Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ty] Preserve gradual behavior for explicit Any subclasses#26034

Merged
charliermarsh merged 21 commits into
mainfrom
charlie/fix-any-subclass-instances
Jun 19, 2026
Merged

[ty] Preserve gradual behavior for explicit Any subclasses#26034
charliermarsh merged 21 commits into
mainfrom
charlie/fix-any-subclass-instances

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

In astral-sh/ty#1686 (comment), we decided the following:

We discussed this internally and our current plan is to treat instances of class Mock(Any): ... as if they were of type Mock & Any. This would enable the use case here, and still give accurate types (and things like auto-completion) for actual attributes on Mock.

Note that this will mean that we treat class C(Any): ... differently from class C(SomethingOfTypeAnyOrUnknown): .... The latter would still be a normal class with a dynamic base, i.e. an instance of that class would not be assignable to arbitrary types.

As such, instances of classes that explicitly inherit from Any now retain their nominal type and precise declared members while remaining assignable to arbitrary types, includingFinal and Literal types:

from typing import Any, final

class Mock(Any):
    def method(self) -> int: ...

@final
class FinalClass: ...

value: FinalClass = Mock()
result: int = Mock().method()

Closes astral-sh/ty#1686.

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Jun 16, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 94.37%. The percentage of expected errors that received a diagnostic held steady at 89.00%. The number of fully passing files held steady at 94/134.

@astral-sh-bot

astral-sh-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

Memory usage report

Summary

Project Old New Diff Outcome
prefect 524.30MB 524.51MB +0.04% (210.80kB)
sphinx 195.80MB 195.93MB +0.07% (137.16kB)
trio 78.59MB 78.61MB +0.03% (25.16kB)
flake8 31.36MB 31.37MB +0.03% (10.91kB)

Significant changes

Click to expand detailed breakdown

prefect

Name Old New Diff Outcome
when_constraint_set_assignable_to_owned_impl 2.81MB 2.88MB +2.18% (62.73kB)
infer_expression_types_impl 56.96MB 56.99MB +0.05% (29.02kB)
is_possibly_constraint_set_assignable 519.86kB 548.03kB +5.42% (28.17kB)
infer_definition_types 69.45MB 69.48MB +0.04% (26.81kB)
infer_scope_types_impl 39.06MB 39.09MB +0.07% (26.45kB)
ClassLiteral<'db>::inherits_from_any_ 0.00B 22.84kB +22.84kB (new)
parsed_module 19.35MB 19.36MB +0.06% (11.85kB)
check_file_impl 17.86MB 17.86MB -0.02% (3.16kB)
infer_statement_types_impl 1.54MB 1.54MB +0.19% (2.99kB)
assignable_solutions_impl 196.75kB 199.45kB +1.37% (2.70kB)
all_narrowing_constraints_for_expression 6.58MB 6.58MB +0.03% (1.99kB)
member_lookup_with_policy_inner 14.31MB 14.31MB -0.01% (1.62kB)
try_call_bin_op_return_type_impl 273.19kB 274.68kB +0.54% (1.49kB)
Type<'db>::class_member_with_policy_ 10.93MB 10.93MB -0.01% (1.45kB)
member_lookup_with_policy_inner::interned_arguments 6.72MB 6.72MB -0.02% (1.17kB)
... 17 more

sphinx

Name Old New Diff Outcome
when_constraint_set_assignable_to_owned_impl 1.38MB 1.41MB +2.39% (33.74kB)
infer_expression_types_impl 23.33MB 23.35MB +0.10% (23.60kB)
infer_definition_types 19.56MB 19.58MB +0.09% (18.90kB)
is_possibly_constraint_set_assignable 232.45kB 250.46kB +7.75% (18.01kB)
ClassLiteral<'db>::inherits_from_any_ 0.00B 13.61kB +13.61kB (new)
infer_scope_types_impl 10.54MB 10.55MB +0.09% (9.57kB)
parsed_module 18.36MB 18.36MB +0.03% (5.73kB)
try_call_bin_op_return_type_impl 194.78kB 199.36kB +2.35% (4.58kB)
infer_statement_types_impl 965.22kB 967.62kB +0.25% (2.40kB)
assignable_solutions_impl 106.62kB 108.09kB +1.37% (1.46kB)
all_narrowing_constraints_for_expression 2.69MB 2.70MB +0.05% (1.43kB)
TupleType<'db>::to_class_type_ 161.29kB 162.46kB +0.73% (1.18kB)
loop_header_reachability 382.05kB 382.61kB +0.15% (576.00B)
Specialization 1.40MB 1.40MB +0.04% (560.00B)
UnionType 655.61kB 655.98kB +0.06% (384.00B)
... 11 more

trio

Name Old New Diff Outcome
ClassLiteral<'db>::inherits_from_any_ 0.00B 8.58kB +8.58kB (new)
when_constraint_set_assignable_to_owned_impl 348.70kB 355.61kB +1.98% (6.90kB)
infer_scope_types_impl 3.20MB 3.20MB +0.11% (3.67kB)
is_possibly_constraint_set_assignable 71.59kB 74.85kB +4.55% (3.26kB)
infer_expression_types_impl 6.57MB 6.57MB +0.04% (2.65kB)
infer_definition_types 5.60MB 5.60MB +0.03% (1.93kB)
try_metaclass_inner 100.91kB 99.75kB -1.15% (1.16kB)
enum_metadata 212.14kB 211.35kB -0.37% (808.00B)
parsed_module 15.04MB 15.04MB -0.00% (688.00B)
inheritance_cycle_inner 31.04kB 30.62kB -1.36% (432.00B)
try_call_bin_op_return_type_impl 44.22kB 44.59kB +0.82% (372.00B)
assignable_solutions_impl 24.05kB 24.28kB +0.97% (240.00B)
all_narrowing_constraints_for_expression 610.01kB 610.21kB +0.03% (204.00B)
loop_header_reachability 124.76kB 124.91kB +0.12% (156.00B)
infer_statement_types_impl 56.79kB 56.88kB +0.17% (96.00B)
... 5 more

flake8

Name Old New Diff Outcome
ClassLiteral<'db>::inherits_from_any_ 0.00B 4.08kB +4.08kB (new)
when_constraint_set_assignable_to_owned_impl 140.96kB 144.27kB +2.34% (3.30kB)
is_possibly_constraint_set_assignable 24.26kB 25.58kB +5.46% (1.32kB)
infer_expression_types_impl 989.39kB 990.45kB +0.11% (1.05kB)
infer_definition_types 1.35MB 1.35MB +0.06% (852.00B)
parsed_module 9.77MB 9.77MB -0.00% (496.00B)
infer_scope_types_impl 674.86kB 675.30kB +0.07% (456.00B)
infer_statement_types_impl 54.62kB 54.77kB +0.28% (156.00B)
try_call_bin_op_return_type_impl 6.02kB 6.11kB +1.56% (96.00B)
UnionType<'db>::from_two_elements_::interned_arguments 26.98kB 26.90kB -0.32% (88.00B)
assignable_solutions_impl 11.78kB 11.86kB +0.70% (84.00B)
all_narrowing_constraints_for_expression 87.07kB 87.14kB +0.08% (72.00B)
UnionType<'db>::from_two_elements_ 29.98kB 29.93kB -0.18% (56.00B)
loop_header_reachability 12.44kB 12.48kB +0.28% (36.00B)
infer_unpack_types 33.36kB 33.38kB +0.04% (12.00B)
... 4 more

@astral-sh-bot

astral-sh-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-assignment 0 224 0
unresolved-attribute 0 115 1
unused-type-ignore-comment 19 0 0
invalid-parameter-default 0 5 0
invalid-argument-type 0 3 0
Total 19 347 1

Showing a random sample of 310 of 367 changes. See the HTML report for the full diff.

Raw diff sample (310 of 367 changes)
aiohttp (https://github.com/aio-libs/aiohttp)
- aiohttp/test_utils.py:626:15 error[invalid-assignment] Object of type `MagicMock` is not assignable to `Application | None`

alerta (https://github.com/alerta/alerta)
- tests/plugins/test_reject.py:27:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `get_config` of type `def get_config(key, default=None, type=None, **kwargs) -> Unknown`

apprise (https://github.com/caronc/apprise)
- tests/test_plugin_rocket_chat.py:423:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `login` of type `def login(self) -> Unknown`
- tests/test_utils_socket.py:445:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `recv` of type `def recv(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:498:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `send` of type `def send(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:600:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `bind` of type `def bind(self, *_args, **_kwargs) -> None`
- tests/test_utils_socket.py:605:5 error[unresolved-attribute] Object of type `bound method _DummySocket.bind(...) -> None` has no attribute `assert_called_once`
- tests/test_utils_socket.py:612:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `settimeout` of type `def settimeout(self, value) -> Unknown`
- tests/test_utils_socket.py:619:12 error[unresolved-attribute] Object of type `bound method _DummySocket.settimeout(value) -> Unknown` has no attribute `call_args_list`
- tests/test_utils_socket.py:783:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `send` of type `def send(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:810:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `recv` of type `def recv(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:813:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `recv` of type `def recv(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:847:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `recv` of type `def recv(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:867:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `recv` of type `def recv(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:869:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `recv` of type `def recv(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:986:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `recv` of type `def recv(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:1010:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `recv` of type `def recv(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:1023:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `recv` of type `def recv(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:1027:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `recv` of type `def recv(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:1049:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `recv` of type `def recv(self, *_args, **_kwargs) -> Unknown`
- tests/test_utils_socket.py:1057:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `recv` of type `def recv(self, *_args, **_kwargs) -> Unknown`

bandersnatch (https://github.com/pypa/bandersnatch)
+ src/bandersnatch/tests/test_sync.py:17:70 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/bandersnatch/tests/test_mirror.py:236:67 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/bandersnatch/tests/test_mirror.py:311:75 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/bandersnatch/tests/test_mirror.py:331:75 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/bandersnatch/tests/test_mirror.py:367:75 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/bandersnatch/tests/test_mirror.py:411:75 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/bandersnatch/tests/test_mirror.py:436:62 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/bandersnatch/tests/test_mirror.py:510:75 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/bandersnatch/tests/test_mirror.py:547:75 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/bandersnatch/tests/test_package.py:30:12 error[unresolved-attribute] Object of type `bound method Master.get_package_metadata(package_name: str, serial: int = 0) -> CoroutineType[Any, Any, Any]` has no attribute `await_count`
- src/bandersnatch/tests/test_package.py:59:12 error[unresolved-attribute] Object of type `bound method Master.get_package_metadata(package_name: str, serial: int = 0) -> CoroutineType[Any, Any, Any]` has no attribute `await_count`
+ src/bandersnatch/tests/test_package.py:25:69 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/bandersnatch/tests/test_package.py:39:47 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/bandersnatch/tests/test_package.py:53:72 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive

cki-lib (https://gitlab.com/cki-project/cki-lib)
- tests/test_cronjob.py:38:9 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `run` of type `def run(self, *, last_run_datetime=None) -> Unknown`
- tests/test_cronjob.py:42:25 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `called`
- tests/test_cronjob.py:80:9 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `run` of type `def run(self, *, last_run_datetime=None) -> Unknown`
- tests/test_cronjob.py:85:25 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `called`
- tests/test_cronjob.py:86:9 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `assert_called_with`
- tests/test_cronjob.py:92:9 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `reset_mock`
- tests/test_cronjob.py:95:26 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `called`
- tests/test_cronjob.py:110:29 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `called`
- tests/test_cronjob.py:111:13 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `assert_called_with`
- tests/test_cronjob.py:115:13 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `reset_mock`
- tests/test_cronjob.py:118:29 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `called`
- tests/test_cronjob.py:119:13 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `assert_called_with`
- tests/test_cronjob.py:125:13 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `reset_mock`
- tests/test_cronjob.py:128:29 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `called`
- tests/test_cronjob.py:129:13 error[unresolved-attribute] Object of type `bound method CronJob.run(*, last_run_datetime=None) -> Unknown` has no attribute `assert_called_with`
- tests/test_cronjob.py:140:9 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `_run` of type `def _run(self, last_run_datetime) -> Unknown`
- tests/test_cronjob.py:184:9 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `_run` of type `def _run(self, last_run_datetime) -> Unknown`
- tests/test_cronjob.py:246:9 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `_run` of type `def _run(self, last_run_datetime) -> Unknown`
- tests/test_psql.py:98:9 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `_execute` of type `def _execute(self, query, *args) -> Unknown`
- tests/test_psql.py:99:9 error[unresolved-attribute] Unresolved attribute `side_effect` on type `bound method PSQLHandler._execute(query, *args) -> Unknown`
- tests/test_psql.py:102:29 error[unresolved-attribute] Object of type `bound method PSQLHandler._execute(query, *args) -> Unknown` has no attribute `call_count`

cloud-init (https://github.com/canonical/cloud-init)
- tests/unittests/sources/test_azure.py:1262:13 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `get_tmp_exec_path` on type `(Unknown & ~str) | Distro`
- tests/unittests/sources/test_openstack.py:849:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_read_ec2_metadata` of type `def _read_ec2_metadata(self) -> Unknown`
- tests/unittests/test_stages.py:98:9 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `is_new_instance` of type `def is_new_instance(self) -> Unknown`

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- tests/appsec/appsec/api_security/test_api_security_manager.py:32:13 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_should_collect_schema` of type `def _should_collect_schema(self, env: ASM_Environment, priority: int | float) -> bool | None`
- tests/ci_visibility/test_ci_visibility.py:1827:13 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `_is_gzip_supported_by_agent` of type `def _is_gzip_supported_by_agent(self) -> bool`
- tests/ci_visibility/test_ci_visibility.py:1845:13 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `_is_gzip_supported_by_agent` of type `def _is_gzip_supported_by_agent(self) -> bool`
- tests/ci_visibility/test_ci_visibility.py:1851:13 error[unresolved-attribute] Object of type `bound method CIVisibility._is_gzip_supported_by_agent() -> bool` has no attribute `assert_called_once`

dragonchain (https://github.com/dragonchain/dragonchain)
- dragonchain/lib/dto/btc_utest.py:51:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_current_block` of type `def get_current_block(self) -> int`
- dragonchain/lib/dto/btc_utest.py:53:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork.get_current_block() -> int` has no attribute `assert_called_once`
- dragonchain/lib/dto/btc_utest.py:56:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_current_block` of type `def get_current_block(self) -> int`
- dragonchain/lib/dto/btc_utest.py:58:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork.get_current_block() -> int` has no attribute `assert_called_once`
- dragonchain/lib/dto/btc_utest.py:61:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call` of type `def _call(self, method: str, *args: Any) -> Any`
- dragonchain/lib/dto/btc_utest.py:62:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `sign_transaction` of type `def sign_transaction(self, raw_transaction: dict[str, Any]) -> str`
- dragonchain/lib/dto/btc_utest.py:66:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork._call(method: str, *args: Any) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/btc_utest.py:67:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork.sign_transaction(raw_transaction: dict[str, Any]) -> str` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/btc_utest.py:70:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_utxos` of type `def _get_utxos(self) -> list[Unknown]`
- dragonchain/lib/dto/btc_utest.py:77:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call` of type `def _call(self, method: str, *args: Any) -> Any`
- dragonchain/lib/dto/btc_utest.py:81:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork._call(method: str, *args: Any) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/btc_utest.py:84:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call` of type `def _call(self, method: str, *args: Any) -> Any`
- dragonchain/lib/dto/btc_utest.py:87:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork._call(method: str, *args: Any) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/btc_utest.py:90:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_calculate_transaction_fee` of type `def _calculate_transaction_fee(self) -> int`
- dragonchain/lib/dto/btc_utest.py:93:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork._calculate_transaction_fee() -> int` has no attribute `assert_called_once`
- dragonchain/lib/dto/btc_utest.py:105:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork._call(method: str, *args: Any) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/btc_utest.py:111:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork._call(method: str, *args: Any) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/btc_utest.py:114:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call` of type `def _call(self, method: str, *args: Any) -> Any`
- dragonchain/lib/dto/btc_utest.py:117:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork._call(method: str, *args: Any) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/btc_utest.py:120:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call` of type `def _call(self, method: str, *args: Any) -> Any`
- dragonchain/lib/dto/btc_utest.py:122:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork._call(method: str, *args: Any) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/btc_utest.py:128:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork._call(method: str, *args: Any) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/btc_utest.py:131:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call` of type `def _call(self, method: str, *args: Any) -> Any`
- dragonchain/lib/dto/btc_utest.py:138:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call` of type `def _call(self, method: str, *args: Any) -> Any`
- dragonchain/lib/dto/btc_utest.py:140:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork._call(method: str, *args: Any) -> Any` has no attribute `assert_called_once_with`
- dragonchain/job_processor/contract_job_utest.py:263:13 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `set_state` of type `def set_state(self, state: str | ContractState, msg: str = "") -> None`
- dragonchain/job_processor/contract_job_utest.py:264:13 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `save` of type `def save(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:274:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `docker_login_if_necessary` of type `def docker_login_if_necessary(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:280:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `pull_image` of type `def pull_image(self, image_name: str) -> Unknown`
- dragonchain/job_processor/contract_job_utest.py:281:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `create_dockerfile` of type `def create_dockerfile(self) -> str`
- dragonchain/job_processor/contract_job_utest.py:286:9 error[unresolved-attribute] Object of type `bound method ContractJob.pull_image(image_name: str) -> Unknown` has no attribute `assert_called`
- dragonchain/job_processor/contract_job_utest.py:287:9 error[unresolved-attribute] Object of type `bound method ContractJob.create_dockerfile() -> str` has no attribute `assert_called`
- dragonchain/job_processor/contract_job_utest.py:307:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `set_state` of type `def set_state(self, state: str | ContractState, msg: str = "") -> None`
- dragonchain/job_processor/contract_job_utest.py:308:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `save` of type `def save(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:312:9 error[unresolved-attribute] Object of type `bound method SmartContractModel.set_state(state: str | ContractState, msg: str = "") -> None` has no attribute `assert_called`
- dragonchain/job_processor/contract_job_utest.py:330:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `set_state` of type `def set_state(self, state: str | ContractState, msg: str = "") -> None`
- dragonchain/job_processor/contract_job_utest.py:331:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `save` of type `def save(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:334:9 error[unresolved-attribute] Object of type `bound method SmartContractModel.set_state(state: str | ContractState, msg: str = "") -> None` has no attribute `assert_called`
- dragonchain/job_processor/contract_job_utest.py:356:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `set_state` of type `def set_state(self, state: str | ContractState, msg: str = "") -> None`
- dragonchain/job_processor/contract_job_utest.py:361:9 error[unresolved-attribute] Object of type `bound method SmartContractModel.set_state(state: str | ContractState, msg: str = "") -> None` has no attribute `assert_called`
- dragonchain/job_processor/contract_job_utest.py:375:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `set_state` of type `def set_state(self, state: str | ContractState, msg: str = "") -> None`
- dragonchain/job_processor/contract_job_utest.py:381:9 error[unresolved-attribute] Object of type `bound method SmartContractModel.set_state(state: str | ContractState, msg: str = "") -> None` has no attribute `assert_called`
- dragonchain/job_processor/contract_job_utest.py:416:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `set_state` of type `def set_state(self, state: str | ContractState, msg: str = "") -> None`
- dragonchain/job_processor/contract_job_utest.py:417:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `save` of type `def save(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:435:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `save` of type `def save(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:436:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `new_from_build_task` of type `def new_from_build_task(data: Mapping[str, Any]) -> SmartContractModel`
- dragonchain/job_processor/contract_job_utest.py:438:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `create` of type `def create(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:440:9 error[unresolved-attribute] Function `create` has no attribute `assert_called`
- dragonchain/job_processor/contract_job_utest.py:445:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `new_from_build_task` of type `def new_from_build_task(data: Mapping[str, Any]) -> SmartContractModel`
- dragonchain/job_processor/contract_job_utest.py:453:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `schedule_contract` of type `def schedule_contract(self, action: SchedulerActions = SchedulerActions.CREATE) -> None`
- dragonchain/job_processor/contract_job_utest.py:454:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `build_contract_image` of type `def build_contract_image(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:455:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `deploy_to_openfaas` of type `def deploy_to_openfaas(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:456:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `create_openfaas_secrets` of type `def create_openfaas_secrets(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:458:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `save` of type `def save(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:459:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `populate_api_keys` of type `def populate_api_keys(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:465:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `deploy_to_openfaas` of type `def deploy_to_openfaas(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:466:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `schedule_contract` of type `def schedule_contract(self, action: SchedulerActions = SchedulerActions.CREATE) -> None`
- dragonchain/job_processor/contract_job_utest.py:468:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `save` of type `def save(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:469:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `create_openfaas_secrets` of type `def create_openfaas_secrets(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:484:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_contract_by_txn_type` of type `def get_contract_by_txn_type(txn_type: str) -> SmartContractModel`
- dragonchain/job_processor/contract_job_utest.py:485:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `new_from_build_task` of type `def new_from_build_task(data: Mapping[str, Any]) -> SmartContractModel`
- dragonchain/job_processor/contract_job_utest.py:486:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `create_dockerfile` of type `def create_dockerfile(self) -> str`
- dragonchain/job_processor/contract_job_utest.py:487:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `create_openfaas_secrets` of type `def create_openfaas_secrets(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:488:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `delete_contract_image` of type `def delete_contract_image(self, image_digest: str) -> None`
- dragonchain/job_processor/contract_job_utest.py:489:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `deploy_to_openfaas` of type `def deploy_to_openfaas(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:490:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `pull_image` of type `def pull_image(self, image_name: str) -> Unknown`
- dragonchain/job_processor/contract_job_utest.py:491:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `schedule_contract` of type `def schedule_contract(self, action: SchedulerActions = SchedulerActions.CREATE) -> None`
- dragonchain/job_processor/contract_job_utest.py:508:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `delete_openfaas_secrets` of type `def delete_openfaas_secrets(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:509:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `delete_openfaas_function` of type `def delete_openfaas_function(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:510:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `delete_contract_data` of type `def delete_contract_data(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:511:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `delete_contract_image` of type `def delete_contract_image(self, image_digest: str) -> None`
- dragonchain/job_processor/contract_job_utest.py:512:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `unschedule_contract` of type `def unschedule_contract(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:513:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `save` of type `def save(self) -> None`
- dragonchain/job_processor/contract_job_utest.py:515:9 error[unresolved-attribute] Object of type `bound method ContractJob.delete_openfaas_secrets() -> None` has no attribute `assert_called_once`
- dragonchain/job_processor/contract_job_utest.py:516:9 error[unresolved-attribute] Object of type `bound method ContractJob.delete_openfaas_function() -> None` has no attribute `assert_called_once`
- dragonchain/job_processor/contract_job_utest.py:517:9 error[unresolved-attribute] Object of type `bound method ContractJob.delete_contract_image(image_digest: str) -> None` has no attribute `assert_called_once`
- dragonchain/job_processor/contract_job_utest.py:518:9 error[unresolved-attribute] Object of type `bound method ContractJob.delete_contract_data() -> None` has no attribute `assert_called_once`
- dragonchain/job_processor/contract_job_utest.py:519:9 error[unresolved-attribute] Object of type `bound method ContractJob.unschedule_contract() -> None` has no attribute `assert_called_once`
- dragonchain/job_processor/contract_job_utest.py:269:13 error[unresolved-attribute] Object of type `bound method SmartContractModel.set_state(state: str | ContractState, msg: str = "") -> None` has no attribute `assert_called_once`
+ dragonchain/job_processor/contract_job_utest.py:269:13 error[unresolved-attribute] Attribute `assert_called_once` is not defined on `bound method SmartContractModel.set_state(state: str | ContractState, msg: str = "") -> None` in union `(bound method SmartContractModel.set_state(state: str | ContractState, msg: str = "") -> None) | MagicMock`
- dragonchain/lib/database/redisearch_utest.py:70:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_redisearch_index_client` of type `def _get_redisearch_index_client(index: str) -> Unknown`
- dragonchain/lib/database/redisearch_utest.py:73:9 error[unresolved-attribute] Function `_get_redisearch_index_client` has no attribute `assert_called_once_with`
- dragonchain/lib/database/redisearch_utest.py:85:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_redisearch_index_client` of type `def _get_redisearch_index_client(index: str) -> Unknown`
- dragonchain/lib/database/redisearch_utest.py:93:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_redisearch_index_client` of type `def _get_redisearch_index_client(index: str) -> Unknown`
- dragonchain/lib/database/redisearch_utest.py:103:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_redisearch_index_client` of type `def _get_redisearch_index_client(index: str) -> Unknown`
- dragonchain/lib/database/redisearch_utest.py:105:9 error[unresolved-attribute] Function `_get_redisearch_index_client` has no attribute `assert_called_once_with`
- dragonchain/lib/database/redisearch_utest.py:110:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_redisearch_index_client` of type `def _get_redisearch_index_client(index: str) -> Unknown`
- dragonchain/lib/database/redisearch_utest.py:113:9 error[unresolved-attribute] Function `_get_redisearch_index_client` has no attribute `assert_called_once_with`
- dragonchain/lib/database/redisearch_utest.py:130:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_redisearch_index_client` of type `def _get_redisearch_index_client(index: str) -> Unknown`
- dragonchain/lib/database/redisearch_utest.py:135:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_redisearch_index_client` of type `def _get_redisearch_index_client(index: str) -> Unknown`
- dragonchain/lib/database/redisearch_utest.py:142:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_redisearch_index_client` of type `def _get_redisearch_index_client(index: str) -> Unknown`
- dragonchain/lib/database/redisearch_utest.py:175:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_redisearch_index_client` of type `def _get_redisearch_index_client(index: str) -> Unknown`
- dragonchain/lib/database/redisearch_utest.py:177:9 error[unresolved-attribute] Function `_get_redisearch_index_client` has no attribute `assert_called_once_with`
- dragonchain/lib/database/redisearch_utest.py:193:9 error[unresolved-attribute] Function `_get_redisearch_index_client` has no attribute `assert_any_call`
- dragonchain/lib/database/redisearch_utest.py:195:9 error[unresolved-attribute] Function `_get_redisearch_index_client` has no attribute `assert_any_call`
- dragonchain/lib/database/redisearch_utest.py:196:9 error[unresolved-attribute] Function `_get_redisearch_index_client` has no attribute `assert_any_call`
- dragonchain/lib/database/redisearch_utest.py:197:9 error[unresolved-attribute] Function `_get_redisearch_index_client` has no attribute `assert_any_call`
- dragonchain/lib/dto/bnb_utest.py:73:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_current_block` of type `def get_current_block(self) -> int`
- dragonchain/lib/dto/bnb_utest.py:75:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork.get_current_block() -> int` has no attribute `assert_called_once`
- dragonchain/lib/dto/bnb_utest.py:78:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_current_block` of type `def get_current_block(self) -> int`
- dragonchain/lib/dto/bnb_utest.py:80:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork.get_current_block() -> int` has no attribute `assert_called_once`
- dragonchain/lib/dto/bnb_utest.py:84:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_fetch_account` of type `def _fetch_account(self) -> Unknown`
- dragonchain/lib/dto/bnb_utest.py:97:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork._fetch_account() -> Unknown` has no attribute `assert_called_once`
- dragonchain/lib/dto/bnb_utest.py:109:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_fetch_account` of type `def _fetch_account(self) -> Unknown`
- dragonchain/lib/dto/bnb_utest.py:118:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_build_transaction_msg` of type `def _build_transaction_msg(self, raw_transaction: dict[str, Any]) -> dict[Unknown, Unknown]`
- dragonchain/lib/dto/bnb_utest.py:123:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_rpc` of type `def _call_node_rpc(self, method: str, params: dict[str, Any]) -> Any`
- dragonchain/lib/dto/bnb_utest.py:126:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork._call_node_rpc(method: str, params: dict[str, Any]) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/bnb_utest.py:131:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_rpc` of type `def _call_node_rpc(self, method: str, params: dict[str, Any]) -> Any`
- dragonchain/lib/dto/bnb_utest.py:134:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork._call_node_rpc(method: str, params: dict[str, Any]) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/bnb_utest.py:140:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_api` of type `def _call_node_api(self, path: str) -> Any`
- dragonchain/lib/dto/bnb_utest.py:151:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork._call_node_api(path: str) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/bnb_utest.py:156:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_api` of type `def _call_node_api(self, path: str) -> Any`
- dragonchain/lib/dto/bnb_utest.py:164:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_api` of type `def _call_node_api(self, path: str) -> Any`
- dragonchain/lib/dto/bnb_utest.py:170:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_current_block` of type `def get_current_block(self) -> int`
- dragonchain/lib/dto/bnb_utest.py:173:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_rpc` of type `def _call_node_rpc(self, method: str, params: dict[str, Any]) -> Any`
- dragonchain/lib/dto/bnb_utest.py:176:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork._call_node_rpc(method: str, params: dict[str, Any]) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/bnb_utest.py:177:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork.get_current_block() -> int` has no attribute `assert_called_once`
- dragonchain/lib/dto/bnb_utest.py:180:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_current_block` of type `def get_current_block(self) -> int`
- dragonchain/lib/dto/bnb_utest.py:183:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_rpc` of type `def _call_node_rpc(self, method: str, params: dict[str, Any]) -> Any`
- dragonchain/lib/dto/bnb_utest.py:186:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork._call_node_rpc(method: str, params: dict[str, Any]) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/bnb_utest.py:187:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork.get_current_block() -> int` has no attribute `assert_called_once`
- dragonchain/lib/dto/bnb_utest.py:194:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork._call_node_rpc(method: str, params: dict[str, Any]) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/bnb_utest.py:322:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_api` of type `def _call_node_api(self, path: str) -> Any`
- dragonchain/lib/dto/bnb_utest.py:325:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork._call_node_api(path: str) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/bnb_utest.py:331:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_api` of type `def _call_node_api(self, path: str) -> Any`
- dragonchain/lib/dto/bnb_utest.py:333:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork._call_node_api(path: str) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/bnb_utest.py:338:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_rpc` of type `def _call_node_rpc(self, method: str, params: dict[str, Any]) -> Any`
- dragonchain/lib/dto/bnb_utest.py:339:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_api` of type `def _call_node_api(self, path: str) -> Any`
- dragonchain/lib/dto/bnb_utest.py:341:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork._call_node_rpc(method: str, params: dict[str, Any]) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/bnb_utest.py:342:9 error[unresolved-attribute] Object of type `bound method BinanceNetwork._call_node_api(path: str) -> Any` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/bnb_utest.py:347:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_rpc` of type `def _call_node_rpc(self, method: str, params: dict[str, Any]) -> Any`
- dragonchain/lib/dto/bnb_utest.py:349:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_call_node_api` of type `def _call_node_api(self, path: str) -> Any`
- dragonchain/lib/dto/eth_utest.py:51:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `sign_transaction` of type `def sign_transaction(self, raw_transaction: dict[str, Any]) -> str`
- dragonchain/lib/dto/eth_utest.py:60:9 error[unresolved-attribute] Object of type `bound method EthereumNetwork.sign_transaction(raw_transaction: dict[str, Any]) -> str` has no attribute `assert_called_once_with`
- dragonchain/lib/dto/eth_utest.py:72:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_current_block` of type `def get_current_block(self) -> int`
- dragonchain/lib/dto/eth_utest.py:74:9 error[unresolved-attribute] Object of type `bound method EthereumNetwork.get_current_block() -> int` has no attribute `assert_called_once`
- dragonchain/lib/dto/eth_utest.py:77:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_current_block` of type `def get_current_block(self) -> int`
- dragonchain/lib/dto/eth_utest.py:79:9 error[unresolved-attribute] Object of type `bound method EthereumNetwork.get_current_block() -> int` has no attribute `assert_called_once`
- dragonchain/lib/dto/eth_utest.py:88:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_calculate_transaction_fee` of type `def _calculate_transaction_fee(self) -> int`
- dragonchain/lib/dto/eth_utest.py:91:9 error[unresolved-attribute] Object of type `bound method EthereumNetwork._calculate_transaction_fee() -> int` has no attribute `assert_called_once`
- dragonchain/lib/dto/eth_utest.py:115:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_current_block` of type `def get_current_block(self) -> int`
- dragonchain/lib/dto/eth_utest.py:120:9 error[unresolved-attribute] Object of type `bound method EthereumNetwork.get_current_block() -> int` has no attribute `assert_called_once`
- dragonchain/lib/dto/eth_utest.py:123:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_current_block` of type `def get_current_block(self) -> int`
- dragonchain/lib/dto/eth_utest.py:128:9 error[unresolved-attribute] Object of type `bound method EthereumNetwork.get_current_block() -> int` has no attribute `assert_called_once`
- dragonchain/lib/dto/eth_utest.py:136:9 error[unresolved-attribute] Object of type `bound method EthereumNetwork.get_current_block() -> int` has no attribute `assert_called_once`
- dragonchain/lib/interfaces/storage_utest.py:44:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `cache_get` of type `def cache_get(key: str, service_name: str = "storage") -> bytes | None`
- dragonchain/lib/interfaces/storage_utest.py:45:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `cache_put` of type `def cache_put(key: str, value: str | bytes, cache_expire: int | None = None, service_name: str = "storage") -> bool`
- dragonchain/lib/interfaces/storage_utest.py:46:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `cache_delete` of type `def cache_delete(key: str, service_name: str = "storage") -> int`
- dragonchain/lib/interfaces/storage_utest.py:58:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:62:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:64:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `cache_put` of type `def cache_put(key: str, value: str | bytes, cache_expire: int | None = None, service_name: str = "storage") -> bool`
- dragonchain/lib/interfaces/storage_utest.py:66:9 error[unresolved-attribute] Function `cache_get` has no attribute `assert_called_once_with`
- dragonchain/lib/interfaces/storage_utest.py:67:9 error[unresolved-attribute] Function `cache_put` has no attribute `assert_called_once_with`
- dragonchain/lib/interfaces/storage_utest.py:70:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:78:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `put` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:90:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `delete` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:98:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `list_objects` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:100:9 error[unresolved-attribute] Object of type `(def list_objects(location: str, prefix: str) -> list[str]) | (def list_objects(location: str, prefix: str) -> list[str])` has no attribute `assert_called_once_with`
- dragonchain/lib/interfaces/storage_utest.py:103:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `list_objects` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:111:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `does_superkey_exist` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:123:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `put` of type `def put(key: str, value: bytes, cache_expire: int | None = None, should_cache: bool = True) -> None`
- dragonchain/lib/interfaces/storage_utest.py:138:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `list_objects` of type `def list_objects(prefix: str) -> list[str]`
- dragonchain/lib/interfaces/storage_utest.py:140:9 error[unresolved-attribute] Function `list_objects` has no attribute `assert_called_once_with`
- dragonchain/lib/interfaces/storage_utest.py:144:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `delete` of type `def delete(key: str) -> None`
- dragonchain/lib/interfaces/storage_utest.py:146:9 error[unresolved-attribute] Function `delete` has no attribute `assert_called_once_with`
- dragonchain/lib/interfaces/storage_utest.py:149:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `list_objects` of type `def list_objects(prefix: str) -> list[str]`
- dragonchain/lib/interfaces/storage_utest.py:154:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `list_objects` of type `def list_objects(prefix: str) -> list[str]`
- dragonchain/lib/interfaces/storage_utest.py:158:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `select_transaction` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:160:9 error[unresolved-attribute] Object of type `(def select_transaction(location: str, block_id: str, txn_id: str) -> dict[Unknown, Unknown]) | (def select_transaction(location: str, block_id: str, txn_id: str) -> dict[Unknown, Unknown])` has no attribute `assert_called_once_with`
- dragonchain/lib/interfaces/storage_utest.py:163:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `select_transaction` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:164:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `cache_get` of type `def cache_get(key: str, service_name: str = "storage") -> bytes | None`
- dragonchain/lib/interfaces/storage_utest.py:169:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `select_transaction` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:170:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `cache_get` of type `def cache_get(key: str, service_name: str = "storage") -> bytes | None`
- dragonchain/lib/interfaces/storage_utest.py:178:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `select_transaction` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:183:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `select_transaction` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:187:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `select_transaction` on type `<module 'dragonchain.lib.interfaces.aws.s3'> | <module 'dragonchain.lib.interfaces.local.disk'>`
- dragonchain/lib/interfaces/storage_utest.py:192:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `put` of type `def put(key: str, value: bytes, cache_expire: int | None = None, should_cache: bool = True) -> None`
- dragonchain/lib/interfaces/storage_utest.py:194:9 error[unresolved-attribute] Function `put` has no attribute `assert_called_once_with`
- dragonchain/transaction_processor/level_5_actions_utest.py:238:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `publish_l5_hash_to_public_network` of type `def publish_l5_hash_to_public_network(self, l5_block_hash: str) -> str`
- dragonchain/transaction_processor/level_5_actions_utest.py:466:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `check_balance` of type `def check_balance(self) -> int`
- dragonchain/transaction_processor/level_5_actions_utest.py:467:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_transaction_fee_estimate` of type `def get_transaction_fee_estimate(self) -> int`
- dragonchain/transaction_processor/level_5_actions_utest.py:470:9 error[unresolved-attribute] Object of type `bound method InterchainModel.check_balance() -> int` has no attribute `assert_called_once`
- dragonchain/transaction_processor/level_5_actions_utest.py:481:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `check_balance` of type `def check_balance(self) -> int`
- dragonchain/transaction_processor/level_5_actions_utest.py:482:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_transaction_fee_estimate` of type `def get_transaction_fee_estimate(self) -> int`
- dragonchain/transaction_processor/level_5_actions_utest.py:485:9 error[unresolved-attribute] Object of type `bound method InterchainModel.check_balance() -> int` has no attribute `assert_called_once`
- dragonchain/transaction_processor/level_5_actions_utest.py:493:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_transaction_fee_estimate` of type `def get_transaction_fee_estimate(self) -> int`
- dragonchain/transaction_processor/level_5_actions_utest.py:496:9 error[unresolved-attribute] Object of type `bound method InterchainModel.get_transaction_fee_estimate() -> int` has no attribute `assert_called_once`
- dragonchain/transaction_processor/level_5_actions_utest.py:507:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_transaction_fee_estimate` of type `def get_transaction_fee_estimate(self) -> int`
- dragonchain/transaction_processor/level_5_actions_utest.py:510:9 error[unresolved-attribute] Object of type `bound method InterchainModel.get_transaction_fee_estimate() -> int` has no attribute `assert_called_once`
- dragonchain/transaction_processor/level_5_actions_utest.py:519:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_transaction_fee_estimate` of type `def get_transaction_fee_estimate(self) -> int`
- dragonchain/transaction_processor/level_5_actions_utest.py:522:9 error[unresolved-attribute] Object of type `bound method InterchainModel.get_transaction_fee_estimate() -> int` has no attribute `assert_called_once`
- dragonchain/webserver/lib/verifications_dao_utest.py:106:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_redisearch_index_client` of type `def _get_redisearch_index_client(index: str) -> Unknown`
- dragonchain/webserver/lib/verifications_dao_utest.py:132:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_redisearch_index_client` of type `def _get_redisearch_index_client(index: str) -> Unknown`

egglog-python (https://github.com/egraphs-good/egglog-python)
- python/tests/test_high_level.py:1334:9 error[unresolved-attribute] Function `my_cost_model` has no attribute `assert_any_call`
- python/tests/test_high_level.py:1335:9 error[unresolved-attribute] Function `my_cost_model` has no attribute `assert_any_call`
- python/tests/test_high_level.py:1336:9 error[unresolved-attribute] Function `my_cost_model` has no attribute `assert_any_call`
- python/tests/test_high_level.py:1337:9 error[unresolved-attribute] Function `my_cost_model` has no attribute `assert_any_call`

ignite (https://github.com/pytorch/ignite)
- tests/ignite/metrics/test_metric.py:810:5 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `compute` of type `def compute(self) -> Unknown`
- tests/ignite/metrics/test_metric.py:818:5 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `compute` of type `def compute(self) -> Unknown`

manticore (https://github.com/trailofbits/manticore)
- tests/native/test_memory.py:1875:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `sys` of type `<module 'sys'>`
- tests/native/test_memory.py:1882:9 error[unresolved-attribute] Module `sys` has no member `configure_mock`
- tests/native/test_memory.py:1886:9 error[unresolved-attribute] Module `sys` has no member `configure_mock`
- tests/native/test_memory.py:1890:9 error[unresolved-attribute] Module `sys` has no member `configure_mock`

mitmproxy (https://github.com/mitmproxy/mitmproxy)
- test/mitmproxy/tools/console/test_flowview.py:92:5 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_content_view` of type `_lru_cache_wrapper[tuple[str, list[Unknown]]]`
- test/mitmproxy/tools/console/test_flowview.py:94:5 error[unresolved-attribute] Object of type `_lru_cache_wrapper[tuple[str, list[Unknown]]]` has no attribute `assert_called_with`

mkdocs (https://github.com/mkdocs/mkdocs)
- mkdocs/tests/structure/file_tests.py:660:9 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `is_modified` of type `def is_modified(self) -> bool`
- mkdocs/tests/structure/file_tests.py:671:9 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `is_modified` of type `def is_modified(self) -> bool`
- mkdocs/tests/structure/file_tests.py:682:9 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `is_modified` of type `def is_modified(self) -> bool`

optuna (https://github.com/optuna/optuna)
- tests/study_tests/test_study.py:1707:5 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_all_trials` of type `def get_all_trials(self, study_id: int, deepcopy: bool = True, states: Container[TrialState] | None = None) -> list[FrozenTrial]`

prefect (https://github.com/PrefectHQ/prefect)
- src/integrations/prefect-aws/tests/test_glue_job.py:120:5 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_get_client` of type `def _get_client(self) -> Any`
- src/integrations/prefect-aws/tests/test_glue_job.py:121:5 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_start_job` of type `def _start_job(self, client: Any) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:375:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:815:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:862:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:942:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:988:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:1037:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:1089:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:1142:13 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:1185:13 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:1263:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:1812:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_retrieve_task_definition` of type `def _retrieve_task_definition(self, logger: Logger, ecs_client: Unknown, task_definition: str) -> Unknown`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:2276:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:2312:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-aws/tests/workers/test_ecs_worker.py:2370:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_create_task_run` of type `def _create_task_run(self, ecs_client: Unknown, task_run_request: dict[Unknown, Unknown]) -> str`
- src/integrations/prefect-dbt/tests/core/test_orchestrator_per_node.py:1373:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `_execute_per_node` of type `def _execute_per_node(self, waves, phases, largest_wave, full_refresh, macro_paths=None, freshness_results=None, all_nodes=None, adapter_type=None, project_name=None, target: str | None = None, extra_cli_args: list[str] | None = None, all_executable_nodes=None) -> Unknown`

rotki (https://github.com/rotki/rotki)
+ rotkehlchen/tests/exchanges/test_bitfinex.py:274:51 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ rotkehlchen/tests/exchanges/test_bitfinex.py:600:51 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ rotkehlchen/tests/exchanges/test_bitfinex.py:1479:51 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ rotkehlchen/tests/exchanges/test_bitfinex.py:1720:51 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- rotkehlchen/tests/unit/test_tokens.py:203:51 error[unresolved-attribute] Function `find_main_currency_prices` has no attribute `call_args_list`

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py:886:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `_raw_predict` of type `def _raw_predict(self, X, n_threads=None) -> Unknown`
- sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py:912:5 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `_raw_predict` of type `def _raw_predict(self, X, n_threads=None) -> Unknown`

scrapy (https://github.com/scrapy/scrapy)
- tests/test_downloadermiddleware_redirect.py:407:5 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_spider_middleware` of type `def get_spider_middleware[_T](self, cls: type[_T]) -> _T | None`
- tests/test_downloadermiddleware_redirect.py:421:5 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_spider_middleware` of type `def get_spider_middleware[_T](self, cls: type[_T]) -> _T | None`
- tests/test_downloadermiddleware_redirect.py:444:5 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_spider_middleware` of type `def get_spider_middleware[_T](self, cls: type[_T]) -> _T | None`
- tests/test_downloadermiddleware_redirect_metarefresh.py:144:5 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `get_spider_middleware` of type `def get_spider_middleware[_T](self, cls: type[_T]) -> _T | None`
- tests/test_downloadermiddleware_robotstxt.py:222:9 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `process_request_2` of type `def process_request_2(self, rp: RobotParser | None, request: Request) -> None`
- tests/test_downloadermiddleware_robotstxt.py:225:20 error[unresolved-attribute] Object of type `bound method RobotsTxtMiddleware.process_request_2(rp: RobotParser | None, request: Request) -> None` has no attribute `called`
- tests/test_downloadermiddleware_robotstxt.py:230:20 error[unresolved-attribute] Object of type `bound method RobotsTxtMiddleware.process_request_2(rp: RobotParser | None, request: Request) -> None` has no attribute `called`
- tests/test_downloadermiddleware_robotstxt.py:233:16 error[unresolved-attribute] Object of type `bound method RobotsTxtMiddleware.process_request_2(rp: RobotParser | None, request: Request) -> None` has no attribute `called`

steam.py (https://github.com/Gobot1234/steam.py)
- steam/protobufs/msg.py:97:32 error[invalid-parameter-default] Default value of type `MissingSentinel` is not assignable to annotated parameter type `EMsg`
- steam/protobufs/msg.py:145:32 error[invalid-parameter-default] Default value of type `MissingSentinel` is not assignable to annotated parameter type `EMsg`
- steam/protobufs/msg.py:309:9 error[invalid-parameter-default] Default value of type `MissingSentinel` is not assignable to annotated parameter type `AppID`
- steam/utils.py:565:29 error[invalid-parameter-default] Default value of type `MissingSentinel` is not assignable to annotated parameter type `_VT@ChainMap | _T@pop`

urllib3 (https://github.com/urllib3/urllib3)
- test/test_http2_connection.py:95:9 error[unresolved-attribute] Object of type `bound method HTTP2Connection.putheader(header: str | bytes, *values: str | bytes) -> None` has no attribute `assert_has_calls`

vision (https://github.com/pytorch/vision)
- test/datasets_utils.py:570:50 error[invalid-argument-type] Argument is incorrect: Expected `bool | None`, found `Mock`
- test/datasets_utils.py:570:50 error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `Mock`

Full report with detailed diff (timing results)

@codspeed-hq

codspeed-hq Bot commented Jun 16, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 65 untouched benchmarks
⏩ 70 skipped benchmarks1


Comparing charlie/fix-any-subclass-instances (2d896b1) with main (307feaa)

Open in CodSpeed

Footnotes

  1. 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@charliermarsh charliermarsh marked this pull request as ready for review June 16, 2026 13:08
@charliermarsh charliermarsh requested a review from a team as a code owner June 16, 2026 13:08
@astral-sh-bot astral-sh-bot Bot requested a review from carljm June 16, 2026 13:08
Comment thread crates/ty_python_semantic/resources/mdtest/annotations/annotated.md
@charliermarsh charliermarsh force-pushed the charlie/fix-any-subclass-instances branch 4 times, most recently from b2545fd to ed023d7 Compare June 18, 2026 16:28

@carljm carljm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Comment thread crates/ty_python_semantic/resources/mdtest/annotations/annotated.md
final: FinalClass = DynamicBase() # error: [invalid-assignment]
literal: Literal[1] = DynamicBase() # error: [invalid-assignment]

class FromUnknown(Unknown): ...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't hurt to test this case, and I think having it behave this way is fine, but we could decide to distinguish "inherits from the symbol Unknown" from "inherits from a name typed as Unknown", in the same way this PR distinguishes those two cases for Any. So I think this case is worthy of dedicated commentary (it does not fit the comment above), and it would be better if we test here using from somewhere import UnknownBase # error: [unresolved-import] and then class FromUnknownBase(UnknownBase): ... -- FromUnknownBase should also be assignable to a non-final class but not to a final one.

class IndirectSubclass(DynamicBase): ...

reveal_type(DynamicBase()) # revealed: DynamicBase
ordinary: Arbitrary = IndirectSubclass()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not also test that assignment of IndirectSubclass to a final class type or a literal type is an error?

y: Literal[1] = B()
```

A base expression whose inferred type is `Any` or `Unknown` does not count as explicitly inheriting

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prose does not describe the current state of the FromUnknown test below. It is inheriting from the symbol ty_extensions.Unknown, not from a base expression whose inferred type is Unknown.

static_assert(not is_assignable_to(TypeOf[Bar], int))
static_assert(not is_assignable_to(TypeOf[Baz], int))
static_assert(not is_assignable_to(TypeOf[Mixed], int))
static_assert(is_assignable_to(UnionDynamic, int))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems kind of random/unintended that this line tests UnionDynamic rather than TypeOf[UnionDynamic], and thus has a different result from the rest of the block.

class.explicit_bases(db).iter().any(|base| match base {
Type::SpecialForm(SpecialFormType::Any) => true,
Type::ClassLiteral(base) => inherits_from_any_inner(db, *base),
Type::GenericAlias(alias) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this arm is covered by any of the tests in this PR? Worth adding an explicit test for the generic alias case.


/// Return whether `class` inherits from the `Any` special form.
#[salsa::tracked(cycle_initial=|_, _, _| false, heap_size=ruff_memory_usage::heap_size)]
fn inherits_from_any_inner<'db>(db: &'db dyn Db, class: ClassLiteral<'db>) -> bool {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The memory increase on this PR is significant. And it feels like this recursive walking of explicit bases is kind of redundant with existing work we already do in building the MRO. I wonder if you tested the comparative perf/memory impact of baking this one bit of additional metadata directly into our MRO representation, rather than making it a separate query that walks explicit bases recursively?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did briefly, but I think I should try it again -- I agree with you.

@charliermarsh charliermarsh force-pushed the charlie/fix-any-subclass-instances branch from ed023d7 to fe56ed9 Compare June 19, 2026 03:42
@charliermarsh charliermarsh force-pushed the charlie/fix-any-subclass-instances branch from 67ecd9a to d5e35a3 Compare June 19, 2026 03:53
@charliermarsh charliermarsh force-pushed the charlie/fix-any-subclass-instances branch from d5e35a3 to bd6f428 Compare June 19, 2026 03:55
@charliermarsh charliermarsh enabled auto-merge (squash) June 19, 2026 16:14
@charliermarsh charliermarsh disabled auto-merge June 19, 2026 16:14
@charliermarsh charliermarsh force-pushed the charlie/fix-any-subclass-instances branch 2 times, most recently from 7dc96c3 to efe9f37 Compare June 19, 2026 17:02
@charliermarsh charliermarsh force-pushed the charlie/fix-any-subclass-instances branch from efe9f37 to 2d896b1 Compare June 19, 2026 17:08
@charliermarsh charliermarsh merged commit afa6bcb into main Jun 19, 2026
58 of 59 checks passed
@charliermarsh charliermarsh deleted the charlie/fix-any-subclass-instances branch June 19, 2026 17:18
charliermarsh added a commit that referenced this pull request Jun 20, 2026
## Summary

In #26034, we kept instances of classes that inherit from an explicit
`Any` base nominal, then recovered `Any` assignability through a
fallback after the ordinary relation check failed. That avoided
increasing the size of `Type`, but required the relation checker to
inspect the source class's MRO after the fact and discard any error
context produced by the failed check.

This records explicit-`Any` ancestry when we construct a nominal
instance instead. Static classes compute the bit in the same tracked MRO
walk that already classifies `TypedDict` instances, avoiding a second
cached query; dynamic classes derive the same flags from their existing
cached MRO. `ClassBase::Any` remains the compact MRO marker that
distinguishes an explicit `Any` base from a base expression whose
inferred type is `Any` or `Unknown`.

Within `NominalInstanceInner::NonTuple`, a small `NominalInstanceClass`
enum keeps ordinary `ClassType`s inline and stores only the uncommon
marked case behind an interned handle. Nesting the marker inside the
existing non-tuple payload means that `NominalInstanceInner` does not
need a dedicated explicit-`Any` variant, and the release layout
assertion continues to keep `Type` at 16 bytes.

Behavior remains unchanged from #26034. With the marker available
directly on nominal instances, the relation checker handles `Any`
assignability in an ordinary match arm. This removes the failed-relation
fallback and its error-context reset entirely.

The CI memory report decreases total reported memory on all four
projects: 5.06 kB on flake8, 23.64 kB on Trio, 132.16 kB on Sphinx, and
238.84 kB on Prefect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Behaviour of Any subclasses when mocking final classes

2 participants