-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Helpful note when union may not have been narrowed #17115
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: pip (https://github.com/pypa/pip)
+ src/pip/_internal/metadata/pkg_resources.py:162: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/pip/_internal/network/utils.py:63: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/pip/_internal/network/utils.py:93: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/pip/_internal/network/auth.py:520: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/pip/_internal/network/auth.py:543: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/pip/_internal/network/session.py:408: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/pip/_internal/index/collector.py:87: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/pip/_internal/cli/req_command.py:151: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/pip/_internal/cli/req_command.py:152: note: You can use "if <variable_name> is not None" to protect against a None value
check-jsonschema (https://github.com/python-jsonschema/check-jsonschema)
+ src/check_jsonschema/cli/param_types.py:90: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/check_jsonschema/cli/param_types.py:91: note: You can use "if <variable_name> is not None" to protect against a None value
dragonchain (https://github.com/dragonchain/dragonchain)
+ dragonchain/broadcast_processor/broadcast_functions.py:95:32: note: You can use "if <variable_name> is not None" to protect against a None value
+ dragonchain/lib/authorization.py:315:19: note: You can use "if <variable_name> is not None" to protect against a None value
+ dragonchain/lib/authorization.py:317:25: note: You can use "if <variable_name> is not None" to protect against a None value
+ dragonchain/lib/authorization.py:340:31: note: You can use "if <variable_name> is not None" to protect against a None value
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/id.py:558: note: You can use "if <variable_name> is not None" to protect against a None value
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/utilities/dispatch.py:183: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/utilities/collections.py:188: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/server/utilities/server.py:24: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/server/utilities/database.py:632: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/_internal/concurrency/services.py:190: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/_internal/concurrency/services.py:195: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/utilities/importtools.py:162: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/utilities/importtools.py:338: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/utilities/importtools.py:339: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/_internal/compatibility/deprecated.py:344: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/client/schemas/objects.py:359: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/events/related.py:121: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/events/related.py:129: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/events/related.py:132: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/events/related.py:140: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/events/related.py:143: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/events/related.py:151: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/events/related.py:154: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/client/base.py:287: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/blocks/core.py:71: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/filesystems.py:716: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/runner/storage.py:298: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/runner.py:421: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/runner.py:967: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/runner.py:972: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/runner.py:976: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/runner.py:988: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/runner.py:992: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/runner.py:996: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/logging/handlers.py:203: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/runtime/flow_run.py:124: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/runtime/flow_run.py:143: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/runtime/flow_run.py:158: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/runtime/flow_run.py:173: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/runtime/flow_run.py:188: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/runtime/flow_run.py:203: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/runtime/flow_run.py:226: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/utilities/engine.py:135: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/utilities/engine.py:154: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/utilities/engine.py:390: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/utilities/engine.py:391: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/utilities/engine.py:392: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/utilities/engine.py:393: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/utilities/engine.py:400: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/utilities/engine.py:494: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/runtime/deployment.py:109: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/runtime/deployment.py:110: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/runner/submit.py:68: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/runner/submit.py:206: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/input/run_input.py:117: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/deployments.py:159: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/deployments.py:161: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/deployments.py:178: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/deployments.py:192: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/deployments.py:194: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/deployments.py:199: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/deployments.py:201: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/deployments.py:212: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/deployments.py:231: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/deployments.py:529: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/deployments.py:800: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/base.py:112: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/base.py:124: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/base.py:136: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/deployments/base.py:149: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:620: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:630: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:642: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:643: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:680: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:797: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:862: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:885: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:907: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:915: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:937: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:1132: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:1172: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:1327: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:1337: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/prefect/engine.py:1357: note: You can use "if <variable_name> is not None" to protect against a None value
... (truncated 165 lines) ...
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:934: note: You can use "if <variable_name> is not None" to protect against a None value
Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/dependencies/limiters.py:819: note: You can use "if <variable_name> is not None" to protect against a None value
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/builders/html/__init__.py:441:16: note: You can use "if <variable_name> is not None" to protect against a None value
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/_code/code.py:1077: note: You can use "if <variable_name> is not None" to protect against a None value
+ src/_pytest/_code/code.py:1083: note: You can use "if <variable_name> is not None" to protect against a None value
+ testing/_py/test_local.py:858: note: You can use "if <variable_name> is not None" to protect against a None value
+ testing/_py/test_local.py:861: note: You can use "if <variable_name> is not None" to protect against a None value
+ testing/_py/test_local.py:912: note: You can use "if <variable_name> is not None" to protect against a None value
+ testing/_py/test_local.py:914: note: You can use "if <variable_name> is not None" to protect against a None value
+ testing/_py/test_local.py:923: note: You can use "if <variable_name> is not None" to protect against a None value
+ testing/_py/test_local.py:924: note: You can use "if <variable_name> is not None" to protect against a None value
+ testing/_py/test_local.py:929: note: You can use "if <variable_name> is not None" to protect against a None value
+ testing/_py/test_local.py:940: note: You can use "if <variable_name> is not None" to protect against a None value
+ testing/_py/test_local.py:1281: note: You can use "if <variable_name> is not None" to protect against a None value
+ testing/_py/test_local.py:1283: note: You can use "if <variable_name> is not None" to protect against a None value
+ testing/_py/test_local.py:1284: note: You can use "if <variable_name> is not None" to protect against a None value
operator (https://github.com/canonical/operator)
+ ops/lib/__init__.py:263: note: You can use "if <variable_name> is not None" to protect against a None value
kornia (https://github.com/kornia/kornia)
+ kornia/enhance/histogram.py:217: note: You can use "if <variable_name> is not None" to protect against a None value
+ kornia/enhance/histogram.py:220: note: You can use "if <variable_name> is not None" to protect against a None value
+ kornia/enhance/histogram.py:241: note: You can use "if <variable_name> is not None" to protect against a None value
+ kornia/enhance/histogram.py:244: note: You can use "if <variable_name> is not None" to protect against a None value
+ kornia/enhance/histogram.py:249: note: You can use "if <variable_name> is not None" to protect against a None value
+ kornia/enhance/histogram.py:251: note: You can use "if <variable_name> is not None" to protect against a None value
werkzeug (https://github.com/pallets/werkzeug)
+ tests/test_wrappers.py:179: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_wrappers.py:180: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_wrappers.py:181: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_wrappers.py:189: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_wrappers.py:190: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_wrappers.py:191: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_wrappers.py:1078: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_wrappers.py:1081: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_test.py:166: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_test.py:168: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_test.py:306: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_test.py:307: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_routing.py:601: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_routing.py:603: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_routing.py:1310: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_local.py:191: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:152: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:153: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:154: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:157: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:158: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:159: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:162: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:163: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:164: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:176: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:177: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:178: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:179: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:180: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:181: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:182: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:183: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:184: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:185: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:195: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:196: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:197: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:198: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:199: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:200: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:201: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:205: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:211: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:212: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:217: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:218: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:242: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:243: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:244: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:245: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:253: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:254: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:255: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:256: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:257: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:259: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:266: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:267: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:272: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:273: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:623: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:624: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:625: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:628: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:629: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:630: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:633: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:634: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:635: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:638: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:639: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:640: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:643: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:644: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:645: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:664: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:665: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:666: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:667: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:668: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:677: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:678: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:679: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:680: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:681: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:684: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:685: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:686: note: You can use "if <variable_name> is not None" to protect against a None value
+ tests/test_http.py:687: note: You can use "if <variable_name> is not None" to protect against a None value
... (truncated 4 lines) ...
discord.py (https://github.com/Rapptz/discord.py)
+ discord/mentions.py:126: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/mentions.py:131: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/invite.py:460: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/guild.py:3232: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/app_commands/commands.py:225: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/app_commands/commands.py:661: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/app_commands/commands.py:662: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/app_commands/commands.py:2381: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/app_commands/commands.py:2383: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/ext/commands/core.py:430: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/ext/commands/core.py:438: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/ext/commands/core.py:451: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/ext/commands/core.py:468: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/ext/commands/core.py:476: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/ext/commands/hybrid.py:309: note: You can use "if <variable_name> is not None" to protect against a None value
+ discord/ext/commands/hybrid.py:319: note: You can use "if <variable_name> is not None" to protect against a None value
streamlit (https://github.com/streamlit/streamlit)
+ lib/tests/streamlit/streamlit_test.py:61:30: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/scriptrunner/script_requests_test.py:116:32: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/scriptrunner/script_requests_test.py:119:31: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/scriptrunner/script_requests_test.py:141:32: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/scriptrunner/script_requests_test.py:142:31: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/scriptrunner/script_requests_test.py:163:32: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/scriptrunner/script_requests_test.py:164:31: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/logger_test.py:104:21: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/logger_test.py:108:21: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/config_test.py:402:23: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:136:27: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:139:9: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:145:9: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:146:9: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:153:9: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:154:9: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:163:16: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:165:16: note: You can use "if <variable_name> is not None" to protect against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:168:16: note: You can use "if <variable_name> is not None" to protect against a None value
... (truncated 108 lines) ...``` |
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.
Thanks for the PR! We should scope the new hint to only the case where None is in the union
I was working on scoping the error message to only show up when None is in the union and when an attribute of a None type object is accessed. This is the if statement I used to determine whether to show the note: if typ_format == '"None"' and "None" in orig_type_format: However when trying to do so I tested individual test cases, which appeared to be entering the if statement and providing the note correctly. So I ran the entire test suite using "python3 runtests.py" and based on the results, the tests seem to never enter into the if statement and print out the note. This has been very confusing and I am wondering why this is occurring and if I am missing something. Any help/guidance is appreciated. Thanks. |
Fixes #17036
The added note makes it easier for new mypy users to understand where the errors are coming from and suggests a potentially simple fix.