예제 #1
0
    def get_payload_from_typing_hints(self, values):
        TestSchema = typing.NamedTuple('TestSchema', [
            ('integer_example', int),
            ('string_example', unicode),
            ('list_of_strings', typing.List[unicode]),
            ('optional_kv', typing.Optional[typing.Tuple[unicode, float]]),
            ('optional_integer', typing.Optional[int]),
        ])

        builder = NamedTupleBasedPayloadBuilder(TestSchema(**values))
        return builder.build()
예제 #2
0
    def get_payload_from_typing_hints(self, values):
        TestSchema = typing.NamedTuple('TestSchema', [
            ('integer_example', int),
            ('boolean', bool),
            ('string_example', str),
            ('list_of_strings', typing.List[str]),
            ('mapping', typing.Mapping[str, float]),
            ('optional_integer', typing.Optional[int]),
        ])

        builder = NamedTupleBasedPayloadBuilder(TestSchema(**values))
        return builder.build()