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

Method is_math_text

site-packages/matplotlib/textpath.py:530–547  ·  view source on GitHub ↗

Returns True if the given string *s* contains any mathtext.

(self, s)

Source from the content-addressed store, hash-verified

528 self._invalid = False
529
530 def is_math_text(self, s):
531 """
532 Returns True if the given string *s* contains any mathtext.
533 """
534 # copied from Text.is_math_text -JJL
535
536 # Did we find an even number of non-escaped dollar signs?
537 # If so, treat is as math text.
538 dollar_count = s.count(r'$') - s.count(r'\$')
539 even_dollars = (dollar_count > 0 and dollar_count % 2 == 0)
540
541 if rcParams['text.usetex']:
542 return s, 'TeX'
543
544 if even_dollars:
545 return s, True
546 else:
547 return s.replace(r'\$', '$'), False
548
549 def text_get_vertices_codes(self, prop, s, usetex):
550 """

Callers 1

Calls 2

countMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected