summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Peuch <cortex@worlddomination.be>2020-10-21 12:54:08 +0200
committerLaurent Peuch <cortex@worlddomination.be>2020-10-21 12:54:08 +0200
commite3e3e8ff9b7aba52527c48b1ac18226f6a28c4fd (patch)
treeb36303a1515a63d0a48fb457f79e8b2a7339f2d2
parentf7a5bd8003e406ce873653955be0aeec92e486f2 (diff)
downloadlogilab-common-e3e3e8ff9b7aba52527c48b1ac18226f6a28c4fd.tar.gz
fix(mypy): handle new mypy version
-rw-r--r--logilab/common/graph.py5
-rw-r--r--logilab/common/modutils.py5
2 files changed, 8 insertions, 2 deletions
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()