-
-
Notifications
You must be signed in to change notification settings - Fork 335
refactor: replace mypy with ty for static type checking #1932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,12 +50,14 @@ def __init__(self, config: BaseConfig) -> None: | |
| setattr(self, attr_name, value) | ||
|
|
||
| def questions(self) -> list[CzQuestion]: | ||
| return self.custom_settings.get("questions", [{}]) # type: ignore[return-value] | ||
| return self.custom_settings.get("questions", [{}]) # type: ignore # noqa: PGH003 | ||
|
|
||
| def message(self, answers: Mapping[str, Any]) -> str: | ||
| message_template = Template(self.custom_settings.get("message_template", "")) | ||
| if getattr(Template, "substitute", None): | ||
| return message_template.substitute(**answers) # type: ignore[attr-defined,no-any-return] # pragma: no cover # TODO: check if we can fix this | ||
| return message_template.substitute( | ||
| **answers | ||
| ) # pragma: no cover # TODO: check if we can fix this | ||
| return message_template.render(**answers) | ||
|
Comment on lines
56
to
61
|
||
|
|
||
| def example(self) -> str: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -316,7 +316,7 @@ def get_core_editor() -> str | None: | |
| return None | ||
|
|
||
|
|
||
| def smart_open(*args, **kwargs): # type: ignore[no-untyped-def,unused-ignore] # noqa: ANN201 | ||
| def smart_open(*args, **kwargs): # noqa: ANN201 | ||
| """Open a file with the EOL style determined from Git.""" | ||
| return open(*args, newline=EOLType.for_open(), **kwargs) | ||
|
Comment on lines
+319
to
321
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152,7 +152,7 @@ def test_version_just_major_error_no_project(config, capsys, argument: str): | |
| commands.Version( | ||
| config, | ||
| { | ||
| argument: True, # type: ignore[misc] | ||
| argument: True, | ||
| }, | ||
|
Comment on lines
152
to
156
|
||
| )() | ||
| captured = capsys.readouterr() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelogexpects aChangelogArgsTypedDict, but here a plaindictcreated via unpacking is passed without a cast. This was previously suppressed with atype: ignoreand may now failty check. Cast the argument toChangelogArgs(as is already done for the laterChangeloginstantiation) to keep the type checker happy and make intent explicit.