On 08/02/16 20:46, Leo Goodstadt 顧維斌 wrote:
> Dear Alex,
>
> As the open issue says, you can already do some of this by specifying
> both the input and the out
>
> parameters.
> I don't think it would be much work to add a decorator which allows
> custom mapping.
>
> I haven't been doing much (any!) Ruffus hacking lately because of my new
> job so this might give me some incentive to do so.
>
> I suspect that
> 1) The callback function should be called once per input file(s)
> 2) The function should return None if the input file is to be ignored
> 3) The function should return (inputs, outputs, anything else....), so
> that you can change the inputs on the fly if you want.
>
hmm...can the function return the inputs if it's going to be passed only
one input file at a time? Or is it getting the input file to decide on
and the whole list of inputs also in another parameter? Or is this part
of the state that it needs? I suspect I need to look more closely at the
implementation of transform to know if I'm using the right terminology here.
> It would help tremendously though if
> 1) you and Bernie could think of a nice name for the decorator
Naming is too hard. I'm fond of overly_long_names which most people
don't like. I'd go with input_output_mapper.
> 2) tell me what the function needs to do the mapping. I.e. does it need
> state, or just the input files?
In my case, I do not need any state as long as the full list of input
filenames are available to the function at every call.
> If it needs state, can you provide state via an callable object or
> closure / function factory?
> 3) let me know if anything else you need or don't understand about how
> Ruffus works
> 4) you can contribute documentation! (he says, cheekily)
>
The user-side documentation seems pretty good to me from what I've seen.
I'll add some developer-side documentation if I end up understanding how
it works.
> I shall see if I can get something coded up this week / by the weekend.
>
Awesome! Thanks a lot. Do tell if you are too busy or found something
better to do. Now that I know that it isn't a stupid idea and is not
meant to be overly hard, I'm happy to dig in properly and write it
myself too.
alex
> <mailto:
bjp...@unimelb.edu.au>> wrote:
>
> Hi Alex,
>
> There is a open issue on github for a feature like this:
>
>
https://github.com/bunbun/ruffus/issues/27
>
> I think it would be very handy to have, and a nice generalisation of
> the current behaviour.
>
> Cheers,
> Bernie
>
> > On 8 Feb 2016, at 11:59 am, Alejandro Dubrovsky
> <mailto:
ruffus_discuss%2Bunsu...@googlegroups.com>.
> <mailto:
ruffus_discuss%2Bunsu...@googlegroups.com>.
> You received this message because you are subscribed to a topic in the
> Google Groups "ruffus_discuss" group.
> To unsubscribe from this topic, visit
>
https://groups.google.com/d/topic/ruffus_discuss/F4EVGLk3rVs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
>
ruffus_discus...@googlegroups.com
> <mailto:
ruffus_discus...@googlegroups.com>.