From 03bf8cd42ce4cece2af78c7adfec4b2e45fe2a8a Mon Sep 17 00:00:00 2001 From: j-t-1 <120829237+j-t-1@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:25:16 +0000 Subject: [PATCH] STY: Use generator expressions --- pypdf/_doc_common.py | 2 +- pypdf/_reader.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pypdf/_doc_common.py b/pypdf/_doc_common.py index e8b7a0665..6757a6211 100644 --- a/pypdf/_doc_common.py +++ b/pypdf/_doc_common.py @@ -715,7 +715,7 @@ def indexed_key(k: str, fields: Dict[Any, Any]) -> str: return ( k + "." - + str(sum([1 for kk in fields if kk.startswith(k + ".")]) + 2) + + str(sum(1 for kk in fields if kk.startswith(k + ".")) + 2) ) # Retrieve document form fields diff --git a/pypdf/_reader.py b/pypdf/_reader.py index b04ea1761..16c24db09 100644 --- a/pypdf/_reader.py +++ b/pypdf/_reader.py @@ -1181,7 +1181,7 @@ def add_form_topname(self, name: str) -> Optional[DictionaryObject]: interim[NameObject("/Kids")] = acroform[NameObject("/Fields")] self.cache_indirect_object( 0, - max([i for (g, i) in self.resolved_objects if g == 0]) + 1, + max(i for (g, i) in self.resolved_objects if g == 0) + 1, interim, ) arr = ArrayObject()