Antoine Pitrou avatar Antoine Pitrou committed edf25b2

Reorder

Comments (0)

Files changed (1)

    needed before comparing path objects.
 
 
+.. method:: PurePath.parent(level=1)
+
+   Return the path's parent at the *level*'th level.  If *level* is not given,
+   return the path's immediate parent::
+
+      >>> p = PurePosixPath('/a/b/c/d')
+      >>> p.parent()
+      PurePosixPath('/a/b/c')
+      >>> p.parent(2)
+      PurePosixPath('/a/b')
+      >>> p.parent(3)
+      PurePosixPath('/a')
+      >>> p.parent(4)
+      PurePosixPath('/')
+
+
+.. method:: PurePath.parents()
+
+   Iterate over the path's parents from the most to the least specific::
+
+      >>> for p in PureNTPath('c:/foo/bar/setup.py').parents(): p
+      ...
+      PureNTPath('c:\\foo\\bar')
+      PureNTPath('c:\\foo')
+      PureNTPath('c:\\')
+
+
 .. method:: PurePath.relative()
 
    Return the path object stripped of its drive and root, if any::
       ValueError: '/etc/passwd' does not start with '/usr'
 
 
-.. method:: PurePath.parent(level=1)
-
-   Return the path's parent at the *level*'th level.  If *level* is not given,
-   return the path's immediate parent::
-
-      >>> p = PurePosixPath('/a/b/c/d')
-      >>> p.parent()
-      PurePosixPath('/a/b/c')
-      >>> p.parent(2)
-      PurePosixPath('/a/b')
-      >>> p.parent(3)
-      PurePosixPath('/a')
-      >>> p.parent(4)
-      PurePosixPath('/')
-
-
-.. method:: PurePath.parents()
-
-   Iterate over the path's parents from the most to the least specific::
-
-      >>> for p in PureNTPath('c:/foo/bar/setup.py').parents(): p
-      ...
-      PureNTPath('c:\\foo\\bar')
-      PureNTPath('c:\\foo')
-      PureNTPath('c:\\')
-
-
 Concrete paths
 --------------
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.