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
d9fbb446
Kaydet (Commit)
d9fbb446
authored
Ara 16, 2013
tarafından
Christian Heimes
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge
üst
cb3558dc
8817d830
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
22 deletions
+42
-22
ntpath.py
Lib/ntpath.py
+7
-21
test_ntpath.py
Lib/test/test_ntpath.py
+26
-0
Makefile.pre.in
Makefile.pre.in
+2
-1
NEWS
Misc/NEWS
+7
-0
No files found.
Lib/ntpath.py
Dosyayı görüntüle @
d9fbb446
...
@@ -204,7 +204,7 @@ def splitdrive(p):
...
@@ -204,7 +204,7 @@ def splitdrive(p):
empty
=
_get_empty
(
p
)
empty
=
_get_empty
(
p
)
if
len
(
p
)
>
1
:
if
len
(
p
)
>
1
:
sep
=
_get_sep
(
p
)
sep
=
_get_sep
(
p
)
normp
=
normcase
(
p
)
normp
=
p
.
replace
(
_get_altsep
(
p
),
se
p
)
if
(
normp
[
0
:
2
]
==
sep
*
2
)
and
(
normp
[
2
:
3
]
!=
sep
):
if
(
normp
[
0
:
2
]
==
sep
*
2
)
and
(
normp
[
2
:
3
]
!=
sep
):
# is a UNC path:
# is a UNC path:
# vvvvvvvvvvvvvvvvvvvv drive letter or UNC path
# vvvvvvvvvvvvvvvvvvvv drive letter or UNC path
...
@@ -240,26 +240,12 @@ def splitunc(p):
...
@@ -240,26 +240,12 @@ def splitunc(p):
"""
"""
import
warnings
import
warnings
warnings
.
warn
(
"ntpath.splitunc is deprecated, use ntpath.splitdrive instead"
,
warnings
.
warn
(
"ntpath.splitunc is deprecated, use ntpath.splitdrive instead"
,
DeprecationWarning
)
DeprecationWarning
,
2
)
sep
=
_get_sep
(
p
)
drive
,
path
=
splitdrive
(
p
)
if
not
p
[
1
:
2
]:
if
len
(
drive
)
==
2
:
return
p
[:
0
],
p
# Drive letter present
# Drive letter present
firstTwo
=
p
[
0
:
2
]
return
p
[:
0
],
p
if
normcase
(
firstTwo
)
==
sep
+
sep
:
return
drive
,
path
# is a UNC path:
# vvvvvvvvvvvvvvvvvvvv equivalent to drive letter
# \\machine\mountpoint\directories...
# directory ^^^^^^^^^^^^^^^
normp
=
normcase
(
p
)
index
=
normp
.
find
(
sep
,
2
)
if
index
==
-
1
:
##raise RuntimeError, 'illegal UNC path: "' + p + '"'
return
(
p
[:
0
],
p
)
index
=
normp
.
find
(
sep
,
index
+
1
)
if
index
==
-
1
:
index
=
len
(
p
)
return
p
[:
index
],
p
[
index
:]
return
p
[:
0
],
p
# Split a path in head (everything up to the last '/') and tail (the
# Split a path in head (everything up to the last '/') and tail (the
...
...
Lib/test/test_ntpath.py
Dosyayı görüntüle @
d9fbb446
...
@@ -66,6 +66,32 @@ class TestNtpath(unittest.TestCase):
...
@@ -66,6 +66,32 @@ class TestNtpath(unittest.TestCase):
(
''
,
'
\\\\
conky
\\\\
mountpoint
\\
foo
\\
bar'
))
(
''
,
'
\\\\
conky
\\\\
mountpoint
\\
foo
\\
bar'
))
tester
(
'ntpath.splitdrive("//conky//mountpoint/foo/bar")'
,
tester
(
'ntpath.splitdrive("//conky//mountpoint/foo/bar")'
,
(
''
,
'//conky//mountpoint/foo/bar'
))
(
''
,
'//conky//mountpoint/foo/bar'
))
# Issue #19911: UNC part containing U+0130
self
.
assertEqual
(
ntpath
.
splitdrive
(
'//conky/MOUNTPOİNT/foo/bar'
),
(
'//conky/MOUNTPOİNT'
,
'/foo/bar'
))
def
test_splitunc
(
self
):
with
self
.
assertWarns
(
DeprecationWarning
):
ntpath
.
splitunc
(
''
)
with
support
.
check_warnings
((
''
,
DeprecationWarning
)):
tester
(
'ntpath.splitunc("c:
\\
foo
\\
bar")'
,
(
''
,
'c:
\\
foo
\\
bar'
))
tester
(
'ntpath.splitunc("c:/foo/bar")'
,
(
''
,
'c:/foo/bar'
))
tester
(
'ntpath.splitunc("
\\\\
conky
\\
mountpoint
\\
foo
\\
bar")'
,
(
'
\\\\
conky
\\
mountpoint'
,
'
\\
foo
\\
bar'
))
tester
(
'ntpath.splitunc("//conky/mountpoint/foo/bar")'
,
(
'//conky/mountpoint'
,
'/foo/bar'
))
tester
(
'ntpath.splitunc("
\\\\\\
conky
\\
mountpoint
\\
foo
\\
bar")'
,
(
''
,
'
\\\\\\
conky
\\
mountpoint
\\
foo
\\
bar'
))
tester
(
'ntpath.splitunc("///conky/mountpoint/foo/bar")'
,
(
''
,
'///conky/mountpoint/foo/bar'
))
tester
(
'ntpath.splitunc("
\\\\
conky
\\\\
mountpoint
\\
foo
\\
bar")'
,
(
''
,
'
\\\\
conky
\\\\
mountpoint
\\
foo
\\
bar'
))
tester
(
'ntpath.splitunc("//conky//mountpoint/foo/bar")'
,
(
''
,
'//conky//mountpoint/foo/bar'
))
self
.
assertEqual
(
ntpath
.
splitunc
(
'//conky/MOUNTPOİNT/foo/bar'
),
(
'//conky/MOUNTPOİNT'
,
'/foo/bar'
))
def
test_split
(
self
):
def
test_split
(
self
):
tester
(
'ntpath.split("c:
\\
foo
\\
bar")'
,
(
'c:
\\
foo'
,
'bar'
))
tester
(
'ntpath.split("c:
\\
foo
\\
bar")'
,
(
'c:
\\
foo'
,
'bar'
))
...
...
Makefile.pre.in
Dosyayı görüntüle @
d9fbb446
...
@@ -910,7 +910,8 @@ PYTHON_HEADERS= \
...
@@ -910,7 +910,8 @@ PYTHON_HEADERS= \
$(srcdir)
/Include/warnings.h
\
$(srcdir)
/Include/warnings.h
\
$(srcdir)
/Include/weakrefobject.h
\
$(srcdir)
/Include/weakrefobject.h
\
pyconfig.h
\
pyconfig.h
\
$(PARSER_HEADERS)
$(PARSER_HEADERS)
\
$(AST_H)
$(LIBRARY_OBJS) $(MODOBJS) Modules/python.o
:
$(PYTHON_HEADERS)
$(LIBRARY_OBJS) $(MODOBJS) Modules/python.o
:
$(PYTHON_HEADERS)
...
...
Misc/NEWS
Dosyayı görüntüle @
d9fbb446
...
@@ -44,6 +44,11 @@ Core and Builtins
...
@@ -44,6 +44,11 @@ Core and Builtins
Library
Library
-------
-------
- Issue #19912: Fixed numerous bugs in ntpath.splitunc().
- Issue #19911: ntpath.splitdrive() now correctly processes the '
İ
' character
(U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE).
- Issue #19532: python -m compileall with no filename/directory arguments now
- Issue #19532: python -m compileall with no filename/directory arguments now
respects the -f and -q flags instead of ignoring them.
respects the -f and -q flags instead of ignoring them.
...
@@ -180,6 +185,8 @@ IDLE
...
@@ -180,6 +185,8 @@ IDLE
Tests
Tests
-----
-----
-
Issue
#
19912
:
Added
tests
for
ntpath
.
splitunc
().
-
Issue
#
19828
:
Fixed
test_site
when
the
whole
suite
is
run
with
-
S
.
-
Issue
#
19828
:
Fixed
test_site
when
the
whole
suite
is
run
with
-
S
.
-
Issue
#
19928
:
Implemented
a
test
for
repr
()
of
cell
objects
.
-
Issue
#
19928
:
Implemented
a
test
for
repr
()
of
cell
objects
.
...
...
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