Skip to content

Commit

Permalink
MNT: depreciate Resources and childs
Browse files Browse the repository at this point in the history
  • Loading branch information
pubpub-zz committed Mar 27, 2024
1 parent 8dbfeba commit 9190b1c
Showing 1 changed file with 63 additions and 2 deletions.
65 changes: 63 additions & 2 deletions pypdf/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from enum import IntFlag, auto
from typing import Dict, Tuple

from ._utils import deprecate_with_replacement


class Core:
"""Keywords that don't quite belong anywhere else."""
Expand Down Expand Up @@ -127,8 +129,11 @@ def all(cls) -> "UserAccessPermissions":
return cls((2**32 - 1) - cls.R1 - cls.R2)


class Ressources:
"""TABLE 3.30 Entries in a resource dictionary."""
class Resources:
"""
TABLE 3.30 Entries in a resource dictionary.
used to be Ressources
"""

EXT_G_STATE = "/ExtGState" # dictionary, optional
COLOR_SPACE = "/ColorSpace" # dictionary, optional
Expand All @@ -140,6 +145,62 @@ class Ressources:
PROPERTIES = "/Properties" # dictionary, optional


class Ressources: # deprecated
"""
Use :class: `Resources` instead.
.. deprecated:: 5.0.0
"""

@classmethod # type: ignore
@property
def EXT_G_STATE(cls) -> str:
deprecate_with_replacement("Ressources", "Resources", "5.0.0")
return "/ExtGState" # dictionary, optional

@classmethod # type: ignore
@property
def COLOR_SPACE(cls) -> str:
deprecate_with_replacement("Ressources", "Resources", "5.0.0")
return "/ColorSpace" # dictionary, optional

@classmethod # type: ignore
@property
def PATTERN(cls) -> str:
deprecate_with_replacement("Ressources", "Resources", "5.0.0")
return "/Pattern" # dictionary, optional

@classmethod # type: ignore
@property
def SHADING(cls) -> str:
deprecate_with_replacement("Ressources", "Resources", "5.0.0")
return "/Shading" # dictionary, optional

@classmethod # type: ignore
@property
def XOBJECT(cls) -> str:
deprecate_with_replacement("Ressources", "Resources", "5.0.0")
return "/XObject" # dictionary, optional

@classmethod # type: ignore
@property
def FONT(cls) -> str:
deprecate_with_replacement("Ressources", "Resources", "5.0.0")
return "/Font" # dictionary, optional

@classmethod # type: ignore
@property
def PROC_SET(cls) -> str:
deprecate_with_replacement("Ressources", "Resources", "5.0.0")
return "/ProcSet" # array, optional

@classmethod # type: ignore
@property
def PROPERTIES(cls) -> str:
deprecate_with_replacement("Ressources", "Resources", "5.0.0")
return "/Properties" # dictionary, optional


class PagesAttributes:
"""Page Attributes, Table 6.2, Page 52."""

Expand Down

0 comments on commit 9190b1c

Please sign in to comment.