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 |
|---|---|---|---|---|---|---|
Extracts the starting age from the spoiler logs dicts. | def extract_age(spoiler_logs):
return [0 if log["randomized_settings"]['starting_age'] == "child" else 1 for log in spoiler_logs] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_spawn(spoiler_logs, ages):\n spawns = [[log['entrances'][\"Child Spawn -> KF Links House\"], \n log['entrances'][\"Adult Spawn -> Temple of Time\"]] for log in spoiler_logs]\n \n return [[xx['region'] if isinstance(xx, dict) else xx for xx in x] for x in spawns]",
"def oldest()... | [
"0.56041646",
"0.5446686",
"0.54392344",
"0.53755945",
"0.5363894",
"0.534055",
"0.5318432",
"0.52772635",
"0.5261191",
"0.5216402",
"0.5192486",
"0.51863116",
"0.5176638",
"0.51354337",
"0.5112253",
"0.5093963",
"0.50713646",
"0.50247675",
"0.5003254",
"0.49770254",
"0.49599... | 0.74757224 | 0 |
Extracts the starting spawns from the spoiler logs dicts. | def extract_spawn(spoiler_logs, ages):
spawns = [[log['entrances']["Child Spawn -> KF Links House"],
log['entrances']["Adult Spawn -> Temple of Time"]] for log in spoiler_logs]
return [[xx['region'] if isinstance(xx, dict) else xx for xx in x] for x in spawns] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_locations(spoiler_logs):\n locations = []\n \n for log in spoiler_logs: # loop to check the spoiler log with try-except\n try:\n locations.append(log['locations'])\n except KeyError:\n print(\"Invalid spoiler log ...\")\n return locations",
"def extrac... | [
"0.6339917",
"0.57573676",
"0.5486719",
"0.53774065",
"0.53229845",
"0.5260402",
"0.5221797",
"0.5181284",
"0.5173909",
"0.51697326",
"0.5125561",
"0.50104666",
"0.50087345",
"0.49784118",
"0.49549",
"0.49262783",
"0.49259952",
"0.48698026",
"0.48630747",
"0.4857975",
"0.4853... | 0.6751286 | 0 |
Extracts items location from n spoiler log files and return list of dict. | def extract_logs(path, n=1000, from_=0, to=1000):
assert from_ < to, 'from_ must be smaller than to'
json_files = list_files(path=path)
nb_files = n if n <= len(json_files) else len(json_files)
json_files = json_files[:nb_files]
spoiler_logs = extract_json(path, json_files)
locations =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_locations(spoiler_logs):\n locations = []\n \n for log in spoiler_logs: # loop to check the spoiler log with try-except\n try:\n locations.append(log['locations'])\n except KeyError:\n print(\"Invalid spoiler log ...\")\n return locations",
"def get_en... | [
"0.7047441",
"0.61211944",
"0.5719867",
"0.5578202",
"0.5554521",
"0.5412144",
"0.54119265",
"0.54089105",
"0.53899264",
"0.5373242",
"0.53686035",
"0.53474027",
"0.53333247",
"0.5329469",
"0.52958363",
"0.52707005",
"0.52652115",
"0.5263494",
"0.5242077",
"0.5234703",
"0.518... | 0.6465091 | 1 |
Given num_people in circle, kill [kill_every]th person, return survivor. | def find_survivor(num_people, kill_every):
# 1 represents alive, 0 represents dead
people = [1 for person in xrange(num_people)]
# track kills so we know when only one is left
dead_count = 0
# for a 0-indexed list, start at position -1
position = -1
# continue kills until only one left
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def survivors_selection(self):\n q = 5\n new_population = []\n for i in range(self._population_size):\n batch = []\n for j in range(q):\n r = random.randint(0, (self._child2population_ratio + 1) * self._population_size - 1)\n if r < self._pop... | [
"0.5692708",
"0.5506005",
"0.5275919",
"0.5144234",
"0.51234853",
"0.5113955",
"0.50657177",
"0.50389415",
"0.50237817",
"0.5021013",
"0.49488246",
"0.4881141",
"0.4862901",
"0.48557314",
"0.48286477",
"0.4793314",
"0.47832945",
"0.47830445",
"0.47760513",
"0.47736254",
"0.47... | 0.81542957 | 0 |
Calculate the mean intracluster distance for sample i. | def _intra_cluster_distance(distances_row, labels, i):
mask = labels == labels[i]
mask[i] = False
if not np.any(mask):
# cluster of size 1
return 0
a = np.mean(distances_row[mask])
return a | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __cluster_simi(self, i, j):\n sum_ = 0.\n for si in self.__indexclusters[i]:\n for sj in self.__indexclusters[j]:\n simi = self.__sample_simi(si, sj)\n sum_ += simi\n return sum_ / (len(self.__indexclusters[i]) * len(self.__indexclusters[j]))",
"d... | [
"0.62086725",
"0.6169589",
"0.61312467",
"0.60572255",
"0.5976423",
"0.59217167",
"0.5884832",
"0.5834737",
"0.5797622",
"0.57780486",
"0.575429",
"0.5702418",
"0.57006186",
"0.5698821",
"0.5696123",
"0.5643952",
"0.5616608",
"0.5607622",
"0.5513053",
"0.5504014",
"0.55019957... | 0.62878674 | 0 |
Calculate the mean nearestcluster distance for sample i. | def _nearest_cluster_distance(distances_row, labels, i):
label = labels[i]
b = np.min([np.mean(distances_row[labels == cur_label])
for cur_label in set(labels) if not cur_label == label])
return b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_to_current_mean(img: np.ndarray, clustermask: np.ndarray) -> float:\n\n rows, cols = img.shape[:2]\n distances = np.zeros((numclusters, 1))\n overall_dist = 0\n\n for i in range(rows):\n for j in range(cols):\n distances = distance(img[i, j, :]) # returned shape: (numcluste... | [
"0.70921725",
"0.6983354",
"0.68959963",
"0.6888589",
"0.6862163",
"0.6755681",
"0.6614062",
"0.65989083",
"0.64621276",
"0.6336365",
"0.63172454",
"0.6288452",
"0.62646407",
"0.6218701",
"0.62094474",
"0.6206924",
"0.6201612",
"0.6172816",
"0.61199796",
"0.60588336",
"0.6042... | 0.71920323 | 0 |
Create FHIRClient for AnVIL server. | def anvil_server(token):
settings = {
'app_id': __name__,
'api_bases': [
'https://healthcare.googleapis.com/v1beta1/projects/fhir-test-16-342800/locations/us-west2/datasets/anvil-test/fhirStores/public/fhir',
]
}
return DispatchingFHIRClient(settings=settings, auth=Google... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_client(self) -> None:\n self._client = discovery.build('ml', 'v1')",
"def dbgap_server():\n settings = {\n 'app_id': __name__,\n 'api_bases': ['https://dbgap-api.ncbi.nlm.nih.gov/fhir/x1']\n }\n return DispatchingFHIRClient(settings=settings)",
"def create_client(self) -> N... | [
"0.6487869",
"0.6173666",
"0.61577755",
"0.6056255",
"0.60014814",
"0.591538",
"0.58781195",
"0.5871188",
"0.58700764",
"0.58499616",
"0.57387865",
"0.57375073",
"0.5689368",
"0.5645486",
"0.5581789",
"0.5546197",
"0.55319875",
"0.5523522",
"0.54800326",
"0.5473757",
"0.54656... | 0.6822667 | 0 |
Create FHIRClient for Kids First server. | def kids_first_server(kids_first_cookie):
settings = {
'app_id': __name__,
'api_bases': ['https://kf-api-fhir-service.kidsfirstdrc.org']
}
return DispatchingFHIRClient(settings=settings, auth=KidsFirstFHIRAuth(cookie=kids_first_cookie)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aggregated_server(token, kids_first_server):\n settings = {\n 'app_id': __name__,\n 'api_bases': [\n 'https://healthcare.googleapis.com/v1beta1/projects/fhir-test-16-342800/locations/us-west2/datasets/anvil-test/fhirStores/public/fhir',\n ]\n }\n dispatching_client = Di... | [
"0.67020583",
"0.6465938",
"0.63516945",
"0.61677873",
"0.60971534",
"0.58580965",
"0.5791649",
"0.57853687",
"0.5732051",
"0.5722499",
"0.56583655",
"0.5594276",
"0.55834925",
"0.5540108",
"0.54757845",
"0.5466903",
"0.5456525",
"0.54284006",
"0.54284006",
"0.5419558",
"0.54... | 0.7738951 | 0 |
Create FHIRClient for dbgap (no auth). | def dbgap_server():
settings = {
'app_id': __name__,
'api_bases': ['https://dbgap-api.ncbi.nlm.nih.gov/fhir/x1']
}
return DispatchingFHIRClient(settings=settings) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_client(self) -> None:\n pass",
"def client(db):\n client = ClientFactory()\n db.session.commit()\n return client",
"def CreateClient():\n client = gdata.docs.client.DocsClient(source=SampleConfig.APP_NAME)\n client.http_client.debug = SampleConfig.DEBUG\n # Authenticate the user with ... | [
"0.64153063",
"0.63008624",
"0.59865993",
"0.5967783",
"0.595943",
"0.5925224",
"0.5923405",
"0.5872304",
"0.5849266",
"0.5800632",
"0.5794818",
"0.5784819",
"0.5735159",
"0.5706987",
"0.5692882",
"0.5692882",
"0.56712383",
"0.5654543",
"0.56373155",
"0.55973315",
"0.5596935"... | 0.75199544 | 0 |
Create FHIRClient for AnVIL and Kids First servers. | def aggregated_server(token, kids_first_server):
settings = {
'app_id': __name__,
'api_bases': [
'https://healthcare.googleapis.com/v1beta1/projects/fhir-test-16-342800/locations/us-west2/datasets/anvil-test/fhirStores/public/fhir',
]
}
dispatching_client = DispatchingFHI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kids_first_server(kids_first_cookie):\n\n settings = {\n 'app_id': __name__,\n 'api_bases': ['https://kf-api-fhir-service.kidsfirstdrc.org']\n }\n return DispatchingFHIRClient(settings=settings, auth=KidsFirstFHIRAuth(cookie=kids_first_cookie))",
"def create_client(self) -> None:\n ... | [
"0.6627241",
"0.615393",
"0.59216076",
"0.5882597",
"0.5776911",
"0.5727543",
"0.5676062",
"0.5568747",
"0.55423355",
"0.55334777",
"0.55085975",
"0.5458564",
"0.5445438",
"0.5424747",
"0.53905445",
"0.5384393",
"0.5339926",
"0.5318168",
"0.53084254",
"0.5308086",
"0.53077346... | 0.65306824 | 1 |
Search clause for all ResearchStudy with Observation | def search_research_studies_with_observations():
return ResearchStudy.where(struct={}).include('focus', Observation, reverse=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_research_studies_with_observations(aggregated_server, search_research_studies_with_observations):\n return search_research_studies_with_observations.perform_resources(aggregated_server.server)",
"def anvil_research_studies_with_observations(anvil_server, search_research_studies_with_observations):\n ... | [
"0.6562124",
"0.6547578",
"0.60443974",
"0.6031267",
"0.58513546",
"0.58444667",
"0.58020145",
"0.57395625",
"0.5688177",
"0.5605952",
"0.5539742",
"0.54948074",
"0.54797405",
"0.53628016",
"0.5359243",
"0.5339344",
"0.53291416",
"0.53238124",
"0.5323354",
"0.5284683",
"0.528... | 0.8091067 | 0 |
All ResearchStudies should have a corresponding Observation | def test_ResearchStudy_Observations(all_research_studies_with_observations):
all_observations = {r.relativePath(): r for r in all_research_studies_with_observations if
r.__class__.__name__ == 'Observation'}
all_research_studies = {r.relativePath(): r for r in all_research_studies_with_ob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_research_studies_with_observations():\n return ResearchStudy.where(struct={}).include('focus', Observation, reverse=True)",
"def anvil_research_studies_with_observations(anvil_server, search_research_studies_with_observations):\n return search_research_studies_with_observations.perform_resources... | [
"0.71020806",
"0.6367827",
"0.6108908",
"0.6089257",
"0.6082288",
"0.60774016",
"0.5873526",
"0.5744204",
"0.5730455",
"0.5679039",
"0.56191796",
"0.5539761",
"0.5515121",
"0.5498734",
"0.54927987",
"0.5440151",
"0.5403485",
"0.5385347",
"0.5369514",
"0.53583926",
"0.5344904"... | 0.72314113 | 0 |
All ResearchStudies should have a coded condition | def test_AggregatedResearchStudy_Condition(all_research_studies_with_observations):
_validate_ResearchStudy_Condition(all_research_studies_with_observations) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_AnvilResearchStudy_Condition(anvil_research_studies_with_observations):\n _validate_ResearchStudy_Condition(anvil_research_studies_with_observations)",
"def test_KidsFirstResearchStudy_Condition(kids_first_research_studies_with_observations):\n _validate_ResearchStudy_Condition(kids_first_research... | [
"0.7046073",
"0.6770994",
"0.65956974",
"0.64887834",
"0.6411145",
"0.61785287",
"0.60468686",
"0.59169006",
"0.5685322",
"0.56535155",
"0.55972874",
"0.558699",
"0.553397",
"0.55026543",
"0.5478138",
"0.5474606",
"0.5416882",
"0.53922516",
"0.5329989",
"0.5327044",
"0.531499... | 0.715086 | 0 |
All ResearchStudies should have a coded condition | def test_AnvilResearchStudy_Condition(anvil_research_studies_with_observations):
_validate_ResearchStudy_Condition(anvil_research_studies_with_observations) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_AggregatedResearchStudy_Condition(all_research_studies_with_observations):\n _validate_ResearchStudy_Condition(all_research_studies_with_observations)",
"def test_KidsFirstResearchStudy_Condition(kids_first_research_studies_with_observations):\n _validate_ResearchStudy_Condition(kids_first_researc... | [
"0.715086",
"0.6770994",
"0.65956974",
"0.64887834",
"0.6411145",
"0.61785287",
"0.60468686",
"0.59169006",
"0.5685322",
"0.56535155",
"0.55972874",
"0.558699",
"0.553397",
"0.55026543",
"0.5478138",
"0.5474606",
"0.5416882",
"0.53922516",
"0.5329989",
"0.5327044",
"0.5314998... | 0.7046073 | 1 |
All ResearchStudies should have a coded Focus | def test_AggregatedResearchStudy_Focus(all_research_studies_with_observations):
_validate_ResearchStudy_Focus(all_research_studies_with_observations) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_AnvilResearchStudy_Focus(anvil_research_studies_with_observations):\n _validate_ResearchStudy_Focus(anvil_research_studies_with_observations)",
"def test_KidsFirstResearchStudy_Focus(kids_first_research_studies_with_observations):\n _validate_ResearchStudy_Focus(kids_first_research_studies_with_ob... | [
"0.7076899",
"0.68101525",
"0.6531888",
"0.64950573",
"0.5497038",
"0.5334513",
"0.52147055",
"0.5205892",
"0.51820993",
"0.50241363",
"0.5009171",
"0.49573323",
"0.4916364",
"0.49054715",
"0.48900115",
"0.48892874",
"0.4863156",
"0.4775147",
"0.4758802",
"0.4709191",
"0.4677... | 0.7123412 | 0 |
All ResearchStudies should have a coded Focus | def test_AnvilResearchStudy_Focus(anvil_research_studies_with_observations):
_validate_ResearchStudy_Focus(anvil_research_studies_with_observations) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_AggregatedResearchStudy_Focus(all_research_studies_with_observations):\n _validate_ResearchStudy_Focus(all_research_studies_with_observations)",
"def test_KidsFirstResearchStudy_Focus(kids_first_research_studies_with_observations):\n _validate_ResearchStudy_Focus(kids_first_research_studies_with_o... | [
"0.7123412",
"0.68101525",
"0.6531888",
"0.64950573",
"0.5497038",
"0.5334513",
"0.52147055",
"0.5205892",
"0.51820993",
"0.50241363",
"0.5009171",
"0.49573323",
"0.4916364",
"0.49054715",
"0.48900115",
"0.48892874",
"0.4863156",
"0.4775147",
"0.4758802",
"0.4709191",
"0.4677... | 0.7076899 | 1 |
All ResearchStudies should have a url source, used to disambiguate combined results. | def test_AllResearchStudy_tag_fullUrl(all_research_studies_with_observations):
research_studies = [r for r in all_research_studies_with_observations if r.__class__.__name__ == 'ResearchStudy']
sources = defaultdict(int)
for research_study in research_studies:
url_parts = urlparse(research_study.meta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_source_studies(self):\n return list(set([trait.source_dataset.source_study_version.study for trait in self.get_all_source_traits()]))",
"def sources(source):\n\n source2 = models.Source(name=u\"Bob's Funerals.com\", url=u\"http://www.bobsfunerals.com\")\n source3 = models.Source(name=u\"Jim'... | [
"0.60480475",
"0.5917757",
"0.5730816",
"0.56753415",
"0.5654313",
"0.55641",
"0.55641",
"0.5547694",
"0.55346626",
"0.5513139",
"0.5512736",
"0.5510917",
"0.5467765",
"0.539208",
"0.5348067",
"0.5348067",
"0.53367364",
"0.5282698",
"0.5280202",
"0.5280202",
"0.52661675",
"... | 0.712948 | 0 |
Add error and pattern in context. | def get_context_data(self, **kwargs):
context = super(EntrySearchMixin, self).get_context_data(**kwargs)
context.update({'error': self.error, 'pattern': self.pattern})
return context | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(update, context):\n logger.warning(f'caused error {context.error}')",
"def error(context, *infos):\n messages = [\"An error occurred when when \" + context + \":\"]\n messages.extend(infos)\n print(\"\\n\\t\".join(map(str, messages)))\n return 1",
"def error(self, *args, **kwargs):",
... | [
"0.59470755",
"0.5853154",
"0.5767513",
"0.55975276",
"0.5572566",
"0.5542401",
"0.5490817",
"0.5427288",
"0.54142773",
"0.53719795",
"0.5330339",
"0.5325302",
"0.53169197",
"0.5305401",
"0.52926093",
"0.52881366",
"0.5283595",
"0.52769256",
"0.5272448",
"0.5222671",
"0.52206... | 0.65863466 | 0 |
Paginate a queryset according to start/end values (zeroindexed) in `range` header, or `None` if pagination is not properly configured. | def paginate_queryset(self, queryset, request, view=None):
self.count = self.get_count(queryset)
self.start_index = 0
self.end_index = self.start_index + self.page_size - 1
# TODO: this logic is repeated below...
if self.end_index > self.count - 1:
self.end_index = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginate_queryset(self, queryset, request, view=None):\n self.request = request\n\n try:\n self.page_number = int(request.query_params.get(\n self.page_query_param, 1\n ))\n except ValueError:\n self.page_number = 1\n\n if self.page_nu... | [
"0.68402827",
"0.6828292",
"0.6751178",
"0.6710934",
"0.66913843",
"0.6599945",
"0.6599945",
"0.6533155",
"0.6450382",
"0.6425188",
"0.6425188",
"0.6371845",
"0.63229877",
"0.6221445",
"0.620526",
"0.60240626",
"0.60176885",
"0.60176885",
"0.60176885",
"0.60176885",
"0.601768... | 0.80992943 | 0 |
Determine an object count, supporting either querysets or regular lists. | def get_count(self, queryset):
try:
return queryset.count()
except (AttributeError, TypeError):
return len(queryset) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_count(self):\r\n try:\r\n return self.objects.count()\r\n except (AttributeError, TypeError):\r\n # If it's not a QuerySet (or it's ilk), fallback to ``len``.\r\n return len(self.objects)",
"def count(self):\n objects = self.all()\n return len(... | [
"0.7612328",
"0.7366252",
"0.7362356",
"0.72482055",
"0.7233067",
"0.7067768",
"0.6915328",
"0.68827933",
"0.684652",
"0.68411964",
"0.6812702",
"0.678749",
"0.67703784",
"0.6692027",
"0.6669056",
"0.6666389",
"0.66293985",
"0.6617003",
"0.6598575",
"0.65860677",
"0.6552511",... | 0.7540589 | 1 |
Start a new turn with the given command, run any actions, and return any resulting messages. End the game if the gameover flag has been set. | def do_command(self, command):
self.state.start_turn(command)
messages = []
for stage in ('before_turn', 'during_turn', 'after_turn'):
messages += self.do_actions(stage)
if self.game_over:
messages += self.do_actions('after_game')
break
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def performCommand(self, game, command):\r\n game.currentTurn.perform(command)",
"def run(self):\n while True:\n if self.is_game_over():\n break\n self.run_turn()",
"def start_game(self, discord_id): # TODO replace with actual interface\n\n character =... | [
"0.66773695",
"0.6270796",
"0.61183286",
"0.6010336",
"0.5974087",
"0.5930384",
"0.5890591",
"0.5843468",
"0.57796586",
"0.57732767",
"0.57515264",
"0.57513005",
"0.57459444",
"0.5695944",
"0.567516",
"0.56622046",
"0.56612563",
"0.5658972",
"0.5644041",
"0.5625182",
"0.55775... | 0.7267475 | 0 |
Run each set of tests for this control, and if all tests are true for any set of tests, return the 'then' actions, otherwise 'else'. | def get_control_actions(self, control):
def test_is_true(test):
# return opposite if test is preceded by a bang
neg, test = (True, test[1:]) if test[0] == '!' else (False, test)
method, args = test.split()[0], test.split()[1:]
return getattr(self.tests, method)(*... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n\n runSuccess = True\n\n for value in self._shouldWork:\n value = value.normalize()\n print('Testing %s for %s' % (value, self._paramPath))\n\n for testName, testFunc in self._chainingTests:\n value, success = testFunc(value)\n ... | [
"0.6726141",
"0.6472806",
"0.64660954",
"0.6464525",
"0.63821197",
"0.624845",
"0.62303114",
"0.62186986",
"0.6192996",
"0.61255074",
"0.61233675",
"0.606831",
"0.60661584",
"0.6063222",
"0.60194975",
"0.6016759",
"0.6006452",
"0.6006351",
"0.59837097",
"0.5983048",
"0.594831... | 0.6739207 | 0 |
Evaluate each of the controls, run any actions and return any messages. End execution if 'done', end game if 'gameover'. | def do_actions(self, stage):
actions = itertools.chain(*[self.get_control_actions(control)
for control in self.controls.get(stage, [])])
messages = []
for action, args in actions:
if action == 'done':
# end execution of actions
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_game_logic(self):\n pass",
"def preliminary_check_controls(self):\n\n # is the program still in a binding state?\n if self.is_binding:\n self.error_msg['text'] = 'You are still binding'\n self.display_object_on_canvas(\n self.error_msg,\n ... | [
"0.6112631",
"0.60391665",
"0.5882871",
"0.5863374",
"0.5770765",
"0.57703453",
"0.57560116",
"0.5746701",
"0.5735498",
"0.5717721",
"0.569645",
"0.5607013",
"0.55787843",
"0.5563742",
"0.5559734",
"0.5549855",
"0.55371934",
"0.5536489",
"0.55203134",
"0.55088747",
"0.5453306... | 0.6375077 | 0 |
Read the specifications for benchmark scenarios from the given file. | def load_specs(specs_file: Path) -> Dict[str, Any]:
with open(specs_file, "r") as f:
specs_list = yaml.safe_load(f)
specs: Dict[str, Any] = {}
for spec in specs_list:
name = spec.pop("scenario")
specs[name] = spec
return specs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_specs(self, filename):\n self.filename = filename\n # Add loading functionality here",
"def load_specs(self, filename):\n self.filename = filename\n # Add loading functionality here",
"def _read_spec_test(filename):\n with open(filename, \"rt\") as file:\n source = file... | [
"0.65114725",
"0.65114725",
"0.6417736",
"0.6258011",
"0.5844041",
"0.5824274",
"0.57949275",
"0.5722615",
"0.5712147",
"0.5671993",
"0.5664229",
"0.56078595",
"0.5601193",
"0.5587428",
"0.55864275",
"0.5574626",
"0.55705124",
"0.5549373",
"0.55298305",
"0.550608",
"0.5504423... | 0.6534479 | 0 |
get "plain" credentials based on this object's user name and password | def get_credentials(self):
return PlainCredentials(self.user_name, self.password) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credentials(self):\n if self.user and self.is_authenticated():\n return AuthCredentials(['authenticated'] + self.user.permissions)\n else:\n return AuthCredentials()",
"def get_credentials(self):\n return self.credentials",
"def get_auth(self, username, password):... | [
"0.7126508",
"0.6844579",
"0.6834155",
"0.67717886",
"0.66723996",
"0.66461086",
"0.66461086",
"0.66461086",
"0.66365105",
"0.66235936",
"0.6611104",
"0.6610586",
"0.66021746",
"0.6597204",
"0.65740955",
"0.6547344",
"0.65441567",
"0.65374196",
"0.6530116",
"0.65276384",
"0.6... | 0.8568334 | 0 |
Creates a RabbitMqValidation object. | def __init__(self, rabbitmq_context, name, queue_name, max_queue_size,
priority=Priority.NORMAL, timeout=None, num_attempts=4,
seconds_between_attempts=2, group=None,
ignore_connection_failure=False):
Validation.__init__(self,
("queue '{0}' should h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_validation(**_):\n return Instance().creation_validation()",
"def __init__(self, options):\n self._options = options\n host = self._get_option('rabbit_host', 'str', 'localhost')\n port = self._get_option('rabbit_port', 'int', 5672)\n use_ssl = self._get_option('rabbit_... | [
"0.5598139",
"0.52708346",
"0.52527857",
"0.5172492",
"0.5163287",
"0.51590836",
"0.51504326",
"0.5145453",
"0.512318",
"0.5121069",
"0.5061056",
"0.50278664",
"0.50171185",
"0.49813724",
"0.4923644",
"0.4903602",
"0.48905015",
"0.48585543",
"0.48296002",
"0.48215201",
"0.480... | 0.59793466 | 0 |
Return root path depending on `env`. | def env_path(env):
host = socket.gethostname()
if host.startswith('maven-iuvs-itf'):
path = Path('/maven_iuvs/{}/products'.format(env))
elif host.startswith('test-machine'):
path = Path('/abc')
else:
path = Path(os.environ['HOME']) / 'Dropbox' / 'data' / 'iuvs'
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRootPath()->str:\n if '--develop' in sys.argv:\n return eel._get_real_path('public') + '/'\n\n return eel._get_real_path('build') + '/'",
"def env_prefix(self, path):\n if self.is_default:\n return self.root # FIXME: Is this guaranteed to be the right one?\n\n return... | [
"0.7341659",
"0.6901161",
"0.68833256",
"0.6854741",
"0.68008",
"0.67826056",
"0.6707531",
"0.6688138",
"0.66275823",
"0.656499",
"0.65384924",
"0.6472738",
"0.64659816",
"0.64594555",
"0.64594555",
"0.64313334",
"0.6426896",
"0.6417263",
"0.6374974",
"0.63685554",
"0.6353679... | 0.7453437 | 0 |
Return data path for given `level`. Some shortcuts for making interactive analysis faster. | def get_data_path(level, env='stage'):
levelstring = dict(l0='level0', l1a='level1a', l1b='level1b',
hk='housekeeping/level1a')
path = env_path(env) / levelstring[level]
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_level_path(target_level, cwd=None):\n if cwd is None:\n cwd = os.getwd()\n q = \"\"\n for ll in levels:\n q = os.path.join(q, get_level_name(ll, cwd))\n if ll == target_level:\n break\n return q",
"def dir_by_levels(path, levels):\n return op.abspath(op.join... | [
"0.59650904",
"0.5753782",
"0.56708485",
"0.56605345",
"0.5576853",
"0.5558456",
"0.55346483",
"0.5532985",
"0.5390557",
"0.5383048",
"0.5358974",
"0.5336397",
"0.53330517",
"0.532758",
"0.53264135",
"0.5312299",
"0.5299398",
"0.5232402",
"0.5229028",
"0.52273643",
"0.5201515... | 0.84084684 | 0 |
return iterator (default) or list of filenames for given pattern and environment. | def get_filenames(level, pattern=None, env='stage', ext='.fits.gz',
iterator=True):
if pattern is None:
pattern = '*'
else:
pattern = '*' + pattern + '*'
path = get_data_path(level, env)
if not os.access(str(path), os.R_OK):
raise PathNotReadableError(path)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def glob(self, pattern, lazy=False):\n def iterator():\n for filename in self.walk(lazy=lazy):\n if fnmatch(filename, pattern):\n yield self.__class__(filename)\n\n return lazy and iterator() or list(iterator())",
"def grep(self, pattern, flags=0, lazy=F... | [
"0.664766",
"0.6400394",
"0.6223163",
"0.6178909",
"0.6141178",
"0.61380345",
"0.5953448",
"0.5931955",
"0.58871454",
"0.5850509",
"0.5837912",
"0.5820044",
"0.5818663",
"0.581429",
"0.57979727",
"0.57786614",
"0.5768742",
"0.57534146",
"0.57429117",
"0.5740436",
"0.57352126"... | 0.69427615 | 0 |
Search for L1A filenames with patterns. | def l1a_filenames(pattern=None, **kwargs):
return get_filenames('l1a', pattern=pattern, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l1b_filenames(pattern=None, **kwargs):\n return get_filenames('l1b', pattern=pattern, **kwargs)",
"def l0_filenames(pattern=None, **kwargs):\n return get_filenames('l0', pattern=pattern, **kwargs)",
"def recognize_files(list_of_filenames):\n reg_exp = define_regex()\n pattern = re.compile(reg_e... | [
"0.7005518",
"0.62887824",
"0.6188861",
"0.6025856",
"0.5976886",
"0.59636414",
"0.5948682",
"0.59232306",
"0.58539903",
"0.5822771",
"0.57933414",
"0.5784495",
"0.5706747",
"0.5674135",
"0.56597656",
"0.5650312",
"0.56369996",
"0.5608095",
"0.5572013",
"0.5571477",
"0.553245... | 0.7837823 | 0 |
Search for L1B filenames with patterns. | def l1b_filenames(pattern=None, **kwargs):
return get_filenames('l1b', pattern=pattern, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l1a_filenames(pattern=None, **kwargs):\n return get_filenames('l1a', pattern=pattern, **kwargs)",
"def l0_filenames(pattern=None, **kwargs):\n return get_filenames('l0', pattern=pattern, **kwargs)",
"def insensitive_glob(pattern):\n def either(c):\n return '[%s%s]' % (c.lower(), c.upper()) ... | [
"0.7119328",
"0.60324216",
"0.5997652",
"0.5950744",
"0.58311814",
"0.5745395",
"0.5716153",
"0.55360895",
"0.551583",
"0.5482351",
"0.5462606",
"0.5438669",
"0.5430079",
"0.5426464",
"0.5419525",
"0.54178977",
"0.5415329",
"0.5376774",
"0.53742963",
"0.537093",
"0.536643",
... | 0.7937848 | 0 |
Save temporary HDF file in output folder for later concatenation. By default the product is stored in HOME/output. | def save_to_hdf(df, fname, output_subdir=None):
path = Path(fname)
newfname = path.with_suffix('.h5').name
folderpath = HOME / 'output'
if output_subdir:
folderpath = folderpath / output_subdir
path = folderpath / newfname
df.to_hdf(str(path), 'df', format='t')
return str(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_temp_file():\n global TEST_DATA_PATH\n TEST_DATA_PATH = tempfile.mkstemp()",
"def _persist_output(self, output, dir):\r\n try:\r\n mkdirp(dir)\r\n filename = os.path.join(dir, 'output.pkl')\r\n numpy_pickle.dump(output, filename, compress=self.compress)\r\n ... | [
"0.66007453",
"0.6436476",
"0.6383146",
"0.6261819",
"0.6228179",
"0.61940974",
"0.6191463",
"0.60604614",
"0.6038779",
"0.6000996",
"0.59706396",
"0.5945426",
"0.5937329",
"0.58776975",
"0.58729124",
"0.58628756",
"0.5847913",
"0.58380574",
"0.5836647",
"0.5831862",
"0.58235... | 0.65459925 | 1 |
Return a string of domain arguments to pass to certbot. | def domain_args(domains):
return ' ' + ' '.join(['-d {0}'.format(domain) for domain in domains]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _domain(self):\n return [self.args[0] >= 0, self.args[1] >= 0]",
"def domain(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"domain\")",
"def domain(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"domain\")",
"def get_arguments_string(self):\n result = self._... | [
"0.6043063",
"0.60352325",
"0.60352325",
"0.6011687",
"0.59671247",
"0.59114164",
"0.5832895",
"0.5832895",
"0.5832895",
"0.5832895",
"0.5830041",
"0.5750665",
"0.57268775",
"0.57268775",
"0.57268775",
"0.56694835",
"0.56390655",
"0.56390655",
"0.56390655",
"0.55137116",
"0.5... | 0.7283193 | 0 |
Retrieve an appropriate staging command flag based on the input value. | def staging_arg(staging):
return '--staging --dry-run' if int(staging) > 0 else '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_flag(flagname):\n if flagname in commands.keys():\n return commands[flagname]\n else:\n for cmdflag in commands.keys():\n if flagname in commands[cmdflag]['aliases']:\n return commands[cmdflag]",
"def getFlag(self, flag) -> bool:\n ... | [
"0.55968773",
"0.5591636",
"0.5532955",
"0.54534316",
"0.5251053",
"0.5185313",
"0.5153552",
"0.5122177",
"0.51145035",
"0.5112357",
"0.51035804",
"0.50814325",
"0.5078153",
"0.49949676",
"0.4978676",
"0.49708307",
"0.49664924",
"0.49361712",
"0.49148405",
"0.49077377",
"0.49... | 0.7097496 | 0 |
Called by constructor to activate the server. May be overridden. | def server_activate(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_activate(self):\n\t\tself.socket.listen(self.request_queue_size)",
"def __init__(self, server_address, RequestHandlerClass):\n\t\tBaseServer.__init__(self, server_address, RequestHandlerClass)\n\t\tself.socket = socket.socket(self.address_family,\n\t\t\t\t\t\t\t\t\tself.socket_type)\n\t\tself.server_b... | [
"0.73568827",
"0.7270721",
"0.71960783",
"0.7154854",
"0.7108848",
"0.70882046",
"0.7024609",
"0.70177794",
"0.6896035",
"0.68819034",
"0.68714905",
"0.6871399",
"0.68174565",
"0.6811275",
"0.68024534",
"0.6776788",
"0.6766742",
"0.67606485",
"0.67577267",
"0.67409325",
"0.67... | 0.8510852 | 0 |
Verify the request. May be overridden. Return True if we should proceed with this request. | def verify_request(self, request, client_address):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify(self):\n if self.geturl():\n return True\n return False",
"def process_request(self):\r\n # Middleware should pass request through\r\n self.assertEquals(self.middleware.process_request(self.request), None)",
"def process_webhook(self):\n if self.token:\n... | [
"0.69135076",
"0.6900922",
"0.6754977",
"0.66755795",
"0.666517",
"0.66586393",
"0.6622752",
"0.65399307",
"0.65296155",
"0.6511181",
"0.6510638",
"0.6503985",
"0.6465731",
"0.64541036",
"0.6441707",
"0.6440308",
"0.6420311",
"0.6409401",
"0.6379907",
"0.6379907",
"0.6372185"... | 0.7712128 | 0 |
Finish one request by instantiating RequestHandlerClass. | def finish_request(self, request, client_address):
self.RequestHandlerClass(request, client_address, self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _request_finished_handler(self):\n handler = HandlerWrapper('.handlers:request_finished_handler', None)\n exc_handler = HandlerWrapper(self.get_setting('handler.exc'), handler)\n return exc_handler",
"def handle_request(self, request):\n return self._first_handler(self, request)",... | [
"0.66085243",
"0.64429325",
"0.6257552",
"0.6036439",
"0.5925803",
"0.5925803",
"0.5866406",
"0.58606917",
"0.5837362",
"0.5830694",
"0.57862175",
"0.5680794",
"0.5662316",
"0.5645141",
"0.5640957",
"0.55994064",
"0.5597272",
"0.5590382",
"0.5590382",
"0.5575692",
"0.5561064"... | 0.7564471 | 0 |
Called to clean up an individual request. | def close_request(self, request):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _clear_request(self):\n self._request = None",
"def _clear_request_state(self):\n self.reset_arguments()\n self._request_finished = False\n self._write_callback = None\n self._close_callback = None",
"def close_request(self, request):\n\t\trequest.close()",
"def cleanup... | [
"0.74487096",
"0.6883553",
"0.6805663",
"0.67775035",
"0.67203283",
"0.66086096",
"0.6569573",
"0.6569573",
"0.6569573",
"0.6569573",
"0.6569573",
"0.6569573",
"0.6569573",
"0.6569573",
"0.6569573",
"0.6569573",
"0.6569573",
"0.65606767",
"0.65449476",
"0.65449476",
"0.651985... | 0.7033376 | 1 |
Called by constructor to activate the server. May be overridden. | def server_activate(self):
self.socket.listen(self.request_queue_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_activate(self):\n\t\tpass",
"def __init__(self, server_address, RequestHandlerClass):\n\t\tBaseServer.__init__(self, server_address, RequestHandlerClass)\n\t\tself.socket = socket.socket(self.address_family,\n\t\t\t\t\t\t\t\t\tself.socket_type)\n\t\tself.server_bind()\n\t\tself.server_activate()",
"... | [
"0.85105765",
"0.7271722",
"0.7196979",
"0.7154846",
"0.7109749",
"0.70898926",
"0.7024001",
"0.7018972",
"0.6897171",
"0.68824595",
"0.6873517",
"0.687293",
"0.6817895",
"0.6812482",
"0.6802926",
"0.6777137",
"0.67663544",
"0.6761803",
"0.6759365",
"0.674058",
"0.671519",
... | 0.7356828 | 1 |
Return socket file number. Interface required by select(). | def fileno(self):
return self.socket.fileno() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fileno(self):\n return self._socket.fileno()",
"def fileno(self):\n return self._socket.fileno()",
"def fileno(self):\n return self.sock.fileno()",
"def fileno(self):\n return self.sock.fileno()",
"def fileno(self) -> int:\n return self.pgconn.socket",
"def fileno (... | [
"0.7614389",
"0.7614389",
"0.75093704",
"0.75093704",
"0.73656094",
"0.73502403",
"0.69934493",
"0.69053924",
"0.69038963",
"0.689046",
"0.6845795",
"0.6821889",
"0.6786743",
"0.673936",
"0.67105764",
"0.6684018",
"0.6598601",
"0.65837055",
"0.6469139",
"0.6465674",
"0.640831... | 0.77852744 | 1 |
builds the conformer model and dataflow for inference | def create_model_and_dataflow_for_inference(builder, conf, inputs):
conformer_encoder = conformer_builder.ConformerEncoder(builder,
input_dim=conf.mel_bands,
sequence_length=conf.max_spectrogra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_inference_graph(self):\n self.build_train_graph()",
"def build_model(self):\n if not os.path.isdir(os.path.join(self.save_dir, self.name)):\n os.mkdir(os.path.join(self.save_dir, self.name))\n self.fitted = False\n else:\n self.fitted = True\n ... | [
"0.6839832",
"0.6701632",
"0.6652164",
"0.66402775",
"0.64333713",
"0.64312077",
"0.64179784",
"0.64040047",
"0.63786626",
"0.6359483",
"0.6354679",
"0.6326365",
"0.63245386",
"0.6312543",
"0.6297141",
"0.6289208",
"0.6272067",
"0.6267459",
"0.625798",
"0.6257605",
"0.6232253... | 0.74342567 | 0 |
Authorize a transaction for the provided user. This get_service_service method would be utilized if you are using this as a secondary factor for user login or authorizing a single transaction within your application. This will NOT begin a user session. | def authorize(self, user, context=None, policy=None):
kwargs = {'username': user}
if context is not None:
kwargs['context'] = context
if policy is not None:
if not isinstance(policy, AuthPolicy):
raise InvalidParameters("Please verify the input policy is a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize(self, service_id, operation_id, ctx):\n raise NotImplementedError",
"def authorize_user(case: APITestCase, user: User):\n\n token = Token.objects.create(user=user)\n case.client.credentials(HTTP_AUTHORIZATION=f'Token {token}')",
"def authorize(user):\n try:\n access_token, ... | [
"0.5923672",
"0.5833841",
"0.5623775",
"0.545789",
"0.5410932",
"0.5373277",
"0.53295743",
"0.5251676",
"0.5220088",
"0.51644796",
"0.5146134",
"0.5119877",
"0.5110956",
"0.5091623",
"0.50768155",
"0.5051242",
"0.5047667",
"0.50170714",
"0.4992066",
"0.49864775",
"0.49635628"... | 0.5858313 | 1 |
Request to start a Service Session for the End User which was derived from a authorization request | def session_start(self, user, authorization_request_id):
self._transport.post("/service/v3/sessions", self._subject, username=user,
auth_request=authorization_request_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __login(self):\n loginResult = self.sfdc.login(username=self.__username, \n password=self.__password)\n self.userId = loginResult.get('userId')\n \n \n self.userInfo = loginResult.get('userInfo', {}) \n # Switch the binding to the ... | [
"0.68474007",
"0.60991573",
"0.60911334",
"0.6076836",
"0.60532165",
"0.6036571",
"0.594356",
"0.59378165",
"0.5901936",
"0.58786064",
"0.5866154",
"0.58496207",
"0.5779873",
"0.57681173",
"0.57542235",
"0.5750955",
"0.5734783",
"0.57310396",
"0.5730623",
"0.5726212",
"0.5705... | 0.7533751 | 0 |
Request to end a Service Session for the End User | def session_end(self, user):
self._transport.delete("/service/v3/sessions", self._subject, username=user) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_session_end_request():\n card_title = \"Session Ended\"\n speech_output = \"Thank you for trying Cuni Control. \" \\\n \"Have a nice day! \"\n \n # Setting this to true ends the session and exits the skill.\n should_end_session = True\n return build_response({}, buil... | [
"0.68782824",
"0.6832003",
"0.6566728",
"0.6490476",
"0.64393437",
"0.6425385",
"0.6402446",
"0.6349682",
"0.63282436",
"0.6273899",
"0.62712944",
"0.6234825",
"0.6213069",
"0.6207226",
"0.6207226",
"0.6207226",
"0.6207226",
"0.6207226",
"0.6207226",
"0.6207226",
"0.6207226",... | 0.72197086 | 0 |
(Dataset) Field name on noncompound dataset raises ValueError | def test_fieldname_exc(self):
ds = self.f.create_dataset('foo', (100,), 'f')
self.assertRaises(ValueError, ds.__getitem__, (0, 'a')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_dataset_names(ds, field):\n\n dsf = ds[field]\n\n standard_name, long_name, var_name = None, None, field\n long_name = _get_dataset_attr(dsf, 'long_name')\n standard_name = _get_dataset_attr(dsf, 'standard_name')\n\n return standard_name, long_name, var_name",
"def get_dataset_name(self):... | [
"0.632174",
"0.59979236",
"0.5831347",
"0.5812153",
"0.5763908",
"0.5740263",
"0.5719686",
"0.569114",
"0.56687605",
"0.5637011",
"0.55908",
"0.5590709",
"0.55751485",
"0.55291516",
"0.5525892",
"0.55011374",
"0.5472811",
"0.54687274",
"0.54357684",
"0.5403844",
"0.5397182",
... | 0.65513605 | 0 |
A naive implementation of the backward pass for a max pooling layer. | def max_pool_backward_naive(dout, cache):
x, pool_params = cache
N, C, H, W = x.shape
pool_height = pool_params['pool_height']
pool_width = pool_params['pool_width']
stride = pool_params['stride']
Hc = (H - pool_height) / stride + 1
Wc = (W - pool_width) / stride + 1
dx = np.zeros(x.shape)
########... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_pool_backward_naive(dout, cache):\n dx = None\n #############################################################################\n # TODO: Implement the max pooling backward pass #\n #############################################################################\n pass\n ######... | [
"0.80057496",
"0.76343054",
"0.7490919",
"0.74883157",
"0.7468646",
"0.7453743",
"0.74028534",
"0.7401237",
"0.73491824",
"0.720543",
"0.7113435",
"0.71039474",
"0.71039474",
"0.7048927",
"0.6986948",
"0.69340307",
"0.69026834",
"0.685706",
"0.6800773",
"0.67663366",
"0.67650... | 0.7760457 | 1 |
Takes a parsed csv file and the name of a mongodb collection. It proceeds to break the parsed file into multiple pieces based on the variable thread_count and then uses individual threads to send each piece of the divided file off to be looped over and inserted into the database. | def send_data_to_mutiple_threads(parsed_file, collection_name):
for i in range(thread_count):
len_file_segment = len(parsed_file) // thread_count
if (i * len_file_segment) + len_file_segment + 1 > len(parsed_file):
divided_product_file = parsed_file[i * len_file_segment:]
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_one_file(collection_name, directory, file_name):\n with MongoDBConnection() as mongo:\n\n database = mongo.connection[DATABASE]\n\n error_count = 0\n try:\n new_collection = database[collection_name]\n before_count = new_collection.count_documents({})\n ... | [
"0.66855055",
"0.66525465",
"0.6548451",
"0.64635015",
"0.63573635",
"0.6298225",
"0.6252751",
"0.6237427",
"0.6213078",
"0.61451656",
"0.6011661",
"0.5976718",
"0.5918912",
"0.59067196",
"0.5781518",
"0.57672864",
"0.57608676",
"0.57320213",
"0.5730259",
"0.56517845",
"0.564... | 0.76724946 | 0 |
Takes in individual data_point and a collection name and inserts the data into the collection. | def insert_data_to_collection(data_point, collection_name): # {{{
try:
with MONGO:
DATABAE = MONGO.connection.assignment_07
new_collection = DATABAE[collection_name]
new_collection.insert_one(data_point)
except TypeError as excep:
LOGGER.info("Error saving ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataInsert(self, collectionName, data):\n result = collectionName.insert(data)\n return result",
"def thread_insert_data(collection_to_insert, collection_name):\n for item in collection_to_insert:\n insert_data_to_collection(item, collection_name)",
"def add_data_collection(self, data_colle... | [
"0.79513663",
"0.7144356",
"0.6520929",
"0.64734733",
"0.6379729",
"0.606351",
"0.6023238",
"0.6003779",
"0.59736943",
"0.5932865",
"0.5908684",
"0.59048027",
"0.5873167",
"0.58440447",
"0.5831229",
"0.5801828",
"0.5735111",
"0.5734013",
"0.5715863",
"0.5707668",
"0.5701859",... | 0.81112075 | 0 |
NOT USED FOR ASSIGNMENT_07 Returns a dict containing information about products listed as available. | def show_available_products(): # {{{
products_available = {}
try:
with MONGO:
product_collection = MONGO.connection.assignment_07["product"].find(
)
for product in product_collection:
if int(product["quantity_available"]) > 0:
pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_available_products(*args):\n logger.info(f\"Preparing dict of available prodcuts...\")\n available_products = {}\n\n with MONGO:\n mdb = eval(Settings.connect_string)\n products = mdb[\"product\"]\n for doc in products.find():\n del doc[\"_id\"]\n if int... | [
"0.7860961",
"0.7774958",
"0.7744309",
"0.7726528",
"0.72653353",
"0.7243636",
"0.67437667",
"0.6728308",
"0.6649637",
"0.66038954",
"0.65983",
"0.65487605",
"0.645477",
"0.6418727",
"0.6408831",
"0.6335968",
"0.62894183",
"0.6267611",
"0.61997634",
"0.61866397",
"0.6156232",... | 0.81598747 | 0 |
NOT USED FOR ASSIGNMENT_07 Returns a dict containing information about customers who have rented a product based on the provided product_id. | def show_rentals(product_id): # {{{
cust_rent_dict = {}
try:
with MONGO:
DATABAE = MONGO.connection.assignment_07
customer_rental = DATABAE.rental.aggregate(
[
{
"$lookup": {
"from": "custome... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customers_renting_product(product_id):\n logger.info(f\"Perparing rental dict for product_id: {product_id}...\")\n users_renting_product = []\n\n with MONGO:\n mdb = eval(Settings.connect_string)\n\n rentals = mdb[\"rental\"]\n customers = mdb[\"customers\"]\n query = {\"pr... | [
"0.7795496",
"0.7388176",
"0.72028625",
"0.685471",
"0.6852489",
"0.63175374",
"0.5973188",
"0.5707278",
"0.55884176",
"0.55630213",
"0.55298024",
"0.552132",
"0.5489038",
"0.54152846",
"0.5413372",
"0.53690314",
"0.53402364",
"0.53297937",
"0.5327381",
"0.5304467",
"0.519002... | 0.76678 | 1 |
This method hides the card value of one of the cards in the hand | def hide_card(self):
try:
self.hidden_card_value = self.hand[1]
self.hand[1] = Card()
except IndexError:
print('The dealer does not have enough cards!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reveal_card(self):\n self.hand[1] = self.hidden_card_value\n self.hidden_card_value = Card()",
"def show_card(self):\n return self.hands.show(0)",
"def cardDiscardable(self, card):\n if self.cardDead(card):\n return True\n\n cardAttr = \"\"\n if Suit.toS... | [
"0.7658349",
"0.70967025",
"0.66173804",
"0.6526069",
"0.6486656",
"0.6423241",
"0.64149517",
"0.6412979",
"0.6320496",
"0.63022",
"0.62236404",
"0.6134764",
"0.611626",
"0.6110068",
"0.6034322",
"0.59990495",
"0.59833556",
"0.58970237",
"0.58864003",
"0.5881191",
"0.58799386... | 0.8576549 | 0 |
This method reveals the hidden card value of the dealer's hand | def reveal_card(self):
self.hand[1] = self.hidden_card_value
self.hidden_card_value = Card() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide_card(self):\n try:\n self.hidden_card_value = self.hand[1]\n self.hand[1] = Card()\n except IndexError:\n print('The dealer does not have enough cards!')",
"def show_card(self):\n return self.hands.show(0)",
"def dealer_hand_value(self):\n r... | [
"0.7789195",
"0.7392347",
"0.6639642",
"0.66025877",
"0.65392435",
"0.642166",
"0.64189625",
"0.6402544",
"0.63908803",
"0.6302911",
"0.6263433",
"0.62296736",
"0.6169979",
"0.615945",
"0.61185575",
"0.60910076",
"0.6089985",
"0.60895157",
"0.60785025",
"0.60517293",
"0.60169... | 0.74495894 | 1 |
Sends a message to many recipients Sends a message to many recipients given a list of valid jid elements | def send_mass_messages(self, recipient_list, sender, message="", subject=""):
try:
for s in recipient_list:
self.send_message(to=s, sender=sender, message=message, subject=subject)
except TypeError:
return -1
return 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_batch(cls, subject, body, recipients, chunk_size=settings.MAILGUN_BATCH_CHUNK_SIZE):\n\n body, recipients = cls._recipient_override(body, recipients)\n responses = []\n\n recipients = iter(recipients)\n chunk = list(islice(recipients, chunk_size))\n while len(chunk) > 0:... | [
"0.6359785",
"0.63397866",
"0.6288471",
"0.62113225",
"0.61084944",
"0.60233146",
"0.60154873",
"0.598864",
"0.5914331",
"0.59037423",
"0.5899749",
"0.5861806",
"0.58536476",
"0.5804122",
"0.57899934",
"0.575579",
"0.5752409",
"0.5724917",
"0.5717271",
"0.57025373",
"0.565774... | 0.6808123 | 0 |
Sends a presence to a specified user or everyone in roster that has a subscription for it If jid is specified username and domain is not used. If jid is not specified, it sends to username + domain combination. If typ is not defined it sends an empty presence. | def send_presence(self, typ=None, jid=None, username=None, domain=None):
if jid is not None:
self.client.send(xmpp.Presence(jid, typ))
elif username is not None and domain is not None:
self.client.send(xmpp.Presence(xmpp.JID(node=username, domain=domain), typ))
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe(self, jid=None, username=None, domain=None):\n return self._roster.subscribe(jid=jid, username=username, domain=domain)",
"def send_presence_subscription(self, pto, pfrom=None,\n ptype='subscribe', pnick=None):\n presence = self.makePresence(ptype=pty... | [
"0.65225786",
"0.5953572",
"0.5894999",
"0.5161822",
"0.49696448",
"0.4899737",
"0.48943952",
"0.48567942",
"0.48436975",
"0.48148578",
"0.47893205",
"0.47853187",
"0.47504738",
"0.47281998",
"0.46669987",
"0.46114495",
"0.4576982",
"0.45469198",
"0.4532463",
"0.44638354",
"0... | 0.84048325 | 0 |
Checks if a given jid in your roster is online | def check_if_online(self, jid):
return self._roster.check_if_online(jid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def online(self) -> bool:\n\t\treturn self._raw_result['data']['online']",
"def is_online(self) -> bool:\n return self.data[Attribute.ONLINE]",
"def online(self):\n return False",
"def online_check(self):\n self.online = False\n online_topic = '{t_topic}/INFO2'.format(**self)\n ... | [
"0.6583299",
"0.63669074",
"0.6345344",
"0.6308235",
"0.62174004",
"0.61554134",
"0.612988",
"0.6103977",
"0.60726005",
"0.6045362",
"0.5973001",
"0.59701645",
"0.59084415",
"0.5903449",
"0.5896175",
"0.5892544",
"0.58921444",
"0.58814085",
"0.5815631",
"0.57817787",
"0.57360... | 0.8775524 | 0 |
Returns a list of subscriptions to self This is the list of clients that wants to push messages to you | def get_subscriptions_to_self(self):
return self._roster.get_my_subscribers()
return self._roster.get_my_subscribers() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscriptions_from_self(self):\n return self._roster.get_my_subscriptions()",
"def get_subscriptions(self):\n return self.subscriptions.all()",
"def get_subscriptions(self):\n url = '{}/v2/subscriptions'.format(self.url)\n r = requests.get(url, headers=self.headers_v2)\n ... | [
"0.8075833",
"0.77067226",
"0.7607144",
"0.7549481",
"0.75401825",
"0.7438987",
"0.74196154",
"0.7336986",
"0.72713166",
"0.7261534",
"0.7198291",
"0.71364784",
"0.70324844",
"0.70229346",
"0.69757015",
"0.6957694",
"0.6943977",
"0.6942855",
"0.6936642",
"0.6935376",
"0.68922... | 0.7923385 | 1 |
Subscribes to the given Jabber ID If the other user allows it, you will be subscribed to their online presence, This means that when they are online you will have them in your roster. You can push messages to anyone who is in your roster and online. If jid is given username and domain will not be used. If no jid is pro... | def subscribe(self, jid=None, username=None, domain=None):
return self._roster.subscribe(jid=jid, username=username, domain=domain) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_presence(self, typ=None, jid=None, username=None, domain=None):\n if jid is not None:\n self.client.send(xmpp.Presence(jid, typ))\n elif username is not None and domain is not None:\n self.client.send(xmpp.Presence(xmpp.JID(node=username, domain=domain), typ))\n ... | [
"0.59986246",
"0.5902258",
"0.57248807",
"0.5553138",
"0.54209846",
"0.5383966",
"0.5320938",
"0.53059906",
"0.52832",
"0.52595043",
"0.5223522",
"0.5197698",
"0.5188524",
"0.5178475",
"0.51495826",
"0.51272815",
"0.50505",
"0.5035625",
"0.5019188",
"0.49989825",
"0.49672887"... | 0.7805445 | 0 |
Unsubscribes to the given Jabber ID If jid is given username and domain will not be used. If no jid is provided it will use the username and domain given. | def unsubscribe(self, jid=None, username=None, domain=None):
if jid is not None:
self._pres_manager.flag_offline(jid)
elif username is not None and domain is not None:
self._pres_manager.flag_offline(xmpp.JID(node=username, domain=domain))
self._roster.unsubscribe(jid=jid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe(self, jid=None, username=None, domain=None):\n return self._roster.subscribe(jid=jid, username=username, domain=domain)",
"async def unsubscribe(self, topic: str, subscription_id: int = None) -> None:\n ...",
"def unsubscribe( self, mess, args):\n user = self.get_sender_usern... | [
"0.5751991",
"0.5670288",
"0.5660844",
"0.5629432",
"0.5567008",
"0.5554873",
"0.5522222",
"0.5506419",
"0.54898965",
"0.54898965",
"0.5454685",
"0.5415067",
"0.53726363",
"0.5342575",
"0.5342575",
"0.5342575",
"0.5342575",
"0.5342575",
"0.52878815",
"0.5221202",
"0.5183088",... | 0.73642457 | 0 |
Sets the method to be called for subscription validation The validator function needs to return a tuple in the format of (bool, bool) Where the first bool determines if the subscription will be allowed. The second bool will determine if a subscription will be send back to sender. | def set_subscription_validator(self, function):
self._pres_manager.set_subscription_validator(function) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, func: TValidateMethod) -> TValidateMethod:\n return cast(TValidateMethod, self.field.validator(func))",
"def validation_method(self, validation_method):\n if (\n self.local_vars_configuration.client_side_validation\n and validation_method is None\n ):... | [
"0.62159944",
"0.60148716",
"0.54788154",
"0.5464176",
"0.54139835",
"0.5381009",
"0.5349757",
"0.53374636",
"0.5266025",
"0.525557",
"0.5229178",
"0.52067775",
"0.5198075",
"0.51660395",
"0.5142323",
"0.5139091",
"0.51210785",
"0.5114187",
"0.50993085",
"0.50549924",
"0.5054... | 0.72708106 | 0 |
Given a function, set it's as the disconnect handler This function will be called whenever someone you are subscribed to disconnects. If someone is subscribed to you, but you are not subscribed to them, and they disconnect this function will not be called. If someone shuts down cleanly by calling the disconnect method.... | def set_disconnect_handler(self, function):
self._pres_manager.set_disconnect_handler(function) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notifyDisconnect(self, function, **kwargs):\n self._sig_disconnect.subscribe(function, **kwargs)",
"def unregisterDisconnect(self, function):\n self._sig_disconnect.unsubscribe(function)",
"def _unregisterConnect(self, function):\n self._sig_connect.unsubscribe(function)",
"def regis... | [
"0.76811427",
"0.7650592",
"0.7344124",
"0.7178858",
"0.70642084",
"0.68698394",
"0.6719059",
"0.6656181",
"0.6610713",
"0.65778524",
"0.6559731",
"0.65423423",
"0.65267336",
"0.64596987",
"0.63724583",
"0.63471484",
"0.63374466",
"0.6266033",
"0.6248985",
"0.62241095",
"0.62... | 0.82017994 | 0 |
Featurize a batch of instances/examples. | def featurize_batch(
self, input_record_list: Sequence[InputRecord]
) -> Sequence[OutputRecord]:
return [self.featurize(record) for record in input_record_list] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit(self, feats, tag_set, epochs, alpha=1):\n # make an (evaluated) copy of the data, to shuffle it in place\n for i in xrange(1, 1 + epochs):\n #print(i)\n feats, tag_set = shuffle_set(feats, tag_set) \n for (tokens, tags) in zip(feats, tag_set):\n ... | [
"0.6292362",
"0.6276744",
"0.6178084",
"0.61522764",
"0.61500376",
"0.61405104",
"0.6135426",
"0.6095357",
"0.6093661",
"0.60840034",
"0.6059089",
"0.6056277",
"0.60404384",
"0.6038489",
"0.6033748",
"0.6026723",
"0.5992279",
"0.5991704",
"0.5987287",
"0.5965327",
"0.59652853... | 0.6554591 | 0 |
Parse string s and return it as an XmlWrapper. | def parse_string(s):
return XmlWrapper(minidom.parseString(s)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_string(self, string):\n try:\n root = ET.XML(string, self.parser)\n except ET.XMLSyntaxError as exc:\n raise ParserException(exc.msg)\n\n self._handle_version(root)\n return self.parse_element(root)",
"def readString(self, st):\n if not isinstance... | [
"0.71517843",
"0.68862134",
"0.68296826",
"0.65980613",
"0.6575704",
"0.64093167",
"0.62460965",
"0.62450075",
"0.6190986",
"0.6140239",
"0.6114127",
"0.6049694",
"0.6008011",
"0.5978161",
"0.59610367",
"0.5953909",
"0.59178597",
"0.5881195",
"0.58256227",
"0.5798697",
"0.578... | 0.8601856 | 0 |
Copies the OID values into a new field. | def copy_oids(fc, fld_name):
oid_fld = arcpy.Describe(fc).OIDFieldName
arcpy.AddField_management(fc, fld_name, 'LONG')
arcpy.CalculateField_management(
fc, fld_name, '!{}!'.format(oid_fld), 'PYTHON_9.3') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _populate(self, fields):\n schema = self.schema\n for k, v in fields.items():\n fields[k] = schema.fields[k].iget(self, v)\n\n self.modify(fields)\n self.reset_modified()",
"def set_field( self, data ):\n self.val[:] = data[:]\n return",
"def auto_popula... | [
"0.6013712",
"0.57678795",
"0.5669727",
"0.5588951",
"0.5334144",
"0.5330527",
"0.53303367",
"0.53043383",
"0.5244572",
"0.5227239",
"0.5165508",
"0.5164859",
"0.5131589",
"0.51217026",
"0.51020074",
"0.5080617",
"0.507278",
"0.5055193",
"0.50528955",
"0.50414616",
"0.5038187... | 0.7256956 | 0 |
Creates a sde connection in the scratch folder and returns the path to `.sde` file. Assumes OSA, and a SQL Server database. | def get_db_conn(server, database, version='sde.DEFAULT'):
scratch_work = arcpy.env.scratchFolder
conn_name = 'temp__{}_{}'.format(server, database)
conn_path = '{}//{}.sde'.format(scratch_work, conn_name)
with TempOverwrite():
arcpy.CreateDatabaseConnection_management(
scratch_work,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connectDB(dbase):\n try:\n desdmfile = os.environ[\"DES_SERVICES\"]\n except KeyError:\n desdmfile = None\n\n dbh = coreutils.desdbi.DesDbi(desdmfile,dbase)\n \n return dbh",
"def create_ogse_db(args):\n if args.ref_diode:\n # read reference-diode data\n xds... | [
"0.5721909",
"0.5700629",
"0.56559503",
"0.54991007",
"0.53026545",
"0.5267769",
"0.5205054",
"0.51417035",
"0.5131447",
"0.51237494",
"0.50961167",
"0.5084689",
"0.5077925",
"0.5076727",
"0.50653267",
"0.5036871",
"0.5032438",
"0.50126195",
"0.5012369",
"0.49979642",
"0.4997... | 0.6377563 | 0 |
Add a series or a shape | def append(self, obj):
if isinstance(obj, Series):
self.series.append(obj)
elif isinstance(obj, Shape):
self.shapes.append(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_series(series, label, marker):\n plt.plot(series, label=label, marker=marker, linestyle=':', linewidth=0.5,\n markersize=4)",
"def add_shape(self, shape):\n\n if isinstance(shape, Shape):\n self.shapes.append(shape)\n else:\n raise TypeError",
"def ad... | [
"0.679036",
"0.6448617",
"0.6153441",
"0.60951203",
"0.60190743",
"0.59869045",
"0.5980581",
"0.5938435",
"0.57375103",
"0.5671077",
"0.55945724",
"0.55821824",
"0.55684173",
"0.5563769",
"0.5553897",
"0.5553167",
"0.5550001",
"0.55373967",
"0.55017203",
"0.54949486",
"0.5481... | 0.66783464 | 1 |
estimate nb of chars for y axis | def get_y_chars(self):
_max = max([s.max() for s in self])
return len(str(int(_max))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y_size(self):\n pass",
"def n_y(self, level):\n resolution = self.resolution(level)\n return (self.y_extent // resolution + 63) // 64",
"def get_y_units(self):\n\n dh = pixels_to_EMU(self.drawing.height)\n return (dh * self.height) / self.y_axis.max",
"def ydim(self):\n... | [
"0.6998755",
"0.6702044",
"0.66450065",
"0.6431775",
"0.62996966",
"0.6284023",
"0.62194103",
"0.6066007",
"0.60201293",
"0.599986",
"0.59938455",
"0.59915423",
"0.5950333",
"0.58822197",
"0.584012",
"0.5835293",
"0.57946754",
"0.5781789",
"0.5694269",
"0.5689259",
"0.5683815... | 0.69375783 | 1 |
set base top margin | def margin_top(self, value):
self._margin_top = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def margin_top(self):\n\n return min(self._margin_top, self._get_max_margin_top())",
"def make_space_above(self, ax, topmargin=1):\n fig = ax.figure\n s = fig.subplotpars\n w, h = fig.get_size_inches()\n\n figh = h - (1-s.top)*h + topmargin\n fig.subplots_adjust(bottom=... | [
"0.66542476",
"0.64437836",
"0.64155746",
"0.6408033",
"0.6184823",
"0.61150414",
"0.61150414",
"0.61074656",
"0.6095084",
"0.59974194",
"0.5987903",
"0.59692764",
"0.588129",
"0.57261807",
"0.5708807",
"0.5618515",
"0.5570389",
"0.55593884",
"0.5545871",
"0.55392355",
"0.552... | 0.73508364 | 0 |
Calculate the maximum and minimum values of all series for an axis 'values' for columns 'xvalues for rows | def _get_extremes(self, attr='values'):
# calculate the maximum and minimum for all series
series_max = [0]
series_min = [0]
for s in self:
if s is not None:
series_max.append(s.max(attr))
series_min.append(s.min(attr))
return min(serie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minMax(df):\n max_, min_ = df.max(axis=0), df.min(axis=0)\n midrange = (max_ + min_) / 2\n half_range = (max_ - min_) / 2\n return (df - midrange) / half_range",
"def xminmax ( self ) :\n return self.xvar.minmax()",
"def compute_axes(self):\n mini, maxi = self._get... | [
"0.66076225",
"0.6471945",
"0.6391276",
"0.63118863",
"0.63118863",
"0.6278994",
"0.62640023",
"0.6240948",
"0.61388075",
"0.6135382",
"0.60807997",
"0.60373276",
"0.60211396",
"0.599636",
"0.59920996",
"0.59727955",
"0.59036803",
"0.5894996",
"0.5865304",
"0.5854356",
"0.584... | 0.67006063 | 0 |
Generates a 'Stochastic Event Set' (that is a collection of earthquake ruptures) representing a possible realization of the seismicity as described by a source model. The calculator loops over sources. For each source, it loops over ruptures. For each rupture, the number of occurrence is randomly sampled by calling | def stochastic_event_set(
sources, source_site_filter=filters.source_site_noop_filter):
for source, s_sites in source_site_filter(sources):
try:
for rupture in source.iter_ruptures():
for i in range(rupture.sample_number_of_occurrences()):
yield ruptur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculator_build_events_from_sources(self):\n gsims_by_trt = self.calculator.csm.full_lt.get_gsims_by_trt()\n print('FetchOpenQuake: self.calculator.csm.src_groups = ')\n print(self.calculator.csm.src_groups)\n sources = self.calculator.csm.get_sources()\n print('FetchOpenQua... | [
"0.6766079",
"0.59371805",
"0.5853599",
"0.5776658",
"0.573276",
"0.5700718",
"0.5650811",
"0.5633665",
"0.56092626",
"0.55868137",
"0.5576924",
"0.556124",
"0.54923797",
"0.5438686",
"0.54226226",
"0.5405479",
"0.5369182",
"0.5362274",
"0.53617173",
"0.535296",
"0.5345076",
... | 0.72047055 | 0 |
Set event IDs on the given list of ebruptures. | def set_eids(ebruptures):
if not ebruptures:
return numpy.zeros(0)
all_eids = []
for ebr in ebruptures:
assert ebr.multiplicity < TWO32, ebr.multiplicity
eids = U64(TWO32 * ebr.serial) + numpy.arange(
ebr.multiplicity, dtype=U64)
ebr.events['eid'] = eids
a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadEvents(self, eventlist):\n for event in eventlist:\n event.ID = self.loadEvent(event.name, event.pid)",
"def set_ids(self, item_list):\n self._reset_sequence()\n for item in item_list:\n key = self.nondup_key_for_item(item)\n item[self.id_key] = self.... | [
"0.6113597",
"0.6063973",
"0.57654226",
"0.57515347",
"0.5746036",
"0.5495133",
"0.54440075",
"0.54335964",
"0.5383432",
"0.5365751",
"0.5346338",
"0.5344072",
"0.53374904",
"0.5326289",
"0.5313889",
"0.5301569",
"0.5280135",
"0.5244845",
"0.5239668",
"0.5180443",
"0.5176981"... | 0.7768218 | 0 |
Sample the ruptures contained in the given source. | def _sample_ruptures(src, prob, num_ses, num_samples, seed):
# the dictionary `num_occ_by_rup` contains a dictionary
# ses_id -> num_occurrences for each occurring rupture
num_occ_by_rup = collections.defaultdict(AccumDict)
# generating ruptures for the given source
for rup_no, rup in enumerate(src.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subsample_imageset(self, source_folder_name, destination_folder_name, sample_step=4):\n photo_list = self.get_photo_list(source_folder_name)\n for i in range(0, len(photo_list), sample_step):\n copyfile(source_folder_name + '/' + photo_list[i], destination_folder_name + '/' + photo_lis... | [
"0.5857222",
"0.5832126",
"0.57680213",
"0.57680213",
"0.57429993",
"0.5725197",
"0.5708163",
"0.57065964",
"0.5625281",
"0.5625036",
"0.5621467",
"0.56018335",
"0.5576259",
"0.55660236",
"0.55596876",
"0.5559516",
"0.55460376",
"0.55166197",
"0.5509907",
"0.55044717",
"0.550... | 0.67701143 | 0 |
Filter the ruptures stored in the dictionary num_occ_by_rup and yield pairs (rupture, ) | def _build_eb_ruptures(
src, num_occ_by_rup, cmaker, s_sites, random_seed, rup_mon):
for rup in sorted(num_occ_by_rup, key=operator.attrgetter('rup_no')):
rup.serial = rup.seed - random_seed + 1
with rup_mon:
try:
rup.sctx, rup.dctx = cmaker.make_contexts(s_sites,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pos_redun_gen(infr):\n infr.print('===========================', color='white')\n infr.print('--- POSITIVE REDUN LOOP ---', color='white')\n # FIXME: should prioritize inconsistentices first\n count = -1\n\n def thread_gen():\n # This is probably not safe\n ... | [
"0.5380859",
"0.5292106",
"0.5125889",
"0.51045907",
"0.49988607",
"0.49800715",
"0.49545532",
"0.49274892",
"0.4879297",
"0.48319057",
"0.47826773",
"0.47735626",
"0.4770856",
"0.47239774",
"0.47063857",
"0.46901873",
"0.4673525",
"0.46630976",
"0.4650474",
"0.4640504",
"0.4... | 0.5293731 | 1 |
Generate a random prime number to be used as module number (p) for DiffieHellman | def generate_prime_module() -> int:
p = generate_random_prime()
print('[CLIENT LOG] generate prime module (p) with the value equal {}'.format(p))
return p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mersenne(p):\n return 2 ** p -1",
"def Pollard_pm1(n, primes, max_B=1000000):\n B = 10\n g = 1\n while B < max_B and g < n:\n a = randint(2, n - 2)\n g = gcd(a, n)\n if g != 1:\n return g\n for p in primes:\n if p >= B:\n break\n ... | [
"0.7612918",
"0.7267547",
"0.7126842",
"0.7050788",
"0.70168465",
"0.6997576",
"0.68809587",
"0.6839765",
"0.68207264",
"0.68041044",
"0.66929156",
"0.66666484",
"0.6654066",
"0.6632159",
"0.66071904",
"0.65769213",
"0.6569943",
"0.6557363",
"0.6512578",
"0.6470537",
"0.64622... | 0.862511 | 0 |
Convert a postgresql table to a python dictionary. The table must contain two columns column 1 contains the keys, and column 2 contains values | def PostgresTableToDict(sqldef, conn):
df = pd.read_sql(sqldef, con=conn)
return dict(zip(df.iloc[:, 0], df.iloc[:, 1])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_to_dict(self, tab):\n dict = {}\n for colname in tab.colnames:\n dict[colname] = tab[colname].data\n return dict",
"def as_dict(self):\r\n values = {}\r\n for name, col in self._columns.items():\r\n values[name] = col.to_database(getattr(self, na... | [
"0.7495272",
"0.7106396",
"0.7009131",
"0.6831916",
"0.67084783",
"0.670363",
"0.670363",
"0.6694122",
"0.66682655",
"0.66331893",
"0.66331893",
"0.66331893",
"0.6616152",
"0.6590558",
"0.6589925",
"0.65601224",
"0.6531183",
"0.6525667",
"0.65016985",
"0.6495068",
"0.6482672"... | 0.86289155 | 0 |
Calculate a new field based on weights given to existing fields | def WeightedSum(inputgeodf, suitfields, weightdf, newsuitfield, dropweightsuits=False):
inputgeodf[newsuitfield] = 0
for field in suitfields:
inputgeodf[newsuitfield] = weightdf['weight'].loc[field.split('_')[0]] * inputgeodf[field] + inputgeodf[newsuitfield]
if dropweightsuits == 1:
inputge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_field_weights(self):\n weights = {}\n for field_name, field in self.fields.items():\n if field.boost:\n weights[field_name] = field.boost\n return weights",
"def weight(self):",
"def getWeight(self) -> float:\n ...",
"def weighting_calculation(sel... | [
"0.6513067",
"0.63443923",
"0.6237842",
"0.61891294",
"0.61255574",
"0.61182654",
"0.60969937",
"0.60597944",
"0.6058004",
"0.603891",
"0.60238034",
"0.59462845",
"0.59314764",
"0.59242976",
"0.5901582",
"0.5888691",
"0.5857859",
"0.58397573",
"0.5791124",
"0.57622707",
"0.57... | 0.6608534 | 0 |
Erase erasegeodf from inputgeodf | def Erase(inputgeodf, erasegeodf):
return gpd.overlay(inputgeodf, gpd.GeoDataFrame({'geometry': erasegeodf.unary_union}), how='difference') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def erase(self):\n pass",
"def erase(self):\r\n self.in_arrow = None\r\n self.out_arrow = None",
"def actionEraseCheck(self):\n sys.stderr.write(\"Erase Check by file ...\\n\")\n sys.stderr.flush()\n if self.data is not None:\n self.programData(self.data, se... | [
"0.5864509",
"0.5602123",
"0.56011736",
"0.55382043",
"0.5428438",
"0.5407708",
"0.5406077",
"0.5384954",
"0.53346765",
"0.52690554",
"0.5186241",
"0.5175114",
"0.51733166",
"0.5170778",
"0.5166687",
"0.5118169",
"0.5118169",
"0.51124847",
"0.5078785",
"0.5074214",
"0.5074214... | 0.7956874 | 0 |
Reclassify raster array by predefined dataframe with related pairs of original and transformed values | def ReclassifyRasterArray(inputarray, reclassdf):
arrshape = inputarray.shape
arrdf = pd.DataFrame(inputarray.reshape(-1), columns=['class'])
reclassdf['class'] = reclassdf['class'].astype(int)
arrsuitjoin = arrdf.join(reclassdf.set_index('class'), on='class', how='left')
return np.array(arrsuitjoin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _apply_transform(self, img: np.ndarray): \n img = self.transform(image=img)[\"image\"]\n return img",
"def _apply_transform(self, img: np.ndarray): \n img = self.transform(image=img)[\"image\"]\n return img",
"def reclassify(\n self, reclass_table: pd.DataFrame, method: s... | [
"0.59887457",
"0.59887457",
"0.5891267",
"0.58596796",
"0.58246267",
"0.5792886",
"0.57720214",
"0.5716713",
"0.55298907",
"0.55264217",
"0.5509864",
"0.54815197",
"0.54692835",
"0.54654515",
"0.5463329",
"0.54365665",
"0.543177",
"0.54298276",
"0.54296744",
"0.54296744",
"0.... | 0.60824215 | 0 |
Calculate nearest neighbor distance to cells of a specific value in PostGIS raster | def ToRasterDistance(inputgeodf, rastername, rasterconn, value, method):
raster_data = PostgresRasterToArray(rastername, rasterconn)
raster_tree = spatial.cKDTree(np.argwhere(raster_data[0] == value))
input_rowcol = np.column_stack((np.round((raster_data[1][5] - inputgeodf.centroid.y)/raster_data[1][0]).val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighb_dist(self, i, ci):\n ri = self.xyz[i]\n j = self.conn[i][ci]\n rj = self.xyz[j].copy()\n if self.periodic:\n if self.use_pconn:\n img = self.pconn[i][ci]\n rj += np.dot(img, self.cell)\n else:\n all_rj = r... | [
"0.6448659",
"0.62662953",
"0.6228066",
"0.61058956",
"0.60530937",
"0.60491186",
"0.5961757",
"0.5959993",
"0.5894973",
"0.5889197",
"0.5887841",
"0.5881528",
"0.5871754",
"0.58700323",
"0.5869459",
"0.58603936",
"0.58264804",
"0.578269",
"0.57672113",
"0.57637554",
"0.57634... | 0.7742841 | 0 |
raster data in PostgreSQL database to numpy array | def PostgresRasterToArray(rastername, rasterconn, nodata=None):
rasterconn = rasterconn + " table=\'" + rastername + "\'"
raster = gdal.Open(rasterconn)
rasterband = raster.GetRasterBand(1)
rastertrans = raster.GetGeoTransform()
rasterarr = rasterband.ReadAsArray()
if nodata is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raster_to_array(input_raster):\n\n raster = gdal.Open(input_raster)\n band = raster.GetRasterBand(1)\n converted_array = band.ReadAsArray()\n\n return converted_array",
"def readArray(input):\n data = gdal.Open(input)\n band = data.GetRasterBand(1)\n \n return band.ReadAsArray()",
"... | [
"0.65399843",
"0.6423413",
"0.6155082",
"0.60712445",
"0.59909385",
"0.5944703",
"0.59434646",
"0.5892678",
"0.58757395",
"0.5872764",
"0.5865737",
"0.5832685",
"0.5817869",
"0.5812894",
"0.58102506",
"0.5804429",
"0.57821363",
"0.57438564",
"0.57320356",
"0.569899",
"0.56827... | 0.76905817 | 0 |
Transform original scale to 1 to 9 by using gamma distribution. Maximum Likelihood Estimation is used first to estimate the parameters for the distribution, then the estimated cdf transform the original field to 1 to 9. | def RescaleByGammaDistribution(inputgeodf, inputfield, newfield, newscale=9):
df = inputgeodf[~np.isnan(inputgeodf[inputfield])]
a, loc, b = gamma.fit(df[inputfield], floc=0)
inputgeodf[newfield] = 1
inputgeodf.loc[~np.isnan(inputgeodf[inputfield]), newfield] = gamma.cdf(df[inputfield], a, loc=0, scale=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_gamma(self):\n result = self.result\n # scaler = preprocessing.StandardScaler()\n # train_minmax = scaler.fit_transform(result)\n # st_rho, st_delta = train_minmax[:, 0], train_minmax[:, 1]\n # self.gamma = (st_delta + st_rho) / 2\n self.gamma = result[:, 0] ... | [
"0.648164",
"0.63862956",
"0.63162005",
"0.6316168",
"0.6284937",
"0.6212734",
"0.61635804",
"0.6148004",
"0.61308765",
"0.60983574",
"0.6055973",
"0.60478526",
"0.6047521",
"0.59976554",
"0.5965367",
"0.5925554",
"0.59061134",
"0.5874108",
"0.5852118",
"0.581981",
"0.5810224... | 0.7616165 | 0 |
Return left most child of node | def left_most_child(n):
if n == None:
return None
while n.left:
n = n.left
return n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_leftmost_child(self):\n\t\tif self.left_child == None:\n\t\t\treturn self\n\t\telse:\n\t\t\treturn self.left_child.get_leftmost_child()",
"def left_child(self, position):\n child = 2 * position + 1\n if child > len(self.table) - 1:\n return None\n return child",
"def lef... | [
"0.8373466",
"0.8092487",
"0.7894623",
"0.78901035",
"0.78861636",
"0.7878979",
"0.77989924",
"0.77989924",
"0.77493393",
"0.7655658",
"0.7477981",
"0.74518734",
"0.73323846",
"0.7313927",
"0.7293937",
"0.72797036",
"0.72629493",
"0.7237921",
"0.722071",
"0.72177696",
"0.7172... | 0.81857544 | 1 |
Move this piece to the given square on the board. | def move_to(self, board, new_square):
current_square = board.find_piece(self)
board.move_piece(current_square, new_square)
self.moved = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_piece(self, from_square, to_square):\n moving_piece = self.get_piece(from_square)\n if moving_piece is not None and moving_piece.player == self.current_player:\n if isinstance(moving_piece, Pawn) & (to_square.row == 0 or to_square.row == 7):\n moving_piece = Queen(s... | [
"0.8212417",
"0.8080082",
"0.7798256",
"0.7666474",
"0.7666474",
"0.7393044",
"0.7332741",
"0.72585386",
"0.7180524",
"0.7180243",
"0.71667033",
"0.7114519",
"0.7109723",
"0.71014935",
"0.70673054",
"0.7032988",
"0.69781625",
"0.69111276",
"0.69016314",
"0.6882075",
"0.686817... | 0.8315273 | 0 |
Test case for get_rates_get Bel VEB exchange rates client | async def test_get_rates_get(client):
params = [('exchangeType', 'exchange_type_example')]
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer special-key',
}
response = await client.request(
method='GET',
path='/public/exchange/1/getRates',
header... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rates_api():\n return get_api_client(cloudsmith_api.RatesApi)",
"def test_get_usd_rates_succeeds(self, mock):\n\n mock.get(self.fixer_endpoint, status_code=200, text=fixture_get_usd_rates_succeeds)\n\n base = 'USD'\n r = self.simulate_get('/api/v1/rates', params={'symbol': base})\... | [
"0.6848447",
"0.6804773",
"0.68021756",
"0.6770227",
"0.6768894",
"0.66975737",
"0.669059",
"0.6670545",
"0.66483796",
"0.6601456",
"0.655258",
"0.65486044",
"0.65401775",
"0.64725304",
"0.64705306",
"0.6412054",
"0.6385457",
"0.6335184",
"0.63079053",
"0.62844616",
"0.627734... | 0.76607555 | 0 |
returns string of 'mean [IQR 25,75], n=_' when given a dataframe.describe() result for nonnormal dist data | def iqr_string(summary):
output = "".join(['%.1f' % summary['mean'], " [IQR ", '%.1f, ' % summary['25%'], '%.1f]' % summary['75%']])
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tran_describe(df):\n return df.describe()",
"def describe_quant(df):\n\n df.describe()",
"def descriptive_statistics(relfreqs): \n means = np.mean(relfreqs, axis=\"columns\")\n stdevs = np.std(relfreqs, axis=\"columns\")\n return means, stdevs",
"def summarize(self):\n return self.d... | [
"0.6620692",
"0.62189144",
"0.6069909",
"0.604985",
"0.5924653",
"0.590731",
"0.5874049",
"0.5863154",
"0.5819489",
"0.5809365",
"0.57765424",
"0.5743814",
"0.5719857",
"0.57178605",
"0.56956404",
"0.56935906",
"0.567541",
"0.56553066",
"0.5649289",
"0.56152576",
"0.56057256"... | 0.6333511 | 1 |
returns string of 'mean +/ std, n=_' when given a dataframe.describe() result for normal dist data | def std_string(summary):
output = "".join(['%.1f' % summary['mean'], " (+/- ", '%.1f)' % summary['std']])
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tran_describe(df):\n return df.describe()",
"def descriptive_statistics(relfreqs): \n means = np.mean(relfreqs, axis=\"columns\")\n stdevs = np.std(relfreqs, axis=\"columns\")\n return means, stdevs",
"def __repr__(self):\n\n return f\"mean is {self.mu} and std is {self.sigma}\"",
"def... | [
"0.672439",
"0.6630897",
"0.6395414",
"0.61711174",
"0.61472607",
"0.6136071",
"0.61173177",
"0.6070295",
"0.60656965",
"0.6004432",
"0.6002653",
"0.5991689",
"0.5985926",
"0.59805095",
"0.59674376",
"0.59546494",
"0.59539324",
"0.5946127",
"0.59310824",
"0.59193796",
"0.5915... | 0.69957507 | 0 |
returns string of the counts of each from a dataframe.value_counts() result and num_patients, which is the total number of patients (not observations, e.g. in the case of patients with multiple comorbidities, so that percentages of the patients can be calculated | def count_string(counts_series, num_patients):
output = ""
for label in counts_series.keys():
output += label + " = %.0f" % counts_series[label]
percent = (counts_series[label] / num_patients) * 100
output += ' (%.1f%%)\n' % percent
return output[:-1] # take off the final \n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obj_value_counts(df):\n df_obj = obj_df(df)\n for col in df_obj.columns:\n print(df_obj[col].value_counts())\n print('-'*100)",
"def user_gender_statistics(df):\n print('Count of gender \\n')\n gender_counts=df['Gender'].value_counts()\n #loop through to print the total number of... | [
"0.6543434",
"0.6515999",
"0.64752",
"0.6379524",
"0.62563115",
"0.6223819",
"0.615157",
"0.6147635",
"0.6146627",
"0.6115137",
"0.6088991",
"0.59538245",
"0.58921516",
"0.58228666",
"0.58000755",
"0.5784507",
"0.57463837",
"0.5742431",
"0.5740331",
"0.5702546",
"0.5685382",
... | 0.73096126 | 0 |
returns an string with the number and percentage of an individuals value | def count_string_indiv(num, num_patients):
output = "%.0f/" % num
output += str(num_patients)
if num_patients is not 0:
percentage = (num / num_patients) * 100
else:
percentage = 0.0
output += ' (%.1f%%)' % percentage
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_text(self):\n # If percentage is zero, round it\n if self.percentage == 0:\n self.percentage = str(\"< 0.01\")\n text = str(self.percentage) + \"% in \" + self.name\n return text",
"def as_counts_and_pcts(self):\n if self.e_pct is None:\n self.calc... | [
"0.68952715",
"0.677492",
"0.67336506",
"0.6733017",
"0.6723874",
"0.67028797",
"0.66558856",
"0.6642059",
"0.6642059",
"0.66164213",
"0.6613658",
"0.6605926",
"0.6602674",
"0.65803075",
"0.6567676",
"0.6566814",
"0.6527969",
"0.6500021",
"0.64925605",
"0.6491722",
"0.6490988... | 0.69533706 | 0 |
creates a horizontal count chart with counts of each etiology and a pie chart with the proportion, grouped by percentage of CSA | def etio_by_csa_no_pie(df):
# TODO: see if there's a way to combine this information with Outcome by Etio
sns.set(style="white", palette=sns.color_palette("cubehelix", 6))
f, axes = plt.subplots(4, 1, figsize=(6, 9))#, sharex=True)
sns.despine(top=True, bottom=True)
#f.suptitle("Etiology of Centra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def figure_4(df):\n\n sns.set(style=\"white\", palette=sns.color_palette(\"cubehelix\", 6))\n f, axes = plt.subplots(4, 1, figsize=(6, 9)) # , sharex=True)\n sns.despine(top=True, bottom=True)\n\n # Add collapsed final treatments\n df['FinalTx_coll'] = df.apply(collapse_final_treatment, axis=1)\n\n... | [
"0.71722245",
"0.70193785",
"0.6873334",
"0.6819008",
"0.62060094",
"0.60715383",
"0.60369134",
"0.60352314",
"0.5986715",
"0.59576315",
"0.5942352",
"0.5933475",
"0.5930427",
"0.5906338",
"0.59038734",
"0.5900262",
"0.586156",
"0.58273524",
"0.58267254",
"0.58182234",
"0.580... | 0.7138226 | 1 |
takes the database dataframe as input makes an output excel with integer codes for value (as opposed to the categorical e.g. male = 0, female = 1 writes them to output_loc for the encoded database keys_output_loc for the keys | def coded_output(database_df, output_loc='coded_output.xlsx'):
LE = LabelEncoder()
output_df = pd.DataFrame()
labels_ser = pd.Series()
# ID no coding
output_df["ID"] = database_df["ID"]
labels_ser["ID"] = "no coding"
# Age no coding
output_df["Age"] = database_df['Age']
labels_ser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __encode_ordinal(self):\n for key, value in self.ord_dict.items():\n if key in self.train_df.columns:\n if self.test_df is not None:\n self.test_df[key + str(\"Encoded\")] = self.test_df[key].map(\n value\n )\n ... | [
"0.5771553",
"0.57225823",
"0.5667205",
"0.55657786",
"0.55108476",
"0.550814",
"0.5501008",
"0.5436885",
"0.54038626",
"0.5347558",
"0.53467244",
"0.53453934",
"0.5328092",
"0.5322064",
"0.5313131",
"0.5303114",
"0.5288735",
"0.52876276",
"0.52721316",
"0.5268272",
"0.526689... | 0.7334738 | 0 |
returns 0 if substring is NOT in dz_string returns 1 if substring is in dz_string | def dz_is_in(dz_string, substring):
if substring not in dz_string:
return 0
else:
return 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dzs_are_in(dz_string, substring1, substring2):\n if substring1 not in dz_string:\n return 0\n elif substring2 not in dz_string:\n return 0\n else:\n return 1",
"def is_dz_free(dz_string, substring=\"none\"):\n if substring not in dz_string:\n return 1\n else:\n ... | [
"0.86692977",
"0.7731571",
"0.69824654",
"0.66297793",
"0.6590674",
"0.64455587",
"0.63113713",
"0.62279797",
"0.61997",
"0.6179148",
"0.60839295",
"0.60779804",
"0.6025104",
"0.60018754",
"0.5991313",
"0.59594995",
"0.59213036",
"0.59093255",
"0.5900898",
"0.5889747",
"0.588... | 0.90364426 | 0 |
returns 1 if both substrings are in dz_string otherwise, returns 0 | def dzs_are_in(dz_string, substring1, substring2):
if substring1 not in dz_string:
return 0
elif substring2 not in dz_string:
return 0
else:
return 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dz_is_in(dz_string, substring):\n if substring not in dz_string:\n return 0\n else:\n return 1",
"def is_dz_free(dz_string, substring=\"none\"):\n if substring not in dz_string:\n return 1\n else:\n return 0",
"def issubstring(substring, string):\n return substrin... | [
"0.84548837",
"0.73484313",
"0.6538616",
"0.6401946",
"0.63691497",
"0.63405085",
"0.62892014",
"0.6248691",
"0.6177356",
"0.6077622",
"0.5994419",
"0.5987834",
"0.5985964",
"0.5968658",
"0.5963067",
"0.59495455",
"0.5948855",
"0.5886351",
"0.5886351",
"0.58585316",
"0.585125... | 0.878685 | 0 |
Bar graphs of the final treatment by percentage of CSA | def figure_4(df):
sns.set(style="white", palette=sns.color_palette("cubehelix", 6))
f, axes = plt.subplots(4, 1, figsize=(6, 9)) # , sharex=True)
sns.despine(top=True, bottom=True)
# Add collapsed final treatments
df['FinalTx_coll'] = df.apply(collapse_final_treatment, axis=1)
OSA_pure_hist ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createChart(cladeGroup, data, taxonomyDict, outputFile):\n dfData = []\n for clade in cladeGroup: \n temp, other, totalTemp = valueCountsSpecies(data, cladeGroup[clade], taxonomyDict)\n relativeTemp = {}\n for val in temp:\n relativeTemp[val] = (temp[val] / sum(list(temp.v... | [
"0.6396768",
"0.6395385",
"0.63722056",
"0.63272125",
"0.6322861",
"0.62947714",
"0.6272048",
"0.6228609",
"0.6182101",
"0.60784197",
"0.5998282",
"0.59176755",
"0.5904907",
"0.5898402",
"0.5880167",
"0.58378726",
"0.5816344",
"0.5765695",
"0.5764959",
"0.57556856",
"0.574817... | 0.6674714 | 0 |
bar graphs of etiology (e.g. cardiac, medication) subdivided by the percentage of CSA | def figure_2(df):
sns.set(style="white", palette=sns.color_palette("cubehelix", 6))
f, axes = plt.subplots(4, 1, figsize=(6, 9)) # , sharex=True)
sns.despine(top=True, bottom=True)
# f.suptitle("Etiology of Central Events, Grouped by %Central Events")
OSA_pure_hist = replace_etiology_labels(histo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bar_plot(df_NP):\n cnt = Counter()\n for tax_list in df_NP.taxonomy:\n for tax in list(tax_list):\n if tax != 'no':\n cnt[tax] += 1\n plt.bar(cnt.keys(),cnt.values())\n plt.xlabel('taxonomic provenance')\n plt.ylabel('number of molecules')\n plt.title('number ... | [
"0.67686075",
"0.675965",
"0.6729898",
"0.6626186",
"0.65885913",
"0.6553059",
"0.64030665",
"0.63949084",
"0.6386724",
"0.6310035",
"0.6282645",
"0.6242876",
"0.6224819",
"0.6212611",
"0.6204041",
"0.6180614",
"0.6158213",
"0.61444724",
"0.6139795",
"0.6129396",
"0.61035854"... | 0.67783177 | 0 |
Calculates the number of times a word appears in a document. | def freq(word, document):
return document.split(None).count(word) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_word(doc):\n count = count = 0\n for w in document.split(\" \"):\n count = count + 1\n return count",
"def get_number_of_document_word_occurs_in(self, word):\n return len(self.dictionary[word]['docs'])",
"def tf(word,document):\n words = document.split()\n\n ret... | [
"0.8091619",
"0.79166186",
"0.7747456",
"0.7732046",
"0.7679956",
"0.7612639",
"0.75380975",
"0.7502421",
"0.74149746",
"0.74019074",
"0.73675257",
"0.7365367",
"0.7351513",
"0.7320617",
"0.7295409",
"0.72857875",
"0.72807866",
"0.7273073",
"0.725781",
"0.7254567",
"0.7247593... | 0.8215878 | 0 |
Calculates the word count of a document. | def wordCount(document):
return float(len(document.split(None))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_word(doc):\n count = count = 0\n for w in document.split(\" \"):\n count = count + 1\n return count",
"def word_count(self, doc):\n\n return len(self.tokenize_doc_simple(doc))",
"def get_number_of_words_in_document(self, document):\n for _set in self.sets:\n ... | [
"0.805283",
"0.78732747",
"0.78494245",
"0.7810129",
"0.7652119",
"0.75944453",
"0.75028855",
"0.74753356",
"0.74423164",
"0.7356049",
"0.7345672",
"0.72192264",
"0.71983796",
"0.71837556",
"0.7177229",
"0.71216017",
"0.7110915",
"0.7091096",
"0.7085445",
"0.70556986",
"0.704... | 0.8585397 | 0 |
Calculates the frequency of a word in a document as a percentage of the total words in that document. This is the first step in TFIDF weighting. For example, if a document is 100 words long, and the word cat appears three times, the term frequency of cat will be 0.03. | def tf(word, document):
return freq(word,document) / wordCount(document) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freq(word, document):\n return document.split(None).count(word)",
"def get_tf(term, document):\n\n term_list = [term.lower() for term in document.split()]\n num_of_words_in_doc = len(document.split())\n term_count_in_doc = term_list.count(term)\n\n return term_count_in_doc / num_of_words_in_doc",
"def... | [
"0.79069054",
"0.774951",
"0.7730149",
"0.75939906",
"0.7489032",
"0.74417335",
"0.74153495",
"0.73702574",
"0.73561954",
"0.73248863",
"0.72456247",
"0.7218045",
"0.7198237",
"0.71101296",
"0.7089674",
"0.70846796",
"0.7082109",
"0.70753145",
"0.7060528",
"0.7046255",
"0.704... | 0.8329893 | 0 |
Delete a tagged object. | def delete_object(
self, object_type: ObjectTypes, object_id: int, tag: str
) -> Response:
try:
DeleteTaggedObjectCommand(object_type, object_id, tag).run()
return self.response(200, message="OK")
except TagInvalidError:
return self.response_422()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_object(self, object):\n object.delete()",
"def delete(self, obj):\n raise NotImplementedError",
"def delete(self, obj):",
"def delete(self, obj=None):\n pass",
"def delete_object(self, account, container, object):#opposite to get\n \n pass",
"def delete(self,... | [
"0.77181983",
"0.7680069",
"0.76284474",
"0.76109326",
"0.7435976",
"0.7433658",
"0.74043643",
"0.7332101",
"0.73187125",
"0.7292564",
"0.72542113",
"0.7143436",
"0.7137488",
"0.7068752",
"0.7039705",
"0.7015592",
"0.7007158",
"0.6973526",
"0.6968675",
"0.695395",
"0.69519883... | 0.80941814 | 0 |
Remove the tag from the user favorite list | def remove_favorite(self, pk: int) -> Response:
try:
TagDAO.remove_user_favorite_tag(pk)
return self.response(200, result="OK")
except TagNotFoundError:
return self.response_404()
except MissingUserContextException as ex:
return self.response_422(m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unfavorite(self, item):\n self._createAction(item, \"unfavorite\")",
"def unfavorite(user_id, wine_id):\n\n # favorite = Favorite.query.get(user_id, wine_id)\n favorite = Favorite.query.filter(Favorite.user_id==user_id, Favorite.wine_id==wine_id).delete() \n db.session.commit()",
"def remov... | [
"0.6693976",
"0.64557177",
"0.6386622",
"0.6364562",
"0.63602966",
"0.6325346",
"0.63078",
"0.62976325",
"0.62953806",
"0.6241944",
"0.62155426",
"0.6196011",
"0.6194774",
"0.61871505",
"0.61795324",
"0.6160769",
"0.6156711",
"0.6134003",
"0.60911",
"0.6086167",
"0.6083497",
... | 0.7441977 | 0 |
Send a `message` to `target` from 'tests!tests.t'. | def msg(self, target, message):
self.server.message_queue.put(('tests!tests@tes.t', target, message)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message(self, source, target, message):\n\n if target == self.nick or message.upper().startswith(self.nick.upper()):\n self.log('I was addressed! Source:', source, 'Message:', message)\n if \"test_irc_send\" in message:\n self.log('Testing via irc')\n ... | [
"0.66552365",
"0.66540533",
"0.6652263",
"0.66165113",
"0.65306926",
"0.6215262",
"0.61991566",
"0.6028364",
"0.60081816",
"0.5979775",
"0.5978541",
"0.59354997",
"0.59265625",
"0.59018064",
"0.5847211",
"0.58345044",
"0.58301985",
"0.57965213",
"0.57851046",
"0.5773253",
"0.... | 0.800717 | 0 |
Returns values and positions of absolute maximi for each channel of a multichannel audio chunk. First index of the input matrix should be the position and the second index the channel. If provided, offset is added to the maximum positions. | def hopMax(channels, offset=0) :
abschannels = abs(channels)
return (
abschannels.max(axis=0),
abschannels.argmax(axis=0)+offset,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absmax(self, location = False):\n if not location:\n if self.is_empty():\n return 0\n else:\n return max(tuple(abs(i).max() for i in self.__m__.values()))\n\n mx = None\n block = None\n index = None\n for k,v in self.__m__.i... | [
"0.58532417",
"0.57175016",
"0.56951547",
"0.55223703",
"0.54759985",
"0.5374628",
"0.5370291",
"0.53619397",
"0.5295614",
"0.52903146",
"0.5255626",
"0.5255626",
"0.52415556",
"0.5239608",
"0.52303153",
"0.52303153",
"0.52303153",
"0.52273613",
"0.52211016",
"0.522107",
"0.5... | 0.6386974 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.