Passed
Push — master ( 84bec4...a08110 )
by Konstantin
04:15 queued 01:47
created

set_points.set_points()   A

Complexity

Conditions 5

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 16
rs 9.3333
c 0
b 0
f 0
cc 5
nop 2
1
def set_points(self, points):
2
    """
3
    Set coordinate polygon by given string.
4
    Moreover, invalidate the parent's AlternativeImages
5
    (because they will have been cropped with a bbox
6
     of the previous polygon).
7
    """
8
    if hasattr(self, 'parent_object_'):
9
        parent = self.parent_object_
10
        if hasattr(parent, 'invalidate_AlternativeImage'):
11
            # RegionType, TextLineType, WordType, GlyphType:
12
            parent.invalidate_AlternativeImage()
13
        elif hasattr(parent, 'parent_object_') and hasattr(parent.parent_object_, 'invalidate_AlternativeImage'):
14
            # BorderType:
15
            parent.parent_object_.invalidate_AlternativeImage(feature_selector='cropped')
16
    self.points = points
17