Closed
Description
- Are you reporting a bug, or opening a feature request?
feature request. Presumably mypy has the type information from the supertype available and at hand. It would be extremely helpful if that information was included in the diagnostics so that I don't have to go hunting for it.
- Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
import datetime
class Tzoffset ( datetime.tzinfo ):
_delta = _tzname = None
def __init__ ( self, delta, tzname='' ):
# type: ( datetime.timedelta, str ) -> None
assert isinstance ( delta, datetime.timedelta )
self._delta = delta
self._tzname = tzname
def utcoffset ( self, dt ):
# type: ( datetime.datetime ) -> datetime.timedelta
return self._delta
def dst ( self, dt ):
# type: ( datetime.datetime ) -> datetime.timedelta
return self._delta
def tzname ( self, dt ):
# type: ( datetime.datetime ) -> str
return self._tzname
- What is the actual behavior/output?
error: Argument 1 of "tzname" incompatible with supertype "tzinfo"
- What is the behavior/output you expect?
error: Argument 1 of "tzname" incompatible with supertype "tzinfo"; expected "foo"
- What are the versions of mypy and Python you are using?
Do you see the same issue after installing mypy from Git master?
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
mypy 0.600
dunno how to check git master
- What are the mypy flags you are using? (For example --strict-optional)
mypy --py2 %1 --ignore-missing-imports --disallow-untyped-defs
mypy %1 --ignore-missing-imports --disallow-untyped-defs
- If mypy crashed with a traceback, please paste
the full traceback below.
(n/a)