mirror of https://github.com/fail2ban/fail2ban
Fix pep8 W601 ".has_key() is deprecated, use 'in'"
parent
f899340b15
commit
3e3d1e0cf6
|
@ -282,7 +282,7 @@ class DefinitionInitConfigReader(ConfigReader):
|
|||
|
||||
if self.has_section("Init"):
|
||||
for opt in self.options("Init"):
|
||||
if not self._initOpts.has_key(opt):
|
||||
if not opt in self._initOpts:
|
||||
self._initOpts[opt] = self.get("Init", opt)
|
||||
|
||||
def convert(self):
|
||||
|
|
|
@ -406,7 +406,7 @@ class CommandAction(ActionBase):
|
|||
# recursive definitions are bad
|
||||
#logSys.log(5, 'recursion fail tag: %s value: %s' % (tag, value) )
|
||||
return False
|
||||
if found_tag in cls._escapedTags or not tags.has_key(found_tag):
|
||||
if found_tag in cls._escapedTags or not found_tag in tags:
|
||||
# Escaped or missing tags - just continue on searching after end of match
|
||||
# Missing tags are ok - cInfo can contain aInfo elements like <HOST> and valid shell
|
||||
# constructs like <STDIN>.
|
||||
|
|
|
@ -91,7 +91,7 @@ class FailManager:
|
|||
ip = ticket.getIP()
|
||||
unixTime = ticket.getTime()
|
||||
matches = ticket.getMatches()
|
||||
if self.__failList.has_key(ip):
|
||||
if ip in self.__failList:
|
||||
fData = self.__failList[ip]
|
||||
if fData.getLastReset() < unixTime - self.__maxTime:
|
||||
fData.setLastReset(unixTime)
|
||||
|
@ -136,7 +136,7 @@ class FailManager:
|
|||
self.__lock.release()
|
||||
|
||||
def __delFailure(self, ip):
|
||||
if self.__failList.has_key(ip):
|
||||
if ip in self.__failList:
|
||||
del self.__failList[ip]
|
||||
|
||||
def toBan(self):
|
||||
|
|
Loading…
Reference in New Issue