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
99bf06b2
Kaydet (Commit)
99bf06b2
authored
Agu 10, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
same thing as for dospath, plus HOMEDRIVE/HOMEPATH support
üst
92794e30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
ntpath.py
Lib/ntpath.py
+11
-12
No files found.
Lib/ntpath.py
Dosyayı görüntüle @
99bf06b2
# Module '
dos
path' -- common operations on DOS pathnames
# Module '
nt
path' -- common operations on DOS pathnames
import
os
import
os
import
stat
import
stat
...
@@ -7,27 +7,22 @@ import string
...
@@ -7,27 +7,22 @@ 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
mapchar
=
'_'
# single '_', but this has been removed. This functionality should
# possibly be added as a new function.
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
)
# Return wheter a path is absolute.
# Return wheter a path is absolute.
# Trivial in Posix, harder on the Mac or MS-DOS.
# Trivial in Posix, harder on the Mac or MS-DOS.
# For DOS it is absolute if it starts with a slash or backslash (current
# For DOS it is absolute if it starts with a slash or backslash (current
...
@@ -243,9 +238,13 @@ def expanduser(path):
...
@@ -243,9 +238,13 @@ def expanduser(path):
while
i
<
n
and
path
[
i
]
not
in
'/
\\
'
:
while
i
<
n
and
path
[
i
]
not
in
'/
\\
'
:
i
=
i
+
1
i
=
i
+
1
if
i
==
1
:
if
i
==
1
:
if
not
os
.
environ
.
has_key
(
'HOME'
):
try
:
drive
=
os
.
environ
[
'HOMEDRIVE'
]
except
KeyError
:
drive
=
''
if
not
os
.
environ
.
has_key
(
'HOMEPATH'
):
return
path
return
path
userhome
=
os
.
environ
[
'HOME'
]
userhome
=
join
(
drive
,
os
.
environ
[
'HOMEPATH'
])
else
:
else
:
return
path
return
path
return
userhome
+
path
[
i
:]
return
userhome
+
path
[
i
:]
...
...
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