Code Duplication    Length = 30-31 lines in 2 locations

ActionTree/__init__.py 2 locations

@@ 490-520 (lines=31) @@
487
        last_ordinate = compute(report._root_action, len(self.__actions) - 1)
488
        assert last_ordinate == 0, last_ordinate
489
490
    class SuccessfulAction(object):
491
        def __init__(self, action, status):
492
            self.__label = str(action.label)
493
            self.__id = id(action)
494
            self.__dependencies = set(id(d) for d in action.dependencies)
495
            self.__ready_time = status.ready_time
496
            self.__start_time = status.start_time
497
            self.__success_time = status.success_time
498
499
        @property
500
        def min_time(self):
501
            return self.__ready_time
502
503
        @property
504
        def max_time(self):
505
            return self.__success_time
506
507
        def draw(self, ax, ordinates, actions):
508
            ordinate = ordinates[self.__id]
509
            ax.plot([self.__ready_time, self.__start_time], [ordinate, ordinate], color="blue", lw=1)
510
            ax.plot(
511
                [self.__start_time, self.__success_time], [ordinate, ordinate],
512
                color="blue", lw=4, solid_capstyle="butt",
513
            )
514
            # @todo Make sure the text is not outside the plot on the right
515
            ax.annotate(
516
                self.__label,
517
                xy=(self.__start_time, ordinate), xytext=(0, 3), textcoords="offset points",
518
            )
519
            for d in self.__dependencies:
520
                ax.plot([actions[d].max_time, self.min_time], [ordinates[d], ordinate], "k:", lw=1)
521
522
    class FailedAction(object):
523
        def __init__(self, action, status):
@@ 522-551 (lines=30) @@
519
            for d in self.__dependencies:
520
                ax.plot([actions[d].max_time, self.min_time], [ordinates[d], ordinate], "k:", lw=1)
521
522
    class FailedAction(object):
523
        def __init__(self, action, status):
524
            self.__label = str(action.label)
525
            self.__id = id(action)
526
            self.__dependencies = set(id(d) for d in action.dependencies)
527
            self.__ready_time = status.ready_time
528
            self.__start_time = status.start_time
529
            self.__failure_time = status.failure_time
530
531
        @property
532
        def min_time(self):
533
            return self.__ready_time
534
535
        @property
536
        def max_time(self):
537
            return self.__failure_time
538
539
        def draw(self, ax, ordinates, actions):
540
            ordinate = ordinates[self.__id]
541
            ax.plot([self.__ready_time, self.__start_time], [ordinate, ordinate], color="red", lw=1)
542
            ax.plot(
543
                [self.__start_time, self.__failure_time], [ordinate, ordinate],
544
                color="red", lw=4, solid_capstyle="butt",
545
            )
546
            ax.annotate(
547
                self.__label,
548
                xy=(self.__start_time, ordinate), xytext=(0, 3), textcoords="offset points",
549
            )
550
            for d in self.__dependencies:
551
                ax.plot([actions[d].max_time, self.min_time], [ordinates[d], ordinate], "k:", lw=1)
552
553
    class CanceledAction(object):
554
        def __init__(self, action, status):