Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Surface lowercasetype instead ofType in error messages on Python 3.9 and above#15139

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
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
3 changes: 2 additions & 1 deletionmypy/messages.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2517,7 +2517,8 @@ def format_literal_value(typ: LiteralType) -> str:
else:
return "<nothing>"
elif isinstance(typ, TypeType):
return f"Type[{format(typ.item)}]"
type_name = "type" if options.use_lowercase_names() else "Type"
return f"{type_name}[{format(typ.item)}]"
elif isinstance(typ, FunctionLike):
func = typ
if func.is_type_obj():
Expand Down
7 changes: 7 additions & 0 deletionstest-data/unit/check-lowercase.test
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,3 +42,10 @@ x = 3 # E: Incompatible types in assignment (expression has type "int", variabl
x = {3}
x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "set[int]")
[builtins fixtures/set.pyi]

[case testTypeLowercaseSettingOff]
# flags: --python-version 3.9 --no-force-uppercase-builtins
x: type[type]
y: int

y = x # E: Incompatible types in assignment (expression has type "type[type]", variable has type "int")

[8]ページ先頭

©2009-2025 Movatter.jp