MCPcopy Create free account
hub / github.com/ipython/ipython / back_latex_name_matches

Function back_latex_name_matches

IPython/core/completer.py:919–944  ·  view source on GitHub ↗

Match latex characters back to unicode name This does ``\\ℵ`` -> ``\\aleph`` Used on Python 3 only.

(text:str)

Source from the content-addressed store, hash-verified

917 return u'', ()
918
919def back_latex_name_matches(text:str):
920 """Match latex characters back to unicode name
921
922 This does ``\\ℵ`` -> ``\\aleph``
923
924 Used on Python 3 only.
925 """
926 if len(text)<2:
927 return u'', ()
928 maybe_slash = text[-2]
929 if maybe_slash != '\\':
930 return u'', ()
931
932
933 char = text[-1]
934 # no expand on quote for completion in strings.
935 # nor backcomplete standard ascii keys
936 if char in string.ascii_letters or char in ['"',"'"]:
937 return u'', ()
938 try :
939 latex = reverse_latex_symbol[char]
940 # '\\' replace the \ as well
941 return '\\'+char,[latex]
942 except KeyError:
943 pass
944 return u'', ()
945
946
947def _formatparamchildren(parameter) -> str:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected