MCPcopy Index your code
hub / github.com/RustPython/RustPython / Terminal

Class Terminal

Lib/email/_header_value_parser.py:886–926  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

884#
885
886class Terminal(str):
887
888 as_ew_allowed = True
889 ew_combine_allowed = True
890 syntactic_break = True
891
892 def __new__(cls, value, token_type):
893 self = super().__new__(cls, value)
894 self.token_type = token_type
895 self.defects = []
896 return self
897
898 def __repr__(self):
899 return "{}({})".format(self.__class__.__name__, super().__repr__())
900
901 def pprint(self):
902 print(self.__class__.__name__ + '/' + self.token_type)
903
904 @property
905 def all_defects(self):
906 return list(self.defects)
907
908 def _pp(self, indent=''):
909 return ["{}{}/{}({}){}".format(
910 indent,
911 self.__class__.__name__,
912 self.token_type,
913 super().__repr__(),
914 '' if not self.defects else ' {}'.format(self.defects),
915 )]
916
917 def pop_trailing_ws(self):
918 # This terminates the recursion.
919 return None
920
921 @property
922 def comments(self):
923 return []
924
925 def __getnewargs__(self):
926 return(str(self), self.token_type)
927
928
929class WhiteSpaceTerminal(Terminal):

Callers 1

_refold_parse_treeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected