remove has_key (not working in python3)

This commit is contained in:
Tomas Kopecek 2017-03-01 14:57:06 +01:00 committed by Mike McLean
parent 882316c298
commit cc9fff9840
19 changed files with 182 additions and 183 deletions

View file

@ -343,7 +343,7 @@ def ensure_connection(session):
warn(_("WARNING: The server is at API version %d and the client is at %d" % (ret, koji.API_VERSION)))
def has_krb_creds():
if not sys.modules.has_key('krbV'):
if 'krbV' not in sys.modules:
return False
try:
ctx = krbV.default_context()

View file

@ -320,7 +320,7 @@ def activate_session(session):
elif options.user:
#authenticate using user/password
session.login()
elif sys.modules.has_key('krbV'):
elif 'krbV' in sys.modules:
try:
if options.keytab and options.principal:
session.krb_login(principal=options.principal, keytab=options.keytab, proxyuser=options.runas)
@ -511,7 +511,7 @@ class TrackedBuild(object):
remote.multicall = True
unpack = []
for br_id in buildroots:
if seen.has_key(br_id):
if br_id in seen:
continue
seen[br_id] = 1
#br_info = remote.getBuildroot(br_id, strict=True)
@ -997,7 +997,7 @@ class BuildTracker(object):
missing_pkgs = []
for dep in deps:
name = dep.info['name']
if not pkgs.has_key(name):
if name not in pkgs:
#guess owner
owners = {}
for pkg in session.listPackages(pkgID=name):
@ -1051,8 +1051,8 @@ class BuildTracker(object):
#fix build group package list based on base of build to shadow
needed = dict([(n, 1) for n in build.base])
current = dict([(p['package'], 1) for p in build_group['packagelist']])
add_pkgs = [n for n in needed if not current.has_key(n)]
drop_pkgs = [n for n in current if not needed.has_key(n)]
add_pkgs = [n for n in needed if n not in current]
drop_pkgs = [n for n in current if n not in needed]
#no group deps needed/allowed
drop_deps = [(g['name'], 1) for g in build_group['grouplist']]
if drop_deps:

View file

@ -354,7 +354,7 @@ class RepoManager(object):
repodir = "%s/%s" % (tagdir, repo_id)
if not os.path.isdir(repodir):
continue
if self.repos.has_key(repo_id):
if repo_id in self.repos:
#we're already managing it, no need to deal with it here
continue
try:
@ -538,7 +538,7 @@ class RepoManager(object):
break
if covered:
continue
if self.tasks.has_key(tag_id):
if tag_id not in self.tasks:
#repo creation in progress
#TODO - implement a timeout
continue
@ -596,7 +596,7 @@ class RepoManager(object):
#some cleanup
n_deletes = 0
for tag_id, repolist in tag_repos.items():
if not tags.has_key(tag_id):
if tag_id not in tags:
#repos for these tags are no longer required
for repo in repolist:
if repo.ready():
@ -813,7 +813,7 @@ if __name__ == "__main__":
elif options.user:
# authenticate using user/password
session.login()
elif sys.modules.has_key('krbV') and options.principal and options.keytab:
elif 'krbV' in sys.modules and options.principal and options.keytab:
session.krb_login(options.principal, options.keytab, options.ccache)
#get an exclusive session
try: