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

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