Fix flake8-bugbear B902 Invalid first argument used for instance method.

This commit is contained in:
Labrys of Knossos 2019-04-05 16:15:21 -04:00
commit 72140e939c

View file

@ -13,17 +13,17 @@ from core import logger
class Section(configobj.Section, object):
def isenabled(section):
def isenabled(self):
# checks if subsection enabled, returns true/false if subsection specified otherwise returns true/false in {}
if not section.sections:
if not self.sections:
try:
value = list(ConfigObj.find_key(section, 'enabled'))[0]
value = list(ConfigObj.find_key(self, 'enabled'))[0]
except Exception:
value = 0
if int(value) == 1:
return section
return self
else:
to_return = copy.deepcopy(section)
to_return = copy.deepcopy(self)
for section_name, subsections in to_return.items():
for subsection in subsections:
try:
@ -40,8 +40,8 @@ class Section(configobj.Section, object):
return to_return
def findsection(section, key):
to_return = copy.deepcopy(section)
def findsection(self, key):
to_return = copy.deepcopy(self)
for subsection in to_return:
try:
value = list(ConfigObj.find_key(to_return[subsection], key))[0]