rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
cols = [128] * 3 cols[data] = xfl.fl_get_dial_value(pobj) xfl.fl_mapcolor(xfl.FL_FREE_COL1, cols[0], cols[1], cols[2]) | self.cols[data] = xfl.fl_get_dial_value(pobj) xfl.fl_mapcolor(xfl.FL_FREE_COL1, self.cols[0], self.cols[1], \ self.cols[2]) | def cb(self, pobj, data): cols = [128] * 3 cols[data] = xfl.fl_get_dial_value(pobj) xfl.fl_mapcolor(xfl.FL_FREE_COL1, cols[0], cols[1], cols[2]) xfl.fl_redraw_object(self.presult) strng = "%d" % cols[data] xfl.fl_set_object_label(self.ptexts[data], strng) |
strng = "%d" % cols[data] | strng = "%d" % self.cols[data] | def cb(self, pobj, data): cols = [128] * 3 cols[data] = xfl.fl_get_dial_value(pobj) xfl.fl_mapcolor(xfl.FL_FREE_COL1, cols[0], cols[1], cols[2]) xfl.fl_redraw_object(self.presult) strng = "%d" % cols[data] xfl.fl_set_object_label(self.ptexts[data], strng) |
structflresource[numb], ptr_flresource[numb], \ pyclsresname[numb], s_clsresname[numb], \ pyclsresclass[numb], s_clsresclass[numb], \ | structflresource[numb], pyclsresname[numb], \ s_clsresname[numb], pyclsresclass[numb], s_clsresclass[numb], \ | def make_flresource(dictflresource): """make_flresource(dictflresource) -> ptr_flresource Taking a python dict (for one dict item) or a list of dicts (for more than one dict item) with keys corresponding to xfdata.FL_RESOURCE attributes prepares and returns a C-compatible pointer to xfdata.FL_RESOURCE. Keys are: 'res_... |
f.write(unescape(caption) + '<img alt="' + caption + '" src="images/' + image_filename + '" />') | f.write(unescape(caption) + '<img alt="' + unescape(caption) + '" src="images/' + image_filename + '" />') | def savePost(post, header, save_folder): """ saves an individual post and any resources for it locally """ slug = post["url-with-slug"].rpartition("/")[2] date_gmt = post["date-gmt"] file_name = os.path.join(save_folder, slug + ".html") f = open(file_name, "w") # header info which is the same for all posts f.write(h... |
print "Getting posts " + str(i) + " to " + str(i + 49) + "." | j = i + 49 if j > total_posts: j = total_posts print "Getting posts " + str(i) + " to " + str(j) + "." | def backup(account): """ makes HTML files for every post on a public Tumblr blog account """ print "Getting basic information." # make sure there's a folder to save in save_folder = os.path.join(os.getcwd(), account) if not os.path.exists(save_folder): os.mkdir(save_folder) # start by calling the API with just a sin... |
if os.getenv('LOGNAME','none').lower() == 'root': pass else: QtGui.QMessageBox.warning(self,"Insufficient Priviledge","Aircrack requires root priviledges to function, Please run application as root") sys.exit() | def __init__(self): QtGui.QDialog.__init__(self) self.setupUi(self) self.retranslateUi(self) | |
fallthru_target = [t._label_str() for t in cur if t.next.label != t.label][0] | fallthru_target = [t.next._label_str() for t in cur if t.next.label != t.label][0] | def translate_code(trace, tbs, tbdict, cfg): # It's translation time! transdict = {} for i in range(len(tbs)-1): transdict[tbs[i].label] = "raise Goto(%s)" % tbs[i+1]._label_str() transdict[tbs[-1].label] = "raise Goto('__end__')" # For label generation labels = 0 # Iterate over the finished CFG and translate each TB ... |
for start, buf in self.get_scratch().items(): print hex(start),":",buf.encode('hex') | for start, buf in sorted(self.get_scratch().items()): print dump(buf,start=start) | def dump_scratch(self): for start, buf in self.get_scratch().items(): print hex(start),":",buf.encode('hex') |
def counter(): i = 0 while True: yield i i += 1 | def first(cond, l): """Return the first item in L for which cond is true. Return None if cond is not true for any item""" for e in l: if cond(e): return e return None | |
print "Replacing", `trace[i]`, "with SET_INPUT[%d] at %d" % (idx, i) | def set_input(trace, in_addr, idx): for var, i in trace.find_inputs(in_addr): print "Replacing", `trace[i]`, "with SET_INPUT[%d] at %d" % (idx, i) new_te = TraceEntry(("IFLO_SET_INPUT", [var, idx])) trace[i] = new_te | |
(0x804e72c4, 12, 1, 'ExAllocatePoolWithQuotaTag'), (0x8054b044, 12, 1, 'ExAllocatePoolWithTag'), | def slice_trace(trace, inbufs, outbufs): print "Doing initial slice..." start_ts = time.time() dynslice(trace, outbufs, output_track=True) end_ts = time.time() print "Slicing done in %s, calculating control dependencies..." % datetime.timedelta(seconds=end_ts-start_ts) tbs = make_tbs(trace) tbdict = make_tbdict(tbs) ... | |
(0x8054af07, 8, 'ExFreePoolWithTag'), | def slice_trace(trace, inbufs, outbufs): print "Doing initial slice..." start_ts = time.time() dynslice(trace, outbufs, output_track=True) end_ts = time.time() print "Slicing done in %s, calculating control dependencies..." % datetime.timedelta(seconds=end_ts-start_ts) tbs = make_tbs(trace) tbdict = make_tbdict(tbs) ... | |
if trace[i+3].op == 'IFLO_TB_HEAD_EIP': | if is_branch(last_insn): ep = i+2 elif trace[i+3].op == 'IFLO_TB_HEAD_EIP': | def fix_sti(trace, tbdict): tbs_to_fix = [] for t in tbdict: for tb in tbdict[t]: if any(i.op == 'IFLO_RESET_INHIBIT_IRQ' for i in tb.rbody): tbs_to_fix.append(tb) edits = [] for tb in tbs_to_fix: i, _ = first(lambda x: x[1].op == 'IFLO_RESET_INHIBIT_IRQ', tb.body) assert trace[i].op == 'IFLO_RESET_INHIBIT_IRQ' asser... |
print "Will heal TB %s by removing trace entry %d" % (`tb`, ep) | def fix_sti(trace, tbdict): tbs_to_fix = [] for t in tbdict: for tb in tbdict[t]: if any(i.op == 'IFLO_RESET_INHIBIT_IRQ' for i in tb.rbody): tbs_to_fix.append(tb) edits = [] for tb in tbs_to_fix: i, _ = first(lambda x: x[1].op == 'IFLO_RESET_INHIBIT_IRQ', tb.body) assert trace[i].op == 'IFLO_RESET_INHIBIT_IRQ' asser... | |
if fault_eip == ret_eip: | if trace[a].args[0] < 32 and fault_eip == ret_eip: | def find_interrupts(trace): to_remove = [] ints = trace.find_interrupts() for a,b in ints: i = a while trace[i].op != 'IFLO_INSN_BYTES': i -= 1 fault_idx = i fault_eip = trace[i].args[0] fault_insn = pydasm.get_instruction(trace[i].args[1].decode('hex'), pydasm.MODE_32) i = b while trace[i].op != 'IFLO_TB_HEAD_EIP': ... |
print "Skipping %s" % repr(cur[0]) | def translate_code(trace, tbs, tbdict, cfg): # It's translation time! transdict = {} for i in range(len(tbs)-1): transdict[tbs[i].label] = "raise Goto(%s)" % tbs[i+1]._label_str() transdict[tbs[-1].label] = "raise Goto('__end__')" # Iterate over the finished CFG and translate each TB for c in cfg: cur = tbdict[c] next... | |
print "Translating %s" % repr(first(lambda x: x.has_slice(), cur)) | def translate_code(trace, tbs, tbdict, cfg): # It's translation time! transdict = {} for i in range(len(tbs)-1): transdict[tbs[i].label] = "raise Goto(%s)" % tbs[i+1]._label_str() transdict[tbs[-1].label] = "raise Goto('__end__')" # Iterate over the finished CFG and translate each TB for c in cfg: cur = tbdict[c] next... | |
global target_os | def get_user_memory(trace, kernel=0x80000000): m2p = { 'Q': 'Q', 'L': 'I', 'W': 'H', 'B': 'B', } mem = {} for i in range(len(trace)-1, -1, -1): insn = trace[i] m = memrex.search(insn.op) if m: addr = insn.args[2] if addr >= kernel: continue tp, sz = m.groups() if tp == 'ST': continue if sz == 'B' and insn.args[-1] > ... | |
embedshell() | print "Splitting TBs with reps..." trace, tbs, tbdict, cfg = fix_reps(trace) | def get_user_memory(trace, kernel=0x80000000): m2p = { 'Q': 'Q', 'L': 'I', 'W': 'H', 'B': 'B', } mem = {} for i in range(len(trace)-1, -1, -1): insn = trace[i] m = memrex.search(insn.op) if m: addr = insn.args[2] if addr >= kernel: continue tp, sz = m.groups() if tp == 'ST': continue if sz == 'B' and insn.args[-1] > ... |
print "Splitting TBs with reps..." trace, tbs, tbdict, cfg = fix_reps(trace) | def get_user_memory(trace, kernel=0x80000000): m2p = { 'Q': 'Q', 'L': 'I', 'W': 'H', 'B': 'B', } mem = {} for i in range(len(trace)-1, -1, -1): insn = trace[i] m = memrex.search(insn.op) if m: addr = insn.args[2] if addr >= kernel: continue tp, sz = m.groups() if tp == 'ST': continue if sz == 'B' and insn.args[-1] > ... | |
mem = get_user_memory(trace) | def get_user_memory(trace, kernel=0x80000000): m2p = { 'Q': 'Q', 'L': 'I', 'W': 'H', 'B': 'B', } mem = {} for i in range(len(trace)-1, -1, -1): insn = trace[i] m = memrex.search(insn.op) if m: addr = insn.args[2] if addr >= kernel: continue tp, sz = m.groups() if tp == 'ST': continue if sz == 'B' and insn.args[-1] > ... | |
self._value = _toFixedUnsigned(value, bits) | self._value = _toFixedUnsigned(int(value), bits) | def __init__(self, value): self._value = _toFixedUnsigned(value, bits) |
self._value = _toFixedSigned(value, bits) | self._value = _toFixedSigned(int(value), bits) | def __init__(self, value): self._value = _toFixedSigned(value, bits) |
(896, 927, 'dr'), | (896, 899, 'DR_0.'), (900, 903, 'DR_1.'), (904, 907, 'DR_2.'), (908, 911, 'DR_3.'), (912, 915, 'DR_4.'), (916, 919, 'DR_5.'), (920, 923, 'DR_6.'), (924, 927, 'DR_7.'), | def memrange(start, length): return [("MEM_%08x" % i) for i in range(start, start+length)] |
lambda args: ["REGS_%d" % qemu_regs["EAX"], "REGS_%d" % qemu_regs["EDX"]], | lambda args: ["REGS_%d" % qemu_regs["EAX"], "REGS_%d" % qemu_regs["EDX"], 'T0'], | def ARITH(dest, src): return [ lambda args: [dest], lambda args: [dest, src], ] |
lambda args: ['T0', "REGS_%d" % qemu_regs['EAX'], 'A0'], | lambda args: ['T0', 'T1', "REGS_%d" % qemu_regs['EAX'], 'A0'], | def ARITH(dest, src): return [ lambda args: [dest], lambda args: [dest, src], ] |
taken = "'label%d'" % labels | new_label = "'label%d'" % labels | def translate_code(trace, tbs, tbdict, cfg): # It's translation time! transdict = {} for i in range(len(tbs)-1): transdict[tbs[i].label] = "raise Goto(%s)" % tbs[i+1]._label_str() transdict[tbs[-1].label] = "raise Goto('__end__')" # For label generation labels = 0 # Iterate over the finished CFG and translate each TB ... |
s += "if (%s): raise Goto(%s)\n" % (ins, taken) | s += "if (%s): raise Goto(%s)\n" % (ins, new_label) | def translate_code(trace, tbs, tbdict, cfg): # It's translation time! transdict = {} for i in range(len(tbs)-1): transdict[tbs[i].label] = "raise Goto(%s)" % tbs[i+1]._label_str() transdict[tbs[-1].label] = "raise Goto('__end__')" # For label generation labels = 0 # Iterate over the finished CFG and translate each TB ... |
print "Translating [TB @%s]" % taken | print "Translating [TB @%s]" % new_label | def translate_code(trace, tbs, tbdict, cfg): # It's translation time! transdict = {} for i in range(len(tbs)-1): transdict[tbs[i].label] = "raise Goto(%s)" % tbs[i+1]._label_str() transdict[tbs[-1].label] = "raise Goto('__end__')" # For label generation labels = 0 # Iterate over the finished CFG and translate each TB ... |
transdict[eval(taken)] = s | transdict[eval(new_label)] = s | def translate_code(trace, tbs, tbdict, cfg): # It's translation time! transdict = {} for i in range(len(tbs)-1): transdict[tbs[i].label] = "raise Goto(%s)" % tbs[i+1]._label_str() transdict[tbs[-1].label] = "raise Goto('__end__')" # For label generation labels = 0 # Iterate over the finished CFG and translate each TB ... |
self.allocated[vaddr] = (vaddr,size) | self.allocated[int(vaddr)] = (int(vaddr),int(size)) | def alloc(self, size, zfill=True): if not size: raise ValueError("Invalid size %d for malloc" % size) size = int(size) |
old_ptr_st, old_size = self.allocated[ptr] | old_ptr, old_size = self.allocated[ptr] | def realloc(self, ptr, size): ptr, size = int(ptr), int(size) if not ptr in self.allocated: raise ValueError("No existing allocation found for %#x" % ptr) if not size: raise ValueError("Invalid size %d for malloc" % size) |
self.base.write(new_alloc, self.read(old_ptr,old_size)) | self.base.write(int(new_alloc), self.read(old_ptr,old_size)) | def realloc(self, ptr, size): ptr, size = int(ptr), int(size) if not ptr in self.allocated: raise ValueError("No existing allocation found for %#x" % ptr) if not size: raise ValueError("Invalid size %d for malloc" % size) |
eip,efl,_ = current.split(" ", 2) for c in [eip,efl]: | eip,efl,_,cpl,_ = current.split(" ", 4) for c in [eip,efl,cpl]: | def load_env(env_file): regs = {} # GP registers for i in range(2): current = env_file.readline().strip().split() for c in current: var,val = c.split('=') regs[var] = UInt(int(val, 16)) # EIP and EFLAGS current = env_file.readline().strip() eip,efl,_ = current.split(" ", 2) for c in [eip,efl]: var,val = c.split('=') re... |
print code[label] | def execute(self): theProfile = Profile() #(addr_space, symtab, types) = load_and_identify_image(self.op, self.opts) thefile = FileAddressSpace(self.opts.filename) flat = PCOW(thefile) | |
print "Time taken: %f ms" % ((t2-t1)*1000) | print "Executed %d instructions, uMIPS: %f" % (isncount, isncount / float(t2-t1)) | def execute(self): theProfile = Profile() #(addr_space, symtab, types) = load_and_identify_image(self.op, self.opts) thefile = FileAddressSpace(self.opts.filename) flat = PCOW(thefile) |
embedshell() | def get_user_memory(trace, kernel=0x80000000): m2p = { 'Q': 'Q', 'L': 'I', 'W': 'H', 'B': 'B', } mem = {} for i in range(len(trace)-1, -1, -1): insn = trace[i] m = memrex.search(insn.op) if m: addr = insn.args[2] if addr >= kernel: continue tp, sz = m.groups() if tp == 'ST': continue if sz == 'B' and insn.args[-1] > ... | |
miro.generate_current_bug_xml() | bug_xml_gen = miro.generate_current_bug_xml() for bug_xml in bug_xml_gen: pass | def test_bugzilla_importing_hits_network_if_urls_are_not_fresh(self, mock_xml_opener): # First, show that in the not-fresh case, we do hit the network. mock_xml_opener.return_value = lxml.etree.XML(open(os.path.join( settings.MEDIA_ROOT, 'sample-data', 'miro-2294-2009-08-06.xml')).read()) |
miro.generate_current_bug_xml() | bug_xml_gen = miro.generate_current_bug_xml() for bug_xml in bug_xml_gen: pass | def test_bugzilla_importing_avoids_network_if_urls_are_fresh(self, mock_xml_opener): # Second, in the stale case, show that we do not hit the network! mock_xml_opener.return_value = lxml.etree.XML(open(os.path.join( settings.MEDIA_ROOT, 'sample-data', 'miro-2294-2009-08-06.xml')).read()) |
sample_out_query = dict(project='GNOME-Do', canonical_bug_link='http://example.com/1') | sample_out_query = dict(canonical_bug_link='http://example.com/1') | def test_lp_data_clean(self, do_nothing): now_t = (2009, 4, 1, 5, 13, 2) # partial time tuple now_d = datetime.datetime(2009, 4, 1, 5, 13, 2) # NOTE: We do not test for time zone correctness. sample_in = dict(project='GNOME-Do', url='http://example.com/1', title='Title', text='Some long text', importance=None, status='... |
mysite.customs.bugtrackers.kde.bugs() | mysite.customs.bugtrackers.kde.grab() | def run(self, **kwargs): logger = self.get_logger(**kwargs) logger.info("Started to grab KDE junior jobs bugs") mysite.customs.bugtrackers.kde.bugs() |
self.assertContains(response, person.location_display_name) | def test_guess_location_on_login(self): person = Person.objects.get(user__username="paulproteus") self.assertFalse(person.location_confirmed) self.assertFalse(person.location_display_name) client = self.login_with_client() response = client.get(reverse(mysite.profile.views.display_list_of_people)) self.assertContains(... | |
self.refresh_all_bugs() def refresh_all_bugs(self): for bug in mysite.search.models.Bug.all_bugs.filter( canonical_bug_link__contains=self.base_url): tb = mysite.customs.bugtrackers.trac.TracBug.from_url( bug.canonical_bug_link) self.refresh_one_bug_id(tb.bug_id) | def update(self): logging.info("Started refreshing all %s bugs." % self.project_name) | |
@login_required @view def diffpatch_mission(request, passed_data={}): | def diffpatch_data(request, passed_data={}): | def diffpatch_patchsingle_get_patch(request): return make_download(controllers.PatchSingleFileMission.get_patch(), filename=controllers.PatchSingleFileMission.PATCH_FILENAME) |
'patchsingle_done': controllers.mission_completed(request.user.get_profile(), 'diffpatch_patchsingle'), | def diffpatch_mission(request, passed_data={}): data = { 'patchsingle_success': False, 'patchsingle_form': forms.PatchSingleUploadForm(), 'patchsingle_error_message': '', 'patchsingle_done': controllers.mission_completed(request.user.get_profile(), 'diffpatch_patchsingle'), 'diffsingle_success': False, 'diffsingle_form... | |
'diffsingle_done': controllers.mission_completed(request.user.get_profile(), 'diffpatch_diffsingle'), | def diffpatch_mission(request, passed_data={}): data = { 'patchsingle_success': False, 'patchsingle_form': forms.PatchSingleUploadForm(), 'patchsingle_error_message': '', 'patchsingle_done': controllers.mission_completed(request.user.get_profile(), 'diffpatch_patchsingle'), 'diffsingle_success': False, 'diffsingle_form... | |
'diffrecursive_done': controllers.mission_completed(request.user.get_profile(), 'diffpatch_diffrecursive'), | def diffpatch_mission(request, passed_data={}): data = { 'patchsingle_success': False, 'patchsingle_form': forms.PatchSingleUploadForm(), 'patchsingle_error_message': '', 'patchsingle_done': controllers.mission_completed(request.user.get_profile(), 'diffpatch_patchsingle'), 'diffsingle_success': False, 'diffsingle_form... | |
'patchrecursive_done': controllers.mission_completed(request.user.get_profile(), 'diffpatch_patchrecursive'), | def diffpatch_mission(request, passed_data={}): data = { 'patchsingle_success': False, 'patchsingle_form': forms.PatchSingleUploadForm(), 'patchsingle_error_message': '', 'patchsingle_done': controllers.mission_completed(request.user.get_profile(), 'diffpatch_patchsingle'), 'diffsingle_success': False, 'diffsingle_form... | |
data['nudge_projects'] = True | def landing_page(request): data = {} data['entries'] = mysite.customs.feed.cached_blog_entries()[:3] recommended_bugs = [] if request.user.is_authenticated(): suggested_searches = request.user.get_profile().get_recommended_search_terms() recommended_bugs = mysite.profile.controllers.recommend_bugs(suggested_searches,... | |
data['nudge_projects'] or data['nudge_tags']) | 'nudge_importer_when_user_has_no_projects' in data or data['nudge_tags'] or 'nudge_importer_when_user_has_some_projects' in data) else: data['nudge_importer_when_user_has_no_projects'] = True | def landing_page(request): data = {} data['entries'] = mysite.customs.feed.cached_blog_entries()[:3] recommended_bugs = [] if request.user.is_authenticated(): suggested_searches = request.user.get_profile().get_recommended_search_terms() recommended_bugs = mysite.profile.controllers.recommend_bugs(suggested_searches,... |
mock_browser_open.side_effect = HTTPError(url="http://theurl.com/", code=504, msg="", hdrs="", fp=open("/dev/null")) | mock_browser_open.side_effect = raise_504 | def test_blog_entries(self, mock_feedparser_parse): mock_feedparser_parse.return_value = { 'entries': [ { 'title': 'Yo é', 'summary': 'Yo é' }]} entries = mysite.customs.feed._blog_entries() self.assertEqual(entries[0]['title'], u'Yo \xe9') self.assertEqual(entries[0]['unicode_text'], u'Yo \xe9') |
E.g., search for gtk, it says C, 541.""" | E.g., search for gtk, it says C (541).""" | def test_facets_filter_results(self): facets = {u'language': u'Python'} |
import pdb;pdb.set_trace() | def test_get_possible_facets(self): # Create three projects project1 = Project.create_dummy(language=u'c') project2 = Project.create_dummy(language=u'd') project3 = Project.create_dummy(language=u'e') | |
{ u'name': u'any', u'query_string': u'q=bug&language=', u'is_active': False, u'count': 2 }, | def test_get_possible_facets(self): # Create three projects project1 = Project.create_dummy(language=u'c') project2 = Project.create_dummy(language=u'd') project3 = Project.create_dummy(language=u'e') | |
self.assertEqual(possible_project_names, list(Project.objects.values_list('name', flat=True))) | self.assertEqual( possible_project_names, sorted(list(Project.objects.values_list('name', flat=True)))) | def test_select_a_project_and_see_other_project_options(self): GET_data = {u'project': u'Miro'} query = mysite.search.controllers.Query.create_from_GET_data(GET_data) possible_project_names = [x['name'] for x in dict(query.get_possible_facets())['project']['options']] self.assertEqual(possible_project_names, list(Proje... |
my['Bugs older than one day + one hour ago'] = mysite.search.models.Bug.all_bugs.filter( | my['Bugs last polled more than than one day + one hour ago'] = mysite.search.models.Bug.all_bugs.filter( | def meta(request): data = {} data['dia_diagnostics'] = {} # temp variable for shortness my = data['dia_diagnostics'] my['Uncompleted DIAs'] = mysite.profile.models.DataImportAttempt.objects.filter( completed=False).count() one_minute_ago = (datetime.datetime.now() - datetime.timedelta(minutes=1)) my['Uncompleted DI... |
my['Bugs older than two days'] = mysite.search.models.Bug.all_bugs.filter( | my['Bugs last polled more than two days ago'] = mysite.search.models.Bug.all_bugs.filter( | def meta(request): data = {} data['dia_diagnostics'] = {} # temp variable for shortness my = data['dia_diagnostics'] my['Uncompleted DIAs'] = mysite.profile.models.DataImportAttempt.objects.filter( completed=False).count() one_minute_ago = (datetime.datetime.now() - datetime.timedelta(minutes=1)) my['Uncompleted DI... |
my['Bugs older than two days (in percent)'] = ( | my['Bugs last polled more than two days ago (in percent)'] = ( | def meta(request): data = {} data['dia_diagnostics'] = {} # temp variable for shortness my = data['dia_diagnostics'] my['Uncompleted DIAs'] = mysite.profile.models.DataImportAttempt.objects.filter( completed=False).count() one_minute_ago = (datetime.datetime.now() - datetime.timedelta(minutes=1)) my['Uncompleted DI... |
query_string = request.POST.get('query_string', None) | query_string = request.POST.get('query_string', '') | def subscribe_to_bug_alert_do(request): confirmation_query_string_fragment = "&confirm_email_alert_signup=1" alert_form = mysite.search.forms.BugAlertSubscriptionForm(request.POST) query_string = request.POST.get('query_string', None) # Lacks initial '?' query_string = query_string.replace(confirmation_query_string_fra... |
next = reverse(fetch_bugs) + '?' + query_string + confirmation_query_string_fragment | next += confirmation_query_string_fragment | def subscribe_to_bug_alert_do(request): confirmation_query_string_fragment = "&confirm_email_alert_signup=1" alert_form = mysite.search.forms.BugAlertSubscriptionForm(request.POST) query_string = request.POST.get('query_string', None) # Lacks initial '?' query_string = query_string.replace(confirmation_query_string_fra... |
failboat | return HttpResponseRedirect(next + request.META['QUERY_STRING']) | def subscribe_to_bug_alert_do(request): confirmation_query_string_fragment = "&confirm_email_alert_signup=1" alert_form = mysite.search.forms.BugAlertSubscriptionForm(request.POST) query_string = request.POST.get('query_string', None) # Lacks initial '?' query_string = query_string.replace(confirmation_query_string_fra... |
def exercise_alert(anonymous=True): | def exercise_alert(self, anonymous=True): | def exercise_alert(anonymous=True): """The 'anonymous' parameter allows the alert functionality to be tested for anonymous and logged-in users.""" |
query = 'ruby' opps_query_string = { 'q': } opps_url = make_twill_url('http://openhatch.org'+reverse(opps_view)) | query = u'ruby' p = Project.create_dummy(language='ruby') for i in range(15): b = Bug.create_dummy(description='ruby') b.project = p b.save() opps_query_string = { u'q': query, u'start': 1, u'end': 10} opps_url = make_twill_url('http://openhatch.org'+reverse(opps_view) + '?' + mysite.base.unicode_sanity.urlencode(opps... | def exercise_alert(anonymous=True): """The 'anonymous' parameter allows the alert functionality to be tested for anonymous and logged-in users.""" |
how_many_bugs_at_time_of_request = tc.find("there should be a suggestion regarding email alerts on this page") | tc.notfind("this page should offer a link to sign up for an email alert") opps_query_string = { u'q': query, u'start': 11, u'end': 20} opps_url = make_twill_url('http://openhatch.org'+reverse(opps_view) + '?' + mysite.base.unicode_sanity.urlencode(opps_query_string)) tc.go(opps_url) tc.find("this page should offer a... | def exercise_alert(anonymous=True): """The 'anonymous' parameter allows the alert functionality to be tested for anonymous and logged-in users.""" |
tc.fv('alert-email', email_address) | tc.fv('alert', 'alert-email', email_address) else: tc.find(User.objects.get(username='paulproteus').email) | def exercise_alert(anonymous=True): """The 'anonymous' parameter allows the alert functionality to be tested for anonymous and logged-in users.""" |
how_many_bugs_at_time_of_request, 'how_many_bugs_required_to_trigger_alert': how_many_bugs_required_to_trigger_alert * 20 | Bug.objects.filter(project=myproj).count(), | def exercise_alert(anonymous=True): """The 'anonymous' parameter allows the alert functionality to be tested for anonymous and logged-in users.""" |
assert_that_record_has_this_data['user__username'] = 'paulproteus' | assert_that_record_has_this_data['user'] = User.objects.get(username='paulproteus') assert_that_record_has_this_data['email'] = User.objects.get(username='paulproteus').email for key, value in assert_that_record_has_this_data.items(): self.assertEqual(alert_record.__getattribute__(key), value, 'we were looking for ' +... | def exercise_alert(anonymous=True): """The 'anonymous' parameter allows the alert functionality to be tested for anonymous and logged-in users.""" |
relevant_hrefs = [link.attrib['href'] for link in relevant_links] | relevant_hrefs = [link.attrib['href'] for link in relevant_links if '/contributors/' in link.attrib['href']] | def get_contribution_info_by_ohloh_username(self, ohloh_username, person=None): # FIXME: This doesn't return any WebResponse. How sad. # In branch pf2_with_webresponse_m2m, we are working on linking DIAs with multiple WebResponses, # after which we intend to return a list of WebResponses, or something like that. if ohl... |
def setUp(self): | @mock.patch('mysite.search.tasks.PopulateProjectLanguageFromOhloh') def setUp(self, do_nothing): | def setUp(self): SearchTest.setUp(self) python_project = Project.create_dummy(language=u'Python') perl_project = Project.create_dummy(language=u'Perl') c_project = Project.create_dummy(language=u'C') unknown_project = Project.create_dummy(language=u'') |
self.compare_lists_of_dicts( | self.assertEqual( | def test_languages_facet(self): # What options do we expect? languages_option_python = {'name': 'Python', 'count': 2, 'is_active': False, 'query_string': 'q=screensaver&language=Python'} languages_option_perl = {'name': 'Perl', 'count': 1, 'is_active': False, 'query_string': 'q=screensaver&language=Perl'} languages_opt... |
[languages_option_any] ) | languages_option_any) | def test_languages_facet(self): # What options do we expect? languages_option_python = {'name': 'Python', 'count': 2, 'is_active': False, 'query_string': 'q=screensaver&language=Python'} languages_option_perl = {'name': 'Perl', 'count': 1, 'is_active': False, 'query_string': 'q=screensaver&language=Perl'} languages_opt... |
should_create=True): | should_create=True, should_use_urlopen=True): | def test_scrape_bug_status_and_mark_as_closed(self, mock_urlopen, project_name='Mercurial', should_create=True): if Project.objects.filter(name=project_name): roundup_project = Project.objects.get(name=project_name) else: roundup_project = Project.create_dummy(name=project_name) |
self.test_scrape_bug_status_and_mark_as_closed(should_create=False) | self.test_scrape_bug_status_and_mark_as_closed(should_create=False, should_use_urlopen=False) def test_reimport_same_bug_works_when_bug_is_stale(self): self.test_scrape_bug_status_and_mark_as_closed() bug = Bug.all_bugs.get() bug.last_polled = datetime.datetime(1970, 1,1) bug.save() self.test_scrape_bug_status_and... | def test_reimport_same_bug_works(self): self.test_scrape_bug_status_and_mark_as_closed() self.test_scrape_bug_status_and_mark_as_closed(should_create=False) |
@mock.patch("mysite.search.tasks.bugzilla_instances.MiroBugzilla.get_current_xml_bug_tree") | @mock.patch("mysite.search.tasks.bugzilla_instances.MiroBugzilla.generate_current_bug_xml") | def test_full_grab_miro_bugs_refreshes_older_bugs(self, mock_xml_opener): mock_xml_opener.return_value = lxml.etree.XML(open(os.path.join( settings.MEDIA_ROOT, 'sample-data', 'miro-2294-2009-08-06.xml')).read()) miro = mysite.search.tasks.bugzilla_instances.MiroBugzilla() miro.update() |
mock_xml_bug_tree.return_value = lxml.etree.XML('''\ <bugzilla> </bugzilla> ''') | mock_xml_bug_tree.return_value = iter([]) | def test_regrab_miro_bugs_refreshes_older_bugs_even_when_missing_from_csv(self, mock_xml_bug_tree, mock_xml_opener): mock_xml_opener.return_value = lxml.etree.XML(open(os.path.join( settings.MEDIA_ROOT, 'sample-data', 'miro-2294-2009-08-06.xml')).read()) |
tc.find('ciao') | tc.notfind('settings') | def test_logout_web(self): self.test_login_web() url = 'http://openhatch.org/search/' url = make_twill_url(url) tc.go(url) tc.follow('log out') tc.find('ciao') |
tc.follow('Change photo') | tc.follow('photo') | def test_set_avatar(self): self.login_with_twill() for image in [photo('static/sample-photo.png'), photo('static/sample-photo.jpg')]: url = 'http://openhatch.org/people/paulproteus/' tc.go(make_twill_url(url)) tc.follow('Change photo') tc.formfile('edit_photo', 'photo', image) tc.submit() # Now check that the photo == ... |
"Bugs matching <strong>unicode</strong>": | "Bugs matching ‘<strong>unicode</strong>’": | def landing_page(request): data = {} data['entries'] = mysite.customs.feed.cached_blog_entries()[:3] recommended_bugs = [] if request.user.is_authenticated(): suggested_searches = request.user.get_profile().get_recommended_search_terms() recommended_bugs = mysite.profile.controllers.recommend_bugs(suggested_searches,... |
def extract_bug_tracker_specific_data(metadata_dict, bug_object): raise NotImplemented | def extract_bug_tracker_specific_data(self, metadata_dict, bug_object): raise RuntimeError(NotImplemented) | def extract_bug_tracker_specific_data(metadata_dict, bug_object): raise NotImplemented |
metadata_dict['Status'] == 'resolved' or | metadata_dict['Status'] == 'resolved') | def extract_bug_tracker_specific_data(self, metadata_dict, bug_object): bug_object.good_for_newcomers = ( 'bitesize' in metadata_dict['Keywords']) bug_object.concerns_just_documentation = ( 'documentation' in metadata_dict['Keywords']) bug_object.status = metadata_dict['Status'] bug_object.looks_closed = ( metadata_dic... |
@mock.patch('mysite.search.tasks.bugzilla_instances.url_is_more_fresh_than_one_day') def test_bugzilla_importing(self, mock_freshness): | @mock.patch('mysite.search.tasks.bugzilla_instances.url_is_more_fresh_than_one_day', mock.Mock(return_value=False)) def test_bugzilla_importing_hits_network_if_urls_are_not_fresh(self): | def test_url_is_more_fresh_than_one_day_with_really_long_url(self): # What the heck, let's demo this function out with the Songbird documentation query. URL = 'http://bugzilla.songbirdnest.com/buglist.cgi?query_format=advanced&component=Documentation&resolution=---&look=at_me_I_am_really_long_oh_no_what_will_we_do&real... |
if sum(self.urls_we_are_awiting_on.values()) == 0: | if sum(self.urls_we_are_waiting_on.values()) == 0: | def seems_finished(self): if sum(self.urls_we_are_awiting_on.values()) == 0: return True return False |
expected_toughness_facet_options = [toughness_option_bitesize, toughness_option_any] | expected_toughness_facet_options = [toughness_option_bitesize] | def test_toughness_facet(self): # What options do we expect? toughness_option_bitesize = {'name': 'bitesize', 'count': 1, 'is_active': False, 'query_string': 'q=screensaver&toughness=bitesize'} toughness_option_any = {'name': 'any', 'count': 3, 'is_active': True, 'query_string': 'q=screensaver&toughness='} expected_tou... |
languages_option_any | def test_languages_facet(self): # What options do we expect? languages_option_python = {'name': 'Python', 'count': 2, 'is_active': False, 'query_string': 'q=screensaver&language=Python'} languages_option_perl = {'name': 'Perl', 'count': 1, 'is_active': False, 'query_string': 'q=screensaver&language=Perl'} languages_opt... | |
expected_toughness_facet_options = [toughness_option_bitesize, toughness_option_any] | expected_toughness_facet_options = [toughness_option_bitesize] | def test_toughness_facet(self): # What options do we expect? toughness_option_bitesize = {u'name': u'bitesize', u'count': 1, u'is_active': False, u'query_string': u'q=&toughness=bitesize&language=Python'} toughness_option_any = {u'name': u'any', u'count': 2, u'is_active': True, u'query_string': u'q=&toughness=&language... |
languages_option_any | def test_languages_facet(self): # What options do we expect? languages_option_python = {u'name': u'Python', u'count': 2, u'is_active': True, u'query_string': u'q=&language=Python'} languages_option_perl = {u'name': u'Perl', u'count': 1, u'is_active': False, u'query_string': u'q=&language=Perl'} languages_option_c = {u'... | |
list(Project.objects.values_list('name', flat=True)) + ['any']) | list(Project.objects.values_list('name', flat=True))) | def test_select_a_project_and_see_other_project_options(self): GET_data = {u'project': u'Miro'} query = mysite.search.controllers.Query.create_from_GET_data(GET_data) possible_project_names = [x['name'] for x in dict(query.get_possible_facets())['project']['options']] self.assertEqual(possible_project_names, list(Proje... |
[u'documentation', u'']) | [u'documentation']) | def test_contribution_type_options_are_reasonable(self): GET_data = {} starting_query = mysite.search.controllers.Query.create_from_GET_data( GET_data) cto = starting_query.get_facet_options(u'contribution_type', [u'documentation', u'']) documentation_one, = [k for k in cto if k[u'name'] == u'documentation'] any_one, =... |
any_one, = [k for k in cto if k[u'name'] == u'any'] | any_one = starting_query.get_facet_options(u'contribution_type', [u''])[0] | def test_contribution_type_options_are_reasonable(self): GET_data = {} starting_query = mysite.search.controllers.Query.create_from_GET_data( GET_data) cto = starting_query.get_facet_options(u'contribution_type', [u'documentation', u'']) documentation_one, = [k for k in cto if k[u'name'] == u'documentation'] any_one, =... |
u'thingamabob', u'']) | u'thingamabob' ]) | def test_contribution_type_options_are_reasonable(self): GET_data = {} starting_query = mysite.search.controllers.Query.create_from_GET_data( GET_data) cto = starting_query.get_facet_options(u'project', [u'thingamajig', u'thingamabob', u'']) jig_ones, = [k for k in cto if k[u'name'] == u'thingamajig'] any_ones, = [k fo... |
any_ones, = [k for k in cto if k[u'name'] == u'any'] | any_one = starting_query.get_facet_options(u'project', [u''])[0] | def test_contribution_type_options_are_reasonable(self): GET_data = {} starting_query = mysite.search.controllers.Query.create_from_GET_data( GET_data) cto = starting_query.get_facet_options(u'project', [u'thingamajig', u'thingamabob', u'']) jig_ones, = [k for k in cto if k[u'name'] == u'thingamajig'] any_ones, = [k fo... |
self.assertEqual(any_ones[u'count'], 3) | self.assertEqual(any_one[u'count'], 3) | def test_contribution_type_options_are_reasonable(self): GET_data = {} starting_query = mysite.search.controllers.Query.create_from_GET_data( GET_data) cto = starting_query.get_facet_options(u'project', [u'thingamajig', u'thingamabob', u'']) jig_ones, = [k for k in cto if k[u'name'] == u'thingamajig'] any_ones, = [k fo... |
question = ProjectInvolvementQuestion.create_dummy(pk=question__pk, is_bug_style=True) | question = ProjectInvolvementQuestion.create_dummy( key_string='non_code_participation', is_bug_style=True) | def test_create_bug_answer(self): # go to the project page p = Project.create_dummy(name='Ubuntu') question__pk = 1 question = ProjectInvolvementQuestion.create_dummy(pk=question__pk, is_bug_style=True) question.save() title = 'omfg i wish this bug would go away' details = 'kthxbai' POST_data = { 'project__pk': p.pk, '... |
details = 'kthxbai' | text = 'kthxbai' | def test_create_bug_answer(self): # go to the project page p = Project.create_dummy(name='Ubuntu') question__pk = 1 question = ProjectInvolvementQuestion.create_dummy(pk=question__pk, is_bug_style=True) question.save() title = 'omfg i wish this bug would go away' details = 'kthxbai' POST_data = { 'project__pk': p.pk, '... |
'bug__title': title, 'bug__details': details | 'answer__title': title, 'answer__text': text | def test_create_bug_answer(self): # go to the project page p = Project.create_dummy(name='Ubuntu') question__pk = 1 question = ProjectInvolvementQuestion.create_dummy(pk=question__pk, is_bug_style=True) question.save() title = 'omfg i wish this bug would go away' details = 'kthxbai' POST_data = { 'project__pk': p.pk, '... |
POST_handler = reverse(mysite.project.views.create_bug_answer_do) | POST_handler = reverse(mysite.project.views.create_answer_do) | def test_create_bug_answer(self): # go to the project page p = Project.create_dummy(name='Ubuntu') question__pk = 1 question = ProjectInvolvementQuestion.create_dummy(pk=question__pk, is_bug_style=True) question.save() title = 'omfg i wish this bug would go away' details = 'kthxbai' POST_data = { 'project__pk': p.pk, '... |
our_bug_answer = BugAnswer.objects.get(title=title) | our_bug_answer = Answer.objects.get(title=title) | def test_create_bug_answer(self): # go to the project page p = Project.create_dummy(name='Ubuntu') question__pk = 1 question = ProjectInvolvementQuestion.create_dummy(pk=question__pk, is_bug_style=True) question.save() title = 'omfg i wish this bug would go away' details = 'kthxbai' POST_data = { 'project__pk': p.pk, '... |
self.assertEqual(our_bug_answer.details, details) | self.assertEqual(our_bug_answer.text, text) | def test_create_bug_answer(self): # go to the project page p = Project.create_dummy(name='Ubuntu') question__pk = 1 question = ProjectInvolvementQuestion.create_dummy(pk=question__pk, is_bug_style=True) question.save() title = 'omfg i wish this bug would go away' details = 'kthxbai' POST_data = { 'project__pk': p.pk, '... |
self.assertContains(project_page, details) | self.assertContains(project_page, text) | def test_create_bug_answer(self): # go to the project page p = Project.create_dummy(name='Ubuntu') question__pk = 1 question = ProjectInvolvementQuestion.create_dummy(pk=question__pk, is_bug_style=True) question.save() title = 'omfg i wish this bug would go away' details = 'kthxbai' POST_data = { 'project__pk': p.pk, '... |
enabled_bugzilla_instances = [] | enabled_bugzilla_instances = [subclass for subclass in mysite.customs.bugtrackers.bugzilla.generate_bugzilla_tracker_classes()] | def find_and_update_enabled_bugzilla_instances(self): enabled_bugzilla_instances = [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.