Skip to content

Commit

Permalink
Merge pull request #111 from hukkinj1/fix-typehint
Browse files Browse the repository at this point in the history
Fix return type of Env.read_env()
  • Loading branch information
sloria authored Dec 3, 2019
2 parents d834094 + c1d63aa commit 4bec2d7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions environs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pathlib import Path

import marshmallow as ma
from dotenv.main import load_dotenv, DotEnv, _walk_to_root
from dotenv.main import load_dotenv, _walk_to_root

__version__ = "6.1.0"
__all__ = ["EnvError", "Env"]
Expand Down Expand Up @@ -246,7 +246,7 @@ def read_env(
recurse: _BoolType = True,
verbose: _BoolType = False,
override: _BoolType = False,
) -> DotEnv:
) -> None:
"""Read a .env file into os.environ.
If .env is not found in the directory from which this method is called,
Expand All @@ -271,11 +271,12 @@ def read_env(
for dirname in _walk_to_root(start):
check_path = os.path.join(dirname, env_name)
if os.path.exists(check_path):
return load_dotenv(check_path, verbose=verbose, override=override)
load_dotenv(check_path, verbose=verbose, override=override)
return
else:
if path is None:
start = os.path.join(start, ".env")
return load_dotenv(start, verbose=verbose, override=override)
load_dotenv(start, verbose=verbose, override=override)

@contextlib.contextmanager
def prefixed(self, prefix: _StrType) -> typing.Iterator["Env"]:
Expand Down

0 comments on commit 4bec2d7

Please sign in to comment.