Skip to content

Delete object.__module__#8789

Closed
AlexWaygood wants to merge 1 commit intomasterfrom
AlexWaygood-patch-1
Closed

Delete object.__module__#8789
AlexWaygood wants to merge 1 commit intomasterfrom
AlexWaygood-patch-1

Conversation

@AlexWaygood
Copy link
Member

An alternative approach to #8787

An alternative approach to #8787
@AlexWaygood
Copy link
Member Author

Hmm, 1868 stubtest errors

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

yarl (https://github.com/aio-libs/yarl)
+ yarl/_url.py:19: error: "object" has no attribute "__module__"  [attr-defined]

SinbadCogs (https://github.com/mikeshardmind/SinbadCogs)
+ devtools/core.py:193: error: "partial[Coroutine[Any, Any, Any]]" has no attribute "__module__"

streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/legacy_caching/hashing.py: note: In member "_to_bytes" of class "_CodeHasher":
+ lib/streamlit/runtime/legacy_caching/hashing.py:625:16: error: Item "MethodType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:625:16: error: Item "BuiltinFunctionType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:625:16: error: Item "WrapperDescriptorType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:625:16: error: Item "MethodDescriptorType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:625:16: error: Item "ClassMethodDescriptorType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:628:49: error: Item "MethodType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:628:49: error: Item "BuiltinFunctionType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:628:49: error: Item "WrapperDescriptorType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:628:49: error: Item "MethodDescriptorType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:628:49: error: Item "ClassMethodDescriptorType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:642:32: error: Item "MethodType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:642:32: error: Item "BuiltinFunctionType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:642:32: error: Item "WrapperDescriptorType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:642:32: error: Item "MethodDescriptorType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]
+ lib/streamlit/runtime/legacy_caching/hashing.py:642:32: error: Item "ClassMethodDescriptorType" of "Union[FunctionType, FunctionType, MethodType, BuiltinFunctionType, BuiltinFunctionType, WrapperDescriptorType, MethodDescriptorType, ClassMethodDescriptorType]" has no attribute "__module__"  [union-attr]

bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/core/property/enum.py: note: In function "_sphinx_type":
+ src/bokeh/core/property/enum.py:105:28: error: "Enumeration" has no attribute "__module__"  [attr-defined]

core (https://github.com/home-assistant/core)
+ homeassistant/helpers/deprecation.py:39: error: "_ObjectT" has no attribute "__module__"  [attr-defined]
+ homeassistant/components/smartthings/__init__.py:290: error: "DeviceBroker" has no attribute "__module__"  [attr-defined]

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/http/request/__init__.py:191: error: "Request" has no attribute "__module__"

rich (https://github.com/Textualize/rich)
+ rich/console.py:946: error: "TextIO" has no attribute "__module__"  [attr-defined]

discord.py (https://github.com/Rapptz/discord.py)
+ discord/ext/commands/bot.py:888: error: "Cog" has no attribute "__module__"

mypy (https://github.com/python/mypy)
+ mypy/test/teststubgen.py:1046: error: "StubgencSuite" has no attribute "__module__"  [attr-defined]
+ mypy/test/teststubgen.py:1093: error: "StubgencSuite" has no attribute "__module__"  [attr-defined]

alerta (https://github.com/alerta/alerta)
+ alerta/webhooks/__init__.py:33: error: "WebhookBase" has no attribute "__module__"

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/typing.py: note: In function "stringify":
+ sphinx/util/typing.py:359:13: error: "TypeVar" has no attribute "__module__"  [attr-defined]
+ sphinx/util/typing.py:363:42: error: "TypeVar" has no attribute "__module__"  [attr-defined]
+ sphinx/util/nodes.py: note: In function "get_full_module_name":
+ sphinx/util/nodes.py:91:27: error: "Node" has no attribute "__module__"  [attr-defined]

pytest (https://github.com/pytest-dev/pytest)
+ testing/test_warning_types.py:20: error: "UserWarning" has no attribute "__module__"  [attr-defined]
+ testing/test_config.py:1294: error: "My" has no attribute "__module__"  [attr-defined]

antidote (https://github.com/Finistere/antidote)
+ src/antidote/_internal/utils.py:77: error: Item "MethodType" of "Union[type, FunctionType, MethodType]" has no attribute "__module__"
+ src/antidote/_internal/utils.py:78: error: Item "MethodType" of "Union[type, FunctionType, MethodType]" has no attribute "__module__"

@AlexWaygood
Copy link
Member Author

Seems like mypy struggles to infer that the __module__ attribute is inherited from type for class objects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant