forked from python/mypy
-
Notifications
You must be signed in to change notification settings - Fork 0
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
equal literal #3
Draft
hauntsaninja
wants to merge
1
commit into
master
Choose a base branch
from
equal-literal
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment has been minimized.
This comment has been minimized.
hauntsaninja
force-pushed
the
equal-literal
branch
from
November 14, 2024 02:11
8be0188
to
02100aa
Compare
Diff from mypy_primer, showing the effect of this PR on open source code: operator (https://github.com/canonical/operator)
- ops/pebble.py:1167: error: TypedDict key must be a string literal; expected one of ("command", "service-context", "environment", "user-id", "user", ...) [literal-required]
- ops/pebble.py:1185: error: TypedDict key must be a string literal; expected one of ("url", "headers") [literal-required]
+ ops/pebble.py:3185: error: Redundant cast to "Literal['response', 'files']" [redundant-cast]
optuna (https://github.com/optuna/optuna)
+ tests/samplers_tests/test_qmc.py:113: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[2]") [comparison-overlap]
+ tests/samplers_tests/test_qmc.py:140: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[1]") [comparison-overlap]
+ tests/samplers_tests/test_qmc.py:160: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[1]") [comparison-overlap]
+ tests/samplers_tests/test_nsgaiii.py:264: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[1]") [comparison-overlap]
+ tests/samplers_tests/test_samplers.py:779: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[2]") [comparison-overlap]
+ tests/samplers_tests/test_samplers.py:803: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[1]") [comparison-overlap]
+ tests/samplers_tests/test_nsgaii.py:748: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[1]") [comparison-overlap]
+ tests/samplers_tests/test_nsgaii.py:786: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[1]") [comparison-overlap]
+ tests/trial_tests/test_trial.py:257: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[2]") [comparison-overlap]
+ tests/study_tests/test_study.py:1199: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[3]") [comparison-overlap]
psycopg (https://github.com/psycopg/psycopg)
+ tests/test_capabilities.py:97: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[2]") [comparison-overlap]
+ tests/pool/test_pool_null_async.py:144: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[2]") [comparison-overlap]
+ tests/pool/test_pool_null_async.py:192: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[1]") [comparison-overlap]
+ tests/pool/test_pool_null.py:145: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[2]") [comparison-overlap]
+ tests/pool/test_pool_null.py:193: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[1]") [comparison-overlap]
+ tests/pool/test_pool_async.py:195: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[2]") [comparison-overlap]
+ tests/pool/test_pool_async.py:219: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[1]") [comparison-overlap]
+ tests/pool/test_pool_async.py:677: error: Non-overlapping equality check (left operand type: "Literal[4]", right operand type: "Literal[2]") [comparison-overlap]
+ tests/pool/test_pool.py:194: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[2]") [comparison-overlap]
+ tests/pool/test_pool.py:218: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[1]") [comparison-overlap]
+ tests/pool/test_pool.py:675: error: Non-overlapping equality check (left operand type: "Literal[4]", right operand type: "Literal[2]") [comparison-overlap]
jinja (https://github.com/pallets/jinja)
+ src/jinja2/parser.py:398: error: Non-overlapping equality check (left operand type: "Literal['name']", right operand type: "Literal['comma']") [comparison-overlap]
+ src/jinja2/parser.py:848: error: Statement is unreachable [unreachable]
+ src/jinja2/parser.py:860: error: Statement is unreachable [unreachable]
+ src/jinja2/filters.py:711: error: Statement is unreachable [unreachable]
+ src/jinja2/ext.py:485: error: Non-overlapping equality check (left operand type: "Literal['block_begin']", right operand type: "Literal['name']") [comparison-overlap]
+ src/jinja2/ext.py:489: error: Statement is unreachable [unreachable]
+ src/jinja2/ext.py:491: error: Statement is unreachable [unreachable]
+ src/jinja2/ext.py:509: error: Statement is unreachable [unreachable]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/pytables.py:4729: error: Item "Index" of "ndarray[Any, Any] | Index" has no attribute "reshape" [union-attr]
+ pandas/io/formats/format.py:247: error: Incompatible types in assignment (expression has type "int", variable has type "Literal[1]") [assignment]
black (https://github.com/psf/black)
+ src/blib2to3/pgen2/pgen.py:288:13: error: Statement is unreachable [unreachable]
artigraph (https://github.com/artigraph/artigraph)
+ tests/arti/graphs/test_graph.py:156: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[2]") [comparison-overlap]
+ tests/arti/graphs/test_graph.py:305: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[2]") [comparison-overlap]
mypy (https://github.com/python/mypy)
+ mypy/stubgen.py:1310: error: Left operand of "or" is always false [redundant-expr]
+ mypy/stubgen.py:1310: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-redundant-expr for more info
streamlit (https://github.com/streamlit/streamlit)
+ lib/tests/streamlit/watcher/event_based_path_watcher_test.py: note: In member "test_multiple_watchers_same_file" of class "EventBasedPathWatcherTest":
+ lib/tests/streamlit/watcher/event_based_path_watcher_test.py:376:16: error: Non-overlapping equality check (left operand type: "Literal[2]", right operand type: "Literal[1]") [comparison-overlap]
+ lib/tests/streamlit/watcher/event_based_path_watcher_test.py:378:9: error: Statement is unreachable [unreachable]
+ lib/tests/streamlit/testing/element_tree_test.py: note: In function "test_chat":
+ lib/tests/streamlit/testing/element_tree_test.py:89:5: error: Statement is unreachable [unreachable]
+ lib/tests/streamlit/testing/element_tree_test.py: note: In function "test_state_access":
+ lib/tests/streamlit/testing/element_tree_test.py:951:12: error: Non-overlapping equality check (left operand type: "Literal['bar']", right operand type: "Literal['baz']") [comparison-overlap]
+ lib/tests/streamlit/testing/element_tree_test.py:953:5: error: Statement is unreachable [unreachable]
+ lib/tests/streamlit/testing/app_test_test.py: note: In function "test_get_query_params":
+ lib/tests/streamlit/testing/app_test_test.py:66:12: error: Non-overlapping equality check (left operand type: "Literal['{}']", right operand type: "Literal['{"foo": ["5"], "bar": ["baz"]}']") [comparison-overlap]
+ lib/tests/streamlit/testing/app_test_test.py: note: In function "test_switch_page":
+ lib/tests/streamlit/testing/app_test_test.py:213:12: error: Non-overlapping equality check (left operand type: "Literal['main page']", right operand type: "Literal['page 1']") [comparison-overlap]
+ lib/tests/streamlit/testing/app_test_test.py:215:5: error: Statement is unreachable [unreachable]
+ lib/tests/streamlit/runtime/fragment_test.py:216:13: error: Statement is unreachable [unreachable]
- lib/tests/streamlit/runtime/fragment_test.py:219:13: error: "DeltaGenerator" has no attribute "my_random_field" [attr-defined]
- lib/tests/streamlit/runtime/fragment_test.py:219:13: error: Unsupported operand types for + ("Callable[..., Never]" and "int") [operator]
rich (https://github.com/Textualize/rich)
+ rich/progress.py:1035: error: Statement is unreachable [unreachable]
pytest (https://github.com/pytest-dev/pytest)
+ testing/test_monkeypatch.py:40: error: Non-overlapping equality check (left operand type: "Literal[2]", right operand type: "Literal[3]") [comparison-overlap]
+ testing/test_monkeypatch.py:41: error: Statement is unreachable [unreachable]
+ testing/test_monkeypatch.py:49: error: Unused "type: ignore" comment [unused-ignore]
+ testing/test_monkeypatch.py:71: error: Statement is unreachable [unreachable]
+ testing/test_monkeypatch.py:114: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[5]") [comparison-overlap]
+ testing/test_monkeypatch.py:115: error: Statement is unreachable [unreachable]
+ testing/test_monkeypatch.py:128: error: Non-overlapping equality check (left operand type: "Literal[2]", right operand type: "Literal[3]") [comparison-overlap]
+ testing/test_monkeypatch.py:129: error: Statement is unreachable [unreachable]
+ testing/test_monkeypatch.py:428: error: Non-overlapping equality check (left operand type: "Literal[2]", right operand type: "Literal[1]") [comparison-overlap]
+ testing/test_doctest.py:1605: error: Statement is unreachable [unreachable]
+ testing/test_doctest.py:1609: error: Unused "type: ignore" comment [unused-ignore]
+ testing/test_doctest.py:1610: error: Statement is unreachable [unreachable]
+ testing/test_compat.py:214: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[1]") [comparison-overlap]
+ testing/test_compat.py:215: error: Statement is unreachable [unreachable]
+ testing/logging/test_fixture.py:177: error: Non-overlapping equality check (left operand type: "Literal[50]", right operand type: "Literal[20]") [comparison-overlap]
+ testing/logging/test_fixture.py:179: error: Statement is unreachable [unreachable]
+ testing/logging/test_fixture.py:183: error: Statement is unreachable [unreachable]
+ testing/code/test_excinfo.py:994: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[3]") [comparison-overlap]
trio (https://github.com/python-trio/trio)
+ src/trio/_tests/test_fakenet.py:189: error: Unused "type: ignore" comment [unused-ignore]
starlette (https://github.com/encode/starlette)
+ tests/test_datastructures.py:317: error: Non-overlapping equality check (left operand type: "Literal[4]", right operand type: "Literal[19]") [comparison-overlap]
+ tests/test_datastructures.py:350: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[4]") [comparison-overlap]
+ tests/test_testclient.py:159: error: Non-overlapping equality check (left operand type: "Literal[0]", right operand type: "Literal[3]") [comparison-overlap]
+ tests/test_responses.py:122: error: Non-overlapping equality check (left operand type: "Literal['']", right operand type: "Literal['6, 7, 8, 9']") [comparison-overlap]
+ tests/test_responses.py:245: error: Non-overlapping equality check (left operand type: "Literal['']", right operand type: "Literal['6, 7, 8, 9']") [comparison-overlap]
+ tests/test_applications.py:533: error: Non-overlapping equality check (left operand type: "Literal[1]", right operand type: "Literal[2]") [comparison-overlap]
discord.py (https://github.com/Rapptz/discord.py)
- discord/mentions.py:126: error: Item "bool" of "bool | Sequence[Snowflake]" has no attribute "__iter__" (not iterable) [union-attr]
- discord/mentions.py:131: error: Item "bool" of "bool | Sequence[Snowflake]" has no attribute "__iter__" (not iterable) [union-attr]
- discord/mentions.py:134: error: Incompatible types in assignment (expression has type "bool", target has type "list[Any | int]") [assignment]
+ discord/mentions.py:134: error: Incompatible types in assignment (expression has type "bool", target has type "list[int]") [assignment]
- discord/mentions.py:136: error: Incompatible types in assignment (expression has type "list[str]", target has type "list[Any | int]") [assignment]
+ discord/mentions.py:136: error: Incompatible types in assignment (expression has type "list[str]", target has type "list[int]") [assignment]
core (https://github.com/home-assistant/core)
+ homeassistant/util/color.py:410: error: Statement is unreachable [unreachable]
+ homeassistant/util/color.py:574: error: Statement is unreachable [unreachable]
+ homeassistant/core.py:1033: error: Statement is unreachable [unreachable]
+ homeassistant/helpers/script.py:681: error: Statement is unreachable [unreachable]
+ homeassistant/helpers/script.py:1144: error: Statement is unreachable [unreachable]
+ homeassistant/components/awair/config_flow.py:224: error: Argument "errors" to "async_show_form" of "ConfigFlow" has incompatible type "dict[str, Literal['invalid_access_token']]"; expected "dict[str, str] | None" [arg-type]
+ homeassistant/components/awair/config_flow.py:224: note: "Dict" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
+ homeassistant/components/awair/config_flow.py:224: note: Consider using "Mapping" instead, which is covariant in the value type
+ homeassistant/components/mold_indicator/sensor.py:415: error: Statement is unreachable [unreachable]
+ homeassistant/components/airtouch5/cover.py:122: error: Statement is unreachable [unreachable]
+ homeassistant/components/sensor/recorder.py:145: error: Statement is unreachable [unreachable]
+ homeassistant/components/mqtt/light/schema_basic.py:405: error: Statement is unreachable [unreachable]
+ homeassistant/components/history/websocket_api.py:254: error: Statement is unreachable [unreachable]
+ homeassistant/components/modbus/climate.py:481: error: Statement is unreachable [unreachable]
werkzeug (https://github.com/pallets/werkzeug)
+ tests/test_wrappers.py:724: error: Non-overlapping equality check (left operand type: "Literal['text/html; charset=utf-8']", right operand type: "Literal['text/html; x-foo=yep']") [comparison-overlap]
- tests/test_wrappers.py:1109: error: Incompatible types in assignment (expression has type "None", variable has type "ContentSecurityPolicy") [assignment]
+ tests/test_wrappers.py:1105: error: Non-overlapping equality check (left operand type: "Literal["default-src 'self'"]", right operand type: "Literal["default-src 'self'; script-src 'self' palletsprojects.com"]") [comparison-overlap]
- tests/test_utils.py:84: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_utils.py:94: error: Non-overlapping equality check (left operand type: "Callable[[], Any]", right operand type: "Literal[42]") [comparison-overlap]
+ tests/test_utils.py:131: error: Non-overlapping equality check (left operand type: "Literal[16]", right operand type: "Literal[42]") [comparison-overlap]
- tests/test_test.py:149: error: Incompatible types in assignment (expression has type "int", target has type "str") [assignment]
+ tests/test_test.py:260: error: Non-overlapping equality check (left operand type: "Literal['http://example.com/bar/']", right operand type: "Literal['http://localhost/bar/']") [comparison-overlap]
- tests/test_datastructures.py:1088: error: Non-overlapping container check (element type: "str", container item type: "tuple[str, float]") [comparison-overlap]
- tests/test_datastructures.py:1089: error: Non-overlapping container check (element type: "str", container item type: "tuple[str, float]") [comparison-overlap]
- tests/test_datastructures.py:1107: error: No overload variant of "best_match" of "Accept" matches argument types "list[str]", "None" [call-overload]
- tests/test_datastructures.py:1107: note: Possible overload variants:
- tests/test_datastructures.py:1107: note: def best_match(self, matches: Iterable[str]) -> Optional[str]
- tests/test_datastructures.py:1107: note: def best_match(self, matches: Iterable[str], default: str = ...) -> str
- tests/test_datastructures.py:1111: error: No overload variant of "best_match" of "Accept" matches argument types "list[str]", "None" [call-overload]
- tests/test_datastructures.py:1111: note: Possible overload variants:
- tests/test_datastructures.py:1111: note: def best_match(self, matches: Iterable[str]) -> Optional[str]
- tests/test_datastructures.py:1111: note: def best_match(self, matches: Iterable[str], default: str = ...) -> str
- tests/test_datastructures.py:1114: error: No overload variant of "best_match" of "Accept" matches argument types "list[str]", "None" [call-overload]
- tests/test_datastructures.py:1114: note: Possible overload variants:
- tests/test_datastructures.py:1114: note: def best_match(self, matches: Iterable[str]) -> Optional[str]
- tests/test_datastructures.py:1114: note: def best_match(self, matches: Iterable[str], default: str = ...) -> str
- tests/test_datastructures.py:1115: error: No overload variant of "best_match" of "Accept" matches argument types "list[str]", "None" [call-overload]
- tests/test_datastructures.py:1115: note: Possible overload variants:
- tests/test_datastructures.py:1115: note: def best_match(self, matches: Iterable[str]) -> Optional[str]
- tests/test_datastructures.py:1115: note: def best_match(self, matches: Iterable[str], default: str = ...) -> str
pyodide (https://github.com/pyodide/pyodide)
+ pyodide-build/pyodide_build/pywasmcross.py:323: error: Argument 1 to "append" of "list" has incompatible type "str"; expected "Literal['Symbol {']" [arg-type]
+ pyodide-build/pyodide_build/tests/test_xbuildenv.py:82: error: Statement is unreachable [unreachable]
+ pyodide-build/pyodide_build/tests/test_bash_runner.py:28: error: Non-overlapping equality check (left operand type: "Literal['2']", right operand type: "Literal['7']") [comparison-overlap]
cloud-init (https://github.com/canonical/cloud-init)
+ cloudinit/url_helper.py:473: error: Invalid index type "str" for "dict[Literal['headers'], Any]"; expected type "Literal['headers']" [index]
+ cloudinit/net/dhcp.py:406: error: Statement is unreachable [unreachable]
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.