theskumar / python-dotenv

Reads key-value pairs from a .env file and can set them as environment variables. It helps in developing applications following the 12-factor principles.
https://saurabh-kumar.com/python-dotenv/
BSD 3-Clause "New" or "Revised" License
7.55k stars 425 forks source link

Fix wrong type annotations #517

Open oliversen opened 4 months ago

Matoran commented 4 months ago

They are correct you can use dotenv_path or stream to create a dotenv (which make both optionals). Encoding is also optional for tempfile https://docs.python.org/3/library/tempfile.html.

oliversen commented 4 months ago

If the Optional type is specified, then we must set the default value for the parameter. In this case, it is necessary to rewrite further code. Correctly dotenv_path: StrPath or dotenv_path: Optional[StrPath] = None

Matoran commented 4 months ago

I agree with dotenv_path: Optional[StrPath] = None, the DotEnv object is build on load_dotenv which first arg is dotenv_path: Optional[StrPath] = None.