Skip to content

Tonic improvements

Alex Pearce requested to merge apearce-moore-56 into master

This MR folds in three commits, each addressing one open issue: #56 (closed), #82 (closed), and #83 (closed).

Warn if a bound function is unused (#56 (closed))

Given this Python:

from PyConf import configurable

@configurable
def func(param=1):
    pass


with func.bind(param=2):
    pass

one gets this warning:

/home/apearce/stack/Moore/PyConf/python/PyConf/tonic.py:162: UserWarning: Bound function <function func at 0x7f4f53081f50> was not called within a bind. Stack trace:
  File "f.py", line 8, in <module>
    with func.bind(param=2):

Switch bind precedence (#82 (closed))

bind calls higher in the call stack now override those lower down. Warnings are now always emitted whenever any precendence conflict is resolved, i.e. when the same parameter is bound to more than one or when it's overriden by at least one bind and at the configurable call site.

All credit to @rmatev for the excellent commit here! 💯

Remove namespace support (#83 (closed))

with namespace(...) is now no longer supported.

Edited by Alex Pearce

Merge request reports

Loading