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

Method _auto_sized_delimiter

lib/matplotlib/_mathtext.py:2966–3002  ·  view source on GitHub ↗
(self, front: str,
                              middle: list[Box | Char | str],
                              back: str)

Source from the content-addressed store, hash-verified

2964 return [Hlist([vlist])]
2965
2966 def _auto_sized_delimiter(self, front: str,
2967 middle: list[Box | Char | str],
2968 back: str) -> T.Any:
2969 state = self.get_state()
2970 if len(middle):
2971 height = max([x.height for x in middle if not isinstance(x, str)])
2972 depth = max([x.depth for x in middle if not isinstance(x, str)])
2973 factor = None
2974 for idx, el in enumerate(middle):
2975 if el == r'\middle':
2976 c = T.cast(str, middle[idx + 1]) # Should be one of p.delims.
2977 if c != '.':
2978 middle[idx + 1] = AutoHeightChar(
2979 c, height, depth, state, factor=factor)
2980 else:
2981 middle.remove(c)
2982 del middle[idx]
2983 # There should only be \middle and its delimiter as str, which have
2984 # just been removed.
2985 middle_part = T.cast(list[Box | Char], middle)
2986 else:
2987 height = 0
2988 depth = 0
2989 factor = 1.0
2990 middle_part = []
2991
2992 parts: list[Node] = []
2993 # \left. and \right. aren't supposed to produce any symbols
2994 if front != '.':
2995 parts.append(
2996 AutoHeightChar(front, height, depth, state, factor=factor))
2997 parts.extend(middle_part)
2998 if back != '.':
2999 parts.append(
3000 AutoHeightChar(back, height, depth, state, factor=factor))
3001 hlist = Hlist(parts)
3002 return hlist
3003
3004 def auto_delim(self, toks: ParseResults) -> T.Any:
3005 return self._auto_sized_delimiter(

Callers 2

_genfracMethod · 0.95
auto_delimMethod · 0.95

Calls 4

get_stateMethod · 0.95
AutoHeightCharClass · 0.85
HlistClass · 0.85
removeMethod · 0.45

Tested by

no test coverage detected