cleanup: import NoReturn properly + remove unused argparse + fix f-string placeholder#3
Open
fadai216 wants to merge 1 commit into
Open
Conversation
… placeholder Three small lints flagged by pyflakes: - scripts/kya_lib.py: 'NoReturn' was written as a string forward-reference with a type:ignore, hiding the real fix: just import it from typing. Now the return type is a proper annotation instead of a stringly-typed hack. - scripts/sign-kyc.py:115: f-string had no placeholders - dropped the 'f' prefix. - scripts/sign.py:24: argparse was imported but unused (script uses base_parser from kya_lib); removed. All three files pass python3 -m py_compile. scripts/test_kya_lib.py still passes 22/22 tests.
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.
Three small lints flagged by
pyflakes scripts/:1.
kya_lib.py: importNoReturnproperlydie()was annotated as-> "NoReturn"(string forward-reference) with a# type: ignore[name-defined]to paper over the missing import. The clean fix is to just addNoReturnto the existingtypingimport:Now mypy / pyright / pyflakes all resolve the name correctly instead of silently trusting the
type: ignore.2.
sign-kyc.py:115: f-string without placeholders (F541)Semantically identical, avoids the
f""tripwire that makes future readers look for interpolation that isn't there.3.
sign.py:24: unusedimport argparseScript uses
base_parserfromkya_lib(a pre-configuredArgumentParser), never touchesargparsedirectly. Removed.Verification
python3 -m py_compilescripts/test_kya_lib.pystill passes 22/22 testspyflakes scripts/output clean for the 3 flagged items