From c0d62d6c54c7ec37b40bea54a3f6a7a618ec0ec6 Mon Sep 17 00:00:00 2001 From: Andrew Baumann Date: Mon, 6 Sep 2021 15:13:08 -0700 Subject: [PATCH] minor cleanup, remove a few more Any types --- pdfminer/ccitt.py | 2 +- pdfminer/pdfdocument.py | 2 +- tools/dumppdf.py | 4 ++-- tools/pdfstats.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pdfminer/ccitt.py b/pdfminer/ccitt.py index ceae95a6..c2b8bb40 100644 --- a/pdfminer/ccitt.py +++ b/pdfminer/ccitt.py @@ -571,7 +571,7 @@ def ccittfaxdecode(data: bytes, params: Dict[str, object]) -> bytes: else: raise ValueError(K) parser.feedbytes(data) - return parser.close() # type: ignore[no-any-return] + return parser.close() # test diff --git a/pdfminer/pdfdocument.py b/pdfminer/pdfdocument.py index e1bfaa47..177bde26 100644 --- a/pdfminer/pdfdocument.py +++ b/pdfminer/pdfdocument.py @@ -764,7 +764,7 @@ def get_outlines(self) -> Iterator[OutlineType]: if 'Outlines' not in self.catalog: raise PDFNoOutlines - def search(entry: Any, level: int + def search(entry: object, level: int ) -> Iterator[PDFDocument.OutlineType]: entry = dict_value(entry) if 'Title' in entry: diff --git a/tools/dumppdf.py b/tools/dumppdf.py index 8455caa6..dbc4990a 100755 --- a/tools/dumppdf.py +++ b/tools/dumppdf.py @@ -32,7 +32,7 @@ def escape(s: Union[str, bytes]) -> str: return ESC_PAT.sub(lambda m: '&#%d;' % ord(m.group(0)), us) -def dumpxml(out: TextIO, obj: Any, codec: Optional[str] = None) -> None: +def dumpxml(out: TextIO, obj: object, codec: Optional[str] = None) -> None: if obj is None: out.write('') return @@ -149,7 +149,7 @@ def dumpoutline(outfp: TextIO, fname: str, objids: Any, pages = {page.pageid: pageno for (pageno, page) in enumerate(PDFPage.create_pages(doc), 1)} - def resolve_dest(dest: Any) -> Any: + def resolve_dest(dest: object) -> Any: if isinstance(dest, (str, bytes)): dest = resolve1(doc.get_dest(dest)) elif isinstance(dest, PSLiteral): diff --git a/tools/pdfstats.py b/tools/pdfstats.py index b1ce73d5..9bf34720 100755 --- a/tools/pdfstats.py +++ b/tools/pdfstats.py @@ -20,11 +20,11 @@ _, SCRIPT = os.path.split(__file__) -def msg(*args: Any, **kwargs: Any) -> None: +def msg(*args: object, **kwargs: Any) -> None: print(' '.join(map(str, args)), **kwargs) # noqa E999 -def flat_iter(obj: Any) -> Iterator[Any]: +def flat_iter(obj: object) -> Iterator[object]: yield obj if isinstance(obj, LTContainer): for ob in obj: