neulab/docprompting-conala huggingface dataset:
os.closerange(fd_low, fd_high)  
Close all file descriptors from fd_low (inclusive) to fd_high (exclusive), ignoring errors. Equivalent to (but much faster than): for fd in range(fd_low, fd_high):
    try:
        os.close(fd)
    except OSError:
        pass
os.confstr(name)  
Return string-valued system configuration values. name specifies the configuration value to retrieve; it may be a string which is the name of a defined system value; these names are specified in a number of standards (POSIX, Unix 95, Unix 98, and others). Some platforms define additional names as well. The names known to the host operating system are given as the keys of the confstr_names dictionary. For configuration variables not included in that mapping, passing an integer for name is also accepted. If the configuration value specified by name isn’t defined, None is returned. If name is a string and is not known, ValueError is raised. If a specific value for name is not supported by the host system, even if it is included in confstr_names, an OSError is raised with errno.EINVAL for the error number. Availability: Unix.
os.confstr_names  
Dictionary mapping names accepted by confstr() to the integer values defined for those names by the host operating system. This can be used to determine the set of names known to the system. Availability: Unix.
os.copy_file_range(src, dst, count, offset_src=None, offset_dst=None)  
Copy count bytes from file descriptor src, starting from offset offset_src, to file descriptor dst, starting from offset offset_dst. If offset_src is None, then src is read from the current position; respectively for offset_dst. The files pointed by src and dst must reside in the same filesystem, otherwise an OSError is raised with errno set to errno.EXDEV. This copy is done without the additional cost of transferring data from the kernel to user space and then back into the kernel. Additionally, some filesystems could implement extra optimizations. The copy is done as if both files are opened as binary. The return value is the amount of bytes copied. This could be less than the amount requested. Availability: Linux kernel >= 4.5 or glibc >= 2.27.  New in version 3.8.
os.cpu_count()  
Return the number of CPUs in the system. Returns None if undetermined. This number is not equivalent to the number of CPUs the current process can use. The number of usable CPUs can be obtained with len(os.sched_getaffinity(0))  New in version 3.4.
os.ctermid()  
Return the filename corresponding to the controlling terminal of the process. Availability: Unix.
os.curdir  
The constant string used by the operating system to refer to the current directory. This is '.' for Windows and POSIX. Also available via os.path.
os.defpath  
The default search path used by exec*p* and spawn*p* if the environment doesn’t have a 'PATH' key. Also available via os.path.
os.device_encoding(fd)  
Return a string describing the encoding of the device associated with fd if it is connected to a terminal; else return None.
os.devnull  
The file path of the null device. For example: '/dev/null' for POSIX, 'nul' for Windows. Also available via os.path.
inode()  
Return the inode number of the entry. The result is cached on the os.DirEntry object. Use os.stat(entry.path, follow_symlinks=False).st_ino to fetch up-to-date information. On the first, uncached call, a system call is required on Windows but not on Unix.
is_dir(*, follow_symlinks=True)  
Return True if this entry is a directory or a symbolic link pointing to a directory; return False if the entry is or points to any other kind of file, or if it doesn’t exist anymore. If follow_symlinks is False, return True only if this entry is a directory (without following symlinks); return False if the entry is any other kind of file or if it doesn’t exist anymore. The result is cached on the os.DirEntry object, with a separate cache for follow_symlinks True and False. Call os.stat() along with stat.S_ISDIR() to fetch up-to-date information. On the first, uncached call, no system call is required in most cases. Specifically, for non-symlinks, neither Windows or Unix require a system call, except on certain Unix file systems, such as network file systems, that return dirent.d_type == DT_UNKNOWN. If the entry is a symlink, a system call will be required to follow the symlink unless follow_symlinks is False. This method can raise OSError, such as PermissionError, but FileNotFoundError is caught and not raised.
is_file(*, follow_symlinks=True)  
Return True if this entry is a file or a symbolic link pointing to a file; return False if the entry is or points to a directory or other non-file entry, or if it doesn’t exist anymore. If follow_symlinks is False, return True only if this entry is a file (without following symlinks); return False if the entry is a directory or other non-file entry, or if it doesn’t exist anymore. The result is cached on the os.DirEntry object. Caching, system calls made, and exceptions raised are as per is_dir().
is_symlink()  
Return True if this entry is a symbolic link (even if broken); return False if the entry points to a directory or any kind of file, or if it doesn’t exist anymore. The result is cached on the os.DirEntry object. Call os.path.islink() to fetch up-to-date information. On the first, uncached call, no system call is required in most cases. Specifically, neither Windows or Unix require a system call, except on certain Unix file systems, such as network file systems, that return dirent.d_type == DT_UNKNOWN. This method can raise OSError, such as PermissionError, but FileNotFoundError is caught and not raised.
name  
The entry’s base filename, relative to the scandir() path argument. The name attribute will be bytes if the scandir() path argument is of type bytes and str otherwise. Use fsdecode() to decode byte filenames.
path  
The entry’s full path name: equivalent to os.path.join(scandir_path,
entry.name) where scandir_path is the scandir() path argument. The path is only absolute if the scandir() path argument was absolute. If the scandir() path argument was a file descriptor, the path attribute is the same as the name attribute. The path attribute will be bytes if the scandir() path argument is of type bytes and str otherwise. Use fsdecode() to decode byte filenames.
stat(*, follow_symlinks=True)  
Return a stat_result object for this entry. This method follows symbolic links by default; to stat a symbolic link add the follow_symlinks=False argument. On Unix, this method always requires a system call. On Windows, it only requires a system call if follow_symlinks is True and the entry is a reparse point (for example, a symbolic link or directory junction). On Windows, the st_ino, st_dev and st_nlink attributes of the stat_result are always set to zero. Call os.stat() to get these attributes. The result is cached on the os.DirEntry object, with a separate cache for follow_symlinks True and False. Call os.stat() to fetch up-to-date information.
os.dup(fd)  
Return a duplicate of file descriptor fd. The new file descriptor is non-inheritable. On Windows, when duplicating a standard stream (0: stdin, 1: stdout, 2: stderr), the new file descriptor is inheritable.  Changed in version 3.4: The new file descriptor is now non-inheritable.
os.dup2(fd, fd2, inheritable=True)  
Duplicate file descriptor fd to fd2, closing the latter first if necessary. Return fd2. The new file descriptor is inheritable by default or non-inheritable if inheritable is False.  Changed in version 3.4: Add the optional inheritable parameter.   Changed in version 3.7: Return fd2 on success. Previously, None was always returned.
os.environ  
A mapping object representing the string environment. For example, environ['HOME'] is the pathname of your home directory (on some platforms), and is equivalent to getenv("HOME") in C. This mapping is captured the first time the os module is imported, typically during Python startup as part of processing site.py. Changes to the environment made after this time are not reflected in os.environ, except for changes made by modifying os.environ directly. This mapping may be used to modify the environment as well as query the environment. putenv() will be called automatically when the mapping is modified. On Unix, keys and values use sys.getfilesystemencoding() and 'surrogateescape' error handler. Use environb if you would like to use a different encoding.  Note Calling putenv() directly does not change os.environ, so it’s better to modify os.environ.   Note On some platforms, including FreeBSD and Mac OS X, setting environ may cause memory leaks. Refer to the system documentation for putenv().  You can delete items in this mapping to unset environment variables. unsetenv() will be called automatically when an item is deleted from os.environ, and when one of the pop() or clear() methods is called.  Changed in version 3.9: Updated to support PEP 584’s merge (|) and update (|=) operators.
os.environb  
Bytes version of environ: a mapping object representing the environment as byte strings. environ and environb are synchronized (modify environb updates environ, and vice versa). environb is only available if supports_bytes_environ is True.  New in version 3.2.   Changed in version 3.9: Updated to support PEP 584’s merge (|) and update (|=) operators.
os.execl(path, arg0, arg1, ...)  
os.execle(path, arg0, arg1, ..., env)  
os.execlp(file, arg0, arg1, ...)  
os.execlpe(file, arg0, arg1, ..., env)  
os.execv(path, args)  
os.execve(path, args, env)  
os.execvp(file, args)  
os.execvpe(file, args, env)  
These functions all execute a new program, replacing the current process; they do not return. On Unix, the new executable is loaded into the current process, and will have the same process id as the caller. Errors will be reported as OSError exceptions. The current process is replaced immediately. Open file objects and descriptors are not flushed, so if there may be data buffered on these open files, you should flush them using sys.stdout.flush() or os.fsync() before calling an exec* function. The “l” and “v” variants of the exec* functions differ in how command-line arguments are passed. The “l” variants are perhaps the easiest to work with if the number of parameters is fixed when the code is written; the individual parameters simply become additional parameters to the execl*() functions. The “v” variants are good when the number of parameters is variable, with the arguments being passed in a list or tuple as the args parameter. In either case, the arguments to the child process should start with the name of the command being run, but this is not enforced. The variants which include a “p” near the end (execlp(), execlpe(), execvp(), and execvpe()) will use the PATH environment variable to locate the program file. When the environment is being replaced (using one of the exec*e variants, discussed in the next paragraph), the new environment is used as the source of the PATH variable. The other variants, execl(), execle(), execv(), and execve(), will not use the PATH variable to locate the executable; path must contain an appropriate absolute or relative path. For execle(), execlpe(), execve(), and execvpe() (note that these all end in “e”), the env parameter must be a mapping which is used to define the environment variables for the new process (these are used instead of the current process’ environment); the functions execl(), execlp(), execv(), and execvp() all cause the new process to inherit the environment of the current process. For execve() on some platforms, path may also be specified as an open file descriptor. This functionality may not be supported on your platform; you can check whether or not it is available using os.supports_fd. If it is unavailable, using it will raise a NotImplementedError. Raises an auditing event os.exec with arguments path, args, env. Availability: Unix, Windows.  New in version 3.3: Added support for specifying path as an open file descriptor for execve().   Changed in version 3.6: Accepts a path-like object.
os.extsep  
The character which separates the base filename from the extension; for example, the '.' in os.py. Also available via os.path.
os.EX_CANTCREAT  
Exit code that means a user specified output file could not be created. Availability: Unix.
os.EX_CONFIG  
Exit code that means that some kind of configuration error occurred. Availability: Unix.
os.EX_DATAERR  
Exit code that means the input data was incorrect. Availability: Unix.
os.EX_IOERR  
Exit code that means that an error occurred while doing I/O on some file. Availability: Unix.
os.EX_NOHOST  
Exit code that means a specified host did not exist. Availability: Unix.
os.EX_NOINPUT  
Exit code that means an input file did not exist or was not readable. Availability: Unix.
os.EX_NOPERM  
Exit code that means that there were insufficient permissions to perform the operation (but not intended for file system problems). Availability: Unix.
os.EX_NOTFOUND  
Exit code that means something like “an entry was not found”. Availability: Unix.
os.EX_NOUSER  
Exit code that means a specified user did not exist. Availability: Unix.
os.EX_OK  
Exit code that means no error occurred. Availability: Unix.
os.EX_OSERR  
Exit code that means an operating system error was detected, such as the inability to fork or create a pipe. Availability: Unix.
os.EX_OSFILE  
Exit code that means some system file did not exist, could not be opened, or had some other kind of error. Availability: Unix.
os.EX_PROTOCOL  
Exit code that means that a protocol exchange was illegal, invalid, or not understood. Availability: Unix.
os.EX_SOFTWARE  
Exit code that means an internal software error was detected. Availability: Unix.
os.EX_TEMPFAIL  
Exit code that means a temporary failure occurred. This indicates something that may not really be an error, such as a network connection that couldn’t be made during a retryable operation. Availability: Unix.
os.EX_UNAVAILABLE  
Exit code that means that a required service is unavailable. Availability: Unix.
os.EX_USAGE  
Exit code that means the command was used incorrectly, such as when the wrong number of arguments are given. Availability: Unix.
os.fchdir(fd)  
Change the current working directory to the directory represented by the file descriptor fd. The descriptor must refer to an opened directory, not an open file. As of Python 3.3, this is equivalent to os.chdir(fd). Raises an auditing event os.chdir with argument path. Availability: Unix.
os.fchmod(fd, mode)  
Change the mode of the file given by fd to the numeric mode. See the docs for chmod() for possible values of mode. As of Python 3.3, this is equivalent to os.chmod(fd, mode). Raises an auditing event os.chmod with arguments path, mode, dir_fd. Availability: Unix.
os.fchown(fd, uid, gid)  
Change the owner and group id of the file given by fd to the numeric uid and gid. To leave one of the ids unchanged, set it to -1. See chown(). As of Python 3.3, this is equivalent to os.chown(fd, uid,
gid). Raises an auditing event os.chown with arguments path, uid, gid, dir_fd. Availability: Unix.
os.fdatasync(fd)  
Force write of file with filedescriptor fd to disk. Does not force update of metadata. Availability: Unix.  Note This function is not available on MacOS.
os.fdopen(fd, *args, **kwargs)  
Return an open file object connected to the file descriptor fd. This is an alias of the open() built-in function and accepts the same arguments. The only difference is that the first argument of fdopen() must always be an integer.
os.fork()  
Fork a child process. Return 0 in the child and the child’s process id in the parent. If an error occurs OSError is raised. Note that some platforms including FreeBSD <= 6.3 and Cygwin have known issues when using fork() from a thread. Raises an auditing event os.fork with no arguments.  Changed in version 3.8: Calling fork() in a subinterpreter is no longer supported (RuntimeError is raised).   Warning See ssl for applications that use the SSL module with fork().  Availability: Unix.
os.forkpty()  
Fork a child process, using a new pseudo-terminal as the child’s controlling terminal. Return a pair of (pid, fd), where pid is 0 in the child, the new child’s process id in the parent, and fd is the file descriptor of the master end of the pseudo-terminal. For a more portable approach, use the pty module. If an error occurs OSError is raised. Raises an auditing event os.forkpty with no arguments.  Changed in version 3.8: Calling forkpty() in a subinterpreter is no longer supported (RuntimeError is raised).  Availability: some flavors of Unix.
os.fpathconf(fd, name)  
Return system configuration information relevant to an open file. name specifies the configuration value to retrieve; it may be a string which is the name of a defined system value; these names are specified in a number of standards (POSIX.1, Unix 95, Unix 98, and others). Some platforms define additional names as well. The names known to the host operating system are given in the pathconf_names dictionary. For configuration variables not included in that mapping, passing an integer for name is also accepted. If name is a string and is not known, ValueError is raised. If a specific value for name is not supported by the host system, even if it is included in pathconf_names, an OSError is raised with errno.EINVAL for the error number. As of Python 3.3, this is equivalent to os.pathconf(fd, name). Availability: Unix.
os.fsdecode(filename)  
Decode the path-like filename from the filesystem encoding with 'surrogateescape' error handler, or 'strict' on Windows; return str unchanged. fsencode() is the reverse function.  New in version 3.2.   Changed in version 3.6: Support added to accept objects implementing the os.PathLike interface.
os.fsencode(filename)  
Encode path-like filename to the filesystem encoding with 'surrogateescape' error handler, or 'strict' on Windows; return bytes unchanged. fsdecode() is the reverse function.  New in version 3.2.   Changed in version 3.6: Support added to accept objects implementing the os.PathLike interface.
os.fspath(path)  
Return the file system representation of the path. If str or bytes is passed in, it is returned unchanged. Otherwise __fspath__() is called and its value is returned as long as it is a str or bytes object. In all other cases, TypeError is raised.  New in version 3.6.
os.fstat(fd)  
Get the status of the file descriptor fd. Return a stat_result object. As of Python 3.3, this is equivalent to os.stat(fd).  See also The stat() function.
os.fstatvfs(fd)  
Return information about the filesystem containing the file associated with file descriptor fd, like statvfs(). As of Python 3.3, this is equivalent to os.statvfs(fd). Availability: Unix.
os.fsync(fd)  
Force write of file with filedescriptor fd to disk. On Unix, this calls the native fsync() function; on Windows, the MS _commit() function. If you’re starting with a buffered Python file object f, first do f.flush(), and then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f are written to disk. Availability: Unix, Windows.
os.ftruncate(fd, length)  
Truncate the file corresponding to file descriptor fd, so that it is at most length bytes in size. As of Python 3.3, this is equivalent to os.truncate(fd, length). Raises an auditing event os.truncate with arguments fd, length. Availability: Unix, Windows.  Changed in version 3.5: Added support for Windows
os.fwalk(top='.', topdown=True, onerror=None, *, follow_symlinks=False, dir_fd=None)  
This behaves exactly like walk(), except that it yields a 4-tuple (dirpath, dirnames, filenames, dirfd), and it supports dir_fd. dirpath, dirnames and filenames are identical to walk() output, and dirfd is a file descriptor referring to the directory dirpath. This function always supports paths relative to directory descriptors and not following symlinks. Note however that, unlike other functions, the fwalk() default value for follow_symlinks is False.  Note Since fwalk() yields file descriptors, those are only valid until the next iteration step, so you should duplicate them (e.g. with dup()) if you want to keep them longer.  This example displays the number of bytes taken by non-directory files in each directory under the starting directory, except that it doesn’t look under any CVS subdirectory: import os
for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):
    print(root, "consumes", end="")
    print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]),
          end="")
    print("bytes in", len(files), "non-directory files")
    if 'CVS' in dirs:
        dirs.remove('CVS')  # don't visit CVS directories
 In the next example, walking the tree bottom-up is essential: rmdir() doesn’t allow deleting a directory before the directory is empty: # Delete everything reachable from the directory named in "top",
# assuming there are no symbolic links.
# CAUTION:  This is dangerous!  For example, if top == '/', it
# could delete all your disk files.
import os
for root, dirs, files, rootfd in os.fwalk(top, topdown=False):
    for name in files:
        os.unlink(name, dir_fd=rootfd)
    for name in dirs:
        os.rmdir(name, dir_fd=rootfd)
 Raises an auditing event os.fwalk with arguments top, topdown, onerror, follow_symlinks, dir_fd. Availability: Unix.  New in version 3.3.   Changed in version 3.6: Accepts a path-like object.   Changed in version 3.7: Added support for bytes paths.
os.F_LOCK  
os.F_TLOCK  
os.F_ULOCK  
os.F_TEST  
Flags that specify what action lockf() will take. Availability: Unix.  New in version 3.3.
os.F_OK  
os.R_OK  
os.W_OK  
os.X_OK  
Values to pass as the mode parameter of access() to test the existence, readability, writability and executability of path, respectively.
os.getcwdb()  
Return a bytestring representing the current working directory.  Changed in version 3.8: The function now uses the UTF-8 encoding on Windows, rather than the ANSI code page: see PEP 529 for the rationale. The function is no longer deprecated on Windows.
os.getegid()  
Return the effective group id of the current process. This corresponds to the “set id” bit on the file being executed in the current process. Availability: Unix.
os.getenv(key, default=None)  
Return the value of the environment variable key if it exists, or default if it doesn’t. key, default and the result are str. On Unix, keys and values are decoded with sys.getfilesystemencoding() and 'surrogateescape' error handler. Use os.getenvb() if you would like to use a different encoding. Availability: most flavors of Unix, Windows.
os.getenvb(key, default=None)  
Return the value of the environment variable key if it exists, or default if it doesn’t. key, default and the result are bytes. getenvb() is only available if supports_bytes_environ is True. Availability: most flavors of Unix.  New in version 3.2.
os.geteuid()  
Return the current process’s effective user id. Availability: Unix.
os.getgid()  
Return the real group id of the current process. Availability: Unix.
os.getgrouplist(user, group)  
Return list of group ids that user belongs to. If group is not in the list, it is included; typically, group is specified as the group ID field from the password record for user. Availability: Unix.  New in version 3.3.
os.getgroups()  
Return list of supplemental group ids associated with the current process. Availability: Unix.  Note On Mac OS X, getgroups() behavior differs somewhat from other Unix platforms. If the Python interpreter was built with a deployment target of 10.5 or earlier, getgroups() returns the list of effective group ids associated with the current user process; this list is limited to a system-defined number of entries, typically 16, and may be modified by calls to setgroups() if suitably privileged. If built with a deployment target greater than 10.5, getgroups() returns the current group access list for the user associated with the effective user id of the process; the group access list may change over the lifetime of the process, it is not affected by calls to setgroups(), and its length is not limited to 16. The deployment target value, MACOSX_DEPLOYMENT_TARGET, can be obtained with sysconfig.get_config_var().