Skip to content

Commit d5d1964

Browse files
DOC: Fix typos and other possible issues detected by PyCharm (#3381)
1 parent ac506d9 commit d5d1964

30 files changed

+151
-155
lines changed

.github/workflows/github-ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ jobs:
220220
- uses: actions/checkout@v4
221221
- uses: actions/setup-python@v5
222222
with:
223-
# Use latest Python, so it understands all syntax.
223+
# Use the latest Python, so it understands all syntax.
224224
python-version: ${{ env.PYTHON_LATEST }}
225225

226226
- run: python -m pip install --upgrade coverage[toml]

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# This action assumes that there is a REL-commit which already has a
2-
# Markdown-formatted git tag. Hence the CHANGELOG is already adjusted
2+
# Markdown-formatted git tag. Hence, the CHANGELOG is already adjusted,
33
# and it's decided what should be in the release.
44
# This action only ensures the release is done with the proper contents
5-
# and that it's announced with a Github release.
5+
# and that it's announced with a GitHub release.
66
name: Create git tag
77
on:
88
push:

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
}
6565

6666
nitpick_ignore_regex = [
67-
# For reasons unclear at this stage the io module prefixes everything with _io
67+
# For reasons unclear at this stage, the io module prefixes everything with _io
6868
# and this confuses sphinx
6969
(
7070
r"py:class",
@@ -131,4 +131,4 @@
131131
napoleon_google_docstring = True
132132
napoleon_numpy_docstring = False # Explicitly prefer Google style docstring
133133
napoleon_use_param = True # for type hint support
134-
napoleon_use_rtype = False # False so the return type is inline with the description.
134+
napoleon_use_rtype = False # False, so the return type is inline with the description.

docs/dev/cmaps.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ CMapName currentdict /CMap defineresource pop
2929

3030
## codespacerange
3131

32-
A codespacerange maps a complete sequence of bytes to a range of unicode glyphs.
32+
A codespacerange maps a complete sequence of bytes to a range of Unicode glyphs.
3333
It defines a starting point:
3434

3535
```text
3636
1 beginbfchar
3737
<1B> <FB00>
3838
```
3939

40-
That means that `1B` (Hex for 27) maps to the unicode character [`FB00`](https://unicode-table.com/en/FB00/) - the ligature ff (two lowercase f's).
40+
That means that `1B` (Hex for 27) maps to the Unicode character [`FB00`](https://unicode-table.com/en/FB00/) - the ligature ff (two lowercase f's).
4141

4242
The two numbers in `begincodespacerange` mean that it starts with an offset of
4343
0 (hence from `1B ➜ FB00`) up to an offset of FF (dec: 255), hence 1B+FF = 282
@@ -49,4 +49,4 @@ Within the text stream, there is
4949
(The)-342(mis\034ts.)
5050
```
5151

52-
`\034 ` is octal for 28 decimal.
52+
`\034 ` is octal for the decimal value 28.

docs/dev/deprecations.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
pypdf strives to be an excellent library for its current users and for new
44
ones. We are careful with introducing potentially breaking changes, but we
5-
will do them if they provide value for the community on the long run.
5+
will do them if they provide value for the community in the long run.
66

77
We hope and think that deprecations will not happen frequently. If they do,
88
users can rely on the following procedure.
@@ -20,8 +20,8 @@ If you are using [Poetry](https://pypi.org/project/poetry/) it is done with the
2020

2121
## How pypdf deprecates features
2222

23-
Assume the current version of pypdf is `x.y.z`. After a discussion (e.g. via
24-
GitHub issues) we decided to remove a class / function / method. This is how
23+
Assume the current version of pypdf is `x.y.z`. After a discussion (e.g., via
24+
GitHub issues), we decided to remove a class / function / method. This is how
2525
we do it:
2626

2727
1. `x.y.(z+1)`: Add a DeprecationWarning. If there is a replacement,
@@ -35,7 +35,7 @@ we do it:
3535
The CHANGELOG informs about it.
3636
3. `(x+2).0.0`: The DeprecationErrors are removed.
3737

38-
This means the users have 3 warnings in the CHANGELOG, a DeprecationWarning
38+
This means the users have three warnings in the CHANGELOG, a DeprecationWarning
3939
until the next major release and a DeprecationError until the major release
4040
after that.
4141

docs/dev/intro.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ most cases we typically want to test for. The `sample-files` might cover a lot
2323
more edge cases, the behavior we get when file sizes get bigger, different
2424
PDF producers.
2525

26-
In order to get the sample-files folder, you need to execute:
26+
To get the sample-files folder, you need to execute:
2727

2828
```
2929
git submodule update --init
@@ -59,26 +59,26 @@ BODY
5959

6060
The `PREFIX` can be:
6161

62-
* `SEC`: Security improvements. Typically an infinite loop that was possible.
63-
* `BUG`: A bug was fixed. Likely there is one or multiple issues. Then write in
62+
* `SEC`: Security improvements. Typically, an infinite loop that was possible.
63+
* `BUG`: A bug was fixed. Likely there are one or multiple issues. Then write in
6464
the `BODY`: `Closes #123` where 123 is the issue number on GitHub.
6565
It would be absolutely amazing if you could write a regression test in those
6666
cases. That is a test that would fail without the fix.
6767
A bug is always an issue for pypdf users - test code or CI that was fixed is
6868
not considered a bug here.
6969
* `ENH`: A new feature! Describe in the body what it can be used for.
70-
* `DEP`: A deprecation. Either marking something as "this is going to be removed"
70+
* `DEP`: Deprecation. Either marking something as "this is going to be removed"
7171
or actually removing it.
7272
* `PI`: A performance improvement. This could also be a reduction in the
7373
file size of PDF files generated by pypdf.
7474
* `ROB`: A robustness change. Dealing better with broken PDF files.
7575
* `DOC`: A documentation change.
7676
* `TST`: Adding or adjusting tests.
77-
* `DEV`: Developer experience improvements, e.g. pre-commit or setting up CI.
78-
* `MAINT`: Quite a lot of different stuff. Performance improvements are for sure
77+
* `DEV`: Developer experience improvements, e.g., pre-commit or setting up CI.
78+
* `MAINT`: Quite a lot of different stuff. Performance improvements are, for sure,
7979
the most interesting changes in here. Refactorings as well.
8080
* `STY`: A style change. Something that makes pypdf code more consistent.
81-
Typically a small change. It could also be better error messages for
81+
Typically, a small change. It could also be better error messages for
8282
end users.
8383

8484
The prefix is used to generate the CHANGELOG. Every PR must have exactly one -
@@ -89,13 +89,13 @@ your PR.
8989

9090
Smaller Pull Requests (PRs) are preferred as it's typically easier to merge
9191
them. For example, if you have some typos, a few code-style changes, a new
92-
feature, and a bug-fix, that could be 3 or 4 PRs.
92+
feature, and a bug-fix, that could be three or four PRs.
9393

94-
A PR must be complete. That means if you introduce a new feature it must be
94+
A PR must be complete. That means if you introduce a new feature, it must be
9595
finished within the PR and have a test for that feature.
9696

9797
## Benchmarks
9898

99-
We need to keep an eye on performance and thus we have a few benchmarks.
99+
We need to keep an eye on performance, and thus we have a few benchmarks.
100100

101101
See [py-pdf.github.io/pypdf/dev/bench](https://py-pdf.github.io/pypdf/dev/bench/)

docs/dev/pypdf-writing.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ our choices.
4343
with a serialize method which roughly maps to `pypdf.PdfObject.write_to_stream`.
4444
Some other similarities include:
4545

46-
* [fpdf.output.OutputProducer.buffersize](https://github.com/PyFPDF/fpdf2/blob/master/fpdf/output.py#L370-L485) vs {py:meth}`pypdf.PdfWriter.write_stream <pypdf.PdfWriter.write_stream>`
47-
* [fpdpf.syntax.Name](https://github.com/PyFPDF/fpdf2/blob/master/fpdf/syntax.py#L124) vs {py:class}`pypdf.generic.NameObject <pypdf.generic.NameObject>`
48-
* [fpdf.syntax.build_obj_dict](https://github.com/PyFPDF/fpdf2/blob/master/fpdf/syntax.py#L222) vs {py:class}`pypdf.generic.DictionaryObject <pypdf.generic.DictionaryObject>`
49-
* [fpdf.structure_tree.NumberTree](https://github.com/PyFPDF/fpdf2/blob/master/fpdf/structure_tree.py#L17) vs
50-
{py:class}`pypdf.generic.TreeObject <pypdf.generic.TreeObject>`
46+
* [fpdf.output.OutputProducer.buffersize](https://github.com/PyFPDF/fpdf2/blob/master/fpdf/output.py#L370-L485) vs. {py:meth}`pypdf.PdfWriter.write_stream <pypdf.PdfWriter.write_stream>`
47+
* [fpdpf.syntax.Name](https://github.com/PyFPDF/fpdf2/blob/master/fpdf/syntax.py#L124) vs. {py:class}`pypdf.generic.NameObject <pypdf.generic.NameObject>`
48+
* [fpdf.syntax.build_obj_dict](https://github.com/PyFPDF/fpdf2/blob/master/fpdf/syntax.py#L222) vs. {py:class}`pypdf.generic.DictionaryObject <pypdf.generic.DictionaryObject>`
49+
* [fpdf.structure_tree.NumberTree](https://github.com/PyFPDF/fpdf2/blob/master/fpdf/structure_tree.py#L17) vs. {py:class}`pypdf.generic.TreeObject <pypdf.generic.TreeObject>`
5150

5251

5352
### pdfrw

docs/dev/releasing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A `pypdf` release contains the following artifacts:
66
* A [release commit](https://github.com/py-pdf/pypdf/commit/91391b18bb8ec9e6e561e2795d988e8634a01a50)
77
* Containing a changelog update
88
* A new [git tag](https://github.com/py-pdf/pypdf/tags)
9-
* A [Github release](https://github.com/py-pdf/pypdf/releases/tag/3.15.0)
9+
* A [GitHub release](https://github.com/py-pdf/pypdf/releases/tag/3.15.0)
1010

1111
## Who does it?
1212

@@ -47,7 +47,7 @@ The release contains the following steps:
4747
4. Wait for the approval of another eligible maintainer.
4848
5. Merge the pull request with the name being the PR title and the body being
4949
the content of `RELEASE_COMMIT_MSG.md`.
50-
7. CI now builds a source and a wheels package which it pushes to PyPI. It also
50+
6. CI now builds a source and a wheels package which it pushes to PyPI. It also
5151
creates the corresponding tag and a GitHub release.
5252

5353
### The Release Tag

docs/dev/testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
pypdf uses [`pytest`](https://docs.pytest.org/en/7.1.x/) for testing.
44

5-
To run the tests you need to install the CI (Continuous Integration) requirements by running `pip install -r requirements/ci.txt` or
5+
To run the tests, you need to install the CI (Continuous Integration) requirements by running `pip install -r requirements/ci.txt` or
66
`pip install -r requirements/ci-3.11.txt` if running Python ≥ 3.11.
77

88
## Deselecting groups of tests
99

1010
pypdf makes use of the following pytest markers:
1111

1212
* `slow`: Tests that require more than 5 seconds.
13-
* `samples`: Tests that require the [the `sample-files` git submodule](https://github.com/py-pdf/sample-files) to be initialized. As of October 2022, this is about 25 MB.
13+
* `samples`: Tests that require [the `sample-files` git submodule](https://github.com/py-pdf/sample-files) to be initialized. As of October 2022, this is about 25 MB.
1414
* `enable_socket`: Tests that download PDF documents. They are stored locally and thus only need to be downloaded once. As of October 2022, this is about 200 MB.
1515
* To successfully run the tests, please download most of the documents beforehand: `python -c "from tests import download_test_pdfs; download_test_pdfs()"`
1616

docs/meta/changelog-v1.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ large PDF files (#808) 🎉
255255
### Maintenance (MAINT)
256256
- Validate PDF magic byte in strict mode (#814)
257257
- Make PdfFileMerger.addBookmark() behave life PdfFileWriters' (#339)
258-
- Quadratic runtime while parsing reduced to linear (#808)
258+
- Quadratic runtime while parsing reduced to linear (#808)
259259

260260
### Testing (TST)
261261
- Newlines in text extraction (#807)
@@ -403,7 +403,7 @@ large PDF files (#808) 🎉
403403
- BUG: Error in Chinese character encoding (#463)
404404
- BUG: Code duplication in Scripts/2-up.py
405405
- ROBUST: Guard 'obj.writeToStream' with 'if obj is not None'
406-
- ROBUST: Ignore a /Prev entry with the value 0 in the trailer
406+
- ROBUST: Ignore a /Prev entry with value 0 in the trailer
407407
- MAINT: Remove Sample_Code (#726)
408408
- TST: Close file handle in test_writer (#722)
409409
- TST: Fix test_get_images (#730)
@@ -449,15 +449,14 @@ Features:
449449

450450
### Tests and Test setup (TST)
451451

452-
- Add Github Action which automatically run unit tests via pytest and
452+
- Add GitHub Action which automatically runs unit tests via pytest and
453453
static code analysis with Flake8 (#660)
454454
- Add several unit tests (#661, #663)
455455
- Add .coveragerc to create coverage reports
456456

457457
### Developer Experience Improvements (DEV)
458458

459-
- Pre commit: Developers can now `pre-commit install` to avoid tiny issues
460-
like trailing whitespaces
459+
- Pre commit: Developers can now `pre-commit install` to avoid tiny issues like trailing whitespaces
461460

462461
### Miscellaneous
463462

0 commit comments

Comments
 (0)