diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 13e2c37..295df0a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ repos: - repo: https://github.com/python/black - rev: 22.1.0 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/fsfe/reuse-tool @@ -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 diff --git a/jepler_udecimal/__init__.py b/jepler_udecimal/__init__.py index 4ed7c23..56598ab 100644 --- a/jepler_udecimal/__init__.py +++ b/jepler_udecimal/__init__.py @@ -141,7 +141,7 @@ 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 @@ def _regard_flags(self, *flags): 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 @@ def _convert_for_comparison(self, other, equality_op=False): 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