提交 e1016496 编写于 作者: S Shohei Fujii 提交者: Kentaro Wada

fix warnings by flake8

上级 7a83871b
......@@ -68,7 +68,8 @@ class Shape(object):
def shape_type(self, value):
if value is None:
value = 'polygon'
if value not in ['polygon', 'rectangle', 'point', 'line', 'circle', 'linestrip']:
if value not in ['polygon', 'rectangle', 'point',
'line', 'circle', 'linestrip']:
raise ValueError('Unexpected shape_type: {}'.format(value))
self._shape_type = value
......
......@@ -26,6 +26,9 @@ def shape_to_mask(img_shape, points, shape_type=None):
elif shape_type == 'rectangle' and len(points) == 2:
xy = [tuple(point) for point in points]
draw.rectangle(xy, outline=1, fill=1)
elif shape_type == 'linestrip':
xy = [tuple(point) for point in points]
draw.line(xy=xy, fill=0, width=3)
else:
xy = [tuple(point) for point in points]
draw.polygon(xy=xy, outline=1, fill=1)
......
......@@ -84,7 +84,8 @@ class Canvas(QtWidgets.QWidget):
@createMode.setter
def createMode(self, value):
if value not in ['polygon', 'rectangle', 'circle', 'line', 'point', 'linestrip']:
if value not in ['polygon', 'rectangle', 'circle',
'line', 'point', 'linestrip']:
raise ValueError('Unsupported createMode: %s' % value)
self._createMode = value
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册