pathlib.Path.expanduser()

Path.expanduser() Return a new path with expanded ~ and ~user constructs, as returned by os.path.expanduser(): >>> p = PosixPath('~/films/Monty Python') >>> p.expanduser() PosixPath('/home/eric/films/Monty Python') New in version 3.5.

pathlib.Path.exists()

Path.exists() Whether the path points to an existing file or directory: >>> Path('.').exists() True >>> Path('setup.py').exists() True >>> Path('/etc').exists() True >>> Path('nonexistentfile').exists() False Note If the path points to a symlink, exists() returns whether the symlink points to an existing file or directory.

pathlib.Path.cwd()

classmethod Path.cwd() Return a new path object representing the current directory (as returned by os.getcwd()): >>> Path.cwd() PosixPath('/home/antoine/pathlib')

pathlib.Path.chmod()

Path.chmod(mode) Change the file mode and permissions, like os.chmod(): >>> p = Path('setup.py') >>> p.stat().st_mode 33277 >>> p.chmod(0o444) >>> p.stat().st_mode 33060

pathlib.Path

class pathlib.Path(*pathsegments) A subclass of PurePath, this class represents concrete paths of the system’s path flavour (instantiating it creates either a PosixPath or a WindowsPath): >>> Path('setup.py') PosixPath('setup.py') pathsegments is specified similarly to PurePath.

parser.tuple2st()

parser.tuple2st(sequence) This is the same function as sequence2st(). This entry point is maintained for backward compatibility.

parser.suite()

parser.suite(source) The suite() function parses the parameter source as if it were an input to compile(source, 'file.py', 'exec'). If the parse succeeds, an ST object is created to hold the internal parse tree representation, otherwise an appropriate exception is raised.

parser.STType

parser.STType The type of the objects returned by expr(), suite() and sequence2st().

parser.st2tuple()

parser.st2tuple(st, line_info=False, col_info=False) This function accepts an ST object from the caller in st and returns a Python tuple representing the equivalent parse tree. Other than returning a tuple instead of a list, this function is identical to st2list(). If line_info is true, line number information will be included for all terminal tokens as a third element of the list representing the token. This information is omitted if the flag is false or omitted.

parser.st2list()

parser.st2list(st, line_info=False, col_info=False) This function accepts an ST object from the caller in st and returns a Python list representing the equivalent parse tree. The resulting list representation can be used for inspection or the creation of a new parse tree in list form. This function does not fail so long as memory is available to build the list representation. If the parse tree will only be used for inspection, st2tuple() should be used instead to reduce memory consumption an