Skip to content

Commit f8cb61b

Browse files
authored
Merge branch 'main' into main
2 parents 57f628a + a36d1cf commit f8cb61b

7 files changed

+14
-17
lines changed

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repos:
1818
- id: check-added-large-files
1919
args: ['--maxkb=1000']
2020
- repo: https://github.com/psf/black
21-
rev: 24.10.0
21+
rev: 25.1.0
2222
hooks:
2323
- id: black
2424
args: [--target-version, py36]
@@ -28,13 +28,13 @@ repos:
2828
- id: blacken-docs
2929
additional_dependencies: [black==22.1.0]
3030
- repo: https://github.com/astral-sh/ruff-pre-commit
31-
rev: v0.7.4
31+
rev: v0.9.5
3232
hooks:
3333
- id: ruff
3434
args: ['--fix']
3535
exclude: "tests/"
3636
- repo: https://github.com/asottile/pyupgrade
37-
rev: v3.19.0
37+
rev: v3.19.1
3838
hooks:
3939
- id: pyupgrade
4040
args: [--py36-plus]
@@ -45,7 +45,7 @@ repos:
4545
args: ["--ignore", "E,W,F"]
4646

4747
- repo: https://github.com/pre-commit/mirrors-mypy
48-
rev: 'v1.13.0'
48+
rev: 'v1.15.0'
4949
hooks:
5050
- id: mypy
5151
files: ^pdfly/.*

make_release.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ def get_formatted_changes(git_tag: str) -> Tuple[str, str]:
259259
if grouped:
260260
output += "\n### Other\n"
261261
output_with_user += "\n### Other\n"
262-
for prefix in grouped:
263-
for commit_dict in grouped[prefix]:
262+
for prefix, commit_dicts in grouped.items():
263+
for commit_dict in commit_dicts:
264264
output += f"- {prefix}: {commit_dict['msg']}\n"
265265
output_with_user += f"- {prefix}: {commit_dict['msg']} by @{commit_dict['author']}\n"
266266

pdfly/cli.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ def update_offsets(
284284
resolve_path=True,
285285
),
286286
],
287-
file_out: Path = typer.Option(None, "-o", "--output"),
287+
file_out: Annotated[
288+
Path, typer.Option("-o", "--output") # noqa
289+
] = None, # type: ignore
288290
encoding: str = typer.Option(
289291
"ISO-8859-1",
290292
help="Encoding used to read and write the files, e.g. UTF-8.",

pyproject.toml

-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ ignore = [
8787
"N806", # Variable `NO` in function should be lowercase
8888
"N814", # Camelcase `PageAttributes` imported as constant `PG`
8989
"N817", # CamelCase `PagesAttributes` imported as acronym `PA`
90-
"ANN101", # annotating 'self' seems weird (at least before 3.11)
91-
"ANN102", # Missing type annotation for `cls` in classmethod
9290
"ANN204", # Missing return type annotation for special method `__init__`
9391
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
9492
"BLE", # we want to capture Exception sometimes
-3 Bytes
Binary file not shown.

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
with open(VERSIONFILE) as fp:
99
verstrline = fp.read()
1010
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
11-
mo = re.search(VSRE, verstrline, re.M)
11+
mo = re.search(VSRE, verstrline, re.MULTILINE)
1212
if mo:
1313
verstr = mo.group(1)
1414
else:

tests/test_update_offsets.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,25 @@
1414

1515
def test_update_offsets(capsys, tmp_path: Path) -> None:
1616
# Arrange
17-
input = str(RESOURCES_ROOT / "file-with-invalid-offsets.pdf")
17+
input = RESOURCES_ROOT / "file-with-invalid-offsets.pdf"
1818
file_expected = str(RESOURCES_ROOT / "file-with-fixed-offsets.pdf")
19-
output = tmp_path / "file-with-offsets-out.pdf"
20-
assert not output.exists()
2119

2220
# Act
2321
exit_code = run_cli(
2422
[
2523
"update-offsets",
2624
str(input),
27-
str(output),
2825
]
2926
)
3027

3128
# Assert
3229
captured = capsys.readouterr()
3330
assert exit_code == 0, captured
3431
assert not captured.err
35-
assert re.search(r"Wrote\s+" + re.escape(str(output)), captured.out)
36-
assert output.exists()
32+
assert re.search(r"Wrote\s+" + re.escape(str(input)), captured.out)
3733
with open(file_expected, encoding="iso-8859-1") as file_exp:
3834
lines_exp = file_exp.readlines()
39-
with open(output, encoding="iso-8859-1") as file_act:
35+
with input.open(encoding="iso-8859-1") as file_act:
4036
lines_act = file_act.readlines()
4137
assert len(lines_exp) == len(
4238
lines_act
@@ -92,6 +88,7 @@ def test_update_offsets_on_all_reference_files(
9288
"--encoding",
9389
"iso-8859-1",
9490
input_pdf_filepath,
91+
"-o",
9592
str(output_pdf_filepath),
9693
]
9794
)

0 commit comments

Comments
 (0)