From c14bd7e764f9c072908416ffe351713b01556dc9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 20:52:53 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v5.0.0) - [github.com/pycqa/isort: 5.10.1 → 6.0.1](https://github.com/pycqa/isort/compare/5.10.1...6.0.1) - https://github.com/pre-commit/mirrors-autopep8 → https://github.com/hhatto/autopep8 - [github.com/hhatto/autopep8: v1.7.0 → v2.3.2](https://github.com/hhatto/autopep8/compare/v1.7.0...v2.3.2) - [github.com/pre-commit/pygrep-hooks: v1.9.0 → v1.10.0](https://github.com/pre-commit/pygrep-hooks/compare/v1.9.0...v1.10.0) --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b306c72..2870eaf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v5.0.0 hooks: - id: trailing-whitespace exclude: | @@ -17,17 +17,17 @@ repos: - id: check-yaml - id: check-added-large-files - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 6.0.1 hooks: - id: isort name: isort (python) - - repo: https://github.com/pre-commit/mirrors-autopep8 - rev: v1.7.0 + - repo: https://github.com/hhatto/autopep8 + rev: v2.3.2 hooks: - id: autopep8 args: ["--max-line-length=120", "-i"] - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 + rev: v1.10.0 hooks: - id: python-use-type-annotations - repo: local From 15f47db132b12bd2b7aa762eebdbb7834f2c0983 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 20:55:25 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- marcxml2csv/marcxml2csv.py | 8 ++++---- marcxml2csv/picaxml2csv.py | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/marcxml2csv/marcxml2csv.py b/marcxml2csv/marcxml2csv.py index d7e0694..c4267f9 100755 --- a/marcxml2csv/marcxml2csv.py +++ b/marcxml2csv/marcxml2csv.py @@ -15,10 +15,9 @@ from pathlib import Path from typing import Iterator, Tuple -from hsciutil.fs import expand_globs - import click as click import tqdm +from hsciutil.fs import expand_globs from lxml import etree @@ -57,9 +56,10 @@ def convert(input: list[str], output: str) -> None: def iterate_zipfile(input: Path) -> Iterator[Tuple[Path, int]]: zf = zipfile.ZipFile(input) zp = zipfile.Path(zf) - return map(lambda filepath: (filepath,zf.getinfo(filepath.name).file_size), zp.iterdir()) + return map(lambda filepath: (filepath, zf.getinfo(filepath.name).file_size), zp.iterdir()) - input_files = list(itertools.chain.from_iterable(map(lambda path: iterate_zipfile(path) if path.name.endswith(".zip") else [(path, path.stat().st_size)], expand_globs(input, recurse=True)))) + input_files = list(itertools.chain.from_iterable(map(lambda path: iterate_zipfile(path) if path.name.endswith( + ".zip") else [(path, path.stat().st_size)], expand_globs(input, recurse=True)))) tsize = reduce(lambda tsize, path: tsize + path[1], input_files, 0) pbar = tqdm.tqdm(total=tsize, unit='b', unit_scale=True, unit_divisor=1024) processed_files_tsize = 0 diff --git a/marcxml2csv/picaxml2csv.py b/marcxml2csv/picaxml2csv.py index 784435f..ca66e6b 100755 --- a/marcxml2csv/picaxml2csv.py +++ b/marcxml2csv/picaxml2csv.py @@ -16,8 +16,8 @@ from typing import Iterator, Tuple import click as click -from hsciutil.fs import expand_globs import tqdm +from hsciutil.fs import expand_globs from lxml import etree @@ -45,9 +45,10 @@ def convert(input: list[str], output: str) -> None: def iterate_zipfile(input: Path) -> Iterator[Tuple[Path, int]]: zf = zipfile.ZipFile(input) zp = zipfile.Path(zf) - return map(lambda filepath: (filepath,zf.getinfo(filepath.name).file_size), zp.iterdir()) + return map(lambda filepath: (filepath, zf.getinfo(filepath.name).file_size), zp.iterdir()) - input_files = list(itertools.chain.from_iterable(map(lambda path: iterate_zipfile(path) if path.name.endswith(".zip") else [(path, path.stat().st_size)], expand_globs(input, recurse=True)))) + input_files = list(itertools.chain.from_iterable(map(lambda path: iterate_zipfile(path) if path.name.endswith( + ".zip") else [(path, path.stat().st_size)], expand_globs(input, recurse=True)))) tsize = reduce(lambda tsize, path: tsize + path[1], input_files, 0) pbar = tqdm.tqdm(total=tsize, unit='b', unit_scale=True, unit_divisor=1024) processed_files_tsize = 0