Skip to content

Commit

Permalink
STY: Put __init__ first (#2970)
Browse files Browse the repository at this point in the history
Just for convention, put `__init__` as the first member of the class ViewerPreferences.
  • Loading branch information
j-t-1 authored Nov 28, 2024
1 parent e8cb703 commit db460c0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pypdf/generic/_viewerpref.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@


class ViewerPreferences(DictionaryObject):
def __init__(self, obj: Optional[DictionaryObject] = None) -> None:
super().__init__(self)
if not is_null_or_none(obj):
self.update(obj.items()) # type: ignore
try:
self.indirect_reference = obj.indirect_reference # type: ignore
except AttributeError:
pass

def _get_bool(self, key: str, default: Optional[BooleanObject]) -> BooleanObject:
return self.get(key, default)

Expand Down Expand Up @@ -153,12 +162,3 @@ def _add_prop_int(key: str, default: Optional[int]) -> property:
cls.enforce = _add_prop_arr("/Enforce", ArrayObject())

return DictionaryObject.__new__(cls)

def __init__(self, obj: Optional[DictionaryObject] = None) -> None:
super().__init__(self)
if not is_null_or_none(obj):
self.update(obj.items()) # type: ignore
try:
self.indirect_reference = obj.indirect_reference # type: ignore
except AttributeError:
pass

0 comments on commit db460c0

Please sign in to comment.