[docs]deflist_files(project:str,asset:str,version:str,registry:str,url:str,prefix:Optional[str]=None,include_dotdot:bool=True,force_remote:bool=False)->List[str]:""" List the contents of a version of a project asset. Args: project: The name of the project. asset: The name of the asset in ``project``. version: The name of the version of the ``asset``. registry: Path to the registry. url: URL to the Gobbler REST API. Only used for remote access. prefix: Prefix for the path within this version's subdirectory. If provided, files are only listed if they have a relative path (i.e., inside the version subdirectory) that starts with this prefix. If None, all files associated with this version are listed. include_dotdot: Whether to list files with path components that start with ``..``. force_remote: Whether to force remote access via the API, even if ``registry`` is on the same filesystem as the caller. Returns: List of strings containing the relative paths of files associated with the versioned asset. All paths will start with ``prefix`` if provided. """suffix_filter=NoneifprefixisnotNone:ifprefix.endswith("/"):prefix=prefix[:-1]else:suffix_filter=os.path.basename(prefix)prefix=os.path.dirname(prefix)ifprefix=="":prefix=Nonelisting=[]ifnotforce_remoteandos.path.exists(registry):target=os.path.join(registry,project,asset,version)ifprefixisnotNone:target=os.path.join(target,prefix)forroot,dirs,filesinos.walk(target):rel=os.path.relpath(root,target)forfinfiles:ifinclude_dotdotornotf.startswith(".."):ifrel!=".":listing.append(os.path.join(rel,f))else:listing.append(f)else:target=project+"/"+asset+"/"+versionifprefixisnotNone:target+="/"+prefiximporturllibres=requests.get(url+"/list?path="+urllib.parse.quote_plus(target)+"&recursive=true")ifres.status_code>=300:raiseut.format_error(res)body=res.json()ifinclude_dotdot:listing=bodyelse:listing=filter(lambdax:notx.startswith("..")andx.find("/..")==-1,body)ifsuffix_filterisnotNone:listing=filter(lambdax:x.startswith(suffix_filter),listing)ifprefixisnotNone:fori,xinenumerate(listing):listing[i]=prefix+"/"+xreturnlisting