Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c0b24734
Kaydet (Commit)
c0b24734
authored
Ara 26, 2005
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Bug #649974: make docstrings for url2pathname consistent
üst
ddddd2f7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
21 deletions
+25
-21
macurl2path.py
Lib/macurl2path.py
+4
-2
nturl2path.py
Lib/nturl2path.py
+12
-17
rourl2path.py
Lib/plat-riscos/rourl2path.py
+4
-2
urllib.py
Lib/urllib.py
+5
-0
No files found.
Lib/macurl2path.py
Dosyayı görüntüle @
c0b24734
...
@@ -8,7 +8,8 @@ import os
...
@@ -8,7 +8,8 @@ import os
__all__
=
[
"url2pathname"
,
"pathname2url"
]
__all__
=
[
"url2pathname"
,
"pathname2url"
]
def
url2pathname
(
pathname
):
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...
# XXXX The .. handling should be fixed...
#
#
...
@@ -49,7 +50,8 @@ def url2pathname(pathname):
...
@@ -49,7 +50,8 @@ def url2pathname(pathname):
return
urllib
.
unquote
(
rv
)
return
urllib
.
unquote
(
rv
)
def
pathname2url
(
pathname
):
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
:
if
'/'
in
pathname
:
raise
RuntimeError
,
"Cannot convert pathname containing slashes"
raise
RuntimeError
,
"Cannot convert pathname containing slashes"
components
=
pathname
.
split
(
':'
)
components
=
pathname
.
split
(
':'
)
...
...
Lib/nturl2path.py
Dosyayı görüntüle @
c0b24734
"""Convert a NT pathname to a file URL and vice versa."""
"""Convert a NT pathname to a file URL and vice versa."""
def
url2pathname
(
url
):
def
url2pathname
(
url
):
r"""Convert a URL to a DOS path.
"""OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use."""
///C|/foo/bar/spam.foo
# e.g.
# ///C|/foo/bar/spam.foo
becomes
# becomes
# C:\foo\bar\spam.foo
C:\foo\bar\spam.foo
"""
import
string
,
urllib
import
string
,
urllib
# Windows itself uses ":" even in URLs.
# Windows itself uses ":" even in URLs.
url
=
url
.
replace
(
':'
,
'|'
)
url
=
url
.
replace
(
':'
,
'|'
)
...
@@ -35,15 +33,12 @@ def url2pathname(url):
...
@@ -35,15 +33,12 @@ def url2pathname(url):
return
path
return
path
def
pathname2url
(
p
):
def
pathname2url
(
p
):
r"""Convert a DOS 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."""
C:\foo\bar\spam.foo
# e.g.
# C:\foo\bar\spam.foo
becomes
# becomes
# ///C|/foo/bar/spam.foo
///C|/foo/bar/spam.foo
"""
import
urllib
import
urllib
if
not
':'
in
p
:
if
not
':'
in
p
:
# No drive specifier, just convert slashes and quote the name
# No drive specifier, just convert slashes and quote the name
...
...
Lib/plat-riscos/rourl2path.py
Dosyayı görüntüle @
c0b24734
...
@@ -11,7 +11,8 @@ __all__ = ["url2pathname","pathname2url"]
...
@@ -11,7 +11,8 @@ __all__ = ["url2pathname","pathname2url"]
__slash_dot
=
string
.
maketrans
(
"/."
,
"./"
)
__slash_dot
=
string
.
maketrans
(
"/."
,
"./"
)
def
url2pathname
(
url
):
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
]
tp
=
urllib
.
splittype
(
url
)[
0
]
if
tp
and
tp
<>
'file'
:
if
tp
and
tp
<>
'file'
:
raise
RuntimeError
,
'Cannot convert non-local URL to pathname'
raise
RuntimeError
,
'Cannot convert non-local URL to pathname'
...
@@ -46,7 +47,8 @@ def url2pathname(url):
...
@@ -46,7 +47,8 @@ def url2pathname(url):
return
'.'
.
join
(
components
)
return
'.'
.
join
(
components
)
def
pathname2url
(
pathname
):
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
),
"/$:"
)
return
urllib
.
quote
(
'///'
+
pathname
.
translate
(
__slash_dot
),
"/$:"
)
def
test
():
def
test
():
...
...
Lib/urllib.py
Dosyayı görüntüle @
c0b24734
...
@@ -50,8 +50,13 @@ elif os.name == 'riscos':
...
@@ -50,8 +50,13 @@ elif os.name == 'riscos':
from
rourl2path
import
url2pathname
,
pathname2url
from
rourl2path
import
url2pathname
,
pathname2url
else
:
else
:
def
url2pathname
(
pathname
):
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
)
return
unquote
(
pathname
)
def
pathname2url
(
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
)
return
quote
(
pathname
)
# This really consists of two pieces:
# This really consists of two pieces:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment