1
0
mirror of https://github.com/samba-team/samba.git synced 2025-09-27 17:44:21 +03:00

PEP8: fix W601: .has_key() is deprecated, use 'in'

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Joe Guo
2018-07-30 16:43:51 +12:00
committed by Douglas Bagnall
parent d7863ffe5d
commit 3606a49c73
3 changed files with 8 additions and 8 deletions

View File

@@ -2371,7 +2371,7 @@ def provision(logger, session_info, smbconf=None,
os.chmod(paths.binddns_dir, 0o770)
os.chown(paths.binddns_dir, -1, paths.bind_gid)
except OSError:
if not os.environ.has_key('SAMBA_SELFTEST'):
if 'SAMBA_SELFTEST' not in os.environ:
logger.info("Failed to chown %s to bind gid %u",
paths.binddns_dir, paths.bind_gid)
@@ -2379,7 +2379,7 @@ def provision(logger, session_info, smbconf=None,
os.chmod(bind_dns_keytab_path, 0o640)
os.chown(bind_dns_keytab_path, -1, paths.bind_gid)
except OSError:
if not os.environ.has_key('SAMBA_SELFTEST'):
if 'SAMBA_SELFTEST' not in os.environ:
logger.info("Failed to chown %s to bind gid %u",
bind_dns_keytab_path, paths.bind_gid)

View File

@@ -704,7 +704,7 @@ def create_dns_dir(logger, paths):
# chmod needed to cope with umask
os.chmod(dns_dir, 0o770)
except OSError:
if not os.environ.has_key('SAMBA_SELFTEST'):
if 'SAMBA_SELFTEST' not in os.environ:
logger.error("Failed to chown %s to bind gid %u" % (
dns_dir, paths.bind_gid))
@@ -771,7 +771,7 @@ def create_zone_file(lp, logger, paths, targetdir, dnsdomain,
# chmod needed to cope with umask
os.chmod(paths.dns, 0o664)
except OSError:
if not os.environ.has_key('SAMBA_SELFTEST'):
if 'SAMBA_SELFTEST' not in os.environ:
logger.error("Failed to chown %s to bind gid %u" % (
paths.dns, paths.bind_gid))
@@ -896,11 +896,11 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid):
os.chown(fpath, -1, paths.bind_gid)
os.chmod(fpath, 0o660)
except OSError:
if not os.environ.has_key('SAMBA_SELFTEST'):
if 'SAMBA_SELFTEST' not in os.environ:
logger.error(
"Failed to set permissions to sam.ldb* files, fix manually")
else:
if not os.environ.has_key('SAMBA_SELFTEST'):
if 'SAMBA_SELFTEST' not in os.environ:
logger.warning("""Unable to find group id for BIND,
set permissions to sam.ldb* files manually""")

View File

@@ -24,7 +24,7 @@ graph = {}
for arc in lines[1:-1]:
match = sre.search('"(.*)" -> "(.*)"', arc)
n1, n2 = match.group(1), match.group(2)
if not graph.has_key(n1):
if n1 not in graph:
graph[n1] = []
graph[n1].append(n2)
@@ -33,7 +33,7 @@ for arc in lines[1:-1]:
subgraph = {}
def add_deps(node):
if graph.has_key(node) and not subgraph.has_key(node):
if node in graph and node not in subgraph:
subgraph[node] = graph[node]
for n in graph[node]:
add_deps(n)