From 4a79b5978832d1f75029a92f2ec3dbc4f07630cb Mon Sep 17 00:00:00 2001 From: creepereye1204 Date: Thu, 24 Apr 2025 07:16:01 +0000 Subject: [PATCH 1/4] Fix: Use FileNotFoundError for file not found in main.py Replaced IOError with FileNotFoundError on line 320 of main.py to use a more specific and appropriate exception for file not found errors. --- src/dotenv/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dotenv/main.py b/src/dotenv/main.py index 1848d602..7d64d812 100644 --- a/src/dotenv/main.py +++ b/src/dotenv/main.py @@ -317,9 +317,10 @@ def _is_debugger(): return check_path if raise_error_if_not_found: - raise IOError("File not found") - + raise FileNotFoundError("File not found") return "" + + def load_dotenv( From c6b59dac0a987f6432ce5facbba30f1d3a259c73 Mon Sep 17 00:00:00 2001 From: creepereye1204 Date: Thu, 24 Apr 2025 07:21:14 +0000 Subject: [PATCH 2/4] Fix: Use FileNotFoundError for file not found in main.py Replaced IOError with FileNotFoundError on line 320 of main.py to use a more specific and appropriate exception for file not found errors. --- src/dotenv/main.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/dotenv/main.py b/src/dotenv/main.py index 7d64d812..96da29a5 100644 --- a/src/dotenv/main.py +++ b/src/dotenv/main.py @@ -319,8 +319,6 @@ def _is_debugger(): if raise_error_if_not_found: raise FileNotFoundError("File not found") return "" - - def load_dotenv( From b85f2773ed28ed80fa48560f2ba898aebcccd379 Mon Sep 17 00:00:00 2001 From: creepereye1204 Date: Thu, 24 Apr 2025 07:28:10 +0000 Subject: [PATCH 3/4] Refactor: Remove unused quote_mode parameter from unset_key Remove the quote_mode parameter from the unset_key function in main.py. This parameter was identified as unused within the function body and has been removed to simplify the signature. --- src/dotenv/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/dotenv/main.py b/src/dotenv/main.py index 96da29a5..60820fe4 100644 --- a/src/dotenv/main.py +++ b/src/dotenv/main.py @@ -200,7 +200,6 @@ def set_key( def unset_key( dotenv_path: StrPath, key_to_unset: str, - quote_mode: str = "always", encoding: Optional[str] = "utf-8", ) -> Tuple[Optional[bool], str]: """ From e9271693beb138511fbcbd522750e4ef08b17aca Mon Sep 17 00:00:00 2001 From: creepereye1204 Date: Thu, 24 Apr 2025 09:50:53 +0000 Subject: [PATCH 4/4] Fix: Use FileNotFoundError for file not found in main.py Replaced IOError with FileNotFoundError on line 320 of main.py to use a more specific and appropriate exception for file not found errors. --- src/dotenv/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dotenv/main.py b/src/dotenv/main.py index 60820fe4..96da29a5 100644 --- a/src/dotenv/main.py +++ b/src/dotenv/main.py @@ -200,6 +200,7 @@ def set_key( def unset_key( dotenv_path: StrPath, key_to_unset: str, + quote_mode: str = "always", encoding: Optional[str] = "utf-8", ) -> Tuple[Optional[bool], str]: """