chore: replace deprecated EnvironmentError alias with OSError (ruff UP024)#154
Open
alexzhu0 wants to merge 1 commit intoFlowElement-ai:mainfrom
Open
Conversation
…ff UP024) Since Python 3.3, `EnvironmentError` is an alias that resolves to the same class object as `OSError` (`EnvironmentError is OSError` returns True). Ruff's UP024 rule flags the alias as stylistically redundant. Scope: 8 `raise EnvironmentError(...)` sites across 4 files, all in configuration / environment-setup code paths. One trailing docstring reference was updated by hand for consistency. Verification: - No `except EnvironmentError` clauses exist anywhere in the repo, so caller semantics are unchanged; even if any did, they would continue to catch the raised exception because EnvironmentError IS OSError. - `ruff check . --exclude 'm_flow/baml_client' --select UP024` is now clean - `ast.parse` on every touched file: clean No behavior change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ruff rule UP024 flags uses of the
EnvironmentErroralias. Since Python 3.3,EnvironmentErrorisOSError— same class object,EnvironmentError is OSErrorreturnsTrue. The alias is stylistically redundant.8
raise EnvironmentError(...)sites across 4 files, all in configuration / environment-setup code paths.def _require(val: Optional[str], label: str) -> None: if not val: - raise EnvironmentError(f"Missing required configuration: {label}") + raise OSError(f"Missing required configuration: {label}")Caller compatibility
No
except EnvironmentErrorclauses exist anywhere in the repo (grep -rn "except EnvironmentError" --include='*.py' .— zero hits outside generated code), so caller semantics are unchanged. And even if any did appear, they would continue to catch the raised exception becauseEnvironmentError is OSError.Files
m_flow/adapters/graph/get_graph_adapter.pym_flow/adapters/vector/create_vector_engine.pym_flow/context_global_variables.pym_flow/shared/files/utils/get_file_content_hash.py4 files, +9 / −9 (one trailing docstring reference updated by hand for consistency).
Verification
No behavior change. Generated code under
m_flow/baml_client/is untouched.I affirm that all code in every commit of this pull request conforms to the terms of the M-flow Developer Certificate of Origin