Code Duplication    Length = 4-5 lines in 6 locations

pyclustering/utils/__init__.py 4 locations

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

pyclustering/cluster/__init__.py 2 locations

@@ 330-333 (lines=4) @@
327
    
328
    """!
329
    @brief Draw canvas cluster descriptor.
330
    
331
    @param[in] ax (Axis): Axis of the canvas where canvas cluster descriptor should be displayed.
332
    @param[in] dimension (uint): Canvas dimension.
333
    @param[in] cluster_descr (canvas_cluster_descr): Canvas cluster descriptor that should be displayed.
334
335
    @return (fig) Figure where clusters are shown.
336
    
@@ 323-327 (lines=5) @@
320
            ax.grid(visible_grid);
321
        
322
        if (display is True):
323
            plt.show();
324
        
325
        return cluster_figure;
326
    
327
    
328
    """!
329
    @brief Draw canvas cluster descriptor.
330