Repository Analysis

py-pdf/pypdf

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

14.4 Low AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of py-pdf/pypdf, a Python project with 10,176 GitHub stars. SynthScan v2.0 examined 84,868 lines of code across 181 source files, recording 1181 pattern matches distributed across 20 syntactic categories. The overall adjusted score of 14.4 places this repository in the Low AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

14.4
Adjusted Score
14.4
Raw Score
100%
Time Factor
2026-08-28
Last Push
10.2K
Stars
Python
Language
84.9K
Lines of Code
181
Files
1.2K
Pattern Hits
2026-08-29
Scan Date
0.14
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 0HIGH 25MEDIUM 39LOW 1117

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 1181 distinct pattern matches across 20 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. 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 diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Hyper-Verbose Identifiers741 hits · 622 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.py116def test_pdfreader_jpeg_image():CODE
LOWtests/test_workflows.py154def test_text_extraction_encrypted():CODE
LOWtests/test_workflows.py267def test_transform_compress_identical_objects():CODE
LOWtests/test_workflows.py572def test_get_fields_no_warning(tmp_path, url, name):CODE
LOWtests/test_workflows.py583def test_scale_rectangle_indirect_object():CODE
LOWtests/test_workflows.py694def test_image_extraction_strict():CODE
LOWtests/test_workflows.py887def test_tounicode_is_identity():CODE
LOWtests/test_workflows.py951def test_fields_returning_stream():CODE
LOWtests/test_workflows.py1070def test_cr_with_cm_operation():CODE
LOWtests/test_workflows.py1087def remove_trailing_whitespace(text: str) -> str:CODE
LOWtests/test_workflows.py1106def test_text_extraction_layout_mode(pdf_path, expected_path):CODE
LOWtests/test_workflows.py1115def test_layout_mode_space_vertically():CODE
LOWtests/test_workflows.py1130def test_layout_mode_rotations(rotation, strip_rotated):CODE
LOWtests/test_workflows.py1148def test_text_extraction_invalid_mode():CODE
LOWtests/test_workflows.py1156def test_get_page_showing_field():CODE
LOWtests/test_reader.py1517def test_outline_with_missing_named_destination():CODE
LOWtests/test_reader.py1526def test_outline_with_empty_action():CODE
LOWtests/test_reader.py1535def test_outline_with_invalid_destinations():CODE
LOWtests/test_reader.py1543def test_pdfreader_multiple_definitions(caplog):CODE
LOWtests/test_reader.py1554def test_wrong_password_error():CODE
LOWtests/test_reader.py1563def test_get_page_number_by_indirect():CODE
LOWtests/test_reader.py1569def test_corrupted_xref_table():CODE
LOWtests/test_reader.py379def test_startxref_corrupt_trailing_pointer(caplog):CODE
LOWtests/test_reader.py433def test_find_previous_startxref_pos_recovery_variants():CODE
LOWtests/test_reader.py473def test_duplicate_eof_markers(caplog, suffix, duplicates, strict):CODE
LOWtests/test_reader.py501def test_duplicate_eof_markers_without_startxref(pdf_data):CODE
LOWtests/test_reader.py516def test_get_page_of_encrypted_file(pdffile, password, should_fail):CODE
LOWtests/test_reader.py584def test_reading_choice_field_without_opt_key():CODE
LOWtests/test_reader.py642def test_read_malformed_header(caplog):CODE
LOWtests/test_reader.py699def test_circular_xref_prev_reference(caplog):CODE
LOWtests/test_reader.py1033def test_user_access_permissions():CODE
LOWtests/test_reader.py1098def test_convert_to_int_error():CODE
LOWtests/test_reader.py1124def test_extract_text_hello_world():CODE
LOWtests/test_reader.py1149def test_read_not_binary_mode(caplog):CODE
LOWtests/test_reader.py1171def test_form_topname_with_and_without_acroform(caplog):CODE
LOWtests/test_reader.py1259def test_get_full_qualified_fields():CODE
LOWtests/test_reader.py1280def test_get_fields_read_else_block():CODE
LOWtests/test_reader.py1313def test_get_fields_read_write_report(txt_file_path):CODE
LOWtests/test_reader.py1481def test_outline_missing_title(caplog):CODE
LOWtests/test_reader.py1788def test_xyz_with_missing_param():CODE
LOWtests/test_reader.py1856def test_context_manager_with_stream():CODE
LOWtests/test_reader.py1953def test_space_in_names_to_continue_processing(caplog):CODE
LOWtests/test_reader.py1999def test_unbalanced_brackets_in_dictionary_object(caplog):CODE
LOWtests/test_reader.py2110def test_infinite_loop_for_length_value():CODE
LOWtests/test_reader.py2123def test_trailer_cannot_be_read():CODE
LOWtests/test_reader.py2147def test_read_standard_xref_table__two_whitespace_characters_between_offset_and_generation():CODE
LOWtests/test_reader.py2157def test_read_standard_xref_table__entry_invalid_but_object_found(caplog):CODE
LOWtests/test_reader.py2184def test_root_object_recovery_limit(caplog):CODE
LOWtests/test_reader.py2227def test_rebuild_xref_table__speed():CODE
LOWtests/test_reader.py2241def test_rebuild_xref_table_with_cross_reference_stream(caplog, strict):CODE
LOWtests/test_reader.py2338def test_cache_indirect_object_strict_overwrite_error():CODE
LOWtests/test_reader.py2346def test_objstm_batch_parse_caches_all_objects():CODE
LOWtests/test_reader.py2360def test_objstm_cache_hit_returns_target():CODE
LOWtests/test_reader.py2375def test_objstm_skips_cache_for_overridden_objects():CODE
LOWtests/test_reader.py2394def test_objstm_does_not_cache_stale_objects_from_non_authoritative_stream():CODE
LOWtests/test_reader.py2483def test_xref_table_with_comments_before_trailer():CODE
LOWtests/test_reader.py2573def test_get_object_from_stream__size_limit(caplog):CODE
LOWtests/test_reader.py2623def test_named_destinations_cache():CODE
681 more matches not shown…
Unused Imports105 hits · 91 pts
SeverityFileLineSnippetContext
LOWpypdf/__init__.py11CODE
LOWpypdf/__init__.py12CODE
LOWpypdf/__init__.py13CODE
LOWpypdf/__init__.py13CODE
LOWpypdf/__init__.py14CODE
LOWpypdf/__init__.py15CODE
LOWpypdf/__init__.py17CODE
LOWpypdf/__init__.py17CODE
LOWpypdf/__init__.py18CODE
LOWpypdf/__init__.py19CODE
LOWpypdf/__init__.py19CODE
LOWpypdf/__init__.py20CODE
LOWpypdf/_font.py1CODE
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
LOWpypdf/_text_extraction/_layout_mode/__init__.py3CODE
LOWpypdf/_text_extraction/_layout_mode/__init__.py3CODE
LOWpypdf/_text_extraction/_layout_mode/__init__.py3CODE
LOWpypdf/_text_extraction/_layout_mode/__init__.py3CODE
45 more matches not shown…
Deep Nesting87 hits · 73 pts
SeverityFileLineSnippetContext
LOWresources/afm_to_dataclass.py23CODE
LOWresources/afm_to_dataclass.py50CODE
LOWtests/test_workflows.py668CODE
LOWtests/test_reader.py171CODE
LOWtests/test_reader.py188CODE
LOWtests/test_font.py139CODE
LOWtests/utils.py111CODE
LOWpypdf/_page_labels.py190CODE
LOWpypdf/_encryption.py73CODE
LOWpypdf/_encryption.py96CODE
LOWpypdf/_encryption.py1045CODE
LOWpypdf/_writer.py763CODE
LOWpypdf/_writer.py951CODE
LOWpypdf/_writer.py1450CODE
LOWpypdf/_writer.py1838CODE
LOWpypdf/_writer.py2000CODE
LOWpypdf/_writer.py2126CODE
LOWpypdf/_writer.py2233CODE
LOWpypdf/_writer.py2572CODE
LOWpypdf/_writer.py2694CODE
LOWpypdf/_writer.py2850CODE
LOWpypdf/_writer.py3022CODE
LOWpypdf/_writer.py3221CODE
LOWpypdf/_reader.py454CODE
LOWpypdf/_reader.py673CODE
LOWpypdf/_reader.py906CODE
LOWpypdf/_reader.py1040CODE
LOWpypdf/_reader.py1175CODE
LOWpypdf/_reader.py1364CODE
LOWpypdf/_reader.py1439CODE
LOWpypdf/xmp.py273CODE
LOWpypdf/xmp.py357CODE
LOWpypdf/xmp.py631CODE
LOWpypdf/_page.py830CODE
LOWpypdf/_page.py976CODE
LOWpypdf/_page.py1058CODE
LOWpypdf/_page.py1658CODE
LOWpypdf/_page.py1815CODE
LOWpypdf/_page.py2134CODE
LOWpypdf/_doc_common.py465CODE
LOWpypdf/_doc_common.py658CODE
LOWpypdf/_doc_common.py723CODE
LOWpypdf/_doc_common.py798CODE
LOWpypdf/_doc_common.py1069CODE
LOWpypdf/_doc_common.py1241CODE
LOWpypdf/_doc_common.py1490CODE
LOWpypdf/_doc_common.py1548CODE
LOWpypdf/_font.py367CODE
LOWpypdf/_font.py513CODE
LOWpypdf/_font.py634CODE
LOWpypdf/_cmap.py63CODE
LOWpypdf/_cmap.py205CODE
LOWpypdf/_cmap.py278CODE
LOWpypdf/_cmap.py372CODE
LOWpypdf/filters.py101CODE
LOWpypdf/filters.py812CODE
LOWpypdf/filters.py174CODE
LOWpypdf/filters.py268CODE
LOWpypdf/filters.py420CODE
LOWpypdf/filters.py646CODE
27 more matches not shown…
Docstring Block Structure14 hits · 70 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.py694 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.py722 Insert a blank page to this PDF file and return it. If no page size is specified for a dimension, use STRING
HIGHpypdf/_page.py594 Return a new blank page. If ``width`` or ``height`` is ``None``, try to get the page size fromSTRING
HIGHpypdf/filters.py179 Decode data which is flate-encoded. Args: data: Flate-encoded data. decode_parms: STRING
HIGHpypdf/filters.py359 Decode an ASCII-Hex encoded data stream. Args: data: a str sequence of hexadecimal-encoded vSTRING
HIGHpypdf/filters.py425 Decode a run length encoded data stream. Args: data: a bytes sequence of length/data STRING
HIGHpypdf/filters.py813 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.py567 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.py1114 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
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.py999 # Create a weak reference to the underlying object to test laterCOMMENT
MEDIUMtests/test_generic.py1027 # 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.py892 # Create a new StreamObject for the new_content_dataCOMMENT
MEDIUMpypdf/_writer.py905 # Create a new StreamObject in a new /Contents entry.COMMENT
MEDIUMpypdf/_writer.py2736 # Create a new PdfReader instance using the streamCOMMENT
MEDIUMpypdf/_font.py766 # Create the descendant font objectCOMMENT
MEDIUMpypdf/_font.py782 # Create the Type 0 font objectCOMMENT
MEDIUMpypdf/filters.py631# Create an alias for the old class nameCOMMENT
MEDIUMpypdf/_utils.py547# 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/_appearance_stream.py96 # Define the rotation matrixCOMMENT
MEDIUMpypdf/generic/_appearance_stream.py689 # Create a default appearance if none was found in the annotationCOMMENT
MEDIUMpypdf/generic/_appearance_stream.py766 # Create the TextStreamAppearance instanceCOMMENT
MEDIUMpypdf/generic/_link.py28# This module contains code used by _writer.py to track links in pagesCOMMENT
MEDIUMpypdf/_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 Wrapping56 hits · 54 pts
SeverityFileLineSnippetContext
LOWmake_release.py104 except Exception:CODE
LOWtests/test_reader.py649 except Exception:CODE
LOWtests/test_page.py67 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.py52 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.py2367def _get_page_layout(self) -> Optional[LayoutType]:CODE
LOWpypdf/_writer.py531 except Exception:CODE
LOWpypdf/_writer.py599 except Exception as exc: # pragma: no coverCODE
LOWpypdf/_writer.py3019 except Exception:CODE
LOWpypdf/_writer.py3239 except Exception:CODE
LOWpypdf/_writer.py3244 except Exception:CODE
LOWpypdf/_reader.py243 except Exception: # to be sure to capture all errorsCODE
LOWpypdf/_reader.py486 except Exception:CODE
LOWpypdf/_reader.py970 except Exception:CODE
LOWpypdf/_reader.py1014 except Exception:CODE
LOWpypdf/_reader.py1018 except Exception:CODE
LOWpypdf/_reader.py1070 except Exception:CODE
LOWpypdf/_reader.py1075 except Exception as e:CODE
LOWpypdf/_reader.py1123 except Exception:CODE
LOWpypdf/_reader.py1171 except Exception:CODE
LOWpypdf/_reader.py1426 except Exception: # could be multiple causesCODE
LOWpypdf/_page.py1797 except Exception:CODE
LOWpypdf/_page.py1808 except Exception:CODE
LOWpypdf/_page.py1960 except Exception as exception:CODE
LOWpypdf/_page.py2497 except Exception: # pragma: no coverCODE
LOWpypdf/_doc_common.py823 except Exception as exc:CODE
LOWpypdf/_doc_common.py883 except Exception as exc:CODE
LOWpypdf/_cmap.py97 except Exception:CODE
LOWpypdf/_cmap.py103 except Exception:CODE
LOWpypdf/_cmap.py121 except Exception:CODE
LOWpypdf/_text_extraction/__init__.py164 except Exception:CODE
LOWpypdf/_text_extraction/__init__.py196 except Exception:CODE
LOWpypdf/_text_extraction/_text_extractor.py250 except Exception:CODE
LOWpypdf/_text_extraction/_text_extractor.py261 except Exception:CODE
LOWpypdf/_text_extraction/_text_extractor.py306 except Exception:CODE
LOWpypdf/generic/_base.py162 except Exception:CODE
LOWpypdf/generic/_base.py496 except Exception as e:CODE
LOWpypdf/generic/_base.py921 except Exception:CODE
LOWpypdf/generic/_image_xobject.py723 except Exception as exception:CODE
LOWpypdf/generic/_data_structures.py1786 except Exception:CODE
LOWpypdf/generic/_data_structures.py1791 except Exception:CODE
LOWpypdf/generic/_data_structures.py127 except Exception:CODE
LOWpypdf/generic/_data_structures.py300 except Exception:CODE
LOWpypdf/generic/_data_structures.py405 except Exception:CODE
LOWpypdf/generic/_data_structures.py625 except Exception as exc:CODE
LOWpypdf/generic/_data_structures.py843 except Exception: # it means we are inserting in first positionCODE
LOWpypdf/generic/_data_structures.py989 except Exception:CODE
LOWpypdf/generic/_data_structures.py1025 except Exception:CODE
LOWpypdf/generic/_data_structures.py1291 except Exception:CODE
LOWpypdf/generic/_data_structures.py1325 except Exception:CODE
LOWpypdf/generic/_utils.py156 except Exception:CODE
LOWpypdf/_codecs/__init__.py13 except Exception:CODE
Over-Commented Block53 hits · 52 pts
SeverityFileLineSnippetContext
LOWtests/test_text_extraction.py821 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.txt21fonttools==4.60.2COMMENT
LOWrequirements/ci.txt41pycparser==2.22COMMENT
LOWrequirements/ci.txt61pytest-xdist==3.6.1COMMENT
LOWrequirements/ci-3.11.txt1#COMMENT
LOWrequirements/ci-3.11.txt21execnet==2.1.1COMMENT
LOWrequirements/ci-3.11.txt41pluggy==1.5.0COMMENT
LOWrequirements/ci-3.11.txt61pytest-socket==0.7.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/_reader.py941 while cnt < size:COMMENT
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.py121 """COMMENT
LOWpypdf/_utils.py1# Copyright (c) 2006, Mathieu FenniakCOMMENT
LOWpypdf/_utils.py541 return f"{bytes / 10**3:.1f} kB"COMMENT
LOWpypdf/_utils.py561# this list of conditions and the following disclaimer.COMMENT
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
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/_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
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
LOWtests/test_workflows.py163 .startswith("Lorem ipsum dolor sit amet")CODE
LOWtests/test_workflows.py163 .startswith("Lorem ipsum dolor sit amet")CODE
LOWtests/test_cmap.py302 assert "Lorem ipsum dolor sit amet" in reader.pages[0].extract_text()CODE
LOWtests/test_cmap.py302 assert "Lorem ipsum dolor sit amet" in reader.pages[0].extract_text()CODE
LOWtests/test_cmap.py328 assert page.extract_text() == "Lorem ipsum"CODE
LOWtests/test_writer.py462 assert "Lorem ipsum dolor sit amet" in extracted_textCODE
LOWtests/test_writer.py462 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
LOWtests/generic/test_data_structures.py216 assert ContentStream(stream=array2, pdf=None).get_data() == b"Lorem ipsum!\nShared stream 0\nShared stream 2\n"CODE
LOWtests/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
LOWtests/generic/test_files.py114 assert attachment.content.startswith(b"Hello World!\n\nLorem ipsum dolor sit amet, ")CODE
LOWtests/generic/test_files.py114 assert attachment.content.startswith(b"Hello World!\n\nLorem ipsum dolor sit amet, ")CODE
LOWtests/generic/test_files.py115 assert attachment.content.endswith(b"\ntakimata sanctus est Lorem ipsum dolor sit amet.\n")CODE
LOWtests/generic/test_files.py115 assert attachment.content.endswith(b"\ntakimata sanctus est Lorem ipsum dolor sit amet.\n")CODE
LOWtests/generic/test_files.py294 embedded_file.content = "Lorem ipsum dolor sit amet"CODE
LOWtests/generic/test_files.py294 embedded_file.content = "Lorem ipsum dolor sit amet"CODE
LOWtests/generic/test_files.py295 assert embedded_file.content == b"Lorem ipsum dolor sit amet"CODE
LOWtests/generic/test_files.py295 assert embedded_file.content == b"Lorem ipsum dolor sit amet"CODE
LOWtests/generic/test_files.py478 b"Hello World!\n\nLorem ipsum dolor sit amet, consetetur sad"CODE
LOWtests/generic/test_files.py478 b"Hello World!\n\nLorem ipsum dolor sit amet, consetetur sad"CODE
LOWtests/generic/test_files.py483 b"t Lorem\nipsum dolor sit amet. Lorem ipsum dolor sit amet"CODE
LOWtests/generic/test_files.py483 b"t Lorem\nipsum dolor sit amet. Lorem ipsum dolor sit amet"CODE
LOWtests/generic/test_files.py488 b"imata sanctus est Lorem ipsum dolor sit amet.\n"CODE
LOWtests/generic/test_files.py488 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.py553# ---------------------------------------------------------------------------------COMMENT
MEDIUMpypdf/_utils.py581# ---------------------------------------------------------------------------------COMMENT
MEDIUMpypdf/_codecs/adobe_glyphs.py41# -----------------------------------------------------------------------------COMMENT
MEDIUMpypdf/_codecs/adobe_glyphs.py80# -----------------------------------------------------------------------------COMMENT
MEDIUMpypdf/_codecs/core_font_metrics.py5# -----------------------------------------------------------------------------------------------COMMENT
MEDIUMpypdf/_codecs/core_font_metrics.py14# -----------------------------------------------------------------------------------------------COMMENT
MEDIUMpypdf/_codecs/_codecs.py185 # -------------------------------------------------------------------------COMMENT
MEDIUMpypdf/_codecs/_codecs.py210 # --------------------------------------------------------------------------COMMENT
Modern Structural Boilerplate27 hits · 26 pts
SeverityFileLineSnippetContext
LOWpypdf/_writer.py571 def set_need_appearances_writer(self, state: bool = True) -> None:CODE
LOWpypdf/_writer.py2373 def _set_page_layout(self, layout: Union[NameObject, LayoutType]) -> None:CODE
LOWpypdf/_writer.py2409 def set_page_layout(self, layout: LayoutType) -> None:CODE
LOWpypdf/__init__.py33__all__ = [CODE
LOWpypdf/xmp.py685 def _set_single_value(self, namespace: str, name: str, value: Optional[str]) -> None:CODE
LOWpypdf/xmp.py709 def _set_bag_values(self, namespace: str, name: str, values: Optional[list[str]]) -> None:CODE
LOWpypdf/xmp.py737 def _set_seq_values(self, namespace: str, name: str, values: Optional[list[str]]) -> None:CODE
LOWpypdf/xmp.py765 def _set_langalt_values(self, namespace: str, name: str, values: Optional[dict[str, str]]) -> None:CODE
LOWpypdf/xmp.py798 def _update_stream(self) -> None:CODE
LOWpypdf/_page.py136def _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
LOWpypdf/generic/_viewerpref.py65 def _set_bool(self, key: str, v: bool) -> None:CODE
LOWpypdf/generic/_viewerpref.py71 def _set_name(self, key: str, lst: list[str], v: NameObject) -> None:CODE
LOWpypdf/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.py96logger = logging.getLogger(__name__)CODE
LOWpypdf/generic/_data_structures.py1043 def set_data(self, data: bytes) -> None:CODE
LOWpypdf/generic/_data_structures.py1176 def set_data(self, data: bytes) -> None:CODE
LOWpypdf/generic/_data_structures.py1517 def set_data(self, data: bytes) -> None:CODE
LOWpypdf/_codecs/__init__.py49__all__ = [CODE
Cross-Language Confusion5 hits · 20 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_writer.py1963 # "I DO NOT Agree": null,COMMENT
HIGHtests/test_filters.py715 b"/DecodeParms [ null ]"CODE
HIGHpypdf/_page.py2539 that is called 'FontFilex' (where x is null, 2, or 3), then that fontname isSTRING
AI Slop Vocabulary4 hits · 12 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_reader.py1530 # 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
MEDIUMpypdf/generic/_data_structures.py1784 try: # Prefer to be more robust not only to null parametersCODE
MEDIUMpypdf/generic/_data_structures.py1789 try: # Prefer to be more robust not only to null parametersCODE
Redundant / Tautological Comments7 hits · 10 pts
SeverityFileLineSnippetContext
LOWtests/test_images.py69 # Check if the images have the same dimensionsCOMMENT
LOWtests/test_images.py73 # Check if the color modes are the sameCOMMENT
LOWtests/test_writer.py589 # Check if the title was setCOMMENT
LOWtests/test_merger.py129 # Check if outline is correctCOMMENT
LOWtests/bench.py100 # Check if outline is correctCOMMENT
LOWpypdf/_page.py729 # Check if displayed (in content stream)COMMENT
LOWpypdf/generic/_data_structures.py345 # Check if this is a chain list, we need to loop to prevent recurCOMMENT
Dead Code5 hits · 10 pts
SeverityFileLineSnippetContext
MEDIUMpypdf/generic/_data_structures.py1298CODE
MEDIUMpypdf/generic/_data_structures.py1299CODE
MEDIUMpypdf/generic/_data_structures.py1300CODE
MEDIUMpypdf/generic/_data_structures.py1301CODE
MEDIUMpypdf/generic/_data_structures.py1302CODE
Verbosity Indicators3 hits · 4 pts
SeverityFileLineSnippetContext
LOWtests/utils.py127 # Step 1: Count number of x- and y-coordinates of rectangles.COMMENT
LOWtests/utils.py150 # Step 2: Look for texts in rectangles.COMMENT
LOWtests/utils.py164 # Step 3: Build the list of rows containing list of cell-texts.COMMENT
Structural Annotation Overuse3 hits · 4 pts
SeverityFileLineSnippetContext
LOWtests/utils.py127 # Step 1: Count number of x- and y-coordinates of rectangles.COMMENT
LOWtests/utils.py150 # Step 2: Look for texts in rectangles.COMMENT
LOWtests/utils.py164 # Step 3: Build the list of rows containing list of cell-texts.COMMENT
AI Structural Patterns4 hits · 4 pts
SeverityFileLineSnippetContext
LOWpypdf/_writer.py177CODE
LOWpypdf/_page.py1815CODE
LOW…f/_text_extraction/_layout_mode/_text_state_manager.py123CODE
LOWpypdf/generic/_appearance_stream.py449CODE
Slop Phrases1 hit · 2 pts
SeverityFileLineSnippetContext
LOWpypdf/_page_labels.py245 # When there are no kids, make sure to exit the `while` loop directlyCOMMENT
TODO Padding1 hit · 2 pts
SeverityFileLineSnippetContext
LOWpypdf/generic/_image_xobject.py543 # TODO: implement maskCOMMENT