From aecd90a1b9b4b7332d8c1974b0e45a72404377c7 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Mon, 8 May 2017 12:54:09 -0700 Subject: [PATCH] Run mypy in python 3 mode. This still picks up the 2.7 type annotations in comments. Fix the compute_quadratic signature to allow for the ValuewView of an OrderedDict in python 3. --- lib/cretonne/meta/constant_hash.py | 4 ++-- lib/cretonne/meta/mypy.ini | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/cretonne/meta/constant_hash.py b/lib/cretonne/meta/constant_hash.py index 96560ffc87..47f5eebe33 100644 --- a/lib/cretonne/meta/constant_hash.py +++ b/lib/cretonne/meta/constant_hash.py @@ -9,7 +9,7 @@ from __future__ import absolute_import from cdsl import next_power_of_two try: - from typing import Any, List, Sequence, Callable # noqa + from typing import Any, List, Iterable, Callable # noqa except ImportError: pass @@ -32,7 +32,7 @@ def simple_hash(s): def compute_quadratic(items, hash_function): - # type: (Sequence[Any], Callable[[Any], int]) -> List[Any] + # type: (Iterable[Any], Callable[[Any], int]) -> List[Any] """ Compute an open addressed, quadratically probed hash table containing `items`. The returned table is a list containing the elements of the diff --git a/lib/cretonne/meta/mypy.ini b/lib/cretonne/meta/mypy.ini index ca7f5e4c00..7046100b4c 100644 --- a/lib/cretonne/meta/mypy.ini +++ b/lib/cretonne/meta/mypy.ini @@ -1,5 +1,4 @@ [mypy] -python_version = 2.7 disallow_untyped_defs = True warn_unused_ignores = True warn_return_any = True