Skip to content

Commit 8dbfeba

Browse files
MAINT: Fix typos found by codespell (#2549)
1 parent 3f21f92 commit 8dbfeba

25 files changed

+77
-76
lines changed

CHANGELOG.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ nobody will be affected though. Hence only the patch update.
243243
- Avoid endless recursion of reading damaged PDF file (#2093)
244244

245245
### Performance Improvements (PI)
246-
- Re-use content stream (#2101)
246+
- Reuse content stream (#2101)
247247

248248
### Maintenance (MAINT)
249249
- Make ParseError inherit from PyPdfError (#2097)
@@ -411,7 +411,7 @@ nobody will be affected though. Hence only the patch update.
411411

412412
### New Features (ENH)
413413
- Simplify metadata input (Document Information Dictionary) (#1851)
414-
- Extend cmap compatibilty to GBK_EUC_H/V (#1812)
414+
- Extend cmap compatibility to GBK_EUC_H/V (#1812)
415415

416416
### Bug Fixes (BUG)
417417
- Prevent infinite loop when no character follows after a comment (#1828)
@@ -432,7 +432,7 @@ nobody will be affected though. Hence only the patch update.
432432
- Refactor internal Encryption class (#1821)
433433
- Add R parameter to generate_values (#1820)
434434
- Make encryption_key parameter of write_to_stream optional (#1819)
435-
- Prepare for adding AES enryption support (#1818)
435+
- Prepare for adding AES encryption support (#1818)
436436

437437
[Full Changelog](https://github.com/py-pdf/pypdf/compare/3.8.1...3.9.0)
438438

@@ -665,7 +665,7 @@ NOTICE: pypdf changed the way it represents numbers parsed from PDF files.
665665
## Version 3.2.0, 2022-12-31
666666

667667
### Performance Improvement (PI)
668-
- Help the specializing adpative interpreter (#1522)
668+
- Help the specializing adaptive interpreter (#1522)
669669

670670
### New Features (ENH)
671671
- Add support for page labels (#1519)
@@ -999,12 +999,12 @@ BUG: Add PyPDF2.generic to PyPI distribution
999999

10001000
### Documentation (DOC)
10011001
- Update changelog url in package metadata (#1180)
1002-
- Mantion camelot for table extraction (#1179)
1002+
- Mention camelot for table extraction (#1179)
10031003
- Mention pyHanko for signing PDF documents (#1178)
10041004
- Weow have CMAP support since a while (#1177)
10051005

10061006
### Maintenance (MAINT)
1007-
- Consistant usage of warnings / log messages (#1164)
1007+
- Consistent usage of warnings / log messages (#1164)
10081008
- Consistent terminology for outline items (#1156)
10091009

10101010

@@ -1082,7 +1082,7 @@ BUG: Add PyPDF2.generic to PyPI distribution
10821082

10831083
### Code Style (STY)
10841084
- Fixing typos (#1137)
1085-
- Re-use code via get_outlines_property in tests (#1130)
1085+
- Reuse code via get_outlines_property in tests (#1130)
10861086

10871087
[Full Changelog](https://github.com/py-pdf/PyPDF2/compare/2.6.0...2.7.0)
10881088

@@ -1246,7 +1246,7 @@ BUG: Add PyPDF2.generic to PyPI distribution
12461246

12471247
## Version 2.3.1, 2022-06-19
12481248

1249-
BUG: Forgot to add the interal `_codecs` subpackage.
1249+
BUG: Forgot to add the internal `_codecs` subpackage.
12501250

12511251
[Full Changelog](https://github.com/py-pdf/PyPDF2/compare/2.3.0...2.3.1)
12521252

@@ -1285,7 +1285,7 @@ The highlight of this release is improved support for file encryption
12851285
- Fix corrupted (wrongly) linear PDF (#1008)
12861286

12871287
### Maintenance (MAINT)
1288-
- Move PDF_Samples folder into ressources
1288+
- Move PDF_Samples folder into resources
12891289
- Fix typos (#1007)
12901290

12911291
### Testing (TST)

docs/meta/changelog-v1.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,13 @@ large PDF files (#808) 🎉
295295
### Bug Fixes (BUG)
296296
- Clip by trimBox when merging pages, which would otherwise be ignored (#240)
297297
- Add overwriteWarnings parameter PdfFileMerger (#243)
298-
- IndexError for getPage() of decryped file (#359)
298+
- IndexError for getPage() of decrypted file (#359)
299299
- Handle cases where decodeParms is an ArrayObject (#405)
300300
- Updated PDF fields don't show up when page is written (#412)
301301
- Set Linked Form Value (#414)
302302
- Fix zlib -5 error for corrupt files (#603)
303303
- Fix reading more than last1K for EOF (#642)
304-
- Acciental import
304+
- Accidental import
305305

306306
### Robustness (ROB)
307307
- Allow extra whitespace before "obj" in readObjectHeader (#567)
@@ -788,7 +788,7 @@ UPCOMING:
788788

789789
## Version 1.18, 2013-08-19
790790

791-
- Fixed a bug where older verions of objects were incorrectly added to the
791+
- Fixed a bug where older versions of objects were incorrectly added to the
792792
cache, resulting in outdated or missing pages, images, and other objects
793793
(from speedplane)
794794

docs/meta/taking-ownership.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ that if I become unavailable, e.g. due to severe health issues.
66

77
This currently is just an abstract scenario. I'm fine and I will likely do this
88
for several more years, but I have seen how projects stand still for many years
9-
because of the maintainer becomming inactive.
9+
because of the maintainer becoming inactive.
1010

1111
I've also followed the [GitHub Deceased User Policy](https://docs.github.com/en/site-policy/other-site-policies/github-deceased-user-policy)
1212
and added a [pre-designated successor](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-access-to-your-personal-repositories/maintaining-ownership-continuity-of-your-personal-accounts-repositories).

docs/modules/PdfDocCommon.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
**PdfDocCommon** is an abstract class which is inherited by **PdfReader** and **PdfWriter**
44

5-
Where indentified in the API, you can use any of the derivated class.
5+
Where identified in the API, you can use any of the derived class.

docs/user/add-watermark.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Example of watermark:
6969
## Stamping images directly
7070

7171
The above code only works for stamps that are already in PDF format.
72-
However, you can easilly convert an image to PDF image using
72+
However, you can easily convert an image to PDF image using
7373
[Pillow](https://pypi.org/project/Pillow/).
7474

7575

docs/user/cropping-and-transforming.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ writer.add_page(page3)
2626

2727
# add some Javascript to launch the print window on opening this PDF.
2828
# the password dialog may prevent the print dialog from being shown,
29-
# comment the the encription lines, if that's the case, to try this out:
29+
# comment the the encryption lines, if that's the case, to try this out:
3030
writer.add_js("this.print({bUI:true,bSilent:false,bShrinkToFit:true});")
3131

3232
# write to document-output.pdf
@@ -212,7 +212,7 @@ pypdf._page.MERGE_CROP_BOX = "trimbox"
212212

213213
# Transforming several copies of the same page
214214

215-
We have designed the following business card (A8 format) to advertize our new startup.
215+
We have designed the following business card (A8 format) to advertise our new startup.
216216

217217
![](nup-source.png)
218218

docs/user/forms.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ To flesh out this overview:
6464
- `/V`: Field Value
6565
- `/DV` : Default Field Value (used when resetting a form for example)
6666
* In order to streamline readability, _Field_ Objects and _Widget_ Objects can be fused housing all properties.
67-
* Fields can be organised hierarchically, id est one field can be placed under another. In such instances, the `/Parent` will have an IndirectObject providing Bottom-Up links and `/Childs` is an array carrying IndirectObjects for Top-Down navigation; _Widget_ Objects are still required for visual rendering. To call upon them, use the *fully qualified field name* (where all the individual names of the parent objects are seperated by `.`)
67+
* Fields can be organised hierarchically, id est one field can be placed under another. In such instances, the `/Parent` will have an IndirectObject providing Bottom-Up links and `/Kids` is an array carrying IndirectObjects for Top-Down navigation; _Widget_ Objects are still required for visual rendering. To call upon them, use the *fully qualified field name* (where all the individual names of the parent objects are separated by `.`)
6868

6969
For instance take two (visual) fields both called _city_, but attached below _sender_ and _receiver_; the corresponding full names will be _sender.city_ and _receiver.city_.
70-
* When a field is repeated on multiple pages, the Field Object will have many _Widget_ Objects in `/Childs`. These objects are pure _widgets_, containing no _field_ specific data.
70+
* When a field is repeated on multiple pages, the Field Object will have many _Widget_ Objects in `/Kids`. These objects are pure _widgets_, containing no _field_ specific data.
7171
* If Fields stores only hidden values, no _Widgets_ are required.
7272

7373
In _pypdf_ fields are extracted from the `/Fields` array:

docs/user/pdfa-compliance.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ against future technological changes and obsolescence.
2222
improvements over PDF/A-1, while maintaining compatibility with PDF/A-1b
2323
(Level B) documents.
2424
* **Level B** (Basic): Like PDF/A-1b, but support for PDF 1.7 features such
25-
as transparancy layers.
25+
as transparency layers.
2626
* **Level U** (Unicode): Ensures Unicode mapping without the full
2727
accessibility requirements of PDF/A-1a (Level A).
2828
* **Level A** (Accessible): Similar to PDF/A-1a

docs/user/suppress-warnings.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pypdf makes use of 3 mechanisms to show that something went wrong:
2020

2121
## Exceptions
2222

23-
Exeptions need to be catched if you want to handle them. For example, you could
23+
Exceptions need to be caught if you want to handle them. For example, you could
2424
want to read the text from a PDF as a part of a search function.
2525

2626
Most PDF files don't follow the specifications. In this case pypdf needs to

pypdf/_doc_common.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def named_destinations(self) -> Dict[str, Any]:
380380
return self._get_named_destinations()
381381

382382
def get_named_dest_root(self) -> ArrayObject:
383-
nd = ArrayObject()
383+
named_dest = ArrayObject()
384384
if CA.NAMES in self.root_object and isinstance(
385385
self.root_object[CA.NAMES], DictionaryObject
386386
):
@@ -392,15 +392,15 @@ def get_named_dest_root(self) -> ArrayObject:
392392
dests_ref = dests.indirect_reference
393393
if CA.NAMES in dests:
394394
# TABLE 3.33 Entries in a name tree node dictionary
395-
nd = cast(ArrayObject, dests[CA.NAMES])
395+
named_dest = cast(ArrayObject, dests[CA.NAMES])
396396
else:
397-
nd = ArrayObject()
398-
dests[NameObject(CA.NAMES)] = nd
397+
named_dest = ArrayObject()
398+
dests[NameObject(CA.NAMES)] = named_dest
399399
elif hasattr(self, "_add_object"):
400400
dests = DictionaryObject()
401401
dests_ref = self._add_object(dests)
402402
names[NameObject(CA.DESTS)] = dests_ref
403-
dests[NameObject(CA.NAMES)] = nd
403+
dests[NameObject(CA.NAMES)] = named_dest
404404

405405
elif hasattr(self, "_add_object"):
406406
names = DictionaryObject()
@@ -409,9 +409,9 @@ def get_named_dest_root(self) -> ArrayObject:
409409
dests = DictionaryObject()
410410
dests_ref = self._add_object(dests)
411411
names[NameObject(CA.DESTS)] = dests_ref
412-
dests[NameObject(CA.NAMES)] = nd
412+
dests[NameObject(CA.NAMES)] = named_dest
413413

414-
return nd
414+
return named_dest
415415

416416
## common
417417
def _get_named_destinations(
@@ -1208,6 +1208,7 @@ def decode_permissions(
12081208
"copy": UserAccessPermissions.EXTRACT,
12091209
"annotations": UserAccessPermissions.ADD_OR_MODIFY,
12101210
"forms": UserAccessPermissions.FILL_FORM_FIELDS,
1211+
# Do not fix typo, as part of official, but deprecated API.
12111212
"accessability": UserAccessPermissions.EXTRACT_TEXT_AND_GRAPHICS,
12121213
"assemble": UserAccessPermissions.ASSEMBLE_DOC,
12131214
"print_high_quality": UserAccessPermissions.PRINT_TO_REPRESENTATION,

pypdf/_merger.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ def write(self, fileobj: Union[Path, StrByteType]) -> None:
306306
def close(self) -> None:
307307
"""Shut all file descriptors (input and output) and clear all memory usage."""
308308
self.pages = []
309-
for fo, _reader in self.inputs:
310-
fo.close()
309+
for file_descriptor, _reader in self.inputs:
310+
file_descriptor.close()
311311

312312
self.inputs = []
313313
self.output = None

pypdf/_page.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ def replace_contents(
924924
else:
925925
content.indirect_reference = self[
926926
PG.CONTENTS
927-
].indirect_reference # TODO: in a future may required generation managment
927+
].indirect_reference # TODO: in a future may required generation management
928928
try:
929929
self.indirect_reference.pdf._objects[
930930
content.indirect_reference.idnum - 1 # type: ignore
@@ -1582,7 +1582,7 @@ def _extract_text(
15821582
# /Resources can be inherited sometimes so we look to parents
15831583
objr = objr["/Parent"].get_object()
15841584
# if no parents we will have no /Resources will be available
1585-
# => an exception wil be raised
1585+
# => an exception will be raised
15861586
resources_dict = cast(DictionaryObject, objr[PG.RESOURCES])
15871587
except Exception:
15881588
# no resources means no text is possible (no font) we consider the

pypdf/_text_extraction/_layout_mode/_text_state_manager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def set_state_param(self, op: bytes, value: Union[float, List[Any]]) -> None:
5252
Args:
5353
op: operator read from PDF stream as bytes. No action is taken
5454
for unsupported operators (see supported operators above).
55-
value (float | List[Any]): new paramater value. If a list,
55+
value (float | List[Any]): new parameter value. If a list,
5656
value[0] is used.
5757
"""
5858
if op not in [b"Tc", b"Tz", b"Tw", b"TL", b"Ts"]:

pypdf/_writer.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def set_need_appearances_writer(self, state: bool = True) -> None:
413413
414414
The "NeedAppearances" flag indicates whether the appearance dictionary
415415
for form fields should be automatically generated by the PDF viewer or
416-
if the embedded appearence should be used.
416+
if the embedded appearance should be used.
417417
418418
Args:
419419
state: The actual value of the NeedAppearances flag.
@@ -602,7 +602,7 @@ def add_js(self, javascript: str) -> None:
602602
>>> output.add_js("this.print({bUI:true,bSilent:false,bShrinkToFit:true});")
603603
# Example: This will launch the print window when the PDF is opened.
604604
"""
605-
# Names / JavaScript prefered to be able to add multiple scripts
605+
# Names / JavaScript preferred to be able to add multiple scripts
606606
if "/Names" not in self._root_object:
607607
self._root_object[NameObject(CA.NAMES)] = DictionaryObject()
608608
names = cast(DictionaryObject, self._root_object[CA.NAMES])
@@ -724,7 +724,7 @@ def append_pages_from_reader(
724724
Copy pages from reader to writer. Includes an optional callback
725725
parameter which is invoked after pages are appended to the writer.
726726
727-
``append`` should be prefered.
727+
``append`` should be preferred.
728728
729729
Args:
730730
reader: a PdfReader object from which to copy page
@@ -910,7 +910,7 @@ def update_page_form_field_values(
910910
if PG.ANNOTS not in page:
911911
logger_warning("No fields to update on this page", __name__)
912912
return
913-
# /Helvetica is just in case of but this is normally insufficient as we miss the font ressource
913+
# /Helvetica is just in case of but this is normally insufficient as we miss the font resource
914914
default_da = af.get(
915915
InteractiveFormDictEntries.DA, TextStringObject("/Helvetica 0 Tf 0 g")
916916
)
@@ -1620,16 +1620,16 @@ def add_outline(self) -> None:
16201620
def add_named_destination_array(
16211621
self, title: TextStringObject, destination: Union[IndirectObject, ArrayObject]
16221622
) -> None:
1623-
nd = self.get_named_dest_root()
1623+
named_dest = self.get_named_dest_root()
16241624
i = 0
1625-
while i < len(nd):
1626-
if title < nd[i]:
1627-
nd.insert(i, destination)
1628-
nd.insert(i, TextStringObject(title))
1625+
while i < len(named_dest):
1626+
if title < named_dest[i]:
1627+
named_dest.insert(i, destination)
1628+
named_dest.insert(i, TextStringObject(title))
16291629
return
16301630
else:
16311631
i += 2
1632-
nd.extend([TextStringObject(title), destination])
1632+
named_dest.extend([TextStringObject(title), destination])
16331633
return
16341634

16351635
def add_named_destination_object(
@@ -2771,7 +2771,7 @@ def reset_translation(
27712771
Late cloning will create new independent objects.
27722772
27732773
Args:
2774-
reader: PdfReader or IndirectObject refering a PdfReader object.
2774+
reader: PdfReader or IndirectObject referencing a PdfReader object.
27752775
if set to None or omitted, all tables will be reset.
27762776
"""
27772777
if reader is None:

pypdf/_xobj_image_helpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _get_imagemode(
6464
pass
6565
elif not isinstance(color_space, list):
6666
raise PdfReadError(
67-
"can not interprete colorspace", color_space
67+
"Cannot interpret colorspace", color_space
6868
) # pragma: no cover
6969
elif color_space[0].startswith("/Cal"): # /CalRGB and /CalGray
7070
color_space = "/Device" + color_space[0][4:]

pypdf/filters.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def decode(
597597
deprecation_no_replacement(
598598
"decode_parms being an ArrayObject", removed_in="3.15.5"
599599
)
600-
parms = CCITTFaxDecode._get_parameters(decode_parms, height)
600+
params = CCITTFaxDecode._get_parameters(decode_parms, height)
601601

602602
img_size = len(data)
603603
tiff_header_struct = "<2shlh" + "hhll" * 8 + "h"
@@ -610,19 +610,19 @@ def decode(
610610
256,
611611
4,
612612
1,
613-
parms.columns, # ImageWidth, LONG, 1, width
613+
params.columns, # ImageWidth, LONG, 1, width
614614
257,
615615
4,
616616
1,
617-
parms.rows, # ImageLength, LONG, 1, length
617+
params.rows, # ImageLength, LONG, 1, length
618618
258,
619619
3,
620620
1,
621621
1, # BitsPerSample, SHORT, 1, 1
622622
259,
623623
3,
624624
1,
625-
parms.group, # Compression, SHORT, 1, 4 = CCITT Group 4 fax encoding
625+
params.group, # Compression, SHORT, 1, 4 = CCITT Group 4 fax encoding
626626
262,
627627
3,
628628
1,
@@ -636,7 +636,7 @@ def decode(
636636
278,
637637
4,
638638
1,
639-
parms.rows, # RowsPerStrip, LONG, 1, length
639+
params.rows, # RowsPerStrip, LONG, 1, length
640640
279,
641641
4,
642642
1,

pypdf/generic/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def highlight(
318318
specifying the highlighted area
319319
quad_points: An ArrayObject of 8 FloatObjects. Must match a word or
320320
a group of words, otherwise no highlight will be shown.
321-
highlight_color: The color used for the hightlight
321+
highlight_color: The color used for the highlight.
322322
323323
Returns:
324324
A dictionary object representing the annotation.

0 commit comments

Comments
 (0)