Closed pwalsh closed 2 years ago
Hey @pwalsh, you can actually use None instead of the noop and it will work as intended.
On Fri, Sep 17, 2021, 10:44 Paul Walsh @.***> wrote:
Useful for composing flows as parameterized higher order functions.
Simple example:
import data flows as DF
my_data = [...]
def my_great_flow(validate=False): return DF.Flow( my_data, DF.validate() if validate is True else DF.noop() )
An alternative approach would be to allow None values in the processor list passed to a flow (... else None rather than ... else DF.noop()), and then filter the list for Nones before running the processors. I don't have a personal preference but perhaps exposing a noop processor is the more explicit approach for consumers of the library.
You can view, comment on, or merge this pull request online at:
https://github.com/datahq/dataflows/pull/166 Commit Summary
- Adds noop processor.
File Changes
- A dataflows/processors/noop.py https://github.com/datahq/dataflows/pull/166/files#diff-3593ebfce6b0041cb83e780c87a10b65c2457667851d21160674e63589f109ca (8)
- M tests/test_lib.py https://github.com/datahq/dataflows/pull/166/files#diff-e84919fd51635165755b148c79e7c9689b7a6f5a6b7146c97b42cc29c12562b5 (23)
Patch Links:
- https://github.com/datahq/dataflows/pull/166.patch
- https://github.com/datahq/dataflows/pull/166.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/datahq/dataflows/pull/166, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACAY5ISNZBI2FCFD2RIAZLUCL5WRANCNFSM5EGQNJCQ .
:). Don't know how I missed that.
Just a testament to the quality of my documentation I guess 😇
On Fri, Sep 17, 2021, 13:11 Paul Walsh @.***> wrote:
Closed #166 https://github.com/datahq/dataflows/pull/166.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/datahq/dataflows/pull/166#event-5318684814, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACAY5P5FVYUAG3S6TMPE6DUCMO4NANCNFSM5EGQNJCQ .
@akariv no, in this case I think early on I had a failing Flow, and thought it was a None processor, so I wrote a noop and moved on, and just kept using it. I never went back to check thoroughly.
Useful for composing flows as parameterized higher order functions.
Simple example:
An alternative approach would be to allow None values in the processor list passed to a flow (
... else None
rather than... else DF.noop()
), and then filter the list for Nones before running the processors. I don't have a personal preference but perhaps exposing a noop processor is the more explicit approach for consumers of the library.