AI Slop Code RIsk Monitor

py-pdf/pypdf

A pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files

17.4 Elevated pattern signal View on GitHub

Maintenance and Governance Review

This report summarizes scanner evidence for py-pdf/pypdf, a Python project with 10,250 GitHub stars. SynthScan examined 90,493 lines of code across 187 source files, recording 1379 pattern matches distributed across 22 syntactic categories. The legacy adjusted pattern signal is 17.4 (Elevated pattern signal); it is not an authorship estimate.

Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.

17.4
Adjusted Signal
17.4
Raw Pattern Score
100%
Time Factor
2026-10-09
Last Push
10.2K
Stars
Python
Language
90.5K
Lines of Code
187
Files
1.4K
Pattern Hits
2026-10-12
Scan Date
0.42
HC Hit Rate

Risk Review · v3

Use each vector to guide manual verification of the underlying findings.

Cognitive Ownership Risk 42.8/100 · MEDIUM

Can maintainers explain intent, assumptions, and trade-offs? 1078 finding(s).

Hallucinated Dependency & Supply Chain Risk 9.6/100 · LOW

Are imports declared and package/API names verified? 149 finding(s).

Agent Over-Engineering Ratio 45.4/100 · MEDIUM

Are wrappers, guards, and repeated structures necessary? 1031 finding(s).

PR Review Velocity Impact 64.1/100 · HIGH

Which changes need focused human review? 1379 finding(s).

What These Metrics Mean

Adjusted Signal
Legacy pattern score normalized per 1,000 scanned lines and multiplied by the repository-level time factor. It is not an estimate of AI authorship.
Raw Pattern Score
Sum of severity- and context-weighted pattern findings before applying the time factor.
Time Factor
A coarse multiplier based on repository last-push metadata. It does not identify when individual code was written.
Pattern Hits
Count of configured pattern findings. Review each location and surrounding code before acting.
HC Hit Rate
High- and critical-severity findings per scanned file. Severity is a configured detector weight, not proof of a vulnerability or authorship.
Lines / Files
Scan coverage denominators used by the legacy normalized score.

Pattern-Signal History

This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.

Severity Breakdown

Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.

CRITICAL 0HIGH 79MEDIUM 39LOW 1261

Directory Score Breakdown

This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.

Pattern Findings

The scanner identified 1379 distinct pattern matches across 22 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.

Hyper-Verbose Identifiers875 hits · 707 pts
SeverityFileLineSnippetContext
LOWmake_release.py332def get_git_commits_since_tag(git_tag: str) -> list[Change]:CODE
LOWtests/test_forms.py12def test_form_button__v_value_should_be_name_object():CODE
LOWtests/test_workflows.py117def test_pdfreader_jpeg_image():CODE
LOW⚡tests/test_workflows.py155def test_text_extraction_encrypted():CODE
LOWtests/test_workflows.py268def test_transform_compress_identical_objects():CODE
LOWtests/test_workflows.py573def test_get_fields_no_warning(tmp_path, url, name):CODE
LOWtests/test_workflows.py584def test_scale_rectangle_indirect_object():CODE
LOWtests/test_workflows.py695def test_image_extraction_strict():CODE
LOWtests/test_workflows.py888def test_tounicode_is_identity():CODE
LOWtests/test_workflows.py952def test_fields_returning_stream():CODE
LOWtests/test_workflows.py1071def test_cr_with_cm_operation():CODE
LOWtests/test_workflows.py1088def remove_trailing_whitespace(text: str) -> str:CODE
LOWtests/test_workflows.py1107def test_text_extraction_layout_mode(pdf_path, expected_path):CODE
LOWtests/test_workflows.py1116def test_layout_mode_space_vertically():CODE
LOWtests/test_workflows.py1131def test_layout_mode_rotations(rotation, strip_rotated):CODE
LOWtests/test_workflows.py1149def test_text_extraction_invalid_mode():CODE
LOWtests/test_workflows.py1157def test_get_page_showing_field():CODE
LOW⚡tests/test_reader.py1577def test_outline_with_missing_named_destination():CODE
LOW⚡tests/test_reader.py1586def test_outline_with_empty_action():CODE
LOW⚡tests/test_reader.py1595def test_outline_with_invalid_destinations():CODE
LOW⚡tests/test_reader.py1603def test_pdfreader_multiple_definitions(caplog):CODE
LOW⚡tests/test_reader.py1614def test_wrong_password_error():CODE
LOW⚡tests/test_reader.py1623def test_get_page_number_by_indirect():CODE
LOW⚡tests/test_reader.py1629def test_corrupted_xref_table():CODE
LOWtests/test_reader.py382def test_startxref_corrupt_trailing_pointer(caplog):CODE
LOWtests/test_reader.py436def test_find_previous_startxref_pos_recovery_variants():CODE
LOWtests/test_reader.py476def test_duplicate_eof_markers(caplog, suffix, duplicates, strict):CODE
LOWtests/test_reader.py504def test_duplicate_eof_markers_without_startxref(pdf_data):CODE
LOWtests/test_reader.py544def test_eof_marker_not_at_line_start(CODE
LOWtests/test_reader.py578def test_get_page_of_encrypted_file(pdffile, password, should_fail):CODE
LOWtests/test_reader.py646def test_reading_choice_field_without_opt_key():CODE
LOWtests/test_reader.py704def test_read_malformed_header(caplog):CODE
LOWtests/test_reader.py761def test_circular_xref_prev_reference(caplog):CODE
LOWtests/test_reader.py1095def test_user_access_permissions():CODE
LOWtests/test_reader.py1160def test_convert_to_int_error():CODE
LOWtests/test_reader.py1186def test_extract_text_hello_world():CODE
LOWtests/test_reader.py1211def test_read_not_binary_mode(caplog):CODE
LOWtests/test_reader.py1231def test_form_topname_with_and_without_acroform(caplog):CODE
LOWtests/test_reader.py1319def test_get_full_qualified_fields():CODE
LOWtests/test_reader.py1340def test_get_fields_read_else_block():CODE
LOWtests/test_reader.py1373def test_get_fields_read_write_report(txt_file_path):CODE
LOWtests/test_reader.py1541def test_outline_missing_title(caplog):CODE
LOWtests/test_reader.py1848def test_xyz_with_missing_param():CODE
LOWtests/test_reader.py1916def test_context_manager_with_stream():CODE
LOWtests/test_reader.py2013def test_space_in_names_to_continue_processing(caplog):CODE
LOWtests/test_reader.py2059def test_unbalanced_brackets_in_dictionary_object(caplog):CODE
LOWtests/test_reader.py2178def test_root_object__not_a_dictionary(caplog, root_body):CODE
LOWtests/test_reader.py2208def test_negative_startxref_is_treated_as_zero(caplog):CODE
LOWtests/test_reader.py2251def test_infinite_loop_for_length_value():CODE
LOWtests/test_reader.py2264def test_trailer_cannot_be_read():CODE
LOWtests/test_reader.py2288def test_read_standard_xref_table__two_whitespace_characters_between_offset_and_generation():CODE
LOWtests/test_reader.py2298def test_read_standard_xref_table__entry_invalid_but_object_found(caplog):CODE
LOWtests/test_reader.py2325def test_root_object_recovery_limit(caplog):CODE
LOWtests/test_reader.py2368def test_rebuild_xref_table__speed():CODE
LOWtests/test_reader.py2382def test_rebuild_xref_table_with_cross_reference_stream(caplog, strict):CODE
LOWtests/test_reader.py2479def test_cache_indirect_object_strict_overwrite_error():CODE
LOWtests/test_reader.py2487def test_objstm_batch_parse_caches_all_objects():CODE
LOWtests/test_reader.py2501def test_objstm_cache_hit_returns_target():CODE
LOWtests/test_reader.py2516def test_objstm_skips_cache_for_overridden_objects():CODE
LOWtests/test_reader.py2535def test_objstm_does_not_cache_stale_objects_from_non_authoritative_stream():CODE
815 more matches not shown…
Empty Error Handlers48 hits · 240 pts
SeverityFileLineSnippetContext
HIGHresources/afm_to_dataclass.py136except KeyError:CODE
HIGHresources/afm_to_dataclass.py163except TypeError:CODE
HIGHtests/test_workflows.py264except PdfReadWarning:CODE
HIGHtests/test_reader.py711except Exception:CODE
HIGHpypdf/_writer.py542except Exception:CODE
HIGHpypdf/_writer.py1270except AttributeError:CODE
HIGHpypdf/_writer.py386except (KeyError, AttributeError):CODE
HIGHpypdf/_writer.py780except KeyError:CODE
HIGHpypdf/_writer.py1726except AttributeError:CODE
HIGHpypdf/_writer.py2206except (TypeError, KeyError):CODE
HIGHpypdf/_writer.py3325except Exception:CODE
HIGHpypdf/_writer.py2874except KeyError:CODE
HIGHpypdf/_writer.py2913except KeyError:CODE
HIGHpypdf/_writer.py3330except Exception:CODE
HIGHpypdf/_writer.py2190except AttributeError: # pragma: no coverCODE
HIGHpypdf/_reader.py1498except Exception: # could be multiple causesCODE
HIGHpypdf/_reader.py1078except Exception:CODE
HIGHpypdf/_reader.py1082except Exception:CODE
HIGHpypdf/_page.py1281except (AssertionError, AttributeError):CODE
HIGHpypdf/_page.py1206except ValueError:CODE
HIGHpypdf/_page.py1466except KeyError:CODE
HIGHpypdf/_page.py1471except AttributeError:CODE
HIGHpypdf/_page.py1848except Exception:CODE
HIGHpypdf/_page.py1859except Exception:CODE
HIGHpypdf/_page.py1913except (AttributeError, TypeError):CODE
HIGHpypdf/_page.py2546except Exception: # pragma: no coverCODE
HIGHpypdf/_page.py1086except AttributeError:CODE
HIGHpypdf/_page.py1980except IndexError:CODE
HIGHpypdf/_doc_common.py1214except AttributeError:CODE
HIGHpypdf/_doc_common.py809except KeyError:CODE
HIGHpypdf/filters.py144except zlib.error:CODE
HIGHpypdf/_text_extraction/_text_extractor.py168except OrientationNotFoundError:CODE
HIGHpypdf/_text_extraction/_text_extractor.py309except Exception:CODE
HIGHpypdf/generic/_base.py167except Exception:CODE
HIGHpypdf/generic/_base.py669except UnicodeDecodeError:CODE
HIGHpypdf/generic/_base.py910except (ValueError, IndexError):CODE
HIGHpypdf/generic/_base.py934except Exception:CODE
HIGHpypdf/generic/_viewerpref.py59except AttributeError:CODE
HIGHpypdf/generic/_viewerpref.py85except KeyError:CODE
HIGHpypdf/generic/_font.py645except AttributeError:CODE
HIGHpypdf/generic/_data_structures.py136except Exception:CODE
HIGHpypdf/generic/_data_structures.py317except Exception:CODE
HIGHpypdf/generic/_data_structures.py1025except Exception:CODE
HIGHpypdf/generic/_data_structures.py1061except Exception:CODE
HIGHpypdf/generic/_data_structures.py1328except Exception:CODE
HIGHpypdf/generic/_data_structures.py1362except Exception:CODE
HIGHpypdf/generic/_data_structures.py238except ValueError:CODE
HIGHpypdf/generic/_data_structures.py1666except KeyError:CODE
Unused Imports111 hits · 97 pts
SeverityFileLineSnippetContext
LOWtests/generic/test_font.py2CODE
LOWpypdf/__init__.py10CODE
LOWpypdf/__init__.py10CODE
LOWpypdf/__init__.py10CODE
LOWpypdf/__init__.py10CODE
LOWpypdf/__init__.py12CODE
LOWpypdf/__init__.py13CODE
LOWpypdf/__init__.py14CODE
LOWpypdf/__init__.py14CODE
LOWpypdf/__init__.py15CODE
LOWpypdf/__init__.py16CODE
LOWpypdf/__init__.py18CODE
LOWpypdf/__init__.py18CODE
LOWpypdf/__init__.py19CODE
LOWpypdf/__init__.py20CODE
LOWpypdf/__init__.py20CODE
LOWpypdf/__init__.py21CODE
LOWpypdf/_crypt_providers/__init__.py28CODE
LOWpypdf/_crypt_providers/__init__.py28CODE
LOWpypdf/_crypt_providers/__init__.py31CODE
LOWpypdf/_crypt_providers/__init__.py31CODE
LOWpypdf/_crypt_providers/__init__.py31CODE
LOWpypdf/_crypt_providers/__init__.py31CODE
LOWpypdf/_crypt_providers/__init__.py31CODE
LOWpypdf/_crypt_providers/__init__.py31CODE
LOWpypdf/_crypt_providers/__init__.py31CODE
LOWpypdf/_crypt_providers/__init__.py31CODE
LOWpypdf/_crypt_providers/__init__.py31CODE
LOWpypdf/_crypt_providers/__init__.py44CODE
LOWpypdf/_crypt_providers/__init__.py44CODE
LOWpypdf/_crypt_providers/__init__.py44CODE
LOWpypdf/_crypt_providers/__init__.py44CODE
LOWpypdf/_crypt_providers/__init__.py44CODE
LOWpypdf/_crypt_providers/__init__.py44CODE
LOWpypdf/_crypt_providers/__init__.py44CODE
LOWpypdf/_crypt_providers/__init__.py44CODE
LOWpypdf/_crypt_providers/__init__.py44CODE
LOWpypdf/_crypt_providers/__init__.py56CODE
LOWpypdf/_crypt_providers/__init__.py56CODE
LOWpypdf/_crypt_providers/__init__.py56CODE
LOWpypdf/_crypt_providers/__init__.py56CODE
LOWpypdf/_crypt_providers/__init__.py56CODE
LOWpypdf/_crypt_providers/__init__.py56CODE
LOWpypdf/_crypt_providers/__init__.py56CODE
LOWpypdf/_crypt_providers/__init__.py56CODE
LOWpypdf/_crypt_providers/__init__.py56CODE
LOWpypdf/annotations/__init__.py14CODE
LOWpypdf/annotations/__init__.py14CODE
LOWpypdf/annotations/__init__.py15CODE
LOWpypdf/annotations/__init__.py15CODE
LOWpypdf/annotations/__init__.py15CODE
LOWpypdf/annotations/__init__.py15CODE
LOWpypdf/annotations/__init__.py15CODE
LOWpypdf/annotations/__init__.py15CODE
LOWpypdf/annotations/__init__.py15CODE
LOWpypdf/annotations/__init__.py15CODE
LOWpypdf/annotations/__init__.py15CODE
LOWpypdf/annotations/__init__.py26CODE
LOWpypdf/annotations/__init__.py26CODE
LOWpypdf/_text_extraction/_layout_mode/__init__.py2CODE
51 more matches not shown…
Docstring Block Structure16 hits · 80 pts
SeverityFileLineSnippetContext
HIGHmake_release.py364 Parse the first line of a git commit message. Args: line: The first line of a git commit message. STRING
HIGHdocs/dev/documentation.md48 Example function with PEP 484 type annotations. Args: param1: The first parameter. param2: The secSTRING
HIGHpypdf/_encryption.py788 Apply the SASLprep profile (RFC 4013) of stringprep (RFC 3454). This normalizes Unicode passwords for PDF 2.0 STRING
HIGHpypdf/_writer.py706 Append a blank page to this PDF file and return it. If no page size is specified, use the size of the STRING
HIGHpypdf/_writer.py734 Insert a blank page to this PDF file and return it. If no page size is specified for a dimension, use STRING
HIGHpypdf/_page.py625 Return a new blank page. If ``width`` or ``height`` is ``None``, try to get the page size fromSTRING
HIGHpypdf/filters.py185 Decode data which is flate-encoded. Args: data: Flate-encoded data. decode_parms: STRING
HIGHpypdf/filters.py369 Decode an ASCII-Hex encoded data stream. Args: data: a str sequence of hexadecimal-encoded vSTRING
HIGHpypdf/filters.py435 Decode a run length encoded data stream. Args: data: a bytes sequence of length/data STRING
HIGHpypdf/filters.py624 Decompresses data encoded using the Brotli compression method, reproducing the original data. STRING
HIGHpypdf/filters.py669 Compresses data using the Brotli compression method. Args: data: The data to be compressedSTRING
HIGHpypdf/filters.py919 Decode the stream data based on the specified filters. This function decodes the stream data using the filtersSTRING
HIGH…f/_text_extraction/_layout_mode/_text_state_manager.py80 Create a TextStateParams instance to display a text string. Type[bytes] values will be decoded implicitSTRING
HIGHpypdf/generic/_image_xobject.py571 Users need to have the pillow package installed. It's unclear if pypdf will keep this function here, hence it'STRING
HIGHpypdf/generic/_data_structures.py1150 Try to decode the stream object as an image Args: pillow_parameters: parameters provided tSTRING
HIGHpypdf/generic/_utils.py134 Create a ByteStringObject or a TextStringObject from a string to represent the string. Args: string: TSTRING
Deep Nesting88 hits · 70 pts
SeverityFileLineSnippetContext
LOWresources/afm_to_dataclass.py23CODE
LOWresources/afm_to_dataclass.py50CODE
LOWtests/test_workflows.py669CODE
LOWtests/test_reader.py174CODE
LOWtests/test_reader.py191CODE
LOWtests/test_configuration.py134CODE
LOWtests/utils.py115CODE
LOWtests/generic/test_font.py192CODE
LOWpypdf/_page_labels.py198CODE
LOWpypdf/_encryption.py73CODE
LOWpypdf/_encryption.py96CODE
LOWpypdf/_encryption.py1045CODE
LOWpypdf/_writer.py776CODE
LOWpypdf/_writer.py960CODE
LOWpypdf/_writer.py1459CODE
LOWpypdf/_writer.py1847CODE
LOWpypdf/_writer.py2013CODE
LOWpypdf/_writer.py2139CODE
LOWpypdf/_writer.py2246CODE
LOWpypdf/_writer.py2603CODE
LOWpypdf/_writer.py2725CODE
LOWpypdf/_writer.py2887CODE
LOWpypdf/_writer.py3059CODE
LOWpypdf/_writer.py3307CODE
LOWpypdf/_reader.py365CODE
LOWpypdf/_reader.py479CODE
LOWpypdf/_reader.py703CODE
LOWpypdf/_reader.py968CODE
LOWpypdf/_reader.py1104CODE
LOWpypdf/_reader.py1239CODE
LOWpypdf/_reader.py1428CODE
LOWpypdf/_reader.py1511CODE
LOWpypdf/xmp.py279CODE
LOWpypdf/xmp.py363CODE
LOWpypdf/xmp.py637CODE
LOWpypdf/_page.py869CODE
LOWpypdf/_page.py1015CODE
LOWpypdf/_page.py1097CODE
LOWpypdf/_page.py1707CODE
LOWpypdf/_page.py1866CODE
LOWpypdf/_page.py2175CODE
LOWpypdf/_doc_common.py485CODE
LOWpypdf/_doc_common.py704CODE
LOWpypdf/_doc_common.py776CODE
LOWpypdf/_doc_common.py851CODE
LOWpypdf/_doc_common.py1129CODE
LOWpypdf/_doc_common.py1304CODE
LOWpypdf/_doc_common.py1399CODE
LOWpypdf/_doc_common.py1590CODE
LOWpypdf/_cmap.py67CODE
LOWpypdf/_cmap.py148CODE
LOWpypdf/_cmap.py274CODE
LOWpypdf/_cmap.py347CODE
LOWpypdf/filters.py105CODE
LOWpypdf/filters.py918CODE
LOWpypdf/filters.py180CODE
LOWpypdf/filters.py278CODE
LOWpypdf/filters.py430CODE
LOWpypdf/filters.py741CODE
LOWpypdf/filters.py840CODE
28 more matches not shown…
Self-Referential Comments22 hits · 66 pts
SeverityFileLineSnippetContext
MEDIUMresources/afm_to_dataclass.py39 "# This file is based upon the 14 core AFM files provided by Adobe/Macromedia at\n# " +CODE
MEDIUMtests/test_generic.py1121 # Create a weak reference to the underlying object to test laterCOMMENT
MEDIUMtests/test_generic.py1149 # Create a weak reference to the underlying object to test laterCOMMENT
MEDIUMtests/generic/test_data_structures.py146 # Create a single child A as the /First (and /Last)COMMENT
MEDIUM.github/workflows/release.yaml30 contents: write # Create the actual release.CODE
MEDIUMpypdf/_writer.py901 # Create a new StreamObject for the new_content_dataCOMMENT
MEDIUMpypdf/_writer.py914 # Create a new StreamObject in a new /Contents entry.COMMENT
MEDIUMpypdf/_writer.py2767 # Create a new PdfReader instance using the streamCOMMENT
MEDIUMpypdf/filters.py721# Create an alias for the old class nameCOMMENT
MEDIUMpypdf/_utils.py557# The following class has been copied from Django:COMMENT
MEDIUMpypdf/generic/_files.py80 # Create the file entry (the actual embedded file stream)COMMENT
MEDIUMpypdf/generic/_files.py89 # Create the filespec dictionaryCOMMENT
MEDIUMpypdf/generic/_font.py862 # Create the descendant font objectCOMMENT
MEDIUMpypdf/generic/_font.py878 # Create the Type 0 font objectCOMMENT
MEDIUMpypdf/generic/_appearance_stream.py99 # Define the rotation matrixCOMMENT
MEDIUMpypdf/generic/_appearance_stream.py727 # Create a default appearance if none was found in the annotationCOMMENT
MEDIUMpypdf/generic/_appearance_stream.py809 # Create the TextStreamAppearance instanceCOMMENT
MEDIUMpypdf/generic/_link.py28# This module contains code used by _writer.py to track links in pagesCOMMENT
MEDIUM⚡pypdf/_codecs/core_font_metrics.py1# This file is based upon the 14 core AFM files provided by Adobe/Macromedia atCOMMENT
MEDIUMpypdf/_codecs/symbol.py10# This file is provided as-is by Unicode, Inc. (The Unicode Consortium). NoCOMMENT
MEDIUMpypdf/_codecs/_codecs.py180 # The following method has been converted to Python from PDFsharp:COMMENT
MEDIUMpypdf/_codecs/zapfding.py10# This file is provided as-is by Unicode, Inc. (The Unicode Consortium). NoCOMMENT
Excessive Try-Catch Wrapping57 hits · 51 pts
SeverityFileLineSnippetContext
LOWmake_release.py104 except Exception:CODE
LOWtests/test_reader.py711 except Exception:CODE
LOWtests/test_page.py68 except Exception:CODE
LOWdocs/user/suppress-warnings.md45except Exception as exc:CODE
LOWdocs/user/extract-images.md69 except Exception as exception:CODE
LOW.github/scripts/check_urls.py50 except Exception as exception:CODE
LOW.github/scripts/check_gh_pages_updates.py66 except Exception as e:CODE
LOW.github/scripts/check_gh_pages_updates.py82 except Exception as e:CODE
LOWpypdf/_encryption.py1068 except Exception:CODE
MEDIUMpypdf/_writer.py2381def _get_page_layout(self) -> Optional[LayoutType]:CODE
LOWpypdf/_writer.py542 except Exception:CODE
LOWpypdf/_writer.py611 except Exception as exc: # pragma: no coverCODE
LOWpypdf/_writer.py3056 except Exception:CODE
LOWpypdf/_writer.py3325 except Exception:CODE
LOWpypdf/_writer.py3330 except Exception:CODE
LOWpypdf/_reader.py251 except Exception: # to be sure to capture all errorsCODE
LOWpypdf/_reader.py511 except Exception:CODE
LOWpypdf/_reader.py1034 except Exception:CODE
LOWpypdf/_reader.py1078 except Exception:CODE
LOWpypdf/_reader.py1082 except Exception:CODE
LOWpypdf/_reader.py1134 except Exception:CODE
LOWpypdf/_reader.py1139 except Exception as e:CODE
LOWpypdf/_reader.py1187 except Exception:CODE
LOWpypdf/_reader.py1235 except Exception:CODE
LOWpypdf/_reader.py1498 except Exception: # could be multiple causesCODE
LOWpypdf/_page.py1848 except Exception:CODE
LOWpypdf/_page.py1859 except Exception:CODE
LOWpypdf/_page.py2000 except Exception as exception:CODE
LOWpypdf/_page.py2546 except Exception: # pragma: no coverCODE
LOWpypdf/_doc_common.py876 except Exception as exc:CODE
LOWpypdf/_doc_common.py936 except Exception as exc:CODE
LOWpypdf/_cmap.py101 except Exception:CODE
LOWpypdf/_cmap.py114 except Exception:CODE
LOWpypdf/_cmap.py140 except Exception:CODE
LOWpypdf/_cmap.py516 except Exception:CODE
LOWpypdf/_text_extraction/_text_extractor.py253 except Exception:CODE
LOWpypdf/_text_extraction/_text_extractor.py264 except Exception:CODE
LOWpypdf/_text_extraction/_text_extractor.py309 except Exception:CODE
LOWpypdf/generic/_base.py167 except Exception:CODE
LOWpypdf/generic/_base.py507 except Exception as e:CODE
LOWpypdf/generic/_base.py934 except Exception:CODE
LOWpypdf/generic/_image_xobject.py727 except Exception as exception:CODE
LOWpypdf/generic/_font.py515 except Exception as exception:CODE
LOWpypdf/generic/_font.py589 except Exception as exception:CODE
LOWpypdf/generic/_font.py747 except Exception as exception: # Font file data is corrupt.CODE
LOW⚡pypdf/generic/_data_structures.py1835 except Exception:CODE
LOW⚡pypdf/generic/_data_structures.py1840 except Exception:CODE
LOWpypdf/generic/_data_structures.py136 except Exception:CODE
LOWpypdf/generic/_data_structures.py317 except Exception:CODE
LOWpypdf/generic/_data_structures.py422 except Exception:CODE
LOWpypdf/generic/_data_structures.py644 except Exception as exc:CODE
LOWpypdf/generic/_data_structures.py863 except Exception: # it means we are inserting in first positionCODE
LOWpypdf/generic/_data_structures.py1025 except Exception:CODE
LOWpypdf/generic/_data_structures.py1061 except Exception:CODE
LOWpypdf/generic/_data_structures.py1328 except Exception:CODE
LOWpypdf/generic/_data_structures.py1362 except Exception:CODE
LOWpypdf/_codecs/__init__.py13 except Exception:CODE
Over-Commented Block53 hits · 51 pts
SeverityFileLineSnippetContext
LOWtests/test_text_extraction.py921 NameObject("/Type"): NameObject("/Font"),COMMENT
LOWtests/test_encryption.py41 # qpdf --encrypt "" "asdfzxcv" 40 -- unencrypted.pdf r2-owner-password.pdfCOMMENT
LOWrequirements/dev.txt1#COMMENT
LOWrequirements/dev.txt41packaging==24.1COMMENT
LOWrequirements/dev.txt61 # via pytest-covCOMMENT
LOWrequirements/dev.txt81 # via pre-commitCOMMENT
LOWrequirements/ci.txt1#COMMENT
LOWrequirements/ci.txt21execnet==2.1.1COMMENT
LOWrequirements/ci.txt41py-cpuinfo==9.0.0COMMENT
LOWrequirements/ci.txt61pytest-timeout==2.3.1COMMENT
LOWrequirements/ci-3.11.txt1#COMMENT
LOWrequirements/ci-3.11.txt41 # -r requirements/ci.inCOMMENT
LOWrequirements/ci-3.11.txt61pytest-cov==5.0.0COMMENT
LOWrequirements/ci-3.11.txt81 # via -r requirements/ci.inCOMMENT
LOWrequirements/docs.txt1#COMMENT
LOWrequirements/docs.txt21 # via requestsCOMMENT
LOWrequirements/docs.txt41 # via sphinxCOMMENT
LOWdocs/conf.py141# To execute these examples real files need to be read and written.COMMENT
LOWpypdf/_encryption.py1# Copyright (c) 2022, exiledkingccCOMMENT
LOWpypdf/_writer.py1# Copyright (c) 2006, Mathieu FenniakCOMMENT
LOWpypdf/_reader.py1# Copyright (c) 2006, Mathieu FenniakCOMMENT
LOWpypdf/xmp.py41# It's documented here: https://github.com/adobe/xmp-docs/raw/master/XMPSpecifications/XMPSpecificationPart3.pdfCOMMENT
LOWpypdf/_page.py1# Copyright (c) 2006, Mathieu FenniakCOMMENT
LOWpypdf/_doc_common.py1# Copyright (c) 2006, Mathieu FenniakCOMMENT
LOWpypdf/filters.py1# Copyright (c) 2006, Mathieu FenniakCOMMENT
LOWpypdf/filters.py121COMMENT
LOWpypdf/_utils.py1# Copyright (c) 2006, Mathieu FenniakCOMMENT
LOWpypdf/_utils.py561# Original license:COMMENT
LOWpypdf/_utils.py581# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ANDCOMMENT
LOWpypdf/_crypt_providers/_base.py1# Copyright (c) 2023, exiledkingccCOMMENT
LOWpypdf/_crypt_providers/_cryptography.py1# Copyright (c) 2023, exiledkingccCOMMENT
LOWpypdf/_crypt_providers/__init__.py1# Copyright (c) 2023, exiledkingccCOMMENT
LOWpypdf/_crypt_providers/_pycryptodome.py1# Copyright (c) 2023, exiledkingccCOMMENT
LOWpypdf/_crypt_providers/_fallback.py1# Copyright (c) 2023, exiledkingccCOMMENT
LOWpypdf/_text_extraction/_text_extractor.py1# Copyright (c) 2006, Mathieu FenniakCOMMENT
LOW…pdf/_text_extraction/_layout_mode/_fixed_width_page.py161 bt_group(tj_ops[bt_idx], _text, last_displaced_tx)COMMENT
LOWpypdf/generic/_base.py1# Copyright (c) 2006, Mathieu FenniakCOMMENT
LOWpypdf/generic/_viewerpref.py1# Copyright (c) 2023, Pubpub-ZZCOMMENT
LOWpypdf/generic/__init__.py1# Copyright (c) 2006, Mathieu FenniakCOMMENT
LOWpypdf/generic/_image_inline.py1# Copyright (c) 2024, pypdf contributorsCOMMENT
LOWpypdf/generic/_image_xobject.py421 decode = x_object[ImageAttributes.DECODE]COMMENT
LOWpypdf/generic/_data_structures.py1# Copyright (c) 2006, Mathieu FenniakCOMMENT
LOWpypdf/generic/_link.py1# All rights reserved.COMMENT
LOWpypdf/_codecs/adobe_glyphs.py1# Generated from https://github.com/adobe-type-tools/agl-aglfn/blob/4036a9ca80a62f64f9de4f7321a9a045ad0ecfd6/glyphlist.tCOMMENT
LOWpypdf/_codecs/adobe_glyphs.py21# provided with the distribution.COMMENT
LOWpypdf/_codecs/adobe_glyphs.py41# -----------------------------------------------------------------------------COMMENT
LOWpypdf/_codecs/adobe_glyphs.py61# 2. Redistributions in binary form must reproduce the above copyright notice,COMMENT
LOWpypdf/_codecs/adobe_glyphs.py81#COMMENT
LOWpypdf/_codecs/adobe_glyphs.py101# the rights to use, copy, modify, merge, publish, distribute, and/or sellCOMMENT
LOWpypdf/_codecs/core_font_metrics.py1# This file is based upon the 14 core AFM files provided by Adobe/Macromedia atCOMMENT
LOWpypdf/_codecs/symbol.py1# Generated from https://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/symbol.txtCOMMENT
LOWpypdf/_codecs/_codecs.py181 # https://github.com/empira/PDFsharp/blob/5fbf6ed14740bc4e16786816882d32e43af3ff5d/src/foundation/src/PDFsharp/src/PCOMMENT
LOWpypdf/_codecs/zapfding.py1# Generated from https://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/zdingbat.txtCOMMENT
Cross-Language Confusion9 hits · 45 pts
SeverityFileLineSnippetContext
HIGHmake_release.py114 git commit -eF RELEASE_COMMIT_MSG.md && git pushSTRING
HIGHmake_release.py130 git tag -eF RELEASE_TAG_MSG.md && git pushSTRING
HIGHtests/test_reader.py2755 # null, so it is dropped from the page tree and no page remains.COMMENT
HIGHtests/test_writer.py2064 # "I DO NOT Agree": null,COMMENT
HIGHtests/test_generic.py456 (b"[null null]", [NullObject(), NullObject()]),CODE
HIGHtests/test_generic.py457 (b"[null]", [NullObject()]),CODE
HIGHtests/test_filters.py716 b"/DecodeParms [ null ]"CODE
HIGHpypdf/_page.py2588 that is called 'FontFilex' (where x is null, 2, or 3), then that fontname isSTRING
HIGHpypdf/generic/_data_structures.py280 # Shortcut for null, as some arrays consist mostly of nullsCOMMENT
Fake / Example Data29 hits · 40 pts
SeverityFileLineSnippetContext
LOWresources/multicolumn-lorem-ipsum.txt1 Two-Column Document with Lorem IpsumCODE
LOWresources/multicolumn-lorem-ipsum.txt9with Lorem Ipsum text. nas lacinia. Nam ipsum ligula, eleifend at, accumCODE
LOWresources/multicolumn-lorem-ipsum.txt20placerat. Integer sapien est, iaculis in, pretium quis, ipsum dolor sit amet, consectetuer adipiscing elitCODE
LOW⚡tests/test_workflows.py164 .startswith("Lorem ipsum dolor sit amet")CODE
LOW⚡tests/test_workflows.py164 .startswith("Lorem ipsum dolor sit amet")CODE
LOW⚡tests/test_cmap.py306 assert "Lorem ipsum dolor sit amet" in reader.pages[0].extract_text()CODE
LOW⚡tests/test_cmap.py306 assert "Lorem ipsum dolor sit amet" in reader.pages[0].extract_text()CODE
LOWtests/test_cmap.py332 assert page.extract_text() == "Lorem ipsum"CODE
LOW⚡tests/test_writer.py491 assert "Lorem ipsum dolor sit amet" in extracted_textCODE
LOW⚡tests/test_writer.py491 assert "Lorem ipsum dolor sit amet" in extracted_textCODE
LOWtests/test_xmp.py29 assert xmp.dc_creator == ["John Doe"]CODE
LOWtests/test_xmp.py47 assert xmp.dc_creator == ["John Doe"]CODE
LOW⚡tests/generic/test_data_structures.py216 assert ContentStream(stream=array2, pdf=None).get_data() == b"Lorem ipsum!\nShared stream 0\nShared stream 2\n"CODE
LOW⚡tests/generic/test_data_structures.py223 b"Lorem ipsum!\nShared stream 0\nShared stream 1\nShared stream 2\n"CODE
LOWtests/generic/test_data_structures.py189 stream2.set_data(b"Lorem ipsum!")CODE
LOW⚡tests/generic/test_files.py114 assert attachment.content.startswith(b"Hello World!\n\nLorem ipsum dolor sit amet, ")CODE
LOW⚡tests/generic/test_files.py114 assert attachment.content.startswith(b"Hello World!\n\nLorem ipsum dolor sit amet, ")CODE
LOW⚡tests/generic/test_files.py115 assert attachment.content.endswith(b"\ntakimata sanctus est Lorem ipsum dolor sit amet.\n")CODE
LOW⚡tests/generic/test_files.py115 assert attachment.content.endswith(b"\ntakimata sanctus est Lorem ipsum dolor sit amet.\n")CODE
LOW⚡tests/generic/test_files.py431 embedded_file.content = "Lorem ipsum dolor sit amet"CODE
LOW⚡tests/generic/test_files.py431 embedded_file.content = "Lorem ipsum dolor sit amet"CODE
LOW⚡tests/generic/test_files.py432 assert embedded_file.content == b"Lorem ipsum dolor sit amet"CODE
LOW⚡tests/generic/test_files.py432 assert embedded_file.content == b"Lorem ipsum dolor sit amet"CODE
LOW⚡tests/generic/test_files.py615 b"Hello World!\n\nLorem ipsum dolor sit amet, consetetur sad"CODE
LOW⚡tests/generic/test_files.py615 b"Hello World!\n\nLorem ipsum dolor sit amet, consetetur sad"CODE
LOW⚡tests/generic/test_files.py620 b"t Lorem\nipsum dolor sit amet. Lorem ipsum dolor sit amet"CODE
LOW⚡tests/generic/test_files.py620 b"t Lorem\nipsum dolor sit amet. Lorem ipsum dolor sit amet"CODE
LOW⚡tests/generic/test_files.py625 b"imata sanctus est Lorem ipsum dolor sit amet.\n"CODE
LOW⚡tests/generic/test_files.py625 b"imata sanctus est Lorem ipsum dolor sit amet.\n"CODE
Cross-File Repetition6 hits · 30 pts
SeverityFileLineSnippetContext
HIGHpypdf/_writer.py0read-only boolean property showing whether this pdf file is encrypted. note that this property, if true, will remain truSTRING
HIGHpypdf/_reader.py0read-only boolean property showing whether this pdf file is encrypted. note that this property, if true, will remain truSTRING
HIGHpypdf/_doc_common.py0read-only boolean property showing whether this pdf file is encrypted. note that this property, if true, will remain truSTRING
HIGHpypdf/_writer.py0integration into jupyter notebooks. this method returns a dictionary that maps a mime-type to its representation. .. seeSTRING
HIGHpypdf/_reader.py0integration into jupyter notebooks. this method returns a dictionary that maps a mime-type to its representation. .. seeSTRING
HIGHpypdf/_doc_common.py0integration into jupyter notebooks. this method returns a dictionary that maps a mime-type to its representation. .. seeSTRING
Decorative Section Separators8 hits · 27 pts
SeverityFileLineSnippetContext
MEDIUMpypdf/_utils.py563# ---------------------------------------------------------------------------------COMMENT
MEDIUMpypdf/_utils.py591# ---------------------------------------------------------------------------------COMMENT
MEDIUMpypdf/_codecs/adobe_glyphs.py41# -----------------------------------------------------------------------------COMMENT
MEDIUMpypdf/_codecs/adobe_glyphs.py80# -----------------------------------------------------------------------------COMMENT
MEDIUM⚡pypdf/_codecs/core_font_metrics.py5# -----------------------------------------------------------------------------------------------COMMENT
MEDIUM⚡pypdf/_codecs/core_font_metrics.py14# -----------------------------------------------------------------------------------------------COMMENT
MEDIUMpypdf/_codecs/_codecs.py185 # -------------------------------------------------------------------------COMMENT
MEDIUMpypdf/_codecs/_codecs.py210 # --------------------------------------------------------------------------COMMENT
Modern Structural Boilerplate28 hits · 26 pts
SeverityFileLineSnippetContext
LOWpypdf/_writer.py583 def set_need_appearances_writer(self, state: bool = True) -> None:CODE
LOWpypdf/_writer.py2387 def _set_page_layout(self, layout: Union[NameObject, LayoutType]) -> None:CODE
LOWpypdf/_writer.py2423 def set_page_layout(self, layout: LayoutType) -> None:CODE
LOWpypdf/_writer.py3160 def _set_cloned_kids(self, parent_fields: dict[int, DictionaryObject], reader: PdfReader) -> None:CODE
LOWpypdf/__init__.py34__all__ = [CODE
LOWpypdf/xmp.py691 def _set_single_value(self, namespace: str, name: str, value: Optional[str]) -> None:CODE
LOWpypdf/xmp.py715 def _set_bag_values(self, namespace: str, name: str, values: Optional[list[str]]) -> None:CODE
LOWpypdf/xmp.py743 def _set_seq_values(self, namespace: str, name: str, values: Optional[list[str]]) -> None:CODE
LOWpypdf/xmp.py771 def _set_langalt_values(self, namespace: str, name: str, values: Optional[dict[str, str]]) -> None:CODE
LOWpypdf/xmp.py804 def _update_stream(self) -> None:CODE
LOWpypdf/_page.py167def _set_rectangle(self: Any, name: str, value: Union[RectangleObject, float]) -> None:CODE
LOWpypdf/_crypt_providers/__init__.py68__all__ = [CODE
LOWpypdf/annotations/__init__.py28__all__ = [CODE
LOWpypdf/_text_extraction/_layout_mode/__init__.py10__all__ = [CODE
LOW…f/_text_extraction/_layout_mode/_text_state_manager.py52 def set_state_param(self, op: bytes, value: Union[float, list[Any]]) -> None:CODE
LOW…f/_text_extraction/_layout_mode/_text_state_manager.py67 def set_font(self, font: Font, size: float) -> None:CODE
LOWpypdf/actions/__init__.py13__all__ = [CODE
LOW⚡pypdf/generic/_viewerpref.py65 def _set_bool(self, key: str, v: bool) -> None:CODE
LOW⚡pypdf/generic/_viewerpref.py71 def _set_name(self, key: str, lst: list[str], v: NameObject) -> None:CODE
LOW⚡pypdf/generic/_viewerpref.py81 def _set_arr(self, key: str, v: Optional[ArrayObject]) -> None:CODE
LOWpypdf/generic/_viewerpref.py101 def _set_int(self, key: str, v: int) -> None:CODE
LOWpypdf/generic/__init__.py75__all__ = [CODE
LOWpypdf/generic/_image_inline.py42logger = logging.getLogger(__name__)CODE
LOWpypdf/generic/_data_structures.py97logger = logging.getLogger(__name__)CODE
LOWpypdf/generic/_data_structures.py1079 def set_data(self, data: bytes) -> None:CODE
LOWpypdf/generic/_data_structures.py1212 def set_data(self, data: bytes) -> None:CODE
LOWpypdf/generic/_data_structures.py1554 def set_data(self, data: bytes) -> None:CODE
LOWpypdf/_codecs/__init__.py49__all__ = [CODE
AI Slop Vocabulary4 hits · 12 pts
SeverityFileLineSnippetContext
MEDIUM⚡tests/test_reader.py1590 # outline items (entitled Tables and Figures) utilize an empty action (/A)COMMENT
LOWpypdf/generic/_image_inline.py136 # Ideally, we could just use plain run-length decoding here, where 80_16 = 128_10COMMENT
MEDIUM⚡pypdf/generic/_data_structures.py1833 try: # Prefer to be more robust not only to null parametersCODE
MEDIUM⚡pypdf/generic/_data_structures.py1838 try: # Prefer to be more robust not only to null parametersCODE
Redundant / Tautological Comments7 hits · 10 pts
SeverityFileLineSnippetContext
LOWtests/test_images.py71 # Check if the images have the same dimensionsCOMMENT
LOWtests/test_images.py75 # Check if the color modes are the sameCOMMENT
LOWtests/test_writer.py618 # Check if the title was setCOMMENT
LOWtests/test_merger.py129 # Check if outline is correctCOMMENT
LOWtests/bench.py101 # Check if outline is correctCOMMENT
LOWpypdf/_page.py768 # Check if displayed (in content stream)COMMENT
LOWpypdf/generic/_data_structures.py362 # Check if this is a chain list, we need to loop to prevent recurCOMMENT
Dead Code5 hits · 10 pts
SeverityFileLineSnippetContext
MEDIUMpypdf/generic/_data_structures.py1335CODE
MEDIUMpypdf/generic/_data_structures.py1336CODE
MEDIUMpypdf/generic/_data_structures.py1337CODE
MEDIUMpypdf/generic/_data_structures.py1338CODE
MEDIUMpypdf/generic/_data_structures.py1339CODE
Verbosity Indicators3 hits · 4 pts
SeverityFileLineSnippetContext
LOWtests/utils.py131 # Step 1: Count number of x- and y-coordinates of rectangles.COMMENT
LOWtests/utils.py154 # Step 2: Look for texts in rectangles.COMMENT
LOWtests/utils.py168 # Step 3: Build the list of rows containing list of cell-texts.COMMENT
Structural Annotation Overuse3 hits · 4 pts
SeverityFileLineSnippetContext
LOWtests/utils.py131 # Step 1: Count number of x- and y-coordinates of rectangles.COMMENT
LOWtests/utils.py154 # Step 2: Look for texts in rectangles.COMMENT
LOWtests/utils.py168 # Step 3: Build the list of rows containing list of cell-texts.COMMENT
AI Structural Patterns4 hits · 3 pts
SeverityFileLineSnippetContext
LOWpypdf/_writer.py200CODE
LOWpypdf/_page.py1866CODE
LOW…f/_text_extraction/_layout_mode/_text_state_manager.py123CODE
LOWpypdf/generic/_appearance_stream.py487CODE
Overly Generic Function Names1 hit · 2 pts
SeverityFileLineSnippetContext
LOW⚡tests/generic/test_base.py171 def test_function(stream: StreamType) -> IndirectObject:CODE
Slop Phrases1 hit · 2 pts
SeverityFileLineSnippetContext
LOWpypdf/_page_labels.py267 # When there are no kids, make sure to exit the `while` loop directlyCOMMENT
TODO Padding1 hit · 2 pts
SeverityFileLineSnippetContext
LOWpypdf/generic/_image_xobject.py547 # TODO: implement maskCOMMENT