Skip to content

Commit 0e1f74a

Browse files
committed
Run mypy during pre-commit
1 parent 7f0d437 commit 0e1f74a

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,17 @@ repos:
3030
name: lint (code)
3131
types: [python]
3232
exclude: "^(docs/|examples/|setup.py$)"
33+
- repo: local
34+
hooks:
35+
- id: mypy
36+
name: mypy
37+
entry: "mypy --no-warn-unused-ignores jepler_udecimal"
38+
language: python
39+
additional_dependencies: ["mypy==0.910"]
40+
types: [python]
41+
# use require_serial so that script
42+
# is only called once per commit
43+
require_serial: true
44+
# Print the number of files as a sanity-check
45+
verbose: true
46+
pass_filenames: false

jepler_udecimal/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141

142142
DecimalTuple = _namedtuple("DecimalTuple", "sign digits exponent")
143143
except ImportError:
144-
DecimalTuple = lambda *args: args
144+
DecimalTuple = lambda *args: args # type: ignore
145145

146146
# Rounding
147147
ROUND_DOWN = "ROUND_DOWN"
@@ -3574,7 +3574,7 @@ def _regard_flags(self, *flags):
35743574
self._ignored_flags.remove(flag)
35753575

35763576
# We inherit object.__hash__, so we must deny this explicitly
3577-
__hash__ = None
3577+
__hash__ = None # type: ignore
35783578

35793579
def Etiny(self):
35803580
"""Returns Etiny (= Emin - prec + 1)"""
@@ -5372,7 +5372,7 @@ def _convert_for_comparison(self, other, equality_op=False):
53725372
try:
53735373
import re
53745374
except:
5375-
import ure as re
5375+
import ure as re # type: ignore
53765376

53775377
_parser = re.compile( # A numeric string consists of:
53785378
r"([-+])?" # an optional sign, followed by either... # 1

0 commit comments

Comments
 (0)