Skip to content

Commit

Permalink
minor cleanup, remove a few more Any types
Browse files Browse the repository at this point in the history
  • Loading branch information
0xabu committed Sep 6, 2021
1 parent b52a059 commit c0d62d6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pdfminer/ccitt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pdfminer/pdfdocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tools/dumppdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('<null />')
return
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions tools/pdfstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c0d62d6

Please sign in to comment.