Code Duplication    Length = 24-26 lines in 2 locations

ActionTree/__init__.py 2 locations

@@ 463-488 (lines=26) @@
460
                action.dependencies,
461
                key=lambda d: report.get_action_status(d).success_time or report.get_action_status(d).failure_time
462
            ):
463
                if len(dependents[d]) == 1:
464
                    ordinate = compute(d, ordinate - 1)
465
                else:
466
                    dependents[d].remove(action)
467
            return ordinate
468
469
        last_ordinate = compute(report._root_action, len(self.__actions) - 1)
470
        assert last_ordinate == 0, last_ordinate
471
472
    class SuccessfulAction(object):
473
        def __init__(self, action, status):
474
            self.__label = str(action.label)
475
            self.__id = id(action)
476
            self.__dependencies = set(id(d) for d in action.dependencies)
477
            self.__ready_time = status.ready_time
478
            self.__start_time = status.start_time
479
            self.__success_time = status.success_time
480
481
        @property
482
        def min_time(self):
483
            return self.__ready_time
484
485
        @property
486
        def max_time(self):
487
            return self.__success_time
488
489
        def draw(self, ax, ordinates, actions):
490
            ordinate = ordinates[self.__id]
491
            ax.plot([self.__ready_time, self.__start_time], [ordinate, ordinate], color="blue", lw=1)
@@ 490-513 (lines=24) @@
487
            return self.__success_time
488
489
        def draw(self, ax, ordinates, actions):
490
            ordinate = ordinates[self.__id]
491
            ax.plot([self.__ready_time, self.__start_time], [ordinate, ordinate], color="blue", lw=1)
492
            # @todo Use an other end-style to avoid pixels before/after min/max_time
493
            ax.plot([self.__start_time, self.__success_time], [ordinate, ordinate], color="blue", lw=4)
494
            # @todo Make sure the text is not outside the plot on the right
495
            ax.annotate(self.__label, xy=(self.__start_time, ordinate), xytext=(0, 3), textcoords="offset points")
496
            for d in self.__dependencies:
497
                ax.plot([actions[d].max_time, self.min_time], [ordinates[d], ordinate], "k:", lw=1)
498
499
    class FailedAction(object):
500
        def __init__(self, action, status):
501
            self.__label = str(action.label)
502
            self.__id = id(action)
503
            self.__dependencies = set(id(d) for d in action.dependencies)
504
            self.__ready_time = status.ready_time
505
            self.__start_time = status.start_time
506
            self.__failure_time = status.failure_time
507
508
        @property
509
        def min_time(self):
510
            return self.__ready_time
511
512
        @property
513
        def max_time(self):
514
            return self.__failure_time
515
516
        def draw(self, ax, ordinates, actions):