cleanup; remove unused imports
This commit is contained in:
parent
a11a3af597
commit
5ecd4b4810
39 changed files with 36 additions and 67 deletions
|
@ -21,7 +21,7 @@ def inputs() -> Sequence[Path]:
|
||||||
return get_files(user_config.logfiles)
|
return get_files(user_config.logfiles)
|
||||||
|
|
||||||
|
|
||||||
from .core import dataclass, Json, Res, PathIsh, datetime_aware
|
from .core import dataclass, Json, PathIsh, datetime_aware
|
||||||
from .core.common import isoparse
|
from .core.common import isoparse
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ def measurements() -> Iterable[Measurement]:
|
||||||
try:
|
try:
|
||||||
datas = db.execute(f'SELECT "{f.name}" as name, Time, Temperature, Humidity, Pressure, Dewpoint FROM data ORDER BY log_index')
|
datas = db.execute(f'SELECT "{f.name}" as name, Time, Temperature, Humidity, Pressure, Dewpoint FROM data ORDER BY log_index')
|
||||||
oldfmt = True
|
oldfmt = True
|
||||||
db_dts = list(db.execute(f'SELECT last_download FROM info'))[0][0]
|
db_dts = list(db.execute('SELECT last_download FROM info'))[0][0]
|
||||||
if db_dts == 'N/A':
|
if db_dts == 'N/A':
|
||||||
# ??? happens for 20180923-20180928
|
# ??? happens for 20180923-20180928
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -5,8 +5,7 @@ Blood tracking (manual org-mode entries)
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Iterable, NamedTuple, Optional
|
from typing import Iterable, NamedTuple, Optional
|
||||||
|
|
||||||
from ..core.common import listify
|
from ..core.error import Res
|
||||||
from ..core.error import Res, echain
|
|
||||||
from ..core.orgmode import parse_org_datetime, one_table
|
from ..core.orgmode import parse_org_datetime, one_table
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,12 @@ from my.config import codeforces as config
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import NamedTuple
|
from typing import NamedTuple
|
||||||
from pathlib import Path
|
|
||||||
import json
|
import json
|
||||||
from typing import Dict, Iterator, Any
|
from typing import Dict, Iterator
|
||||||
|
|
||||||
from ..common import cproperty, get_files
|
from ..common import cproperty, get_files
|
||||||
from ..error import Res, unwrap
|
from ..error import Res, unwrap
|
||||||
from ..core.konsume import zoom, ignore, wrap
|
from ..core.konsume import ignore, wrap
|
||||||
|
|
||||||
from kython import fget
|
from kython import fget
|
||||||
# TODO remove
|
# TODO remove
|
||||||
|
|
|
@ -39,7 +39,7 @@ def config() -> commits_cfg:
|
||||||
##########################
|
##########################
|
||||||
|
|
||||||
import git # type: ignore
|
import git # type: ignore
|
||||||
from git.repo.fun import is_git_dir, find_worktree_git_dir # type: ignore
|
from git.repo.fun import is_git_dir # type: ignore
|
||||||
|
|
||||||
|
|
||||||
log = LazyLogger(__name__, level='info')
|
log = LazyLogger(__name__, level='info')
|
||||||
|
|
|
@ -3,9 +3,8 @@ from my.config import topcoder as config
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import NamedTuple
|
from typing import NamedTuple
|
||||||
from pathlib import Path
|
|
||||||
import json
|
import json
|
||||||
from typing import Dict, Iterator, Any
|
from typing import Dict, Iterator
|
||||||
|
|
||||||
from ..common import cproperty, get_files
|
from ..common import cproperty, get_files
|
||||||
from ..error import Res, unwrap
|
from ..error import Res, unwrap
|
||||||
|
|
|
@ -26,7 +26,6 @@ def make_config(cls: Type[C], migration: Callable[[Attrs], Attrs]=lambda x: x) -
|
||||||
|
|
||||||
F = TypeVar('F')
|
F = TypeVar('F')
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
import inspect
|
|
||||||
from typing import Iterator
|
from typing import Iterator
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def override_config(config: F) -> Iterator[F]:
|
def override_config(config: F) -> Iterator[F]:
|
||||||
|
|
|
@ -99,7 +99,7 @@ config = make_config(Config)
|
||||||
|
|
||||||
|
|
||||||
### tests start
|
### tests start
|
||||||
from typing import Iterator, Any
|
from typing import Iterator
|
||||||
from contextlib import contextmanager as ctx
|
from contextlib import contextmanager as ctx
|
||||||
@ctx
|
@ctx
|
||||||
def _reset_config() -> Iterator[Config]:
|
def _reset_config() -> Iterator[Config]:
|
||||||
|
|
|
@ -29,7 +29,6 @@ del ModuleType
|
||||||
def setup_config() -> None:
|
def setup_config() -> None:
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from .preinit import get_mycfg_dir
|
from .preinit import get_mycfg_dir
|
||||||
mycfg_dir = get_mycfg_dir()
|
mycfg_dir = get_mycfg_dir()
|
||||||
|
|
|
@ -36,7 +36,6 @@ def one_table(o: OrgNode) -> Table:
|
||||||
return one(collect(o, lambda n: (x for x in n.body_rich if isinstance(x, Table))))
|
return one(collect(o, lambda n: (x for x in n.body_rich if isinstance(x, Table))))
|
||||||
|
|
||||||
|
|
||||||
from typing import Iterator, Dict, Any
|
|
||||||
class TypedTable(Table):
|
class TypedTable(Table):
|
||||||
def __new__(cls, orig: Table) -> 'TypedTable':
|
def __new__(cls, orig: Table) -> 'TypedTable':
|
||||||
tt = super().__new__(TypedTable)
|
tt = super().__new__(TypedTable)
|
||||||
|
|
|
@ -5,7 +5,7 @@ Various pandas helpers and convenience functions
|
||||||
# NOTE: this file is meant to be importable without Pandas installed
|
# NOTE: this file is meant to be importable without Pandas installed
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
from typing import Optional, TYPE_CHECKING, Any, Iterable, Type, List, Dict
|
from typing import Optional, TYPE_CHECKING, Any, Iterable, Type, Dict
|
||||||
from . import warnings, Res
|
from . import warnings, Res
|
||||||
from .common import LazyLogger, Json, asdict
|
from .common import LazyLogger, Json, asdict
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from datetime import datetime, tzinfo
|
from datetime import tzinfo
|
||||||
from typing import Sequence
|
from typing import Sequence
|
||||||
|
|
||||||
import pytz # type: ignore
|
import pytz # type: ignore
|
||||||
|
|
|
@ -3,7 +3,6 @@ from itertools import chain
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
import os
|
import os
|
||||||
import pkgutil
|
import pkgutil
|
||||||
import re
|
|
||||||
import sys
|
import sys
|
||||||
from typing import List, Iterable, Optional
|
from typing import List, Iterable, Optional
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
Consumes data exported by https://github.com/karlicoss/emfitexport
|
Consumes data exported by https://github.com/karlicoss/emfitexport
|
||||||
"""
|
"""
|
||||||
from datetime import date
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Iterable, Any, Optional
|
from typing import Dict, List, Iterable, Any, Optional
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,7 @@ Foursquare/Swarm checkins
|
||||||
from datetime import datetime, timezone, timedelta
|
from datetime import datetime, timezone, timedelta
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Dict, NamedTuple, Union, Any, Tuple, Set
|
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# TODO pytz for timezone???
|
# TODO pytz for timezone???
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
Github data (uses [[https://github.com/settings/admin][official GDPR export]])
|
Github data (uses [[https://github.com/settings/admin][official GDPR export]])
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from datetime import datetime
|
|
||||||
import json
|
import json
|
||||||
from typing import Iterable, Dict, Any
|
from typing import Iterable, Dict, Any
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ REQUIRES = [
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from ..core import Paths, PathIsh
|
from ..core import Paths
|
||||||
|
|
||||||
from my.config import github as user_config
|
from my.config import github as user_config
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ except ModuleNotFoundError as e:
|
||||||
|
|
||||||
############################
|
############################
|
||||||
|
|
||||||
from typing import Tuple, Iterable, Dict, Sequence
|
from typing import Tuple, Dict, Sequence
|
||||||
|
|
||||||
from ..core import get_files, Path
|
from ..core import get_files, Path
|
||||||
from ..core.common import mcachew
|
from ..core.common import mcachew
|
||||||
|
@ -127,7 +127,7 @@ def _get_summary(e) -> Tuple[str, Optional[str], Optional[str]]:
|
||||||
link = com['html_url']
|
link = com['html_url']
|
||||||
iss = pl['issue']
|
iss = pl['issue']
|
||||||
title = iss['title']
|
title = iss['title']
|
||||||
return f"{rname}: commented on issue {title}", link, f'issue_comment_' + link
|
return f"{rname}: commented on issue {title}", link, 'issue_comment_' + link
|
||||||
elif tp == "ReleaseEvent":
|
elif tp == "ReleaseEvent":
|
||||||
action = pl['action']
|
action = pl['action']
|
||||||
rel = pl['release']
|
rel = pl['release']
|
||||||
|
|
|
@ -7,7 +7,7 @@ import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from html.parser import HTMLParser
|
from html.parser import HTMLParser
|
||||||
from typing import List, Dict, Optional, Any, Callable, Iterable, Tuple
|
from typing import List, Optional, Any, Callable, Iterable, Tuple
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
import pytz
|
import pytz
|
||||||
|
|
|
@ -23,7 +23,7 @@ config = make_config(google)
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional, Iterable
|
from typing import Optional, Iterable
|
||||||
|
|
||||||
from ...core.kompress import kopen, kexists
|
from ...core.kompress import kexists
|
||||||
|
|
||||||
|
|
||||||
def get_takeouts(*, path: Optional[str]=None) -> Iterable[Path]:
|
def get_takeouts(*, path: Optional[str]=None) -> Iterable[Path]:
|
||||||
|
|
|
@ -6,7 +6,7 @@ REQUIRES = [
|
||||||
]
|
]
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional, Callable
|
from typing import Callable
|
||||||
|
|
||||||
from .core import Paths
|
from .core import Paths
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,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 numpy as np # type: ignore
|
|
||||||
import matplotlib.pyplot as plt # type: ignore
|
import matplotlib.pyplot as plt # type: ignore
|
||||||
from matplotlib.figure import Figure # type: ignore
|
from matplotlib.figure import Figure # type: ignore
|
||||||
from matplotlib.axes import Axes # type: ignore
|
from matplotlib.axes import Axes # type: ignore
|
||||||
|
@ -170,7 +169,6 @@ def hhmm(time: datetime):
|
||||||
# return fromstart / tick
|
# return fromstart / tick
|
||||||
|
|
||||||
import matplotlib.dates as mdates # type: ignore
|
import matplotlib.dates as mdates # type: ignore
|
||||||
from matplotlib.ticker import MultipleLocator, FixedLocator # type: ignore
|
|
||||||
|
|
||||||
def plot_one(sleep: SleepEntry, fig: Figure, axes: Axes, xlims=None, showtext=True):
|
def plot_one(sleep: SleepEntry, fig: Figure, axes: Axes, xlims=None, showtext=True):
|
||||||
span = sleep.completed - sleep.created
|
span = sleep.completed - sleep.created
|
||||||
|
|
|
@ -5,7 +5,7 @@ from pathlib import Path
|
||||||
from csv import DictReader
|
from csv import DictReader
|
||||||
from itertools import islice
|
from itertools import islice
|
||||||
|
|
||||||
from typing import Dict, Any, NamedTuple, Dict
|
from typing import Dict, Any, NamedTuple
|
||||||
|
|
||||||
# sleep = []
|
# sleep = []
|
||||||
# with open('2017.csv', 'r') as fo:
|
# with open('2017.csv', 'r') as fo:
|
||||||
|
@ -14,7 +14,6 @@ from typing import Dict, Any, NamedTuple, Dict
|
||||||
# sleep
|
# sleep
|
||||||
# print(line)
|
# print(line)
|
||||||
|
|
||||||
import numpy as np # type: ignore
|
|
||||||
import matplotlib.pyplot as plt # type: ignore
|
import matplotlib.pyplot as plt # type: ignore
|
||||||
from numpy import genfromtxt # type: ignore
|
from numpy import genfromtxt # type: ignore
|
||||||
import matplotlib.pylab as pylab # type: ignore
|
import matplotlib.pylab as pylab # type: ignore
|
||||||
|
@ -77,7 +76,6 @@ class SleepData(NamedTuple):
|
||||||
|
|
||||||
|
|
||||||
def iter_useful(data_file: str):
|
def iter_useful(data_file: str):
|
||||||
from csv import DictReader
|
|
||||||
with open(data_file) as fo:
|
with open(data_file) as fo:
|
||||||
reader = DictReader(fo)
|
reader = DictReader(fo)
|
||||||
for d in reader:
|
for d in reader:
|
||||||
|
|
|
@ -20,7 +20,7 @@ config = make_config(lastfm)
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import NamedTuple, Any, Sequence, Iterable
|
from typing import NamedTuple, Sequence, Iterable
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,11 @@ REQUIRES = [
|
||||||
'ijson',
|
'ijson',
|
||||||
]
|
]
|
||||||
|
|
||||||
import json
|
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from itertools import islice
|
from itertools import islice
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
from typing import Any, Collection, Iterable, NamedTuple, Optional, Sequence, IO, Tuple
|
from typing import Iterable, NamedTuple, Optional, Sequence, IO, Tuple
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# pip3 install geopy
|
# pip3 install geopy
|
||||||
|
|
|
@ -4,7 +4,7 @@ Simple location provider, serving as a fallback when more detailed data isn't av
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime, date, time, timezone
|
from datetime import datetime, date, time, timezone
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from typing import Optional, Sequence, Tuple, Union, cast
|
from typing import Sequence, Tuple, Union, cast
|
||||||
|
|
||||||
from ..core.common import fromisoformat
|
from ..core.common import fromisoformat
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import csv
|
import csv
|
||||||
import json
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Iterator, List, NamedTuple
|
from typing import Iterator, List, NamedTuple
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@ REQUIRES = [
|
||||||
'orgparse',
|
'orgparse',
|
||||||
]
|
]
|
||||||
|
|
||||||
from datetime import datetime, date
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Sequence, Iterable, NamedTuple, Optional
|
from typing import List, Sequence, Iterable, NamedTuple, Optional
|
||||||
|
|
||||||
from .core import PathIsh, get_files
|
from .core import get_files
|
||||||
from .core.common import mcachew
|
from .core.common import mcachew
|
||||||
from .core.cachew import cache_dir
|
from .core.cachew import cache_dir
|
||||||
from .core.orgmode import collect
|
from .core.orgmode import collect
|
||||||
|
|
|
@ -10,8 +10,6 @@ from datetime import datetime
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
import io
|
import io
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
from typing import NamedTuple, List, Optional, Iterator, Sequence
|
from typing import NamedTuple, List, Optional, Iterator, Sequence
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ from concurrent.futures import ProcessPoolExecutor as Pool
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Tuple, Dict, Optional, NamedTuple, Iterator, Iterable, List
|
from typing import Optional, NamedTuple, Iterator, Iterable, List
|
||||||
|
|
||||||
from geopy.geocoders import Nominatim # type: ignore
|
from geopy.geocoders import Nominatim # type: ignore
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ REQUIRES = [
|
||||||
'git+https://github.com/karlicoss/pockexport',
|
'git+https://github.com/karlicoss/pockexport',
|
||||||
]
|
]
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from .core import Paths
|
from .core import Paths
|
||||||
|
|
||||||
|
@ -36,7 +35,6 @@ except ModuleNotFoundError as e:
|
||||||
|
|
||||||
Article = dal.Article
|
Article = dal.Article
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import Sequence, Iterable
|
from typing import Sequence, Iterable
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
[[https://github.com/burtonator/polar-bookshelf][Polar]] articles and highlights
|
[[https://github.com/burtonator/polar-bookshelf][Polar]] articles and highlights
|
||||||
"""
|
"""
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Type, Any, cast, TYPE_CHECKING
|
from typing import cast, TYPE_CHECKING
|
||||||
|
|
||||||
|
|
||||||
import my.config
|
import my.config
|
||||||
|
@ -40,12 +40,10 @@ from datetime import datetime
|
||||||
from typing import List, Dict, Iterable, NamedTuple, Sequence, Optional
|
from typing import List, Dict, Iterable, NamedTuple, Sequence, Optional
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import pytz
|
|
||||||
|
|
||||||
from ..core import LazyLogger, Json
|
from ..core import LazyLogger, Json
|
||||||
from ..core.common import isoparse
|
from ..core.common import isoparse
|
||||||
from ..error import Res, echain, sort_res_by
|
from ..error import Res, echain, sort_res_by
|
||||||
from ..core.konsume import wrap, zoom, ignore, Zoomable, Wdict
|
from ..core.konsume import wrap, Zoomable, Wdict
|
||||||
|
|
||||||
|
|
||||||
logger = LazyLogger(__name__)
|
logger = LazyLogger(__name__)
|
||||||
|
|
|
@ -5,7 +5,6 @@ REQUIRES = [
|
||||||
'git+https://github.com/karlicoss/rexport',
|
'git+https://github.com/karlicoss/rexport',
|
||||||
]
|
]
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
from .core.common import Paths
|
from .core.common import Paths
|
||||||
|
|
||||||
from my.config import reddit as uconfig
|
from my.config import reddit as uconfig
|
||||||
|
@ -95,7 +94,7 @@ def upvoted() -> Iterator[Upvote]:
|
||||||
|
|
||||||
### the rest of the file is some elaborate attempt of restoring favorite/unfavorite times
|
### the rest of the file is some elaborate attempt of restoring favorite/unfavorite times
|
||||||
|
|
||||||
from typing import Dict, Union, Iterable, Iterator, NamedTuple, Any
|
from typing import Dict, Iterable, Iterator, NamedTuple
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
import pytz
|
import pytz
|
||||||
import re
|
import re
|
||||||
|
@ -183,7 +182,7 @@ def _get_events(backups: Sequence[Path], parallel: bool=True) -> Iterator[Event]
|
||||||
assert not first
|
assert not first
|
||||||
yield Event(
|
yield Event(
|
||||||
dt=bdt, # TODO average wit ps.save_dt?
|
dt=bdt, # TODO average wit ps.save_dt?
|
||||||
text=f"unfavorited",
|
text="unfavorited",
|
||||||
kind=ps,
|
kind=ps,
|
||||||
eid=f'unf-{ps.sid}',
|
eid=f'unf-{ps.sid}',
|
||||||
url=ps.url,
|
url=ps.url,
|
||||||
|
|
|
@ -6,7 +6,7 @@ REQUIRES = [
|
||||||
]
|
]
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from datetime import datetime, timedelta
|
from datetime import timedelta
|
||||||
from typing import Sequence, Iterable
|
from typing import Sequence, Iterable
|
||||||
|
|
||||||
from .core import get_files, LazyLogger
|
from .core import get_files, LazyLogger
|
||||||
|
@ -38,7 +38,6 @@ def entries() -> Iterable[Res[Entry]]:
|
||||||
def groups(gap: timedelta=timedelta(hours=3)) -> Iterable[Res[Sequence[Entry]]]:
|
def groups(gap: timedelta=timedelta(hours=3)) -> Iterable[Res[Sequence[Entry]]]:
|
||||||
vit, eit = split_errors(entries(), ET=Exception)
|
vit, eit = split_errors(entries(), ET=Exception)
|
||||||
yield from eit
|
yield from eit
|
||||||
import more_itertools
|
|
||||||
from more_itertools import split_when
|
from more_itertools import split_when
|
||||||
yield from split_when(vit, lambda a, b: (b.dt - a.dt) > gap)
|
yield from split_when(vit, lambda a, b: (b.dt - a.dt) > gap)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ from my.config import feedly as config
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Sequence
|
from typing import Sequence
|
||||||
|
|
||||||
from ..core.common import listify, get_files, isoparse
|
from ..core.common import listify, get_files
|
||||||
from .common import Subscription
|
from .common import Subscription
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,7 @@ REQUIRES = [
|
||||||
]
|
]
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from pathlib import Path
|
from typing import Dict, List, Iterator
|
||||||
from typing import Dict, List, Optional, Iterator
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from .common import LazyLogger, get_files, group_by_key, cproperty, make_dict
|
from .common import LazyLogger, get_files, group_by_key, cproperty, make_dict
|
||||||
|
|
|
@ -6,9 +6,9 @@ REQUIRES = [
|
||||||
'python-tcxparser',
|
'python-tcxparser',
|
||||||
]
|
]
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import timedelta
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import NamedTuple, Iterable
|
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
|
||||||
|
|
|
@ -10,9 +10,8 @@ REQUIRES = [
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from itertools import groupby, islice
|
from itertools import groupby
|
||||||
from pathlib import Path
|
from typing import Iterator, NamedTuple, Optional
|
||||||
from typing import Dict, Iterator, List, NamedTuple, Optional, Tuple
|
|
||||||
|
|
||||||
from more_itertools import seekable
|
from more_itertools import seekable
|
||||||
import pytz
|
import pytz
|
||||||
|
|
|
@ -32,14 +32,11 @@ config = make_config(twitter_archive)
|
||||||
|
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Union, List, Dict, Set, Optional, Iterable, Any, NamedTuple, Sequence
|
from typing import List, Optional, Iterable, NamedTuple, Sequence
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import json
|
import json
|
||||||
import zipfile
|
|
||||||
|
|
||||||
import pytz
|
from ..common import get_files, LazyLogger, Json
|
||||||
|
|
||||||
from ..common import PathIsh, get_files, LazyLogger, Json
|
|
||||||
from ..core import kompress
|
from ..core import kompress
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ VK data (exported by [[https://github.com/Totktonada/vk_messages_backup][Totkton
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
|
||||||
from typing import Dict, Iterable, NamedTuple
|
from typing import Dict, Iterable, NamedTuple
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
|
|
Loading…
Add table
Reference in a new issue