MCPcopy Create free account
hub / github.com/scanny/python-pptx / _set_boolean_property

Method _set_boolean_property

src/pptx/oxml/table.py:151–162  ·  view source on GitHub ↗

Generalized setter for boolean properties on the `a:tblPr` child element. Sets `propname` attribute appropriately based on `value`. If `value` is True, the attribute is set to "1"; a tblPr child element is added if necessary. If `value` is False, the `propname` attribute is

(self, propname: str, value: bool)

Source from the content-addressed store, hash-verified

149 return {True: True, False: False, None: False}[propval]
150
151 def _set_boolean_property(self, propname: str, value: bool) -> None:
152 """Generalized setter for boolean properties on the `a:tblPr` child element.
153
154 Sets `propname` attribute appropriately based on `value`. If `value` is True, the
155 attribute is set to "1"; a tblPr child element is added if necessary. If `value` is False,
156 the `propname` attribute is removed if present, allowing its default value of False to be
157 its effective value.
158 """
159 if value not in (True, False):
160 raise ValueError("assigned value must be either True or False, got %s" % value)
161 tblPr = self.get_or_add_tblPr()
162 setattr(tblPr, propname, value)
163
164 @classmethod
165 def _tbl_tmpl(cls):

Callers 6

bandColMethod · 0.95
bandRowMethod · 0.95
firstColMethod · 0.95
firstRowMethod · 0.95
lastColMethod · 0.95
lastRowMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected