💾 Archived View for tris.fyi › pydoc › compileall captured on 2023-04-26 at 13:27:58. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
Module/script to byte-compile all .py files to .pyc files. When called as a script with arguments, this compiles the directories given as arguments recursively; the -l option prevents it from recursing into directories. Without arguments, if compiles all modules on sys.path, without recursing into subdirectories. (Even though it should do so for packages -- for now, you'll have to deal with packages separately.) See module py_compile for details of the actual byte-compilation.
PurePath subclass that can make system calls. Path represents a filesystem path but unlike PurePath, also offers methods to do system calls on path objects. Depending on your system, instantiating a Path will return either a PosixPath or a WindowsPath object. You can also instantiate a PosixPath or WindowsPath directly, but cannot instantiate a WindowsPath on a POSIX system or vice versa.
absolute(self) Return an absolute version of this path. This function works even if the path doesn't point to anything. No normalization is done, i.e. all '.' and '..' will be kept along. Use resolve() to get the canonical path to a file.
as_posix(self) Return the string representation of the path with forward (/) slashes.
as_uri(self) Return the path as a 'file' URI.
chmod(self, mode, *, follow_symlinks=True) Change the permissions of the path, like os.chmod().
cwd() Return a new path pointing to the current working directory (as returned by os.getcwd()).
exists(self) Whether this path exists.
expanduser(self) Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser)
glob(self, pattern) Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.
group(self) Return the group name of the file gid.
hardlink_to(self, target) Make this path a hard link pointing to the same file as *target*. Note the order of arguments (self, target) is the reverse of os.link's.
home() Return a new path pointing to the user's home directory (as returned by os.path.expanduser('~')).
is_absolute(self) True if the path is absolute (has both a root and, if applicable, a drive).
is_block_device(self) Whether this path is a block device.
is_char_device(self) Whether this path is a character device.
is_dir(self) Whether this path is a directory.
is_fifo(self) Whether this path is a FIFO.
is_file(self) Whether this path is a regular file (also True for symlinks pointing to regular files).
is_mount(self) Check if this path is a POSIX mount point
is_relative_to(self, *other) Return True if the path is relative to another path or False.
is_reserved(self) Return True if the path contains one of the special names reserved by the system, if any.
is_socket(self) Whether this path is a socket.
is_symlink(self) Whether this path is a symbolic link.
iterdir(self) Iterate over the files in this directory. Does not yield any result for the special paths '.' and '..'.
joinpath(self, *args) Combine this path with one or several arguments, and return a new path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored).
lchmod(self, mode) Like chmod(), except if the path points to a symlink, the symlink's permissions are changed, rather than its target's.
link_to(self, target) Make the target path a hard link pointing to this path. Note this function does not make this path a hard link to *target*, despite the implication of the function and argument names. The order of arguments (target, link) is the reverse of Path.symlink_to, but matches that of os.link. Deprecated since Python 3.10 and scheduled for removal in Python 3.12. Use `hardlink_to()` instead.
lstat(self) Like stat(), except if the path points to a symlink, the symlink's status information is returned, rather than its target's.
match(self, path_pattern) Return True if this path matches the given pattern.
mkdir(self, mode=511, parents=False, exist_ok=False) Create a new directory at this given path.
open(self, mode='r', buffering=-1, encoding=None, errors=None, newline=None) Open the file pointed by this path and return a file object, as the built-in open() function does.
owner(self) Return the login name of the file owner.
read_bytes(self) Open the file in bytes mode, read it, and close the file.
read_text(self, encoding=None, errors=None) Open the file in text mode, read it, and close the file.
readlink(self) Return the path to which the symbolic link points.
relative_to(self, *other) Return the relative path to another path identified by the passed arguments. If the operation is not possible (because this is not a subpath of the other path), raise ValueError.
rename(self, target) Rename this path to the target path. The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, *not* the directory of the Path object. Returns the new Path instance pointing to the target path.
replace(self, target) Rename this path to the target path, overwriting if that path exists. The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, *not* the directory of the Path object. Returns the new Path instance pointing to the target path.
resolve(self, strict=False) Make the path absolute, resolving all symlinks on the way and also normalizing it (for example turning slashes into backslashes under Windows).
rglob(self, pattern) Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree.
rmdir(self) Remove this directory. The directory must be empty.
samefile(self, other_path) Return whether other_path is the same or not as this file (as returned by os.path.samefile()).
stat(self, *, follow_symlinks=True) Return the result of the stat() system call on this path, like os.stat() does.
symlink_to(self, target, target_is_directory=False) Make this path a symlink pointing to the target path. Note the order of arguments (link, target) is the reverse of os.symlink.
touch(self, mode=438, exist_ok=True) Create this file with the given access mode, if it doesn't exist.
unlink(self, missing_ok=False) Remove this file or link. If the path is a directory, use rmdir() instead.
with_name(self, name) Return a new path with the file name changed.
with_stem(self, stem) Return a new path with the stem changed.
with_suffix(self, suffix) Return a new path with the file suffix changed. If the path has no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path.
write_bytes(self, data) Open the file in bytes mode, write to it, and close the file.
write_text(self, data, encoding=None, errors=None, newline=None) Open the file in text mode, write to it, and close the file.
anchor = <property object at 0x7f75e2d070b0> The concatenation of the drive and root, or ''.
drive = <property object at 0x7f75e2d07010> The drive prefix (letter or UNC path), if any.
name = <property object at 0x7f75e2d07100> The final path component, if any.
parent = <property object at 0x7f75e2d07290> The logical parent of the path.
parents = <property object at 0x7f75e2d072e0> A sequence of this path's logical parents.
parts = <property object at 0x7f75e2d07240> An object providing sequence-like access to the components in the filesystem path.
root = <property object at 0x7f75e2d07060> The root of the path, if any.
stem = <property object at 0x7f75e2d071f0> The final path component, minus its last suffix.
suffix = <property object at 0x7f75e2d07150> The final component's last suffix, if any. This includes the leading period. For example: '.txt'
suffixes = <property object at 0x7f75e2d071a0> A list of the final component's suffixes, if any. These include the leading periods. For example: ['.tar', '.gz']
partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.
args = <member 'args' of 'functools.partial' objects> tuple of arguments to future partial calls
func = <member 'func' of 'functools.partial' objects> function object to use in future partial calls
keywords = <member 'keywords' of 'functools.partial' objects> dictionary of keyword arguments to future partial calls
compile_dir(dir, maxlevels=None, ddir=None, force=False, rx=None, quiet=0, legacy=False, optimize=-1, workers=1, invalidation_mode=None, *, stripdir=None, prependdir=None, limit_sl_dest=None, hardlink_dupes=False) Byte-compile all modules in the given directory tree. Arguments (only dir is required): dir: the directory to byte-compile maxlevels: maximum recursion level (default `sys.getrecursionlimit()`) ddir: the directory that will be prepended to the path to the file as it is compiled into each byte-code file. force: if True, force compilation, even if timestamps are up-to-date quiet: full output with False or 0, errors only with 1, no output with 2 legacy: if True, produce legacy pyc paths instead of PEP 3147 paths optimize: int or list of optimization levels or -1 for level of the interpreter. Multiple levels leads to multiple compiled files each with one optimization level. workers: maximum number of parallel workers invalidation_mode: how the up-to-dateness of the pyc will be checked stripdir: part of path to left-strip from source file path prependdir: path to prepend to beginning of original file path, applied after stripdir limit_sl_dest: ignore symlinks if they are pointing outside of the defined path hardlink_dupes: hardlink duplicated pyc files
compile_file(fullname, ddir=None, force=False, rx=None, quiet=0, legacy=False, optimize=-1, invalidation_mode=None, *, stripdir=None, prependdir=None, limit_sl_dest=None, hardlink_dupes=False) Byte-compile one file. Arguments (only fullname is required): fullname: the file to byte-compile ddir: if given, the directory name compiled in to the byte-code file. force: if True, force compilation, even if timestamps are up-to-date quiet: full output with False or 0, errors only with 1, no output with 2 legacy: if True, produce legacy pyc paths instead of PEP 3147 paths optimize: int or list of optimization levels or -1 for level of the interpreter. Multiple levels leads to multiple compiled files each with one optimization level. invalidation_mode: how the up-to-dateness of the pyc will be checked stripdir: part of path to left-strip from source file path prependdir: path to prepend to beginning of original file path, applied after stripdir limit_sl_dest: ignore symlinks if they are pointing outside of the defined path. hardlink_dupes: hardlink duplicated pyc files
compile_path(skip_curdir=1, maxlevels=0, force=False, quiet=0, legacy=False, optimize=-1, invalidation_mode=None) Byte-compile all module on sys.path. Arguments (all optional): skip_curdir: if true, skip current directory (default True) maxlevels: max recursion level (default 0) force: as for compile_dir() (default False) quiet: as for compile_dir() (default 0) legacy: as for compile_dir() (default False) optimize: as for compile_dir() (default -1) invalidation_mode: as for compiler_dir()
main() Script main program.