Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0470689

Browse files
committed
Run 2to3's fix_has_key over Lib/plat-os2emx/.
1 parent ba21f61 commit 0470689

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

Lib/plat-os2emx/grp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@
5858

5959
# try and find the group file
6060
__group_path = []
61-
if os.environ.has_key('ETC_GROUP'):
61+
if 'ETC_GROUP' in os.environ:
6262
__group_path.append(os.environ['ETC_GROUP'])
63-
if os.environ.has_key('ETC'):
63+
if 'ETC' in os.environ:
6464
__group_path.append('%s/group' % os.environ['ETC'])
65-
if os.environ.has_key('PYTHONHOME'):
65+
if 'PYTHONHOME' in os.environ:
6666
__group_path.append('%s/Etc/group' % os.environ['PYTHONHOME'])
6767

6868
group_file = None
@@ -149,9 +149,9 @@ def __read_group_file():
149149
fields[2] = int(fields[2])
150150
fields[3] = [f.strip() for f in fields[3].split(',')]
151151
record = Group(*fields)
152-
if not gidx.has_key(fields[2]):
152+
if fields[2] not in gidx:
153153
gidx[fields[2]] = record
154-
if not namx.has_key(fields[0]):
154+
if fields[0] not in namx:
155155
namx[fields[0]] = record
156156
elif len(entry) > 0:
157157
pass # skip empty or malformed records

Lib/plat-os2emx/pwd.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@
6161

6262
# try and find the passwd file
6363
__passwd_path = []
64-
if os.environ.has_key('ETC_PASSWD'):
64+
if 'ETC_PASSWD' in os.environ:
6565
__passwd_path.append(os.environ['ETC_PASSWD'])
66-
if os.environ.has_key('ETC'):
66+
if 'ETC' in os.environ:
6767
__passwd_path.append('%s/passwd' % os.environ['ETC'])
68-
if os.environ.has_key('PYTHONHOME'):
68+
if 'PYTHONHOME' in os.environ:
6969
__passwd_path.append('%s/Etc/passwd' % os.environ['PYTHONHOME'])
7070

7171
passwd_file = None
@@ -164,7 +164,7 @@ def __read_passwd_file():
164164
uidx = {}
165165
namx = {}
166166
sep = None
167-
while 1:
167+
while True:
168168
entry = passwd.readline().strip()
169169
if len(entry) > 6:
170170
if sep == None:
@@ -175,9 +175,9 @@ def __read_passwd_file():
175175
for i in (5, 6):
176176
fields[i] = __field_sep[sep](fields[i])
177177
record = Passwd(*fields)
178-
if not uidx.has_key(fields[2]):
178+
if fields[2] not in uidx:
179179
uidx[fields[2]] = record
180-
if not namx.has_key(fields[0]):
180+
if fields[0] not in namx:
181181
namx[fields[0]] = record
182182
elif len(entry) > 0:
183183
pass # skip empty or malformed records

0 commit comments

Comments
 (0)