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

Class ParserState

lib/matplotlib/_mathtext.py:1876–1911  ·  view source on GitHub ↗

Parser state. States are pushed and popped from a stack as necessary, and the "current" state is always at the top of the stack. Upon entering and leaving a group { } or math/non-math, the stack is pushed and popped accordingly.

Source from the content-addressed store, hash-verified

1874
1875
1876class ParserState:
1877 """
1878 Parser state.
1879
1880 States are pushed and popped from a stack as necessary, and the "current"
1881 state is always at the top of the stack.
1882
1883 Upon entering and leaving a group { } or math/non-math, the stack is pushed
1884 and popped accordingly.
1885 """
1886
1887 def __init__(self, fontset: Fonts, font: str, font_class: str, fontsize: float,
1888 dpi: float):
1889 self.fontset = fontset
1890 self._font = font
1891 self.font_class = font_class
1892 self.fontsize = fontsize
1893 self.dpi = dpi
1894
1895 def copy(self) -> ParserState:
1896 return copy.copy(self)
1897
1898 @property
1899 def font(self) -> str:
1900 return self._font
1901
1902 @font.setter
1903 def font(self, name: str) -> None:
1904 if name in ('normal', 'rm', 'it', 'bf', 'bfit'):
1905 self.font_class = name
1906 self._font = name
1907
1908 def get_current_underline_thickness(self) -> float:
1909 """Return the underline thickness for this state."""
1910 return self.fontset.get_underline_thickness(
1911 self.font, self.fontsize, self.dpi)
1912
1913
1914def cmd(expr: str, args: ParserElement) -> ParserElement:

Callers 1

parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…