chore: small safety/idiomatic micro-fixes (PYI063, PLW0602, PLW1508)#169
Open
alexzhu0 wants to merge 1 commit into
Open
chore: small safety/idiomatic micro-fixes (PYI063, PLW0602, PLW1508)#169alexzhu0 wants to merge 1 commit into
alexzhu0 wants to merge 1 commit into
Conversation
Four unrelated low-risk lint findings, grouped in one PR: - PYI063: replace dunder positional params with PEP 570 syntax pydantic's `model_post_init(self, __context)` is a hook with the same semantics as `model_post_init(self, context, /)`; use the modern form. Files: adapters/vector/embeddings/config.py, llm/config.py - PLW0602: drop unused `global _last_prune_time` in `_check_prune_cooldown` (read-only function, no rebinding). The other helper that *does* assign keeps its `global` declaration. File: api/v1/prune/routers/get_prune_router.py - PLW1508: `os.getenv(name, default)` requires str|None; passing the int `8000` is silently ignored if the env var is unset on some platforms and will raise on others. Pass "8000" so int() parses it uniformly. File: api/client.py
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
Four unrelated low-risk lint findings grouped in one PR — each is a 1-line, semantics-preserving change.
PYI063 — PEP 570 positional-only syntax (2 sites)
pydantic's
model_post_init(self, __context)hook is identical in meaning tomodel_post_init(self, context, /). Modern form is clearer and recommended by ruff (__prefix is legacy mypy syntax, deprecated in favor of/since 3.8).adapters/vector/embeddings/config.py:44llm/config.py:129PLW0602 — drop dead
globaldeclaration (1 site)_check_prune_cooldownonly reads_last_prune_time, so theglobalis no-op noise. The companion_update_last_prune_time(which actually assigns) keeps itsglobaldeclaration, untouched.api/v1/prune/routers/get_prune_router.py:214PLW1508 —
os.getenvdefault must be str|None (1 site)os.getenv("HTTP_API_PORT", 8000)passes an int as default. CPython tolerates this today but typeshed types the second arg asstr | Noneand ruff flags it. Trivial fix:"8000"soint(...)parses it uniformly.api/client.py:359Verification
No behavioral change in any of the four cases.
I affirm that all code in every commit of this pull request conforms to the terms of the M-flow Developer Certificate of Origin