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
fda5c1a8
Kaydet (Commit)
fda5c1a8
authored
Agu 10, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
redefined normcase()
üst
3b8e1604
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
14 deletions
+5
-14
dospath.py
Lib/dospath.py
+5
-14
No files found.
Lib/dospath.py
Dosyayı görüntüle @
fda5c1a8
...
@@ -7,28 +7,18 @@ import string
...
@@ -7,28 +7,18 @@ import string
# Normalize the case of a pathname.
# Normalize the case of a pathname.
# On MS-DOS it maps the pathname to lowercase, turns slashes into
# On MS-DOS it maps the pathname to lowercase, turns slashes into
# backslashes
and maps invalid consecutive characters to a single '_'
.
# backslashes.
# Other normalizations (such as optimizing '../' away) are not allowed
# Other normalizations (such as optimizing '../' away) are not allowed
# (this is done by normpath).
# (this is done by normpath).
#
# Previously, this version mapped invalid consecutive characters to a
# Amrit: Things that can be valid regular expressions cannot be normalized
# single '_', but this has been removed. This functionality should
# away. (which is pretty much all special characters)
# possibly be added as a new function.
#
# I am assuming that at least these chars may be used:
# [, ], |, *, +, ?
mapchar
=
'_'
def
normcase
(
s
):
def
normcase
(
s
):
res
,
s
=
splitdrive
(
s
)
res
,
s
=
splitdrive
(
s
)
for
c
in
s
:
for
c
in
s
:
if
c
in
'/
\\
'
:
if
c
in
'/
\\
'
:
res
=
res
+
os
.
sep
res
=
res
+
os
.
sep
elif
c
==
'.'
and
res
[
-
1
:]
==
os
.
sep
:
res
=
res
+
mapchar
+
c
elif
ord
(
c
)
<
32
or
c
in
' ",:;<=>'
:
if
res
[
-
1
:]
!=
mapchar
:
res
=
res
+
mapchar
else
:
else
:
res
=
res
+
c
res
=
res
+
c
return
string
.
lower
(
res
)
return
string
.
lower
(
res
)
...
@@ -59,6 +49,7 @@ def join(a, b):
...
@@ -59,6 +49,7 @@ def join(a, b):
# Split a path in a drive specification (a drive letter followed by a
# Split a path in a drive specification (a drive letter followed by a
# colon) and the path specification.
# colon) and the path specification.
# It is always true that drivespec + pathspec == p
# It is always true that drivespec + pathspec == p
def
splitdrive
(
p
):
def
splitdrive
(
p
):
if
p
[
1
:
2
]
==
':'
:
if
p
[
1
:
2
]
==
':'
:
return
p
[
0
:
2
],
p
[
2
:]
return
p
[
0
:
2
],
p
[
2
:]
...
...
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