-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Allow any type to be returned by __new__
#14471
base: master
Are you sure you want to change the base?
Conversation
Please make sure that if the |
Will do. |
Diff from mypy_primer, showing the effect of this PR on open source code: parso (https://github.com/davidhalter/parso)
+ parso/python/pep8.py:38: error: "Type[object]" has no attribute "SUITE" [attr-defined]
+ parso/python/pep8.py:124: error: "Type[object]" has no attribute "BACKSLASH" [attr-defined]
+ parso/grammar.py:213: error: Incompatible types in assignment (expression has type "object", base class "Grammar" defined the type as "Optional[ErrorFinderConfig]") [assignment]
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:163: error: Dict entry 0 has incompatible type "str": "Type[BaseException]"; expected "str": "Type[Exception]" [dict-item]
+ aioredis/connection.py:164: error: Dict entry 1 has incompatible type "str": "Type[BaseException]"; expected "str": "Type[Exception]" [dict-item]
+ aioredis/connection.py:165: error: Dict entry 2 has incompatible type "str": "Type[BaseException]"; expected "str": "Type[Exception]" [dict-item]
+ aioredis/connection.py:168: error: Dict entry 3 has incompatible type "str": "Type[BaseException]"; expected "str": "Type[Exception]" [dict-item]
+ aioredis/connection.py:171: error: Dict entry 4 has incompatible type "str": "Type[BaseException]"; expected "str": "Type[Exception]" [dict-item]
+ aioredis/connection.py:172: error: Dict entry 5 has incompatible type "str": "Type[BaseException]"; expected "str": "Type[Exception]" [dict-item]
+ aioredis/connection.py:173: error: Dict entry 6 has incompatible type "str": "Type[BaseException]"; expected "str": "Type[Exception]" [dict-item]
+ aioredis/connection.py:174: error: Dict entry 7 has incompatible type "str": "Type[BaseException]"; expected "str": "Type[Exception]" [dict-item]
+ aioredis/connection.py:175: error: Dict entry 8 has incompatible type "str": "Type[BaseException]"; expected "str": "Type[Exception]" [dict-item]
+ aioredis/connection.py:177: error: Dict entry 1 has incompatible type "str": "Type[BaseException]"; expected "str": "Union[Type[Exception], Mapping[str, Type[Exception]]]" [dict-item]
+ aioredis/connection.py:178: error: Dict entry 2 has incompatible type "str": "Type[BaseException]"; expected "str": "Union[Type[Exception], Mapping[str, Type[Exception]]]" [dict-item]
+ aioredis/connection.py:179: error: Dict entry 3 has incompatible type "str": "Type[BaseException]"; expected "str": "Union[Type[Exception], Mapping[str, Type[Exception]]]" [dict-item]
+ aioredis/connection.py:180: error: Dict entry 4 has incompatible type "str": "Type[BaseException]"; expected "str": "Union[Type[Exception], Mapping[str, Type[Exception]]]" [dict-item]
+ aioredis/connection.py:181: error: Dict entry 5 has incompatible type "str": "Type[BaseException]"; expected "str": "Union[Type[Exception], Mapping[str, Type[Exception]]]" [dict-item]
+ aioredis/connection.py:182: error: Dict entry 6 has incompatible type "str": "Type[BaseException]"; expected "str": "Union[Type[Exception], Mapping[str, Type[Exception]]]" [dict-item]
+ aioredis/connection.py:207: error: Incompatible return value type (got "BaseException", expected "ResponseError") [return-value]
+ aioredis/connection.py:289: error: "BaseException" has no attribute "errno" [attr-defined]
+ aioredis/connection.py:420: error: Statement is unreachable [unreachable]
+ aioredis/connection.py:461: error: Incompatible types (expression has type "Type[BaseException]", TypedDict item "protocolError" has type "Callable[[str], Exception]") [typeddict-item]
+ aioredis/connection.py:517: error: "BaseException" has no attribute "errno" [attr-defined]
+ aioredis/connection.py:1393: error: "object" has no attribute "acquire" [attr-defined]
+ aioredis/connection.py:1402: error: "object" has no attribute "release" [attr-defined]
+ aioredis/client.py:3430: error: Item "Sequence[Union[bytes, str, memoryview]]" of "Union[Sequence[Union[bytes, str, memoryview]], Mapping[bytes, float]]" has no attribute "keys" [union-attr]
+ aioredis/client.py:3430: error: Item "Sequence[Union[bytes, str, memoryview]]" of "Union[Sequence[Union[bytes, str, memoryview]], Mapping[str, float]]" has no attribute "keys" [union-attr]
+ aioredis/client.py:3430: error: Item "Sequence[Union[bytes, str, memoryview]]" of "Union[Sequence[Union[bytes, str, memoryview]], Mapping[memoryview, float]]" has no attribute "keys" [union-attr]
+ aioredis/client.py:3430: error: Item "Sequence[Union[bytes, str, memoryview]]" of "Union[Sequence[Union[bytes, str, memoryview]], Mapping[bytes, float]]" has no attribute "values" [union-attr]
+ aioredis/client.py:3430: error: Item "Sequence[Union[bytes, str, memoryview]]" of "Union[Sequence[Union[bytes, str, memoryview]], Mapping[str, float]]" has no attribute "values" [union-attr]
+ aioredis/client.py:3430: error: Item "Sequence[Union[bytes, str, memoryview]]" of "Union[Sequence[Union[bytes, str, memoryview]], Mapping[memoryview, float]]" has no attribute "values" [union-attr]
+ aioredis/client.py:3533: error: Argument 2 to "warn" has incompatible type "Type[BaseException]"; expected "Optional[Type[Warning]]" [arg-type]
+ aioredis/client.py:4525: error: Argument 1 to "annotate_exception" of "Pipeline" has incompatible type "BaseException"; expected "Exception" [arg-type]
+ aioredis/client.py:4593: error: Argument 1 to "annotate_exception" of "Pipeline" has incompatible type "BaseException"; expected "Exception" [arg-type]
nionutils (https://github.com/nion-software/nionutils)
+ nion/utils/Promise.py:20: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/Promise.py:20: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ReferenceCounting.py:58: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ReferenceCounting.py:58: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ReferenceCounting.py:64: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ReferenceCounting.py:64: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/Event.py:82: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/Event.py:82: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/Event.py:86: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/Event.py:86: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/Event.py:102: error: "Type[List[Any]]" has no attribute "from_list" [attr-defined]
+ nion/utils/Event.py:107: error: "Type[List[Any]]" has no attribute "from_list" [attr-defined]
+ nion/utils/Event.py:112: error: "Type[List[Any]]" has no attribute "from_list" [attr-defined]
+ nion/utils/Event.py:123: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/Event.py:123: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/Event.py:140: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/Event.py:140: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/Event.py:159: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/Event.py:159: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/Recorder.py:115: error: Argument 1 to "KeyAccessor" has incompatible type "object"; expected "Accessor" [arg-type]
+ nion/utils/Recorder.py:119: error: Argument 1 to "KeyAccessor" has incompatible type "object"; expected "Accessor" [arg-type]
+ nion/utils/Recorder.py:129: error: Incompatible return value type (got "object", expected "Accessor") [return-value]
+ nion/utils/Recorder.py:140: error: Argument 1 to "KeyRecorderEntry" has incompatible type "object"; expected "Accessor" [arg-type]
+ nion/utils/Recorder.py:145: error: Argument 1 to "KeyAccessor" has incompatible type "object"; expected "Accessor" [arg-type]
+ nion/utils/Recorder.py:146: error: Argument 1 to "KeyRecorderEntry" has incompatible type "object"; expected "Accessor" [arg-type]
+ nion/utils/Recorder.py:154: error: Argument 1 to "KeyAccessor" has incompatible type "object"; expected "Accessor" [arg-type]
+ nion/utils/Recorder.py:155: error: Argument 1 to "KeyAccessor" has incompatible type "object"; expected "Accessor" [arg-type]
+ nion/utils/Recorder.py:156: error: Argument 1 to "InsertRecorderEntry" has incompatible type "object"; expected "Accessor" [arg-type]
+ nion/utils/Recorder.py:161: error: Argument 1 to "KeyAccessor" has incompatible type "object"; expected "Accessor" [arg-type]
+ nion/utils/Recorder.py:163: error: Argument 1 to "RemoveRecorderEntry" has incompatible type "object"; expected "Accessor" [arg-type]
+ nion/utils/ListModel.py:312: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:312: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:346: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:346: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:360: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:360: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:383: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:383: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:393: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:393: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:423: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:423: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:466: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:466: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:478: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:478: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:544: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:544: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:662: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:662: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:668: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:668: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:679: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:679: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:724: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:724: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:752: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:752: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:812: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:812: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:823: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:823: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:866: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:866: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:910: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:910: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ListModel.py:925: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/ListModel.py:925: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/ThreadPool.py:40: error: Argument 5 to "finalize" has incompatible type "object"; expected "Event" [arg-type]
+ nion/utils/ThreadPool.py:61: error: "object" has no attribute "is_set" [attr-defined]
+ nion/utils/ThreadPool.py:70: error: "object" has no attribute "is_set" [attr-defined]
+ nion/utils/ThreadPool.py:93: error: Argument 1 to "DispatcherInfo" has incompatible type "object"; expected "_RLock" [arg-type]
+ nion/utils/ThreadPool.py:93: error: Argument 4 to "DispatcherInfo" has incompatible type "object"; expected "Event" [arg-type]
+ nion/utils/Process.py:62: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/Process.py:62: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/Process.py:66: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/Process.py:66: error: "object" has no attribute "__exit__" [attr-defined]
+ nion/utils/Process.py:71: error: "object" has no attribute "__enter__" [attr-defined]
+ nion/utils/Process.py:71: error: "object" has no attribute "__exit__" [attr-defined]
poetry (https://github.com/python-poetry/poetry)
+ src/poetry/utils/setup_reader.py:126: error: Left operand of "and" is always true [redundant-expr]
+ src/poetry/utils/setup_reader.py:130: error: "stmt" has no attribute "test" [attr-defined]
+ src/poetry/utils/setup_reader.py:134: error: "AST" has no attribute "left" [attr-defined]
+ src/poetry/utils/setup_reader.py:138: error: "AST" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:154: error: "stmt" has no attribute "value" [attr-defined]
+ src/poetry/utils/setup_reader.py:158: error: "AST" has no attribute "func" [attr-defined]
+ src/poetry/utils/setup_reader.py:159: error: "AST" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:161: error: "AST" has no attribute "value" [attr-defined]
+ src/poetry/utils/setup_reader.py:162: error: "AST" has no attribute "attr" [attr-defined]
+ src/poetry/utils/setup_reader.py:166: error: Incompatible return value type (got "Tuple[AST, List[stmt]]", expected "Optional[Tuple[Call, List[stmt]]]") [return-value]
+ src/poetry/utils/setup_reader.py:178: error: "stmt" has no attribute "body" [attr-defined]
+ src/poetry/utils/setup_reader.py:198: error: "AST" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:203: error: "expr" has no attribute "func" [attr-defined]
+ src/poetry/utils/setup_reader.py:206: error: "expr" has no attribute "func" [attr-defined]
+ src/poetry/utils/setup_reader.py:206: error: "AST" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:209: error: Argument 1 to "_find_in_call" of "SetupReader" has incompatible type "expr"; expected "Call" [arg-type]
+ src/poetry/utils/setup_reader.py:217: error: "AST" has no attribute "elts" [attr-defined]
+ src/poetry/utils/setup_reader.py:219: error: "AST" has no attribute "s" [attr-defined]
+ src/poetry/utils/setup_reader.py:221: error: "AST" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:224: error: "expr" has no attribute "elts" [attr-defined]
+ src/poetry/utils/setup_reader.py:226: error: "AST" has no attribute "s" [attr-defined]
+ src/poetry/utils/setup_reader.py:242: error: "AST" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:247: error: "expr" has no attribute "func" [attr-defined]
+ src/poetry/utils/setup_reader.py:250: error: "expr" has no attribute "func" [attr-defined]
+ src/poetry/utils/setup_reader.py:250: error: "AST" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:253: error: Argument 1 to "_find_in_call" of "SetupReader" has incompatible type "expr"; expected "Call" [arg-type]
+ src/poetry/utils/setup_reader.py:262: error: "AST" has no attribute "keys" [attr-defined]
+ src/poetry/utils/setup_reader.py:262: error: "AST" has no attribute "values" [attr-defined]
+ src/poetry/utils/setup_reader.py:267: error: "expr" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:270: error: "AST" has no attribute "s" [attr-defined]
+ src/poetry/utils/setup_reader.py:271: error: "AST" has no attribute "s" [attr-defined]
+ src/poetry/utils/setup_reader.py:271: error: "expr" has no attribute "elts" [attr-defined]
+ src/poetry/utils/setup_reader.py:274: error: "AST" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:279: error: "expr" has no attribute "keys" [attr-defined]
+ src/poetry/utils/setup_reader.py:279: error: "expr" has no attribute "values" [attr-defined]
+ src/poetry/utils/setup_reader.py:284: error: "expr" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:287: error: "AST" has no attribute "s" [attr-defined]
+ src/poetry/utils/setup_reader.py:288: error: "AST" has no attribute "s" [attr-defined]
+ src/poetry/utils/setup_reader.py:288: error: "expr" has no attribute "elts" [attr-defined]
+ src/poetry/utils/setup_reader.py:304: error: "AST" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:309: error: "expr" has no attribute "func" [attr-defined]
+ src/poetry/utils/setup_reader.py:312: error: "expr" has no attribute "func" [attr-defined]
+ src/poetry/utils/setup_reader.py:312: error: "AST" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:315: error: Argument 1 to "_find_in_call" of "SetupReader" has incompatible type "expr"; expected "Call" [arg-type]
+ src/poetry/utils/setup_reader.py:323: error: Returning Any from function declared to return "Optional[str]" [no-any-return]
+ src/poetry/utils/setup_reader.py:323: error: "AST" has no attribute "s" [attr-defined]
+ src/poetry/utils/setup_reader.py:325: error: "AST" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:328: error: Returning Any from function declared to return "Optional[str]" [no-any-return]
+ src/poetry/utils/setup_reader.py:328: error: "expr" has no attribute "s" [attr-defined]
+ src/poetry/utils/setup_reader.py:353: error: "stmt" has no attribute "targets" [attr-defined]
+ src/poetry/utils/setup_reader.py:357: error: "AST" has no attribute "id" [attr-defined]
+ src/poetry/utils/setup_reader.py:358: error: Returning Any from function declared to return "Optional[expr]" [no-any-return]
+ src/poetry/utils/setup_reader.py:358: error: "stmt" has no attribute "value" [attr-defined]
+ src/poetry/utils/setup_reader.py:364: error: "expr" has no attribute "s" [attr-defined]
+ src/poetry/mixology/term.py:48: error: Returning Any from function declared to return "bool" [no-any-return]
+ src/poetry/mixology/term.py:50: error: "Type[object]" has no attribute "SUBSET" [attr-defined]
+ src/poetry/mixology/term.py:66: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:66: error: "Type[object]" has no attribute "DISJOINT" [attr-defined]
+ src/poetry/mixology/term.py:70: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:70: error: "Type[object]" has no attribute "SUBSET" [attr-defined]
+ src/poetry/mixology/term.py:74: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:74: error: "Type[object]" has no attribute "DISJOINT" [attr-defined]
+ src/poetry/mixology/term.py:76: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:76: error: "Type[object]" has no attribute "OVERLAPPING" [attr-defined]
+ src/poetry/mixology/term.py:79: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:79: error: "Type[object]" has no attribute "OVERLAPPING" [attr-defined]
+ src/poetry/mixology/term.py:83: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:83: error: "Type[object]" has no attribute "DISJOINT" [attr-defined]
+ src/poetry/mixology/term.py:87: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:87: error: "Type[object]" has no attribute "OVERLAPPING" [attr-defined]
+ src/poetry/mixology/term.py:91: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:91: error: "Type[object]" has no attribute "SUBSET" [attr-defined]
+ src/poetry/mixology/term.py:95: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:95: error: "Type[object]" has no attribute "SUBSET" [attr-defined]
+ src/poetry/mixology/term.py:99: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:99: error: "Type[object]" has no attribute "DISJOINT" [attr-defined]
+ src/poetry/mixology/term.py:102: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:102: error: "Type[object]" has no attribute "OVERLAPPING" [attr-defined]
+ src/poetry/mixology/term.py:105: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:105: error: "Type[object]" has no attribute "OVERLAPPING" [attr-defined]
+ src/poetry/mixology/term.py:109: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:109: error: "Type[object]" has no attribute "SUBSET" [attr-defined]
+ src/poetry/mixology/term.py:113: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/term.py:113: error: "Type[object]" has no attribute "OVERLAPPING" [attr-defined]
+ src/poetry/repositories/repository_pool.py:43: error: Incompatible types in assignment (expression has type "Dict[_KT, _VT]", variable has type "OrderedDict[str, PrioritizedRepository]") [assignment]
+ src/poetry/mixology/incompatibility.py:267: error: Left operand of "and" is always true [redundant-expr]
+ src/poetry/repositories/pool.py:26: error: Argument 2 to "warn" has incompatible type "Type[BaseException]"; expected "Optional[Type[Warning]]" [arg-type]
+ src/poetry/console/logging/io_formatter.py:29: error: "object" has no attribute "format" [attr-defined]
+ src/poetry/mixology/partial_solution.py:204: error: Returning Any from function declared to return "bool" [no-any-return]
+ src/poetry/mixology/partial_solution.py:204: error: "Type[object]" has no attribute "SUBSET" [attr-defined]
+ src/poetry/mixology/partial_solution.py:213: error: Returning Any from function declared to return "str" [no-any-return]
+ src/poetry/mixology/partial_solution.py:213: error: "Type[object]" has no attribute "OVERLAPPING" [attr-defined]
+ src/poetry/mixology/version_solver.py:105: error: Argument 2 to "Incompatibility" has incompatible type "BaseException"; expected "IncompatibilityCause" [arg-type]
+ src/poetry/mixology/version_solver.py:182: error: "Type[object]" has no attribute "DISJOINT" [attr-defined]
... (truncated 50 lines) ...
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/sas/sas_constants.py:184: error: "Type[object]" has no attribute "row_size_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:185: error: "Type[object]" has no attribute "row_size_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:186: error: "Type[object]" has no attribute "row_size_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:187: error: "Type[object]" has no attribute "row_size_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:188: error: "Type[object]" has no attribute "column_size_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:189: error: "Type[object]" has no attribute "column_size_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:190: error: "Type[object]" has no attribute "column_size_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:191: error: "Type[object]" has no attribute "column_size_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:192: error: "Type[object]" has no attribute "subheader_counts_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:193: error: "Type[object]" has no attribute "subheader_counts_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:194: error: "Type[object]" has no attribute "subheader_counts_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:195: error: "Type[object]" has no attribute "subheader_counts_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:196: error: "Type[object]" has no attribute "column_text_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:197: error: "Type[object]" has no attribute "column_text_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:198: error: "Type[object]" has no attribute "column_text_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:199: error: "Type[object]" has no attribute "column_text_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:200: error: "Type[object]" has no attribute "column_name_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:201: error: "Type[object]" has no attribute "column_name_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:202: error: "Type[object]" has no attribute "column_attributes_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:203: error: "Type[object]" has no attribute "column_attributes_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:204: error: "Type[object]" has no attribute "column_attributes_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:205: error: "Type[object]" has no attribute "column_attributes_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:206: error: "Type[object]" has no attribute "format_and_label_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:207: error: "Type[object]" has no attribute "format_and_label_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:208: error: "Type[object]" has no attribute "format_and_label_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:209: error: "Type[object]" has no attribute "format_and_label_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:210: error: "Type[object]" has no attribute "column_list_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:211: error: "Type[object]" has no attribute "column_list_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:212: error: "Type[object]" has no attribute "column_list_index" [attr-defined]
+ pandas/io/sas/sas_constants.py:213: error: "Type[object]" has no attribute "column_list_index" [attr-defined]
+ pandas/util/version/__init__.py:52: error: Incompatible return value type (got "object", expected "NegativeInfinityType") [return-value]
+ pandas/util/version/__init__.py:84: error: Incompatible return value type (got "object", expected "InfinityType") [return-value]
+ pandas/util/version/__init__.py:160: error: "object" has no attribute "_key" [attr-defined]
+ pandas/util/version/__init__.py:178: error: "object" has no attribute "_key" [attr-defined]
+ pandas/util/version/__init__.py:189: error: Argument 2 to "warn" has incompatible type "Type[BaseException]"; expected "Optional[Type[Warning]]" [arg-type]
+ pandas/util/version/__init__.py:542: error: Incompatible types in assignment (expression has type "object", variable has type "Union[Union[InfinityType, NegativeInfinityType], Tuple[str, int]]") [assignment]
+ pandas/util/version/__init__.py:546: error: Incompatible types in assignment (expression has type "object", variable has type "Union[Union[InfinityType, NegativeInfinityType], Tuple[str, int]]") [assignment]
+ pandas/util/version/__init__.py:552: error: Incompatible types in assignment (expression has type "object", variable has type "Union[Union[InfinityType, NegativeInfinityType], Tuple[str, int]]") [assignment]
+ pandas/util/version/__init__.py:559: error: Incompatible types in assignment (expression has type "object", variable has type "Union[Union[InfinityType, NegativeInfinityType], Tuple[str, int]]") [assignment]
+ pandas/util/version/__init__.py:566: error: Incompatible types in assignment (expression has type "object", variable has type "Union[NegativeInfinityType, Tuple[Union[Union[Union[InfinityType, NegativeInfinityType], int, str], Tuple[Union[Union[InfinityType, NegativeInfinityType], int, str], str], Tuple[NegativeInfinityType, Union[Union[InfinityType, NegativeInfinityType], int, str]]], ...]]") [assignment]
+ pandas/util/version/__init__.py:576: error: Generator has incompatible item type "Tuple[object, Union[InfinityType, NegativeInfinityType, str]]"; expected "Union[InfinityType, NegativeInfinityType, int, str, Tuple[Union[Union[InfinityType, NegativeInfinityType], int, str], str], Tuple[NegativeInfinityType, Union[Union[InfinityType, NegativeInfinityType], int, str]]]" [misc]
+ pandas/_testing/_warnings.py:21: error: Incompatible default for argument "expected_warning" (default has type "Type[BaseException]", argument has type "Union[Type[Warning], bool, Tuple[Type[Warning], ...], None]") [assignment]
+ pandas/io/formats/latex.py:471: error: Incompatible return value type (got "RowStringConverter", expected "RowStringIterator") [return-value]
+ pandas/io/formats/latex.py:481: error: Incompatible return value type (got "Type[RowStringConverter]", expected "Type[RowStringIterator]") [return-value]
+ pandas/io/formats/latex.py:483: error: Incompatible return value type (got "Type[RowStringConverter]", expected "Type[RowStringIterator]") [return-value]
+ pandas/compat/__init__.py:154: error: Incompatible return value type (got "Type[lzma.LZMAFile]", expected "Type[pandas.compat.compressors.LZMAFile]") [return-value]
+ pandas/util/_decorators.py:57: error: Incompatible types in assignment (expression has type "Type[BaseException]", variable has type "Optional[Type[Warning]]") [assignment]
... (truncated 5382 lines) ...``` |
@intgr I'm not familiar with the mypy internal stuff, so I can't really figure out where this implicit class type usage could be implemented. Do you have any ideas about this? |
I'm not very familiar either. I wanted to look into it, but haven't found the time yet |
I replied here: |
Just curious, but where does this come up? If that's what's meant, shouldn't these be corrected to return |
Yes, that's exactly what I meant. |
What should be corrected? The code? Or mypy's assumption about the return type? Sort of saying the same thing maybe, but either way, why should un-annotated valid python code be "rejected" by mypy? The spec seems to me to say it should not. The spec can of course be changed, and actually probably could benefit from a lot of clarification. At some point it's an implementation-defined situation, not a spec-defined one, but then so is all of Perl. |
I meant for MyPy not to make assumptions about the return type.
If the return type is left as
Would you mind linking that? |
It's in my linked reply above, but not a problem.
Assuming Self is not the most general type possible or allowed by the language. It seems mypy doesn't presently work like that, but an object instantiation is just a call to a function __new__ and I see nothing in the spec that overrides the above statement for object instantiation, but I well may have missed it. I think it makes sense that a spec compliant type checker should not report type errors in correct code that doesn't have type errors, particularly when the typing philosophy of python is supposed to be "gradual typing," which as I read means first do no harm, and add checking gradually as requested. Python could probably declare non-subtype return types as UB, but my digging says it doesn't. I'm just here because it was allowed, handling staticness in python isn't obvious to a newcomer, and I did it and I had code that worked. Now I have other code that instantiates a callable that is just as good, drop-in replaceable, and arguably less confusing, maybe, so that's fine too, but it was an unnecessary dead-end that I found through honest, legal, even if smelly (but simpler), means, and it signaled (and enforced) singleton-like intent* automatically for better or worse. Edit: |
Yes yes. Ok. I thought you said assume "Self"
Maybe if Self is implicitly -> Any then this means the same thing, and I was just confused. It should not mean the Wolf() in Sheep() clothing is assumed as a Sheep(). It should mean it returns the implicit Any return type associated with Sheep.__new__. Maybe that resolves my confusion. |
Totally agree.
😄 Yeah, sounds like we're actually saying the same thing then!
That's what I'm saying: if |
Fixes #8330. Made a first mypy_primer run locally, and had a lot of things breaking, so the fix might be incomplete.
check-classes.test