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

Method push_source

Lib/shlex.py:76–88  ·  view source on GitHub ↗

Push an input source onto the lexer's input source stack.

(self, newstream, newfile=None)

Source from the content-addressed store, hash-verified

74 self.pushback.appendleft(tok)
75
76 def push_source(self, newstream, newfile=None):
77 "Push an input source onto the lexer's input source stack."
78 if isinstance(newstream, str):
79 newstream = StringIO(newstream)
80 self.filestack.appendleft((self.infile, self.instream, self.lineno))
81 self.infile = newfile
82 self.instream = newstream
83 self.lineno = 1
84 if self.debug:
85 if newfile is not None:
86 print('shlex: pushing to file %s' % (self.infile,))
87 else:
88 print('shlex: pushing to stream %s' % (self.instream,))
89
90 def pop_source(self):
91 "Pop the input source stack."

Callers 1

get_tokenMethod · 0.95

Calls 1

StringIOClass · 0.90

Tested by

no test coverage detected