From 1c20eb27aaf1c557c83c8582f13f905bf990b5a5 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Wed, 30 Sep 2020 22:24:44 +0100 Subject: [PATCH] CI: add mypy checks for my.reddit, my.pocket and my.github.ghexport --- doc/example_config/my/config/__init__.py | 9 +++++++++ my/reddit.py | 5 +++-- tox.ini | 10 ++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/doc/example_config/my/config/__init__.py b/doc/example_config/my/config/__init__.py index abffd626..51a0d01d 100644 --- a/doc/example_config/my/config/__init__.py +++ b/doc/example_config/my/config/__init__.py @@ -11,3 +11,12 @@ class hypothesis: class instapaper: export_path: Paths = '' + +class pocket: + export_path: Paths = '' + +class github: + export_path: Paths = '' + +class reddit: + export_path: Paths = '' diff --git a/my/reddit.py b/my/reddit.py index 475bd814..981a9908 100755 --- a/my/reddit.py +++ b/my/reddit.py @@ -209,8 +209,9 @@ def events(*args, **kwargs) -> List[Event]: inp = inputs() # 2.2s for 300 files without cachew # 0.2s for 300 files with cachew - evit = _get_events(inp, *args, **kwargs) - return list(sorted(evit, key=lambda e: e.cmp_key)) + evit = _get_events(inp, *args, **kwargs) # type: ignore[call-arg] + # todo mypy is confused here and thinks it's iterable of Path? perhaps something to do with mcachew? + return list(sorted(evit, key=lambda e: e.cmp_key)) # type: ignore[attr-defined,arg-type] def stats(): diff --git a/tox.ini b/tox.ini index f88bd3c0..d807f290 100644 --- a/tox.ini +++ b/tox.ini @@ -31,11 +31,17 @@ setenv = MYPYPATH=doc/example_config commands = # TODO ugh. somehow, user installed (editable??) packages leak into this environment?? pip install -e .[testing] .[optional] + pip install git+https://github.com/karlicoss/ghexport pip install git+https://github.com/karlicoss/hypexport pip install git+https://github.com/karlicoss/instapexport + pip install git+https://github.com/karlicoss/pockexport + pip install git+https://github.com/karlicoss/rexport # todo I guess use a script... - python3 -m mypy -p my.hypothesis \ - -p my.instapaper \ + python3 -m mypy -p my.github.ghexport \ + -p my.hypothesis \ + -p my.instapaper \ + -p my.pocket \ + -p my.reddit \ --txt-report .mypy-coverage \ --html-report .mypy-coverage \ {posargs}