Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
599b65de
Commit
599b65de
authored
Jul 23, 2010
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use augassign.
parent
db902ac0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
Lib/ntpath.py
Lib/ntpath.py
+22
-22
No files found.
Lib/ntpath.py
View file @
599b65de
...
...
@@ -275,7 +275,7 @@ def split(p):
# set i to index beyond p's last slash
i
=
len
(
p
)
while
i
and
p
[
i
-
1
]
not
in
seps
:
i
=
i
-
1
i
-=
1
head
,
tail
=
p
[:
i
],
p
[
i
:]
# now tail has no slashes
# remove trailing slashes from head, unless it's all slashes
head2
=
head
...
...
@@ -366,7 +366,7 @@ def expanduser(path):
return
path
i
,
n
=
1
,
len
(
path
)
while
i
<
n
and
path
[
i
]
not
in
_get_bothseps
(
path
):
i
=
i
+
1
i
+=
1
if
'HOME'
in
os
.
environ
:
userhome
=
os
.
environ
[
'HOME'
]
...
...
@@ -435,21 +435,21 @@ def expandvars(path):
pathlen
=
len
(
path
)
try
:
index
=
path
.
index
(
c
)
res
=
res
+
c
+
path
[:
index
+
1
]
res
+=
c
+
path
[:
index
+
1
]
except
ValueError
:
res
=
res
+
path
res
+=
path
index
=
pathlen
-
1
elif
c
==
percent
:
# variable or '%'
if
path
[
index
+
1
:
index
+
2
]
==
percent
:
res
=
res
+
c
index
=
index
+
1
res
+=
c
index
+=
1
else
:
path
=
path
[
index
+
1
:]
pathlen
=
len
(
path
)
try
:
index
=
path
.
index
(
percent
)
except
ValueError
:
res
=
res
+
percent
+
path
res
+=
percent
+
path
index
=
pathlen
-
1
else
:
var
=
path
[:
index
]
...
...
@@ -461,11 +461,11 @@ def expandvars(path):
value
=
'%'
+
var
+
'%'
if
isinstance
(
path
,
bytes
):
value
=
value
.
encode
(
'ascii'
)
res
=
res
+
value
res
+=
value
elif
c
==
dollar
:
# variable or '$$'
if
path
[
index
+
1
:
index
+
2
]
==
dollar
:
res
=
res
+
c
index
=
index
+
1
res
+=
c
index
+=
1
elif
path
[
index
+
1
:
index
+
2
]
==
brace
:
path
=
path
[
index
+
2
:]
pathlen
=
len
(
path
)
...
...
@@ -483,23 +483,23 @@ def expandvars(path):
value
=
'${'
+
var
+
'}'
if
isinstance
(
path
,
bytes
):
value
=
value
.
encode
(
'ascii'
)
res
=
res
+
value
res
+=
value
except
ValueError
:
if
isinstance
(
path
,
bytes
):
res
=
res
+
b'${'
+
path
res
+=
b'${'
+
path
else
:
res
=
res
+
'${'
+
path
res
+=
'${'
+
path
index
=
pathlen
-
1
else
:
var
=
''
index
=
index
+
1
index
+=
1
c
=
path
[
index
:
index
+
1
]
while
c
and
c
in
varchars
:
if
isinstance
(
path
,
bytes
):
var
=
var
+
c
.
decode
(
'ascii'
)
var
+=
c
.
decode
(
'ascii'
)
else
:
var
=
var
+
c
index
=
index
+
1
var
+=
c
index
+=
1
c
=
path
[
index
:
index
+
1
]
if
var
in
os
.
environ
:
value
=
os
.
environ
[
var
]
...
...
@@ -507,12 +507,12 @@ def expandvars(path):
value
=
'$'
+
var
if
isinstance
(
path
,
bytes
):
value
=
value
.
encode
(
'ascii'
)
res
=
res
+
value
res
+=
value
if
c
:
index
=
index
-
1
index
-=
1
else
:
res
=
res
+
c
index
=
index
+
1
res
+=
c
index
+=
1
return
res
...
...
@@ -529,7 +529,7 @@ def normpath(path):
# collapse initial backslashes
if
path
.
startswith
(
sep
):
prefix
=
prefix
+
sep
prefix
+=
sep
path
=
path
.
lstrip
(
sep
)
comps
=
path
.
split
(
sep
)
...
...
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