GreaterThan, LLC

PipeLayer 0.4.1

It’s that time. Another week, another new version. This one has only one visible addition: The Switch filter. It works (and reads) very much like it’s counterparts in C# and JavaScript:

switch = Switch(
    CarColor, { # The Expression (implements Step), returns an enum
        IsRed.IS_TRUE:
            car_is_red,   # A Step or Callable
        IsRed.IS_FALSE:
            lambda d, c: {"car": "Is not red."} # Lambda's work too!
    }
)

Under the hood, I needed to make the step init functions public. I moved them out of the Pipeline and into a new StepHelper class—easy, they were already static functions!

It took a bit more code re-organization to clean up the API namespace. Interfaces for all objects were created to avoid some PITA circular references when the actual object wasn’t needed. That’s what I get for wanting to expose all the core classes in the root __init__.py

For the first version of the Switch filter, I decided to require the expression to return an Enum. It shouldn’t be too difficult to add some flexibility to to the expression return type.

Stay tuned, there’s some fun stuff coming out in the next version. 😎

in PipeLayer, PyPi, Python