https://pantsbuild.org/ logo
r

red-balloon-89377

04/01/2020, 4:27 PM
Mypy question: I have the following code:
Copy code
if isinstance(current_target, JvmTarget):
            # Some code...
            if isinstance(current_target, RuntimePlatformMixin):
                info["runtime_platform"] = current_target.runtime_platform.name
In CI, mypy complains that:
Copy code
src/python/pants/backend/project_info/tasks/export_dep_as_jar.py: note: In member "_process_target" of class "ExportDepAsJar":
src/python/pants/backend/project_info/tasks/export_dep_as_jar.py:319:17: error:
Statement is unreachable  [misc]
                    info["runtime_platform"] = current_target.runtime_plat...
                    ^
Which is apparently a thing in the presence of multiple inheritance https://github.com/python/mypy/issues/3603 Is it okay to skip typechecking in this line, with a reference to the issue (or one of the follow ups, since that one is closed)? cc\ @hundreds-father-404
h

hundreds-father-404

04/01/2020, 5:09 PM
yes, that is okay to skip :)
please do link to the issue + use the error code in your skip, e.g.
# type: ignore[call-args]
r

red-balloon-89377

04/01/2020, 5:14 PM
Thanks!
In the error above, the code is
[misc]
, right?
h

hundreds-father-404

04/01/2020, 5:16 PM
correct
r

red-balloon-89377

04/01/2020, 5:22 PM
Done, thanks a lot!
❤️ 1