| Conditions | 6 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | import os |
||
| 13 | def read_dotenv(dotenv_path: str): |
||
| 14 | with closing(open(dotenv_path, 'r')) as file: |
||
| 15 | for line in file: |
||
| 16 | line = line.rstrip(os.linesep) |
||
| 17 | |||
| 18 | if not line or line.startswith('#') or '=' not in line: |
||
| 19 | continue |
||
| 20 | |||
| 21 | env_key, env_value = line.split('=', 1) |
||
| 22 | env_value = env_value.strip("'").strip('"') |
||
| 23 | |||
| 24 | yield env_key, env_value |
||
| 25 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.