mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
SF 563203. Replaced 'has_key()' with 'in'.
This commit is contained in:
parent
9d5e4aa414
commit
54f0222547
54 changed files with 243 additions and 222 deletions
|
@ -291,9 +291,9 @@ def expanduser(path):
|
|||
while i < n and path[i] not in '/\\':
|
||||
i = i + 1
|
||||
if i == 1:
|
||||
if os.environ.has_key('HOME'):
|
||||
if 'HOME' in os.environ:
|
||||
userhome = os.environ['HOME']
|
||||
elif not os.environ.has_key('HOMEPATH'):
|
||||
elif not 'HOMEPATH' in os.environ:
|
||||
return path
|
||||
else:
|
||||
try:
|
||||
|
@ -347,7 +347,7 @@ def expandvars(path):
|
|||
try:
|
||||
index = path.index('}')
|
||||
var = path[:index]
|
||||
if os.environ.has_key(var):
|
||||
if var in os.environ:
|
||||
res = res + os.environ[var]
|
||||
except ValueError:
|
||||
res = res + path
|
||||
|
@ -360,7 +360,7 @@ def expandvars(path):
|
|||
var = var + c
|
||||
index = index + 1
|
||||
c = path[index:index + 1]
|
||||
if os.environ.has_key(var):
|
||||
if var in os.environ:
|
||||
res = res + os.environ[var]
|
||||
if c != '':
|
||||
res = res + c
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue