Yo Hal! On Thu, 07 Jun 2018 21:33:56 -0700 Hal Murray via devel <devel@ntpsec.org> wrote:
> I really like type checking. I remember the > first time I figured out what was going on when the compiler gave me > an error message for using foo where I wanted foo*. Thank you! You motivated me to install mypy, and run it on two NTPsec Python files. We can charaterize this as a 'target rich environment': ntpsec # mypy ntpclients/ntpviz.py /usr/local/lib64/python2.7/site-packages/ntp/util.py:16: error: Cannot find module named 'ntp.ntpc' /usr/local/lib64/python2.7/site-packages/ntp/util.py:16: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help) /usr/local/lib64/python2.7/site-packages/ntp/util.py:1394: error: Incompatible import of "OrderedDict" (imported name has type "Type[OrderedDict[Any, Any]]", local name has type "Type[OrderedDict]") /usr/local/lib64/python2.7/site-packages/ntp/util.py:1396: error: Name 'OrderedDict' already defined (possibly by an import) /usr/local/lib64/python2.7/site-packages/ntp/statfiles.py:25: error: Need type annotation for 'peermap' ntpclients/ntpviz.py:199: error: Need type annotation for 'percs' ntpclients/ntpviz.py:1276: error: String interpolation mixes specifier with and without mapping keys ntpclients/ntpviz.py:1546: error: No library stub file for module 'psutil' ntpclients/ntpviz.py:1546: note: (Stub files are from https://github.com/python/typeshed) ntpclients/ntpviz.py:1670: error: Incompatible types in assignment (expression has type "str", variable has type "datetime") ntpclients/ntpviz.py:1713: error: Argument 1 to "utcfromtimestamp" of "datetime" has incompatible type "None"; expected "float" ntpclients/ntpviz.py:1715: error: Argument 1 to "utcfromtimestamp" of "datetime" has incompatible type "None"; expected "float" ntpclients/ntpviz.py:1722: error: Argument 1 to "float" has incompatible type "None"; expected "Union[SupportsFloat, str, bytes]" ntpclients/ntpviz.py:1888: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "NTPViz") ntpclients/ntpviz.py:1894: error: "NTPViz" has no attribute "append" ntpclients/ntpviz.py:1916: error: "NTPViz" has no attribute "__iter__" (not iterable) ntpsec # mypy pylib/packet.py /usr/local/lib64/python2.7/site-packages/ntp/util.py:16: error: Cannot find module named 'ntp.ntpc' /usr/local/lib64/python2.7/site-packages/ntp/util.py:1394: error: Incompatible import of "OrderedDict" (imported name has type "Type[OrderedDict[Any, Any]]", local name has type "Type[OrderedDict]") /usr/local/lib64/python2.7/site-packages/ntp/util.py:1396: error: Name 'OrderedDict' already defined (possibly by an import) pylib/packet.py:196: error: Cannot find module named 'ntp.ntpc' pylib/packet.py:196: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help) pylib/packet.py:229: error: Name 'raw_input' is not defined pylib/packet.py:241: error: Incompatible redefinition (redefinition with type "Callable[[Any], Any]", original type "Type[str]") pylib/packet.py:249: error: Incompatible redefinition (redefinition with type "Callable[[Any], Any]", original type "Type[bytes]") pylib/packet.py:264: error: Incompatible redefinition (redefinition with type "Callable[[Any], Any]", original type "Type[str]") pylib/packet.py:1595: error: Assignment to variable 'e' outside except: block Not sure what that all means, much of it is junk, but a couple of eye openers in there. Time to add a waf mypy target. RGDS GARY --------------------------------------------------------------------------- Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703 g...@rellim.com Tel:+1 541 382 8588 Veritas liberabit vos. -- Quid est veritas? "If you can’t measure it, you can’t improve it." - Lord Kelvin
pgp9DWdLFPnqE.pgp
Description: OpenPGP digital signature
_______________________________________________ devel mailing list devel@ntpsec.org http://lists.ntpsec.org/mailman/listinfo/devel