Skip to content
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

Provide hint when Union type with None may not have been narrowed #1

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

kr321
Copy link
Owner

@kr321 kr321 commented Apr 24, 2024

Fixes python#17036

When a union includes None, new users may not know they need an is not None check before accessing attributes. For example, the following code:

class A:
    def foo(self) -> int: pass

def f(x: Union[A, None]) -> int:
    return x.foo()

previously (on the master branch) generated this error message:

main:7: error: Item "None" of "Optional[A]" has no attribute "foo"

which may be ambiguous since x is never explicitly defined as None.

With this PR, the message remains, but we add a suggestion for how to fix the error:

main:7: error: Item "None" of "Optional[A]" has no attribute "foo"
main:7: note: You can use "if x is not None" to guard against a None value

This is possible by checking if None is part of the union when an error signaling a type doesn't have an attribute is triggered and displays the corresponding hint if it is.

github-actions bot and others added 22 commits April 14, 2024 19:50
Source commit:

python/typeshed@7c8e82f

Co-authored-by: mypybot <>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
The release branch has been cut:
https://github.com/python/mypy/tree/release-1.10
Increase the dev version.
…python#16604)

Fixes python#16603

This change maps over union types when determining the types of access
descriptors. Previously, the because [this
conditional](https://github.com/md384/mypy/blob/c2a55afcef32ecb11a4c76c4c79539f6ba36d55c/mypy/checkmember.py#L697-L701)
would fall through to the `else` case because instance type was not a
singular `TypeType` (it was a Union), so we'd end up with an instance
value being passed to `__get__` instead of `None`.
Fixes python#16367

During semantic analysis, we try to parse all strings as types,
including those inside Literal[]. Previously, we preserved the original
string in the `UnboundType.original_str_expr` attribute, but if a type
is parsed as a Union, we didn't have a place to put the value.

This PR instead always wraps string types in a RawExpressionType node,
which now optionally includes a `.node` attribute containing the parsed
type. This way, we don't need to worry about preserving the original
string as a custom attribute on different kinds of types that can appear
in this context.

The downside is that more code needs to be aware of RawExpressionType.
Add command about how to activate virtual environment on Windows.
Initial pass at blog post for Release 1.10.

Still need to add some information about the major changes. Pulled up 3
commits that seemed like we might want to write something about (under
TODO), but they can move them to "Other Notable Changes and Fixes" if
that's not the case.
- add typeshed updates note
- remove unreleased
002f77c removed the last reference to
six, so there is no need to pull down the six docs inventory
…ining about None type missing an attribute is generated
@angelawuuu angelawuuu changed the title Union Provide hint when Union type with None may not have been narrowed Apr 24, 2024
@angelawuuu angelawuuu requested review from angelawuuu and removed request for angelawuuu April 25, 2024 17:58
Copy link
Collaborator

@jublizoo jublizoo left a comment

Choose a reason for hiding this comment

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

LGTM!

@andyxzhu
Copy link
Collaborator

LGTM!

@andyxzhu andyxzhu self-assigned this Apr 26, 2024
sanxiyn and others added 5 commits April 26, 2024 07:02
Use lower-case `list`, `tuple`, `type` instead of `List`, `Tuple`,
`Type` in documentation.
Fix failing MacOS tests in CI

Python 3.9 is not available on the latest MacOS images
actions/setup-python#850

---------

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Copy link

Diff from mypy_primer, showing the effect of this PR on open source code:

pip (https://github.com/pypa/pip)
+ src/pip/_internal/network/utils.py:63: note: You can use "if response.raw is not None" to guard against a None value
+ src/pip/_internal/network/utils.py:93: note: You can use "if response.raw is not None" to guard against a None value
+ src/pip/_internal/network/auth.py:521: note: You can use "if resp.raw is not None" to guard against a None value
+ src/pip/_internal/network/auth.py:544: note: You can use "if resp.request is not None" to guard against a None value
+ src/pip/_internal/network/session.py:408: note: You can use "if self.auth is not None" to guard against a None value
+ src/pip/_internal/index/collector.py:88: note: You can use "if response.request is not None" to guard against a None value
+ src/pip/_internal/cli/req_command.py:150: note: You can use "if session.auth is not None" to guard against a None value
+ src/pip/_internal/cli/req_command.py:151: note: You can use "if session.auth is not None" to guard 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 guard against a None value
+ dragonchain/lib/authorization.py:315:19: note: You can use "if <variable name> is not None" to guard against a None value
+ dragonchain/lib/authorization.py:317:25: note: You can use "if <variable name> is not None" to guard against a None value
+ dragonchain/lib/authorization.py:340:31: note: You can use "if <variable name> is not None" to guard 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 m is not None" to guard against a None value
+ src/check_jsonschema/cli/param_types.py:91: note: You can use "if m is not None" to guard against a None value

psycopg (https://github.com/psycopg/psycopg)
+ tests/types/test_enum.py:309: error: String argument 1 "RenamedEnum" to enum.Enum(...) does not match variable name "enum"  [misc]
+ tests/types/test_enum.py:321: error: String argument 1 "LargerEnum" to enum.Enum(...) does not match variable name "enum"  [misc]
+ tests/types/test_enum.py:336: error: String argument 1 "SmallerEnum" to enum.Enum(...) does not match variable name "enum"  [misc]

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/id.py:558: note: You can use "if session is not None" to guard against a None value

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/apply.py:251: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas/core/apply.py:251: error: No overload variant of "__get__" of "AxisProperty" matches argument types "GroupBy[Any]", "type[GroupBy[Any]]"  [call-overload]
+ pandas/core/apply.py:251: note: Error code "call-overload" not covered by "type: ignore" comment
+ pandas/core/apply.py:251: note: Possible overload variants:
+ pandas/core/apply.py:251: note:     def __get__(self, obj: DataFrame | Series, type: Any) -> Index
+ pandas/core/apply.py:251: note:     def __get__(self, obj: None, type: Any) -> AxisProperty
+ pandas/core/apply.py:251: error: No overload variant of "__get__" of "AxisProperty" matches argument types "SeriesGroupBy", "type[SeriesGroupBy]"  [call-overload]
+ pandas/core/apply.py:251: error: No overload variant of "__get__" of "AxisProperty" matches argument types "DataFrameGroupBy", "type[DataFrameGroupBy]"  [call-overload]
+ pandas/core/apply.py:251: error: No overload variant of "__get__" of "AxisProperty" matches argument types "BaseWindow", "type[BaseWindow]"  [call-overload]
+ pandas/core/apply.py:251: error: No overload variant of "__get__" of "AxisProperty" matches argument types "Resampler", "type[Resampler]"  [call-overload]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/dependencies/limiters.py:819: note: You can use "if resource is not None" to guard against a None value

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/builders/html/__init__.py:441:16: note: You can use "if self._publisher.writer is not None" to guard against a None value

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/_code/code.py:1077: note: You can use "if e is not None" to guard against a None value
+ src/_pytest/_code/code.py:1083: note: You can use "if e is not None" to guard against a None value
+ testing/_py/test_local.py:858: note: You can use "if x is not None" to guard against a None value
+ testing/_py/test_local.py:861: note: You can use "if x is not None" to guard against a None value
+ testing/_py/test_local.py:912: note: You can use "if x is not None" to guard against a None value
+ testing/_py/test_local.py:914: note: You can use "if y is not None" to guard against a None value
+ testing/_py/test_local.py:923: note: You can use "if x is not None" to guard against a None value
+ testing/_py/test_local.py:924: note: You can use "if x is not None" to guard against a None value
+ testing/_py/test_local.py:929: note: You can use "if x is not None" to guard against a None value
+ testing/_py/test_local.py:940: note: You can use "if x is not None" to guard against a None value
+ testing/_py/test_local.py:1281: note: You can use "if cmd is not None" to guard against a None value
+ testing/_py/test_local.py:1283: note: You can use "if cmd is not None" to guard against a None value
+ testing/_py/test_local.py:1284: note: You can use "if x is not None" to guard against a None value

graphql-core (https://github.com/graphql-python/graphql-core)
+ tests/type/test_definition.py:717: error: String argument 1 "Colors" to enum.Enum(...) does not match variable name "colors"  [misc]
+ tests/type/test_definition.py:725: error: String argument 1 "Colors" to enum.Enum(...) does not match variable name "colors"  [misc]
+ tests/type/test_definition.py:733: error: String argument 1 "Colors" to enum.Enum(...) does not match variable name "colors"  [misc]
+ tests/type/test_definition.py:741: error: String argument 1 "Colors" to enum.Enum(...) does not match variable name "colors"  [misc]

operator (https://github.com/canonical/operator)
+ ops/lib/__init__.py:266: note: You can use "if self.spec.loader is not None" to guard against a None value

jax (https://github.com/google/jax)
+ jax/_src/pretty_printer.py:150: error: String argument 1 "_Color" to enum.Enum(...) does not match variable name "Color"  [misc]
+ jax/_src/pretty_printer.py:152: error: String argument 1 "_Intensity" to enum.Enum(...) does not match variable name "Intensity"  [misc]

kornia (https://github.com/kornia/kornia)
+ kornia/enhance/histogram.py:217: note: You can use "if image is not None" to guard against a None value
+ kornia/enhance/histogram.py:220: note: You can use "if image is not None" to guard against a None value
+ kornia/enhance/histogram.py:241: note: You can use "if image is not None" to guard against a None value
+ kornia/enhance/histogram.py:244: note: You can use "if image is not None" to guard against a None value
+ kornia/enhance/histogram.py:249: note: You can use "if image is not None" to guard against a None value
+ kornia/enhance/histogram.py:251: note: You can use "if image is not None" to guard 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 guard 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 guard 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 guard 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 guard 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 guard 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 guard 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 guard against a None value
+ lib/tests/streamlit/logger_test.py:104:21: note: You can use "if None is not None" to guard against a None value
+ lib/tests/streamlit/logger_test.py:108:21: note: You can use "if None is not None" to guard against a None value
+ lib/tests/streamlit/config_test.py:402:23: note: You can use "if config._config_options is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:136:27: note: You can use "if original_session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:139:9: note: You can use "if original_session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:145:9: note: You can use "if original_session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:146:9: note: You can use "if original_session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:153:9: note: You can use "if original_session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:154:9: note: You can use "if original_session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:163:16: note: You can use "if reconnected_session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:163:52: note: You can use "if original_session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:165:16: note: You can use "if reconnected_session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:168:16: note: You can use "if reconnected_session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:178:16: note: You can use "if active_session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:219:9: note: You can use "if session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:234:9: note: You can use "if session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:243:16: note: You can use "if session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/websocket_session_manager_test.py:253:16: note: You can use "if session_info is not None" to guard against a None value
+ lib/tests/streamlit/runtime/runtime_test.py:233:19: note: You can use "if <variable name> is not None" to guard against a None value
+ lib/tests/streamlit/runtime/runtime_test.py:253:19: note: You can use "if <variable name> is not None" to guard against a None value
+ lib/tests/streamlit/runtime/runtime_test.py:342:27: note: You can use "if <variable name> is not None" to guard against a None value
+ lib/tests/streamlit/runtime/runtime_test.py:370:23: note: You can use "if <variable name> is not None" to guard against a None value
+ lib/tests/streamlit/runtime/runtime_test.py:396:23: note: You can use "if <variable name> is not None" to guard against a None value
+ lib/tests/streamlit/runtime/app_session_test.py:488:9: note: You can use "if session._local_sources_watcher is not None" to guard against a None value
+ lib/tests/streamlit/runtime/scriptrunner/script_runner_test.py:1138:24: note: You can use "if widget is not None" to guard against a None value
+ lib/tests/streamlit/form_test.py:251:33: note: You can use "if form_data is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:310:26: note: You can use "if dg._cursor is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:311:26: note: You can use "if dg._cursor is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:317:25: note: You can use "if dg._cursor is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:318:26: note: You can use "if dg._cursor is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:336:26: note: You can use "if c1 is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:336:46: note: You can use "if c2 is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:337:26: note: You can use "if c1 is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:337:37: note: You can use "if c2 is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:338:26: note: You can use "if c1 is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:338:43: note: You can use "if c2 is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:339:26: note: You can use "if c1 is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:339:37: note: You can use "if c2 is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:350:29: note: You can use "if dg._cursor is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:359:29: note: You can use "if dg._cursor is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:370:31: note: You can use "if dg._cursor is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:388:9: note: You can use "if ctx is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:398:9: note: You can use "if ctx is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:399:9: note: You can use "if ctx is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:407:9: note: You can use "if ctx is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:408:9: note: You can use "if ctx is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:423:26: note: You can use "if container._cursor is not None" to guard against a None value
+ lib/tests/streamlit/delta_generator_test.py:442:30: note: You can use "if column._cursor is not None" to guard against a None value
+ lib/tests/streamlit/web/server/server_test.py:215:26: note: You can use "if ws_client.headers is not None" to guard against a None value
+ lib/tests/streamlit/web/server/server_test.py:231:31: note: You can use "if ws_client.headers is not None" to guard against a None value
+ lib/tests/streamlit/runtime/metrics_util_test.py:179:9: note: You can use "if ctx is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/widgets_test.py:473:17: note: You can use "if <variable name> is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/widgets_test.py:480:17: note: You can use "if <variable name> is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/widgets_test.py:488:17: note: You can use "if <variable name> is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/widgets_test.py:495:17: note: You can use "if <variable name> is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/session_state_test.py:177:16: note: You can use "if serialized is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/session_state_test.py:178:16: note: You can use "if serialized is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/session_state_test.py:182:16: note: You can use "if serialized is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/session_state_test.py:183:16: note: You can use "if serialized is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/session_state_test.py:200:16: note: You can use "if serialized is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/session_state_test.py:201:21: note: You can use "if serialized is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/session_state_test.py:215:16: note: You can use "if serialized is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/session_state_test.py:216:16: note: You can use "if serialized is not None" to guard against a None value
+ lib/tests/streamlit/runtime/state/session_state_test.py:239:9: note: You can use "if metadata.callback is not None" to guard against a None value

... (truncated 1 lines) ...

werkzeug (https://github.com/pallets/werkzeug)
+ tests/test_wrappers.py:179: note: You can use "if a is not None" to guard against a None value
+ tests/test_wrappers.py:180: note: You can use "if a is not None" to guard against a None value
+ tests/test_wrappers.py:181: note: You can use "if a is not None" to guard against a None value
+ tests/test_wrappers.py:189: note: You can use "if a is not None" to guard against a None value
+ tests/test_wrappers.py:190: note: You can use "if a is not None" to guard against a None value
+ tests/test_wrappers.py:191: note: You can use "if a is not None" to guard against a None value
+ tests/test_wrappers.py:1078: note: You can use "if req.range is not None" to guard against a None value
+ tests/test_wrappers.py:1081: note: You can use "if req.range is not None" to guard against a None value
+ tests/test_test.py:166: note: You can use "if b.input_stream is not None" to guard against a None value
+ tests/test_test.py:168: note: You can use "if b.input_stream is not None" to guard against a None value
+ tests/test_test.py:306: note: You can use "if request.authorization is not None" to guard against a None value
+ tests/test_test.py:307: note: You can use "if request.authorization is not None" to guard against a None value
+ tests/test_routing.py:601: note: You can use "if rule.methods is not None" to guard against a None value
+ tests/test_routing.py:603: note: You can use "if rule.methods is not None" to guard against a None value
+ tests/test_routing.py:1310: note: You can use "if None is not None" to guard against a None value
+ tests/test_local.py:191: note: You can use "if local.LocalProxy.__doc__ is not None" to guard against a None value
+ tests/test_http.py:152: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:153: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:154: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:157: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:158: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:159: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:162: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:163: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:164: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:176: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:177: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:178: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:179: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:180: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:181: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:182: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:183: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:184: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:185: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:195: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:196: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:197: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:198: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:199: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:200: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:201: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:205: note: You can use "if <variable name> is not None" to guard against a None value
+ tests/test_http.py:211: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:212: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:217: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:218: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:242: note: You can use "if wa is not None" to guard against a None value
+ tests/test_http.py:243: note: You can use "if wa is not None" to guard against a None value
+ tests/test_http.py:244: note: You can use "if wa is not None" to guard against a None value
+ tests/test_http.py:245: note: You can use "if wa is not None" to guard against a None value
+ tests/test_http.py:253: note: You can use "if wa is not None" to guard against a None value
+ tests/test_http.py:254: note: You can use "if wa is not None" to guard against a None value
+ tests/test_http.py:255: note: You can use "if wa is not None" to guard against a None value
+ tests/test_http.py:256: note: You can use "if wa is not None" to guard against a None value
+ tests/test_http.py:257: note: You can use "if wa is not None" to guard against a None value
+ tests/test_http.py:259: note: You can use "if <variable name> is not None" to guard against a None value
+ tests/test_http.py:266: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:267: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:272: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:273: note: You can use "if a is not None" to guard against a None value
+ tests/test_http.py:623: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:624: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:625: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:628: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:629: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:630: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:633: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:634: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:635: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:638: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:639: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:640: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:643: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:644: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:645: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:664: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:665: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:666: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:667: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:668: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:677: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:678: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:679: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:680: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:681: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:684: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:685: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:686: note: You can use "if rv is not None" to guard against a None value
+ tests/test_http.py:687: note: You can use "if rv is not None" to guard against a None value
+ tests/test_debug.py:281: note: You can use "if e.__context__ is not None" to guard against a None value
+ tests/test_datastructures.py:1189: note: You can use "if r is not None" to guard against a None value
+ tests/conftest.py:86: note: You can use "if self is not None" to guard against a None value
+ tests/conftest.py:123: note: You can use "if client.log is not None" to guard against a None value

discord.py (https://github.com/Rapptz/discord.py)
+ discord/guild.py:3232: note: You can use "if channel is not None" to guard against a None value

ibis (https://github.com/ibis-project/ibis)
+ ibis/expr/types/generic.py:1225: note: You can use "if data_mapper is not None" to guard against a None value
+ ibis/expr/types/generic.py:1395: note: You can use "if data_mapper is not None" to guard against a None value
+ ibis/expr/types/relations.py:232: note: You can use "if data_mapper is not None" to guard against a None value
+ ibis/expr/types/relations.py:1149: note: You can use "if metrics is not None" to guard against a None value
+ ibis/expr/types/relations.py:1150: note: You can use "if metrics is not None" to guard against a None value
+ ibis/expr/types/relations.py:3833: note: You can use "if match_result is not None" to guard against a None value
+ ibis/expr/types/relations.py:4248: note: You can use "if names is not None" to guard against a None value
+ ibis/expr/types/relations.py:4254: note: You can use "if names is not None" to guard against a None value
+ ibis/expr/types/relations.py:4256: note: You can use "if names is not None" to guard against a None value
+ ibis/backends/sql/datatypes.py:1030: note: You can use "if scale is not None" to guard against a None value
+ ibis/backends/tests/base.py:104: note: You can use "if <variable name> is not None" to guard against a None value
+ ibis/examples/gen_registry.py:328: note: You can use "if <variable name> is not None" to guard against a None value
+ ibis/backends/druid/tests/conftest.py:87: note: You can use "if match is not None" to guard against a None value
+ ibis/backends/datafusion/__init__.py:290: note: You can use "if catalog is not None" to guard against a None value
+ ibis/backends/datafusion/__init__.py:292: note: You can use "if catalog is not None" to guard against a None value
+ ibis/backends/datafusion/__init__.py:294: note: You can use "if database is not None" to guard against a None value
+ ibis/backends/clickhouse/__init__.py:258: note: You can use "if expr is not None" to guard against a None value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error message when union may not have been narrowed