Skip to content

Conversation

@srittau
Copy link
Collaborator

@srittau srittau commented Apr 29, 2024

No description provided.

@srittau
Copy link
Collaborator Author

srittau commented Apr 29, 2024

This is a trial to judge the impact of such a change that could prevent runtime errors due to mixing timezone-aware and unaware datetimes.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@srittau
Copy link
Collaborator Author

srittau commented Apr 29, 2024

While I think there's some promise in this approach, I struggle with Any annotated datetimes. The __sub__ overloads (for example), derive a return type of Any, probably because mypy is merging the timedelta and NoReturn annotations of multiple annotations. Does anyone have an idea how to work around this?

@bluetech
Copy link
Contributor

I don't have much to add except to say that having this will be truly great, my code is littered with "aware"/"not aware" comments which really should be in the type, so I hope you can get it to work. (I haven't been bothered with it enough to use something like DataType yet).

I am curious about two things:

  • Why default TzInfoT to Any instead of tzinfo | None?
  • Why are the overloads needed? I guess typecheckers don't know the type of default values so they don't see that fromtimestamp(123) is the same as fromtimestamp(123, tz=None) and so can't infer TzInfoT=None?

@srittau
Copy link
Collaborator Author

srittau commented May 19, 2024

@bluetech

  • Why default TzInfoT to Any instead of tzinfo | None?

It tried both, but both didn't work. tzinfo | None is also my preferred default, but I hoped that Any would have less problems when it didn't.

  • Why are the overloads needed? I guess typecheckers don't know the type of default values so they don't see that fromtimestamp(123) is the same as fromtimestamp(123, tz=None) and so can't infer TzInfoT=None?

Exactly.

@github-actions

This comment has been minimized.

@srittau srittau linked an issue Nov 10, 2025 that may be closed by this pull request
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@srittau
Copy link
Collaborator Author

srittau commented Nov 10, 2025

Looking at some of the primer output (unfortunately, there's a lot of spam):

  • tornado: A bit unfortunate, since mypy infers {"aware": aware_dt, "naive": naive_dt} to be dict[str, object], instead of dict[str, datetime[...]].
  • mongo-python-driver, dulwich: Since aware and non-aware datetimes are now different objects, constructs like if now.tzinfo is None: now = make_tz_aware(now) won't work anymore in all cases, although I see that as a positive.
  • openlibrary: Needs update of type ignore.
  • homeassistant: Would be fixed by tightening the return annotation of their parse_datetime utility function to include the new tzinfo parameter.

Overall while I think that this generates quite a bit of churn, all that churn pays off by preventing really annoying and hard to spot tz awareness bugs.

@mttbernardini
Copy link

mttbernardini commented Dec 20, 2025

Nice to see this getting implemented in typeshed!

Leaving this other attempt for reference: https://github.com/mttbernardini/datetypes

A question I have is in regards of runtime behaviour. How does this PR tackle using the generic datetime in a runtime context, since the actual runtime object doesn't support __class_getitem__()?

@glyph
Copy link
Contributor

glyph commented Dec 20, 2025

Great to see this happening! I hope that the stdlib itself can have an update to address the __class_getitem__ issue, but I'd definitely be happy to EOL datetype if this were to land.

@github-actions

This comment was marked as outdated.

@m-aciek
Copy link
Contributor

m-aciek commented Jan 23, 2026

I hope that the stdlib itself can have an update to address the __class_getitem__ issue

It looks like we need a PR to CPython to allow to use datetime as a generic. For what it's worth I've used Copilot to implement that: https://github.com/m-aciek/cpython/pull/29/changes.

For backports it may be worth to provide an alias in typing_extensions package. It could look like follows: https://github.com/m-aciek/typing_extensions/pull/1/changes.

Would it be enough to make it all work? 🎉

@github-actions
Copy link
Contributor

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

pandera (https://github.com/pandera-dev/pandera)
- pandera/engines/pandas_engine.py:975: error: Argument 1 to "Timestamp" has incompatible type "Any | Hashable"; expected "integer[Any] | float | str | date | datetime | datetime64[date | int | None]"  [arg-type]
+ pandera/engines/pandas_engine.py:975: error: Argument 1 to "Timestamp" has incompatible type "Any | Hashable"; expected "integer[Any] | float | str | date | datetime[Any] | datetime64[date | int | None]"  [arg-type]
- pandera/strategies/pandas_strategies.py:67: note:     def mask(self, cond: Series[Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | Callable[[Series[Any]], Series[builtins.bool]] | Callable[[Any], builtins.bool], other: str | bytes | date | datetime | timedelta | <15 more items> | None = ..., *, inplace: Literal[True], axis: Literal['index', 0] | None = ..., level: Hashable | None = ...) -> None
+ pandera/strategies/pandas_strategies.py:67: note:     def mask(self, cond: Series[Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | Callable[[Series[Any]], Series[builtins.bool]] | Callable[[Any], builtins.bool], other: str | bytes | date | datetime[Any] | timedelta | <15 more items> | None = ..., *, inplace: Literal[True], axis: Literal['index', 0] | None = ..., level: Hashable | None = ...) -> None
- pandera/strategies/pandas_strategies.py:67: note:     def mask(self, cond: Series[Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | Callable[[Series[Any]], Series[builtins.bool]] | Callable[[Any], builtins.bool], other: str | bytes | date | datetime | timedelta | <15 more items> | None = ..., *, inplace: Literal[False] = ..., axis: Literal['index', 0] | None = ..., level: Hashable | None = ...) -> Series[Any]
+ pandera/strategies/pandas_strategies.py:67: note:     def mask(self, cond: Series[Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | Callable[[Series[Any]], Series[builtins.bool]] | Callable[[Any], builtins.bool], other: str | bytes | date | datetime[Any] | timedelta | <15 more items> | None = ..., *, inplace: Literal[False] = ..., axis: Literal['index', 0] | None = ..., level: Hashable | None = ...) -> Series[Any]
- pandera/strategies/pandas_strategies.py:69: note:     def mask(self, cond: Series[Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | Callable[[Series[Any]], Series[builtins.bool]] | Callable[[Any], builtins.bool], other: str | bytes | date | datetime | timedelta | <15 more items> | None = ..., *, inplace: Literal[True], axis: Literal['index', 0] | None = ..., level: Hashable | None = ...) -> None
+ pandera/strategies/pandas_strategies.py:69: note:     def mask(self, cond: Series[Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | Callable[[Series[Any]], Series[builtins.bool]] | Callable[[Any], builtins.bool], other: str | bytes | date | datetime[Any] | timedelta | <15 more items> | None = ..., *, inplace: Literal[True], axis: Literal['index', 0] | None = ..., level: Hashable | None = ...) -> None
- pandera/strategies/pandas_strategies.py:69: note:     def mask(self, cond: Series[Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | Callable[[Series[Any]], Series[builtins.bool]] | Callable[[Any], builtins.bool], other: str | bytes | date | datetime | timedelta | <15 more items> | None = ..., *, inplace: Literal[False] = ..., axis: Literal['index', 0] | None = ..., level: Hashable | None = ...) -> Series[Any]
+ pandera/strategies/pandas_strategies.py:69: note:     def mask(self, cond: Series[Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | Callable[[Series[Any]], Series[builtins.bool]] | Callable[[Any], builtins.bool], other: str | bytes | date | datetime[Any] | timedelta | <15 more items> | None = ..., *, inplace: Literal[False] = ..., axis: Literal['index', 0] | None = ..., level: Hashable | None = ...) -> Series[Any]
- pandera/strategies/pandas_strategies.py:70: note:     def mask(self, cond: Series[Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | Callable[[Series[Any]], Series[builtins.bool]] | Callable[[Any], builtins.bool], other: str | bytes | date | datetime | timedelta | <15 more items> | None = ..., *, inplace: Literal[True], axis: Literal['index', 0] | None = ..., level: Hashable | None = ...) -> None
+ pandera/strategies/pandas_strategies.py:70: note:     def mask(self, cond: Series[Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | Callable[[Series[Any]], Series[builtins.bool]] | Callable[[Any], builtins.bool], other: str | bytes | date | datetime[Any] | timedelta | <15 more items> | None = ..., *, inplace: Literal[True], axis: Literal['index', 0] | None = ..., level: Hashable | None = ...) -> None
- pandera/strategies/pandas_strategies.py:70: note:     def mask(self, cond: Series[Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | Callable[[Series[Any]], Series[builtins.bool]] | Callable[[Any], builtins.bool], other: str | bytes | date | datetime | timedelta | <15 more items> | None = ..., *, inplace: Literal[False] = ..., axis: Literal['index', 0] | None = ..., level: Hashable | None = ...) -> Series[Any]
+ pandera/strategies/pandas_strategies.py:70: note:     def mask(self, cond: Series[Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | Callable[[Series[Any]], Series[builtins.bool]] | Callable[[Any], builtins.bool], other: str | bytes | date | datetime[Any] | timedelta | <15 more items> | None = ..., *, inplace: Literal[False] = ..., axis: Literal['index', 0] | None = ..., level: Hashable | None = ...) -> Series[Any]

freqtrade (https://github.com/freqtrade/freqtrade)
- freqtrade/data/metrics.py:258: error: Argument 1 to "abs" has incompatible type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "SupportsAbs[object]"  [arg-type]
+ freqtrade/data/metrics.py:258: error: Argument 1 to "abs" has incompatible type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "SupportsAbs[object]"  [arg-type]
- freqtrade/data/metrics.py:259: error: Argument "high_date" to "DrawDownResult" has incompatible type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "Timestamp"  [arg-type]
+ freqtrade/data/metrics.py:259: error: Argument "high_date" to "DrawDownResult" has incompatible type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "Timestamp"  [arg-type]
- freqtrade/data/metrics.py:260: error: Argument "low_date" to "DrawDownResult" has incompatible type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "Timestamp"  [arg-type]
+ freqtrade/data/metrics.py:260: error: Argument "low_date" to "DrawDownResult" has incompatible type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "Timestamp"  [arg-type]
- freqtrade/data/metrics.py:261: error: Argument "high_value" to "DrawDownResult" has incompatible type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "float"  [arg-type]
+ freqtrade/data/metrics.py:261: error: Argument "high_value" to "DrawDownResult" has incompatible type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "float"  [arg-type]
- freqtrade/data/metrics.py:262: error: Argument "low_value" to "DrawDownResult" has incompatible type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "float"  [arg-type]
+ freqtrade/data/metrics.py:262: error: Argument "low_value" to "DrawDownResult" has incompatible type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "float"  [arg-type]
- freqtrade/data/metrics.py:263: error: Argument "relative_account_drawdown" to "DrawDownResult" has incompatible type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "float"  [arg-type]
+ freqtrade/data/metrics.py:263: error: Argument "relative_account_drawdown" to "DrawDownResult" has incompatible type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "float"  [arg-type]
- freqtrade/data/metrics.py:265: error: Argument "current_high_date" to "DrawDownResult" has incompatible type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "Timestamp"  [arg-type]
+ freqtrade/data/metrics.py:265: error: Argument "current_high_date" to "DrawDownResult" has incompatible type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "Timestamp"  [arg-type]
- freqtrade/data/converter/orderflow.py:116: error: Incompatible types in assignment (expression has type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]", variable has type "datetime")  [assignment]
+ freqtrade/data/converter/orderflow.py:116: error: Incompatible types in assignment (expression has type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]", variable has type "datetime[Any]")  [assignment]
- freqtrade/data/converter/orderflow.py:134: error: Incompatible types in assignment (expression has type "list[dict[Hashable, Any]]", target has type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | NAType | NaTType | None")  [assignment]
+ freqtrade/data/converter/orderflow.py:134: error: Incompatible types in assignment (expression has type "list[dict[Hashable, Any]]", target has type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | NAType | NaTType | None")  [assignment]
- freqtrade/data/converter/orderflow.py:142: error: Incompatible types in assignment (expression has type "dict[Hashable, dict[Hashable, Any]]", target has type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | NAType | NaTType | None")  [assignment]
+ freqtrade/data/converter/orderflow.py:142: error: Incompatible types in assignment (expression has type "dict[Hashable, dict[Hashable, Any]]", target has type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | NAType | NaTType | None")  [assignment]
- freqtrade/data/converter/orderflow.py:175: note:     def __rsub__(self, datetime | Timestamp | datetime64[date | int | None], /) -> Timestamp
+ freqtrade/data/converter/orderflow.py:175: note:     def __rsub__(self, datetime[Any] | Timestamp | datetime64[date | int | None], /) -> Timestamp
- freqtrade/data/converter/orderflow.py:175: note:     def __sub__(self, datetime, /) -> Never
+ freqtrade/data/converter/orderflow.py:175: note:     def __sub__(self, datetime[Any], /) -> Never
+ freqtrade/data/converter/orderflow.py:175: note:     def __sub__(self, datetime[tzinfo] | datetime[tzinfo | None], /) -> timedelta
- freqtrade/data/converter/orderflow.py:175: note:     def __sub__(self, datetime, /) -> timedelta
+ freqtrade/data/converter/orderflow.py:175: note:     def __sub__(self, datetime[None] | datetime[tzinfo | None], /) -> timedelta
- freqtrade/data/converter/orderflow.py:175: note:     def __sub__(self, timedelta, /) -> datetime
+ freqtrade/data/converter/orderflow.py:175: note:     def __sub__(self, timedelta, /) -> datetime[Any]
- freqtrade/data/converter/orderflow.py:175: error: Unsupported operand types for - ("timedelta" and "datetime")  [operator]
+ freqtrade/data/converter/orderflow.py:175: error: Unsupported operand types for - ("timedelta" and "datetime[Any]")  [operator]
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "timedelta64" matches argument type "datetime"  [operator]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "timedelta64" matches argument type "datetime[Any]"  [operator]
- freqtrade/data/converter/orderflow.py:175: error: Unsupported operand types for - ("bool" and "datetime")  [operator]
+ freqtrade/data/converter/orderflow.py:175: error: Unsupported operand types for - ("bool" and "datetime[Any]")  [operator]
- freqtrade/data/converter/orderflow.py:175: error: Unsupported operand types for - ("int" and "datetime")  [operator]
+ freqtrade/data/converter/orderflow.py:175: error: Unsupported operand types for - ("int" and "datetime[Any]")  [operator]
- freqtrade/data/converter/orderflow.py:175: error: Unsupported operand types for - ("float" and "datetime")  [operator]
+ freqtrade/data/converter/orderflow.py:175: error: Unsupported operand types for - ("float" and "datetime[Any]")  [operator]
- freqtrade/data/converter/orderflow.py:175: note:     def __sub__(self, datetime | datetime64[date | int | None], /) -> Timedelta
+ freqtrade/data/converter/orderflow.py:175: note:     def __sub__(self, datetime[Any] | datetime64[date | int | None], /) -> Timedelta
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "Timedelta" matches argument type "datetime"  [operator]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "Timedelta" matches argument type "datetime[Any]"  [operator]
- freqtrade/data/converter/orderflow.py:175: error: Unsupported operand types for - ("complex" and "datetime")  [operator]
+ freqtrade/data/converter/orderflow.py:175: error: Unsupported operand types for - ("complex" and "datetime[Any]")  [operator]
- freqtrade/data/converter/orderflow.py:175: error: Unsupported operand types for - ("integer[Any]" and "datetime")  [operator]
+ freqtrade/data/converter/orderflow.py:175: error: Unsupported operand types for - ("integer[Any]" and "datetime[Any]")  [operator]
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "floating" matches argument type "datetime"  [operator]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "floating" matches argument type "datetime[Any]"  [operator]
- freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "complexfloating" matches argument type "datetime"  [operator]
+ freqtrade/data/converter/orderflow.py:175: error: No overload variant of "__sub__" of "complexfloating" matches argument type "datetime[Any]"  [operator]
- freqtrade/data/converter/converter.py:109: error: Argument 1 has incompatible type "dict[str, str]"; expected "Callable[[DataFrame], str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | Callable[[DataFrame], Series[Any]] | Callable[[DataFrame], DataFrame] | ufunc | str | list[Callable[[DataFrame], str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | Callable[[DataFrame], Series[Any]] | Callable[[DataFrame], DataFrame] | ufunc | str] | Mapping[Hashable, Callable[[DataFrame], str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | Callable[[DataFrame], Series[Any]] | Callable[[DataFrame], DataFrame] | ufunc | str | list[Callable[[DataFrame], str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | Callable[[DataFrame], Series[Any]] | Callable[[DataFrame], DataFrame] | ufunc | str]] | None"  [arg-type]
+ freqtrade/data/converter/converter.py:109: error: Argument 1 has incompatible type "dict[str, str]"; expected "Callable[[DataFrame], str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | Callable[[DataFrame], Series[Any]] | Callable[[DataFrame], DataFrame] | ufunc | str | list[Callable[[DataFrame], str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | Callable[[DataFrame], Series[Any]] | Callable[[DataFrame], DataFrame] | ufunc | str] | Mapping[Hashable, Callable[[DataFrame], str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | Callable[[DataFrame], Series[Any]] | Callable[[DataFrame], DataFrame] | ufunc | str | list[Callable[[DataFrame], str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | Callable[[DataFrame], Series[Any]] | Callable[[DataFrame], DataFrame] | ufunc | str]] | None"  [arg-type]
- freqtrade/data/converter/converter.py:294: note:     def [ScalarT: str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] __setitem__(self, Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | str_ | tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...] | list[ScalarT], Any | ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | IndexOpsMixin[Any, Any] | None, /) -> None
+ freqtrade/data/converter/converter.py:294: note:     def [ScalarT: str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] __setitem__(self, Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | str_ | tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...] | list[ScalarT], Any | ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | IndexOpsMixin[Any, Any] | None, /) -> None
- freqtrade/data/converter/converter.py:296: note:     def [ScalarT: str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] __setitem__(self, Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | str_ | tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...] | list[ScalarT], Any | ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | IndexOpsMixin[Any, Any] | None, /) -> None
+ freqtrade/data/converter/converter.py:296: note:     def [ScalarT: str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] __setitem__(self, Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | str_ | tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...] | list[ScalarT], Any | ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | IndexOpsMixin[Any, Any] | None, /) -> None
- freqtrade/data/btanalysis/trade_parallelism.py:40: note:     def [S2: str | bytes | bool | int | float | complex | <6 more items> | type[str] | list[str] | date | time | datetime | timedelta, HashableT1: Hashable, HashableT2: Hashable, HashableT3: Hashable, HashableT4: Hashable] concat(objs: Iterable[Series[S2] | None] | Mapping[HashableT1, Series[S2] | None], *, axis: Literal['index', 0] = ..., join: Literal['inner', 'outer'] = ..., ignore_index: bool = ..., keys: Iterable[HashableT2] | None = ..., levels: Sequence[list[HashableT3] | tuple[HashableT3, ...]] | None = ..., names: list[HashableT4] | None = ..., verify_integrity: bool = ..., sort: bool = ..., copy: bool = ...) -> Series[S2]
+ freqtrade/data/btanalysis/trade_parallelism.py:40: note:     def [S2: str | bytes | bool | int | float | complex | <6 more items> | type[str] | list[str] | date | time | datetime[Any] | timedelta, HashableT1: Hashable, HashableT2: Hashable, HashableT3: Hashable, HashableT4: Hashable] concat(objs: Iterable[Series[S2] | None] | Mapping[HashableT1, Series[S2] | None], *, axis: Literal['index', 0] = ..., join: Literal['inner', 'outer'] = ..., ignore_index: bool = ..., keys: Iterable[HashableT2] | None = ..., levels: Sequence[list[HashableT3] | tuple[HashableT3, ...]] | None = ..., names: list[HashableT4] | None = ..., verify_integrity: bool = ..., sort: bool = ..., copy: bool = ...) -> Series[S2]
- freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "str" of "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "str" of "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
- freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "bytes" of "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "bytes" of "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
- freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "date" of "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "date" of "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
- freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "datetime" of "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "datetime[Any]" of "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
- freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "timedelta" of "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "timedelta" of "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
- freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "bool" of "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "bool" of "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
- freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "int" of "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "int" of "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
- freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "float" of "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "float" of "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
- freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "Timestamp" of "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "Timestamp" of "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
- freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "Timedelta" of "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "Timedelta" of "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
- freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "complex" of "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:64: error: Item "complex" of "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]" has no attribute "copy"  [union-attr]
- freqtrade/optimize/optimize_reports/optimize_reports.py:341: error: Argument 1 to "int" has incompatible type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc"  [arg-type]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:341: error: Argument 1 to "int" has incompatible type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc"  [arg-type]
- freqtrade/optimize/optimize_reports/optimize_reports.py:342: error: Argument 1 to "int" has incompatible type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc"  [arg-type]
+ freqtrade/optimize/optimize_reports/optimize_reports.py:342: error: Argument 1 to "int" has incompatible type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]"; expected "str | Buffer | SupportsInt | SupportsIndex | SupportsTrunc"  [arg-type]
- freqtrade/strategy/strategy_helper.py:107: note:     def __sub__(self, datetime, /) -> Never
+ freqtrade/strategy/strategy_helper.py:107: note:     def __sub__(self, datetime[Any], /) -> Never
- freqtrade/strategy/strategy_helper.py:108: note:     def __sub__(self, datetime, /) -> Never
+ freqtrade/strategy/strategy_helper.py:108: note:     def __sub__(self, datetime[Any], /) -> Never
- freqtrade/data/entryexitanalysis.py:58: error: Invalid index type "tuple[Hashable, str]" for "_LocIndexerFrame[DataFrame]"; expected type "tuple[int | str | str_ | Timestamp | tuple[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any], ...] | Callable[[DataFrame], Never], int | str | str_ | tuple[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any], ...]]"  [index]
+ freqtrade/data/entryexitanalysis.py:58: error: Invalid index type "tuple[Hashable, str]" for "_LocIndexerFrame[DataFrame]"; expected type "tuple[int | str | str_ | Timestamp | tuple[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any], ...] | Callable[[DataFrame], Never], int | str | str_ | tuple[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any], ...]]"  [index]
- freqtrade/freqai/data_kitchen.py:444: error: Incompatible types in assignment (expression has type "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]", target has type "str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | NAType | NaTType | None | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | NAType | NaTType | None] | Sequence[Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | NAType | NaTType | None]] | Mapping[Any, str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | NAType | NaTType | None] | ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | IndexOpsMixin[Any, Any] | DataFrame")  [assignment]
+ freqtrade/freqai/data_kitchen.py:444: error: Incompatible types in assignment (expression has type "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]", target has type "str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | NAType | NaTType | None | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | NAType | NaTType | None] | Sequence[Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | NAType | NaTType | None]] | Mapping[Any, str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | NAType | NaTType | None] | ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | IndexOpsMixin[Any, Any] | DataFrame")  [assignment]
- freqtrade/plot/plotting.py:187: error: Invalid index type "tuple[datetime, str]" for "_LocIndexerFrame[DataFrame]"; expected type "tuple[int | str | str_ | Timestamp | tuple[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any], ...] | Callable[[DataFrame], Never], int | str | str_ | tuple[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any], ...]]"  [index]
+ freqtrade/plot/plotting.py:187: error: Invalid index type "tuple[datetime[Any], str]" for "_LocIndexerFrame[DataFrame]"; expected type "tuple[int | str | str_ | Timestamp | tuple[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any], ...] | Callable[[DataFrame], Never], int | str | str_ | tuple[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any], ...]]"  [index]
- freqtrade/plot/plotting.py:188: error: Invalid index type "tuple[datetime, str]" for "_LocIndexerFrame[DataFrame]"; expected type "tuple[int | str | str_ | Timestamp | tuple[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any], ...] | Callable[[DataFrame], Never], int | str | str_ | tuple[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any], ...]]"  [index]
+ freqtrade/plot/plotting.py:188: error: Invalid index type "tuple[datetime[Any], str]" for "_LocIndexerFrame[DataFrame]"; expected type "tuple[int | str | str_ | Timestamp | tuple[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any], ...] | Callable[[DataFrame], Never], int | str | str_ | tuple[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any], ...]]"  [index]
- freqtrade/templates/FreqaiExampleStrategy.py:245: error: Invalid index type "tuple[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...], list[str]]" for "_LocIndexerFrame[DataFrame]"; expected type "tuple[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...], Hashable]"  [index]
+ freqtrade/templates/FreqaiExampleStrategy.py:245: error: Invalid index type "tuple[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...], list[str]]" for "_LocIndexerFrame[DataFrame]"; expected type "tuple[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...], Hashable]"  [index]
- freqtrade/templates/FreqaiExampleStrategy.py:245: error: Unsupported left operand type for & ("tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]")  [operator]
+ freqtrade/templates/FreqaiExampleStrategy.py:245: error: Unsupported left operand type for & ("tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]")  [operator]
- freqtrade/templates/FreqaiExampleStrategy.py:245: error: Argument 2 to "reduce" has incompatible type "list[Series[builtins.bool]]"; expected "Iterable[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]]"  [arg-type]
+ freqtrade/templates/FreqaiExampleStrategy.py:245: error: Argument 2 to "reduce" has incompatible type "list[Series[builtins.bool]]"; expected "Iterable[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]]"  [arg-type]
- freqtrade/templates/FreqaiExampleStrategy.py:255: error: Invalid index type "tuple[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...], list[str]]" for "_LocIndexerFrame[DataFrame]"; expected type "tuple[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...], Hashable]"  [index]
+ freqtrade/templates/FreqaiExampleStrategy.py:255: error: Invalid index type "tuple[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...], list[str]]" for "_LocIndexerFrame[DataFrame]"; expected type "tuple[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...], Hashable]"  [index]
- freqtrade/templates/FreqaiExampleStrategy.py:255: error: Unsupported left operand type for & ("tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]")  [operator]
+ freqtrade/templates/FreqaiExampleStrategy.py:255: error: Unsupported left operand type for & ("tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]")  [operator]
- freqtrade/templates/FreqaiExampleStrategy.py:255: error: Argument 2 to "reduce" has incompatible type "list[Series[builtins.bool]]"; expected "Iterable[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]]"  [arg-type]
+ freqtrade/templates/FreqaiExampleStrategy.py:255: error: Argument 2 to "reduce" has incompatible type "list[Series[builtins.bool]]"; expected "Iterable[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]]"  [arg-type]
- freqtrade/templates/FreqaiExampleStrategy.py:263: error: Unsupported left operand type for & ("tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]")  [operator]
+ freqtrade/templates/FreqaiExampleStrategy.py:263: error: Unsupported left operand type for & ("tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]")  [operator]
- freqtrade/templates/FreqaiExampleStrategy.py:263: error: Argument 2 to "reduce" has incompatible type "list[Series[builtins.bool]]"; expected "Iterable[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]]"  [arg-type]
+ freqtrade/templates/FreqaiExampleStrategy.py:263: error: Argument 2 to "reduce" has incompatible type "list[Series[builtins.bool]]"; expected "Iterable[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]]"  [arg-type]
- freqtrade/templates/FreqaiExampleStrategy.py:267: error: Unsupported left operand type for & ("tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]")  [operator]
+ freqtrade/templates/FreqaiExampleStrategy.py:267: error: Unsupported left operand type for & ("tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]")  [operator]
- freqtrade/templates/FreqaiExampleStrategy.py:267: error: Argument 2 to "reduce" has incompatible type "list[Series[builtins.bool]]"; expected "Iterable[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]]"  [arg-type]
+ freqtrade/templates/FreqaiExampleStrategy.py:267: error: Argument 2 to "reduce" has incompatible type "list[Series[builtins.bool]]"; expected "Iterable[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]]"  [arg-type]

spark (https://github.com/apache/spark)
- python/pyspark/sql/pandas/types.py:789: error: Argument 1 to "apply" of "Series" has incompatible type "Callable[[Any], Any | NaTType]"; expected "Callable[..., str | bytes | date | datetime | timedelta | <15 more items> | None]"  [arg-type]
+ python/pyspark/sql/pandas/types.py:789: error: Argument 1 to "apply" of "Series" has incompatible type "Callable[[Any], Any | NaTType]"; expected "Callable[..., str | bytes | date | datetime[Any] | timedelta | <15 more items> | None]"  [arg-type]
- python/pyspark/sql/pandas/types.py:789: error: Incompatible return value type (got "Any | NaTType", expected "str | bytes | date | datetime | timedelta | <15 more items> | None")  [return-value]
+ python/pyspark/sql/pandas/types.py:789: error: Incompatible return value type (got "Any | NaTType", expected "str | bytes | date | datetime[Any] | timedelta | <15 more items> | None")  [return-value]
- python/pyspark/pandas/series.py:1209: note:     def __getitem__(self, str | bytes | date | datetime | timedelta | <12 more items>, /) -> Any
+ python/pyspark/pandas/series.py:1209: note:     def __getitem__(self, str | bytes | date | datetime[Any] | timedelta | <12 more items>, /) -> Any
- python/pyspark/pandas/series.py:1209: note:     def __getitem__(self, Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | Index[Any] | Series[Any] | SequenceNotStr[float | str | Timestamp] | slice[Any, Any, Any] | tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...] | Sequence[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]] | Callable[..., Any], /) -> Series[Any]
+ python/pyspark/pandas/series.py:1209: note:     def __getitem__(self, Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | Index[Any] | Series[Any] | SequenceNotStr[float | str | Timestamp] | slice[Any, Any, Any] | tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...] | Sequence[tuple[IndexOpsMixin[Any, Any] | Series[builtins.bool] | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | list[builtins.bool] | str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | Sequence[str | bytes | date | datetime[Any] | timedelta | <7 more items> | complex | integer[Any] | floating[Any] | complexfloating[Any, Any]] | slice[Any, Any, Any], ...]] | Callable[..., Any], /) -> Series[Any]

tornado (https://github.com/tornadoweb/tornado)
+ tornado/test/locale_test.py:100: error: Unsupported operand types for - ("object" and "timedelta")  [operator]
+ tornado/test/locale_test.py:100: error: Argument 1 to "format_date" of "Locale" has incompatible type "timedelta"; expected "int | float | datetime[Any]"  [arg-type]
+ tornado/test/locale_test.py:106: error: Unsupported operand types for - ("object" and "timedelta")  [operator]
+ tornado/test/locale_test.py:106: error: Argument 1 to "format_date" of "Locale" has incompatible type "timedelta"; expected "int | float | datetime[Any]"  [arg-type]
+ tornado/test/locale_test.py:112: error: Unsupported operand types for - ("object" and "timedelta")  [operator]
+ tornado/test/locale_test.py:112: error: Argument 1 to "format_date" of "Locale" has incompatible type "timedelta"; expected "int | float | datetime[Any]"  [arg-type]
+ tornado/test/locale_test.py:119: error: Unsupported operand types for - ("object" and "timedelta")  [operator]
+ tornado/test/locale_test.py:119: error: Argument 1 to "format_date" of "Locale" has incompatible type "timedelta"; expected "int | float | datetime[Any]"  [arg-type]
+ tornado/test/locale_test.py:126: error: Unsupported operand types for - ("object" and "timedelta")  [operator]
+ tornado/test/locale_test.py:126: error: Incompatible types in assignment (expression has type "timedelta", variable has type "datetime[None]")  [assignment]
+ tornado/test/locale_test.py:132: error: Unsupported operand types for - ("object" and "timedelta")  [operator]
+ tornado/test/locale_test.py:132: error: Incompatible types in assignment (expression has type "timedelta", variable has type "datetime[None]")  [assignment]
+ tornado/test/locale_test.py:138: error: Unsupported operand types for - ("object" and "timedelta")  [operator]
+ tornado/test/locale_test.py:138: error: Incompatible types in assignment (expression has type "timedelta", variable has type "datetime[None]")  [assignment]

bokeh (https://github.com/bokeh/bokeh)
- src/bokeh/util/serialization.py:171:1: error: Argument 1 to "convert_datetime_type" becomes "Any | Any | Any | datetime | date | time | datetime64[date | int | None]" due to an unfollowed import  [no-any-unimported]
+ src/bokeh/util/serialization.py:171:1: error: Argument 1 to "convert_datetime_type" becomes "Any | Any | Any | datetime[Any] | date | time | datetime64[date | int | None]" due to an unfollowed import  [no-any-unimported]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ bson/json_util.py:915: error: Unused "type: ignore" comment  [unused-ignore]
+ pymongo/ocsp_cache.py:92: error: Incompatible types in assignment (expression has type "datetime[None]", variable has type "datetime[tzinfo]")  [assignment]
+ pymongo/ocsp_cache.py:126: error: Incompatible types in assignment (expression has type "datetime[None]", variable has type "datetime[tzinfo]")  [assignment]
+ pymongo/ocsp_support.py:269: error: Incompatible types in assignment (expression has type "datetime[None]", variable has type "datetime[tzinfo]")  [assignment]

openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/tests/core/test_unmarshal.py:32: error: Unused "type: ignore" comment  [unused-ignore]
+ openlibrary/tests/core/test_unmarshal.py: note: In function "parse_datetime":
+ openlibrary/tests/core/test_unmarshal.py:32: error: No overload variant of "datetime" matches argument type "Generator[int, None, None]"  [call-overload]
+ openlibrary/tests/core/test_unmarshal.py:32: note: Error code "call-overload" not covered by "type: ignore" comment
+ openlibrary/tests/core/test_unmarshal.py:32: note: Possible overload variants:
+ openlibrary/tests/core/test_unmarshal.py:32: note:     def [_TzInfoT: tzinfo | None] __new__(cls, year: SupportsIndex, month: SupportsIndex, day: SupportsIndex, hour: SupportsIndex = ..., minute: SupportsIndex = ..., second: SupportsIndex = ..., microsecond: SupportsIndex = ..., tzinfo: None = ..., *, fold: int = ...) -> datetime[None]
+ openlibrary/tests/core/test_unmarshal.py:32: note:     def [_TzInfoT: tzinfo | None] __new__(cls, year: SupportsIndex, month: SupportsIndex, day: SupportsIndex, hour: SupportsIndex = ..., minute: SupportsIndex = ..., second: SupportsIndex = ..., microsecond: SupportsIndex = ..., *, tzinfo: tzinfo, fold: int = ...) -> datetime[tzinfo]
+ openlibrary/tests/core/test_unmarshal.py:32: note:     def [_TzInfoT: tzinfo | None] __new__(cls, year: SupportsIndex, month: SupportsIndex, day: SupportsIndex, hour: SupportsIndex, minute: SupportsIndex, second: SupportsIndex, microsecond: SupportsIndex, tzinfo: tzinfo, *, fold: int = ...) -> datetime[tzinfo]

dulwich (https://github.com/dulwich/dulwich)
+ dulwich/approxidate.py:100: error: Incompatible types in assignment (expression has type "datetime[tzinfo | None]", variable has type "datetime[None]")  [assignment]

alerta (https://github.com/alerta/alerta)
- alerta/models/key.py:24: error: Incompatible default for argument "expire_time" (default has type "None", argument has type "datetime")  [assignment]
+ alerta/models/key.py:24: error: Incompatible default for argument "expire_time" (default has type "None", argument has type "datetime[Any]")  [assignment]
- alerta/models/key.py:54: error: Argument "expire_time" to "ApiKey" has incompatible type "datetime | None"; expected "datetime"  [arg-type]
+ alerta/models/key.py:54: error: Argument "expire_time" to "ApiKey" has incompatible type "datetime[Any] | None"; expected "datetime[Any]"  [arg-type]
- alerta/models/key.py:93: error: Argument "expire_time" to "ApiKey" has incompatible type "Any | None"; expected "datetime"  [arg-type]
+ alerta/models/key.py:93: error: Argument "expire_time" to "ApiKey" has incompatible type "Any | None"; expected "datetime[Any]"  [arg-type]
- alerta/models/heartbeat.py:28: error: Incompatible default for argument "create_time" (default has type "None", argument has type "datetime")  [assignment]
+ alerta/models/heartbeat.py:28: error: Incompatible default for argument "create_time" (default has type "None", argument has type "datetime[Any]")  [assignment]
- alerta/models/heartbeat.py:88: error: Argument "create_time" to "Heartbeat" has incompatible type "datetime | None"; expected "datetime"  [arg-type]
+ alerta/models/heartbeat.py:88: error: Argument "create_time" to "Heartbeat" has incompatible type "datetime[Any] | None"; expected "datetime[Any]"  [arg-type]
- alerta/models/heartbeat.py:124: error: Argument "create_time" to "Heartbeat" has incompatible type "Any | None"; expected "datetime"  [arg-type]
+ alerta/models/heartbeat.py:124: error: Argument "create_time" to "Heartbeat" has incompatible type "Any | None"; expected "datetime[Any]"  [arg-type]

spack (https://github.com/spack/spack)
+ lib/spack/spack/llnl/util/lang.py:640: error: Incompatible types in assignment (expression has type "Callable[[Any], datetime[Any] | datetime[None]]", target has type "Callable[[Any], datetime[tzinfo | None]]")  [assignment]

materialize (https://github.com/MaterializeInc/materialize)
- misc/python/materialize/scratch.py:74: error: Argument 1 to "fromtimestamp" of "datetime" has incompatible type "str"; expected "float"  [arg-type]
+ misc/python/materialize/scratch.py:74: error: No overload variant of "fromtimestamp" of "datetime" matches argument type "str"  [call-overload]
+ misc/python/materialize/scratch.py:74: note: Possible overload variants:
+ misc/python/materialize/scratch.py:74: note:     def [_TzInfoT: tzinfo | None] fromtimestamp(cls, timestamp: float, tz: None = ...) -> datetime[None]
+ misc/python/materialize/scratch.py:74: note:     def [_TzInfoT: tzinfo | None] fromtimestamp(cls, timestamp: float, tz: tzinfo) -> datetime[tzinfo]
- misc/python/materialize/parallel_workload/parallel_workload.py:416: error: Incompatible types in assignment (expression has type "datetime", variable has type "float")  [assignment]
+ misc/python/materialize/parallel_workload/parallel_workload.py:416: error: Incompatible types in assignment (expression has type "datetime[None]", variable has type "float")  [assignment]
- misc/python/materialize/parallel_workload/parallel_workload.py:417: error: Unsupported operand types for < ("datetime" and "float")  [operator]
+ misc/python/materialize/parallel_workload/parallel_workload.py:417: error: No overload variant of "__lt__" of "datetime" matches argument type "float"  [operator]
+ misc/python/materialize/parallel_workload/parallel_workload.py:417: note: Possible overload variants:
+ misc/python/materialize/parallel_workload/parallel_workload.py:417: note:     def __lt__(self, datetime[None] | datetime[tzinfo | None], /) -> bool
+ misc/python/materialize/parallel_workload/parallel_workload.py:417: note:     def __lt__(self, datetime[Any], /) -> Never

psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/types/datetime.py:574: error: Incompatible types in assignment (expression has type "datetime[None]", variable has type "datetime[tzinfo]")  [assignment]

apprise (https://github.com/caronc/apprise)
- apprise/asset.py:283: error: Incompatible types in assignment (expression has type "tzinfo | None", variable has type "None")  [assignment]
- apprise/persistent_store.py:128: error: Incompatible types in assignment (expression has type "datetime", variable has type "None")  [assignment]
+ apprise/persistent_store.py:128: error: Incompatible types in assignment (expression has type "datetime[Any]", variable has type "None")  [assignment]
- apprise/persistent_store.py:136: error: Incompatible types in assignment (expression has type "datetime", variable has type "None")  [assignment]
+ apprise/persistent_store.py:136: error: Incompatible types in assignment (expression has type "datetime[tzinfo]", variable has type "None")  [assignment]
- apprise/persistent_store.py:139: error: Incompatible types in assignment (expression has type "datetime", variable has type "None")  [assignment]
+ apprise/persistent_store.py:139: error: Incompatible types in assignment (expression has type "datetime[tzinfo]", variable has type "None")  [assignment]
- apprise/persistent_store.py:1427: error: Incompatible types in assignment (expression has type "datetime | int", variable has type "int | float | None")  [assignment]
+ apprise/persistent_store.py:1427: error: Incompatible types in assignment (expression has type "datetime[None] | int", variable has type "int | float | None")  [assignment]
- apprise/persistent_store.py:1525: error: Unsupported operand types for > ("datetime" and "None")  [operator]
+ apprise/persistent_store.py:1525: error: No overload variant of "__gt__" of "datetime" matches argument type "None"  [operator]
+ apprise/persistent_store.py:1525: note: Possible overload variants:
+ apprise/persistent_store.py:1525: note:     def __gt__(self, datetime[None] | datetime[tzinfo | None], /) -> bool
+ apprise/persistent_store.py:1525: note:     def __gt__(self, datetime[Any], /) -> Never
- apprise/persistent_store.py:1525: error: Unsupported operand types for < ("int" and "datetime")  [operator]
+ apprise/persistent_store.py:1525: error: Unsupported operand types for < ("int" and "datetime[None]")  [operator]
- apprise/persistent_store.py:1525: error: Unsupported operand types for < ("float" and "datetime")  [operator]
+ apprise/persistent_store.py:1525: error: Unsupported operand types for < ("float" and "datetime[None]")  [operator]

core (https://github.com/home-assistant/core)
- homeassistant/util/dt.py:230: error: Returning Any from function declared to return "datetime | None"  [no-any-return]
+ homeassistant/util/dt.py:230: error: Returning Any from function declared to return "datetime[Any] | None"  [no-any-return]
- homeassistant/core.py:1886: error: Returning Any from function declared to return "ReadOnlyDict[str, datetime | Collection[Any]]"  [no-any-return]
+ homeassistant/core.py:1886: error: Returning Any from function declared to return "ReadOnlyDict[str, datetime[Any] | Collection[Any]]"  [no-any-return]
+ homeassistant/components/recorder/models/state.py:77: error: Unused "type: ignore" comment  [unused-ignore]
+ homeassistant/components/recorder/models/state.py:89: error: Unused "type: ignore" comment  [unused-ignore]
+ homeassistant/helpers/sun.py:150: error: Returning Any from function declared to return "bool"  [no-any-return]
+ homeassistant/helpers/condition.py:998: error: Returning Any from function declared to return "bool"  [no-any-return]
- homeassistant/components/recorder/util.py:378: error: Returning Any from function declared to return "datetime | None"  [no-any-return]
+ homeassist

... (truncated 237 lines) ...

@srittau
Copy link
Collaborator Author

srittau commented Jan 23, 2026

Looking at some of the primer output:

  • This actually makes some # type: ignores unnecessary, since type checkers now have more knowledge about whether tzinfo is None or not.
  • There are a few cases where variables were used to "naïvify" or "awarify" a datetime (i.e. if x.tzinfo is None: x = make_aware(x)). This is unfortunate and needs either explicit annotations or a second variable.
  • tornado tests are mixing aware and naïve datetimes in a dict, which is derived as dict[str, object] by mypy. Outside of tests this would point to a real problem, so I'm not too worried about this use case.
  • openlibrary: datetime(*(int(token) for token in tokens)) doesn't work anymore, but already needs a # type: ignore.
  • dulwich: Might actually point to a real problem.
  • spack: Needs a specialized function annotation.

So while this will cause some churn, I am convinced that treating datetime[None] and datetime[tzinfo] as two separate types during typing is the right course of action. This causes lots of hard to spot (and sometimes very subtle) bugs at runtime. Especially for people living close to UTC time, where the bugs are often off-by-one, or only surface during summer.

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.

Safer types for datetime

5 participants