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 committed by karlicoss
parent eff9c02886
commit c63177e186
15 changed files with 132 additions and 64 deletions

View file

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

View file

@ -10,7 +10,7 @@ from ..core.error import Res, set_error_datetime, extract_error_datetime
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')

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 ..kobo import *
from ..kobo import * # type: ignore[no-redef]

View file

@ -1,11 +1,13 @@
#!/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 typing import NamedTuple
import json
from typing import Dict, Iterator
from ..core import get_files, Res, unwrap
from ..core.compat import cached_property
from ..core.konsume import ignore, wrap

View file

@ -1,11 +1,13 @@
#!/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 typing import NamedTuple
import json
from typing import Dict, Iterator
from ..core import get_files, Res, unwrap, Json
from ..core.compat import cached_property
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
class hypothesis:
# expects outputs from https://github.com/karlicoss/hypexport
# (it's just the standard Hypothes.is export format)
@ -139,6 +145,10 @@ class hackernews:
export_path: Paths
class materialistic:
export_path: Paths
class fbmessenger:
class fbmessengerexport:
export_db: PathIsh
@ -155,6 +165,11 @@ class twitter:
class talon:
export_path: Paths
class twint:
export_path: Paths
class browser:
class export:
export_path: Paths = ''
@ -167,3 +182,70 @@ class telegram:
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
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'):
thread_key = r['thread_key']
user_key = r['user_key']

View file

@ -10,7 +10,7 @@ from ..core.common import LazyLogger
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

View file

@ -85,7 +85,7 @@ def iter_useful(data_file: str):
# TODO <<< hmm. these files do contain deep and light sleep??
# 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'
# TODO with_my?
@ -95,7 +95,7 @@ files = [
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))
# 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 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
('light', (0, 400), 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.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__)

View file

@ -13,7 +13,7 @@ from typing import Iterable
from .core import Res, get_files
from .core.common import isoparse, Json
import tcxparser
import tcxparser # type: ignore[import]
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'],
time=time,
chat=chat,
sender=sender,
sender=User(id=sender.id, name=sender.name),
text=r['text'],
)

View file

@ -12,7 +12,7 @@ except ImportError as ie:
# must be caused by something else
raise ie
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:
raise ie # raise the original exception.. must be something else
else:

View file

@ -3,7 +3,8 @@ from datetime import datetime
import json
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):

79
tox.ini
View file

@ -96,57 +96,38 @@ commands =
pip install -e .[testing,optional]
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.coding.commits \
my.goodreads \
my.pdfs \
my.smscalls \
my.location.gpslogger \
my.location.via_ip \
my.google.takeout.parser
my.arbtt \
my.coding.commits \
my.browser.export \
my.github.ghexport \
my.emfit \
my.endomondo \
my.fbmessenger.export \
my.goodreads \
my.google.takeout.parser \
my.orgmode \
my.hypothesis \
my.instapaper \
my.kobo \
my.location.gpslogger \
my.location.via_ip \
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 \
-p my.browser \
-p my.endomondo \
-p my.github.ghexport \
-p my.github.gdpr \
-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 \
-p my \
--exclude 'my/coding/codeforces.py' \
--exclude 'my/coding/topcoder.py' \
--exclude 'my/jawbone/.*' \
--txt-report .coverage.mypy-misc \
--html-report .coverage.mypy-misc \
{posargs}