MCPcopy Index your code
hub / github.com/python-openxml/python-docx / __getitem__

Method __getitem__

src/docx/styles/latent.py:12–18  ·  view source on GitHub ↗

Enables dictionary-style access to a latent style by name.

(self, key)

Source from the content-addressed store, hash-verified

10 for a particular named latent style."""
11
12 def __getitem__(self, key):
13 """Enables dictionary-style access to a latent style by name."""
14 style_name = BabelFish.ui2internal(key)
15 lsdException = self._element.get_by_name(style_name)
16 if lsdException is None:
17 raise KeyError("no latent style with name '%s'" % key)
18 return _LatentStyle(lsdException)
19
20 def __iter__(self):
21 return (_LatentStyle(ls) for ls in self._element.lsdException_lst)

Callers

nothing calls this directly

Calls 3

_LatentStyleClass · 0.85
ui2internalMethod · 0.80
get_by_nameMethod · 0.45

Tested by

no test coverage detected