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
649f8e7d
Kaydet (Commit)
649f8e7d
authored
Agu 03, 2005
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
patch [ 1105730 ] Faster commonprefix in macpath, ntpath, etc.
üst
b3700592
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
41 deletions
+35
-41
macpath.py
Lib/macpath.py
+8
-8
ntpath.py
Lib/ntpath.py
+7
-8
os2emxpath.py
Lib/os2emxpath.py
+7
-8
riscospath.py
Lib/plat-riscos/riscospath.py
+10
-17
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/macpath.py
Dosyayı görüntüle @
649f8e7d
...
@@ -175,14 +175,14 @@ def lexists(path):
...
@@ -175,14 +175,14 @@ def lexists(path):
def
commonprefix
(
m
):
def
commonprefix
(
m
):
"Given a list of pathnames, returns the longest common leading component"
"Given a list of pathnames, returns the longest common leading component"
if
not
m
:
return
''
if
not
m
:
return
''
prefix
=
m
[
0
]
s1
=
min
(
m
)
for
item
in
m
:
s2
=
max
(
m
)
for
i
in
range
(
len
(
prefix
)):
n
=
min
(
len
(
s1
),
len
(
s2
))
if
prefix
[:
i
+
1
]
!=
item
[:
i
+
1
]
:
for
i
in
xrange
(
n
)
:
prefix
=
prefix
[:
i
]
if
s1
[
i
]
!=
s2
[
i
]:
if
i
==
0
:
return
''
return
s1
[:
i
]
break
return
s1
[:
n
]
return
prefix
def
expandvars
(
path
):
def
expandvars
(
path
):
"""Dummy to retain interface-compatibility with other operating systems."""
"""Dummy to retain interface-compatibility with other operating systems."""
...
...
Lib/ntpath.py
Dosyayı görüntüle @
649f8e7d
...
@@ -212,14 +212,13 @@ def dirname(p):
...
@@ -212,14 +212,13 @@ def dirname(p):
def
commonprefix
(
m
):
def
commonprefix
(
m
):
"Given a list of pathnames, returns the longest common leading component"
"Given a list of pathnames, returns the longest common leading component"
if
not
m
:
return
''
if
not
m
:
return
''
prefix
=
m
[
0
]
s1
=
min
(
m
)
for
item
in
m
:
s2
=
max
(
m
)
for
i
in
range
(
len
(
prefix
)):
n
=
min
(
len
(
s1
),
len
(
s2
))
if
prefix
[:
i
+
1
]
!=
item
[:
i
+
1
]:
for
i
in
xrange
(
n
):
prefix
=
prefix
[:
i
]
if
s1
[
i
]
!=
s2
[
i
]:
if
i
==
0
:
return
''
return
s1
[:
i
]
break
return
s1
[:
n
]
return
prefix
# Get size, mtime, atime of files.
# Get size, mtime, atime of files.
...
...
Lib/os2emxpath.py
Dosyayı görüntüle @
649f8e7d
...
@@ -173,14 +173,13 @@ def dirname(p):
...
@@ -173,14 +173,13 @@ def dirname(p):
def
commonprefix
(
m
):
def
commonprefix
(
m
):
"Given a list of pathnames, returns the longest common leading component"
"Given a list of pathnames, returns the longest common leading component"
if
not
m
:
return
''
if
not
m
:
return
''
prefix
=
m
[
0
]
s1
=
min
(
m
)
for
item
in
m
:
s2
=
max
(
m
)
for
i
in
range
(
len
(
prefix
)):
n
=
min
(
len
(
s1
),
len
(
s2
))
if
prefix
[:
i
+
1
]
!=
item
[:
i
+
1
]:
for
i
in
xrange
(
n
):
prefix
=
prefix
[:
i
]
if
s1
[
i
]
!=
s2
[
i
]:
if
i
==
0
:
return
''
return
s1
[:
i
]
break
return
s1
[:
n
]
return
prefix
# Get size, mtime, atime of files.
# Get size, mtime, atime of files.
...
...
Lib/plat-riscos/riscospath.py
Dosyayı görüntüle @
649f8e7d
...
@@ -168,23 +168,16 @@ def dirname(p):
...
@@ -168,23 +168,16 @@ def dirname(p):
return
split
(
p
)[
0
]
return
split
(
p
)[
0
]
def
commonprefix
(
ps
):
def
commonprefix
(
m
):
"""
"Given a list of pathnames, returns the longest common leading component"
Return the longest prefix of all list elements. Purely string-based; does not
if
not
m
:
return
''
separate any path parts. Why am I in os.path?
s1
=
min
(
m
)
"""
s2
=
max
(
m
)
if
len
(
ps
)
==
0
:
n
=
min
(
len
(
s1
),
len
(
s2
))
return
''
for
i
in
xrange
(
n
):
prefix
=
ps
[
0
]
if
s1
[
i
]
!=
s2
[
i
]:
for
p
in
ps
[
1
:]:
return
s1
[:
i
]
prefix
=
prefix
[:
len
(
p
)]
return
s1
[:
n
]
for
i
in
range
(
len
(
prefix
)):
if
prefix
[
i
]
<>
p
[
i
]:
prefix
=
prefix
[:
i
]
if
i
==
0
:
return
''
break
return
prefix
## File access functions. Why are we in os.path?
## File access functions. Why are we in os.path?
...
...
Misc/NEWS
Dosyayı görüntüle @
649f8e7d
...
@@ -178,6 +178,9 @@ Extension Modules
...
@@ -178,6 +178,9 @@ Extension Modules
Library
Library
-------
-------
-
Patch
#
1105730
:
Apply
the
new
implementation
of
commonprefix
in
posixpath
to
ntpath
,
macpath
,
os2emxpath
and
riscospath
.
-
Fix
a
problem
in
Tkinter
introduced
by
SF
patch
#
869468
:
delete
bogus
-
Fix
a
problem
in
Tkinter
introduced
by
SF
patch
#
869468
:
delete
bogus
__hasattr__
and
__delattr__
methods
on
class
Tk
that
were
breaking
__hasattr__
and
__delattr__
methods
on
class
Tk
that
were
breaking
Tkdnd
.
Tkdnd
.
...
...
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