Skip to content
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
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions marcxml2csv/marcxml2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions marcxml2csv/picaxml2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down