summaryrefslogtreecommitdiffstats
path: root/Lib/ntpath.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-08-01 21:27:48 (GMT)
committerGeorg Brandl <georg@python.org>2010-08-01 21:27:48 (GMT)
commit422b545852b0203a900044237c43cb50ac9b0b63 (patch)
tree25f59c22f03ca95e3a590f6d2519dfaf4e89e5aa /Lib/ntpath.py
parent8b256caf2d56db5afadc7a82c7b4440b9c1911cf (diff)
downloadcpython-422b545852b0203a900044237c43cb50ac9b0b63.zip
cpython-422b545852b0203a900044237c43cb50ac9b0b63.tar.gz
cpython-422b545852b0203a900044237c43cb50ac9b0b63.tar.bz2
Merged revisions 83065 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ........ r83065 | georg.brandl | 2010-07-23 10:46:35 +0200 (Fr, 23 Jul 2010) | 1 line Use augassign. ........
Diffstat (limited to 'Lib/ntpath.py')
-rw-r--r--Lib/ntpath.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index 6aa1e85..dd7372f 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -277,7 +277,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
@@ -356,7 +356,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']
@@ -425,21 +425,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]
@@ -451,11 +451,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)
@@ -473,23 +473,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]
@@ -497,12 +497,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
@@ -526,7 +526,7 @@ def normpath(path):
# collapse initial backslashes
if path.startswith(sep):
- prefix = prefix + sep
+ prefix += sep
path = path.lstrip(sep)
comps = path.split(sep)