-
Notifications
You must be signed in to change notification settings - Fork 243
[RFC] Canonicalize type as type[Any]
#1986
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: main
Are you sure you want to change the base?
[RFC] Canonicalize type as type[Any]
#1986
Conversation
|
cc @grievejia who authored 6767f68 |
type as type[Any]
This comment has been minimized.
This comment has been minimized.
This diff canonicalised the builtin type (which is a class) as a `Type::Type` with an implicit `Any`. The typing spec (https://typing.python.org/en/latest/spec/special-types.html#type) requires that "Plain `type` without brackets, the root of Python’s metaclass hierarchy, is equivalent to `type[Any]`." Whereas assignments of `type` and `type[Any]` are allowed by Pyrefly before this diff, they are not considered as identical types by `assert_type` call. After the canonicalisation introduced by this diff, they are considered as identical. As a result, we are able to pass 3 more conformance test cases. Since `type` itself is a class, we need to add some special treatment in the type system on inheritance, so that it can be inherited and used as a metaclass, while being a `Type::Type`. Some of the treatments are similar to how `tuple` is handled.
9e2f02e to
739a5b5
Compare
|
Diff from mypy_primer, showing the effect of this PR on open source code: psycopg (https://github.com/psycopg/psycopg)
- ERROR psycopg/psycopg/_queries.py:400:5-446:15: `type[int] | type[str] | type[Unknown] | None` is not assignable to `None` (caused by inconsistent types when breaking cycles) [bad-assignment]
+ ERROR psycopg/psycopg/_queries.py:400:5-446:15: `type[int] | type[str] | type | None` is not assignable to `None` (caused by inconsistent types when breaking cycles) [bad-assignment]
- ::error file=psycopg/psycopg/_queries.py,line=400,col=5,endLine=446,endColumn=15,title=Pyrefly bad-assignment::`type[int] | type[str] | type[Unknown] | None` is not assignable to `None` (caused by inconsistent types when breaking cycles)
+ ::error file=psycopg/psycopg/_queries.py,line=400,col=5,endLine=446,endColumn=15,title=Pyrefly bad-assignment::`type[int] | type[str] | type | None` is not assignable to `None` (caused by inconsistent types when breaking cycles)
egglog-python (https://github.com/egraphs-good/egglog-python)
- ERROR python/egglog/runtime.py:434:28-33: Expected a type form, got instance of `type` [not-a-type]
- ::error file=python/egglog/runtime.py,line=434,col=28,endLine=434,endColumn=33,title=Pyrefly not-a-type::Expected a type form, got instance of `type`
AutoSplit (https://github.com/Toufool/AutoSplit)
- ERROR src/menu_bar.py:206:18-29: Object of class `type` has no attribute `name` [missing-attribute]
- ERROR src/menu_bar.py:206:33-57: Object of class `type` has no attribute `short_description` [missing-attribute]
- ERROR src/menu_bar.py:210:20-31: Object of class `type` has no attribute `name` [missing-attribute]
- ERROR src/menu_bar.py:210:37-55: Object of class `type` has no attribute `description` [missing-attribute]
- ::error file=src/menu_bar.py,line=206,col=18,endLine=206,endColumn=29,title=Pyrefly missing-attribute::Object of class `type` has no attribute `name`
- ::error file=src/menu_bar.py,line=206,col=33,endLine=206,endColumn=57,title=Pyrefly missing-attribute::Object of class `type` has no attribute `short_description`
- ::error file=src/menu_bar.py,line=210,col=20,endLine=210,endColumn=31,title=Pyrefly missing-attribute::Object of class `type` has no attribute `name`
- ::error file=src/menu_bar.py,line=210,col=37,endLine=210,endColumn=55,title=Pyrefly missing-attribute::Object of class `type` has no attribute `description`
python-chess (https://github.com/niklasf/python-chess)
- ERROR chess/syzygy.py:993:9-1000:72: `int | type[Unknown]` is not assignable to `int` (caused by inconsistent types when breaking cycles) [bad-assignment]
+ ERROR chess/syzygy.py:993:9-1000:72: `int | type` is not assignable to `int` (caused by inconsistent types when breaking cycles) [bad-assignment]
- ::error file=chess/syzygy.py,line=993,col=9,endLine=1000,endColumn=72,title=Pyrefly bad-assignment::`int | type[Unknown]` is not assignable to `int` (caused by inconsistent types when breaking cycles)
+ ::error file=chess/syzygy.py,line=993,col=9,endLine=1000,endColumn=72,title=Pyrefly bad-assignment::`int | type` is not assignable to `int` (caused by inconsistent types when breaking cycles)
kornia (https://github.com/kornia/kornia)
+ ERROR kornia/core/check.py:309:37-49: Object of class `object` has no attribute `__name__` [missing-attribute]
+ ERROR kornia/core/check.py:309:96-106: Object of class `object` has no attribute `__name__` [missing-attribute]
+ ::error file=kornia/core/check.py,line=309,col=37,endLine=309,endColumn=49,title=Pyrefly missing-attribute::Object of class `object` has no attribute `__name__`%0A Did you mean `__ne__`?
+ ::error file=kornia/core/check.py,line=309,col=96,endLine=309,endColumn=106,title=Pyrefly missing-attribute::Object of class `object` has no attribute `__name__`%0A Did you mean `__ne__`?
dulwich (https://github.com/dulwich/dulwich)
- ERROR dulwich/commit_graph.py:313:29-40: Argument `type[Unknown]` is not assignable to parameter `commit_time` with type `int` in function `CommitGraphEntry.__init__` [bad-argument-type]
+ ERROR dulwich/commit_graph.py:313:29-40: Argument `type` is not assignable to parameter `commit_time` with type `int` in function `CommitGraphEntry.__init__` [bad-argument-type]
- ::error file=dulwich/commit_graph.py,line=313,col=29,endLine=313,endColumn=40,title=Pyrefly bad-argument-type::Argument `type[Unknown]` is not assignable to parameter `commit_time` with type `int` in function `CommitGraphEntry.__init__`
+ ::error file=dulwich/commit_graph.py,line=313,col=29,endLine=313,endColumn=40,title=Pyrefly bad-argument-type::Argument `type` is not assignable to parameter `commit_time` with type `int` in function `CommitGraphEntry.__init__`
django-stubs (https://github.com/typeddjango/django-stubs)
- ERROR ext/django_stubs_ext/patch.py:128:13-34: Object of class `type` has no attribute `__class_getitem__` [missing-attribute]
- ::error file=ext/django_stubs_ext/patch.py,line=128,col=13,endLine=128,endColumn=34,title=Pyrefly missing-attribute::Object of class `type` has no attribute `__class_getitem__`
schemathesis (https://github.com/schemathesis/schemathesis)
+ ERROR src/schemathesis/core/registries.py:18:21-34: Object of class `object` has no attribute `__name__` [missing-attribute]
+ ::error file=src/schemathesis/core/registries.py,line=18,col=21,endLine=18,endColumn=34,title=Pyrefly missing-attribute::Object of class `object` has no attribute `__name__`%0A Did you mean `__ne__`?
bandersnatch (https://github.com/pypa/bandersnatch)
+ ERROR src/bandersnatch/filter.py:42:33-62: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch/filter.py:46:25-54: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch/filter.py:103:16-47: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch/filter.py:107:16-47: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch/filter.py:170:30-52: `type` is not subscriptable [unsupported-operation]
- ERROR src/bandersnatch/filter.py:41:13-48: `not in` is not supported between `Literal['plugins']` and `type` [not-iterable]
- ERROR src/bandersnatch/filter.py:42:33-62: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch/filter.py:46:25-54: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch/filter.py:103:16-47: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch/filter.py:107:16-47: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch/filter.py:170:30-52: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch/main.py:222:23-33: Object of class `type` has no attribute `get` [missing-attribute]
- ERROR src/bandersnatch/tests/mock_config.py:15:5-19: Object of class `type` has no attribute `clear` [missing-attribute]
- ERROR src/bandersnatch/tests/mock_config.py:17:5-33: Object of class `type` has no attribute `_read_defaults_file` [missing-attribute]
- ERROR src/bandersnatch/tests/mock_config.py:19:5-25: Object of class `type` has no attribute `read_string` [missing-attribute]
+ ERROR src/bandersnatch/tests/test_configuration.py:58:41-59: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch/tests/test_configuration.py:108:29-47: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch/tests/test_configuration.py:115:26-44: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch/tests/test_configuration.py:121:30-48: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch/tests/test_configuration.py:127:26-44: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch/tests/test_configuration.py:135:26-45: `type` is not subscriptable [unsupported-operation]
- ERROR src/bandersnatch/tests/test_configuration.py:54:36-53: Object of class `type` has no attribute `sections` [missing-attribute]
- ERROR src/bandersnatch/tests/test_configuration.py:58:41-59: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch/tests/test_configuration.py:108:29-47: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch/tests/test_configuration.py:113:9-29: Object of class `type` has no attribute `read_string` [missing-attribute]
- ERROR src/bandersnatch/tests/test_configuration.py:115:26-44: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch/tests/test_configuration.py:119:9-29: Object of class `type` has no attribute `read_string` [missing-attribute]
- ERROR src/bandersnatch/tests/test_configuration.py:121:30-48: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch/tests/test_configuration.py:125:9-29: Object of class `type` has no attribute `read_string` [missing-attribute]
- ERROR src/bandersnatch/tests/test_configuration.py:127:26-44: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch/tests/test_configuration.py:131:9-30: Object of class `type` has no attribute `read_string` [missing-attribute]
- ERROR src/bandersnatch/tests/test_configuration.py:135:26-45: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch/tests/test_configuration.py:175:9-51: Cannot index into `type` [bad-index]
+ ERROR src/bandersnatch/tests/test_configuration.py:175:9-51: `type` is not subscriptable [unsupported-operation]
- ERROR src/bandersnatch/tests/test_configuration.py:199:9-51: Cannot index into `type` [bad-index]
+ ERROR src/bandersnatch/tests/test_configuration.py:199:9-51: `type` is not subscriptable [unsupported-operation]
- ERROR src/bandersnatch/tests/test_configuration.py:226:9-36: Cannot index into `type` [bad-index]
+ ERROR src/bandersnatch/tests/test_configuration.py:226:9-36: `type` is not subscriptable [unsupported-operation]
- ERROR src/bandersnatch/tests/test_configuration.py:247:9-36: Cannot index into `type` [bad-index]
+ ERROR src/bandersnatch/tests/test_configuration.py:247:9-36: `type` is not subscriptable [unsupported-operation]
- ERROR src/bandersnatch/tests/test_configuration.py:253:9-37: Cannot index into `type` [bad-index]
+ ERROR src/bandersnatch/tests/test_configuration.py:253:9-37: `type` is not subscriptable [unsupported-operation]
- ERROR src/bandersnatch/tests/test_configuration.py:263:12-29: Object of class `type` has no attribute `has_option` [missing-attribute]
- ERROR src/bandersnatch/tests/test_configuration.py:264:13-33: Object of class `type` has no attribute `remove_option` [missing-attribute]
- ERROR src/bandersnatch/tests/test_configuration.py:320:17-30: Object of class `type` has no attribute `read_dict` [missing-attribute]
- ERROR src/bandersnatch/tests/test_delete.py:82:5-35: Object of class `type` has no attribute `read_dict` [missing-attribute]
- ERROR src/bandersnatch/tests/test_filter.py:122:9-29: Object of class `type` has no attribute `read_string` [missing-attribute]
- ERROR src/bandersnatch/tests/test_mirror.py:1251:5-21: Object of class `type` has no attribute `read_dict` [missing-attribute]
- ERROR src/bandersnatch/tests/test_mirror.py:1334:5-21: Object of class `type` has no attribute `read_dict` [missing-attribute]
- ERROR src/bandersnatch_filter_plugins/latest_name.py:30:29-65: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch_filter_plugins/latest_name.py:38:23-59: Cannot index into `type` [bad-index]
+ ERROR src/bandersnatch_filter_plugins/latest_name.py:30:29-65: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch_filter_plugins/latest_name.py:38:23-59: `type` is not subscriptable [unsupported-operation]
- ERROR src/bandersnatch_filter_plugins/metadata_filter.py:36:36-65: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch_filter_plugins/metadata_filter.py:198:38-81: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch_filter_plugins/metadata_filter.py:271:36-273:14: Cannot index into `type` [bad-index]
+ ERROR src/bandersnatch_filter_plugins/metadata_filter.py:36:36-65: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch_filter_plugins/metadata_filter.py:198:38-81: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch_filter_plugins/metadata_filter.py:271:36-273:14: `type` is not subscriptable [unsupported-operation]
- ERROR src/bandersnatch_filter_plugins/prerelease_name.py:40:25-64: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch_filter_plugins/regex_name.py:26:22-56: Cannot index into `type` [bad-index]
- ERROR src/bandersnatch_filter_plugins/regex_name.py:60:22-56: Cannot index into `type` [bad-index]
+ ERROR src/bandersnatch_filter_plugins/prerelease_name.py:40:25-64: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch_filter_plugins/regex_name.py:26:22-56: `type` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch_filter_plugins/regex_name.py:60:22-56: `type` is not subscriptable [unsupported-operation]
+ ::error file=src/bandersnatch/filter.py,line=42,col=33,endLine=42,endColumn=62,title=Pyrefly unsupported-operation::`type` is not subscriptable
+ ::error file=src/bandersnatch/filter.py,line=46,col=25,endLine=46,endColumn=54,title=Pyrefly unsupported-operation::`type` is not subscriptable
+ ::error file=src/bandersnatch/filter.py,line=103,col=16,endLine=103,endColumn=47,title=Pyrefly unsupported-operation::`type` is not subscriptable
+ ::error file=src/bandersnatch/filter.py,line=107,col=16,endLine=107,endColumn=47,title=Pyrefly unsupported-operation::`type` is not subscriptable
+ ::error file=src/bandersnatch/filter.py,line=170,col=30,endLine=170,endColumn=52,title=Pyrefly unsupported-operation::`type` is not subscriptable
- ::error file=src/bandersnatch/filter.py,line=41,col=13,endLine=41,endColumn=48,title=Pyrefly not-iterable::`not in` is not supported between `Literal['plugins']` and `type`
- ::error file=src/bandersnatch/filter.py,line=42,col=33,endLine=42,endColumn=62,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
- ::error file=src/bandersnatch/filter.py,line=46,col=25,endLine=46,endColumn=54,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
- ::error file=src/bandersnatch/filter.py,line=103,col=16,endLine=103,endColumn=47,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
- ::error file=src/bandersnatch/filter.py,line=107,col=16,endLine=107,endColumn=47,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
- ::error file=src/bandersnatch/filter.py,line=170,col=30,endLine=170,endColumn=52,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
- ::error file=src/bandersnatch/main.py,line=222,col=23,endLine=222,endColumn=33,title=Pyrefly missing-attribute::Object of class `type` has no attribute `get`
- ::error file=src/bandersnatch/tests/mock_config.py,line=15,col=5,endLine=15,endColumn=19,title=Pyrefly missing-attribute::Object of class `type` has no attribute `clear`
- ::error file=src/bandersnatch/tests/mock_config.py,line=17,col=5,endLine=17,endColumn=33,title=Pyrefly missing-attribute::Object of class `type` has no attribute `_read_defaults_file`
- ::error file=src/bandersnatch/tests/mock_config.py,line=19,col=5,endLine=19,endColumn=25,title=Pyrefly missing-attribute::Object of class `type` has no attribute `read_string`
+ ::error file=src/bandersnatch/tests/test_configuration.py,line=58,col=41,endLine=58,endColumn=59,title=Pyrefly unsupported-operation::`type` is not subscriptable
+ ::error file=src/bandersnatch/tests/test_configuration.py,line=108,col=29,endLine=108,endColumn=47,title=Pyrefly unsupported-operation::`type` is not subscriptable
+ ::error file=src/bandersnatch/tests/test_configuration.py,line=115,col=26,endLine=115,endColumn=44,title=Pyrefly unsupported-operation::`type` is not subscriptable
+ ::error file=src/bandersnatch/tests/test_configuration.py,line=121,col=30,endLine=121,endColumn=48,title=Pyrefly unsupported-operation::`type` is not subscriptable
+ ::error file=src/bandersnatch/tests/test_configuration.py,line=127,col=26,endLine=127,endColumn=44,title=Pyrefly unsupported-operation::`type` is not subscriptable
- ::error file=src/bandersnatch/tests/test_configuration.py,line=54,col=36,endLine=54,endColumn=53,title=Pyrefly missing-attribute::Object of class `type` has no attribute `sections`
+ ::error file=src/bandersnatch/tests/test_configuration.py,line=135,col=26,endLine=135,endColumn=45,title=Pyrefly unsupported-operation::`type` is not subscriptable
- ::error file=src/bandersnatch/tests/test_configuration.py,line=58,col=41,endLine=58,endColumn=59,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
- ::error file=src/bandersnatch/tests/test_configuration.py,line=108,col=29,endLine=108,endColumn=47,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
- ::error file=src/bandersnatch/tests/test_configuration.py,line=113,col=9,endLine=113,endColumn=29,title=Pyrefly missing-attribute::Object of class `type` has no attribute `read_string`
- ::error file=src/bandersnatch/tests/test_configuration.py,line=115,col=26,endLine=115,endColumn=44,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
- ::error file=src/bandersnatch/tests/test_configuration.py,line=119,col=9,endLine=119,endColumn=29,title=Pyrefly missing-attribute::Object of class `type` has no attribute `read_string`
- ::error file=src/bandersnatch/tests/test_configuration.py,line=121,col=30,endLine=121,endColumn=48,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
- ::error file=src/bandersnatch/tests/test_configuration.py,line=125,col=9,endLine=125,endColumn=29,title=Pyrefly missing-attribute::Object of class `type` has no attribute `read_string`
- ::error file=src/bandersnatch/tests/test_configuration.py,line=127,col=26,endLine=127,endColumn=44,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
- ::error file=src/bandersnatch/tests/test_configuration.py,line=131,col=9,endLine=131,endColumn=30,title=Pyrefly missing-attribute::Object of class `type` has no attribute `read_string`
- ::error file=src/bandersnatch/tests/test_configuration.py,line=135,col=26,endLine=135,endColumn=45,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
- ::error file=src/bandersnatch/tests/test_configuration.py,line=175,col=9,endLine=175,endColumn=51,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
+ ::error file=src/bandersnatch/tests/test_configuration.py,line=175,col=9,endLine=175,endColumn=51,title=Pyrefly unsupported-operation::`type` is not subscriptable
- ::error file=src/bandersnatch/tests/test_configuration.py,line=199,col=9,endLine=199,endColumn=51,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
+ ::error file=src/bandersnatch/tests/test_configuration.py,line=199,col=9,endLine=199,endColumn=51,title=Pyrefly unsupported-operation::`type` is not subscriptable
- ::error file=src/bandersnatch/tests/test_configuration.py,line=226,col=9,endLine=226,endColumn=36,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
+ ::error file=src/bandersnatch/tests/test_configuration.py,line=226,col=9,endLine=226,endColumn=36,title=Pyrefly unsupported-operation::`type` is not subscriptable
- ::error file=src/bandersnatch/tests/test_configuration.py,line=247,col=9,endLine=247,endColumn=36,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
+ ::error file=src/bandersnatch/tests/test_configuration.py,line=247,col=9,endLine=247,endColumn=36,title=Pyrefly unsupported-operation::`type` is not subscriptable
- ::error file=src/bandersnatch/tests/test_configuration.py,line=253,col=9,endLine=253,endColumn=37,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
+ ::error file=src/bandersnatch/tests/test_configuration.py,line=253,col=9,endLine=253,endColumn=37,title=Pyrefly unsupported-operation::`type` is not subscriptable
- ::error file=src/bandersnatch/tests/test_configuration.py,line=263,col=12,endLine=263,endColumn=29,title=Pyrefly missing-attribute::Object of class `type` has no attribute `has_option`
- ::error file=src/bandersnatch/tests/test_configuration.py,line=264,col=13,endLine=264,endColumn=33,title=Pyrefly missing-attribute::Object of class `type` has no attribute `remove_option`
- ::error file=src/bandersnatch/tests/test_configuration.py,line=320,col=17,endLine=320,endColumn=30,title=Pyrefly missing-attribute::Object of class `type` has no attribute `read_dict`
- ::error file=src/bandersnatch/tests/test_delete.py,line=82,col=5,endLine=82,endColumn=35,title=Pyrefly missing-attribute::Object of class `type` has no attribute `read_dict`
- ::error file=src/bandersnatch/tests/test_filter.py,line=122,col=9,endLine=122,endColumn=29,title=Pyrefly missing-attribute::Object of class `type` has no attribute `read_string`
- ::error file=src/bandersnatch/tests/test_mirror.py,line=1251,col=5,endLine=1251,endColumn=21,title=Pyrefly missing-attribute::Object of class `type` has no attribute `read_dict`
- ::error file=src/bandersnatch/tests/test_mirror.py,line=1334,col=5,endLine=1334,endColumn=21,title=Pyrefly missing-attribute::Object of class `type` has no attribute `read_dict`
- ::error file=src/bandersnatch_filter_plugins/latest_name.py,line=30,col=29,endLine=30,endColumn=65,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
- ::error file=src/bandersnatch_filter_plugins/latest_name.py,line=38,col=23,endLine=38,endColumn=59,title=Pyrefly bad-index::Cannot index into `type`%0A Object of class `type` has no attribute `__getitem__`
... (truncated 14 lines) ...
discord.py (https://github.com/Rapptz/discord.py)
- ERROR discord/utils.py:743:24-37: Object of class `type` has no attribute `__slots__` [missing-attribute]
- ::error file=discord/utils.py,line=743,col=24,endLine=743,endColumn=37,title=Pyrefly missing-attribute::Object of class `type` has no attribute `__slots__`%0A Did you mean `__flags__`?
zope.interface (https://github.com/zopefoundation/zope.interface)
- ERROR src/zope/interface/tests/test_interface.py:2187:9-44: Object of class `type` has no attribute `setTaggedValue` [missing-attribute]
- ERROR src/zope/interface/tests/test_interface.py:2208:26-50: Object of class `type` has no attribute `queryDirectTaggedValue` [missing-attribute]
- ERROR src/zope/interface/tests/test_interface.py:2209:26-48: Object of class `type` has no attribute `getDirectTaggedValue` [missing-attribute]
- ERROR src/zope/interface/tests/test_interface.py:2210:40-66: Object of class `type` has no attribute `getDirectTaggedValueTags` [missing-attribute]
- ::error file=src/zope/interface/tests/test_interface.py,line=2187,col=9,endLine=2187,endColumn=44,title=Pyrefly missing-attribute::Object of class `type` has no attribute `setTaggedValue`
- ::error file=src/zope/interface/tests/test_interface.py,line=2208,col=26,endLine=2208,endColumn=50,title=Pyrefly missing-attribute::Object of class `type` has no attribute `queryDirectTaggedValue`
- ::error file=src/zope/interface/tests/test_interface.py,line=2209,col=26,endLine=2209,endColumn=48,title=Pyrefly missing-attribute::Object of class `type` has no attribute `getDirectTaggedValue`
- ::error file=src/zope/interface/tests/test_interface.py,line=2210,col=40,endLine=2210,endColumn=66,title=Pyrefly missing-attribute::Object of class `type` has no attribute `getDirectTaggedValueTags`
pandera (https://github.com/pandera-dev/pandera)
- ERROR pandera/api/dataframe/model.py:434:13-30: Object of class `type` has no attribute `Config` [missing-attribute]
- ERROR pandera/io/pandas_io.py:67:38-42: Type `type` is not iterable [not-iterable]
- ERROR tests/io/test_pandas_io.py:1578:37-45: Argument `type[Unknown] | Unknown` is not assignable to parameter `other` with type `DataFrame | Series[Any]` in function `pandas.core.frame.DataFrame.equals` [bad-argument-type]
+ ERROR tests/io/test_pandas_io.py:1578:37-45: Argument `type | Unknown` is not assignable to parameter `other` with type `DataFrame | Series[Any]` in function `pandas.core.frame.DataFrame.equals` [bad-argument-type]
- ::error file=pandera/api/dataframe/model.py,line=434,col=13,endLine=434,endColumn=30,title=Pyrefly missing-attribute::Object of class `type` has no attribute `Config`
- ::error file=pandera/io/pandas_io.py,line=67,col=38,endLine=67,endColumn=42,title=Pyrefly not-iterable::Type `type` is not iterable
- ::error file=tests/io/test_pandas_io.py,line=1578,col=37,endLine=1578,endColumn=45,title=Pyrefly bad-argument-type::Argument `type[Unknown] | Unknown` is not assignable to parameter `other` with type `DataFrame | Series[Any]` in function `pandas.core.frame.DataFrame.equals`
+ ::error file=tests/io/test_pandas_io.py,line=1578,col=37,endLine=1578,endColumn=45,title=Pyrefly bad-argument-type::Argument `type | Unknown` is not assignable to parameter `other` with type `DataFrame | Series[Any]` in function `pandas.core.frame.DataFrame.equals`
streamlit (https://github.com/streamlit/streamlit)
- ERROR lib/streamlit/vendor/pympler/asizeof.py:1143:28-32: Cannot set item in `dict[_Claskey | type[Unknown] | Unknown, None]` [unsupported-operation]
+ ERROR lib/streamlit/vendor/pympler/asizeof.py:1143:28-32: Cannot set item in `dict[_Claskey | type | Unknown, None]` [unsupported-operation]
- ERROR lib/streamlit/vendor/pympler/asizeof.py:1147:32-1149:18: Cannot set item in `dict[_Claskey | type[Unknown] | Unknown, None]` [unsupported-operation]
+ ERROR lib/streamlit/vendor/pympler/asizeof.py:1147:32-1149:18: Cannot set item in `dict[_Claskey | type | Unknown, None]` [unsupported-operation]
- ERROR lib/streamlit/vendor/pympler/asizeof.py:1156:28-1158:14: Cannot set item in `dict[_Claskey | type[Unknown] | Unknown, None]` [unsupported-operation]
+ ERROR lib/streamlit/vendor/pympler/asizeof.py:1156:28-1158:14: Cannot set item in `dict[_Claskey | type | Unknown, None]` [unsupported-operation]
- ERROR lib/streamlit/vendor/pympler/asizeof.py:1937:16-33: `in` is not supported between `type[Unknown]` and `None` [not-iterable]
+ ERROR lib/streamlit/vendor/pympler/asizeof.py:1937:16-33: `in` is not supported between `type` and `None` [not-iterable]
- ERROR lib/streamlit/vendor/pympler/asizeof.py:1942:21-33: Cannot set item in `dict[_Claskey | type[Unknown] | Unknown, None]` [unsupported-operation]
+ ERROR lib/streamlit/vendor/pympler/asizeof.py:1942:21-33: Cannot set item in `dict[_Claskey | type | Unknown, None]` [unsupported-operation]
- ERROR lib/streamlit/vendor/pympler/asizeof.py:2726:28-29: Cannot set item in `dict[_Claskey | type[Unknown] | Unknown, None]` [unsupported-operation]
+ ERROR lib/streamlit/vendor/pympler/asizeof.py:2726:28-29: Cannot set item in `dict[_Claskey | type | Unknown, None]` [unsupported-operation]
- ::error file=lib/streamlit/vendor/pympler/asizeof.py,line=1143,col=28,endLine=1143,endColumn=32,title=Pyrefly unsupported-operation::Cannot set item in `dict[_Claskey | type[Unknown] | Unknown, None]`%0A Argument `Self@_Typedef` is not assignable to parameter `value` with type `None` in function `dict.__setitem__`
+ ::error file=lib/streamlit/vendor/pympler/asizeof.py,line=1143,col=28,endLine=1143,endColumn=32,title=Pyrefly unsupported-operation::Cannot set item in `dict[_Claskey | type | Unknown, None]`%0A Argument `Self@_Typedef` is not assignable to parameter `value` with type `None` in function `dict.__setitem__`
- ::error file=lib/streamlit/vendor/pympler/asizeof.py,line=1147,col=32,endLine=1149,endColumn=18,title=Pyrefly unsupported-operation::Cannot set item in `dict[_Claskey | type[Unknown] | Unknown, None]`%0A Argument `_Typedef` is not assignable to parameter `value` with type `None` in function `dict.__setitem__`
+ ::error file=lib/streamlit/vendor/pympler/asizeof.py,line=1147,col=32,endLine=1149,endColumn=18,title=Pyrefly unsupported-operation::Cannot set item in `dict[_Claskey | type | Unknown, None]`%0A Argument `_Typedef` is not assignable to parameter `value` with type `None` in function `dict.__setitem__`
- ::error file=lib/streamlit/vendor/pympler/asizeof.py,line=1156,col=28,endLine=1158,endColumn=14,title=Pyrefly unsupported-operation::Cannot set item in `dict[_Claskey | type[Unknown] | Unknown, None]`%0A Argument `_Typedef` is not assignable to parameter `value` with type `None` in function `dict.__setitem__`
+ ::error file=lib/streamlit/vendor/pympler/asizeof.py,line=1156,col=28,endLine=1158,endColumn=14,title=Pyrefly unsupported-operation::Cannot set item in `dict[_Claskey | type | Unknown, None]`%0A Argument `_Typedef` is not assignable to parameter `value` with type `None` in function `dict.__setitem__`
- ::error file=lib/streamlit/vendor/pympler/asizeof.py,line=1937,col=16,endLine=1937,endColumn=33,title=Pyrefly not-iterable::`in` is not supported between `type[Unknown]` and `None`
+ ::error file=lib/streamlit/vendor/pympler/asizeof.py,line=1937,col=16,endLine=1937,endColumn=33,title=Pyrefly not-iterable::`in` is not supported between `type` and `None`
- ::error file=lib/streamlit/vendor/pympler/asizeof.py,line=1942,col=21,endLine=1942,endColumn=33,title=Pyrefly unsupported-operation::Cannot set item in `dict[_Claskey | type[Unknown] | Unknown, None]`%0A Argument `_Typedef` is not assignable to parameter `value` with type `None` in function `dict.__setitem__`
+ ::error file=lib/streamlit/vendor/pympler/asizeof.py,line=1942,col=21,endLine=1942,endColumn=33,title=Pyrefly unsupported-operation::Cannot set item in `dict[_Claskey | type | Unknown, None]`%0A Argument `_Typedef` is not assignable to parameter `value` with type `None` in function `dict.__setitem__`
- ::error file=lib/streamlit/vendor/pympler/asizeof.py,line=2726,col=28,endLine=2726,endColumn=29,title=Pyrefly unsupported-operation::Cannot set item in `dict[_Claskey | type[Unknown] | Unknown, None]`%0A Argument `_Typedef` is not assignable to parameter `value` with type `None` in function `dict.__setitem__`
+ ::error file=lib/streamlit/vendor/pympler/asizeof.py,line=2726,col=28,endLine=2726,endColumn=29,title=Pyrefly unsupported-operation::Cannot set item in `dict[_Claskey | type | Unknown, None]`%0A Argument `_Typedef` is not assignable to parameter `value` with type `None` in function `dict.__setitem__`
prefect (https://github.com/PrefectHQ/prefect)
- ERROR src/prefect/blocks/system.py:70:35-46: Expected a type form, got instance of `type` [not-a-type]
- ::error file=src/prefect/blocks/system.py,line=70,col=35,endLine=70,endColumn=46,title=Pyrefly not-a-type::Expected a type form, got instance of `type`
pydantic (https://github.com/pydantic/pydantic)
- ERROR pydantic/config.py:1282:9-35: Object of class `type` has no attribute `__pydantic_config__` [missing-attribute]
+ ERROR pydantic/config.py:1282:9-35: Object of class `object` has no attribute `__pydantic_config__` [missing-attribute]
- ::error file=pydantic/config.py,line=1282,col=9,endLine=1282,endColumn=35,title=Pyrefly missing-attribute::Object of class `type` has no attribute `__pydantic_config__`
+ ::error file=pydantic/config.py,line=1282,col=9,endLine=1282,endColumn=35,title=Pyrefly missing-attribute::Object of class `object` has no attribute `__pydantic_config__`
strawberry (https://github.com/strawberry-graphql/strawberry)
- ERROR strawberry/experimental/pydantic/object_type.py:271:9-27: Object of class `type` has no attribute `_pydantic_type` [missing-attribute]
- ERROR strawberry/experimental/pydantic/object_type.py:293:13-30: Object of class `type` has no attribute `from_pydantic` [missing-attribute]
- ERROR strawberry/experimental/pydantic/object_type.py:295:13-28: Object of class `type` has no attribute `to_pydantic` [missing-attribute]
+ ERROR strawberry/types/object_type.py:134:34-46: Object of class `object` has no attribute `__name__` [missing-attribute]
- ERROR strawberry/types/object_type.py:297:13-20: Argument `type[@_]` is not assignable to parameter `cls` with type `T` in function `_process_type` [bad-argument-type]
+ ERROR strawberry/types/object_type.py:297:13-20: Argument `type` is not assignable to parameter `cls` with type `T` in function `_process_type` [bad-argument-type]
- ::error file=strawberry/experimental/pydantic/object_type.py,line=271,col=9,endLine=271,endColumn=27,title=Pyrefly missing-attribute::Object of class `type` has no attribute `_pydantic_type`
- ::error file=strawberry/experimental/pydantic/object_type.py,line=293,col=13,endLine=293,endColumn=30,title=Pyrefly missing-attribute::Object of class `type` has no attribute `from_pydantic`
- ::error file=strawberry/experimental/pydantic/object_type.py,line=295,col=13,endLine=295,endColumn=28,title=Pyrefly missing-attribute::Object of class `type` has no attribute `to_pydantic`
+ ::error file=strawberry/types/object_type.py,line=134,col=34,endLine=134,endColumn=46,title=Pyrefly missing-attribute::Object of class `object` has no attribute `__name__`%0A Did you mean `__ne__`?
- ::error file=strawberry/types/object_type.py,line=297,col=13,endLine=297,endColumn=20,title=Pyrefly bad-argument-type::Argument `type[@_]` is not assignable to parameter `cls` with type `T` in function `_process_type`
+ ::error file=strawberry/types/object_type.py,line=297,col=13,endLine=297,endColumn=20,title=Pyrefly bad-argument-type::Argument `type` is not assignable to parameter `cls` with type `T` in function `_process_type`
mkdocs (https://github.com/mkdocs/mkdocs)
- ERROR mkdocs/config/base.py:277:16-27: Object of class `type` has no attribute `_schema` [missing-attribute]
- ERROR mkdocs/config/config_options.py:95:37-84: `partial[Config]` is not assignable to attribute `config_class` with type `type[Unknown]` [bad-assignment]
+ ERROR mkdocs/config/config_options.py:95:37-84: `partial[Config]` is not assignable to attribute `config_class` with type `type` [bad-assignment]
- ::error file=mkdocs/config/base.py,line=277,col=16,endLine=277,endColumn=27,title=Pyrefly missing-attribute::Object of class `type` has no attribute `_schema`
- ::error file=mkdocs/config/config_options.py,line=95,col=37,endLine=95,endColumn=84,title=Pyrefly bad-assignment::`partial[Config]` is not assignable to attribute `config_class` with type `type[Unknown]`
+ ::error file=mkdocs/config/config_options.py,line=95,col=37,endLine=95,endColumn=84,title=Pyrefly bad-assignment::`partial[Config]` is not assignable to attribute `config_class` with type `type`
bokeh (https://github.com/bokeh/bokeh)
- ERROR src/bokeh/core/has_props.py:219:36-51: Object of class `type` has no attribute `properties` [missing-attribute]
+ ERROR src/bokeh/core/has_props.py:790:35-118: `list[type[Model]]` is not assignable to `list[type[HasProps]]` [bad-assignment]
- ERROR src/bokeh/core/property/include.py:66:27-52: Object of class `type` has no attribute `descriptors` [missing-attribute]
- ERROR src/bokeh/model/model.py:332:26-42: Object of class `type` has no attribute `event_name` [missing-attribute]
- ERROR src/bokeh/models/plots.py:177:57-65: Argument `dict[Unknown, Unknown] | dict[str, str] | dict[str, type] | Unknown` is not assignable to parameter `selector` with type `dict[str | type[_Operator], Any]` in function `bokeh.core.query.find` [bad-argument-type]
+ ERROR src/bokeh/models/plots.py:177:57-65: Argument `dict[Unknown, Unknown] | dict[str, str] | dict[str, type[Model]] | Unknown` is not assignable to parameter `selector` with type `dict[str | type[_Operator], Any]` in function `bokeh.core.query.find` [bad-argument-type]
- ::error file=src/bokeh/core/has_props.py,line=219,col=36,endLine=219,endColumn=51,title=Pyrefly missing-attribute::Object of class `type` has no attribute `properties`
+ ::error file=src/bokeh/core/has_props.py,line=790,col=35,endLine=790,endColumn=118,title=Pyrefly bad-assignment::`list[type[Model]]` is not assignable to `list[type[HasProps]]`
- ::error file=src/bokeh/core/property/include.py,line=66,col=27,endLine=66,endColumn=52,title=Pyrefly missing-attribute::Object of class `type` has no attribute `descriptors`
- ::error file=src/bokeh/model/model.py,line=332,col=26,endLine=332,endColumn=42,title=Pyrefly missing-attribute::Object of class `type` has no attribute `event_name`
- ::error file=src/bokeh/models/plots.py,line=177,col=57,endLine=177,endColumn=65,title=Pyrefly bad-argument-type::Argument `dict[Unknown, Unknown] | dict[str, str] | dict[str, type] | Unknown` is not assignable to parameter `selector` with type `dict[str | type[_Operator], Any]` in function `bokeh.core.query.find`
+ ::error file=src/bokeh/models/plots.py,line=177,col=57,endLine=177,endColumn=65,title=Pyrefly bad-argument-type::Argument `dict[Unknown, Unknown] | dict[str, str] | dict[str, type[Model]] | Unknown` is not assignable to parameter `selector` with type `dict[str | type[_Operator], Any]` in function `bokeh.core.query.find`
pandas (https://github.com/pandas-dev/pandas)
- ERROR pandas/core/computation/expr.py:346:11-29: Argument `frozenset[str | Unknown]` is not assignable to parameter `nodes` with type `set[str]` in function `disallow` [bad-argument-type]
+ ERROR pandas/core/computation/expr.py:346:11-29: Argument `frozenset[str]` is not assignable to parameter `nodes` with type `set[str]` in function `disallow` [bad-argument-type]
- ERROR pandas/core/computation/expr.py:764:5-765:83: Argument `frozenset[str | Unknown]` is not assignable to parameter `nodes` with type `set[str]` in function `disallow` [bad-argument-type]
+ ERROR pandas/core/computation/expr.py:764:5-765:83: Argument `frozenset[str]` is not assignable to parameter `nodes` with type `set[str]` in function `disallow` [bad-argument-type]
- ERROR pandas/core/computation/expr.py:781:11-74: Argument `frozenset[str | Unknown]` is not assignable to parameter `nodes` with type `set[str]` in function `disallow` [bad-argument-type]
+ ERROR pandas/core/computation/expr.py:781:11-74: Argument `frozenset[str]` is not assignable to parameter `nodes` with type `set[str]` in function `disallow` [bad-argument-type]
- ERROR pandas/core/dtypes/common.py:1681:28-45: Object of class `type` has no attribute `type` [missing-attribute]
+ ERROR pandas/core/dtypes/common.py:1682:34-48: No matching overload found for function `numpy.dtype.__new__` called with arguments: (type[dtype[_ScalarT_co]], ((self: ExtensionDtype) -> type[Any]) | type) [no-matching-overload]
- ERROR pandas/core/indexes/base.py:322:23-33: No matching overload found for function `type.__new__` called with arguments: (type[Unknown], **Unknown) [no-matching-overload]
+ ERROR pandas/core/indexes/base.py:322:23-33: No matching overload found for function `type.__new__` called with arguments: (type, **Unknown) [no-matching-overload]
- ERROR pandas/core/ops/mask_ops.py:78:12-24: Returned type `tuple[ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | ndarray[tuple[Any, ...], dtype[Any]] | Unknown, ndarray[tuple[Any, ...], dtype[Any]] | type[Unknown] | Unknown]` is not assignable to declared return type `tuple[ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]], ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]]` [bad-return]
+ ERROR pandas/core/ops/mask_ops.py:78:12-24: Returned type `tuple[ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | ndarray[tuple[Any, ...], dtype[Any]] | Unknown, ndarray[tuple[Any, ...], dtype[Any]] | type | Unknown]` is not assignable to declared return type `tuple[ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]], ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]]` [bad-return]
- ERROR pandas/tests/generic/test_generic.py:205:46-53: Argument `type[Unknown]` is not assignable to parameter `right` with type `DataFrame | Series | None` in function `pandas._testing.asserters.assert_metadata_equivalent` [bad-argument-type]
+ ERROR pandas/tests/generic/test_generic.py:205:46-53: Argument `type` is not assignable to parameter `right` with type `DataFrame | Series | None` in function `pandas._testing.asserters.assert_metadata_equivalent` [bad-argument-type]
- ERROR pandas/tests/generic/test_generic.py:226:43-50: Argument `type[Unknown]` is not assignable to parameter `left` with type `DataFrame | Series` in function `pandas._testing.asserters.assert_metadata_equivalent` [bad-argument-type]
+ ERROR pandas/tests/generic/test_generic.py:226:43-50: Argument `type` is not assignable to parameter `left` with type `DataFrame | Series` in function `pandas._testing.asserters.assert_metadata_equivalent` [bad-argument-type]
- ::error file=pandas/core/computation/expr.py,line=346,col=11,endLine=346,endColumn=29,title=Pyrefly bad-argument-type::Argument `frozenset[str | Unknown]` is not assignable to parameter `nodes` with type `set[str]` in function `disallow`
- ::error file=pandas/core/computation/expr.py,line=764,col=5,endLine=765,endColumn=83,title=Pyrefly bad-argument-type::Argument `frozenset[str | Unknown]` is not assignable to parameter `nodes` with type `set[str]` in function `disallow`
- ::error file=pandas/core/computation/expr.py,line=781,col=11,endLine=781,endColumn=74,title=Pyrefly bad-argument-type::Argument `frozenset[str | Unknown]` is not assignable to parameter `nodes` with type `set[str]` in function `disallow`
+ ::error file=pandas/core/computation/expr.py,line=346,col=11,endLine=346,endColumn=29,title=Pyrefly bad-argument-type::Argument `frozenset[str]` is not assignable to parameter `nodes` with type `set[str]` in function `disallow`
+ ::error file=pandas/core/computation/expr.py,line=764,col=5,endLine=765,endColumn=83,title=Pyrefly bad-argument-type::Argument `frozenset[str]` is not assignable to parameter `nodes` with type `set[str]` in function `disallow`
+ ::error file=pandas/core/computation/expr.py,line=781,col=11,endLine=781,endColumn=74,title=Pyrefly bad-argument-type::Argument `frozenset[str]` is not assignable to parameter `nodes` with type `set[str]` in function `disallow`
- ::error file=pandas/core/dtypes/common.py,line=1681,col=28,endLine=1681,endColumn=45,title=Pyrefly missing-attribute::Object of class `type` has no attribute `type`
... (truncated 9 lines) ...
beartype (https://github.com/beartype/beartype)
- ERROR beartype/_check/forward/reference/fwdrefmake.py:301:5-41: Object of class `type` has no attribute `__name_beartype__` [missing-attribute]
- ERROR beartype/_check/forward/reference/fwdrefmake.py:302:5-47: Object of class `type` has no attribute `__scope_name_beartype__` [missing-attribute]
- ERROR beartype/_util/hint/pep/proposal/pep585.py:387:12-31: Object of class `NoneType` has no attribute `__orig_bases__`
+ ERROR beartype/_util/hint/pep/proposal/pep585.py:387:12-31: Object of class `NoneType` has no attribute `__orig_bases__` [missing-attribute]
- Object of class `type` has no attribute `__orig_bases__` [missing-attribute]
- ::error file=beartype/_check/forward/reference/fwdrefmake.py,line=301,col=5,endLine=301,endColumn=41,title=Pyrefly missing-attribute::Object of class `type` has no attribute `__name_beartype__`
- ::error file=beartype/_check/forward/reference/fwdrefmake.py,line=302,col=5,endLine=302,endColumn=47,title=Pyrefly missing-attribute::Object of class `type` has no attribute `__scope_name_beartype__`
- ::error file=beartype/_util/hint/pep/proposal/pep484/pep484generic.py,line=418,col=18,endLine=418,endColumn=30,title=Pyrefly missing-attribute::Object of class `NoneType` has no attribute `__mro__`%0A Did you mean `__or__`?
+ ::error file=beartype/_util/hint/pep/proposal/pep484/pep484generic.py,line=418,col=18,endLine=418,endColumn=30,title=Pyrefly missing-attribute::Object of class `NoneType` has no attribute `__mro__`
- ::error file=beartype/_util/hint/pep/proposal/pep585.py,line=387,col=12,endLine=387,endColumn=31,title=Pyrefly missing-attribute::Object of class `NoneType` has no attribute `__orig_bases__`%0AObject of class `type` has no attribute `__orig_bases__`
+ ::error file=beartype/_util/hint/pep/proposal/pep585.py,line=387,col=12,endLine=387,endColumn=31,title=Pyrefly missing-attribute::Object of class `NoneType` has no attribute `__orig_bases__`
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- INFO tests/annotations/declarations.py:1353:16-67: revealed type: type[BuildsWithSig[type[Unknown], Unknown]] [reveal-type]
+ INFO tests/annotations/declarations.py:1353:16-67: revealed type: type[BuildsWithSig[type, Unknown]] [reveal-type]
- ERROR src/hydra_zen/structured_configs/_implementations.py:965:34-39: Expected a type form, got instance of `type[Any] | type[Path] | type | type[Unknown] | Any` [not-a-type]
- ERROR src/hydra_zen/typing/_implementations.py:612:12-71: Returned type `type[Unknown]` is not assignable to declared return type `frozenset[str]` [bad-return]
+ ERROR src/hydra_zen/typing/_implementations.py:612:12-71: Returned type `type` is not assignable to declared return type `frozenset[str]` [bad-return]
- ::notice file=tests/annotations/declarations.py,line=1353,col=16,endLine=1353,endColumn=67,title=Pyrefly reveal-type::revealed type: type[BuildsWithSig[type[Unknown], Unknown]]
+ ::notice file=tests/annotations/declarations.py,line=1353,col=16,endLine=1353,endColumn=67,title=Pyrefly reveal-type::revealed type: type[BuildsWithSig[type, Unknown]]
- ::error file=src/hydra_zen/structured_configs/_implementations.py,line=965,col=34,endLine=965,endColumn=39,title=Pyrefly not-a-type::Expected a type form, got instance of `type[Any] | type[Path] | type | type[Unknown] | Any`
- ::error file=src/hydra_zen/typing/_implementations.py,line=612,col=12,endLine=612,endColumn=71,title=Pyrefly bad-return::Returned type `type[Unknown]` is not assignable to declared return type `frozenset[str]`
+ ::error file=src/hydra_zen/typing/_implementations.py,line=612,col=12,endLine=612,endColumn=71,title=Pyrefly bad-return::Returned type `type` is not assignable to declared return type `frozenset[str]`
static-frame (https://github.com/static-frame/static-frame)
- ERROR static_frame/core/type_clinic.py:783:24-29: Expected a type form, got instance of `type` [not-a-type]
- ERROR static_frame/core/util.py:2093:26-2098:10: No matching overload found for function `numpy._core.multiarray.arange` called with arguments: (start=Unknown, stop=Unknown, step=Unknown, dtype=dtype[float64] | dtype[Any] | None) [no-matching-overload]
+ ERROR static_frame/core/util.py:2093:26-2098:10: No matching overload found for function `numpy._core.multiarray.arange` called with arguments: (start=Unknown, stop=Unknown, step=Unknown, dtype=dtype[Any] | Unknown | None) [no-matching-overload]
- ERROR static_frame/core/util.py:2657:27-67: Argument `type[Unknown]` is not assignable to parameter `__array` with type `ndarray[tuple[Any, ...], dtype[Any]]` in function `arraykit.nonzero_1d` [bad-argument-type]
+ ERROR static_frame/core/util.py:2657:27-67: Argument `type` is not assignable to parameter `__array` with type `ndarray[tuple[Any, ...], dtype[Any]]` in function `arraykit.nonzero_1d` [bad-argument-type]
- ERROR static_frame/test/unit/test_frame.py:20282:23-68: Argument `(a: ndarray[Any, Any]) -> type[Unknown]` is not assignable to parameter `func` with type `(ndarray[Any, Any]) -> ndarray[Any, Any]` in function `static_frame.core.frame.Frame.from_overlay` [bad-argument-type]
+ ERROR static_frame/test/unit/test_frame.py:20282:23-68: Argument `(a: ndarray[Any, Any]) -> type` is not assignable to parameter `func` with type `(ndarray[Any, Any]) -> ndarray[Any, Any]` in function `static_frame.core.frame.Frame.from_overlay` [bad-argument-type]
- ::error file=static_frame/core/type_clinic.py,line=783,col=24,endLine=783,endColumn=29,title=Pyrefly not-a-type::Expected a type form, got instance of `type`
... (truncated 250 lines) ...``` |
|
@grievejia has imported this pull request. If you are a Meta employee, you can view this in D90144605. |
|
Thanks for the patch! Will take a look later this week. |
stroxler
left a comment
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.
Review automatically exported from Phabricator review in Meta.
Summary
This diff canonicalised the builtin type (which is a class) as a
Type::Typewith an implicitAny.The typing spec
(https://typing.python.org/en/latest/spec/special-types.html#type) requires that
"Plain
typewithout brackets, the root of Python’s metaclass hierarchy, is equivalent totype[Any]."Whereas assignments of
typeandtype[Any]are allowed by Pyrefly before this diff, they are not considered as identical types byassert_typecall. After the canonicalisation introduced by this diff, they are considered as identical. As a result, we are able to pass 3 more conformance test cases.Since
typeitself is a class, we need to add some special treatment in the type system on inheritance, so that it can be inherited and used as a metaclass, while being aType::Type. Some of the treatments are similar to howtupleis handled.Test Plan
python test.py