Skip to content

Commit

Permalink
Merge pull request #56 from 0xabu/typed_pdfminer
Browse files Browse the repository at this point in the history
Use new pdfminer release, with type annotations
  • Loading branch information
0xabu authored Mar 19, 2022
2 parents 0e68261 + 05e90fd commit 29780ef
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 18 deletions.
14 changes: 0 additions & 14 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,3 @@ warn_unused_ignores = True
warn_return_any = True
no_implicit_reexport = True
strict_equality = True

[mypy-pdfannots.*]
# temporary, for https://github.com/pdfminer/pdfminer.six/pull/661
warn_unused_ignores = False

[mypy-pdfminer.*]
ignore_missing_imports = True
disallow_untyped_calls = False
disallow_untyped_defs = False
check_untyped_defs = False
warn_unused_ignores = False

[mypy-cryptography.hazmat.*]
ignore_missing_imports = True
3 changes: 1 addition & 2 deletions pdfannots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ def walk_number_tree(td: typing.Dict[typing.Any, typing.Any]
yield prefix + label


class _PDFProcessor(PDFLayoutAnalyzer): # type:ignore
# (pdfminer lacks type annotations)
class _PDFProcessor(PDFLayoutAnalyzer):
"""
PDF processor class.
Expand Down
2 changes: 1 addition & 1 deletion pdfannots/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def __lt__(self, other: typing.Any) -> bool:

def item_hit(self, item: LTComponent) -> bool:
"""Is this pos within the bounding box of the given PDF component?"""
return (self.x >= item.x0 # type: ignore [no-any-return]
return (self.x >= item.x0
and self.x <= item.x1
and self.y >= item.y0
and self.y <= item.y1)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pip requirements for pdfannots
# Use as: pip3 install -r requirements.txt

pdfminer.six == 20201018
pdfminer.six == 20220319

0 comments on commit 29780ef

Please sign in to comment.