jigneshvasoya / ruffus

Automatically exported from code.google.com/p/ruffus
MIT License
0 stars 0 forks source link

Mark input strings so they are not checked as filenames #67

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1. Use indicator object like "ouput_from"
2. What is a good name?
3. They will still participate in suffix, formatter and regex replacement

Original issue reported on code.google.com by bunbu...@gmail.com on 14 May 2014 at 10:31

GoogleCodeExporter commented 9 years ago
Bernie Pope suggests that we should generalise this:

If any object in the input parameters is a (non-list/tuple) class instance, 
check (getattr) whether it has a "ruffus_params()" function. If it does, call 
it to obtain a list which is substituted in place. If there are string nested 
within, these will take part in Ruffus string substitution.

"output_from" would be a simple wrapper which returns the internal string via 
ruffus_params()

class output_from (object):
    def __init__(self, str):
        self.str = str
    def ruffus_params(self):
        return [self.str]

Returning a list should be like wildcards and should not introduce an 
unnecessary level of indirection for output parameters, i.e. suffix(".txt") or 
formatter() / "{basename[0]}" should work.

Check!

Original comment by bunbu...@gmail.com on 24 Jun 2014 at 7:06