Skip to content

Commit

Permalink
MAINT: Fix typos found by codespell (py-pdf#2549)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan6419846 committed Mar 27, 2024
1 parent 3f21f92 commit 8dbfeba
Show file tree
Hide file tree
Showing 25 changed files with 77 additions and 76 deletions.
18 changes: 9 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ nobody will be affected though. Hence only the patch update.
- Avoid endless recursion of reading damaged PDF file (#2093)

### Performance Improvements (PI)
- Re-use content stream (#2101)
- Reuse content stream (#2101)

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

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

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

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

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

### Performance Improvement (PI)
- Help the specializing adpative interpreter (#1522)
- Help the specializing adaptive interpreter (#1522)

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

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

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


Expand Down Expand Up @@ -1082,7 +1082,7 @@ BUG: Add PyPDF2.generic to PyPI distribution

### Code Style (STY)
- Fixing typos (#1137)
- Re-use code via get_outlines_property in tests (#1130)
- Reuse code via get_outlines_property in tests (#1130)

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

Expand Down Expand Up @@ -1246,7 +1246,7 @@ BUG: Add PyPDF2.generic to PyPI distribution

## Version 2.3.1, 2022-06-19

BUG: Forgot to add the interal `_codecs` subpackage.
BUG: Forgot to add the internal `_codecs` subpackage.

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

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

### Maintenance (MAINT)
- Move PDF_Samples folder into ressources
- Move PDF_Samples folder into resources
- Fix typos (#1007)

### Testing (TST)
Expand Down
6 changes: 3 additions & 3 deletions docs/meta/changelog-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,13 @@ large PDF files (#808) 🎉
### Bug Fixes (BUG)
- Clip by trimBox when merging pages, which would otherwise be ignored (#240)
- Add overwriteWarnings parameter PdfFileMerger (#243)
- IndexError for getPage() of decryped file (#359)
- IndexError for getPage() of decrypted file (#359)
- Handle cases where decodeParms is an ArrayObject (#405)
- Updated PDF fields don't show up when page is written (#412)
- Set Linked Form Value (#414)
- Fix zlib -5 error for corrupt files (#603)
- Fix reading more than last1K for EOF (#642)
- Acciental import
- Accidental import

### Robustness (ROB)
- Allow extra whitespace before "obj" in readObjectHeader (#567)
Expand Down Expand Up @@ -788,7 +788,7 @@ UPCOMING:

## Version 1.18, 2013-08-19

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

Expand Down
2 changes: 1 addition & 1 deletion docs/meta/taking-ownership.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ that if I become unavailable, e.g. due to severe health issues.

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

I've also followed the [GitHub Deceased User Policy](https://docs.github.com/en/site-policy/other-site-policies/github-deceased-user-policy)
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).
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/PdfDocCommon.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

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

Where indentified in the API, you can use any of the derivated class.
Where identified in the API, you can use any of the derived class.
2 changes: 1 addition & 1 deletion docs/user/add-watermark.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Example of watermark:
## Stamping images directly

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


Expand Down
4 changes: 2 additions & 2 deletions docs/user/cropping-and-transforming.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ writer.add_page(page3)

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

# write to document-output.pdf
Expand Down Expand Up @@ -212,7 +212,7 @@ pypdf._page.MERGE_CROP_BOX = "trimbox"

# Transforming several copies of the same page

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

![](nup-source.png)

Expand Down
4 changes: 2 additions & 2 deletions docs/user/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ To flesh out this overview:
- `/V`: Field Value
- `/DV` : Default Field Value (used when resetting a form for example)
* In order to streamline readability, _Field_ Objects and _Widget_ Objects can be fused housing all properties.
* 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 `.`)
* 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 `.`)

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_.
* 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.
* 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.
* If Fields stores only hidden values, no _Widgets_ are required.

In _pypdf_ fields are extracted from the `/Fields` array:
Expand Down
2 changes: 1 addition & 1 deletion docs/user/pdfa-compliance.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ against future technological changes and obsolescence.
improvements over PDF/A-1, while maintaining compatibility with PDF/A-1b
(Level B) documents.
* **Level B** (Basic): Like PDF/A-1b, but support for PDF 1.7 features such
as transparancy layers.
as transparency layers.
* **Level U** (Unicode): Ensures Unicode mapping without the full
accessibility requirements of PDF/A-1a (Level A).
* **Level A** (Accessible): Similar to PDF/A-1a
Expand Down
2 changes: 1 addition & 1 deletion docs/user/suppress-warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pypdf makes use of 3 mechanisms to show that something went wrong:

## Exceptions

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

Most PDF files don't follow the specifications. In this case pypdf needs to
Expand Down
15 changes: 8 additions & 7 deletions pypdf/_doc_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def named_destinations(self) -> Dict[str, Any]:
return self._get_named_destinations()

def get_named_dest_root(self) -> ArrayObject:
nd = ArrayObject()
named_dest = ArrayObject()
if CA.NAMES in self.root_object and isinstance(
self.root_object[CA.NAMES], DictionaryObject
):
Expand All @@ -392,15 +392,15 @@ def get_named_dest_root(self) -> ArrayObject:
dests_ref = dests.indirect_reference
if CA.NAMES in dests:
# TABLE 3.33 Entries in a name tree node dictionary
nd = cast(ArrayObject, dests[CA.NAMES])
named_dest = cast(ArrayObject, dests[CA.NAMES])
else:
nd = ArrayObject()
dests[NameObject(CA.NAMES)] = nd
named_dest = ArrayObject()
dests[NameObject(CA.NAMES)] = named_dest
elif hasattr(self, "_add_object"):
dests = DictionaryObject()
dests_ref = self._add_object(dests)
names[NameObject(CA.DESTS)] = dests_ref
dests[NameObject(CA.NAMES)] = nd
dests[NameObject(CA.NAMES)] = named_dest

elif hasattr(self, "_add_object"):
names = DictionaryObject()
Expand All @@ -409,9 +409,9 @@ def get_named_dest_root(self) -> ArrayObject:
dests = DictionaryObject()
dests_ref = self._add_object(dests)
names[NameObject(CA.DESTS)] = dests_ref
dests[NameObject(CA.NAMES)] = nd
dests[NameObject(CA.NAMES)] = named_dest

return nd
return named_dest

## common
def _get_named_destinations(
Expand Down Expand Up @@ -1208,6 +1208,7 @@ def decode_permissions(
"copy": UserAccessPermissions.EXTRACT,
"annotations": UserAccessPermissions.ADD_OR_MODIFY,
"forms": UserAccessPermissions.FILL_FORM_FIELDS,
# Do not fix typo, as part of official, but deprecated API.
"accessability": UserAccessPermissions.EXTRACT_TEXT_AND_GRAPHICS,
"assemble": UserAccessPermissions.ASSEMBLE_DOC,
"print_high_quality": UserAccessPermissions.PRINT_TO_REPRESENTATION,
Expand Down
4 changes: 2 additions & 2 deletions pypdf/_merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ def write(self, fileobj: Union[Path, StrByteType]) -> None:
def close(self) -> None:
"""Shut all file descriptors (input and output) and clear all memory usage."""
self.pages = []
for fo, _reader in self.inputs:
fo.close()
for file_descriptor, _reader in self.inputs:
file_descriptor.close()

self.inputs = []
self.output = None
Expand Down
4 changes: 2 additions & 2 deletions pypdf/_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ def replace_contents(
else:
content.indirect_reference = self[
PG.CONTENTS
].indirect_reference # TODO: in a future may required generation managment
].indirect_reference # TODO: in a future may required generation management
try:
self.indirect_reference.pdf._objects[
content.indirect_reference.idnum - 1 # type: ignore
Expand Down Expand Up @@ -1582,7 +1582,7 @@ def _extract_text(
# /Resources can be inherited sometimes so we look to parents
objr = objr["/Parent"].get_object()
# if no parents we will have no /Resources will be available
# => an exception wil be raised
# => an exception will be raised
resources_dict = cast(DictionaryObject, objr[PG.RESOURCES])
except Exception:
# no resources means no text is possible (no font) we consider the
Expand Down
2 changes: 1 addition & 1 deletion pypdf/_text_extraction/_layout_mode/_text_state_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def set_state_param(self, op: bytes, value: Union[float, List[Any]]) -> None:
Args:
op: operator read from PDF stream as bytes. No action is taken
for unsupported operators (see supported operators above).
value (float | List[Any]): new paramater value. If a list,
value (float | List[Any]): new parameter value. If a list,
value[0] is used.
"""
if op not in [b"Tc", b"Tz", b"Tw", b"TL", b"Ts"]:
Expand Down
22 changes: 11 additions & 11 deletions pypdf/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def set_need_appearances_writer(self, state: bool = True) -> None:
The "NeedAppearances" flag indicates whether the appearance dictionary
for form fields should be automatically generated by the PDF viewer or
if the embedded appearence should be used.
if the embedded appearance should be used.
Args:
state: The actual value of the NeedAppearances flag.
Expand Down Expand Up @@ -602,7 +602,7 @@ def add_js(self, javascript: str) -> None:
>>> output.add_js("this.print({bUI:true,bSilent:false,bShrinkToFit:true});")
# Example: This will launch the print window when the PDF is opened.
"""
# Names / JavaScript prefered to be able to add multiple scripts
# Names / JavaScript preferred to be able to add multiple scripts
if "/Names" not in self._root_object:
self._root_object[NameObject(CA.NAMES)] = DictionaryObject()
names = cast(DictionaryObject, self._root_object[CA.NAMES])
Expand Down Expand Up @@ -724,7 +724,7 @@ def append_pages_from_reader(
Copy pages from reader to writer. Includes an optional callback
parameter which is invoked after pages are appended to the writer.
``append`` should be prefered.
``append`` should be preferred.
Args:
reader: a PdfReader object from which to copy page
Expand Down Expand Up @@ -910,7 +910,7 @@ def update_page_form_field_values(
if PG.ANNOTS not in page:
logger_warning("No fields to update on this page", __name__)
return
# /Helvetica is just in case of but this is normally insufficient as we miss the font ressource
# /Helvetica is just in case of but this is normally insufficient as we miss the font resource
default_da = af.get(
InteractiveFormDictEntries.DA, TextStringObject("/Helvetica 0 Tf 0 g")
)
Expand Down Expand Up @@ -1620,16 +1620,16 @@ def add_outline(self) -> None:
def add_named_destination_array(
self, title: TextStringObject, destination: Union[IndirectObject, ArrayObject]
) -> None:
nd = self.get_named_dest_root()
named_dest = self.get_named_dest_root()
i = 0
while i < len(nd):
if title < nd[i]:
nd.insert(i, destination)
nd.insert(i, TextStringObject(title))
while i < len(named_dest):
if title < named_dest[i]:
named_dest.insert(i, destination)
named_dest.insert(i, TextStringObject(title))
return
else:
i += 2
nd.extend([TextStringObject(title), destination])
named_dest.extend([TextStringObject(title), destination])
return

def add_named_destination_object(
Expand Down Expand Up @@ -2771,7 +2771,7 @@ def reset_translation(
Late cloning will create new independent objects.
Args:
reader: PdfReader or IndirectObject refering a PdfReader object.
reader: PdfReader or IndirectObject referencing a PdfReader object.
if set to None or omitted, all tables will be reset.
"""
if reader is None:
Expand Down
2 changes: 1 addition & 1 deletion pypdf/_xobj_image_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _get_imagemode(
pass
elif not isinstance(color_space, list):
raise PdfReadError(
"can not interprete colorspace", color_space
"Cannot interpret colorspace", color_space
) # pragma: no cover
elif color_space[0].startswith("/Cal"): # /CalRGB and /CalGray
color_space = "/Device" + color_space[0][4:]
Expand Down
10 changes: 5 additions & 5 deletions pypdf/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ def decode(
deprecation_no_replacement(
"decode_parms being an ArrayObject", removed_in="3.15.5"
)
parms = CCITTFaxDecode._get_parameters(decode_parms, height)
params = CCITTFaxDecode._get_parameters(decode_parms, height)

img_size = len(data)
tiff_header_struct = "<2shlh" + "hhll" * 8 + "h"
Expand All @@ -610,19 +610,19 @@ def decode(
256,
4,
1,
parms.columns, # ImageWidth, LONG, 1, width
params.columns, # ImageWidth, LONG, 1, width
257,
4,
1,
parms.rows, # ImageLength, LONG, 1, length
params.rows, # ImageLength, LONG, 1, length
258,
3,
1,
1, # BitsPerSample, SHORT, 1, 1
259,
3,
1,
parms.group, # Compression, SHORT, 1, 4 = CCITT Group 4 fax encoding
params.group, # Compression, SHORT, 1, 4 = CCITT Group 4 fax encoding
262,
3,
1,
Expand All @@ -636,7 +636,7 @@ def decode(
278,
4,
1,
parms.rows, # RowsPerStrip, LONG, 1, length
params.rows, # RowsPerStrip, LONG, 1, length
279,
4,
1,
Expand Down
2 changes: 1 addition & 1 deletion pypdf/generic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def highlight(
specifying the highlighted area
quad_points: An ArrayObject of 8 FloatObjects. Must match a word or
a group of words, otherwise no highlight will be shown.
highlight_color: The color used for the hightlight
highlight_color: The color used for the highlight.
Returns:
A dictionary object representing the annotation.
Expand Down
Loading

0 comments on commit 8dbfeba

Please sign in to comment.