Code Duplication    Length = 16-16 lines in 2 locations

src/ocrd_page_user_methods/set_points.py 1 location

@@ 1-16 (lines=16) @@
1
def set_points(self, points):
2
    """
3
    Set coordinate polygon by given string.
4
    Moreover, invalidate the parent's ``pc:AlternativeImage``s
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

src/ocrd_models/ocrd_page_generateds.py 1 location

@@ 4128-4143 (lines=16) @@
4125
        pass
4126
    def __hash__(self):
4127
        return hash(self.id)
4128
    def set_points(self, points):
4129
        """
4130
        Set coordinate polygon by given string.
4131
        Moreover, invalidate the parent's ``pc:AlternativeImage``s
4132
        (because they will have been cropped with a bbox
4133
        of the previous polygon).
4134
        """
4135
        if hasattr(self, 'parent_object_'):
4136
            parent = self.parent_object_
4137
            if hasattr(parent, 'invalidate_AlternativeImage'):
4138
                # RegionType, TextLineType, WordType, GlyphType:
4139
                parent.invalidate_AlternativeImage()
4140
            elif hasattr(parent, 'parent_object_') and hasattr(parent.parent_object_, 'invalidate_AlternativeImage'):
4141
                # BorderType:
4142
                parent.parent_object_.invalidate_AlternativeImage(feature_selector='cropped')
4143
        self.points = points
4144
# end class CoordsType
4145
4146