#3399 new enhancement

Evaluate adding mypy checks to code checks

Reported by: jaraco Owned by:
Priority: normal Milestone: Support Python 3
Component: unknown Version: n/a
Keywords: Cc:
Launchpad Bug:

Description

The mypy project (and type checking more generally) promises to improve code quality and catch type errors statically. Recent versions of mypy have fairly robust support for inferring types for many functions. The Python 3 porting team would like to evaluate the viability of employing mypy checks during the code check phase to catch such errors early and perhaps elucidate issues with binary vs. text during the porting effort.

Change History (8)

comment:1 Changed at 2020-09-11T19:37:44Z by jaraco

  • Status changed from new to assigned

comment:2 Changed at 2020-09-11T19:40:54Z by jaraco

I've started work in [this branch](https://github.com/jaraco/tahoe-lafs/tree/3399.mypy). Just adding mypy checks reveals 200+ errors with the bulk in interfaces.py:

typechecks installed: mypy==0.782,mypy-extensions==0.4.3,typed-ast==1.4.1,typing-extensions==3.7.4.3
typechecks run-test-pre: PYTHONHASHSEED='8406647'
typechecks run-test: commands[0] | mypy src
src/allmydata/introducer/interfaces.py:45: error: Method must have at least one argument
src/allmydata/introducer/interfaces.py:106: error: Method must have at least one argument
src/allmydata/interfaces.py:59: error: Method must have at least one argument
src/allmydata/interfaces.py:67: error: Method must have at least one argument
src/allmydata/interfaces.py:110: error: Method must have at least one argument
src/allmydata/interfaces.py:318: error: Method must have at least one argument
src/allmydata/interfaces.py:436: error: Method must have at least one argument
src/allmydata/interfaces.py:457: error: Method must have at least one argument
src/allmydata/interfaces.py:468: error: Method must have at least one argument
src/allmydata/interfaces.py:473: error: Method must have at least one argument
src/allmydata/interfaces.py:484: error: Method must have at least one argument
src/allmydata/interfaces.py:488: error: Method must have at least one argument
src/allmydata/interfaces.py:492: error: Method must have at least one argument
src/allmydata/interfaces.py:502: error: Method must have at least one argument
src/allmydata/interfaces.py:508: error: Method must have at least one argument
src/allmydata/interfaces.py:528: error: Method must have at least one argument
src/allmydata/interfaces.py:545: error: Method must have at least one argument
src/allmydata/interfaces.py:548: error: Method must have at least one argument
src/allmydata/interfaces.py:551: error: Method must have at least one argument
src/allmydata/interfaces.py:560: error: Method must have at least one argument
src/allmydata/interfaces.py:570: error: Method must have at least one argument
src/allmydata/interfaces.py:599: error: Method must have at least one argument
src/allmydata/interfaces.py:627: error: Method must have at least one argument
src/allmydata/interfaces.py:642: error: Method must have at least one argument
src/allmydata/interfaces.py:657: error: Method must have at least one argument
src/allmydata/interfaces.py:661: error: Method must have at least one argument
src/allmydata/interfaces.py:666: error: Method must have at least one argument
src/allmydata/interfaces.py:670: error: Method must have at least one argument
src/allmydata/interfaces.py:678: error: Method must have at least one argument
src/allmydata/interfaces.py:690: error: Method must have at least one argument
src/allmydata/interfaces.py:701: error: Method must have at least one argument
src/allmydata/interfaces.py:772: error: Method must have at least one argument
src/allmydata/interfaces.py:782: error: Method must have at least one argument
src/allmydata/interfaces.py:790: error: Method must have at least one argument
src/allmydata/interfaces.py:793: error: Method must have at least one argument
src/allmydata/interfaces.py:888: error: Method must have at least one argument
src/allmydata/interfaces.py:922: error: Method must have at least one argument
src/allmydata/interfaces.py:925: error: Method must have at least one argument
src/allmydata/interfaces.py:930: error: Method must have at least one argument
src/allmydata/interfaces.py:1001: error: Method must have at least one argument
src/allmydata/interfaces.py:1007: error: Method must have at least one argument
src/allmydata/interfaces.py:1011: error: Method must have at least one argument
src/allmydata/interfaces.py:1019: error: Method must have at least one argument
src/allmydata/interfaces.py:1027: error: Method must have at least one argument
src/allmydata/interfaces.py:1037: error: Method must have at least one argument
src/allmydata/interfaces.py:1042: error: Method must have at least one argument
src/allmydata/interfaces.py:1051: error: Method must have at least one argument
src/allmydata/interfaces.py:1056: error: Method must have at least one argument
src/allmydata/interfaces.py:1062: error: Method must have at least one argument
src/allmydata/interfaces.py:1071: error: Method must have at least one argument
src/allmydata/interfaces.py:1074: error: Method must have at least one argument
src/allmydata/interfaces.py:1080: error: Method must have at least one argument
src/allmydata/interfaces.py:1084: error: Method must have at least one argument
src/allmydata/interfaces.py:1092: error: Method must have at least one argument
src/allmydata/interfaces.py:1101: error: Method must have at least one argument
src/allmydata/interfaces.py:1127: error: Method must have at least one argument
src/allmydata/interfaces.py:1201: error: Method must have at least one argument
src/allmydata/interfaces.py:1294: error: Method must have at least one argument
src/allmydata/interfaces.py:1304: error: Method must have at least one argument
src/allmydata/interfaces.py:1349: error: Method must have at least one argument
src/allmydata/interfaces.py:1358: error: Method must have at least one argument
src/allmydata/interfaces.py:1367: error: Method must have at least one argument
src/allmydata/interfaces.py:1517: error: Method must have at least one argument
src/allmydata/interfaces.py:1542: error: Method must have at least one argument
src/allmydata/interfaces.py:1619: error: Method must have at least one argument
src/allmydata/interfaces.py:1622: error: Method must have at least one argument
src/allmydata/interfaces.py:1630: error: Method must have at least one argument
src/allmydata/interfaces.py:1779: error: Method must have at least one argument
src/allmydata/interfaces.py:1892: error: Method must have at least one argument
src/allmydata/interfaces.py:1930: error: Method must have at least one argument
src/allmydata/interfaces.py:1955: error: Method must have at least one argument
src/allmydata/interfaces.py:1968: error: Method must have at least one argument
src/allmydata/interfaces.py:1992: error: Method must have at least one argument
src/allmydata/interfaces.py:1995: error: Method must have at least one argument
src/allmydata/interfaces.py:2011: error: Method must have at least one argument
src/allmydata/interfaces.py:2022: error: Method must have at least one argument
src/allmydata/interfaces.py:2044: error: Method must have at least one argument
src/allmydata/interfaces.py:2050: error: Method must have at least one argument
src/allmydata/interfaces.py:2074: error: Method must have at least one argument
src/allmydata/interfaces.py:2118: error: Method must have at least one argument
src/allmydata/interfaces.py:2134: error: Method must have at least one argument
src/allmydata/interfaces.py:2147: error: Method must have at least one argument
src/allmydata/interfaces.py:2161: error: Method must have at least one argument
src/allmydata/interfaces.py:2164: error: Method must have at least one argument
src/allmydata/interfaces.py:2167: error: Method must have at least one argument
src/allmydata/interfaces.py:2172: error: Method must have at least one argument
src/allmydata/interfaces.py:2175: error: Method must have at least one argument
src/allmydata/interfaces.py:2178: error: Method must have at least one argument
src/allmydata/interfaces.py:2186: error: Method must have at least one argument
src/allmydata/interfaces.py:2189: error: Method must have at least one argument
src/allmydata/interfaces.py:2205: error: Method must have at least one argument
src/allmydata/interfaces.py:2208: error: Method must have at least one argument
src/allmydata/interfaces.py:2345: error: Method must have at least one argument
src/allmydata/interfaces.py:2348: error: Method must have at least one argument
src/allmydata/interfaces.py:2351: error: Method must have at least one argument
src/allmydata/interfaces.py:2354: error: Method must have at least one argument
src/allmydata/interfaces.py:2359: error: Method must have at least one argument
src/allmydata/interfaces.py:2366: error: Method must have at least one argument
src/allmydata/interfaces.py:2369: error: Method must have at least one argument
src/allmydata/interfaces.py:2372: error: Method must have at least one argument
src/allmydata/interfaces.py:2375: error: Method must have at least one argument
src/allmydata/interfaces.py:2379: error: Method must have at least one argument
src/allmydata/interfaces.py:2390: error: Method must have at least one argument
src/allmydata/interfaces.py:2395: error: Method must have at least one argument
src/allmydata/interfaces.py:2400: error: Method must have at least one argument
src/allmydata/interfaces.py:2408: error: Method must have at least one argument
src/allmydata/interfaces.py:2416: error: Method must have at least one argument
src/allmydata/interfaces.py:2420: error: Method must have at least one argument
src/allmydata/interfaces.py:2424: error: Method must have at least one argument
src/allmydata/interfaces.py:2431: error: Method must have at least one argument
src/allmydata/interfaces.py:2434: error: Method must have at least one argument
src/allmydata/interfaces.py:2445: error: Method must have at least one argument
src/allmydata/interfaces.py:2448: error: Method must have at least one argument
src/allmydata/interfaces.py:2451: error: Method must have at least one argument
src/allmydata/interfaces.py:2457: error: Method must have at least one argument
src/allmydata/interfaces.py:2462: error: Method must have at least one argument
src/allmydata/interfaces.py:2466: error: Method must have at least one argument
src/allmydata/interfaces.py:2478: error: Method must have at least one argument
src/allmydata/interfaces.py:2482: error: Method must have at least one argument
src/allmydata/interfaces.py:2495: error: Method must have at least one argument
src/allmydata/interfaces.py:2499: error: Method must have at least one argument
src/allmydata/interfaces.py:2509: error: Method must have at least one argument
src/allmydata/interfaces.py:2520: error: Method must have at least one argument
src/allmydata/interfaces.py:2524: error: Method must have at least one argument
src/allmydata/interfaces.py:2560: error: Method must have at least one argument
src/allmydata/interfaces.py:2564: error: Method must have at least one argument
src/allmydata/interfaces.py:2569: error: Method must have at least one argument
src/allmydata/interfaces.py:2575: error: Method must have at least one argument
src/allmydata/interfaces.py:2610: error: Method must have at least one argument
src/allmydata/interfaces.py:2706: error: Method must have at least one argument
src/allmydata/interfaces.py:2711: error: Method must have at least one argument
src/allmydata/interfaces.py:2714: error: Method must have at least one argument
src/allmydata/interfaces.py:2718: error: Method must have at least one argument
src/allmydata/interfaces.py:2723: error: Method must have at least one argument
src/allmydata/interfaces.py:2726: error: Method must have at least one argument
src/allmydata/interfaces.py:2732: error: Method must have at least one argument
src/allmydata/interfaces.py:2736: error: Method must have at least one argument
src/allmydata/interfaces.py:2741: error: Method must have at least one argument
src/allmydata/interfaces.py:2745: error: Method must have at least one argument
src/allmydata/interfaces.py:2748: error: Method must have at least one argument
src/allmydata/interfaces.py:2752: error: Method must have at least one argument
src/allmydata/interfaces.py:2764: error: Method must have at least one argument
src/allmydata/interfaces.py:2767: error: Method must have at least one argument
src/allmydata/interfaces.py:2772: error: Method must have at least one argument
src/allmydata/interfaces.py:2779: error: Method must have at least one argument
src/allmydata/interfaces.py:2783: error: Method must have at least one argument
src/allmydata/interfaces.py:2788: error: Method must have at least one argument
src/allmydata/interfaces.py:2793: error: Method must have at least one argument
src/allmydata/interfaces.py:2796: error: Method must have at least one argument
src/allmydata/interfaces.py:2800: error: Method must have at least one argument
src/allmydata/interfaces.py:2805: error: Method must have at least one argument
src/allmydata/interfaces.py:2808: error: Method must have at least one argument
src/allmydata/interfaces.py:2845: error: Method must have at least one argument
src/allmydata/interfaces.py:2863: error: Method must have at least one argument
src/allmydata/interfaces.py:2880: error: Method must have at least one argument
src/allmydata/interfaces.py:2883: error: Method must have at least one argument
src/allmydata/interfaces.py:2889: error: Method must have at least one argument
src/allmydata/interfaces.py:2896: error: Method must have at least one argument
src/allmydata/interfaces.py:2909: error: Method must have at least one argument
src/allmydata/interfaces.py:2939: error: Method must have at least one argument
src/allmydata/interfaces.py:2966: error: Method must have at least one argument
src/allmydata/interfaces.py:2977: error: Method must have at least one argument
src/allmydata/util/pollmixin.py:26: error: Need type annotation for '_poll_should_ignore_these_errors' (hint: "_poll_should_ignore_these_errors: List[<type>] = ...")
src/allmydata/test/test_python3.py:50: error: "Callable[[Python3PortingEffortTests], Any]" has no attribute "todo"
src/allmydata/test/check_load.py:47: error: Need type annotation for 'last_stats' (hint: "last_stats: Dict[<type>, <type>] = ...")
src/allmydata/test/check_load.py:53: error: Incompatible types in assignment (expression has type "int", variable has type "str")
src/allmydata/test/check_load.py:56: error: Incompatible types in assignment (expression has type "float", target has type "int")
src/allmydata/monitor.py:44: error: Method must have at least one argument
src/allmydata/monitor.py:49: error: Method must have at least one argument
src/allmydata/monitor.py:60: error: Method must have at least one argument
src/allmydata/monitor.py:77: error: Method must have at least one argument
src/allmydata/monitor.py:81: error: Method must have at least one argument
src/allmydata/monitor.py:86: error: Method must have at least one argument
src/allmydata/util/fileutil.py:312: error: Name '_getfullpathname' already defined on line 310
src/allmydata/storage/crawler.py:22: error: Name 'pickle' already defined (possibly by an import)
src/allmydata/node.py:712: error: Need type annotation for 'GENERATED_FILES' (hint: "GENERATED_FILES: List[<type>] = ...")
src/allmydata/windows/fixups.py:220: error: Name 'unichr' is not defined
src/allmydata/test/test_iputil.py:136: error: "Callable[[ListAddresses], Any]" has no attribute "timeout"
src/allmydata/web/status.py:1327: error: Name 'cmp' is not defined
src/allmydata/web/status.py:1335: error: Name 'cmp' is not defined
src/allmydata/test/test_stats.py:9: error: Incompatible types in assignment (expression has type "float", base class "CPUUsageMonitor" defined the type as "int")
src/allmydata/uri.py:726: error: Incompatible types in assignment (expression has type "Type[CHKFileVerifierURI]", base class "DirectoryURIVerifier" defined the type as "Type[SSKVerifierURI]")
src/allmydata/scripts/run_common.py:70: error: List item 0 has incompatible type "Tuple[str, str, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/debug.py:21: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/debug.py:419: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/debug.py:613: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/debug.py:661: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/debug.py:875: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/create_node.py:147: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/create_node.py:154: error: List item 0 has incompatible type "Tuple[str, str, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:155: error: List item 1 has incompatible type "Tuple[str, str, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:156: error: List item 2 has incompatible type "Tuple[str, str, str, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:158: error: List item 3 has incompatible type "Tuple[str, str, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:160: error: List item 4 has incompatible type "Tuple[str, None, int, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:161: error: List item 5 has incompatible type "Tuple[str, None, int, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:162: error: List item 6 has incompatible type "Tuple[str, None, int, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:163: error: List item 7 has incompatible type "Tuple[str, None, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:199: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/tahoe_start.py:20: error: List item 0 has incompatible type "Tuple[str, str, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/stats_gatherer.py:15: error: List item 0 has incompatible type "Tuple[str, None, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/stats_gatherer.py:16: error: List item 1 has incompatible type "Tuple[str, None, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/stats_gatherer.py:17: error: List item 2 has incompatible type "Tuple[str, None, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/stats_gatherer.py:27: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/frontends/ftpd.py:2: error: Module 'types' has no attribute 'NoneType'
src/allmydata/web/directory.py:1217: error: Incompatible types in assignment (expression has type "str", base class "MultiFormatResource" defined the type as "None")
src/allmydata/web/directory.py:1274: error: Incompatible types in assignment (expression has type "str", base class "MultiFormatResource" defined the type as "None")
src/allmydata/scripts/cli.py:54: error: List item 0 has incompatible type "Tuple[str, None, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/cli.py:65: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:75: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:84: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:88: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:107: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:150: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:155: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:168: error: List item 0 has incompatible type "Tuple[str, None, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/cli.py:186: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:198: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:226: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:261: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:270: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:289: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:375: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:392: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:408: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:420: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:435: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:452: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/frontends/sftpd.py:3: error: Module 'types' has no attribute 'NoneType'
src/allmydata/scripts/runner.py:65: error: Unsupported operand types for + ("List[List[Union[Type[BaseOptions], str, None]]]" and "List[Tuple[str, None, Type[InviteOptions], str]]")
src/allmydata/scripts/runner.py:110: error: Module has no attribute "dispatch"
src/allmydata/test/storage_plugin.py:41: error: Method must have at least one argument
src/allmydata/test/test_storage_client.py:508: error: On Python 3 '{}'.format(b'abc') produces "b'abc'"; use !r if this is a desired behavior
src/allmydata/test/test_helper.py:88: error: Need type annotation for 'introducer_clients' (hint: "introducer_clients: List[<type>] = ...")
src/allmydata/test/check_memory.py:495: error: Module has no attribute "maxint"
src/allmydata/test/check_memory.py:497: error: Module has no attribute "maxint"
src/allmydata/test/check_memory.py:501: error: Module has no attribute "maxint"
src/allmydata/test/test_sftp.py:17: error: Name 'conch_interfaces' already defined on line 12
src/allmydata/test/test_sftp.py:18: error: Name 'sftp' already defined on line 13
src/allmydata/test/test_sftp.py:19: error: Incompatible import of "sftpd" (imported name has type Module, local name has type "object")
src/allmydata/test/test_sftp.py:23: error: Incompatible types in assignment (expression has type "None", variable has type "ImportError")
src/allmydata/test/test_encode.py:176: error: Incompatible types in assignment (expression has type "float", variable has type "int")
src/allmydata/test/test_deepcheck.py:919: error: Name 'unicode' is not defined
Found 242 errors in 31 files (checked 291 source files)
ERROR: InvocationError for command /Users/jaraco/code/public/tahoe-lafs/.tox/typechecks/bin/mypy src (exited with code 1)
___________________________________ summary ____________________________________
ERROR:   typechecks: commands failed

comment:3 Changed at 2020-09-11T20:00:03Z by jaraco

Taking a look at the interfaces, I see that they're using foolscap.api.RemoteInterface, which explicitly states that the conventional "self" arguments are disallowed.

So it seems at first blush that mypy and foolscap are mutually incompatible.

comment:4 Changed at 2020-09-11T20:04:58Z by jaraco

I imagine there are a few options forward:

  1. Amend mypy to support the foolscap interface(s).
  2. Update foolscap to be compatible with mypy conventions.
  3. Disable mypy checks for code that touches foolscap interfaces.

Options (1) and (2) are likely to be expensive and possibly intractable efforts. It's uncertain what the scope of (3) would be or what effect that would have on the checks.

I was unable to find any references in foolscap referencing mypy, so I suspect this issue has not been approached previously.

comment:5 Changed at 2020-09-11T20:05:44Z by jaraco

  • Owner jaraco deleted
  • Status changed from assigned to new

comment:6 Changed at 2020-09-11T21:18:24Z by wearpants

I'll need to look into this when I have a bit more brain, but as a quick check, does zope.interface have the same behavior? If so, maybe we can piggyback off what the mypy zope plugin is already doing to support that.

Otherwise, I agree that option 3 is the best choice, probably by explicitly disabling specific checks on a line-by-line basis. My only hesitancy about doing that would be if it impedes the effectiveness of mypy elsewhere in the code.

comment:7 Changed at 2020-09-18T19:52:38Z by jaraco

Fantastic suggestion. Digging deeper into the interfaces implementations, I noticed that many of them are in fact zope interfaces. In 471c88c70, I've simply added that plugin and enabled it and the errors dropped from 242 to 142 (exactly 100? that's suspicious o_O).

typechecks installed: mypy==0.782,mypy-extensions==0.4.3,mypy-zope==0.2.7,typed-ast==1.4.1,typing-extensions==3.7.4.3,zope.event==4.5.0,zope.interface==5.1.0,zope.schema==6.0.0
typechecks run-test-pre: PYTHONHASHSEED='2059477720'
typechecks run-test: commands[0] | mypy src
src/allmydata/util/pollmixin.py:26: error: Need type annotation for '_poll_should_ignore_these_errors' (hint: "_poll_should_ignore_these_errors: List[<type>] = ...")
src/allmydata/test/test_python3.py:50: error: "Callable[[Python3PortingEffortTests], Any]" has no attribute "todo"
src/allmydata/test/check_load.py:47: error: Need type annotation for 'last_stats' (hint: "last_stats: Dict[<type>, <type>] = ...")
src/allmydata/test/check_load.py:56: error: Incompatible types in assignment (expression has type "float", target has type "int")
src/allmydata/interfaces.py:59: error: Method must have at least one argument
src/allmydata/interfaces.py:67: error: Method must have at least one argument
src/allmydata/interfaces.py:110: error: Method must have at least one argument
src/allmydata/interfaces.py:683: error: Cannot determine consistent method resolution order (MRO) for "IVerifierURI"
src/allmydata/interfaces.py:750: error: Interface methods should not have 'self' argument
src/allmydata/interfaces.py:758: error: Interface methods should not have 'self' argument
src/allmydata/interfaces.py:2845: error: Method must have at least one argument
src/allmydata/interfaces.py:2863: error: Method must have at least one argument
src/allmydata/interfaces.py:2880: error: Method must have at least one argument
src/allmydata/interfaces.py:2883: error: Method must have at least one argument
src/allmydata/interfaces.py:2889: error: Method must have at least one argument
src/allmydata/interfaces.py:2896: error: Method must have at least one argument
src/allmydata/interfaces.py:2909: error: Method must have at least one argument
src/allmydata/interfaces.py:2939: error: Method must have at least one argument
src/allmydata/web/private.py:64: error: zope.interface.implementer accepts interface, not allmydata.web.private.IToken.
src/allmydata/web/private.py:64: error: Make sure you have stubs for all packages that provide interfaces for allmydata.web.private.IToken class hierarchy.
src/allmydata/introducer/interfaces.py:45: error: Method must have at least one argument
src/allmydata/codec.py:23: error: 'CRSEncoder' is missing following 'ICodecEncoder' interface members: encode_proposal.
src/allmydata/util/fileutil.py:312: error: Name '_getfullpathname' already defined on line 310
src/allmydata/storage/immutable.py:193: error: zope.interface.implementer accepts interface, not allmydata.interfaces.RIBucketWriter.
src/allmydata/storage/immutable.py:193: error: Make sure you have stubs for all packages that provide interfaces for allmydata.interfaces.RIBucketWriter class hierarchy.
src/allmydata/storage/immutable.py:292: error: zope.interface.implementer accepts interface, not allmydata.interfaces.RIBucketReader.
src/allmydata/storage/immutable.py:292: error: Make sure you have stubs for all packages that provide interfaces for allmydata.interfaces.RIBucketReader class hierarchy.
src/allmydata/storage/crawler.py:22: error: Name 'pickle' already defined (possibly by an import)
src/allmydata/introducer/client.py:20: error: zope.interface.implementer accepts interface, not allmydata.introducer.interfaces.RIIntroducerSubscriberClient_v2.
src/allmydata/introducer/client.py:20: error: Make sure you have stubs for all packages that provide interfaces for allmydata.introducer.interfaces.RIIntroducerSubscriberClient_v2 class hierarchy.
src/allmydata/introducer/client.py:159: error: Signature of "IntroducerClient" incompatible with "subscribe_to" of supertype "IIntroducerClient"
src/allmydata/introducer/client.py:200: error: Signature of "IntroducerClient" incompatible with "publish" of supertype "IIntroducerClient"
src/allmydata/stats.py:126: error: zope.interface.implementer accepts interface, not allmydata.interfaces.RIStatsProvider.
src/allmydata/stats.py:126: error: Make sure you have stubs for all packages that provide interfaces for allmydata.interfaces.RIStatsProvider class hierarchy.
src/allmydata/stats.py:179: error: zope.interface.implementer accepts interface, not allmydata.interfaces.RIStatsGatherer.
src/allmydata/stats.py:179: error: Make sure you have stubs for all packages that provide interfaces for allmydata.interfaces.RIStatsGatherer class hierarchy.
src/allmydata/node.py:712: error: Need type annotation for 'GENERATED_FILES' (hint: "GENERATED_FILES: List[<type>] = ...")
src/allmydata/windows/fixups.py:220: error: Name 'unichr' is not defined
src/allmydata/test/test_iputil.py:136: error: "Callable[[ListAddresses], Any]" has no attribute "timeout"
src/allmydata/web/status.py:1327: error: Name 'cmp' is not defined
src/allmydata/web/status.py:1335: error: Name 'cmp' is not defined
src/allmydata/test/test_stats.py:9: error: Incompatible types in assignment (expression has type "float", base class "CPUUsageMonitor" defined the type as "int")
src/allmydata/storage/server.py:39: error: zope.interface.implementer accepts interface, not allmydata.interfaces.RIStorageServer.
src/allmydata/storage/server.py:39: error: Make sure you have stubs for all packages that provide interfaces for allmydata.interfaces.RIStorageServer class hierarchy.
src/allmydata/uri.py:491: error: '_DirectoryBaseURI' is missing following 'IURI' interface members: is_readonly, get_readonly.
src/allmydata/uri.py:726: error: Incompatible types in assignment (expression has type "Type[CHKFileVerifierURI]", base class "DirectoryURIVerifier" defined the type as "Type[SSKVerifierURI]")
src/allmydata/immutable/literal.py:10: error: '_ImmutableFileNodeBase' is missing following 'allmydata.interfaces.IFilesystemNode' interface members: get_storage_index, get_size, get_cap, get_readcap, get_repair_cap, get_verify_cap, get_uri, get_current_size.
src/allmydata/immutable/literal.py:10: error: '_ImmutableFileNodeBase' is missing following 'allmydata.interfaces.IReadable' interface members: download_to_data, read.
src/allmydata/immutable/literal.py:10: error: '_ImmutableFileNodeBase' is missing following 'allmydata.interfaces.IFileNode' interface members: get_best_readable_version, download_best_version, get_size_of_best_version.
src/allmydata/immutable/literal.py:10: error: '_ImmutableFileNodeBase' is missing following 'ICheckable' interface members: check, check_and_repair.
src/allmydata/immutable/encode.py:78: error: 'Encoder' is missing following 'IEncoder' interface members: set_size.
src/allmydata/scripts/run_common.py:70: error: List item 0 has incompatible type "Tuple[str, str, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/debug.py:21: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/debug.py:419: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/debug.py:613: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/debug.py:661: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/debug.py:875: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/create_node.py:147: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/create_node.py:154: error: List item 0 has incompatible type "Tuple[str, str, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:155: error: List item 1 has incompatible type "Tuple[str, str, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:156: error: List item 2 has incompatible type "Tuple[str, str, str, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:158: error: List item 3 has incompatible type "Tuple[str, str, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:160: error: List item 4 has incompatible type "Tuple[str, None, int, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:161: error: List item 5 has incompatible type "Tuple[str, None, int, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:162: error: List item 6 has incompatible type "Tuple[str, None, int, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:163: error: List item 7 has incompatible type "Tuple[str, None, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/create_node.py:199: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/immutable/upload.py:319: error: 'PeerSelector' is missing following 'IPeerSelector' interface members: confirm_share_allocation, add_peers.
src/allmydata/immutable/upload.py:1411: error: zope.interface.implementer accepts interface, not allmydata.interfaces.RIEncryptedUploadable.
src/allmydata/immutable/upload.py:1411: error: Make sure you have stubs for all packages that provide interfaces for allmydata.interfaces.RIEncryptedUploadable class hierarchy.
src/allmydata/control.py:58: error: zope.interface.implementer accepts interface, not allmydata.interfaces.RIControlClient.
src/allmydata/control.py:58: error: Make sure you have stubs for all packages that provide interfaces for allmydata.interfaces.RIControlClient class hierarchy.
src/allmydata/scripts/tahoe_start.py:20: error: List item 0 has incompatible type "Tuple[str, str, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/stats_gatherer.py:15: error: List item 0 has incompatible type "Tuple[str, None, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/stats_gatherer.py:16: error: List item 1 has incompatible type "Tuple[str, None, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/stats_gatherer.py:17: error: List item 2 has incompatible type "Tuple[str, None, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/stats_gatherer.py:27: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/mutable/filenode.py:554: error: Signature of "MutableFileNode" incompatible with "upload" of supertype "IMutableFileNode"
src/allmydata/mutable/filenode.py:702: error: 'MutableFileVersion' is missing following 'IMutableFileVersion' interface members: get_servermap.
src/allmydata/mutable/filenode.py:941: error: Signature of "MutableFileVersion" incompatible with "download_to_data" of supertype "allmydata.interfaces.IReadable"
src/allmydata/immutable/offloaded.py:125: error: zope.interface.implementer accepts interface, not allmydata.interfaces.RICHKUploadHelper.
src/allmydata/immutable/offloaded.py:125: error: Make sure you have stubs for all packages that provide interfaces for allmydata.interfaces.RICHKUploadHelper class hierarchy.
src/allmydata/immutable/offloaded.py:450: error: 'LocalCiphertextReader' is missing following 'IEncryptedUploadable' interface members: set_upload_status.
src/allmydata/immutable/offloaded.py:486: error: zope.interface.implementer accepts interface, not allmydata.interfaces.RIHelper.
src/allmydata/immutable/offloaded.py:486: error: Make sure you have stubs for all packages that provide interfaces for allmydata.interfaces.RIHelper class hierarchy.
src/allmydata/frontends/ftpd.py:2: error: Module 'types' has no attribute 'NoneType'
src/allmydata/dirnode.py:557: error: Signature of "DirectoryNode" incompatible with "set_uri" of supertype "IDirectoryNode"
src/allmydata/web/directory.py:1217: error: Incompatible types in assignment (expression has type "str", base class "MultiFormatResource" defined the type as "None")
src/allmydata/web/directory.py:1274: error: Incompatible types in assignment (expression has type "str", base class "MultiFormatResource" defined the type as "None")
src/allmydata/scripts/cli.py:54: error: List item 0 has incompatible type "Tuple[str, None, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/cli.py:65: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:75: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:84: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:88: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:107: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:150: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:155: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:168: error: List item 0 has incompatible type "Tuple[str, None, None, str]"; expected "List[Optional[str]]"
src/allmydata/scripts/cli.py:186: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:198: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:226: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:261: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:270: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:289: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:375: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:392: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:408: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:420: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:435: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/scripts/cli.py:452: error: Incompatible types in assignment (expression has type "str", base class "BaseOptions" defined the type as "None")
src/allmydata/frontends/sftpd.py:3: error: Module 'types' has no attribute 'NoneType'
src/allmydata/scripts/runner.py:65: error: Unsupported operand types for + ("List[List[Union[Type[BaseOptions], str, None]]]" and "List[Tuple[str, None, Type[InviteOptions], str]]")
src/allmydata/scripts/runner.py:110: error: Module has no attribute "dispatch"
src/allmydata/introducer/server.py:130: error: zope.interface.implementer accepts interface, not allmydata.introducer.interfaces.RIIntroducerPublisherAndSubscriberService_v2.
src/allmydata/introducer/server.py:130: error: Make sure you have stubs for all packages that provide interfaces for allmydata.introducer.interfaces.RIIntroducerPublisherAndSubscriberService_v2 class hierarchy.
src/allmydata/test/storage_plugin.py:41: error: Method must have at least one argument
src/allmydata/test/storage_plugin.py:49: error: zope.interface.implementer accepts interface, not allmydata.interfaces.IFoolscapStoragePlugin.
src/allmydata/test/storage_plugin.py:49: error: Make sure you have stubs for all packages that provide interfaces for allmydata.interfaces.IFoolscapStoragePlugin class hierarchy.
src/allmydata/test/storage_plugin.py:106: error: zope.interface.implementer accepts interface, not allmydata.test.storage_plugin.RIDummy.
src/allmydata/test/storage_plugin.py:106: error: Make sure you have stubs for all packages that provide interfaces for allmydata.test.storage_plugin.RIDummy class hierarchy.
src/allmydata/test/storage_plugin.py:117: error: 'DummyStorageClient' is missing following 'IStorageServer' interface members: get_version, allocate_buckets, add_lease, renew_lease, get_buckets, slot_readv, slot_testv_and_readv_and_writev, advise_corrupt_share.
src/allmydata/test/common.py:395: error: 'FakeCHKFileNode' is missing following 'allmydata.interfaces.IFilesystemNode' interface members: get_readcap.
src/allmydata/test/common.py:533: error: 'FakeMutableFileNode' is missing following 'IMutableFileNode' interface members: download_version, upload.
src/allmydata/test/test_storage_client.py:508: error: On Python 3 '{}'.format(b'abc') produces "b'abc'"; use !r if this is a desired behavior
src/allmydata/test/test_helper.py:88: error: Need type annotation for 'introducer_clients' (hint: "introducer_clients: List[<type>] = ...")
src/allmydata/test/no_network.py:142: error: 'NoNetworkServer' is missing following 'IServer' interface members: start_connecting.
src/allmydata/test/no_network.py:180: error: 'NoNetworkStorageBroker' is missing following 'IStorageBroker' interface members: get_all_connections, get_all_connectors, get_all_peerids, get_all_connections_for, get_permuted_peers.
src/allmydata/test/check_memory.py:495: error: Module has no attribute "maxint"
src/allmydata/test/check_memory.py:497: error: Module has no attribute "maxint"
src/allmydata/test/check_memory.py:501: error: Module has no attribute "maxint"
src/allmydata/test/test_sftp.py:17: error: Name 'conch_interfaces' already defined on line 12
src/allmydata/test/test_sftp.py:18: error: Name 'sftp' already defined on line 13
src/allmydata/test/test_sftp.py:19: error: Incompatible import of "sftpd" (imported name has type Module, local name has type "object")
src/allmydata/test/test_sftp.py:23: error: Incompatible types in assignment (expression has type "None", variable has type "ImportError")
src/allmydata/test/test_encode.py:176: error: Incompatible types in assignment (expression has type "float", variable has type "int")
src/allmydata/test/test_dirnode.py:1529: error: 'FakeMutableFile' is missing following 'allmydata.interfaces.IFilesystemNode' interface members: get_readcap, get_repair_cap, get_verify_cap, get_readonly_uri, get_storage_index, get_size, get_current_size.
src/allmydata/test/test_dirnode.py:1529: error: 'FakeMutableFile' is missing following 'allmydata.interfaces.IFileNode' interface members: get_best_readable_version, get_size_of_best_version.
src/allmydata/test/test_dirnode.py:1529: error: 'FakeMutableFile' is missing following 'IMutableFileNode' interface members: get_best_mutable_version, overwrite, get_servermap, download_version, upload, get_version.
src/allmydata/test/test_deepcheck.py:919: error: Name 'unicode' is not defined
src/allmydata/test/test_checker.py:65: error: 'FakeServer' is missing following 'IServer' interface members: start_connecting, get_rref, get_storage_server.
src/allmydata/test/test_checker.py:78: error: 'FakeCheckResults' is missing following 'ICheckResults' interface members: get_uri, get_happiness, get_encoding_needed, get_encoding_expected, get_share_counter_good, get_share_counter_wrong, get_incompatible_shares, get_servers_responding, get_host_counter_good_shares, get_version_counter_recoverable, get_version_counter_unrecoverable, get_sharemap, get_report.
src/allmydata/test/test_checker.py:109: error: 'FakeCheckAndRepairResults' is missing following 'ICheckAndRepairResults' interface members: get_storage_index_string.
Found 142 errors in 48 files (checked 291 source files)
ERROR: InvocationError for command /Users/jaraco/code/public/tahoe-lafs/.tox/typechecks/bin/mypy src (exited with code 1)
___________________________________ summary ____________________________________
ERROR:   typechecks: commands failed

Still some errors remain about "Method must have at least one argument.", suggesting that the interface detection is being missed on some interfaces, but now at a more manageable level.

comment:8 Changed at 2020-09-18T20:41:08Z by jaraco

I've filed Shoobx/mypy-zope to seek some help with addressing the remaining issues with "Method must have at least one argument".

Note: See TracTickets for help on using tickets.