file_utils
pymusas.file_utils
ensure_path
def ensure_path(path: Union[str, Path]) -> Path
Ensure string is converted to a Path.
This is a more restrictive version of spaCy's ensure_path
Parameters¶
- path :
Union[str, Path]
If string, it's converted to Path.
Returns¶
Path
download_url_file
def download_url_file(url: str) -> str
Returns a path to the contents download from the url.
This function will first check if the downloaded content already exists
based on a cached file within the pymusas.config.PYMUSAS_CACHE_HOME directory.
If it does then the cached file path will be returned else the the content
will be downloaded and cached.
Code reference AllenNLP
Parameters¶
- url :
str
The URL address to the file to be downloaded.
Returns¶
str