コード例 #1
0
ファイル: stubs.py プロジェクト: DD-DeCaF/iloop-to-model
class ModelRequestMessage(Message):
    sample_ids = repeated(Int(description='Sample IDs'))
    model_id = String(description='Model ID (f.e. iJO1366)')
    phase_id = Int(description='Phase ID')
    map = String(description='Name of map to show')
    method = String(description='Simulation method to run')
    with_fluxes = Bool(description='Add flux information to  the response')
    objective = String(description='Reaction ID to be set as objective')
コード例 #2
0
ファイル: stubs.py プロジェクト: DD-DeCaF/iloop-to-model
class PhasePlaneMessage(Message):
    objective_upper_bound = repeated(
        Float32(description='Upper bound for theoretical yield objective'))
    objective_lower_bound = repeated(
        Float32(description='Lower bound for theoretical yield objective'))
    objective = repeated(Float32(description='Theoretical objective values'))
    objective_id = String(description='Objective reaction ID')
コード例 #3
0
        class QueryResponse(Message):
            class Meta:
                description = 'Information about pets'

            ids = repeated(Field(Pet, description='Bunch of pets'))
            pet = Field(Pet, description='The other pet')
            repeat = repeated(String(description='Bunch of strings'))
コード例 #4
0
class ParameterMessage(Message):
    in_ = String(json_name='in')  # TODO: enum
    description: str
    required: bool
    name: str
    type: str
    items: SchemaMessage
    schema: SchemaMessage
コード例 #5
0
ファイル: stubs.py プロジェクト: DD-DeCaF/iloop-to-model
class ModelMessage(Message):
    model_id = String(
        description=
        'The saved model ID which can be used for retrieving cached information'
    )
    fluxes = map_(
        Float32())  # TODO: fix not implemented while trying to add description
    growth_rate = Float32(description='Growth rate for this simulation')
    model: JSONValue
コード例 #6
0
class ErrorResponse(Message):
    status = Int32()
    description = String()

    # TODO Repeat(String)
    path = String()

    # TODO helper for raising errors
    def raise_(self):
        if self.status == 501:
            raise NotImplemented_()
        # if self.status == 500:
        #         raise ServerError(self.message or '')
        #     if self.status == 404:
        #         raise NotFound(self.message or '')

        raise RuntimeError('HTTP status {}: {}'.format(self.status,
                                                       self.description))
コード例 #7
0
ファイル: stubs.py プロジェクト: DD-DeCaF/iloop-to-model
class MeasurementMessage(Message):
    type = String(
        description=
        'The subject of the measurement, e.g. "compound", "protein" or "reaction"'
    )
    id = Int(
        description=
        'identifier associated with the measured subject, e.g. metabolite identifier'
    )
    name = String(description='In case of metabolite, human-readable name')
    db_name = String(
        description=
        'In case of xref data, the miriam name of the database, e.g. uniprot')
    mode = String(
        description='Quantification mode, e.g. "relative" or "quantitative"')
    measurements = repeated(
        Float32(description='Measurements taken during the experiment'))
    units = MapField(str, description='Units in which measurements are taken')
    rate = String(description='Rate')
コード例 #8
0
class SchemaMessage(Schema):
    ref = String(json_name='$ref')

    type: str  # TODO: enum
    description: str

    items = Field('venom.rpc.reflect.openapi.SchemaMessage')

    properties = MapField('venom.rpc.reflect.openapi.SchemaMessage')
    additional_properties = Field('venom.rpc.reflect.openapi.SchemaMessage')
コード例 #9
0
    async def test_magic_request_message_auto_unpack(self):
        def func(self, value: str) -> StringValue:
            return StringValue(value)

        inspect = magic_normalize(func, auto_generate_request=True)
        self.assertEqual(inspect.response, StringValue)
        self.assertEqual(inspect.request.__meta__.name, 'FuncRequest')
        self.assertEqual(fields(inspect.request), (
            String(name='value'),
        ))
        # TODO StringValue() should be equal to StringValue('')
        self.assertEqual(await inspect.invokable(None, inspect.request()), StringValue(''))
        self.assertEqual(await inspect.invokable(None, inspect.request('foo')), StringValue('foo'))
コード例 #10
0
ファイル: test_stub.py プロジェクト: lyschoening/venom
    def test_stub_rpc_response_repeat_auto(self):
        class GreeterStub(Stub):
            @rpc(auto=True)
            def get_greetings(self) -> List[str]:
                raise NotImplementedError

        self.assertEqual(GreeterStub.get_greetings.response.__meta__.name,
                         'GetGreetingsResponse')
        self.assertEqual(tuple(fields(GreeterStub.get_greetings.response)),
                         (repeated(String(), name='values')))

        self.assertEqual(GreeterStub.greet.response, StringValue)
        self.assertEqual(GreeterStub.greet.name, 'get_greetings')
コード例 #11
0
ファイル: test_stub.py プロジェクト: lyschoening/venom
    def test_stub_rpc_request_repeat_auto(self):
        class GreeterStub(Stub):
            @rpc(auto=True)
            def greet_many(self, names: List[str]) -> str:
                raise NotImplementedError

        self.assertEqual(GreeterStub.greet_many.request.__meta__.name,
                         'GreetManyRequest')
        self.assertEqual(tuple(fields(GreeterStub.greet_many.request)),
                         (repeated(String(), name='names'), ))

        self.assertEqual(GreeterStub.greet_many.response, StringValue)
        self.assertEqual(GreeterStub.greet_many.name, 'greet_many')
コード例 #12
0
ファイル: test_stub.py プロジェクト: lyschoening/venom
    def test_stub_rpc_request_auto(self):
        class GreeterStub(Stub):
            @rpc(auto=True)
            def greet(self, name: str, shout: bool = False) -> str:
                raise NotImplementedError

        self.assertEqual(GreeterStub.greet.request.__meta__.name,
                         'GreetRequest')
        self.assertEqual(tuple(fields(GreeterStub.greet.request)), (
            String(name='name'),
            Bool(name='shout'),
        ))

        self.assertEqual(GreeterStub.greet.response, StringValue)
        self.assertEqual(GreeterStub.greet.name, 'greet')
コード例 #13
0
    def test_message_type_hints(self):
        class Pet(Message):
            sounds: List[str]
            size: float
            speed: int
            age: int

        self.assertIsInstance(Pet.__fields__, OrderedDict)
        self.assertEqual(('sounds', 'size', 'speed', 'age'),
                         tuple(Pet.__fields__.keys()))
        self.assertEqual(
            {
                'sounds': repeated(String(), name='sounds'),
                'size': Field(float, name='size'),
                'speed': Field(int, name='speed'),
                'age': Field(int, name='age')
            }, Pet.__fields__)
コード例 #14
0
ファイル: test_fields.py プロジェクト: lyschoening/venom
 def test_field_string(self):
     self.assertEqual(String(), Field(str))
コード例 #15
0
 class Pet(Message):
     id = Int()
     name = String()
     tag = String()
コード例 #16
0
 class FooInner(Message):
     i = String()
コード例 #17
0
        class Pet(Message):
            class Meta:
                description = 'Very important object'

            pet_id = String(description='Pet ID to query')
コード例 #18
0
 class Pet(Message):
     sound = String()
コード例 #19
0
 class Pet(Message):
     sounds = repeated(String())
コード例 #20
0
class HelloRequest(Message):
    name = String()
コード例 #21
0
ファイル: stubs.py プロジェクト: DD-DeCaF/iloop-to-model
class ExperimentMessage(Message):
    id = Int(description='Experiment ID')
    name = String(description='Experiment name')
コード例 #22
0
ファイル: stubs.py プロジェクト: DD-DeCaF/iloop-to-model
class ExperimentsRequestMessage(Message):
    taxon_code = String(
        descripton=
        'Species five-letter mnemonic short_code that must be associated with at least one '
        'sample belonging to the  experiment')
コード例 #23
0
class HelloResponse(Message):
    message = String()
コード例 #24
0
ファイル: stubs.py プロジェクト: DD-DeCaF/iloop-to-model
class SampleModelsMessage(Message):
    response = repeated(String(description='Possible models for the sample'))
コード例 #25
0
ファイル: stubs.py プロジェクト: DD-DeCaF/iloop-to-model
class PhaseMessage(Message):
    id = Int(description='Phase ID')
    name = String(description='Phase name')
コード例 #26
0
ファイル: stubs.py プロジェクト: DD-DeCaF/iloop-to-model
class MetaboliteMediumMessage(Message):
    id = Int(description='Metabolite ID')
    name = String(description='Metabolite human-readable name')
    concentration = Float32(description='Concentration in medium')
コード例 #27
0
 class HelloRequest(Message):
     name = String()
     shout = Bool()
コード例 #28
0
 class Foo(Message):
     string = String()
コード例 #29
0
ファイル: stubs.py プロジェクト: DD-DeCaF/iloop-to-model
class SampleMessage(Message):
    id = repeated(Int(description='Sample IDs'))
    name = String(description='Sample name')
    organism = String(description='Organism short code')
コード例 #30
0
ファイル: stubs.py プロジェクト: DD-DeCaF/iloop-to-model
class SampleInfoMessage(Message):
    genotype_changes = repeated(
        String(description='Gnomic strings for genotype changes'))
    measurements = repeated(MeasurementMessage)
    medium = repeated(MetaboliteMediumMessage)