Skip to content

Commit

Permalink
replace match (python 3.10+ only)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersonhc committed Dec 29, 2024
1 parent 87fc1a7 commit 86afcc3
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions fpdf/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,20 +451,12 @@ def get_items(self, resource_type: PDFResourceType):

@classmethod
def _get_prefix(cls, resource_type: PDFResourceType):
match resource_type:
case PDFResourceType.EXT_G_STATE:
return "GS"
# COLOR_SPACE = intern("ColorSpece")
case PDFResourceType.PATTERN:
return "P"
case PDFResourceType.SHADDING:
return "Sh"
case PDFResourceType.X_OBJECT:
return "I"
case PDFResourceType.FONT:
return "F"
case _:
raise ValueError(f"No prefix for resource type {resource_type}")
if resource_type == PDFResourceType.PATTERN:
return "P"
elif resource_type == PDFResourceType.SHADDING:
return "Sh"
else:
raise ValueError(f"No prefix for resource type {resource_type}")


class OutputProducer:
Expand Down

0 comments on commit 86afcc3

Please sign in to comment.