shlex.shlex.token

shlex.token The token buffer. It may be useful to examine this when catching exceptions.

shlex.shlex.whitespace_split

shlex.whitespace_split If True, tokens will only be split in whitespaces. This is useful, for example, for parsing command lines with shlex, getting tokens in a similar way to shell arguments.

shlex.shlex.sourcehook()

shlex.sourcehook(filename) When shlex detects a source request (see source below) this method is given the following token as argument, and expected to return a tuple consisting of a filename and an open file-like object. Normally, this method first strips any quotes off the argument. If the result is an absolute pathname, or there was no previous source request in effect, or the previous source was a stream (such as sys.stdin), the result is left alone. Otherwise, if the result is a relativ

shlex.shlex.whitespace

shlex.whitespace Characters that will be considered whitespace and skipped. Whitespace bounds tokens. By default, includes space, tab, linefeed and carriage-return.

shlex.shlex.wordchars

shlex.wordchars The string of characters that will accumulate into multi-character tokens. By default, includes all ASCII alphanumerics and underscore.

shlex.split()

shlex.split(s, comments=False, posix=True) Split the string s using shell-like syntax. If comments is False (the default), the parsing of comments in the given string will be disabled (setting the commenters attribute of the shlex instance to the empty string). This function operates in POSIX mode by default, but uses non-POSIX mode if the posix argument is false. Note Since the split() function instantiates a shlex instance, passing None for s will read the string to split from standard in

shlex.shlex.push_source()

shlex.push_source(newstream, newfile=None) Push an input source stream onto the input stack. If the filename argument is specified it will later be available for use in error messages. This is the same method used internally by the sourcehook() method.

shlex.shlex.push_token()

shlex.push_token(str) Push the argument onto the token stack.

shlex.shlex.instream

shlex.instream The input stream from which this shlex instance is reading characters.

shlex.shlex.source

shlex.source This attribute is None by default. If you assign a string to it, that string will be recognized as a lexical-level inclusion request similar to the source keyword in various shells. That is, the immediately following token will be opened as a filename and input will be taken from that stream until EOF, at which point the close() method of that stream will be called and the input source will again become the original input stream. Source requests may be stacked any number of leve