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
db5ebc7b
Kaydet (Commit)
db5ebc7b
authored
Şub 09, 2001
tarafından
Eric S. Raymond
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
String method conversion.
üst
51cc3bcd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
knee.py
Lib/knee.py
+5
-5
macurl2path.py
Lib/macurl2path.py
+6
-7
No files found.
Lib/knee.py
Dosyayı görüntüle @
db5ebc7b
...
...
@@ -7,7 +7,7 @@ This code is intended to be read, not executed. However, it does work
"""
import
sys
,
imp
,
__builtin__
,
string
import
sys
,
imp
,
__builtin__
# Replacement for __import__()
...
...
@@ -30,7 +30,7 @@ def determine_parent(globals):
assert
globals
is
parent
.
__dict__
return
parent
if
'.'
in
pname
:
i
=
string
.
rfind
(
pname
,
'.'
)
i
=
pname
.
rfind
(
'.'
)
pname
=
pname
[:
i
]
parent
=
sys
.
modules
[
pname
]
assert
parent
.
__name__
==
pname
...
...
@@ -39,7 +39,7 @@ def determine_parent(globals):
def
find_head_package
(
parent
,
name
):
if
'.'
in
name
:
i
=
string
.
find
(
name
,
'.'
)
i
=
name
.
find
(
'.'
)
head
=
name
[:
i
]
tail
=
name
[
i
+
1
:]
else
:
...
...
@@ -61,7 +61,7 @@ def find_head_package(parent, name):
def
load_tail
(
q
,
tail
):
m
=
q
while
tail
:
i
=
string
.
find
(
tail
,
'.'
)
i
=
tail
.
find
(
'.'
)
if
i
<
0
:
i
=
len
(
tail
)
head
,
tail
=
tail
[:
i
],
tail
[
i
+
1
:]
mname
=
"
%
s.
%
s"
%
(
m
.
__name__
,
head
)
...
...
@@ -111,7 +111,7 @@ def reload_hook(module):
name
=
module
.
__name__
if
'.'
not
in
name
:
return
import_module
(
name
,
name
,
None
)
i
=
string
.
rfind
(
name
,
'.'
)
i
=
name
.
rfind
(
'.'
)
pname
=
name
[:
i
]
parent
=
sys
.
modules
[
pname
]
return
import_module
(
name
[
i
+
1
:],
name
,
parent
)
...
...
Lib/macurl2path.py
Dosyayı görüntüle @
db5ebc7b
...
...
@@ -2,7 +2,6 @@
Do not import directly; use urllib instead."""
import
string
import
urllib
import
os
...
...
@@ -21,7 +20,7 @@ def url2pathname(pathname):
pathname
=
pathname
[
2
:]
elif
pathname
[:
2
]
==
'//'
:
raise
RuntimeError
,
'Cannot convert non-local URL to pathname'
components
=
string
.
split
(
pathname
,
'/'
)
components
=
pathname
.
split
(
'/'
)
# Remove . and embedded ..
i
=
0
while
i
<
len
(
components
):
...
...
@@ -37,7 +36,7 @@ def url2pathname(pathname):
i
=
i
+
1
if
not
components
[
0
]:
# Absolute unix path, don't start with colon
rv
=
string
.
join
(
components
[
1
:],
':'
)
rv
=
':'
.
join
(
components
[
1
:]
)
else
:
# relative unix path, start with colon. First replace
# leading .. by empty strings (giving ::file)
...
...
@@ -45,7 +44,7 @@ def url2pathname(pathname):
while
i
<
len
(
components
)
and
components
[
i
]
==
'..'
:
components
[
i
]
=
''
i
=
i
+
1
rv
=
':'
+
string
.
join
(
components
,
':'
)
rv
=
':'
+
':'
.
join
(
components
)
# and finally unquote slashes and other funny characters
return
urllib
.
unquote
(
rv
)
...
...
@@ -53,7 +52,7 @@ def pathname2url(pathname):
"convert mac pathname to /-delimited pathname"
if
'/'
in
pathname
:
raise
RuntimeError
,
"Cannot convert pathname containing slashes"
components
=
string
.
split
(
pathname
,
':'
)
components
=
pathname
.
split
(
':'
)
# Remove empty first and/or last component
if
components
[
0
]
==
''
:
del
components
[
0
]
...
...
@@ -67,9 +66,9 @@ def pathname2url(pathname):
components
=
map
(
_pncomp2url
,
components
)
if
os
.
path
.
isabs
(
pathname
):
return
'/'
+
string
.
join
(
components
,
'/'
)
return
'/'
+
'/'
.
join
(
components
)
else
:
return
string
.
join
(
components
,
'/'
)
return
'/'
.
join
(
components
)
def
_pncomp2url
(
component
):
component
=
urllib
.
quote
(
component
[:
31
],
safe
=
''
)
# We want to quote slashes
...
...
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