(obj, attr, val)
| 114 | # The following two functions extend setattr and getattr to support chained objects, e.g. rsetattr(cfg, optim.lr, 1e-4) |
| 115 | # From https://stackoverflow.com/questions/31174295/getattr-and-setattr-on-nested-subobjects-chained-properties |
| 116 | def rsetattr(obj, attr, val): |
| 117 | pre, _, post = attr.rpartition('.') |
| 118 | return setattr(rgetattr(obj, pre) if pre else obj, post, val) |
| 119 | |
| 120 | |
| 121 | def rgetattr(obj, attr, *args): |
nothing calls this directly
no test coverage detected