MCPcopy Index your code
hub / github.com/python/cpython / Terminal

Class Terminal

Lib/email/_header_value_parser.py:903–943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

901#
902
903class Terminal(str):
904
905 as_ew_allowed = True
906 ew_combine_allowed = True
907 syntactic_break = True
908
909 def __new__(cls, value, token_type):
910 self = super().__new__(cls, value)
911 self.token_type = token_type
912 self.defects = []
913 return self
914
915 def __repr__(self):
916 return "{}({})".format(self.__class__.__name__, super().__repr__())
917
918 def pprint(self):
919 print(self.__class__.__name__ + '/' + self.token_type)
920
921 @property
922 def all_defects(self):
923 return list(self.defects)
924
925 def _pp(self, indent=''):
926 return ["{}{}/{}({}){}".format(
927 indent,
928 self.__class__.__name__,
929 self.token_type,
930 super().__repr__(),
931 '' if not self.defects else ' {}'.format(self.defects),
932 )]
933
934 def pop_trailing_ws(self):
935 # This terminates the recursion.
936 return None
937
938 @property
939 def comments(self):
940 return []
941
942 def __getnewargs__(self):
943 return(str(self), self.token_type)
944
945
946class WhiteSpaceTerminal(Terminal):

Callers 1

_refold_parse_treeFunction · 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…