Code Duplication    Length = 4-5 lines in 6 locations

pyclustering/utils/__init__.py 4 locations

@@ 677-680 (lines=4) @@
674
            continue;
675
        
676
        time_stop_simulation = len(dynamic) - 1;
677
        active_state = False;
678
        
679
        if (dynamic[time_stop_simulation][index_dyn] > threshold):
680
            active_state = True;
681
            
682
        # if active state is detected, it means we don't have whole oscillatory period for the considered oscillator, should be skipped.
683
        if (active_state is True):
@@ 656-659 (lines=4) @@
653
654
def allocate_sync_ensembles(dynamic, tolerance = 0.1, threshold = 1.0, ignore = None):
655
    """!
656
    @brief Allocate clusters in line with ensembles of synchronous oscillators where each
657
           synchronous ensemble corresponds to only one cluster.
658
    
659
    @param[in] dynamic (dynamic): Dynamic of each oscillator.
660
    @param[in] tolerance (double): Maximum error for allocation of synchronous ensemble oscillators.
661
    @param[in] threshold (double): Amlitude trigger when spike is taken into account.
662
    @param[in] ignore (bool): Set of indexes that shouldn't be taken into account.
@@ 812-816 (lines=5) @@
809
                    
810
            elif (dimension == 3):
811
                if (data is None):
812
                    axes.scatter(item[0], item[1], item[2], c = color, marker = marker_descr);
813
                else:
814
                    axes.scatter(data[item][0], data[item][1], data[item][2], c = color, marker = marker_descr);
815
        
816
        color_index += 1;
817
    
818
    for item in noise:
819
        if (dimension == 1):
@@ 791-795 (lines=5) @@
788
            axes = fig.add_subplot(111);
789
        elif (dimension == 3):
790
            axes = fig.gca(projection='3d');
791
        else:
792
            raise NameError('Drawer supports only 2d and 3d data representation');
793
    
794
    color_index = 0;
795
    for cluster in clusters:
796
        color = colors[color_index];
797
        for item in cluster:
798
            if (dimension == 1):

pyclustering/cluster/__init__.py 2 locations

@@ 330-333 (lines=4) @@
327
                    ax.scatter(data[item][0], data[item][1], data[item][2], c = color, marker = marker, s = markersize);
@@ 323-327 (lines=5) @@
320
                else:
321
                    ax.plot(data[item][0], data[item][1], color = color, marker = marker, markersize = markersize);
322
        
323
            elif (dimension == 3):
324
                if (data is None):
325
                    ax.scatter(item[0], item[1], item[2], c = color, marker = marker, s = markersize);
326
                else:
327
                    ax.scatter(data[item][0], data[item][1], data[item][2], c = color, marker = marker, s = markersize);