Skip to content

Implement global (unscoped) bind

Rosen Matev requested to merge rmatev-tonic into master
  • implement global (unscoped) bind f.global_bind()
  • (internal) keep a bind arguments stack per configurable rather than a single global stack
  • add an options file globally setting the FT decoding version to v2
  • fix a bug in the downloading inputs for tests

A global (unscoped) bind is useful in cases where the binding and the calls to the configurables need to happen in different places. The input raw data handling already was already globally configured using a workaround, which is now replaced with the new feature. The use of this should be restricted to special cases like this, and top level options (although there bind should be preferred).

@configurable
def f(x):
    return x

f.global_bind(x=2)
print(f())  # prints 2

As with bind, a second consecutive global_bind will warn if the same parameter is bound. Doing a global_bind inside a bind context will raise an exception.

Edited by Rosen Matev

Merge request reports