File tree 1 file changed +12
-7
lines changed 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -49,15 +49,20 @@ def get_rotation(rotation):
49
49
50
50
*rotation* may be 'horizontal', 'vertical', or a numeric value in degrees.
51
51
"""
52
- if rotation in ('horizontal' , None ):
53
- angle = 0.
54
- elif rotation == 'vertical' :
55
- angle = 90.
56
- else :
52
+ try :
57
53
angle = float (rotation )
58
- return angle % 360
59
-
54
+ except (ValueError , TypeError ):
55
+ isString = isinstance (rotation , six .string_types )
56
+ if ((isString and rotation == 'horizontal' ) or rotation is None ):
57
+ angle = 0.
58
+ elif (isString and rotation == 'vertical' ):
59
+ angle = 90.
60
+ else :
61
+ raise ValueError ("rotation is {0} expected either 'horizontal'"
62
+ " 'vertical', numeric value or"
63
+ "None" .format (rotation ))
60
64
65
+ return angle
61
66
# these are not available for the object inspector until after the
62
67
# class is build so we define an initial set here for the init
63
68
# function and they will be overridden after object defn
You can’t perform that action at this time.
0 commit comments