neulab/docprompting-conala huggingface dataset:
shutil.copystat(src, dst, *, follow_symlinks=True)  
Copy the permission bits, last access time, last modification time, and flags from src to dst. On Linux, copystat() also copies the “extended attributes” where possible. The file contents, owner, and group are unaffected. src and dst are path-like objects or path names given as strings. If follow_symlinks is false, and src and dst both refer to symbolic links, copystat() will operate on the symbolic links themselves rather than the files the symbolic links refer to—reading the information from the src symbolic link, and writing the information to the dst symbolic link.  Note Not all platforms provide the ability to examine and modify symbolic links. Python itself can tell you what functionality is locally available.  If os.chmod in os.supports_follow_symlinks is True, copystat() can modify the permission bits of a symbolic link. If os.utime in os.supports_follow_symlinks is True, copystat() can modify the last access and modification times of a symbolic link. If os.chflags in os.supports_follow_symlinks is True, copystat() can modify the flags of a symbolic link. (os.chflags is not available on all platforms.)  On platforms where some or all of this functionality is unavailable, when asked to modify a symbolic link, copystat() will copy everything it can. copystat() never returns failure. Please see os.supports_follow_symlinks for more information.  Raises an auditing event shutil.copystat with arguments src, dst.  Changed in version 3.3: Added follow_symlinks argument and support for Linux extended attributes.
shutil.copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2, ignore_dangling_symlinks=False, dirs_exist_ok=False)  
Recursively copy an entire directory tree rooted at src to a directory named dst and return the destination directory. dirs_exist_ok dictates whether to raise an exception in case dst or any missing parent directory already exists. Permissions and times of directories are copied with copystat(), individual files are copied using copy2(). If symlinks is true, symbolic links in the source tree are represented as symbolic links in the new tree and the metadata of the original links will be copied as far as the platform allows; if false or omitted, the contents and metadata of the linked files are copied to the new tree. When symlinks is false, if the file pointed by the symlink doesn’t exist, an exception will be added in the list of errors raised in an Error exception at the end of the copy process. You can set the optional ignore_dangling_symlinks flag to true if you want to silence this exception. Notice that this option has no effect on platforms that don’t support os.symlink(). If ignore is given, it must be a callable that will receive as its arguments the directory being visited by copytree(), and a list of its contents, as returned by os.listdir(). Since copytree() is called recursively, the ignore callable will be called once for each directory that is copied. The callable must return a sequence of directory and file names relative to the current directory (i.e. a subset of the items in its second argument); these names will then be ignored in the copy process. ignore_patterns() can be used to create such a callable that ignores names based on glob-style patterns. If exception(s) occur, an Error is raised with a list of reasons. If copy_function is given, it must be a callable that will be used to copy each file. It will be called with the source path and the destination path as arguments. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. Raises an auditing event shutil.copytree with arguments src, dst.  Changed in version 3.3: Copy metadata when symlinks is false. Now returns dst.   Changed in version 3.2: Added the copy_function argument to be able to provide a custom copy function. Added the ignore_dangling_symlinks argument to silent dangling symlinks errors when symlinks is false.   Changed in version 3.8: Platform-specific fast-copy syscalls may be used internally in order to copy the file more efficiently. See Platform-dependent efficient copy operations section.   New in version 3.8: The dirs_exist_ok parameter.
shutil.disk_usage(path)  
Return disk usage statistics about the given path as a named tuple with the attributes total, used and free, which are the amount of total, used and free space, in bytes. path may be a file or a directory.  New in version 3.3.   Changed in version 3.8: On Windows, path can now be a file or directory.  Availability: Unix, Windows.
exception shutil.Error  
This exception collects exceptions that are raised during a multi-file operation. For copytree(), the exception argument is a list of 3-tuples (srcname, dstname, exception).
shutil.get_archive_formats()  
Return a list of supported formats for archiving. Each element of the returned sequence is a tuple (name, description). By default shutil provides these formats:  
zip: ZIP file (if the zlib module is available). 
tar: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives. 
gztar: gzip’ed tar-file (if the zlib module is available). 
bztar: bzip2’ed tar-file (if the bz2 module is available). 
xztar: xz’ed tar-file (if the lzma module is available).  You can register new formats or provide your own archiver for any existing formats, by using register_archive_format().
shutil.get_terminal_size(fallback=(columns, lines))  
Get the size of the terminal window. For each of the two dimensions, the environment variable, COLUMNS and LINES respectively, is checked. If the variable is defined and the value is a positive integer, it is used. When COLUMNS or LINES is not defined, which is the common case, the terminal connected to sys.__stdout__ is queried by invoking os.get_terminal_size(). If the terminal size cannot be successfully queried, either because the system doesn’t support querying, or because we are not connected to a terminal, the value given in fallback parameter is used. fallback defaults to (80, 24) which is the default size used by many terminal emulators. The value returned is a named tuple of type os.terminal_size. See also: The Single UNIX Specification, Version 2, Other Environment Variables.  New in version 3.3.
shutil.get_unpack_formats()  
Return a list of all registered formats for unpacking. Each element of the returned sequence is a tuple (name, extensions, description). By default shutil provides these formats:  
zip: ZIP file (unpacking compressed files works only if the corresponding module is available). 
tar: uncompressed tar file. 
gztar: gzip’ed tar-file (if the zlib module is available). 
bztar: bzip2’ed tar-file (if the bz2 module is available). 
xztar: xz’ed tar-file (if the lzma module is available).  You can register new formats or provide your own unpacker for any existing formats, by using register_unpack_format().
shutil.ignore_patterns(*patterns)  
This factory function creates a function that can be used as a callable for copytree()’s ignore argument, ignoring files and directories that match one of the glob-style patterns provided. See the example below.
shutil.make_archive(base_name, format[, root_dir[, base_dir[, verbose[, dry_run[, owner[, group[, logger]]]]]]])  
Create an archive file (such as zip or tar) and return its name. base_name is the name of the file to create, including the path, minus any format-specific extension. format is the archive format: one of “zip” (if the zlib module is available), “tar”, “gztar” (if the zlib module is available), “bztar” (if the bz2 module is available), or “xztar” (if the lzma module is available). root_dir is a directory that will be the root directory of the archive, all paths in the archive will be relative to it; for example, we typically chdir into root_dir before creating the archive. base_dir is the directory where we start archiving from; i.e. base_dir will be the common prefix of all files and directories in the archive. base_dir must be given relative to root_dir. See Archiving example with base_dir for how to use base_dir and root_dir together. root_dir and base_dir both default to the current directory. If dry_run is true, no archive is created, but the operations that would be executed are logged to logger. owner and group are used when creating a tar archive. By default, uses the current owner and group. logger must be an object compatible with PEP 282, usually an instance of logging.Logger. The verbose argument is unused and deprecated. Raises an auditing event shutil.make_archive with arguments base_name, format, root_dir, base_dir.  Changed in version 3.8: The modern pax (POSIX.1-2001) format is now used instead of the legacy GNU format for archives created with format="tar".
shutil.move(src, dst, copy_function=copy2)  
Recursively move a file or directory (src) to another location (dst) and return the destination. If the destination is an existing directory, then src is moved inside that directory. If the destination already exists but is not a directory, it may be overwritten depending on os.rename() semantics. If the destination is on the current filesystem, then os.rename() is used. Otherwise, src is copied to dst using copy_function and then removed. In case of symlinks, a new symlink pointing to the target of src will be created in or as dst and src will be removed. If copy_function is given, it must be a callable that takes two arguments src and dst, and will be used to copy src to dst if os.rename() cannot be used. If the source is a directory, copytree() is called, passing it the copy_function(). The default copy_function is copy2(). Using copy() as the copy_function allows the move to succeed when it is not possible to also copy the metadata, at the expense of not copying any of the metadata. Raises an auditing event shutil.move with arguments src, dst.  Changed in version 3.3: Added explicit symlink handling for foreign filesystems, thus adapting it to the behavior of GNU’s mv. Now returns dst.   Changed in version 3.5: Added the copy_function keyword argument.   Changed in version 3.8: Platform-specific fast-copy syscalls may be used internally in order to copy the file more efficiently. See Platform-dependent efficient copy operations section.   Changed in version 3.9: Accepts a path-like object for both src and dst.
shutil.register_archive_format(name, function[, extra_args[, description]])  
Register an archiver for the format name. function is the callable that will be used to unpack archives. The callable will receive the base_name of the file to create, followed by the base_dir (which defaults to os.curdir) to start archiving from. Further arguments are passed as keyword arguments: owner, group, dry_run and logger (as passed in make_archive()). If given, extra_args is a sequence of (name, value) pairs that will be used as extra keywords arguments when the archiver callable is used. description is used by get_archive_formats() which returns the list of archivers. Defaults to an empty string.
shutil.register_unpack_format(name, extensions, function[, extra_args[, description]])  
Registers an unpack format. name is the name of the format and extensions is a list of extensions corresponding to the format, like .zip for Zip files. function is the callable that will be used to unpack archives. The callable will receive the path of the archive, followed by the directory the archive must be extracted to. When provided, extra_args is a sequence of (name, value) tuples that will be passed as keywords arguments to the callable. description can be provided to describe the format, and will be returned by the get_unpack_formats() function.
shutil.rmtree(path, ignore_errors=False, onerror=None)  
Delete an entire directory tree; path must point to a directory (but not a symbolic link to a directory). If ignore_errors is true, errors resulting from failed removals will be ignored; if false or omitted, such errors are handled by calling a handler specified by onerror or, if that is omitted, they raise an exception.  Note On platforms that support the necessary fd-based functions a symlink attack resistant version of rmtree() is used by default. On other platforms, the rmtree() implementation is susceptible to a symlink attack: given proper timing and circumstances, attackers can manipulate symlinks on the filesystem to delete files they wouldn’t be able to access otherwise. Applications can use the rmtree.avoids_symlink_attacks function attribute to determine which case applies.  If onerror is provided, it must be a callable that accepts three parameters: function, path, and excinfo. The first parameter, function, is the function which raised the exception; it depends on the platform and implementation. The second parameter, path, will be the path name passed to function. The third parameter, excinfo, will be the exception information returned by sys.exc_info(). Exceptions raised by onerror will not be caught. Raises an auditing event shutil.rmtree with argument path.  Changed in version 3.3: Added a symlink attack resistant version that is used automatically if platform supports fd-based functions.   Changed in version 3.8: On Windows, will no longer delete the contents of a directory junction before removing the junction.   
rmtree.avoids_symlink_attacks  
Indicates whether the current platform and implementation provides a symlink attack resistant version of rmtree(). Currently this is only true for platforms supporting fd-based directory access functions.  New in version 3.3.
rmtree.avoids_symlink_attacks  
Indicates whether the current platform and implementation provides a symlink attack resistant version of rmtree(). Currently this is only true for platforms supporting fd-based directory access functions.  New in version 3.3.
exception shutil.SameFileError  
This exception is raised if source and destination in copyfile() are the same file.  New in version 3.4.
shutil.unpack_archive(filename[, extract_dir[, format]])  
Unpack an archive. filename is the full path of the archive. extract_dir is the name of the target directory where the archive is unpacked. If not provided, the current working directory is used. format is the archive format: one of “zip”, “tar”, “gztar”, “bztar”, or “xztar”. Or any other format registered with register_unpack_format(). If not provided, unpack_archive() will use the archive file name extension and see if an unpacker was registered for that extension. In case none is found, a ValueError is raised. Raises an auditing event shutil.unpack_archive with arguments filename, extract_dir, format.  Changed in version 3.7: Accepts a path-like object for filename and extract_dir.
shutil.unregister_archive_format(name)  
Remove the archive format name from the list of supported formats.
shutil.unregister_unpack_format(name)  
Unregister an unpack format. name is the name of the format.
shutil.which(cmd, mode=os.F_OK | os.X_OK, path=None)  
Return the path to an executable which would be run if the given cmd was called. If no cmd would be called, return None. mode is a permission mask passed to os.access(), by default determining if the file exists and executable. When no path is specified, the results of os.environ() are used, returning either the “PATH” value or a fallback of os.defpath. On Windows, the current directory is always prepended to the path whether or not you use the default or provide your own, which is the behavior the command shell uses when finding executables. Additionally, when finding the cmd in the path, the PATHEXT environment variable is checked. For example, if you call shutil.which("python"), which() will search PATHEXT to know that it should look for python.exe within the path directories. For example, on Windows: >>> shutil.which("python")
'C:\\Python33\\python.EXE'
  New in version 3.3.   Changed in version 3.8: The bytes type is now accepted. If cmd type is bytes, the result type is also bytes.
signal.alarm(time)  
If time is non-zero, this function requests that a SIGALRM signal be sent to the process in time seconds. Any previously scheduled alarm is canceled (only one alarm can be scheduled at any time). The returned value is then the number of seconds before any previously set alarm was to have been delivered. If time is zero, no alarm is scheduled, and any scheduled alarm is canceled. If the return value is zero, no alarm is currently scheduled. Availability: Unix. See the man page alarm(2) for further information.
signal.CTRL_BREAK_EVENT  
The signal corresponding to the Ctrl+Break keystroke event. This signal can only be used with os.kill(). Availability: Windows.  New in version 3.2.
signal.CTRL_C_EVENT  
The signal corresponding to the Ctrl+C keystroke event. This signal can only be used with os.kill(). Availability: Windows.  New in version 3.2.
signal.getitimer(which)  
Returns current value of a given interval timer specified by which. Availability: Unix.
signal.getsignal(signalnum)  
Return the current signal handler for the signal signalnum. The returned value may be a callable Python object, or one of the special values signal.SIG_IGN, signal.SIG_DFL or None. Here, signal.SIG_IGN means that the signal was previously ignored, signal.SIG_DFL means that the default way of handling the signal was previously in use, and None means that the previous signal handler was not installed from Python.
exception signal.ItimerError  
Raised to signal an error from the underlying setitimer() or getitimer() implementation. Expect this error if an invalid interval timer or a negative time is passed to setitimer(). This error is a subtype of OSError.  New in version 3.3: This error used to be a subtype of IOError, which is now an alias of OSError.
signal.ITIMER_PROF  
Decrements interval timer both when the process executes and when the system is executing on behalf of the process. Coupled with ITIMER_VIRTUAL, this timer is usually used to profile the time spent by the application in user and kernel space. SIGPROF is delivered upon expiration.
signal.ITIMER_REAL  
Decrements interval timer in real time, and delivers SIGALRM upon expiration.
signal.ITIMER_VIRTUAL  
Decrements interval timer only when the process is executing, and delivers SIGVTALRM upon expiration.
signal.pause()  
Cause the process to sleep until a signal is received; the appropriate handler will then be called. Returns nothing. Availability: Unix. See the man page signal(2) for further information. See also sigwait(), sigwaitinfo(), sigtimedwait() and sigpending().
signal.pidfd_send_signal(pidfd, sig, siginfo=None, flags=0)  
Send signal sig to the process referred to by file descriptor pidfd. Python does not currently support the siginfo parameter; it must be None. The flags argument is provided for future extensions; no flag values are currently defined. See the pidfd_send_signal(2) man page for more information. Availability: Linux 5.1+  New in version 3.9.
signal.pthread_kill(thread_id, signalnum)  
Send the signal signalnum to the thread thread_id, another thread in the same process as the caller. The target thread can be executing any code (Python or not). However, if the target thread is executing the Python interpreter, the Python signal handlers will be executed by the main thread of the main interpreter. Therefore, the only point of sending a signal to a particular Python thread would be to force a running system call to fail with InterruptedError. Use threading.get_ident() or the ident attribute of threading.Thread objects to get a suitable value for thread_id. If signalnum is 0, then no signal is sent, but error checking is still performed; this can be used to check if the target thread is still running. Raises an auditing event signal.pthread_kill with arguments thread_id, signalnum. Availability: Unix. See the man page pthread_kill(3) for further information. See also os.kill().  New in version 3.3.
signal.pthread_sigmask(how, mask)  
Fetch and/or change the signal mask of the calling thread. The signal mask is the set of signals whose delivery is currently blocked for the caller. Return the old signal mask as a set of signals. The behavior of the call is dependent on the value of how, as follows.  
SIG_BLOCK: The set of blocked signals is the union of the current set and the mask argument. 
SIG_UNBLOCK: The signals in mask are removed from the current set of blocked signals. It is permissible to attempt to unblock a signal which is not blocked. 
SIG_SETMASK: The set of blocked signals is set to the mask argument.  mask is a set of signal numbers (e.g. {signal.SIGINT, signal.SIGTERM}). Use valid_signals() for a full mask including all signals. For example, signal.pthread_sigmask(signal.SIG_BLOCK, []) reads the signal mask of the calling thread. SIGKILL and SIGSTOP cannot be blocked. Availability: Unix. See the man page sigprocmask(3) and pthread_sigmask(3) for further information. See also pause(), sigpending() and sigwait().  New in version 3.3.
signal.raise_signal(signum)  
Sends a signal to the calling process. Returns nothing.  New in version 3.8.
signal.setitimer(which, seconds, interval=0.0)  
Sets given interval timer (one of signal.ITIMER_REAL, signal.ITIMER_VIRTUAL or signal.ITIMER_PROF) specified by which to fire after seconds (float is accepted, different from alarm()) and after that every interval seconds (if interval is non-zero). The interval timer specified by which can be cleared by setting seconds to zero. When an interval timer fires, a signal is sent to the process. The signal sent is dependent on the timer being used; signal.ITIMER_REAL will deliver SIGALRM, signal.ITIMER_VIRTUAL sends SIGVTALRM, and signal.ITIMER_PROF will deliver SIGPROF. The old values are returned as a tuple: (delay, interval). Attempting to pass an invalid interval timer will cause an ItimerError. Availability: Unix.
signal.set_wakeup_fd(fd, *, warn_on_full_buffer=True)  
Set the wakeup file descriptor to fd. When a signal is received, the signal number is written as a single byte into the fd. This can be used by a library to wakeup a poll or select call, allowing the signal to be fully processed. The old wakeup fd is returned (or -1 if file descriptor wakeup was not enabled). If fd is -1, file descriptor wakeup is disabled. If not -1, fd must be non-blocking. It is up to the library to remove any bytes from fd before calling poll or select again. When threads are enabled, this function can only be called from the main thread of the main interpreter; attempting to call it from other threads will cause a ValueError exception to be raised. There are two common ways to use this function. In both approaches, you use the fd to wake up when a signal arrives, but then they differ in how they determine which signal or signals have arrived. In the first approach, we read the data out of the fd’s buffer, and the byte values give you the signal numbers. This is simple, but in rare cases it can run into a problem: generally the fd will have a limited amount of buffer space, and if too many signals arrive too quickly, then the buffer may become full, and some signals may be lost. If you use this approach, then you should set warn_on_full_buffer=True, which will at least cause a warning to be printed to stderr when signals are lost. In the second approach, we use the wakeup fd only for wakeups, and ignore the actual byte values. In this case, all we care about is whether the fd’s buffer is empty or non-empty; a full buffer doesn’t indicate a problem at all. If you use this approach, then you should set warn_on_full_buffer=False, so that your users are not confused by spurious warning messages.  Changed in version 3.5: On Windows, the function now also supports socket handles.   Changed in version 3.7: Added warn_on_full_buffer parameter.
signal.SIGALRM  
Timer signal from alarm(2). Availability: Unix.
signal.SIGBREAK  
Interrupt from keyboard (CTRL + BREAK). Availability: Windows.
signal.SIGCONT  
Continue the process if it is currently stopped Availability: Unix.
signal.SIGFPE  
Floating-point exception. For example, division by zero.  See also ZeroDivisionError is raised when the second argument of a division or modulo operation is zero.
signal.SIGHUP  
Hangup detected on controlling terminal or death of controlling process. Availability: Unix.
signal.SIGINT  
Interrupt from keyboard (CTRL + C). Default action is to raise KeyboardInterrupt.