def process_finder(lock, channel_queue, target, update_time): f = finder.Finder(target) while True: f.RefreshList() input_channel_queue = Queue() output_channel_queue = Queue() input_lock = threading.Lock() output_lock = threading.Lock() for s in f.streamer: input_channel_queue.put(s.user_name) threads = [] for i in range(10): t = threading.Thread(target=thread_finder_finduser, args=( input_lock, output_lock, input_channel_queue, output_channel_queue, f, )) threads.append(t) t.start() for t in threads: t.join() result = [] while not output_channel_queue.empty(): result.append(output_channel_queue.get()) resultString = '' for r in result: resultString = resultString + r + ', ' resultString = resultString[:-2] print_log(f.module_name + ' joined channels : ' + resultString) #write_log(target, f.module_name + ' joined channels : ' + resultString) result.append(target) channel_queue.put(result) time.sleep(update_time)
default='/Users/wangyi/Desktop/scripts/apks/tmp/geoquiz') parser.add_argument( '--input', '-i', type=str, default='/Users/wangyi/Desktop/scripts/smali/CheckUtil.smali') args = parser.parse_args() reciver_cls, func, dir_name, in_file = args.recv, args.fun, args.dir, args.input searcher = class_relation.ClassSearcher(dir_name) searcher.search() class_relation.extract_relations(class_relation.classes) descendants = class_relation.get_all_descendants(reciver_cls) my_finder = finder.Finder(reciver_cls + func, dir_name) call_points = dict() call_points.update({reciver_cls + func: my_finder.find()}) for descendant in descendants: my_finder.set_fun_name(descendant + func) call_points.update({descendant: my_finder.find()}) tmp_file = get_to_path(call_points[descendant]) to_dir = tmp_file[:tmp_file.rfind('/') + 1] instrument_file_name = in_file[in_file.rfind('/') + 1:] assert (instrument_file_name.endswith(POSTFIX)) package_name = get_package_name(tmp_file) instrument_class_name = instrument_file_name[:instrument_file_name. rfind('.')] INSTRUMENT_CLASS = package_name + '/' + instrument_class_name + ';'
def get_finder(): with app.app_context(): thefinder = getattr(g, '_finder', None) if thefinder is None: thefinder = finder.Finder() return thefinder
def __init__(self): self.finder = finder.Finder()
import finder find = finder.Finder() index, graph = find.crawl_web('http://sdandersonz.pythonanywhere.com/') print(graph) rank = find.compute_ranks(graph) print(rank)
import finder, run_comparison, writer if __name__ == "__main__": finder_d = finder.Finder("D:\\") finder_c = finder.Finder("C:\\") writer_d = writer.Writer("D:\\test\\", "D") writer_c = writer.Writer("D:\\test\\run_2", "C") writer_d.start() writer_c.start() run_comparison.run_comparison(10000, finder_d, writer_d) run_comparison.run_comparison(10000, finder_c, writer_c)
def setUp(self): self.instance = finder.Finder('SMario.sfc', 'elcome')