Skip to content

MAINT: Tweak comments #3257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pypdf/_doc_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,13 +978,13 @@ def _build_outline_item(self, node: DictionaryObject) -> Optional[Destination]:
title = ""

if "/A" in node:
# Action, PDFv1.7 Section 12.6 (only type GoTo supported)
# Action, PDF 1.7 and PDF 2.0 §12.6 (only type GoTo supported)
action = cast(DictionaryObject, node["/A"])
action_type = cast(NameObject, action[GoToActionArguments.S])
if action_type == "/GoTo":
dest = action[GoToActionArguments.D]
elif "/Dest" in node:
# Destination, PDFv1.7 Section 12.3.2
# Destination, PDF 1.7 and PDF 2.0 §12.3.2
dest = node["/Dest"]
# if array was referenced in another object, will be a dict w/ key "/D"
if isinstance(dest, DictionaryObject) and "/D" in dest:
Expand All @@ -994,7 +994,7 @@ def _build_outline_item(self, node: DictionaryObject) -> Optional[Destination]:
outline_item = self._build_destination(title, dest)
elif isinstance(dest, str):
# named destination, addresses NameObject Issue #193
# TODO : keep named destination instead of replacing it ?
# TODO: Keep named destination instead of replacing it?
try:
outline_item = self._build_destination(
title, self._named_destinations[dest].dest_array
Expand Down Expand Up @@ -1028,7 +1028,7 @@ def _build_outline_item(self, node: DictionaryObject) -> Optional[Destination]:
# absolute value = num. visible children
# with positive = open/unfolded, negative = closed/folded
outline_item[NameObject("/Count")] = node["/Count"]
# if count is 0 we will consider it as open ( in order to have always an is_open to simplify
# if count is 0 we will consider it as open (to have available is_open)
outline_item[NameObject("/%is_open%")] = BooleanObject(
node.get("/Count", 0) >= 0
)
Expand Down Expand Up @@ -1428,8 +1428,8 @@ def _repr_mimebundle_(


class LazyDict(Mapping[Any, Any]):
def __init__(self, *args: Any, **kw: Any) -> None:
self._raw_dict = dict(*args, **kw)
def __init__(self, *args: Any, **kwargs: Any) -> None:
self._raw_dict = dict(*args, **kwargs)

def __getitem__(self, key: str) -> Any:
func, arg = self._raw_dict.__getitem__(key)
Expand Down
Loading