Skip to content

Commit

Permalink
Fix F811 flake8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Dec 7, 2023
1 parent ccd8c6b commit 0a1faaa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/bx/cookbook/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ def _attribute(permission="rwd", **kwds):

def _property(attrname, default):
propname, attrname = attrname, mangle(classname, attrname)
fget, fset, fdel, doc = None, None, None, propname
if "r" in permission:

def fget(self):
Expand All @@ -124,11 +123,17 @@ def fget(self):
setattr(self, attrname, default)
return value

else:
fget = None

if "w" in permission:

def fset(self, value):
setattr(self, attrname, value)

else:
fset = None

if "d" in permission:

def fdel(self):
Expand All @@ -139,7 +144,9 @@ def fdel(self):
# calling fget can restore this attribute, so remove property
delattr(self.__class__, propname)

return property(fget=fget, fset=fset, fdel=fdel, doc=doc)
else:
fdel = None
return property(fget=fget, fset=fset, fdel=fdel, doc=propname)

for attrname, default in kwds.items():
classdict[attrname] = _property(attrname, default)

0 comments on commit 0a1faaa

Please sign in to comment.