Skip to content

Commit 2f00ca0

Browse files
committed
MAINT: Update dependencies
1 parent d8bbb9c commit 2f00ca0

File tree

11 files changed

+168
-115
lines changed

11 files changed

+168
-115
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repos:
1818
exclude: "docs/make.bat"
1919
- id: trailing-whitespace
2020
- repo: https://github.com/psf/black
21-
rev: 25.12.0
21+
rev: 26.3.1
2222
hooks:
2323
- id: black
2424
args: [--target-version, py36]
@@ -28,7 +28,7 @@ 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.14.13
31+
rev: v0.15.6
3232
hooks:
3333
- id: ruff
3434
args: ['--fix']

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ maint:
33
python -m pip install --upgrade .
44
python -m pip lock --group dev --group docs .
55
uv pip install -r pylock.toml
6+
git submodule update --remote
67

78
release:
89
python make_release.py

docs/user/subcommand-cat.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ pdfly cat input.pdf 5 -o out.pdf
8686

8787
Note that it is `5`, because the page indices always start at 0.
8888

89+
### Specify a negative index
90+
91+
Get the last page of a PDF:
92+
93+
```
94+
pdfly cat -o out.pdf input.pdf -- -1
95+
```
96+
97+
`--` must be used to escape negative indices.
98+
8999
### Concatenate two PDFs
90100

91101
Just combine two PDF files so that the pages come right after each other:

pdfly/cli.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,16 @@ def cat(
121121
resolve_path=True,
122122
),
123123
],
124-
output: Path = typer.Option(..., "-o", "--output"), # noqa
125124
fn_pgrgs: list[str] | None = typer.Argument( # noqa: B008
126-
None, help="filenames and/or page ranges"
127-
),
128-
verbose: bool = typer.Option(
129-
False, help="show page ranges as they are being read"
125+
None, allow_dash=True, help="filenames and/or page ranges"
130126
),
127+
output: Path = typer.Option(..., "-o", "--output"), # noqa
131128
password: str = typer.Option(
132129
None, help="Document's user or owner password."
133130
),
131+
verbose: bool = typer.Option(
132+
False, help="show page ranges as they are being read"
133+
),
134134
) -> None:
135135
pdfly.cat.main(
136136
filename, fn_pgrgs, output=output, verbose=verbose, password=password

pdfly/metadata.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def main(pdf: Path, output: OutputOptions) -> None:
5353
v_value=reader._encryption.V,
5454
revision=reader._encryption.R,
5555
)
56-
if reader.is_encrypted and reader._encryption
56+
if reader._encryption
5757
else None
5858
),
5959
pdf_file_version=reader.stream.read(8).decode("utf-8"),
@@ -66,21 +66,12 @@ def main(pdf: Path, output: OutputOptions) -> None:
6666
)
6767
else:
6868
info = reader.metadata
69-
7069
reader.stream.seek(0)
7170
pdf_file_version = reader.stream.read(8).decode("utf-8")
7271
pdf_stat = pdf.stat()
7372
pdf_id = reader.trailer.get("/ID")
7473
meta = MetaInfo(
7574
pages=len(reader.pages),
76-
encryption=(
77-
EncryptionData(
78-
v_value=reader._encryption.V, # type: ignore
79-
revision=reader._encryption.R, # type: ignore
80-
)
81-
if reader.is_encrypted and reader._encryption
82-
else None
83-
),
8475
page_mode=reader.page_mode,
8576
pdf_file_version=pdf_file_version,
8677
page_layout=reader.page_layout,
@@ -188,7 +179,6 @@ def main(pdf: Path, output: OutputOptions) -> None:
188179
os_table.add_row(
189180
"Access Time", f"{meta.access_time:%Y-%m-%d %H:%M:%S}"
190181
)
191-
192182
console = Console()
193183
console.print(os_table)
194184
console.print(table)

pdfly/sign.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _sign_pdf_contents(
103103
)
104104
pdf.sign(
105105
key=key,
106-
cert=cert,
106+
cert=cert, # type: ignore
107107
extra_certs=extra_certs,
108108
hashalgo=hashalgo,
109109
signing_time=sign_time,
@@ -135,7 +135,7 @@ def _sign_pdf_contents(
135135
signer,
136136
content_to_sign,
137137
key,
138-
cert,
138+
cert, # type: ignore
139139
extra_certs,
140140
hashalgo,
141141
sign_time,

pdfly/x2pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def image_to_pdf(filepath: Path) -> BytesIO:
2222
w, h = cover.size
2323
width, height = px_to_mm(w), px_to_mm(h)
2424
pdf = FPDF(unit="mm")
25-
pdf.add_page(format=(width, height))
25+
pdf.add_page(format=(width, height)) # type: ignore
2626
pdf.image(filepath, x=0, y=0)
2727
return BytesIO(pdf.output())
2828

0 commit comments

Comments
 (0)