[docs]deflist_files(path:str,url:str,recursive:bool=True,force_remote:bool=False)->List[str]:""" List the contents of a registered directory or a subdirectory thereof. Args: path: Absolute path of the directory to list. url: URL to the SewerRat REST API. Only used for remote access. recursive: Whether to list the contents recursively. If False, the contents of subdirectories are not listed, and the names of directories are suffxed with ``/`` in the returned list. force_remote: Whether to force remote access via the API, even if ``path`` is on the same filesystem as the caller. Returns: List of strings containing the relative paths of files in ``path``. """ifnotforce_remoteandos.path.exists(path):listing=[]forroot,dirs,filesinos.walk(path):rel=os.path.relpath(root,path)forfinfiles:ifrel!=".":listing.append(os.path.join(rel,f))else:listing.append(f)ifnotrecursive:fordindirs:listing.append(d+"/")breakreturnlistingelse:importurllibres=requests.get(url+"/list?path="+urllib.parse.quote_plus(path)+"&recursive="+str(recursive).lower())ifres.status_code>=300:raiseut.format_error(res)returnres.json()