Deprecations - TC01/Treemaker GitHub Wiki
Deprecations
Backwards compatibility is really important to scientists. Thus, now that Treemaker's v1.0 release is out, things will not be removed (as a general guideline), but merely deprecated-- as in, a warning will be printed out if you try to use them in a plugin or config file. This page tracks all deprecated features and explains what you should do instead.
(Possibly, if Treemaker gets that far, major version releases will result in the removal of deprecated features).
Treemaker v1.1: makeCuts method.
As of Treemaker v1.1, the makeCuts
method in plugins has been deprecated. The analyze
method now takes an extra argument, cutArray
, and returns a tuple of variables, cutArray
.
The old way of doing things is still supported, but to upgrade your plugins and silence the error, you just need to change this:
def analyze(event, variables, labels, isData):
to:
def analyze(event, variables, labels, isData, cutArray)
and the return statement at the end:
return variables
To this:
return variables, cutArray
Any filling of cut objects should now happen in the analyze
method instead of makeCuts
. Then delete makeCuts
to silence the message.
Treemaker v1.2: reset method.
The reset
method used to define the reset of a plugin's variables back to their intended state has been deprecated. From now on, Treemaker will handle this automatically; it keeps a copy of the initial array of declared variables in memory, and after filling (or failing to fill, if the drop
method was called, which is new in v1.1), automatically resets all variables back to their initial state.
If you wish to run some other code in a "cleanup" step, the reset
method will still be called if it is defined. But the method has been deprecated anyway, to deliberately notify users that the reset function is no longer required.