Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #69

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/psf/black
rev: "23.9.1"
rev: "24.10.0"
hooks:
- id: black-jupyter

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -28,33 +28,33 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.3"
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
args: [--prose-wrap=never]

- repo: https://github.com/python-poetry/poetry
rev: "1.6.0" # add version here
rev: "1.8.0" # add version here
hooks:
- id: poetry-check
- id: poetry-lock
args: ["--check", "--no-update"]

- repo: https://github.com/hadialqattan/pycln
rev: v2.3.0
rev: v2.4.0
hooks:
- id: pycln
args: [--config=pyproject.toml]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.6.0"
rev: "v1.13.0"
hooks:
- id: mypy
args: [--config-file, ./pyproject.toml]
Expand Down
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
Loading