general: migrate modules to use 3.9 features
This commit is contained in:
parent
d3f9a8e8b6
commit
8496d131e7
125 changed files with 889 additions and 739 deletions
|
@ -20,6 +20,7 @@ REQUIRES = [
|
|||
|
||||
|
||||
from my.core.hpi_compat import handle_legacy_import
|
||||
|
||||
is_legacy_import = handle_legacy_import(
|
||||
parent_module_name=__name__,
|
||||
legacy_submodule_name='rexport',
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
from typing import Iterator
|
||||
from my.core import stat, Stats
|
||||
from collections.abc import Iterator
|
||||
|
||||
from my.core import Stats, stat
|
||||
from my.core.source import import_source
|
||||
|
||||
from .common import Save, Upvote, Comment, Submission, _merge_comments
|
||||
from .common import Comment, Save, Submission, Upvote, _merge_comments
|
||||
|
||||
# Man... ideally an all.py file isn't this verbose, but
|
||||
# reddit just feels like that much of a complicated source and
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
This defines Protocol classes, which make sure that each different
|
||||
type of shared models have a standardized interface
|
||||
"""
|
||||
from my.core import __NOT_HPI_MODULE__
|
||||
|
||||
from typing import Set, Iterator, Protocol
|
||||
from my.core import __NOT_HPI_MODULE__ # isort: skip
|
||||
|
||||
from collections.abc import Iterator
|
||||
from itertools import chain
|
||||
from typing import Protocol
|
||||
|
||||
from my.core import datetime_aware, Json
|
||||
from my.core import Json, datetime_aware
|
||||
|
||||
|
||||
# common fields across all the Protocol classes, so generic code can be written
|
||||
|
@ -49,7 +51,7 @@ class Submission(RedditBase, Protocol):
|
|||
def _merge_comments(*sources: Iterator[Comment]) -> Iterator[Comment]:
|
||||
#from .rexport import logger
|
||||
#ignored = 0
|
||||
emitted: Set[str] = set()
|
||||
emitted: set[str] = set()
|
||||
for e in chain(*sources):
|
||||
uid = e.id
|
||||
if uid in emitted:
|
||||
|
|
|
@ -10,13 +10,13 @@ REQUIRES = [
|
|||
|
||||
from dataclasses import dataclass
|
||||
|
||||
# note: keeping pushshift import before config import, so it's handled gracefully by import_source
|
||||
from pushshift_comment_export.dal import PComment, read_file
|
||||
|
||||
from my.config import reddit as uconfig
|
||||
from my.core import Paths, Stats, stat
|
||||
from my.core.cfg import make_config
|
||||
|
||||
# note: keeping pushshift import before config import, so it's handled gracefully by import_source
|
||||
from pushshift_comment_export.dal import read_file, PComment
|
||||
|
||||
from my.config import reddit as uconfig
|
||||
|
||||
@dataclass
|
||||
class pushshift_config(uconfig.pushshift):
|
||||
|
@ -29,10 +29,10 @@ class pushshift_config(uconfig.pushshift):
|
|||
|
||||
config = make_config(pushshift_config)
|
||||
|
||||
from my.core import get_files
|
||||
from typing import Sequence, Iterator
|
||||
from collections.abc import Iterator, Sequence
|
||||
from pathlib import Path
|
||||
|
||||
from my.core import get_files
|
||||
|
||||
|
||||
def inputs() -> Sequence[Path]:
|
||||
|
|
|
@ -7,23 +7,24 @@ REQUIRES = [
|
|||
'git+https://github.com/karlicoss/rexport',
|
||||
]
|
||||
|
||||
from dataclasses import dataclass
|
||||
import inspect
|
||||
from collections.abc import Iterator, Sequence
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Iterator, Sequence
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from my.core import (
|
||||
get_files,
|
||||
make_logger,
|
||||
warnings,
|
||||
stat,
|
||||
Paths,
|
||||
Stats,
|
||||
get_files,
|
||||
make_logger,
|
||||
stat,
|
||||
warnings,
|
||||
)
|
||||
from my.core.cachew import mcachew
|
||||
from my.core.cfg import make_config, Attrs
|
||||
from my.core.cfg import Attrs, make_config
|
||||
|
||||
from my.config import reddit as uconfig
|
||||
from my.config import reddit as uconfig # isort: skip
|
||||
|
||||
logger = make_logger(__name__)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue