From 64700adaa5305d5d5bbf8f646f13a5c5a9860cd8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 20:37:53 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- alto2txt2fixture/patterns.py | 1 + alto2txt2fixture/plaintext.py | 13 ++++++------- alto2txt2fixture/settings.py | 1 + alto2txt2fixture/types.py | 1 - alto2txt2fixture/utils.py | 7 ++----- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/alto2txt2fixture/patterns.py b/alto2txt2fixture/patterns.py index f315ec1..e807640 100644 --- a/alto2txt2fixture/patterns.py +++ b/alto2txt2fixture/patterns.py @@ -1,6 +1,7 @@ """ Useful regular expressions, intially just ``PUBLICATION_CODE``. """ + import re PUBLICATION_CODE = re.compile(r"\d{7}") diff --git a/alto2txt2fixture/plaintext.py b/alto2txt2fixture/plaintext.py index 19ed5fa..9bc0abd 100644 --- a/alto2txt2fixture/plaintext.py +++ b/alto2txt2fixture/plaintext.py @@ -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 @@ -77,7 +77,6 @@ class FulltextPathDict(TypedDict): @dataclass class PlainTextFixture: - """Manage exporting `plaintext` `alto2txt` results for `lwmdb.fulltext.models.Fulltext`. Attributes: @@ -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: diff --git a/alto2txt2fixture/settings.py b/alto2txt2fixture/settings.py index bf518c1..7433a81 100644 --- a/alto2txt2fixture/settings.py +++ b/alto2txt2fixture/settings.py @@ -19,6 +19,7 @@ a `docdict` configuration for running `newspaper` portions of `alto2txt2fixture` """ + from typing import Final, Literal, TypeAlias from .types import DataProviderFixtureDict, dotdict diff --git a/alto2txt2fixture/types.py b/alto2txt2fixture/types.py index b686e81..e1a6834 100644 --- a/alto2txt2fixture/types.py +++ b/alto2txt2fixture/types.py @@ -97,7 +97,6 @@ class TranslatorTuple(NamedTuple): class PlaintextFixtureFieldsDict(TypedDict): - """A typed `dict` for Plaintext Fixutres to match `lwmdb.Fulltext` `model` Attributes: diff --git a/alto2txt2fixture/utils.py b/alto2txt2fixture/utils.py index 2a3cd13..93f10d1 100644 --- a/alto2txt2fixture/utils.py +++ b/alto2txt2fixture/utils.py @@ -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: @@ -1045,7 +1043,6 @@ def path_globs_to_tuple( class DiskUsageTuple(NamedTuple): - """Type hint for `nametuple` returned from `disk_usage`.""" total: int