-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Argument X of "Y" incompatible with supertype "Z" - needs more detail #5025
Comments
Note there is a proposal to add more info for errors like this behind a flag #4835 |
This is what I ended up doing to shut up mypy, but it's not correct:
def tzname ( self, dt ):
# type: ( Any ) -> Optional[str] # TODO FIXME: figure out the correct type
for the 1st argument
return self._tzname.encode ( 'ascii' )
Royce Mitchell, IT Consultant
ITAS Solutions
royce3@itas-solutions.com
…On Mon, May 21, 2018 at 9:19 AM, vovanz ***@***.***> wrote:
@remdragon <https://github.com/remdragon> did you figured out what type
does mypy expects as the first argument to tzname method? I've
encountered this problem as well.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5025 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADka13OWJb4b6w11v4vxRYSkVqlLLFEDks5t0szWgaJpZM4T8pxH>
.
|
Taking a look at this |
ilevkivskyi
pushed a commit
that referenced
this issue
May 8, 2019
Closes #5025 Updated the error message that is displayed when the argument types of a method in a subclass are incompatible with the arguments of the same method in the superclass. ```python # sample.py class A: def kek(self, lol: int = 0) -> None: print("Kek in A") class B(A): def kek(self, haha: str = "") -> None: super().kek(1) print("Kek in B") ``` Output before: ```sh mypy sample.py sample.py:11: error: Argument 1 of "kek" incompatible with supertype "A" ``` Output now: ``` mypy sample.py sample.py:11: error: Argument 1 of "kek" is incompatible with supertype "A"; supertype defines the argument type as "int" ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
error: Argument 1 of "tzname" incompatible with supertype "tzinfo"
error: Argument 1 of "tzname" incompatible with supertype "tzinfo"; expected "foo"
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
mypy --py2 %1 --ignore-missing-imports --disallow-untyped-defs
mypy %1 --ignore-missing-imports --disallow-untyped-defs
the full traceback below.
(n/a)
The text was updated successfully, but these errors were encountered: