Run mypy during pre-commit

This commit is contained in:
Jeff Epler 2022-05-13 09:23:45 -05:00
parent 7f0d4370b5
commit 0e1f74a755
No known key found for this signature in database
GPG key ID: D5BF15AB975AB4DE
2 changed files with 17 additions and 3 deletions

View file

@ -30,3 +30,17 @@ repos:
name: lint (code)
types: [python]
exclude: "^(docs/|examples/|setup.py$)"
- repo: local
hooks:
- id: mypy
name: mypy
entry: "mypy --no-warn-unused-ignores jepler_udecimal"
language: python
additional_dependencies: ["mypy==0.910"]
types: [python]
# use require_serial so that script
# is only called once per commit
require_serial: true
# Print the number of files as a sanity-check
verbose: true
pass_filenames: false

View file

@ -141,7 +141,7 @@ try:
DecimalTuple = _namedtuple("DecimalTuple", "sign digits exponent")
except ImportError:
DecimalTuple = lambda *args: args
DecimalTuple = lambda *args: args # type: ignore
# Rounding
ROUND_DOWN = "ROUND_DOWN"
@ -3574,7 +3574,7 @@ class Context(object):
self._ignored_flags.remove(flag)
# We inherit object.__hash__, so we must deny this explicitly
__hash__ = None
__hash__ = None # type: ignore
def Etiny(self):
"""Returns Etiny (= Emin - prec + 1)"""
@ -5372,7 +5372,7 @@ ExtendedContext = Context(
try:
import re
except:
import ure as re
import ure as re # type: ignore
_parser = re.compile( # A numeric string consists of:
r"([-+])?" # an optional sign, followed by either... # 1