pre-commit hooks changes
parent
21c84acc8f
commit
303159a818
|
@ -228,23 +228,29 @@ class Location(STIXDomainObject):
|
||||||
|
|
||||||
def _check_object_constraints(self):
|
def _check_object_constraints(self):
|
||||||
super(Location, self)._check_object_constraints()
|
super(Location, self)._check_object_constraints()
|
||||||
if self.get('precision'):
|
if self.get('precision') is not None:
|
||||||
self._check_properties_dependency(['longitude', 'latitude'], ['precision'])
|
self._check_properties_dependency(['longitude', 'latitude'], ['precision'])
|
||||||
if self.precision < 0.0:
|
if self.precision < 0.0:
|
||||||
msg = ("{0.id} 'precision' must be a positive value. Received "
|
msg = (
|
||||||
"{0.precision}")
|
"{0.id} 'precision' must be a positive value. Received "
|
||||||
|
"{0.precision}"
|
||||||
|
)
|
||||||
raise ValueError(msg.format(self))
|
raise ValueError(msg.format(self))
|
||||||
|
|
||||||
self._check_properties_dependency(['latitude'], ['longitude'])
|
self._check_properties_dependency(['latitude'], ['longitude'])
|
||||||
|
|
||||||
if self.get('latitude') is not None and fabs(self.latitude) > 90.0:
|
if self.get('latitude') is not None and fabs(self.latitude) > 90.0:
|
||||||
msg = ("{0.id} 'latitude' must be between -90 and 90. Received "
|
msg = (
|
||||||
"{0.latitude}")
|
"{0.id} 'latitude' must be between -90 and 90. Received "
|
||||||
|
"{0.latitude}"
|
||||||
|
)
|
||||||
raise ValueError(msg.format(self))
|
raise ValueError(msg.format(self))
|
||||||
|
|
||||||
if self.get('longitude') is not None and fabs(self.longitude) > 180.0:
|
if self.get('longitude') is not None and fabs(self.longitude) > 180.0:
|
||||||
msg = ("{0.id} 'longitude' must be between -180 and 180. Received "
|
msg = (
|
||||||
"{0.longitude}")
|
"{0.id} 'longitude' must be between -180 and 180. Received "
|
||||||
|
"{0.longitude}"
|
||||||
|
)
|
||||||
raise ValueError(msg.format(self))
|
raise ValueError(msg.format(self))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue