

def __call__(self, *args, **kwargs):
    'Defines how calling the function locally should be handled'
    for requirement in self.requires:
        lacks_requirement = self.check_requirements()
        if lacks_requirement:
            return (self.outputs(lacks_requirement) if self.outputs else lacks_requirement)
    for (index, argument) in enumerate(args):
        kwargs[self.parameters[index]] = argument
    if (not getattr(self, 'skip_directives', False)):
        for (parameter, directive) in self.directives.items():
            if (parameter in kwargs):
                continue
            arguments = ((self.defaults[parameter],) if (parameter in self.defaults) else ())
            kwargs[parameter] = directive(*arguments, api=self.api, api_version=self.version, interface=self)
    if (not getattr(self, 'skip_validation', False)):
        errors = self.validate(kwargs)
        if errors:
            errors = {
                'errors': errors,
            }
            if getattr(self, 'on_invalid', False):
                errors = self.on_invalid(errors)
            outputs = getattr(self, 'invalid_outputs', self.outputs)
            return (outputs(errors) if outputs else errors)
    result = self.interface(**kwargs)
    if self.transform:
        result = self.transform(result)
    return (self.outputs(result) if self.outputs else result)

dataset/ETHPy150Open timothycrosley/hug/hug/interface.py Local.__call__/original