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