lnccbrown / HSSM

Development of HSSM package
Other
82 stars 11 forks source link

`self` missing in `hasattr`check in Param.update #499

Closed cpaniaguam closed 4 months ago

cpaniaguam commented 4 months ago

https://github.com/lnccbrown/HSSM/blob/2b8fadbd1098c54e449ba95dbec963eb7d5a4617/src/hssm/param.py#L87-L95

One could use the object's internal dict and use its update method self.__dict__.update(kwargs).

For validation one could check whether there are extra attrs in kwargs and react accordingly. For example:


extra_attrs = kwargs.keys() - self.__dict__.keys()
if extra_attrs:
            raise ValueError(f"Invalid attrributes: {', '.join(extra_attrs)}")
cpaniaguam commented 4 months ago

Add tests for the update method.