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 |
|---|---|---|---|---|---|---|
Display a list of Member paginated | def list_member(request):
member_list = Member.objects.all()
paginator = Paginator(member_list, 5)
try:
page = int(request.GET.get('page', '1'))
except ValueError:
page = 1
# If page request (9999) is out of range, deliver last page of results.
try:
member_list = pagina... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(request):\n assert isinstance(request, HttpRequest)\n\n form = SearchForm(request.GET or None)\n if form.is_valid():\n search_name = form.data['search_name']\n member_list = Member.objects.filter( Q(name__icontains=search_name) | Q(full_name__icontains=search_nam... | [
"0.78345263",
"0.70588547",
"0.7022545",
"0.6863475",
"0.67834175",
"0.6747191",
"0.6563027",
"0.6514594",
"0.64230216",
"0.637318",
"0.6352936",
"0.6283344",
"0.62146246",
"0.6173804",
"0.6141176",
"0.61208135",
"0.61201227",
"0.610306",
"0.6090148",
"0.6090148",
"0.60892296... | 0.83615065 | 0 |
Align the external registry. | def _align(self):
for external_id, external_entry in sorted(self.external_registry.items()):
if external_id in self.skip_external:
continue
bioregistry_id = self.external_id_to_bioregistry_id.get(external_id)
# There's already a mapping for this external ID t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def align(self):\n ...",
"def temporally_align_data_interfaces(self):\n pass",
"def AlignFieldmaps(self):\n for entry in self.entry_map['fmap']:\n info = self.info[entry]\n\n# Register the magnitude image at the shortest TR to the T1-IR\n# structural image.\n... | [
"0.6081261",
"0.557019",
"0.5147257",
"0.49545655",
"0.49139827",
"0.48331964",
"0.48314154",
"0.46982148",
"0.45978466",
"0.45773122",
"0.45580065",
"0.45571685",
"0.45098197",
"0.45003244",
"0.4498881",
"0.44842976",
"0.44819683",
"0.44467154",
"0.44428003",
"0.44403112",
"... | 0.6750257 | 0 |
Prepare a dictionary to be added to the bioregistry for each external registry entry. The default implementation returns `external_entry` unchanged. If you need more than that, override this method. | def prepare_external(self, external_id: str, external_entry: Dict[str, Any]) -> Dict[str, Any]:
return external_entry | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _align(self):\n for external_id, external_entry in sorted(self.external_registry.items()):\n if external_id in self.skip_external:\n continue\n\n bioregistry_id = self.external_id_to_bioregistry_id.get(external_id)\n # There's already a mapping for this ex... | [
"0.5661854",
"0.52508706",
"0.52203363",
"0.4919496",
"0.48606208",
"0.48559207",
"0.48190767",
"0.48090026",
"0.47993204",
"0.4797935",
"0.47642413",
"0.47563672",
"0.47513482",
"0.4740633",
"0.47319844",
"0.4727857",
"0.4723997",
"0.47188598",
"0.47101957",
"0.47030905",
"0... | 0.77220005 | 0 |
Write the internal registry. | def write_registry(self) -> None:
self.manager.write_registry() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __write(self, registry_data: list) -> None:\n with open(self.__registry_filepath, 'w+') as registry_file:\n registry_file.seek(0)\n registry_file.write(json.dumps(registry_data))\n registry_file.truncate()",
"def write(self):\n\t\traise NotImplementedError('%s: No writ... | [
"0.71736217",
"0.6395241",
"0.6308655",
"0.6276962",
"0.6276962",
"0.6197535",
"0.6197535",
"0.6181082",
"0.61420774",
"0.60741246",
"0.60397553",
"0.60311437",
"0.59387153",
"0.5858807",
"0.58051056",
"0.5795055",
"0.5783678",
"0.5652679",
"0.56347007",
"0.562523",
"0.562328... | 0.8478858 | 0 |
Print the curation table. | def print_curation_table(self, **kwargs) -> None:
s = self.get_curation_table(**kwargs)
if s:
print(s) # noqa:T201 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_table(self):\n print(\"%-12s%-12s%-12s%-12s%-12s\" % (\"index\",\"balance\",\"payment\",\"interest\",\"amortization\"))\n print(\"-------------------------------------------------------------\")\n for i in self.table[\"index\"]:\n print(\"%-12i%-12i%-12i%-12i%-12i\" % (sel... | [
"0.7252084",
"0.7043366",
"0.6997914",
"0.6970662",
"0.68268204",
"0.6667863",
"0.65658396",
"0.6513143",
"0.64058745",
"0.6379583",
"0.6373463",
"0.6369926",
"0.633189",
"0.63122463",
"0.627458",
"0.6262004",
"0.6254405",
"0.62401485",
"0.6236742",
"0.62190664",
"0.6151593",... | 0.72845334 | 0 |
Make turtle t draw a square of with side sz. | def drawSquare(t, sz):
t.shape("turtle")
while 1:
if sz > 200:
break
for j in range (36):
t.left(10)
sz = sz + 1
if j%2 == 1:
t.color("red")
else:
t.color("blue")
for i in range(4):
t.forward(sz)
t.left(90)
sz = sz + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_square(turtle, size):\n\n square = range(4)\n\n for line in square:\n alexa.forward(size)\n alexa.left(90)",
"def make_square(turt,sz):\n for i in range(4):\n turt.forward(sz)\n turt.left(90)",
"def draw_square():\r\n turtle.forward(100)\r\n turtle.le... | [
"0.8070417",
"0.8039957",
"0.774589",
"0.7098677",
"0.6976722",
"0.6861428",
"0.6785766",
"0.6780308",
"0.6778455",
"0.6728188",
"0.6636653",
"0.65735304",
"0.6547466",
"0.6542052",
"0.6403489",
"0.63923377",
"0.63704145",
"0.6338713",
"0.6337131",
"0.6320703",
"0.6318662",
... | 0.85142684 | 0 |
Gets the data from a given slug, returns a JSON respone from the Helix API endpoint | def get_data(slug: str) -> dict:
response = get("data", slug=slug)
try:
return response["data"][0]
except KeyError as e:
log.error(f"Ran into exception: {e}")
log.error(f"Response: {response}")
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def getProductDetailBySlug(self, slug=None):\n payload = {}\n \n if slug:\n payload[\"slug\"] = slug\n \n\n # Parameter validation\n schema = CatalogValidator.getProductDetailBySlug()\n schema.dump(schema.load(payload))\n \n\n url_with... | [
"0.68774015",
"0.6794511",
"0.66812634",
"0.6649883",
"0.65714777",
"0.65092707",
"0.64786947",
"0.6264475",
"0.6155149",
"0.60536057",
"0.60405624",
"0.59062344",
"0.5894154",
"0.585762",
"0.58429706",
"0.5822873",
"0.5815605",
"0.5812659",
"0.5802165",
"0.5779416",
"0.57777... | 0.77147025 | 0 |
Gets the data for given slug, returns a tuple first entry being the mp4_url used to download the clip, second entry being the title of the clip to be used as filename. | def get_clip_data(slug: str) -> tuple:
clip_info = get_data(slug)
if "thumbnail_url" in clip_info and "title" in clip_info:
# All to get what we need to return
# the mp4_url and title of the clip
thumb_url = clip_info["thumbnail_url"]
slice_point = thumb_url.index("-previ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data(slug: str) -> dict:\r\n response = get(\"data\", slug=slug)\r\n\r\n try:\r\n return response[\"data\"][0]\r\n except KeyError as e:\r\n log.error(f\"Ran into exception: {e}\")\r\n log.error(f\"Response: {response}\")\r\n return response",
"def download_clip(clip:... | [
"0.62556016",
"0.62428874",
"0.55988955",
"0.54840624",
"0.54813236",
"0.54214275",
"0.540999",
"0.538477",
"0.53262895",
"0.53129536",
"0.52874196",
"0.5253897",
"0.5250813",
"0.5233298",
"0.5196757",
"0.5182033",
"0.51498044",
"0.5142984",
"0.512994",
"0.5127548",
"0.511784... | 0.8549872 | 0 |
Splits up the URL given and returns the slug of the clip. | def get_slug(clip: str) -> str:
slug = clip.split("/")
return slug[len(slug) - 1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slug_from_url(url):\n\n find_replaces = [\n ('http(s)?://', ''),\n ('\\.', '-'),\n ('/', '-'),\n ]\n\n for find, replace in find_replaces:\n url = re.sub(find, replace, url)\n\n return url",
"def _split_url(url):\n return url[1:].split('/')",
"def get_slug(sel... | [
"0.6573873",
"0.6397004",
"0.6325671",
"0.62193835",
"0.61308074",
"0.60969",
"0.60584766",
"0.6047683",
"0.60388464",
"0.5998331",
"0.5956057",
"0.5953348",
"0.5937267",
"0.5903982",
"0.58827615",
"0.5872457",
"0.58718574",
"0.5865004",
"0.5849255",
"0.57959837",
"0.57903177... | 0.78426516 | 0 |
Downloads the clip, does not return anything. | def download_clip(clip: str, basepath: str) -> None:
slug = get_slug(clip)
mp4_url, clip_title = get_clip_data(slug)
# Remove special characters so we can save the video
regex = re.compile("[^a-zA-Z0-9_]")
clip_title = clip_title.replace(" ", "_") if CLIP_TITLE == "title" else slug
out_fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_cover(self) -> None:\n self.cover_path = None\n if self.cover_url is None:\n Logger.Logger.log('No cover picture found for this song.')\n return\n Logger.Logger.log('Retrieving cover picture from iTunes...')\n url_hash: str = md5(self.cover_url.encode('ut... | [
"0.5969689",
"0.576693",
"0.5721179",
"0.561436",
"0.561436",
"0.5589499",
"0.5550476",
"0.553288",
"0.55146897",
"0.54741114",
"0.5457423",
"0.5455695",
"0.54392725",
"0.54390466",
"0.54390466",
"0.5427849",
"0.5362654",
"0.53607637",
"0.53044415",
"0.52991045",
"0.52852416"... | 0.6272273 | 0 |
Downloads clips, returns a list of streamer names. | def download_clips(data: dict, length: float, path: str) -> list:
amount = 0
length *= 60
names = []
for clip in data:
download_clip(data[clip]["url"], path)
length -= data[clip]["duration"]
name = data[clip]["display_name"]
amount += 1
if name no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_live_streamers(self) -> 'Response':\n headers = {\n 'Content-Type': 'application/json',\n }\n response = await self._client.request(method=RequestMethods.GET,\n url=USERS_LIVE_STREAMERS_URL,\n ... | [
"0.57559013",
"0.53566355",
"0.53493756",
"0.53475106",
"0.52516747",
"0.5216363",
"0.5199266",
"0.51281935",
"0.51072365",
"0.50970334",
"0.5091703",
"0.5090108",
"0.5083827",
"0.5082633",
"0.5065399",
"0.50641793",
"0.5059439",
"0.5045423",
"0.5039622",
"0.50376827",
"0.503... | 0.6597001 | 0 |
Plot the skeleton based on joint angle data | def visualise_from_joints(self, ax):
ax.set_xlim(-2,2)
ax.set_ylim(-2,2)
ax.set_zlim(-1,1)
self.joint2pos()
skeleton_points = self.skeleton_param['list_points']
skeleton_segments = self.skeleton_param['list_segments']
for seg in skeleton_segments:
point_ini = skeleton_segments[seg]['points'][0]
x_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_full_skeleton(input_image, joints, all_joints=None, draw_edges=True, vis=None, all_vis=None, radius=None):\n\n \n joints = joints + 112\n print(joints)\n\n if radius is None:\n radius = max(4, (np.mean(input_image.shape[:2]) * 0.01).astype(int))\n\n colors = {\n 'pink': np.arr... | [
"0.6712119",
"0.66732395",
"0.6326688",
"0.6149413",
"0.6103602",
"0.60394126",
"0.57644",
"0.57560295",
"0.57036847",
"0.5674877",
"0.56541306",
"0.55659026",
"0.5548639",
"0.5521969",
"0.5489853",
"0.547457",
"0.5472636",
"0.5417708",
"0.539933",
"0.5385514",
"0.5375",
"0... | 0.6926737 | 0 |
Register call records namespace. | def register(blueprint):
blueprint.add_route(post, "/call-records", methods=['POST']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_recorder(self, groupname, tablename, recorder,\n timeseries=False):\n self.open_db()\n tab = self.get_table(groupname, tablename)\n if timeseries is False:\n self.add_row(tab, recorder())\n else:\n self.recorders.append((tab, r... | [
"0.51874465",
"0.5077612",
"0.5027467",
"0.49655706",
"0.49356636",
"0.4900239",
"0.4900239",
"0.4899169",
"0.48648772",
"0.48585153",
"0.48410738",
"0.48243338",
"0.4807487",
"0.48033518",
"0.4797804",
"0.47961318",
"0.47794095",
"0.4770171",
"0.47700715",
"0.47573164",
"0.4... | 0.52914554 | 0 |
Determine how to access metadata and break read into ``parts`` This logic is mostly to handle `gather_statistics=False` cases, because this also means we should avoid scanning every file in the dataset. | def _determine_dataset_parts(fs, paths, gather_statistics, filters, dataset_kwargs):
parts = []
if len(paths) > 1:
if gather_statistics is not False:
# This scans all the files
dataset = pq.ParquetDataset(
paths, filesystem=fs, filters=filters, **dataset_kwargs
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract(self):\r\n self._data = []\r\n for fname in self.files:\r\n meta = dict(filename=fname)\r\n\r\n # Perform the actual metadata extraction\r\n fname = os.path.splitext(self.filter_filename(fname))[0]\r\n values = fname.split(self.sep)\r\n\r\n ... | [
"0.6003094",
"0.5807587",
"0.5770916",
"0.5663388",
"0.5620173",
"0.5604538",
"0.5548953",
"0.55457515",
"0.55446166",
"0.55306935",
"0.55277216",
"0.5524769",
"0.55243605",
"0.5494944",
"0.5478514",
"0.546195",
"0.5459989",
"0.54192567",
"0.5416553",
"0.53937715",
"0.5377363... | 0.6683663 | 0 |
Format the CV report in HTML | def get_html_cv_report(db, last_rpt_time):
rval = ""
if not db.table_exists(table="checkables"):
return rval
rval += ("<h2>%s</h2>\n" % cv_sublib.report_title())
diml = [{'name': 'cos',
'pop': "type = 'f' and ? < last_check",
'samp': "type = 'f' and checksum = 1 and ? ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview():\r\n html = create_html_report()\r\n return html",
"def save_html(self, report_summary, file_name, folder):\n myfile = open(file_name, \"w\")\n myfile.write(t('! DOCTYPE html') + nl())\n myfile.write(t('html') + nl())\n myfile.write(t('head') + nl())\n myfil... | [
"0.6857024",
"0.6329301",
"0.6285875",
"0.6268089",
"0.6226494",
"0.62075233",
"0.61447465",
"0.6047048",
"0.60389507",
"0.59905636",
"0.595511",
"0.5953522",
"0.5907026",
"0.58661455",
"0.5827086",
"0.5820692",
"0.5806999",
"0.57924706",
"0.5770915",
"0.5728266",
"0.5708893"... | 0.63381964 | 1 |
Format the MPRA report in HTML | def get_html_mpra_report(db, last_rpt_time):
if not db.table_exists(table="mpra"):
return ""
rval = ("<h2>%s</h2>\n" % mpra_sublib.report_title())
body = ''
hfmt = " %-5s %-20s %-20s %-20s %8s\n"
bfmt = " %-5s %-20s %-20s %-20s %8d\n"
mdelta = 0
pdelta = 0
rows = mpr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_html_report():\n display(HTML('report_page.html'))",
"def format_report_header(self):",
"def report_processing_qc(analysis_dir,html_file):\n # Initialise the HTML report\n processing_qc = Document(\"Processing report for %s\" %\n os.path.basename(analysis_di... | [
"0.6548287",
"0.6382216",
"0.6350493",
"0.63070124",
"0.6249452",
"0.6193579",
"0.61822295",
"0.6177774",
"0.6018906",
"0.59797597",
"0.59589267",
"0.5935615",
"0.5932245",
"0.5914714",
"0.5901026",
"0.5877641",
"0.58640754",
"0.58531994",
"0.5836908",
"0.5832936",
"0.5818078... | 0.6652169 | 0 |
Format the TCC report in HTML | def get_html_tcc_report(db, last_rpt_time):
rval = ""
if not db.table_exists(table='tcc_data'):
return rval
rval = ("<h2>%s</h2>\n" % tcc_sublib.report_title())
checks = correct = error = 0
rows = tcc_sublib.recent_records(last_rpt_time, db=db)
for (t, l, h, c, e) in rows:
che... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_html(self) -> str:\n source_name = escape(self.source_name)\n (covered, lines) = self.coverage_stats()\n lines_stats = \"{} / {} ({} lines of code)\".format(covered, lines, len(self.source_code))\n (br_covered, br_count, calls_covered, calls_count) = self.branch_stats()\n ... | [
"0.61556923",
"0.60551417",
"0.6044294",
"0.6040636",
"0.60342383",
"0.5991108",
"0.5984696",
"0.5921795",
"0.5864797",
"0.5859054",
"0.58359385",
"0.57773423",
"0.57677716",
"0.5733748",
"0.57317203",
"0.57093257",
"0.56609064",
"0.5646776",
"0.5618573",
"0.55744916",
"0.557... | 0.68484527 | 0 |
Extracts url from html | def extract_url(td):
url = td.find('a',href=True)['href']
return url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_url(self, url, html):\n html = self.getHtmlContent(html, 'content')\n new_urls = self.getValidUrlsFromHtml(html)\n return new_urls",
"def extractUrl(self, href):\n url = ''\n pattern = re.compile(r'(http[s]?://[^&]+)&', re.U | re.M)\n url_match = pattern.sear... | [
"0.6942664",
"0.694266",
"0.67256683",
"0.6684412",
"0.66800857",
"0.65427136",
"0.65086895",
"0.64643157",
"0.6385671",
"0.63537264",
"0.6315027",
"0.630541",
"0.62315476",
"0.61999756",
"0.6182553",
"0.6172405",
"0.6132446",
"0.6130918",
"0.6104548",
"0.60942876",
"0.607704... | 0.7369381 | 0 |
List all users and their assignments to queues. | def list_command(ctx: click.Context, user_ids: Tuple[int], queue_ids: Tuple[int]) -> None:
with RossumClient(context=ctx.obj) as rossum:
queue_users = rossum.get_queues((USERS,), users=user_ids)
user_queues: Dict[int, List[List[Optional[str]]]] = {}
for queue in queue_users:
if queue_ids an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_queue_users():\n users = firebase_admin.auth.list_users().iterate_all()\n for user in users:\n if user.disabled: # skip disabled users\n continue\n # add user task\n add_task(url_for(\"task_queue_podcasts\"), {\"user_uid\": user.uid})\n\n return OK_RESPONSE",
"d... | [
"0.6420194",
"0.62280095",
"0.61567736",
"0.6114229",
"0.6111416",
"0.60904527",
"0.6056923",
"0.59933186",
"0.59414256",
"0.5924326",
"0.5871818",
"0.58335733",
"0.5831743",
"0.58315027",
"0.5815715",
"0.5800357",
"0.5722068",
"0.57204676",
"0.5710141",
"0.57079506",
"0.5701... | 0.71933156 | 0 |
Helper Function for isvalid, Checks if s1, s2 are a valid bracket pair | def isValidPair(self,s1,s2):
if (s1 == '(' and s2 == ')'):
return True
if (s1 == '[' and s2 == ']'):
return True
if (s1 == '{' and s2 == '}'):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(str1, str2):\n if ( (str2 == '[' and str1 == ']')\n or (str2 == '{' and str1 == '}')\n or (str2 == '(' and str1 == ')')):\n return True\n return False",
"def multi_bracket_validation(input):\n brackets = Stack()\n for i in input:\n if i == '(' or i == '[' or... | [
"0.6902342",
"0.6578745",
"0.64985824",
"0.6201826",
"0.6157199",
"0.61534166",
"0.6116992",
"0.60981786",
"0.60610473",
"0.5993438",
"0.5981416",
"0.5980033",
"0.5964657",
"0.59297395",
"0.58786607",
"0.5873677",
"0.5793385",
"0.57868797",
"0.57779795",
"0.5727495",
"0.57272... | 0.86355895 | 0 |
Checks if s contains valid ({[]}) pair in correct order | def isValid(self, s: str) -> bool:
st = []
for char in s:
if (len(st) != 0):
e = st[-1]
if (self.isValidPair(e,char)):
st.pop()
continue
st.append(char)
return (len(st)==0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isValid(self, s):\n # 1\n if not s:\n return True\n\n # 2\n if not len(s) % 2 == 0:\n return False\n\n comp = {\n ')': '(',\n ']': '[',\n '}': '{',\n }\n stack = []\n\n for char in s:\n # 3... | [
"0.6825853",
"0.6750236",
"0.6749478",
"0.66877943",
"0.6573299",
"0.6547619",
"0.6510734",
"0.6484433",
"0.62763965",
"0.6209836",
"0.61905116",
"0.61400807",
"0.60200226",
"0.59876984",
"0.5978047",
"0.5973066",
"0.5904061",
"0.58395123",
"0.5775908",
"0.5752234",
"0.563264... | 0.69817543 | 0 |
Returns a list with the order traversal of elements in the tree Uses a strategy type pattern with parameters strategy = {PRE,POST,IN} For respective order traversals | def RecursiveTraversal(self, root: TreeNode, strategy: str) -> List[int]:
result = []
if (root):
if strategy == 'POST':
if (root.left is not None):
result = result + self.RecursiveTraversal(root.left,strategy)
if (root.right is not None):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def traverse_postorder(operation):\n\n nodes_postorder = []\n def recurse(node):\n if isinstance(node, Operation):\n for input_node in node.input_nodes:\n recurse(input_node)\n nodes_postorder.append(node)\n\n recurse(operation)\n return nodes_postorder",
"... | [
"0.6355085",
"0.63519377",
"0.6300792",
"0.628017",
"0.62159055",
"0.61725616",
"0.6165398",
"0.61307913",
"0.6094408",
"0.60663015",
"0.60005105",
"0.5948831",
"0.594843",
"0.59415513",
"0.5918404",
"0.5880077",
"0.58614326",
"0.58589536",
"0.58558935",
"0.5847287",
"0.58438... | 0.695369 | 0 |
Compute the LegendreGaussLobatto quadrature nodes. | def legendre_gauss_lobatto_nodes(N, # noqa: N803
backend=None, force_dim_axis=False):
return jacobi_gauss_lobatto_nodes(0, 0, N,
backend=backend, force_dim_axis=force_dim_axis) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ReferenceElement(N):\n\n # Legendre polynomials are Jacobi(alpha,beta) polynomials\n alpha=0.; beta=0;\n\n # Gauss-Lobatto quadrature points for Legendre polynomials\n # According to Hesthaven+Warburton (p. 448, JacobGL.m) these\n # are the order N-2 Gauss quadrature points of Jacobi polynomials... | [
"0.58593106",
"0.58049333",
"0.57061964",
"0.5585701",
"0.5494929",
"0.5449645",
"0.5404597",
"0.5396169",
"0.53935695",
"0.53853106",
"0.5384895",
"0.53766567",
"0.5354576",
"0.5340692",
"0.5332809",
"0.53303593",
"0.5283502",
"0.5264142",
"0.52536964",
"0.5246925",
"0.52407... | 0.62280107 | 0 |
Generate a base64 encoded reference to a given Django ORM instance. | def serialize_model_instance(instance):
ref = [instance.__class__.__module__, instance.__class__.__name__, instance.pk]
dumped_ref = json.dumps(ref).encode('utf-8')
return b64encode(dumped_ref).decode('utf-8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base64_string(self) -> global___Expression:",
"def serialize(obj):\n result = base64.urlsafe_b64encode(obj)\n # this workaround is needed because in case of python 3 the\n # urlsafe_b64encode method returns string of 'bytes' class.\n result = result.decode()\n return result",
"def serialized... | [
"0.65252703",
"0.6164654",
"0.6147635",
"0.60311043",
"0.5965339",
"0.5942643",
"0.5856737",
"0.57892215",
"0.5784739",
"0.5777973",
"0.57017314",
"0.56621474",
"0.56593806",
"0.5639606",
"0.5626723",
"0.55980736",
"0.55938447",
"0.5560814",
"0.55501676",
"0.55286133",
"0.552... | 0.67707986 | 0 |
Load Django ORM instance from base64 encoded reference. | def deserialize_model_instance(encoded):
dumped_ref = b64decode(encoded)
ref = json.loads(dumped_ref.decode('utf-8'))
model_module = import_module(ref[0])
model_class = getattr(model_module, ref[1])
return model_class.objects.get(pk=ref[2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loads(cls, data: str) -> \"Serializable\":\n instance = dill.loads(base64.b64decode(data.encode(\"ascii\")))\n if not isinstance(instance, cls):\n raise TypeError(f\"Unpickled object is not of type {cls}\")\n return instance",
"def deserialize(obj):\n result = base64.urlsaf... | [
"0.60619754",
"0.59615856",
"0.5860249",
"0.5757516",
"0.5731678",
"0.5695101",
"0.5684532",
"0.56761885",
"0.5633992",
"0.54312295",
"0.5369191",
"0.5346863",
"0.5322224",
"0.5310522",
"0.5259935",
"0.5250897",
"0.5246336",
"0.5245134",
"0.5214885",
"0.5203839",
"0.51985216"... | 0.65203667 | 0 |
Filter out users where tracking coverage is too low | def filter_tracking_coverage(sp, locs, tpls, trips):
print("\t filter by tracking coverage")
def filter_user_by_number_of_days(
sp, tpls, coverage=0.7, min_nb_good_days=28, filter_sp=True
):
nb_users = len(sp.user_id.unique())
sp_tpls = sp.append(tpls).sort_values(["user_id", "star... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune(self):\n target_user_ids = self.get_queryset().values_list('id', flat=True)\n exclude_user_ids = SentDrip.objects.filter(date__lt=conditional_now(),\n drip=self.drip_model,\n user__id__in=tar... | [
"0.56458056",
"0.5546361",
"0.5329408",
"0.5329177",
"0.52725947",
"0.526916",
"0.5250236",
"0.5200599",
"0.5181351",
"0.5166104",
"0.51466775",
"0.51419705",
"0.5112545",
"0.5094425",
"0.50508887",
"0.4991155",
"0.49397007",
"0.49257168",
"0.49173298",
"0.49149612",
"0.49059... | 0.68626004 | 0 |
Given the locations and staypoints OF ONE USER, generate the graph | def generate_graph(
locs_user, sp_user, study, trips_user=None, gap_threshold=None
):
# print(sp_user["location_id"])
# print(locs_user)
AG = ActivityGraph(
sp_user,
locs_user,
trips=trips_user,
gap_threshold=gap_threshold,
)
# Add purpose feature
if study == ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_locations(\n staypoints,\n method=\"dbscan\",\n epsilon=100,\n num_samples=1,\n distance_metric=\"haversine\",\n agg_level=\"user\",\n activities_only=False,\n print_progress=False,\n n_jobs=1,\n):\n if agg_level not in [\"user\", \"dataset\"]:\n raise AttributeErr... | [
"0.659939",
"0.59695464",
"0.58203804",
"0.5736499",
"0.57258886",
"0.5721508",
"0.56901395",
"0.56083816",
"0.5594009",
"0.55866593",
"0.5553673",
"0.55434465",
"0.55286705",
"0.5508056",
"0.5475889",
"0.547315",
"0.54577315",
"0.5440168",
"0.5398705",
"0.53711665",
"0.53706... | 0.720365 | 0 |
Decorator to transform tuple into a series | def to_series(func):
@wraps(func)
def add_series(center, home_center):
normed_center = func(center.x, center.y, home_center)
return pd.Series(normed_center, index=["x_normed", "y_normed"])
return add_series | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_series(obj):\n vals = obj.values\n return transform_array(vals)",
"def fit_transform(self,\n series: Union[TimeSeries, Sequence[TimeSeries]],\n *args,\n **kwargs) -> Union[TimeSeries, List[TimeSeries]]:\n return self.fit(se... | [
"0.6347814",
"0.5983925",
"0.59830374",
"0.57251686",
"0.5697443",
"0.55903757",
"0.5556683",
"0.5526106",
"0.55077857",
"0.55077857",
"0.54631025",
"0.54327905",
"0.5429192",
"0.53740853",
"0.5326982",
"0.5293809",
"0.5269717",
"0.52383643",
"0.5229252",
"0.5213238",
"0.5200... | 0.61962026 | 1 |
Normalize (x, y) point by home center with haversine distance | def get_haversine_displacement(x, y, home_center):
sign_x = 1 if x > home_center.x else -1
displacement_x = ti.geogr.point_distances.haversine_dist(
x, home_center.y, home_center.x, home_center.y
)[0]
sign_y = 1 if y > home_center.y else -1
displacement_y = ti.geogr.point_distances.haversine... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_normalize(x):\n return (x - K.mean(x)) / K.std(x)",
"def center_normalize(x):\n return (x - K.mean(x)) / K.std(x)",
"def center(x):\n return x - x.mean()",
"def project_normalize_coordinates(node_feats, transformer=None, crs=None):\n # get home node:\n home_node = node_feats.iloc[\n... | [
"0.6706094",
"0.6706094",
"0.6531805",
"0.6390352",
"0.6324326",
"0.6195097",
"0.61200726",
"0.608594",
"0.59820485",
"0.59815353",
"0.59811616",
"0.59621364",
"0.59285176",
"0.5893189",
"0.58789176",
"0.5869087",
"0.5867697",
"0.5864994",
"0.58597124",
"0.5850982",
"0.584125... | 0.67650664 | 0 |
As input to the DL model, we want coordinates relative to home. To do so, we project the coordinates if possible or use the haversine distance. | def project_normalize_coordinates(node_feats, transformer=None, crs=None):
# get home node:
home_node = node_feats.iloc[
(node_feats["in_degree"] + node_feats["out_degree"]).argmax()
]
home_center = home_node["center"]
@to_series
def get_projected_displacement(x, y, home_center):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project(self, (lng, lat)):\n x = lng * DEG_TO_RAD\n lat = max(min(MAX_LATITUDE, lat), -MAX_LATITUDE)\n y = lat * DEG_TO_RAD\n y = math.log(math.tan((math.pi / 4) + (y / 2)))\n return (x*EARTH_RADIUS, y*EARTH_RADIUS)",
"def get_haversine_displacement(x, y, home_center):\n sign_x = 1 if x > home_center... | [
"0.6284721",
"0.6001774",
"0.5923108",
"0.59172964",
"0.5848251",
"0.58461255",
"0.5788823",
"0.5744928",
"0.5701934",
"0.56556606",
"0.56522423",
"0.56383795",
"0.5605939",
"0.556082",
"0.5559464",
"0.55476177",
"0.5541876",
"0.55329305",
"0.55219483",
"0.5511411",
"0.549560... | 0.6179198 | 1 |
Load mydataset. This is a template for adding a function to load a dataset from MoleculeNet. Adjust the global variable URL strings, default parameters, default featurizers, transformers, and splitters, and variable names as needed. All available featurizers, transformers, and splitters are in the `DEFAULTS_X` global v... | def load_mydataset(
featurizer: Featurizer = DEFAULT_FEATURIZERS['CircularFingerprint'],
transformers: List[Transformer] = [
DEFAULT_TRANSFORMERS['NormalizationTransformer']
],
splitter: Splitter = DEFAULT_SPLITTERS['RandomSplitter'],
reload: bool = True,
data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_dataset(self, split, epoch=1, combine=False, **kwargs):\n paths = utils.split_paths(self.cfg.data)\n assert len(paths) > 0\n data_path = paths[(epoch - 1) % len(paths)]\n\n # infer langcode\n src, tgt = self.cfg.source_lang, self.cfg.target_lang\n\n self.datasets[... | [
"0.6464995",
"0.6344406",
"0.63009864",
"0.62198555",
"0.6104486",
"0.6049461",
"0.57530385",
"0.57283473",
"0.5718382",
"0.5714284",
"0.56947726",
"0.56910175",
"0.56653357",
"0.5658124",
"0.56215054",
"0.55981797",
"0.55725634",
"0.5554376",
"0.5487216",
"0.5476791",
"0.545... | 0.75441635 | 0 |
Wraps a batch, ensuring the Begin and appropriate Commit/Rollback messages are sent. The context manager provides a function that can be used to publish mutation events that are part of the batch. | def batch(self, batch_identifier, begin_operation):
logger.debug('Starting transaction...')
self.publish(
batch_operation=BatchOperation(
batch_identifier=batch_identifier,
begin_operation=begin_operation,
),
)
def mutation(mutatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flush_batch(self, batch: Sequence[TResult]) -> None:\n pass",
"def on_batch_begin(self, batch, logs=None):",
"def update_batch(self, *args, **kwargs):\n pass",
"def batch(self, batch):\n\n self._batch = batch",
"async def __aenter__(self) -> 'Batch':\n return self",
"def p... | [
"0.6107172",
"0.6058084",
"0.59232724",
"0.5890671",
"0.5817309",
"0.56705236",
"0.56705236",
"0.5649754",
"0.5590239",
"0.5588603",
"0.5561749",
"0.55558044",
"0.55515575",
"0.55392265",
"0.55080247",
"0.54725164",
"0.54669183",
"0.5443207",
"0.5433236",
"0.54260266",
"0.539... | 0.71501136 | 0 |
Setup a subparser and add commands argument. | def setup_subparser(name, description, commands):
subparser = SUBPARSER.add_parser(
name,
help=description
)
subparser.add_argument(
'sub_command',
metavar='sub_command',
type=str,
nargs='+',
help='Which command to run. Options: %s' % ', '.join(command... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend_cli(self, subparser):",
"def setup_subcommands(argparser):\n\n subparsers = argparser.add_subparsers()\n\n parser_info = subparsers.add_parser('info', help = 'Provide the information about the user')\n parser_info.add_argument('user', help = 'The user to inspect')\n\n parser_ownerships = s... | [
"0.7698085",
"0.75867957",
"0.73314893",
"0.73306316",
"0.7281835",
"0.7191596",
"0.71781605",
"0.7178032",
"0.7148665",
"0.7147075",
"0.7076881",
"0.70134723",
"0.6995097",
"0.69701797",
"0.69290245",
"0.6924605",
"0.69063866",
"0.69054353",
"0.6900211",
"0.68858474",
"0.684... | 0.87016386 | 0 |
Provider callback to supply trunk information by parent port. | def trunk_by_port_provider(resource, port_id, context, **kwargs):
return trunk_objects.Trunk.get_object(context, port_id=port_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_subports_handler(self, *args, **kwargs):\n payload = kwargs['payload']\n trunk = payload.current_trunk\n subports = payload.subports\n self._add_subports(trunk, subports)",
"def create_trunk(self, trunk_id, port_id, port_mac):\n trunk = TrunkParentPort(trunk_id, port_i... | [
"0.5619033",
"0.55133367",
"0.5189067",
"0.50392914",
"0.50232095",
"0.49888024",
"0.49793926",
"0.49399418",
"0.49195224",
"0.48990533",
"0.48919058",
"0.4873907",
"0.4868863",
"0.4865824",
"0.47533485",
"0.46831423",
"0.46696264",
"0.46676424",
"0.4636975",
"0.459998",
"0.4... | 0.64877063 | 0 |
Update subport bindings to match trunk host binding. | def update_subport_bindings(self, context, subports):
el = context.elevated()
ports_by_trunk_id = collections.defaultdict(list)
updated_ports = collections.defaultdict(list)
for s in subports:
ports_by_trunk_id[s['trunk_id']].append(s['port_id'])
for trunk_id, subpor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _process_trunk_subport_bindings(self, context, trunk, port_ids):\n updated_ports = []\n trunk_port_id = trunk.port_id\n trunk_port = self.core_plugin.get_port(context, trunk_port_id)\n trunk_host = trunk_port.get(portbindings.HOST_ID)\n migrating_to_host = trunk_port.get(\n ... | [
"0.72594476",
"0.62411875",
"0.60699815",
"0.6037147",
"0.58178145",
"0.5778144",
"0.5715002",
"0.5682961",
"0.56433135",
"0.5611568",
"0.5526104",
"0.5511807",
"0.5493885",
"0.5483759",
"0.5401468",
"0.5302826",
"0.52826065",
"0.5278357",
"0.5265437",
"0.5241553",
"0.5210903... | 0.73464423 | 0 |
Update the trunk status to reflect outcome of data plane wiring. | def update_trunk_status(self, context, trunk_id, status):
with db_api.CONTEXT_WRITER.using(context):
trunk = trunk_objects.Trunk.get_object(context, id=trunk_id)
if trunk:
self._safe_update_trunk(trunk, status=status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateStatus(self, status):\n pass",
"def setPlayerStates(self, updates):\r\n for upd in updates:\r\n print \"UPD player %s\" % upd['player']\r\n player = self.players[upd['player']]\r\n player.setStatus(upd['status'], upd['jump'], upd['charge'])\r\n\r\n ... | [
"0.59264684",
"0.587799",
"0.5827756",
"0.57601655",
"0.57076484",
"0.5657012",
"0.56370485",
"0.5632501",
"0.5620142",
"0.55872035",
"0.55813205",
"0.5570724",
"0.54910195",
"0.54610723",
"0.5435151",
"0.5413461",
"0.5406934",
"0.53957736",
"0.53900707",
"0.53420854",
"0.534... | 0.66915464 | 0 |
Process port bindings for subports on the given trunk. | def _process_trunk_subport_bindings(self, context, trunk, port_ids):
updated_ports = []
trunk_port_id = trunk.port_id
trunk_port = self.core_plugin.get_port(context, trunk_port_id)
trunk_host = trunk_port.get(portbindings.HOST_ID)
migrating_to_host = trunk_port.get(
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_subports(self, trunk, subports):\n df_parent = self.nb_api.get(l2.LogicalPort(id=trunk.port_id))\n for subport in subports:\n self._add_subport(trunk, subport, df_parent)\n self._update_subport_statuses(trunk.port_id, subports)",
"def update_subport_bindings(self, context... | [
"0.709539",
"0.7085368",
"0.6798057",
"0.6746032",
"0.6344534",
"0.5957856",
"0.59459835",
"0.5633385",
"0.56034285",
"0.53181684",
"0.5282736",
"0.52312386",
"0.5199397",
"0.5183888",
"0.518253",
"0.51030344",
"0.5098466",
"0.50715005",
"0.50691193",
"0.50661856",
"0.5005763... | 0.80192614 | 0 |
Tell the agent about a trunk being created. | def trunk_created(self, context, trunk):
self._resource_rpc.push(context, [trunk], events.CREATED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_trunk(self, trunk_id, port_id, port_mac):\n trunk = TrunkParentPort(trunk_id, port_id, port_mac)\n try:\n if not trunk.bridge.exists():\n raise exc.TrunkBridgeNotFound(bridge=trunk.bridge.br_name)\n trunk.plug(self.br_int)\n except RuntimeError a... | [
"0.636586",
"0.56802857",
"0.559323",
"0.5474232",
"0.5465365",
"0.54455197",
"0.5414655",
"0.53447294",
"0.5334757",
"0.5334757",
"0.530312",
"0.52899647",
"0.5281329",
"0.5230191",
"0.52272636",
"0.52272636",
"0.52272636",
"0.52031016",
"0.517991",
"0.51687413",
"0.5164937"... | 0.8424135 | 0 |
Tell the agent about a trunk being deleted. | def trunk_deleted(self, context, trunk):
self._resource_rpc.push(context, [trunk], events.DELETED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ticket_deleted(self, ticket):",
"def delete():\n click.echo('delete was called.')",
"def ticket_deleted(self, ticket):\n if 'ticket' not in self.sources:\n return\n gnp = GrowlNotificationPacket(notification='ticket',\n title='Ticket #%d dele... | [
"0.6661764",
"0.64171475",
"0.64160955",
"0.6204961",
"0.61002207",
"0.60787624",
"0.6034837",
"0.59630114",
"0.5942703",
"0.5942189",
"0.59273684",
"0.5918228",
"0.58854705",
"0.58777356",
"0.5877477",
"0.58540946",
"0.58333445",
"0.58311665",
"0.58311665",
"0.58311665",
"0.... | 0.8402147 | 0 |
Tell the agent about new subports to add. | def subports_added(self, context, subports):
self._resource_rpc.push(context, subports, events.CREATED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_subports_handler(self, *args, **kwargs):\n payload = kwargs['payload']\n trunk = payload.current_trunk\n subports = payload.subports\n self._add_subports(trunk, subports)",
"def _add_subports(self, trunk, subports):\n df_parent = self.nb_api.get(l2.LogicalPort(id=trunk... | [
"0.70927566",
"0.7042181",
"0.6376136",
"0.63531935",
"0.56381696",
"0.55981827",
"0.558805",
"0.5571931",
"0.5547448",
"0.5459118",
"0.54546964",
"0.5422842",
"0.53876525",
"0.5361296",
"0.5357681",
"0.5305928",
"0.53015155",
"0.52851564",
"0.52837807",
"0.52406853",
"0.5188... | 0.78780574 | 0 |
Tell the agent about existing subports to remove. | def subports_deleted(self, context, subports):
self._resource_rpc.push(context, subports, events.DELETED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delete_subports_handler(self, *args, **kwargs):\n payload = kwargs['payload']\n trunk = payload.current_trunk\n subports = payload.subports\n self._delete_subports(trunk, subports)",
"def _delete_subports(self, trunk, subports):\n df_parent = self.nb_api.get(l2.LogicalPort... | [
"0.67607665",
"0.6679392",
"0.6238778",
"0.6224345",
"0.616057",
"0.60194",
"0.59349513",
"0.5784502",
"0.57671446",
"0.57442874",
"0.57296705",
"0.5690951",
"0.5671759",
"0.5668719",
"0.56362563",
"0.5633142",
"0.55769914",
"0.5551251",
"0.554487",
"0.5493517",
"0.54907167",... | 0.68250704 | 0 |
Helper fixture for add fleur schema tests Creates a Schema form the 0.34 schemas by just changing the version number to 0.01 removes the corresponding folder after the tests | def fake_schemas_and_test_files(tmp_path, test_file):
import masci_tools
from masci_tools.io.parsers.fleur import register_migration
from masci_tools.io.parsers.fleur.fleur_outxml_parser import _TaskParser
#Create migration to be able to use the outxml_parser
@register_migration(base_version='0.34'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_schema():\n return 'test_schema'",
"def test_versioned_release_schema():\n path = 'versioned-release-validation-schema.json'\n if os.path.exists(path):\n warn_and_assert([path], '{0} is present, run: rm {0}',\n 'Versioned release schema files are present. See warni... | [
"0.66084665",
"0.64975446",
"0.62625825",
"0.6225974",
"0.62073606",
"0.61930996",
"0.6191072",
"0.61177087",
"0.6056608",
"0.603084",
"0.60139173",
"0.6012539",
"0.5997258",
"0.59951305",
"0.59671104",
"0.5963642",
"0.5961408",
"0.59456563",
"0.5932938",
"0.5872717",
"0.5869... | 0.7063366 | 0 |
Generates reasonable parameter combinations. | def parameter_combinations(cls, raw=False):
parameter_combinations = {'proportion': [0.1, 0.25, 0.5, 0.75,
1.0, 1.5, 2.0],
'n_neighbors': [5, 7, 9],
't': [0.3, 0.5, 0.8]}
return cls.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parameter_combinations(cls, raw=False):\r\n parameter_combinations = {'proportion': [0.1, 0.25, 0.5, 0.75,\r\n 1.0, 1.5, 2.0],\r\n 'n_neighbors': [3, 5, 7]}\r\n return cls.generate_parameter_combinations(parameter_co... | [
"0.76313037",
"0.7224867",
"0.70344704",
"0.67043203",
"0.6637404",
"0.66145205",
"0.66092134",
"0.6572072",
"0.6570018",
"0.65444964",
"0.65280664",
"0.64884037",
"0.64671034",
"0.63868093",
"0.6379742",
"0.6354687",
"0.6319228",
"0.627921",
"0.6229858",
"0.6163955",
"0.6131... | 0.76634777 | 0 |
Return the list with every other element of the list starting with the first >>>every_other_new([5, "book", "computer", 4]) [5, "computer"] | def every_other_new (list):
return list[::2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def every_other(seq):\n every_other = seq[::2]\n return every_other",
"def everyother(l, evenind = True):\n\tx = evenind\n\tresult = []\n\tfor el in l:\n\t\tif x:\n\t\t\tresult.append(el)\n\t\tx = not x\n\treturn result",
"def every_other(seq):\n seq = seq[::2]\n return seq",
"def every_other(seq... | [
"0.65220475",
"0.649866",
"0.64737666",
"0.6340509",
"0.6264626",
"0.60266745",
"0.55710185",
"0.55634767",
"0.55586797",
"0.5421033",
"0.5331364",
"0.52655756",
"0.5256756",
"0.5178552",
"0.5163781",
"0.51042634",
"0.50668144",
"0.5015972",
"0.5002389",
"0.4960613",
"0.49420... | 0.808119 | 0 |
Return the validator dictionary. | def validator(self) -> Optional[Dict[str, Any]]:
return self._validator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_validator_kwargs(self):\n return {\n 'schema': self.get_validation_schema(),\n }",
"def get_validate(self) -> dict:\n response = self.rc.execute(\"GET\",\n self._get_uri(GET_VALIDATE_URI),\n headers=self.h... | [
"0.7152374",
"0.70878893",
"0.6952434",
"0.6856572",
"0.6742903",
"0.67127526",
"0.66705245",
"0.65641207",
"0.6417823",
"0.63874716",
"0.636434",
"0.62552",
"0.61715084",
"0.6151127",
"0.61211085",
"0.6085729",
"0.6057178",
"0.6043076",
"0.60317767",
"0.60255325",
"0.5916598... | 0.7766095 | 0 |
Set the validator dictionary. | def validator(self, value: Optional[Dict[str, Any]]):
self._validator = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validator_info(self, validator_info):\n\n self._validator_info = validator_info",
"def validator(self) -> Optional[Dict[str, Any]]:\n return self._validator",
"def validations(self, validations):\n\n self.container['validations'] = validations",
"def __init__(self,validator):\n ... | [
"0.63722885",
"0.59797984",
"0.59709877",
"0.5968238",
"0.59022975",
"0.58239925",
"0.5774157",
"0.56801814",
"0.5592095",
"0.5553507",
"0.55335283",
"0.55131084",
"0.5410613",
"0.5351317",
"0.53378487",
"0.53378487",
"0.5327392",
"0.5327392",
"0.5301388",
"0.52763367",
"0.52... | 0.7382766 | 0 |
Set the required list. | def required(self, value: Optional[List[str]]):
self._required = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_listonly(self, value):\n if not value and self.__listonly:\n self.__listonly = False\n self.clear_preprocessed()",
"def setup_lists(self):\n pass",
"def set_required(self, val):\n if not contain_in_list_equal(val, PARAM_REQUIRED):\n raise ArgumentE... | [
"0.6505629",
"0.6397032",
"0.6206235",
"0.6055954",
"0.5997724",
"0.5990036",
"0.5935963",
"0.59239346",
"0.59239346",
"0.59239346",
"0.59239346",
"0.59028673",
"0.58956826",
"0.58768284",
"0.578714",
"0.5773013",
"0.57687247",
"0.57687247",
"0.57682145",
"0.57617426",
"0.573... | 0.7008466 | 0 |
Implmentation for command line executing. Data for slates are by defaule taken from presets. That requires to enter, `slate_name`. If `slate_data` are entered then they are used. `data_output` should be path to json file where data will be collected. | def create_slates(
fill_data, slate_name=None, slate_data=None, data_output_json=None
):
if slate_data is None and slate_name is None:
raise TypeError(
"`create_slates` expects to enter data for slates or name"
" of slate preset."
)
elif slate_data is None:
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n parser = specify_parser()\n args = parser.parse_args()\n\n mapping = init_data(args.datafile[0])\n loaded_data = read(args.input)\n\n mount(mapping, loaded_data)",
"def main():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"-data_dir\", required=True, help=\"Direc... | [
"0.59716684",
"0.57863504",
"0.56220686",
"0.5616262",
"0.5616262",
"0.55532867",
"0.5512346",
"0.54771554",
"0.5472725",
"0.54657245",
"0.54542744",
"0.54304427",
"0.54218835",
"0.5402871",
"0.5400456",
"0.5400111",
"0.5323287",
"0.530436",
"0.5283623",
"0.52831334",
"0.5282... | 0.6469278 | 0 |
Bulk insert entries data to the database model/table. | def bulk_insert(engine, model, entries):
with session_scope(engine) as session:
session.bulk_insert_mappings(model, entries)
session.commit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _insert_bulk(self, iterable):\n self.cursor.executemany(self.INSERT, iterable)\n self.conn.commit()",
"def bulk_insert(objects, model, session):\n session.bulk_insert_mappings(model, objects)",
"def insert_data_bulk(self, table_name, data):\n if len(data) == 0:\n return\n... | [
"0.7436783",
"0.74265236",
"0.72922033",
"0.7262458",
"0.7102141",
"0.70946467",
"0.69618917",
"0.6844668",
"0.6755042",
"0.6731562",
"0.6694375",
"0.6672867",
"0.66262",
"0.65884143",
"0.65853024",
"0.65044075",
"0.647805",
"0.64497185",
"0.6417831",
"0.63891107",
"0.6336435... | 0.7966555 | 0 |
the IVOA messenger vocabulary in astropy's cache. Should we clean up after ourselves? | def messenger_vocabulary(mocker):
import_file_to_cache(
'http://www.ivoa.net/rdf/messenger',
get_pkg_data_filename(
'data/messenger.desise',
package=__package__)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vocab(self):\n\n\t\tself.parse_transcript() \n\t\tself.purge_words()\n\t\tself.analyze_words()\n\t\tself.sort_word_analysis()",
"def update_vocab(self, text):\n for char in text:\n if char not in self.vocab:\n self.vocab[char] = len(self.vocab)\n if char not in... | [
"0.61893916",
"0.5901378",
"0.57867765",
"0.5723008",
"0.56460667",
"0.5620585",
"0.5584214",
"0.55801475",
"0.5509116",
"0.54804516",
"0.5464186",
"0.5447357",
"0.54274684",
"0.5425342",
"0.5407084",
"0.53599447",
"0.5356806",
"0.5317574",
"0.5316638",
"0.53160644",
"0.53119... | 0.65306276 | 0 |
take a stream of tokens/nodes and split it according to tokens stream = a , c , e , f separator = ',' | def split(stream, separator, element):
if isinstance(stream, Node):
stream = stream.get_inner_body()
current = None
try:
while True:
if not current:
current = element()
token = stream.__next__()
# print('scanning ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_into_tokens(dataset, delimiter=\"\"):\n pass",
"def split_sub_statement(stream, node_types):\n \n if isinstance(stream, Node):\n stream = stream.get_inner_body()\n \n current_node = None\n \n try:\n while True:\n \n token = next(stream)\n ... | [
"0.63907176",
"0.61089045",
"0.58818567",
"0.57984126",
"0.5695363",
"0.569318",
"0.56813574",
"0.5672309",
"0.5669516",
"0.5632018",
"0.5601465",
"0.55953586",
"0.55795026",
"0.5567501",
"0.5564501",
"0.55217683",
"0.54989874",
"0.54901063",
"0.5487813",
"0.54479396",
"0.543... | 0.6474475 | 0 |
take a stream of tokens/nodes and split it according to separators constructing elements stream = SELECT ... FROM ... WHERE ... node_types a list of classes inheriting from SubStatement typically used after Parenthesis splitting | def split_sub_statement(stream, node_types):
if isinstance(stream, Node):
stream = stream.get_inner_body()
current_node = None
try:
while True:
token = next(stream)
#print('current token ', token)
matched = False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(stream, separator, element):\n if isinstance(stream, Node):\n stream = stream.get_inner_body()\n \n current = None\n try:\n \n while True:\n if not current:\n current = element()\n \n token = stream.__next__()\n# ... | [
"0.5636374",
"0.55413985",
"0.54855776",
"0.54737806",
"0.5462743",
"0.5454955",
"0.5390649",
"0.53512144",
"0.530895",
"0.5241497",
"0.520279",
"0.5183244",
"0.51298153",
"0.51044255",
"0.5070569",
"0.5052488",
"0.504832",
"0.50384504",
"0.5021596",
"0.5013821",
"0.50020903"... | 0.72118944 | 0 |
parse a select ... eventually complex Sub select are necessarily inside a parenthesis block | def parse_select(text):
lexer = create_lexer(SqlLexer)
class Select(SubStatement):
begin='SELECT'
class From(SubStatement):
begin='FROM'
class Where(SubStatement):
begin='WHERE'
def split_select(stream):
return (element for element in spl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_select(self):\n self.assertEqual(['SELECT',\n ['MAX(*)', 'AS', 'a'], ['(SELECT 1 FROM Q)', 'AS', 'b'], ['c', 'AS', 'c.a'],\n 'FROM', 'T', ''],\n grammar._SELECT_EXPR.parseString(\"SELECT MAX(*) AS a, (SELECT 1 FROM Q) AS b,\"\n... | [
"0.7084201",
"0.5947812",
"0.5921865",
"0.5876474",
"0.55781275",
"0.5544057",
"0.55064434",
"0.5500245",
"0.5372754",
"0.5361309",
"0.5359532",
"0.5358202",
"0.53483516",
"0.53483516",
"0.5344046",
"0.53224427",
"0.5290747",
"0.52629024",
"0.5235372",
"0.51850915",
"0.517177... | 0.7535803 | 0 |
This method generates a single sine pulse according to the given parameters. | def generate_singlesine(time = 0, samples_nb = 1000, rep_frequency = 10 , pulse_frequency = 50, amplitude = 1 , edge = 1, phase_offset = 0, noise = 0):
if edge not in [0,1]:
print(colorama.Back.RED + colorama.Style.BRIGHT + "ERROR: invalid phase (either 0 for a rising or a 1 for a falling edge) , exit."+ coloram... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sine(x, period=10.0, start_phase=0.0, name=''):\n x = x.astype(np.float)\n variables = {\n 'function': sine, 'period': period, 'start_phase': start_phase}\n y = np.sin(2*np.pi*(x / period) + start_phase)\n return packer(x, y, variables, name=name)",
"def __generate_sin(self, phase_shif... | [
"0.6940268",
"0.6880557",
"0.6853573",
"0.68185854",
"0.65643746",
"0.646433",
"0.64616054",
"0.64028764",
"0.63944584",
"0.638604",
"0.63438696",
"0.6322916",
"0.6321839",
"0.63211584",
"0.6289463",
"0.6178244",
"0.6147117",
"0.6147117",
"0.61345106",
"0.6107279",
"0.6093004... | 0.71325195 | 0 |
Gets the changed_by of this AuditEntry. | def changed_by(self):
return self._changed_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_by(self):\n return self._updated_by",
"def last_modified_by(self):\n return self._last_modified_by",
"def updated_by(self) -> \"str\":\n return self._attrs.get(\"updatedBy\")",
"def updated_by(self) -> \"str\":\n return self._attrs.get(\"updatedBy\")",
"def updated_b... | [
"0.7249279",
"0.69695014",
"0.67318934",
"0.67318934",
"0.67318934",
"0.66954154",
"0.6461869",
"0.6311164",
"0.6311164",
"0.6311164",
"0.6311164",
"0.6311164",
"0.6311164",
"0.62398523",
"0.6199881",
"0.6086686",
"0.6080386",
"0.60497826",
"0.60042036",
"0.5695446",
"0.56655... | 0.830074 | 1 |
Sets the changed_by of this AuditEntry. | def changed_by(self, changed_by):
self._changed_by = changed_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changed_by(self):\n return self._changed_by",
"def changed_by(self):\n return self._changed_by",
"def updated_by(self, updated_by):\n\n self._updated_by = updated_by",
"def updated_by(self, updated_by: \"str\"):\n self._attrs[\"updatedBy\"] = updated_by",
"def updated_by(sel... | [
"0.70531774",
"0.70531774",
"0.6982425",
"0.67455775",
"0.67455775",
"0.67455775",
"0.65675133",
"0.65675133",
"0.60424423",
"0.5959088",
"0.58513176",
"0.58513176",
"0.58513176",
"0.58513176",
"0.58513176",
"0.58513176",
"0.5797555",
"0.5767141",
"0.5724656",
"0.55524004",
"... | 0.8309313 | 0 |
Gets the organization_id of this AuditEntry. | def organization_id(self):
return self._organization_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organization_id(self) -> str:\n return pulumi.get(self, \"organization_id\")",
"def organization_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"organization_id\")",
"def organization_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"organizatio... | [
"0.80762357",
"0.78826576",
"0.77492076",
"0.77492076",
"0.7006984",
"0.69951683",
"0.6884503",
"0.6850317",
"0.6845058",
"0.6613094",
"0.63587046",
"0.63540274",
"0.6339878",
"0.62920094",
"0.62616473",
"0.62345904",
"0.62345904",
"0.6231323",
"0.61555445",
"0.61486125",
"0.... | 0.84393626 | 0 |
Sets the organization_id of this AuditEntry. | def organization_id(self, organization_id):
self._organization_id = organization_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organization_id(self, organization_id):\n if organization_id is None:\n raise ValueError(\"Invalid value for `organization_id`, must not be `None`\") # noqa: E501\n\n self._organization_id = organization_id",
"def org_id(self, org_id):\n\n self._org_id = org_id",
"def organ... | [
"0.75153923",
"0.730572",
"0.71776944",
"0.71776944",
"0.71776944",
"0.6829373",
"0.6627145",
"0.65207165",
"0.64345294",
"0.6204442",
"0.60855114",
"0.6005726",
"0.6005726",
"0.6001661",
"0.6001661",
"0.583284",
"0.5821725",
"0.582044",
"0.56470793",
"0.5548742",
"0.55099416... | 0.832213 | 1 |
Sets the entity_id of this AuditEntry. | def entity_id(self, entity_id):
self._entity_id = entity_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entity_id(self, entity_id: str):\n\n self._entity_id = entity_id",
"def entity_id(self, entity_id):\n if entity_id is None:\n raise ValueError(\"Invalid value for `entity_id`, must not be `None`\")\n\n self._entity_id = entity_id",
"def entities_id(self, entities_id):\n\n ... | [
"0.79976314",
"0.79222083",
"0.66796696",
"0.65123117",
"0.64531934",
"0.6290769",
"0.5910044",
"0.5910044",
"0.5910044",
"0.5910044",
"0.5910044",
"0.5899952",
"0.5899952",
"0.5899952",
"0.57038164",
"0.5661641",
"0.545111",
"0.54498637",
"0.5395395",
"0.5363157",
"0.5341813... | 0.8073803 | 0 |
Gets the audit_action of this AuditEntry. | def audit_action(self):
return self._audit_action | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_action(self):\n return self.__action",
"def action(self):\n return self._get_field(\"action\")",
"def get_action(self):\n return self.current_action",
"def action(self):\n return self._action",
"def action(self):\n return self._action",
"def action(self):\n ... | [
"0.71937025",
"0.6969079",
"0.69373006",
"0.68369156",
"0.68369156",
"0.68369156",
"0.68369156",
"0.68369156",
"0.68369156",
"0.66419053",
"0.6547587",
"0.6547587",
"0.6547587",
"0.65027106",
"0.64371264",
"0.63478076",
"0.63173217",
"0.6236077",
"0.62267995",
"0.62238157",
"... | 0.8121201 | 0 |
Sets the audit_action of this AuditEntry. | def audit_action(self, audit_action):
allowed_values = ["Accept", "Active", "AwaitingPayment", "AwaitingRefund", "Cancelled", "Completed", "Created", "Error", "Expiring", "Expired", "Failed", "Migrated", "NeedsAmendments", "Paid", "Pending", "Provisioned", "Refunded", "Reject", "Trial", "Unknown", "Unpaid", "Up... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_action(self, action):\n self.action = action",
"def set_action(self, action):\n self.action = action",
"def set_action(self, action):\n self._action = action\n return self",
"def action(self, action):\n if action is None:\n raise ValueError(\"Invalid valu... | [
"0.66921645",
"0.66921645",
"0.66859514",
"0.66470796",
"0.6639677",
"0.65499735",
"0.6252528",
"0.6251429",
"0.61876976",
"0.61398673",
"0.6064159",
"0.60461444",
"0.59672004",
"0.5907352",
"0.5907352",
"0.5907352",
"0.5907352",
"0.5907352",
"0.5907352",
"0.5889515",
"0.5769... | 0.7367506 | 0 |
Gets the field_changes of this AuditEntry. | def field_changes(self):
return self._field_changes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetChanges(self):\n return self._changes",
"def get_changed_columns(self):\r\n return [k for k,v in self._values.items() if v.changed]",
"def get_instance_changes(self, instance_id=None):\n if instance_id:\n changes = self.instance_changes.get(instance_id)\n if change... | [
"0.68609107",
"0.6590611",
"0.62377644",
"0.621888",
"0.6127568",
"0.60550255",
"0.5940233",
"0.5925335",
"0.5840356",
"0.5840356",
"0.5838879",
"0.58374155",
"0.5817625",
"0.5815635",
"0.5807362",
"0.5798377",
"0.5789541",
"0.5708215",
"0.5708215",
"0.5687627",
"0.56683177",... | 0.8374598 | 0 |
Sets the field_changes of this AuditEntry. | def field_changes(self, field_changes):
self._field_changes = field_changes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_changes(self):\n return self._field_changes",
"def field_values(self, field_values):\n\n self._field_values = field_values",
"def fields(self, fields):\n\n self._fields = fields",
"def mark_field_changed(self, name):\n self.assert_known_field(name)\n assert not se... | [
"0.61595047",
"0.5507908",
"0.53668636",
"0.5330242",
"0.53061247",
"0.52194923",
"0.50769526",
"0.5023602",
"0.49466592",
"0.4921573",
"0.49189287",
"0.48740104",
"0.4870308",
"0.4827835",
"0.47986823",
"0.47916147",
"0.47897416",
"0.47836465",
"0.4755989",
"0.47100684",
"0.... | 0.8000916 | 0 |
Gets the new_entity of this AuditEntry. | def new_entity(self):
return self._new_entity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetEntity(self):\n return self.__entity",
"def entity(self):\n return self._entity",
"def entity(self):\n return self._entity",
"def new_entity(self, new_entity):\n\n self._new_entity = new_entity",
"def add_new_entry(self, ent):\n ent.inserted = time.strftime(\"%D\")\n... | [
"0.6181463",
"0.59021616",
"0.59021616",
"0.58873767",
"0.5741779",
"0.5430238",
"0.5360991",
"0.5357177",
"0.53207916",
"0.5318232",
"0.5270728",
"0.5266742",
"0.52565885",
"0.5232584",
"0.5209981",
"0.5157979",
"0.51241785",
"0.51241785",
"0.50976807",
"0.50870144",
"0.5085... | 0.8268161 | 0 |
Sets the new_entity of this AuditEntry. | def new_entity(self, new_entity):
self._new_entity = new_entity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_entity(self):\n return self._new_entity",
"def new(self, new):\n\n self._new = new",
"def entity(self, entity):\n\n self._entity = entity",
"def set_entity(cls, entity):\n # Preparing auto increment\n entity_count = cls.get_entity_count()\n new_key = \"entity... | [
"0.68103546",
"0.5976102",
"0.596852",
"0.5584641",
"0.547989",
"0.5396724",
"0.5247832",
"0.51539177",
"0.49853706",
"0.49630386",
"0.48778757",
"0.48662427",
"0.48621497",
"0.48537818",
"0.4843221",
"0.48238978",
"0.48095122",
"0.47993878",
"0.4794472",
"0.4772747",
"0.4751... | 0.8411291 | 0 |
if isfile, filefullname is full log file name, otherwise, is a message content targets is a file path that contained files and directories which will be commited | def commit_targets(path, targets, username, password, filefullname, isfile=True):
#import pdb
#pdb.set_trace()
os.chdir(path);
f = open(targets, 'r')
lines = f.readlines()
f.close()
if len(lines) == 0:
print(targets + "内容为空,没有内容需要提交。")
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _log_fe_file(fe_file):\n mode = ' '\n if 'mode' in fe_file:\n mode = fe_file['mode']\n sha1 = ' '\n if 'sha1' in fe_file:\n sha1 = p4gf_util.abbrev(fe_file['sha1'])\n\n return NTR('{mode} {action} {sha1} {path}') \\\n .format( mode = mode\n ,... | [
"0.52691615",
"0.5039596",
"0.5001261",
"0.49933988",
"0.4985368",
"0.49669752",
"0.49560165",
"0.49521917",
"0.49425593",
"0.49176311",
"0.4898986",
"0.4898172",
"0.48861098",
"0.48836476",
"0.48686358",
"0.4850638",
"0.48221838",
"0.48219132",
"0.48186952",
"0.48127997",
"0... | 0.5567791 | 0 |
Generates and returns the vtk reader object for the file associated with the data object | def vtk_xml_reader(self):
reader = vtk.vtkXMLStructuredGridReader()
reader.SetFileName(self.file)
reader.Update()
assert isinstance(reader, vtk.vtkObject)
return reader | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vtk_poly_data_reader(*args, **kwargs):\n import itk\n instance = itk.VTKPolyDataReader.New(*args, **kwargs)\n return instance.__internal_call__()",
"def getReader(self):\n return Tes3Reader(self.inName,cStringIO.StringIO(self.data))",
"def New(*args, **kargs):\n obj = itkVTKPolyDataR... | [
"0.6545355",
"0.6346199",
"0.6157321",
"0.6139681",
"0.5995363",
"0.59510255",
"0.59271294",
"0.5886643",
"0.58603144",
"0.58483154",
"0.5797087",
"0.5774329",
"0.5770789",
"0.5755884",
"0.57461375",
"0.5723048",
"0.57099384",
"0.5707522",
"0.5695322",
"0.5686459",
"0.5674991... | 0.6800043 | 0 |
get the vtk point object for the location (x,y,z) | def __get_points_object__(xyz):
# TODO: Need to fix this to handle all points, not just the first
source = vtk.vtkPointSource()
source.SetCenter(xyz[0])
source.SetRadius(0)
source.SetNumberOfPoints(1)
source.Update()
return source | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point(self):\n return self.x, self.y, self.z",
"def point(x, y, z):\n return point_or_vector(x,y,z,1.0)",
"def getPoint(self):\n return Point(*self.position)",
"def __getitem__(self, *args):\n return _itkSurfaceSpatialObjectPointPython.vectoritkSurfaceSpatialObjectPoint3___getitem... | [
"0.7138827",
"0.6928828",
"0.6814521",
"0.6653981",
"0.6626665",
"0.6483561",
"0.6447883",
"0.6434501",
"0.63675106",
"0.6335543",
"0.632635",
"0.62961286",
"0.6287827",
"0.6256243",
"0.6240352",
"0.62284607",
"0.62024504",
"0.6198469",
"0.61825156",
"0.6178122",
"0.6170829",... | 0.71322364 | 1 |
extract the values at the given points from the dataset | def __get_data_at_points__(self, points):
file_data = self.reader.GetOutput()
probe = vtk.vtkProbeFilter()
probe.SetInputConnection(points.GetOutputPort())
probe.SetSourceData(file_data)
probe.Update()
b = vnp.vtk_to_numpy(probe.GetOutput().GetPointData().GetArray(self.v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPointValues(self, *args, **kwargs):\n ...",
"def get_data_on_points(self, varname, record, points):\n res = float('nan')*np.ones((len(points)), dtype=np.float64)\n if len(np.shape(np.array(points))) != 2:\n raise TelemacException('Warning problem with the list of '\\\n ... | [
"0.7277286",
"0.70598024",
"0.6576054",
"0.6518973",
"0.64923763",
"0.6459009",
"0.6390364",
"0.6366006",
"0.6219205",
"0.6143739",
"0.6140725",
"0.6134579",
"0.6126942",
"0.6115077",
"0.6099375",
"0.60878146",
"0.60623926",
"0.6060969",
"0.6037294",
"0.60322315",
"0.6028742"... | 0.72260445 | 1 |
Loads model either from local or S3 locations. Will return intput if already a model object | def _load_model(self, loc):
# If not a string, return input
if not (isinstance(loc, str) or isinstance(loc, unicode)):
return loc
# If location is in S3, copy to local, then unpickle
to_delete = False
if "s3" in loc:
tmp_loc = "{0}/tmp_file_{1}.obj".for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model(self, filename):\n model_object = self.s3_resource.Object(self.bucket_name, self.models_path + str(filename)).get()['Body'].read()\n model = pickle.loads(model_object)\n return model",
"def load_model(model_name):\r\n model = joblib.load(model_name)\r\n return model",
... | [
"0.75516003",
"0.6837531",
"0.68298393",
"0.6772153",
"0.67715466",
"0.67704576",
"0.67639816",
"0.67479384",
"0.67256385",
"0.67108077",
"0.6706669",
"0.6681385",
"0.6663933",
"0.6650679",
"0.6566042",
"0.65559953",
"0.6542129",
"0.6527688",
"0.64914966",
"0.648556",
"0.6479... | 0.83705956 | 0 |
Tests if `content` is UTF8. | def _is_utf8(filename: str) -> bool:
import codecs
try:
f = codecs.open(filename, encoding="utf-8", errors="strict")
for _ in f:
pass
return True
except UnicodeDecodeError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_text(content):\n if b\"\\0\" in content:\n return False\n if not content: # Empty files are considered text\n return True\n # Try to decode as UTF-8\n try:\n content.decode(\"utf8\")\n except UnicodeDecodeError:\n return False\n else:\n return True",
"... | [
"0.7579349",
"0.67203206",
"0.65982825",
"0.63214815",
"0.62996536",
"0.62089914",
"0.61764824",
"0.61721087",
"0.6123802",
"0.6123237",
"0.6099631",
"0.60387695",
"0.6030514",
"0.5989804",
"0.597334",
"0.5968493",
"0.59362227",
"0.58833",
"0.58812207",
"0.5879804",
"0.587365... | 0.69245964 | 1 |
Utility templatetag filter to avoid double translations of application names. | def trans_app(value):
return _(value.title()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_template_tags_pgettext(self):\n trans_real._active = Local()\n trans_real._translations = {}\n with translation.override(\"de\"):\n # Nonexistent context\n t = self.get_template(\n '{% load i18n %}{% blocktranslate context \"nonexistent\" %}May'\n ... | [
"0.57928973",
"0.56929904",
"0.5665104",
"0.5644416",
"0.559896",
"0.5557011",
"0.545776",
"0.54576653",
"0.54251087",
"0.5404726",
"0.54015297",
"0.5391843",
"0.53435445",
"0.53083515",
"0.5285667",
"0.5259713",
"0.5222787",
"0.51800734",
"0.5176696",
"0.5171347",
"0.5166482... | 0.6428007 | 0 |
The following is a simple function to implement weighted random selection in Python. Given a list of weights, it returns an index randomly, according to these weights | def weighted_choice(weights):
totals = []
running_total = 0
for w in weights:
running_total += w
totals.append(running_total)
rnd = random.random() * running_total
for i, total in enumerate(totals):
if rnd < total:
return i | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select(weights):\n r = random.random() * sum(weights)\n s = 0.0\n for k,w in enumerate(weights):\n s += w\n if r <= s:\n return k\n raise RuntimeError(\"select WTF from %s\" % weights)",
"def sample_from(self, weights):\n total = sum(weights)\n rnd = total *... | [
"0.82606566",
"0.8147948",
"0.7802385",
"0.77919173",
"0.77846617",
"0.7762445",
"0.7742134",
"0.76883686",
"0.7550791",
"0.7534086",
"0.75046813",
"0.7490498",
"0.748244",
"0.74608684",
"0.7452026",
"0.7432589",
"0.7383656",
"0.73409927",
"0.7274987",
"0.7147634",
"0.7080318... | 0.8362862 | 0 |
Parses the use's command line argument and returns the appropriate list of files. | def parse_arguments():
if len(sys.argv)==1:
# no arguments supplied
print ("Not enough arguments have been provided")
print ("Usage: python gdp_plots.py <filenames>")
print ("Options: -a: plot all gdp data in current directory")
sys.exit()
if sys.argv[1] == '-a' :
fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_args_files(self, filematch):\n files, start_pos = [], 0\n while True:\n pos_a = self.cmd.find(filematch, start_pos)\n if pos_a > 0:\n pos_b = self.cmd.find(' ', pos_a)\n if pos_b > 0:\n files.append(self.cmd[pos_a:pos_b... | [
"0.72466576",
"0.70566356",
"0.70298886",
"0.6989811",
"0.69031173",
"0.6775648",
"0.6678286",
"0.6585601",
"0.6568925",
"0.6557616",
"0.64935684",
"0.64906317",
"0.6489036",
"0.6487588",
"0.64503473",
"0.64449847",
"0.6427273",
"0.64082843",
"0.63974094",
"0.6387201",
"0.638... | 0.7244765 | 1 |
Plot all files in file_list using Pandas and Matp[lotlib. Each data file is its own plot. | def create_plots(file_list):
# load data and transpose so that country names are
# the columns and their gdp data becomes the rows
# read data into a pandas dataframe and transpose
for filename in file_list:
data = pandas.read_csv(filename, index_col = 'country').T
# create a p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_files(n=15):\n lod = read_files(n)\n\n for i in range(len(lod)):\n plt.plot(range(len(lod[i])), lod[i])\n\n plt.show()",
"def real_time_plot(files):\n global len_data, first_iter, colors\n\n for i,F in enumerate(files):\n\n # Load data\n data = pylab.loadtxt(F, delimiter=',', ski... | [
"0.71749127",
"0.69367737",
"0.6857739",
"0.6779122",
"0.64660704",
"0.63999444",
"0.6350419",
"0.63171303",
"0.6292504",
"0.62442714",
"0.62001306",
"0.6139794",
"0.6138147",
"0.6124569",
"0.61201525",
"0.5935963",
"0.5925208",
"0.5872423",
"0.5801415",
"0.5780353",
"0.57756... | 0.72236323 | 0 |
print out a size with the appropriate unit suffix | def printSize(sz, unit=1000):
fmt10 = ["%dB", "%dKiB", "%dMiB", "%dGiB", "%dTiB", "%dPiB"]
fmt2 = ["%dB", "%dKB", "%dMB", "%dGB", "%dTB", "%dPB"]
fmt = fmt10 if unit == 1000 else fmt2
i = 0
while i < len(fmt):
if sz < unit:
break
sz /= unit
i += 1
return fmt[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sizeof_fmt(size, suffix='B'):\r\n for unit in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']:\r\n if abs(size) < 1024.0:\r\n return f'{size:3.1f} {unit}{suffix}'\r\n size /= 1024.0\r\n return f'{size:3.1f} Y{suffix}'",
"def format_size(size):\n size = float(size)\n for unit in ['bit... | [
"0.7967207",
"0.77675575",
"0.7738173",
"0.7724627",
"0.75752074",
"0.752115",
"0.7514448",
"0.74665457",
"0.7454024",
"0.7452294",
"0.7434771",
"0.74308723",
"0.73925203",
"0.7369652",
"0.73430955",
"0.73430955",
"0.7312293",
"0.73056585",
"0.7280283",
"0.7270896",
"0.722881... | 0.8110585 | 0 |
print out a probability in a reasonable format | def printProbability(p):
if p > .0000001:
return "%9.6f%%" % (p * 100)
else:
return "%9.3e" % (p) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n prob = str(round(self.probability, 5))\n dprob = str(round(self.postdProbability, 5))\n output = \"dprob: \" + dprob + \" \\tprob: \" + prob + \"\\t: \"\n for key in self.attackDict.keys():\n output += key + \" \"\n return output",
"def format_probability(chance, n=4):\n... | [
"0.7008854",
"0.69079965",
"0.6850042",
"0.67920554",
"0.6706265",
"0.65928787",
"0.6556326",
"0.65150875",
"0.6484869",
"0.6395371",
"0.6380937",
"0.63522184",
"0.62861836",
"0.62230384",
"0.6202777",
"0.61732423",
"0.61580294",
"0.6151522",
"0.6142543",
"0.6141717",
"0.6109... | 0.80756766 | 0 |
run and report a set of specified simulations tests actual list of simulations to run (print a header line for each None test) period simulation period verbosity output options | def Run(tests, period=YEAR, verbosity="all"):
# figure out what output he wants
headings = True
parms = True
descr = True
if verbosity == "parameters":
descr = False
elif verbosity == "headings":
parms = False
descr = False
elif verbosity == "data only":
parm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\tresults = []\n\n\tconfig = configparser.ConfigParser()\n\tconfig.read(\"simulation.ini\")\n\tsettings = config['sim']\n\n\tcompleted_obj_hw = int(settings[\"ClientsPerCampaign\"]) * float(settings[\"CompletedPctgHW\"])\n\texceeded_obj_hw = float(settings[\"ExceededPctgHW\"])\n\tsignificance_level = ... | [
"0.66855633",
"0.6444111",
"0.6423009",
"0.63771325",
"0.63536066",
"0.6350432",
"0.6322105",
"0.6304921",
"0.62810755",
"0.6244929",
"0.6231836",
"0.6231481",
"0.6206141",
"0.6166658",
"0.61662865",
"0.61633986",
"0.61437416",
"0.60853714",
"0.60736054",
"0.606979",
"0.60636... | 0.70470625 | 0 |
Takes in a sparse hash and xors all numbers in groups of 'block_size' a 256 length sparse hash will generate a 'block_size' numbered array. | def dense_hash(hash_, block_size=16):
results = list()
for index in range(0, len(hash_), block_size):
block = hash_[index:index + block_size]
total = 0
for i in block:
total ^= i
results.append(total)
return results | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dense_hash(hash):\n dense_hash = []\n for i in range(0, len(hash), 16):\n block = reduce(lambda x, y: x ^ y, hash[i:i+16])\n dense_hash.append(block)\n return dense_hash",
"def k1xk2(data: typing.List[int], hash_size: int = 256) -> int:\n kk = sparse_knot_hash(data, hash_size, 1)... | [
"0.64490837",
"0.60304624",
"0.59660774",
"0.5825108",
"0.57991964",
"0.5717893",
"0.56716293",
"0.56199217",
"0.5568617",
"0.55538166",
"0.54708904",
"0.5447922",
"0.5439429",
"0.5383834",
"0.5338911",
"0.5331041",
"0.53225833",
"0.5314728",
"0.5307399",
"0.52971476",
"0.526... | 0.7294205 | 0 |
Choosing your team and opponent | def choose_team():
blah = True
global team_choice
global opponent_choice
while blah:
team_choice = input("Which NFL team would you like to play with? \n").title()
NFL_teams = ["Jets", "Bills", "Dolphins", "Patriots", "Titans", "Texans", "Colts", "Jaguars", "Broncos", "Chiefs", "Chargers", "Rai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_opponent(self):\n possible_opponents = [\n self.data['personalities'].pop(),\n self.data['events'].pop()\n ]\n title = 'Recruit a member or gain experience:'\n options = []\n for possible_opponent in possible_opponents:\n option = card_... | [
"0.7527788",
"0.651584",
"0.6435174",
"0.640273",
"0.64010537",
"0.6302428",
"0.6267415",
"0.61891365",
"0.6188227",
"0.6178674",
"0.616317",
"0.61611134",
"0.6142924",
"0.61102605",
"0.6105685",
"0.6103712",
"0.60909766",
"0.60868555",
"0.60826194",
"0.6060774",
"0.605628",
... | 0.7136275 | 1 |
Player decides whether they want to return the kickoff, associated gain on kickoff depending on input | def kickoff():
kickoff_choice = input(f"The {opponent_choice} are kicking off to your end zone. Do you want to return the kickoff? \n").lower()
global kick_return
global location
if kickoff_choice == "yes":
if random.random() < 0.1:
if random.random() < 0.7:
kick_retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_func():\n global gain\n if random.random() < 0.8:\n if random.random() < .9:\n gain = random.randint(0, 5) #For example, you have an 80% chance of gaining between 1 and 9 yards on a run play, and you have about a 72% chance to gain between 1 and 6 yards\n else:\n gain = random... | [
"0.6319561",
"0.62356794",
"0.6226591",
"0.6195144",
"0.6065509",
"0.6050107",
"0.6003843",
"0.59457415",
"0.5942352",
"0.5925448",
"0.58969015",
"0.5894861",
"0.5847418",
"0.58423024",
"0.58215815",
"0.5810432",
"0.5764698",
"0.57618344",
"0.575565",
"0.57321423",
"0.5730262... | 0.6866473 | 0 |
Determines yard gain on passing play | def pass_func():
global gain
if random.random() < 0.35:
gain = 0 #You don't gain yardage if the pass is incomplete
print("The pass is incomplete.\n")
elif random.random() > 0.35 and random.random() < 0.43:
if random.random() < .7:
gain = random.randint(1, 5)
else:
gai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gain(self):\n return None",
"def gain(self):\n return self[1]",
"def gain(self) -> int:\n return self._gain",
"def update_playback_gain(self, val):\n self.playbackGain = 10**(5.0*(val - self.speedDial.maximum()/2)/self.speedDial.maximum())",
"def dcgain(sys):\n return sy... | [
"0.64661837",
"0.6415016",
"0.6104374",
"0.59965986",
"0.5939903",
"0.5935967",
"0.58814234",
"0.5853398",
"0.581609",
"0.57570386",
"0.5736254",
"0.5732244",
"0.57280487",
"0.57192993",
"0.569461",
"0.5688064",
"0.5660062",
"0.5658602",
"0.56367904",
"0.5631949",
"0.56276673... | 0.6713752 | 0 |
ppiFile the name of input file to be parsed, which should be a file with one PPI at each line returns ppbConf, an adjacency matrix represented as a numpy array | def getConf(ppiFile):
validpattern = re.compile('^[\w _\-.,\t"\':;]+$')
splitpattern = re.compile('[\t ;,]+')
numericpattern = re.compile('^[0-9. \t,\-]+')
### collect node names ###
finfile = open(ppiFile, 'r')
names = {}
index = 0
for temp in finfile:
temp = temp.strip('\t \n\r')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readPfile(filename):\n\n with smart_open(filename, \"rb\") as f:\n # Read header\n # Assuming all data are consistent\n for line in f:\n tokens = line.decode().split()\n if tokens[0] == \"-pfile_header\":\n headerSize = int(tokens[4])\n el... | [
"0.6192037",
"0.58578134",
"0.5780167",
"0.57182866",
"0.5705861",
"0.5597269",
"0.55652106",
"0.5564362",
"0.55439883",
"0.5541717",
"0.5494945",
"0.54893816",
"0.548049",
"0.5466671",
"0.546124",
"0.544112",
"0.54269356",
"0.5412758",
"0.53786016",
"0.5374732",
"0.53634465"... | 0.76946753 | 0 |
Get stars from query text. According to format of the query text different methods are called. | def getStars(queries, lcs_fold, query_path=None, progb_txt="Querying stars: "):
ORDINARY_QUERY_KEY = "QUERY:"
stars = []
for query in tqdm(queries, desc=progb_txt):
query = query.strip()
if query.startswith(ORDINARY_QUERY_KEY):
stars += getStarsFromRemoteDb(
que... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSimpleRating(self,ratingLine):\n\n ratingStepartist = re.search(\"^\\[([\\d]+\\.?[\\d]?)/10\\](.*)\\{(.*)\\}[\\s]*\\((.*)\\)$\", ratingLine)\n passRating = re.search(\"^\\[([\\d]*\\.?[\\d]?)(PASS).*\\]\", ratingLine)\n plus = re.search(\"^\\[([\\d]*\\.?[\\d]?)(\\+\\+).*\\]\", ratingLine... | [
"0.5948951",
"0.58353686",
"0.5699146",
"0.5515522",
"0.5428978",
"0.5378395",
"0.53607404",
"0.5349942",
"0.5316735",
"0.5293226",
"0.5238394",
"0.5216603",
"0.5174512",
"0.5134198",
"0.5081347",
"0.5047674",
"0.49897566",
"0.49563116",
"0.49219772",
"0.48989",
"0.48985943",... | 0.62427163 | 0 |
Get stars from folder/s. If path is iterable (case that more folders were given, light curves from that all folder will be loaded | def getStarsFromFolder(single_path, lcs_fold):
p, restr = _check_sample_name(single_path)
try:
st = StarsProvider().getProvider(
"FileManager", {"path": os.path.join(lcs_fold, p)}).getStars()
stars = _split_stars(st, restr)
except KeyError:
raise IOError("\n\nThere no fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sar_paths(directory_path: str) -> list:\n dataset_path = Path(directory_path)\n\n path_generator = dataset_path.rglob('*.tif')\n paths = sorted([path for path in path_generator if path.is_file()])\n return [sar_set(*g) for k, g in groupby(paths, key=lambda path: re.match(TYPE_REGEX, path.name)[... | [
"0.6114552",
"0.60083556",
"0.5877471",
"0.58240753",
"0.5820839",
"0.57919365",
"0.57441986",
"0.5722332",
"0.5715297",
"0.5675058",
"0.56288785",
"0.5609739",
"0.55748695",
"0.55511475",
"0.5519499",
"0.54943717",
"0.5487072",
"0.5483709",
"0.5482678",
"0.54466915",
"0.5430... | 0.7668567 | 0 |
This method parsing the query text in order to return desired stars from remote database. | def getStarsFromRemoteDb(query, query_path):
try:
db_key, query_file = query.split(":")
except:
QueryInputError(
"Key for resolving stars source was not recognized:\n%s" % query)
queries = StatusResolver(
os.path.join(query_path, query_file)).getQueries()
stars = [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_for_query(query):\n index = query.find('@')\n if index == -1:\n return \"\"\n elif index == len(query)-1:\n # Make sure the final return doesn't index outside the list.\n return \"\"\n else:\n return query[index+1:]",
"def process_query(self, query_str):\n ... | [
"0.56206834",
"0.5586432",
"0.55854344",
"0.55172074",
"0.54510283",
"0.535934",
"0.52816796",
"0.5249843",
"0.5221207",
"0.5220947",
"0.5200863",
"0.51649463",
"0.5164076",
"0.51512545",
"0.51384133",
"0.5105419",
"0.51047957",
"0.5100868",
"0.5099509",
"0.5096608",
"0.50962... | 0.5791404 | 0 |
This takes a netcdf fill and pulls out the lat and lons array | def nc_getLatsandLons(fn):
from netCDF4 import Dataset
# load the netcdf file
ncf1 = Dataset(fn, mode='r')
# Pull out the lon and lat data
lats = ncf1.variables["lat"][:]
lons = ncf1.variables["lon"][:]
return lats, lons | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_2D_netCDF(filename, var_name, lat_name, lon_name):\n data = Dataset(filename, 'r')\n var = data[var_name][:]\n lats = data[lat_name][:]\n lons = data[lon_name][:]\n data.close()\n return var, lats, lons",
"def get_ecmwf_lat_lon(nc_file):\n from netCDF4 import Dataset\n \n fh =... | [
"0.6686081",
"0.65038174",
"0.64324605",
"0.63821316",
"0.63641685",
"0.6291383",
"0.6236775",
"0.611699",
"0.60048854",
"0.5986861",
"0.5980002",
"0.5972642",
"0.5938534",
"0.59312713",
"0.5917963",
"0.58900464",
"0.5883775",
"0.5870067",
"0.58416015",
"0.5827574",
"0.581921... | 0.6993417 | 0 |
(str) > str Replaces 3 or more consecutive newlines with 2 newlines. Removes multiple newlines at the end of the string. | def beautify(text):
text = re.sub('\n{3,}', '\n\n', text)
text = re.sub('\n+$', '\n', text)
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify(s):\n\tl = s.splitlines(True)\n\ttry:\n\t\tif l[1] in ('\\r\\n', '\\n', '</br>'):\n\t\t\tl = everyother(l)\n\texcept IndexError:\n\t\tpass\n\ttry:\n\t\tif l[-1] not in ('\\r\\n', '\\n', '</br>'):\n\t\t\tl.append('\\r\\n')\n\texcept IndexError:\n\t\tpass\n\treturn ''.join(l)",
"def cleanup_newlines(str... | [
"0.710905",
"0.68628454",
"0.67626935",
"0.65454465",
"0.6492721",
"0.64468503",
"0.6399429",
"0.6366013",
"0.6259932",
"0.6204685",
"0.61964625",
"0.61156934",
"0.6046275",
"0.6034635",
"0.6033117",
"0.5945784",
"0.5924168",
"0.5903102",
"0.5898147",
"0.5855274",
"0.5854465"... | 0.7270905 | 0 |
(str) > str Generator function, yields all .rst files' names from the given path. | def list_files(folder_path):
try:
for name in os.listdir(folder_path):
base, ext = os.path.splitext(name)
if ext != '.rst':
continue
yield os.path.join(folder_path, name)
except OSError as ex:
log.error('Exception occured in list_files: {0}'.fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan_docs():\n\n\n def scan_file(fn):\n f = open(fn)\n\n for l in f:\n m = re.search(r\"\\.\\. (\\w+):: ([.\\w+]+)\", l)\n\n if not m:\n continue\n\n name_kind[m.group(2)] = m.group(1)\n\n for i in os.listdir(\"source\"):\n if i.endswit... | [
"0.6643023",
"0.6321115",
"0.6180466",
"0.6087502",
"0.6051104",
"0.59749836",
"0.5908224",
"0.5885887",
"0.5877877",
"0.5859597",
"0.5819454",
"0.58117485",
"0.5770539",
"0.5751046",
"0.5707234",
"0.5693174",
"0.56727237",
"0.5656135",
"0.56490225",
"0.5645481",
"0.5626505",... | 0.70348614 | 0 |
() > None Configures argument parser, generates site files. | def main():
parser = argparse.ArgumentParser()
parser.add_argument("layout_path", help="relative path to the directory "
"containing .rst files with site content and jinja "
"templates that define the site structure")
parser.add_argument("output_path", help="r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_arguments(args):\n\n parent_parser = argparse.ArgumentParser(add_help=False)\n parent_parser.add_argument('--debug', '-d', action='count', default=0)\n parent_parser.add_argument('--version', '-v', action='version',\n version='%(prog)s {version}'.format(version=version.__ve... | [
"0.6615437",
"0.6609897",
"0.66001606",
"0.6552956",
"0.6536455",
"0.6516835",
"0.6481947",
"0.6475446",
"0.6441392",
"0.6417566",
"0.6365299",
"0.6311957",
"0.6306291",
"0.6297207",
"0.6176481",
"0.6133819",
"0.6131787",
"0.607976",
"0.6054829",
"0.60472035",
"0.6026954",
... | 0.7562603 | 0 |
Takes in a trained policy, runs the policy for a specified number of rollouts, and returns the results of the experiment. | def _run_policy(env, policy, num_rollouts):
start_states, final_states, goal_states, actions, paths = [], [], [], [], []
for i in range(num_rollouts):
path = rollout(
env,
policy,
max_path_length=100,
animated=False,
)
obs = path["observat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rollout(env, our_policy, expert_policy, num_rollouts, max_steps):\n returns = []\n observations = []\n actions = []\n for i in range(num_rollouts):\n # print('iter', i)\n obs = env.reset()\n done = False\n totalr = 0.\n steps = 0\n while not done:\n ... | [
"0.7071595",
"0.70170295",
"0.68903935",
"0.6639821",
"0.6559121",
"0.6324267",
"0.620789",
"0.6170936",
"0.6127437",
"0.60635906",
"0.60242164",
"0.6003384",
"0.5966104",
"0.5851238",
"0.58464557",
"0.5844492",
"0.5844492",
"0.58353084",
"0.5820814",
"0.5737581",
"0.5696761"... | 0.7488749 | 0 |
Prints a board with a title. board = [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], ] | def boardprinter(board: list, title: str):
padding = " "
header = padding + " |A|B|C|D|E|F|G|H|I|J|"
protoboard = ""
for i in range(10):
newrow = str(board[i])
newrow = newrow.replace("[", "#|").replace(
", ", "|").replace("'", "").replace("]", "|")
# Prep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_board(self):\n num_rows = len(self.board)\n num_cols = len(self.board[0])\n \n for i in range(num_rows):\n if i % 3 == 0 and i != 0:\n print(\"- - - - - - - - - - - -\")\n \n for j in range(num_cols):\n if j % 3 == 0 and j != 0:\n print(\" | \", end=\"\")... | [
"0.7980977",
"0.79472417",
"0.7928891",
"0.7881975",
"0.7878489",
"0.78713536",
"0.7841725",
"0.7832346",
"0.78164923",
"0.7790345",
"0.77899647",
"0.77899647",
"0.77850956",
"0.77644897",
"0.77406794",
"0.7719308",
"0.7688303",
"0.76780593",
"0.76677835",
"0.76352805",
"0.76... | 0.8417716 | 0 |
Generates a valid shot | def shotgenerator():
return random.randint(0, 9), random.randint(0, 9) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createNewShot(*args):\n createDir.createShot(pi.shotsFolder)",
"def createShot(shotFolder, *args):\n createShotUI(shotFolder)",
"def make_shot(self, target, force):\n intersections = self._get_edge_intersections(target)\n\n if target[0] > self.cue_coords[0]:\n start = max(int... | [
"0.65291405",
"0.61991775",
"0.61182004",
"0.60835326",
"0.60244423",
"0.5980719",
"0.59457535",
"0.5912019",
"0.5864049",
"0.5780368",
"0.572628",
"0.5722106",
"0.567072",
"0.5562419",
"0.55616623",
"0.5552547",
"0.55457574",
"0.55451393",
"0.551989",
"0.55038774",
"0.549977... | 0.70925194 | 0 |
Generate a ship of length N. | def generateship(length: int):
length = length - 1
vertical = bool(random.randint(0, 1))
if vertical:
col1 = random.randint(0, 9)
row1 = random.randint(0, 9 - length)
col2 = col1
row2 = row1 + length
return (col1, row1), (col2, row2)
if not vertical:
col1 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_ship(length, *args):\n coord = (randint(0, 10 - length), randint(0, 10 - length))\n check = True\n while check:\n check = False\n if args:\n for arg in args:\n check = point_in_ship(arg, coord) if check == False else True\n while point_in_s... | [
"0.71276236",
"0.6535593",
"0.6233696",
"0.61020637",
"0.60862756",
"0.60614854",
"0.6044193",
"0.6028837",
"0.5943878",
"0.58799267",
"0.58623815",
"0.5815113",
"0.5723559",
"0.5715128",
"0.5660159",
"0.5649343",
"0.5647397",
"0.56422246",
"0.5617939",
"0.561721",
"0.5591131... | 0.658633 | 1 |
Build message specific to the recipient. | def build_message(self, recipient_email):
message = self.queue_doc.message
if not message:
return ""
message = message.replace(
self.message_placeholder("tracker"), self.get_tracker_str(recipient_email)
)
message = message.replace(
self.message_placeholder("unsubscribe_url"), self.get_unsubscribe_st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_message(self):\n msg_type = self.msg_type\n if msg_type == \"PUBMSG\":\n msg_type = \"PRIVMSG\"\n ret = \"{} {}\".format(msg_type, self.target)\n if self.content:\n ret += \" :{}\".format(self.content)\n return ret + \"\\r\\n\"",
"def build_m... | [
"0.6769794",
"0.6737969",
"0.62899005",
"0.6173471",
"0.61571157",
"0.6078235",
"0.6017565",
"0.60136795",
"0.59706426",
"0.5963227",
"0.5956112",
"0.5827875",
"0.5805116",
"0.57555825",
"0.57555825",
"0.57119703",
"0.57029104",
"0.569709",
"0.5649452",
"0.5649261",
"0.563867... | 0.72548765 | 0 |
Build and return the email queues those are created. Sends email incase if it is requested to send now. | def process(self, send_now=False):
final_recipients = self.final_recipients()
queue_separately = (final_recipients and self.queue_separately) or len(final_recipients) > 20
if not (final_recipients + self.final_cc()):
return []
queue_data = self.as_dict(include_recipients=False)
if not queue_data:
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_email_queue():\n g.setdefault('email_queue', [])",
"def send_queued_mail():\r\n now = datetime.datetime.now(g.tz)\r\n if not c.site:\r\n c.site = Default\r\n\r\n clear = False\r\n session = smtplib.SMTP(g.smtp_server)\r\n # convienence funciton for sending the mail to the singly... | [
"0.6772418",
"0.62025726",
"0.6147615",
"0.6054284",
"0.6054284",
"0.6054284",
"0.6054284",
"0.6054284",
"0.6054284",
"0.6054284",
"0.6054284",
"0.6054284",
"0.58631426",
"0.5812916",
"0.5798254",
"0.5771639",
"0.5767222",
"0.5765894",
"0.5718625",
"0.5701637",
"0.5682031",
... | 0.65649277 | 1 |
check if a param is a python reserved word. if so append the PREPEND_STR and return. If not just return the param | def check_param(param):
return PREPEND_STR+param if keyword.iskeyword(param) else param | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def param_name(p):\n prefix = ['limit_', 'error_', 'fix_']\n for prf in prefix:\n if p.startswith(prf):\n return p[len(prf):]\n return p",
"def format_parameter(param, required):\n\n param_string = check_param(flatten_param(param))\n if not required:\n param_string += '=No... | [
"0.62164277",
"0.60627276",
"0.59327525",
"0.58690375",
"0.5847756",
"0.58377063",
"0.57170993",
"0.5695834",
"0.5646491",
"0.5615303",
"0.5615303",
"0.558056",
"0.5556343",
"0.5556343",
"0.5484624",
"0.5424852",
"0.5399515",
"0.53664017",
"0.53664017",
"0.5356545",
"0.530470... | 0.81484944 | 0 |
clean param looks for parameters with '' and removes them | def clean_param(param):
if '<' in param:
param = param.replace("<", "")
if '>' in param:
param = param.replace(">", "")
return param | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_params(self, url):\n if isinstance(url, unicode):\n url = url.encode(\"utf-8\")\n parts = list(urlparse.urlsplit(url))\n if not parts[3]:\n return url\n query = urlparse.parse_qsl(parts[3])\n query = [q for q in query if self._is_param_allowed(*q)]... | [
"0.69229156",
"0.6752244",
"0.65578884",
"0.6452081",
"0.64409894",
"0.6366064",
"0.628932",
"0.6192528",
"0.6158099",
"0.6077513",
"0.6062495",
"0.6045371",
"0.60109264",
"0.6010546",
"0.5998438",
"0.59780425",
"0.59707963",
"0.59661484",
"0.5924474",
"0.59158826",
"0.591525... | 0.7192391 | 0 |
Turn a parameter that looks like this param[name_one][name_two][name_three] into this param_name_one_name_two_name_three | def flatten_param(param):
param = param.replace(']', '').replace('[', '_').replace('<','').replace('>','')
if param.startswith('_'):
param = param.replace('_', '', 1)
return param | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parameterize_string(raw):\n\n parts = []\n s_index = 0\n\n for match in _PARAMETER_PATTERN.finditer(raw):\n parts.append(raw[s_index:match.start()])\n parts.append({u\"Ref\": match.group(1)})\n s_index = match.end()\n\n if not parts:\n return GenericHelperFn(raw)\n\n ... | [
"0.5780257",
"0.5667719",
"0.5615841",
"0.55319816",
"0.5456321",
"0.5438268",
"0.53272706",
"0.5323091",
"0.5322933",
"0.5312868",
"0.53086865",
"0.52487105",
"0.5246531",
"0.5241464",
"0.5229589",
"0.5199713",
"0.5155024",
"0.5140652",
"0.5140652",
"0.513402",
"0.5124002",
... | 0.679576 | 0 |
Determines if a parameter should be treated as an array | def is_array_param(param):
return param.get('tags') and param['tags']['type'] == 'array' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_array(self):\n return False",
"def is_array(val):\n return (\n isinstance(val, tuple) or \\\n isinstance(val, dict) or \\\n isinstance(val, list)\n )",
"def IsArray(obj):\n return isinstance(obj, (list, tuple))",
"def is_array(self, arr):\n return isinstance(arr, np.ndarray... | [
"0.75525606",
"0.7493666",
"0.74254745",
"0.7411446",
"0.734913",
"0.7297551",
"0.7130163",
"0.7086796",
"0.7065588",
"0.70564675",
"0.6974437",
"0.6965529",
"0.68480897",
"0.68339354",
"0.67768043",
"0.67439604",
"0.6680122",
"0.664659",
"0.6624795",
"0.6542464",
"0.64139646... | 0.80148953 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.