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
db848035
Kaydet (Commit)
db848035
authored
Eki 20, 2011
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Simplify calls in fnmatch.
üst
cd9fdfd6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
fnmatch.py
Lib/fnmatch.py
+5
-5
No files found.
Lib/fnmatch.py
Dosyayı görüntüle @
db848035
...
...
@@ -35,9 +35,9 @@ def fnmatch(name, pat):
pat
=
os
.
path
.
normcase
(
pat
)
return
fnmatchcase
(
name
,
pat
)
@functools.lru_cache
(
maxsize
=
250
)
def
_compile_pattern
(
pat
,
is_bytes
=
False
):
if
is
_bytes
:
@functools.lru_cache
(
maxsize
=
250
,
typed
=
True
)
def
_compile_pattern
(
pat
):
if
is
instance
(
pat
,
bytes
)
:
pat_str
=
str
(
pat
,
'ISO-8859-1'
)
res_str
=
translate
(
pat_str
)
res
=
bytes
(
res_str
,
'ISO-8859-1'
)
...
...
@@ -49,7 +49,7 @@ def filter(names, pat):
"""Return the subset of the list NAMES that match PAT."""
result
=
[]
pat
=
os
.
path
.
normcase
(
pat
)
match
=
_compile_pattern
(
pat
,
isinstance
(
pat
,
bytes
)
)
match
=
_compile_pattern
(
pat
)
if
os
.
path
is
posixpath
:
# normcase on posix is NOP. Optimize it away from the loop.
for
name
in
names
:
...
...
@@ -67,7 +67,7 @@ def fnmatchcase(name, pat):
This is a version of fnmatch() which doesn't case-normalize
its arguments.
"""
match
=
_compile_pattern
(
pat
,
isinstance
(
pat
,
bytes
)
)
match
=
_compile_pattern
(
pat
)
return
match
(
name
)
is
not
None
...
...
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