MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / symbol

Method symbol

site-packages/matplotlib/mathtext.py:2625–2662  ·  view source on GitHub ↗
(self, s, loc, toks)

Source from the content-addressed store, hash-verified

2623 return [self._make_space(float(toks[0]))]
2624
2625 def symbol(self, s, loc, toks):
2626 c = toks[0]
2627 try:
2628 char = Char(c, self.get_state())
2629 except ValueError:
2630 raise ParseFatalException(s, loc, "Unknown symbol: %s" % c)
2631
2632 if c in self._spaced_symbols:
2633 # iterate until we find previous character, needed for cases
2634 # such as ${ -2}$, $ -2$, or $ -2$.
2635 prev_char = next((c for c in s[:loc][::-1] if c != ' '), '')
2636 # Binary operators at start of string should not be spaced
2637 if (c in self._binary_operators and
2638 (len(s[:loc].split()) == 0 or prev_char == '{' or
2639 prev_char in self._left_delim)):
2640 return [char]
2641 else:
2642 return [Hlist([self._make_space(0.2),
2643 char,
2644 self._make_space(0.2)] ,
2645 do_kern = True)]
2646 elif c in self._punctuation_symbols:
2647
2648 # Do not space commas between brackets
2649 if c == ',':
2650 prev_char = next((c for c in s[:loc][::-1] if c != ' '), '')
2651 next_char = next((c for c in s[loc + 1:] if c != ' '), '')
2652 if prev_char == '{' and next_char == '}':
2653 return [char]
2654
2655 # Do not space dots as decimal separators
2656 if c == '.' and s[loc - 1].isdigit() and s[loc + 1].isdigit():
2657 return [char]
2658 else:
2659 return [Hlist([char,
2660 self._make_space(0.2)],
2661 do_kern = True)]
2662 return [char]
2663
2664 snowflake = symbol
2665

Callers 1

subsuperMethod · 0.95

Calls 8

get_stateMethod · 0.95
_make_spaceMethod · 0.95
ParseFatalExceptionClass · 0.90
HlistClass · 0.85
isdigitMethod · 0.80
CharClass · 0.70
nextFunction · 0.50
splitMethod · 0.45

Tested by

no test coverage detected