query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Erstellt simplen baseline tfidfbasierten unigram SVM classifier mit 10fold crossvalidation auf preprocessed germeval.train dataset | def createBaselineClassifier(self, bigram=False):
tweets, labels = self.read_corpus()
ten_folds = self.get_n_folds(tweets, labels)
if(bigram):
print("Baseline: tf-idf bigram SVM")
self.write_label_to_csv("Baseline: tf-idf bigram SVM")
bow_transformer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def training(train_data, dev_data, param):\n text_to_vec = TextToVec(**param)\n\n # Fit with both train and dev data\n text_to_vec.fit(train_data['data'] + dev_data['data'])\n word_vec_map = text_to_vec.vectorizer.get_feature_names()\n train_vec = text_to_vec.transform(train_data['data'])\n dev_v... | [
"0.69524693",
"0.6886112",
"0.6814737",
"0.68065464",
"0.6736175",
"0.6735247",
"0.66681165",
"0.666012",
"0.66220576",
"0.66164863",
"0.65743214",
"0.6573713",
"0.6566177",
"0.6508141",
"0.6498798",
"0.64600265",
"0.6457398",
"0.6447588",
"0.6409227",
"0.64040935",
"0.639933... | 0.76527756 | 0 |
Takes webpage url, loads it with web chrome driver on given maximum waiting time (by default 60sec) and outputs html page source. | def get_page_source(self, url: str, target_class: str, waiting_time=60) -> str:
if self.get_status():
pass
else:
self.__driver = webdriver.Chrome(self.__driver_path)
try:
self.__driver.get(url)
except TimeoutException:
print(f"URL LOADING... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, url:str, time=1):\n page = self.driver.get(url)\n sleep(time)\n return page",
"def httpGetSelenium(url, delaySecs, mustGet=False):\n global display\n global browser\n logging.info('Downloading %s using Selenium/Firefox' % url)\n host = urlparse.urlsplit(url)[1]\n ... | [
"0.67502713",
"0.65184426",
"0.6472697",
"0.6418692",
"0.6342237",
"0.6335778",
"0.62551194",
"0.6215674",
"0.60361654",
"0.59978306",
"0.59692",
"0.59198636",
"0.5875962",
"0.5869679",
"0.58675563",
"0.5823361",
"0.58122635",
"0.5781892",
"0.5766489",
"0.5762371",
"0.5757728... | 0.67109185 | 1 |
Takes BeautifulSoup object and tries to find next page in AirBnB search query. | def find_next_page(self, soup: BeautifulSoup) -> Optional[str]:
try:
next_page = (
f"https://www.airbnb.com{soup.find('a', class_='_za9j7e')['href']}"
)
except (TypeError, KeyError):
next_page = None
return next_page | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_find_next_page() -> None:\n html_doc = \"\"\"\n <html>\n <head><title>Example text</title></head>\n <body><a class=\"_za9j7e\" href=\"/test\">Text to extract</a></body>\n </html>\n \"\"\"\n soup = BeautifulSoup(html_doc, \"ht... | [
"0.72525835",
"0.6864087",
"0.6701612",
"0.65257955",
"0.65106577",
"0.6394619",
"0.6340258",
"0.63028586",
"0.6277595",
"0.6232996",
"0.62071836",
"0.6183836",
"0.61454487",
"0.6069918",
"0.60682636",
"0.6050431",
"0.602947",
"0.602719",
"0.5980646",
"0.5963144",
"0.5961957"... | 0.73679984 | 0 |
Takes city,country name and number of samples that needs to be scraped, then tries to find needed data and adds it into collected_dic dictionary. | def collect_city_items(self, samples: int, city: str, country:str) -> None:
time_start = time.time()
url = self.get_city_url(city,country)
samples_taken = 0
while url != None:
page_source = self.get_page_source(url, "_1g5ss3l")
soup = BeautifulSoup(page_source, "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_all(self, samples: int, cities: list, country:str) -> None:\n\n time_start = time.time()\n for city in cities:\n self.collect_city_items(samples,city,country)\n print(f\"All scraping is done! Time elapsed: {time.time()-time_start} seconds.\")",
"def init(city: str, cou... | [
"0.6393902",
"0.61978185",
"0.5626694",
"0.560007",
"0.553585",
"0.5505954",
"0.5486551",
"0.5483711",
"0.545995",
"0.5458258",
"0.54034764",
"0.53772944",
"0.5356381",
"0.53447205",
"0.53084505",
"0.53021246",
"0.528695",
"0.5267542",
"0.5241169",
"0.5230059",
"0.5229647",
... | 0.74315417 | 0 |
Takes airbnb apartment url, gets html page source then from it collects longitude and latitude coordinates and amenities data which appends to collected_dic dictionary. | def collect_amenities(self, url: str) -> None:
page_source = self.get_page_source(url, "gmnoprint")
soup = BeautifulSoup(page_source, "html.parser")
# Get latitude and longitude data
self.get_coordinates(soup)
# Open amenities url and collect additional data
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrape_apartment(url_tuple):\n req = requests.get(url_tuple[0])\n soup = BeautifulSoup(req.text)\n try:\n title = soup.find_all(class_='postingtitle')[0]\n except:\n pdb.set_trace()\n price = MONEY.search(title.text).group(1)\n attrs = soup.find_all(class_='attrgroup')[0]\n t... | [
"0.713004",
"0.66835093",
"0.66080236",
"0.6330858",
"0.6308233",
"0.6168042",
"0.61317265",
"0.6128649",
"0.6120434",
"0.6106903",
"0.6007357",
"0.5968393",
"0.59113824",
"0.5897801",
"0.58391964",
"0.5819363",
"0.5795354",
"0.57798064",
"0.5736259",
"0.5721426",
"0.567999",... | 0.7711305 | 0 |
Takes cities list,country name and number of samples that needs to be scraped, loops through every city, scrapes data and appends to collected_dic dictionary. | def collect_all(self, samples: int, cities: list, country:str) -> None:
time_start = time.time()
for city in cities:
self.collect_city_items(samples,city,country)
print(f"All scraping is done! Time elapsed: {time.time()-time_start} seconds.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_city_items(self, samples: int, city: str, country:str) -> None:\n time_start = time.time()\n url = self.get_city_url(city,country)\n samples_taken = 0\n while url != None:\n\n page_source = self.get_page_source(url, \"_1g5ss3l\")\n soup = BeautifulSoup(... | [
"0.7872526",
"0.6471848",
"0.6193934",
"0.6192851",
"0.6126794",
"0.60295945",
"0.5842041",
"0.5747323",
"0.57091296",
"0.5695384",
"0.5640974",
"0.55920327",
"0.5585987",
"0.55787474",
"0.5530041",
"0.5507943",
"0.5484832",
"0.54827386",
"0.5460536",
"0.54576236",
"0.5448601... | 0.77342606 | 1 |
Takes beautiful soup object, returns and appends found url to collected_dic dictionary. If it doesn't exist returns and appends None value. | def get_item_url(self, soup: BeautifulSoup) -> Optional[str]:
try:
url = f"https://www.airbnb.com{soup.find('a').get('href')}"
except AttributeError:
url = None
self.__collected_dic["url"].append(url)
return url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup(self, url):\n return {'url': url}",
"def extract_from_soup( target_url_soup ):\n\n datetime_now = datetime.datetime.now().strftime(\"%m.%d.%Y:%H.%M.%S\")\n\n # Declare a list for each variable extracted below.\n title_list = []\n href_list = []\n cost_list = []\n info_list = [... | [
"0.5943531",
"0.57695955",
"0.56360537",
"0.55083185",
"0.54314125",
"0.54251456",
"0.5360817",
"0.53569",
"0.52569366",
"0.51911604",
"0.51872367",
"0.51849586",
"0.5162024",
"0.51553",
"0.51447505",
"0.513835",
"0.5138052",
"0.51330787",
"0.51328456",
"0.51217043",
"0.51126... | 0.6178361 | 0 |
Takes beautiful soup object, tries to find and append item property type to collected_dic dictionary. If it doesn't exist appends None value. | def get_item_property_type(self, soup: BeautifulSoup) -> None:
try:
property_type = soup.find("div", class_="_b14dlit").get_text()
property_type = property_type.split(" ")
index = property_type.index("in")
property_type = " ".join(property_type[:index])
ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPropertyDetails(soup, refs, PropertyItem, tagType='entitytype'):\n propEntry = dict()\n\n propOwner, propChild = PropertyItem.split(':')[0].replace('#',''), PropertyItem.split(':')[-1]\n SchemaNamespace, SchemaType = getNamespace(propOwner), getType(propOwner)\n rsvLogger.debug('___')\n rsvLo... | [
"0.5883507",
"0.5378689",
"0.5378468",
"0.51176757",
"0.5024855",
"0.50065035",
"0.49827838",
"0.49611333",
"0.49003726",
"0.48840225",
"0.48394716",
"0.4829663",
"0.48160177",
"0.47699362",
"0.47631818",
"0.4733115",
"0.47183883",
"0.46972144",
"0.46875298",
"0.4686675",
"0.... | 0.7105546 | 0 |
Takes beautiful soup object, tries to find and append item location to collected_dic dictionary. If it doesn't exist appends None value. | def get_item_location(self, soup: BeautifulSoup) -> None:
try:
location = soup.find("div", class_="_b14dlit").get_text()
location = location.split(" ")
index = location.index("in")
location = " ".join(location[index + 1 :])
except (AttributeError, IndexErr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_from_soup( target_url_soup ):\n\n datetime_now = datetime.datetime.now().strftime(\"%m.%d.%Y:%H.%M.%S\")\n\n # Declare a list for each variable extracted below.\n title_list = []\n href_list = []\n cost_list = []\n info_list = []\n loc_list = []\n datetime_pulled = []\n\n # I... | [
"0.5867997",
"0.56147057",
"0.5444389",
"0.54335",
"0.53501713",
"0.5335215",
"0.53009695",
"0.5204059",
"0.51855624",
"0.5175734",
"0.5133198",
"0.5110254",
"0.5097912",
"0.5073919",
"0.5005285",
"0.49998677",
"0.49817833",
"0.49747327",
"0.4959687",
"0.49388048",
"0.4893884... | 0.7052489 | 0 |
Takes beautiful soup object, tries to find and append item title to collected_dic dictionary. If it doesn't exist appends None value. | def get_item_title(self, soup: BeautifulSoup) -> None:
try:
title = soup.find("span", class_="_bzh5lkq").get_text()
except AttributeError:
title = None
self.__collected_dic["title"].append(title) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def found_title(newtitle=None):\n global title, body\n if title and len(body):\n print(title)\n if title not in ('DEDICATED', 'INTRODUCTION'):\n body = parse_body(body)\n thebook.append(Section(title, body))\n body = []\n title = newtitle",
"def get_soup_general_da... | [
"0.61773974",
"0.5822468",
"0.5736757",
"0.5698712",
"0.5602335",
"0.55480945",
"0.5448295",
"0.54458094",
"0.54364854",
"0.5428637",
"0.5381655",
"0.53368074",
"0.5331688",
"0.5323809",
"0.5249588",
"0.52433676",
"0.523925",
"0.5206616",
"0.51884025",
"0.5179303",
"0.5178137... | 0.75311166 | 0 |
Takes beautiful soup object, tries to find and append item rating to collected_dic dictionary. If it doesn't exist appends None value. | def get_item_rating(self, soup: BeautifulSoup) -> None:
try:
rating = soup.find("span", class_="_10fy1f8").get_text()
except AttributeError:
rating = None
self.__collected_dic["rating"].append(rating) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item_reviews(self, soup: BeautifulSoup) -> None:\n try:\n reviews = soup.find(\"span\", class_=\"_a7a5sx\").get_text()\n reviews = re.findall(\"[0-9]+\", reviews)[0]\n except AttributeError:\n reviews = None\n self.__collected_dic[\"reviews\"].append(re... | [
"0.6933185",
"0.61987257",
"0.6190968",
"0.6185046",
"0.5983376",
"0.58625484",
"0.56688863",
"0.55826455",
"0.54689103",
"0.5409436",
"0.5389322",
"0.5279748",
"0.52278376",
"0.5189856",
"0.5176954",
"0.5125328",
"0.5075371",
"0.50679195",
"0.50548285",
"0.5036137",
"0.50282... | 0.80135775 | 0 |
Takes beautiful soup object, tries to find and append item reviews count to collected_dic dictionary. If it doesn't exist appends None value. | def get_item_reviews(self, soup: BeautifulSoup) -> None:
try:
reviews = soup.find("span", class_="_a7a5sx").get_text()
reviews = re.findall("[0-9]+", reviews)[0]
except AttributeError:
reviews = None
self.__collected_dic["reviews"].append(reviews) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item_rating(self, soup: BeautifulSoup) -> None:\n try:\n rating = soup.find(\"span\", class_=\"_10fy1f8\").get_text()\n except AttributeError:\n rating = None\n self.__collected_dic[\"rating\"].append(rating)",
"def get_reviews(review_url):\n print review_url... | [
"0.6247622",
"0.586302",
"0.5853375",
"0.5773529",
"0.55292547",
"0.5483901",
"0.54430836",
"0.54322064",
"0.5398597",
"0.537634",
"0.5374115",
"0.53568625",
"0.53283167",
"0.5212728",
"0.51809",
"0.5137657",
"0.5126477",
"0.5108474",
"0.5082245",
"0.50741506",
"0.50617576",
... | 0.7706817 | 0 |
Takes beautiful soup object, tries to find and append item price to collected_dic dictionary. If it doesn't exist appends None value. | def get_item_price(self, soup: BeautifulSoup) -> None:
try:
price = soup.find("span", class_="_olc9rf0").get_text()
price = re.findall("\d+(?:\.\d+)?", price)[0]
except (AttributeError, IndexError):
price = None
self.__collected_dic["price"].append(price) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_listing_price_from_result(soup, prices):\r\n for description in soup.find_all(name='div', class_='descr'):\r\n price = description.find(name='div', class_='price')\r\n if price == None:\r\n prices.append('No Price')\r\n else:\r\n prices.append(price.get_tex... | [
"0.6530516",
"0.62555623",
"0.6165758",
"0.61416197",
"0.61225903",
"0.6093888",
"0.59539896",
"0.5916509",
"0.59050703",
"0.5744452",
"0.5712572",
"0.57022685",
"0.56966907",
"0.5678608",
"0.5564862",
"0.55330116",
"0.54826045",
"0.5435226",
"0.5373445",
"0.5371177",
"0.5316... | 0.7805614 | 0 |
Takes beautiful soup object, tries to find and append item guests count to collected_dic dictionary. If it doesn't exist appends None value. | def get_item_guests(self, soup: BeautifulSoup) -> None:
try:
guests = (
soup.find("div", class_="_kqh46o")
.find_all("span", class_="_3hmsj")[0]
.get_text()
)
guests = re.findall("[0-9]+", guests)[0]
except (AttributeErr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item_reviews(self, soup: BeautifulSoup) -> None:\n try:\n reviews = soup.find(\"span\", class_=\"_a7a5sx\").get_text()\n reviews = re.findall(\"[0-9]+\", reviews)[0]\n except AttributeError:\n reviews = None\n self.__collected_dic[\"reviews\"].append(re... | [
"0.5919098",
"0.5558538",
"0.55115074",
"0.5256707",
"0.52388537",
"0.52354115",
"0.5231342",
"0.5225441",
"0.5176389",
"0.51691544",
"0.5093434",
"0.50525236",
"0.49904534",
"0.49780917",
"0.4904021",
"0.4903231",
"0.48984927",
"0.48683393",
"0.48404592",
"0.48371214",
"0.48... | 0.73032606 | 0 |
Takes beautiful soup object, tries to find and append item bedroom count, studio type, to collected_dic dictionary. If it doesn't exist appends None value. | def get_item_bedrooms(self, soup: BeautifulSoup) -> None:
try:
bedrooms = (
soup.find("div", class_="_kqh46o")
.find_all("span", class_="_3hmsj")[1]
.get_text()
)
try:
bedrooms = re.findall("[0-9]+", bedrooms)[0]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_soup_general_data(soup):\n data_dict = {}\n\n name = soup.find(class_='product_title')\n if name:\n data_dict['name_of_game'] = name.h1.text\n\n pub = soup.find('li', class_='summary_detail publisher')\n if pub:\n data_dict['publisher'] = pub.a.text.strip()\n\n rel_date = so... | [
"0.65049696",
"0.6490216",
"0.5634446",
"0.5586962",
"0.5545422",
"0.55328375",
"0.55142635",
"0.5388668",
"0.5358688",
"0.5337653",
"0.5323064",
"0.5318799",
"0.5273689",
"0.52649623",
"0.52235305",
"0.52003837",
"0.5172041",
"0.5144129",
"0.513891",
"0.5137125",
"0.5134646"... | 0.6817234 | 0 |
Takes beautiful soup object, tries to find and append item beds count to collected_dic dictionary. If it doesn't exist appends None value. | def get_item_beds(self, soup: BeautifulSoup) -> None:
try:
beds = (
soup.find("div", class_="_kqh46o")
.find_all("span", class_="_3hmsj")[2]
.get_text()
)
beds = re.findall("[0-9]+", beds)[0]
except (AttributeError, Inde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item_reviews(self, soup: BeautifulSoup) -> None:\n try:\n reviews = soup.find(\"span\", class_=\"_a7a5sx\").get_text()\n reviews = re.findall(\"[0-9]+\", reviews)[0]\n except AttributeError:\n reviews = None\n self.__collected_dic[\"reviews\"].append(re... | [
"0.57513833",
"0.5713499",
"0.56199276",
"0.54456687",
"0.54290533",
"0.5398115",
"0.531527",
"0.5298637",
"0.5287076",
"0.5250815",
"0.5219739",
"0.5195833",
"0.5075992",
"0.5029931",
"0.4841725",
"0.48312882",
"0.47905236",
"0.47811645",
"0.47461322",
"0.47437534",
"0.47316... | 0.6474664 | 0 |
Takes beautiful soup object, tries to find and append item baths count,type to collected_dic dictionary. If it doesn't exist appends None value. | def get_item_baths(self, soup: BeautifulSoup) -> None:
shared_bath = 0
try:
baths = (
soup.find("div", class_="_kqh46o")
.find_all("span", class_="_3hmsj")[3]
.get_text()
)
try:
baths_number = re.findall(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item_beds(self, soup: BeautifulSoup) -> None:\n try:\n beds = (\n soup.find(\"div\", class_=\"_kqh46o\")\n .find_all(\"span\", class_=\"_3hmsj\")[2]\n .get_text()\n )\n beds = re.findall(\"[0-9]+\", beds)[0]\n excep... | [
"0.60078645",
"0.594044",
"0.58874077",
"0.5764784",
"0.5659716",
"0.56236094",
"0.5562076",
"0.5540509",
"0.55326164",
"0.5405525",
"0.53313136",
"0.5321272",
"0.5228685",
"0.52053225",
"0.51900023",
"0.5188694",
"0.51610667",
"0.51563483",
"0.5138344",
"0.5132109",
"0.51134... | 0.6020522 | 0 |
Takes beautiful soup object, tries to find and append item coordinates to collected_dic dictionary. If it doesn't exist appends None value. | def get_coordinates(self, soup: BeautifulSoup) -> None:
try:
url = soup.find(
"a", {"title": "Open this area in Google Maps (opens a new window)"}
)["href"]
coordinates = url[url.find("=") + 1 : url.find("&")]
coordinates = [float(n) for n in coord... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item_location(self, soup: BeautifulSoup) -> None:\n try:\n location = soup.find(\"div\", class_=\"_b14dlit\").get_text()\n location = location.split(\" \")\n index = location.index(\"in\")\n location = \" \".join(location[index + 1 :])\n except (Att... | [
"0.65895325",
"0.5828491",
"0.5600424",
"0.5580063",
"0.5535078",
"0.5499111",
"0.5496232",
"0.5378672",
"0.53142726",
"0.52613944",
"0.52297103",
"0.51500046",
"0.5102584",
"0.5087085",
"0.50758004",
"0.5071389",
"0.5041007",
"0.50328267",
"0.5031559",
"0.5027197",
"0.500837... | 0.6116278 | 1 |
Takes html parsed text string and tries to find if wifi is included into amenities or not. | def get_amenity_wifi(self, amenities: str) -> None:
wifi = 0
if "Wifi" in amenities:
if "Unavailable: Wifi" not in amenities:
wifi = 1
self.__collected_dic["wifi"].append(wifi) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_amenities(self, url: str) -> None:\n page_source = self.get_page_source(url, \"gmnoprint\")\n soup = BeautifulSoup(page_source, \"html.parser\")\n\n # Get latitude and longitude data\n self.get_coordinates(soup)\n\n # Open amenities url and collect additional data\n ... | [
"0.5070194",
"0.50482494",
"0.5041983",
"0.50070536",
"0.47982666",
"0.47982666",
"0.47930086",
"0.47911403",
"0.47896484",
"0.47879738",
"0.47409207",
"0.47315672",
"0.47259563",
"0.46491262",
"0.46217394",
"0.46015614",
"0.46010172",
"0.4589547",
"0.45573193",
"0.45248565",
... | 0.54296416 | 0 |
Takes html parsed text string and tries to find if parking is included into amenities or not. | def get_amenity_parking(self, amenities: str) -> None:
parking = 0
if "Free parking on premises" in amenities:
if "Unavailable: Free parking on premises" not in amenities:
parking = 1
self.__collected_dic["parking"].append(parking) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_amenities(self, url: str) -> None:\n page_source = self.get_page_source(url, \"gmnoprint\")\n soup = BeautifulSoup(page_source, \"html.parser\")\n\n # Get latitude and longitude data\n self.get_coordinates(soup)\n\n # Open amenities url and collect additional data\n ... | [
"0.5201916",
"0.51330274",
"0.51330274",
"0.5108337",
"0.49992627",
"0.49880508",
"0.4983557",
"0.49751857",
"0.49537873",
"0.49529174",
"0.49365577",
"0.49275178",
"0.4898428",
"0.48865342",
"0.4861898",
"0.48336342",
"0.4831972",
"0.48242387",
"0.48124063",
"0.4793044",
"0.... | 0.5208724 | 0 |
go from yaml to method. Need to be here for accesing local variables. | def _from_yaml_to_func(method, params):
prm = dict()
if params is not None:
for key, val in params.items():
prm[key] = eval(str(val))
return eval(method)(**prm) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_yaml_to_func(method, params):\n prm = dict()\n if params is not None:\n for key, val in params.iteritems():\n prm[key] = eval(str(val))\n return eval(method)(**prm)",
"def yaml(self):\n raise NotImplementedError",
"def user_create_yaml(self):\n pass",
"def _... | [
"0.6370778",
"0.6029875",
"0.5958894",
"0.5843925",
"0.58090866",
"0.57686687",
"0.57444394",
"0.57349527",
"0.57081026",
"0.5651127",
"0.56415755",
"0.56176186",
"0.55755144",
"0.5432763",
"0.54186237",
"0.53906727",
"0.5385559",
"0.53769624",
"0.53585047",
"0.5351156",
"0.5... | 0.6445744 | 0 |
Represents raw documents as a Domain; a domain contains the tfidf weighted cooccurrence matrices of the labeled and unlabeled documents (with consistent Vocabulary). | def as_domain(labeled_docs, labels, issource, domain, unlabeled_docs=None, unlabeled_y=None, tokken_pattern=r"(?u)\b\w\w+\b", min_df=1):
if issource:
counter = CountVectorizer(token_pattern=tokken_pattern, min_df=min_df)
v = counter.fit(labeled_docs).vocabulary_
tfidf = TfidfVectorizer(subli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, documents_path):\n self.documents = []\n self.vocabulary = []\n self.likelihoods = []\n self.documents_path = documents_path\n self.term_doc_matrix = None \n self.document_topic_prob = None # P(z | d)\n self.topic_word_prob = None # P(w | z)\n ... | [
"0.55177164",
"0.532483",
"0.53110534",
"0.5309066",
"0.52573663",
"0.52449435",
"0.5205308",
"0.5171874",
"0.5132251",
"0.51252466",
"0.5084443",
"0.50789124",
"0.5076497",
"0.50449795",
"0.5018901",
"0.49906158",
"0.49721056",
"0.49612966",
"0.48982418",
"0.48972565",
"0.48... | 0.613163 | 0 |
Given a source and a target domain, returns two new versions of them in which the feature spaces are common, by trivially juxtapossing the two vocabularies | def unify_feat_space(source, target):
word_set = source.V.term_set().union(target.V.term_set())
word2idx = {w:i for i,w in enumerate(word_set)}
Vshared = Vocabulary(word2idx)
def reindexDomain(domain, sharedV):
V = domain.V
nD=domain.X.shape[0]
nF=len(sharedV)
newX = lil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_common(self, other, mapping):\n\n self_oov = defaultdict(lambda: 0)\n other_oov = defaultdict(lambda: 0)\n self_word_id = deepcopy(self.word_id)\n other_word_id = deepcopy(other.word_id)\n new_words = []\n map_ = mapping.map\n for i, w in enumerate(self.word... | [
"0.60505563",
"0.59342515",
"0.5890901",
"0.54661405",
"0.5458241",
"0.54137206",
"0.54004747",
"0.53808236",
"0.52926284",
"0.52847356",
"0.52746683",
"0.5259281",
"0.5251617",
"0.5208583",
"0.52080506",
"0.51845384",
"0.51535887",
"0.5097035",
"0.50506455",
"0.50265324",
"0... | 0.7349194 | 0 |
tests that the endpoint will correctly retrieve issues resolved in a release from the GroupResolution model | def test_shows_issues_from_groupresolution(self):
GroupResolution.objects.create(
group=self.group,
release=self.release,
type=GroupResolution.Type.in_release,
)
response = self.client.get(self.path)
assert response.status_code == 200, response.conten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_index_response_descriptor_projects_release_release_resource(self):\n pass",
"def test_load_response_descriptor_projects_release_release_resource(self):\n pass",
"def test_modify_response_descriptor_projects_release_release_resource(self):\n pass",
"def test_issue_get_issue(self)... | [
"0.6731257",
"0.6728096",
"0.6593924",
"0.65891445",
"0.6567739",
"0.641095",
"0.6356711",
"0.6323448",
"0.63181",
"0.6240595",
"0.61705667",
"0.6141184",
"0.6125675",
"0.60648435",
"0.6044746",
"0.5915682",
"0.58900505",
"0.58779943",
"0.58763444",
"0.5847858",
"0.58201045",... | 0.8160675 | 0 |
tests that the endpoint will correctly retrieve issues resolved in a release from the GroupLink model | def test_shows_issues_from_grouplink(self):
repo = Repository.objects.create(
organization_id=self.org.id,
name=self.project.name,
)
commit = Commit.objects.create(
organization_id=self.org.id,
repository_id=repo.id,
key='a' * 40,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_shows_issues_from_groupresolution(self):\n GroupResolution.objects.create(\n group=self.group,\n release=self.release,\n type=GroupResolution.Type.in_release,\n )\n response = self.client.get(self.path)\n\n assert response.status_code == 200, re... | [
"0.7602695",
"0.7020391",
"0.6634302",
"0.6492066",
"0.64093494",
"0.64001703",
"0.62322736",
"0.62202394",
"0.6219868",
"0.62177134",
"0.6194878",
"0.6169989",
"0.6118815",
"0.61100864",
"0.6021633",
"0.6009909",
"0.6000159",
"0.59847087",
"0.5977124",
"0.5949995",
"0.594505... | 0.7487624 | 1 |
tests that the endpoint will correctly retrieve issues resolved in a release from the GroupLink and GroupResolution model but will not return the groups twice if they appear in both | def test_does_not_return_duplicate_groups(self):
repo = Repository.objects.create(
organization_id=self.org.id,
name=self.project.name,
)
commit = Commit.objects.create(
organization_id=self.org.id,
repository_id=repo.id,
key='a' * 40,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_shows_issues_from_groupresolution(self):\n GroupResolution.objects.create(\n group=self.group,\n release=self.release,\n type=GroupResolution.Type.in_release,\n )\n response = self.client.get(self.path)\n\n assert response.status_code == 200, re... | [
"0.78239423",
"0.75734323",
"0.7388709",
"0.6468655",
"0.6451129",
"0.628309",
"0.6230137",
"0.6230137",
"0.59780496",
"0.59780496",
"0.5959293",
"0.5912394",
"0.586184",
"0.5860263",
"0.5786",
"0.57264304",
"0.5712603",
"0.5679398",
"0.5674802",
"0.5664668",
"0.5576779",
"... | 0.7576254 | 1 |
Given a list of edges, finds the shortest subtour | def _subtour(edges,n):
visited = [False]*n
cycles = []
costs = []
selected = [[] for i in range(n)]
for x,y in edges:
selected[x].append(y)
while True:
current = visited.index(False)
thiscycle = [current]
while True:
visited[current] = True
neighbors = [x for x in selected[curren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_path(vs, es, source, target):\n dijkstra(vs, es, source, stop = target)\n test = target\n result = []\n while test != source:\n e = test._ss_edge\n result.append(e)\n test = e.v1 if e.v1 != test else e.v2\n assert test == source and test._ss_edge is None\n return resu... | [
"0.666806",
"0.62232685",
"0.61860347",
"0.6144948",
"0.6141155",
"0.60325694",
"0.6011906",
"0.59948426",
"0.5962064",
"0.5957213",
"0.59469795",
"0.5917289",
"0.59133065",
"0.58742553",
"0.58728814",
"0.5868527",
"0.5865398",
"0.5839711",
"0.5784419",
"0.5782554",
"0.577789... | 0.71938235 | 0 |
evaluate the numerical range of Comparison node, if any else returns None | def evaluate_comparison_range(node):
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def less_than_or_equal(self) -> global___Expression:",
"def _computeRangeFromData(data):\n if data is None:\n return None\n\n dataRange = min_max(data, min_positive=True, finite=True)\n if dataRange.minimum is None: # Only non-finite data\n return None\n\n if da... | [
"0.61809945",
"0.59843427",
"0.59064376",
"0.5892637",
"0.57899994",
"0.5788908",
"0.56772816",
"0.5649862",
"0.55945563",
"0.5576392",
"0.55749583",
"0.5557043",
"0.5555275",
"0.5538864",
"0.5505666",
"0.54928887",
"0.5434632",
"0.54216003",
"0.53938824",
"0.5393089",
"0.538... | 0.87581426 | 0 |
test if node is a Comparison node or not | def is_comparison(node):
return isinstance(node, Comparison) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare(self, node) -> bool:\n\t\t# No conflicts, Return True\n\t\treturn True",
"def _lt(self, node_a, node_b):\n node_a = self.__getitem__(node_a)\n node_b = self.__getitem__(node_b)\n if 'val' in node_a and 'val' in node_b:\n return node_a['val'] > node_b['val']\n el... | [
"0.6903759",
"0.64374024",
"0.63477373",
"0.6331517",
"0.6281208",
"0.6251952",
"0.6213936",
"0.60570204",
"0.60122114",
"0.5931676",
"0.59073883",
"0.58261156",
"0.5811369",
"0.5807912",
"0.5807912",
"0.579668",
"0.57671314",
"0.5764646",
"0.5764646",
"0.5764646",
"0.5764646... | 0.877195 | 0 |
forward compatible attributes from src node to dst node | def forward_attributes(src, dst):
dst.set_tag(src.get_tag())
dst.set_debug(src.get_debug())
dst.set_handle(src.get_handle())
if hasattr(src.attributes, "init_stage"):
forward_stage_attributes(src, dst)
if isinstance(src, BooleanOperation) and isinstance(dst, BooleanOperation):
dst.li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward_stage_attributes(src, dst):\n dst.attributes.init_stage = src.attributes.init_stage",
"def merge_attribute_defs(self, dest, source, changes = {}):\n # print \"in merge_attribute_defs, dest =\"\n # pp.pprint(dest)\n # print \"source =\"\n # pp.pprint(source)\n for... | [
"0.67408407",
"0.6257168",
"0.61852455",
"0.61845607",
"0.616487",
"0.6137304",
"0.6068984",
"0.6030227",
"0.60268617",
"0.6002633",
"0.5964167",
"0.5799605",
"0.5663637",
"0.5646328",
"0.556146",
"0.550726",
"0.5453629",
"0.5437124",
"0.5434096",
"0.54210055",
"0.54031247",
... | 0.73098195 | 0 |
copy node's stage attributes from src node to dst node | def forward_stage_attributes(src, dst):
dst.attributes.init_stage = src.attributes.init_stage | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward_attributes(src, dst):\n dst.set_tag(src.get_tag())\n dst.set_debug(src.get_debug())\n dst.set_handle(src.get_handle())\n if hasattr(src.attributes, \"init_stage\"):\n forward_stage_attributes(src, dst)\n if isinstance(src, BooleanOperation) and isinstance(dst, BooleanOperation):\n... | [
"0.65456533",
"0.61022925",
"0.6005289",
"0.5879294",
"0.5840372",
"0.57985765",
"0.5703638",
"0.5673773",
"0.56665874",
"0.5569441",
"0.5422265",
"0.542203",
"0.54179245",
"0.5395858",
"0.53932905",
"0.5353597",
"0.53415",
"0.52928126",
"0.52678436",
"0.5226759",
"0.5178725"... | 0.7721214 | 0 |
order the node between root start_node end end_nodes by depth (root first, starting with start_node) | def depth_node_ordering(start_node, end_nodes):
ordered_list = []
ordered_set = set()
working_list = [start_node]
while working_list != []:
node = working_list.pop(0)
if not node in ordered_set:
ordered_set.add(node)
ordered_list.append(node)
if not is_lea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def level_order_nodes(root):\n queue = []\n queue.append(root)\n\n while 0 < len(queue):\n next_node = queue.pop(0)\n if next_node.get_left():\n queue.append(next_node.get_left())\n if next_node.get_right():\n queue.append(next_node.get_right())\n yield ne... | [
"0.6819107",
"0.66105956",
"0.6462769",
"0.64328337",
"0.63325244",
"0.6302154",
"0.62727016",
"0.62204933",
"0.62066984",
"0.61907727",
"0.6122201",
"0.6085809",
"0.60491794",
"0.5997853",
"0.5974809",
"0.5974748",
"0.59546626",
"0.59442264",
"0.5885649",
"0.58825254",
"0.58... | 0.75627315 | 0 |
Logical/Boolean operand list reduction | def logical_reduce(op_list, op_ctor=LogicalOr, precision=ML_Bool, **kw):
local_list = [node for node in op_list]
while len(local_list) > 1:
op0 = local_list.pop(0)
op1 = local_list.pop(0)
local_list.append(
op_ctor(op0, op1, precision=precision)
)
# assigning attr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def and_list(conditionList):\n return functools.reduce(numpy.logical_and, conditionList)",
"def _build_logical_op(op):\n def logical_op(self, other):\n \"\"\"`plist` logical operation. **Logical operations perform set operations on `plist`s.**\n\n **IMPORTANT:** `plist` logical operations between two `... | [
"0.6813916",
"0.6477328",
"0.64292115",
"0.6301982",
"0.6253801",
"0.61561936",
"0.6140855",
"0.61121607",
"0.5945855",
"0.5918095",
"0.5884704",
"0.5880134",
"0.585678",
"0.5807552",
"0.57737833",
"0.5770661",
"0.57645154",
"0.5751736",
"0.57142824",
"0.57137764",
"0.5698087... | 0.6991345 | 0 |
Check that value_list is made of only a single value replicated in each element | def uniform_list_check(value_list):
return reduce((lambda acc, value: acc and value == value_list[0]), value_list, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_list(self, value):\n\n okay = True\n count = 0\n for v in value.elts:\n if not self.eval_value(v):\n okay = False\n break\n count += 1\n return okay",
"def list_value(self) -> global___Expression.RepeatedValue:",
"def get_... | [
"0.7017066",
"0.68168586",
"0.6749428",
"0.6419715",
"0.6196872",
"0.6089518",
"0.60870165",
"0.60539323",
"0.6019771",
"0.60183877",
"0.6017028",
"0.6016584",
"0.5992568",
"0.59700656",
"0.59156656",
"0.5905811",
"0.5892706",
"0.5876694",
"0.58335215",
"0.58328056",
"0.58143... | 0.78100336 | 0 |
check whether optree is a uniform vector constant | def uniform_vector_constant_check(optree):
if isinstance(optree, Constant) and not optree.get_precision() is None \
and optree.get_precision().is_vector_format():
return uniform_list_check(optree.get_value())
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_vector_uniform_cst(node, scalar_value):\n return isinstance(node, Constant) and node.get_precision().is_vector_format() and node.get_value() == [scalar_value] * node.get_precision().get_vector_size()",
"def constraint(arg: tp.Any) -> bool: # pylint: disable=unused-argument\n return bool(optimiz... | [
"0.74290043",
"0.62921304",
"0.598652",
"0.5885696",
"0.57871664",
"0.5658665",
"0.5651164",
"0.5575722",
"0.55392045",
"0.5502697",
"0.548666",
"0.548012",
"0.5459383",
"0.5400245",
"0.53898835",
"0.53681916",
"0.5312601",
"0.5306478",
"0.53039426",
"0.52689224",
"0.5227338"... | 0.8246579 | 0 |
check whether optree is a bit shift by a uniform vector constant | def uniform_shift_check(optree):
if isinstance(optree, (BitLogicLeftShift, BitLogicRightShift, BitArithmeticRightShift)):
return uniform_vector_constant_check(optree.get_input(1)) \
or not optree.get_input(1).get_precision().is_vector_format()
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bit_and_offset_bit_size_larger_than_val(self):\n value = bytearray()\n value.append(0)\n ops = [bitwise_operations.bit_and(self.five_255_bin, 0, 16, 1, value, None)]\n\n with pytest.raises(e.InvalidRequest):\n self.as_connection.operate(self.test_key, ops)",
"def u... | [
"0.5800303",
"0.5784374",
"0.5755397",
"0.57097644",
"0.5691729",
"0.5596629",
"0.5503038",
"0.54794496",
"0.5436376",
"0.541721",
"0.5364626",
"0.5343168",
"0.53392947",
"0.5334625",
"0.5328559",
"0.5325568",
"0.53192496",
"0.53049386",
"0.5279903",
"0.5243033",
"0.52364814"... | 0.81356406 | 0 |
check if node is a Constant node whose value is equal to boolean False | def is_false(node):
return is_scalar_cst(node, False) or is_vector_uniform_cst(node, False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_constant(node):\n return isinstance(node, gast.Constant)",
"def visit_Boolean(self, node: Boolean) -> Constant:\n\n if node.token.type == TokenType.FALSE:\n return Constant(IntType(1), 0)\n else:\n return Constant(IntType(1), 1)",
"def isConstant(self):\n retu... | [
"0.728244",
"0.7048054",
"0.68400115",
"0.67654836",
"0.6402696",
"0.63894206",
"0.6348832",
"0.6318454",
"0.6188289",
"0.61378944",
"0.6130613",
"0.6118372",
"0.6079896",
"0.6041154",
"0.60238224",
"0.60228443",
"0.601274",
"0.6000596",
"0.59984237",
"0.5994963",
"0.5991435"... | 0.7263826 | 1 |
check if node is a Constant node whose value is equal to boolean True | def is_true(node):
return is_scalar_cst(node, True) or is_vector_uniform_cst(node, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_constant(node):\n return isinstance(node, gast.Constant)",
"def visit_Boolean(self, node: Boolean) -> Constant:\n\n if node.token.type == TokenType.FALSE:\n return Constant(IntType(1), 0)\n else:\n return Constant(IntType(1), 1)",
"def isConstant(self):\n retu... | [
"0.7559144",
"0.71484566",
"0.69709504",
"0.656642",
"0.64772093",
"0.6468468",
"0.63953775",
"0.63772726",
"0.6324451",
"0.62858105",
"0.6268525",
"0.62218773",
"0.61466664",
"0.61460716",
"0.6143728",
"0.6135371",
"0.6135371",
"0.6069527",
"0.60675347",
"0.6061682",
"0.6025... | 0.72229344 | 1 |
check if node is a constant node with value equals to value | def is_scalar_cst(node, value):
return isinstance(node, Constant) and not node.get_precision().is_vector_format() and node.get_value() == value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_constant(node):\n return isinstance(node, gast.Constant)",
"def isConstant(self):\n return _libsbml.ASTNode_isConstant(self)",
"def get_node_value(node: Node):\n if node.type != 'Const':\n raise Exception('Can\\'t get value for non-constant node {}'.format(node.name))\n return node.... | [
"0.78889656",
"0.6742143",
"0.66828245",
"0.66555667",
"0.65215504",
"0.6408163",
"0.63753164",
"0.63392127",
"0.6313619",
"0.629812",
"0.629812",
"0.62779915",
"0.6109536",
"0.6078157",
"0.60358846",
"0.60154814",
"0.5975816",
"0.5975208",
"0.59493333",
"0.5927838",
"0.59168... | 0.6888622 | 1 |
check if node is a vector constant node with each value equals to scalar_value | def is_vector_uniform_cst(node, scalar_value):
return isinstance(node, Constant) and node.get_precision().is_vector_format() and node.get_value() == [scalar_value] * node.get_precision().get_vector_size() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_scalar_cst(node, value):\n return isinstance(node, Constant) and not node.get_precision().is_vector_format() and node.get_value() == value",
"def uniform_vector_constant_check(optree):\n if isinstance(optree, Constant) and not optree.get_precision() is None \\\n and optree.get_precision()... | [
"0.7676364",
"0.6696494",
"0.6261708",
"0.6169692",
"0.6040905",
"0.6035021",
"0.6025566",
"0.5993697",
"0.5895198",
"0.5793313",
"0.57826185",
"0.5727301",
"0.56869394",
"0.5670119",
"0.5656833",
"0.5623561",
"0.562084",
"0.56127745",
"0.5563629",
"0.5537945",
"0.5534003",
... | 0.8400726 | 0 |
extract the set of all ML_Table nodes in the graph rooted at node | def extract_tables(node):
processed_set = set([node])
table_set = set()
working_set = [node]
while working_set:
elt = working_set.pop(0)
if isinstance(elt, ML_NewTable):
table_set.add(elt)
elif not isinstance(elt, ML_LeafNode):
for op_node in elt.inputs:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes(self): \n return [n for n in self.iternodes()]",
"def nodes(self):\n return list(self.node_dict.keys())",
"def nodes(self):\n return list(self._g.keys())",
"def get_nodes(self):\n try:\n return list(self._adjacency_list.keys())\n except Exception as err... | [
"0.66851443",
"0.65299195",
"0.63991666",
"0.63836783",
"0.6374744",
"0.6373175",
"0.6370612",
"0.6365841",
"0.6346639",
"0.63331085",
"0.63235015",
"0.6316059",
"0.6316059",
"0.6258775",
"0.6237624",
"0.6236789",
"0.623624",
"0.62344027",
"0.62301373",
"0.62281096",
"0.62281... | 0.70232916 | 0 |
If a page failed, only print summary for individual passing pages. | def test_basic_summary_pass_and_fail_page(self):
test_page_set = _MakePageSet()
measurement_results = SummarySavingPageMeasurementResults()
measurement_results.WillMeasurePage(test_page_set.pages[0])
measurement_results.Add('a', 'seconds', 3)
measurement_results.DidMeasurePage()
measurement_res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_repeated_pageset_one_iteration_one_page_error(self):\n test_page_set = _MakePageSet()\n\n measurement_results = SummarySavingPageMeasurementResults()\n measurement_results.WillMeasurePage(test_page_set.pages[0])\n measurement_results.Add('a', 'seconds', 3)\n measurement_results.DidMeasurePa... | [
"0.6134542",
"0.6080731",
"0.5873231",
"0.5858546",
"0.58456564",
"0.5735306",
"0.5710613",
"0.5676167",
"0.5612672",
"0.55004257",
"0.5491531",
"0.54851025",
"0.54830986",
"0.54601794",
"0.54513687",
"0.5383508",
"0.5375481",
"0.5362082",
"0.5309944",
"0.53028923",
"0.527191... | 0.711514 | 0 |
Page error on one iteration, no results for that page should print. | def test_repeated_pageset_one_iteration_one_page_error(self):
test_page_set = _MakePageSet()
measurement_results = SummarySavingPageMeasurementResults()
measurement_results.WillMeasurePage(test_page_set.pages[0])
measurement_results.Add('a', 'seconds', 3)
measurement_results.DidMeasurePage()
me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_repeated_pageset_one_iteration_one_page_fails(self):\n test_page_set = _MakePageSet()\n\n measurement_results = SummarySavingPageMeasurementResults()\n measurement_results.WillMeasurePage(test_page_set.pages[0])\n measurement_results.Add('a', 'seconds', 3)\n measurement_results.DidMeasurePa... | [
"0.63939047",
"0.62474793",
"0.62365466",
"0.6147043",
"0.61051977",
"0.6099422",
"0.6091826",
"0.60235256",
"0.59854174",
"0.5981817",
"0.58998466",
"0.5878424",
"0.58761185",
"0.58725035",
"0.5859526",
"0.58584183",
"0.5845222",
"0.58384657",
"0.5829947",
"0.57729685",
"0.5... | 0.6588589 | 0 |
Finds golden files and returns Test cases for each. | def FindTests():
for root, _, files in os.walk(GOLDEN_CASES_DIR):
path_parts = root.split('/')
if path_parts[-3] == 'golden':
language = path_parts[-2]
variant = path_parts[-1]
for golden_file in files:
input, _ = golden_file.split('.')
options = None
if input.endswit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_case_4():\n print(\"*********Test_case_4***********\")\n path = os.path.join(os.path.dirname(__file__), 'testdir')\n result = find_files('', path)\n for file in result:\n print(file)",
"def match_files(gold_folder, sys_folder):\n\n print \"Compiling files...\"\n # Get a list of ... | [
"0.65793926",
"0.64893675",
"0.64621574",
"0.64006156",
"0.6366292",
"0.63431907",
"0.63229936",
"0.63121384",
"0.6176363",
"0.617604",
"0.6151453",
"0.6115767",
"0.609317",
"0.60732734",
"0.6029849",
"0.6013128",
"0.5976453",
"0.5971647",
"0.5935336",
"0.59210765",
"0.589561... | 0.8243808 | 0 |
Element indexing to a cat column must give the underlying object not the numerical index. | def test_categorical_element_indexing():
cat = pd.Categorical(["a", "a", "b", "c", "a"], categories=["a", "b", "c"])
pdsr = pd.Series(cat)
sr = cudf.Series(cat)
assert_eq(pdsr, sr)
assert_eq(pdsr.cat.codes, sr.cat.codes, check_dtype=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cat_to_idx(self, category):\n if not category in self.cat2x:\n return torch.LongTensor([self.categories])\n else:\n return torch.LongTensor([self.cat2x[category]])",
"def __getitem__(self, *args, **kwargs):\n raise TypeError('ColumnProxy object {0!r} cannot be inde... | [
"0.6748589",
"0.58743685",
"0.56824946",
"0.5635902",
"0.5635735",
"0.556013",
"0.55250746",
"0.5503947",
"0.545419",
"0.5422058",
"0.5415116",
"0.5410023",
"0.5395065",
"0.5395065",
"0.53761595",
"0.53630656",
"0.53630656",
"0.5346034",
"0.53438663",
"0.5338679",
"0.5329827"... | 0.681991 | 0 |
Return the config for the given class | def find(self, cls):
for currentClass in self._classesToCheck(cls):
if currentClass in self.config:
return self.config[currentClass]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(cls) -> \"__Config\":\n if cls.__instance is None:\n cls.__instance = cls.__Config()\n return cls.__instance",
"def get_config(cls):\n if not cls.config:\n import aha\n cls.config = aha.Config()\n return cls.config",
"def get_config() ... | [
"0.701777",
"0.6749747",
"0.6556386",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0.6486368",
"0... | 0.7693431 | 0 |
Generator to return the classes to check | def _classesToCheck(self, cls):
yield cls
yield from inspect.getmro(cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_classes(self):\n\n\t\t \n\t\t \n\t\treturn self.classes",
"def _classes_(cls):\n for base_cls in cls.__bases__:\n # Avoid infinite loop\n if base_cls == Sandbox:\n continue\n\n yield base_cls",
"def classes(self):\n return list(self._... | [
"0.7157586",
"0.709198",
"0.68926764",
"0.6888688",
"0.6881639",
"0.684387",
"0.6781942",
"0.67179024",
"0.67107236",
"0.6675634",
"0.66542095",
"0.6602557",
"0.6583878",
"0.65767574",
"0.65569717",
"0.6484939",
"0.6484313",
"0.64667964",
"0.645659",
"0.64409065",
"0.6328888"... | 0.8311737 | 0 |
Return a new Converter for the given value | def newConverter(self, value):
return JsonConverter(value, self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert(self, value):\r\n return Converter.convert(self, value)",
"def convert(self, value):\n return value",
"def convert(self, value):\r\n return value",
"def do_conversion(self, value):\n converter, found = self.find_converter()\n if not found:\n return va... | [
"0.8381657",
"0.6770604",
"0.6709356",
"0.658467",
"0.6505078",
"0.64513594",
"0.6341737",
"0.6293036",
"0.6208647",
"0.61260635",
"0.60289",
"0.59860456",
"0.5968452",
"0.59336025",
"0.59202874",
"0.58909506",
"0.5852398",
"0.58523387",
"0.580042",
"0.57849145",
"0.56562614"... | 0.71443933 | 1 |
Test the paste_app_factory method | def test_paste_app_factory(conf_options: dict) -> None:
pypiserver.paste_app_factory({}, **conf_options) # type: ignore | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paste(*_, **settings):\n\n hook_exceptions()\n return app",
"def test_create(self):\n self.app\n pass",
"def test_app_is_created(app):\n assert app.name == \"myapp.app\"",
"def test_args_paste():\n args = cli.parse_args(['-p'])\n assert args.paste\n args = cli.parse_args([... | [
"0.75429773",
"0.64659303",
"0.63208234",
"0.6096845",
"0.60132974",
"0.59782386",
"0.59624046",
"0.5924574",
"0.5872827",
"0.5869057",
"0.5792947",
"0.5787532",
"0.57584083",
"0.57016015",
"0.5698065",
"0.56482124",
"0.5626123",
"0.561111",
"0.56102985",
"0.5605485",
"0.5587... | 0.86091185 | 0 |
Test converting legacy kwargs to modern ones. | def test_backwards_compat_kwargs_conversion(
incoming: t.Dict[str, t.Any], updated: t.Dict[str, t.Any]
) -> None:
assert pypiserver.backwards_compat_kwargs(incoming) == updated | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_backwards_compat_kwargs_duplicate_check(\n kwargs: t.Dict[str, t.Any]\n) -> None:\n with pytest.raises(ValueError) as err:\n pypiserver.backwards_compat_kwargs(kwargs)\n assert \"('redirect_to_fallback', 'disable_fallback')\" in str(err.value)",
"def test_kwargs(self):\n def f(**k... | [
"0.6780095",
"0.6209033",
"0.62044317",
"0.58742636",
"0.5702732",
"0.56252295",
"0.5585343",
"0.5493738",
"0.5490867",
"0.5481675",
"0.54620266",
"0.54593474",
"0.54495806",
"0.54409826",
"0.54409826",
"0.5440154",
"0.5372943",
"0.53631043",
"0.53510404",
"0.5344417",
"0.533... | 0.7822542 | 0 |
Duplicate legacy and modern kwargs cause an error. | def test_backwards_compat_kwargs_duplicate_check(
kwargs: t.Dict[str, t.Any]
) -> None:
with pytest.raises(ValueError) as err:
pypiserver.backwards_compat_kwargs(kwargs)
assert "('redirect_to_fallback', 'disable_fallback')" in str(err.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_backwards_compat_kwargs_conversion(\n incoming: t.Dict[str, t.Any], updated: t.Dict[str, t.Any]\n) -> None:\n assert pypiserver.backwards_compat_kwargs(incoming) == updated",
"def _validate_kwargs(self, kwargs):\n pass",
"def _clean_kwargs(keep_name=False, **kwargs):\n if \"name\" in kwarg... | [
"0.71261305",
"0.69028276",
"0.685023",
"0.685023",
"0.67343134",
"0.672661",
"0.6497117",
"0.6353625",
"0.63036036",
"0.6257885",
"0.6235753",
"0.62345606",
"0.6179054",
"0.6158781",
"0.6150902",
"0.61483604",
"0.6142967",
"0.6137005",
"0.61115927",
"0.6098669",
"0.60952514"... | 0.7760046 | 0 |
Sets hyperparam from eta. eta is always given as natural scale (i.e., not as in log scale). If self.use_log_eta is True, hyperparam is set as log10 of eta, otherwise, just as eta. | def _eta_to_hyperparam(self, eta):
# If logscale is used, output hyperparam is log of eta.
if self.use_log_eta:
hyperparam = numpy.log10(numpy.abs(eta))
else:
hyperparam = numpy.abs(eta)
return hyperparam | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_eta(self, eta, recalc=True):\n self.eta = eta\n if recalc:\n self.setup()",
"def _hyperparam_to_eta(self, hyperparam):\n\n # Using only the first component (if an array is given)\n if numpy.isscalar(hyperparam):\n hyperparam_ = hyperparam\n else:\n... | [
"0.72072184",
"0.6813025",
"0.57682955",
"0.55616474",
"0.5560605",
"0.5515153",
"0.5403729",
"0.5357541",
"0.5231969",
"0.51832867",
"0.51660645",
"0.51635844",
"0.5162369",
"0.5126844",
"0.511959",
"0.5063914",
"0.50580955",
"0.5032944",
"0.50258696",
"0.4991061",
"0.496942... | 0.7799939 | 0 |
Sets hyperparam from scale. scale is always given with no logscale If self.use_log_scale is True, hyperparam is set as log10 of scale, otherwise, just as scale. | def _scale_to_hyperparam(self, scale):
# If logscale is used, output hyperparam is log of scale.
if self.use_log_scale:
hyperparam = numpy.log10(numpy.abs(scale))
else:
hyperparam = numpy.abs(scale)
return hyperparam | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hyperparam_to_scale(self, hyperparam):\n\n # If logscale is used, input hyperparam is log of the scale.\n if self.use_log_scale:\n scale = 10.0**hyperparam\n else:\n scale = numpy.abs(hyperparam)\n\n return scale",
"def with_scale_op(self, scale):\n\t\tself.... | [
"0.7289561",
"0.7201419",
"0.7191887",
"0.71832746",
"0.7069923",
"0.7069923",
"0.699523",
"0.68600637",
"0.66926146",
"0.6317553",
"0.6300621",
"0.6281228",
"0.6176776",
"0.6152803",
"0.6124598",
"0.61061937",
"0.6054151",
"0.6054151",
"0.60514426",
"0.6048682",
"0.60273486"... | 0.7945751 | 0 |
Sets scale from hyperparam. If self.use_log_eta is True, hyperparam is the log10 of scale, hence, 10hyperparam is set to scale. If self.use_log_eta is False, hyperparam is directly set to scale. | def _hyperparam_to_scale(self, hyperparam):
# If logscale is used, input hyperparam is log of the scale.
if self.use_log_scale:
scale = 10.0**hyperparam
else:
scale = numpy.abs(hyperparam)
return scale | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_scale(self, scale):\n scale = float(scale)\n if scale <= 1:\n raise ValueError('The scale parameter must exceed 1.')\n self._a = scale",
"def with_scale_op(self, scale):\n\t\tself.variables['scale'] = scale\n\t\treturn self",
"def scale(self, scale):\n\n self._sca... | [
"0.7160335",
"0.70182",
"0.7008263",
"0.7008263",
"0.6956479",
"0.686961",
"0.67326957",
"0.6482247",
"0.6439006",
"0.6423413",
"0.63850397",
"0.628717",
"0.6281172",
"0.62260556",
"0.62219095",
"0.60703826",
"0.6028934",
"0.6014516",
"0.59568024",
"0.59473497",
"0.5937969",
... | 0.7183986 | 0 |
Converts the input hyperparameters to their log10, if this is enabled by ``self.use_log_eta`` and ``self.use_scale``. If is assumed that the input hyperparam is not in log scale, and it | def hyperparam_to_log_hyperparam(self, hyperparam):
if numpy.isscalar(hyperparam):
hyperparam_ = numpy.array([hyperparam], dtype=float)
elif isinstance(hyperparam, list):
hyperparam_ = numpy.array(hyperparam, dtype=float)
else:
# Copy to avoid overwriting inp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _scale_to_hyperparam(self, scale):\n\n # If logscale is used, output hyperparam is log of scale.\n if self.use_log_scale:\n hyperparam = numpy.log10(numpy.abs(scale))\n else:\n hyperparam = numpy.abs(scale)\n\n return hyperparam",
"def log10_to_linear(self):\... | [
"0.6494631",
"0.6203526",
"0.6119233",
"0.6057978",
"0.60358506",
"0.5988041",
"0.59488064",
"0.593895",
"0.5878854",
"0.5878085",
"0.57430357",
"0.56935257",
"0.5687105",
"0.56567544",
"0.56355536",
"0.5627555",
"0.5538405",
"0.55289024",
"0.5511932",
"0.54038805",
"0.537455... | 0.751598 | 0 |
Computes Y, C, Cinv, and Mz. These variables are shared among many of the functions, hence their values are stored as the class attribute to avoid recomputation when the hyperparam is the same. | def _update_Y_C_Mz(self, hyperparam):
if numpy.isscalar(hyperparam):
hyperparam_ = numpy.array([hyperparam], dtype=float)
else:
hyperparam_ = hyperparam
# Check if likelihood is already computed for an identical hyperparam
if (self.Y is None) or \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fv(self):\n return self.beta * (self.x ** self.c)",
"def __call__(self): \n m = np.zeros((len(self.observation),))\n k = np.zeros((len(self.observation), len(self.prior)))\n \n sv = self.stateVector\n m = sv[0] * np.exp(-(self.independentVariable/sv[1])) + sv[2]\... | [
"0.59086186",
"0.58693445",
"0.5725177",
"0.5724267",
"0.5717048",
"0.56606054",
"0.56538683",
"0.5635367",
"0.56154704",
"0.5575419",
"0.5557026",
"0.55501467",
"0.55418694",
"0.5519615",
"0.5491406",
"0.5484955",
"0.5480766",
"0.5474882",
"0.54440594",
"0.5426298",
"0.54156... | 0.6593799 | 0 |
Based on a given eta, finds optimal sigma and sigma0. | def _find_optimal_sigma_sigma0(self, hyperparam):
# Get eta
eta = self._hyperparam_to_eta(hyperparam)
if numpy.abs(eta) > self.max_eta:
# eta is very large. Use Asymptotic relation
sigma02 = self._find_optimal_sigma02()
if numpy.isinf(eta):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_optimal_sigma02(self):\n\n # Note: this sigma0 is only when eta is at infinity. Hence, computing\n # it does not require eta, update of self.mixed_cor, or update of Y, C,\n # Mz. Hence, once it is computed, it can be reused even if other\n # variables like eta changed. Here, i... | [
"0.65215653",
"0.62374073",
"0.617904",
"0.6090801",
"0.5879847",
"0.5878558",
"0.5856363",
"0.5769966",
"0.575374",
"0.56794155",
"0.5636983",
"0.5634799",
"0.5628103",
"0.5624852",
"0.5605197",
"0.5604418",
"0.55644435",
"0.5560786",
"0.5504456",
"0.5502449",
"0.5466018",
... | 0.66214657 | 0 |
Finds optimal sigma2 either if eta is large or not. As a product, this function also computes Y, C, and Mz and stores them into the class attribute. | def _find_optimal_sigma2(self, hyperparam):
# Get eta
eta = self._hyperparam_to_eta(hyperparam)
if numpy.isinf(eta):
self.sigma2 = 0.0
elif numpy.abs(eta) > self.max_eta:
# eta is very large. Use Asymptotic relation
sigma02 = self._find_optimal_sig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_optimal_sigma02(self):\n\n # Note: this sigma0 is only when eta is at infinity. Hence, computing\n # it does not require eta, update of self.mixed_cor, or update of Y, C,\n # Mz. Hence, once it is computed, it can be reused even if other\n # variables like eta changed. Here, i... | [
"0.7176988",
"0.59672517",
"0.5650372",
"0.55412585",
"0.5514771",
"0.5469607",
"0.54237366",
"0.52667284",
"0.5251802",
"0.5221388",
"0.5180984",
"0.5173459",
"0.51367885",
"0.51309645",
"0.5127917",
"0.5123459",
"0.511272",
"0.5111477",
"0.5084016",
"0.5080336",
"0.5066447"... | 0.6776169 | 1 |
When eta is very large, we assume sigma is zero. Thus, sigma0 is computed by this function. This is the Ordinary Least Square (OLS) solution of the regression problem where we assume there is no correlation between points, hence sigma is assumed to be zero. This function does not require update of self.mixed_cor with h... | def _find_optimal_sigma02(self):
# Note: this sigma0 is only when eta is at infinity. Hence, computing
# it does not require eta, update of self.mixed_cor, or update of Y, C,
# Mz. Hence, once it is computed, it can be reused even if other
# variables like eta changed. Here, it suffice ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_sigma0(\n T,\n S,\n **kwargs,\n):\n return compute_rho(T, S, 0, **kwargs) - 1000",
"def _find_optimal_sigma_sigma0(self, hyperparam):\n\n # Get eta\n eta = self._hyperparam_to_eta(hyperparam)\n\n if numpy.abs(eta) > self.max_eta:\n\n # eta is very large. Us... | [
"0.5766266",
"0.54744494",
"0.54260993",
"0.5349098",
"0.5347502",
"0.5321468",
"0.53052974",
"0.5288759",
"0.52732444",
"0.52384627",
"0.5224316",
"0.5215391",
"0.52068543",
"0.51839966",
"0.518033",
"0.5179178",
"0.5159284",
"0.51567394",
"0.51350135",
"0.51132566",
"0.5104... | 0.61868757 | 0 |
Log likelihood function L = (1/2) log det(S) (1/2) log det(X.TSinvX) (1/2) sigma^(2) z.T M1 z where S = sigma^2 Kn is the covariance Sinv is the inverse of S M1 = Sinv = SinvX(X.TSinvX)^(1)X.TSinv hyperparam = [eta, scale[0], scale[1], ...] sign_switch changes the sign of the output from ell to ell. When True, this is ... | def likelihood(self, sign_switch, hyperparam):
self.timer.tic()
if numpy.isscalar(hyperparam):
hyperparam_ = numpy.array([hyperparam], dtype=float)
else:
hyperparam_ = hyperparam
# Check if likelihood is already computed for an identical hyperparam
if (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neg_log_lik_m0_s2(z, obj):\n theta = np.exp(z)\n obj.lamb = 0.0\n obj.alpha = 1.0\n obj.sp_graph.m = theta[0] * np.ones(len(obj.sp_graph))\n obj.sp_graph.comp_graph_laplacian(obj.sp_graph.m)\n obj.sp_graph.comp_precision(s2=theta[1])\n obj.inv()\n nll = obj.neg_log_lik()\n return nll... | [
"0.639472",
"0.63689023",
"0.6278078",
"0.6268089",
"0.62324935",
"0.6212104",
"0.6173381",
"0.61649543",
"0.6137505",
"0.6112011",
"0.6090468",
"0.6059623",
"0.6040386",
"0.60403025",
"0.60365576",
"0.6034824",
"0.60192484",
"0.59930056",
"0.5970323",
"0.59362626",
"0.593269... | 0.68401754 | 0 |
ell is the log likelihood probability. dell_deta is d(ell)/d(eta), which is the derivative of ell with respect to eta when the optimal value of sigma is substituted in the likelihood function per given eta. | def _likelihood_der1_eta(self, hyperparam):
# Get eta
eta = self._hyperparam_to_eta(hyperparam)
# Include derivative w.r.t scale
if (not numpy.isscalar(hyperparam)) and \
(hyperparam.size > self.scale_index):
# Set scale of the covariance object
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _core_calc_degrad(self,bd,Ld) :\n\t\tdegrad = np.dot(Ld,bd) # Do matrix multiplication \n\t\tdegrad = np.exp(degrad) # Exponentiate to convert log to real\n\t\treturn degrad",
"def d_beta_d_EDOT(self):\n eTheta = self.eTheta()\n a1 = (self.a1()).decompose()\n sinOmg = np.sin(self.omega()... | [
"0.6194956",
"0.5892976",
"0.58652955",
"0.5839284",
"0.5833242",
"0.56382203",
"0.5621809",
"0.56214774",
"0.55912405",
"0.55669016",
"0.55669016",
"0.5566127",
"0.55534786",
"0.55189806",
"0.5486393",
"0.5479628",
"0.5476858",
"0.5461322",
"0.545591",
"0.54455996",
"0.54387... | 0.6015106 | 1 |
The second derivative of ell is computed as a function of only eta. Here, we substituted optimal value of sigma, which is self is a function of eta. | def _likelihood_der2_eta(self, hyperparam):
# Get eta
eta = self._hyperparam_to_eta(hyperparam)
# Include derivative w.r.t scale
if (not numpy.isscalar(hyperparam)) and \
(hyperparam.size > self.scale_index):
# Set scale of the covariance object
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _likelihood_der1_eta(self, hyperparam):\n\n # Get eta\n eta = self._hyperparam_to_eta(hyperparam)\n\n # Include derivative w.r.t scale\n if (not numpy.isscalar(hyperparam)) and \\\n (hyperparam.size > self.scale_index):\n\n # Set scale of the covariance obj... | [
"0.60565823",
"0.6055946",
"0.5918542",
"0.5883431",
"0.5852493",
"0.5850711",
"0.57616276",
"0.5710149",
"0.55860746",
"0.55797863",
"0.55753237",
"0.5569406",
"0.5566426",
"0.5511863",
"0.5490713",
"0.548191",
"0.54660964",
"0.5443324",
"0.54321235",
"0.54290915",
"0.542676... | 0.6394015 | 0 |
ell is the log likelihood probability. der2_scale is d2(ell)/d(theta2), is the second derivative of ell with respect to the distance scale (theta). The output is a 2D array of the size of scale. | def _likelihood_der2_scale(self, hyperparam):
# Get eta
eta = self._hyperparam_to_eta(hyperparam)
# Set scale of the covariance object
scale = self._hyperparam_to_scale(hyperparam[self.scale_index:])
self.mixed_cor.set_scale(scale)
# Initialize Hessian
d2ell_ds... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __dNdlog2dN(self,Dp,dNdlogDp):\n \n x = np.log10(Dp)\n y = (x[1:]+x[:-1])/2.\n y = np.pad(y,1,'constant',constant_values=(x[0]-(y[0]-x[0]),x[-1]+(x[-1]-y[-1])))\n dlogDp = np.diff(y)\n return dNdlogDp*dlogDp # cm-3",
"def l2_error(dist_orig, dist_proj):\n return... | [
"0.55520815",
"0.54072475",
"0.54047674",
"0.5384151",
"0.5367165",
"0.53637755",
"0.52973455",
"0.5292729",
"0.5260438",
"0.52383775",
"0.5231421",
"0.52137166",
"0.5206704",
"0.51778436",
"0.516807",
"0.5146946",
"0.5146946",
"0.5135246",
"0.5123771",
"0.5119823",
"0.511800... | 0.5481771 | 1 |
This method send bypass captcha requests to server. | def bypass_captcha(self, rps):
viewstate_pattern = r"id=\"__VIEWSTATE\".*\"(.*)\""
viewstategenerator_pattern = r"id=\"__VIEWSTATEGENERATOR\".*\"(.*)\""
CAPTCHA_PATTERN = r"id=\"ctl00_ContentPlaceHolder1_ctl00_lblCapcha\".*?>(.*?)<\/span>"
viewstate = re.search(viewstate_pattern, rps)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def captcha(self):\n notification.send_sms(message=message)\n notification.send_emails(emails=email, message=message)\n sleep(25)\n\n ### this code snippet is for reference only, not to be used ###\n # sleep(3)\n # captcha = self.driver.find_element_by_xpath('/html/body/di... | [
"0.62544423",
"0.6103214",
"0.6067324",
"0.59717184",
"0.5513239",
"0.54646844",
"0.54646844",
"0.54646844",
"0.54264605",
"0.539916",
"0.52904004",
"0.5271962",
"0.52673227",
"0.52487135",
"0.5246963",
"0.52196044",
"0.5145724",
"0.5138002",
"0.5120748",
"0.5091527",
"0.5090... | 0.68714964 | 0 |
Configure MFA for a supported method. This endpoint allows you to turn on multifactor authentication with a given backend. Currently only Duo is supported. | def configure(self, mount_point, mfa_type="duo", force=False):
if mfa_type != "duo" and not force:
# The situation described via this exception is not likely to change in the future.
# However we provided that flexibility here just in case.
error_msg = 'Unsupported mfa_type a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_authenticator(self):\n pass",
"def create(self, validated_data):\n return MFAMethod.objects.get_or_create(\n user=self.user,\n name=self.context['name'],\n defaults={\n 'secret': create_secret(),\n 'is_active': False,\n ... | [
"0.57172984",
"0.5230584",
"0.5130717",
"0.5084936",
"0.50102353",
"0.49796712",
"0.49703634",
"0.49597913",
"0.49300924",
"0.49291438",
"0.48739278",
"0.4803513",
"0.4799917",
"0.47987106",
"0.47448215",
"0.47258478",
"0.46918166",
"0.46821758",
"0.4669423",
"0.4643165",
"0.... | 0.53463924 | 1 |
Read the MFA configuration. | def read_configuration(self, mount_point):
api_path = utils.format_url(
"/v1/auth/{mount_point}/mfa_config",
mount_point=mount_point,
)
return self._adapter.get(url=api_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_configuration (self):\n\t\tself.config.read(self._configfile)",
"def read_config(self, config_filename):",
"def __read_config(self):\n with open(self.config_file, 'r') as data_file:\n dict = json.load(data_file)\n self.ibooks_doc_root = dict[\"ibooks_doc_root\"]\n ... | [
"0.6781609",
"0.61869454",
"0.6186931",
"0.6110168",
"0.6043231",
"0.5997185",
"0.59913665",
"0.5987478",
"0.59253895",
"0.5901664",
"0.586555",
"0.5857615",
"0.58440846",
"0.5814617",
"0.5770413",
"0.5769286",
"0.57601607",
"0.5759924",
"0.575806",
"0.5715192",
"0.5684835",
... | 0.72445226 | 0 |
Configure the access keys and host for Duo API connections. To authenticate users with Duo, the backend needs to know what host to connect to and must authenticate with an integration key and secret key. This endpoint is used to configure that information. | def configure_duo_access(self, mount_point, host, integration_key, secret_key):
params = {
"host": host,
"ikey": integration_key,
"skey": secret_key,
}
api_path = utils.format_url(
"/v1/auth/{mount_point}/duo/access",
mount_point=mount_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect(self):\n config.base_url = self.get_config('host')\n config.client_connection_attempts = 1\n config.assume_untrusted = False\n if self.get_config('insecure'):\n config.assume_untrusted = True\n\n config.credentials = utils.PseudoNamespace({\n 'de... | [
"0.65555876",
"0.62280256",
"0.62280256",
"0.62280256",
"0.59869045",
"0.5971876",
"0.5971876",
"0.5971876",
"0.5893048",
"0.5856009",
"0.5752485",
"0.5730355",
"0.57224387",
"0.572047",
"0.5690831",
"0.5680026",
"0.56105566",
"0.55848527",
"0.5567586",
"0.5540301",
"0.554011... | 0.66753906 | 0 |
Read the Duo second factor behavior configuration. | def read_duo_behavior_configuration(self, mount_point):
api_path = utils.format_url(
"/v1/auth/{mount_point}/duo/config",
mount_point=mount_point,
)
return self._adapter.get(url=api_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getConfig():\n\n config = rFile(\"/var/www/html/config.txt\").split()\n f = int(config[0])\n mode = config[1]\n\n if (f in DABchannels and (mode == \"explore\" or mode == \"monitor\")):\n return f, mode\n else:\n return 227360000, \"explore\" # Kamzik - Bratislava",
"def _read... | [
"0.5765526",
"0.56082726",
"0.5532349",
"0.5521322",
"0.5478832",
"0.53924507",
"0.53509307",
"0.5320101",
"0.5315262",
"0.5277126",
"0.52766246",
"0.5254558",
"0.5254131",
"0.5205814",
"0.51902187",
"0.5177769",
"0.5168247",
"0.5155753",
"0.5141957",
"0.51250005",
"0.5118755... | 0.6313685 | 0 |
LM score between entity field and query (JM smoothing, lambda=0.1). | def lm_score(self, entity_id, field=Lucene.FIELDNAME_CONTENTS):
params = {'field': field}
score = ScorerLM(econfig.LUCENE, self.query, params).score_doc(entity_id)
if score is None:
return None
return math.exp(score) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nllr_lm_score(self, entity_id, field=Lucene.FIELDNAME_CONTENTS):\n if self.DEBUG:\n print entity_id\n weights = {field: 1}\n return self.nllr_mlm_score(entity_id, weights)",
"def nllr_mlm_score(self, entity_id, weights):\n if self.DEBUG:\n print entity_id\n ... | [
"0.708184",
"0.63598555",
"0.6187785",
"0.6119376",
"0.6004286",
"0.6003608",
"0.5998157",
"0.59792185",
"0.5948516",
"0.5866565",
"0.56778747",
"0.56386065",
"0.56243676",
"0.56018996",
"0.5581119",
"0.5576428",
"0.5565399",
"0.5552731",
"0.55442345",
"0.55178195",
"0.549327... | 0.69207376 | 1 |
NLLRLM score between entity field and query (JM smoothing, lambda=0.1). | def nllr_lm_score(self, entity_id, field=Lucene.FIELDNAME_CONTENTS):
if self.DEBUG:
print entity_id
weights = {field: 1}
return self.nllr_mlm_score(entity_id, weights) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lm_score(self, entity_id, field=Lucene.FIELDNAME_CONTENTS):\n params = {'field': field}\n score = ScorerLM(econfig.LUCENE, self.query, params).score_doc(entity_id)\n if score is None:\n return None\n return math.exp(score)",
"def get_score(self, query: list, index: int,... | [
"0.6321107",
"0.622483",
"0.61104494",
"0.5844902",
"0.57667696",
"0.57209873",
"0.5639459",
"0.5606974",
"0.5599905",
"0.55891883",
"0.5580743",
"0.5580481",
"0.54940456",
"0.54940456",
"0.5493724",
"0.5456159",
"0.5449882",
"0.5407899",
"0.5399958",
"0.5386923",
"0.5331723"... | 0.67011994 | 0 |
LM score of entity to the context of query (context means query mention) E.g. given the query "uss yorktown charleston" and mention "uss", query context is " yorktown charleston" | def context_sim(self, entity_id, mention, field=Lucene.FIELDNAME_CONTENTS):
# get query context
match = re.search(mention, self.query)
if match is None:
raise Exception("NOTE: Mention \"" + mention + "\" is not found in the query \"" + self.query + "\"")
mention_scope = match... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score(self, model, context):\n pass",
"def logscore(self, word, context=None):\n return log_base2(self.score(word, context))",
"def score(self, word, context=None):\n return self.unmasked_score(\n self.vocab.lookup(word), self.vocab.lookup(context) if context else None\n ... | [
"0.629584",
"0.6020259",
"0.6019326",
"0.59775954",
"0.59326226",
"0.58543825",
"0.585231",
"0.5738253",
"0.5686639",
"0.56525356",
"0.5639428",
"0.55629355",
"0.5555911",
"0.5548642",
"0.552669",
"0.55149966",
"0.54901755",
"0.54591113",
"0.5448006",
"0.5440294",
"0.5423294"... | 0.7449945 | 0 |
Calculates similarity between query and set. sim(q|e1, e2, ..., en) = Mul_i (Sum_j ( p(t_i|e_j) ) ) = Mul_i (Sum_j ( Sum_f (weight_f p(t_i|theta_e_j_f)))) | def query_set_sim(self, en_ids, weights):
# fielded_weights = self.__get_weights(weights)
scorer = ScorerMLM(econfig.LUCENE, self.query, {}) # {'field_weights': fielded_weights})
p_t_theta_d = {}
for t in set(self.query.split()):
p_t_theta_d[t] = 0
for en in en_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_sim(query, database):\n return np.dot(database, query.T)",
"def similarity(query,id):\n similarity = 0.0\n for term in query:\n if term in dictionary:\n similarity += inverse_document_frequency(term)*imp(term,id)\n similarity = similarity / length[id]\n return similar... | [
"0.7175541",
"0.6489239",
"0.6459145",
"0.62557817",
"0.6234562",
"0.6195891",
"0.6162976",
"0.6106626",
"0.6089762",
"0.607751",
"0.6071316",
"0.6070239",
"0.6068862",
"0.6035685",
"0.59365237",
"0.59148014",
"0.5890446",
"0.58836573",
"0.58645576",
"0.5861333",
"0.5832041",... | 0.66497064 | 1 |
This function launches a new thread that will periodically poll the total memory usage of the tool that is being run. If it goes over the limit will kill it | def _memoryLimitPolling(self, process):
assert self.memoryLimitPollTimePeriodInSeconds > 0
assert self._outOfMemory == False
# Other parts of the runner can can set on this to prevent this thread
# from waiting on this Event object.
self._eventObj = threading.Event()
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure_memory_usage(context, target_call, target_args, log_interval=30, log_filename=None, memory_usage_refresh=0.01):\n \n\n class StoppableThread(threading.Thread):\n def __init__(self, target, args):\n super(StoppableThread, self).__init__(target=target, args=args)\n self.d... | [
"0.63734585",
"0.62052387",
"0.61687994",
"0.60751086",
"0.584649",
"0.56678164",
"0.5567358",
"0.54405665",
"0.53550315",
"0.53374034",
"0.5336937",
"0.5336815",
"0.53305274",
"0.5318903",
"0.52779293",
"0.5263257",
"0.5249336",
"0.52466595",
"0.52375495",
"0.52327853",
"0.5... | 0.6854932 | 0 |
PythonPsUtilBackend runs directly on the host so all files are available so just return the requested `hostPath`. | def getFilePathInBackend(self, hostPath):
return hostPath | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _host_dir(self, path):\n return self._host._dir(path)",
"def get_host_outfiles(self):\n\n raise NotImplementedError",
"def get_host_test_path(java_name):\n return os.path.join(HOST_SOURCE_PATH, java_name + '.java')",
"def _extract_system_path(self, script):\r\n\r\n DEFAULT_PATH = ['... | [
"0.6170428",
"0.57157826",
"0.5449702",
"0.5441255",
"0.5421754",
"0.5415816",
"0.5408244",
"0.54069084",
"0.53569037",
"0.53399646",
"0.5324452",
"0.52674645",
"0.5236842",
"0.5222871",
"0.521366",
"0.521366",
"0.5206845",
"0.51636076",
"0.5159144",
"0.5156217",
"0.5147714",... | 0.6990126 | 0 |
returns insee code corresponding to dpt, city | def match_city(self, city, dpt_code, zip_code = None):
city = format_str_city_insee(city)
dpt_code = dpt_code.rjust(2, '0')
if zip_code:
zip_code.rjust(5, '0')
# Based on zip code and city name
ls_matching = []
found_indicator = False
if zip_code:
if zip_code in self.dict_corr_zi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ibge_code(city, state):\n df = pd.read_csv(IBGE_CODE_PATH)\n code = df[(df['state'] == state) & (df['city'] == city)]['cod_ibge'].values[0]\n\n return code",
"def _city_code(self, cr, uid, ids, field_name, arg, context=None):\n res = {}\n if context is None:\n context = ... | [
"0.66449314",
"0.625442",
"0.62423724",
"0.6053599",
"0.5997891",
"0.59143895",
"0.59143895",
"0.58753246",
"0.5867614",
"0.5860927",
"0.5850521",
"0.58501303",
"0.58037025",
"0.5786822",
"0.57718045",
"0.5757091",
"0.574179",
"0.56687176",
"0.5657822",
"0.5640575",
"0.563829... | 0.64625853 | 1 |
returns dict of (insee_code, insee_code_ardt) hence should be used with dict_refine_ic.get(some_ic, (None, None)) | def get_dict_refine_insee_code(ls_valid_ic):
dict_refine_ic = {x: (x, x) for x in ls_valid_ic}
ls_valid_ic_corse = [x for x in ls_valid_ic if re.match('2[AB]', x)]
for ic in ls_valid_ic_corse:
dict_refine_ic[ic[:1] + u'0' + ic[2:]] = (ic, ic) # assumed unicity was checked
dict_ic_ardts = dict(list(itertools... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pro_code_dict(code=False, inverse=False, return_all=False):\n\n pro_code_dict = {\"0500\": \"Date\",\n \"0501\": \"height [> 0: top, < 0: bottom of elem.] (cm)\",\n \"0502\": \"element density (kg m-3)\",\n \"0503\": \"element temperature (degC)\",... | [
"0.5792657",
"0.56349945",
"0.5617833",
"0.5178615",
"0.5101016",
"0.50875264",
"0.5040435",
"0.5025938",
"0.49679732",
"0.49463975",
"0.49188617",
"0.49167842",
"0.49008295",
"0.48914126",
"0.48870748",
"0.4877674",
"0.48740917",
"0.48693362",
"0.48639834",
"0.48317078",
"0.... | 0.7238658 | 0 |
Return a unique version of the name indicated by incrementing a numeral at the end. Stop when the name no longer appears in the indicated list of elements. | def GetUniqueName( name, elems ):
digits = []
for c in reversed( name ):
if c.isdigit():
digits.append( c )
else:
break
stem = name[0:len( name ) - len( digits )]
val = ''.join( digits )[::-1] or 0
i = int( val )
while True:
i += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_name(name, nlist, max=1000):\n out = name\n if name in nlist:\n for i in range(1, max+1):\n out = \"%s_%i\" % (name, i)\n if out not in nlist:\n break\n return out",
"def create_id(elements: Iterable) -> str:\r\n i = 1\r\n while str(i) in ele... | [
"0.7059048",
"0.6539179",
"0.6503504",
"0.64329684",
"0.6357792",
"0.63444585",
"0.6311142",
"0.62842697",
"0.62330544",
"0.6209509",
"0.61816657",
"0.60640204",
"0.6054472",
"0.59599507",
"0.59309864",
"0.5866971",
"0.58655614",
"0.5832725",
"0.5830949",
"0.5816138",
"0.5800... | 0.7630242 | 0 |
Parse linux kernel command line | def _parse_kernel_cmdline():
with open('/proc/cmdline', 'rt') as f:
cmdline = f.read()
parameters = {}
for p in cmdline.split():
name, _, value = p.partition('=')
parameters[name] = value
return parameters | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_kernel_cmdline():\n with open('/proc/cmdline', 'rt') as f:\n cmdline = f.read()\n return {k: v for k, v in [opt.split('=', 1) for opt in cmdline.split()]}",
"def parse_line(self, line):\n command, _, arg = line.strip().partition(\" \")\n return command, arg.strip()",
"def ... | [
"0.73274046",
"0.7037992",
"0.6562589",
"0.65337706",
"0.6472747",
"0.6455539",
"0.64284176",
"0.64134884",
"0.63817954",
"0.63675463",
"0.63600963",
"0.63580567",
"0.63080716",
"0.6272218",
"0.625232",
"0.625139",
"0.6198785",
"0.61655796",
"0.6148147",
"0.6138631",
"0.61234... | 0.7100071 | 1 |
Get IP address of interface by mac. | def _get_interface_ip(mac_addr):
interfaces = netifaces.interfaces()
for iface in interfaces:
addresses = netifaces.ifaddresses(iface)
link_addresses = addresses.get(netifaces.AF_LINK, [])
for link_addr in link_addresses:
if link_addr.get('addr') == mac_addr:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ip_address(interface):\n try:\n import netifaces\n detail = netifaces.ifaddresses(interface)\n if netifaces.AF_INET in detail:\n ip = detail[netifaces.AF_INET][0]['addr']\n else:\n ip = 'unavailable'\n if netifaces.AF_LINK in detail:\n ... | [
"0.8026894",
"0.76742333",
"0.7580477",
"0.7389743",
"0.73871446",
"0.7237862",
"0.7237862",
"0.72314113",
"0.72044134",
"0.7070667",
"0.7066264",
"0.7041465",
"0.70133704",
"0.70125526",
"0.69932485",
"0.69927114",
"0.6951872",
"0.69368696",
"0.6909909",
"0.6887243",
"0.6845... | 0.85497403 | 1 |
Creates the replay buffer used by the agent. | def _build_replay_buffer(self, use_staging):
return circular_replay_buffer.WrappedReplayBuffer(
observation_shape=self.observation_shape,
stack_size=self.stack_size,
use_staging=use_staging,
update_horizon=self.update_horizon,
observation_dtype=self.observation_dtype.as_numpy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_replay_buffer(agent, batch_size, steps_per_loop):\n buf = tf_uniform_replay_buffer.TFUniformReplayBuffer(\n data_spec=agent.policy.trajectory_spec,\n batch_size=batch_size,\n max_length=steps_per_loop)\n return buf",
"def _build_replay_buffer(self):\n if self._replay_scheme not in [... | [
"0.79755753",
"0.7711548",
"0.77069366",
"0.7016459",
"0.68654853",
"0.6467603",
"0.63176847",
"0.6298358",
"0.628107",
"0.6151623",
"0.6001608",
"0.5929396",
"0.590335",
"0.590335",
"0.58773506",
"0.58617955",
"0.5817816",
"0.57644856",
"0.5761791",
"0.5725533",
"0.56881297"... | 0.7753396 | 1 |
Build an op used as a target for the Qvalue. | def _build_target_q_op(self):
targets = []
for gamma, target_q in zip(self.gammas,
self._replay_next_target_net_outputs.q_values):
# Get the maximum Q-value across the actions dimension.
replay_next_qt_max = tf.reduce_max(target_q, 1)
# Calculate the Bellman tar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_operand(uri):\n pass",
"def _build_target_quantile_values_op(self):\n batch_size = tf.shape(self._replay.rewards)[0]\n ###### Munchausen-specific\n replay_action_one_hot = tf.one_hot(\n self._replay.actions, self.num_actions, 1., 0., name='action_one_hot')\n # tau * ln pi_k+1 (... | [
"0.5995338",
"0.57918787",
"0.57603526",
"0.56549174",
"0.55991924",
"0.55703175",
"0.55093545",
"0.5493088",
"0.5455012",
"0.5433516",
"0.542818",
"0.53791517",
"0.53440946",
"0.5338595",
"0.5321848",
"0.52954006",
"0.5256739",
"0.52311665",
"0.5186261",
"0.5183431",
"0.5163... | 0.5934941 | 1 |
Got tweet text and make links to and keywords >>> _make_links(' looks good') | def _make_links(tweet):
for pattern, repl in (USER_SUB, KEYWORD_SUB):
tweet = re.sub(pattern, repl, tweet)
return tweet | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_links(text):\n return []",
"def links(self, text):\n\n # For some reason, the part of the regex below that matches the url\n # does not match a trailing parenthesis. It gets caught by tail, and\n # we check later to see if it should be included as part of the url.\n pa... | [
"0.7043584",
"0.6851034",
"0.6808395",
"0.6633235",
"0.6553719",
"0.6350119",
"0.63444644",
"0.6249969",
"0.6089006",
"0.60624635",
"0.6031451",
"0.6028871",
"0.6027234",
"0.6013814",
"0.60099053",
"0.5993672",
"0.5987236",
"0.59827447",
"0.5959164",
"0.5945195",
"0.59446293"... | 0.7756548 | 0 |
Return tweet number by it's url | def _get_tweet_number(tweet_url):
path = urlparse.urlparse(tweet_url)[2]
number = path.split('/')[-1]
return '#%s' % (number,) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tweet_url(username, id):\n return 'http://twitter.com/%s/status/%d' % (username, id)",
"def twitter_shares_for_url(url):\n score = 0\n response = requests.get(TWITTER_URL % url)\n response_dict = json.loads(response.text)\n try: \n score = int(response_dict['count'])\n except KeyErro... | [
"0.67411107",
"0.668006",
"0.6449784",
"0.6367362",
"0.6169248",
"0.6121158",
"0.6019715",
"0.60047036",
"0.59109133",
"0.5901117",
"0.58846456",
"0.58774775",
"0.5872609",
"0.58725935",
"0.58359605",
"0.5820438",
"0.5812713",
"0.5789946",
"0.57826376",
"0.5769278",
"0.576210... | 0.8521526 | 0 |
Adapt Twitter update from feed to appropriate form | def adapt_tweet(feedpost):
tweet = feedpost['title']
for action in (_make_links, _clean_name, urlize):
tweet = action(tweet)
feedpost['title'] = _get_tweet_number(feedpost['link'])
feedpost['body'] = u'<p>%s</p>' % tweet
return feedpost | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _updateFeed(pk):\n feed = get_object_or_404(Feed, pk=pk)\n\n rawFeed, entries = feed._fetch_feed() \n\n feed.title = rawFeed.get('title', None)\n feed.subtitle = rawFeed.get('subtitle', None)\n feed.copyright = rawFeed.get('rights', None)\n feed.ttl = rawFeed.get('ttl'... | [
"0.62205714",
"0.60478735",
"0.6047306",
"0.6046086",
"0.5973159",
"0.5969453",
"0.5937184",
"0.5915754",
"0.59061176",
"0.59007436",
"0.5856137",
"0.5848711",
"0.5842313",
"0.5816839",
"0.57708246",
"0.5753551",
"0.57099795",
"0.57034284",
"0.5676764",
"0.564971",
"0.5605945... | 0.66675574 | 0 |
Apply a series of functions to images, in order | def noise_pipeline(images, funcs, DIFFICULTY):
if DIFFICULTY == 0:
return images
else:
for func in funcs:
images = func(images, DIFFICULTY)
return images | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_images(pool, func, images, entries):\n start = time.perf_counter()\n images = pool.map(func, images)\n logger.info(\"Erased white background from %i images:\", len(images))\n util.pprint_log([x.name for x in entries], logger.info)\n logger.info(util.elapsed(start))\n logger.info(\"\\n... | [
"0.6335667",
"0.6332353",
"0.6208054",
"0.6176098",
"0.61512184",
"0.6097178",
"0.60163295",
"0.5955838",
"0.592969",
"0.5877869",
"0.5870783",
"0.5867737",
"0.5864984",
"0.584824",
"0.58426917",
"0.58315134",
"0.5793101",
"0.5792224",
"0.578668",
"0.5781769",
"0.57268596",
... | 0.6561603 | 0 |
Create new header in BigWig, with UCSC chromosome names. | def create_new_header(infile, mappings, outfile):
with pyBigWig.open(infile) as bw:
if set(bw.chroms().keys()).issubset(mappings.values()):
# If chromosome names are already UCSC, just rename input file to output name.
# Exit with status 0 since this is normal behavior.
o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_bcd_header():\n outstr = \"change_score,change_significant\"\n return outstr",
"def make_header(args):\n header = os.path.join(args.output_dir,'header.sam')\n args.header = header\n header_handle = open(header,'w')\n header_handle.write('@HD\\tVN:1.4\\n')\n joined_sam = open(os.... | [
"0.69009733",
"0.67127013",
"0.65658563",
"0.6510133",
"0.6454724",
"0.63578403",
"0.6334576",
"0.62840295",
"0.62764555",
"0.62375987",
"0.62220395",
"0.60990757",
"0.60630655",
"0.5961345",
"0.5900107",
"0.58924407",
"0.5892133",
"0.588358",
"0.5857314",
"0.58443433",
"0.58... | 0.7737841 | 0 |
Test add book and author for this book | def test_basic_book(self):
ernest_author = Author.objects.create(FIO="Ernest Miller Hemingway", birthday = "1899-07-21")
create_book = Book.objects.create(title="The Old Man And The Sea", yearbook="2012-07-07", short_describe="The Old Man and the Sea is the story of an epic battle between an old, experi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_book(self):\n\n first_book_list = BookList()\n first_book = Book()\n\n first_book.create_book({\n \"title\": \"First Man\",\n \"author\": \"James R. Hansen\",\n \"year\": 2005,\n \"publisher_name\": \"Simon & Schuster\",\n \"publication_date\": \"01/01/2018\",\n ... | [
"0.8033954",
"0.73864216",
"0.72206485",
"0.7168948",
"0.71325123",
"0.7100341",
"0.7059323",
"0.69993746",
"0.6932381",
"0.69312495",
"0.69264877",
"0.6893691",
"0.6842516",
"0.6811556",
"0.67937917",
"0.673111",
"0.6695913",
"0.66555095",
"0.6640223",
"0.6628424",
"0.662358... | 0.7952658 | 1 |
Doing image geometric transform Proposed image to have the following configurations [H x W x C + CL] Where CL is the number of channels for the label. It is NOT in onehot form | def transform_with_label(aug):
geometric_tfx = get_geometric_transformer(aug)
intensity_tfx = get_intensity_transformer(aug)
def transform(comp, c_label, c_img, use_onehot, nclass, **kwargs):
"""
Args
comp: a numpy array with shape [H x W x C + c_label]
c_labe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(gt_image):\n\n # One hot encoding of each pixel according to the CVPR2018 classes\n label_ohe = list(map(lambda x: tf.to_float(tf.equal(gt_image // 1000, x)), cvpr2018_labels()))\n # Stack everything together\n return tf.stack(label_ohe, axis=-1)",
"def preprocess(x, y):\n x = t... | [
"0.6074364",
"0.59880865",
"0.5935255",
"0.5914312",
"0.5884035",
"0.58383584",
"0.58045274",
"0.57652116",
"0.5764966",
"0.5761152",
"0.5758166",
"0.5748635",
"0.57463133",
"0.5708836",
"0.5703026",
"0.5618863",
"0.5613768",
"0.5601108",
"0.55916953",
"0.5589554",
"0.5588472... | 0.64057213 | 0 |
Sample "length" letters from the "letters" set at random. Sampling with replacement since Python doesn't have a helper for it. | def SampleLetters(letters, length):
chosen_letters = [None]*length
for i in xrange(length):
index = random.randint(0, len(letters)-1)
chosen_letters[i] = letters[index]
return ''.join(chosen_letters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_letter(letters):\n return random.choice(letters)",
"def genrate_letters():\n lt = []\n letter = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n for l in letter:\n lt.append(l)\n text_signature = ''.join([random.choice(lt) for x in range(26)])\n return text_signature... | [
"0.711622",
"0.70421904",
"0.6915822",
"0.686984",
"0.68674105",
"0.6841954",
"0.6827628",
"0.6730802",
"0.6676226",
"0.6670744",
"0.6661909",
"0.665187",
"0.66370744",
"0.6534375",
"0.6531977",
"0.65249056",
"0.6519144",
"0.6512519",
"0.6488118",
"0.6458661",
"0.6452403",
... | 0.86969054 | 0 |
Initialize a randomized sequence of the given length. | def __init__(self, length, alphabet=IUPAC.unambiguous_dna):
seq_str = self.SampleLetters(alphabet.letters, length)
Seq.__init__(self, seq_str.upper(), alphabet) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_sequence(length):\n sequence = ''\n for i in range(length):\n random_letter = format(random.randrange(9), 'x')\n sequence = '{}{}'.format(sequence, random_letter)\n return sequence",
"def __init__(self, solution_length):\n self.solution_vector = [random.randint(0, 1) ... | [
"0.6629182",
"0.66176623",
"0.658629",
"0.6582095",
"0.6406209",
"0.6395533",
"0.63719714",
"0.63587624",
"0.6338797",
"0.63131535",
"0.61847615",
"0.6158394",
"0.6141171",
"0.6127328",
"0.609781",
"0.60856277",
"0.6074763",
"0.601853",
"0.60163087",
"0.5998892",
"0.5998362",... | 0.6847667 | 0 |
New() > itkStatisticsLabelMapFilterLM2ID2 Create a new object of the class itkStatisticsLabelMapFilterLM2ID2 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named paramete... | def New(*args, **kargs):
obj = itkStatisticsLabelMapFilterLM2ID2.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkStatisticsLabelMapFilterLM2IF2.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkStatisticsLabelMapFilterLM2IUL2.__New_orig__()\n import itkTemplate\n ... | [
"0.83149797",
"0.8200963",
"0.8135466",
"0.8090839",
"0.73438203",
"0.725997",
"0.721282",
"0.72081983",
"0.71405476",
"0.7132342",
"0.7059641",
"0.7042538",
"0.7017669",
"0.7016017",
"0.70073396",
"0.6974631",
"0.69630873",
"0.69624627",
"0.6949204",
"0.6938305",
"0.6908284"... | 0.8477198 | 0 |
itkStatisticsLabelMapFilterLM2ID2_cast(itkLightObject obj) > itkStatisticsLabelMapFilterLM2ID2 | def itkStatisticsLabelMapFilterLM2ID2_cast(*args):
return _itkStatisticsLabelMapFilterPython.itkStatisticsLabelMapFilterLM2ID2_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkStatisticsLabelMapFilterLM2IF2_cast(*args):\n return _itkStatisticsLabelMapFilterPython.itkStatisticsLabelMapFilterLM2IF2_cast(*args)",
"def itkLabelStatisticsImageFilterIF2IUS2_cast(obj: 'itkLightObject') -> \"itkLabelStatisticsImageFilterIF2IUS2 *\":\n return _itkLabelStatisticsImageFilterPython.itk... | [
"0.80322564",
"0.79823023",
"0.7893789",
"0.78591686",
"0.7851117",
"0.78283685",
"0.78102875",
"0.7797543",
"0.7742517",
"0.7737263",
"0.7732647",
"0.76894057",
"0.7674775",
"0.76598394",
"0.76478344",
"0.76477337",
"0.7639166",
"0.7605115",
"0.7604473",
"0.7592416",
"0.7589... | 0.79866123 | 1 |
New() > itkStatisticsLabelMapFilterLM2IF2 Create a new object of the class itkStatisticsLabelMapFilterLM2IF2 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named paramete... | def New(*args, **kargs):
obj = itkStatisticsLabelMapFilterLM2IF2.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkStatisticsLabelMapFilterLM2ID2.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkStatisticsLabelMapFilterLM2IUL2.__New_orig__()\n import itkTemplate\n ... | [
"0.843711",
"0.831192",
"0.8250166",
"0.81894773",
"0.7441643",
"0.7362913",
"0.72992975",
"0.72771376",
"0.72669464",
"0.7254058",
"0.72335607",
"0.71993315",
"0.71802956",
"0.716803",
"0.7120768",
"0.7075302",
"0.7069684",
"0.7050837",
"0.70298636",
"0.7017997",
"0.70105153... | 0.8474006 | 0 |
itkStatisticsLabelMapFilterLM2IF2_cast(itkLightObject obj) > itkStatisticsLabelMapFilterLM2IF2 | def itkStatisticsLabelMapFilterLM2IF2_cast(*args):
return _itkStatisticsLabelMapFilterPython.itkStatisticsLabelMapFilterLM2IF2_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkLabelStatisticsImageFilterIF2IUS2_cast(obj: 'itkLightObject') -> \"itkLabelStatisticsImageFilterIF2IUS2 *\":\n return _itkLabelStatisticsImageFilterPython.itkLabelStatisticsImageFilterIF2IUS2_cast(obj)",
"def itkLabelStatisticsImageFilterIF2IUC2_cast(obj: 'itkLightObject') -> \"itkLabelStatisticsImageF... | [
"0.8240036",
"0.81565195",
"0.8092138",
"0.8091814",
"0.80504936",
"0.8036776",
"0.8022948",
"0.80178344",
"0.7998775",
"0.799767",
"0.7939651",
"0.78813887",
"0.78631645",
"0.7859602",
"0.78509605",
"0.7848506",
"0.78350013",
"0.7834007",
"0.7830703",
"0.78172",
"0.78123486"... | 0.830871 | 0 |
GetNumberOfBins(self) > unsigned int | def GetNumberOfBins(self):
return _itkStatisticsLabelMapFilterPython.itkStatisticsLabelMapFilterLM2IUC2_GetNumberOfBins(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetNumberOfBins(self):\n return _itkStatisticsLabelMapFilterPython.itkStatisticsLabelMapFilterLM2IUL2_GetNumberOfBins(self)",
"def GetNumberOfBins(self):\n return _itkStatisticsLabelMapFilterPython.itkStatisticsLabelMapFilterLM3IUL3_GetNumberOfBins(self)",
"def GetNumberOfBins(self):\n ... | [
"0.82316476",
"0.8069619",
"0.8034871",
"0.7994188",
"0.7973157",
"0.79582214",
"0.79557824",
"0.7921399",
"0.7840222",
"0.74550825",
"0.7419367",
"0.7398972",
"0.7327729",
"0.7327729",
"0.70314807",
"0.700273",
"0.69960093",
"0.68870395",
"0.6842152",
"0.6813086",
"0.6806192... | 0.8167406 | 1 |
New() > itkStatisticsLabelMapFilterLM2IUC2 Create a new object of the class itkStatisticsLabelMapFilterLM2IUC2 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parame... | def New(*args, **kargs):
obj = itkStatisticsLabelMapFilterLM2IUC2.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkStatisticsLabelMapFilterLM2IUL2.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkStatisticsLabelMapFilterLM2ID2.__New_orig__()\n import itkTemplate\n ... | [
"0.8266667",
"0.8216114",
"0.8195583",
"0.8179952",
"0.75897044",
"0.7574842",
"0.75570375",
"0.75075126",
"0.7507078",
"0.74742097",
"0.7426614",
"0.74248356",
"0.73668313",
"0.73328125",
"0.7325878",
"0.7308328",
"0.7296205",
"0.72733915",
"0.7259532",
"0.7214819",
"0.72035... | 0.841422 | 0 |
SetNumberOfBins(self, unsigned int _arg) | def SetNumberOfBins(self, *args):
return _itkStatisticsLabelMapFilterPython.itkStatisticsLabelMapFilterLM2IUL2_SetNumberOfBins(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numBinsChanged(self, val):\n self.numBins = val",
"def SetNumberOfBins(self, *args):\n return _itkStatisticsLabelMapFilterPython.itkStatisticsLabelMapFilterLM3IUL3_SetNumberOfBins(self, *args)",
"def SetNumberOfBins(self, *args):\n return _itkStatisticsLabelMapFilterPython.itkStatistic... | [
"0.794444",
"0.79127944",
"0.78897446",
"0.7833059",
"0.7787631",
"0.77847445",
"0.7743061",
"0.7736516",
"0.7728256",
"0.7695621",
"0.7241547",
"0.7241453",
"0.7236182",
"0.7229673",
"0.72076654",
"0.7199223",
"0.7145229",
"0.7084795",
"0.7059764",
"0.66575295",
"0.65296084"... | 0.8033812 | 0 |
GetNumberOfBins(self) > unsigned int | def GetNumberOfBins(self):
return _itkStatisticsLabelMapFilterPython.itkStatisticsLabelMapFilterLM2IUL2_GetNumberOfBins(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetNumberOfBins(self):\n return _itkStatisticsLabelMapFilterPython.itkStatisticsLabelMapFilterLM2IUC2_GetNumberOfBins(self)",
"def GetNumberOfBins(self):\n return _itkStatisticsLabelMapFilterPython.itkStatisticsLabelMapFilterLM3IUL3_GetNumberOfBins(self)",
"def GetNumberOfBins(self):\n ... | [
"0.8167406",
"0.8069619",
"0.8034871",
"0.7994188",
"0.7973157",
"0.79582214",
"0.79557824",
"0.7921399",
"0.7840222",
"0.74550825",
"0.7419367",
"0.7398972",
"0.7327729",
"0.7327729",
"0.70314807",
"0.700273",
"0.69960093",
"0.68870395",
"0.6842152",
"0.6813086",
"0.68061924... | 0.82316476 | 0 |
New() > itkStatisticsLabelMapFilterLM2IUL2 Create a new object of the class itkStatisticsLabelMapFilterLM2IUL2 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parame... | def New(*args, **kargs):
obj = itkStatisticsLabelMapFilterLM2IUL2.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkStatisticsLabelMapFilterLM2ID2.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkStatisticsLabelMapFilterLM2IF2.__New_orig__()\n import itkTemplate\n i... | [
"0.83719987",
"0.8353688",
"0.83438087",
"0.8249253",
"0.7390369",
"0.73350155",
"0.7332469",
"0.73305076",
"0.73084134",
"0.7277089",
"0.72720915",
"0.724737",
"0.72352374",
"0.7234086",
"0.72299886",
"0.7211963",
"0.72058827",
"0.7197542",
"0.7177051",
"0.7108383",
"0.70950... | 0.84165066 | 0 |
New() > itkStatisticsLabelMapFilterLM2IUS2 Create a new object of the class itkStatisticsLabelMapFilterLM2IUS2 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named parame... | def New(*args, **kargs):
obj = itkStatisticsLabelMapFilterLM2IUS2.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkStatisticsLabelMapFilterLM2ID2.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkStatisticsLabelMapFilterLM2IF2.__New_orig__()\n import itkTemplate\n i... | [
"0.83128744",
"0.8290446",
"0.8277999",
"0.8246717",
"0.7611095",
"0.75362366",
"0.75296354",
"0.7465429",
"0.73758674",
"0.7362777",
"0.72344404",
"0.7175453",
"0.712361",
"0.7119744",
"0.7110731",
"0.7095538",
"0.70795894",
"0.70573217",
"0.7056422",
"0.70488024",
"0.704586... | 0.8524355 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.