Restore mostly-alphabetic sorting of os functions.

This commit is contained in:
Georg Brandl 2012-06-24 12:50:06 +02:00
parent b9df00cc00
commit 8ccadaafe6
1 changed files with 135 additions and 142 deletions

View File

@ -96,6 +96,13 @@ These functions and data items provide information and operate on the current
process and user. process and user.
.. function:: ctermid()
Return the filename corresponding to the controlling terminal of the process.
Availability: Unix.
.. data:: environ .. data:: environ
A mapping object representing the string environment. For example, A mapping object representing the string environment. For example,
@ -177,6 +184,28 @@ process and user.
.. versionadded:: 3.2 .. versionadded:: 3.2
.. function:: 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 :func:`sys.getfilesystemencoding`
and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you
would like to use a different encoding.
Availability: most flavors of Unix, Windows.
.. function:: 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.
Availability: most flavors of Unix.
.. versionadded:: 3.2
.. function:: get_exec_path(env=None) .. function:: get_exec_path(env=None)
Returns the list of directories that will be searched for a named Returns the list of directories that will be searched for a named
@ -188,13 +217,6 @@ process and user.
.. versionadded:: 3.2 .. versionadded:: 3.2
.. function:: ctermid()
Return the filename corresponding to the controlling terminal of the process.
Availability: Unix.
.. function:: getegid() .. function:: getegid()
Return the effective group id of the current process. This corresponds to the Return the effective group id of the current process. This corresponds to the
@ -253,17 +275,6 @@ process and user.
obtained with :func:`sysconfig.get_config_var`. obtained with :func:`sysconfig.get_config_var`.
.. function:: initgroups(username, gid)
Call the system initgroups() to initialize the group access list with all of
the groups of which the specified username is a member, plus the specified
group id.
Availability: Unix.
.. versionadded:: 3.2
.. function:: getlogin() .. function:: getlogin()
Return the name of the user logged in on the controlling terminal of the Return the name of the user logged in on the controlling terminal of the
@ -325,10 +336,22 @@ process and user.
(respectively) the calling process, the process group of the calling process, (respectively) the calling process, the process group of the calling process,
or the real user ID of the calling process. or the real user ID of the calling process.
Availability: Unix Availability: Unix.
.. versionadded:: 3.3 .. versionadded:: 3.3
.. data:: PRIO_PROCESS
PRIO_PGRP
PRIO_USER
Parameters for the :func:`getpriority` and :func:`setpriority` functions.
Availability: Unix.
.. versionadded:: 3.3
.. function:: getresuid() .. function:: getresuid()
Return a tuple (ruid, euid, suid) denoting the current process's Return a tuple (ruid, euid, suid) denoting the current process's
@ -358,36 +381,16 @@ process and user.
Availability: Unix. Availability: Unix.
.. function:: getenv(key, default=None) .. function:: initgroups(username, gid)
Return the value of the environment variable *key* if it exists, or Call the system initgroups() to initialize the group access list with all of
*default* if it doesn't. *key*, *default* and the result are str. the groups of which the specified username is a member, plus the specified
group id.
On Unix, keys and values are decoded with :func:`sys.getfilesystemencoding`
and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you
would like to use a different encoding.
Availability: most flavors of Unix, Windows.
.. function:: 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.
Availability: most flavors of Unix.
.. versionadded:: 3.2
.. data:: PRIO_PROCESS
PRIO_PGRP
PRIO_USER
Parameters for :func:`getpriority` and :func:`setpriority` functions.
Availability: Unix. Availability: Unix.
.. versionadded:: 3.3 .. versionadded:: 3.2
.. function:: putenv(key, value) .. function:: putenv(key, value)
@ -1269,27 +1272,13 @@ features:
.. data:: F_OK .. data:: F_OK
R_OK
W_OK
X_OK
Value to pass as the *mode* parameter of :func:`access` to test the existence of Values to pass as the *mode* parameter of :func:`access` to test the
*path*. existence, readability, writability and executability of *path*,
respectively.
.. data:: R_OK
Value to include in the *mode* parameter of :func:`access` to test the
readability of *path*.
.. data:: W_OK
Value to include in the *mode* parameter of :func:`access` to test the
writability of *path*.
.. data:: X_OK
Value to include in the *mode* parameter of :func:`access` to determine if
*path* can be executed.
.. function:: chdir(path) .. function:: chdir(path)
@ -1308,29 +1297,6 @@ features:
on some platforms. on some platforms.
.. function:: 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. From Python 3.3, this is equivalent to ``os.chdir(fd)``.
Availability: Unix.
.. function:: getcwd()
Return a string representing the current working directory.
Availability: Unix, Windows.
.. function:: getcwdb()
Return a bytestring representing the current working directory.
Availability: Unix, Windows.
.. function:: chflags(path, flags, *, follow_symlinks=True) .. function:: chflags(path, flags, *, follow_symlinks=True)
Set the flags of *path* to the numeric *flags*. *flags* may take a combination Set the flags of *path* to the numeric *flags*. *flags* may take a combination
@ -1357,12 +1323,6 @@ features:
The *follow_symlinks* argument. The *follow_symlinks* argument.
.. function:: chroot(path)
Change the root directory of the current process to *path*. Availability:
Unix.
.. function:: chmod(path, mode, *, dir_fd=None, follow_symlinks=True) .. function:: chmod(path, mode, *, dir_fd=None, follow_symlinks=True)
Change the mode of *path* to the numeric *mode*. *mode* may take one of the Change the mode of *path* to the numeric *mode*. *mode* may take one of the
@ -1425,6 +1385,35 @@ features:
and the *dir_fd* and *follow_symlinks* arguments. and the *dir_fd* and *follow_symlinks* arguments.
.. function:: chroot(path)
Change the root directory of the current process to *path*. Availability:
Unix.
.. function:: 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. From Python 3.3, this is equivalent to ``os.chdir(fd)``.
Availability: Unix.
.. function:: getcwd()
Return a string representing the current working directory.
Availability: Unix, Windows.
.. function:: getcwdb()
Return a bytestring representing the current working directory.
Availability: Unix, Windows.
.. function:: lchflags(path, flags) .. function:: lchflags(path, flags)
Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do
@ -1518,6 +1507,52 @@ features:
Added the *dir_fd* parameter. Added the *dir_fd* parameter.
.. function:: mkdir(path, mode=0o777, *, dir_fd=None)
Create a directory named *path* with numeric mode *mode*.
On some systems, *mode* is ignored. Where it is used, the current umask
value is first masked out. If the directory already exists, :exc:`OSError`
is raised.
This function can also support :ref:`paths relative to directory descriptors
<dir_fd>`.
It is also possible to create temporary directories; see the
:mod:`tempfile` module's :func:`tempfile.mkdtemp` function.
Availability: Unix, Windows.
.. versionadded:: 3.3
The *dir_fd* argument.
.. function:: makedirs(path, mode=0o777, exist_ok=False)
.. index::
single: directory; creating
single: UNC paths; and os.makedirs()
Recursive directory creation function. Like :func:`mkdir`, but makes all
intermediate-level directories needed to contain the leaf directory. If
the target directory with the same mode as specified already exists,
raises an :exc:`OSError` exception if *exist_ok* is False, otherwise no
exception is raised. If the directory cannot be created in other cases,
raises an :exc:`OSError` exception. The default *mode* is ``0o777`` (octal).
On some systems, *mode* is ignored. Where it is used, the current umask
value is first masked out.
.. note::
:func:`makedirs` will become confused if the path elements to create
include :data:`pardir`.
This function handles UNC paths correctly.
.. versionadded:: 3.2
The *exist_ok* parameter.
.. function:: mkfifo(path, mode=0o666, *, dir_fd=None) .. function:: mkfifo(path, mode=0o666, *, dir_fd=None)
Create a FIFO (a named pipe) named *path* with numeric mode *mode*. Create a FIFO (a named pipe) named *path* with numeric mode *mode*.
@ -1572,52 +1607,6 @@ features:
Compose a raw device number from the major and minor device numbers. Compose a raw device number from the major and minor device numbers.
.. function:: mkdir(path, mode=0o777, *, dir_fd=None)
Create a directory named *path* with numeric mode *mode*.
On some systems, *mode* is ignored. Where it is used, the current umask
value is first masked out. If the directory already exists, :exc:`OSError`
is raised.
This function can also support :ref:`paths relative to directory descriptors
<dir_fd>`.
It is also possible to create temporary directories; see the
:mod:`tempfile` module's :func:`tempfile.mkdtemp` function.
Availability: Unix, Windows.
.. versionadded:: 3.3
The *dir_fd* argument.
.. function:: makedirs(path, mode=0o777, exist_ok=False)
.. index::
single: directory; creating
single: UNC paths; and os.makedirs()
Recursive directory creation function. Like :func:`mkdir`, but makes all
intermediate-level directories needed to contain the leaf directory. If
the target directory with the same mode as specified already exists,
raises an :exc:`OSError` exception if *exist_ok* is False, otherwise no
exception is raised. If the directory cannot be created in other cases,
raises an :exc:`OSError` exception. The default *mode* is ``0o777`` (octal).
On some systems, *mode* is ignored. Where it is used, the current umask
value is first masked out.
.. note::
:func:`makedirs` will become confused if the path elements to create
include :data:`pardir`.
This function handles UNC paths correctly.
.. versionadded:: 3.2
The *exist_ok* parameter.
.. function:: pathconf(path, name) .. function:: pathconf(path, name)
Return system configuration information relevant to a named file. *name* Return system configuration information relevant to a named file. *name*
@ -1956,6 +1945,7 @@ features:
.. versionadded:: 3.3 .. versionadded:: 3.3
.. data:: supports_effective_ids .. data:: supports_effective_ids
An object implementing collections.Set indicating which functions in the An object implementing collections.Set indicating which functions in the
@ -1973,6 +1963,7 @@ features:
.. versionadded:: 3.3 .. versionadded:: 3.3
.. data:: supports_fd .. data:: supports_fd
An object implementing collections.Set indicating which functions in the An object implementing collections.Set indicating which functions in the
@ -1993,6 +1984,7 @@ features:
.. versionadded:: 3.3 .. versionadded:: 3.3
.. data:: supports_follow_symlinks .. data:: supports_follow_symlinks
An object implementing collections.Set indicating which functions in the An object implementing collections.Set indicating which functions in the
@ -2011,6 +2003,7 @@ features:
.. versionadded:: 3.3 .. versionadded:: 3.3
.. function:: symlink(source, link_name, target_is_directory=False, *, dir_fd=None) .. function:: symlink(source, link_name, target_is_directory=False, *, dir_fd=None)
Create a symbolic link pointing to *source* named *link_name*. Create a symbolic link pointing to *source* named *link_name*.