Skip to content

Commit

Permalink
Cleaned up flakes
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Aug 25, 2018
1 parent f646ee2 commit f73d6d8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions param/parameterized.py
Expand Up @@ -208,7 +208,9 @@ def _f(*args, **kwargs):


@accept_arguments
def depends(func, *what, watch=False):
def depends(*args, watch=False):
func = args[0]
what = args[1:]

_dinfo = {'dependencies': what,
'watch': watch}
Expand All @@ -220,7 +222,7 @@ def _depends(*args,**kw):
# storing here risks it being tricky to find if other libraries
# mess around with methods
_depends._dinfo = _dinfo

return _depends


Expand Down Expand Up @@ -491,24 +493,24 @@ def _set_instantiate(self,instantiate):
# Note that unlike with parameter value setting, there's no access
# to the Parameterized instance, so no per-instance subscription.

def __setattr__(self,name,value):
def __setattr__(self,name,value):
old = getattr(self,name) if (name!="default" and hasattr(self,'subscribers') and name in self.subscribers) else NotImplemented

super(Parameter, self).__setattr__(name, value)

if old is not NotImplemented:
for subscriber in self.subscribers[name]:
subscriber(Change(what=name,attribute=self._attrib_name,obj=None,cls=self._owner,old=old,new=value))

# TODO: this is a python 3.6+ thing; we can presumably do this in
# Parameterized.__new__ for older pythons. (And merge with objtype
# slot.)
#
#
# (not specific to this change, but regarding attrib_name, owner:
# what if someone re-uses a parameter object across different
# classes? maybe we should raise an error if attrib name,owner
# already set)
#
#
def __set_name__(self, owner, name):
self._owner = owner
# note: simpler way of getting _attrib_name
Expand Down

0 comments on commit f73d6d8

Please sign in to comment.