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 |
|---|---|---|---|---|---|---|
Save articles in postgres db | def save_article_if_new_postgres(articles):
conn = connect_to_postgres()
if conn is None:
return
cur = conn.cursor()
for article in articles:
# check if already written in DB and write if not
insert_command = """
INSERT INTO article ( header, url, dt,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_article(title,image,description,content,pub_date,news_url,note,user):\n article = Article(\n title=title,\n image=image,\n description=description,\n content = content,\n pub_date=datetime.strptime(pub_date, \"%Y-%m-%dT%H:%M:%SZ\"),\n news_url=news_url\n ... | [
"0.73172563",
"0.6863781",
"0.6768949",
"0.65381116",
"0.6503976",
"0.64485466",
"0.63395226",
"0.6312849",
"0.6307352",
"0.6274374",
"0.6257384",
"0.625451",
"0.62285715",
"0.6206362",
"0.61266017",
"0.61232036",
"0.6103075",
"0.607053",
"0.60469747",
"0.6026209",
"0.6017043... | 0.75139326 | 0 |
Save articles in mongo db | def save_articles_mongo(articles):
myclient = pymongo.MongoClient("mongodb://{host}:{port}/".format(host=os.environ['MONGO_HOST'],
port=os.environ['MONGO_PORT']))
mongo_db = myclient[os.environ['MONGO_DATABASE']]
col = mongo_db['artic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_new_article(article: Article = Body(...)):\n article_to_insert = article.dict()\n\n res = articles_db.post_articles_mongo(\n articles,\n keywords,\n article_to_insert\n )\n return res",
"def save_article(title,image,description,content,pub_date,news_url,note,user):\n ... | [
"0.73897463",
"0.6997813",
"0.65601164",
"0.6556793",
"0.652823",
"0.64266276",
"0.6244929",
"0.62407756",
"0.62350714",
"0.6227737",
"0.61431664",
"0.61152697",
"0.6031079",
"0.6001613",
"0.5997048",
"0.5939616",
"0.59179276",
"0.5911599",
"0.5878683",
"0.5847209",
"0.584200... | 0.77447826 | 0 |
Write articles for a specific date to CSV file resultsfile.csv | def retrieve_data_for_specific_date(articles_date):
conn = connect_to_postgres()
if conn is None:
return
cur = conn.cursor()
query = "SELECT url, header, text, dt FROM article WHERE DATE(dt) = '{date}'".format(date=articles_date)
outputquery = "COPY ({0}) TO STDOUT WITH DELIMITER ';' CSV HE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_to_file(self, results):\n with open(self.outputFilename, \"w\") as csvFile:\n csvWriter = csv.writer(csvFile, delimiter=',') \n title_row = ('asset_id', 'component_id', 'latitude', 'longitude', 'installation_date', 'commissioning_date', 'street_name', 'cabinet_id', 'nominal... | [
"0.71165556",
"0.67996395",
"0.6601403",
"0.6560274",
"0.649295",
"0.64271957",
"0.6424851",
"0.6422594",
"0.64133316",
"0.62774163",
"0.62692654",
"0.62142366",
"0.621073",
"0.6196222",
"0.61850923",
"0.6164418",
"0.61497664",
"0.6112314",
"0.6108876",
"0.6106222",
"0.609581... | 0.7286791 | 0 |
Get article body by url | def get_article_body(url):
G.go(url)
text = G.doc.select('////div[@class="StandardArticleBody_body"]').text()
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_article_body(url):\n headers = {'User-Agent': 'Codeup Data Science'}\n response = get(url, headers=headers)\n soup = BeautifulSoup(response.content, \"html.parser\") \n return soup.find('div', itemprop='text').text",
"def get_news_text(news_url: str):\n print(\"Getting Article Content..\"... | [
"0.80219",
"0.72327757",
"0.7176655",
"0.71069115",
"0.7102558",
"0.70835567",
"0.6839535",
"0.6642274",
"0.6600342",
"0.6591846",
"0.6425075",
"0.6403817",
"0.6382481",
"0.6372149",
"0.6269961",
"0.6259513",
"0.625738",
"0.6211645",
"0.6158588",
"0.6148016",
"0.6120894",
"... | 0.79432315 | 1 |
compute huasdorff distance loss for binary segmentation | def hd_loss(seg_soft, gt, seg_dtm, gt_dtm):
delta_s = (seg_soft[:,1,...] - gt.float()) ** 2
s_dtm = seg_dtm[:,1,...] ** 2
g_dtm = gt_dtm[:,1,...] ** 2
dtm = s_dtm + g_dtm
multipled = torch.einsum('bxyz, bxyz->bxyz', delta_s, dtm)
hd_loss = multipled.mean()
return hd_loss | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot2dist(seg):\n\n C = seg.shape[0]\n res = np.zeros_like(seg)\n for c in range(1, C): # background is excluded (C=0)\n posmask = seg[c].astype(np.bool)\n if posmask.any():\n negmask = ~posmask\n res[c] = distance(negmask) * negmask - (distance(posmask) - 1) * ... | [
"0.6661529",
"0.64099824",
"0.6366204",
"0.6363473",
"0.6323493",
"0.6294771",
"0.6266017",
"0.6199597",
"0.6166965",
"0.61504185",
"0.61312085",
"0.611591",
"0.61024386",
"0.60867727",
"0.6085334",
"0.60677123",
"0.60288733",
"0.598568",
"0.59616965",
"0.59327346",
"0.591597... | 0.658907 | 1 |
Plot the game board. | def draw_gameBoard(self):
# 15 horizontal lines
for i in range(9):
start_pixel_x = (i + 1) * CELL_PIXELS
start_pixel_y = (0 + 1) * CELL_PIXELS
end_pixel_x = (i + 1) * CELL_PIXELS
end_pixel_y = (9 + 1) * CELL_PIXELS
self.create_line(start_pixel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_game(self):\n display = plt.figure()\n\n # Plots dots.\n for dot in self.dots:\n plt.scatter(dot.x + .5, dot.y + .5, color=dot.color, s=1000)\n\n # Makes a uniform grid,\n axes = display.gca()\n axes.set_aspect('equal', adjustable='box')\n axe... | [
"0.7858056",
"0.72502124",
"0.7214515",
"0.7201967",
"0.7029387",
"0.69352525",
"0.6921453",
"0.6867675",
"0.6835099",
"0.6799645",
"0.67796713",
"0.6748692",
"0.6730312",
"0.6723405",
"0.6704865",
"0.6669026",
"0.66521883",
"0.664082",
"0.6609495",
"0.6582655",
"0.65821016",... | 0.7261132 | 1 |
Get group by given path | def by_path(self, path):
return self._client.get(
url=self._client.get_full_url(
self.
get_path('by_path', realm=self._realm_name, group_path=path)
)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group(group_data,path):\n path_name = path.label()\n group_name = re.sub(r'[0-9]+','',path_name)\n if group_name not in group_data:\n group_data[group_name] = len(group_data.keys())\n return group_data[group_name]",
"def get_existing_group(self, path, id, name):\n v_id = re.matc... | [
"0.772978",
"0.6525223",
"0.64835656",
"0.6461817",
"0.63495713",
"0.6327463",
"0.6285342",
"0.6127037",
"0.60188633",
"0.5930976",
"0.5804726",
"0.5801799",
"0.5779514",
"0.57688206",
"0.5748913",
"0.5744108",
"0.57338333",
"0.5729888",
"0.5722318",
"0.56843024",
"0.5631451"... | 0.6660683 | 1 |
Move group to root | def move_to_root(self, group_id, name):
return self._client.post(
url=self._client.get_full_url(
self.get_path('collection', realm=self._realm_name)
),
data=json.dumps({
'id': group_id,
'name': name
})
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setRoot(self):\n if self.state == BaseEditMode.ES_None:\n sheet = self._logic._getSheet()\n layout = sheet.getLayoutGroup()\n \n import suit.core.layout.LayoutGroupRadial as radialLayout\n if not isinstance(layout, radialLayout.LayoutGroupRadialSim... | [
"0.6359244",
"0.6358635",
"0.6273549",
"0.6110124",
"0.6003973",
"0.5983621",
"0.5983621",
"0.5983621",
"0.5983621",
"0.5831443",
"0.582785",
"0.57909787",
"0.578574",
"0.57406604",
"0.5727043",
"0.5719707",
"0.571599",
"0.5661129",
"0.5623719",
"0.56196225",
"0.5595319",
"... | 0.74857575 | 0 |
Return the data entry with that key(string only). If the key is not in the data, return None. | def getData(key):
#only string keys are accepted
if ( type(key) != str ): return None
try:
return Co8PersistentData.__dataDict[key]
except KeyError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_if_exist(self, data, key):\n if key in data:\n return data[key]\n return None",
"def __getitem__(self, key):\n return self.data.get(key, '')",
"def get_value(self, key: str) -> Any:\r\n if key is None:\r\n return self.data\r\n try:\r\n ... | [
"0.82123154",
"0.7309039",
"0.72677135",
"0.72277874",
"0.7040932",
"0.69868594",
"0.69868594",
"0.69660264",
"0.6961794",
"0.69375473",
"0.6881359",
"0.6826834",
"0.682081",
"0.68107283",
"0.67963827",
"0.67706054",
"0.6757001",
"0.6744611",
"0.67237025",
"0.67097914",
"0.66... | 0.74667233 | 1 |
Remove the data entry with that key(string only). | def removeData(key):
#only string keys are accepted
if ( type(key) != str ): return None
try:
del Co8PersistentData.__dataDict[key]
except KeyError:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_key(self, key):\n del self.data[key]\n self.save_data()",
"def remove(self, key):",
"def remove(kv_data, key):\n if isinstance(kv_data, str):\n kv_data = loads(kv_data) # Turn into Dictionary\n try:\n del kv_data[key]\n except NameError:\n ... | [
"0.8042788",
"0.7945503",
"0.7696901",
"0.7657578",
"0.75942427",
"0.7518757",
"0.7511551",
"0.74180245",
"0.7405447",
"0.7395271",
"0.7338885",
"0.73069334",
"0.729629",
"0.727901",
"0.727901",
"0.72788465",
"0.72736",
"0.7261323",
"0.7245008",
"0.7219925",
"0.7194281",
"0... | 0.84150505 | 0 |
Add a completion finder specify an existing finder with `before` or `after` to finetune the order in which the finder will have the opportunity to return its matches | def register_robot_completion_finder(
completion_finder: Callable, before: Callable = None, after: Callable = None
):
kernel = get_ipython().kernel
finders = kernel.completer.completion_finders
if completion_finder in finders:
kernel.completer.completion_finders.remove(completion_finder)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_after(self, **opts):\n return self.parser.find(search_after=self, **opts)",
"def set_custom_completer(self,completer,pos=0):\n\n newcomp = new.instancemethod(completer,self.Completer,\n self.Completer.__class__)\n self.Completer.matchers.insert(po... | [
"0.56004035",
"0.5579921",
"0.53368646",
"0.53288037",
"0.5268136",
"0.50188124",
"0.48547605",
"0.4744556",
"0.47388002",
"0.47188815",
"0.4714299",
"0.46791056",
"0.46681008",
"0.4652077",
"0.46503916",
"0.4621655",
"0.4608734",
"0.4596069",
"0.4594391",
"0.45838556",
"0.45... | 0.7401616 | 0 |
Remove a completion finder | def unregister_robot_completion_finder(completion_finder: Callable):
kernel = get_ipython().kernel
kernel.completer.completion_finders.remove(completion_finder) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __del__( self ):\n self.suggest = None",
"def _remove_finder(importer, finder):\r\n\r\n existing_finder = _get_finder(importer)\r\n\r\n if not existing_finder:\r\n return\r\n\r\n if isinstance(existing_finder, ChainedFinder):\r\n try:\r\n existing_finder.finders.remove(finder)\r\n exc... | [
"0.6519088",
"0.63977975",
"0.60877055",
"0.607742",
"0.6075447",
"0.59601915",
"0.59573257",
"0.59435254",
"0.59435254",
"0.59435254",
"0.59297496",
"0.57765245",
"0.5717672",
"0.56873983",
"0.5661162",
"0.5658041",
"0.5658041",
"0.5655606",
"0.56469905",
"0.56457305",
"0.56... | 0.7751524 | 0 |
Return the docs available from cached, imported libraries and and history of the current run | def docs(self, history=[]):
if self._doc_cache is None:
self._doc_cache = {}
for lib in ["BuiltIn"]:
self._load_libdoc(lib)
self._update_imports(history)
docs = dict(**self._doc_cache, **self._history_docs(history))
return docs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def docs():",
"def get_docs(self):\n return self.retrieve_docstring()",
"def get_docs(self):\n return self.retrieve_docstring()",
"def get_docs(self):\n return self.retrieve_docstring()",
"def get_docs_and_page():\n _, *args = sys.argv[:]\n if len(args) > 0:\n print(pydoc.... | [
"0.7214914",
"0.7208809",
"0.7208809",
"0.7208809",
"0.7035019",
"0.64107287",
"0.6370273",
"0.63667387",
"0.63056684",
"0.6242937",
"0.62129766",
"0.61954343",
"0.61671525",
"0.6120073",
"0.60648566",
"0.60035056",
"0.5990763",
"0.59571904",
"0.59271187",
"0.592674",
"0.5901... | 0.7643801 | 0 |
Try to load a libdoc, either by name, or named source. Tries to use the cache. | def _load_libdoc(self, name, source=None, use_cache=True):
strategies = [name]
if source is not None and source.endswith(".robot"):
try:
strategies += [find_file(source)]
except Exception:
pass
for strategy in strategies:
if u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_for_cache(self, doc_uri, doc, parsed_uri):\n remote_uri = '{}://{}/{}'.format(\n parsed_uri.scheme, parsed_uri.netloc, parsed_uri.path)\n if self.verbose:\n print('Loading URI {}'.format(remote_uri), file=sys.stderr)\n response = self.session.get(remote_uri)\n ... | [
"0.5935057",
"0.5904772",
"0.57871795",
"0.56727594",
"0.54848313",
"0.54818624",
"0.54666173",
"0.54666173",
"0.5432692",
"0.53918415",
"0.5369334",
"0.53154343",
"0.52822685",
"0.5280265",
"0.5209134",
"0.5153642",
"0.5152831",
"0.51441497",
"0.5137212",
"0.5116933",
"0.509... | 0.8219947 | 0 |
Return NPSH in ft given suction and vapor pressure in Pa and density in kg/m^3. | def calc_NPSH(P_suction, P_vapor, rho_liq):
# Note: NPSH = (P_suction - P_vapor)/(rho_liq*gravity)
# Taking into account units, NPSH will be equal to return value
return 0.334438*(P_suction - P_vapor)/rho_liq | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phosfracs(h,ks):\n k1p,k2p,k3p = ks\n h3po4 = h*h*h\n h2po4 = k1p*h*h\n hpo4 = k1p*k2p*h\n po4 = k1p*k2p*k3p\n denom = h3po4 + h2po4 + hpo4 + po4\n h3po4 /= denom\n h2po4 /= denom\n hpo4 /= denom\n po4 /= denom\n return h3po4,h2po4,hpo4,po4",
"def get_f_s_gas(p: float, ... | [
"0.6685551",
"0.639336",
"0.6244425",
"0.6082317",
"0.60762024",
"0.6053931",
"0.60533136",
"0.6028373",
"0.6004268",
"0.59924716",
"0.5931524",
"0.5906271",
"0.5870304",
"0.5837564",
"0.58216316",
"0.5757926",
"0.5748486",
"0.5741466",
"0.57287925",
"0.57140833",
"0.56934816... | 0.72387576 | 0 |
Given a list of numbers 1...max_num, find which one is missing. | def missing_number(nums, max_num):
expected_sum = sum(range(1, max_num + 1))
actual_sum = sum(nums)
missing_num = expected_sum - actual_sum
return missing_num | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task8_missing_number(num):\n check_list = list(range(1, max(num) + 1))\n result = list(set(check_list) - set(num))\n return result",
"def first_missing_positive_int_linear(nums):\n\t\n\t# Here's the trick: the first missing positive number must be \n\t# between 1 and len(array) + 1 \t\n\ts = set(num... | [
"0.71682376",
"0.66200066",
"0.6587165",
"0.64158785",
"0.64004153",
"0.6262766",
"0.6218174",
"0.61476374",
"0.601516",
"0.5959102",
"0.5955049",
"0.5899052",
"0.5875794",
"0.5813601",
"0.5809686",
"0.57972556",
"0.579456",
"0.579384",
"0.5793581",
"0.5776495",
"0.5772597",
... | 0.7283265 | 0 |
Secure XMLRPC server. It it very similar to SimpleXMLRPCServer but it uses HTTPS for transporting XML data. | def __init__(self, server_address, HandlerClass, logRequests=False):
self.logRequests = logRequests
SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self)
SocketServer.BaseServer.__init__(self, server_address, HandlerClass)
ctx = SSL.Context(SSL.SSLv23_METHOD)
ctx.use_private... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ServerApp(stream, certfile, keyfile):\n\n def secured():\n print 'server secured!'\n wait()\n\n def read(line):\n line = line.strip()\n print 'client said: %r.' % line\n\n if line == 'QUIT':\n write('GOODBYE')\n elif line == 'STARTTLS':\n st... | [
"0.5891365",
"0.57680714",
"0.55865854",
"0.5579839",
"0.55737317",
"0.55374026",
"0.5511723",
"0.5408151",
"0.5328179",
"0.52618873",
"0.5247265",
"0.52101576",
"0.5188306",
"0.51858515",
"0.5183569",
"0.5180495",
"0.51675045",
"0.51625985",
"0.5136065",
"0.51181674",
"0.511... | 0.5801445 | 1 |
Authenticates the headers against the credentials set in the configuration file. This method overrides the one with the same name in SimpleXMLRPCRequestHandler. whether authentication was successful or not | def authenticate(self, headers):
try:
from base64 import b64decode
(basic, _, encoded) = headers.get('Authorization').partition(' ')
assert basic == 'Basic', 'Only basic authentication supported'
encodedByteString = encoded.encode()
decodedBytes = b64d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_auth_header(self):\n self.auth_header = self.get_auth_header(self.login, self.password)\n return True if self.auth_header else False",
"def authenticate(self, environ):\n try:\n hd = parse_auth_header(environ['HTTP_AUTHORIZATION'])\n except:\n return Fals... | [
"0.7003828",
"0.6873419",
"0.6723734",
"0.666804",
"0.66520137",
"0.65985966",
"0.65686065",
"0.65346134",
"0.65084785",
"0.64767873",
"0.64284766",
"0.6428409",
"0.6404516",
"0.6397908",
"0.6395942",
"0.63829255",
"0.6370441",
"0.6318763",
"0.6311569",
"0.63074154",
"0.63029... | 0.7470838 | 0 |
Recreates images from a torch variable, sort of reverse preprocessing | def recreate_image(im_as_var):
recreated_im = im_as_var.data.numpy()[0]
recreated_im[recreated_im > 1] = 1
recreated_im[recreated_im < 0] = 0
# recreated_im = np.round(recreated_im * 255)
return recreated_im | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconstruct_image(self, net, images, name):\n target_img_grid = torchvision.utils.make_grid(images)\n images = images.to(self.device)\n output = net(images)\n img_grid = torchvision.utils.make_grid(output.cpu().data)\n if self.writer is not None:\n self.writer.add_... | [
"0.6344635",
"0.6262975",
"0.60765135",
"0.60504323",
"0.60154146",
"0.59801286",
"0.5910857",
"0.5901042",
"0.588297",
"0.579484",
"0.57937944",
"0.57394487",
"0.57089525",
"0.57089525",
"0.56973785",
"0.5683466",
"0.5676998",
"0.56759846",
"0.56605226",
"0.5660026",
"0.5645... | 0.6469008 | 0 |
Parameters required reload codegen for the fn_jira package | def codegen_reload_data():
return {
"package": u"fn_jira",
"message_destinations": [u"fn_jira"],
"functions": [u"jira_create_comment", u"jira_open_issue", u"jira_transition_issue"],
"workflows": [],
"actions": [],
"incident_fields": [u"jira_internal_url", u"jira_issue... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def codegen_reload_data():\n reload_params = {\"package\": u\"fn_microsoft_security_graph\",\n \"incident_fields\": [u\"microsoft_security_graph_alert_id\"], \n \"action_fields\": [u\"microsoft_security_graph_alert_assignedto\", u\"microsoft_security_graph_alert_closeddatet... | [
"0.6842905",
"0.6677929",
"0.6676545",
"0.6523825",
"0.65152633",
"0.63794017",
"0.6208954",
"0.53216106",
"0.5253385",
"0.5147386",
"0.51459956",
"0.5096269",
"0.50347793",
"0.4986125",
"0.49463722",
"0.49400613",
"0.49377644",
"0.4926541",
"0.4925193",
"0.49187768",
"0.4917... | 0.70339006 | 0 |
Project onto logbarrier. Useful for minimization of f(x) when x >= b. F(A) = log(det(A)) | def logbarrier(parameter, bias=None, reg=0.01, lr=0.1):
Norm = reg*lr
# Update W
squared = torch.mul(parameter, parameter)
squared = squared + 4*Norm
squareroot = torch.sqrt(squared)
update_w = (parameter + squareroot)/2.0
parameter.data = update_w
if bias is not None:
squared ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logbarrierfunc(delta, z, use_sigma):\n if use_sigma:\n z = np.where(z >= 0, np.tanh(z), z)\n k = 2\n return np.where(z > delta, -np.log(np.abs(z)),\n ((k - 1) / k) * (((z - k * delta) / ((k - 1) * delta)) ** k - 1) - np.log(delta))",
"def _loglike(self, y, f):\n binc... | [
"0.6741824",
"0.64290917",
"0.60649145",
"0.60545915",
"0.60342085",
"0.6012831",
"0.5975654",
"0.59622115",
"0.59182394",
"0.5911255",
"0.5808303",
"0.57899916",
"0.57665676",
"0.5762922",
"0.575",
"0.56905204",
"0.56785864",
"0.5675621",
"0.5657112",
"0.5648416",
"0.564723"... | 0.65788895 | 1 |
Counts the number of each type of decision in a dataset. | def getdecisionCounts(decision):
countY = 0; countN = 0
for row in decision:
# in our dataset format, the label is always the last column
if row == 'No':
countN += 1
else :
countY += 1
return countY, countN | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_elements_in_dataset(dataset):\n return dataset.count()",
"def trainCount(\n trainData, \n questionType,\n questionDict,\n questionIdict, \n objDict, \n objIdict,\n numAns):\n count_wa = np.zer... | [
"0.70031756",
"0.6811811",
"0.6684121",
"0.6506254",
"0.64955044",
"0.6468372",
"0.63262606",
"0.630834",
"0.62841123",
"0.62841123",
"0.62841123",
"0.62519157",
"0.62002695",
"0.6189409",
"0.6175214",
"0.6160707",
"0.6154031",
"0.61376435",
"0.6134713",
"0.6132458",
"0.61286... | 0.75158674 | 0 |
Function that calculates the FULL date for a METAR/TAF, based on the day, hour and minute As METARS can be expired, and TAFs can be in the future, we need to work out the Year and Month | def calc_metar_taf_date(day, hr, mn=0):
yr=0
mth=0
# Now get the month and year: METARS/TAFs can be from the day before (eg around midnight) or older; TAF's can be valid for a tomorrow...
# so we need to compare to today's date
if day == datetime.utcnow().day:
# METAR/TAF is from today... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_input():\n \n year = 2020\n month = 3 # number \n day = 12 # number in month\n hour = 12 # integer between 9 (= 9:00AM) and 17 (= 4:00PM) ## CHECK THIS\n minute = 0 # float between 0 (= 0 min) to 0.983 = 59 min)\n \n date=dt.datetime(year,month,day)\n time = date.timetuple().tm_... | [
"0.53826153",
"0.5304163",
"0.52935094",
"0.520267",
"0.5138873",
"0.51071763",
"0.50233746",
"0.49142775",
"0.49124345",
"0.49063063",
"0.49044997",
"0.48882982",
"0.4868934",
"0.48479235",
"0.4841657",
"0.48159018",
"0.48131526",
"0.48040777",
"0.4795018",
"0.4777202",
"0.4... | 0.75091416 | 0 |
Function that webscrapes SIGMET and AIRMET data from specified URL, returning a list of SIGMET/AIRMET dictionary items for further processing | def read_sigmet_airmet_ZA(sigmet_url):
sigair_met_list = [] # The list of disctionaries that will be returned, containing SIGMAT/AIRMET data
# Regular expressions to extract the co-ordinats and the Flight Level
coord_re = re.compile(r'([NS]\d{4,4} [EW]\d{5,5})')
valid_re = re.compile(r'VALID ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_from_web():\n pass",
"def program_item(url):\n items = []\n \n soup = abcradionational.get_soup(url)\n\n playable_podcast = abcradionational.get_playable_podcast(soup)\n\n items = abcradionational.compile_playable_podcast(playable_podcast)\n\n return items",
"def get_from_web(... | [
"0.59911746",
"0.59453905",
"0.5848602",
"0.5834908",
"0.58163935",
"0.5807108",
"0.57875293",
"0.5772196",
"0.576209",
"0.57481354",
"0.5744503",
"0.5738256",
"0.57149047",
"0.5688065",
"0.56816363",
"0.5670173",
"0.5655818",
"0.5650575",
"0.56476456",
"0.5641101",
"0.562150... | 0.69745046 | 0 |
Function that accepts SIGMET and AIRMET data, and creates a list of GEOJSON features grouped into SIGMET and AIRMET Each Feature will form a layer on the map this allows for easy filtering of layers. The function also returns a list of the Groups applicable (eg. there may be no AIRMETS so only SIGMETS will be returned) | def generate_sigmet_geojson(sigair_met_list):
# Initialise Variables
used_groups = [] #contains applicable groupings for use on the web page (i.e. it excludes groupings that do not appear) - used to filter layers on the map
used_layers = []
sigair_met_features = []
# If there are no Sig/Airme... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_features_geojson(self, geojson_tagset):\n kreis_region_bund_list = []\n only_regs_set = set()\n for feature in geojson_tagset:\n bundesl = feature.properties.get('NAME_1')\n region = feature.properties.get('NAME_2')\n kreis = feature.properties.get('NA... | [
"0.5929601",
"0.5754891",
"0.5700304",
"0.56480706",
"0.5514577",
"0.544874",
"0.5413403",
"0.5413403",
"0.5413403",
"0.53773695",
"0.53624165",
"0.5340683",
"0.5311254",
"0.5300792",
"0.5300585",
"0.52863663",
"0.5171702",
"0.5116965",
"0.51054764",
"0.5100863",
"0.50949407"... | 0.72906536 | 0 |
Function that webscrapes METAR data from specified URL, returning a list of METAR dictionary items for further processing | def read_metar_ZA(metar_url, date_as_ISO_text=False):
metar_list = [] # The list of dictionaries that will be returned, containing METAR data
# Regular expressions to extract the wind
re_wind_no_gust = re.compile(r'(?P<direction>[0-9]{3,3})(?P<spd>[0-9]{2,2})KT') # 10005KT
re_wind_gust = re.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrape_mars():\n (news_title, news_p) = scrape_news()\n\n\n mars_data = {\n \"news_title\": news_title,\n \"news_p\": news_p,\n \"jpl_url\": scrape_jpl_images(),\n \"facts_tbl\": scrape_mars_facts(),\n \"weather\": scrape_weather(),\n \"hemi_pct\": scrape_hemisph... | [
"0.6425863",
"0.62656265",
"0.61560684",
"0.61202806",
"0.6082322",
"0.60705894",
"0.603539",
"0.602477",
"0.59803134",
"0.5978208",
"0.5974024",
"0.5970704",
"0.5949197",
"0.59491205",
"0.59410346",
"0.59403086",
"0.5926911",
"0.59215087",
"0.58880013",
"0.58857656",
"0.5870... | 0.679931 | 0 |
Function that accepts METAR data, and creates a list of GEOJSON features | def generate_metar_geojson(metar_list):
# Initialise Variables
metar_features = []
# If there are no Metars (incase None is passed)
if metar_list is None:
return metar_features
#Get the colours
colr = current_app.config['WEATHER_METAR_COLOUR']
opacity = current_app.config[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFeatures(gdf):\n import json\n return [json.loads(gdf.to_json())['features'][0]['geometry']]",
"def getFeatures(gdf):\n import json\n return [json.loads(gdf.to_json())['features'][0]['geometry']]",
"def getFeatures(gdf):\n import json\n return [json.loads(gdf.to_json())['features'][0][... | [
"0.67721707",
"0.67721707",
"0.67721707",
"0.67712075",
"0.6762713",
"0.6726054",
"0.6585093",
"0.6470925",
"0.646173",
"0.6427646",
"0.6305461",
"0.61622536",
"0.60196996",
"0.59077334",
"0.59004563",
"0.5895464",
"0.58717555",
"0.586631",
"0.58627445",
"0.58431137",
"0.5829... | 0.7444071 | 0 |
Function that webscrapes TAF data from specified URL, returning a list of TAF dictionary items for further processing | def read_taf_ZA(taf_url):
taf_list = [] # The list of disctionaries that will be returned, containing SIGMAT/AIRMET data
# Retrieve the webpage containing TAF data
try:
r = requests.get(taf_url, verify=False)
except:
current_app.logger.error(f"Error retrieving TAF - faile... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_data_in_api(url: str) -> list:\n\n try:\n resp = requests.request('GET', url, timeout=10)\n resp.raise_for_status\n\n return Froxy._data_filter(resp.text)\n\n except (\n requests.ConnectionError,\n requests.ConnectTimeout,\n r... | [
"0.66955215",
"0.64286023",
"0.6310379",
"0.62667525",
"0.6012198",
"0.5954974",
"0.59443146",
"0.5918982",
"0.5910473",
"0.58493155",
"0.5826196",
"0.58011115",
"0.5792379",
"0.5791782",
"0.5757033",
"0.5722308",
"0.57221663",
"0.5651222",
"0.56475663",
"0.56458086",
"0.5624... | 0.6669442 | 1 |
Returns a country name >>> country_name(198) u'Spain' | def country_name(country_id):
if country_id == '999':
#Added for internal call - ie flag/phone.png
return _('internal call').title()
try:
obj_country = Country.objects.get(id=country_id)
return obj_country.countryname
except:
return _('unknown').title() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def country() -> str:",
"def get_country_name(ip_addr):\n global geoip_db_reader\n try:\n name = geoip_db_reader.country(ip_addr).country.name\n return name\n except geoip2.errors.AddressNotFoundError:\n return None",
"def city_country(city_name, country_name):\n city_country_c... | [
"0.7970611",
"0.74789137",
"0.7290018",
"0.7256297",
"0.72242415",
"0.72170895",
"0.7174187",
"0.7125716",
"0.7032557",
"0.69968367",
"0.6897612",
"0.68448883",
"0.68448883",
"0.6844652",
"0.6830179",
"0.68273675",
"0.68273675",
"0.68217665",
"0.6775136",
"0.67616194",
"0.670... | 0.8094582 | 0 |
Computes maximum profit given an array of integers. | def max_profit(prices: List[int]) -> int: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mxprofit(array):\n\n #initialize variables\n minimum_val = 10000\n profit = 0\n # edge cases\n if len(array) <= 1:\n return 0\n # iterate through list and store minimum value\n for i in range(len(array)):\n if array[i] < minimum_val:\n minimum_val = array[i]\n ... | [
"0.79491603",
"0.7307924",
"0.72126335",
"0.71998954",
"0.71405184",
"0.7001814",
"0.6913991",
"0.681403",
"0.6794797",
"0.6759049",
"0.67483675",
"0.6679292",
"0.66514146",
"0.6540295",
"0.6539902",
"0.64617467",
"0.6461604",
"0.6277102",
"0.6220039",
"0.62115324",
"0.620860... | 0.7735168 | 1 |
Encode an integer to a string, using this base. The ``n`` parameter must be an integer. Returns the encoded string, or raises ``ValueError`` if ``n`` is greater than the largest encodable integer. | def encode(self, n):
if n > self.max_encodable_value:
raise ValueError(
'%d is greater than the largest encodable integer (%d)' % (
n, self.max_encodable_value))
ret = []
for base in reversed(self.bases):
n, d = divmod(n, len(base))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_int(n):\n return struct.pack(\">I\", n)",
"def encode(n, minlen=1, charset=CHARSET_DEFAULT):\n\n chs = []\n while n > 0:\n r = n % BASE\n n //= BASE\n\n chs.append(charset[r])\n\n if len(chs) > 0:\n chs.reverse()\n else:\n chs.append('0')\n\n s = ''... | [
"0.7220351",
"0.70059884",
"0.6887076",
"0.62927896",
"0.6291305",
"0.62205064",
"0.62073284",
"0.61941147",
"0.6176299",
"0.61528087",
"0.6137992",
"0.6087266",
"0.6072454",
"0.6028726",
"0.59832066",
"0.59443367",
"0.5895882",
"0.58804363",
"0.5871919",
"0.5861902",
"0.5858... | 0.85049254 | 0 |
Decode a string to an integer, using this base. The ``x`` parameter must be a string as long as the ``bases`` sequence. Returns the decoded integer or raises ``ValueError`` if the length of ``x`` is not equal to the length of ``bases`` or any of the characters in ``x`` aren't valid digits for their position. | def decode(self, x):
if len(x) != len(self.bases):
raise ValueError(
"the length of %r (%d) doesn't match the number of bases (%d)" % (
x, len(x), len(self.bases)))
ret = 0
for base, d in zip(self.bases, x):
ret = (ret * len(base)) + b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_to_int(string, base):\n if string==\"0\" or base <= 0 : return 0 \n result = 0 \n return result",
"def int2base(x: int, base: int, fixed_length: int=None):\n if x < 0:\n sign = -1\n elif x == 0:\n string_repr = digs[0]\n if fixed_length is None:\n return string_r... | [
"0.61489844",
"0.5960833",
"0.59521884",
"0.5633632",
"0.56069225",
"0.52934",
"0.5220636",
"0.5193034",
"0.5165642",
"0.51576704",
"0.51355946",
"0.5104095",
"0.50997156",
"0.50545096",
"0.50545096",
"0.50545096",
"0.50545096",
"0.50119114",
"0.498523",
"0.49698025",
"0.4967... | 0.7865437 | 0 |
Adds information about test | def add_info(info):
self._info[get_test_name(request)].append(info) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_info(self, request):\n def add_info(info):\n \"\"\"\n Adds information about test\n \"\"\"\n self._info[get_test_name(request)].append(info)\n return add_info",
"def addTest(self, test):\r\n self.tests.append(test)\r\n return",
"d... | [
"0.8229106",
"0.70418406",
"0.65376693",
"0.6416931",
"0.6405385",
"0.6334821",
"0.63047326",
"0.6282116",
"0.6282116",
"0.6248777",
"0.62369514",
"0.6232264",
"0.61616373",
"0.6148637",
"0.6100409",
"0.6083263",
"0.6083263",
"0.6083263",
"0.6074645",
"0.60481167",
"0.6041077... | 0.7915905 | 1 |
Takes in a tuple of 2 numpy matrices, a tuple of layers, and an integer. Returns tuple with a MLPRegressor model and a tuple. Creates a multilayer perceptron model with a provided number of hidden layers. Trains the model with provided data. | def mlp_model(train, layers=(100,), window_size=5):
# generate a window
window = mlp_window_selector(train, window_size)
# interpolate new data
train_x = mlp_input_mapper(train[0], window)
train_y = mlp_input_mapper(train[1], window)
# generate model
model = MLPRegressor(hidden_layer_sizes=t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mlp(learning_rate=0.01, L1_reg=0.00, L2_reg=0.0001, n_epochs=1000,\r\n dataset='mnist.pkl.gz', batch_size=20, n_hidden=500):\r\n datasets = load_data(dataset)\r\n\r\n train_set_x, train_set_y = datasets[0]\r\n valid_set_x, valid_set_y = datasets[1]\r\n test_set_x, test_set_y = data... | [
"0.65499324",
"0.64408076",
"0.63840145",
"0.63513124",
"0.62518644",
"0.62417245",
"0.62325275",
"0.6184379",
"0.60457563",
"0.60316384",
"0.6014735",
"0.59431326",
"0.59126353",
"0.58972156",
"0.5835209",
"0.58220255",
"0.5813621",
"0.5739834",
"0.57342285",
"0.57225025",
"... | 0.7192432 | 0 |
Creates Withholding for taxes in invoice | def action_move_create_withholding(self):
account_move = self.env['account.move']
aitw_obj = self.env['account.invoice.tax.wh']
for invoice_brw in self:
if invoice_brw.type not in ('out_invoice', 'out_refund'):
continue
if not invoice_brw.wh_agent_itbms:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def withholding_tax_amount(self, withholding_tax_amount):\n\n self._withholding_tax_amount = withholding_tax_amount",
"def withholding_tax_rate(self, withholding_tax_rate):\n\n self._withholding_tax_rate = withholding_tax_rate",
"def create_invoice(self):\n sales_tax = 0.06\n item_s... | [
"0.64049727",
"0.6330529",
"0.61386544",
"0.611488",
"0.5884036",
"0.56877345",
"0.56771636",
"0.5668548",
"0.56052196",
"0.55591106",
"0.55289155",
"0.55289155",
"0.54594743",
"0.54070324",
"0.5400555",
"0.5374065",
"0.5350586",
"0.53499526",
"0.5275051",
"0.52569675",
"0.52... | 0.6966169 | 0 |
Create and setup the base vtk and Qt objects for the application | def setup():
renderer = vtk.vtkRenderer()
frame = QtWidgets.QFrame()
vtk_widget = QVTKRenderWindowInteractor()
interactor = vtk_widget.GetRenderWindow().GetInteractor()
render_window = vtk_widget.GetRenderWindow()
frame.setAutoFillBackground(True)
vtk_widget.GetR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self):\n raise NotImplementedError(\"\"\"The create method must be overridden to\n build desired vtk objects.\"\"\")",
"def __init__(self, background_color=(0, 0, 0)):\n QtWidgets.QMainWindow.__init__(self)\n self.frame = QtWidgets.QFrame()\n self.setCentralWidge... | [
"0.67277646",
"0.6394425",
"0.6386949",
"0.63848686",
"0.63642865",
"0.63218343",
"0.6316782",
"0.6250288",
"0.6237879",
"0.61253744",
"0.6118074",
"0.6117805",
"0.60873276",
"0.6083839",
"0.606485",
"0.6062236",
"0.6044137",
"0.60299915",
"0.6014983",
"0.6009766",
"0.5957483... | 0.70242107 | 0 |
Move the camera to display the axial view | def set_axial_view(self):
self.renderer.ResetCamera()
fp = self.renderer.GetActiveCamera().GetFocalPoint()
p = self.renderer.GetActiveCamera().GetPosition()
dist = math.sqrt((p[0] - fp[0]) ** 2 + (p[1] - fp[1]) ** 2 + (p[2] - fp[2]) ** 2)
self.renderer.GetActiveCamera().SetPositi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setCamera(self, viewX=0, viewY=0):\n self.viewX = viewX\n self.viewY = viewY",
"def set_view(self):\n self.scene.mlab.view(azimuth=90.0, elevation=-90.0)",
"def on_show_view(self):\n self.setup()\n arcade.set_background_color(arcade.color.BLACK)\n arcade.set_viewpo... | [
"0.7212608",
"0.71399224",
"0.68425083",
"0.6840306",
"0.6815355",
"0.6792847",
"0.6789115",
"0.6767413",
"0.67336446",
"0.66762626",
"0.667446",
"0.6662792",
"0.66398436",
"0.65895605",
"0.6578721",
"0.6573344",
"0.6547032",
"0.6519471",
"0.64943886",
"0.6483231",
"0.6456752... | 0.80318666 | 0 |
Move the camera to display the coronal view | def set_coronal_view(self):
self.renderer.ResetCamera()
fp = self.renderer.GetActiveCamera().GetFocalPoint()
p = self.renderer.GetActiveCamera().GetPosition()
dist = math.sqrt((p[0] - fp[0]) ** 2 + (p[1] - fp[1]) ** 2 + (p[2] - fp[2]) ** 2)
self.renderer.GetActiveCamera().SetPosi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def centerCamera(self):\n self.camera = (self.width / 2, self.height / 2)",
"def set_axial_view(self):\n self.renderer.ResetCamera()\n fp = self.renderer.GetActiveCamera().GetFocalPoint()\n p = self.renderer.GetActiveCamera().GetPosition()\n dist = math.sqrt((p[0] - fp[0]) ** 2... | [
"0.69981605",
"0.68610466",
"0.6816325",
"0.6801461",
"0.6791668",
"0.6753843",
"0.6710304",
"0.66631925",
"0.6643434",
"0.662266",
"0.6570206",
"0.6474585",
"0.64409626",
"0.6439115",
"0.6436408",
"0.64255387",
"0.6420345",
"0.6418809",
"0.64171857",
"0.6415462",
"0.6286711"... | 0.84081805 | 0 |
Move the camera to display the sagittal view | def set_sagittal_view(self):
self.renderer.ResetCamera()
fp = self.renderer.GetActiveCamera().GetFocalPoint()
p = self.renderer.GetActiveCamera().GetPosition()
dist = math.sqrt((p[0] - fp[0]) ** 2 + (p[1] - fp[1]) ** 2 + (p[2] - fp[2]) ** 2)
self.renderer.GetActiveCamera().SetPos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_view(self, s):\n #s.scene.reset_zoom()\n s.scene.z_plus_view()\n c = s.scene.camera\n c.azimuth(-30)\n c.elevation(20)\n s.render()",
"def set_view(self, s):\n #s.scene.reset_zoom()\n s.scene.z_plus_view()\n c = s.scene.camera\n c.azim... | [
"0.70561534",
"0.7050205",
"0.6879647",
"0.6870642",
"0.6862437",
"0.6770447",
"0.6629652",
"0.6603986",
"0.65818405",
"0.65284383",
"0.65133715",
"0.65020484",
"0.6485723",
"0.6480093",
"0.64748067",
"0.6467349",
"0.6407815",
"0.63660985",
"0.6329483",
"0.63262033",
"0.63193... | 0.7297154 | 0 |
Function call by the silhouette when a node is selected | def event_node_selected(self, node):
# TODO
print("selected node:", node) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_NormalNode_clicked(self):\n # TODO: not implemented yet\n # raise NotImplementedError\n print(\"Select Normal Node,not need others attend in! Best Wish\")\n self.select_actor = \"NormalNode\"",
"def OnNodeSelected( self, event ):\n try:\n node = self.sorted[ e... | [
"0.63384455",
"0.6190276",
"0.5896407",
"0.57874525",
"0.5669783",
"0.5633221",
"0.5563177",
"0.5476702",
"0.5465189",
"0.54551536",
"0.5449223",
"0.5443576",
"0.54165447",
"0.54047793",
"0.540049",
"0.53979313",
"0.53696954",
"0.53696954",
"0.53685576",
"0.53352416",
"0.5327... | 0.644856 | 0 |
Function call by the silhouette when a edge is selected | def event_edge_selected(self, edge):
# TODO
print("selected edge:", edge) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __filterEdges(self):",
"def edge_on_silhouette(self, vertices_2d: np.ndarray) -> np.ndarray:\n assert vertices_2d.ndim == 2\n assert vertices_2d.shape[1] == 2\n triangles = vertices_2d[self.faces, :]\n u = triangles[:, 1, :] - triangles[:, 0, :]\n v = triangles[:, 2, :] - t... | [
"0.6124664",
"0.60711336",
"0.58666146",
"0.5829186",
"0.5802818",
"0.57219154",
"0.56343764",
"0.5494429",
"0.5428436",
"0.5423086",
"0.53683704",
"0.53628373",
"0.5345972",
"0.52988225",
"0.52867573",
"0.52692485",
"0.5213829",
"0.51858133",
"0.51805794",
"0.51662755",
"0.5... | 0.6577793 | 0 |
Schedule all push and preload resources for a given node with the given delay. | def schedule_pushed_and_preloaded_resources(
self, node: Node, delay: float, dry_run=False
) -> Optional[List[Tuple[Node, float]]]:
push_resources = self.policy.push_set_for_resource(node.resource) if self.policy else []
preload_resources = self.policy.preload_set_for_resource(node.resource... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_after_delay(delay_ms: float, callback: Callable[[], None]):\n heapq.heappush(\n _sorted_scheduled_events,\n _ScheduledEvent(\n time=pygame.time.get_ticks() + delay_ms, callback=callback\n ),\n )",
"def schedule(self, sleep_time, delay):\n self.sleep_time = sle... | [
"0.6102289",
"0.6074285",
"0.55365187",
"0.5314593",
"0.5240758",
"0.51047784",
"0.4969097",
"0.49502808",
"0.49491665",
"0.49445334",
"0.49225804",
"0.4915911",
"0.4893828",
"0.48897707",
"0.48873812",
"0.48403677",
"0.4801317",
"0.47886148",
"0.47872466",
"0.47806123",
"0.4... | 0.75357234 | 0 |
Steps through the request queue once and updates the simulator state based on the results | def step_request_queue(self):
completed_this_step, time_ms_this_step = self.request_queue.step()
self.total_time_ms += time_ms_this_step
for node in completed_this_step:
self.completed_nodes[node] = self.total_time_ms + node.resource.execution_ms
self.log.verbose("resou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_iteration(self):\n self.send_pending_requests()\n super().on_iteration()",
"def request() -> None:\n\t_flag.set()",
"def step(self):\n # Pull data from the first available input channel.\n\n input_bag = self.get()\n\n # todo add timer\n self.handle_results(input... | [
"0.61810625",
"0.592369",
"0.592225",
"0.5875259",
"0.58692753",
"0.58094347",
"0.5794984",
"0.57932585",
"0.57728696",
"0.5763457",
"0.5760611",
"0.57588017",
"0.5739882",
"0.5738198",
"0.572418",
"0.57186425",
"0.57186425",
"0.5717217",
"0.5703992",
"0.5692217",
"0.5689397"... | 0.65267473 | 0 |
Simulates the page load time of a webpage in the given client environment with an optional push policy to also simulate. | def simulate_load_time(
self,
client_env: ClientEnvironment,
policy: Optional[Policy] = None,
cached_urls: Optional[Set[str]] = None,
use_aft: Optional[bool] = False,
) -> float:
self.log.verbose("simulating page load with client environment", **client_env._asdict())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_impl(context):\r\n context.browser.get('https://opensource-demo.orangehrmlive.com/')\r\n time.sleep(10)",
"def warmup_browser(self, browser: 'Browserify', url: 'Url') -> 'EngineMakerInterface':",
"def __call__(self):\n self.page1() # GET web (request 101)\n\n grinder.sleep(1000)\n ... | [
"0.5652721",
"0.55101717",
"0.5463232",
"0.5439354",
"0.5430658",
"0.5325434",
"0.52991545",
"0.5253171",
"0.5198481",
"0.5186823",
"0.5095128",
"0.50730103",
"0.50594103",
"0.5050114",
"0.49977705",
"0.49749178",
"0.49519542",
"0.494344",
"0.49331352",
"0.48965228",
"0.48575... | 0.7346552 | 0 |
Computes the completion time up until the given URL, or until the last object in the page if URL is not specified | def completion_time(self, url: Optional[str] = None) -> float:
if not url:
return max(self.completed_nodes.values())
return self.completed_nodes[self.url_to_node_map[url]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginator(url: str, timeout: int=0.1, **kwargs) -> Generator[Tuple[int, Dict[str, Any]], None, None]:\n while True:\n status, data = fetch(url, **kwargs) \n yield status, data \n next_url = data['next']\n if next_url is None: \n break \n else:\n url =... | [
"0.6120126",
"0.610536",
"0.5593772",
"0.5554222",
"0.5485298",
"0.54599017",
"0.54582006",
"0.5422357",
"0.5416172",
"0.5386441",
"0.538519",
"0.5384364",
"0.5352325",
"0.5347377",
"0.53389025",
"0.5257554",
"0.52555287",
"0.5252659",
"0.5217241",
"0.52099425",
"0.5205436",
... | 0.68649894 | 0 |
Creates the execution graph from the environment config | def create_execution_graph(self, env_config: EnvironmentConfig):
# create a map of Nodes, mapping their order (basically their ID) to a Node for that resource
res_list = sorted(env_config.har_resources, key=lambda r: r.order)
self.node_map = {
res.order: Node(resource=res, priority=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train(config, env_processes):\n tf.reset_default_graph()\n with config.unlocked:\n config.network = functools.partial(\n utility.define_network, config.network, config)\n config.policy_optimizer = getattr(tf.train, config.policy_optimizer)\n config.value_optimizer = getattr(tf.train, config.v... | [
"0.59626645",
"0.5879072",
"0.5851549",
"0.58362114",
"0.582692",
"0.56316763",
"0.56060916",
"0.56032616",
"0.55222464",
"0.5481048",
"0.5472875",
"0.54267657",
"0.5402605",
"0.5366224",
"0.53651065",
"0.5359956",
"0.53140163",
"0.5304578",
"0.5295872",
"0.5290212",
"0.52884... | 0.6807472 | 0 |
Determine site position by converting given longitude, latitude and height for a station to geocentric cartesian coordinates | def _get_site_pos(dset):
# TODO hjegei: Workaround -> better would it be if Position object can handle LLH as input format!!!
x, y, z = gnss.llh2xyz(np.deg2rad(dset.lat), np.deg2rad(dset.lon), dset.height)
return np.stack((x, y, z), axis=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lonlat2xy(s_lon, s_lat): # x: easting, y: northing\r\n # convert decimals to seconds...\r\n s_lon = dec2sec(s_lon)\r\n s_lat = dec2sec(s_lat)\r\n\r\n ## Auxiliary values \r\n # i.e. differences of latitude and longitude relative to Bern in the unit [10000'']\r\n s_lng_aux = (s_lon - 26782.5)/... | [
"0.6473595",
"0.64406455",
"0.6367665",
"0.6359032",
"0.6342975",
"0.6301968",
"0.62030673",
"0.61451846",
"0.6122501",
"0.59740734",
"0.59316474",
"0.5877593",
"0.5861095",
"0.5844831",
"0.5828851",
"0.5814638",
"0.58141816",
"0.5814044",
"0.57828254",
"0.5778477",
"0.577743... | 0.6629958 | 0 |
Formats the "Current?" column for the given service | def format_using_current_token(service, token_etag, token_name):
is_current = is_service_current(service, token_etag, token_name)
if is_current:
return terminal.success('Current')
else:
return 'Not Current' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_column_format(self):\n pass",
"def format_status(self) -> str:\n if not self.ready_to_trade:\n return \"Market connectors are not ready.\"\n lines = []\n\n balance_df = self.get_balance_df()\n lines.extend([\"\", \" Balances:\"] + [\" \" + line for lin... | [
"0.53294194",
"0.5314236",
"0.51500046",
"0.49896735",
"0.49314412",
"0.48342925",
"0.48339313",
"0.48071983",
"0.47880876",
"0.47838733",
"0.47743535",
"0.4739447",
"0.4735393",
"0.47299096",
"0.47188416",
"0.4716945",
"0.47101995",
"0.46654326",
"0.46208525",
"0.46192995",
... | 0.56200206 | 0 |
Formats the "Healthy?" column for the given instance | def format_instance_status(instance):
if instance['healthy?']:
return terminal.success('Healthy')
else:
if instance['_status'] == 'failed':
status = 'Failed'
elif instance['_status'] == 'killed':
status = 'Killed'
else:
status = 'Unhealthy'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _health(self) -> str:\n bad = []\n if self.leech:\n bad.append(\"leech\")\n if self.zero:\n bad.append(\"last quality was zero\")\n\n if not bad:\n return \"OK\"\n else:\n return \" & \".join(bad)",
"def health(self):\n ret... | [
"0.66063195",
"0.61336064",
"0.5757227",
"0.5724033",
"0.556004",
"0.556004",
"0.55392295",
"0.54227436",
"0.54227436",
"0.54227436",
"0.54227436",
"0.54227436",
"0.54227436",
"0.5414834",
"0.5352144",
"0.52626026",
"0.5253913",
"0.52401495",
"0.52276134",
"0.52202225",
"0.52... | 0.7172031 | 0 |
Given a specific environment, creates an SARSA agent specific for this environment. Can only handle discrete environments. | def create_agent(self, env):
if isinstance(env.action_space, gym.spaces.Discrete):
return SarsaAgent(
obs_dim=env.observation_space.shape[0],
act_dim=env.action_space.n,
hidden_sizes=[64],
)
raise ValueError("SARSA can only be use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_agent(self, env):\n\n if isinstance(env.action_space, gym.spaces.Box):\n return ContinuousReinforceAgent(\n obs_dim=env.observation_space.shape[0],\n act_dim=env.action_space.shape[0],\n hidden_sizes=[64],\n )\n\n if isinst... | [
"0.66630644",
"0.6631694",
"0.65505534",
"0.5953285",
"0.59230745",
"0.59207326",
"0.5811515",
"0.56780297",
"0.5674116",
"0.5648996",
"0.56102073",
"0.5546342",
"0.5455327",
"0.5420759",
"0.5400671",
"0.5400206",
"0.5390566",
"0.53870106",
"0.5293561",
"0.52203923",
"0.52186... | 0.76628625 | 0 |
Creates a dictionary from the given csv file of votes. | def create_dict_of_votes(file):
with open(file) as csvfile:
entries = csv.reader(csvfile)
header = next(entries)
votes = dict()
# add valid entries to the dictionary
for entry in entries:
# create full name of voter
name = " ".join(entry[0:2]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dict_of_votes(file: str) -> dict:\r\n with open(file) as csvfile:\r\n entries = csv.reader(csvfile)\r\n header = next(entries)\r\n # add valid entries to the dictionary\r\n for entry in entries:\r\n # create full name of voter\r\n name = \" \".join(en... | [
"0.83097434",
"0.6771137",
"0.6684424",
"0.65192115",
"0.6435881",
"0.63070375",
"0.62879527",
"0.614326",
"0.6132934",
"0.6074498",
"0.6073671",
"0.60459125",
"0.6025651",
"0.5999806",
"0.5969029",
"0.5962401",
"0.59587884",
"0.59540343",
"0.5944068",
"0.5942996",
"0.5933732... | 0.8414147 | 0 |
Returns dictionary matching party to their number of votes. | def count_party_votes(votes):
vote_count = {'Pineapple Pizza Party': 0, 'Pronounced Jiff Union': 0, 'Socks and Crocs Reform League': 0}
for person in votes:
vote_count[votes[person]] += 1
return vote_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_party_votes(votes: dict) -> dict:\r\n vote_count = {'Pineapple Pizza Party': 0, 'Pronounced Jiff Union': 0, 'Socks and Crocs Reform League': 0}\r\n for person in votes:\r\n vote_count[votes[person]] += 1\r\n return vote_count",
"def _build_votes_dict(self, participants):\n # more idi... | [
"0.8228742",
"0.7485642",
"0.72830147",
"0.6617967",
"0.6336069",
"0.63264114",
"0.6291957",
"0.602717",
"0.6024599",
"0.59887576",
"0.59753215",
"0.59386176",
"0.5893761",
"0.5803234",
"0.571136",
"0.5707201",
"0.5667682",
"0.56395775",
"0.56219697",
"0.55806905",
"0.5569669... | 0.8151295 | 1 |
This parses the text and calls the stock api's | def create_request(self):
try:
stock_name, request = self.text.split(" ")
print(stock_name)
print(request)
if request in run_commands.keys():
endpoint: str = run_commands.get(request).get('endpoint')
url_maker: str = f"stocks/{stock... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle(text, mic, profile):\n mic.say(\"Getting Stock Info\")\n try:\n output = ''\n for symbol in profile['stocks']:\n print symbol\n stock_info = ys.get_all(symbol)\n print stock_info\n current_out = symbol + \" Current Price is \" + stock_info[... | [
"0.6446082",
"0.6064416",
"0.58562076",
"0.5731274",
"0.5679771",
"0.56551915",
"0.56509995",
"0.5433896",
"0.5427276",
"0.5418267",
"0.5416561",
"0.53897613",
"0.5357206",
"0.5336395",
"0.5328035",
"0.5324772",
"0.52904373",
"0.5286274",
"0.5283608",
"0.5273834",
"0.52720124... | 0.6076654 | 1 |
Asynchronously sends an email. | def send_mail(email):
return email.send() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_async_email(self, msg):\n with app.app_context():\n result = mail.send(msg)\n print result",
"async def send_async(message: Message,\n smtp_url: str,\n timeout: Optional[float] = None) -> None:\n await aiosmtplib.send(message.as_mim... | [
"0.805142",
"0.7082899",
"0.69788533",
"0.6903616",
"0.6663209",
"0.6635336",
"0.65764534",
"0.6436717",
"0.6432856",
"0.6255557",
"0.6238951",
"0.620998",
"0.61682665",
"0.6115785",
"0.6109997",
"0.6098291",
"0.6079861",
"0.6077377",
"0.6065762",
"0.605886",
"0.6035348",
"... | 0.71749014 | 1 |
Returns the table ref of this data source | def table_ref(self):
return self._table_ref | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table(self):\n return self.reference.table",
"def get_tablename(self):\n return self.ds_table",
"def _get_table(self):\n\t\treturn self._table",
"def getTable(self):\n return self.table",
"def table(self):\n return self._table_name",
"def table_reference(self) -> 'outputs.... | [
"0.80259466",
"0.7685921",
"0.74390745",
"0.7402559",
"0.7323773",
"0.730483",
"0.72898585",
"0.72898585",
"0.72102654",
"0.7203599",
"0.71419007",
"0.7136916",
"0.7059128",
"0.6891377",
"0.68354404",
"0.6753009",
"0.67144763",
"0.6667032",
"0.658848",
"0.6525942",
"0.6496132... | 0.80833095 | 0 |
Sets the table ref of this data source | def table_ref(self, table_ref):
self._table_ref = table_ref | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table(self, table):\n self._table = table",
"def table(self, table):\n self._table = table",
"def table(self, table):\n self._table = table\n return self",
"def set_tablename(self, name):\n self.ds_table = name",
"def setTable(self, tabledef):\n if isinstance(t... | [
"0.739735",
"0.739735",
"0.7211746",
"0.7137724",
"0.7083364",
"0.66676944",
"0.65916336",
"0.6471779",
"0.64186233",
"0.6321501",
"0.61828244",
"0.6096648",
"0.606003",
"0.58967596",
"0.58615065",
"0.5810949",
"0.57010216",
"0.56777436",
"0.56641984",
"0.5638385",
"0.562644"... | 0.82613385 | 0 |
Creates a HiveOptions from a protobuf representation of a hive option | def from_proto(cls, hive_options_proto: Any):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pacbio_legacy_option_from_dict(d):\n warnings.warn(\n \"This is obsolete and will disappear soon\",\n DeprecationWarning)\n\n opt_id = d['pb_option']['option_id']\n name = d['pb_option']['name']\n default = d['pb_option']['default']\n desc = d['pb_option']['description']\n opti... | [
"0.61288893",
"0.5841968",
"0.5561387",
"0.541132",
"0.5346837",
"0.53381705",
"0.52984047",
"0.5268845",
"0.52168745",
"0.51290756",
"0.5099677",
"0.5046146",
"0.50235265",
"0.5022524",
"0.50158",
"0.49905807",
"0.49835107",
"0.49617806",
"0.49509934",
"0.49315557",
"0.49299... | 0.7752231 | 0 |
Returns the hive options of this data source | def hive_options(self):
return self._hive_options | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hive_options(self, hive_options):\n self._hive_options = hive_options",
"def get_options(self):\n\t\treturn self.options",
"def options(self):\r\n return self._options",
"def options(self):\n return self._options",
"def options(self):\n return self._options",
"def options(self... | [
"0.6753955",
"0.64224505",
"0.6406258",
"0.6329274",
"0.6329274",
"0.6329274",
"0.6329274",
"0.6329274",
"0.6297048",
"0.62957364",
"0.6286461",
"0.6261513",
"0.6254374",
"0.6164323",
"0.6094738",
"0.60717124",
"0.60363626",
"0.59543324",
"0.5833424",
"0.58288234",
"0.5753857... | 0.8826298 | 0 |
Read dataset file and assigns dataframe object to _df | def read_csv(self) -> None:
self._df = pd.read_csv(self._dataset_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_from_file(filename):\r\n df = pd.read_csv(filename)\r\n return df",
"def load_file(self):\n\n self.df = self.sqlContext.read.csv(self.source, sep=self.sep, header=True, inferSchema=True)",
"def __init__(self, file_path: str):\n self._data: pd.DataFrame = self.read_input_and_s... | [
"0.73519945",
"0.71827435",
"0.7137628",
"0.71346796",
"0.7073277",
"0.7056249",
"0.7042096",
"0.7015911",
"0.6976835",
"0.69308776",
"0.6821296",
"0.6812685",
"0.6812685",
"0.6812685",
"0.67467344",
"0.6741589",
"0.67386633",
"0.6737851",
"0.6723442",
"0.669246",
"0.6677787"... | 0.7191624 | 1 |
Add performance metrics to database | def add_metrics_to_db(self) -> None:
model = {
'id': 'model1',
'name': 'Housing Price Prediction',
'metrics': {
'mean_squared_error': mean_squared_error(self._y_test, self._predictions),
'mean_absolute_error': mean_absolute_error(self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _upsert_ad_performance(ad_insights: [adsinsights.AdsInsights], con: sqlite3.Connection):\n con.execute(\"\"\"\nCREATE TABLE IF NOT EXISTS ad_performance (\n date DATE NOT NULL,\n ad_id BIGINT NOT NULL,\n device TEXT NOT NULL,\n performance TEXT NOT NULL,\n PRIMARY KEY (a... | [
"0.6532678",
"0.6473024",
"0.6408329",
"0.62970644",
"0.6142278",
"0.6128735",
"0.60779417",
"0.60430735",
"0.5946224",
"0.5942702",
"0.58619076",
"0.57984644",
"0.57819676",
"0.57261676",
"0.5714961",
"0.5689637",
"0.56649697",
"0.56607974",
"0.5641271",
"0.56071305",
"0.560... | 0.6575922 | 0 |
Activation Layer Factory Fetching activation layers by name with this function allows export or torch script friendly functions to be returned dynamically based on current config. | def get_act_layer(name: Union[Type[nn.Module], str] = 'relu'):
if not name:
return None
if not isinstance(name, str):
# callable, module, etc
return name
if not (is_no_jit() or is_exportable() or is_scriptable()):
if name in _ACT_LAYER_ME:
return _ACT_LAYER_ME[nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_activation_by_name(name: str) -> Any:\n\n methods = {\n \"elu\": nn.ELU,\n \"hardshrink\": nn.Hardshrink,\n \"hardtanh\": nn.Hardtanh,\n \"leakyrelu\": nn.LeakyReLU,\n \"logsigmoid\": nn.LogSigmoid,\n \"prelu\": nn.PReLU,\n \"relu\": nn.ReLU,\n \"r... | [
"0.7152628",
"0.70717144",
"0.6963733",
"0.6800435",
"0.6777995",
"0.6755335",
"0.67358005",
"0.6719022",
"0.65349716",
"0.6503413",
"0.6461656",
"0.6411131",
"0.6332975",
"0.6296324",
"0.61543286",
"0.6150409",
"0.61462146",
"0.61194414",
"0.6103528",
"0.60810024",
"0.602140... | 0.7186623 | 0 |
This function will create kgram shingles of the given list of documents These shingle will be mapped to an integer starting from 0 upto the amount of unique shingles1 | def create_shingles(data, k):
shingle_dict = dict()
new_shingle_data = list()
counter = 0
for row in data:
rowLen = len(row)
dataSet = set()
for i in range(rowLen):
shingle = ""
end = False
for j in range(i, i+k):
if j < rowLen:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def computeShingles(q, document):\n shingles = []\n for i in range(len(document) - q + 1):\n shingle = \"\"\n for j in range(i,i+q):\n shingle += document[j]\n shingles.append(shingle)\n return shingles",
"def generate_shingles(input_path, output_path, w=3):\n j = 0\n ... | [
"0.67824256",
"0.6367405",
"0.5835742",
"0.5742281",
"0.5741155",
"0.5707629",
"0.56785816",
"0.56361556",
"0.56329596",
"0.5627037",
"0.5607358",
"0.5552314",
"0.5540847",
"0.5519311",
"0.54999167",
"0.5490055",
"0.5477467",
"0.5469412",
"0.5448132",
"0.5428961",
"0.5425567"... | 0.66990095 | 1 |
Return a list of fastq files for a sample | def get_fastq_files(wildcards):
return expand(os.path.join(fastq_dir, "{sample}_{readpair}.fastq"), readpair=[1, 2], **wildcards) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fastqc_files(sample, unit, pairs, config, pre):\n if config[\"preprocessing\"][\"fastqc\"]:\n files = expand(config[\"paths\"][\"results\"]+\"/intermediate/fastqc/{sample}_{unit}_{pair}{PREPROCESS}_fastqc.zip\",\n sample=sample, unit=unit, pair=pairs, PREPROCESS=pre)\n ... | [
"0.7235477",
"0.69955313",
"0.694868",
"0.6912009",
"0.68494976",
"0.68432003",
"0.67609453",
"0.6671568",
"0.6637574",
"0.66306156",
"0.6463436",
"0.63523906",
"0.6314824",
"0.62729365",
"0.62422514",
"0.62312776",
"0.61750907",
"0.61349267",
"0.61219597",
"0.61131996",
"0.6... | 0.74324495 | 0 |
Manually add a connection to the given host to the manager. | def add(self, host, auth, conn):
self.conns[(host, auth)] = conn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, host, **kwargs):\n self.configs_[0][1].add(host, **kwargs)",
"def connect(self, host):\n if not self.app.connect(host):\n command = \"Connect({0})\".format(host).encode(\"utf-8\")\n self.exec_command(command)\n self.last_host = host",
"def put_http_conne... | [
"0.6808785",
"0.6553107",
"0.64744145",
"0.63056237",
"0.628429",
"0.6277616",
"0.6277616",
"0.6277616",
"0.6277616",
"0.6183404",
"0.61097676",
"0.6090129",
"0.60137916",
"0.59971344",
"0.5995894",
"0.5946697",
"0.59274036",
"0.5888396",
"0.58841246",
"0.58552635",
"0.578421... | 0.7374451 | 0 |
Add a connection hook to call to establish new connections. | def add_conn_hook(self, hook):
self._conn_hooks.append(hook) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_connect(self):\n pass",
"def __setup_conn__(self, **kwargs):\n self.ext_conn = setup_conn(**kwargs)",
"def add_connection(self, connection):\n self.connections.append(connection)",
"def install_connection(connection):\n global _connection\n _connection = connection",
"... | [
"0.6542846",
"0.63578016",
"0.62390274",
"0.6225715",
"0.62094665",
"0.6207269",
"0.61733675",
"0.6155529",
"0.613016",
"0.6120211",
"0.6120178",
"0.60572773",
"0.6049189",
"0.6049189",
"0.6049189",
"0.60206264",
"0.6017511",
"0.5992856",
"0.59708303",
"0.59135336",
"0.588404... | 0.8143728 | 0 |
Drop all connection hooks. | def clear_hooks(self):
self._conn_hooks = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dropConnection(): #@NoSelf",
"def _shutdown(self):\n self.logger.debug(\"Unregistering feature modules.\")\n for feature in self._features.values():\n try:\n if hasattr(feature.handle, \"module_unregister\"):\n self.eventloop.run_until_complete(feat... | [
"0.68577594",
"0.6616656",
"0.66142684",
"0.65215844",
"0.6480401",
"0.64762944",
"0.64350116",
"0.64162797",
"0.6381791",
"0.63806885",
"0.63268006",
"0.6322851",
"0.6251294",
"0.6248939",
"0.62343895",
"0.62227136",
"0.6218636",
"0.6218636",
"0.6214084",
"0.61898184",
"0.61... | 0.8032567 | 0 |
Find a connection to the given host, trying hooks as needed. | def find(self, host, auth):
key = (host, auth)
if key not in self.conns:
conn = None
hooks = self._conn_hooks or self._default_hooks
for hook in hooks:
conn = hook.connect(host, auth)
if conn:
logger.info("Establishe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _search_connection(self, host, login, passwd, conn):\n self._connections_lock.acquireRead()\n try:\n if (host in self._connections):\n connections = self._connections[host]\n\n for connection in connections:\n if (connection.login == log... | [
"0.6699842",
"0.6128602",
"0.6030898",
"0.585696",
"0.58262634",
"0.57517755",
"0.57059544",
"0.563675",
"0.56287616",
"0.5608209",
"0.5578952",
"0.5518781",
"0.5487876",
"0.5470335",
"0.5441373",
"0.5431511",
"0.5421753",
"0.54134536",
"0.540528",
"0.5404659",
"0.53588086",
... | 0.7668413 | 0 |
Returns a fully qualified URL given a URI. | def get_url(self, uri):
# TODO make this a prepend_if_needed type method
return urllib.parse.urljoin(self.hostname, uri) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getQualifiedURL(uri = None):\n schema, stdport = ('http', '80')\n host = os.environ.get('HTTP_HOST')\n if not host:\n host = os.environ.get('SERVER_NAME')\n port = os.environ.get('SERVER_PORT', '80')\n if port != stdport: host = host + \":\" + port\n result = \"%s://%s\" % (sch... | [
"0.7353941",
"0.69257873",
"0.6902368",
"0.68242913",
"0.64607567",
"0.64334136",
"0.63883835",
"0.6377446",
"0.6356064",
"0.6309383",
"0.6280118",
"0.62178695",
"0.6212839",
"0.61945224",
"0.61942387",
"0.6174435",
"0.61667067",
"0.6149685",
"0.609751",
"0.6057507",
"0.60546... | 0.7861528 | 0 |
Read the "fof_special_particles" files and return an array of the positions of each particles belonging to a group. | def read_groups_particles(filename):
f = open(filename,'r')
Ntot = fromstring(f.read(4),int32)[0]
Pos = fromstring(f.read(3*4*Ntot),float32)
Pos.shape = (Ntot,3)
f.close()
return Pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_txt_particles(particles_file, refpart, real_particles, bucket_length, comm, madx_format, verbose):\r\n \r\n four_momentum = refpart.get_four_momentum()\r\n pmass = four_momentum.get_mass()\r\n E_0 = four_momentum.get_total_energy()\r\n p0c = four_momentum.get_momentum()\r\n\r\n myrank = ... | [
"0.6557702",
"0.6279666",
"0.5980885",
"0.59802526",
"0.5884605",
"0.58215463",
"0.5802813",
"0.57792974",
"0.57417893",
"0.57334733",
"0.56957585",
"0.5649068",
"0.5588368",
"0.5572744",
"0.5500945",
"0.54789186",
"0.54614913",
"0.54000187",
"0.53840524",
"0.53737193",
"0.53... | 0.75867194 | 0 |
Returns the parsed IPP message in a readable form. | def __str__(self) :
if not self.parsed :
return ""
mybuffer = []
mybuffer.append("IPP version : %s.%s" % self.version)
mybuffer.append("IPP operation Id : 0x%04x" % self.operation_id)
mybuffer.append("IPP request Id : 0x%08x" % self.request_id)
for attrtype in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_message(self):\n if self.__eof:\n return None\n result = {}\n line = sys.stdin.readline()\n while line == '\\n':\n line = sys.stdin.readline()\n if not line:\n self.__eof = True\n return None\n s = line.split(\" \", 1)\... | [
"0.60272247",
"0.5938139",
"0.58673644",
"0.58623207",
"0.5761721",
"0.5755809",
"0.5738192",
"0.57289153",
"0.5727499",
"0.5727499",
"0.5700545",
"0.5665022",
"0.5658874",
"0.55902284",
"0.5564594",
"0.556166",
"0.5557055",
"0.5533912",
"0.55286163",
"0.55037266",
"0.5503726... | 0.62728494 | 0 |
Sets the request's operation id. | def setOperationId(self, opid) :
self.operation_id = opid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_id(self, request_id):\n\n self._request_id = request_id",
"def request_id(self, request_id):\n\n self._request_id = request_id",
"def request_id(self, request_id):\n\n self._request_id = request_id",
"def set_operation(self, operation):\n self._data_dict[self.OP_GID] =... | [
"0.6570105",
"0.6570105",
"0.6570105",
"0.6405243",
"0.63805985",
"0.6355321",
"0.6242067",
"0.5786017",
"0.5701327",
"0.5701327",
"0.5689727",
"0.56761694",
"0.565457",
"0.5503637",
"0.5461634",
"0.53911835",
"0.53881204",
"0.538676",
"0.5347063",
"0.53353757",
"0.53325474",... | 0.80629724 | 0 |
Indicates that the parser enters into an operationattributestag group. | def operation_attributes_tag(self) :
self._curattributes = self._operation_attributes
return self.parseTag() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attrControlGrp(*args, annotation: Union[AnyStr, bool]=\"\", attribute: Union[name, bool]=None,\n changeCommand: Union[Script, bool]=None, enable: bool=True, exists:\n bool=True, handlesAttribute: Union[name, bool]=None, hideMapButton:\n bool=True, label: Un... | [
"0.51638806",
"0.4936743",
"0.48911783",
"0.48018166",
"0.47010294",
"0.46412504",
"0.46040428",
"0.45955312",
"0.45861644",
"0.45599842",
"0.4545363",
"0.45116305",
"0.44554913",
"0.44155097",
"0.44143426",
"0.43964836",
"0.43932542",
"0.43922263",
"0.4387848",
"0.43646452",
... | 0.599768 | 0 |
Indicates that the parser enters into a printerattributestag group. | def printer_attributes_tag(self) :
self._curattributes = self._printer_attributes
return self.parseTag() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unknown_starttag(self, tag, attrs):\n if tag in self.valid_tags:\n self.result.append('<' + tag)\n for k, v in attrs:\n if string.lower(k[0:2]) != 'on' and",
"def enter_group():\n logline(\"\\\\\", indent=False)\n global... | [
"0.4925782",
"0.49084425",
"0.47429618",
"0.47403184",
"0.47209662",
"0.47065154",
"0.46375936",
"0.46353352",
"0.45543104",
"0.45409465",
"0.45381525",
"0.4515491",
"0.44930646",
"0.44930646",
"0.44722897",
"0.44514444",
"0.44369882",
"0.44209164",
"0.44116554",
"0.44032434",
... | 0.56767845 | 0 |
Indicates that the parser enters into an unsupportedattributestag group. | def unsupported_attributes_tag(self) :
self._curattributes = self._unsupported_attributes
return self.parseTag() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unknown_starttag(self, tag, attrs):\n if tag in self.valid_tags:\n self.result.append('<' + tag)\n for k, v in attrs:\n if string.lower(k[0:2]) != 'on' and",
"def test_fetchParserUnknownAttribute(self):\n p = imap4._Fet... | [
"0.5917786",
"0.5775716",
"0.56351364",
"0.5381743",
"0.53326553",
"0.5275372",
"0.5197594",
"0.5179682",
"0.5155139",
"0.509307",
"0.5074497",
"0.5070778",
"0.5019276",
"0.49966884",
"0.49966884",
"0.49716008",
"0.4971445",
"0.49685493",
"0.49527672",
"0.49197876",
"0.491650... | 0.70035094 | 0 |
Indicates that the parser enters into a subscriptionattributestag group. | def subscription_attributes_tag(self) :
self._curattributes = self._subscription_attributes
return self.parseTag() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __on_group_created(self, logger, *args):",
"def on_subscribe( client, userdata, mid, granted_qos ):\n logging.info( \"Topic successfully subcribed with QoS: %s\" %granted_qos )",
"def log_group_arn(self) -> str:\n ...",
"def process(self, event):\n matchgroups = {}\n try:\n ... | [
"0.5545517",
"0.48461246",
"0.47890064",
"0.4731607",
"0.46983153",
"0.4677109",
"0.4675229",
"0.4673879",
"0.46679845",
"0.4644136",
"0.4639828",
"0.4598391",
"0.4586624",
"0.4523136",
"0.45071408",
"0.45024773",
"0.4499094",
"0.4495115",
"0.4495115",
"0.4495115",
"0.4485821... | 0.53500694 | 1 |
Indicates that the parser enters into an eventnotificationattributestag group. | def event_notification_attributes_tag(self) :
self._curattributes = self._event_notification_attributes
return self.parseTag() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __on_group_created(self, logger, *args):",
"def unknown_starttag(self, tag, attrs):\n if tag in self.valid_tags:\n self.result.append('<' + tag)\n for k, v in attrs:\n if string.lower(k[0:2]) != 'on' and",
"def visit_event(s... | [
"0.53819436",
"0.49599183",
"0.49296498",
"0.4853252",
"0.48404688",
"0.48267183",
"0.4818338",
"0.48151654",
"0.47872686",
"0.47819456",
"0.47710592",
"0.47700667",
"0.47468475",
"0.47368065",
"0.4735554",
"0.47104743",
"0.46678525",
"0.466398",
"0.4663215",
"0.46572715",
"0... | 0.59145147 | 0 |
Lager statistikk over antall lenker og utbredelse til NVDB stedfesting | def veglenkestatistikk( stedfesting ):
antall_stedfestingelementer = len( stedfesting )
utbredelse = None
unike_veglenker = None
if 'type' in stedfesting[0]:
if stedfesting[0]['type'] == 'Linje':
utbredelse = sum( [ k['sluttposisjon']-k['startposisjon'] for k in stedfestin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query3() :",
"def update_vluln_table():",
"def ustvari(self):\n raise NotImplementedError",
"def get_total_stateless(db):\n pass",
"def stats(self):",
"def overheadstats(sdb, obsdate, update=True):\n bvs_updated = 0\n scams=0\n #for a given obsdate get the night info\n nid=getnighti... | [
"0.57543916",
"0.55784565",
"0.55619425",
"0.5497133",
"0.54629505",
"0.5411191",
"0.5397337",
"0.52770716",
"0.524446",
"0.52380294",
"0.5190501",
"0.51876616",
"0.5183608",
"0.5163349",
"0.5152543",
"0.51474845",
"0.5139914",
"0.50777394",
"0.5056625",
"0.50381786",
"0.5028... | 0.6221996 | 0 |
Using eigen value decomposition (eigendecomposition) for dimensionality reduction. Outputs the components that explain X% of the variance in the data. (X% is the quality_percent). TAKES TOO MUCH TIME, BECAUSE OF THE COVARIANCE MATRIX. | def fit_evd(self):
# EVD only work on square matrices as we need to compute the eigenvalues and eigenvectors
# For this we compute the covariance matrix K
# K should be n x n matrix (pixels x pixels)
# The covariance matrix is nxn
self.cov_matrix = np.zeros(shape=[self.n_featur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eigen_decomposition(X, features):\n # Center to average\n Xctr = X - X.mean(0)\n # covariance matrix\n Xcov = np.cov(Xctr.T)\n\n # Compute eigenvalues and eigenvectors\n eigen_values, eigen_vectors = sp.linalg.eigh(Xcov)\n\n # Sort the eigenvalues and the eigenvectors descending\n sorte... | [
"0.65321",
"0.6287839",
"0.6122023",
"0.6052969",
"0.60071176",
"0.5969323",
"0.58543324",
"0.5676435",
"0.5669116",
"0.56286806",
"0.5590691",
"0.55898774",
"0.5563641",
"0.5545428",
"0.5533987",
"0.5528895",
"0.5517526",
"0.54985064",
"0.54313755",
"0.5378376",
"0.5334669",... | 0.68186647 | 0 |
Dimensionality reduction using singular value decomposition (SVD). Outputs the components that explain X% of the variance in the data. (X% is the quality_percent) | def fit_svd(self):
# U has the eigenvectors of G.Gt as columns ()
# S has square roots of the eigenvalues of G.Gt and Gt.G in its diagonal
# The square roos of the eigenvalues are called singular values
# V has the eigenvectors of Gt.G as columns ()
# full_matrices set to false ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def svd(self, X): # [5pts]\n N,D = X.shape[0],X.shape[1]\n if X.ndim == 3:\n U = np.zeros((N,N,3))\n S = np.zeros((min(N,D),3))\n V = np.zeros((D,D,3))\n for i in range(3):\n U_temp,S_temp,V_temp = np.linalg.svd(X[:,:,i],compute_uv=True, full... | [
"0.69040626",
"0.68697",
"0.6656673",
"0.6501096",
"0.6389488",
"0.6386059",
"0.6347023",
"0.6329251",
"0.6273901",
"0.62269294",
"0.62042505",
"0.61884207",
"0.61802185",
"0.61400044",
"0.6100364",
"0.605698",
"0.6007152",
"0.6001164",
"0.598117",
"0.5975402",
"0.5959942",
... | 0.70182264 | 0 |
Parse content and metadata of .yml files | def read(self, source_path):
content = None
metadata = dict()
self._source_path = source_path
with pelican_open(source_path) as text:
metadata = yaml.load(text)
# Turn these into expected objects
# 'author': pelican.urlwrappers.Author object
if 'auth... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_yamls(folder):\n for item in iglob(folder + \"/*.yaml\"):\n data_file = os.path.join(folder, item)\n data = yaml.load(open(data_file))\n load_data(data)",
"def parse(file_contents, file_name):\n\n try:\n yaml.load(file_contents)\n except Exception:\n\n _, e... | [
"0.63108075",
"0.61328685",
"0.6085054",
"0.60793495",
"0.6052815",
"0.6027979",
"0.5993412",
"0.5960239",
"0.591337",
"0.59100944",
"0.590964",
"0.58585054",
"0.584181",
"0.5835282",
"0.58184296",
"0.57883096",
"0.5787211",
"0.573365",
"0.5728019",
"0.5714711",
"0.5706502",
... | 0.6347969 | 0 |
Called when the Readers instance has parsed the READERS settings. Associate all Markdown file extensions with the MarkdownExtReader. | def on_readers_init(readers):
for fmt in MarkdownExtReader.file_extensions:
readers.reader_classes[fmt] = MarkdownExtReader | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def registerExtensions(self, extensions, configs):\n for ext in extensions:\n try:\n if isinstance(ext, util.string_type):\n ext = self.build_extension(ext, configs.get(ext, []))\n if isinstance(ext, Extension):\n ext.extendMarkd... | [
"0.5789195",
"0.5561572",
"0.5184722",
"0.5121114",
"0.5109936",
"0.51069635",
"0.506897",
"0.5020507",
"0.4993649",
"0.49655452",
"0.49195173",
"0.4918681",
"0.4900654",
"0.48862994",
"0.48733476",
"0.48583728",
"0.4821897",
"0.48209038",
"0.47776324",
"0.47749218",
"0.47437... | 0.8195992 | 0 |
Generates a pandas dataframe with scraped comments and replies data. Will concatenate replies with comments | def comment_data(post_id: str,
sub_reddit: str):
url_to_open = f"https://www.reddit.com/r/{sub_reddit}/comments/{post_id}.json"
success_status = 0
while success_status != 200:
try:
response = urlopen(url_to_open, timeout=10)
success_status = response.status
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_comments(**kwargs):\r\n\r\n # Log in to get cookies.\r\n cookies = _login(**kwargs)\r\n\r\n if 'r' not in kwargs:\r\n # This is the first comments request.\r\n # Make the comments request and set an empty list.\r\n kwargs['r'] = requests.get('https://news.ycombinator.com/thre... | [
"0.6028869",
"0.59971136",
"0.594456",
"0.59385234",
"0.592934",
"0.5916526",
"0.5916526",
"0.5870459",
"0.58392066",
"0.58221716",
"0.5795665",
"0.5788009",
"0.57595724",
"0.5736693",
"0.5731914",
"0.5636468",
"0.56259465",
"0.56077534",
"0.5583711",
"0.5546369",
"0.552571",... | 0.6636042 | 0 |
The identity block is the block that has no ConvGRU layer at shortcut. Arguments | def identity_block(input_tensor, kernel_size, filters, stage, block):
filters1, filters2, filters3 = filters
if K.image_data_format() == 'channels_last':
bn_axis = 3
else:
bn_axis = 1
conv_name_base = 'res' + str(stage) + block + '_branch'
bn_name_base = 'bn' + str(stage) + block + '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_block(self,X,stage,block):\n conv_name_base='res'+str(stage)+block+'_branch'\n bn_name_base='bn'+str(stage)+block+'_branch'\n \n #retrieve the filters\n #F1,F2,F3=filters\n \n X_shortcut=X\n \n #first component of main path\n X=Conv... | [
"0.7053969",
"0.6951196",
"0.69148076",
"0.69123244",
"0.69026166",
"0.6895569",
"0.68718547",
"0.68239397",
"0.67982614",
"0.6778847",
"0.6770707",
"0.6738197",
"0.67351675",
"0.67298466",
"0.67144144",
"0.67034507",
"0.67034507",
"0.66972566",
"0.6693836",
"0.66613907",
"0.... | 0.7369076 | 0 |
CallChangeOption Helper function used to call Config.ChangeOption. | def CallChangeOption(event, option, val, IdRange=0):
Config.ChangeOption(option, val, IdRange) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cb_config(data, option, value):\n option_name = option.split(\".\")[-1]\n if option_name in vimode_settings:\n vimode_settings[option_name] = value\n return weechat.WEECHAT_RC_OK",
"def __call__(self, givenEvent):\n return self._options[givenEvent]()",
"def config_option(func):\n\n ... | [
"0.5770124",
"0.56601584",
"0.5591877",
"0.54953575",
"0.541492",
"0.5305409",
"0.52639145",
"0.524375",
"0.5221593",
"0.51719373",
"0.51574725",
"0.5091422",
"0.5087586",
"0.502432",
"0.5001329",
"0.49955308",
"0.4986194",
"0.49639228",
"0.49518788",
"0.49281865",
"0.4927516... | 0.8534425 | 0 |
CallChangeColorFile Used to call ChangeColorFile | def CallChangeColorFile(event, item, newcolor):
ChangeColorFile(item, newcolor)
event.Skip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_file_change(op_list_file):\n if os.path.exists(\"flag_change_file.txt\"):\n print(\n \"-----maybe op_file has changed, so don't need to change again------\"\n )\n else:\n run_multi_thread(op_list_file)",
"def setColorDiffuse(*args):",
"def _color(self, args):",
"... | [
"0.5624063",
"0.5616077",
"0.55919427",
"0.5476601",
"0.5475762",
"0.546004",
"0.54469645",
"0.54314727",
"0.5325275",
"0.5319817",
"0.5314164",
"0.5309682",
"0.53093964",
"0.52945733",
"0.52685404",
"0.5266808",
"0.5259466",
"0.52457315",
"0.524514",
"0.52394056",
"0.5238474... | 0.82037705 | 0 |
ToggleSpinner Disables or enables the suplied widget depending on the arguments. | def ToggleSpinner(event, state, widget):
if state == True:
widget.Enable()
else:
widget.Disable()
event.Skip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle(self):\n if self.is_enabled:\n self.disable()\n else:\n self.enable()",
"def getSpinControl(*args):",
"def toggle(self, **kwargs):\n self.on = False if self.on else True",
"def spin(self):\n spinner = self._spinner_dict.get(self._current_gui, lambd... | [
"0.60068536",
"0.5711606",
"0.5626328",
"0.559918",
"0.5583677",
"0.55804306",
"0.55801517",
"0.5556936",
"0.5454728",
"0.5453252",
"0.54468673",
"0.54066956",
"0.5290974",
"0.5263952",
"0.5262461",
"0.5248748",
"0.5246615",
"0.5209481",
"0.5189879",
"0.5189879",
"0.5099715",... | 0.82428086 | 0 |
ShowMe Makes window visible. | def ShowMe(self, event):
self.Show(True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_window(self):\n self.show()",
"def show(self):\n self._window.show()",
"def show(self, window):\r\n\r\n return",
"def show(self):\n self.wid.show()",
"def show_window(self):\n self._window.grab_set()\n self._window.wait_window()",
"def show(self):\n ... | [
"0.78528696",
"0.7491415",
"0.734914",
"0.72472316",
"0.7217072",
"0.7105373",
"0.709106",
"0.70552",
"0.6812878",
"0.68034613",
"0.6783857",
"0.67171425",
"0.66291493",
"0.66144276",
"0.65156806",
"0.65005463",
"0.6489242",
"0.6466619",
"0.6453149",
"0.6444627",
"0.6414573",... | 0.7963508 | 0 |
HideMe Hides the window. | def HideMe(self, event):
self.Hide() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide (self):\n \n self.top.withdraw()",
"def hide(self):\n\n self.stop_repl()\n self.visible = False\n self.withdraw() # Hide window",
"def hideWindow(*args, **kwargs):\n\targs[0].hide()\n\treturn True # Prevents windows from being destroyed",
"def hide_gui():\n ... | [
"0.7509359",
"0.74262136",
"0.74119747",
"0.7347229",
"0.7313304",
"0.7259042",
"0.72342604",
"0.72129107",
"0.712137",
"0.71150166",
"0.70670795",
"0.695298",
"0.695298",
"0.69347274",
"0.69264334",
"0.68977106",
"0.6878487",
"0.6852868",
"0.68457806",
"0.68457806",
"0.66689... | 0.8016458 | 0 |
viewLog Creates child class and the required controls to view the log file. | def viewLog(self, event):
logcontent = ""
if Config.GetOption("ActLog") == True:
logFrame = wx.Frame(None, -1, "View Log", size=(500, 500))
panel5 = wx.Panel(logFrame)
data = wx.richtext.RichTextCtrl(panel5, pos=(0, 0), size=(500,
500))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onViewLog(self):\n view_log.ViewLog(self.root, self.log)",
"def __init__(self, log):\n self.log = log\n self.logger = logging.getLogger(self.__class__.__name__)",
"def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.log = logging.getLogger(logg... | [
"0.7140692",
"0.6262259",
"0.6205708",
"0.6183581",
"0.6140777",
"0.6120262",
"0.6110456",
"0.6074646",
"0.6068381",
"0.5992768",
"0.59753233",
"0.59445345",
"0.5932987",
"0.59261584",
"0.5916817",
"0.5870651",
"0.5854801",
"0.582109",
"0.5819214",
"0.57651544",
"0.57493365",... | 0.6518171 | 1 |
Adds an unique index to a table | def alterTableAddUnique(database: str, table: str, indexName: str, columns: list) -> int:
bd = _database(database)
if bd:
tb = _table(database, table)
if tb:
tb["unique_index"].insert([indexName, table, columns])
return 0
else:
return 3
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_table_indexes(collection) -> None:\n # Unique ticker event ID\n collection.create_index('data.u', unique=True)\n # The symbol, e.g. BTCUSDT\n collection.create_index('data.s')\n # The time for sorting.\n collection.create_index('time')",
"def create_index(self, indexname, table, colu... | [
"0.6950932",
"0.66842467",
"0.667532",
"0.6672381",
"0.6609532",
"0.6567683",
"0.63993394",
"0.63612676",
"0.6354538",
"0.6333292",
"0.6333292",
"0.632288",
"0.6283021",
"0.62678844",
"0.6257337",
"0.62452674",
"0.6228201",
"0.61746067",
"0.6142951",
"0.60947925",
"0.602906",... | 0.70561254 | 0 |
Changes a database encoding | def alterDatabaseEncoding(database: str, encoding: str) -> int:
bd = _database(database)
if bd:
if encoding not in ["utf8", "ascii", "iso-8859-1"]:
return 3
else:
bd["encoding"] = encoding
try:
table = bd["tablas"]
for t in ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_encoding(self, encoding):\n\n self._encoding = encoding",
"def setEncoding(self,value):\n self.PDFreactorConfiguration.in1[\"encoding\"] = value",
"def encoding(self, enc):\n self._encoding = enc",
"def setEncoding(self, value):\n return self._set(encoding=value)",
"def chan... | [
"0.67461425",
"0.64060473",
"0.634873",
"0.623026",
"0.619429",
"0.61455333",
"0.6030758",
"0.5986381",
"0.5978252",
"0.59553367",
"0.5942807",
"0.5934476",
"0.5905521",
"0.5881358",
"0.5742639",
"0.5733933",
"0.5719861",
"0.56561494",
"0.5630939",
"0.562058",
"0.5567001",
... | 0.78333086 | 0 |
Generates a database checksum | def checksumDatabase(database: str, mode: str) -> str:
bd = _database(database)
if bd:
if mode not in ["MD5", "SHA256"]:
return None
return ch.checksumDatabase(database,mode)
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checksumTable(database: str, table: str, mode: str) -> str:\n\n bd = _database(database)\n\n if bd:\n\n tb = _table(database, table)\n\n if tb:\n\n if mode not in [\"MD5\", \"SHA256\"]:\n return None \n\n return ch.checksumTable(database, tabl... | [
"0.66937816",
"0.6190386",
"0.61403894",
"0.60973465",
"0.60893285",
"0.6068533",
"0.60548466",
"0.5977226",
"0.5915417",
"0.59037364",
"0.589102",
"0.58852303",
"0.58622736",
"0.58616817",
"0.5835881",
"0.5829948",
"0.5826346",
"0.57996047",
"0.5776036",
"0.5759001",
"0.5728... | 0.7103147 | 0 |
Generates a table checksum | def checksumTable(database: str, table: str, mode: str) -> str:
bd = _database(database)
if bd:
tb = _table(database, table)
if tb:
if mode not in ["MD5", "SHA256"]:
return None
return ch.checksumTable(database, table, mode)
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checksum_full_table(self):\n # Calculate checksum for old table\n old_checksum = self.query(\n sql.checksum_full_table(self.table_name, self._old_table.column_list)\n )\n\n # Calculate checksum for new table\n new_checksum = self.query(\n sql.checksum_fu... | [
"0.64989996",
"0.6389361",
"0.60043424",
"0.5984078",
"0.5979633",
"0.5943067",
"0.59368956",
"0.5757987",
"0.574514",
"0.57429785",
"0.5741921",
"0.5712693",
"0.566631",
"0.56360173",
"0.5609682",
"0.5606184",
"0.5592736",
"0.5590365",
"0.5528552",
"0.5523038",
"0.55114263",... | 0.6832998 | 0 |
Enables safe mode for a table in a database | def safeModeOn(database: str, table: str) -> int:
nombreST = str(database) + '-' + str(table)
if not _database(database):
return 2
if not _table(database, table):
return 3
if BC.EsUnaTablaSegura(nombreST, _main_path):
return 4
try:
BC.CreateBlockChain(nombreST, _ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def safeModeOff(database: str, table: str) -> int:\n\n nombreST = str(database) + '-' + str(table)\n\n if not _database(database):\n return 2\n\n if not _table(database, table):\n return 3\n\n if not BC.EsUnaTablaSegura(nombreST, _main_path):\n return 4\n\n try:\n BC.Dele... | [
"0.6526765",
"0.649856",
"0.649856",
"0.64588463",
"0.6081784",
"0.60203445",
"0.599737",
"0.576383",
"0.57122225",
"0.566805",
"0.56553423",
"0.56194913",
"0.5618057",
"0.55770737",
"0.555558",
"0.55528665",
"0.5505558",
"0.54966724",
"0.5485075",
"0.5333716",
"0.53314537",
... | 0.6587872 | 0 |
Disables safe mode for a table in a database | def safeModeOff(database: str, table: str) -> int:
nombreST = str(database) + '-' + str(table)
if not _database(database):
return 2
if not _table(database, table):
return 3
if not BC.EsUnaTablaSegura(nombreST, _main_path):
return 4
try:
BC.DeleteSafeTable(nombreS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable(mode='soft'):\n Qdb().disable(mode)",
"def allow_syncdb(self, db, model):\n return True",
"def allow_syncdb(self, db, model):\n return True",
"def safeModeOn(database: str, table: str) -> int:\n nombreST = str(database) + '-' + str(table)\n if not _database(database):\n ... | [
"0.6601288",
"0.63316554",
"0.63316554",
"0.62221414",
"0.6210767",
"0.615746",
"0.59436333",
"0.58665496",
"0.5816745",
"0.5745367",
"0.5609925",
"0.5590738",
"0.55830115",
"0.5501912",
"0.5471799",
"0.54703504",
"0.54557586",
"0.54145384",
"0.5412278",
"0.54096645",
"0.5406... | 0.72843796 | 0 |
Convert daily Github issues from mongodb to BigARTM format (UCI Bagofwords) | def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--target-dir", required=True,
help="Directory to store bigARTM files")
parser.add_argument("--start-date", default="2015-12-01",
help="Start date(YYYY-MM-DD) to convert mongodb f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n verbose = False\n online = True\n\n if online:\n TOKEN = \"\"\n g = Github(base_url=\"https://github.ibm.com/api/v3\", login_or_token=TOKEN)\n repo = g.get_repo(\"Raphael-Lambert/test_note\")\n\n path = \"C:/Users/RaphaelLambert/Documents/git_issues\"\n onlyfiles =... | [
"0.5371995",
"0.5351099",
"0.5217168",
"0.5203004",
"0.51921064",
"0.5157592",
"0.50705695",
"0.5066366",
"0.5036247",
"0.4937896",
"0.47906277",
"0.47864658",
"0.47658864",
"0.4753645",
"0.47526726",
"0.47179803",
"0.47064632",
"0.47028103",
"0.46983656",
"0.46869716",
"0.46... | 0.5855663 | 0 |
Run experiment n_pulls times. Updates return Q on each iteration. | def experiment(self, n_pulls: int):
self.N = np.zeros(self.n_arms)
self.Q = np.zeros(self.n_arms)
Q_history = np.array([])
for pull in range(n_pulls):
action = self.get_action(pull)
reward = self.get_reward(action, pull)
Q = self.update_Q(action, rewa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule_pulls():\n for repo in Repository.objects.all():\n # distribute pulls by delaying evenly across an hour\n pk_hash = hashlib.sha256(str(repo.pk).encode())\n delay_s = int(pk_hash.hexdigest(), 16) % (60 * 60)\n\n pull.apply_async(\n args=(repo.remote_id, repo.pr... | [
"0.58870846",
"0.58440375",
"0.5743763",
"0.5656772",
"0.55926",
"0.55351824",
"0.5529241",
"0.5444302",
"0.54419786",
"0.54373276",
"0.5437268",
"0.5400262",
"0.5295067",
"0.5259368",
"0.5251553",
"0.5244251",
"0.5202766",
"0.51938194",
"0.51859874",
"0.51479423",
"0.5139781... | 0.6956549 | 0 |
Wire type" is a part of the "key" that carries enough information to parse value from the wire, i.e. read correct amount of bytes, but there's not enough informaton to interprete in unambiguously. For example, one can't clearly distinguish 64bit fixedsized integers from 64bit floats, signed zigzagencoded varints from r... | def wire_type(self):
if hasattr(self, '_m_wire_type'):
return self._m_wire_type if hasattr(self, '_m_wire_type') else None
self._m_wire_type = self._root.Pair.WireTypes((self.key.value & 7))
return self._m_wire_type if hasattr(self, '_m_wire_type') else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(self):\n return struct.unpack('<B', self.raw_data[0])[0]",
"def pkt_type(self):\n return uint16_packer.unpack(self[32:34])[0]",
"def Type(self, String):\r\n\r\n if (String == \"byte\") or (String == \"sbyte\"):\r\n return 1\r\n elif (String == \"word\") or (Strin... | [
"0.64454204",
"0.6344862",
"0.6177453",
"0.5958382",
"0.5952993",
"0.5889277",
"0.5840352",
"0.5823337",
"0.5787412",
"0.577655",
"0.5731551",
"0.5713418",
"0.56753224",
"0.5661148",
"0.564763",
"0.56469196",
"0.5632343",
"0.56118524",
"0.55602056",
"0.55430776",
"0.55326146"... | 0.6732522 | 0 |
given a userId and BusinessId, this function returns the corresponding review | def get_review(reviews, userId, BusinessId):
reviews = reviews[(reviews['business_id'] == BusinessId) & (reviews['user_id'] == userId)]
if reviews.empty:
return np.nan
elif len(reviews) > 1:
return float(reviews['stars'].max())
else:
return float(reviews['stars']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_reviews():\n print(\"***** Find Reviews of a Business *****\")\n while (True):\n print()\n business_object = query_business_name()\n if business_object == \"back\":\n return\n elif business_object is None:\n continue\n id = business_object['bu... | [
"0.6462504",
"0.63464046",
"0.61958796",
"0.6140048",
"0.6079224",
"0.59808564",
"0.58458614",
"0.5808643",
"0.5693213",
"0.55099154",
"0.5501791",
"0.54506606",
"0.54472685",
"0.5408173",
"0.5311152",
"0.528549",
"0.52852464",
"0.5272833",
"0.52651584",
"0.524855",
"0.523621... | 0.7737348 | 0 |
computes the euclidean similarity | def similarity_euclid(matrix, business1, business2):
selected_features = matrix.loc[business1].notna() & matrix.loc[business2].notna()
if not selected_features.any():
return 0
features1 = matrix.loc[business1][selected_features]
features2 = matrix.loc[business2][selected_features]
distance... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairwise_euclidean_similarity(x, y):\n s = 2 * torch.mm(x, torch.transpose(y, 1, 0))\n diag_x = torch.sum(x * x, dim=-1)\n diag_x = torch.unsqueeze(diag_x, 0)\n diag_y = torch.reshape(torch.sum(y * y, dim=-1), (1, -1))\n\n return s - diag_x - diag_y",
"def euc_dist(self, squared=True):",
"de... | [
"0.7442795",
"0.7366634",
"0.73303705",
"0.72702587",
"0.7191978",
"0.71874243",
"0.7170478",
"0.71292555",
"0.7122205",
"0.71213186",
"0.7113179",
"0.71043175",
"0.7030621",
"0.70219976",
"0.70203394",
"0.70122296",
"0.69272286",
"0.692671",
"0.69088495",
"0.6883007",
"0.682... | 0.74360234 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.