Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, d):
if d in direction.compass_dirs:
self._compass = d
self._degrees = direction.compass_dirs[d]
else:
self._compass = None
value = float(d)
if value < 0.0 or value > 360.0:
raise ValueError("direction must be 0..360: '" + str(value) + "'")
self._degrees = value