Skip to content
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

Support rename=True in collections.namedtuple #17247

Merged
merged 5 commits into from
May 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed May 15, 2024
commit 0873df68d733673d8c4a811e49ad232cc36bacdf
4 changes: 2 additions & 2 deletions mypy/semanal_namedtuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def parse_namedtuple_args(
rename = arg.name == "True"
else:
self.fail(
"Boolean literal expected as the \"rename\" argument to "
'Boolean literal expected as the "rename" argument to '
f"{type_name}()",
arg,
)
Expand Down Expand Up @@ -691,7 +691,7 @@ def save_namedtuple_body(self, named_tuple_info: TypeInfo) -> Iterator[None]:
def check_namedtuple_field_name(self, field: str, seen_names: Container[str]) -> Optional[str]:
"""Return None for valid fields, a string description for invalid ones."""
if field in seen_names:
return f"has duplicate field name \"{field}\""
return f'has duplicate field name "{field}"'
elif not field.isidentifier():
return f'field name "{field}" is not a valid identifier'
elif field.startswith("_"):
Expand Down
Loading