spotify/luigi — pull request #177 by JoeEnnever (2013-09-17 19:06:39+00:00)
Title: Adds Task.get_known_param_values, refactor get_param_values

Adds test for these methods. Useful for metaprogrammed tasks - these often duplicate parameters
of a task, and add their own. E.g.:

```python
def Metaprogram(task_cls):
class Meta(luigi.Task):
param1 = luigi.Parameter()
param2 = luigi.Parameter()

def requires(self):
return task_class(**self.task_params)

def __init__(self, *args, **kwargs):
super(Meta, self).__init__(*args, **kwargs)
params = task_cls.get_nonglobal_params()
# kwargs has param1, param2, but task_cls doesn't know about them
self.task_params = task_cls.get_known_param_values(params, args, kwargs)
name = 'Meta' + task_cls.__name__
bases = (Meta,)
attrs = dict([(k, v) for k, v in task_cls.get_nonglobal_params()])
return type(name, bases, attrs)
```