Skip to content

Commit

Permalink
fix: support python 3.9 properly
Browse files Browse the repository at this point in the history
  • Loading branch information
dhdaines committed Nov 20, 2024
1 parent 0fe084b commit 8209a12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.9"
- name: Install Hatch
uses: pypa/hatch@install
- name: Run tests
Expand Down
7 changes: 5 additions & 2 deletions playa/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,16 @@ def _load(self, parser: IndirectObjectParser) -> None:
objid1 = objs[index * 2]
self.offsets[objid1] = XRefPos(obj.objid, index, 0)
# Now get the trailer
for s1, s2 in itertools.pairwise(parser.trailer):
itor = iter(parser.trailer)
s1 = next(itor)
for s2 in itor:
_, token = s1
if token is KEYWORD_TRAILER:
_, dic = s2
self.trailer.update(dict_value(dic))
log.debug("trailer=%r", self.trailer)
break
s1 = s2
else:
log.warning("b'trailer' not found in document")

Expand Down Expand Up @@ -1258,7 +1261,7 @@ def __len__(self) -> int:
def __iter__(self) -> Iterator[Page]:
return iter(self._pages)

def __getitem__(self, key: int | str) -> Page:
def __getitem__(self, key: Union[int, str]) -> Page:
if isinstance(key, int):
return self._pages[key]
else:
Expand Down

0 comments on commit 8209a12

Please sign in to comment.