MCPcopy Index your code
hub / github.com/ipython/ipython / parse

Method parse

IPython/utils/text.py:547–565  ·  view source on GitHub ↗
(self, fmt_string: str)

Source from the content-addressed store, hash-verified

545 )
546
547 def parse(self, fmt_string: str) -> Iterator[Tuple[Any, Any, Any, Any]]:
548 for literal_txt, field_name, format_spec, conversion in Formatter.parse(
549 self, fmt_string
550 ):
551 # Find $foo patterns in the literal text.
552 continue_from = 0
553 txt = ""
554 for m in self._dollar_pattern_ignore_single_quote.finditer(literal_txt):
555 new_txt, new_field = m.group(1,2)
556 # $$foo --> $foo
557 if new_field.startswith("$"):
558 txt += new_txt + new_field
559 else:
560 yield (txt + new_txt, new_field, "", None)
561 txt = ""
562 continue_from = m.end()
563
564 # Re-yield the {foo} style pattern
565 yield (txt + literal_txt[continue_from:], field_name, format_spec, conversion)
566
567 def __repr__(self) -> str:
568 return "<DollarFormatter>"

Callers 15

vformatMethod · 0.45
guarded_evalFunction · 0.45
_trim_exprMethod · 0.45
timeitMethod · 0.45
code_wrapMethod · 0.45
extract_symbolsFunction · 0.45
from_stringMethod · 0.45
visit_ModuleMethod · 0.45
latex_to_png_mplFunction · 0.45
process_pure_pythonMethod · 0.45

Calls 1

groupMethod · 0.80