allensdk.api.cloud_cache.utils module¶
-
allensdk.api.cloud_cache.utils.
bucket_name_from_url
(url: str) → Union[str, NoneType][source]¶ Read in a URL and return the name of the AWS S3 bucket it points towards.
Parameters: - URL: str
A generic URL, suitable for retrieving an S3 object via an HTTP GET request.
Returns: - str
An AWS S3 bucket name. Note: if ‘s3.amazonaws.com’ does not occur in the URL, this method will return None and emit a warning.
-
allensdk.api.cloud_cache.utils.
file_hash_from_path
(file_path: Union[str, pathlib.Path]) → str[source]¶ Return the hexadecimal file hash for a file
Parameters: - file_path: Union[str, Path]
path to a file
Returns: - str:
The file hash (Blake2b; hexadecimal) of the file
-
allensdk.api.cloud_cache.utils.
relative_path_from_url
(url: str) → str[source]¶ Read in a url and return the relative path of the object
Parameters: - url: str
The url of the object whose path you want
Returns: - str:
Relative path of the object
Notes
This method returns a str rather than a pathlib.Path because it is used to get the S3 object Key from a URL. If using Pathlib.path on a Windows system, the ‘/’ will get transformed into ‘’, confusing S3.