Utilities¶
Utilities for Bio2BEL.
-
bio2bel.utils.
get_data_dir
(module_name)[source]¶ Ensure the appropriate Bio2BEL data directory exists for the given module, then returns the file path.
-
bio2bel.utils.
prefix_directory_join
(prefix, *parts)[source]¶ Join the parts onto the prefix directory.
- Return type
-
bio2bel.utils.
ensure_path
(prefix, url, *, path=None, use_requests=False, force=False, bucket=None, s3_client=None)[source]¶ Download a file if it doesn’t exist.
-
bio2bel.utils.
get_connection
(connection=None)[source]¶ Return the SQLAlchemy connection string if it is set.
Order of operations:
Return the connection if given as a parameter
Check the environment for BIO2BEL_{module_name}_CONNECTION
Look in the bio2bel config file for module-specific connection. Create if doesn’t exist. Check the module-specific section for
connection
Look in the bio2bel module folder for a config file. Don’t create if doesn’t exist. Check the default section for
connection
Check the environment for BIO2BEL_CONNECTION
Check the bio2bel config file for default
Fall back to standard default cache connection