def setUp(self): self.bbox_input = BBoxInput("bboxinput", dimensions=2) self.bbox_input.ll = [0, 1] self.bbox_input.ur = [2, 4]
def json(self, value): """init this request from json back again :param value: the json (not string) representation """ self.operation = value['operation'] self.version = value['version'] self.language = value['language'] self.identifier = value['identifier'] self.identifiers = value['identifiers'] self.store_execute = value['store_execute'] self.status = value['status'] self.lineage = value['lineage'] self.outputs = value['outputs'] self.raw = value['raw'] self.inputs = {} for identifier in value['inputs']: inpt = None inpt_defs = value['inputs'][identifier] for inpt_def in inpt_defs: if inpt_def['type'] == 'complex': inpt = ComplexInput( identifier=inpt_def['identifier'], title=inpt_def.get('title'), abstract=inpt_def.get('abstract'), workdir=inpt_def.get('workdir'), data_format=Format( schema=inpt_def['data_format'].get('schema'), extension=inpt_def['data_format'].get('extension'), mime_type=inpt_def['data_format']['mime_type'], encoding=inpt_def['data_format'].get('encoding')), supported_formats=[ Format(schema=infrmt.get('schema'), extension=infrmt.get('extension'), mime_type=infrmt['mime_type'], encoding=infrmt.get('encoding')) for infrmt in inpt_def['supported_formats'] ], mode=MODE.NONE) inpt.file = inpt_def['file'] elif inpt_def['type'] == 'literal': allowed_values = [] for allowed_value in inpt_def['allowed_values']: if allowed_value['type'] == 'anyvalue': allowed_values.append(AnyValue()) elif allowed_value['type'] == 'novalue': allowed_values.append(NoValue()) elif allowed_value['type'] == 'valuesreference': allowed_values.append(ValuesReference()) elif allowed_value['type'] == 'allowedvalue': allowed_values.append( AllowedValue( allowed_type=allowed_value['allowed_type'], value=allowed_value['value'], minval=allowed_value['minval'], maxval=allowed_value['maxval'], spacing=allowed_value['spacing'], range_closure=allowed_value[ 'range_closure'])) inpt = LiteralInput(identifier=inpt_def['identifier'], title=inpt_def.get('title'), abstract=inpt_def.get('abstract'), data_type=inpt_def.get('data_type'), workdir=inpt_def.get('workdir'), allowed_values=AnyValue, uoms=inpt_def.get('uoms'), mode=inpt_def.get('mode')) inpt.uom = inpt_def.get('uom') inpt.data = inpt_def.get('data') elif inpt_def['type'] == 'bbox': inpt = BBoxInput(identifier=inpt_def['identifier'], title=inpt_def['title'], abstract=inpt_def['abstract'], crss=inpt_def['crs'], dimensions=inpt_def['dimensions'], workdir=inpt_def['workdir'], mode=inpt_def['mode']) inpt.ll = inpt_def['bbox'][0] inpt.ur = inpt_def['bbox'][1] if identifier in self.inputs: self.inputs[identifier].append(inpt) else: self.inputs[identifier] = [inpt]
def setUp(self): self.bbox_input = BBoxInput("bboxinput")