Skip to content

Commit

Permalink
fix mypy errors and work around python/mypy#11852
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Dec 28, 2021
1 parent 860e29e commit e17580a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion git_code_debt/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ def load_data(
itertools.repeat(metric_parsers),
itertools.repeat(exclude),
)
with mapper(jobs) as do_map:
# https://github.com/python/mypy/issues/11852
with mapper(jobs) as do_map: # type: ignore
for commit, metrics in zip(
commits, do_map(_get_metrics_inner, mp_args),
):
Expand Down
3 changes: 1 addition & 2 deletions git_code_debt/util/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class is to be included in the output.
matched_classes = set()

for _, module_name, _ in pkgutil.walk_packages(
# https://github.com/python/mypy/issues/1422
package.__path__, # type: ignore
package.__path__,
prefix=package.__name__ + '.',
):
module = __import__(module_name, fromlist=['__trash'], level=0)
Expand Down
3 changes: 2 additions & 1 deletion tests/generate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def square(x):

@pytest.mark.parametrize('jobs', (1, 4))
def test_mapper(jobs):
with mapper(jobs) as do_map:
# https://github.com/python/mypy/issues/11852
with mapper(jobs) as do_map: # type: ignore
ret = tuple(do_map(square, (3, 5, 9)))
assert ret == (9, 25, 81)

Expand Down

0 comments on commit e17580a

Please sign in to comment.