-
Notifications
You must be signed in to change notification settings - Fork 55
/
duplicated_io.html
285 lines (276 loc) · 15.1 KB
/
duplicated_io.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<HTML>
<HEAD>
<TITLE> CloneDigger Report </TITLE>
<script type="text/javascript">
function unhide(divID) {
var item = document.getElementById(divID);
if (item) {
item.className=(item.className=='hidden')?'unhidden':'hidden';
}
}
</script>
<style type="text/css">
.hidden { display: none; }
.unhidden { display: block; }
.preformatted {
border: 1px dashed #3c78b5;
font-size: 11px;
font-family: Courier;
margin: 10px;
line-height: 13px;
}
.preformattedHeader {
background-color: #f0f0f0;
border-bottom: 1px dashed #3c78b5;
padding: 3px;
text-align: center;
}
.preformattedContent {
background-color: #f0f0f0;
padding: 3px;
}
<!--
<div class="preformatted"><div class="preformattedContent">
<pre>Clone Digger
</pre>
</div></div>
-->
</style>
</HEAD>
<BODY>
<P>Source files: 5</P>
<a href = "javascript:unhide('files');">Click here to show/hide file names</a><div id="files" class="hidden"><P><B>Source files:</B><BR>io/loaders.py, <BR>io/outputdata.py, <BR>io/__init__.py, <BR>io/stdinput.py, <BR>io/writers.py</P></div>
<P>Clones detected: 6</P>
<P>109 of 649 lines are duplicates (16.80%) </P>
<P>
<B>Parameters<BR> </B>
clustering_threshold = 10<BR>
distance_threshold = 5<BR>
size_threshold = 5<BR>
hashing_depth = 1<BR>
clusterize_using_hash = False<BR>
clusterize_using_dcup = False<BR>
</P>
<B>Time elapsed</B><BR>Construction of AST : 0.12 seconds<BR>
Building statement hash : 0.00 seconds<BR>
Building patterns : 0.25 seconds<BR>
Marking similar statements : 0.31 seconds<BR>
Finding similar sequences of statements : 0.01 seconds<BR>
Refining candidates : 0.11 seconds<BR>
Total time: 0.81<BR>
Started at: Mon Aug 1 06:55:59 2016<BR>
Finished at: Mon Aug 1 06:56:00 2016
<P><B>Clone # 1</B><BR>Distance between two fragments = 1 <BR>Clone size = 12<TABLE NOWRAP WIDTH=100% BORDER=1><TD>Source file "io/stdinput.py"<BR>The first line is 311</TD><TD></TD><TD>Source file "io/stdinput.py"<BR>The first line is 445</TD></TR><TR>
<TD>
preamble_directives = {}</TD>
<TD style="width: 10px;" BGCOLOR=AQUA> </TD><TD>
preamble_directives = {}</TD>
</TR>
<TR>
<TD>
with (open(filename, 'r')) as (<span style="color: rgb(255, 0, 0);">datafile</span>):<BR>
for line in <span style="color: rgb(255, 0, 0);">datafile</span>:<BR>
line = line.strip()<BR>
if (len(line) == 0) or (line[0] != '#'):<BR>
break<BR>
if line.startswith('## '):<BR>
parts = line[len('## '):].split('=')<BR>
if len(parts) == 2:<BR>
preamble_directives[parts[0].strip()] = parts[1].strip()</TD>
<TD style="width: 10px;" BGCOLOR=RED> </TD><TD>
with (open(filename, 'r')) as (<span style="color: rgb(255, 0, 0);">multidatafile</span>):<BR>
for line in <span style="color: rgb(255, 0, 0);">multidatafile</span>:<BR>
line = line.strip()<BR>
if (len(line) == 0) or (line[0] != '#'):<BR>
break<BR>
if line.startswith('## '):<BR>
parts = line[len('## '):].split('=')<BR>
if len(parts) == 2:<BR>
preamble_directives[parts[0].strip()] = parts[1].strip()</TD>
</TR>
<TR>
<TD>
orig_cwd = _os.getcwd()</TD>
<TD style="width: 10px;" BGCOLOR=AQUA> </TD><TD>
orig_cwd = _os.getcwd()</TD>
</TR>
<TR>
<TD>
if len(_os.path.dirname(filename)) > 0:<BR>
_os.chdir(_os.path.dirname(filename))</TD>
<TD style="width: 10px;" BGCOLOR=AQUA> </TD><TD>
if len(_os.path.dirname(filename)) > 0:<BR>
_os.chdir(_os.path.dirname(filename))</TD>
</TR>
</TABLE> </P> <HR><BR>
<P><B>Clone # 2</B><BR>Distance between two fragments = 0 <BR>Clone size = 10<TABLE NOWRAP WIDTH=100% BORDER=1><TD>Source file "io/stdinput.py"<BR>The first line is 344</TD><TD></TD><TD>Source file "io/stdinput.py"<BR>The first line is 484</TD></TR><TR>
<TD>
def is_interactive():<BR>
import __main__ as main<BR>
return not hasattr(main, '__file__')</TD>
<TD style="width: 10px;" BGCOLOR=AQUA> </TD><TD>
def is_interactive():<BR>
import __main__ as main<BR>
return not hasattr(main, '__file__')</TD>
</TR>
<TR>
<TD>
if is_interactive():<BR>
try:<BR>
import time<BR>
from IPython.display import clear_output<BR>
def display_progress(i, N):<BR>
time.sleep(0.001)<BR>
clear_output()<BR>
print(('Loading %s: %.0f%%') % ((filename, ((100.0) * (float(i))) / (float(N)))))<BR>
_sys.stdout.flush()<BR>
except:<BR>
def display_progress(i, N):<BR>
pass<BR>
else:<BR>
def display_progress(i, N):<BR>
pass</TD>
<TD style="width: 10px;" BGCOLOR=AQUA> </TD><TD>
if is_interactive():<BR>
try:<BR>
import time<BR>
from IPython.display import clear_output<BR>
def display_progress(i, N):<BR>
time.sleep(0.001)<BR>
clear_output()<BR>
print(('Loading %s: %.0f%%') % ((filename, ((100.0) * (float(i))) / (float(N)))))<BR>
_sys.stdout.flush()<BR>
except:<BR>
def display_progress(i, N):<BR>
pass<BR>
else:<BR>
def display_progress(i, N):<BR>
pass</TD>
</TR>
</TABLE> </P> <HR><BR>
<P><B>Clone # 3</B><BR>Distance between two fragments = 4 <BR>Clone size = 10<TABLE NOWRAP WIDTH=100% BORDER=1><TD>Source file "io/stdinput.py"<BR>The first line is 324</TD><TD></TD><TD>Source file "io/stdinput.py"<BR>The first line is 459</TD></TR><TR>
<TD>
try:<BR>
if 'Lookup' in preamble_directives:<BR>
lookupDict = self.parse_dictfile(preamble_directives['Lookup'])<BR>
else:<BR>
lookupDict = {}<BR>
if 'Columns' in preamble_directives:<BR>
colLabels = [l.strip() for l in preamble_directives['Columns'].split(',') ]<BR>
else:<BR>
colLabels = [<span style="color: rgb(255, 0, 0);">'plus count'</span>, <span style="color: rgb(255, 0, 0);">'count total'</span>]<BR>
<span style="color: rgb(255, 0, 0);">spamLabels</span>, fillInfo = self.<span style="color: rgb(255, 0, 0);">_extractLabelsFromColLabels</span>(colLabels)<BR>
nDataCols = len(colLabels)<BR>
finally:<BR>
_os.chdir(orig_cwd)</TD>
<TD style="width: 10px;" BGCOLOR=RED> </TD><TD>
try:<BR>
if 'Lookup' in preamble_directives:<BR>
lookupDict = self.parse_dictfile(preamble_directives['Lookup'])<BR>
else:<BR>
lookupDict = {}<BR>
if 'Columns' in preamble_directives:<BR>
colLabels = [l.strip() for l in preamble_directives['Columns'].split(',') ]<BR>
else:<BR>
colLabels = [<span style="color: rgb(255, 0, 0);">'dataset1 plus count'</span>, <span style="color: rgb(255, 0, 0);">'dataset1 count total'</span>]<BR>
<span style="color: rgb(255, 0, 0);">dsSpamLabels</span>, fillInfo = self.<span style="color: rgb(255, 0, 0);">_extractLabelsFromMultiDataColLabels</span>(colLabels)<BR>
nDataCols = len(colLabels)<BR>
finally:<BR>
_os.chdir(orig_cwd)</TD>
</TR>
</TABLE> </P> <HR><BR>
<P><B>Clone # 4</B><BR>Distance between two fragments = 3 <BR>Clone size = 10<TABLE NOWRAP WIDTH=100% BORDER=1><TD>Source file "io/writers.py"<BR>The first line is 138</TD><TD></TD><TD>Source file "io/writers.py"<BR>The first line is 95</TD></TR><TR>
<TD>
if gatestring_list is not None:<BR>
if (len(gatestring_list) > 0) and (not isinstance(gatestring_list[0], _objs.GateString)):<BR>
raise ValueError('Argument gatestring_list must be a list of GateString objects!')<BR>
else:<BR>
gatestring_list = list(<span style="color: rgb(255, 0, 0);">multidataset.gsIndex</span>.keys())</TD>
<TD style="width: 10px;" BGCOLOR=RED> </TD><TD>
if gatestring_list is not None:<BR>
if (len(gatestring_list) > 0) and (not isinstance(gatestring_list[0], _objs.GateString)):<BR>
raise ValueError('Argument gatestring_list must be a list of GateString objects!')<BR>
else:<BR>
gatestring_list = list(<span style="color: rgb(255, 0, 0);">dataset</span>.keys())</TD>
</TR>
<TR>
<TD>
spamLabels = <span style="color: rgb(255, 0, 0);">multidataset</span>.get_spam_labels()</TD>
<TD style="width: 10px;" BGCOLOR=RED> </TD><TD>
spamLabels = <span style="color: rgb(255, 0, 0);">dataset</span>.get_spam_labels()</TD>
</TR>
<TR>
<TD>
if spamLabelOrder is not None:<BR>
assert len(spamLabelOrder) == len(spamLabels)<BR>
assert all([sl in spamLabels for sl in spamLabelOrder ])<BR>
assert all([sl in spamLabelOrder for sl in spamLabels ])<BR>
spamLabels = spamLabelOrder</TD>
<TD style="width: 10px;" BGCOLOR=AQUA> </TD><TD>
if spamLabelOrder is not None:<BR>
assert len(spamLabelOrder) == len(spamLabels)<BR>
assert all([sl in spamLabels for sl in spamLabelOrder ])<BR>
assert all([sl in spamLabelOrder for sl in spamLabels ])<BR>
spamLabels = spamLabelOrder</TD>
</TR>
</TABLE> </P> <HR><BR>
<P><B>Clone # 5</B><BR>Distance between two fragments = 3 <BR>Clone size = 8<TABLE NOWRAP WIDTH=100% BORDER=1><TD>Source file "io/stdinput.py"<BR>The first line is 364</TD><TD></TD><TD>Source file "io/stdinput.py"<BR>The first line is 503</TD></TR><TR>
<TD>
if ((iLine) % (nSkip) == 0) or ((iLine) + (1) == nLines):<BR>
display_progress((iLine) + (1), nLines)</TD>
<TD style="width: 10px;" BGCOLOR=AQUA> </TD><TD>
if ((iLine) % (nSkip) == 0) or ((iLine) + (1) == nLines):<BR>
display_progress((iLine) + (1), nLines)</TD>
</TR>
<TR>
<TD>
line = line.strip()</TD>
<TD style="width: 10px;" BGCOLOR=AQUA> </TD><TD>
line = line.strip()</TD>
</TR>
<TR>
<TD>
if (len(line) == 0) or (line[0] == '#'):<BR>
continue</TD>
<TD style="width: 10px;" BGCOLOR=AQUA> </TD><TD>
if (len(line) == 0) or (line[0] == '#'):<BR>
continue</TD>
</TR>
<TR>
<TD>
try:<BR>
gateStringTuple, <span style="color: rgb(255, 0, 0);">gateStringStr</span>, valueList = self.parse_dataline(line, lookupDict, nDataCols)<BR>
except ValueError, e:<BR>
raise ValueError(('%s Line %d: %s') % ((filename, iLine, str(e))))</TD>
<TD style="width: 10px;" BGCOLOR=RED> </TD><TD>
try:<BR>
gateStringTuple, <span style="color: rgb(255, 0, 0);">_</span>, valueList = self.parse_dataline(line, lookupDict, nDataCols)<BR>
except ValueError, e:<BR>
raise ValueError(('%s Line %d: %s') % ((filename, iLine, str(e))))</TD>
</TR>
<TR>
<TD>
self.<span style="color: rgb(255, 0, 0);">_fillDataCountDict</span>(<span style="color: rgb(255, 0, 0);">countDict</span>, fillInfo, valueList)</TD>
<TD style="width: 10px;" BGCOLOR=RED> </TD><TD>
self.<span style="color: rgb(255, 0, 0);">_fillMultiDataCountDicts</span>(<span style="color: rgb(255, 0, 0);">dsCountDicts</span>, fillInfo, valueList)</TD>
</TR>
</TABLE> </P> <HR><BR>
<P><B>Clone # 6</B><BR>Distance between two fragments = 3 <BR>Clone size = 5<TABLE NOWRAP WIDTH=100% BORDER=1><TD>Source file "io/writers.py"<BR>The first line is 217</TD><TD></TD><TD>Source file "io/writers.py"<BR>The first line is 223</TD></TR><TR>
<TD>
for <span style="color: rgb(255, 0, 0);">prepLabel</span>, <span style="color: rgb(255, 0, 0);">rhoVec</span> in gs.<span style="color: rgb(255, 0, 0);">preps</span>.items():<BR>
output.write(('%s\n') % (<span style="color: rgb(255, 0, 0);">prepLabel</span>))<BR>
output.write('PauliVec\n')<BR>
output.write((' '.join((('%.8g') % (el) for el in <span style="color: rgb(255, 0, 0);">rhoVec</span> ))) + ('\n'))<BR>
output.write('\n')</TD>
<TD style="width: 10px;" BGCOLOR=RED> </TD><TD>
for <span style="color: rgb(255, 0, 0);">ELabel</span>, <span style="color: rgb(255, 0, 0);">EVec</span> in gs.<span style="color: rgb(255, 0, 0);">effects</span>.items():<BR>
output.write(('%s\n') % (<span style="color: rgb(255, 0, 0);">ELabel</span>))<BR>
output.write('PauliVec\n')<BR>
output.write((' '.join((('%.8g') % (el) for el in <span style="color: rgb(255, 0, 0);">EVec</span> ))) + ('\n'))<BR>
output.write('\n')</TD>
</TR>
</TABLE> </P> <HR>
<HR>
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 <a href="http://clonedigger.sourceforge.net">http://clonedigger.sourceforge.net</a>
</BODY>
</HTML>