Process func decorator

In [ ]:
from pywps import ComplexInput, ComplexOutput, FORMATS, Format
from pywps import Process
In [ ]:
def esgfapi(F):
    def wrapper(self):
        F(self)
        self.profile.append('ESGF-API')
        self.inputs.extend([
            ComplexInput(
                'test', 'Test ESGF API Param',
                supported_formats=[FORMATS.JSON],
            ), ])
    return wrapper
In [ ]:
class EmuSubset(Process):
    @esgfapi
    def __init__(self):
        inputs = [
            ComplexInput(
                'domain', 'domain',
                abstract="",
                supported_formats=[FORMATS.JSON],
                min_occurs=0, max_occurs=1,
            ),
        ]
        outputs = [
            ComplexOutput(
                'output', 'Output',
                as_reference=True,
                supported_formats=[FORMATS.NETCDF], ), ]
        
        super(EmuSubset, self).__init__(
            self._handler,
            identifier='Emu.subset',
            title='xarray.subset',
            abstract="subset netcdf files",
            version='1',
            inputs=inputs,
            outputs=outputs,
            store_supported=True,
            status_supported=True)
    
    def _handler(self, request, response):
        pass
In [ ]:
p = EmuSubset()
for inpt in p.inputs:
    print(inpt.title)
In [ ]:
p.profile
In [ ]: