Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 2, 2024
1 parent 9ed00ca commit 0f3c9ca
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
1 change: 1 addition & 0 deletions alto2txt2fixture/patterns.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Useful regular expressions, intially just ``PUBLICATION_CODE``.
"""

import re

PUBLICATION_CODE = re.compile(r"\d{7}")
13 changes: 6 additions & 7 deletions alto2txt2fixture/plaintext.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
DEFAULT_EXTRACTED_SUBDIR: Final[PathLike] = Path("extracted")

FULLTEXT_FILE_NAME_SUFFIX: Final[str] = "_plaintext"
FULLTEXT_DEFAULT_PLAINTEXT_ZIP_GLOB_REGEX: Final[
str
] = f"*{FULLTEXT_FILE_NAME_SUFFIX}.{ZIP_FILE_EXTENSION}"
FULLTEXT_DEFAULT_PLAINTEXT_ZIP_GLOB_REGEX: Final[str] = (
f"*{FULLTEXT_FILE_NAME_SUFFIX}.{ZIP_FILE_EXTENSION}"
)
TXT_FIXTURE_FILE_EXTENSION: Final[str] = "txt"
TXT_FIXTURE_FILE_GLOB_REGEX: Final[str] = f"**/*.{TXT_FIXTURE_FILE_EXTENSION}"
DEFAULT_MAX_PLAINTEXT_PER_FIXTURE_FILE: Final[int] = 100
Expand Down Expand Up @@ -77,7 +77,6 @@ class FulltextPathDict(TypedDict):

@dataclass
class PlainTextFixture:

"""Manage exporting `plaintext` `alto2txt` results for `lwmdb.fulltext.models.Fulltext`.
Attributes:
Expand Down Expand Up @@ -213,9 +212,9 @@ def __post_init__(self) -> None:
self._check_and_set_files_attr(force=True)
self._check_and_set_data_provider(force=True)
self._disk_usage: DiskUsageTuple = disk_usage(self.path)
self._uncompressed_source_file_dict: OrderedDict[
PathLike, PathLike
] = OrderedDict()
self._uncompressed_source_file_dict: OrderedDict[PathLike, PathLike] = (
OrderedDict()
)
self._pk_plaintext_dict: OrderedDict[PathLike, int] = OrderedDict()

def __len__(self) -> int:
Expand Down
1 change: 1 addition & 0 deletions alto2txt2fixture/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
a `docdict` configuration for running `newspaper` portions of `alto2txt2fixture`
"""

from typing import Final, Literal, TypeAlias

from .types import DataProviderFixtureDict, dotdict
Expand Down
1 change: 0 additions & 1 deletion alto2txt2fixture/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ class TranslatorTuple(NamedTuple):


class PlaintextFixtureFieldsDict(TypedDict):

"""A typed `dict` for Plaintext Fixutres to match `lwmdb.Fulltext` `model`
Attributes:
Expand Down
7 changes: 2 additions & 5 deletions alto2txt2fixture/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,11 @@


@overload
def get_now(as_str: Literal[True]) -> str:
...
def get_now(as_str: Literal[True]) -> str: ...


@overload
def get_now(as_str: Literal[False]) -> datetime.datetime:
...
def get_now(as_str: Literal[False]) -> datetime.datetime: ...


def get_now(as_str: bool = False) -> datetime.datetime | str:
Expand Down Expand Up @@ -1045,7 +1043,6 @@ def path_globs_to_tuple(


class DiskUsageTuple(NamedTuple):

"""Type hint for `nametuple` returned from `disk_usage`."""

total: int
Expand Down

0 comments on commit 0f3c9ca

Please sign in to comment.