rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
self.N = ncolors self._i_under = self.N self._i_over = self.N+1 self._i_bad = self.N+2
def set_source(self, source): """ Define an alternative source for the colormap. *source* can be any other matplotlib colormap object or its registered name, a NumPy array with one RGB triplet per row or the name of a textfile with one RGB triplet per line. Values should be between 0.0 and 1.0. """ self.source = source try: source = cm.get_cmap(source)
24ed2bf2192a7e9558edc823cd2e9a65511bb35c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/508/24ed2bf2192a7e9558edc823cd2e9a65511bb35c/mplutil.py
def uniconvw_run(): file=None icon=None _pkgdir = __path__[0] app_ver = string.strip(open(os.path.join(_pkgdir, 'VERSION')).read())
a93cda7fa7405e3cfafbc93a7d6b81bd44eaa3a7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3125/a93cda7fa7405e3cfafbc93a7d6b81bd44eaa3a7/__init__.py
def uniconvw_run(): file=None icon=None _pkgdir = __path__[0] app_ver = string.strip(open(os.path.join(_pkgdir, 'VERSION')).read())
a93cda7fa7405e3cfafbc93a7d6b81bd44eaa3a7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3125/a93cda7fa7405e3cfafbc93a7d6b81bd44eaa3a7/__init__.py
RE_BEGIN_HASH = re.compile(r'^[ \t]*
RE_BEGIN_HASH = re.compile(r'^[ \t]*
def clean_code(self, text): # remove XML comments text = re.sub(self.RE_XMLCOMMENT, '', text) # remove preprocessor directions text = re.sub(self.RE_PREPROCESSOR, '', text) # substitute multilines with one line text = re.sub(self.RE_MULTILINES, "", text) return text
ee0cba7ed8caf8e8e5efd7b1ddbd40e8fef9fa4b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/ee0cba7ed8caf8e8e5efd7b1ddbd40e8fef9fa4b/fortrandoc.py
f.writelines([self.cmd('sectionerrors'), '\n\n'])
def write_function(self, fn, f): f.writelines([ r'\begin{functiondef}{', self.cmd('returnvalue', fn.return_value), ' ', self.cmd('function', fn.name), '(', ]) if fn.parameters: params = ", ".join(map(lambda s: self.cmd('textbf', s), fn.parameters)) f.writelines([params]) f.writelines([')}\n\n'])
c7a600240f7814227a1cc8b0ed48cbb032734d53 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/c7a600240f7814227a1cc8b0ed48cbb032734d53/fortrandoc.py
else: f.writelines([self.begin('desc'), 'Error codes missing.\n', self.end('desc')])
def write_function(self, fn, f): f.writelines([ r'\begin{functiondef}{', self.cmd('returnvalue', fn.return_value), ' ', self.cmd('function', fn.name), '(', ]) if fn.parameters: params = ", ".join(map(lambda s: self.cmd('textbf', s), fn.parameters)) f.writelines([params]) f.writelines([')}\n\n'])
c7a600240f7814227a1cc8b0ed48cbb032734d53 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/c7a600240f7814227a1cc8b0ed48cbb032734d53/fortrandoc.py
for (error, desc) in sub.errors:
for (error, desc) in fn.errors:
def write_function(self, fn, f): lines = [ '<div class="function_definition">\n', '<a name="function_%s">' % fn.name, '<h3><span class="type">%s</span> <span class="keyword">function</span> <span class="subroutine">%s</span>(<div class="parameters">' % (fn.return_value, fn.name) ] f.writelines(lines) subs = [] for var in fn.parameters: names = map(lambda var: var.name, fn.inputvars+fn.inoutputvars+fn.outputvars) if var in names: subs.append('<a href="#function_%s_var_%s"><span class="variable">%s</span></a>' % (fn.name, var, var)) else: subs.append('<span class="variable">%s</span>' % var) f.writelines([', '.join(subs)]) f.writelines(['</div>)</h3></a>\n']) f.writelines(['<div class="description">\n%s\n</div>' % fn.description])
287d34b59e696f93858fc8cefd2e41fb3d1bf268 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/287d34b59e696f93858fc8cefd2e41fb3d1bf268/fortrandoc.py
elif name == 'constants':
elif name == 'constants' or name == 'constantblock':
def interpret(self, nodes): "Extract information from the nodes."
287d34b59e696f93858fc8cefd2e41fb3d1bf268 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/287d34b59e696f93858fc8cefd2e41fb3d1bf268/fortrandoc.py
def extract_subroutine(self, node, text): "Extract subroutine from source code."
287d34b59e696f93858fc8cefd2e41fb3d1bf268 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/287d34b59e696f93858fc8cefd2e41fb3d1bf268/fortrandoc.py
FUNCTION = re.compile(r"\A\s*?(?P<retval>.+?)\s*?function\s+?(?P<name>.+)\s*?\((?P<params>.*)\)\s*?\n")
FUNCTION = re.compile(r"\A\s*?(?P<retval>.+?)\s*?function\s+(?P<name>\w+)\s*\((?P<params>[^\)]*)\)\s*?")
def extract_subroutine(self, node, text): "Extract subroutine from source code."
287d34b59e696f93858fc8cefd2e41fb3d1bf268 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/287d34b59e696f93858fc8cefd2e41fb3d1bf268/fortrandoc.py
self.current_comment = None
self.current_comment = ''
def extract_variables(self, text, l): "Extract variable and group information from source code."
287d34b59e696f93858fc8cefd2e41fb3d1bf268 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/287d34b59e696f93858fc8cefd2e41fb3d1bf268/fortrandoc.py
self.current_comment = None
self.current_comment = ''
def end_group(scanner, token): if not self.active_group.variables: error(15, 'No variable found in group: %s' % self.active_group.description) self.active_group = None self.current_comment = None
287d34b59e696f93858fc8cefd2e41fb3d1bf268 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/287d34b59e696f93858fc8cefd2e41fb3d1bf268/fortrandoc.py
self.current_comment = token.strip()
self.current_comment += token.strip()
def commentblock(scanner, token): self.current_comment = token.strip()
287d34b59e696f93858fc8cefd2e41fb3d1bf268 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/287d34b59e696f93858fc8cefd2e41fb3d1bf268/fortrandoc.py
self.current_comment = None
self.current_comment = ''
def blank_lines(scanner, token): self.current_comment = None
287d34b59e696f93858fc8cefd2e41fb3d1bf268 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/287d34b59e696f93858fc8cefd2e41fb3d1bf268/fortrandoc.py
self.current_comment = None
self.current_comment = '' def dump(scanner, token): print "[%s]\n" % token,
def variable_definition(scanner, token): match = re.search(self.VARIABLE, token) if match: m = match.groups() vartype = m[1].split(",")[0].strip() if self.current_comment: self.current_comment = self.clean_description(self.current_comment) v = Variable(m[2], vartype, self.current_comment) else: v = Variable(m[2], vartype) dim = re.search(r"(dimension\(.*?\))", m[1]) if dim: v.dimension = dim.group(1) opt = re.search(r"optional", m[1])
287d34b59e696f93858fc8cefd2e41fb3d1bf268 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/287d34b59e696f93858fc8cefd2e41fb3d1bf268/fortrandoc.py
(r'(?m)^[^!\n]*?::.*?$', variable_definition),
(r'(?m)[^\n!]*::[^\n]*\n', variable_definition),
def variable_definition(scanner, token): match = re.search(self.VARIABLE, token) if match: m = match.groups() vartype = m[1].split(",")[0].strip() if self.current_comment: self.current_comment = self.clean_description(self.current_comment) v = Variable(m[2], vartype, self.current_comment) else: v = Variable(m[2], vartype) dim = re.search(r"(dimension\(.*?\))", m[1]) if dim: v.dimension = dim.group(1) opt = re.search(r"optional", m[1])
287d34b59e696f93858fc8cefd2e41fb3d1bf268 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/287d34b59e696f93858fc8cefd2e41fb3d1bf268/fortrandoc.py
(r'<code>.+?</code>', lambda s, t: t.replace('<verb>','\\begin{verbatim}').replace('</verb>', '\\end{verbatim}')),
(r'<code>.+?</code>', lambda s, t: t.replace('<code>','\\begin{verbatim}').replace('</code>', '\\end{verbatim}')), (r'<bf>.+?</bf>', lambda s, t: t.replace('<bf>','\\textbf{').replace('</bf>', '}')), (r'<ul>.+?</ul>', lambda s, t: t.replace('<ul>','\\underline{').replace('</ul>', '}')), (r'<it>.+?</it>', lambda s, t: t.replace('<it>','\\textit{').replace('</it>', '}')),
def write_interface(self, interface, description, f): f.writelines([self.cmd('interface', interface), '\n']) f.writelines([self.env('desc', description), '\n'])
193cf4facfdd52529e4264af9402bcc38e502a1f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/193cf4facfdd52529e4264af9402bcc38e502a1f/fortrandoc.py
f.writelines([self.cmd('sectionerrors'), '\n\n'])
def write_subroutine(self, sub, f): f.writelines([ r'\begin{subroutinedef}{', self.cmd('subroutine', sub.name), '(', self.cmd('sloppy') ]) if sub.parameters: params = ", ".join(map(lambda s: self.cmd('textbf', s), sub.parameters)) f.writelines([params]) f.writelines([')}\n\n'])
e8fbebc0714f082be31b3fa3ebda93ab4d89b701 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/e8fbebc0714f082be31b3fa3ebda93ab4d89b701/fortrandoc.py
else: f.writelines([self.begin('desc'), 'Error codes missing.\n', self.end('desc')])
def write_subroutine(self, sub, f): f.writelines([ r'\begin{subroutinedef}{', self.cmd('subroutine', sub.name), '(', self.cmd('sloppy') ]) if sub.parameters: params = ", ".join(map(lambda s: self.cmd('textbf', s), sub.parameters)) f.writelines([params]) f.writelines([')}\n\n'])
e8fbebc0714f082be31b3fa3ebda93ab4d89b701 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/1500/e8fbebc0714f082be31b3fa3ebda93ab4d89b701/fortrandoc.py
assert sum(dist[1:]) == 2
assert sum(dist[1:]) == 2, dist
def test_abundance_dist(self): dist = self.kh.abundance_distribution() assert dist[0] == 4**4 assert sum(dist[1:]) == 0 n = self.kh.consume('AAAA') n = self.kh.consume('AACT') dist = self.kh.abundance_distribution() assert sum(dist[1:]) == 2 assert dist[1] == 2
ec4e41e6b1a2bcd2d2887f22b60662148c31e9ac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/ec4e41e6b1a2bcd2d2887f22b60662148c31e9ac/test_hashtable.py
outfile = infile + '.graphsize2'
outfile = infile + '.graphsize'
def main(): global done, worker_count done = False worker_count = 0 infile = sys.argv[1] outfile = infile + '.graphsize2' print 'creating ht' ht = khmer.new_hashbits(K, HASHTABLE_SIZE, 1) print 'eating fa', infile total_reads, n_consumed = ht.consume_fasta(infile) outfp = open(outfile, 'w') inqueue = Queue.Queue(50) outqueue = Queue.Queue(50) ## worker and writer threads for i in range(WORKER_THREADS): t = threading.Thread(target=process, args=(inqueue, outqueue, ht)) worker_count += 1 t.start() threading.Thread(target=write, args=(outqueue, outfp)).start() ### main thread x = [] i = 0 for n, record in enumerate(screed.fasta.fasta_iter(open(infile))): if n % 10000 == 0: print '...', n x.append(record) i += 1 if i > GROUPSIZE: inqueue.put(x) x = [] i = 0 inqueue.put(x) done = True
760dd0f6dd5be7a30634c9ff505488f45fa9b124 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/760dd0f6dd5be7a30634c9ff505488f45fa9b124/graph-size.py
(a, b, c) = ht.divide_tags_into_subsets(1)
(a, b, _, _, c) = ht.divide_tags_into_subsets(1)
def test_3_merge_013(self): ht = khmer.new_hashbits(20, 4**14+1) filename = os.path.join(thisdir, 'test-graph2.fa')
2c4f9e27acd168e5f22d83058231ab8e29888cdc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/2c4f9e27acd168e5f22d83058231ab8e29888cdc/test_subset_graph.py
(a, b, c) = ht.divide_tags_into_subsets(1)
(a, b, _, _, c) = ht.divide_tags_into_subsets(1)
def test_3_merge_023(self): ht = khmer.new_hashbits(20, 4**14+1) filename = os.path.join(thisdir, 'test-graph2.fa')
2c4f9e27acd168e5f22d83058231ab8e29888cdc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/2c4f9e27acd168e5f22d83058231ab8e29888cdc/test_subset_graph.py
assert len(divvy) == 2 x = ht.do_subset_partition(divvy[0], divvy[1]) ht.merge_subset(x) y = ht.do_subset_partition(divvy[0], 0)
assert len(divvy) == 4 x = ht.do_subset_partition(divvy[0], divvy[2]) ht.merge_subset(x) y = ht.do_subset_partition(divvy[2], 0)
def test_random_20_a_succ(self): ht = khmer.new_hashbits(20, 4**13+1) filename = os.path.join(thisdir, 'test-data/random-20-a.fa') outfile = filename + '.out'
2c4f9e27acd168e5f22d83058231ab8e29888cdc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/2c4f9e27acd168e5f22d83058231ab8e29888cdc/test_subset_graph.py
assert len(divvy) == 2 x = ht.do_subset_partition(divvy[0], divvy[1]) y = ht.do_subset_partition(divvy[1], 0)
assert len(divvy) == 4 x = ht.do_subset_partition(divvy[0], divvy[2]) y = ht.do_subset_partition(divvy[2], 0)
def test_random_20_a_succ_II(self): ht = khmer.new_hashbits(20, 4**13+1) filename = os.path.join(thisdir, 'test-data/random-20-a.fa') outfile = filename + '.out'
2c4f9e27acd168e5f22d83058231ab8e29888cdc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/2c4f9e27acd168e5f22d83058231ab8e29888cdc/test_subset_graph.py
assert len(divvy) == 2, len(divvy) x = ht.do_subset_partition(divvy[0], divvy[1]) y = ht.do_subset_partition(divvy[1], 0)
assert len(divvy) == 4, len(divvy) x = ht.do_subset_partition(divvy[0], divvy[2]) y = ht.do_subset_partition(divvy[2], 0)
def test_random_20_a_succ_III(self): ht = khmer.new_hashbits(20, 4**13+1) filename = os.path.join(thisdir, 'test-data/random-20-a.fa') outfile = filename + '.out'
2c4f9e27acd168e5f22d83058231ab8e29888cdc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/2c4f9e27acd168e5f22d83058231ab8e29888cdc/test_subset_graph.py
(a, b, c) = divvy
print divvy (a, _, b, _, c) = divvy
def test_save_load_merge(self): ht = khmer.new_hashbits(20, 4**14+1) filename = os.path.join(thisdir, 'test-graph2.fa')
2c4f9e27acd168e5f22d83058231ab8e29888cdc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/2c4f9e27acd168e5f22d83058231ab8e29888cdc/test_subset_graph.py
assert n == (103, 1, 0), n
assert n == (102, 1, 0), n
def test_complex6_32_12(self): ht = khmer.new_hashtable(20, 4**12+1)
59baa7d72846b63e34acf7b9cbb7e79b6f89b101 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/59baa7d72846b63e34acf7b9cbb7e79b6f89b101/test_graph.py
assert n == 106, n
assert n == 103, n
def test_complex6_32_12(self): ht = khmer.new_hashtable(20, 4**12+1)
f4261d43b634eec486aea14e928dc1b0bfd8ac4f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/f4261d43b634eec486aea14e928dc1b0bfd8ac4f/test_graph.py
ht = khmer.new_hashtable(K, 1)
ht = khmer.new_hashbits(K, 1, 1)
def main(dir1, dir2, n_threads): # detect all of the relevant partitionmap files subset_filenames = glob.glob(os.path.join(dir1, '*.pmap')) # create empty hashtable structure ht = khmer.new_hashtable(K, 1) # put jobs on queue merge_queue = Queue.Queue() for filename in subset_filenames: merge_queue.put((ht, filename)) print 'starting threads' threads = [] for n in range(n_threads): t = threading.Thread(target=pull_pair, args=(merge_queue,)) threads.append(t) t.start() # wait for threads for t in threads: t.join() # done! if merge_queue.qsize() == 1: ht, merge_file = merge_queue.get() shutil.copy(merge_file, os.path.join(dir2, os.path.basename(merge_file))) assert merge_queue.qsize() == 0
eff72e89775da8c1e9b1e4f775912971d016875f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/eff72e89775da8c1e9b1e4f775912971d016875f/do-subset-merge.py
print 'gorup_d', partition_id, group_n
print 'group_d', partition_id, group_n
def read_partition_file(fp): for n, line in enumerate(fp): if n % 2 == 0: surrendered = False name, partition_id = line[1:].strip().rsplit('\t', 1) if '*' in partition_id: partition_id = int(partition_id[:-1]) surrendered = True else: partition_id = int(partition_id) else: sequence = line.strip() yield name, partition_id, surrendered, sequence
9c6e3737a226aeb71150d38f537718e5a42b42a9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/9c6e3737a226aeb71150d38f537718e5a42b42a9/extract-partitions.py
ht = khmer.new_hashtable(K, 1)
def main(dir1, dir2, n_threads): # detect all of the relevant partitionmap files subset_filenames = glob.glob(os.path.join(dir1, '*.pmap')) # put on queue merge_queue = Queue.Queue() for filename in subset_filenames: merge_queue.put((ht, filename)) print 'starting threads' threads = [] for n in range(n_threads): t = threading.Thread(target=pull_pair, args=(merge_queue,)) threads.append(t) t.start() # wait for threads for t in threads: t.join() # done! if merge_queue.qsize() == 1: ht, merge_file = merge_queue.get() shutil.copy(merge_file, os.path.join(dir2, os.path.basename(merge_file))) assert merge_queue.qsize() == 0
06f7f78df7adf2e4f73d66c405637189118ff6da /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/06f7f78df7adf2e4f73d66c405637189118ff6da/do-subset-merge.py
assert len(divvy) == 2
assert len(divvy) == 2, len(divvy)
def test_random_20_a_succ_III(self): ht = khmer.new_hashbits(20, 4**13+1) filename = os.path.join(thisdir, 'test-data/random-20-a.fa') outfile = filename + '.out'
3749dbc57b09888c4a058f1d60ad190792428f55 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/3749dbc57b09888c4a058f1d60ad190792428f55/test_subset_graph.py
assert n_unassigned == 1, n_unassigned assert n_surrendered == 16, n_surrendered
assert n_unassigned == 2, n_unassigned assert n_surrendered == 15, n_surrendered
def test_surrendered(self): ht = khmer.new_hashtable(32, 4**15+1)
a930b3146550406c86b1b458b15a209289b36960 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/a930b3146550406c86b1b458b15a209289b36960/test_graph.py
name, partition_id = line[1:].strip().split('\t')
name, partition_id = line[1:].strip().rsplit('\t', 1)
def read_partition_file(fp): for n, line in enumerate(fp): if n % 2 == 0: surrendered = False name, partition_id = line[1:].strip().split('\t') if '*' in partition_id: partition_id = int(partition_id[:-1]) surrendered = True else: partition_id = int(partition_id) else: sequence = line.strip() yield name, partition_id, surrendered, sequence
0ea508017a97148ded8da4acf8783b12a7c031a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/0ea508017a97148ded8da4acf8783b12a7c031a4/extract-partitions.py
partition = int(record['name'].split('\t')[1].rstrip('*'))
partition = int(record['name'].rsplit('\t', 1)[1].rstrip('*'))
def read_partition_file(fp): for n, line in enumerate(fp): if n % 2 == 0: surrendered = False name, partition_id = line[1:].strip().split('\t') if '*' in partition_id: partition_id = int(partition_id[:-1]) surrendered = True else: partition_id = int(partition_id) else: sequence = line.strip() yield name, partition_id, surrendered, sequence
0ea508017a97148ded8da4acf8783b12a7c031a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/0ea508017a97148ded8da4acf8783b12a7c031a4/extract-partitions.py
partition = int(record['name'].split('\t')[1].rstrip('*'))
partition = int(record['name'].rsplit('\t', 1)[1].rstrip('*'))
def read_partition_file(fp): for n, line in enumerate(fp): if n % 2 == 0: surrendered = False name, partition_id = line[1:].strip().split('\t') if '*' in partition_id: partition_id = int(partition_id[:-1]) surrendered = True else: partition_id = int(partition_id) else: sequence = line.strip() yield name, partition_id, surrendered, sequence
0ea508017a97148ded8da4acf8783b12a7c031a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/0ea508017a97148ded8da4acf8783b12a7c031a4/extract-partitions.py
del count[0]
if 0 in count: del count[0]
def read_partition_file(fp): for n, line in enumerate(fp): if n % 2 == 0: surrendered = False name, partition_id = line[1:].strip().split('\t') if '*' in partition_id: partition_id = int(partition_id[:-1]) surrendered = True else: partition_id = int(partition_id) else: sequence = line.strip() yield name, partition_id, surrendered, sequence
0ea508017a97148ded8da4acf8783b12a7c031a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/0ea508017a97148ded8da4acf8783b12a7c031a4/extract-partitions.py
def threaded_calc(ht, filename, start, stop): x = ht.do_subset_partition(filename, start, stop)
def threaded_calc(ht, start, stop): x = ht.do_subset_partition(start, stop)
def threaded_calc(ht, filename, start, stop): x = ht.do_subset_partition(filename, start, stop) print 'done!' results.append(x)
cc452556e825fd5344213fdb08dacfe6b19b284a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/cc452556e825fd5344213fdb08dacfe6b19b284a/do-th-subset-calc.py
def threaded_calc(ht, filename, start, stop): x = ht.do_subset_partition(filename, start, stop) print 'done!' results.append(x)
cc452556e825fd5344213fdb08dacfe6b19b284a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/cc452556e825fd5344213fdb08dacfe6b19b284a/do-th-subset-calc.py
for i in range(N_THREADS - 1): start = subset_size * i end = start + subset_size t = threading.Thread(target=threaded_calc, args=(ht, FILENAME, start, end))
for i in range(n_subsets): start = divvy[i] end = divvy[i+1] t = threading.Thread(target=threaded_calc, args=(ht, start, end))
def threaded_calc(ht, filename, start, stop): x = ht.do_subset_partition(filename, start, stop) print 'done!' results.append(x)
cc452556e825fd5344213fdb08dacfe6b19b284a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/cc452556e825fd5344213fdb08dacfe6b19b284a/do-th-subset-calc.py
start = subset_size * (N_THREADS - 1) end = total_reads t = threading.Thread(target=threaded_calc, args=(ht, FILENAME, start, end)) threads.append(t) t.start()
def threaded_calc(ht, filename, start, stop): x = ht.do_subset_partition(filename, start, stop) print 'done!' results.append(x)
cc452556e825fd5344213fdb08dacfe6b19b284a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/cc452556e825fd5344213fdb08dacfe6b19b284a/do-th-subset-calc.py
n = ht.do_partition2(filename, "")
n = ht.do_partition3(filename, "")
def test_simple_20_12(self): ht = khmer.new_hashtable(20, 4**12+1)
7a5d6f6a5188c5b939b268bf28a0d3c801663adb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/7a5d6f6a5188c5b939b268bf28a0d3c801663adb/test_graph.py
n = ht.do_partition2(filename, "")
n = ht.do_partition3(filename, "")
def test_simple_30_12(self): ht = khmer.new_hashtable(32, 4**12+1)
7a5d6f6a5188c5b939b268bf28a0d3c801663adb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/7a5d6f6a5188c5b939b268bf28a0d3c801663adb/test_graph.py
n = ht.do_partition2(filename, "")
n = ht.do_partition3(filename, "")
def test_merge_20_12(self): ht = khmer.new_hashtable(20, 4**12+1)
7a5d6f6a5188c5b939b268bf28a0d3c801663adb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/7a5d6f6a5188c5b939b268bf28a0d3c801663adb/test_graph.py
n = ht.do_partition2(filename, "")
n = ht.do_partition3(filename, "")
def test_merge_32_12(self): ht = khmer.new_hashtable(32, 4**12+1)
7a5d6f6a5188c5b939b268bf28a0d3c801663adb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/7a5d6f6a5188c5b939b268bf28a0d3c801663adb/test_graph.py
n = ht.do_partition2(filename, "")
n = ht.do_partition3(filename, "")
def test_complex_20_12(self): ht = khmer.new_hashtable(20, 4**12+1)
7a5d6f6a5188c5b939b268bf28a0d3c801663adb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/7a5d6f6a5188c5b939b268bf28a0d3c801663adb/test_graph.py
n = ht.do_partition2(filename, "")
n = ht.do_partition3(filename, "")
def test_complex_31_12(self): ht = khmer.new_hashtable(31, 4**12+1)
7a5d6f6a5188c5b939b268bf28a0d3c801663adb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/7a5d6f6a5188c5b939b268bf28a0d3c801663adb/test_graph.py
n = ht.do_partition2(filename, "")
n = ht.do_partition3(filename, "")
def test_complex_32_12(self): ht = khmer.new_hashtable(32, 4**12+1)
7a5d6f6a5188c5b939b268bf28a0d3c801663adb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/7a5d6f6a5188c5b939b268bf28a0d3c801663adb/test_graph.py
basename = os.path.basename(filename)
basename = os.path.basename(filename)
def main(filename): basename = os.path.basename(filename) # populate the hash table and tag set ht.consume_fasta_and_tag(filename, callback)
6445d513aff8a6a3ce836d4610e82cdd8316b62c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/6445d513aff8a6a3ce836d4610e82cdd8316b62c/get-occupancy2.py
ht.consume_fasta_and_tag(filename, callback)
ht.consume_fasta(filename, 0, 0, None, True, callback)
def main(filename): basename = os.path.basename(filename) # populate the hash table and tag set ht.consume_fasta_and_tag(filename, callback)
6445d513aff8a6a3ce836d4610e82cdd8316b62c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/6445d513aff8a6a3ce836d4610e82cdd8316b62c/get-occupancy2.py
main(sys.argv[1])
main(sys.argv[1])
def main(filename): basename = os.path.basename(filename) # populate the hash table and tag set ht.consume_fasta_and_tag(filename, callback)
6445d513aff8a6a3ce836d4610e82cdd8316b62c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11148/6445d513aff8a6a3ce836d4610e82cdd8316b62c/get-occupancy2.py
'size': number_to_human_size(build['size']),
'size': format_byte_size(build['size']),
def update_params(self, d): super(SourceDownloadsWidget, self).update_params(d) sources = [] releases = [] dist_tags = {}
f5b8611e785fc5e833d2b257dd05231893aa71b5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12732/f5b8611e785fc5e833d2b257dd05231893aa71b5/downloads.py
redirect('/', anchor='/'.join(args), params=kwds)
url = pylons.url('/', anchor='/'.join(args), **kwds) if url.startswith('/community'): url = url[10:] redirect(url)
def default(self, *args, **kwds): identity = request.environ.get('repoze.who.identity') if identity: csrf = identity.get('_csrf_token') if csrf: kwds['_csrf_token'] = csrf
76e5e8ed78d05720ee24cf4589e1336defca0abe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12732/76e5e8ed78d05720ee24cf4589e1336defca0abe/root.py
def default(self, *args, **kwds):
def _default(self, *args, **kwds):
def default(self, *args, **kwds): identity = request.environ.get('repoze.who.identity') if identity: csrf = identity.get('_csrf_token') if csrf: kwds['_csrf_token'] = csrf
0ebabdf2fee62deeb3ba63418f6fbd22f93c08dd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12732/0ebabdf2fee62deeb3ba63418f6fbd22f93c08dd/root.py
url = pylons.url('/', anchor='/'.join(args), **kwds) if url.startswith('/community'): url = url[10:]
anchor='/'.join(args) if anchor: kwds['anchor'] = anchor
def default(self, *args, **kwds): identity = request.environ.get('repoze.who.identity') if identity: csrf = identity.get('_csrf_token') if csrf: kwds['_csrf_token'] = csrf
0ebabdf2fee62deeb3ba63418f6fbd22f93c08dd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12732/0ebabdf2fee62deeb3ba63418f6fbd22f93c08dd/root.py
redirect(url)
redirect(url, **kwds)
def default(self, *args, **kwds): identity = request.environ.get('repoze.who.identity') if identity: csrf = identity.get('_csrf_token') if csrf: kwds['_csrf_token'] = csrf
0ebabdf2fee62deeb3ba63418f6fbd22f93c08dd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12732/0ebabdf2fee62deeb3ba63418f6fbd22f93c08dd/root.py
def changed_saved(self, current, previous): if current is None:
def changed_saved(self): items = self.saved_items.selectedItems() if len(items) == 0:
def changed_saved(self, current, previous): if current is None: return d = current.data(QtCore.Qt.UserRole).toMap() username = d[QtCore.QString('username')].toString() password = d[QtCore.QString('password')].toString() host = d[QtCore.QString('host')].toString() port = d[QtCore.QString('port')].toString() self.username_edit.setText(username) self.password_edit.setText(password) self.host_edit.setText(host) self.port_edit.setText(port)
8ff643f3c3cc95b3308c8ec93abb975815ecf8cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/8ff643f3c3cc95b3308c8ec93abb975815ecf8cc/pytty.py
print item.text()
def remove_entry(self): items = self.saved_items.selectedItems() for item in items: print item.text() config = SafeConfig(os.path.join(sys.path[0], 'saved.ini')) config.remove_section(str(item.text())) config.write() self.load_saved_items()
8ff643f3c3cc95b3308c8ec93abb975815ecf8cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/8ff643f3c3cc95b3308c8ec93abb975815ecf8cc/pytty.py
self.host_edit.textChanged.connect(self.clear_saved_selection)
self.host_edit.textEdited.connect(self.clear_saved_selection)
def show_connection_page(self): page_hlayout = QtGui.QHBoxLayout() page_vlayout = QtGui.QVBoxLayout() page_layout = QtGui.QGridLayout() new_group = QtGui.QGroupBox("New Connection") layout = QtGui.QFormLayout()
8ff643f3c3cc95b3308c8ec93abb975815ecf8cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/8ff643f3c3cc95b3308c8ec93abb975815ecf8cc/pytty.py
self.port_edit.textChanged.connect(self.clear_saved_selection)
self.port_edit.textEdited.connect(self.clear_saved_selection)
def show_connection_page(self): page_hlayout = QtGui.QHBoxLayout() page_vlayout = QtGui.QVBoxLayout() page_layout = QtGui.QGridLayout() new_group = QtGui.QGroupBox("New Connection") layout = QtGui.QFormLayout()
8ff643f3c3cc95b3308c8ec93abb975815ecf8cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/8ff643f3c3cc95b3308c8ec93abb975815ecf8cc/pytty.py
self.username_edit.textChanged.connect(self.clear_saved_selection)
self.username_edit.textEdited.connect(self.clear_saved_selection)
def show_connection_page(self): page_hlayout = QtGui.QHBoxLayout() page_vlayout = QtGui.QVBoxLayout() page_layout = QtGui.QGridLayout() new_group = QtGui.QGroupBox("New Connection") layout = QtGui.QFormLayout()
8ff643f3c3cc95b3308c8ec93abb975815ecf8cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/8ff643f3c3cc95b3308c8ec93abb975815ecf8cc/pytty.py
self.password_edit.textChanged.connect(self.clear_saved_selection)
self.password_edit.textEdited.connect(self.clear_saved_selection)
def show_connection_page(self): page_hlayout = QtGui.QHBoxLayout() page_vlayout = QtGui.QVBoxLayout() page_layout = QtGui.QGridLayout() new_group = QtGui.QGroupBox("New Connection") layout = QtGui.QFormLayout()
8ff643f3c3cc95b3308c8ec93abb975815ecf8cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/8ff643f3c3cc95b3308c8ec93abb975815ecf8cc/pytty.py
self.saved_items.currentItemChanged.connect(self.changed_saved)
self.saved_items.itemSelectionChanged.connect(self.changed_saved) self.saved_items.itemDoubleClicked.connect(self.connect)
def show_connection_page(self): page_hlayout = QtGui.QHBoxLayout() page_vlayout = QtGui.QVBoxLayout() page_layout = QtGui.QGridLayout() new_group = QtGui.QGroupBox("New Connection") layout = QtGui.QFormLayout()
8ff643f3c3cc95b3308c8ec93abb975815ecf8cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/8ff643f3c3cc95b3308c8ec93abb975815ecf8cc/pytty.py
def __init__(self, terminal):
def __init__(self, terminal, index):
def __init__(self, terminal): QtCore.QThread.__init__(self) self.terminal = terminal
8ff643f3c3cc95b3308c8ec93abb975815ecf8cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/8ff643f3c3cc95b3308c8ec93abb975815ecf8cc/pytty.py
th = ConnectionThread(term)
th = ConnectionThread(term, idx)
def run(self): self.terminal.connect()
8ff643f3c3cc95b3308c8ec93abb975815ecf8cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/8ff643f3c3cc95b3308c8ec93abb975815ecf8cc/pytty.py
def connection_finished(): term = th.terminal if term.channel.is_connected(): self.tabs.removeTab(idx) self.tabs.add_new_tab(term, index=idx) else: if term.channel.authentication_error: self.status_label.setText("Authentication Error.") else: self.status_label.setText("Unable to connect.") self.login_button.setDisabled(False) del term self.connection_threads.remove(th)
8ff643f3c3cc95b3308c8ec93abb975815ecf8cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/8ff643f3c3cc95b3308c8ec93abb975815ecf8cc/pytty.py
def connection_finished(): term = th.terminal if term.channel.is_connected(): self.tabs.removeTab(idx) self.tabs.add_new_tab(term, index=idx) else: if term.channel.authentication_error: self.status_label.setText("Authentication Error.") else: self.status_label.setText("Unable to connect.") self.login_button.setDisabled(False) del term self.connection_threads.remove(th)
8ff643f3c3cc95b3308c8ec93abb975815ecf8cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/8ff643f3c3cc95b3308c8ec93abb975815ecf8cc/pytty.py
if widget == sender:
if widget == sender:
def close_tab(self): sender = self.sender() for idx in range(0, self.tabs.count()): widget = self.tabs.widget(idx) if widget == sender: #or widget is None: self.tabs.close_tab(idx)
8ff643f3c3cc95b3308c8ec93abb975815ecf8cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/8ff643f3c3cc95b3308c8ec93abb975815ecf8cc/pytty.py
scroll_bottom = self.get_scroll_bottom() - 1
scroll_top = self.get_scroll_top() scroll_bottom = self.get_scroll_bottom()
def insert_row(self, num=1): buf = self.get_buffer() (row, col) = self.cursor.get_row_col() new_rows = [TerminalRow(self.width, self) for x in range(0, num)] buf.insert(row, '') buf[row:row + 1] = new_rows self.log.debug("Inserted %s row(s): %s" % (num, len(buf)))
eb395ad9a2761db0588f1339c232928c3c2e4c94 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/eb395ad9a2761db0588f1339c232928c3c2e4c94/terminal.py
self.parent.set_dirty()
repaint_buf = buf[scroll_top - 1:scroll_bottom - 1] for row in repaint_buf: row.set_dirty()
def insert_row(self, num=1): buf = self.get_buffer() (row, col) = self.cursor.get_row_col() new_rows = [TerminalRow(self.width, self) for x in range(0, num)] buf.insert(row, '') buf[row:row + 1] = new_rows self.log.debug("Inserted %s row(s): %s" % (num, len(buf)))
eb395ad9a2761db0588f1339c232928c3c2e4c94 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/eb395ad9a2761db0588f1339c232928c3c2e4c94/terminal.py
for cnt in range(0, times): row = buf.pop(scroll_top - 1) row.reset() buf.insert(scroll_bottom - 1, row) self.parent.set_dirty() self.print_debug() return
first = scroll_top - 1 last = scroll_bottom - 1 rows = [TerminalRow(self.width, self) for x in range(0, times)] del buf[first:first + times] buf.insert(last, '') buf[last:last + 1] = rows repaint_buf = buf[first:last] for row in repaint_buf: row.set_dirty() return
def scroll(self, times=1): self.log.debug("screen scroll") if self.alternate_active: scroll_top = self.get_scroll_top() scroll_bottom = self.get_scroll_bottom() buf = self.get_buffer() for cnt in range(0, times): row = buf.pop(scroll_top - 1) row.reset() buf.insert(scroll_bottom - 1, row) self.parent.set_dirty() self.print_debug() return self.base += times self.log.debug("Scrolling screen buffer, base = %s, row = %s" % (self.base, self.cursor.row)) #if (self.base + self.height) - 1 >= self.scrollback: if (self.base - times) >= self.scrollback: self.log.debug("Scrollback exceeded...rolling over buffer.") self.base -= times for cnt in range(0, times): row = self.buffer.pop(0) row.reset() self.buffer.append(row) self.parent.set_dirty() self.parent.set_scroll_value(self.base)
eb395ad9a2761db0588f1339c232928c3c2e4c94 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/eb395ad9a2761db0588f1339c232928c3c2e4c94/terminal.py
def scroll(self, times=1): self.log.debug("screen scroll") if self.alternate_active: scroll_top = self.get_scroll_top() scroll_bottom = self.get_scroll_bottom() buf = self.get_buffer() for cnt in range(0, times): row = buf.pop(scroll_top - 1) row.reset() buf.insert(scroll_bottom - 1, row) self.parent.set_dirty() self.print_debug() return self.base += times self.log.debug("Scrolling screen buffer, base = %s, row = %s" % (self.base, self.cursor.row)) #if (self.base + self.height) - 1 >= self.scrollback: if (self.base - times) >= self.scrollback: self.log.debug("Scrollback exceeded...rolling over buffer.") self.base -= times for cnt in range(0, times): row = self.buffer.pop(0) row.reset() self.buffer.append(row) self.parent.set_dirty() self.parent.set_scroll_value(self.base)
eb395ad9a2761db0588f1339c232928c3c2e4c94 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13269/eb395ad9a2761db0588f1339c232928c3c2e4c94/terminal.py
try: interface = autobus.lookup_interface(message["interface_name"]) function = interface.lookup_function(message["function"])
interface_name = message["interface_name"] function_name = message["function"] print ("Attempting to dispatch function call from " + sender + " to interface " + interface_name + " and function " + function_name) try: interface = autobus.lookup_interface(interface_name) function = interface.lookup_function(function_name)
def process_call_function_command(message, sender, connection): try: interface = autobus.lookup_interface(message["interface_name"]) function = interface.lookup_function(message["function"]) except (autobus.NoSuchInterfaceException, autobus.NoSuchFunctionException) as e: connection.send_error(message, text=str(e)) return if function.special: function.invoke_special(message, connection) return invoke_message = create_message(RunFunctionCommand, interface_name=interface.name, function=function.name, arguments=message["arguments"]) interface.connection.send(invoke_message) print ("Sending run command to " + str(interface.connection.id) + " with message id " + str(invoke_message["message_id"]) + " whose response is to be forwarded with id " + str(message["message_id"])) # FIXME: This causes a response to a function invocation sent as a notification # to still be sent when the function returns on the remote side. We need to # somehow not add the message to this list and perhaps suppress the "sporadic # message received" warning that would consequently be printed to stdout once # the remote client sends back the return value if the incoming message here # is a notification. interface.connection.pending_responses[invoke_message["message_id"]] = ( sender, message["message_id"])
ff95f68e1a52ea6b848a35ec23a0adb8dc995aaa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/ff95f68e1a52ea6b848a35ec23a0adb8dc995aaa/processors.py
repeat = (address == last_plc_address and (last_plc_time + PLC_DELAY) > now)
repeat = (last_plc_time + PLC_DELAY) > now
def do_GET(self): global last_plc_time global last_plc_address global last_rf_time global last_rf_address path = self.path if "?" not in path: # Serve the script page print "Serving script page for url " + path self.send_response(200) self.send_header("Content-Type", "text/html") self.end_headers() with open("src/activehomed/receive_ie.html") as file: for line in file: self.wfile.write(line + " ") else: # Incoming event from the script page print "Inbound event for url " + path params = dict(parse_qsl(path.split("?")[1], True)) mode, address, command, sequence, timestamp, _, _ = (params["a"], params["b"], params["c"], params["d"], params["e"], params["f"], params["g"]) receive_action_event(mode, address, command, sequence, timestamp) repeat = False if mode.startswith("send") or mode.startswith("recv"): mode = mode[4:] now = time() if mode == "plc": repeat = (address == last_plc_address and (last_plc_time + PLC_DELAY) > now) last_plc_time = now last_plc_address = address elif mode == "rf": repeat = (address == last_rf_address and (last_rf_time + RF_DELAY) > now) last_rf_time = now last_rf_address = address house, unit = address[0], address[1:] if sequence == "": sequence = None else: try: sequence = int(sequence) except ValueError: print ("WARNING: Sequence number " + str(sequence) + " couldn't be converted to an integer.") if timestamp == "": timestamp = None receive_event(mode, house, unit, address, command, sequence, timestamp, repeat) self.send_response(200) self.send_header("Content-Type", "text/plain") self.end_headers() self.wfile.write("ok")
0308ccc9978cf272a44d7ebe62b4ac6d2f63e867 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/0308ccc9978cf272a44d7ebe62b4ac6d2f63e867/__init__.py
last_plc_address = address
def do_GET(self): global last_plc_time global last_plc_address global last_rf_time global last_rf_address path = self.path if "?" not in path: # Serve the script page print "Serving script page for url " + path self.send_response(200) self.send_header("Content-Type", "text/html") self.end_headers() with open("src/activehomed/receive_ie.html") as file: for line in file: self.wfile.write(line + " ") else: # Incoming event from the script page print "Inbound event for url " + path params = dict(parse_qsl(path.split("?")[1], True)) mode, address, command, sequence, timestamp, _, _ = (params["a"], params["b"], params["c"], params["d"], params["e"], params["f"], params["g"]) receive_action_event(mode, address, command, sequence, timestamp) repeat = False if mode.startswith("send") or mode.startswith("recv"): mode = mode[4:] now = time() if mode == "plc": repeat = (address == last_plc_address and (last_plc_time + PLC_DELAY) > now) last_plc_time = now last_plc_address = address elif mode == "rf": repeat = (address == last_rf_address and (last_rf_time + RF_DELAY) > now) last_rf_time = now last_rf_address = address house, unit = address[0], address[1:] if sequence == "": sequence = None else: try: sequence = int(sequence) except ValueError: print ("WARNING: Sequence number " + str(sequence) + " couldn't be converted to an integer.") if timestamp == "": timestamp = None receive_event(mode, house, unit, address, command, sequence, timestamp, repeat) self.send_response(200) self.send_header("Content-Type", "text/plain") self.end_headers() self.wfile.write("ok")
0308ccc9978cf272a44d7ebe62b4ac6d2f63e867 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/0308ccc9978cf272a44d7ebe62b4ac6d2f63e867/__init__.py
function(*args, **kwargs)
return function(*args, **kwargs)
def wrapper(*args, **kwargs): with lock: function(*args, **kwargs)
8a882154224fd12aa063fe17ed18d4ccffcfc10e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/8a882154224fd12aa063fe17ed18d4ccffcfc10e/concurrent.py
return "objects.path like ? escape ?", [self.path.replace("/", "//") + "///%", "/"]
return "objects.path like ? escape ?", [self.path.replace("/", "//") .replace("%", "/%") .replace("_", "/_") + "//%", "/"]
def sql(self): return "objects.path like ? escape ?", [self.path.replace("/", "//") + "///%", "/"]
cbc2de45c0d427f59cfb660ab20c87fe943faec0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/cbc2de45c0d427f59cfb660ab20c87fe943faec0/query.py
raise ResponseException("You can't add an empty quote")
raise FactoidException("You can't add an empty quote")
def addquote(sink, arguments, context): """ Syntax: {addquote|<group>|<quote>} -- Adds a new quote to the specified group. This function then evaluates to the number that the new quote was assigned. Numbering starts at 1 for blank groups. Groups must already be present in the quote system configuration before quotes can be added to them; see ~config global quote. If the specified quote is empty, a ResponseException will be thrown. """ quotegroup = arguments.resolveString(0) quotetext = arguments.resolveString(1) if quotetext.strip() == "": raise ResponseException("You can't add an empty quote") with quote_lock: if not quotegroup in Configuration.getText(None, "quote/groupnames").split(" "): raise FactoidException("The group " + quotegroup + " does not exist.") next_id_result = execute("select nextquote from quotesequence where " "quotegroup = ?", [quotegroup]).fetchone() if next_id_result is None: next_id_result = 0 execute_commit("insert into quotesequence values (?, 0)", [quotegroup]) else: next_id_result = next_id_result[0] next_id_result += 1 execute_commit("update quotesequence set nextquote = ? where quotegroup = ?", [next_id_result, quotegroup]) execute_commit("insert into quotes values(?, ?, ?, ?)", [quotegroup, next_id_result, quotetext, False]) add_quote_info(quotegroup, next_id_result, nick=context.getSender().getNick(), user=context.getSender().getUsername(), host=context.getSender().getHostname(), server=context.getSender().getServerName(), scope=context.getCanonicalName(), date=str(currentTimeMillis())) sink.write(next_id_result)
0acdf72276645fd4a862601e936ea9513434c9dd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/0acdf72276645fd4a862601e936ea9513434c9dd/quote.py
<%s@%s> from %s on <font color="
&lt;%s@%s&gt; from %s on <font color="
def do_GET(self): path = self.path path_components = path[1:].split("/") if len(path_components) == 1 and path_components[0] == "": path_components = [] if len(path_components) > 0 and path_components[-1] == "": path_components = path_components[:-1] if len(path_components) == 0: self.send_response(200) self.send_header("Content-type", "text/html") self.end_headers() self.wfile.write(""" <html><body><b>Group listing is not supported right now.</b> It will be supported at some time in the future. </body></html> """) return elif len(path_components) == 1: # Group listing with quote_lock: quotenumbers = search_quotes(path_components[0], "") # TODO: we need to add paging at some point quotedata = [get_quote_data(path_components[0], quotenumber) for quotenumber in quotenumbers] self.send_response(200) self.send_header("Content-type", "text/html") self.end_headers() self.wfile.write(""" <html><body><h2>%s</h2><br/> """ % path_components[0]) for quotetext, quoteinfo in quotedata: self.wfile.write(""" %s<br/> <small><font color="#707070">Added by <font color="#008c00"><b>%s</b></font> <%s@%s> from %s on <font color="#0055bb"><b>%s</b></font> at %s</font></small><br/><br/> """ % (escapeHtml(quotetext), escapeHtml(quoteinfo["nick"]), escapeHtml(quoteinfo["user"]), escapeHtml(quoteinfo["host"]), escapeHtml(quoteinfo["server"]), escapeHtml(Date(long(quoteinfo["date"])).toString()), escapeHtml(quoteinfo["scope"]))) self.wfile.write(""" </body></html> """) return # OLD STUFF self.send_response(200) self.send_header("Content-type", "text/plain") self.end_headers() self.wfile.write("The path is " + self.path)
2a0da4602619ff2bc353adbb74f3b555b537c418 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/2a0da4602619ff2bc353adbb74f3b555b537c418/quote.py
display_type = client.propget("svnweb:display", path).values[0]
display_type = client.propget("svnweb:display", path).values()[0]
def do_GET(self): path = self.path if ".." in path: raise Exception("Path can't contain two dots in a row") print "Initial path: " + path if path == "": path = "/" if path[0] != "/": raise Exception("Path doesn't start with a forward slash. It's " + path) path = root_path + path print "Getting result for path " + path try: result = client.cat(path) except: print "Result not there; trying index.html under it" if path[-1] != "/": path += "/" path += "index.html" try: result = client.cat(path) except: print "Couldn't find index.html either" print_exc() result = None if result == None: self.send_response(404) self.send_header("Content-Type", "text/html") self.no_cache() self.end_headers() self.wfile.write(error_response) return print "Got it! Propgetting..." # We have the file. Now we go figure out if we're supposed to use an # alternate displayer. try: display_type = client.propget("svnweb:display", path).values[0] except: display_type = None print "svnweb:display is " + str(display_type) if display_type == "mediawiki": print "Forwarding to mediawiki renderer" mime_type, result = display_mediawiki(self, path, result) else: print "No known renderer set with svnweb:display, displaying directly" try: mime_type = client.propget("svn:mime-type", path).values[0] except: print "Couldn't propget, looking up dynamically" mime_type, _ = mimetypes.guess_type(path) if mime_type is None: print "Dynamic lookup didn't find anything. Using text/plain." mime_type = "text/plain" print "Mime type is " + mime_type self.send_response(200) print "Response sent" if mime_type != None: print "Sending mime type" self.send_header("Content-Type", mime_type) print "Sending no-cache headers" self.no_cache() print "Ending headers" self.end_headers() print "Writing..." self.wfile.write(result) print "Output sent!" # That's it!
dbae861019ffa7731e99a234c0c50395de1dad92 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/dbae861019ffa7731e99a234c0c50395de1dad92/svnweb.py
mime_type = client.propget("svn:mime-type", path).values[0]
mime_type = client.propget("svn:mime-type", path).values()[0]
def do_GET(self): path = self.path if ".." in path: raise Exception("Path can't contain two dots in a row") print "Initial path: " + path if path == "": path = "/" if path[0] != "/": raise Exception("Path doesn't start with a forward slash. It's " + path) path = root_path + path print "Getting result for path " + path try: result = client.cat(path) except: print "Result not there; trying index.html under it" if path[-1] != "/": path += "/" path += "index.html" try: result = client.cat(path) except: print "Couldn't find index.html either" print_exc() result = None if result == None: self.send_response(404) self.send_header("Content-Type", "text/html") self.no_cache() self.end_headers() self.wfile.write(error_response) return print "Got it! Propgetting..." # We have the file. Now we go figure out if we're supposed to use an # alternate displayer. try: display_type = client.propget("svnweb:display", path).values[0] except: display_type = None print "svnweb:display is " + str(display_type) if display_type == "mediawiki": print "Forwarding to mediawiki renderer" mime_type, result = display_mediawiki(self, path, result) else: print "No known renderer set with svnweb:display, displaying directly" try: mime_type = client.propget("svn:mime-type", path).values[0] except: print "Couldn't propget, looking up dynamically" mime_type, _ = mimetypes.guess_type(path) if mime_type is None: print "Dynamic lookup didn't find anything. Using text/plain." mime_type = "text/plain" print "Mime type is " + mime_type self.send_response(200) print "Response sent" if mime_type != None: print "Sending mime type" self.send_header("Content-Type", mime_type) print "Sending no-cache headers" self.no_cache() print "Ending headers" self.end_headers() print "Writing..." self.wfile.write(result) print "Output sent!" # That's it!
dbae861019ffa7731e99a234c0c50395de1dad92 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/dbae861019ffa7731e99a234c0c50395de1dad92/svnweb.py
to them; see ~config global quote. """ with quote_lock: quotegroup = arguments.resolveString(0) quotetext = arguments.resolveString(1)
to them; see ~config global quote. If the specified quote is empty, a ResponseException will be thrown. """ quotegroup = arguments.resolveString(0) quotetext = arguments.resolveString(1) if quotetext.strip() == "": raise ResponseException("You can't add an empty quote") with quote_lock:
def addquote(sink, arguments, context): """ Syntax: {addquote|<group>|<quote>} -- Adds a new quote to the specified group. This function then evaluates to the number that the new quote was assigned. Numbering starts at 1 for blank groups. Groups must already be present in the quote system configuration before quotes can be added to them; see ~config global quote. """ with quote_lock: quotegroup = arguments.resolveString(0) quotetext = arguments.resolveString(1) if not quotegroup in Configuration.getText(None, "quote/groupnames").split(" "): raise FactoidException("The group " + quotegroup + " does not exist.") next_id_result = execute("select nextquote from quotesequence where " "quotegroup = ?", [quotegroup]).fetchone() if next_id_result is None: next_id_result = 0 execute_commit("insert into quotesequence values (?, 0)", [quotegroup]) else: next_id_result = next_id_result[0] next_id_result += 1 execute_commit("update quotesequence set nextquote = ? where quotegroup = ?", [next_id_result, quotegroup]) execute_commit("insert into quotes values(?, ?, ?, ?)", [quotegroup, next_id_result, quotetext, False]) add_quote_info(quotegroup, next_id_result, nick=context.getSender().getNick(), user=context.getSender().getUsername(), host=context.getSender().getHostname(), server=context.getSender().getServerName(), scope=context.getCanonicalName(), date=str(currentTimeMillis())) sink.write(next_id_result)
07756206b5c131fba5ccbce012a0d3354258af2d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/07756206b5c131fba5ccbce012a0d3354258af2d/quote.py
and self.db is other.db)
and self.db is other.db and self.operation_list is other.operation_list)
def __eq__(self, other): return (isinstance(other, Changeset) and self.path == other.path and self.db is other.db)
db61fa0c7b951f4aa93ab2ac3541caee9c9ae6d0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/db61fa0c7b951f4aa93ab2ac3541caee9c9ae6d0/changeset.py
bus = AutobusConnection(host, port, print_exceptions=True) bus.add_interface(interface_name, RPC()) speech_queue_object = bus.add_object(interface_name, "speech_queue", """ This doesn't work yet. """, {}) bus.start_connecting()
def time_format_weekday_month_day(self, time): """ Returns time_format_weekday(time) + " " + time_format_month_day(time) """ return (self.time_format_weekday(time) + " " + self.time_format_month_day(time))
f91ea5a996e0f948cfac5211b773083210239180 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/f91ea5a996e0f948cfac5211b773083210239180/speakd.py
print "" print "Speakd has successfully started up. PID is " + str(os.getpid()) try: while not is_shutting_down: sentence_tuple = get_next_sentence() if sentence_tuple is None: time.sleep(0.5) continue priority, sentence = sentence_tuple print "Something to say: " + str(sentence.components) if sentence.voice is not None: voice = voices[sentence.voice] else: voice = voices[default_voice] voice_path = voice.path print "Saying with voice " + voice.name audio_stream.start_stream() for item in sentence.components: if isinstance(item, basestring): file = sanitize_file(item) print "Saying word " + file try: wave_file = wave.open(os.path.join(voice_path, file + ".wav"), "r") except: print "File " + file + " does not exist for voice " + voice.name + ". It will be silently ignored." continue data = wave_file.readframes(1024) while data != "": audio_stream.write(data)
print "Opening audio device..." def main(): global audio_device global autio_stream global bus global speech_queue_object audio_device = pyaudio.PyAudio() audio_stream = audio_device.open(format=audio_device.get_format_from_width(2), channels=1, rate=44100, output=True, frames_per_buffer=1024) audio_stream.stop_stream() bus = AutobusConnection(host, port, print_exceptions=True) bus.add_interface(interface_name, RPC()) speech_queue_object = bus.add_object(interface_name, "speech_queue", """ This doesn't work yet. """, {}) bus.start_connecting() print "" print "Speakd has successfully started up. PID is " + str(os.getpid()) try: while not is_shutting_down: sentence_tuple = get_next_sentence() if sentence_tuple is None: time.sleep(0.5) continue priority, sentence = sentence_tuple print "Something to say: " + str(sentence.components) if sentence.voice is not None: voice = voices[sentence.voice] else: voice = voices[default_voice] voice_path = voice.path print "Saying with voice " + voice.name audio_stream.start_stream() for item in sentence.components: if isinstance(item, basestring): file = sanitize_file(item) print "Saying word " + file try: wave_file = wave.open(os.path.join(voice_path, file + ".wav"), "r") except: print "File " + file + " does not exist for voice " + voice.name + ". It will be silently ignored." continue
def sanitize_file(name): return name.replace(".", "").replace("\\", "").replace("/", "")
f91ea5a996e0f948cfac5211b773083210239180 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/f91ea5a996e0f948cfac5211b773083210239180/speakd.py
elif isinstance(item, int): print "Pausing for " + str(item) + " milliseconds" time.sleep((item * 1.0) / 1000.0) print "Flushing bus outbound queue" bus.flush() print "Waiting..." time.sleep(1) print "Closing audio stream" audio_stream.stop_stream() print "Done." except KeyboardInterrupt: print "Interrupted, shutting down" bus.shutdown()
while data != "": audio_stream.write(data) data = wave_file.readframes(1024) elif isinstance(item, int): print "Pausing for " + str(item) + " milliseconds" time.sleep((item * 1.0) / 1000.0) print "Flushing bus outbound queue" bus.flush() print "Waiting..." time.sleep(1) print "Closing audio stream" audio_stream.stop_stream() print "Done." except KeyboardInterrupt: print "Interrupted, shutting down" bus.shutdown()
def sanitize_file(name): return name.replace(".", "").replace("\\", "").replace("/", "")
f91ea5a996e0f948cfac5211b773083210239180 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/f91ea5a996e0f948cfac5211b773083210239180/speakd.py
if self.receive_queues is None:
if self.receive_queues is None or self.input_thread is None:
def query(self, message, timeout=30): """ Sends the specified message from the server, waiting up to the specified timeout for a response. When a response is received, it is returned. If a response is not received within the specified amount of time, a TimeoutException will be raised. Otherwise, the response sent by the server will be returned. """ queue = Queue() if self.receive_queues is None: raise NotConnectedException() self.receive_queues[message["message_id"]] = queue self.send(message) try: response = queue.get(block=True, timeout=timeout) except Empty: try: del self.receive_queues[message["message_id"]] except KeyError: pass raise TimeoutException() # If we don't get a KeyError, it's guaranteed that the input thread # will already have removed the queue, so we don't need to worry about # removing it. return response
9815ea9bfd6504e0869e3a54189808ac56697ec1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/9815ea9bfd6504e0869e3a54189808ac56697ec1/__init__.py
return PrefixFilter("not", SQLFilter(*self.get_filter_sql()))
query = Query(self.db) query.filters.append(PrefixFilter("not", SQLFilter(*self.get_filter_sql()))) return query
def inverse(self): """ Returns a new query that selects objects only if they would not be selected by this query. If you only want to invert a small part of the overall query, you can do that by constructing everything else in your query, creating a separate query, filtering it by the part you want to invert, inverting it, and then using the & operator to get a new query that only inverts the one query. """ return PrefixFilter("not", SQLFilter(*self.get_filter_sql()))
c03ba0e338c1ff71bd738b67f82151436981a77b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/c03ba0e338c1ff71bd738b67f82151436981a77b/query.py
except KeyError:
except (KeyError, IndexError):
def foreign_get(object, item): if object is None or object is Null: return None try: return foreign_translate(object[item]) except KeyError: return None
4068f0f2fa9389a194fc3c499922fa6c41cd1e8c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8199/4068f0f2fa9389a194fc3c499922fa6c41cd1e8c/libfact.py
print "Usage: ./cmeansMultiGPU.py INPUT_FILE NUM_CLUSTERS [THRESHOLD=0.0001] [MIN_ITERS=0] [MAX_ITERS=100] [DEVICE=0] [FUZZINESS=2] [DISTANCE_MEASURE=0] [K1=1.0] [K2=0.01] [K3=1.5] [MEMBER_THRESHOLD=0.05] [TABU_ITER=100] [TABU_TENURE=5] [MDL=0] [CPU_ONLY=0]"
print "Usage: ./cmeansMultiGPU.py INPUT_FILE NUM_CLUSTERS [THRESHOLD=0.0001] [MIN_ITERS=0] [MAX_ITERS=100] [DEVICE=0] [FUZZINESS=2] [DISTANCE_MEASURE=0] [K1=1.0] [K2=0.01] [K3=1.5] [MEMBER_THRESHOLD=0.05] [TABU_ITER=100] [TABU_TENURE=5] [MDL=0] [CPU_ONLY=0] [TRUNCATE=1] [RANDOM_SEED=1]"
def usage(): print "Usage: ./cmeansMultiGPU.py INPUT_FILE NUM_CLUSTERS [THRESHOLD=0.0001] [MIN_ITERS=0] [MAX_ITERS=100] [DEVICE=0] [FUZZINESS=2] [DISTANCE_MEASURE=0] [K1=1.0] [K2=0.01] [K3=1.5] [MEMBER_THRESHOLD=0.05] [TABU_ITER=100] [TABU_TENURE=5] [MDL=0] [CPU_ONLY=0]" print print " INPUT_FILE and NUM_CLUSTERS are required." print " The rest of the parameters can be specified in NAME=VALUE form" print " Alternatively, the parameters can be provided positionally if all are provided"
7ef63f0d6acaed783b4943ead1066c04c97005ad /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11171/7ef63f0d6acaed783b4943ead1066c04c97005ad/cmeansMultiGPU.py
if key in ['K1','K2','K3','MEMBER_THRESHOLD','THRESHOLD']:
if key in ['K1','K2','K3','MEMBER_THRESHOLD','THRESHOLD','FUZZINESS']:
def parseInputArgs(): args = sys.argv num_args = len(args) params = { 'INPUT_FILE' : '', 'NUM_CLUSTERS' : 0, 'THRESHOLD' : 0.0001, 'MIN_ITERS' : 0, 'MAX_ITERS' : 100, 'DEVICE' : 0, 'FUZZINESS' : 2, 'DISTANCE_MEASURE': 0, 'K1': 1.0, 'K2': 0.01, 'K3': 1.5, 'MEMBER_THRESHOLD': 0.05, 'TABU_ITER': 100, 'TABU_TENURE': 5, 'MDL': 0, 'CPU_ONLY': 0, } num_params = len(params.keys()) if num_args == num_params: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] params['THRESHOLD'] = args[3] params['MIN_ITERS'] = args[4] params['MAX_ITERS'] = args[5] params['DEVICE'] = args[6] params['FUZZINESS'] = args[7] params['DISTANCE_MEASURE'] = args[8] params['K1'] = args[9] params['K2'] = args[10] params['K3'] = args[11] params['MEMBER_THRESHOLD'] = args[12] params['TABU_ITER'] = args[13] params['TABU_TENURE'] = args[14] params['MDL'] = args[15] params['CPU_ONLY'] = args[16] elif num_args == 3: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] elif 3 < num_args < num_params: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] for arg in args[3:]: try: key,val = arg.split("=") key = key.upper() assert key in params.keys() if key in ['K1','K2','K3','MEMBER_THRESHOLD','THRESHOLD']: params[key] = float(val) else: params[key] = int(val) except AssertionError: print "Error: Found invalid parameter '%s'" % key except ValueError: print "Error: Invalid value '%s' for parameter '%s'" % (val,key) print usage() sys.exit(1) else: print "Invalid command line arguments." print usage() sys.exit(1) if os.path.exists(params['INPUT_FILE']): if params['INPUT_FILE'].lower().endswith(".bin"): input = open(params['INPUT_FILE'],'rb') import struct params['NUM_EVENTS'] = struct.unpack('i',input.read(4))[0] params['NUM_DIMENSIONS'] = struct.unpack('i',input.read(4))[0] else: input = open(params['INPUT_FILE']) line = input.readline() # Read the header line num_dimensions = len(line.split(DELIMITER)) num_events = 0 for line in input: num_events += 1 params['NUM_DIMENSIONS'] = num_dimensions params['NUM_EVENTS'] = num_events params['NUM_EVENTS'] -= params['NUM_EVENTS'] % 16 print "%d events removed to ensure memory alignment" % (params['NUM_EVENTS'] % 16) else: print "Invalid input file." sys.exit(1) return params
7ef63f0d6acaed783b4943ead1066c04c97005ad /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11171/7ef63f0d6acaed783b4943ead1066c04c97005ad/cmeansMultiGPU.py
params['NUM_EVENTS'] -= params['NUM_EVENTS'] % 16 print "%d events removed to ensure memory alignment" % (params['NUM_EVENTS'] % 16)
if params['TRUNCATE']: params['NUM_EVENTS'] -= params['NUM_EVENTS'] % (16*num_gpus) print "%d events removed to ensure memory alignment" % (params['NUM_EVENTS'] % (16*num_gpus))
def parseInputArgs(): args = sys.argv num_args = len(args) params = { 'INPUT_FILE' : '', 'NUM_CLUSTERS' : 0, 'THRESHOLD' : 0.0001, 'MIN_ITERS' : 0, 'MAX_ITERS' : 100, 'DEVICE' : 0, 'FUZZINESS' : 2, 'DISTANCE_MEASURE': 0, 'K1': 1.0, 'K2': 0.01, 'K3': 1.5, 'MEMBER_THRESHOLD': 0.05, 'TABU_ITER': 100, 'TABU_TENURE': 5, 'MDL': 0, 'CPU_ONLY': 0, } num_params = len(params.keys()) if num_args == num_params: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] params['THRESHOLD'] = args[3] params['MIN_ITERS'] = args[4] params['MAX_ITERS'] = args[5] params['DEVICE'] = args[6] params['FUZZINESS'] = args[7] params['DISTANCE_MEASURE'] = args[8] params['K1'] = args[9] params['K2'] = args[10] params['K3'] = args[11] params['MEMBER_THRESHOLD'] = args[12] params['TABU_ITER'] = args[13] params['TABU_TENURE'] = args[14] params['MDL'] = args[15] params['CPU_ONLY'] = args[16] elif num_args == 3: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] elif 3 < num_args < num_params: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] for arg in args[3:]: try: key,val = arg.split("=") key = key.upper() assert key in params.keys() if key in ['K1','K2','K3','MEMBER_THRESHOLD','THRESHOLD']: params[key] = float(val) else: params[key] = int(val) except AssertionError: print "Error: Found invalid parameter '%s'" % key except ValueError: print "Error: Invalid value '%s' for parameter '%s'" % (val,key) print usage() sys.exit(1) else: print "Invalid command line arguments." print usage() sys.exit(1) if os.path.exists(params['INPUT_FILE']): if params['INPUT_FILE'].lower().endswith(".bin"): input = open(params['INPUT_FILE'],'rb') import struct params['NUM_EVENTS'] = struct.unpack('i',input.read(4))[0] params['NUM_DIMENSIONS'] = struct.unpack('i',input.read(4))[0] else: input = open(params['INPUT_FILE']) line = input.readline() # Read the header line num_dimensions = len(line.split(DELIMITER)) num_events = 0 for line in input: num_events += 1 params['NUM_DIMENSIONS'] = num_dimensions params['NUM_EVENTS'] = num_events params['NUM_EVENTS'] -= params['NUM_EVENTS'] % 16 print "%d events removed to ensure memory alignment" % (params['NUM_EVENTS'] % 16) else: print "Invalid input file." sys.exit(1) return params
7ef63f0d6acaed783b4943ead1066c04c97005ad /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11171/7ef63f0d6acaed783b4943ead1066c04c97005ad/cmeansMultiGPU.py
current_path = os.getcwd() print "Current Directory: %s" % current_path print "PROJECT_PATH: %s" % PROJECT_PATH print "Compiling C-means for target file" os.chdir(PROJECT_PATH)
def parseInputArgs(): args = sys.argv num_args = len(args) params = { 'INPUT_FILE' : '', 'NUM_CLUSTERS' : 0, 'THRESHOLD' : 0.0001, 'MIN_ITERS' : 0, 'MAX_ITERS' : 100, 'DEVICE' : 0, 'FUZZINESS' : 2, 'DISTANCE_MEASURE': 0, 'K1': 1.0, 'K2': 0.01, 'K3': 1.5, 'MEMBER_THRESHOLD': 0.05, 'TABU_ITER': 100, 'TABU_TENURE': 5, 'MDL': 0, 'CPU_ONLY': 0, } num_params = len(params.keys()) if num_args == num_params: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] params['THRESHOLD'] = args[3] params['MIN_ITERS'] = args[4] params['MAX_ITERS'] = args[5] params['DEVICE'] = args[6] params['FUZZINESS'] = args[7] params['DISTANCE_MEASURE'] = args[8] params['K1'] = args[9] params['K2'] = args[10] params['K3'] = args[11] params['MEMBER_THRESHOLD'] = args[12] params['TABU_ITER'] = args[13] params['TABU_TENURE'] = args[14] params['MDL'] = args[15] params['CPU_ONLY'] = args[16] elif num_args == 3: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] elif 3 < num_args < num_params: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] for arg in args[3:]: try: key,val = arg.split("=") key = key.upper() assert key in params.keys() if key in ['K1','K2','K3','MEMBER_THRESHOLD','THRESHOLD']: params[key] = float(val) else: params[key] = int(val) except AssertionError: print "Error: Found invalid parameter '%s'" % key except ValueError: print "Error: Invalid value '%s' for parameter '%s'" % (val,key) print usage() sys.exit(1) else: print "Invalid command line arguments." print usage() sys.exit(1) if os.path.exists(params['INPUT_FILE']): if params['INPUT_FILE'].lower().endswith(".bin"): input = open(params['INPUT_FILE'],'rb') import struct params['NUM_EVENTS'] = struct.unpack('i',input.read(4))[0] params['NUM_DIMENSIONS'] = struct.unpack('i',input.read(4))[0] else: input = open(params['INPUT_FILE']) line = input.readline() # Read the header line num_dimensions = len(line.split(DELIMITER)) num_events = 0 for line in input: num_events += 1 params['NUM_DIMENSIONS'] = num_dimensions params['NUM_EVENTS'] = num_events params['NUM_EVENTS'] -= params['NUM_EVENTS'] % 16 print "%d events removed to ensure memory alignment" % (params['NUM_EVENTS'] % 16) else: print "Invalid input file." sys.exit(1) return params
7ef63f0d6acaed783b4943ead1066c04c97005ad /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11171/7ef63f0d6acaed783b4943ead1066c04c97005ad/cmeansMultiGPU.py
print "CWD:",os.getcwd()
def parseInputArgs(): args = sys.argv num_args = len(args) params = { 'INPUT_FILE' : '', 'NUM_CLUSTERS' : 0, 'THRESHOLD' : 0.0001, 'MIN_ITERS' : 0, 'MAX_ITERS' : 100, 'DEVICE' : 0, 'FUZZINESS' : 2, 'DISTANCE_MEASURE': 0, 'K1': 1.0, 'K2': 0.01, 'K3': 1.5, 'MEMBER_THRESHOLD': 0.05, 'TABU_ITER': 100, 'TABU_TENURE': 5, 'MDL': 0, 'CPU_ONLY': 0, } num_params = len(params.keys()) if num_args == num_params: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] params['THRESHOLD'] = args[3] params['MIN_ITERS'] = args[4] params['MAX_ITERS'] = args[5] params['DEVICE'] = args[6] params['FUZZINESS'] = args[7] params['DISTANCE_MEASURE'] = args[8] params['K1'] = args[9] params['K2'] = args[10] params['K3'] = args[11] params['MEMBER_THRESHOLD'] = args[12] params['TABU_ITER'] = args[13] params['TABU_TENURE'] = args[14] params['MDL'] = args[15] params['CPU_ONLY'] = args[16] elif num_args == 3: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] elif 3 < num_args < num_params: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] for arg in args[3:]: try: key,val = arg.split("=") key = key.upper() assert key in params.keys() if key in ['K1','K2','K3','MEMBER_THRESHOLD','THRESHOLD']: params[key] = float(val) else: params[key] = int(val) except AssertionError: print "Error: Found invalid parameter '%s'" % key except ValueError: print "Error: Invalid value '%s' for parameter '%s'" % (val,key) print usage() sys.exit(1) else: print "Invalid command line arguments." print usage() sys.exit(1) if os.path.exists(params['INPUT_FILE']): if params['INPUT_FILE'].lower().endswith(".bin"): input = open(params['INPUT_FILE'],'rb') import struct params['NUM_EVENTS'] = struct.unpack('i',input.read(4))[0] params['NUM_DIMENSIONS'] = struct.unpack('i',input.read(4))[0] else: input = open(params['INPUT_FILE']) line = input.readline() # Read the header line num_dimensions = len(line.split(DELIMITER)) num_events = 0 for line in input: num_events += 1 params['NUM_DIMENSIONS'] = num_dimensions params['NUM_EVENTS'] = num_events params['NUM_EVENTS'] -= params['NUM_EVENTS'] % 16 print "%d events removed to ensure memory alignment" % (params['NUM_EVENTS'] % 16) else: print "Invalid input file." sys.exit(1) return params
7ef63f0d6acaed783b4943ead1066c04c97005ad /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11171/7ef63f0d6acaed783b4943ead1066c04c97005ad/cmeansMultiGPU.py
cmd = '../../bin/linux/release/cmeansMultiGPU "%s"' % params['INPUT_FILE']
cmd = '%s/../../bin/linux/release/cmeansMultiGPU "%s"' % (PROJECT_PATH,params['INPUT_FILE'])
def parseInputArgs(): args = sys.argv num_args = len(args) params = { 'INPUT_FILE' : '', 'NUM_CLUSTERS' : 0, 'THRESHOLD' : 0.0001, 'MIN_ITERS' : 0, 'MAX_ITERS' : 100, 'DEVICE' : 0, 'FUZZINESS' : 2, 'DISTANCE_MEASURE': 0, 'K1': 1.0, 'K2': 0.01, 'K3': 1.5, 'MEMBER_THRESHOLD': 0.05, 'TABU_ITER': 100, 'TABU_TENURE': 5, 'MDL': 0, 'CPU_ONLY': 0, } num_params = len(params.keys()) if num_args == num_params: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] params['THRESHOLD'] = args[3] params['MIN_ITERS'] = args[4] params['MAX_ITERS'] = args[5] params['DEVICE'] = args[6] params['FUZZINESS'] = args[7] params['DISTANCE_MEASURE'] = args[8] params['K1'] = args[9] params['K2'] = args[10] params['K3'] = args[11] params['MEMBER_THRESHOLD'] = args[12] params['TABU_ITER'] = args[13] params['TABU_TENURE'] = args[14] params['MDL'] = args[15] params['CPU_ONLY'] = args[16] elif num_args == 3: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] elif 3 < num_args < num_params: params['INPUT_FILE'] = args[1] params['NUM_CLUSTERS'] = args[2] for arg in args[3:]: try: key,val = arg.split("=") key = key.upper() assert key in params.keys() if key in ['K1','K2','K3','MEMBER_THRESHOLD','THRESHOLD']: params[key] = float(val) else: params[key] = int(val) except AssertionError: print "Error: Found invalid parameter '%s'" % key except ValueError: print "Error: Invalid value '%s' for parameter '%s'" % (val,key) print usage() sys.exit(1) else: print "Invalid command line arguments." print usage() sys.exit(1) if os.path.exists(params['INPUT_FILE']): if params['INPUT_FILE'].lower().endswith(".bin"): input = open(params['INPUT_FILE'],'rb') import struct params['NUM_EVENTS'] = struct.unpack('i',input.read(4))[0] params['NUM_DIMENSIONS'] = struct.unpack('i',input.read(4))[0] else: input = open(params['INPUT_FILE']) line = input.readline() # Read the header line num_dimensions = len(line.split(DELIMITER)) num_events = 0 for line in input: num_events += 1 params['NUM_DIMENSIONS'] = num_dimensions params['NUM_EVENTS'] = num_events params['NUM_EVENTS'] -= params['NUM_EVENTS'] % 16 print "%d events removed to ensure memory alignment" % (params['NUM_EVENTS'] % 16) else: print "Invalid input file." sys.exit(1) return params
7ef63f0d6acaed783b4943ead1066c04c97005ad /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11171/7ef63f0d6acaed783b4943ead1066c04c97005ad/cmeansMultiGPU.py
if not isinstance(region.parsed, TestCase): return
def evaluate(region, document, globs): try: old_compile = doctest.compile except AttributeError: old_compile = compile doctest.compile = monkey_compile if not isinstance(region.parsed, TestCase): return result = manuel.doctest.DocTestResult() if region.parsed.group: test_name = region.parsed.group else: test_name = os.path.split(document.location)[1] exc_msg = None output = region.parsed.output if output: match = doctest.DocTestParser._EXCEPTION_RE.match(output) if match: exc_msg = match.group('msg') test_options = {doctest.ELLIPSIS: True, doctest.IGNORE_EXCEPTION_DETAIL: True, doctest.DONT_ACCEPT_TRUE_FOR_1: True, } options = region.parsed.options if options: for x in options.split(','): x = x.strip() sign = x[0] value = eval('doctest.' + x[1:]) test_options[value] = sign == '+' example = doctest.Example(region.parsed.code, output, exc_msg=exc_msg, lineno=region.lineno, options=test_options) test = doctest.DocTest([example], globs, test_name, document.location, region.lineno-1, None) runner = doctest.DocTestRunner() runner.DIVIDER = '' # disable unwanted result formatting runner.run(test, clear_globs=False) region.evaluated = result doctest.compile = old_compile
5eb62cd33f167fd4c250f074ee04b668ec0f8948 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9784/5eb62cd33f167fd4c250f074ee04b668ec0f8948/sphinx.py
if s[-1] != '\n':
if s == '' or s[-1] != '\n':
def newlineify(s): if s[-1] != '\n': s += '\n' return s
f32339b667b0d23fd16c8082a1e5e1232f3b5bb4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9784/f32339b667b0d23fd16c8082a1e5e1232f3b5bb4/__init__.py
globs = GlobWrapper(globs)
wrapped_globs = GlobWrapper(globs)
def evaluate_with(self, m, globs): globs = GlobWrapper(globs) for region in list(self): for evaluater in sort_handlers(m.evaluaters): evaluater(region, self, globs)
36513ccaa72ab9805fc471d7d13d68472e784a89 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9784/36513ccaa72ab9805fc471d7d13d68472e784a89/__init__.py
evaluater(region, self, globs)
evaluater(region, self, wrapped_globs) globs.update(wrapped_globs)
def evaluate_with(self, m, globs): globs = GlobWrapper(globs) for region in list(self): for evaluater in sort_handlers(m.evaluaters): evaluater(region, self, globs)
36513ccaa72ab9805fc471d7d13d68472e784a89 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9784/36513ccaa72ab9805fc471d7d13d68472e784a89/__init__.py