File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1616from .outlet import Outlet
1717from .property import Property
1818
19- __version__ = '0.11 .0'
19+ __version__ = '0.12 .0'
2020API_VERSION = 2
2121
2222
Original file line number Diff line number Diff line change @@ -141,10 +141,13 @@ def set_value(self, value):
141141 raise PropertyError ('Value greater than maximum: {}'
142142 .format (self .description ['maximum' ]))
143143
144- if 'multipleOf' in self .description and \
145- value % self .description ['multipleOf' ] != 0 :
146- raise PropertyError ('Value is not a multiple of: {}'
147- .format (self .description ['multipleOf' ]))
144+ if 'multipleOf' in self .description :
145+ # note that we don't use the modulus operator here because it's
146+ # unreliable for floating point numbers
147+ multiple_of = self .description ['multipleOf' ]
148+ if value / multiple_of - round (value / multiple_of ) != 0 :
149+ raise PropertyError ('Value is not a multiple of: {}'
150+ .format (multiple_of ))
148151
149152 if 'enum' in self .description and \
150153 len (self .description ['enum' ]) > 0 and \
Original file line number Diff line number Diff line change 2929
3030setup (
3131 name = 'gateway_addon' ,
32- version = '0.11 .0' ,
32+ version = '0.12 .0' ,
3333 description = 'Bindings for Mozilla WebThings Gateway add-ons' ,
3434 long_description = long_description ,
3535 url = 'https://github.com/mozilla-iot/gateway-addon-python' ,
You can’t perform that action at this time.
0 commit comments