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
a9da5ae0
Kaydet (Commit)
a9da5ae0
authored
Haz 19, 2003
tarafından
Walter Dörwald
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use find() instead of looping over the string in expanduser().
From SF patch #757058.
üst
76ca1d42
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
posixpath.py
Lib/posixpath.py
+4
-4
test_posixpath.py
Lib/test/test_posixpath.py
+5
-1
No files found.
Lib/posixpath.py
Dosyayı görüntüle @
a9da5ae0
...
...
@@ -303,11 +303,11 @@ def expanduser(path):
do nothing."""
if
not
path
.
startswith
(
'~'
):
return
path
i
,
n
=
1
,
len
(
path
)
while
i
<
n
and
path
[
i
]
!=
'/'
:
i
+=
1
i
=
path
.
find
(
'/'
,
1
)
if
i
<
0
:
i
=
len
(
path
)
if
i
==
1
:
if
not
'HOME'
in
os
.
environ
:
if
'HOME'
not
in
os
.
environ
:
import
pwd
userhome
=
pwd
.
getpwuid
(
os
.
getuid
())
.
pw_dir
else
:
...
...
Lib/test/test_posixpath.py
Dosyayı görüntüle @
a9da5ae0
...
...
@@ -332,12 +332,16 @@ class PosixPathTest(unittest.TestCase):
def
test_expanduser
(
self
):
self
.
assertEqual
(
posixpath
.
expanduser
(
"foo"
),
"foo"
)
self
.
assert_
(
isinstance
(
posixpath
.
expanduser
(
"~/"
),
basestring
))
try
:
import
pwd
except
ImportError
:
pass
else
:
self
.
assert_
(
isinstance
(
posixpath
.
expanduser
(
"~/"
),
basestring
))
self
.
assertEqual
(
posixpath
.
expanduser
(
"~"
)
+
"/"
,
posixpath
.
expanduser
(
"~/"
)
)
self
.
assert_
(
isinstance
(
posixpath
.
expanduser
(
"~root/"
),
basestring
))
self
.
assert_
(
isinstance
(
posixpath
.
expanduser
(
"~foo/"
),
basestring
))
...
...
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