Code Duplication    Length = 24-26 lines in 2 locations

ActionTree/__init__.py 2 locations

@@ 463-488 (lines=26) @@
460
        }
461
462
    # @todo Factorize Actions
463
    class SuccessfulAction(object):
464
        def __init__(self, action, status):
465
            self.__label = str(action.label)
466
            self.__id = id(action)
467
            self.__dependencies = set(id(d) for d in action.dependencies)
468
            self.__ready_time = status.ready_time
469
            self.__start_time = status.start_time
470
            self.__success_time = status.success_time
471
472
        @property
473
        def min_time(self):
474
            return self.__ready_time
475
476
        @property
477
        def max_time(self):
478
            return self.__success_time
479
480
        def draw(self, ax, ordinates, actions):
481
            ordinate = ordinates[self.__id]
482
            ax.plot([self.__ready_time, self.__start_time], [ordinate, ordinate], color="blue", lw=1)
483
            # @todo Use an other end-style to avoid pixels before/after min/max_time
484
            ax.plot([self.__start_time, self.__success_time], [ordinate, ordinate], color="blue", lw=4)
485
            # @todo Make sure the text is not outside the plot on the right
486
            ax.annotate(self.__label, xy=(self.__start_time, ordinate), xytext=(0, 3), textcoords="offset points")
487
            for d in self.__dependencies:
488
                ax.plot([actions[d].max_time, self.min_time], [ordinates[d], ordinate], "k:", lw=1)
489
490
    class FailedAction(object):
491
        def __init__(self, action, status):
@@ 490-513 (lines=24) @@
487
            for d in self.__dependencies:
488
                ax.plot([actions[d].max_time, self.min_time], [ordinates[d], ordinate], "k:", lw=1)
489
490
    class FailedAction(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.__failure_time = status.failure_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.__failure_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="red", lw=1)
510
            ax.plot([self.__start_time, self.__failure_time], [ordinate, ordinate], color="red", lw=4)
511
            ax.annotate(self.__label, xy=(self.__start_time, ordinate), xytext=(0, 3), textcoords="offset points")
512
            for d in self.__dependencies:
513
                ax.plot([actions[d].max_time, self.min_time], [ordinates[d], ordinate], "k:", lw=1)
514
515
    class CanceledAction(object):
516
        def __init__(self, action, status):