From e176a942eecc93f369be9eb9ee487337d85b781a Mon Sep 17 00:00:00 2001 From: root <3c2b2ff5@inbox.ru> Date: Tue, 5 Nov 2019 10:55:11 +0100 Subject: [PATCH] replaced if no x in y with if x not in y --- nss_cache/sources/httpsource.py | 20 ++++++++++---------- nss_cache/sources/ldapsource.py | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/nss_cache/sources/httpsource.py b/nss_cache/sources/httpsource.py index c46d168a..37a8b59b 100644 --- a/nss_cache/sources/httpsource.py +++ b/nss_cache/sources/httpsource.py @@ -80,25 +80,25 @@ def __init__(self, conf, conn=None): def _SetDefaults(self, configuration): """Set defaults if necessary.""" - if not 'automount_base_url' in configuration: + if 'automount_base_url' not in configuration: configuration['automount_base_url'] = self.AUTOMOUNT_BASE_URL - if not 'passwd_url' in configuration: + if 'passwd_url' not in configuration: configuration['passwd_url'] = self.PASSWD_URL - if not 'shadow_url' in configuration: + if 'shadow_url' not in configuration: configuration['shadow_url'] = self.SHADOW_URL - if not 'group_url' in configuration: + if 'group_url' not in configuration: configuration['group_url'] = self.GROUP_URL - if not 'netgroup_url' in configuration: + if 'netgroup_url' not in configuration: configuration['netgroup_url'] = self.GROUP_URL - if not 'sshkey_url' in configuration: + if 'sshkey_url' not in configuration: configuration['sshkey_url'] = self.SSHKEY_URL - if not 'retry_delay' in configuration: + if 'retry_delay' not in configuration: configuration['retry_delay'] = self.RETRY_DELAY - if not 'retry_max' in configuration: + if 'retry_max' not in configuration: configuration['retry_max'] = self.RETRY_MAX - if not 'tls_cacertfile' in configuration: + if 'tls_cacertfile' not in configuration: configuration['tls_cacertfile'] = self.TLS_CACERTFILE - if not 'http_proxy' in configuration: + if 'http_proxy' not in configuration: configuration['http_proxy'] = None def GetPasswdMap(self, since=None): diff --git a/nss_cache/sources/ldapsource.py b/nss_cache/sources/ldapsource.py index 1b7917f6..66cb7e79 100644 --- a/nss_cache/sources/ldapsource.py +++ b/nss_cache/sources/ldapsource.py @@ -190,25 +190,25 @@ def _SetDefaults(self, configuration): if 'uri' in configuration: if configuration['uri'].startswith('ldapi://'): configuration['uri'] = 'ldapi://' + quote(configuration['uri'][8:], '') - if not 'bind_dn' in configuration: + if 'bind_dn' not in configuration: configuration['bind_dn'] = self.BIND_DN - if not 'bind_password' in configuration: + if 'bind_password' not in configuration: configuration['bind_password'] = self.BIND_PASSWORD - if not 'retry_delay' in configuration: + if 'retry_delay' not in configuration: configuration['retry_delay'] = self.RETRY_DELAY - if not 'retry_max' in configuration: + if 'retry_max' not in configuration: configuration['retry_max'] = self.RETRY_MAX - if not 'scope' in configuration: + if 'scope' not in configuration: configuration['scope'] = self.SCOPE - if not 'timelimit' in configuration: + if 'timelimit' not in configuration: configuration['timelimit'] = self.TIMELIMIT # TODO(jaq): XXX EVIL. ldap client libraries change behaviour if we use # polling, and it's nasty. So don't let the user poll. if configuration['timelimit'] == 0: configuration['timelimit'] = -1 - if not 'tls_require_cert' in configuration: + if 'tls_require_cert' not in configuration: configuration['tls_require_cert'] = self.TLS_REQUIRE_CERT - if not 'tls_starttls' in configuration: + if 'tls_starttls' not in configuration: configuration['tls_starttls'] = 0 # Translate tls_require into appropriate constant, if necessary. @@ -223,13 +223,13 @@ def _SetDefaults(self, configuration): elif configuration['tls_require_cert'] == 'try': configuration['tls_require_cert'] = ldap.OPT_X_TLS_TRY - if not 'sasl_authzid' in configuration: + if 'sasl_authzid' not in configuration: configuration['sasl_authzid'] = '' # Should we issue STARTTLS? if configuration['tls_starttls'] in (1, '1', 'on', 'yes', 'true'): configuration['tls_starttls'] = 1 - #if not configuration['tls_starttls']: + # if not configuration['tls_starttls']: else: configuration['tls_starttls'] = 0