Esempio 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)
Esempio 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
Esempio n. 3
0
 class MyParameter:
     attr_unit = ParameterAttribute(unit=unit.meter / unit.second**2)
Esempio n. 4
0
 class MyParameter(ParameterType):
     required = ParameterAttribute()
Esempio n. 5
0
 class MyParameter(ParameterType):
     required = ParameterAttribute()
     optional = ParameterAttribute(default=None)
Esempio n. 6
0
 class MyParameter(ParameterType):
     required = ParameterAttribute()
     optional = ParameterAttribute(default=1)
     required_indexed = IndexedParameterAttribute()
     optional_indexed2 = IndexedParameterAttribute(default=None)
Esempio n. 7
0
 class MyParameter(ParameterType):
     attr = ParameterAttribute()
     indexed = IndexedParameterAttribute()
     attr2 = ParameterAttribute()
     indexed2 = IndexedParameterAttribute(default=None)
Esempio n. 8
0
 class MyParameter(ParameterType):
     attr = ParameterAttribute()
     indexed = IndexedParameterAttribute()
Esempio n. 9
0
 class MyParameter:
     attr_unit = ParameterAttribute(unit=unit.kilocalories_per_mole /
                                    unit.angstrom**2)
Esempio n. 10
0
 class MyParameter:
     attr_required = ParameterAttribute()
Esempio n. 11
0
 class MyParameter:
     attr_optional = ParameterAttribute(default=None)
Esempio n. 12
0
 class MyParameter:
     attr = ParameterAttribute()
Esempio n. 13
0
 class MyParameter:
     attr = ParameterAttribute(default=None,
                               unit=unit.angstrom,
                               converter=unit.Quantity)