MCPcopy
hub / github.com/ArtifexSoftware/pdf2docx / restore

Method restore

pdf2docx/shape/Shapes.py:13–26  ·  view source on GitHub ↗

Clean current instances and restore them from source dicts.

(self, raws:list)

Source from the content-addressed store, hash-verified

11 ''' A collection of ``Shape`` instances: ``Stroke`` or ``Fill``.'''
12
13 def restore(self, raws:list):
14 '''Clean current instances and restore them from source dicts.'''
15 self.reset()
16 # Distinguish specified type by key like `start`, `end` and `uri`.
17 for raw in raws:
18 if 'start' in raw:
19 shape = Stroke(raw)
20 elif 'uri' in raw:
21 shape = Hyperlink(raw)
22 else:
23 shape = Fill(raw)
24 # add to list
25 self.append(shape)
26 return self
27
28
29 def _update_bbox(self, e:Shape):

Callers

nothing calls this directly

Calls 5

StrokeClass · 0.90
HyperlinkClass · 0.90
FillClass · 0.90
resetMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected