From e3e3e8ff9b7aba52527c48b1ac18226f6a28c4fd Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Wed, 21 Oct 2020 12:54:08 +0200 Subject: fix(mypy): handle new mypy version --- logilab/common/graph.py | 5 ++++- logilab/common/modutils.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'logilab') diff --git a/logilab/common/graph.py b/logilab/common/graph.py index d460692..8521cc6 100644 --- a/logilab/common/graph.py +++ b/logilab/common/graph.py @@ -300,7 +300,10 @@ def _get_cycles( cycle.insert(0, node) # make a canonical representation - start_from = min(cycle) + # mypy: error: Value of type variable "_LT" of "min" cannot be "V" + # XXX I have no idea what this exactly mean here... we probably need to + # XXX tell that "V" supports "lower than" type of comparison but how? + start_from = min(cycle) # type: ignore index = cycle.index(start_from) cycle = cycle[index:] + cycle[0:index] diff --git a/logilab/common/modutils.py b/logilab/common/modutils.py index 6e65fb9..ca0b35a 100644 --- a/logilab/common/modutils.py +++ b/logilab/common/modutils.py @@ -198,7 +198,10 @@ def load_module_from_modpath( if module is None: mp_file, mp_filename, mp_desc = find_module(part, path) try: - module = load_module(curname, mp_file, mp_filename, mp_desc) + # mypy: Argument 2 to "load_module" has incompatible type "IO[Any]"; + # mypy: expected "Optional[_FileLike]" + # this is handled by the try/finally somehow? + module = load_module(curname, mp_file, mp_filename, mp_desc) # type: ignore finally: if mp_file is not None: mp_file.close() -- cgit v1.2.1