Skip to content

Change Any -> None in re.Match group-related methods #9482

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

Closed
wants to merge 1 commit into from
Closed

Change Any -> None in re.Match group-related methods #9482

wants to merge 1 commit into from

Conversation

willfrey
Copy link
Contributor

@willfrey willfrey commented Jan 9, 2023

This is to see how mypy_primer feels about these changes in 2023, as per @AlexWaygood's suggestion in #9465.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2023

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

pip (https://github.com/pypa/pip)
+ src/pip/_internal/utils/encoding.py:32: error: Item "None" of "Optional[bytes]" has no attribute "decode"  [union-attr]
+ src/pip/_internal/utils/compatibility_tags.py:30: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ src/pip/_internal/models/wheel.py:30: error: Item "None" of "Optional[str]" has no attribute "replace"  [union-attr]
+ src/pip/_internal/models/wheel.py:33: error: Item "None" of "Optional[str]" has no attribute "replace"  [union-attr]
+ src/pip/_internal/models/wheel.py:35: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]
+ src/pip/_internal/models/wheel.py:36: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]
+ src/pip/_internal/models/wheel.py:37: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]
+ src/pip/_internal/vcs/subversion.py:154: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ src/pip/_internal/vcs/subversion.py:171: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ src/pip/_internal/vcs/git.py:104: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ src/pip/_internal/models/link.py:80: error: Argument "name" to "LinkHash" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ src/pip/_internal/models/link.py:80: error: Argument "value" to "LinkHash" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ src/pip/_internal/models/link.py:378: error: Argument 1 to "match" of "Pattern" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ src/pip/_internal/index/package_finder.py:545: error: Incompatible types in assignment (expression has type "Tuple[int, Optional[str]]", variable has type "Union[Tuple[], Tuple[int, str]]")  [assignment]
+ src/pip/_internal/index/package_finder.py:545: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ src/pip/_internal/req/constructors.py:51: error: Incompatible return value type (got "Tuple[Optional[str], Optional[str]]", expected "Tuple[str, Optional[str]]")  [return-value]

aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/client.py:3903: error: Argument 1 to "findall" of "Pattern" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ aioredis/client.py:3913: error: Item "None" of "Optional[str]" has no attribute "startswith"  [union-attr]
+ aioredis/client.py:3915: error: Value of type "Optional[str]" is not indexable  [index]
+ aioredis/client.py:3919: error: Item "None" of "Optional[str]" has no attribute "rsplit"  [union-attr]
+ aioredis/client.py:3923: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]

pycryptodome (https://github.com/Legrandin/pycryptodome)
+ lib/Crypto/SelfTest/Signature/test_dss.py:169: error: Item "None" of "Optional[str]" has no attribute "replace"  [union-attr]
+ lib/Crypto/SelfTest/Signature/test_dss.py:207: error: Item "None" of "Optional[str]" has no attribute "replace"  [union-attr]
+ lib/Crypto/SelfTest/Signature/test_dss.py:329: error: Item "None" of "Optional[str]" has no attribute "replace"  [union-attr]
+ lib/Crypto/SelfTest/Signature/test_dss.py:342: error: Argument "curve" to "construct" has incompatible type "Optional[str]"; expected "Union[str, int]"  [arg-type]
+ lib/Crypto/SelfTest/Signature/test_dss.py:368: error: Item "None" of "Optional[str]" has no attribute "replace"  [union-attr]
+ lib/Crypto/SelfTest/Signature/test_dss.py:373: error: Argument "curve" to "construct" has incompatible type "Optional[str]"; expected "Union[str, int]"  [arg-type]

vision (https://github.com/pytorch/vision)
+ torchvision/datasets/utils.py:506: error: Argument 1 to "int" has incompatible type "Optional[bytes]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ torchvision/prototype/datasets/_builtin/imagenet.py:125: error: Incompatible return value type (got "Tuple[Tuple[Label, Optional[str]], Tuple[str, BinaryIO]]", expected "Tuple[Tuple[Label, str], Tuple[str, BinaryIO]]")  [return-value]
+ torchvision/prototype/datasets/_builtin/imagenet.py:139: error: Argument 1 to "int" has incompatible type "Union[str, None, Any]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ torchvision/prototype/datasets/_builtin/imagenet.py:139: note: Error code "arg-type" not covered by "type: ignore" comment
+ torchvision/prototype/datasets/_builtin/caltech.py:84: error: Incompatible return value type (got "Tuple[str, Union[str, None, Any]]", expected "Tuple[str, str]")  [return-value]
+ torchvision/prototype/datasets/_builtin/caltech.py:95: error: Incompatible return value type (got "Tuple[str, Union[str, None, Any]]", expected "Tuple[str, str]")  [return-value]

porcupine (https://github.com/Akuli/porcupine)
+ porcupine/plugins/geometry.py:17: error: Argument 1 to "map" has incompatible type "Type[int]"; expected "Callable[[Optional[str]], int]"  [arg-type]
+ porcupine/plugins/editorconfig.py:163: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ porcupine/plugins/editorconfig.py:164: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ porcupine/plugins/editorconfig.py:178: error: Argument 1 to "map" has incompatible type "Type[int]"; expected "Callable[[Optional[str]], int]"  [arg-type]
+ porcupine/plugins/aboutdialog.py:21: error: Argument 1 to "open" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ porcupine/plugins/aboutdialog.py:23: error: Argument 1 to "Path" has incompatible type "Optional[str]"; expected "Union[str, PathLike[str]]"  [arg-type]
+ porcupine/plugins/aboutdialog.py:86: error: Argument 3 to "replace" of "Text" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ porcupine/plugins/langserver.py:444: error: Argument 1 to "len" has incompatible type "Optional[str]"; expected "Sized"  [arg-type]

python-chess (https://github.com/niklasf/python-chess)
+ chess/__init__.py:3016: error: Argument 1 to "index" of "list" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ chess/__init__.py:3026: error: Argument 1 to "index" of "list" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ chess/__init__.py:3029: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ chess/__init__.py:3034: error: Item "None" of "Optional[str]" has no attribute "lower"  [union-attr]
+ chess/pgn.py:149: error: Unsupported left operand type for + ("None")  [operator]
+ chess/pgn.py:149: note: Left operand is of type "Optional[str]"
+ chess/pgn.py:149: error: No overload variant of "__add__" of "str" matches argument type "None"  [operator]
+ chess/pgn.py:149: note: Possible overload variants:
+ chess/pgn.py:149: note:     def __add__(self, str, /) -> str
+ chess/pgn.py:149: note: Both left and right operands are unions
+ chess/pgn.py:151: error: Incompatible return value type (got "Optional[str]", expected "str")  [return-value]
+ chess/pgn.py:415: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ chess/pgn.py:423: error: Argument 1 to "float" has incompatible type "Optional[str]"; expected "Union[SupportsFloat, SupportsIndex, str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]"  [arg-type]
+ chess/pgn.py:433: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ chess/pgn.py:465: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]
+ chess/pgn.py:510: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ chess/pgn.py:510: error: Argument 1 to "float" has incompatible type "Optional[str]"; expected "Union[SupportsFloat, SupportsIndex, str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]"  [arg-type]
+ chess/pgn.py:544: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ chess/pgn.py:544: error: Argument 1 to "float" has incompatible type "Optional[str]"; expected "Union[SupportsFloat, SupportsIndex, str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]"  [arg-type]
+ chess/pgn.py:1540: error: Invalid index type "Optional[str]" for "Headers"; expected type "str"  [index]
+ chess/pgn.py:1540: error: Incompatible types in assignment (expression has type "Optional[str]", target has type "str")  [assignment]

python-htmlgen (https://github.com/srittau/python-htmlgen)
+ test_htmlgen/util.py:13: error: Argument 1 to "findall" of "Pattern" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ test_htmlgen/element.py:115: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]
+ test_htmlgen/element.py:124: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]
+ test_htmlgen/element.py:152: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]

pylox (https://github.com/sco1/pylox)
+ pylox/preprocessor.py:70: error: Value of type "Optional[str]" is not indexable  [index]
+ pylox/preprocessor.py:73: error: Item "None" of "Optional[str]" has no attribute "strip"  [union-attr]
+ pylox/preprocessor.py:77: error: Item "None" of "Optional[str]" has no attribute "strip"  [union-attr]
+ pylox/preprocessor.py:80: error: Value of type "Optional[str]" is not indexable  [index]

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/networks.py:267: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")  [assignment]
+ pydantic/color.py:246: error: Unsupported operand types for * ("None" and "int")  [operator]
+ pydantic/color.py:246: note: Left operand is of type "Optional[str]"
+ pydantic/color.py:246: error: Argument 1 to "int" has incompatible type "Union[str, int]"; expected "Union[str, bytes, bytearray]"  [arg-type]
+ pydantic/color.py:256: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray]"  [arg-type]
+ pydantic/color.py:274: error: Argument 1 to "parse_hsl" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pydantic/color.py:274: error: Argument 2 to "parse_hsl" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pydantic/color.py:274: error: Argument 3 to "parse_hsl" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pydantic/color.py:274: error: Argument 4 to "parse_hsl" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pydantic/color.py:279: error: Argument 1 to "parse_hsl" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pydantic/color.py:279: error: Argument 2 to "parse_hsl" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pydantic/color.py:279: error: Argument 3 to "parse_hsl" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pydantic/color.py:279: error: Argument 4 to "parse_hsl" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pydantic/types.py:682: error: Argument 1 to "float" has incompatible type "Optional[str]"; expected "Union[SupportsFloat, SupportsIndex, str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]"  [arg-type]
+ pydantic/_internal/_model_construction.py:202: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")  [assignment]

rich (https://github.com/Textualize/rich)
+ rich/_emoji_replace.py:26: error: Item "None" of "Optional[str]" has no attribute "lower"  [union-attr]
+ rich/_emoji_replace.py:27: error: Argument 1 has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ rich/_emoji_replace.py:30: error: Incompatible return value type (got "Optional[str]", expected "str")  [return-value]
+ rich/text.py:1224: error: Argument 1 to "len" has incompatible type "Optional[str]"; expected "Sized"  [arg-type]
+ rich/text.py:1271: error: Argument 1 to "len" has incompatible type "Optional[str]"; expected "Sized"  [arg-type]
+ rich/markup.py:93: error: Value of type "Optional[str]" is not indexable  [index]
+ rich/markup.py:96: error: Item "None" of "Optional[str]" has no attribute "partition"  [union-attr]
+ rich/markup.py:178: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")  [assignment]
+ rich/color.py:471: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]

jax (https://github.com/google/jax)
+ jax/experimental/jax2tf/shape_poly.py:694: error: Argument 1 to "from_var" of "_DimPolynomial" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ jax/experimental/jax2tf/shape_poly.py:697: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ jax/_src/test_util.py:1137: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]

cloud-init (https://github.com/canonical/cloud-init)
+ cloudinit/config/schema.py:482: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/util/version/__init__.py:345: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ pandas/util/version/__init__.py:346: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]
+ pandas/util/version/__init__.py:347: error: Argument 1 to "_parse_letter_version" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pandas/util/version/__init__.py:347: error: Argument 2 to "_parse_letter_version" has incompatible type "Optional[str]"; expected "Union[str, bytes, SupportsInt]"  [arg-type]
+ pandas/util/version/__init__.py:349: error: Argument 1 to "_parse_letter_version" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pandas/util/version/__init__.py:349: error: Argument 2 to "_parse_letter_version" has incompatible type "Optional[str]"; expected "Union[str, bytes, SupportsInt]"  [arg-type]
+ pandas/util/version/__init__.py:351: error: Argument 1 to "_parse_letter_version" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pandas/util/version/__init__.py:351: error: Argument 2 to "_parse_letter_version" has incompatible type "Optional[str]"; expected "Union[str, bytes, SupportsInt]"  [arg-type]
+ pandas/util/version/__init__.py:352: error: Argument 1 to "_parse_local_version" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pandas/io/formats/css.py:355: error: Incompatible types in assignment (expression has type "int", variable has type "Optional[str]")  [assignment]
+ pandas/io/formats/css.py:358: error: Incompatible types in assignment (expression has type "float", variable has type "Optional[str]")  [assignment]
+ pandas/io/formats/css.py:358: error: Argument 1 to "float" has incompatible type "Optional[str]"; expected "Union[SupportsFloat, SupportsIndex, str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]"  [arg-type]
+ pandas/io/formats/css.py:377: error: No overload variant of "round" matches argument types "Optional[str]", "int"  [call-overload]
+ pandas/io/formats/css.py:377: note: Possible overload variants:
+ pandas/io/formats/css.py:377: note:     def [_T] round(number: _SupportsRound1[_T], ndigits: None = ...) -> _T
+ pandas/io/formats/css.py:377: note:     def [_T] round(number: _SupportsRound2[_T], ndigits: SupportsIndex) -> _T
+ pandas/io/formats/css.py:378: error: Non-overlapping equality check (left operand type: "int", right operand type: "Optional[str]")  [comparison-overlap]
+ pandas/io/formats/css.py:378: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ pandas/io/formats/css.py:379: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ pandas/core/dtypes/dtypes.py:787: error: Argument "unit" to "DatetimeTZDtype" has incompatible type "Optional[str]"; expected "Union[str, DatetimeTZDtype]"  [arg-type]
+ pandas/core/dtypes/dtypes.py:911: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")  [assignment]
+ pandas/core/arrays/sparse/dtype.py:308: error: Incompatible return value type (got "Tuple[Optional[str], bool]", expected "Tuple[str, bool]")  [return-value]
+ pandas/core/interchange/from_dataframe.py:303: error: Unsupported left operand type for + ("None")  [operator]
+ pandas/core/interchange/from_dataframe.py:303: note: Left operand is of type "Optional[str]"

bokeh (https://github.com/bokeh/bokeh)
+ release/config.py: note: In member "__init__" of class "Config":
+ release/config.py:36:34: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")  [assignment]
+ release/config.py:37:58: error: Argument 1 to "tuple" has incompatible type "Tuple[Optional[str], ...]"; expected "Iterable[str]"  [arg-type]
+ release/config.py:41:32: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")  [assignment]
+ src/bokeh/util/version.py: note: In function "_base_version_helper":
+ src/bokeh/util/version.py:80:12: error: Incompatible return value type (got "Optional[str]", expected "str")  [return-value]
+ src/bokeh/util/compiler.py: note: In function "_detect_nodejs":
+ src/bokeh/util/compiler.py:408:33: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]

schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/makedoc.py: note: In function "markdown_list_hook":
+ schema_salad/makedoc.py:165:22: error: Argument 1 to "len" has incompatible type "Optional[str]"; expected "Sized"  [arg-type]
+ schema_salad/makedoc.py:194:17: error: No overload variant of "__add__" of "str" matches argument type "None"  [operator]
+ schema_salad/makedoc.py:194:17: note: Possible overload variants:
+ schema_salad/makedoc.py:194:17: note:     def __add__(self, str, /) -> str
+ schema_salad/makedoc.py:194:17: error: Unsupported left operand type for + ("None")  [operator]
+ schema_salad/makedoc.py:194:17: note: Both left and right operands are unions
+ schema_salad/makedoc.py:196:23: error: No overload variant of "__add__" of "str" matches argument type "None"  [operator]
+ schema_salad/makedoc.py:196:23: note: Possible overload variants:
+ schema_salad/makedoc.py:196:23: note:     def __add__(self, str, /) -> str
+ schema_salad/makedoc.py:196:23: note: Both left and right operands are unions
+ schema_salad/makedoc.py:199:19: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]
+ schema_salad/makedoc.py:200:30: error: Argument 1 to "len" has incompatible type "Optional[str]"; expected "Sized"  [arg-type]
+ schema_salad/makedoc.py:226:46: error: Value of type "Optional[str]" is not indexable  [index]
+ schema_salad/makedoc.py:229:17: error: No overload variant of "__add__" of "str" matches argument type "None"  [operator]
+ schema_salad/makedoc.py:229:17: note: Possible overload variants:
+ schema_salad/makedoc.py:229:17: note:     def __add__(self, str, /) -> str
+ schema_salad/makedoc.py:229:17: note: Both left and right operands are unions
+ schema_salad/makedoc.py:230:23: error: Unsupported left operand type for + ("None")  [operator]
+ schema_salad/makedoc.py:230:23: note: Left operand is of type "Optional[str]"

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:454: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray]"  [arg-type]

parso (https://github.com/davidhalter/parso)
+ parso/utils.py:168: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ parso/utils.py:179: error: Incompatible types in assignment (expression has type "int", variable has type "Optional[str]")  [assignment]
+ parso/utils.py:180: error: Argument 2 to "PythonVersionInfo" has incompatible type "str"; expected "int"  [arg-type]

git-revise (https://github.com/mystor/git-revise)
+ gitrevise/odb.py:112: error: Item "None" of "Optional[bytes]" has no attribute "strip"  [union-attr]
+ gitrevise/odb.py:119: error: Item "None" of "Optional[bytes]" has no attribute "strip"  [union-attr]
+ gitrevise/odb.py:126: error: Item "None" of "Optional[bytes]" has no attribute "strip"  [union-attr]
+ gitrevise/odb.py:133: error: Item "None" of "Optional[bytes]" has no attribute "strip"  [union-attr]
+ gitrevise/odb.py:140: error: Item "None" of "Optional[bytes]" has no attribute "strip"  [union-attr]
+ gitrevise/todo.py:58: error: Argument 1 to "parse" of "StepKind" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ gitrevise/todo.py:59: error: Argument 1 to "get_commit" of "Repository" has incompatible type "Optional[str]"; expected "Union[Oid, str]"  [arg-type]

ignite (https://github.com/pytorch/ignite)
+ ignite/distributed/comp_models/native.py:514: error: Unsupported left operand type for + ("None")  [operator]
+ ignite/distributed/comp_models/native.py:514: note: Left operand is of type "Optional[str]"
+ ignite/distributed/comp_models/native.py:517: error: No overload variant of "__add__" of "str" matches argument type "None"  [operator]
+ ignite/distributed/comp_models/native.py:517: note: Possible overload variants:
+ ignite/distributed/comp_models/native.py:517: note:     def __add__(self, str, /) -> str
+ ignite/distributed/comp_models/native.py:517: note: Both left and right operands are unions

sympy (https://github.com/sympy/sympy)
+ sympy/core/expr.py:388: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]

freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/configuration/timerange.py:141: error: Argument 1 to "len" has incompatible type "Optional[str]"; expected "Sized"  [arg-type]
+ freqtrade/configuration/timerange.py:143: error: Argument 1 to "len" has incompatible type "Optional[str]"; expected "Sized"  [arg-type]
+ freqtrade/configuration/timerange.py:144: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ freqtrade/configuration/timerange.py:146: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ freqtrade/configuration/timerange.py:150: error: Argument 1 to "len" has incompatible type "Optional[str]"; expected "Sized"  [arg-type]
+ freqtrade/configuration/timerange.py:152: error: Argument 1 to "len" has incompatible type "Optional[str]"; expected "Sized"  [arg-type]
+ freqtrade/configuration/timerange.py:153: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ freqtrade/configuration/timerange.py:155: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ freqtrade/data/history/idatahandler.py:58: error: Argument 1 to "rebuild_pair_from_filename" of "IDataHandler" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ freqtrade/data/history/idatahandler.py:59: error: Argument 1 to "rebuild_timeframe_from_filename" of "IDataHandler" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ freqtrade/data/history/idatahandler.py:60: error: Argument 1 to "from_string" of "CandleType" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ freqtrade/freqai/data_drawer.py:440: error: Invalid index type "Optional[str]" for "Dict[str, Any]"; expected type "str"  [index]
+ freqtrade/freqai/data_drawer.py:441: error: Invalid index type "Optional[str]" for "Dict[str, Any]"; expected type "str"  [index]
+ freqtrade/freqai/data_drawer.py:442: error: Invalid index type "Optional[str]" for "Dict[str, Any]"; expected type "str"  [index]
+ freqtrade/freqai/data_drawer.py:442: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
+ freqtrade/freqai/data_drawer.py:445: error: Argument 1 to "int" has incompatible type "Optional[str]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]

pylint (https://github.com/pycqa/pylint)
+ pylint/pyreverse/utils.py:264: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]
+ pylint/lint/message_state_handler.py:365: error: Argument 1 to "parse_pragma" has incompatible type "Optional[str]"; expected "str"  [arg-type]
+ pylint/checkers/strings.py:1002: error: Incompatible return value type (got "Optional[str]", expected "str")  [return-value]
+ pylint/checkers/spelling.py:186: error: No overload variant of "__add__" of "str" matches argument type "None"  [operator]
+ pylint/checkers/spelling.py:186: note: Possible overload variants:
+ pylint/checkers/spelling.py:186: note:     def __add__(self, str, /) -> str
+ pylint/checkers/spelling.py:186: error: Unsupported left operand type for + ("None")  [operator]
+ pylint/checkers/spelling.py:186: note: Both left and right operands are unions
+ pylint/checkers/spelling.py:203: error: No overload variant of "__add__" of "str" matches argument type "None"  [operator]
+ pylint/checkers/spelling.py:203: note: Possible overload variants:
+ pylint/checkers/spelling.py:203: note:     def __add__(self, str, /) -> str
+ pylint/checkers/spelling.py:203: error: Unsupported left operand type for + ("None")  [operator]
+ pylint/checkers/spelling.py:203: note: Both left and right operands are unions
+ pylint/checkers/format.py:610: error: Argument 1 to "parse_pragma" has incompatible type "Optional[str]"; expected "str"  [arg-type]

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/nodes.py: note: In function "split_explicit_title":
+ sphinx/util/nodes.py:344:16: error: Incompatible return value type (got "Tuple[bool, Optional[str], Optional[str]]", expected "Tuple[bool, str, str]")  [return-value]
+ sphinx/util/inventory.py: note: In member "load_v2" of class "InventoryFile":
+ sphinx/util/inventory.py:122:16: error: Unsupported right operand type for in ("Optional[str]")  [operator]
+ sphinx/util/inventory.py:133:16: error: Item "None" of "Optional[str]" has no attribute "endswith"  [union-attr]
+ sphinx/util/inventory.py:134:28: error: Value of type "Optional[str]" is not indexable  [index]
+ sphinx/util/inventory.py:134:28: error: No overload variant of "__add__" of "str" matches argument type "None"  [operator]
+ sphinx/util/inventory.py:134:28: note: 

... (truncated 507 lines) ...

@AlexWaygood
Copy link
Member

That looks suboptimal.

@willfrey
Copy link
Contributor Author

willfrey commented Jan 9, 2023

@AlexWaygood I concur 😆

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

Successfully merging this pull request may close these issues.

3 participants