CloneDigger Report

Source files: 5

Click here to show/hide file names

Source files:
io/loaders.py,
io/outputdata.py,
io/__init__.py,
io/stdinput.py,
io/writers.py

Clones detected: 6

109 of 649 lines are duplicates (16.80%)

Parameters
clustering_threshold = 10
distance_threshold = 5
size_threshold = 5
hashing_depth = 1
clusterize_using_hash = False
clusterize_using_dcup = False

Time elapsed
Construction of AST : 0.12 seconds
Building statement hash : 0.00 seconds
Building patterns : 0.25 seconds
Marking similar statements : 0.31 seconds
Finding similar sequences of statements : 0.01 seconds
Refining candidates : 0.11 seconds
Total time: 0.81
Started at: Mon Aug 1 06:55:59 2016
Finished at: Mon Aug 1 06:56:00 2016

Clone # 1
Distance between two fragments = 1
Clone size = 12

Source file "io/stdinput.py" The first line is 311 |  | Source file "io/stdinput.py" The first line is 445
preamble_directives = {} |  | preamble_directives = {}
with (open(filename, 'r')) as (datafile): for line in datafile: line = line.strip() if (len(line) == 0) or (line[0] != '#'): break if line.startswith('## '): parts = line[len('## '):].split('=') if len(parts) == 2: preamble_directives[parts[0].strip()] = parts[1].strip() |  | with (open(filename, 'r')) as (multidatafile): for line in multidatafile: line = line.strip() if (len(line) == 0) or (line[0] != '#'): break if line.startswith('## '): parts = line[len('## '):].split('=') if len(parts) == 2: preamble_directives[parts[0].strip()] = parts[1].strip()
orig_cwd = _os.getcwd() |  | orig_cwd = _os.getcwd()
if len(_os.path.dirname(filename)) > 0: _os.chdir(_os.path.dirname(filename)) |  | if len(_os.path.dirname(filename)) > 0: _os.chdir(_os.path.dirname(filename))

Clone # 2
Distance between two fragments = 0
Clone size = 10

Source file "io/stdinput.py" The first line is 344 |  | Source file "io/stdinput.py" The first line is 484
def is_interactive(): import __main__ as main return not hasattr(main, '__file__') |  | def is_interactive(): import __main__ as main return not hasattr(main, '__file__')
if is_interactive(): try: import time from IPython.display import clear_output def display_progress(i, N): time.sleep(0.001) clear_output() print(('Loading %s: %.0f%%') % ((filename, ((100.0) * (float(i))) / (float(N))))) _sys.stdout.flush() except: def display_progress(i, N): pass else: def display_progress(i, N): pass |  | if is_interactive(): try: import time from IPython.display import clear_output def display_progress(i, N): time.sleep(0.001) clear_output() print(('Loading %s: %.0f%%') % ((filename, ((100.0) * (float(i))) / (float(N))))) _sys.stdout.flush() except: def display_progress(i, N): pass else: def display_progress(i, N): pass

Clone # 3
Distance between two fragments = 4
Clone size = 10

Source file "io/stdinput.py" The first line is 324 |  | Source file "io/stdinput.py" The first line is 459
try: if 'Lookup' in preamble_directives: lookupDict = self.parse_dictfile(preamble_directives['Lookup']) else: lookupDict = {} if 'Columns' in preamble_directives: colLabels = [l.strip() for l in preamble_directives['Columns'].split(',') ] else: colLabels = ['plus count', 'count total'] spamLabels, fillInfo = self._extractLabelsFromColLabels(colLabels) nDataCols = len(colLabels) finally: _os.chdir(orig_cwd) |  | try: if 'Lookup' in preamble_directives: lookupDict = self.parse_dictfile(preamble_directives['Lookup']) else: lookupDict = {} if 'Columns' in preamble_directives: colLabels = [l.strip() for l in preamble_directives['Columns'].split(',') ] else: colLabels = ['dataset1 plus count', 'dataset1 count total'] dsSpamLabels, fillInfo = self._extractLabelsFromMultiDataColLabels(colLabels) nDataCols = len(colLabels) finally: _os.chdir(orig_cwd)

Clone # 4
Distance between two fragments = 3
Clone size = 10

Source file "io/writers.py" The first line is 138 |  | Source file "io/writers.py" The first line is 95
if gatestring_list is not None: if (len(gatestring_list) > 0) and (not isinstance(gatestring_list[0], _objs.GateString)): raise ValueError('Argument gatestring_list must be a list of GateString objects!') else: gatestring_list = list(multidataset.gsIndex.keys()) |  | if gatestring_list is not None: if (len(gatestring_list) > 0) and (not isinstance(gatestring_list[0], _objs.GateString)): raise ValueError('Argument gatestring_list must be a list of GateString objects!') else: gatestring_list = list(dataset.keys())
spamLabels = multidataset.get_spam_labels() |  | spamLabels = dataset.get_spam_labels()
if spamLabelOrder is not None: assert len(spamLabelOrder) == len(spamLabels) assert all([sl in spamLabels for sl in spamLabelOrder ]) assert all([sl in spamLabelOrder for sl in spamLabels ]) spamLabels = spamLabelOrder |  | if spamLabelOrder is not None: assert len(spamLabelOrder) == len(spamLabels) assert all([sl in spamLabels for sl in spamLabelOrder ]) assert all([sl in spamLabelOrder for sl in spamLabels ]) spamLabels = spamLabelOrder

Clone # 5
Distance between two fragments = 3
Clone size = 8

Source file "io/stdinput.py" The first line is 364 |  | Source file "io/stdinput.py" The first line is 503
if ((iLine) % (nSkip) == 0) or ((iLine) + (1) == nLines): display_progress((iLine) + (1), nLines) |  | if ((iLine) % (nSkip) == 0) or ((iLine) + (1) == nLines): display_progress((iLine) + (1), nLines)
line = line.strip() |  | line = line.strip()
if (len(line) == 0) or (line[0] == '#'): continue |  | if (len(line) == 0) or (line[0] == '#'): continue
try: gateStringTuple, gateStringStr, valueList = self.parse_dataline(line, lookupDict, nDataCols) except ValueError, e: raise ValueError(('%s Line %d: %s') % ((filename, iLine, str(e)))) |  | try: gateStringTuple, _, valueList = self.parse_dataline(line, lookupDict, nDataCols) except ValueError, e: raise ValueError(('%s Line %d: %s') % ((filename, iLine, str(e))))
self._fillDataCountDict(countDict, fillInfo, valueList) |  | self._fillMultiDataCountDicts(dsCountDicts, fillInfo, valueList)

Clone # 6
Distance between two fragments = 3
Clone size = 5

Source file "io/writers.py" The first line is 217 |  | Source file "io/writers.py" The first line is 223
for prepLabel, rhoVec in gs.preps.items(): output.write(('%s\n') % (prepLabel)) output.write('PauliVec\n') output.write((' '.join((('%.8g') % (el) for el in rhoVec ))) + ('\n')) output.write('\n') |  | for ELabel, EVec in gs.effects.items(): output.write(('%s\n') % (ELabel)) output.write('PauliVec\n') output.write((' '.join((('%.8g') % (el) for el in EVec ))) + ('\n')) output.write('\n')

Clone Digger is aimed to find software clones in Python and Java programs. It is provided under the GPL license and can be downloaded from the site http://clonedigger.sourceforge.net