general/ci: clean up mypy-misc pipeline, only exclude specific files instead

marked some module configs which aren't really ready for public use as type: ignore
This commit is contained in:
Dima Gerasimov 2023-02-20 23:40:13 +00:00
parent eff9c02886
commit bf6a96a44d
15 changed files with 132 additions and 64 deletions

View file

@ -13,7 +13,7 @@ import pandas as pd # type: ignore
import orgparse import orgparse
from my.config import blood as config from my.config import blood as config # type: ignore[attr-defined]
class Entry(NamedTuple): class Entry(NamedTuple):

View file

@ -10,7 +10,7 @@ from ..core.error import Res, set_error_datetime, extract_error_datetime
from .. import orgmode from .. import orgmode
from my.config import weight as config from my.config import weight as config # type: ignore[attr-defined]
log = LazyLogger('my.body.weight') log = LazyLogger('my.body.weight')

View file

@ -4,4 +4,4 @@ warnings.high('my.books.kobo is deprecated! Please use my.kobo instead!')
from ..core.util import __NOT_HPI_MODULE__ from ..core.util import __NOT_HPI_MODULE__
from ..kobo import * from ..kobo import * # type: ignore[no-redef]

View file

@ -1,11 +1,13 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from my.config import codeforces as config from my.config import codeforces as config # type: ignore[attr-defined]
from datetime import datetime, timezone from datetime import datetime, timezone
from typing import NamedTuple from typing import NamedTuple
import json import json
from typing import Dict, Iterator from typing import Dict, Iterator
from ..core import get_files, Res, unwrap from ..core import get_files, Res, unwrap
from ..core.compat import cached_property from ..core.compat import cached_property
from ..core.konsume import ignore, wrap from ..core.konsume import ignore, wrap

View file

@ -1,11 +1,13 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from my.config import topcoder as config from my.config import topcoder as config # type: ignore[attr-defined]
from datetime import datetime from datetime import datetime
from typing import NamedTuple from typing import NamedTuple
import json import json
from typing import Dict, Iterator from typing import Dict, Iterator
from ..core import get_files, Res, unwrap, Json from ..core import get_files, Res, unwrap, Json
from ..core.compat import cached_property from ..core.compat import cached_property
from ..core.error import Res, unwrap from ..core.error import Res, unwrap

View file

@ -14,8 +14,14 @@ from my.core import init
### ###
from datetime import tzinfo
from pathlib import Path
from typing import List
from my.core import Paths, PathIsh from my.core import Paths, PathIsh
class hypothesis: class hypothesis:
# expects outputs from https://github.com/karlicoss/hypexport # expects outputs from https://github.com/karlicoss/hypexport
# (it's just the standard Hypothes.is export format) # (it's just the standard Hypothes.is export format)
@ -139,6 +145,10 @@ class hackernews:
export_path: Paths export_path: Paths
class materialistic:
export_path: Paths
class fbmessenger: class fbmessenger:
class fbmessengerexport: class fbmessengerexport:
export_db: PathIsh export_db: PathIsh
@ -155,6 +165,11 @@ class twitter:
class talon: class talon:
export_path: Paths export_path: Paths
class twint:
export_path: Paths
class browser: class browser:
class export: class export:
export_path: Paths = '' export_path: Paths = ''
@ -167,3 +182,70 @@ class telegram:
export_path: PathIsh = '' export_path: PathIsh = ''
class demo:
data_path: Paths
username: str
timezone: tzinfo
class simple:
count: int
class vk_messages_backup:
storage_path: Path
class kobo:
export_path: Paths
class feedly:
export_path: Paths
class feedbin:
export_path: Paths
class taplog:
export_path: Paths
class lastfm:
export_path: Paths
class rescuetime:
export_path: Paths
class runnerup:
export_path: Paths
class emfit:
export_path: Path
timezone: tzinfo
excluded_sids: List[str]
class foursquare:
export_path: Paths
class rtm:
export_path: Paths
class imdb:
export_path: Paths
class roamresearch:
export_path: Paths
username: str

View file

@ -113,7 +113,7 @@ def _process_db(db: sqlite3.Connection) -> Iterator[Res[Entity]]:
yield s yield s
self_id = config.facebook_id self_id = config.facebook_id
thread_users: Dict[str, List[str]] = {} thread_users: Dict[str, List[Sender]] = {}
for r in db.execute('SELECT * from thread_participants'): for r in db.execute('SELECT * from thread_participants'):
thread_key = r['thread_key'] thread_key = r['thread_key']
user_key = r['user_key'] user_key = r['user_key']

View file

@ -10,7 +10,7 @@ from ..core.common import LazyLogger
logger = LazyLogger(__name__) logger = LazyLogger(__name__)
from my.config import jawbone as config from my.config import jawbone as config # type: ignore[attr-defined]
BDIR = config.export_dir BDIR = config.export_dir

View file

@ -85,7 +85,7 @@ def iter_useful(data_file: str):
# TODO <<< hmm. these files do contain deep and light sleep?? # TODO <<< hmm. these files do contain deep and light sleep??
# also steps stats?? # also steps stats??
from my.config import jawbone as config from my.config import jawbone as config # type: ignore[attr-defined]
p = config.export_dir / 'old_csv' p = config.export_dir / 'old_csv'
# TODO with_my? # TODO with_my?
@ -95,7 +95,7 @@ files = [
p / "2017.csv", p / "2017.csv",
] ]
from kython import concat, parse_date from kython import concat, parse_date # type: ignore
useful = concat(*(list(iter_useful(str(f))) for f in files)) useful = concat(*(list(iter_useful(str(f))) for f in files))
# for u in useful: # for u in useful:
@ -108,7 +108,7 @@ dates = [parse_date(u.date, yearfirst=True, dayfirst=False) for u in useful]
# TODO filter outliers? # TODO filter outliers?
# TODO don't need this anymore? it's gonna be in dashboards package # TODO don't need this anymore? it's gonna be in dashboards package
from kython.plotting import plot_timestamped from kython.plotting import plot_timestamped # type: ignore
for attr, lims, mavg, fig in [ # type: ignore for attr, lims, mavg, fig in [ # type: ignore
('light', (0, 400), 5, None), ('light', (0, 400), 5, None),
('deep', (0, 600), 5, None), ('deep', (0, 600), 5, None),

View file

@ -19,7 +19,7 @@ from ..core.common import LazyLogger, mcachew, fastermime
from ..core.error import Res, sort_res_by from ..core.error import Res, sort_res_by
from ..core.cachew import cache_dir from ..core.cachew import cache_dir
from my.config import photos as config from my.config import photos as config # type: ignore[attr-defined]
logger = LazyLogger(__name__) logger = LazyLogger(__name__)

View file

@ -13,7 +13,7 @@ from typing import Iterable
from .core import Res, get_files from .core import Res, get_files
from .core.common import isoparse, Json from .core.common import isoparse, Json
import tcxparser import tcxparser # type: ignore[import]
from my.config import runnerup as config from my.config import runnerup as config

View file

@ -51,7 +51,7 @@ def _message_from_row(r: sqlite3.Row, *, chats: Chats) -> Message:
id=r['message_id'], id=r['message_id'],
time=time, time=time,
chat=chat, chat=chat,
sender=sender, sender=User(id=sender.id, name=sender.name),
text=r['text'], text=r['text'],
) )

View file

@ -12,7 +12,7 @@ except ImportError as ie:
# must be caused by something else # must be caused by something else
raise ie raise ie
try: try:
from my.config import twitter as user_config # type: ignore[misc] from my.config import twitter as user_config # type: ignore[misc,assignment]
except ImportError: except ImportError:
raise ie # raise the original exception.. must be something else raise ie # raise the original exception.. must be something else
else: else:

View file

@ -3,7 +3,8 @@ from datetime import datetime
import json import json
from typing import NamedTuple, Iterable, Sequence, Optional from typing import NamedTuple, Iterable, Sequence, Optional
from my.config import vk as config
from my.config import vk as config # type: ignore[attr-defined]
class Favorite(NamedTuple): class Favorite(NamedTuple):

69
tox.ini
View file

@ -96,57 +96,38 @@ commands =
pip install -e .[testing,optional] pip install -e .[testing,optional]
hpi module install --parallel \ hpi module install --parallel \
my.browser.export \
my.orgmode \
my.endomondo \
my.github.ghexport \
my.hypothesis \
my.instapaper \
my.pocket \
my.reddit.rexport \
my.reddit.pushshift \
my.stackexchange.stexport \
my.tinder.android \
my.pinboard \
my.arbtt \ my.arbtt \
my.coding.commits \ my.coding.commits \
my.browser.export \
my.github.ghexport \
my.emfit \
my.endomondo \
my.fbmessenger.export \
my.goodreads \ my.goodreads \
my.pdfs \ my.google.takeout.parser \
my.smscalls \ my.orgmode \
my.hypothesis \
my.instapaper \
my.kobo \
my.location.gpslogger \ my.location.gpslogger \
my.location.via_ip \ my.location.via_ip \
my.google.takeout.parser my.pdfs \
my.pinboard \
my.pocket \
my.reddit.pushshift \
my.reddit.rexport \
my.rescuetime \
my.runnerup \
my.stackexchange.stexport \
my.smscalls \
my.tinder.android
# todo fuck. -p my.github isn't checking the subpackages?? wtf...
# guess it wants .pyi file??
{envpython} -m mypy --install-types --non-interactive \ {envpython} -m mypy --install-types --non-interactive \
-p my.browser \ -p my \
-p my.endomondo \ --exclude 'my/coding/codeforces.py' \
-p my.github.ghexport \ --exclude 'my/coding/topcoder.py' \
-p my.github.gdpr \ --exclude 'my/jawbone/.*' \
-p my.hypothesis \
-p my.instapaper \
-p my.pocket \
-p my.smscalls \
-p my.reddit \
-p my.stackexchange.stexport \
-p my.pinboard \
-p my.body.exercise.cardio \
-p my.body.exercise.cross_trainer \
-p my.bluemaestro \
-p my.location.google \
-p my.location.google_takeout \
-p my.location.via_ip \
-p my.location.gpslogger \
-p my.ip.common \
-p my.time.tz.via_location \
-p my.calendar.holidays \
-p my.arbtt \
-p my.coding.commits \
-p my.goodreads \
-p my.pdfs \
-p my.bumble.android \
-p my.tinder.android \
--txt-report .coverage.mypy-misc \ --txt-report .coverage.mypy-misc \
--html-report .coverage.mypy-misc \ --html-report .coverage.mypy-misc \
{posargs} {posargs}