shlex.shlex.debug

shlex.debug If this attribute is numeric and 1 or more, a shlex instance will print verbose progress output on its behavior. If you need to use this, you can read the module source code to learn the details.

shlex.shlex.commenters

shlex.commenters The string of characters that are recognized as comment beginners. All characters from the comment beginner to end of line are ignored. Includes just '#' by default.

shlex.shlex

class shlex.shlex(instream=None, infile=None, posix=False) A shlex instance or subclass instance is a lexical analyzer object. The initialization argument, if present, specifies where to read characters from. It must be a file-/stream-like object with read() and readline() methods, or a string. If no argument is given, input will be taken from sys.stdin. The second optional argument is a filename string, which sets the initial value of the infile attribute. If the instream argument is omitte

shlex.quote()

shlex.quote(s) Return a shell-escaped version of the string s. The returned value is a string that can safely be used as one token in a shell command line, for cases where you cannot use a list. This idiom would be unsafe: >>> filename = 'somefile; rm -rf ~' >>> command = 'ls -l {}'.format(filename) >>> print(command) # executed by a shell: boom! ls -l somefile; rm -rf ~ quote() lets you plug the security hole: >>> command = 'ls -l {}'.format(quote(filen

shelve.Shelf.sync()

Shelf.sync() Write back all entries in the cache if the shelf was opened with writeback set to True. Also empty the cache and synchronize the persistent dictionary on disk, if feasible. This is called automatically when the shelf is closed with close().

shelve.Shelf.close()

Shelf.close() Synchronize and close the persistent dict object. Operations on a closed shelf will fail with a ValueError.

shelve.Shelf

class shelve.Shelf(dict, protocol=None, writeback=False, keyencoding='utf-8') A subclass of collections.abc.MutableMapping which stores pickled values in the dict object. By default, version 3 pickles are used to serialize values. The version of the pickle protocol can be specified with the protocol parameter. See the pickle documentation for a discussion of the pickle protocols. If the writeback parameter is True, the object will hold a cache of all entries accessed and write them back to t

shelve.open()

shelve.open(filename, flag='c', protocol=None, writeback=False) Open a persistent dictionary. The filename specified is the base filename for the underlying database. As a side-effect, an extension may be added to the filename and more than one file may be created. By default, the underlying database file is opened for reading and writing. The optional flag parameter has the same interpretation as the flag parameter of dbm.open(). By default, version 3 pickles are used to serialize values. T

shelve.DbfilenameShelf

class shelve.DbfilenameShelf(filename, flag='c', protocol=None, writeback=False) A subclass of Shelf which accepts a filename instead of a dict-like object. The underlying file will be opened using dbm.open(). By default, the file will be created and opened for both read and write. The optional flag parameter has the same interpretation as for the open() function. The optional protocol and writeback parameters have the same interpretation as for the Shelf class.

shelve.BsdDbShelf

class shelve.BsdDbShelf(dict, protocol=None, writeback=False, keyencoding='utf-8') A subclass of Shelf which exposes first(), next(), previous(), last() and set_location() which are available in the third-party bsddb module from pybsddb but not in other database modules. The dict object passed to the constructor must support those methods. This is generally accomplished by calling one of bsddb.hashopen(), bsddb.btopen() or bsddb.rnopen(). The optional protocol, writeback, and keyencoding par