Code Duplication    Length = 16-16 lines in 2 locations

src/ocrd_models/ocrd_page_generateds.py 1 location

@@ 3481-3496 (lines=16) @@
3478
        pass
3479
    def __hash__(self):
3480
        return hash(self.id)
3481
    def set_points(self, points):
3482
        """
3483
        Set coordinate polygon by given string.
3484
        Moreover, invalidate the parent's ``pc:AlternativeImage``s
3485
        (because they will have been cropped with a bbox
3486
        of the previous polygon).
3487
        """
3488
        if hasattr(self, 'parent_object_'):
3489
            parent = self.parent_object_
3490
            if hasattr(parent, 'invalidate_AlternativeImage'):
3491
                # RegionType, TextLineType, WordType, GlyphType:
3492
                parent.invalidate_AlternativeImage()
3493
            elif hasattr(parent, 'parent_object_') and hasattr(parent.parent_object_, 'invalidate_AlternativeImage'):
3494
                # BorderType:
3495
                parent.parent_object_.invalidate_AlternativeImage(feature_selector='cropped')
3496
        self.points = points
3497
# end class CoordsType
3498
3499

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