- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.9k
Open
Labels
stubs: false positiveType checkers report false errorsType checkers report false errors
Description
The typing for converter here is as follows:
converter: Callable[[float | None], struct_time]And the typing for time.gmtime/time.localtime here is:
def gmtime(seconds: float | None = None, /) -> struct_time: ...
def localtime(seconds: float | None = None, /) -> struct_time: ...Yet when I try to typecheck this code:
import logging
import time
class UTCFormatter(logging.Formatter):
    converter = time.gmtimeI get the following error:
$ mypy main.py
main.py:5: error: Incompatible types in assignment (expression has type "Callable[[], struct_time]", base class "Formatter" defined the type as "Callable[[float | None], struct_time]")  [assignment]
Found 1 error in 1 file (checked 1 source file)
I tested this on a fresh python3.13 venv with the following deps installed:
mypy==1.18.2
mypy_extensions==1.1.0
pathspec==0.12.1
typing_extensions==4.15.0
Metadata
Metadata
Assignees
Labels
stubs: false positiveType checkers report false errorsType checkers report false errors