You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm about to PR a node in timeflux_dsp that uses arbitrary rules to classify data. The rules are eval'd as expressions using ports, in the way the Expression node does.
This eval logic from Expression seems like it might be useful in quite a few contexts. It's something like this:
def _eval_expression(self, expression):
ports = [port_name for port_name, _, _
in self.iterate('i_*')
if port_name in expression]
_local_dict = {port_name: self.ports.get(port_name).data
for port_name in ports}
if np.any([data is None for data in _local_dict.values()]):
return
calculated = pd.eval(expr=expression,
local_dict=_local_dict,
**self._kwargs)
for port_name in ports:
self.o.meta.update(self.ports.get(port_name).meta)
return calculated
Should it be a helper in helpers/ports.py, or should the Expression node be refactored so that other nodes can extend it more easily and inherit this method from it?
The text was updated successfully, but these errors were encountered:
I'm about to PR a node in timeflux_dsp that uses arbitrary rules to classify data. The rules are eval'd as expressions using ports, in the way the Expression node does.
This eval logic from Expression seems like it might be useful in quite a few contexts. It's something like this:
Should it be a helper in helpers/ports.py, or should the Expression node be refactored so that other nodes can extend it more easily and inherit this method from it?
The text was updated successfully, but these errors were encountered: