Skip to content

Commit

Permalink
enable mypy on tests and tools, fix one implicit reexport bug
Browse files Browse the repository at this point in the history
  • Loading branch information
0xabu committed Sep 3, 2021
1 parent 4a83166 commit 7278d83
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 14 deletions.
3 changes: 2 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import os
import sys
from typing import List

import pdfminer

Expand Down Expand Up @@ -48,7 +49,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
exclude_patterns: List[str] = []


# -- Options for HTML output -------------------------------------------------
Expand Down
13 changes: 11 additions & 2 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@ warn_return_any = True
no_implicit_reexport = True
strict_equality = True

[mypy-pdfminer.ccitt]
disallow_untyped_calls = False

[mypy-cryptography.hazmat.*]
ignore_missing_imports = True

[mypy-pdfminer.ccitt]
disallow_untyped_calls = False
[mypy-hotshot.*]
ignore_missing_imports = True

[mypy-nose.*]
ignore_missing_imports = True

[mypy-setuptools]
ignore_missing_imports = True
2 changes: 1 addition & 1 deletion tools/conv_afm.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ def main(argv):


if __name__ == '__main__':
sys.exit(main(sys.argv))
sys.exit(main(sys.argv)) # type: ignore[no-untyped-call]
2 changes: 1 addition & 1 deletion tools/conv_cmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,4 @@ def usage():


if __name__ == '__main__':
sys.exit(main(sys.argv))
sys.exit(main(sys.argv)) # type: ignore[no-untyped-call]
2 changes: 1 addition & 1 deletion tools/conv_glyphlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ def main(argv):


if __name__ == '__main__':
sys.exit(main(sys.argv))
sys.exit(main(sys.argv)) # type: ignore[no-untyped-call]
2 changes: 1 addition & 1 deletion tools/dumppdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,4 +370,4 @@ def main(argv=None):


if __name__ == '__main__':
sys.exit(main())
sys.exit(main()) # type: ignore[no-untyped-call]
2 changes: 1 addition & 1 deletion tools/pdf2txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,4 @@ def main(args=None):


if __name__ == '__main__':
sys.exit(main())
sys.exit(main()) # type: ignore[no-untyped-call]
2 changes: 1 addition & 1 deletion tools/pdfdiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,4 @@ def main(args=None):


if __name__ == '__main__':
sys.exit(main())
sys.exit(main()) # type: ignore[no-untyped-call]
6 changes: 3 additions & 3 deletions tools/pdfstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import collections

from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage, PDFTextExtractionNotAllowed
from pdfminer.pdfdocument import PDFDocument, PDFTextExtractionNotAllowed
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import PDFPageAggregator
from pdfminer.layout import LAParams, LTContainer
Expand Down Expand Up @@ -79,4 +79,4 @@ def main(args):


if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
sys.exit(main(sys.argv[1:])) # type: ignore[no-untyped-call]
2 changes: 1 addition & 1 deletion tools/prof.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ def usage():


if __name__ == '__main__':
sys.exit(prof_main(sys.argv))
sys.exit(prof_main(sys.argv)) # type: ignore[no-untyped-call]
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ whitelist_externals =
flake8
commands =
flake8 pdfminer/ tools/ tests/ --count --statistics
mypy --install-types --non-interactive pdfminer
mypy --install-types --non-interactive --show-error-codes .
nosetests --nologcapture
python -m sphinx -b html docs/source docs/build/html
python -m sphinx -b doctest docs/source docs/build/doctest

0 comments on commit 7278d83

Please sign in to comment.