]> granicus.if.org Git - python/commitdiff
Bug #649974: make docstrings for url2pathname consistent
authorGeorg Brandl <georg@python.org>
Mon, 26 Dec 2005 22:53:56 +0000 (22:53 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 26 Dec 2005 22:53:56 +0000 (22:53 +0000)
Lib/macurl2path.py
Lib/nturl2path.py
Lib/plat-riscos/rourl2path.py
Lib/urllib.py

index ed23883cfd79d4df82ff0d15c4a8e0ceba8dcb08..4c5ae64572e26ab59f299ce83b16ca42827b44a2 100644 (file)
@@ -8,7 +8,8 @@ import os
 __all__ = ["url2pathname","pathname2url"]
 
 def url2pathname(pathname):
-    "Convert /-delimited pathname to mac pathname"
+    """OS-specific conversion from a relative URL of the 'file' scheme
+    to a file system path; not recommended for general use."""
     #
     # XXXX The .. handling should be fixed...
     #
@@ -49,7 +50,8 @@ def url2pathname(pathname):
     return urllib.unquote(rv)
 
 def pathname2url(pathname):
-    "convert mac pathname to /-delimited pathname"
+    """OS-specific conversion from a file system path to a relative URL
+    of the 'file' scheme; not recommended for general use."""
     if '/' in pathname:
         raise RuntimeError, "Cannot convert pathname containing slashes"
     components = pathname.split(':')
index 2ced9a91c5dd0e26e3e66688a280f645ca9597b8..31064044e73d7687986618ecea165a2f51bd543c 100644 (file)
@@ -1,14 +1,12 @@
 """Convert a NT pathname to a file URL and vice versa."""
 
 def url2pathname(url):
-    r"""Convert a URL to a DOS path.
-
-            ///C|/foo/bar/spam.foo
-
-                    becomes
-
-            C:\foo\bar\spam.foo
-    """
+    """OS-specific conversion from a relative URL of the 'file' scheme
+    to a file system path; not recommended for general use."""
+    # e.g.
+    # ///C|/foo/bar/spam.foo
+    # becomes
+    # C:\foo\bar\spam.foo
     import string, urllib
     # Windows itself uses ":" even in URLs.
     url = url.replace(':', '|')
@@ -35,15 +33,12 @@ def url2pathname(url):
     return path
 
 def pathname2url(p):
-    r"""Convert a DOS path name to a file url.
-
-            C:\foo\bar\spam.foo
-
-                    becomes
-
-            ///C|/foo/bar/spam.foo
-    """
-
+    """OS-specific conversion from a file system path to a relative URL
+    of the 'file' scheme; not recommended for general use."""
+    # e.g.
+    # C:\foo\bar\spam.foo
+    # becomes
+    # ///C|/foo/bar/spam.foo
     import urllib
     if not ':' in p:
         # No drive specifier, just convert slashes and quote the name
index 7642b9f21f2d710b72c09d969854431d622b2dbb..7a8badf446320bf3f86a0cfff782d94305212059 100644 (file)
@@ -11,7 +11,8 @@ __all__ = ["url2pathname","pathname2url"]
 __slash_dot = string.maketrans("/.", "./")
 
 def url2pathname(url):
-    "Convert URL to a RISC OS path."
+    """OS-specific conversion from a relative URL of the 'file' scheme
+    to a file system path; not recommended for general use."""
     tp = urllib.splittype(url)[0]
     if tp and tp <> 'file':
         raise RuntimeError, 'Cannot convert non-local URL to pathname'
@@ -46,7 +47,8 @@ def url2pathname(url):
     return '.'.join(components)
 
 def pathname2url(pathname):
-    "Convert a RISC OS path name to a file url."
+    """OS-specific conversion from a file system path to a relative URL
+    of the 'file' scheme; not recommended for general use."""
     return urllib.quote('///' + pathname.translate(__slash_dot), "/$:")
 
 def test():
index f700d718f4bc9389f72bbf0f592b9d5901a6a347..802d9b760e1bd6e6f2d5936ab84085b25726449e 100644 (file)
@@ -50,8 +50,13 @@ elif os.name == 'riscos':
     from rourl2path import url2pathname, pathname2url
 else:
     def url2pathname(pathname):
+        """OS-specific conversion from a relative URL of the 'file' scheme
+        to a file system path; not recommended for general use."""
         return unquote(pathname)
+
     def pathname2url(pathname):
+        """OS-specific conversion from a file system path to a relative URL
+        of the 'file' scheme; not recommended for general use."""
         return quote(pathname)
 
 # This really consists of two pieces: