MCPcopy Create free account
hub / github.com/PageBot/PageBot / addStyle

Method addStyle

Lib/pagebot/document.py:506–513  ·  view source on GitHub ↗

Adds the style to the self.styles dictionary. Makes sure that styles don't get overwritten, if force is False. Removes them first with *self.removeStyle* or use *self.replaceStyle(name, style)* instead.

(self, name, style, force=False)

Source from the content-addressed store, hash-verified

504 return style
505
506 def addStyle(self, name, style, force=False):
507 """Adds the style to the self.styles dictionary. Makes sure that styles
508 don't get overwritten, if force is False. Removes them first with
509 *self.removeStyle* or use *self.replaceStyle(name, style)* instead."""
510 if name in self.styles:
511 assert force
512 self.removeStyle(name)
513 self.replaceStyle(name, style)
514
515 def removeStyle(self, name):
516 """Removes the style *name* if it exists. Raises an error if is does not

Callers 1

initializeStylesMethod · 0.95

Calls 2

removeStyleMethod · 0.95
replaceStyleMethod · 0.95

Tested by

no test coverage detected