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

Method parseline

Lib/cmd.py:183–201  ·  view source on GitHub ↗

Parse the line into a command name and a string containing the arguments. Returns a tuple containing (command, args, line). 'command' and 'args' may be None if the line couldn't be parsed.

(self, line)

Source from the content-addressed store, hash-verified

181 pass
182
183 def parseline(self, line):
184 """Parse the line into a command name and a string containing
185 the arguments. Returns a tuple containing (command, args, line).
186 'command' and 'args' may be None if the line couldn't be parsed.
187 """
188 line = line.strip()
189 if not line:
190 return None, None, line
191 elif line[0] == '?':
192 line = 'help ' + line[1:]
193 elif line[0] == '!':
194 if hasattr(self, 'do_shell'):
195 line = 'shell ' + line[1:]
196 else:
197 return None, None, line
198 i, n = 0, len(line)
199 while i < n and line[i] in self.identchars: i = i+1
200 cmd, arg = line[:i], line[i:].strip()
201 return cmd, arg, line
202
203 def onecmd(self, line):
204 """Interpret the argument as though it had been typed in response

Callers 6

onecmdMethod · 0.95
completeMethod · 0.95
onecmdMethod · 0.80
handle_command_defMethod · 0.80
_complete_anyMethod · 0.80
read_commandMethod · 0.80

Calls 1

stripMethod · 0.45

Tested by

no test coverage detected