-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add Json types and use for json.load(s) #5911
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
Conversation
This comment has been minimized.
This comment has been minimized.
parse_constant: None = ..., | ||
object_pairs_hook: None = ..., | ||
**kwds: Any, | ||
) -> Json: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like how this introduces an implicit union return and breaks code like json.loads(some_string)["Foo"]
. It is more correct, but the usual reasons for avoiding union returns apply here IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, another good reason for python/typing#566.
Diff from mypy_primer, showing the effect of this PR on open source code: kopf (https://github.com/nolar/kopf.git)
+ kopf/_cogs/configs/diffbase.py:197: error: Incompatible types in assignment (expression has type "Union[Dict[str, Any], List[Any], str, float, None]", variable has type "Optional[BodyEssence]")
+ kopf/_kits/webhooks.py:211: error: Argument 1 to "__call__" of "WebhookFn" has incompatible type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected "Request"
pandas (https://github.com/pandas-dev/pandas.git)
+ pandas/core/arrays/_arrow_utils.py:66: error: No overload variant of "__getitem__" of "list" matches argument type "str" [call-overload]
+ pandas/core/arrays/_arrow_utils.py:66: note: Possible overload variants:
+ pandas/core/arrays/_arrow_utils.py:66: note: def __getitem__(self, SupportsIndex) -> Any
+ pandas/core/arrays/_arrow_utils.py:66: note: def __getitem__(self, slice) -> List[Any]
+ pandas/core/arrays/_arrow_utils.py:66: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable [index]
+ pandas/core/arrays/_arrow_utils.py:66: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]" [index]
+ pandas/core/arrays/_arrow_utils.py:116: error: No overload variant of "__getitem__" of "list" matches argument type "str" [call-overload]
+ pandas/core/arrays/_arrow_utils.py:116: note: Possible overload variants:
+ pandas/core/arrays/_arrow_utils.py:116: note: def __getitem__(self, SupportsIndex) -> Any
+ pandas/core/arrays/_arrow_utils.py:116: note: def __getitem__(self, slice) -> List[Any]
+ pandas/core/arrays/_arrow_utils.py:116: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable [index]
+ pandas/core/arrays/_arrow_utils.py:116: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]" [index]
+ pandas/core/arrays/_arrow_utils.py:117: error: No overload variant of "__getitem__" of "list" matches argument type "str" [call-overload]
+ pandas/core/arrays/_arrow_utils.py:117: note: Possible overload variants:
+ pandas/core/arrays/_arrow_utils.py:117: note: def __getitem__(self, SupportsIndex) -> Any
+ pandas/core/arrays/_arrow_utils.py:117: note: def __getitem__(self, slice) -> List[Any]
+ pandas/core/arrays/_arrow_utils.py:117: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable [index]
+ pandas/core/arrays/_arrow_utils.py:117: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]" [index]
pip (https://github.com/pypa/pip.git)
+ src/pip/_internal/models/direct_url.py:217: error: Argument 1 to "from_dict" of "DirectUrl" has incompatible type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected "Dict[str, Any]"
optuna (https://github.com/optuna/optuna.git)
+ optuna/distributions.py:480: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ optuna/distributions.py:480: note: Possible overload variants:
+ optuna/distributions.py:480: note: def __getitem__(self, SupportsIndex) -> Any
+ optuna/distributions.py:480: note: def __getitem__(self, slice) -> List[Any]
+ optuna/distributions.py:480: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ optuna/distributions.py:480: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ optuna/distributions.py:481: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ optuna/distributions.py:481: note: Possible overload variants:
+ optuna/distributions.py:481: note: def __getitem__(self, SupportsIndex) -> Any
+ optuna/distributions.py:481: note: def __getitem__(self, slice) -> List[Any]
+ optuna/distributions.py:481: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ optuna/distributions.py:481: error: Unsupported target for indexed assignment ("Union[Any, str]")
+ optuna/distributions.py:481: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ optuna/distributions.py:481: error: Invalid index type "str" for "Union[Any, str]"; expected type "Union[int, slice]"
+ optuna/distributions.py:484: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ optuna/distributions.py:484: note: Possible overload variants:
+ optuna/distributions.py:484: note: def __getitem__(self, SupportsIndex) -> Any
+ optuna/distributions.py:484: note: def __getitem__(self, slice) -> List[Any]
+ optuna/distributions.py:484: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ optuna/distributions.py:484: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ optuna/distributions.py:485: error: Argument after ** must be a mapping
+ optuna/distributions.py:485: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ optuna/distributions.py:485: note: Possible overload variants:
+ optuna/distributions.py:485: note: def __getitem__(self, SupportsIndex) -> Any
+ optuna/distributions.py:485: note: def __getitem__(self, slice) -> List[Any]
+ optuna/distributions.py:485: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ optuna/distributions.py:485: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ optuna/distributions.py:487: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ optuna/distributions.py:487: note: Possible overload variants:
+ optuna/distributions.py:487: note: def __getitem__(self, SupportsIndex) -> Any
+ optuna/distributions.py:487: note: def __getitem__(self, slice) -> List[Any]
+ optuna/distributions.py:487: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ optuna/distributions.py:487: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ optuna/integration/allennlp/_executor.py:191: error: Incompatible return value type (got "Union[Dict[str, Any], List[Any], str, float, int, bool, None]", expected "Dict[str, Any]")
+ optuna/integration/allennlp/_dump_best_config.py:46: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ optuna/integration/allennlp/_dump_best_config.py:46: note: Possible overload variants:
+ optuna/integration/allennlp/_dump_best_config.py:46: note: def __getitem__(self, SupportsIndex) -> Any
+ optuna/integration/allennlp/_dump_best_config.py:46: note: def __getitem__(self, slice) -> List[Any]
+ optuna/integration/allennlp/_dump_best_config.py:46: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ optuna/integration/allennlp/_dump_best_config.py:46: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ optuna/integration/allennlp/_dump_best_config.py:48: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ optuna/integration/allennlp/_dump_best_config.py:48: note: Possible overload variants:
+ optuna/integration/allennlp/_dump_best_config.py:48: note: def __getitem__(self, SupportsIndex) -> Any
+ optuna/integration/allennlp/_dump_best_config.py:48: note: def __getitem__(self, slice) -> List[Any]
+ optuna/integration/allennlp/_dump_best_config.py:48: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ optuna/integration/allennlp/_dump_best_config.py:48: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ optuna/integration/allennlp/_dump_best_config.py:48: error: Invalid index type "str" for "Union[Any, str]"; expected type "Union[int, slice]"
+ optuna/integration/allennlp/_dump_best_config.py:50: error: Invalid index type "str" for "Union[Any, str]"; expected type "Union[int, slice]"
+ optuna/integration/allennlp/_dump_best_config.py:55: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ optuna/integration/allennlp/_dump_best_config.py:55: note: Possible overload variants:
+ optuna/integration/allennlp/_dump_best_config.py:55: note: def __getitem__(self, SupportsIndex) -> Any
+ optuna/integration/allennlp/_dump_best_config.py:55: note: def __getitem__(self, slice) -> List[Any]
+ optuna/integration/allennlp/_dump_best_config.py:55: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ optuna/integration/allennlp/_dump_best_config.py:55: error: Item "str" of "Union[Any, str]" has no attribute "pop"
+ optuna/integration/allennlp/_dump_best_config.py:55: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ optuna/integration/allennlp/_dump_best_config.py:57: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ optuna/integration/allennlp/_dump_best_config.py:57: note: Possible overload variants:
+ optuna/integration/allennlp/_dump_best_config.py:57: note: def __getitem__(self, SupportsIndex) -> Any
+ optuna/integration/allennlp/_dump_best_config.py:57: note: def __getitem__(self, slice) -> List[Any]
+ optuna/integration/allennlp/_dump_best_config.py:57: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ optuna/integration/allennlp/_dump_best_config.py:57: error: Unsupported target for indexed assignment ("Union[Any, str]")
+ optuna/integration/allennlp/_dump_best_config.py:57: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ optuna/integration/_lightgbm_tuner/optimize.py:464: error: Incompatible return value type (got "Union[Dict[str, Any], List[Any], str, float, int, bool, None]", expected "Dict[str, Any]")
+ optuna/cli.py:446: error: Item "List[Any]" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "items"
+ optuna/cli.py:446: error: Item "str" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "items"
+ optuna/cli.py:446: error: Item "float" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "items"
+ optuna/cli.py:446: error: Item "int" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "items"
+ optuna/cli.py:446: error: Item "bool" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "items"
+ optuna/cli.py:446: error: Item "None" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "items"
- optuna/storages/_rdb/alembic/versions/v2.4.0.a.py:181: note: Use "-> None" if function does not return a value
+ optuna/storages/_rdb/alembic/versions/v2.4.0.a.py:181: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
- tests/integration_tests/test_chainer.py:83: error: First argument to namedtuple() should be "MockTrainer", not "_MockTrainer"
- tests/integration_tests/test_chainer.py:84: error: First argument to namedtuple() should be "MockUpdater", not "_MockUpdater"
- tests/integration_tests/test_chainer.py:97: error: First argument to namedtuple() should be "MockTrainer", not "_MockTrainer"
manticore (https://github.com/trailofbits/manticore.git)
+ tests/auto_generators/make_VMTests.py:332: error: Argument 1 to "dict" has incompatible type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected "SupportsKeysAndGetItem[str, Any]"
poetry (https://github.com/python-poetry/poetry.git)
+ poetry/json/__init__.py:24: error: Incompatible types in assignment (expression has type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]", variable has type "str")
- poetry/mixology/failure.py:143: error: Item "PackageNotFoundCause" of "Union[RootCause, NoVersionsCause, DependencyCause, ConflictCause, PythonCause, PlatformCause, PackageNotFoundCause]" has no attribute "other"
- poetry/mixology/failure.py:144: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
+ poetry/mixology/failure.py:143: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
mypy (https://github.com/python/mypy.git)
+ mypy/stubutil.py:104: error: Incompatible return value type (got "Tuple[str, Union[Dict[str, Any], List[Any], str, float, int, bool, None]]", expected "Optional[Tuple[Optional[str], Optional[List[str]]]]") [return-value]
+ mypy/stubutil.py:119: error: Argument 2 to "find_module_path_using_sys_path" has incompatible type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected "List[str]" [arg-type]
+ mypy/build.py:812: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
paasta (https://github.com/yelp/paasta.git)
+ paasta_tools/frameworks/task_store.py:75: error: Argument after ** must be a mapping
+ paasta_tools/kubernetes_tools.py:1848: error: Argument "registrations" to "KubernetesServiceRegistration" has incompatible type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected "Sequence[str]"
+ paasta_tools/kubernetes_tools.py:1999: error: Item "List[Any]" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ paasta_tools/kubernetes_tools.py:1999: error: Item "str" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ paasta_tools/kubernetes_tools.py:1999: error: Item "float" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ paasta_tools/kubernetes_tools.py:1999: error: Item "int" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ paasta_tools/kubernetes_tools.py:1999: error: Item "bool" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ paasta_tools/flink_tools.py:173: error: Incompatible return value type (got "Union[Dict[str, Any], List[Any], str, float, int, bool, None]", expected "Mapping[str, Any]")
+ paasta_tools/tron_tools.py:81: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ paasta_tools/tron_tools.py:81: note: Possible overload variants:
+ paasta_tools/tron_tools.py:81: note: def __getitem__(self, SupportsIndex) -> Any
+ paasta_tools/tron_tools.py:81: note: def __getitem__(self, slice) -> List[Any]
+ paasta_tools/tron_tools.py:81: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ paasta_tools/tron_tools.py:81: error: Item "str" of "Union[Any, str]" has no attribute "keys"
+ paasta_tools/tron_tools.py:83: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ paasta_tools/tron_tools.py:83: error: Invalid index type "str" for "Union[Any, str]"; expected type "Union[int, slice]"
+ paasta_tools/deployd/queue.py:136: error: Argument 1 to "update" of "dict" has incompatible type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected "Mapping[str, object]"
dragonchain (https://github.com/dragonchain/dragonchain.git)
+ dragonchain/lib/faas.py:68:13: error: List comprehension has incompatible type List[Union[Dict[str, Any], List[Any], str, float, int, bool, None]]; expected List[Dict[str, str]]
+ dragonchain/lib/interfaces/secrets.py:40:16: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ dragonchain/lib/interfaces/secrets.py:40:16: note: Possible overload variants:
+ dragonchain/lib/interfaces/secrets.py:40:16: note: def __getitem__(self, SupportsIndex) -> Any
+ dragonchain/lib/interfaces/secrets.py:40:16: note: def __getitem__(self, slice) -> List[Any]
+ dragonchain/lib/interfaces/secrets.py:40:16: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ dragonchain/lib/interfaces/secrets.py:40:29: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ dragonchain/lib/interfaces/aws/s3.py:108:12: error: Item "List[Any]" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/interfaces/aws/s3.py:108:12: error: Item "str" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/interfaces/aws/s3.py:108:12: error: Item "float" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/interfaces/aws/s3.py:108:12: error: Item "int" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/interfaces/aws/s3.py:108:12: error: Item "bool" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/interfaces/aws/s3.py:108:12: error: Item "None" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/interfaces/aws/s3.py:111:17: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ dragonchain/lib/interfaces/aws/s3.py:111:17: note: Possible overload variants:
+ dragonchain/lib/interfaces/aws/s3.py:111:17: note: def __getitem__(self, SupportsIndex) -> Any
+ dragonchain/lib/interfaces/aws/s3.py:111:17: note: def __getitem__(self, slice) -> List[Any]
+ dragonchain/lib/interfaces/aws/s3.py:111:17: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ dragonchain/lib/interfaces/aws/s3.py:111:17: error: Unsupported target for indexed assignment ("Union[Any, str]")
+ dragonchain/lib/interfaces/aws/s3.py:111:28: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ dragonchain/lib/interfaces/aws/s3.py:113:17: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ dragonchain/lib/interfaces/aws/s3.py:113:17: note: Possible overload variants:
+ dragonchain/lib/interfaces/aws/s3.py:113:17: note: def __getitem__(self, SupportsIndex) -> Any
+ dragonchain/lib/interfaces/aws/s3.py:113:17: note: def __getitem__(self, slice) -> List[Any]
+ dragonchain/lib/interfaces/aws/s3.py:113:17: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ dragonchain/lib/interfaces/aws/s3.py:113:17: error: Unsupported target for indexed assignment ("Union[Any, str]")
+ dragonchain/lib/interfaces/aws/s3.py:113:28: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ dragonchain/lib/interfaces/aws/s3.py:114:16: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ dragonchain/lib/interfaces/aws/s3.py:114:16: note: Possible overload variants:
+ dragonchain/lib/interfaces/aws/s3.py:114:16: note: def __getitem__(self, SupportsIndex) -> Any
+ dragonchain/lib/interfaces/aws/s3.py:114:16: note: def __getitem__(self, slice) -> List[Any]
+ dragonchain/lib/interfaces/aws/s3.py:114:16: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ dragonchain/lib/interfaces/aws/s3.py:114:16: error: Incompatible return value type (got "Union[Any, str]", expected "Dict[Any, Any]")
+ dragonchain/lib/interfaces/aws/s3.py:114:27: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ dragonchain/lib/interfaces/local/disk.py:102:16: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ dragonchain/lib/interfaces/local/disk.py:102:16: note: Possible overload variants:
+ dragonchain/lib/interfaces/local/disk.py:102:16: note: def __getitem__(self, SupportsIndex) -> Any
+ dragonchain/lib/interfaces/local/disk.py:102:16: note: def __getitem__(self, slice) -> List[Any]
+ dragonchain/lib/interfaces/local/disk.py:102:16: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ dragonchain/lib/interfaces/local/disk.py:102:27: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ dragonchain/lib/interfaces/local/disk.py:103:20: error: Item "List[Any]" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/interfaces/local/disk.py:103:20: error: Item "str" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/interfaces/local/disk.py:103:20: error: Item "float" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/interfaces/local/disk.py:103:20: error: Item "int" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/interfaces/local/disk.py:103:20: error: Item "bool" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/interfaces/local/disk.py:103:20: error: Item "None" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/interfaces/local/disk.py:106:25: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ dragonchain/lib/interfaces/local/disk.py:106:25: note: Possible overload variants:
+ dragonchain/lib/interfaces/local/disk.py:106:25: note: def __getitem__(self, SupportsIndex) -> Any
+ dragonchain/lib/interfaces/local/disk.py:106:25: note: def __getitem__(self, slice) -> List[Any]
+ dragonchain/lib/interfaces/local/disk.py:106:25: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ dragonchain/lib/interfaces/local/disk.py:106:25: error: Unsupported target for indexed assignment ("Union[Any, str]")
+ dragonchain/lib/interfaces/local/disk.py:106:36: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ dragonchain/lib/interfaces/local/disk.py:108:25: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ dragonchain/lib/interfaces/local/disk.py:108:25: note: Possible overload variants:
+ dragonchain/lib/interfaces/local/disk.py:108:25: note: def __getitem__(self, SupportsIndex) -> Any
+ dragonchain/lib/interfaces/local/disk.py:108:25: note: def __getitem__(self, slice) -> List[Any]
+ dragonchain/lib/interfaces/local/disk.py:108:25: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ dragonchain/lib/interfaces/local/disk.py:108:25: error: Unsupported target for indexed assignment ("Union[Any, str]")
+ dragonchain/lib/interfaces/local/disk.py:108:36: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ dragonchain/lib/interfaces/local/disk.py:109:24: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ dragonchain/lib/interfaces/local/disk.py:109:24: note: Possible overload variants:
+ dragonchain/lib/interfaces/local/disk.py:109:24: note: def __getitem__(self, SupportsIndex) -> Any
+ dragonchain/lib/interfaces/local/disk.py:109:24: note: def __getitem__(self, slice) -> List[Any]
+ dragonchain/lib/interfaces/local/disk.py:109:24: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ dragonchain/lib/interfaces/local/disk.py:109:24: error: Incompatible return value type (got "Union[Any, str]", expected "Dict[Any, Any]")
+ dragonchain/lib/interfaces/local/disk.py:109:35: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
- dragonchain/lib/dto/eth_utest.py:51:9: error: Cannot assign to a method
- dragonchain/lib/dto/eth_utest.py:72:9: error: Cannot assign to a method
- dragonchain/lib/dto/eth_utest.py:77:9: error: Cannot assign to a method
- dragonchain/lib/dto/eth_utest.py:88:9: error: Cannot assign to a method
- dragonchain/lib/dto/eth_utest.py:115:9: error: Cannot assign to a method
- dragonchain/lib/dto/eth_utest.py:123:9: error: Cannot assign to a method
- dragonchain/lib/dto/eth_utest.py:131:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:51:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:56:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:61:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:62:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:70:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:77:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:84:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:90:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:101:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:108:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:114:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:120:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:125:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:131:9: error: Cannot assign to a method
- dragonchain/lib/dto/btc_utest.py:138:9: error: Cannot assign to a method
+ dragonchain/lib/dto/transaction_model.py:72:8: error: Item "List[Any]" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/dto/transaction_model.py:72:8: error: Item "str" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/dto/transaction_model.py:72:8: error: Item "float" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/dto/transaction_model.py:72:8: error: Item "int" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/dto/transaction_model.py:72:8: error: Item "bool" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/dto/transaction_model.py:72:8: error: Item "None" of "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" has no attribute "get"
+ dragonchain/lib/dto/transaction_model.py:74:19: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ dragonchain/lib/dto/transaction_model.py:74:19: note: Possible overload variants:
+ dragonchain/lib/dto/transaction_model.py:74:19: note: def __getitem__(self, SupportsIndex) -> Any
+ dragonchain/lib/dto/transaction_model.py:74:19: note: def __getitem__(self, slice) -> List[Any]
+ dragonchain/lib/dto/transaction_model.py:74:19: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ dragonchain/lib/dto/transaction_model.py:74:23: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ dragonchain/lib/dto/transaction_model.py:74:33: error: Invalid index type "str" for "Union[Any, str]"; expected type "Union[int, slice]"
+ dragonchain/lib/dto/transaction_model.py:75:22: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ dragonchain/lib/dto/transaction_model.py:75:22: note: Possible overload variants:
+ dragonchain/lib/dto/transaction_model.py:75:22: note: def __getitem__(self, SupportsIndex) -> Any
+ dragonchain/lib/dto/transaction_model.py:75:22: note: def __getitem__(self, slice) -> List[Any]
+ dragonchain/lib/dto/transaction_model.py:75:22: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ dragonchain/lib/dto/transaction_model.py:75:26: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ dragonchain/lib/dto/transaction_model.py:75:36: error: Invalid index type "str" for "Union[Any, str]"; expected type "Union[int, slice]"
+ dragonchain/lib/dto/transaction_model.py:76:20: error: No overload variant of "__getitem__" of "list" matches argument type "str"
+ dragonchain/lib/dto/transaction_model.py:76:20: note: Possible overload variants:
+ dragonchain/lib/dto/transaction_model.py:76:20: note: def __getitem__(self, SupportsIndex) -> Any
+ dragonchain/lib/dto/transaction_model.py:76:20: note: def __getitem__(self, slice) -> List[Any]
+ dragonchain/lib/dto/transaction_model.py:76:20: error: Value of type "Union[Dict[str, Any], List[Any], str, float, int, bool, None]" is not indexable
+ dragonchain/lib/dto/transaction_model.py:76:24: error: Invalid index type "str" for "Union[Dict[str, Any], List[Any], str, float, int, bool, None]"; expected type "Union[int, slice]"
+ ``` |
Agreed with Akuli about the implicit Union type. mypy primer damage also doesn't seem good, so closing (feel free to re-open if you feel strongly, or when AnyOf becomes a thing) |
Closes: #5910