MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / delta

Method delta

lib/matplotlib/backends/backend_pdf.py:2542–2578  ·  view source on GitHub ↗

Copy properties of other into self and return PDF commands needed to transform *self* into *other*.

(self, other)

Source from the content-addressed store, hash-verified

2540 )
2541
2542 def delta(self, other):
2543 """
2544 Copy properties of other into self and return PDF commands
2545 needed to transform *self* into *other*.
2546 """
2547 cmds = []
2548 fill_performed = False
2549 for params, cmd in self.commands:
2550 different = False
2551 for p in params:
2552 ours = getattr(self, p)
2553 theirs = getattr(other, p)
2554 try:
2555 if ours is None or theirs is None:
2556 different = ours is not theirs
2557 else:
2558 different = bool(ours != theirs)
2559 except ValueError:
2560 ours = np.asarray(ours)
2561 theirs = np.asarray(theirs)
2562 different = (ours.shape != theirs.shape or
2563 np.any(ours != theirs))
2564 if different:
2565 break
2566
2567 # Need to update hatching if we also updated fillcolor
2568 if cmd.__name__ == 'hatch_cmd' and fill_performed:
2569 different = True
2570
2571 if different:
2572 if cmd.__name__ == 'fillcolor_cmd':
2573 fill_performed = True
2574 theirs = [getattr(other, p) for p in params]
2575 cmds.extend(cmd(self, *theirs))
2576 for p in params:
2577 setattr(self, p, getattr(other, p))
2578 return cmds
2579
2580 def copy_properties(self, other):
2581 """

Callers 1

check_gcMethod · 0.80

Calls 1

cmdFunction · 0.85

Tested by

no test coverage detected