Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/os.path.rst

    r2 r391  
    1616   :func:`splitunc` and :func:`ismount` do handle them correctly.
    1717
     18
     19Unlike a unix shell, Python does not do any *automatic* path expansions.
     20Functions such as :func:`expanduser` and :func:`expandvars` can be invoked
     21explicitly when an application desires shell-like path expansion.  (See also
     22the :mod:`glob` module.)
    1823
    1924.. note::
     
    3641
    3742   Return a normalized absolutized version of the pathname *path*. On most
    38    platforms, this is equivalent to ``normpath(join(os.getcwd(), path))``.
     43   platforms, this is equivalent to calling the function :func:`normpath` as
     44   follows: ``normpath(join(os.getcwd(), path))``.
    3945
    4046   .. versionadded:: 1.5.2
     
    4349.. function:: basename(path)
    4450
    45    Return the base name of pathname *path*.  This is the second half of the pair
    46    returned by ``split(path)``.  Note that the result of this function is different
     51   Return the base name of pathname *path*.  This is the second element of the
     52   pair returned by passing *path* to the function :func:`split`.  Note that
     53   the result of this function is different
    4754   from the Unix :program:`basename` program; where :program:`basename` for
    4855   ``'/foo/bar/'`` returns ``'bar'``, the :func:`basename` function returns an
     
    5966.. function:: dirname(path)
    6067
    61    Return the directory name of pathname *path*.  This is the first half of the
    62    pair returned by ``split(path)``.
     68   Return the directory name of pathname *path*.  This is the first element of
     69   the pair returned by passing *path* to the function :func:`split`.
    6370
    6471
     
    141148
    142149   Return the system's ctime which, on some systems (like Unix) is the time of the
    143    last change, and, on others (like Windows), is the creation time for *path*.
     150   last metadata change, and, on others (like Windows), is the creation time for *path*.
    144151   The return value is a number giving the number of seconds since the epoch (see
    145152   the  :mod:`time` module).  Raise :exc:`os.error` if the file does not exist or
     
    197204   if there was one) are thrown away, and joining continues.  The return value is
    198205   the concatenation of *path1*, and optionally *path2*, etc., with exactly one
    199    directory separator (``os.sep``) inserted between components, unless *path2* is
    200    empty.  Note that on Windows, since there is a current directory for each drive,
    201    ``os.path.join("c:", "foo")`` represents a path relative to the current
    202    directory on drive :file:`C:` (:file:`c:foo`), not :file:`c:\\foo`.
     206   directory separator (``os.sep``) following each non-empty part except the last.
     207   (This means that an empty last part will result in a path that ends with a
     208   separator.)  Note that on Windows, since there is a current directory for
     209   each drive, ``os.path.join("c:", "foo")`` represents a path relative to the
     210   current directory on drive :file:`C:` (:file:`c:foo`), not :file:`c:\\foo`.
    203211
    204212
     
    212220.. function:: normpath(path)
    213221
    214    Normalize a pathname.  This collapses redundant separators and up-level
    215    references so that ``A//B``, ``A/./B`` and ``A/foo/../B`` all become ``A/B``.
    216    It does not normalize the case (use :func:`normcase` for that).  On Windows, it
    217    converts forward slashes to backward slashes. It should be understood that this
    218    may change the meaning of the path if it contains symbolic links!
     222   Normalize a pathname by collapsing redundant separators and up-level
     223   references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all
     224   become ``A/B``.  This string manipulation may change the meaning of a path
     225   that contains symbolic links.  On Windows, it converts forward slashes to
     226   backward slashes. To normalize case, use :func:`normcase`.
    219227
    220228
     
    229237.. function:: relpath(path[, start])
    230238
    231    Return a relative filepath to *path* either from the current directory or from
    232    an optional *start* point.
    233 
    234    *start* defaults to :attr:`os.curdir`. Availability:  Windows, Unix.
     239   Return a relative filepath to *path* either from the current directory or
     240   from an optional *start* directory.  This is a path computation:  the
     241   filesystem is not accessed to confirm the existence or nature of *path* or
     242   *start*.
     243
     244   *start* defaults to :attr:`os.curdir`.
     245
     246   Availability:  Windows, Unix.
    235247
    236248   .. versionadded:: 2.6
     
    241253   Return ``True`` if both pathname arguments refer to the same file or directory
    242254   (as indicated by device number and i-node number). Raise an exception if a
    243    :func:`os.stat` call on either pathname fails. Availability: Unix.
     255   :func:`os.stat` call on either pathname fails.
     256
     257   Availability: Unix.
    244258
    245259
     
    247261
    248262   Return ``True`` if the file descriptors *fp1* and *fp2* refer to the same file.
     263
    249264   Availability: Unix.
    250265
     
    253268
    254269   Return ``True`` if the stat tuples *stat1* and *stat2* refer to the same file.
    255    These structures may have been returned by :func:`fstat`, :func:`lstat`, or
    256    :func:`stat`.  This function implements the underlying comparison used by
    257    :func:`samefile` and :func:`sameopenfile`. Availability: Unix.
     270   These structures may have been returned by :func:`os.fstat`,
     271   :func:`os.lstat`, or :func:`os.stat`.  This function implements the
     272   underlying comparison used by :func:`samefile` and :func:`sameopenfile`.
     273
     274   Availability: Unix.
    258275
    259276
    260277.. function:: split(path)
    261278
    262    Split the pathname *path* into a pair, ``(head, tail)`` where *tail* is the last
    263    pathname component and *head* is everything leading up to that.  The *tail* part
    264    will never contain a slash; if *path* ends in a slash, *tail* will be empty.  If
    265    there is no slash in *path*, *head* will be empty.  If *path* is empty, both
    266    *head* and *tail* are empty.  Trailing slashes are stripped from *head* unless
    267    it is the root (one or more slashes only).  In nearly all cases, ``join(head,
    268    tail)`` equals *path* (the only exception being when there were multiple slashes
    269    separating *head* from *tail*).
     279   Split the pathname *path* into a pair, ``(head, tail)`` where *tail* is the
     280   last pathname component and *head* is everything leading up to that.  The
     281   *tail* part will never contain a slash; if *path* ends in a slash, *tail*
     282   will be empty.  If there is no slash in *path*, *head* will be empty.  If
     283   *path* is empty, both *head* and *tail* are empty.  Trailing slashes are
     284   stripped from *head* unless it is the root (one or more slashes only).  In
     285   all cases, ``join(head, tail)`` returns a path to the same location as *path*
     286   (but the strings may differ).  Also see the functions :func:`dirname` and
     287   :func:`basename`.
    270288
    271289
     
    297315   mount point (such as ``r'\\host\mount'``), if present, and *rest* the rest of
    298316   the path (such as  ``r'\path\file.ext'``).  For paths containing drive letters,
    299    *unc* will always be the empty string. Availability:  Windows.
     317   *unc* will always be the empty string.
     318
     319   Availability:  Windows.
    300320
    301321
     
    320340   .. note::
    321341
    322       This function is deprecated and has been removed in 3.0 in favor of
     342      This function is deprecated and has been removed in Python 3 in favor of
    323343      :func:`os.walk`.
    324344
     
    327347
    328348   True if arbitrary Unicode strings can be used as file names (within limitations
    329    imposed by the file system), and if :func:`os.listdir` returns Unicode strings
    330    for a Unicode argument.
     349   imposed by the file system).
    331350
    332351   .. versionadded:: 2.3
Note: See TracChangeset for help on using the changeset viewer.