query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Parse all the receipts in a page $($('receiptList')[0], '.receipt')
def get_all_receipts(driver): for rs in driver.find_elements_by_css_selector('#receiptList > .receipt'): m = rs.find_element_by_class_name('merchant').text a = rs.find_element_by_class_name('amount').text tags = get_tags(rs) # created = rs.find_element_by_class_name('created').text ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_page(html):\n\n soup = BeautifulSoup(html, \"html.parser\")\n review_soups = soup.find_all(\"script\", type=\"application/ld+json\")\n\n description_list = []\n for soup in review_soups:\n text = soup.string\n # decode the json into python dict\n js_dict = json.loads(text...
[ "0.5918104", "0.58435255", "0.58188194", "0.57904243", "0.5556428", "0.5508593", "0.5491882", "0.5340022", "0.5337224", "0.5319644", "0.53191775", "0.52593327", "0.5188675", "0.51741016", "0.5160254", "0.5149924", "0.51434594", "0.51386225", "0.5125705", "0.5125278", "0.51094...
0.7097282
0
Adds a random tag to te element e
def add_tag(e, driver): tag = random_tag(8) e.find_element_by_class_name('add-tag').click() driver.find_element_by_class_name('tag_input')\ .send_keys(tag) driver.find_element_by_class_name('tag_input')\ .send_keys(Keys.ENTER) # driver.find_elements_by_class_name('save-tag')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_tag():\n le = string.ascii_lowercase\n t = ''.join(random.choices(le, k=20))\n while t in all_sync_tags:\n t = ''.join(random.choices(le, k=20))\n all_sync_tags.add(t)\n return t", "async def random(self, ctx: \"IceTeaContext\"):\n random_tag = await ctx.guild_data.get_random...
[ "0.65818673", "0.6172663", "0.5825145", "0.5720927", "0.5680862", "0.5654317", "0.56073415", "0.55814886", "0.54953814", "0.5490698", "0.5482699", "0.544681", "0.5446589", "0.54433995", "0.5442182", "0.5436922", "0.54314387", "0.54289097", "0.5411935", "0.5398727", "0.5386961...
0.6847355
0
Adds a receipt and checks if the receipt is available in the page or not.
def test_add_receipts(driver): print("-"*80) print("Test: Adding a receipt") print("-"*80) driver = driver time.sleep(1) old_receipts = list(get_all_receipts(driver)) m, a = add_receipts(driver) if DEBUG>=2: driver.refresh() time.sleep(1) new_receipts = list(get_all_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_receipt(self, expense_id, receipt):\n url = base_url + expense_id + '/receipt'\n attachments = [{\n 'receipt': {\n 'filename': basename(receipt),\n 'content': open(receipt).read()\n }\n }]\n data = {...
[ "0.6474564", "0.60533386", "0.60503274", "0.59340584", "0.59150124", "0.5709651", "0.5687415", "0.5664679", "0.55857974", "0.5524835", "0.54288006", "0.5311793", "0.53011096", "0.5201266", "0.5190392", "0.51798517", "0.51535845", "0.5153071", "0.51528484", "0.5149826", "0.514...
0.6201582
1
Adds tag to a randomly chosen receipts, and test if the tag appears in the page.
def test_add_tag(driver): print("-"*80) print("Test: Adding a tag") print("-"*80) time.sleep(1) # Get all receipts receipts = driver.find_elements_by_class_name('receipt') # Choose a receipt randomly to add tag i = random.randint(0, len(receipts)-1) e = receipts[i] # Click on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_tag_available(self, tag):\n if not self.is_tag_available(tag):\n self.available_tags.append(tag)\n return True\n return False", "def add_tag(e, driver):\n tag = random_tag(8)\n e.find_element_by_class_name('add-tag').click()\n \n driver.find_element_by_cla...
[ "0.61787117", "0.58436096", "0.56740206", "0.5673675", "0.56630784", "0.560776", "0.5599565", "0.5599389", "0.55671066", "0.5524673", "0.55101967", "0.5503966", "0.540269", "0.53944606", "0.5385403", "0.5377311", "0.5365164", "0.53577447", "0.53268236", "0.53238463", "0.53207...
0.6953735
0
Selects a random receipt and delets its one of the tag.
def test_del_tag(driver): print("-"*80) print("Test: Deleting a tag") print("-"*80) # Select a random receipt receipts = driver.find_elements_by_class_name('receipt') index_of_random_receipt = random.randint(0, len(receipts)-1) e = receipts[index_of_random_receipt] # Click on the add-ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_card_to_discard(self):\n random.choice(self.hand.card_list).use()", "def popitem(self):\n all_items = self.items()\n removed_item = random.choice(all_items)\n self[removed_item[0]] = None\n return removed_item", "def randomchooseanddelete():\n\t\tvar = random.choic...
[ "0.56589305", "0.56030184", "0.5574104", "0.5553268", "0.5550799", "0.5537981", "0.5410938", "0.5271329", "0.52251256", "0.5189678", "0.518462", "0.518013", "0.51355296", "0.5100171", "0.50719386", "0.50703305", "0.5046442", "0.5043233", "0.50326264", "0.50287735", "0.5027231...
0.5921851
0
Tests that no duplicate tags are present in any of the receipt rows.
def test_no_duplicate_tag(driver): for i,rs in enumerate(driver.find_elements_by_class_name('receipt')): l = list(get_tags(rs)) if len(l) != len(set(l)): print("There are duplicate tags in the {}-th receipt line"\ .format(i)) print("Found tag: {!r}".format(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_identify_duplicates_2(self):\n\n ticket1 = ticket.ImportTicket()\n ticket1.id = \"none\"\n ticket1.type = \"replace\"\n ticket1.phage_id = \"none\"\n\n ticket2 = ticket.ImportTicket()\n ticket2.id = \"none\"\n ticket2.type = \"replace\"\n ticket2.pha...
[ "0.64517295", "0.63557196", "0.63374513", "0.63146347", "0.62994874", "0.6062375", "0.5988476", "0.5920074", "0.5837031", "0.5792533", "0.5742825", "0.5715697", "0.56995887", "0.5624811", "0.5606689", "0.5596342", "0.5590627", "0.5542353", "0.5532762", "0.54885316", "0.546058...
0.7634636
0
Obtain the student list from the github page.
def get_github_student_url(netid): url = 'https://raw.githubusercontent.com/CT-CS5356-Fall2017/cs5356/master/README.md' r = requests.get(url) assert r.ok text = r.text for l in text.split('\n'): if netid in l: return extract_netid_and_url(l) return None, None, None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_student():\n\n github = request.args.get('github', 'jhacks')\n first, last, github = hackbright.get_student_by_github(github)\n\n\n rows = hackbright.list_projects(github)\n\n return render_template (\"student_info.html\",\n first=first,\n l...
[ "0.76476395", "0.76356137", "0.75395155", "0.74945027", "0.74906665", "0.7481209", "0.7445407", "0.73635167", "0.71734434", "0.7094604", "0.6793378", "0.6793378", "0.6773407", "0.6719253", "0.64450616", "0.6293417", "0.6264575", "0.61711216", "0.60709566", "0.60630196", "0.60...
0.6192105
17
sub is the URI for this submaster, graph is a graph where we can learn about the sub. If graph is not provided, we look in a file named name. name is the filename where we can load a graph about this URI (see showconfig.subFile) passing name alone makes a new empty sub temporary means the sub won't get saved or loaded
def __init__(self, name=None, graph=None, sub=None, leveldict=None, temporary=False): if name is sub is leveldict is None: raise TypeError("more args are needed") if sub is not None and name is None: name = graph.label(sub) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readSubgraph(graph, ctxURI):\n filename = filenameFromURI(ctxURI)\n for dateDir in os.listdir(\"graph\"):\n f = \"graph/%s/%s\" % (dateDir, filename)\n if os.path.exists(f):\n print \"readSubgraph adds\", f\n graph.parse(f, format=SUBGRAPH_FORMAT, publicID=ctxURI)", ...
[ "0.6257602", "0.6256526", "0.571922", "0.56646866", "0.56184924", "0.5403181", "0.53438115", "0.5342686", "0.5310563", "0.53039163", "0.5279179", "0.5236011", "0.52190375", "0.5109594", "0.50893027", "0.505222", "0.5039063", "0.5036581", "0.50334924", "0.501467", "0.501467", ...
0.57035416
3
Use only the primary patch names.
def normalize_patch_names(self): # possibly busted -- don't use unless you know what you're doing self.set_all_levels(self.levels.copy())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_base_patch_attribute(self, name):\n return getattr(self.patches[0],name)", "def select_patch(self, pset, name):\n new_pset = {}\n local = []\n for p in pset.pop(name, []):\n if p.path:\n new_pset[p.pop()] = [p]\n else:\n loc...
[ "0.58377707", "0.56666094", "0.5597444", "0.5579668", "0.5453649", "0.5399043", "0.5339904", "0.53296804", "0.5318845", "0.53062016", "0.5186838", "0.5186247", "0.51232326", "0.5088145", "0.5077108", "0.5073389", "0.50535864", "0.5053332", "0.50263005", "0.50233734", "0.50104...
0.6785791
0
Get a copy of this sumbaster that only uses the primary patch names. The levels will be the same.
def get_normalized_copy(self): newsub = Submaster("%s (normalized)" % self.name, temporary=1) newsub.set_all_levels(self.levels) return newsub
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_patch_names(self):\n # possibly busted -- don't use unless you know what you're doing\n self.set_all_levels(self.levels.copy())", "def select_patch(self, pset, name):\n new_pset = {}\n local = []\n for p in pset.pop(name, []):\n if p.path:\n ...
[ "0.6610615", "0.55338424", "0.5316381", "0.50903565", "0.4965529", "0.49571154", "0.48675856", "0.48469475", "0.4844921", "0.4835232", "0.48207238", "0.47844133", "0.4756528", "0.4659601", "0.46503493", "0.46458557", "0.4645491", "0.46413666", "0.46378627", "0.46317893", "0.4...
0.57336044
1
Returns a new sub that is a crossfade between this sub and another submaster.
def crossfade(self, othersub, amount): otherlevels = othersub.get_levels() keys_set = {} for k in self.levels.keys() + otherlevels.keys(): keys_set[k] = 1 all_keys = keys_set.keys() xfaded_sub = Submaster("xfade", temporary=1) for k in all_keys: x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def single_crossover(self, original1, original2):\n point=self.r.uniform(0.1,0.6)\n cut1=int(point*len(original1))\n cut2=int(point*len(original2))\n child1=original1[:cut1]+original2[cut2:]\n child2=original2[:cut2]+original1[cut1:]\n return child1, child2", "def cross_...
[ "0.5533875", "0.53190196", "0.51839143", "0.51807356", "0.516271", "0.51314044", "0.50931656", "0.5081098", "0.50494057", "0.4948672", "0.48324168", "0.48280615", "0.4818816", "0.48025087", "0.47644114", "0.4739545", "0.47050485", "0.4703831", "0.4700212", "0.468024", "0.4679...
0.6667901
0
Compare by sub repr (name, hopefully)
def __cmp__(self, other): return cmp(repr(self), repr(other))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(self, p_str, p_str_1): # real signature unknown; restored from __doc__\n return 0", "def simplecompare(left, right): # {{{2\n return simplifyname(left) == simplifyname(right)", "def compare(self, subnode) -> bool:\n\t\t# OK the node if it has a different name.\n\t\tif subnode.name != self....
[ "0.652829", "0.6498774", "0.62934", "0.62529504", "0.6075222", "0.6040502", "0.6037785", "0.5980569", "0.59679115", "0.5904851", "0.58886135", "0.5821633", "0.5770389", "0.5770389", "0.5766717", "0.57128614", "0.57128614", "0.57128614", "0.5695189", "0.56796706", "0.567816", ...
0.6340613
2
Fades between two floats by an amount. amount is a float between 0 and 1. If amount is 0, it will return the start value. If it is 1, the end value will be returned.
def linear_fade(start, end, amount): level = start + (amount * (end - start)) return level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_fade(f):\n\n return 6 * f**5 - 15 * f**4 + 10 * f**3", "def note(f, start, end, fade=.01):\n\n def sampler(t):\n seconds = t / frame_rate\n if seconds < start:\n return 0\n elif seconds > end:\n return 0\n elif seconds < start + fade:\n ...
[ "0.63774043", "0.58785605", "0.57970434", "0.57820743", "0.5732445", "0.55991083", "0.55940306", "0.54289734", "0.5340329", "0.52971613", "0.52749896", "0.5232748", "0.52009887", "0.52002275", "0.51993597", "0.5190919", "0.5162115", "0.5096275", "0.50267357", "0.501857", "0.5...
0.71994865
0
Make a submaster with chans at full.
def fullsub(*chans): return Submaster('%r' % chans, leveldict=dict([(c, 1.0) for c in chans]), temporary=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slave_to_master():\n print(\"Shifting from slave to master\")\n stop_slave_worker()\n setup_slave_web()\n pull_from_slave()\n commit_pull_to_db()\n stop_slave_web()\n start_master_worker()\n print(\"DONE!\")", "def _createMaster(self, *args, **kwds):\n raise NotImplementedError...
[ "0.58434314", "0.5790138", "0.577078", "0.5688928", "0.5688928", "0.56830597", "0.5652936", "0.56389004", "0.5592588", "0.5241908", "0.51976085", "0.51319396", "0.5120436", "0.5092865", "0.506428", "0.5058892", "0.50532806", "0.505305", "0.5025217", "0.5023051", "0.5001885", ...
0.72206587
0
Get (and make on demand) the global instance of Submasters
def get_global_submasters(): global _submasters if _submasters is None: _submasters = Submasters() return _submasters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_as_global(self):\n return setup(env=self)", "def getCore(cls):\n if RegistryCore in SingletonMetaClass._instances:\n return SingletonMetaClass._instances[RegistryCore]\n else:\n dummyCore = RegistryCore() # Which will persist because it is a singleton\n ...
[ "0.61441386", "0.5998967", "0.5872403", "0.5779558", "0.5716639", "0.5647827", "0.5647827", "0.55729216", "0.5532796", "0.5526975", "0.5435401", "0.5431643", "0.53985244", "0.53905225", "0.53872716", "0.53734785", "0.5368312", "0.5367188", "0.5337147", "0.531928", "0.52608085...
0.844328
0
name is a channel or sub nama, submasters is a Submasters object. If you leave submasters empty, it will use the global instance of Submasters.
def get_sub_by_name(name, submasters=None): if not submasters: submasters = get_global_submasters() if name in submasters.get_all_sub_names(): return submasters.get_sub_by_name(name) try: val = int(name) s = Submaster("#%d" % val, leveldict={val : 1.0}, temporary=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_global_submasters():\n global _submasters\n if _submasters is None:\n _submasters = Submasters()\n return _submasters", "def getSlave(name):", "def __init__(self,name):\n self.name=name", "def choose_master(searchname):\n masters = get_masters()\n masternames = []\n master_l...
[ "0.60327685", "0.5456186", "0.52233124", "0.52174276", "0.5192696", "0.5189498", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.515374", "0.51509494", "0.51326793", "0.511801", "0.511137...
0.6861665
0
Get list of values for Towns or Flats
def get_list_by_id(driver, id): try: flat_list = [ a.get_attribute("value") for a in driver.find_element_by_id(id).find_elements_by_tag_name("option") ] return flat_list except Exception: return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sub_values(self):\n return list()", "def values(self, ctx, key):\n many = list()\n for member in self._members:\n if member == \"domestic\":\n many.append(\"USA\")\n else:\n many.appen...
[ "0.57573897", "0.57160014", "0.54090106", "0.53499687", "0.53499687", "0.5321765", "0.5275088", "0.527258", "0.5265491", "0.5206687", "0.5197695", "0.51752776", "0.5147378", "0.5105366", "0.5098353", "0.5074413", "0.5068465", "0.50452", "0.50440454", "0.5041997", "0.50381625"...
0.0
-1
Get block links that needs to be scraped
def get_block_links(driver, flat_link): success = False while not success: try: driver.get(flat_link) links = [ a.find_element_by_tag_name("div").get_attribute("onclick") for a in driver.find_element_by_tag_name( "table" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_links(links):\n chrome_options = set_chrome_options()\n driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)\n # driver = webdriver.Chrome(ChromeDriverManager().install())\n data = []\n click.secho(\"Processing Blocks\", fg=\"green\")\n for link in links:\...
[ "0.64953417", "0.63744885", "0.63381374", "0.6304446", "0.6284163", "0.6245196", "0.6236293", "0.62197006", "0.62188816", "0.62003785", "0.6200064", "0.61960524", "0.61911696", "0.6149259", "0.6149259", "0.6077804", "0.60738134", "0.6063514", "0.60611784", "0.6055509", "0.605...
0.69733745
0
Returns the value of the object in the html doc
def get_value_by_id(driver, id): try: return driver.find_element_by_id(id).get_attribute("value") except Exception: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getValue(self):\n return self.text()", "def get(self):\n return self.text", "def value(self) -> str:\n return self.textContent", "def value(self) -> str:\n logging.info(f\"get element value. {self.desc}\")\n js = f\"\"\"return document.querySelectorAll(\"{self.css}\")[{...
[ "0.69438607", "0.68847394", "0.6519228", "0.641823", "0.63363945", "0.63048047", "0.63006294", "0.62927264", "0.6240657", "0.62233037", "0.61801374", "0.61370933", "0.60944414", "0.60770327", "0.60549545", "0.60404533", "0.60396016", "0.6038859", "0.60195327", "0.60172534", "...
0.0
-1
Get block details (Block, Street, Ethnic Quota, Delivery Date etc.)
def get_block_details(driver): block_details = driver.find_elements_by_xpath( "//div[contains(@id, 'blockDetails')]" "/div[contains(@class, 'row')]" "/div[contains(@class, 'columns')]" ) data = [] for block in block_details: text = block.text.strip().replace("\xa0", " ") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_info(self, block):\n # Allow for a list of blocks..\n block = utils.request_type(block)\n\n res = r.get(self.url + self.block + str(block))\n return self.execute(res)", "def get_block(blockhash):\n return requests.get(BASE+f'/api/block/{blockhash}').json()", "def get_bl...
[ "0.75774884", "0.70849556", "0.67741823", "0.6712757", "0.6633147", "0.6616499", "0.651604", "0.6455317", "0.6438343", "0.6410969", "0.6402337", "0.63255215", "0.63255215", "0.6322955", "0.6290969", "0.62387437", "0.6234543", "0.61930615", "0.6183136", "0.6164675", "0.6121300...
0.6142854
20
Return the block details and unit details of the block that needs to be scraped
def process_block(driver, link): success = False while not success: try: initial_dict = {} driver.execute_script(link) sleep(5) initial_dict["Town"] = get_value_by_id(driver, "Town") initial_dict["Flat"] = get_value_by_id(driver, "Flat") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_block_details(driver):\n block_details = driver.find_elements_by_xpath(\n \"//div[contains(@id, 'blockDetails')]\"\n \"/div[contains(@class, 'row')]\"\n \"/div[contains(@class, 'columns')]\"\n )\n data = []\n for block in block_details:\n text = block.text.strip().re...
[ "0.7465973", "0.7022857", "0.6690495", "0.6238568", "0.6185555", "0.61804634", "0.6017959", "0.5901549", "0.5897106", "0.5874875", "0.57887346", "0.5779844", "0.5719809", "0.56906885", "0.5678055", "0.56490666", "0.56474906", "0.5632621", "0.5591605", "0.5585963", "0.558427",...
0.62705994
3
Get unit details such as price, unit number and size of the flat
def get_unit_details(driver): unit_details = [ a for a in driver.find_elements_by_xpath("//span[contains(@class, 'tooltip')]") if "$" in a.get_attribute("title") ] data = [] for unit in unit_details: unit_dict = {} unit_dict["Unit"] = unit.get_attribute("data-sele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_units(self, unit_tag):\n\n # a list that contains apartment unit's information\n unit = []\n # use a loop to list all the cells in a row \n for cell in unit_tag.find_all('td'):\n if cell.attrs: # omit the cell with nothing in it \n # look for the apart...
[ "0.65363365", "0.6247561", "0.62094957", "0.6176072", "0.60823435", "0.60677147", "0.60247993", "0.59882915", "0.5932856", "0.5925027", "0.59137136", "0.59080875", "0.5906841", "0.59064364", "0.58812594", "0.581311", "0.5801488", "0.5773368", "0.57587975", "0.57579017", "0.56...
0.62567747
1
Scrapes the given HDB flat link
def scrape_link(driver, flat_link): block_links = get_block_links(driver, flat_link) final_data = [] town = unquote(re.compile("Town=(.+?)&").findall(flat_link)[0]) flat = unquote(re.compile("Flat=(.+?)&").findall(flat_link)[0]) with click.progressbar( block_links, label=f"{town} - {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(url):", "def query_download_link_from_ebi(query):\n all_links = list()\n fl = get_accession(query)\n for r in fl:\n tmp = get_download_link(r)\n if len(tmp) > 0:\n all_links.extend(tmp)\n ret_links = [\"ftp://\"+link for link in all_links]\n return sorted(list(se...
[ "0.5718415", "0.57158643", "0.55186397", "0.548208", "0.54378086", "0.54260284", "0.5411816", "0.5407343", "0.5341128", "0.53196687", "0.5304999", "0.527208", "0.52331084", "0.52271384", "0.5219008", "0.52138084", "0.52050495", "0.5154918", "0.51489604", "0.5146916", "0.51392...
0.50706863
26
Retrieves the list of links that needs to be scraped from the HDB site
def get_links_to_scrape(selection_type, launch_date, flat_type=None, town=None): flats_available = get_available_flats(selection_type) links = [] if flats_available: launch_list = [x for x in flats_available if x["launch_date"] == launch_date] if len(launch_list) == 1: launch = l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_article_links(self):\n urls = []\n for page in range(self._start, self._end+1):\n urls.append(self._searchURL + str(page))\n result_list = await self._connect(urls)\n\n self._urls = []\n hares_links = []\n for result in result_list:\n so...
[ "0.71196836", "0.6982231", "0.69748014", "0.6669149", "0.65978754", "0.6594985", "0.65475273", "0.653703", "0.65365434", "0.6533951", "0.64862245", "0.6483864", "0.6464923", "0.64329183", "0.64310044", "0.64140874", "0.6400334", "0.6399905", "0.63990253", "0.63548243", "0.634...
0.0
-1
Scrape all the links provided
def scrape_links(links): chrome_options = set_chrome_options() driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options) # driver = webdriver.Chrome(ChromeDriverManager().install()) data = [] click.secho("Processing Blocks", fg="green") for link in links: flat_da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_scraping(final_links, driver):\n\n for final_link in final_links:\n tags = extract_all_tags(final_link, driver)\n if len(tags) != 0:\n final_tags = find_usefull_tags(tags, tagmodel, tag_count_vect)\n if len(final_tags) != 0:\n print('Extracting(classna...
[ "0.7583046", "0.7526638", "0.738387", "0.73196805", "0.7291691", "0.7291431", "0.71704775", "0.7136285", "0.7109048", "0.71016616", "0.70481175", "0.70481175", "0.6999034", "0.69867545", "0.69702506", "0.6962078", "0.6943053", "0.6934792", "0.69260466", "0.68911314", "0.68731...
0.74114144
2
Retrieves all the links to scrape and scrapes them
def scrape(selection_type, launch_date, flat_type=None, town=None): click.secho("\nStarting to scrape for...", fg="yellow") click.secho( f"Type : {selection_type}, Launch Date : {launch_date}, " f"Flat Type : {flat_type if flat_type else 'All'} Room, " f"Town : {town if town else 'All'}"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_links(self, soup):\n \"\"\" @param soup: BeautifulSoup object that cointains the targeted links \"\"\"\n \"\"\" @type soup: BeautifulSoup object \"\"\"\n for link in soup.select('a[href^=\"https://\"]'): # All links which have a href element\n href = link.get('href') # The...
[ "0.75396395", "0.72842485", "0.72815204", "0.72737837", "0.72676533", "0.71962756", "0.71267897", "0.7033066", "0.6953482", "0.6929304", "0.69227266", "0.690421", "0.6901927", "0.68815696", "0.6868711", "0.6855402", "0.6835952", "0.68060416", "0.6781345", "0.6776316", "0.6770...
0.0
-1
Sets chrome options for Selenium. Chrome options for headless browser is enabled.
def set_chrome_options(): chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--disable-dev-shm-usage") chrome_prefs = {} chrome_options.experimental_options["prefs"] = chrome_prefs chrome_prefs["profil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chrome_options(chrome_options):\n # https://pytest-selenium.readthedocs.io/en/latest/user_guide.html#id2\n chrome_options.add_argument(\"--headless\")\n return chrome_options", "def get_driver_options():\n # Define Browser Options\n chrome_options = Options()\n chrome_options.add_argument(\...
[ "0.8496415", "0.7502271", "0.7380162", "0.732335", "0.7207787", "0.72045255", "0.7193336", "0.71788657", "0.71749604", "0.7159074", "0.69817954", "0.6930866", "0.69131696", "0.68333215", "0.67308944", "0.66156524", "0.65814704", "0.6520646", "0.64218086", "0.6401822", "0.6392...
0.8364757
1
Get a stable matching M.
def gale_shapley(preferences): men = [None for _ in range(len(preferences[0]))] women = men[:] while None in men: m_index = men.index(None) w_index = preferences[0][m_index].pop(0) if women[w_index] is None: men[m_index] = w_index women[w_index] = m_index ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_match(self, list):\n raise NotImplementedError", "def mst(self):\n candidate = self.greedy()\n cycle = candidate.find_cycle()\n if not cycle:\n return candidate\n new_id, old_edges, compact = self.contract(cycle)\n merged = self.merge(compact.mst(...
[ "0.5943371", "0.5701889", "0.56933075", "0.536049", "0.53329885", "0.5310596", "0.5237595", "0.5233238", "0.5206456", "0.51877546", "0.5182246", "0.51267123", "0.5119106", "0.5103096", "0.5059229", "0.50577456", "0.50360453", "0.50291455", "0.5021538", "0.5006081", "0.5004837...
0.0
-1
if a match for any of the terms, add to collection
def inspect_text(self, page_text, terms): # convert all text to lower case to # increase likelihood of match page_text_lower = page_text.lower() page_text_lower = page_text_lower.replace('\r', '').replace('\n', '') payload = [ # populate with match dicts ] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, keyword, definitions):\r\n for x_temp in definitions:\r\n self.query(term1='kd',term2=keyword,term3=x_temp.strip(),action='set')", "def filter_matches_add(self, key, value):\n\t\tif key in self.filter_matches.keys():\n\t\t\tself.filter_matches[key].append(value)\n\t\telse:\n\t\t\t...
[ "0.59386075", "0.59243774", "0.5805406", "0.5803124", "0.57706547", "0.5768881", "0.57660365", "0.5763686", "0.57444286", "0.5717375", "0.5699989", "0.56840605", "0.5662643", "0.5640335", "0.55982566", "0.5573996", "0.557234", "0.55294293", "0.55034256", "0.5490613", "0.54661...
0.0
-1
if a match for any of the terms, add to collection
def inspect_doc(self, file, terms): # populate with studies in loop reports = [] # extract text and do the search for i, chunk in enumerate(file.content_chunks()): study = self.inspect_text(chunk, terms) for entry in study: # only populate if th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, keyword, definitions):\r\n for x_temp in definitions:\r\n self.query(term1='kd',term2=keyword,term3=x_temp.strip(),action='set')", "def filter_matches_add(self, key, value):\n\t\tif key in self.filter_matches.keys():\n\t\t\tself.filter_matches[key].append(value)\n\t\telse:\n\t\t\t...
[ "0.59407234", "0.59250385", "0.58055615", "0.58037716", "0.577241", "0.5770614", "0.576582", "0.57644546", "0.574501", "0.57189065", "0.5701197", "0.56857425", "0.566223", "0.5640238", "0.5600224", "0.5575121", "0.55734783", "0.5529684", "0.55030024", "0.5492", "0.5466994", ...
0.0
-1
inspect files for terms and package in report
def process(self, terms): for entry in self.files: try: logger.info('file - {0}'.format(entry.path)) # notional output file path path_sentences = self.path.joinpath('{0}.csv'.format(entry.path.stem)) path_summary = self.path.joinpath('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inspect_doc(self, file, terms):\n # populate with studies in loop\n reports = []\n\n # extract text and do the search\n for i, chunk in enumerate(file.content_chunks()):\n\n study = self.inspect_text(chunk, terms)\n\n for entry in study:\n # only...
[ "0.58868176", "0.5764706", "0.554264", "0.54554343", "0.5339803", "0.53092337", "0.5306702", "0.5306702", "0.5279815", "0.5256303", "0.5224792", "0.52182484", "0.52127594", "0.5207112", "0.51852155", "0.51701903", "0.5164076", "0.5128097", "0.5112102", "0.51082677", "0.509898...
0.6321172
0
Compute topicbased evaluation measures.
def get_topic_measures(dict_clusters, dict_groundtruth, exact_match=True, cluster_n=None, coverage_percentage=None, coverage_n=None, keep_cluster_duplicates=False): total_tp = 0 total_fp = 0 total_n = get_total_time_frame_count(dict_groundtruth) dict_time_frame_measures = dict() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_eval_measures(I_ref, I_est):\n assert I_ref.shape == I_est.shape, \"Dimension of input matrices must agree\"\n TP = np.sum(np.logical_and(I_ref, I_est))\n FP = np.sum(I_est > 0, axis=None) - TP\n FN = np.sum(I_ref > 0, axis=None) - TP\n P = 0\n R = 0\n F = 0\n if TP > 0:\n ...
[ "0.6625372", "0.64955384", "0.6448829", "0.6443132", "0.6389598", "0.6364721", "0.63611853", "0.6323378", "0.6317727", "0.6317414", "0.62976706", "0.6265887", "0.6255314", "0.6248004", "0.62303275", "0.6208526", "0.62012196", "0.6184607", "0.61584944", "0.61475414", "0.613873...
0.607863
25
This will assign each uniqueSynIDBabelNetDict item to its belonging doc's index's synsetID in docIndexBabelSynsetID. It will return a new dict contains docIndexLangTrans which only contains each translation's simple lemma.
def queryBabelNetSimpleLemma(docIndexBabelSynsetID, keyset = ['0b8bb0c1-7e51-41f6-8d32-31d15a9ca7ad',\ '29738119-195a-42c8-ace1-8a78de74b891'], limit = 1000): uniqueSynIDBabelNetDict = getUniqueSynsetIDInfo(docIndexBabelSynsetID,\ keyset, limit) return uniqueSynIDDict2docIndexLangSimpleLemma\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_rel_doctitle_dict():\n claim_rel_docno_dict = {} #key is claim text, value is a set of doc_title that are relevant\n clm_sen_doc_title_dict = read_pickle(\"sen_doc_title_dict\")\n claim_sen_true_relevance_dict = read_pickle(\"claim_sen_relevance_dict_\"+curr_source)\n exclude = set(string.pu...
[ "0.5330593", "0.503289", "0.49542165", "0.4926849", "0.48962122", "0.48810023", "0.48669112", "0.4849703", "0.4818311", "0.4808446", "0.47217777", "0.47156107", "0.47085276", "0.46934414", "0.468521", "0.4650607", "0.4636594", "0.4608131", "0.45931166", "0.45893452", "0.45717...
0.54201746
0
Clean away the 10% of points that have the largest residual errors (difference between the prediction and the actual net worth). Return a list of tuples named cleaned_data where each tuple is of the form (age, net_worth, error).
def outlierCleaner(predictions, ages, net_worths): cleaned_data = [] from math import pow as mt import numpy as np residual_error = predictions-net_worths squares=[] squares=pow(residual_error,2) max=np.sort(squares,axis=None)[-9] j=0 for i in predictions: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outlierCleaner(predictions, ages, net_worths):\n\n #cleaned_data = []\n # construct a data list with age, net_worth in place plus one extra param for square error\n data = [(age, net_worth, pred - net_worth) for age, net_worth, pred in zip (ages, net_worths, predictions)]\n sorted_data = sorted(dat...
[ "0.7661633", "0.749023", "0.7297859", "0.7290999", "0.72400224", "0.72392774", "0.72265327", "0.7198323", "0.71599376", "0.7110456", "0.70693636", "0.7020611", "0.7007656", "0.69745594", "0.6947679", "0.6945497", "0.6927607", "0.6892141", "0.68885416", "0.67452204", "0.671970...
0.7233383
6
Czech National Repository cli commands.
def nr(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():"...
[ "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134", "0.71026134"...
0.0
-1
Simple function that turns the WTForms validation errors into a simple list
def validation_errors_to_error_messages(validation_errors): errorMessages = [] for field in validation_errors: for error in validation_errors[field]: errorMessages.append(f'{field} : {error}') return errorMessages
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validation_errors_to_error_messages(validation_errors):\n error_messages = []\n for field in validation_errors:\n for error in validation_errors[field]:\n error_messages.append(f\"{field}: {error}\")\n return error_messages", "def validation_errors_to_error_messages(validation_erro...
[ "0.7599614", "0.7591915", "0.7591915", "0.7591915", "0.7591915", "0.7591915", "0.73390347", "0.69662005", "0.69610375", "0.69260114", "0.6922244", "0.69090396", "0.685043", "0.67200595", "0.6496139", "0.64767337", "0.6468248", "0.64465904", "0.6444137", "0.63223875", "0.62967...
0.7549263
6
Initialize renderer, given global options
def __init__(self, **kwargs): self.opts = {} self.opts.update(kwargs) self._v_registry = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n _gdi_.RendererVersion_swiginit(self,_gdi_.new_RendererVersion(*args, **kwargs))", "def setup_render(\n self, options: Dict[str, Any], env: MutableMapping[str, Any]\n ) -> None:\n self.md_env = env\n self.config: Dict[str, Any] = options\n ...
[ "0.7229818", "0.64800763", "0.64486676", "0.64179695", "0.63754964", "0.6197224", "0.6181591", "0.6046669", "0.6039335", "0.601107", "0.59780896", "0.59675336", "0.59179", "0.5914378", "0.5914378", "0.5905787", "0.5891683", "0.5876394", "0.5876394", "0.58561707", "0.5804442",...
0.52844226
97
Return the renderable's type (or class)
def getType(self, renderable): if hasattr(renderable, 'type'): return renderable.type return renderable.__class__.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type(self):\n return self.type", "def get_type(self):\n return self.type", "def get_type ( self, object ):\n return self.type", "def get_type ( self, object ):\n return self.type", "def _get_type(self):\n return self.__type", "def _get_type(self):\n return self._...
[ "0.738765", "0.738765", "0.7356796", "0.7356796", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0.72969824", "0...
0.87245935
0
Create a dict out of the renderable's properties
def createFormatMap(self, form, renderable, **extras): fmtmap = renderable.__dict__.copy() fmtmap.update(extras) def replaceVars(match): try: var = match.group()[2:-1] if var and var.endswith(":lexical"): var = var[:-len(":lexica...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_properties():", "def to_canvas_properties(component: Component) -> Dict:\n if ComponentCache.get_generic_component(component.id) is not None:\n template = ComponentCache.load_jinja_template(\"generic_properties_template.jinja2\")\n else:\n template = ComponentCache.loa...
[ "0.7129193", "0.7106046", "0.6904705", "0.6887883", "0.6796573", "0.67095697", "0.66495484", "0.66427183", "0.66427183", "0.66427183", "0.65843934", "0.65843934", "0.65699", "0.65269935", "0.6484647", "0.6482976", "0.64552784", "0.6446044", "0.6404835", "0.6350085", "0.634993...
0.0
-1
Connects to the backend
def connect(self, uri, params={}): osaka.utils.LOGGER.debug("Opening WebDav handler") # Grab information out of the URI username, password = osaka.utils.get_uri_username_and_password(uri) scheme, host = osaka.utils.get_uri_scheme_and_hostname(uri) # Setup webdav connection ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect():", "def connect(self):\n self.conn.connect()", "def connect(self):\n\t\tpass", "def connect():\n if not is_notebook():\n print('Python session is not running in a Notebook Kernel')\n return\n\n global _comm\n\n kernel = get_ipython().kernel\n kernel.comm_manager...
[ "0.7398303", "0.739737", "0.72759634", "0.72383165", "0.72286403", "0.71946704", "0.71751684", "0.71751684", "0.71751684", "0.71751684", "0.71751684", "0.71751684", "0.71751684", "0.71751684", "0.7162846", "0.71536916", "0.7142807", "0.7085793", "0.70778674", "0.6991977", "0....
0.0
-1
Returns a list of schemes this handler handles
def getSchemes(): return ["dav", "davs"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schemes(self):\n schemes = [];\n # shared schemes\n if XCSchemeHasSharedSchemes(self.path.obj_path) == True:\n shared_path = XCSchemeGetSharedPath(self.path.obj_path);\n shared_schemes = XCSchemeParseDirectory(shared_path);\n for scheme in shared_schemes:\n...
[ "0.75406027", "0.693951", "0.6891899", "0.6662243", "0.663156", "0.6367041", "0.62336844", "0.6017969", "0.59294844", "0.59125614", "0.588485", "0.58822525", "0.5831422", "0.5829238", "0.57939374", "0.5772619", "0.57696944", "0.5756378", "0.57460356", "0.5717628", "0.5716265"...
0.67720795
3
Gets the URI (file) as a steam
def get(self, uri, text=False): osaka.utils.LOGGER.debug( "Getting stream to URI: {0} Note: Using HTTP GET".format(uri) ) # Use the standard HTTP handler for getting the product return self.httpHandler.get(re.compile("^dav").sub("http", uri), text=text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(URI):\n return file_fabric.get_class(URI).get_content(URI)", "def get_url(self):\n return self.get_file(uri_type=URI_URL, no_copy=True)", "def getSource(self):\n return urllib2.urlopen(Parser.SOURCE_URL)", "def get_file(self):\n return self.theFile", "def get_url(self):\n ...
[ "0.6582305", "0.65651655", "0.6001005", "0.5889885", "0.5810439", "0.58087236", "0.57913876", "0.5754765", "0.574611", "0.57455057", "0.5726757", "0.5621217", "0.56021684", "0.5600786", "0.5595253", "0.55704397", "0.5549709", "0.55440325", "0.5542883", "0.5542883", "0.5542883...
0.0
-1
Puts a stream to a URI as a steam
def put(self, stream, uri): osaka.utils.LOGGER.debug("Putting stream to URI: {0}".format(uri)) path = osaka.utils.get_uri_path(uri) # Attempt to create the directories needed try: self.webdav.mkdirs(os.path.dirname(path)) self.webdav.delete(path) except Ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _put_stream(\n session: \"Session\",\n url_tail: str,\n stream: Any,\n params: Optional[Dict[str, Any]] = None,\n) -> None:\n _put(session, url_tail, params=params, stream=stream)", "def push(self, stream, url, chunk_size=BaseStorageConnector.CHUNK_SIZE, hashes={}):\n data_remaining = T...
[ "0.7054951", "0.64119333", "0.6110452", "0.6086386", "0.604635", "0.59401935", "0.59182334", "0.5894305", "0.58401287", "0.58284074", "0.58060104", "0.57905805", "0.5720501", "0.5701586", "0.5699771", "0.568601", "0.5669447", "0.5650895", "0.56434804", "0.56145215", "0.557887...
0.68627423
1
Does the URI exist?
def exists(self, uri): osaka.utils.LOGGER.debug("Does URI {0} exist?".format(uri)) try: path = osaka.utils.get_uri_path(uri) tmp = self.webdav.exists(path) osaka.utils.LOGGER.debug("Does URI {0} exist? {1}".format(uri, tmp)) return tmp except Excep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_exists(uri: Optional[str]) -> bool:\n\n if uri is None:\n return True\n\n # TODO Replace after finding way to pass custom fs through FireO validator\n if uri.startswith(\"gs://\"):\n return True\n\n else:\n # Get file system\n fs, uri = url_to_fs(uri)\n\n ...
[ "0.7822257", "0.7769442", "0.7757363", "0.76649225", "0.7608781", "0.7599233", "0.7431948", "0.7154187", "0.7040223", "0.6972205", "0.69640946", "0.69546145", "0.68923616", "0.68552965", "0.6847898", "0.6846125", "0.6817109", "0.68061155", "0.6687541", "0.66671914", "0.666637...
0.7657785
4
Detect if this uri is a composite uri (uri to collection of objects i.e. directory)
def isComposite(self, uri): return self.httpHandler.isComposite(re.compile("^dav").sub("http", uri))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equals(self, uri):\r\n return self.uri == uri.uri", "def __contains__(self, uri):\n\t\treturn uri in self._uris", "def exists(self, uri):\n nodes = self.nodes\n parts = uri.strip(\"/\").split(\"/\")\n while parts:\n item = parts.pop(0)\n if item in nodes:\n...
[ "0.6044663", "0.59846824", "0.56538606", "0.547975", "0.5412995", "0.53839725", "0.53809494", "0.53663313", "0.5299749", "0.5286439", "0.52351284", "0.52337736", "0.5166748", "0.5152837", "0.51354367", "0.5079929", "0.5077022", "0.5007033", "0.50047165", "0.49976695", "0.4975...
0.7831748
0
Remove this uri from backend
def rm(self, uri): path = osaka.utils.get_uri_path(uri) try: osaka.utils.LOGGER.debug("Removing {0} as a file".format(uri)) self.webdav.delete(path) except Exception as e: osaka.utils.LOGGER.debug( "Removing {0} as a directory, file encountered...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removePath(self):\n if not self.isRegularURI():\n return self\n return URI(self._scheme, self._host, self._port, None, None)", "def remove_endpoint_from_sipserver(self, endpoint: str) -> None:", "def remove(self, uri):\n\n uri = uri.strip('/')\n if self.exists(uri):\n...
[ "0.69381297", "0.68379", "0.6801519", "0.6649036", "0.6409602", "0.6364226", "0.63440347", "0.63397205", "0.6339108", "0.63132256", "0.6302701", "0.6282967", "0.62568563", "0.61741954", "0.61519825", "0.61519825", "0.61519825", "0.6138365", "0.61273754", "0.61069584", "0.6096...
0.5942276
30
Find the molar mass of an element whose name is a single letter
def test_single_caps(self): result_h = mmc.find_molar_mass('H') actual_h = 1.007940 self.assertTrue(abs(percent_error(result_h, actual_h)) < self.ERR_THRESHOLD)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mass(elem):\n return mass[get_num(elem)]", "def get_mass_of_element(label: str, average=False):\r\n masses = {\"H\": [1.00782503223, 1.007975],\r\n \"D\": [2.01410177812, 1.007975],\r\n \"T\": [3.0160492779, 1.007975],\r\n \"HE3\": [3.0160293...
[ "0.74579024", "0.6618539", "0.65636605", "0.6527752", "0.63585585", "0.6221174", "0.620677", "0.61874425", "0.6165897", "0.6140514", "0.6091518", "0.5948016", "0.5925343", "0.5922776", "0.586542", "0.5841972", "0.58355707", "0.58152306", "0.57357925", "0.5702625", "0.5697561"...
0.50926125
87
Try to identify if this ID is a Diaspora ID.
def identify_id(id: str) -> bool: return validate_handle(id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_is_sys_id(value):\n return re.match(r'^[A-Za-z0-9]{32}$', value) is not None", "def is_id(string):\n regex = re.compile('[0-9a-f]{32}\\Z', re.I)\n if bool(regex.match(string)):\n return True\n\n return False", "def is_id(self):\n found = False\n for p in self.ant:...
[ "0.59963197", "0.59421945", "0.593698", "0.58225274", "0.58214414", "0.57790256", "0.5756167", "0.57188654", "0.5654986", "0.56482553", "0.56460714", "0.56319267", "0.56233346", "0.5620309", "0.5589509", "0.55803376", "0.55722827", "0.55430007", "0.5532444", "0.54714316", "0....
0.6429384
0
Try to identify whether this is a Diaspora request. Try first public message. Then private message. The check if this is a legacy payload.
def identify_request(request: RequestType): # Private encrypted JSON payload try: data = json.loads(decode_if_bytes(request.body)) if "encrypted_magic_envelope" in data: return True except Exception: pass # Public XML payload try: xml = etree.fromstring(en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_request_id(\n self,\n message: W24TechreadMessage\n ) -> None:\n self.assertEqual(type(message.request_id), UUID)", "def test_parse_request_type_1b(self):\n req_type, errors = self._exec_parse(test_source=MessageEventType.MAAS_REQUEST, session_secret=self.session_secret,...
[ "0.5976573", "0.5566071", "0.5507683", "0.5502372", "0.54410976", "0.53419185", "0.52768904", "0.52765584", "0.5259478", "0.52162665", "0.51526713", "0.50846195", "0.5070117", "0.50653064", "0.5056263", "0.5053988", "0.50189286", "0.50047797", "0.49829745", "0.4969264", "0.49...
0.6161511
0
Get the Magic Envelope, trying JSON first.
def store_magic_envelope_doc(self, payload): try: json_payload = json.loads(decode_if_bytes(payload)) except ValueError: # XML payload xml = unquote(decode_if_bytes(payload)) xml = xml.lstrip().encode("utf-8") logger.debug("diaspora.protocol.st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def envelope(self) -> ty.Optional[reapy.Envelope]:\r\n ...", "def _get(self, endpoint):\n res = self._request(\"get\", endpoint)\n if not res.content:\n return {}\n try:\n res = res.json()\n except ValueError:\n raise ValueError(\"Cannot parse {...
[ "0.58300304", "0.52251226", "0.517581", "0.51550686", "0.51502216", "0.5089819", "0.5088869", "0.49445137", "0.4938673", "0.49159572", "0.49054477", "0.48548508", "0.48404655", "0.48331526", "0.48033655", "0.47506374", "0.47504154", "0.47300792", "0.4723121", "0.47184947", "0...
0.5803346
1
Receive a payload. For testing purposes, `skip_author_verification` can be passed. Authorship will not be verified.
def receive( self, request: RequestType, user: UserType = None, sender_key_fetcher: Callable[[str], str] = None, skip_author_verification: bool = False) -> Tuple[str, str]: self.user = user self.get_contact_key = sender_key_fetcher self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consume(self, payload):\n raise NotImplementedError()", "def parse_payload(self, reader, *args):\n self.public_key = VerifyingKey(base58.b58encode(reader.read_octet_string(Ed25519Fulfillment.PUBKEY_LENGTH)))\n self.signature = reader.read_octet_string(Ed25519Fulfillment.SIGNATURE_LENGTH)...
[ "0.61539936", "0.5716426", "0.5672425", "0.55479646", "0.55434424", "0.5535404", "0.5526889", "0.5324167", "0.5275576", "0.52546746", "0.5214359", "0.5210298", "0.51711327", "0.5140142", "0.51385045", "0.5129198", "0.5123276", "0.5112027", "0.5058972", "0.5022598", "0.5013941...
0.58068484
1
Given the Slap XML, extract out the payload.
def get_message_content(self): body = self.doc.find( ".//{http://salmon-protocol.org/ns/magic-env}data").text body = urlsafe_b64decode(body.encode("ascii")) logger.debug("diaspora.protocol.get_message_content: %s", body) return body
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPayload(self):\n return self.__payload", "def GetPayload(self):\n return self.__Payload", "def payload(self) -> \"dict\":\n return self._attrs.get(\"payload\")", "def get_payload(packet):\n #payload_len = get_payload_length(packet)\n adaptation_field_len = TS.get_adaptation_...
[ "0.59317213", "0.58863056", "0.5794243", "0.5767172", "0.5704178", "0.5636364", "0.56294817", "0.5610667", "0.56100625", "0.55278426", "0.55220735", "0.54700834", "0.54270935", "0.5413248", "0.5396209", "0.5341139", "0.5281778", "0.52647984", "0.52466995", "0.51145464", "0.50...
0.4523796
51
Verify the signed XML elements to have confidence that the claimed author did actually generate this message.
def verify_signature(self): if self.get_contact_key: sender_key = self.get_contact_key(self.sender_handle) else: sender_key = fetch_public_key(self.sender_handle) if not sender_key: raise NoSenderKeyFoundError("Could not find a sender contact to retrieve key")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify(self):\n if not self.public_key:\n self.fetch_public_key()\n data = self.doc.find(\".//{http://salmon-protocol.org/ns/magic-env}data\").text\n sig = self.doc.find(\".//{http://salmon-protocol.org/ns/magic-env}sig\").text\n sig_contents = '.'.join([\n dat...
[ "0.6460989", "0.6012024", "0.5928324", "0.58900124", "0.58766717", "0.58533514", "0.5705952", "0.57010704", "0.57010704", "0.57008016", "0.5696933", "0.56610656", "0.5656039", "0.5643142", "0.5613317", "0.5607168", "0.5607168", "0.55957574", "0.55839974", "0.55581915", "0.554...
0.635598
1
Build POST data for sending out to remotes.
def build_send(self, entity: BaseEntity, from_user: UserType, to_user_key: RsaKey = None) -> Union[str, Dict]: if entity.outbound_doc is not None: # Use pregenerated outbound document xml = entity.outbound_doc else: xml = entity.to_xml() me = MagicEnvelope(etr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_request(self):\n self.build_header_2_40()\n self.build_fullprops()\n data_compressed = mcafee_crypto.mcafee_compress(self.agent_pubkey_epo_format + self.fullprops_xml)\n data_len = struct.pack('<I', len(data_compressed))\n final_header_len = struct.pack('<I', len(self.b...
[ "0.6420373", "0.6261004", "0.6086373", "0.6077922", "0.58227134", "0.57651263", "0.56345344", "0.56216294", "0.55878955", "0.55731726", "0.55425364", "0.55423886", "0.54660404", "0.5465455", "0.54102004", "0.5387433", "0.53872937", "0.53795594", "0.5359118", "0.5322905", "0.5...
0.0
-1
Test whether template messages are filled in correctly
def test_template(): # Keywords and values to be filled into the template items = {'item_1': 'First', 'long_keyword_item_2': 'Second', 'space_3': 'Third Third Third ', 'item_4': 'Fourth', 'item_5': None} sender = 'dummy@moc.org' receiver = 'dummy@moc.org' result = 'F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_template_feedback(self):\r\n pass", "def test_no_template(self):\n template = ''\n value_count = 2\n msg = 'No template has been provided for formatting multiple fields.'\n with six.assertRaisesRegex(self, ValidationError, msg):\n validate_str_substitution(t...
[ "0.70445824", "0.69512606", "0.6756586", "0.6515136", "0.6505775", "0.63853836", "0.63569164", "0.63475287", "0.6342673", "0.6311789", "0.6182489", "0.6177041", "0.6113845", "0.6097171", "0.6028403", "0.6024074", "0.60189646", "0.60169435", "0.60158145", "0.5994536", "0.59719...
0.72762394
0
Test the function that sends emails
def test_send(mock_smtp): msg_values = {'sender': 'dummy@moc.org', 'receiver': 'newuser1@moc.org', 'subject': 'Test Message Subject', 'body': 'This is a Test.'} msg = Message(**msg_values) # What we expect to be passed to smtplib.SMTP.sendmail(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_send_email(self):\n\t\trecipient = \"\"\n\t\tself.email.send_email(self.subject, recipient, self.content)", "def test_sending_mail(self):\n\n appt_date = datetime.date.today() + datetime.timedelta(days=7) # Default for email\n confirmed = self.create_confirmed_notification(self.test_patien...
[ "0.84259117", "0.81025887", "0.8088316", "0.79653007", "0.77341914", "0.77055657", "0.75438136", "0.7537014", "0.7523021", "0.75019276", "0.7405664", "0.7390368", "0.73420846", "0.73209274", "0.7308146", "0.72822124", "0.7265372", "0.72434294", "0.72308856", "0.71922207", "0....
0.68188745
34
Test that BadEmailRecipient is raised correctly
def test_bademail(mock_smtp): msg_values = {'sender': 'dummy@moc.org', 'receiver': 'newuser1@moc.org', 'subject': 'Test Message Subject', 'body': 'This is a Test.'} rejected_recipients = ['bademail1@moc.org', 'bademail2@moc.org'] msg = Message...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_email_badAuth(get_email):\n e = get_email\n e.auth = 'baDp@ssw0rd'\n\n with pytest.raises(MessageSendError):\n e.send()", "def test_failed_email(self):\n self.assertEqual(send_email(\"testtestcom\", \"test\", \"test\"), 'There was an error sending')", "def test_bad_email_is_reje...
[ "0.76745105", "0.7439456", "0.7381916", "0.73518157", "0.7336578", "0.7319879", "0.72991", "0.72176707", "0.7176044", "0.71172804", "0.7101039", "0.7054247", "0.70468605", "0.7007666", "0.69897413", "0.69525427", "0.69355714", "0.6870197", "0.6861531", "0.6830244", "0.6777513...
0.7262134
7
Test the function which writes email text to a file
def test_file_dump(): subject = 'Test Message Subject' target_path = '/testdir/' label = 'MessageLabel' _file_dump() _file_dump(subject=subject) _file_dump(label=label) _file_dump(target_path=target_path) _file_dump(subject=subject, label=label) _file_dump(subject=subject, targ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_save_email(self):\n with self.assertRaises(IOError):\n self.email.save_email('')\n\n self.email.save_email('./saved_email.txt')\n os.remove('./saved_email.txt')", "def send_email(file_to_send=None, text=None, mail_to=None, mail_cc=None):\n\n time_str = time.strftime(\"...
[ "0.7262289", "0.6686942", "0.6604532", "0.6517213", "0.6456689", "0.64280295", "0.6413351", "0.62977284", "0.6290503", "0.62466466", "0.6211717", "0.61679226", "0.60826576", "0.6080844", "0.60796", "0.6066122", "0.6065163", "0.6063552", "0.6054845", "0.6054382", "0.6051807", ...
0.6148143
12
Store unit name to operator storage.
def snapshot(self): return {"unit_name": self.unit_name}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_unit(self, unit_name):\n\t\tif unit_name:\n\t\t\tunit, created = Unit.objects.get_or_create(name = unit_name)\n\t\t\treturn unit\n\t\telse:\n\t\t\treturn None", "def assign_unit(self):\n self.units = {}\n for unit in RADIAL_UNITS:\n if unit.REPR == \"2th_deg\":\n ...
[ "0.6208687", "0.6059043", "0.5988778", "0.5988778", "0.5988778", "0.5912101", "0.5870038", "0.5859827", "0.57746965", "0.56364304", "0.5537556", "0.5498192", "0.5427222", "0.54253703", "0.5417302", "0.54103583", "0.54103583", "0.54103583", "0.5342795", "0.533778", "0.533326",...
0.50751776
48
Restore unit name from operator storage.
def restore(self, snapshot): self.unit_name = snapshot["unit_name"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unset_current_units(self, utype):\n try:\n cunits = self._saved_units[utype]\n except KeyError:\n raise Exception(\"Units to restore not found\")\n \n if utype in self.allowed_utypes:\n if cunits in self.units[utype]:\n self.curren...
[ "0.5882164", "0.5470842", "0.53259164", "0.5200672", "0.5197964", "0.5142684", "0.51369697", "0.51304567", "0.51059127", "0.508888", "0.5024236", "0.5002708", "0.5002232", "0.4978874", "0.49773827", "0.49704474", "0.49696362", "0.4954233", "0.4941948", "0.49404556", "0.493762...
0.69181377
0
Determine the indices for labels that are not corrupted in the dataset.
def get_valid_indices(labels): idxs = (labels != invalid_labels[0]) for l in invalid_labels[1:]: idxs = idxs & (labels != l) return idxs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unlabeled_idx(X_train, labeled_idx):\n return np.arange(X_train.shape[0])[np.logical_not(np.in1d(np.arange(X_train.shape[0]), labeled_idx))]", "def test_label_indices_unknown():\n with pytest.raises(ValueError):\n util.get_label_indices(3, \"random_str\")", "def labeled_indices(self):\n ...
[ "0.71164936", "0.6890843", "0.66725874", "0.6499322", "0.6470832", "0.6461701", "0.6385171", "0.63188404", "0.6288615", "0.62110835", "0.6081898", "0.60789007", "0.6048194", "0.60084397", "0.60058415", "0.5992234", "0.5959932", "0.59489834", "0.59395844", "0.5922739", "0.5922...
0.767029
0
Rownormalize a confusion matrix such that each row sums to 1.
def normalize_cm(confusion_matrix): return confusion_matrix / np.sum(confusion_matrix, axis=1)[:, None]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self,matrix):\n for i in range(self.N):\n matrix[self.N-1][i] = 0\n for i in range(self.n):\n matrix[self.N - 1][self.index(i,i)] = 1\n return matrix", "def calculate_confusion_matrix(self):\n self.confusion_matrix = confusion_matrix(self.y_true, se...
[ "0.6799281", "0.65102744", "0.63084555", "0.62923783", "0.6252788", "0.6247862", "0.6205865", "0.6060601", "0.5997621", "0.5996156", "0.5935661", "0.580154", "0.5800489", "0.5782243", "0.5769484", "0.57469106", "0.57228315", "0.5720026", "0.56820333", "0.5675977", "0.5648898"...
0.64935726
2
Plots the provided matrix as a heatmap.
def plot_heatmap(matrix, path, xlabel=None, ylabel=None): plt.close('all') df_cm = pd.DataFrame(matrix) _ = plt.figure(figsize=(10, 7)) heatmap = sns.heatmap(df_cm) if xlabel: plt.xlabel(xlabel) if ylabel: plt.ylabel(ylabel) plt.tight_layout() make_dir(images_dir) plt.savefig(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_matrix(self, matrix: np.ndarray):\n sns.heatmap(matrix, annot=True)\n plt.show()", "def heat_plot(matrix, filename, xTicks, yTicks, xLabel='X', yLabel='Y'):\n\tfig = plt.figure()\n\tax = fig.add_subplot(111)\n\tcax = ax.matshow(matrix, vmin=0, vmax=1)\n\tfig.colorbar(cax)\n\tticks = np.ara...
[ "0.9083646", "0.8111335", "0.7733745", "0.7686196", "0.75203776", "0.73202413", "0.72764456", "0.72310925", "0.7123252", "0.7040286", "0.70304877", "0.69949627", "0.69005406", "0.68791676", "0.6876664", "0.68729216", "0.68505466", "0.68141985", "0.68010235", "0.679396", "0.67...
0.79578066
2
Method converts scans to "beam" and "slist" or gate
def get_gridded_parameters(q, xparam="time", yparam="slist", zparam="v", round=False): plotParamDF = q[ [xparam, yparam, zparam] ] if round: plotParamDF[xparam] = np.array(plotParamDF[xparam]).astype(int) plotParamDF[yparam] = np.array(plotParamDF[yparam]).astype(int) plotParamDF = plotParam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform():", "def grads(self, inputs):", "def transform(self):", "def parse_gate(s):\n if \"(\" in s:\n gate = s[:s.find(\"(\")]\n params = (s[s.find(\"(\") + 1:s.find(\")\")]).split(',')\n else:\n gate = s\n params = []\n return gate, params", "def out(self, inpu...
[ "0.5443031", "0.52975905", "0.49829447", "0.49706343", "0.49494323", "0.48984832", "0.4892525", "0.48914054", "0.4875848", "0.48683128", "0.48583546", "0.4853262", "0.48398063", "0.48309585", "0.4755715", "0.47467345", "0.47420567", "0.4724559", "0.4716806", "0.47004852", "0....
0.0
-1
Add a colorbar to the right of an axis.
def _add_colorbar(self, im, ax, colormap, label=""): import matplotlib as mpl pos = ax.get_position() cpos = [pos.x1 + pos.width * 0.01, pos.y0 + pos.height*.1, 0.01, pos.height * 0.8] # this list defines (left, bottom, width, height cax = self.fig.add_axes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_colorbar(self, fig, ax, norm, colormap, label=\"\"):\n import matplotlib as mpl\n pos = ax.get_position()\n cpos = [pos.x1 + 0.025, pos.y0 + 0.0125,\n 0.015, pos.height * 0.8] # this list defines (left, bottom, width, height\n cax = fig.add_axes(cp...
[ "0.7577057", "0.7577057", "0.7418903", "0.74102116", "0.7179385", "0.71613485", "0.71574956", "0.6979866", "0.6953447", "0.6930779", "0.67889935", "0.6788904", "0.6615177", "0.6534736", "0.6524789", "0.65199506", "0.6450172", "0.6343112", "0.62681675", "0.62551737", "0.625244...
0.7166474
5
Adding the radar location
def overlay_radar( self, rad, marker="D", zorder=2, markerColor="k", markerSize=2, fontSize="small", font_color="darkblue", xOffset=-5, yOffset=-1.5, annotate=True, ): lat, lon = rad.hdw.geographic.lat, rad.hdw.geographic.lon self.ax.scatter([lon], [lat], s=markerSize, mark...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_radar(self, screen):\n self.get_data()\n for radar in self.radars:\n position, _ = radar\n pg.draw.line(screen, RADAR_COLOR, self.center, position, 1)\n pg.draw.circle(screen, RADAR_COLOR, position, 2)", "def update_radar(self, degree):\n length = 0\...
[ "0.67039686", "0.63898516", "0.62378395", "0.62253624", "0.59539694", "0.5928526", "0.591509", "0.5865031", "0.58556056", "0.5846813", "0.5733738", "0.5710981", "0.57103014", "0.56818926", "0.5656227", "0.5623805", "0.56126463", "0.56040233", "0.55189615", "0.55062455", "0.54...
0.63266826
2
Add a colorbar to the right of an axis.
def _add_hcolorbar(self, im, colormap="jet_r", label=""): pos = self.ax.get_position() cpos = [ pos.x0 + 0.3 * pos.width, pos.y0 - 0.15 * pos.height, pos.width * 0.5, 0.02, ] # this list defines (left, bottom, width, height) cax = self.fig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_colorbar(self, fig, ax, norm, colormap, label=\"\"):\n import matplotlib as mpl\n pos = ax.get_position()\n cpos = [pos.x1 + 0.025, pos.y0 + 0.0125,\n 0.015, pos.height * 0.8] # this list defines (left, bottom, width, height\n cax = fig.add_axes(cp...
[ "0.7577057", "0.7577057", "0.7418903", "0.74102116", "0.7179385", "0.7166474", "0.71613485", "0.71574956", "0.6979866", "0.6953447", "0.6930779", "0.67889935", "0.6788904", "0.6615177", "0.6534736", "0.6524789", "0.6450172", "0.6343112", "0.62681675", "0.62551737", "0.625244"...
0.65199506
16
Add a colorbar to the right of an axis.
def _add_colorbar(self, im, colormap="jet_r", label=""): pos = self.ax.get_position() cpos = [ pos.x1 + 0.15, pos.y0 + 0.2 * pos.height, 0.02, pos.height * 0.5, ] # this list defines (left, bottom, width, height) cax = self.fig.add_axes(cp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_colorbar(self, fig, ax, norm, colormap, label=\"\"):\n import matplotlib as mpl\n pos = ax.get_position()\n cpos = [pos.x1 + 0.025, pos.y0 + 0.0125,\n 0.015, pos.height * 0.8] # this list defines (left, bottom, width, height\n cax = fig.add_axes(cp...
[ "0.75750417", "0.75750417", "0.7417919", "0.7408142", "0.71787065", "0.7165443", "0.7160115", "0.71563584", "0.6978977", "0.6928187", "0.67887163", "0.6787255", "0.66141695", "0.6534215", "0.6523998", "0.65192235", "0.64490265", "0.6341669", "0.6268099", "0.62562", "0.6251723...
0.69518185
9
Utility function to check whether a web file exists
def exists(path): r = requests.head(path) # print(r.status_code) return r.status_code == requests.codes.ok
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_exist(file_url):\n try:\n response = requests.head(file_url)\n if 200 <= response.status_code < 300:\n return True\n return False\n except ConnectionError:\n return False", "def path_exists(path):\n if path.startswith('http://') or path.startswith('https:/...
[ "0.7608307", "0.75662315", "0.73194575", "0.7288888", "0.7177729", "0.7153116", "0.7143501", "0.71434325", "0.712243", "0.7096242", "0.7095951", "0.7071145", "0.7071145", "0.70501417", "0.7046735", "0.6996455", "0.6995336", "0.69689524", "0.6950054", "0.6929631", "0.69092137"...
0.7007093
15
Utility function to check whether a web file exists
def exists_adv(path): # TODO: use selenium r = requests.head(path) # print(r.status_code) return r.status_code == requests.codes.ok
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_exist(file_url):\n try:\n response = requests.head(file_url)\n if 200 <= response.status_code < 300:\n return True\n return False\n except ConnectionError:\n return False", "def path_exists(path):\n if path.startswith('http://') or path.startswith('https:/...
[ "0.7608307", "0.75662315", "0.73194575", "0.7288888", "0.7177729", "0.7153116", "0.7143501", "0.71434325", "0.712243", "0.7096242", "0.7095951", "0.7071145", "0.7071145", "0.70501417", "0.7046735", "0.7007093", "0.6996455", "0.6995336", "0.69689524", "0.6950054", "0.6929631",...
0.6821469
26
Generates the actual list of data.
def items_for_result(cl, result, form): first = True pk = cl.lookup_opts.pk.attname for field_name in cl.list_display: row_class = '' try: f, attr, value = lookup_field(field_name, result, cl.model_admin) except (AttributeError, ObjectDoesNotExist): result_rep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self):\n return []", "def generate_data_list(self, data_list):\n sol = []\n for i in data_list:\n sol.append({\n \"data_sig\": i[0],\n \"data\": pickle.loads(i[1]),\n \"attachment\": i[2],\n \"likes\":pickle....
[ "0.70158565", "0.69500333", "0.6627234", "0.6627234", "0.6581639", "0.6571209", "0.6527973", "0.6522008", "0.6475456", "0.6389813", "0.6351662", "0.6335732", "0.6313153", "0.6286832", "0.6168916", "0.61285734", "0.6125956", "0.61118275", "0.60740054", "0.60603684", "0.605547"...
0.0
-1
Displays the headers and data list together
def custom_result_list(cl): return {'cl': cl, 'result_hidden_fields': list(result_hidden_fields(cl)), 'results': list(results(cl))}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Show_Headers( self ):\r\n self.system.Change_Seq( \"Header\" )", "def print_data_list(self):\n print('\\n{0}'.format(self.webDataFrame))", "def show_header():\n return {};", "def print_headings(self):\n hdg_list = sorted(self.data.keys())\n sys.stdout.write('Offset: %.1f; '...
[ "0.73954624", "0.68752635", "0.68444526", "0.67309403", "0.6625386", "0.6576772", "0.6552585", "0.6507191", "0.64780176", "0.64676386", "0.64187795", "0.6418145", "0.6410429", "0.63538736", "0.62718225", "0.6268395", "0.6247569", "0.6239931", "0.6209731", "0.6189096", "0.6182...
0.0
-1
How large is the memory footprint of conf, based on its name. Will be fooled by a character sequence of 'g' followed by a ''.
def parse_memsize(conf): def is_int(x): try: int(x) return True except ValueError: return False return int([x[:-1] for x in conf.split('-') if x.endswith('g') and is_int(x[:-1])][0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats_conf(cls, name, parsed_conf):\n return [('%s.byte_count' % name, 'sum')]", "def const_size():\r\n return 1000.0", "def parse_conf(cls, name, conf):\n return {'chunk_read': conf.get_int(name, 'chunk_read', 65536)}", "def __repr__(self):\n return \"This {} has {} GB of memory\...
[ "0.5902921", "0.583913", "0.58113116", "0.5456372", "0.5391151", "0.5356007", "0.53244126", "0.5324148", "0.5314864", "0.5306662", "0.52871865", "0.52870625", "0.52672195", "0.52419114", "0.52418697", "0.5218706", "0.52169126", "0.52168775", "0.5185539", "0.51632905", "0.5160...
0.6888114
0
Write centrality values to disk in a sorted order
def writeCentrality(filename, data): filePath = os.path.join(CONFIG['CENTRALITIES_PATH'], filename) f = open(filePath, "w") data = {k: v for k, v in sorted( data.items(), key=lambda x: x[1], reverse=True)} for k, v in data.items(): text = f"{k:<4}\t{v:.6f}\n" f.write(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_concordance(self, filename):\n out = ''\n values = [x for x in self.concordance_table.hash_table if x is not None]\n values.sort(key=lambda x: x[0])\n for v in values:\n out += f'{v[0]}: {\" \".join(str(x) for x in sorted(set(v[1])))}\\n' \n with open(filenam...
[ "0.60706383", "0.6037458", "0.5878708", "0.5682553", "0.56810784", "0.56637853", "0.5599887", "0.5573662", "0.55650854", "0.5537689", "0.55024195", "0.5464176", "0.54634184", "0.54443085", "0.5426661", "0.542125", "0.54044104", "0.53835964", "0.53779113", "0.5361577", "0.5359...
0.66767085
0
Driver function to compute closeness centrality with our implementation
def getCloseness(elistPath): adjGraph = AdjGraph(elistPath, separator=" ") closeness_centrality, time = closenessCentrality(adjGraph) writeCentrality("closeness.txt", closeness_centrality) return time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closeness_centrality(self):\n try:\n self.logger.info('正在计算网络的接近中心性 ...')\n return self.order_dict(nx.closeness_centrality(self.G), index=1)\n except Exception as e:\n self.logger.error(\"计算失败,原因:{0}\".format(e))", "def closenessCentrality(graph, numberOfPoints)...
[ "0.7083481", "0.6964299", "0.6601105", "0.64688396", "0.63151455", "0.61969167", "0.61969167", "0.6112925", "0.6112925", "0.61098886", "0.6097105", "0.59924364", "0.5978136", "0.5963294", "0.5874746", "0.5809668", "0.57596725", "0.5749201", "0.57267666", "0.57262075", "0.5714...
0.62849784
5
Driver function to compute betweenness centrality with our implementation
def getBetweenness(elistPath): adjGraph = AdjGraph(elistPath, separator=" ") betweenness_centrality, time = betweennessCentrality(adjGraph) writeCentrality("betweenness.txt", betweenness_centrality) return time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def centrality(self):\n\n raise NotImplementedError", "def betweennessCentrality(graph, numberOfPoints):\n c_betweenness = nx.betweenness_centrality(graph)\n c_betweenness = heapq.nlargest(\n numberOfPoints, list(\n c_betweenness.values()))\n return c_betweenness", "def betwee...
[ "0.69452184", "0.6299335", "0.62937677", "0.627996", "0.5946061", "0.5885782", "0.5858307", "0.5824364", "0.5745462", "0.55819964", "0.5556215", "0.55418205", "0.55275846", "0.55232453", "0.55021954", "0.5489992", "0.5465673", "0.546549", "0.5463459", "0.54562855", "0.5450895...
0.52353776
37
Driver function to compute PageRank centrality with our implementation
def getPageRank(elistPath, alpha, maxiter, tolerance): adjGraph = AdjGraph(elistPath, separator=" ") graph = adjGraph.SNAPGraph preference_vector = [] for node in graph.Nodes(): id = node.GetId() if (id % 4) == 0: preference_vector.append(id) pageRank, convIter, time =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def centrality(self):\n\n raise NotImplementedError", "def test_rank_centrality():\n for case in iter_testcases('pairwise'):\n n_items = case[\"n_items\"]\n data = case[\"data\"]\n assert np.allclose(\n case[\"rc_est\"], rank_centrality(n_items, data),\n ...
[ "0.6278928", "0.62419796", "0.61034995", "0.5806597", "0.55678606", "0.55409473", "0.55005234", "0.5499149", "0.5430832", "0.54202163", "0.5397319", "0.5381687", "0.53645724", "0.533091", "0.5321031", "0.52142334", "0.52062696", "0.51900065", "0.518672", "0.51294845", "0.5124...
0.5468313
8
Get all algorithms as a list.
def algorithms_factory(): all_algorithms = [] for algorithm_module in ALGORITHMS: module_name = "{}.{}".format(PREFIX, algorithm_module) module = importlib.import_module(module_name) for item in dir(module): item = getattr(module, item) try: if iss...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __all_Algs_ ( self ) :\n _algs = self.algorithms()\n\n algs = []\n for _a in _algs :\n algs += [ self.algorithm ( _a ) ]\n return algs", "def __all_Algs_ ( self ) :\n _algs = self.algorithms()\n\n algs = []\n for _a in _algs :\n algs +=...
[ "0.78977793", "0.78977793", "0.7375212", "0.73156726", "0.7029874", "0.64547384", "0.63551086", "0.63491154", "0.6280677", "0.6270786", "0.6266274", "0.62648815", "0.6220377", "0.62152606", "0.6201127", "0.6201127", "0.61609894", "0.6141701", "0.6131828", "0.6128035", "0.6045...
0.7507013
2
Returns an icon and color for the current battery status.
def _get_icon_and_color(status, percent): # ACPI incorrectly reports Unknown status when battery is full. if status == _STATUS_CHARGING or status == _STATUS_UNKNOWN: return (_ICON_CHARGE, _get_xres('i3blocks.Battery.charging')) elif percent < 13: return (_ICON_BATTERY0, _get_xres('i3blocks.Battery.wa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def icon(self) -> str:\n return icon_for_battery_level(\n battery_level=self._device.battery_level,\n charging=self._device.battery_status == \"Charging\",\n )", "def icon(self):\n if self._sensor_type == \"battery_level\" and self._state is not None:\n retur...
[ "0.7368904", "0.7080904", "0.6770462", "0.6676303", "0.666014", "0.6639815", "0.6630334", "0.65848225", "0.6547445", "0.65156764", "0.65122", "0.6509895", "0.64397836", "0.64348817", "0.6421024", "0.6402484", "0.6393751", "0.6383948", "0.6379605", "0.6368297", "0.6336585", ...
0.74303985
0
Set up the ISY lock platform.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: isy_data = hass.data[DOMAIN][entry.entry_id] devices: dict[str, DeviceInfo] = isy_data.devices entities: list[ISYLockEntity | ISYLockProgramEntity] = [] for node in isy_data.nodes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_lock(self):\n\n try:\n ml2_config.cfg.CONF.set_override('lock_path', \"lock\")\n except ml2_config.cfg.NoSuchOptError:\n ml2_config.cfg.CONF.set_override(\n 'lock_path', \"lock\", \"oslo_concurrency\")", "def _init_hardware(self):\n return", ...
[ "0.5982792", "0.5921281", "0.590566", "0.58926433", "0.5771162", "0.57644296", "0.57520133", "0.5710186", "0.56673187", "0.5626076", "0.5617026", "0.5603553", "0.55783045", "0.55767614", "0.5567374", "0.55596775", "0.55491793", "0.5538614", "0.5533805", "0.55283636", "0.55103...
0.571416
7
Get whether the lock is in locked state.
def is_locked(self) -> bool | None: if self._node.status is None: return None return VALUE_TO_STATE.get(self._node.status)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_locked(self):\n return self._state == STATE_LOCKED", "def is_locked(self):\n return self.lock_obj.is_locked()", "def is_locked(self):\n return bool(int(self._fp(self.F_LOCKED).read()))", "def is_locked(self):\n ret_val = self._is_locked()\n return ret_val", "def is...
[ "0.87003785", "0.8550151", "0.8484983", "0.84297246", "0.83765304", "0.8348038", "0.80977696", "0.8088233", "0.8047967", "0.8046365", "0.80401134", "0.8030041", "0.8028347", "0.7962065", "0.7894212", "0.7860884", "0.78418344", "0.7835671", "0.775852", "0.768794", "0.76440454"...
0.7975883
13
Send the lock command to the ISY device.
async def async_lock(self, **kwargs: Any) -> None: if not await self._node.secure_lock(): raise HomeAssistantError(f"Unable to lock device {self._node.address}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock(self, volume, _cfg=None) :\n name_or_id = self.get_name_or_id(volume)\n CmdList=[_cfg.binaries[\"vos\"], \"lock\",\"-id\" ,\"%s\" % name_or_id, \"-cell\", \"%s\" % _cfg.cell]\n return CmdList,PM.lock", "def lock_devices(self, data):\n data = clean(data, self.lock_parameters)...
[ "0.6890727", "0.6612157", "0.6487658", "0.6206156", "0.6201278", "0.61673373", "0.6067654", "0.60168225", "0.5983736", "0.5970574", "0.5965061", "0.5952579", "0.59398365", "0.59253836", "0.592176", "0.5887172", "0.5887172", "0.5877024", "0.5849291", "0.58367187", "0.5828803",...
0.6550973
2
Send the unlock command to the ISY device.
async def async_unlock(self, **kwargs: Any) -> None: if not await self._node.secure_unlock(): raise HomeAssistantError(f"Unable to unlock device {self._node.address}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def unlock_socket(self, **kwargs) -> None: # pylint: disable=unused-argument\r\n await self._send(\"unlock\")", "def unlock(self, volume, _cfg=None) :\n name_or_id = self.get_name_or_id(volume)\n CmdList=[_cfg.binaries[\"vos\"], \"unlock\",\"-id\" ,\"%s\" % name_or_id, \"-cell\", \"%...
[ "0.6933005", "0.6880047", "0.6764243", "0.6674355", "0.65612656", "0.6523741", "0.65057546", "0.6444326", "0.63621765", "0.6292668", "0.62738365", "0.6243749", "0.6237608", "0.61635226", "0.6132243", "0.61316955", "0.61226827", "0.61185473", "0.6117652", "0.60763335", "0.6063...
0.7108106
0
Set a user lock code for a ZWave Lock.
async def async_set_zwave_lock_user_code(self, user_num: int, code: int) -> None: if not await self._node.set_zwave_lock_code(user_num, code): raise HomeAssistantError( f"Could not set user code {user_num} for {self._node.address}" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_lock(self, value):\n act = LockAction(self, value)\n return act.invoke()", "def bdev_opal_set_lock_state(client, bdev_name, user_id, password, lock_state):\n params = {\n 'bdev_name': bdev_name,\n 'user_id': user_id,\n 'password': password,\n 'lock_state': loc...
[ "0.63590306", "0.6249155", "0.62183875", "0.59769493", "0.59599304", "0.5901474", "0.5836311", "0.57592857", "0.5626843", "0.5608006", "0.5600001", "0.5518261", "0.54043525", "0.5400554", "0.53396076", "0.52960056", "0.5278731", "0.52023333", "0.5202007", "0.5099273", "0.5099...
0.8170936
0
Delete a user lock code for a ZWave Lock.
async def async_delete_zwave_lock_user_code(self, user_num: int) -> None: if not await self._node.delete_zwave_lock_code(user_num): raise HomeAssistantError( f"Could not delete user code {user_num} for {self._node.address}" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_lock(self, lock_name):\n path = '/locks/delete/%s' % lock_name\n response = self.rest.request(content_type='text/plain',\n method='delete', path=path)\n return response.ok", "def remove_lock(lockfilename):\n if os.path.isfile(lockfilename...
[ "0.6468142", "0.60991776", "0.60766983", "0.60018265", "0.59561795", "0.5938285", "0.59352523", "0.5836511", "0.58137447", "0.58059436", "0.57329696", "0.5720484", "0.5700564", "0.5658155", "0.56113094", "0.55580187", "0.55230284", "0.54913527", "0.5483612", "0.54719645", "0....
0.7895677
0
Return true if the device is locked.
def is_locked(self) -> bool: return bool(self._node.status)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_locked(self):\n return bool(int(self._fp(self.F_LOCKED).read()))", "def locked(self) -> bool:\n return pulumi.get(self, \"locked\")", "def is_locked(self) -> bool | None:\n return self.instrument.is_locked", "def locked(self):\n return self.is_locked", "def is_locked(self...
[ "0.7943987", "0.7936965", "0.7820437", "0.78008175", "0.77606076", "0.77312416", "0.77243763", "0.77204716", "0.76964444", "0.76309425", "0.7617796", "0.76023257", "0.75771534", "0.7530081", "0.74587584", "0.7339495", "0.73260325", "0.72443646", "0.72316366", "0.7168567", "0....
0.7555975
13
Wrapper to make one stemplot with colored dashed lines leading to colored marker.
def stemplot(x, y, data, order, ax, palette, marker='o', size=7): if 'label' in data: data.index = data['label'] sns.stripplot(x=x, y=y, data=data, order=order, ax=ax, palette=palette, size=size, marker=marker) _, stemlines, baseline = ax.stem(data.loc[order, y], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dashed(requestContext, *seriesList):\n\n if len(seriesList) == 2:\n dashLength = seriesList[1]\n else:\n dashLength = 5\n for series in seriesList[0]:\n series.name = 'dashed(%s, %d)' % (series.name, dashLength)\n series.options['dashed'] = dashLength\n return seriesList[0]", "def addLineStyl...
[ "0.6697311", "0.6332501", "0.6120764", "0.5748406", "0.57332265", "0.5688296", "0.55950266", "0.5579449", "0.5518021", "0.5498685", "0.547668", "0.5439205", "0.54324776", "0.5400206", "0.53976005", "0.5385666", "0.53844017", "0.53750837", "0.5357235", "0.5297244", "0.5285306"...
0.57081205
5
Make figure 1 with sample sizes, AUCs, number of significant genera, and direction of shift. Note that 'edd_singh' should be converted to 'cdi_singh' in all of these inputs.
def plot_fig1(dysbiosis, dataset_order, samplesizes, edd_color=False): disease_colors = fmt.get_disease_colors() # Make color palette dictionary that has all of the datasets # Note: need trailing underscore so that cd studies are not considered cdi diseases = set([i.split('_')[0] + '_' for i in dataset_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fig1a():\n # fmt: off\n tpm = np.array([\n [0, 0, 0, 0, 0, 0],\n [0, 0, 1, 0, 0, 0],\n [1, 0, 1, 0, 1, 0],\n [1, 0, 0, 0, 1, 0],\n [1, 0, 0, 0, 0, 0],\n [1, 1, 1, 0, 0, 0],\n [1, 0, 1, 0, 1, 0],\n [1, 1, 0, 0, 1, 0],\n [1, 0, 0, 0, 0, 0],\n ...
[ "0.58824545", "0.5732328", "0.5641182", "0.5567753", "0.5508082", "0.550383", "0.5480538", "0.5412664", "0.54065424", "0.5347281", "0.53468496", "0.53282726", "0.5326497", "0.53225636", "0.5300855", "0.5290681", "0.5252", "0.5245081", "0.5244896", "0.5240326", "0.52390766", ...
0.5809068
1
Gives the dimension of the space.
def dimension(self): return 3*self.genus - 3 + self.n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dimension(self):\n\t\treturn self.d", "def dimension(self):\n return self._dim", "def get_dim(self):\n return self.dim", "def get_dim(self):\n return self._dim", "def dimension_size(self):\n return self._dim", "def getDim(self):\n return \"%dx%d\" % (self.rows, self...
[ "0.8409023", "0.8195192", "0.8176067", "0.8092739", "0.80823815", "0.8056118", "0.8042051", "0.79779434", "0.79756033", "0.7931746", "0.7931746", "0.7931746", "0.7931746", "0.79101586", "0.790592", "0.7898158", "0.78823423", "0.7878321", "0.78709406", "0.78420436", "0.782932"...
0.8082504
4
Returns a new space that is this one plus some extra marks.
def add_marks(self, *marks): return Mgn(self.genus, self.marks.union(marks))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_spaces(self):\n raise NotImplementedError", "def add_space(self) -> None:\n\n tag = r'\\vspace{5mm}'\n self.doc = self.doc + tag", "def spacer(self):\n (outline,_,_) = self.bounds\n return Builder(self.box, (outline, -base_height, base_height))", "def rj...
[ "0.6920317", "0.64510643", "0.6179168", "0.5979944", "0.59413135", "0.5904091", "0.58225226", "0.5793971", "0.57875836", "0.57260907", "0.5690367", "0.5688831", "0.56818223", "0.5667973", "0.56672996", "0.56457", "0.5640145", "0.5622476", "0.5593193", "0.5565683", "0.5523006"...
0.5021953
67
Returns the number of marked points in this space
def n(self): return len(self.marks)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nr_points(self):\n return len(self.x)", "def Points_Counting(self):\n return len(self.__traectory_list)", "def get_position_count(self):\n return self.positions.count()", "def remaining(self):\n\t\tmines = sum(1 for _ in self.get_mines())\n\t\tmarked = sum(1 for x in range(self.width...
[ "0.696392", "0.67317307", "0.67282224", "0.67231625", "0.66830474", "0.663576", "0.66085297", "0.6584659", "0.65598637", "0.65361863", "0.64434", "0.64434", "0.6428971", "0.64273876", "0.6387803", "0.6330457", "0.6312989", "0.629933", "0.6259385", "0.624347", "0.6226892", "...
0.7444573
0
Returns Faber's index for this class, if it is one of the MgnLb ones. Useful for automated testing.
def num(self, cls): try: return self.classes.index(cls) + 1 except: raise Exception("Someone asked for " + str(cls) + ", which is not here " + str(self))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self):\n return self._ll_tree.get_index()", "def get_index(self):\n return self.index", "def get_index(self):\n return self.index", "def get_class_index(self, label):\n assert label in CLASSES\n return CLASSES.index(label)", "def lookup_class_idx(self,label):\r\...
[ "0.6050335", "0.59324574", "0.59324574", "0.59132624", "0.586107", "0.58063376", "0.5795107", "0.5788164", "0.5774034", "0.57638466", "0.5744078", "0.5722317", "0.57168525", "0.57167095", "0.57143927", "0.5689585", "0.5687951", "0.568232", "0.5658404", "0.5655441", "0.5637541...
0.0
-1
Assuming that this Mgn represents a reducible componet, then find its complement in the big_space.
def complementary_component(self, big_space): if not self.marks.issubset(big_space.marks): print(self, big_space) raise Exception("Bad marked points") if not self.genus <= big_space.genus: raise Exception("Bad genus") return Mgn(big_space.genus - self.genus, b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_complement(num):\n pass", "def findComplement(self, num: int) -> int:\n n = num\n xor = 1\n while n > 0:\n num = num ^ xor\n xor = xor << 1\n n = n >> 1\n return num", "def __neg__(self):\n return self[::-1].complement", "def com...
[ "0.63396746", "0.61063755", "0.59051156", "0.5849143", "0.57684183", "0.55742115", "0.5551845", "0.5545718", "0.54682595", "0.5424471", "0.54141927", "0.5409631", "0.5397393", "0.5304626", "0.5295751", "0.52824384", "0.5260014", "0.5250732", "0.5249668", "0.524294", "0.524003...
0.66515833
0
Determines whether self and space represent the same reducible boundary in in_space. Returns true or false.
def same_as(self, space, in_space): if self.marks == space.marks and self.genus == space.genus: return True space = space.complementary_component(in_space) if self.marks == space.marks and self.genus == space.genus: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identical_to(self, elem):\n \n return (self.n == elem.n) and (math.fabs(self.dx - elem.dx) < 0.001) and (math.fabs(self.dy - elem.dy) < 0.001) and (math.fabs(self.dz - elem.dz) < 0.001)", "def is_crossed(self):\n left_boundary_clusters = np.extract(self.cluster[0] > 0,\n ...
[ "0.6337293", "0.6325333", "0.63244414", "0.61551076", "0.6122222", "0.60953236", "0.60872793", "0.6034836", "0.60208577", "0.6013389", "0.6013389", "0.59886944", "0.59886944", "0.59886944", "0.59716356", "0.595167", "0.5944169", "0.59415483", "0.59169555", "0.5908367", "0.589...
0.7264176
0
Returns a list of Tautalogical classes on this space. The order should correspond to that of Faber's program.
def classes(self): #print "making classes again!" l = [] for p in self.marks: l.append(psi_class(self,p)) for d in range(1, self.dimension + 1): l.append(kappa_class(self,d)) for i in range(1, self.genus+1): l.append(chern_char(self, 2*i-1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_classes(self):\n\n # Sort them.\n classes = ['Safe','Violence','Gun','Cold_Arms','Smoking','Kissing']\n classes = sorted(classes)\n\n # Return.\n if self.class_limit is not None:\n return classes[:self.class_limit]\n else:\n return classes", ...
[ "0.72215134", "0.7199463", "0.69713986", "0.69658506", "0.68616223", "0.6852802", "0.682863", "0.6769311", "0.6740012", "0.66448003", "0.66298234", "0.6626617", "0.6571226", "0.6533752", "0.6475372", "0.64634293", "0.6436322", "0.6409945", "0.63905394", "0.63858676", "0.63457...
0.5609355
76
Accessor method to get the classes. Shifts the index so it matches Fabers. This index is printed by the rij() function.
def __getitem__(self, index): if index in self.marks: return psi_class(self, index) return self.classes[index-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_classes(self):\n return list(range(self.num_clss))", "def return_classes(self):\n\n\t\t \n\t\t \n\t\treturn self.classes", "def _get_classifers(self):\n return self.__classifers", "def _get_classifers(self):\n return self.__classifers", "def _get_classifers(self):\n return self....
[ "0.6719678", "0.66587174", "0.664865", "0.664865", "0.664865", "0.664865", "0.664865", "0.664865", "0.64690423", "0.6428921", "0.64125866", "0.6395632", "0.6255855", "0.6167112", "0.6150065", "0.61381936", "0.61374813", "0.60772604", "0.59909374", "0.59331733", "0.5930647", ...
0.67644227
0
Prints a list of all the Tautalogical classes for this space, with their index. The name is borrowed from Faber, I think it is Dutch. I provide an engligh alias, but I don't know a short name to call it.
def rij(self): for i, c in zip(range(len(self.classes)), self.classes): print("[" + str(i+1) + "] " + repr(c)) #+ " --- " + str(c)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_classes():\n for obj in Classes.get_all_obj_list():\n print('\\033[33;1m[%s] [%s]校区 [%s]班级 学费[%s]\\033[0m'.center(60, '-') \\\n % (obj.school_nid.get_obj_by_uuid().name, obj.school_nid.get_obj_by_uuid().addr, \\\n obj.name, obj.tuition))", "def show_class(self,c):\...
[ "0.6714107", "0.634568", "0.61626154", "0.5878553", "0.5662025", "0.5653758", "0.56095046", "0.56065696", "0.56037056", "0.55753785", "0.5560725", "0.553855", "0.5536381", "0.55214304", "0.55173147", "0.5508782", "0.55005157", "0.54884297", "0.5479619", "0.54688627", "0.54669...
0.57717013
4
Creates symbols in the global namespace for all the classes on this space. This makes it so you can type in e.g. psi1ka2 and it knows what you mean.
def mak(self): #print "entering mak!!!" for cl in self.classes: sage.misc.misc.inject_variable(repr(cl),cl, warn=False) #for long_name_for_class_that_probably_wont_be_in_global_namespace in self.classes: #if long_name_for_class_that_probably_wont_be_in_global_namespace !=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_root_symbols(self):\n RootSymbol = Symbol(Token(None,None,'R00t.Symbol'))\n RootSymbol.GlobalSymbolDict=self.GlobalSymbolDict\n StartDocSymbol = Symbol(Token(None,None,'%^'))\n StartDocSymbol.regex = Set('%^')\n StartDocSymbol.is_lit = True\n StartDocSymbol.Glob...
[ "0.61037695", "0.60583246", "0.5722966", "0.5719212", "0.56878597", "0.56597066", "0.55972683", "0.55732954", "0.5548546", "0.5395741", "0.53940487", "0.53814834", "0.53207135", "0.52824837", "0.5233545", "0.5211916", "0.52010185", "0.5181912", "0.5168852", "0.5159553", "0.51...
0.6204658
0
Generator object, gives all the reducible boundaries for this space, but returns them as spaces, i.e., as a Mgn object with the defining genus and marked points. This is used to compute itersections with ch.
def red_boundaries_as_spaces(self): marks = set(self.marks) if self.n != 0: first_mark_list = [marks.pop()] p1,p2 = self.next_marks() for g1 in range(0, self.genus + 1): for p in subsets(marks): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def irr_boundary_as_space(self):\n p1,p2 = self.next_marks()\n \n return Mgn(self.genus - 1, self.marks.union([p1,p2])), p1, p2", "def gen_grids(self):\n self.dx = self.grid_width / self.grid_resol\n self.dk = 2 * np.pi/self.grid_width\n self.grid_x_shifted = -self.grid...
[ "0.6455349", "0.60431594", "0.5857253", "0.54997003", "0.5488937", "0.5479533", "0.54215795", "0.5392349", "0.5385499", "0.53742164", "0.5348733", "0.534845", "0.5332898", "0.5305748", "0.52968", "0.5293048", "0.52900636", "0.52560335", "0.52560335", "0.52474153", "0.52438915...
0.76073295
0
Gives the irreducible boundaries for this space, but returns it as a space, i.e., as a Mgn object with the defining genus and marked points. This is used to compute itersections with ch.
def irr_boundary_as_space(self): p1,p2 = self.next_marks() return Mgn(self.genus - 1, self.marks.union([p1,p2])), p1, p2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def red_boundaries_as_spaces(self):\n marks = set(self.marks)\n if self.n != 0:\n first_mark_list = [marks.pop()]\n \n \n p1,p2 = self.next_marks() \n \n for g1 in range(0, self.genus + 1):\n for p in subsets(marks):\...
[ "0.6790039", "0.57674015", "0.5721155", "0.5695158", "0.5683047", "0.56764877", "0.56645674", "0.54823256", "0.5448614", "0.5395288", "0.5320104", "0.5307561", "0.5305074", "0.52890897", "0.5264711", "0.5260044", "0.5260044", "0.5260044", "0.5260044", "0.5260044", "0.5260044"...
0.76175594
0