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 |
|---|---|---|---|---|---|---|
Given the normalized RNN outputs (postsoftmax) at each time step and a target labeling, compute the backward variables beta_t(s) as defined in equation 9 in the paper | def compute_backward_variables(self, normalized_logits, target):
target_length = target.shape[0]
num_time_steps = normalized_logits.shape[0]
######################
### YOUR CODE HERE ###
######################
blank_label = normalized_logits.shape[1] - 1
l = add_blanks(target, blank_label)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backwardVariableGeneration(self):\n self.beta = zeros((self.noOfEmmittingStates+2, self.T + 1))\n\n # initialisation\n for j in range(self.noOfEmmittingStates+1):\n self.beta[j,-1] = self.transitionMatrix[j,-1]\n self.beta[-1,-1] = 1.0\n\n # main recursion\n for t in range(self.T, 1, -1)... | [
"0.69956106",
"0.64794415",
"0.64426166",
"0.6405609",
"0.6382755",
"0.62425697",
"0.6233701",
"0.62206537",
"0.6206972",
"0.6171835",
"0.6160794",
"0.6156567",
"0.6151788",
"0.614928",
"0.6116877",
"0.61009604",
"0.61001897",
"0.60951155",
"0.609498",
"0.6073558",
"0.6066956... | 0.7704807 | 0 |
Given the RNN outputs (presoftmax) at each time step and a target labeling, compute the gradients of the CTC loss w.r.t. the unnormalized logits | def compute_gradients(self, logits, target):
target_length = target.shape[0]
num_time_steps = logits.shape[0]
######################
### YOUR CODE HERE ###
######################
# expand labels by inserting a blank between each pair
normalized_logits = softmax(logits)
blank_label = normali... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_ctc_loss(self, logits, target):\n\n num_time_steps = logits.shape[0]\n num_labels = logits.shape[1] - 1\n num_labels_with_blank = num_labels + 1\n\n # sanity check to ensure targets are all right\n assert (target < num_labels).all()\n\n\t\t######################\n\t\t### YOUR CODE HERE #... | [
"0.70471126",
"0.6771997",
"0.6501649",
"0.6481051",
"0.6475507",
"0.64638615",
"0.645722",
"0.644719",
"0.6429101",
"0.6332298",
"0.6330999",
"0.6292698",
"0.622307",
"0.6192175",
"0.6190752",
"0.61711174",
"0.6128896",
"0.61129713",
"0.6112532",
"0.6099241",
"0.60904557",
... | 0.7260533 | 0 |
Deletes text object file, database records and any keywords in the graph. | def TextDelete(texttitle):
path = app.config['UPLOAD_FOLDER'] + \
'/objects/' + texttitle + '.txt'
with Database() as database:
database.deleteText(texttitle, session['id'])
# Loads in the file to be deleted and the keyword graph
with open(path, "rb") as objectfile:
current_fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete():",
"def clear_db():\n humans = Human4j.nodes.all()\n for h in humans:\n h.delete()\n binomes = Binome4j.nodes.all()\n for b in binomes:\n b.delete()\n projects = Project4j.nodes.all()\n for p in projects:\n p.delete()\n sherpas = Sherpa4j.nodes.all()\n fo... | [
"0.66543853",
"0.6603808",
"0.6559491",
"0.6447322",
"0.64100724",
"0.6389136",
"0.6299942",
"0.62388057",
"0.6218455",
"0.6199544",
"0.6175071",
"0.61286473",
"0.6114",
"0.6112866",
"0.6111774",
"0.6104314",
"0.60767096",
"0.6068975",
"0.60340655",
"0.6027067",
"0.60106134",... | 0.78041196 | 0 |
Performs dijsktras algorithm from a certain node | def dijsktra(graph, initial):
# Sets initial node score to 10
visited = {initial: 10}
nodes = set(graph.nodes)
max_weight = graph.distances[max(graph.distances, key=graph.distances.get)]
min_weight = graph.distances[min(graph.distances, key=graph.distances.get)]
# Defines the number of nodes t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_correcting_algo(dt, ori_node, des_node, do_return=False):\n # Convert all labels to string\n ori = str(ori_node)\n des = str(des_node)\n dt[[\"start\", \"end\"]] = dt[[\"start\", \"end\"]].astype(str) \n \n # Initialization\n nodes = set(dt.loc[:,\"start\"].unique()) | set(dt.loc[:,\... | [
"0.59614277",
"0.5681578",
"0.56544733",
"0.55270684",
"0.5521709",
"0.5521709",
"0.5468644",
"0.54065055",
"0.5363926",
"0.53576124",
"0.5327712",
"0.529251",
"0.5275726",
"0.5270906",
"0.5267602",
"0.52594185",
"0.5239558",
"0.5176163",
"0.5163248",
"0.51169175",
"0.5099423... | 0.5816856 | 1 |
Upload path for raw text, creates a text file with the text in Creates analyser object | def raw_text_upload():
try:
global current_file
if request.method == "POST":
raw_text = request.form['raw_text']
# Checks text is not empty
raw_text = raw_text.strip('<>')
if raw_text != '':
if app.config['UPLOAD_FOLDER'] == UPLOAD_FOLD... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_text_file(text, path):\n os.makedirs(os.path.dirname(path), exist_ok=True)\n with open(path, \"w\") as f:\n f.write(text)",
"def store_lyrics_text(target_path, track_id, text, extension=\".txt\"):\n file_path = os.path.join(target_path, track_id + extension)\n print(file_path)\n wi... | [
"0.63974303",
"0.6382405",
"0.6246426",
"0.62317955",
"0.61909753",
"0.61618316",
"0.6158124",
"0.60989183",
"0.6093532",
"0.6090002",
"0.6025201",
"0.59735364",
"0.59291154",
"0.59190583",
"0.5890567",
"0.5857344",
"0.58509505",
"0.5835025",
"0.5823908",
"0.58041954",
"0.579... | 0.77678305 | 0 |
Shares the text with the user, by creating link in databse | def share_text(texttitle, username):
message = session['username'] + \
" shared the text " + texttitle + " with you."
with Database() as database:
database.share_text(texttitle, username, session["username"])
database.sendNotif(username, message)
flash("Text Shared")
return redir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def share_link(cls, user, link):",
"def share_link(cls, user, link):",
"def insert_link(self, text, href):\n self.insert_text('\\n<a href=\"%s\">%s</a>' % (href, text))",
"def paste_text(text, language=\"text\", paste_expire=8640, paste_user=\"paste.py\",\n return_link=True):\n # costruct ur... | [
"0.6997458",
"0.6997458",
"0.6394542",
"0.6387845",
"0.63727754",
"0.6336196",
"0.62323594",
"0.59182006",
"0.59175485",
"0.5866517",
"0.585186",
"0.5835037",
"0.58334965",
"0.57938176",
"0.5787896",
"0.5775299",
"0.57594526",
"0.5759272",
"0.5726179",
"0.57058954",
"0.569536... | 0.7278323 | 0 |
Displays the text on upload and allows the analysis to be selected | def textdisplay(textTitle, analysis):
try:
global current_file
with Database() as database:
text_owner = database.getTextOwner(textTitle, session['username'])
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER + text_owner
path = app.config['UPLOAD_FOLDER'] + '/objects/' + textT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_text_upload():\n try:\n global current_file\n if request.method == \"POST\":\n raw_text = request.form['raw_text']\n # Checks text is not empty\n raw_text = raw_text.strip('<>')\n if raw_text != '':\n if app.config['UPLOAD_FOLDER']... | [
"0.7159925",
"0.70026785",
"0.6800656",
"0.6480692",
"0.6478881",
"0.63340646",
"0.6268505",
"0.62629604",
"0.6173394",
"0.61475825",
"0.6066088",
"0.60618997",
"0.60281646",
"0.5980928",
"0.5969213",
"0.5954582",
"0.5953171",
"0.59319204",
"0.59178823",
"0.5866974",
"0.58288... | 0.7547743 | 0 |
Saves the text object in a text file and saves it in db | def save_text():
try:
global current_file
if request.method == "POST":
current_file.title = request.form['title'].replace(' ', '')
with Database() as database:
category = database.getCategory(request.form['Category'])
current_file.category = ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_text(self):\n if self.tab_control.index(\"current\") == 0:\n text = self.textbox.get(\"1.0\", tk.END)\n if text is not None:\n files = [('Text Document', '*.txt')]\n text_file = asksaveasfile(title=\"Save your text as .txt\", filetypes=files,\n ... | [
"0.7108115",
"0.69423765",
"0.6938336",
"0.68713033",
"0.677555",
"0.6758945",
"0.6651387",
"0.659884",
"0.65734136",
"0.6515245",
"0.6488028",
"0.64555424",
"0.64316326",
"0.6394388",
"0.6353932",
"0.63499653",
"0.6315648",
"0.6307501",
"0.630571",
"0.62945545",
"0.62737465"... | 0.7057494 | 1 |
Deletes the users account, their files and texts from the database | def deleteaccount():
try:
if app.config['UPLOAD_FOLDER'] == UPLOAD_FOLDER:
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER + \
session['username']
with Database() as db:
texts = db.getOwnedTexts(session['id'])
for text in texts:
TextDel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_user():",
"def db_delete_user_data(self):\n util.log(\"Clearing all user data\", util.LogLevel.Info)\n self.db.db_clear_data_user()\n util.log(\"Done\", util.LogLevel.Info)",
"def delete_user():\n #TODO user delete\n pass",
"def delete_user(self) -> None:\n table_... | [
"0.75881016",
"0.7571063",
"0.73386544",
"0.72856486",
"0.71325874",
"0.70421135",
"0.70142746",
"0.6962373",
"0.6958195",
"0.69209486",
"0.6919454",
"0.6880083",
"0.68616986",
"0.67589813",
"0.6717374",
"0.6716456",
"0.66849625",
"0.6683709",
"0.6657697",
"0.66400325",
"0.66... | 0.76813954 | 0 |
204 responses must not return some entity headers | def get204(self):
bad = ('content-length', 'content-type')
for h in bad:
bottle.response.set_header(h, 'foo')
bottle.status = 204
for h, v in bottle.response.headerlist:
self.assertFalse(h.lower() in bad, "Header %s not deleted" % h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_204_response() -> bytes:\n date = datetime.datetime.now(datetime.timezone.utc).strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n\n header = \"HTTP/1.1 204 No Content\" + \"\\r\\nDate: \" + date + \"\\r\\n\\r\\n\"\n\n print(header)\n return header.encode(HttpServer.FORMAT)",
"def as... | [
"0.7504536",
"0.7456752",
"0.70702946",
"0.7007137",
"0.6838798",
"0.6740226",
"0.66936654",
"0.66851264",
"0.66362447",
"0.65761197",
"0.648202",
"0.6477876",
"0.64216065",
"0.6242951",
"0.623777",
"0.623777",
"0.6185526",
"0.61398613",
"0.61072254",
"0.6086671",
"0.60757756... | 0.83296347 | 0 |
304 responses must not return entity headers | def get304(self):
bad = ('allow', 'content-encoding', 'content-language',
'content-length', 'content-md5', 'content-range',
'content-type', 'last-modified') # + c-location, expires?
for h in bad:
bottle.response.set_header(h, 'foo')
bottle.status = 304
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_304_response() -> bytes:\n content_data = HttpServer.get_content_data(\"/not_modified.html\")\n date = datetime.datetime.now(datetime.timezone.utc).strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n\n header = \"HTTP/1.1 304 Not Modified\" + \"\\r\\nDate: \" + date + \"\\r\\n\" + content_dat... | [
"0.75092345",
"0.7419917",
"0.72726953",
"0.7164188",
"0.7087629",
"0.6714187",
"0.66934466",
"0.6550176",
"0.65363",
"0.6527774",
"0.65198684",
"0.6495292",
"0.6457777",
"0.63518214",
"0.6306506",
"0.6283255",
"0.6283255",
"0.6245512",
"0.6245413",
"0.6172141",
"0.6148629",
... | 0.82604736 | 0 |
Returns an amended copy of the proxies dictionary used by `requests`, it will disable the proxy if the uri provided is to be reached directly. | def config_proxy_skip(proxies, uri, skip_proxy=False):
parsed_uri = urlparse(uri)
# disable proxy if necessary
if skip_proxy:
if 'http' in proxies:
proxies.pop('http')
if 'https' in proxies:
proxies.pop('https')
elif proxies.get('no'):
urls = []
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_proxies(self) -> dict:\n return self._proxies.copy() if self._proxies else None",
"def _proxies_dict(proxy):\r\n if not proxy:\r\n return None\r\n return {'http': proxy, 'https': proxy}",
"def proxies(self):\n\n proxies = APIConsumer.get(\"/proxies\").json()\n proxies... | [
"0.66343987",
"0.6391098",
"0.6165451",
"0.6008237",
"0.55292976",
"0.5497907",
"0.5492077",
"0.5427683",
"0.5362546",
"0.5328795",
"0.52967983",
"0.52951497",
"0.52471906",
"0.5230866",
"0.52142024",
"0.5200751",
"0.5157269",
"0.5149122",
"0.5092851",
"0.5078898",
"0.5063718... | 0.6825937 | 0 |
Creates a new Thoth release instance | def make_release(self, **kwargs) -> ThothRelease:
snapshot_date = make_snapshot_date(**kwargs)
release = ThothRelease(dag_id=self.dag_id, run_id=kwargs["run_id"], snapshot_date=snapshot_date)
return release | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_release(self, **kwargs) -> CrossrefEventsRelease:\n\n start_date, end_date, first_release = self.get_release_info(**kwargs)\n\n release = CrossrefEventsRelease(\n self.dag_id, start_date, end_date, first_release, self.mailto, self.max_threads, self.max_processes\n )\n ... | [
"0.64280033",
"0.63345087",
"0.6219137",
"0.62178385",
"0.59829724",
"0.5792777",
"0.5772973",
"0.56713486",
"0.5646336",
"0.56411284",
"0.556297",
"0.55392003",
"0.5535768",
"0.55193186",
"0.54974574",
"0.54897374",
"0.54813004",
"0.5434569",
"0.5398685",
"0.5379647",
"0.537... | 0.74462247 | 0 |
Task to download the ONIX release from Thoth. | def download(self, release: ThothRelease, **kwargs) -> None:
thoth_download_onix(
publisher_id=self.publisher_id,
format_spec=self.format_specification,
download_path=release.download_path,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _download(self):\n self._system.download(\"http://geant4.web.cern.ch/geant4/support/source/\" + self._tar_name)",
"def thoth_download_onix(\n publisher_id: str,\n download_path: str,\n format_spec: str,\n host_name: str = DEFAULT_HOST_NAME,\n num_retries: int = 3,\n) -> None:\n url =... | [
"0.6697182",
"0.6280148",
"0.62222373",
"0.61106557",
"0.6080942",
"0.5996796",
"0.5958443",
"0.59322697",
"0.5895125",
"0.5894148",
"0.58753026",
"0.580345",
"0.57798254",
"0.57530046",
"0.57020843",
"0.5632765",
"0.5632071",
"0.5620086",
"0.56162405",
"0.5600442",
"0.558787... | 0.69096416 | 0 |
Hits the Thoth API and requests the ONIX feed for a particular publisher. Creates a file called onix.xml at the specified location | def thoth_download_onix(
publisher_id: str,
download_path: str,
format_spec: str,
host_name: str = DEFAULT_HOST_NAME,
num_retries: int = 3,
) -> None:
url = THOTH_URL.format(host_name=host_name, format_specification=format_spec, publisher_id=publisher_id)
logging.info(f"Downloading ONIX XML ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oai_harvest(basic_url, metadata_prefix=None, oai_set=None, processing=None, out_file_suffix=None):\n collection_xpath = \".//oai_2_0:metadata//intact:collection\"\n record_xpath = \".//oai_2_0:record\"\n identifier_xpath = \".//oai_2_0:header//oai_2_0:identifier\"\n token_xpath = \".//oai_2_0:resum... | [
"0.50976276",
"0.50819564",
"0.5062179",
"0.505473",
"0.49140215",
"0.47646818",
"0.47354826",
"0.4707565",
"0.46446255",
"0.46394545",
"0.46037316",
"0.4576128",
"0.45600936",
"0.4554681",
"0.45524687",
"0.4548541",
"0.45293865",
"0.4528018",
"0.4522511",
"0.45112112",
"0.45... | 0.5873819 | 0 |
This function will produce a batch of features and labels for each epoch step to reduce the memory usage. | def generator(features, labels, batch_size):
# Create empty arrays to contain batch of features and labels#
batch_features = np.zeros((batch_size, 160, 320, 3))
batch_labels = np.zeros((batch_size, 1))
while True:
for i in range(batch_size):
# choose random index in features
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_features_labels(features, labels, batch_size):\n for start in range(0, len(features), batch_size):\n end = min(start + batch_size, len(features))\n #print(labels[start:end])\n yield features[start:end], labels[start:end]",
"def batch_features_labels(features, labels, batch_size)... | [
"0.76270497",
"0.7307724",
"0.7307669",
"0.7307669",
"0.7307669",
"0.72704774",
"0.70929223",
"0.69568336",
"0.69184935",
"0.68820596",
"0.6748234",
"0.67144907",
"0.66818917",
"0.66654253",
"0.66291654",
"0.6627662",
"0.66152316",
"0.6594451",
"0.6584446",
"0.6561161",
"0.65... | 0.7333913 | 1 |
Validate and update field value against validator. Raise NoValidatorError if no validator was set. | def validate(self):
if self.validator is None:
raise NoValidatorError('Field %s has no validator assigned.' %
self.id)
self.value = self.validator(self.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validator(self, value: Optional[Dict[str, Any]]):\n self._validator = value",
"def validate(self):\n for field in self.fields:\n if field.validate():\n self.model.set(field.name, field.model_value)\n else:\n self.errors.append(field.error())\n... | [
"0.62739575",
"0.608497",
"0.6071332",
"0.6071332",
"0.6062489",
"0.60375136",
"0.59934586",
"0.5940005",
"0.59261507",
"0.5883836",
"0.5870587",
"0.5867741",
"0.58644885",
"0.5827615",
"0.5827615",
"0.57252115",
"0.5696865",
"0.565482",
"0.5627075",
"0.5613289",
"0.5612839",... | 0.83141893 | 0 |
Shortcut for field.renderer.render(). Raise NoRendererError if no renderer is set. | def render(self):
if not self.renderer:
raise NoRendererError('Field %s has no renderer assigned.' %
self.id)
return self.renderer.render(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(self):\n try:\n if self.permit():\n return self.renderer.render(self)\n except AttributeError:\n if self.renderer is None:\n raise NotImplementedError(\"Should have implemented a renderer for {0}\".format(self.name))\n else:\n ... | [
"0.7004743",
"0.65256923",
"0.64937174",
"0.63230234",
"0.6244154",
"0.6143011",
"0.60672754",
"0.60345244",
"0.5998662",
"0.59685975",
"0.5790698",
"0.57647145",
"0.57602614",
"0.57167757",
"0.5699508",
"0.5687103",
"0.56720227",
"0.5661371",
"0.563945",
"0.5615098",
"0.5605... | 0.77539104 | 0 |
Transform each geometry to a different coordinate reference system. The ``crs`` attribute on the current GeoSeries must be set. | def to_crs(self, crs):
if crs is None:
raise ValueError("Can not transform with invalid crs")
if self.crs is None:
raise ValueError("Can not transform geometries without crs. Set crs for this GeoSeries first.")
if self.crs == crs:
return self
return _u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_geometries(datasource, src_epsg, dst_epsg):\n # Part 1\n src_srs = osr.SpatialReference()\n src_srs.ImportFromEPSG(src_epsg)\n dst_srs = osr.SpatialReference()\n dst_srs.ImportFromEPSG(dst_epsg)\n transformation = osr.CoordinateTransformation(src_srs, dst_srs)\n layer = datasource.GetLa... | [
"0.6502866",
"0.62526053",
"0.61256564",
"0.6086267",
"0.60835266",
"0.6010616",
"0.5969945",
"0.5863563",
"0.5861438",
"0.5789306",
"0.5703812",
"0.56789464",
"0.5665309",
"0.5656348",
"0.56265503",
"0.5570779",
"0.5527477",
"0.5501872",
"0.5500846",
"0.5494727",
"0.5475225"... | 0.7170733 | 0 |
Return a geometry that represents the union of all geometries in the GeoSeries. | def unary_union(self):
return GeoSeries(arctern.ST_Union_Aggr(self)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mergeGeometries(self):\n self.geometry = reduce(lambda p1,p2 : p1.union(p2) ,map(lambda tax : tax.biomeGeometry,self.taxonomies))\n return self.geometry",
"def union(self, other):\n return self._geomgen(capi.geom_union, other)",
"def unary_union(self) -> ir.GeoSpatialScalar:\n r... | [
"0.73016036",
"0.685745",
"0.6835243",
"0.6767258",
"0.67599726",
"0.64897877",
"0.63472724",
"0.634694",
"0.60967267",
"0.60640794",
"0.60346997",
"0.5986849",
"0.59392625",
"0.58512485",
"0.5828639",
"0.57456577",
"0.5710652",
"0.568876",
"0.5681035",
"0.56726",
"0.5660516"... | 0.7909888 | 0 |
Returns the Hausdorff distance between each geometry and other. This is a measure of how similar or dissimilar 2 geometries are. | def hausdorff_distance(self, other):
return _binary_op(arctern.ST_HausdorffDistance, self, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hausdorff_distance(self, other):\n ...",
"def hausdorff_distance(image1, image2):\n image1_int = image1.clone(\"unsigned int\")\n image2_int = image2.clone(\"unsigned int\")\n\n libfn = utils.get_lib_fn(\"hausdorffDistance%iD\" % image1_int.dimension)\n d = libfn(image1_int.pointer, image2... | [
"0.759283",
"0.7179202",
"0.7101328",
"0.689909",
"0.6858431",
"0.6837336",
"0.67604476",
"0.6683294",
"0.66194665",
"0.66013527",
"0.6569919",
"0.65585876",
"0.6527269",
"0.6473583",
"0.6433952",
"0.6392746",
"0.63679177",
"0.63628966",
"0.6316012",
"0.63065404",
"0.6305005"... | 0.76239663 | 0 |
Transform each arctern GeoSeries to GeoPandas GeoSeries. | def to_geopandas(self):
import geopandas
import shapely
return geopandas.GeoSeries(self.apply(lambda x: shapely.wkb.loads(x) if x is not None else None), crs=self.crs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raster_to_geodataframe(*a, **kw) -> gpd.GeoDataFrame:\n kw[\"geo\"] = True\n return raster_to_dataframe(*a, **kw)",
"def convert_to_geopandas(df):\n df['geometry'] = [Point(xy) for xy in zip(df.latitude, df.longitude)]\n crs = {'init': 'epsg:4326'}\n df = gpd.GeoDataFrame(df, crs=crs, geometry... | [
"0.63202363",
"0.6096996",
"0.603656",
"0.598663",
"0.59274143",
"0.5879244",
"0.5840413",
"0.5799306",
"0.5705398",
"0.56461185",
"0.5643855",
"0.55626243",
"0.55617464",
"0.5537935",
"0.5530619",
"0.5516425",
"0.5465296",
"0.5460588",
"0.54439163",
"0.5427812",
"0.5421134",... | 0.6296897 | 1 |
Construct polygon(rectangle) geometries from arr_min_x, arr_min_y, arr_max_x, arr_max_y and special coordinate system. The edges of polygon are parallel to coordinate axis. | def polygon_from_envelope(cls, min_x, min_y, max_x, max_y, crs=None):
crs = _validate_crs(crs)
return cls(arctern.ST_PolygonFromEnvelope(min_x, min_y, max_x, max_y), crs=crs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generatePolygons():",
"def draw_polygon(\n i, sx, tx, sy, ty, xmin, xmax, ymin, ymax,\n offsets, values, xs, ys, yincreasing, eligible,\n *aggs_and_cols\n ):\n # Initialize values of pre-allocated buffers\n xs.fill(np.nan)\n ys.fill(np.nan)\n yi... | [
"0.6298787",
"0.6130665",
"0.5995941",
"0.59403425",
"0.59305",
"0.5916149",
"0.58777076",
"0.58749014",
"0.5831342",
"0.5804383",
"0.57978517",
"0.578452",
"0.5773578",
"0.5768583",
"0.5755375",
"0.57550496",
"0.57409936",
"0.5726229",
"0.57090235",
"0.5684887",
"0.5683477",... | 0.6215077 | 1 |
Construct geometry from the GeoJSON representation string. | def geom_from_geojson(cls, json, crs=None):
crs = _validate_crs(crs)
return cls(arctern.ST_GeomFromGeoJSON(json), crs=crs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_geometry(self, val):\n g = OGRGeometry(val)\n return json.loads(g.json)",
"def json2polygon(geojson_str):\n geojson_object = geojson.loads(geojson_str)\n return geometry.shape(geojson_object)",
"def get_geojson_feature(id, raw_bbox_string, properties_dict):\n coords = raw_bbox_s... | [
"0.64928246",
"0.6445108",
"0.62764484",
"0.62726635",
"0.6204472",
"0.61289346",
"0.59531116",
"0.5860503",
"0.5817557",
"0.5810382",
"0.5739932",
"0.5705384",
"0.56882906",
"0.5613755",
"0.56050944",
"0.5557749",
"0.5536399",
"0.55300456",
"0.5526873",
"0.5519496",
"0.54749... | 0.6517472 | 0 |
Decorator to load common data used by all views | def base_data_manager(wrapped):
@check_session
def wrapper(request, *arg, **kwargs):
@cache_region.cache_on_arguments()
def get_data_manager(collection, journal, document, range_start, range_end):
code = document or journal or collection
data = {}
xylose_do... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data():\n return app_views",
"def data_for_all(request):\n data = common_data(request)\n data.update({\"tags\": Tag.used_tags(),\n \"archive_qualifier\": \"\",\n \"recent_active_months\": Blog.recent_active_months()})\n return data",
"def common_context(request):... | [
"0.6341154",
"0.5741006",
"0.5648095",
"0.559915",
"0.5597389",
"0.55743283",
"0.5551376",
"0.5519761",
"0.5490871",
"0.54798126",
"0.5479319",
"0.5315314",
"0.5302181",
"0.5232341",
"0.522839",
"0.52071565",
"0.5182045",
"0.5180877",
"0.51765704",
"0.51497936",
"0.51259214",... | 0.5870001 | 1 |
Constructor. Unless otherwise specified it has a perfect quantum efficiency, samples at a rate of once per second and has a 0.1s integration time | def __init__(self, quantum_efficiency=1.0,
sample_rate_times_per_second=1.0,
integration_time_seconds=0.1):
self.quantum_efficiency = quantum_efficiency
self.sample_rate_times_per_second = sample_rate_times_per_second
self.integration_time_seconds = integration_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, time_constant: float, sampling_time: float):\n self.alpha = sampling_time / (time_constant + sampling_time)\n self.state = None",
"def __init__(self, timer=120, rate=1, percent=0):\n self.timer = timer\n self.rate = rate\n self.percent = percent",
"def __init__(sel... | [
"0.6873452",
"0.6581009",
"0.6519729",
"0.6232511",
"0.6232355",
"0.6188222",
"0.616987",
"0.61652625",
"0.6155164",
"0.61493057",
"0.6139855",
"0.6118475",
"0.610823",
"0.6098916",
"0.6088264",
"0.60863924",
"0.60642815",
"0.6009342",
"0.60072887",
"0.60061246",
"0.59945565"... | 0.80746883 | 0 |
Creates new task window | def new_task(self, widget):
my_task_window = taskwindow.TaskWindow(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_task(event):\n manager = event.workbench.get_plugin('exopy.tasks')\n dialog = BuilderView(manager=manager,\n parent=event.parameters.get('parent_ui'),\n future_parent=event.parameters.get('future_parent'))\n result = dialog.exec_()\n if result:... | [
"0.7113246",
"0.70224667",
"0.6907756",
"0.68215317",
"0.6519921",
"0.6381383",
"0.637192",
"0.6319704",
"0.62721485",
"0.6223385",
"0.61893445",
"0.6168583",
"0.61627823",
"0.6148006",
"0.6140917",
"0.6093474",
"0.5996884",
"0.5986673",
"0.5972583",
"0.59595525",
"0.5941826"... | 0.81975675 | 0 |
Shows a window with all the tasks and alarms | def see_tasks(self, widget):
my_task_list = tasklistwindow.TaskListWindow(self.task_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dashboard_showall():\n tasks = Task.query.all()\n return render_template('home/taskshowall/dashboard_showall.html',\n tasks=tasks, title=\"Tasks\")",
"def show_tasks():\n\n task = Task(connection=connection, cursor=cursor)\n\n all_tasks = task.get_all_tasks()\n\n cont... | [
"0.6601088",
"0.6460697",
"0.628572",
"0.6235331",
"0.61510676",
"0.6129666",
"0.6097378",
"0.607427",
"0.6070758",
"0.6047063",
"0.59771895",
"0.59053344",
"0.58603084",
"0.58067805",
"0.58024603",
"0.57794356",
"0.57792646",
"0.5776163",
"0.57633907",
"0.5740602",
"0.571361... | 0.69399023 | 0 |
aic(timeSeries, ssc=0) > data, max_weight, max_weight_params | def aic(timeSeries, ssc=0):
if np.min(timeSeries) <= 0:
timeSeries = timeSeries + -np.min(timeSeries) + .01
# create histogram to determine plot values
# note that the original uses hist centers, this uses edges. It may matter
counts, plotvals_edges = np.histogram(timeSeries, 50)
plot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aic_ms(distribution):\n print(\"TESTING: AIC model selection for %s distribution\" % distribution.upper())\n params = dist.DISTRIBUTIONS[distribution][dist.KEY_TEST_PARAMS]\n print(\" creating sample\")\n test_sample = dist.samples(distribution, params)\n print(\" calculating AIC for all ... | [
"0.52783775",
"0.5277361",
"0.51554257",
"0.5079259",
"0.5041149",
"0.5019891",
"0.49585706",
"0.49330664",
"0.49314007",
"0.4872369",
"0.4855907",
"0.48519504",
"0.48410013",
"0.4838592",
"0.47834566",
"0.47363517",
"0.47308505",
"0.47119272",
"0.47084534",
"0.47058246",
"0.... | 0.5706766 | 0 |
Show line of asterisks to demarcate bounds of heap | def demarcate_heap(hgt=self.level, cell_wid=minimum_cell):
# Number of nodes on bottom is 2^hgt
max_nodes = int(np.power(2, hgt))
print (''.center(cell_wid * max_nodes, '*')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_heap(self):\n for i in range(1, (self.size//2)+1): \n print(\" PARENT : \"+ str(self.Heap[i])+\" LEFT CHILD : \"+ \n str(self.Heap[2 * i])+\" RIGHT CHILD : \"+\n str(self.Heap[2 * i + 1]))",
"def min_heap(self): \n \n ... | [
"0.6224625",
"0.6115098",
"0.60877067",
"0.6073852",
"0.58567894",
"0.5810459",
"0.57655525",
"0.57655525",
"0.5722967",
"0.5565458",
"0.55614096",
"0.55261725",
"0.55241466",
"0.550935",
"0.5506681",
"0.54333556",
"0.54333556",
"0.54319435",
"0.5421225",
"0.54208",
"0.541896... | 0.6630077 | 0 |
Swap values at index_0 and index_1 | def swap(self, index_0, index_1):
value_0 = self.get_value_at(index_0)
value_1 = self.get_value_at(index_1)
self.set_value_at(index_0, value_1)
self.set_value_at(index_1, value_0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap(A, index1, index2):\r\n \r\n temp = A[index1]\r\n A[index1] = A[index2]\r\n A[index2] = temp",
"def swap_numbers(numbers, index1, index2):\n temp = numbers[index1]\n numbers[index1] = numbers[index2]\n numbers[index2] = temp",
"def __swap(self, index_1, index_2):\n temp = s... | [
"0.8045885",
"0.80415386",
"0.7976427",
"0.7946715",
"0.77399236",
"0.7737298",
"0.7729477",
"0.76621556",
"0.7614902",
"0.7564756",
"0.7564756",
"0.737364",
"0.7371236",
"0.73423225",
"0.727941",
"0.7278792",
"0.72698545",
"0.71813565",
"0.716901",
"0.7142264",
"0.7134006",
... | 0.82595736 | 0 |
use dictionary to store the difference (target nums[i]). | def twoSum(self, nums: List[int], target: int) -> List[int]:
diffRec = {}
for i, v in enumerate(nums):
if v in diffRec:
return [diffRec[v], i]
else:
diffRec[target - v] = i
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def twoSum(self, nums: List[int], target: int) -> List[int]:\n d = {}\n for i, n in enumerate(nums):\n d[n]=i\n \n for i, n in enumerate(nums):\n m = target - n\n if m in d and d[m] != i:\n return [i,d[m... | [
"0.6771178",
"0.6764401",
"0.6693631",
"0.65968764",
"0.6315861",
"0.62800086",
"0.62199515",
"0.62003785",
"0.61241025",
"0.6120513",
"0.61066025",
"0.5899261",
"0.56001204",
"0.55316275",
"0.5446655",
"0.5416312",
"0.5380408",
"0.5378301",
"0.537053",
"0.5293179",
"0.528616... | 0.6832244 | 0 |
checks if user can afford item and deducts item cost from self.resources and adds the item (or the purchases effects) to the user. returns true if purchased, returns false if not. Default usage is to use an item name from purchase.py. If a Balance object "balance" is given INSTEAD of "item", then it is used directly. | def purchase(self, item=None, balance=None):
if item!= None:
cost = purchases.getCost(item)
if self.affords(cost):
self.payFor(cost)
# TODO: actually do whatever was purchased
# self.applyItem(item)
return True
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def userCanAffordItemObj(self, user : bbUser.bbUser, item : bbItem.bbItem) -> bool:\n return user.credits >= item.getValue()",
"def can_afford(self, item_name):\n item = self.get(item_name)\n for resource in RESOURCES:\n if item.cost.get(resource, 0) > self.game.resources.get(reso... | [
"0.69444394",
"0.6761436",
"0.6278624",
"0.62341774",
"0.6051828",
"0.5915107",
"0.5884033",
"0.5883767",
"0.5861438",
"0.58475995",
"0.5811648",
"0.5739377",
"0.56401324",
"0.560546",
"0.5601953",
"0.5595759",
"0.55743337",
"0.5556562",
"0.5518422",
"0.55150044",
"0.5479447"... | 0.7959187 | 0 |
Returns the date reformated into python datetime format. | def get_python_date(self):
return dateutil.parser.parse(self.iso_date) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modis_to_from_pydatetime(date):\n \n if isinstance(date, (str, unicode)): \n return dt.datetime.strptime(date[1:], '%Y%j').date()\n return dt.datetime.strftime(date, 'A%Y%j')",
"def _to_date(self, x):\n if isinstance(x, datetime.datetime):\n return x.date()\n return x... | [
"0.71629053",
"0.6894753",
"0.68495804",
"0.6835706",
"0.68110466",
"0.6798551",
"0.678441",
"0.6690061",
"0.6632137",
"0.6628195",
"0.66245985",
"0.66197765",
"0.6619198",
"0.660381",
"0.6570892",
"0.65689874",
"0.653436",
"0.6477465",
"0.64709014",
"0.6451577",
"0.6413728",... | 0.70473415 | 1 |
Renders a page for a particular compound. | def CompoundPage(request):
form = compound_form.CompoundForm(request.GET)
if not form.is_valid():
logging.error(form.errors)
raise Http404
# Compute the delta G estimate.
kegg_id = form.cleaned_compoundId
compound = models.Compound.objects.get(kegg_id=kegg_id)
compound.Stash... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_page():\n pages=get_accounts()\n return render_template('disp.html',pages=pages)",
"def renderPage():\n return render_template(\"index.html\")",
"def main_page():\n return render_template(\"main_page.html\")",
"def homepage():\n\n pagesClassIDs = {\n \"index\": {\n \"b... | [
"0.59548026",
"0.57890856",
"0.57370317",
"0.5636853",
"0.55066913",
"0.54987985",
"0.54826313",
"0.54345924",
"0.542592",
"0.53984725",
"0.53741604",
"0.537301",
"0.5337757",
"0.5306245",
"0.5297516",
"0.5291385",
"0.5291248",
"0.5286969",
"0.5282097",
"0.5271443",
"0.526328... | 0.7018998 | 0 |
Run SugarPy on a given .mzML file based on identified peptides from an evidences.csv Translated Ursgal parameters are passed to the SugarPy main function. | def _execute(self):
self.time_point(tag="execution")
main = self.import_engine_as_python_function()
output_file = os.path.join(
self.params["output_dir_path"], self.params["output_file"]
)
input_file = os.path.join(
self.params["input_dir_path"], self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n langs = []\n\n with open(\"sql/07_populate.sql\", 'w', encoding='utf8') as sql:\n sql.write(\"--this file is generated from csv files in data folder\\n\\n\")\n\n langs = write_lang_city(sql)\n write_groups_diets(sql, langs)\n\n with open(\"sql/10_populate_test_data.sql\"... | [
"0.5694265",
"0.5572508",
"0.5570067",
"0.55660534",
"0.55130184",
"0.5468869",
"0.5449003",
"0.54461205",
"0.5285306",
"0.52705884",
"0.52448237",
"0.52008086",
"0.5169603",
"0.5167817",
"0.5165798",
"0.5160243",
"0.5145471",
"0.51369846",
"0.51311797",
"0.512673",
"0.511855... | 0.5930959 | 0 |
Initialize a player at Python Casino, we give new players 100 chips to play | def __init__(self, name="Player"):
self.name = name
self.chips = 100
self.hand1 = []
self.hand2 = []
self.bet = 0
self.lastbet = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def newPlayer():\r\n pass",
"def __init__(self):\n\n self.name = 'KuhnPoker'\n self.num_players = 2",
"def initGame(self):\n self.map = {}\n self.blocks = Group()\n self.Coins =Group()\n self.players = Group()\n self.player1 = Player(1525,75,2)\n self.... | [
"0.6672925",
"0.6669602",
"0.6631138",
"0.6495722",
"0.6478701",
"0.6469059",
"0.6440115",
"0.64392686",
"0.64156747",
"0.6413498",
"0.6401054",
"0.63888377",
"0.63830507",
"0.6313076",
"0.62933445",
"0.6278405",
"0.6247309",
"0.62469554",
"0.62101966",
"0.6190493",
"0.618668... | 0.6768657 | 0 |
Receive a card dealt during the deal round | def dealt_card(self, card):
self.hand1.append(card)
print(f"{self.name} was dealt a {card}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deal(self):\n dealt_card = self.deck_of_cards.pop()\n print(\"You have been dealt the {} \".format(dealt_card.value) \\\n + \"of {}.\".format(dealt_card.suit) + \"\\n\")",
"def deal_card(self):\n return self._deal(1)[0]",
"def deal(self):\n\n if self.dealer... | [
"0.7164214",
"0.6649279",
"0.6613201",
"0.6463644",
"0.64456797",
"0.6287789",
"0.62788486",
"0.6256954",
"0.6247799",
"0.6185928",
"0.618543",
"0.6180968",
"0.61769384",
"0.61759967",
"0.61480325",
"0.6139512",
"0.613029",
"0.6088372",
"0.6074345",
"0.60608476",
"0.6047473",... | 0.7149964 | 1 |
Return the value of the players hand. Still need to handle split hands somehow | def hand_value(self):
return deck.bj_hand_value(self.hand1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_hand_value(self, hand_idx=0):\n return self._get_hand_value(self.players[hand_idx]['hand'])",
"def _get_hand_value(self):\n\t\tvalue_list = []\n\t\tfor index, hand in enumerate(self.player_hand):\n\t\t\tif self.status[index] == 'won':\n\t\t\t\tvalue_list.append(hand.bet)\n\t\t\telif self.status... | [
"0.7838407",
"0.7544803",
"0.7197065",
"0.7069113",
"0.68920386",
"0.68238187",
"0.68197185",
"0.6810919",
"0.68102187",
"0.68066204",
"0.6653587",
"0.66281724",
"0.6549728",
"0.6535241",
"0.6513264",
"0.6500152",
"0.64739597",
"0.63902885",
"0.63755286",
"0.6328881",
"0.6209... | 0.808111 | 0 |
Lost hand, lost bet | def lose(self, dlr):
print(f"Sorry {self.name}, your total of {sum(self.hand1)} didn't beat the dealers {dlr}")
self.lastbet = self.bet
self.bet = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lose(self) -> None:\n self._actual_money -= self._bet",
"def rough_outcome(self) -> float:\n # HUYNH YOU PRICK WHY THE FUCK DO YOU MAKE US WRITE THIS SHIT EVEN IT'S NOT USED ANYWHERE\n # pick move based on this may not be optimal but better than random\n # return 1 if win immediat... | [
"0.69771945",
"0.66398084",
"0.65543616",
"0.6549002",
"0.64223045",
"0.64099866",
"0.6402642",
"0.6375774",
"0.6362669",
"0.6361766",
"0.6273635",
"0.6248365",
"0.6205552",
"0.6203644",
"0.6169682",
"0.61347765",
"0.6123261",
"0.6119863",
"0.61127377",
"0.6111896",
"0.609298... | 0.7257465 | 0 |
Checks if creates data collection. | def test_creates_data_collection(self):
data_collection = create_data_collection(read_config_file("test/data_collection.yaml"))
self.assertIsInstance(data_collection, DataCollection) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_collection(self):\n pass",
"def check_for_new_data(self):\n return",
"def _validate_create_data(self, data):\n return",
"def data_loaded_check(self):\n return True",
"def assertExists(self):\n for db in self._db_tree:\n assert(db in self._datast... | [
"0.69012666",
"0.66905195",
"0.6603279",
"0.64278567",
"0.63041574",
"0.61867595",
"0.61684585",
"0.6142971",
"0.6142184",
"0.60509443",
"0.60087866",
"0.60020673",
"0.59476244",
"0.5895808",
"0.5882238",
"0.58364767",
"0.5814158",
"0.58005524",
"0.5793292",
"0.57574344",
"0.... | 0.69225866 | 0 |
Retrieves the current IAM policy data for listing example ```python import pulumi import pulumi_gcp as gcp policy = gcp.bigqueryanalyticshub.get_listing_iam_policy(project=google_bigquery_analytics_hub_listing["listing"]["project"], location=google_bigquery_analytics_hub_listing["listing"]["location"], data_exchange_id... | def get_listing_iam_policy(data_exchange_id: Optional[str] = None,
listing_id: Optional[str] = None,
location: Optional[str] = None,
project: Optional[str] = None,
opts: Optional[pulumi.InvokeOptions] = None) -> ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_listing_iam_policy_output(data_exchange_id: Optional[pulumi.Input[str]] = None,\n listing_id: Optional[pulumi.Input[str]] = None,\n location: Optional[pulumi.Input[Optional[str]]] = None,\n project: Optional[... | [
"0.7828049",
"0.6415348",
"0.6217417",
"0.6160221",
"0.6139532",
"0.6135994",
"0.61296153",
"0.61258733",
"0.61258733",
"0.61258733",
"0.6070894",
"0.6070894",
"0.6063281",
"0.6063281",
"0.6063281",
"0.5996258",
"0.5977472",
"0.59605813",
"0.59031934",
"0.59001213",
"0.589823... | 0.7959973 | 0 |
Retrieves the current IAM policy data for listing example ```python import pulumi import pulumi_gcp as gcp policy = gcp.bigqueryanalyticshub.get_listing_iam_policy(project=google_bigquery_analytics_hub_listing["listing"]["project"], location=google_bigquery_analytics_hub_listing["listing"]["location"], data_exchange_id... | def get_listing_iam_policy_output(data_exchange_id: Optional[pulumi.Input[str]] = None,
listing_id: Optional[pulumi.Input[str]] = None,
location: Optional[pulumi.Input[Optional[str]]] = None,
project: Optional[pulumi.I... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_listing_iam_policy(data_exchange_id: Optional[str] = None,\n listing_id: Optional[str] = None,\n location: Optional[str] = None,\n project: Optional[str] = None,\n opts: Optional[pulumi.InvokeOptions] = ... | [
"0.7957954",
"0.6418271",
"0.62199444",
"0.6163126",
"0.61404836",
"0.6138383",
"0.6131887",
"0.6128473",
"0.6128473",
"0.6128473",
"0.6072734",
"0.6072734",
"0.60656893",
"0.60656893",
"0.60656893",
"0.5997886",
"0.59795076",
"0.5963106",
"0.59044737",
"0.59022045",
"0.59003... | 0.7827125 | 1 |
initialize with location of my articles and outdir | def __init__(self, workdir = "archived_links", outdir = "tmp"):
self.workdir = workdir
self.outdir = outdir
self.bigdf = ""
self.ArticlesLoaded = False
self.clf = "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init(self) -> None:\n logger.debug(f\"[nbtutorial]: Outdir is: {self.outdir}\")",
"def __init__(self, texts_path, slug, metadata):\n self.texts_path = os.path.abspath(texts_path)\n\n self.slug = slug\n\n self.metadata = metadata",
"def __init__(self, output_dir: str):\n s... | [
"0.6814485",
"0.63777536",
"0.63513637",
"0.6347799",
"0.631205",
"0.62790346",
"0.62379956",
"0.6223603",
"0.61957836",
"0.6175018",
"0.6114833",
"0.6083057",
"0.6074342",
"0.6068505",
"0.6055408",
"0.6051235",
"0.60070103",
"0.59881234",
"0.5972294",
"0.59503233",
"0.592627... | 0.66417944 | 1 |
Test that view renders data from model | def test_the_view_render_Contact_instance(self):
my_info = self.response.context_data['info']
self.assertIsInstance(my_info, Contact)
model_instance = Contact.objects.first()
self.assertIn(model_instance.name, self.response.content)
self.assertIn(model_instance.surname, self.re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_context_data(self):\n self.view.object = self.obj\n context = self.view.get_context_data()\n self.assertIn(\"code\", context)\n self.assertIn(\"edit\", context)\n self.assertTrue(context[\"edit\"])",
"def test():\n return render_template(\n 'test.html',\n... | [
"0.6840645",
"0.66080403",
"0.6523233",
"0.64715046",
"0.6451231",
"0.6444405",
"0.64431345",
"0.6432887",
"0.6404577",
"0.64019704",
"0.6368436",
"0.63485414",
"0.634387",
"0.63366467",
"0.63298786",
"0.63038164",
"0.62876505",
"0.62627774",
"0.62624705",
"0.6258345",
"0.624... | 0.7052593 | 0 |
Test for form date field validation | def test_form_date_validation(self):
form = My_add_data_form(data={'date': date(1800, 05, 03)})
self.assertEqual(form.errors['date'], ['You already dead now'])
form = My_add_data_form(data={'date': date(2200, 05, 03)})
self.assertEqual(form.errors['date'], ['You not born yet']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_date_field():",
"def validate(self, test_data):\n if not isinstance(test_data, datetime.date):\n raise ValidationError('Invalid type/value.', 'datetime.date',\n type(test_data))",
"def check_date_format(form, field):\n try:\n field.data = da... | [
"0.79683304",
"0.7457315",
"0.74449104",
"0.73319423",
"0.73196423",
"0.7264576",
"0.7140698",
"0.7116886",
"0.70986587",
"0.70432013",
"0.7036628",
"0.6971",
"0.69465804",
"0.69303936",
"0.69096756",
"0.69046116",
"0.69046116",
"0.68596894",
"0.6810483",
"0.67967176",
"0.678... | 0.84299916 | 0 |
Test that view return errors in Json format | def test_that_view_return_errors_in_json(self):
self.client.login(username='admin', password='admin')
url = reverse("to_form", args=str(self.my_instance.id))
response = self.client.post(url, data={'name': 'Oleg'}, format='json')
self.assertEqual(response.status_code, 200)
for c ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_json(self):\r\n data = {\"Testing invalid\"}\r\n response = self.client.post(\r\n reverse('verify_student_results_callback'),\r\n data=data,\r\n content_type='application/json',\r\n HTTP_AUTHORIZATION='test BBBBBBBBBBBBBBBBBBBB: testing',\r... | [
"0.6963432",
"0.68196243",
"0.6738075",
"0.6731617",
"0.66677034",
"0.66568595",
"0.6615065",
"0.65761465",
"0.65392554",
"0.6538512",
"0.6524916",
"0.6521766",
"0.6519895",
"0.6510612",
"0.6499493",
"0.6459137",
"0.6440112",
"0.6433431",
"0.64058393",
"0.6382526",
"0.6369236... | 0.8210779 | 0 |
Test that view saves data if form valid | def test_that_view_saves_data_if_form_valid(self):
self.client.login(username='admin', password='admin')
url = reverse("to_form", args=str(self.my_instance.id))
response = self.client.post(url, data={'name': 'Oleg', 'surname': 'Senyshyn', 'date': date(1995, 05, 03),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_submit_form_using_valid_data():",
"def test_valid_form_true(self):\n form = UserRegisterForm(data=self.data)\n self.assertTrue(form.is_valid())",
"def test_form_valid(self):\n form = Mock()\n form.cleaned_data = Mock()\n self.view.form_valid(form)\n self.asser... | [
"0.75905186",
"0.6972983",
"0.68898875",
"0.68876064",
"0.6843631",
"0.68388474",
"0.6799494",
"0.6762418",
"0.6688027",
"0.66799116",
"0.6619247",
"0.6603506",
"0.6595378",
"0.65945286",
"0.6561139",
"0.65168655",
"0.6509908",
"0.64848745",
"0.6478526",
"0.6477208",
"0.64530... | 0.806071 | 0 |
Loads patient Procedure observations | def load(cls):
# Loop through procedures and build patient procedure lists:
procs = csv.reader(file(PROCEDURES_FILE,'U'),dialect='excel-tab')
header = procs.next()
for proc in procs:
cls(dict(zip(header,proc))) # Create a procedure instance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_patient(self, patient):\n \n # Maintain patient count \n self.count_total_patients += 1\n \n # Allocate patient to subunit/session\n self.allocate_patient(patient)\n \n # Add to appropriate _population lists\n patient_dict = {'negative': s... | [
"0.6553638",
"0.5726791",
"0.5658638",
"0.56560385",
"0.5612213",
"0.5544604",
"0.5427802",
"0.533888",
"0.5330403",
"0.5310503",
"0.5299247",
"0.52846605",
"0.5251733",
"0.5122264",
"0.5118435",
"0.50937766",
"0.50423414",
"0.50294584",
"0.50182426",
"0.4999633",
"0.4999633"... | 0.68310565 | 0 |
Returns a tabseparated string representation of a procedure | def asTabString(self):
dl = [self.pid, self.date, self.snomed, self.name[:20]]
s = ""
for v in dl:
s += "%s\t"%v
return s[0:-1] # Throw away the last tab | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asTabString(self):\n dl = [self.pid, self.start, self.snomed, self.name[:20]]\n s = \"\"\n for v in dl:\n s += \"%s\\t\"%v \n return s[0:-1] # Throw away the last tab",
"def print_para_table(s):\n if MODE == 1:\n t = [['Parameter', 'Value', 'Unit'],\n ['N... | [
"0.62828636",
"0.61583054",
"0.57344764",
"0.57325906",
"0.57238656",
"0.57168484",
"0.57098097",
"0.57098097",
"0.5668657",
"0.5587102",
"0.55370563",
"0.54839957",
"0.5471588",
"0.54644656",
"0.542793",
"0.53945804",
"0.53495973",
"0.5316048",
"0.5290959",
"0.52773845",
"0.... | 0.62052697 | 1 |
Initiate the root XML, parse it, and return a dataframe | def process_data(self):
structure_data = self.parse_root(self.root)
dict_data = {}
for d in structure_data:
dict_data = {**dict_data, **d}
df = pd.DataFrame(data=list(dict_data.values()), index=dict_data.keys()).T
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_XML(xml_file, df_cols):\n \n xtree = et.parse(xml_file)\n xroot = xtree.getroot()\n rows = []\n \n for node in xroot: \n res = []\n #res.append(node.attrib.get(df_cols[0]))\n for el in df_cols: \n if node is not None and node.find(el) is not None:\n ... | [
"0.65164536",
"0.6279615",
"0.6141911",
"0.6138031",
"0.6130271",
"0.60411644",
"0.6022583",
"0.60092944",
"0.5845552",
"0.5839543",
"0.58087265",
"0.5732619",
"0.56914544",
"0.5677152",
"0.5674767",
"0.56603354",
"0.56579065",
"0.5635685",
"0.5619518",
"0.5595719",
"0.552725... | 0.6824071 | 0 |
Generate the Doxygen XML. We do not have to remove any old XML or similar since we use the index.xml file to parse the rest.. So if some stale information is in the output folder it is ok we will not use it anyway | def generate(self):
# Write Doxyfile
doxyfile_content = DOXYFILE_TEMPLATE.format(
name="wurfapi",
output_path=self.output_path,
source_path=" ".join(self.source_paths),
recursive="YES" if self.recursive else "NO",
extra="",
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_doxygen(self):\n if not getattr(self, \"doxygen_conf\", None):\n self.generator.bld.fatal(\"No doxygen configuration file supplied.\")\n if not isinstance(self.doxygen_conf, Node.Node):\n self.generator.bld.fatal(\"'doxygen_conf' must be a Node.\")\n\n self.create_task(\n ... | [
"0.70324063",
"0.6946403",
"0.68050563",
"0.66510713",
"0.6509056",
"0.6443243",
"0.6337205",
"0.63226926",
"0.62693423",
"0.62597907",
"0.623974",
"0.62392175",
"0.6145338",
"0.6020383",
"0.6006961",
"0.6003898",
"0.5965673",
"0.5950159",
"0.5910592",
"0.5896202",
"0.5866549... | 0.77589625 | 0 |
Sidebar widget to select your data view | def select_data_view() -> str:
st.sidebar.markdown('### Select your data view:')
view_select = st.sidebar.selectbox('', DATA_VIEWS, index=0). \
replace(' (NEW)', '')
return view_select | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_layout() -> None:\n\n st.sidebar.title(\"Menu\")\n app_mode = st.sidebar.selectbox(\"Please select a page\", [' I. Homepage',\n \"II. Download data\" ,\n \"III. Statistic Data\",... | [
"0.55691195",
"0.5513806",
"0.5493136",
"0.5451674",
"0.5418005",
"0.5393736",
"0.53791744",
"0.5376035",
"0.5333957",
"0.53197217",
"0.53023964",
"0.5265653",
"0.5262883",
"0.52579665",
"0.5177404",
"0.5163641",
"0.51526636",
"0.5104715",
"0.510281",
"0.5094196",
"0.5078733"... | 0.61881065 | 0 |
Sidebar widget to select fiscal year | def select_fiscal_year(view_select) -> str:
if 'Wage Growth' in view_select:
working_fy_list = FY_LIST[:-1]
else:
working_fy_list = FY_LIST
st.sidebar.markdown('### Select fiscal year:')
fy_select = st.sidebar.selectbox('', working_fy_list, index=0).split(' ')[0]
return fy_select | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_calender_year(self, year):\n self.single_selection_from_kendo_dropdown(self.calender_year_kendo_dropdown_locator, year)",
"def set_start_year(self, year):\n return self.form.set_value(\"output period \\\"year from\\\"\", str(year))",
"def MonthYearFieldWidget(field, request):\n return ... | [
"0.6576069",
"0.6364317",
"0.62365025",
"0.6131743",
"0.6076331",
"0.5969902",
"0.5813705",
"0.57639",
"0.5758694",
"0.5715589",
"0.56626064",
"0.5603968",
"0.5560014",
"0.5438583",
"0.54234385",
"0.53938276",
"0.5356743",
"0.5356063",
"0.5349551",
"0.5347137",
"0.53393054",
... | 0.7023844 | 0 |
Sidebar widget to select pay rate conversion (hourly/annual) | def select_pay_conversion(fy_select, pay_norm, view_select) -> int:
st.sidebar.markdown('### Select pay rate conversion:')
conversion_select = st.sidebar.selectbox('', PAY_CONVERSION, index=0)
if conversion_select == 'Hourly':
if view_select != 'Trends':
pay_norm = FISCAL_HOURS[fy_selec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cb_radio(label):\n global pm_rate\n rate_dict = {'0.2 Step': 0.2, '1.0 Step': 1.0}\n pm_rate = rate_dict[label]",
"def select_rates_tab(self):\n self.select_static_tab(self.rates_tab_locator, True)",
"def render_investip():\n\tlinewidth = 2\n\n\tst.sidebar.markdown('# Dashboard')\n\tstock =... | [
"0.55547404",
"0.53186727",
"0.5312881",
"0.5295051",
"0.5293411",
"0.5169351",
"0.5135066",
"0.511413",
"0.5101465",
"0.50238144",
"0.49694377",
"0.49577525",
"0.4831858",
"0.48169535",
"0.48148766",
"0.4786951",
"0.47772965",
"0.47656235",
"0.4762115",
"0.47487792",
"0.4740... | 0.64868665 | 0 |
Sidebar widget to select trends for Trends page | def select_trends() -> str:
trends_checkbox = st.sidebar.checkbox(f'Show all trends', True)
if trends_checkbox:
trends_select = TRENDS_LIST
else:
trends_select = st.sidebar.multiselect('Select your trends', TRENDS_LIST)
return trends_select | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTrends(): \n api = authentication()\n names = [i.name for i in api.GetTrendsCurrent()]\n stringTrends = [i.strip('#') for i in names and ]\n trends = [i for i in stringTrends if i != \"\"]\n return trends",
"def get_trends():\n return api.trends_available()",
"def trending(request):\n\titems = I... | [
"0.6033017",
"0.5886845",
"0.54061174",
"0.5199153",
"0.51406914",
"0.512278",
"0.5105741",
"0.50310594",
"0.49992782",
"0.49274763",
"0.481228",
"0.48026663",
"0.47352293",
"0.46986964",
"0.46903226",
"0.4664409",
"0.466313",
"0.46275526",
"0.45833886",
"0.45830315",
"0.4561... | 0.6717184 | 0 |
Sidebar widget to select minimum salary for Highest Earners page | def select_minimum_salary(df, step, college_select: str = ''):
st.sidebar.markdown('### Enter minimum FTE salary:')
sal_describe = df[SALARY_COLUMN].describe()
number_input_settings = {
'min_value': 100000,
'max_value': int(sal_describe['max']),
'value': 500000,
'step': ste... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_min_expense(self):\n pass",
"def setMinMax(self):\n currentIndustryNum = self.myParent.myIndustry[self.myIndustryData.id]\n oldIndustryNum = self.myParent.myOldIndustry[self.myIndustryData.id]\n self.setMinValue(-currentIndustryNum)\n if oldIndustryNum > currentIndustr... | [
"0.50486606",
"0.5035432",
"0.5007743",
"0.49070513",
"0.48892468",
"0.4817341",
"0.47293594",
"0.4686217",
"0.468501",
"0.4654785",
"0.4652862",
"0.464481",
"0.46400693",
"0.46108285",
"0.46024165",
"0.45971134",
"0.45901182",
"0.45752954",
"0.45622933",
"0.45582008",
"0.455... | 0.60446465 | 0 |
Wrapper around k8s.load_and_create_resource to create a SageMaker resource | def create_sagemaker_resource(
resource_plural, resource_name, spec_file, replacements, namespace="default"
):
reference, spec, resource = k8s.load_and_create_resource(
resource_directory,
CRD_GROUP,
CRD_VERSION,
resource_plural,
resource_name,
spec_file,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_resource(\n service_name: str, config_name: str = None, **resource_args\n):\n session = get_session(config_name)\n return session.resource(service_name, **resource_args)",
"def create_resource():\n return wsgi.Resource(Controller())",
"def create_resource():\n return wsgi.Resource(Con... | [
"0.6695489",
"0.65566033",
"0.6527681",
"0.63303506",
"0.61349356",
"0.6096821",
"0.6095365",
"0.6082456",
"0.60742486",
"0.6072159",
"0.6070179",
"0.60697085",
"0.6067538",
"0.6065695",
"0.60196674",
"0.60108477",
"0.59737706",
"0.59575313",
"0.59364146",
"0.5927485",
"0.590... | 0.7768747 | 0 |
Wrapper around k8s.load_and_create_resource to create a Adopoted resource | def create_adopted_resource(replacements, namespace="default"):
reference, spec, resource = k8s.load_and_create_resource(
resource_directory,
ADOPTED_RESOURCE_CRD_GROUP,
CRD_VERSION,
"adoptedresources",
replacements["ADOPTED_RESOURCE_NAME"],
"adopted_resource_base",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_resource(\n service_name: str, config_name: str = None, **resource_args\n):\n session = get_session(config_name)\n return session.resource(service_name, **resource_args)",
"def create_sagemaker_resource(\n resource_plural, resource_name, spec_file, replacements, namespace=\"default\"\n):\n... | [
"0.6452652",
"0.6253703",
"0.6171513",
"0.6096159",
"0.59922796",
"0.59912336",
"0.595014",
"0.58938444",
"0.5844623",
"0.5840295",
"0.58089936",
"0.57912517",
"0.57580245",
"0.5738343",
"0.573344",
"0.5730226",
"0.5724765",
"0.5722394",
"0.5716222",
"0.5712392",
"0.56978524"... | 0.71058977 | 0 |
Get the scale for a unit | def get_scale(units, compartmentId, volume, extracellularVolume):
if compartmentId == 'c':
V = volume
else:
V = extracellularVolume
if units == 'uM':
return 1. / N_AVOGADRO / V * 1e6
elif units == 'mM':
return 1. / N_AVOGADRO / V * 1e3
elif units == 'molecu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getScale(self):\n return _libsbml.Unit_getScale(self)",
"def scale(self):\n return self.scale_factor / CONSTANTS.AU",
"def GetScale(self):\n ...",
"def scale(self):\n return self._scale",
"def scale(self) -> Tuple[float, float]:\n return self._scale",
"def get_unit(scal... | [
"0.80368865",
"0.7562799",
"0.74804133",
"0.73843277",
"0.7313599",
"0.73030704",
"0.72814995",
"0.7198944",
"0.7182465",
"0.71608347",
"0.71563214",
"0.71075463",
"0.7067282",
"0.7034129",
"0.7005473",
"0.69814765",
"0.6953271",
"0.69395196",
"0.6914729",
"0.6903628",
"0.689... | 0.7647739 | 1 |
Euclidean distance between vector and matrix. | def euclid_dist(vec, mat):
return np.linalg.norm(mat - vec, axis=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euclidean_distance(vector_x, vector_y):\n if len(vector_x) != len(vector_y):\n raise Exception('Vectors must be same dimensions')\n return math.sqrt(sum((vector_x[dim] - vector_y[dim]) ** 2 for dim in range(len(vector_x))))",
"def get_distance(self,row_vector):\n d = row_vector-self.X_test\n ... | [
"0.7465319",
"0.73555523",
"0.7279082",
"0.7155775",
"0.70827484",
"0.7002339",
"0.6978049",
"0.69625634",
"0.69552696",
"0.68833405",
"0.6845088",
"0.684352",
"0.6810883",
"0.6807818",
"0.6792588",
"0.675617",
"0.67391354",
"0.668006",
"0.6631312",
"0.6624541",
"0.6609537",
... | 0.77098405 | 0 |
Generate a description for the combination of well, tile, channel and, optionaly, depth and/or time | def generate_tile_description(tile, time = None, depth = None):
desc = "s"+ str(tile)
if depth is not None:
desc = desc + "_z" + str(depth)
if time is not None:
desc = desc + "_t" + str(time)
return desc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe(self):\n branch = randint(0,62)\n \n if 0 <= branch <= 29: \n if self.casteOrder[0] == 'soldiers':\n if self.genesis == 'escape persecution': \n self.description = '{2}: A full service {3} for retired {1}'.... | [
"0.6358604",
"0.61127687",
"0.60675085",
"0.6044572",
"0.59665823",
"0.592374",
"0.59180605",
"0.59102285",
"0.5901158",
"0.5849729",
"0.5839126",
"0.5819639",
"0.5782906",
"0.5768085",
"0.5766401",
"0.57455444",
"0.5734563",
"0.5732122",
"0.57276",
"0.57193375",
"0.5670834",... | 0.7623472 | 0 |
Generate a name for a file using the description and channel | def generate_file_name(well, channel, desc):
return "bPLATE_w" + well + "_" + desc + "_c" + channel + ".png" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_raw_file_name(self, well, channel, desc):\n \n return \"bPLATE_w\" + well + \"_\" + desc + \"_c\" + channel + \".png\"",
"def file_name(id, title, kind=\"src\"):\n fn_template = conf.template_source_file_name\n if kind == \"tst\":\n fn_template = conf.template_test_fi... | [
"0.75195915",
"0.7167804",
"0.71012443",
"0.70670754",
"0.69943404",
"0.67369324",
"0.6670187",
"0.66342044",
"0.66167426",
"0.6494215",
"0.64797497",
"0.6479064",
"0.6476831",
"0.64566636",
"0.6450938",
"0.64458376",
"0.6431859",
"0.6416797",
"0.6390564",
"0.63887256",
"0.63... | 0.80092597 | 0 |
Constructor that takes the config and the well we are generating images for. | def __init__(self, config, well, directory):
self.config = config
self.well = well
self.directory = directory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, config):\n logging.info(\"Creating footprint\")\n # self.infra = yaml.load(config)\n self.infra = config\n self.footprint_name = self.infra.get(\"footprint\", \"ehw\")\n self.images = self.infra.get(\"images\")\n self.old_images = self.infra.get(\"old_im... | [
"0.66241646",
"0.6582035",
"0.6469281",
"0.6385457",
"0.634032",
"0.6314989",
"0.62429136",
"0.6220419",
"0.6145161",
"0.61328727",
"0.61167324",
"0.61167324",
"0.61167324",
"0.61101764",
"0.6095435",
"0.60907704",
"0.60626227",
"0.6061309",
"0.60489887",
"0.6046789",
"0.6038... | 0.7127226 | 0 |
Generate a name for a file using the description and channel | def _generate_raw_file_name(self, well, channel, desc):
return "bPLATE_w" + well + "_" + desc + "_c" + channel + ".png" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_file_name(well, channel, desc):\n \n return \"bPLATE_w\" + well + \"_\" + desc + \"_c\" + channel + \".png\"",
"def file_name(id, title, kind=\"src\"):\n fn_template = conf.template_source_file_name\n if kind == \"tst\":\n fn_template = conf.template_test_file_name\n\n return f... | [
"0.80091065",
"0.7165928",
"0.7101471",
"0.7064337",
"0.69931364",
"0.67345184",
"0.6668517",
"0.66324764",
"0.66144115",
"0.64927953",
"0.6479",
"0.6476943",
"0.64755803",
"0.6454013",
"0.6448165",
"0.6447837",
"0.6430102",
"0.6413977",
"0.63882077",
"0.63864017",
"0.6377731... | 0.7519707 | 1 |
The function generates and returns a combined table with names of stocks in columns and dates in indexes. Profit tables for individual stocks are taken from stock_retrunrs function. | def Generating_stock_daily_return_table():
#Getting Names list
Profitfile='pap//CombProfit.csv'
path='D://Doktorat Marek//dane//'
ProfitsFilePath=path+Profitfile
quarterly_profit=pd.read_csv(ProfitsFilePath,index_col=0,header=0,parse_dates=True)
Names_list=quarterly_profit.columns.tolist()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setupStockTable(self):\n # Get the date\n # NOTE: This is probably un\n date = datetime.date()\n dateStr = date.month() + \"/\" + date.day() + \"/\" + date.year()\n\n stocks = (\"INTC\", \"AAPL\", \"GOOG\", \"YHOO\", \"SYK\", \"VZ\")\n\n for stock in stocks:\n ... | [
"0.63580585",
"0.61449856",
"0.60916585",
"0.59879607",
"0.586941",
"0.5752481",
"0.574493",
"0.56445813",
"0.5596955",
"0.5551755",
"0.5538056",
"0.55360204",
"0.55317575",
"0.55244833",
"0.5521858",
"0.55173093",
"0.55147207",
"0.54893124",
"0.54601693",
"0.54540384",
"0.54... | 0.6858316 | 0 |
General method for costing belt filter press. Capital cost is a function of flow in gal/hr. | def cost_filter_press(blk):
t0 = blk.flowsheet().time.first()
# Add cost variable and constraint
blk.capital_cost = pyo.Var(
initialize=1,
units=blk.config.flowsheet_costing_block.base_currency,
bounds=(0, None),
doc="Capital cost of unit operation... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cond_boiler_op_cost(Q_therm_W, Q_design_W, T_return_to_boiler_K):\n if Q_therm_W > 0.0:\n\n # boiler efficiency\n eta_boiler = cond_boiler_operation(Q_therm_W, Q_design_W, T_return_to_boiler_K)\n\n E_aux_Boiler_req_W = BOILER_P_AUX * Q_therm_W\n\n Q_primary_W = Q_therm_W / eta_bo... | [
"0.60161155",
"0.5890601",
"0.5859548",
"0.5829997",
"0.5820077",
"0.58090657",
"0.57660633",
"0.57442236",
"0.5743485",
"0.5697327",
"0.56755006",
"0.56499743",
"0.5622",
"0.5602251",
"0.55968297",
"0.5590435",
"0.55680066",
"0.5539766",
"0.5538298",
"0.5469668",
"0.5467324"... | 0.7558044 | 0 |
Test case for create_symlink_file | def test_create_symlink_file(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_symlink(self, source_path, main):\n main_file = os.path.realpath(os.path.join(source_path, main))\n if not os.path.isfile(main_file):\n main_file += '.js'\n if not os.path.isfile(main_file):\n print('\\tWARNING: Could not create symlink for {}, no such file.'.... | [
"0.7453823",
"0.7333795",
"0.7322523",
"0.7264164",
"0.72327024",
"0.71856415",
"0.7102871",
"0.7052772",
"0.70179003",
"0.701752",
"0.6931252",
"0.6921266",
"0.69030124",
"0.6874251",
"0.68668115",
"0.682023",
"0.67737055",
"0.6681461",
"0.66567737",
"0.6653678",
"0.6610112"... | 0.95351255 | 0 |
Test case for get_meta_range | def test_get_meta_range(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_range(self):\n pass",
"def test_get_range_empty(self):\n\n queryset = mock.Mock()\n queryset.aggregate.return_value = None\n\n dimension = models.QuantitativeDimension(\n key='shares',\n name='Count of shares',\n description='Count of shar... | [
"0.8197148",
"0.6618275",
"0.6484984",
"0.64601654",
"0.63697124",
"0.6269415",
"0.6174672",
"0.6106884",
"0.608165",
"0.6080813",
"0.60700256",
"0.6020781",
"0.60202074",
"0.5981426",
"0.59406525",
"0.58997625",
"0.5883565",
"0.5879113",
"0.5847939",
"0.5835961",
"0.5828512"... | 0.9391207 | 0 |
Test case for get_range | def test_get_range(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_meta_range(self):\n pass",
"def getRange(self, p_int): # real signature unknown; restored from __doc__\n pass",
"def _in_range_op(spec):",
"def f_get_range(self, copy=True):\n raise NotImplementedError(\"Should have implemented this.\")",
"def GetTRange(self):\n ...... | [
"0.80703026",
"0.7837224",
"0.7255473",
"0.7147124",
"0.7073319",
"0.7031268",
"0.70060104",
"0.6990455",
"0.6969976",
"0.6872395",
"0.68121374",
"0.67698324",
"0.6767907",
"0.6744316",
"0.67391896",
"0.67225266",
"0.6692281",
"0.66836524",
"0.6643143",
"0.6600423",
"0.659429... | 0.92907894 | 0 |
Compiles network for training | def compile_network(model, optimizer):
compile_network_model(model, optimizer, categorical_crossentropy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile(self):\n logger.info('Define network with dnnet of version : %s'\\\n % dnnet.__version__)\n if self.layers.size == 0:\n msg = 'NeuralNetwork has no layer.\\n Add layers before compiling.'\n raise DNNetRuntimeError(msg)\n\n parent = self.laye... | [
"0.7539172",
"0.7513481",
"0.7444233",
"0.72000104",
"0.719475",
"0.71787214",
"0.7108279",
"0.70971787",
"0.70245636",
"0.699772",
"0.699507",
"0.68741465",
"0.6854814",
"0.68306136",
"0.68187803",
"0.67940164",
"0.67512035",
"0.6746178",
"0.67435986",
"0.6729193",
"0.670608... | 0.78212905 | 0 |
Randomly rotate the point clouds to augument the dataset rotation is per shape based along up direction | def rotate_point_cloud(batch_data):
rotated_data = np.zeros(batch_data.shape, dtype=np.float32)
for k in np.arange(batch_data.shape[0]):
rotation_angle = np.random.uniform() * 2 * np.pi
cosval = np.cos(rotation_angle)
sinval = np.sin(rotation_angle)
rotation_matrix = np.array([[c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_point_cloud(data):\n rotated_data = np.zeros(data.shape, dtype=np.float32)\n for k in xrange(data.shape[0]):\n rotation_angle = np.random.uniform() * 2 * np.pi\n cosval = np.cos(rotation_angle)\n sinval = np.sin(rotation_angle)\n rotation_matrix ... | [
"0.7384044",
"0.69522613",
"0.6924791",
"0.6924791",
"0.6924791",
"0.68159866",
"0.6813395",
"0.6813395",
"0.6746108",
"0.669056",
"0.6641431",
"0.65933377",
"0.65933377",
"0.65933377",
"0.65219665",
"0.64666146",
"0.641492",
"0.6368018",
"0.62005866",
"0.61693",
"0.6102413",... | 0.6964295 | 1 |
Get maximum depth of given tree by BFS | def max_depth(root):
# basic case
if root is None:
return 0
# breadth-first traversal
queue = collections.deque([root])
depth = 0
while queue:
queue_size = len(queue)
for i in range(queue_size):
curr = queue.popleft()
if curr.left is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _max_depth(self):\n max_depth = 0\n for node, data in self.traverse():\n max_depth = max(max_depth, data['level'])\n return max_depth",
"def max_depth(node):\n if not node:\n return 0\n return max(max_depth(node.left), max_depth(node.right)) + 1",
"def maxDepth(... | [
"0.7669001",
"0.7654562",
"0.7653014",
"0.7614319",
"0.7599487",
"0.74606186",
"0.74326384",
"0.73375744",
"0.7196552",
"0.718703",
"0.7182534",
"0.71651614",
"0.7148998",
"0.71120065",
"0.7107149",
"0.7074876",
"0.706041",
"0.7011375",
"0.6983949",
"0.6968935",
"0.6909913",
... | 0.7672864 | 0 |
Crawls each authors pages starting from allauthors main page stored in authors report | def start_requests(self):
authors_pandas = conf.read_from_data('authors.json')
author_link_list = list(
map(lambda obj: (obj['keyUrl'], conf.gd_base_url + obj['article_url'], obj['article_url']),
authors_pandas))
for link in author_link_list:
yield Request... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrape_author(self, author_name, min_len=0, max_len=9999):\n search = sc.search_author(author_name)\n author = next(search)\n sc.fill(author, sections=['publications'])\n print(author.keys())\n with open(\n 'loadings\\\\authors_papers\\\\{}.txt'.format(author_name)... | [
"0.66120636",
"0.6457187",
"0.6398303",
"0.6192936",
"0.61002207",
"0.60938454",
"0.6064179",
"0.6056438",
"0.60388",
"0.5980902",
"0.5950264",
"0.59492725",
"0.5898721",
"0.5894304",
"0.58883196",
"0.5852367",
"0.581795",
"0.5807714",
"0.58075255",
"0.5806006",
"0.5805787",
... | 0.64995414 | 1 |
construct_network establishes all weight matrices and biases and connects them. The outputs may include parameters of the flow | def construct_network(self, n_units, n_samples=1, noise_dim=0,
keep_p=1., nonlinearity=True, init_params=None, name=""):
print "constructing network, n_units: ",n_units
# TODO use kwargs for more elagant solutions to being called by this
# base class
assert keep_p ==1. and n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_networks(self):\n self.online_convnet = self._create_network(name='Online')\n self.target_convnet = self._create_network(name='Target')\n self._net_outputs = self.online_convnet(self.state_ph, training=True)\n self._q_argmax = tf.argmax(self._net_outputs.q_values, axis=1)[0]\n self._repla... | [
"0.7192482",
"0.7097717",
"0.70156425",
"0.69921356",
"0.69625026",
"0.68106323",
"0.67981684",
"0.6779482",
"0.67386734",
"0.67300445",
"0.6718721",
"0.6694646",
"0.6689944",
"0.6686015",
"0.66773814",
"0.66746324",
"0.6673208",
"0.6619003",
"0.66150516",
"0.6595705",
"0.656... | 0.71916044 | 1 |
Add transaction to the history. | def add_history(self):
# add separator, if there already are history entries
if self.parentApp.History != '':
self.parentApp.History += (
'\n\n--- --- --- --- --- --- --- --- --- --- --- ---\n\n'
)
# add the transaction to it
self.parentApp.Histor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addTransaction(self, transaction):\n self.transactions.append(transaction)\n self.transactionIDs.add(transaction.id)",
"def add(self, transaction):\n if isinstance(transaction, Transaction):\n # If the transaction already exists\n if(transaction.hash in self.transac... | [
"0.73509127",
"0.71942204",
"0.7029798",
"0.6894006",
"0.68311554",
"0.6707649",
"0.6418446",
"0.6413464",
"0.6399687",
"0.6394123",
"0.6381334",
"0.63626176",
"0.6356362",
"0.63558763",
"0.63207406",
"0.62853384",
"0.6273537",
"0.6218804",
"0.61947453",
"0.6156782",
"0.61382... | 0.730184 | 1 |
Press cancel go back. | def on_cancel(self, keypress=None):
self.parentApp.switchFormPrevious() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def press_back_button(self):\n self.driver.back()",
"def skip(self):\n self.click_back_button()",
"def back(self):\n self.input_key_event(InputActions.BACK)",
"def back( self ):\n super( ConfirmationScreen, self ).back()\n\n self._current_option = self._current_option - 1\n ... | [
"0.7686845",
"0.76652855",
"0.7510146",
"0.73989546",
"0.7366367",
"0.735423",
"0.7283691",
"0.7280198",
"0.7280198",
"0.7280198",
"0.72527945",
"0.72527945",
"0.7245617",
"0.7226324",
"0.7215707",
"0.7212924",
"0.72069484",
"0.70282036",
"0.7014023",
"0.6985043",
"0.6983128"... | 0.80343944 | 0 |
Parse or generate classification (e.g. public health, education, etc). | def _parse_classification(self, item):
full_name = item.css('td[headers=Name]::text').extract_first()
if "Metra" in full_name and "Board Meeting" in full_name:
return BOARD
elif "Citizens Advisory" in full_name:
return ADVISORY_COMMITTEE
elif "Committee Meeting" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_classification(self, links):\n for link in links:\n if \"hearing\" in link[\"title\"].lower():\n return FORUM\n return COMMISSION",
"def classification(self) -> 'outputs.CaseClassificationResponse':\n return pulumi.get(self, \"classification\")",
"def _... | [
"0.707388",
"0.6647457",
"0.6626518",
"0.6521891",
"0.6510014",
"0.64428645",
"0.636594",
"0.6330406",
"0.6225585",
"0.61786884",
"0.61213285",
"0.6062574",
"0.6061338",
"0.60570234",
"0.6047572",
"0.60411346",
"0.5997528",
"0.5993576",
"0.5987054",
"0.5979351",
"0.5978588",
... | 0.68485194 | 1 |
Cache the response if this request qualifies and has not been cached yet or for restbased and restandtimebased evict the record from the cache if the request method is POST/PATCH/PUT or DELETE | def process_response(self, req, resp, resource, req_succeeded):
# Step 1: for 'rest-based' and 'rest&time-based' eviction strategies the
# POST/PATCH/PUT/DELETE calls are never cached and even more they
# invalidate the record cached by the GET method
if self.cache_config['CACHE_EVICTIO... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_resource(self, req, resp, resource, params):\n\n # Step 1: for 'rest-based' and 'rest&time-based' eviction strategies the\n # POST/PATCH/PUT/DELETE calls are never cached, they should never be\n # loaded from cache as they must always execute,\n # so for those we don't need ... | [
"0.7296144",
"0.7083652",
"0.701264",
"0.68986917",
"0.6891372",
"0.6742869",
"0.67302907",
"0.66479725",
"0.6640116",
"0.6626159",
"0.653558",
"0.6509554",
"0.65028024",
"0.6493731",
"0.64882547",
"0.6464503",
"0.61653435",
"0.6115088",
"0.6103556",
"0.6070408",
"0.6057066",... | 0.77516645 | 0 |
Generate the cache key from the request using the path and the method | def generate_cache_key(req, method: str = None) -> str:
path = req.path
if path.endswith('/'):
path = path[:-1]
if not method:
method = req.method
return f'{path}:{method.upper()}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_view_response_cache_key( # pylint: disable=unused-argument\n handler: Callable[..., Awaitable[StreamResponse]],\n request: Request,\n *args,\n **kwargs,\n) -> str:\n get_params = request.query\n\n hash_ = sha1(request.path.encode('utf-8'))\n\n for param in sorted(get_params):\n ... | [
"0.7671069",
"0.73947465",
"0.69811064",
"0.69450694",
"0.6926922",
"0.6827275",
"0.66507095",
"0.66111356",
"0.6543088",
"0.65096855",
"0.6467866",
"0.64333147",
"0.6348608",
"0.6315374",
"0.6295006",
"0.6290446",
"0.61842054",
"0.6159068",
"0.6157648",
"0.6108428",
"0.60800... | 0.8796167 | 0 |
Serializes the response, so it can be cached. If CACHE_CONTENT_TYPE_JSON_ONLY = False (default), then we need to keep the response ContentType header, so we need to serialize the response body with the content type with msgpack, which takes away performance. For this reason the user can set CACHE_CONTENT_TYPE_JSON_ONLY... | def serialize(self, req, resp, resource) -> bytes:
if self.cache_config['CACHE_CONTENT_TYPE_JSON_ONLY']:
if FALCONVERSION_MAIN < 3:
return resp.body
else:
return resp.text
else:
if FALCONVERSION_MAIN < 3:
return msgpack.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_http_response(self) -> HttpResponse:\n response = (\n JsonResponse(self.body)\n if (self.headers or {}).get(\"Content-Type\") == \"application/json\"\n else HttpResponse(self.body)\n )\n response.headers = self.headers\n return response",
"def r... | [
"0.64963675",
"0.64194614",
"0.636542",
"0.6278377",
"0.61988986",
"0.6171429",
"0.6129956",
"0.60481405",
"0.6038928",
"0.6000924",
"0.60004413",
"0.59598386",
"0.5909832",
"0.5895042",
"0.5895042",
"0.58946943",
"0.58941776",
"0.5894121",
"0.58709216",
"0.5853939",
"0.58444... | 0.72587997 | 0 |
Deserializes the cached record into the response Body or the ContentType and Body | def deserialize(self, data: bytes) -> Tuple[str, Any]:
if self.cache_config['CACHE_CONTENT_TYPE_JSON_ONLY']:
return data
else:
return msgpack.unpackb(data, raw=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deserialize(self, resp):\r\n return self.serializer.deserialize(resp.content, format=resp['Content-Type'])",
"def deserialize(self, data, caches=None):\n return data",
"def decode(self) -> D:\n if self.has_cached_data():\n return self._data\n\n # Dispatch decoding\n ... | [
"0.66872615",
"0.628563",
"0.6097179",
"0.60517174",
"0.6006489",
"0.60002464",
"0.59839606",
"0.59279156",
"0.5876185",
"0.5767751",
"0.57473266",
"0.5706114",
"0.56609535",
"0.56507987",
"0.562745",
"0.5612654",
"0.5603545",
"0.5589274",
"0.5583386",
"0.5578948",
"0.5569624... | 0.6360597 | 1 |
Takes an incoming socket and either stores the command to the command queue, or performs another action based on the command. | def receive_and_store(self, socket, addr):
# Create the incoming connection
conn = IncomingConnection(addr, socket)
# Receive the data from the connection
data = conn.recv_data()
if not data:
logger.warning("Invalid data received")
return
# Get t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_command(self, command_str):\n print \"Received command: {}\".format(command_str)\n commands = command_str.split('#')\n if len(commands) == 2:\n data = None\n elif len(commands) > 2:\n data = commands[2:]\n elif command_str == '':\n # G... | [
"0.6953094",
"0.6832541",
"0.6550946",
"0.6328179",
"0.6293573",
"0.6292742",
"0.6161187",
"0.6027672",
"0.5915629",
"0.5909542",
"0.58832407",
"0.5841701",
"0.58089155",
"0.58026075",
"0.5779208",
"0.5778535",
"0.5763915",
"0.5758714",
"0.5742956",
"0.57220924",
"0.5711825",... | 0.7060211 | 0 |
get base64 string repr of object or np image | def getbase64(nparr,):
if type(nparr) == type({}):
nparr = nparr['img']
im = Image.fromarray(nparr)
buf = BytesIO()
im.save(buf,format="JPEG")
return base64.b64encode(buf.getvalue()).decode('ascii') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base64(self):\n image = self.png.getvalue()\n return base64.encodestring(image).decode('utf-8')",
"def data64(self) -> str:\n return Image.encode64(self.data)",
"def base64_string(self) -> global___Expression:",
"def _get_image(x):\n return b64encode(x).decode('ascii')",
"def data... | [
"0.72159815",
"0.6906734",
"0.68322635",
"0.682055",
"0.6737309",
"0.67277545",
"0.6667643",
"0.66208005",
"0.66028064",
"0.6586784",
"0.65735114",
"0.6563396",
"0.65275586",
"0.6448807",
"0.63930434",
"0.63762724",
"0.63067997",
"0.63018715",
"0.62593025",
"0.6230752",
"0.61... | 0.6916091 | 1 |
make a plot of each object and put image next to it. func defines the type of plot and anything that is done to each image,obj pair | def _dump_plotly(objs, images, func):
l = len(objs)
#print(l)
titles = []
for i,x in enumerate(objs):
if 'id' in x:
titles.append('shape id %d' % x.id)
else:
titles.append('item %d' % i)
fig = tools.make_subplots(rows=l, cols=1, subplot_titles = titles,print_g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_single(potential_func, obstacles, filename, xlim=(-400, 400), ylim=(-400, 400)):\n print \"Generating\", filename\n fig = plt.figure()\n plot = plt.subplot(111)\n show_arrows(plot, potential_func, xlim=xlim, ylim=ylim)\n for obstacle in obstacles:\n show_obstacle(plot, obstacle)\n ... | [
"0.6392929",
"0.6309091",
"0.62998956",
"0.62422526",
"0.62251675",
"0.59421015",
"0.59245807",
"0.590018",
"0.58759063",
"0.5816621",
"0.5809763",
"0.5801232",
"0.57604563",
"0.57517",
"0.5740631",
"0.57335705",
"0.5718802",
"0.5717321",
"0.56906945",
"0.56868666",
"0.568540... | 0.6703569 | 0 |
Parses pidgin's htmlformated logfiles HTML within messages is converted to normal text, so messages about HTMLcode will get lost | def parse_html(root, filename):
root_filename = os.path.join(root, filename)
match_date = regex_date.findall(filename)
if not match_date:
raise Exception(root_filename, 'r')
year = int(match_date[0][0])
month = int(match_date[0][1])
day = int(match_date[0][2])
file = open(root_fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_logfile_html(text):\n out_text = \"\"\n buff = \"\"\n start_tag = \"\"\n end_tag = \"\"\n context = \"none\"\n for i in range(len(text)):\n c = text[i]\n # print \"c = \"+str(c)+\" context = \"+str(context)\n if c == \"<\":\n if context == \"none\":\n ... | [
"0.6302063",
"0.6082321",
"0.60166854",
"0.59433186",
"0.59056187",
"0.57682514",
"0.57220733",
"0.56769717",
"0.5576809",
"0.5557175",
"0.55498254",
"0.5516565",
"0.5464202",
"0.5434003",
"0.5428622",
"0.5424175",
"0.53731394",
"0.5366191",
"0.5362259",
"0.5360732",
"0.53596... | 0.6280499 | 1 |
Asks user for own nicks after listing all encountered ones | def names_interaction():
already_printed = []
for protocol in protocols:
for account in protocol.accounts:
for contact in account.contacts:
for message in contact.messages:
if message.name not in already_printed:
already_printed.app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_sticks_ai(self, sticks):\n print(\"\\nThere are {} sticks on the board\".format(sticks))\n sticks_taken = random.choice(self.hats[sticks]['content'])\n self.hats[sticks]['choice'] = sticks_taken\n sticks -= sticks_taken\n return sticks",
"def user_picks():\r\n print... | [
"0.601555",
"0.5969573",
"0.576979",
"0.5542987",
"0.5438632",
"0.5384672",
"0.53576845",
"0.53359205",
"0.5284243",
"0.5240409",
"0.518095",
"0.5168703",
"0.5161023",
"0.5150909",
"0.5149311",
"0.5141872",
"0.5106042",
"0.5085934",
"0.50680995",
"0.5062412",
"0.5058632",
"... | 0.6445882 | 0 |
Implement the check_unused_args in superclass. | def check_unused_args(self, used_args, args, kwargs):
for k, v in kwargs.items():
if k in used_args:
self._used_kwargs.update({k: v})
else:
self._unused_kwargs.update({k: v}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_args(self, args_):\n\n pass",
"def __init__(self, *unused_args, **unused_kwargs):",
"def __check_args(self):\n self.__check_args_type()\n self.__check_args_val()",
"def ignore(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads\n pass... | [
"0.71085674",
"0.6883384",
"0.67958516",
"0.6730387",
"0.66968954",
"0.6619412",
"0.6390801",
"0.6302647",
"0.6250002",
"0.62224966",
"0.6195048",
"0.6153181",
"0.61491466",
"0.6146345",
"0.6113333",
"0.6072033",
"0.60612833",
"0.60221803",
"0.60128295",
"0.6003403",
"0.59412... | 0.7603612 | 0 |
format a string by a map | def format_map(self, format_string, mapping):
return self.vformat(format_string, args=None, kwargs=mapping) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reprOfStringToValueMap (stringMap : Map) -> String:\n\n entrySeparator = u\"§\"\n entryTemplate = \"%s: %s\"\n keyList = sorted(list(stringMap.keys()))\n result = \"\"\n \n for key in keyList:\n value = stringMap[key] \n result += (iif(result == \"\", \"\", entrySeparator)\n ... | [
"0.7346636",
"0.69570595",
"0.6857461",
"0.67944145",
"0.67872196",
"0.65942025",
"0.64885473",
"0.64343286",
"0.6369347",
"0.6199872",
"0.6082483",
"0.6055873",
"0.6032503",
"0.59989256",
"0.59868157",
"0.59844786",
"0.597163",
"0.59715307",
"0.5968912",
"0.5882509",
"0.5869... | 0.7537712 | 0 |
Get used kwargs after formatting. | def get_used_kwargs(self):
return self._used_kwargs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_kwargs(self):\n return {}",
"def kwargs(self):\n return self._kwargs",
"def kwargs(self):\n return self._kwargs",
"def format_arguments(self, **kwargs):\n return kwargs",
"def get_kwargs(self):\n return {\n 'user': self.user,\n }",
"def get_kwa... | [
"0.7273864",
"0.7083243",
"0.7083243",
"0.7075471",
"0.67573947",
"0.66603476",
"0.6652786",
"0.65693074",
"0.6531428",
"0.65201193",
"0.6439507",
"0.64319444",
"0.6423987",
"0.6408022",
"0.6377557",
"0.6353454",
"0.6334118",
"0.6269364",
"0.6239159",
"0.62325567",
"0.6228446... | 0.7414289 | 0 |
Get unused kwargs after formatting. | def get_unused_kwargs(self):
return self._unused_kwargs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_used_kwargs(self):\n return self._used_kwargs",
"def _scrub_kwargs(kwargs: Dict[str, Any]) -> Dict[str, Any]:\n keywords_to_scrub: List[str] = ['extra_arguments', 'kernel_id']\n scrubbed_kwargs = kwargs.copy()\n for kw in keywords_to_scrub:\n scrubbed_kwargs.pop(kw,... | [
"0.6829997",
"0.6761362",
"0.6697653",
"0.6459872",
"0.6360253",
"0.63554084",
"0.6294143",
"0.6281469",
"0.6259455",
"0.62412184",
"0.62412184",
"0.62019503",
"0.6111536",
"0.6063095",
"0.60411596",
"0.60411596",
"0.599486",
"0.5875321",
"0.5854771",
"0.5847538",
"0.58386594... | 0.7941406 | 0 |
Add element_by alias and extension' methods(if_exists/or_none). | def add_element_extension_method(Klass):
def add_element_method(Klass, using):
locator = using.name.lower()
find_element_name = "element_by_" + locator
find_element_if_exists_name = "element_by_" + locator + "_if_exists"
find_element_or_none_name = "element_by_" + locator + "_or_none... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(self, element):\n pass",
"def add(element):",
"def artAttrTool(*args, exists: Union[AnyStr, bool]=\"\", remove: AnyStr=\"\", q=True, query=True,\n **kwargs)->Union[None, Any]:\n pass",
"def has_element(parent, xpath):\n ele = parent.find('./' + xpath)\n if ele is n... | [
"0.52138686",
"0.5116739",
"0.5036193",
"0.50305545",
"0.49910548",
"0.497446",
"0.48736545",
"0.48461556",
"0.48278427",
"0.47965333",
"0.47628498",
"0.46982324",
"0.46863768",
"0.46765348",
"0.46641046",
"0.46609923",
"0.46489343",
"0.46479532",
"0.46302179",
"0.45912728",
... | 0.6793267 | 0 |
Fluent interface decorator to return self if method return None. | def fluent(func):
@wraps(func)
def fluent_interface(instance, *args, **kwargs):
ret = func(instance, *args, **kwargs)
if ret is not None:
return ret
return instance
return fluent_interface | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __noop(self, *args, **kwargs):\n return None",
"def method(self):\n return None",
"def return_none() -> None:\n pass",
"def __call__(self, *args, **kwargs):\n return self.__wrapped__(*args, **kwargs)",
"def pass_null(func):\n\n def wrapper(obj, *args, **kwargs):\n if not o... | [
"0.6567935",
"0.6153579",
"0.5921167",
"0.5789551",
"0.57773596",
"0.5770913",
"0.5758091",
"0.57273376",
"0.56640935",
"0.5651486",
"0.5617815",
"0.5551248",
"0.5544665",
"0.5541051",
"0.55385506",
"0.5533451",
"0.5528883",
"0.55121976",
"0.54744726",
"0.5464299",
"0.5359974... | 0.62337273 | 1 |
Convert value to a list of key strokes >>> value_to_key_strokes(123) ['1', '2', '3'] >>> value_to_key_strokes('123') ['1', '2', '3'] >>> value_to_key_strokes([1, 2, 3]) ['1', '2', '3'] >>> value_to_key_strokes(['1', '2', '3']) ['1', '2', '3'] | def value_to_key_strokes(value):
result = []
if isinstance(value, Integral):
value = str(value)
for v in value:
if isinstance(v, Keys):
result.append(v.value)
elif isinstance(v, Integral):
result.append(str(v))
else:
result.append(v)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_key_val_list(value):\n if value is None:\n return None\n\n if isinstance(value, (str, bytes, bool, int)):\n raise ValueError('cannot encode objects that are not 2-tuples')\n\n if isinstance(value, collections.Mapping):\n value = v... | [
"0.6031192",
"0.52026004",
"0.5165081",
"0.5160203",
"0.50922084",
"0.5048257",
"0.50478864",
"0.5046137",
"0.50427055",
"0.5000748",
"0.4961365",
"0.49351156",
"0.4862569",
"0.48579395",
"0.48172843",
"0.48017225",
"0.47746295",
"0.4763067",
"0.47456744",
"0.4712962",
"0.463... | 0.77909297 | 0 |
Augment image and key points, bounding boxes !! | def img_and_key_point_augmentation(augmentation, img, bbox, key_points):
# img_copy = img.copy()
image_shape = img.shape
h, w = image_shape[0:2]
# Convert the stochastic sequence of augmenters to a deterministic one.
# The deterministic sequence will always apply the exactly same effects to the im... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def im_detect_keypoints_aug(model, im, boxes):\n\n # Collect heatmaps predicted under different transformations\n heatmaps_ts = []\n # Tag predictions computed under downscaling and upscaling transformations\n ds_ts = []\n us_ts = []\n\n def add_heatmaps_t(heatmaps_t, ds_t=False, us_t=False):\n ... | [
"0.6619781",
"0.65760165",
"0.6573601",
"0.64467424",
"0.63438433",
"0.6319195",
"0.6261868",
"0.6209508",
"0.6207679",
"0.62067044",
"0.61714906",
"0.6164397",
"0.6108835",
"0.60427105",
"0.6042169",
"0.60405695",
"0.6033405",
"0.60134506",
"0.6002291",
"0.5998151",
"0.59661... | 0.7612929 | 0 |
Augment image and bounding boxes !! | def img_augmentation(augmentation, img, bbox):
# img_copy = img.copy()
image_shape = img.shape
h, w = image_shape[0:2]
# Convert the stochastic sequence of augmenters to a deterministic one.
# The deterministic sequence will always apply the exactly same effects to the images.
det = augmentati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocessing(image_data, max_height, max_width):\n img = image_data[\"image\"]\n img = resize_image(img, max_height, max_width)\n gt_boxes = image_data[\"objects\"][\"bbox\"]\n gt_labels = image_data[\"objects\"][\"label\"]\n return img, gt_boxes, gt_labels",
"def to_imgaug(self, image_shape)... | [
"0.68984985",
"0.6853272",
"0.6828715",
"0.6781937",
"0.6781937",
"0.66911954",
"0.66844195",
"0.6655804",
"0.6620257",
"0.6595388",
"0.65874094",
"0.6579807",
"0.65564126",
"0.65507674",
"0.6549536",
"0.65301317",
"0.65256107",
"0.6521426",
"0.6520758",
"0.6511823",
"0.65013... | 0.6885573 | 1 |
Add optimization to the store by inspecting the model field type. | def _optimize_field_by_name(self, store: QueryOptimizerStore, model, selection, field_def) -> bool:
name = self._get_name_from_field_dev(field_def)
if not (model_field := self._get_model_field_from_name(model, name)):
return False
_logger.info('_optimize_field_by_name %r %r', name, m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _optimize_field_by_hints(self, store: QueryOptimizerStore, selected_field, field_def) -> bool:\n if not (optimization_hints := getattr(field_def, 'optimization_hints', None)):\n return False\n args = selected_field.arguments\n self._add_optimization_hints(optimization_hints.sele... | [
"0.53922397",
"0.537939",
"0.49929884",
"0.47674727",
"0.47306097",
"0.46442184",
"0.45238703",
"0.45149407",
"0.45139423",
"0.45052016",
"0.45049003",
"0.44889838",
"0.4485591",
"0.4484575",
"0.4460081",
"0.4451049",
"0.44423994",
"0.44279674",
"0.4426244",
"0.442454",
"0.44... | 0.5479826 | 0 |
Obtain an upload ticket from the API | def get_upload_ticket(self):
r = HTTPClient().fetch(self.config['apiroot'] + self.ticket_path, method="POST",
body=urlencode({'type': 'streaming'}), headers = self.standard_headers,
validate_cert=not self.config['dev'])
response = json.loads(r.body)
return respons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_service_ticket():\n\n payload = {'username': APIC_EM_USER, 'password': APIC_EM_PASSW}\n url = 'https://' + APIC_EM + '/ticket'\n header = {'content-type': 'application/json'}\n ticket_response = requests.post(url, data=json.dumps(payload), headers=header, verify=False)\n if not ticket_respon... | [
"0.67064804",
"0.5887511",
"0.58059216",
"0.5711891",
"0.558435",
"0.55571055",
"0.55388236",
"0.5534896",
"0.55088025",
"0.54868495",
"0.54192376",
"0.531124",
"0.5295683",
"0.5222806",
"0.5221019",
"0.51976347",
"0.51389897",
"0.51316166",
"0.51182204",
"0.50823814",
"0.507... | 0.8335117 | 0 |
Upload a piece of a video file to Vimeo Makes a PUT request to the given URL with the given binary data The _range parameter indicates the first byte to send. The first time you attempt an upload, this will be 0. The next time, it will be the number returned from get_last_uploaded_byte, if that number is less than the ... | def upload_segment(self, upload_uri, _range, data, filetype):
content_range = '%d-%d/%d' % (_range, len(data), len(data))
upload_headers = {'Content-Type': 'video/%s' % filetype,
'Content-Length': len(data),
'Content-Range': 'bytes: %s' % content_range}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_range( # type: ignore\n self, data, # type: bytes\n start_range, # type: int\n end_range, # type: int\n validate_content=False, # type: Optional[bool]\n timeout=None, # type: Optional[int]\n encoding='UTF-8',\n **kwargs\n ... | [
"0.6141114",
"0.5634965",
"0.56206375",
"0.550832",
"0.5482587",
"0.54187346",
"0.5404088",
"0.538972",
"0.5272799",
"0.52320516",
"0.5201052",
"0.511785",
"0.51038563",
"0.5073653",
"0.5050996",
"0.49917027",
"0.49861932",
"0.49765033",
"0.49168584",
"0.49088553",
"0.4880528... | 0.7709178 | 0 |
Get the last byte index of the file successfully uploaded Performs a PUT to the given url, which returns a Range header indicating how much of the video file was successfully uploaded. If less than the total file size, this number is used in subsequent calls to upload_segment | def get_last_uploaded_byte(self, check_uri):
upload_check_headers = {'Content-Range': 'bytes */*'}
request_headers = dict(upload_check_headers.items() + self.standard_headers.items())
try:
HTTPClient().fetch(check_uri, method="PUT", body='', headers=request_headers)
except HT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_size(url: str):\n header = requests.head(url).headers\n if \"Content-Length\" in header and header[\"Content-Length\"] != 0:\n return int(header[\"Content-Length\"])\n elif \"Location\" in header:\n h = requests.head(header[\"Location\"]).headers\n return int(h.get(\"Cont... | [
"0.61535513",
"0.5919975",
"0.5807138",
"0.5694676",
"0.56919193",
"0.5665816",
"0.562974",
"0.55861944",
"0.54725754",
"0.54708993",
"0.54157346",
"0.53107536",
"0.53089446",
"0.5262854",
"0.52135384",
"0.51811814",
"0.5161932",
"0.5133586",
"0.5120558",
"0.5094605",
"0.5090... | 0.6557539 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.