my.jawbone: get rid of matplotlib import on top level

This commit is contained in:
karlicoss 2023-11-10 01:59:21 +00:00
parent e547acfa59
commit ac5f71c68b
2 changed files with 9 additions and 7 deletions

View file

@ -1,3 +1,5 @@
from __future__ import annotations
from typing import Dict, Any, List, Iterable from typing import Dict, Any, List, Iterable
import json import json
from functools import lru_cache from functools import lru_cache
@ -155,9 +157,6 @@ def stats():
#### NOTE: most of the stuff below is deprecated and remnants of my old code! #### NOTE: most of the stuff below is deprecated and remnants of my old code!
#### sorry for it, feel free to remove if you don't need it #### sorry for it, feel free to remove if you don't need it
import matplotlib.pyplot as plt # type: ignore
from matplotlib.figure import Figure # type: ignore
from matplotlib.axes import Axes # type: ignore
def hhmm(time: datetime): def hhmm(time: datetime):
return time.strftime("%H:%M") return time.strftime("%H:%M")
@ -168,9 +167,10 @@ def hhmm(time: datetime):
# fromstart = time - sleep.created # fromstart = time - sleep.created
# return fromstart / tick # return fromstart / tick
import matplotlib.dates as mdates # type: ignore
def plot_one(sleep: SleepEntry, fig: Figure, axes: Axes, xlims=None, showtext=True): def plot_one(sleep: SleepEntry, fig, axes, xlims=None, showtext=True):
import matplotlib.dates as mdates # type: ignore[import-not-found]
span = sleep.completed - sleep.created span = sleep.completed - sleep.created
print(f"{sleep.xid} span: {span}") print(f"{sleep.xid} span: {span}")
@ -253,7 +253,10 @@ def predicate(sleep: SleepEntry):
# TODO move to dashboard # TODO move to dashboard
def plot(): def plot() -> None:
from matplotlib.figure import Figure # type: ignore[import-not-found]
import matplotlib.pyplot as plt # type: ignore[import-not-found]
# TODO FIXME melatonin data # TODO FIXME melatonin data
melatonin_data = {} # type: ignore[var-annotated] melatonin_data = {} # type: ignore[var-annotated]

View file

@ -171,7 +171,6 @@ commands =
-p {[testenv]package_name} \ -p {[testenv]package_name} \
--exclude 'my/coding/codeforces.py' \ --exclude 'my/coding/codeforces.py' \
--exclude 'my/coding/topcoder.py' \ --exclude 'my/coding/topcoder.py' \
--exclude 'my/jawbone/.*' \
--txt-report .coverage.mypy-misc \ --txt-report .coverage.mypy-misc \
--html-report .coverage.mypy-misc \ --html-report .coverage.mypy-misc \
{posargs} {posargs}