Exemplo n.º 1
0
 def __init__(
         self,
         type_parameters=None,
         metadata=None):
     if not type_parameters:
         type_parameters = []
     type_parameters_fixed = [
         instantiate_if_class(t) for t in type_parameters]
     self.type_parameters = type_parameters_fixed
     self.metadata = metadata
Exemplo n.º 2
0
 def __init__(self,
              field_type,
              field_name=None,
              field_id=-1,
              default=None,
              required=False,
              metadata=None):
     self.creation_count = Field._field_creation_counter
     Field._field_creation_counter += 1
     self.field_type = instantiate_if_class(field_type)
     self.field_id = field_id
     self.field_name = field_name
     self.required = required
     self.metadata = metadata
     # verify that the given default value
     # is the correct type for this field
     if default is not None:
         self.validate(default)
     self.default = default
Exemplo n.º 3
0
 def __init__(self, key_type, value_type, *args, **kwargs):
     super(Map, self).__init__(*args, **kwargs)
     self.type_parameters = [
         instantiate_if_class(key_type),
         instantiate_if_class(value_type)]
Exemplo n.º 4
0
 def __init__(self, element_type, *args, **kwargs):
     super(List, self).__init__(*args, **kwargs)
     self.type_parameters = [instantiate_if_class(element_type)]