Ejemplo n.º 1
0
 class MyParameter(ParameterType):
     required1 = ParameterAttribute()
     optional1 = ParameterAttribute(default=None)
     optional2 = IndexedParameterAttribute(default=None)
     optional3 = ParameterAttribute(default=5)
     required2 = IndexedParameterAttribute()
     optional4 = ParameterAttribute(default=2)
Ejemplo n.º 2
0
 class MyParameter:
     attr_all_to_float = ParameterAttribute(converter=float)
     attr_int_to_float = ParameterAttribute()
     @attr_int_to_float.converter
     def attr_int_to_float(self, attr, value):
         """Convert only integers to float"""
         if isinstance(value, int):
             return float(value)
         elif not isinstance(value, float):
             raise TypeError()
         return value
Ejemplo n.º 3
0
 class MyParameter:
     attr_unit = ParameterAttribute(unit=unit.meter / unit.second**2)
Ejemplo n.º 4
0
 class MyParameter(ParameterType):
     required = ParameterAttribute()
Ejemplo n.º 5
0
 class MyParameter(ParameterType):
     required = ParameterAttribute()
     optional = ParameterAttribute(default=None)
Ejemplo n.º 6
0
 class MyParameter(ParameterType):
     required = ParameterAttribute()
     optional = ParameterAttribute(default=1)
     required_indexed = IndexedParameterAttribute()
     optional_indexed2 = IndexedParameterAttribute(default=None)
Ejemplo n.º 7
0
 class MyParameter(ParameterType):
     attr = ParameterAttribute()
     indexed = IndexedParameterAttribute()
     attr2 = ParameterAttribute()
     indexed2 = IndexedParameterAttribute(default=None)
Ejemplo n.º 8
0
 class MyParameter(ParameterType):
     attr = ParameterAttribute()
     indexed = IndexedParameterAttribute()
Ejemplo n.º 9
0
 class MyParameter:
     attr_unit = ParameterAttribute(unit=unit.kilocalories_per_mole /
                                    unit.angstrom**2)
Ejemplo n.º 10
0
 class MyParameter:
     attr_required = ParameterAttribute()
Ejemplo n.º 11
0
 class MyParameter:
     attr_optional = ParameterAttribute(default=None)
Ejemplo n.º 12
0
 class MyParameter:
     attr = ParameterAttribute()
Ejemplo n.º 13
0
 class MyParameter:
     attr = ParameterAttribute(default=None,
                               unit=unit.angstrom,
                               converter=unit.Quantity)