Python dotenv.dotenv_values() Examples
The following are 6
code examples of dotenv.dotenv_values().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
dotenv
, or try the search function
.
Example #1
Source File: config.py From seismic-deeplearning with MIT License | 5 votes |
def load_config(dot_env_path: find_dotenv(raise_error_if_not_found=True)): """ Load the variables from the .env file Returns: .env variables(dict) """ logger = logging.getLogger(__name__) logger.info(f"Found config in {dot_env_path}") return dotenv_values(dot_env_path)
Example #2
Source File: config.py From DistributedDeepLearning with MIT License | 5 votes |
def load_config(): """ Load the variables from the .env file Returns: .env variables(dict) """ logger = logging.getLogger(__name__) dot_env_path = find_dotenv(raise_error_if_not_found=True) logger.info(f"Found config in {dot_env_path}") return dotenv_values(dot_env_path)
Example #3
Source File: dotenv.py From gpu_monitor with MIT License | 5 votes |
def populate_args_from_dotenv(func): logger = _logger() try: dotenv_path = find_dotenv(raise_error_if_not_found=True) logger.info('Found .evn, loading variables') env_dict = dotenv_values(dotenv_path=dotenv_path) par_func = partial(func, **env_dict) par_func.__doc__ = func.__doc__ return par_func except IOError: logger.info('Didn\'t find .env') return func
Example #4
Source File: base.py From skiptracer with Apache License 2.0 | 5 votes |
def __init__(self): """ Initialize defaults as needed """ self.env = dotenv_values() self.info_dict = {} self.info_list = [] self.ua = random_line() self.proxy = {}
Example #5
Source File: env_settings.py From pydantic with MIT License | 5 votes |
def read_env_file(file_path: Path, *, encoding: str = None, case_sensitive: bool = False) -> Dict[str, Optional[str]]: try: from dotenv import dotenv_values except ImportError as e: raise ImportError('python-dotenv is not installed, run `pip install pydantic[dotenv]`') from e file_vars: Dict[str, Optional[str]] = dotenv_values(file_path, encoding=encoding) if not case_sensitive: return {k.lower(): v for k, v in file_vars.items()} else: return file_vars
Example #6
Source File: runtime_config.py From FATE with Apache License 2.0 | 4 votes |
def init_env(): RuntimeConfig.ENV.update(dotenv.dotenv_values(dotenv_path=os.path.join(get_project_base_directory(), "fate.env")))