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 |
|---|---|---|---|---|---|---|
Trims sample of the video based on provided timestamp. | def trim_sub_sample(file: str,
start_time: str,
end_time: str,
sample_start_time: str,
sample_end_time: str,
timestamp_format: str = '%H:%M:%S') -> str:
trim_duration = calculate_duration(sample_start_time, sampl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim_sample_section(file: str,\r\n sampling_rate: Union[float, int, str]) -> str:\r\n sampling_rate = float(sampling_rate)\r\n temp = temporary_copy(file)\r\n\r\n clip_length = int((duration(file) * sampling_rate * 0.01))\r\n start = random.randint(1, int(duration(file) - clip_length... | [
"0.6254582",
"0.6151421",
"0.5557799",
"0.53147614",
"0.5298579",
"0.5284812",
"0.5268129",
"0.52429914",
"0.5126373",
"0.51176107",
"0.50899065",
"0.5088638",
"0.5041741",
"0.5011227",
"0.5000018",
"0.49756473",
"0.49663383",
"0.4927226",
"0.4915662",
"0.491378",
"0.4906019"... | 0.61838084 | 1 |
Converts permass concentrations to molar elemental ratios. Be careful with units. | def to_molar_ratio(massfrac_numerator, massfrac_denominator, numerator_mass, denominator_mass):
return (massfrac_numerator / numerator_mass) / (massfrac_denominator / denominator_mass) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_mass_fraction(molar_ratio, massfrac_denominator, numerator_mass, denominator_mass):\n return molar_ratio * massfrac_denominator * numerator_mass / denominator_mass",
"def calculate_molar_mass(collector):\n avg_temp = collector.get_average_temperature()\n avg_acceleration = collector.get_a... | [
"0.6570512",
"0.6387427",
"0.6225264",
"0.6197347",
"0.61699295",
"0.61401415",
"0.59813184",
"0.5977784",
"0.5962342",
"0.5911865",
"0.5904414",
"0.5866847",
"0.5850029",
"0.5839683",
"0.5834741",
"0.57970756",
"0.5790854",
"0.57902527",
"0.57459486",
"0.5739973",
"0.5671409... | 0.7075 | 0 |
Converts permass concentrations to molar elemental ratios. Be careful with units. | def to_mass_fraction(molar_ratio, massfrac_denominator, numerator_mass, denominator_mass):
return molar_ratio * massfrac_denominator * numerator_mass / denominator_mass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_molar_ratio(massfrac_numerator, massfrac_denominator, numerator_mass, denominator_mass):\n return (massfrac_numerator / numerator_mass) / (massfrac_denominator / denominator_mass)",
"def calculate_molar_mass(collector):\n avg_temp = collector.get_average_temperature()\n avg_acceleration =... | [
"0.70750344",
"0.63879806",
"0.6224704",
"0.6200152",
"0.6170182",
"0.61407906",
"0.5981897",
"0.5978215",
"0.5962941",
"0.59128755",
"0.5904845",
"0.5865875",
"0.5851286",
"0.5841126",
"0.58343244",
"0.5798284",
"0.5793204",
"0.579121",
"0.5745705",
"0.5740774",
"0.56701314"... | 0.65707004 | 1 |
Decorator to cause accounts types to be registered. | def register(account_type):
def class_rebuilder(cls):
ACCOUNT_TYPES[account_type] = cls
return cls
return class_rebuilder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_type(required_account_type):\n @decorator\n def wrapper(_target, *args, **kwargs):\n #print \"user: %s account: %s required: %s\" % (c.logged_in_persona.username, c.logged_in_persona.account_type, required_account_type)\n if c.logged_in_persona.has_account_required(required_account_... | [
"0.64866626",
"0.593681",
"0.593681",
"0.593681",
"0.593681",
"0.5924995",
"0.59029967",
"0.57714283",
"0.566535",
"0.56409156",
"0.56202453",
"0.5600665",
"0.5598966",
"0.5578374",
"0.5473508",
"0.53761977",
"0.53490406",
"0.53382665",
"0.5309572",
"0.5287466",
"0.5265452",
... | 0.75555587 | 0 |
Step 1; Beginning of oauth account flow. UI will open this page; we create an accounts objects and redirect to appropriate server. We use account id as random string for oauth flow. | def oauth_start_flow():
# Have to do authentication!
rest.default_user_authentication()
account_type = flask.request.args.get('type')
if account_type is None:
flask.abort(400)
cls = ACCOUNT_TYPES.get(account_type, None)
if cls is None:
flask.about(400)
key = str(uuid.uuid4())
instance = cls(i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_oauth_view(request):\n url = get_oauth_url()\n return redirect(url)",
"def login():\n auth_state = str(uuid.uuid4())\n SESSION.auth_state = auth_state\n\n # For this sample, the user selects an account to authenticate. Change\n # this value to 'none' for \"silent SSO\" behavior, and i... | [
"0.62930983",
"0.6078127",
"0.6021608",
"0.6018276",
"0.60160273",
"0.5985778",
"0.5968037",
"0.5957953",
"0.5931979",
"0.5931979",
"0.58930075",
"0.5847592",
"0.57649285",
"0.57595754",
"0.57595444",
"0.5758911",
"0.5733115",
"0.57007194",
"0.57004714",
"0.56916237",
"0.5669... | 0.77316916 | 0 |
If there's an error, the video's state should change to error. | def test_error(self):
with build_video(self.user) as video:
video = self._send(video, None)
eq_(video.state, 'error') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def videostart_failed(self):\n # type: () -> bool\n return self._videostart_failed",
"def test_api_video_update_live_state_invalid_state(self):\n video = factories.VideoFactory(\n id=\"a1a21411-bf2f-4926-b97f-3c48a124d528\",\n upload_state=PENDING,\n live_sta... | [
"0.6850327",
"0.6648256",
"0.6501016",
"0.6486651",
"0.64745677",
"0.6245674",
"0.6153345",
"0.6150683",
"0.6136198",
"0.6088421",
"0.6035782",
"0.60141194",
"0.59987426",
"0.59581625",
"0.59347904",
"0.5892585",
"0.5874808",
"0.586871",
"0.5861455",
"0.5848578",
"0.58309966"... | 0.8121518 | 0 |
A successful upload should mark the video as pending. | def test_success(self):
with build_video(self.user, shortlink='') as video:
eq_(video.shortlink, '')
video = self._send(video, 'asdf')
eq_(video.shortlink, 'asdf')
eq_(video.state, 'pending') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_video(self, video_file):\r\n part = \"snippet,status\"\r\n metadata = self.get_metadata(video_file)\r\n body = {\r\n \"snippet\": {\r\n \"title\": metadata['title'],\r\n \"description\": metadata['description'],\r\n \"tags\": m... | [
"0.6411847",
"0.6389235",
"0.6193352",
"0.6147046",
"0.6135063",
"0.6128116",
"0.6121101",
"0.61047024",
"0.6059915",
"0.60580754",
"0.60440266",
"0.60114586",
"0.60114586",
"0.597828",
"0.5959089",
"0.5924159",
"0.5913069",
"0.5905608",
"0.5900825",
"0.5889539",
"0.58836186"... | 0.7087659 | 0 |
Checks if perimeter has been cropped and calls the Pressure_img function if not. | def ask_perimeter(self):
print("controller - ask_perimeter!")
img_cv2_mask = self.pressure_img.mask
if self.pressure_img.perimetre_done:
self.view.popupmsg("El perímetre ja ha estat seleccionat")
else:
self.pressure_img.roi_crop(img_cv2_mask, "Perimeter") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_crop(self):\n if self.box_drawn == True:\n if (self.cd_pic_num != -1) & (self.cd_crop_num == 1):\n self.communicator.generate_crop(picture_num=self.cd_pic_num, \\\n xa=self.xa, ya=self.ya, xb=self.xb, yb=self.yb)\n else:\n ... | [
"0.59077215",
"0.5777624",
"0.5664135",
"0.55029684",
"0.549613",
"0.5492193",
"0.5465245",
"0.5449832",
"0.54098934",
"0.538821",
"0.53386",
"0.5330267",
"0.52779585",
"0.5244926",
"0.52412415",
"0.52412415",
"0.52167773",
"0.5201059",
"0.5196827",
"0.51848155",
"0.51782674"... | 0.71450925 | 0 |
Calls the View function to ask user confirmation about a image's roi. | def ask_roi_confirmation(self, img_cv2_mask, img_cv2_roi, tissue, scale_factor, ring):
print("controller - ask_roi_confirmation!")
self.pressure_img.close_all()
#try:
self.view.processing_gui.ask_roi_confirmation(img_cv2_mask, img_cv2_roi, tissue, scale_factor, ring)
#except:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_ROI(self):\n self.dialog.show()",
"def roi_confirmated(self, img_cv2_roi, tissue, ring):\n print(\"controller - roi_confirmated!\")\n #self.view.processing_gui.updateLabelGUI(self.pressure_img.mask)\n if(ring == 0):\n #Zona tancada\n self.view.processi... | [
"0.70574677",
"0.6576104",
"0.60032237",
"0.59183544",
"0.55503994",
"0.5404039",
"0.5364119",
"0.535209",
"0.53482574",
"0.52915484",
"0.52847826",
"0.523859",
"0.5238487",
"0.51996696",
"0.51756555",
"0.5173748",
"0.51667273",
"0.51611865",
"0.515586",
"0.5125555",
"0.51220... | 0.7337351 | 0 |
Updates the Pressure_img mask image Calls the Pressure_img function to allow the user to select the granulation roi. | def roi_granulation(self):
print("controller - roi_granulation!")
self.view.processing_gui.ask_zone_type("Granulation") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roi_ko(self):\n self.pressure_img.mask = self.pressure_img.previous_roi",
"def roi_confirmated(self, img_cv2_roi, tissue, ring):\n print(\"controller - roi_confirmated!\")\n #self.view.processing_gui.updateLabelGUI(self.pressure_img.mask)\n if(ring == 0):\n #Zona tancad... | [
"0.6317587",
"0.6000016",
"0.57783824",
"0.5777991",
"0.57711995",
"0.5617572",
"0.5591309",
"0.5567481",
"0.55403477",
"0.55359846",
"0.5511945",
"0.54685134",
"0.5459414",
"0.5456648",
"0.5431762",
"0.54131716",
"0.54126906",
"0.54013383",
"0.5394527",
"0.53525496",
"0.5320... | 0.6256246 | 1 |
Updates the Pressure_img mask image Calls the Pressure_img function to allow the user to select the slough roi. | def roi_slough(self):
print("controller - roi_slough!")
self.view.processing_gui.ask_zone_type("Slough") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roi_ko(self):\n self.pressure_img.mask = self.pressure_img.previous_roi",
"def select_rois(img):\n # mouse callback function\n def draw_rect_roi(event, x, y, flags, param):\n # grab references to the global variables\n global rect_bbox, rect_endpoint_tmp, drawing\n \n ... | [
"0.6494786",
"0.6200216",
"0.59670705",
"0.5965427",
"0.59423405",
"0.5937729",
"0.5737662",
"0.5628978",
"0.5572147",
"0.5549276",
"0.55204433",
"0.55133724",
"0.54876465",
"0.5473547",
"0.5455478",
"0.54485846",
"0.5395004",
"0.537549",
"0.535571",
"0.5346196",
"0.53438634"... | 0.64491475 | 1 |
Updates the View of perimeter label. | def update_perimeter_count(self):
print("controller - update_perimeter_count!")
self.view.processing_gui.update_perimeter_count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perimeter(self):",
"def perimeter(self):\n\t\treturn self.height * 4",
"def perimeter(self):\r\n return (2*self.width) + (2*self.height)",
"def perimeter(self):\n return 2 * (self.height + self.width)",
"def perimeter(self):\n return self.sidelength1 + self.sidelength2 + self.baselengt... | [
"0.6562732",
"0.5983641",
"0.5811004",
"0.5740546",
"0.57372487",
"0.56979233",
"0.5674618",
"0.5625266",
"0.5573195",
"0.55355376",
"0.5426588",
"0.54047966",
"0.5268101",
"0.5234699",
"0.52308786",
"0.52281636",
"0.5173433",
"0.51504153",
"0.5146223",
"0.5136679",
"0.510507... | 0.7330417 | 0 |
Updates the View of necrosis's label with the number of roi's already selected. | def update_necrosis_count(self, number):
print("controller - update_necrosis_count!")
self.view.processing_gui.update_necrosis_count(number) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_count(self, model, view):\r\n view.SetLabel(str(len(model)))",
"def UpdateLabel(self) -> _n_6_t_0:",
"def on_change(self, attr, old, new):\n n = self.labels.index(new) + 1 # Select 0-indexed\n self.notify(set_figures(n))",
"def add_rois_of_selected(self):\r\n \r\n ... | [
"0.6313287",
"0.60930824",
"0.5740461",
"0.56573534",
"0.56184924",
"0.5597885",
"0.55671257",
"0.55533975",
"0.5529179",
"0.552418",
"0.55067056",
"0.548959",
"0.54870605",
"0.5442299",
"0.5416914",
"0.5410583",
"0.5399066",
"0.539881",
"0.5396154",
"0.5348075",
"0.534378",
... | 0.6362857 | 0 |
Updates the View of slough's label with the number of roi's already selected. | def update_slough_count(self, number):
print("controller - update_slough_count!")
self.view.processing_gui.update_slough_count(number) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_count(self, model, view):\r\n view.SetLabel(str(len(model)))",
"def UpdateLabel(self) -> _n_6_t_0:",
"def on_change(self, attr, old, new):\n n = self.labels.index(new) + 1 # Select 0-indexed\n self.notify(set_figures(n))",
"def _update_moved(self):\n self._RAS_textbox.... | [
"0.6317862",
"0.5995547",
"0.59830886",
"0.5859805",
"0.5648021",
"0.5629299",
"0.5573244",
"0.5515612",
"0.54684705",
"0.5434191",
"0.5426762",
"0.5373202",
"0.5369618",
"0.53585535",
"0.532692",
"0.53242594",
"0.5314334",
"0.53061146",
"0.5304349",
"0.5285585",
"0.5261471",... | 0.6371451 | 0 |
The selection event of the listView, returns a key of the clicked event. You can retrieve the item rapidly | def list_view_on_selected(self, widget, selected_item_key):
self.lbl.set_text('List selection: ' + self.listView.children[selected_item_key].get_text()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getItemAtClick(self, event):\n pos = event.pos()\n obj = self.itemAt(pos)\n return obj",
"def getItemAtClick(self, event):\n pos = event.pos()\n obj = self.itemAt(pos)\n return obj",
"def get_selected(self):\n\n # if there are items in the list\n if s... | [
"0.6607023",
"0.6607023",
"0.652857",
"0.6433958",
"0.63030964",
"0.6219612",
"0.6185426",
"0.6173829",
"0.61479783",
"0.61361617",
"0.6107332",
"0.60872215",
"0.6082524",
"0.6076021",
"0.60734886",
"0.6067992",
"0.6049827",
"0.6033601",
"0.60326743",
"0.60219294",
"0.6016022... | 0.67299557 | 0 |
Overloading App.on_close event to stop the Timer. | def on_close(self):
self.stop_flag = True
super(MyApp, self).on_close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closeEvent(self, event):\n self.is_active = False\n app._in_event_loop = False\n super()",
"def close(self):\n if self._timer is not None:\n self._timer.cancel()\n self._timer = None",
"def closeEvent(self, event):\r\n self.app.stop()\r\n even... | [
"0.74909806",
"0.7348616",
"0.70537823",
"0.69772965",
"0.6918064",
"0.68710506",
"0.6840016",
"0.6794492",
"0.6722776",
"0.6722776",
"0.6617191",
"0.65869474",
"0.65790683",
"0.6563779",
"0.65539956",
"0.65417385",
"0.65401816",
"0.6536845",
"0.64983386",
"0.64668995",
"0.64... | 0.7523976 | 0 |
remove a domain block | def delete(self, request, domain_id):
domain = get_object_or_404(models.IPBlocklist, id=domain_id)
domain.delete()
return redirect("settings-ip-blocks") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_block(self, block):\n raise NotImplementedError()",
"async def setjrremove(self, ctx, domain):\n allowedDomains = await self.config.guild(ctx.guild).allowedDomains()\n \n try:\n allowedDomains.remove(domain)\n except:\n await ctx.send(\"Somethin... | [
"0.6359438",
"0.6147736",
"0.61247057",
"0.6054354",
"0.60280436",
"0.60078883",
"0.598406",
"0.5948759",
"0.5926825",
"0.59146273",
"0.58885175",
"0.5874299",
"0.58524954",
"0.5817104",
"0.5711738",
"0.57082176",
"0.56653637",
"0.5606764",
"0.5604172",
"0.5581459",
"0.553306... | 0.63509643 | 1 |
Mutates a point_to_tract_mapping (mapping) with the tractids | def form_point_to_tract_mapping(voter, mapping, geoid_to_id_mapping: GeoIDToIDMapping):
# voter.name refers to the point ID
mapping[voter.name] = geoid_to_id_mapping[voter["GEOID"]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tract_dict(\n state_code: str, state_name: str, num_districts: int, sample_richness: int\n) -> TractDict:\n\n # First generate the tract dictionary with spatial diversity data\n # but without the VRP information\n tract_dict, geoid_to_id_mapping = sd_utils.get_all_tract_geoids(state_code)\n ... | [
"0.57381487",
"0.5064897",
"0.5047353",
"0.49305636",
"0.49061775",
"0.47935897",
"0.4788964",
"0.47624108",
"0.47538432",
"0.47472757",
"0.47433028",
"0.47236985",
"0.46938264",
"0.46630144",
"0.46513113",
"0.46393666",
"0.46393234",
"0.46272546",
"0.46198624",
"0.46148434",
... | 0.70692253 | 0 |
Creates a TractDict. This function is meant to replace generate_tracts_with_vrps. | def create_tract_dict(
state_code: str, state_name: str, num_districts: int, sample_richness: int
) -> TractDict:
# First generate the tract dictionary with spatial diversity data
# but without the VRP information
tract_dict, geoid_to_id_mapping = sd_utils.get_all_tract_geoids(state_code)
tract_dic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tract_and_patch(self):\n return {'tract': self.tract, 'patch': self.patch}",
"def make_dicts(self):\n self._dicts = [tree.to_dict() for tree in self.reaction_trees]\n self._update_route_dict(self._dicts, \"dict\")",
"def create_trip_entities_dict(trip_entities):\n\n trip_entities = ... | [
"0.56971306",
"0.5689369",
"0.5653",
"0.5594163",
"0.55410594",
"0.5534308",
"0.53802884",
"0.5362124",
"0.5362049",
"0.53505194",
"0.5299998",
"0.5288673",
"0.52820265",
"0.52705413",
"0.5270055",
"0.5264597",
"0.5264597",
"0.52621305",
"0.525155",
"0.52464527",
"0.5236678",... | 0.721766 | 0 |
gets mean x and y coords of nose points | def get_nose(self):
face = self.detector(self.img)[0]
landmarks = self.landmark_predictor(image=self.img, box=face)
nose_coords = [(landmarks.part(n).x, landmarks.part(n).y) for n in range(self.nose_start, self.nose_end+1)]
return np.mean([coord[0] for coord in nose_coords]), np.mean([... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mean_coord(self):\n # load dataset in a dummy manner\n dataset = torchvision.datasets.MNIST('../../data/MNIST_data/', train=True, download=False)\n mean = (dataset.data.float().mean(0) / 255).unsqueeze(0) # [1,28,28]\n return mean",
"def mean_average_position():\n pass",
... | [
"0.7053279",
"0.6812186",
"0.6778993",
"0.67765117",
"0.6738566",
"0.66707665",
"0.6621994",
"0.6574459",
"0.6566059",
"0.656135",
"0.64890003",
"0.6394404",
"0.63685876",
"0.636848",
"0.6341445",
"0.6322579",
"0.6279607",
"0.6245893",
"0.62065923",
"0.61990976",
"0.6187433",... | 0.73176885 | 0 |
MIDI Manufacturer's Association Manufacturer code. | def manufacturer(self) -> int:
return self.__manufacturer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _manufacturer(self, mac_address):\n # Initialize key variables\n manufacturer = ''\n\n # Process data\n mac_oui = mac_address[0:6]\n if mac_oui in self.oui:\n manufacturer = self.oui[mac_oui]\n\n # Return\n return manufacturer",
"def get_manufacture... | [
"0.7039295",
"0.6281218",
"0.6247883",
"0.61845714",
"0.61188304",
"0.61003816",
"0.60814244",
"0.60315275",
"0.58468425",
"0.57476723",
"0.5479505",
"0.5350545",
"0.534351",
"0.5192532",
"0.51850796",
"0.5102366",
"0.5096284",
"0.50186163",
"0.5003242",
"0.4973625",
"0.49520... | 0.6453868 | 1 |
Number of sample loops. | def number_of_sample_loops(self) -> int:
return self.__number_of_sample_loops | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_count(self):",
"def _number_of_samples(self):\n return len(self._raw_data.samples)",
"def number_of_iterations(self) -> int:\n pass",
"def num_trials(self):",
"def getNrSamples(self): \r\n return self.numSamples",
"def sample_count(self):\n assert len(self.decay_... | [
"0.77285004",
"0.73062783",
"0.7268869",
"0.7204515",
"0.7139536",
"0.71121275",
"0.6947088",
"0.688138",
"0.688138",
"0.6845794",
"0.6778513",
"0.66946554",
"0.66409796",
"0.6606833",
"0.65847504",
"0.6580523",
"0.6520154",
"0.6514653",
"0.6495271",
"0.64637583",
"0.64366883... | 0.8805137 | 0 |
Unique ID that corresponds to one of the defined cue points. | def first_cue_point_id(self) -> int:
return self.__first_cue_point_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getId(self):\n return _libsbml.Point_getId(self)",
"def getID():",
"def isSetId(self):\n return _libsbml.Point_isSetId(self)",
"def unique_id(self):\n return '{}-{}-{}'.format(self.airly.latitude, self.airly.longitude,\n self.type)",
"def access_poin... | [
"0.5839297",
"0.5805237",
"0.5759867",
"0.5608562",
"0.56079704",
"0.55911225",
"0.556848",
"0.5514932",
"0.5496133",
"0.54830205",
"0.54366374",
"0.5428988",
"0.5382813",
"0.5362727",
"0.5337666",
"0.5337666",
"0.5292135",
"0.52660453",
"0.526209",
"0.52404964",
"0.52404964"... | 0.7408783 | 0 |
Fraction of a sample at which to loop. | def first_loop_fraction(self) -> int:
return self.__first_loop_fraction | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def samp_frac(self):\n return self._samp_frac",
"def sample_interval(self):\n\n if self.sample_rate != 0:\n return 1.0 / self.sample_rate\n return 0.0",
"def sampling_ratio(self):\n return self.coincidences / self.n",
"def sample(self, my_sample):\n with self... | [
"0.6541615",
"0.63065964",
"0.6200258",
"0.6049395",
"0.60246664",
"0.5968896",
"0.59467435",
"0.5922556",
"0.5913564",
"0.59098226",
"0.5898032",
"0.5800631",
"0.57934856",
"0.57577497",
"0.57469136",
"0.5729358",
"0.57202506",
"0.5714236",
"0.5710693",
"0.5709957",
"0.56999... | 0.6381295 | 1 |
Number of times to play the loop. | def first_loop_play_count(self) -> int:
return self.__first_loop_play_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_sample_loops(self) -> int:\n return self.__number_of_sample_loops",
"def _get_repeat_times(self):\n # The passed arg on_repeat is used to check that.\n\n # The arg passes 1 in case the --repeat flag is not passed\n # which means we simply need to loop for once.\n\n ... | [
"0.7073815",
"0.6966447",
"0.689869",
"0.6741683",
"0.6648914",
"0.6567338",
"0.6561674",
"0.6554293",
"0.6351848",
"0.632595",
"0.6323625",
"0.6312584",
"0.63071966",
"0.62850726",
"0.62801373",
"0.62801373",
"0.6268525",
"0.6232783",
"0.6212921",
"0.61603415",
"0.6130002",
... | 0.71601063 | 0 |
This method poses random questions and answers according to given specificity sector. The input where the qas are drawn from is the previously generated 'qa_plan', the output of the 'fit_user_qa_plan()' method. The returned value of this method is a dataframe, which can be | def pose_qa(self, specificity_sector=0, n_qas=4, n_diff_sectors=3,
n_incorrect = 3, plan_file=None, save_posed=True):
def test_ans_length(ans, indexes):
la = len(ans)
if la > indexes.max():
return np.array(ans)[indexes]
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quick_quiz(character_set):",
"def CosmosQADataset(cosmos_qa_type):\n assert(isinstance(cosmos_qa_type, CosmosQAType))\n download_dataset(Collection.COSMOS_QA, check_shallow_integrity)\n\n def extract_answers(entry):\n for i in range(0, 4):\n key = \"answer{}\".format(i)\n ... | [
"0.5895356",
"0.5623797",
"0.5359407",
"0.53172994",
"0.5279164",
"0.5250498",
"0.52369994",
"0.52043676",
"0.51952434",
"0.51847357",
"0.51839304",
"0.51815075",
"0.5181405",
"0.517284",
"0.51394653",
"0.51062614",
"0.51045674",
"0.50932574",
"0.5072808",
"0.5072549",
"0.503... | 0.7371346 | 0 |
Avoid ELSE blocks after FOR and WHILE loops | def item5():
for i in range(3):
print('Loop %d' % i)
else:
print('Else block!')
for i in range(3):
print('Loop2 %d' % i)
if i == 1:
break
else:
print('Else2 block!')
for x in []:
print('Never runs')
else:
print('Else3 block!')... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _do_iteration(self):\n return True",
"def check_all():\r\n i = 100000\r\n while i <= 999996:\r\n if check(i):\r\n print(i)\r\n i = i + 1",
"def main():\n for i in range(5):\n check_row()\n put_beeeper_if_not()\n go_next_row()",
"def _While(self, ... | [
"0.6228759",
"0.58655894",
"0.5738613",
"0.56981057",
"0.5669924",
"0.5666032",
"0.56203306",
"0.5455191",
"0.5447608",
"0.5388828",
"0.535743",
"0.53433776",
"0.53137475",
"0.5310617",
"0.5303306",
"0.5303306",
"0.52976257",
"0.5291997",
"0.5275105",
"0.527306",
"0.527118",
... | 0.685508 | 0 |
If newmode is passed, then uses that. Otherwise, figure out the mode from the text in the dictionary. | def setMode(self, newmode=None):
if newmode==None and self.mode: return
# find it in my dictionary
for k,v in self.items():
if k.lower() == "mode":
if newmode:
self.mode = newmode
self[k] = str(self.mode)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _change_mode(self, new_mode: MODES):\n # Deactivate old mode_handler:\n self.mode_handler.deactivate()\n self.mode_handler = self.MODE_HANDLER[new_mode](self)\n self._set_tooltip(new_mode)",
"def set_mode(self, new_mode):\n\n\t\tself._log.info('Mode changed to: %s' % new_mode.name... | [
"0.6759037",
"0.6211309",
"0.5947452",
"0.58121467",
"0.58069605",
"0.57656926",
"0.5718",
"0.5681236",
"0.5670762",
"0.559873",
"0.5597414",
"0.5564046",
"0.54976666",
"0.5490073",
"0.54751664",
"0.5468625",
"0.5468625",
"0.5467199",
"0.5443208",
"0.5443208",
"0.5443208",
... | 0.67427456 | 1 |
transformerXLModel is the basic Transformer XL model. | def transformerXLModel(*args, **kwargs):
model = TransfoXLModel.from_pretrained(*args, **kwargs)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xmodel ( self ) :\n return self.__xmodel",
"def _get_model(self):\n layers = []\n\n # inner / hidden network layers + non-linearities\n for l in self.network_layers:\n layers.append(Dense(l))\n layers.append(Relu)\n\n # output layer (no non-linearity)\... | [
"0.66650623",
"0.54803026",
"0.5377177",
"0.53191274",
"0.5308579",
"0.5296709",
"0.5221611",
"0.52039653",
"0.518719",
"0.5157642",
"0.5134617",
"0.5084184",
"0.50639063",
"0.50284153",
"0.5018292",
"0.5004004",
"0.4994367",
"0.49910897",
"0.4984821",
"0.49719974",
"0.497099... | 0.7552164 | 0 |
transformerXLModel is the basic Transformer XL model with the tied (pretrained) language modeling head on top. | def transformerXLLMHeadModel(*args, **kwargs):
model = TransfoXLLMHeadModel.from_pretrained(*args, **kwargs)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transformerXLModel(*args, **kwargs):\n model = TransfoXLModel.from_pretrained(*args, **kwargs)\n return model",
"def xmodel ( self ) :\n return self.__xmodel",
"def makeModel(self):\n\n # Get the script\n modelScript = os.path.join(self.datapath, 'make3FGLxml.py')\n if not... | [
"0.797606",
"0.6120926",
"0.5763685",
"0.5688995",
"0.5641112",
"0.5614112",
"0.55153745",
"0.5507637",
"0.55041826",
"0.5501991",
"0.54965496",
"0.548723",
"0.5450487",
"0.534327",
"0.5335557",
"0.53259224",
"0.5324218",
"0.53236556",
"0.5313579",
"0.5309539",
"0.5280318",
... | 0.65289116 | 1 |
generate the sig matrix | def sigMatrixGen(input_matrix, n):
result = []
for i in range(n):
sig = sigGen(input_matrix)
result.append(sig)
# return a ndarray
print("\nsig matrix:")
print(np.array(result))
print()
return np.array(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigGen(matrix):\n\n # the row sequence set\n seqSet = [i for i in range(matrix.shape[0])]\n print(seqSet)\n\n # initialize the sig vector as [-1, -1, ..., -1]\n result = [-1 for i in range(matrix.shape[1])]\n\n count = 0\n\n while len(seqSet) > 0:\n\n # choose a row of matrix random... | [
"0.68948627",
"0.6191242",
"0.6187946",
"0.598485",
"0.5967972",
"0.5833865",
"0.5798283",
"0.5795263",
"0.57234436",
"0.5647453",
"0.56300986",
"0.56264895",
"0.5622457",
"0.55994517",
"0.55803543",
"0.5577488",
"0.55420196",
"0.5500648",
"0.54968154",
"0.5479149",
"0.547609... | 0.72748 | 0 |
Parses a glider filename and returns details in a dictionary | def parse_glider_filename(filename):
head, tail = os.path.split(filename)
matches = re.search(r"([\w\d\-]+)-(\d+)-(\d+)-(\d+)-(\d+)\.(\w+)$", tail)
if matches is not None:
return {
'path': head,
'glider': matches.group(1),
'year': int(matches.group(2)),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_info_from_filename(filename: str) -> dict:\n *parts, suffix = filename.split('.')\n dct = re.match(r'^(?P<name>[A-z0-9.]*)(-(?P<num_rows>[0-9]+))?$', '.'.join(parts)).groupdict()\n return {\n 'name': dct['name'],\n 'num_rows': int(dct['num_rows']) if dct['num_rows'] else None,\n ... | [
"0.7027147",
"0.6626871",
"0.64223754",
"0.6290143",
"0.6282178",
"0.6234423",
"0.6144738",
"0.6055546",
"0.5997078",
"0.59870154",
"0.5905344",
"0.5888167",
"0.587226",
"0.5845857",
"0.5842085",
"0.5797123",
"0.5785687",
"0.57787573",
"0.5772142",
"0.5770483",
"0.5726815",
... | 0.77769184 | 0 |
Runs a given process and outputs the resulting text as a StringIO | def generate_stream(processArgs):
process = subprocess.Popen(processArgs, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout, _ = process.communicate()
return StringIO(stdout), process.returncode | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_process(self, inp=\"\"):\n return subprocess.run(self.binary,\n input=inp,\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE,\n universal_newlines=True)",
"def pipestring_process(cmd_string, stdin_stri... | [
"0.6597672",
"0.6272315",
"0.6223156",
"0.6206414",
"0.61605144",
"0.6066002",
"0.60533535",
"0.60068065",
"0.59855485",
"0.59770447",
"0.58666307",
"0.5833781",
"0.58200186",
"0.5778298",
"0.57350576",
"0.5726362",
"0.57263464",
"0.57205766",
"0.57126004",
"0.5710412",
"0.57... | 0.67323834 | 0 |
Creates a glider binary data reader over a set of files | def create_glider_BD_ASCII_reader(filePaths):
return process_file_list(filePaths) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_read(filenames, gulp_size, gulp_nframe, dtype, *args, **kwargs):\n return BinaryFileReadBlock(filenames, gulp_size, gulp_nframe, dtype, *args, **kwargs)",
"def read_data_files(filenames, datapath, ids=None):\n filenames = np.array(filenames) # make sure it's array\n if ids is None:\n i... | [
"0.639739",
"0.62938154",
"0.6247702",
"0.60956717",
"0.6022894",
"0.6002602",
"0.5995944",
"0.5995127",
"0.59817314",
"0.59698343",
"0.5965601",
"0.5965601",
"0.5963358",
"0.59414357",
"0.5940989",
"0.58962756",
"0.5845373",
"0.58348626",
"0.5799914",
"0.57856023",
"0.578003... | 0.69841737 | 0 |
Finds and returns available headers in a set of glider data files | def find_glider_BD_headers(reader):
# Bleed off extraneous headers
# Stop when sci_m_present_time is found
line = reader.readline()
while len(line) > 0 and line.find('m_present_time') == -1:
line = reader.readline()
if line is '':
raise EOFError('No headers found before end of file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_headers(self):\n\t\t# collect all the non-segment\n\t\t# files into a list (there\n\t\t# should only be one header)\n\t\tfiles = glob.glob(\"%s/*\" % self.segment_path)\n\t\theaders = [f for f in files if os.path.splitext(f)[1] != '.seg']\n\t\tfor path in headers:\n\t\t\t_file = os.path.split(path)[1]\n\t\... | [
"0.6632229",
"0.65994",
"0.65624875",
"0.6429262",
"0.64260775",
"0.64229804",
"0.63735414",
"0.6354691",
"0.6352438",
"0.63134146",
"0.6298018",
"0.6255339",
"0.62524575",
"0.6244713",
"0.6222327",
"0.61979926",
"0.61969197",
"0.6183677",
"0.6171282",
"0.61333",
"0.60195607"... | 0.6877878 | 0 |
Adds M blank rows to the store (must be opened in append mode) | def appendBlankRows(self, M):
if self.mode != Mode.APPEND:
raise IOError("Storage must be opened in append mode to add blank rows")
self.close()
_f = open(self.fname, 'rb+')
if M < 1:
raise ValueError("The value of M must be positive, not %r"%M)
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_blank_data_row(self):\n last_row_count = self.csv_data_table.rowCount()\n column_count = self.csv_data_table.columnCount()\n self.csv_data_table.insertRow(last_row_count)\n for empty_col in range(0, column_count):\n item = QTableWidgetItem('')\n self.csv_da... | [
"0.69131434",
"0.596373",
"0.5878236",
"0.5868808",
"0.5703616",
"0.56528914",
"0.5589739",
"0.55539495",
"0.5524541",
"0.5487279",
"0.5436453",
"0.5421905",
"0.5409542",
"0.5403166",
"0.5389834",
"0.5389834",
"0.5389834",
"0.5389834",
"0.5389834",
"0.5389834",
"0.5389834",
... | 0.7960882 | 0 |
Return the column addressed by column_name throws IndexError if the column doesn't exist. | def getCol(self, column_name):
idx = self.colnames.index(column_name)
return self.getColByIdx(idx) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_column(self, column_name):\n self.check_for_column(column_name)\n return self.data[column_name].dropna()",
"def _get_column(self, name):\r\n return self.column(name)",
"def _get_column(cls, name):\r\n return cls._columns[name]",
"def get_column_index(self, colName):\n\t\tr... | [
"0.7714685",
"0.7650503",
"0.76223123",
"0.76065403",
"0.7599028",
"0.75833434",
"0.75328934",
"0.7448818",
"0.7424424",
"0.738257",
"0.7336229",
"0.73362017",
"0.72618985",
"0.7194864",
"0.71373194",
"0.70307726",
"0.6987194",
"0.69389665",
"0.6921798",
"0.6916647",
"0.67962... | 0.79146 | 0 |
Put data row in to row idx. Checks to see if the data in v is compatible with the column formats. Throws ValueError on failure. | def putRow(self, idx, row):
if idx >= self.N:
raise IndexError("Attempting to write index %s, raw store only has %d rows"%(
idx, self.N))
if len(row) != len(self.dtypes):
raise ValueError(
"data value only has %s entries, "
"raw sto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateRow(self, index: int) -> None:\n ...",
"def insertRow(self, index, *row):\n if ((len(row) == 1) and (type(row[0]) in MATRIX_VALID_COLLECTIONS)):\n row = row[0]\n if self._width:\n if not (len(row) == self._width):\n raise ValueError('Improper le... | [
"0.5599062",
"0.5544031",
"0.548146",
"0.5278369",
"0.52741003",
"0.5217676",
"0.52135384",
"0.5139518",
"0.5120288",
"0.5111561",
"0.5045599",
"0.5038212",
"0.5009873",
"0.5005236",
"0.49977255",
"0.49887398",
"0.49842817",
"0.49717635",
"0.49660245",
"0.4960734",
"0.4940758... | 0.6238916 | 0 |
Helper generating constraints for stacking items in a direction. | def stack(items, direction):
constraints = []
if direction == 'left':
first_item, second_item = 'left', 'right'
elif direction == 'right':
first_item, second_item = 'right', 'left'
elif direction == 'top':
first_item, second_item = 'top', 'bottom'
elif direction == 'bottom':... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _do_stack_layout(self, components, relative_sizes, align):\n size = list(self.bounds)\n if self.fit_components != \"\":\n self.get_preferred_size()\n if \"h\" in self.fit_components:\n size[0] = self._cached_preferred_size[0] - self.hpadding\n if \"... | [
"0.555301",
"0.5161152",
"0.51127726",
"0.5089055",
"0.50467676",
"0.50209427",
"0.500587",
"0.50038433",
"0.49958363",
"0.49911833",
"0.494457",
"0.4942481",
"0.49328098",
"0.48278317",
"0.47881868",
"0.4776161",
"0.47228655",
"0.4689109",
"0.46761665",
"0.46651027",
"0.4664... | 0.7391361 | 1 |
use an existed model on one image | def use_model_on_one_image(self, image_path, model_path, save_path):
if self.cuda:
self.unet.load_state_dict(torch.load(model_path))
else:
self.unet.load_state_dict(torch.load(model_path, map_location=lambda storage, loc: storage))
ori_image = Image.open(image_path).conv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_processing(img):\n\n # assert isinstance(img, EmotionalImage)\n\n if str(img.name).find('json') > -1:\n return\n user = get_user(img.path + '/' + 'meta.json')\n filePath = img.path + '/' + img.name\n # print(\"---------------Processsing----------------\", img.name)\n\n features =... | [
"0.673883",
"0.6424996",
"0.6207342",
"0.6130024",
"0.60245216",
"0.6023661",
"0.6002946",
"0.59894556",
"0.5934572",
"0.5884859",
"0.5836255",
"0.58333",
"0.5814745",
"0.5811822",
"0.5806755",
"0.5802723",
"0.5786928",
"0.57847947",
"0.57477283",
"0.5739294",
"0.5732787",
... | 0.73852843 | 0 |
Compute descriptors and then wasserstein distance between two set of signals | def compute_wasserstein_distance(set1, set2, dist_function=dist_norm, weights=None):
# Transform DataFrame pandas to numpy array
arr1 = np.array(set1).T
arr2 = np.array(set2).T
# Compute list of descriptors
desc1 = [compute_descriptor(s1) for s1 in arr1]
desc2 = [compute_descriptor(s2) for s2 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SignalDistance(s1,s2):\n\tdist = 0\n\n\t# calculate absolute distance between each element\n\tfor i in range(0, len(s1)):\n\t\tdist += np.abs(s1[i] - s2[i])\n\treturn dist",
"def _pairwise_dist(self,s1,s2):\n\n return 0.0",
"def compute_feature_distances(features1: np.ndarray, \r\n ... | [
"0.6228309",
"0.616242",
"0.6078043",
"0.60723436",
"0.6060084",
"0.59661925",
"0.59318876",
"0.58962315",
"0.5886226",
"0.5865435",
"0.5851835",
"0.5777995",
"0.5744812",
"0.57403195",
"0.57391304",
"0.5724529",
"0.5693168",
"0.56878394",
"0.5677371",
"0.56667423",
"0.565164... | 0.71085036 | 0 |
Determine if a project is Apache. Look for a key string in a set of possible license files to figure out if a project looks to be Apache. This is used as a precondition for enforcing license headers. | def _project_is_apache():
license_files = ["LICENSE"]
for filename in license_files:
try:
with open(filename, "r") as file:
for line in file:
if re.search('Apache License', line):
return True
except IOError:
pas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_for_exact_apache(start, lines):\n APACHE2 = \"\"\"\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may\nnot use this file except in compliance with the License. You may obtain\na copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicab... | [
"0.6920449",
"0.6128609",
"0.6103929",
"0.5924239",
"0.5574283",
"0.52922183",
"0.52390844",
"0.51788116",
"0.5098838",
"0.50670195",
"0.5051487",
"0.50348383",
"0.5003425",
"0.49993333",
"0.49344766",
"0.49279973",
"0.49052182",
"0.4885833",
"0.486364",
"0.486364",
"0.486364... | 0.8212929 | 0 |
Check for Apache 2.0 license. H102 license header not found | def hacking_has_license(physical_line, filename, lines, line_number):
# don't work about init files for now
# TODO(sdague): enforce license in init file if it's not empty of content
license_found = False
# skip files that are < 10 lines, which isn't enough for a license to fit
# this allows us to h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _project_is_apache():\n\n license_files = [\"LICENSE\"]\n for filename in license_files:\n try:\n with open(filename, \"r\") as file:\n for line in file:\n if re.search('Apache License', line):\n return True\n except IOErro... | [
"0.737723",
"0.71610737",
"0.6707912",
"0.6684249",
"0.6561588",
"0.65200686",
"0.6306875",
"0.6149235",
"0.6117944",
"0.60859275",
"0.60083145",
"0.59861296",
"0.5967069",
"0.5955334",
"0.5936293",
"0.59291077",
"0.59291077",
"0.59291077",
"0.59291077",
"0.59291077",
"0.5929... | 0.7472326 | 0 |
Check for Apache 2.0 license. H103 header does not match Apache 2.0 License notice | def hacking_has_correct_license(physical_line, filename, lines, line_number):
# don't work about init files for now
# skip files that are < 10 lines, which isn't enough for a license to fit
# this allows us to handle empty files, as well as not fail on the Okay
# doctests.
if _project_is_apache() an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hacking_has_license(physical_line, filename, lines, line_number):\n # don't work about init files for now\n # TODO(sdague): enforce license in init file if it's not empty of content\n license_found = False\n\n # skip files that are < 10 lines, which isn't enough for a license to fit\n # this all... | [
"0.7345693",
"0.7040451",
"0.6871561",
"0.662552",
"0.639615",
"0.61346924",
"0.61181307",
"0.60795856",
"0.60514086",
"0.598824",
"0.5797824",
"0.57448393",
"0.571064",
"0.5656432",
"0.5645439",
"0.56257385",
"0.55955493",
"0.55851114",
"0.55649054",
"0.5533282",
"0.5533282"... | 0.7416897 | 0 |
This heuristic function assigns a heuristic value to a course, based on problem details stored in the schedule class | def course_heuristic(schedule, course):
if course in schedule.heuristic_dictionary:
return schedule.heuristic_dictionary[course] + (0 if schedule.is_program_in_goal(course[0]) else 10)
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Scheduling():\n Faculty = 'Adams Schuurman VanderLinden Bailey'.split()\n Times = 'mwf900 mwf1030 tth900 tth1030'.split()\n Classrooms = 'nh253 sb382'.split()\n Courses = 'cs104 cs108 cs112 cs212 cs214 cs336 cs344'.split()\n variables = Courses\n domains = {}\n combo = list(itertools.produ... | [
"0.617071",
"0.61182505",
"0.6040365",
"0.58960104",
"0.5803067",
"0.5758609",
"0.57564235",
"0.5750708",
"0.56579125",
"0.56294435",
"0.5623086",
"0.56135297",
"0.5591968",
"0.5587101",
"0.5519861",
"0.5488439",
"0.547708",
"0.5465807",
"0.5456001",
"0.5443133",
"0.5440999",... | 0.7756556 | 0 |
Prints the results of the four elementary mathematical operations of arithmetic (addition, subtraction, multiplication, division) | def operations(arg_list: list):
if not args_is_good(arg_list):
return
a, b = int(arg_list[1]), int(arg_list[2])
operation_names = (
"Sum",
"Difference",
"Product",
"Quotient",
"Remainder"
)
result_list = [
a + b,
a - b,
a * b,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runOperation(operation, num1, num2):\n if operation == 1 or operation == '+':\n print(add(num1, num2))\n elif operation == 2 or operation == '-':\n print(sub(num1, num2))\n elif operation == 3 or operation == '*':\n print(mul(num1, num2))\n elif operation == 4 or operation == '... | [
"0.7177928",
"0.6828142",
"0.6739674",
"0.6738346",
"0.673798",
"0.6510891",
"0.6449975",
"0.6426332",
"0.62821764",
"0.6196362",
"0.617307",
"0.61650133",
"0.613895",
"0.61381805",
"0.61274135",
"0.6107636",
"0.6107401",
"0.61008376",
"0.6081034",
"0.606653",
"0.60600907",
... | 0.72273034 | 0 |
Remove voice a nick on our channel. nick Nick to devoice. nick string | def devoice(self,nick):
self.logger.debug("devoicing %s" % nick)
self.connection.mode(self.config["IRC/channel"],"-v "+nick) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def devoice(phenny, input):\n if not input.admin or not input.sender.startswith('#'):\n return\n nick = input.group(2)\n verify = auth_check(phenny, input.nick, nick)\n if verify:\n channel = input.sender\n if not nick:\n nick = input.nick\n phenny.write(['MODE', channel, \"-v\", nick])",
"d... | [
"0.69212866",
"0.67807645",
"0.6592906",
"0.6344784",
"0.6223396",
"0.61001515",
"0.6064964",
"0.60210776",
"0.5978641",
"0.59538937",
"0.59272945",
"0.58392036",
"0.58038807",
"0.5778864",
"0.5776423",
"0.57549924",
"0.5736404",
"0.5667781",
"0.5608558",
"0.55976915",
"0.559... | 0.77431965 | 0 |
Give voice a nick on our channel. nick Nick to voice. nick string | def voice(self,nick):
self.logger.debug("voicing %s" % nick)
self.connection.mode(self.config["IRC/channel"],"+v "+nick) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _nick(self, nick: str) -> str:\n\n logger.debug(f\"Setting nick to {nick!r}\")\n\n self._target_nick = nick\n\n reply = await self._connection.send(\"nick\", {\"name\": nick})\n data = self._extract_data(reply)\n\n new_nick = data[\"to\"]\n self._target_nick = ne... | [
"0.7547319",
"0.7147378",
"0.69989777",
"0.69552326",
"0.6930003",
"0.68089306",
"0.6656594",
"0.66358733",
"0.6490215",
"0.6323261",
"0.6312087",
"0.621955",
"0.619321",
"0.61336875",
"0.6128659",
"0.6064886",
"0.60516953",
"0.60454017",
"0.6038842",
"0.60170436",
"0.6006084... | 0.7972986 | 0 |
Give ops to a nick on our channel. nick Nick to op. nick string | def op(self,nick):
self.logger.debug("giving ops to %s" % nick)
self.connection.mode(self.config["IRC/channel"],"+o "+nick) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _nick(self, nick: str) -> str:\n\n logger.debug(f\"Setting nick to {nick!r}\")\n\n self._target_nick = nick\n\n reply = await self._connection.send(\"nick\", {\"name\": nick})\n data = self._extract_data(reply)\n\n new_nick = data[\"to\"]\n self._target_nick = ne... | [
"0.72929114",
"0.7012624",
"0.6978233",
"0.6868163",
"0.6865441",
"0.6821805",
"0.6784968",
"0.67588824",
"0.67487234",
"0.658333",
"0.6552925",
"0.64476985",
"0.6386876",
"0.6353068",
"0.6332817",
"0.62990147",
"0.62818927",
"0.6228734",
"0.61587983",
"0.6144883",
"0.6113449... | 0.8314927 | 0 |
Bot main event loop. This starts the main event loop which continues running until internal logic decides to end things by calling leave(). | def MainLoop(self):
self.pleaseQuit=0
self.logger.info("Starting main eventloop")
try:
self.irc.process_forever(1)
except KeyboardInterrupt:
self.logger.warn("Received interrupt, disconnecting from irc")
#self.irc.disconnect_all("^C received")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_loop(self):\n LOGGER.info('Entering main event loop...')\n try:\n while self._handle_faucet_events():\n while not self._faucet_events.event_socket_connected:\n LOGGER.info('Attempting faucet event sock connection...')\n time.sle... | [
"0.7019646",
"0.6838164",
"0.68114",
"0.68013227",
"0.6725955",
"0.66973686",
"0.6689965",
"0.66604954",
"0.6658232",
"0.6626411",
"0.6600207",
"0.6574286",
"0.65117",
"0.6506493",
"0.6485123",
"0.64634466",
"0.6433927",
"0.6427703",
"0.6392893",
"0.63523704",
"0.63094646",
... | 0.69424963 | 1 |
Returns True is the array has a FITS header with a defined World Coordinate System. | def has_wcs(self):
if self.header is None:
return False
required = 'CRPIX,CRVAL,CTYPE'.split(',')
keywords = np.concatenate(
[(lambda i: [r+str(i+1) for r in required])(i)
for i in range(self.header['NAXIS'])])
return all([k in self.header for k in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_wcs(self):\n return self.wcs is not None",
"def is_fits_file (fyl):\n return (fnmatch.fnmatch(fyl, _FITS_PAT) or fnmatch.fnmatch(fyl, _GZFITS_PAT))",
"def check_header(self, magmap):\n for i in range(len(self.mag_map_list)):\n if magmap.fits_header['DATE-OBS'] == self.mag_ma... | [
"0.6224717",
"0.6077173",
"0.596128",
"0.5930147",
"0.5891437",
"0.5868964",
"0.5844264",
"0.5785444",
"0.5705036",
"0.56585866",
"0.56518614",
"0.5558755",
"0.5507444",
"0.5489972",
"0.5458702",
"0.5453048",
"0.54431623",
"0.54268235",
"0.5411415",
"0.541082",
"0.5403351",
... | 0.75262904 | 0 |
Remove data directory from arguments to pass to upgrade function. | def _clean_args(sys_argv, args):
# print(args.datadir)
# print( os.path.abspath(os.path.expanduser(sys_argv[0])))
# if sys_argv[0].startswith("_") or not args.datadir == os.path.abspath(os.path.expanduser(sys_argv[0])):
# print("aa")
base = [x for x in sys_argv if
x.startswith("-") o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanDataDir(self):\n for strFile in os.listdir(self.strDataDir):\n os.remove(os.path.join(self.strDataDir, strFile))",
"def remove_data(data=None): #clear\n data = get_data(data)\n shutil.rmtree(data)",
"def cleanup(self):\n\n # uninstall sourcedata\n if self.conversi... | [
"0.6184891",
"0.61816466",
"0.6153867",
"0.5912949",
"0.57309043",
"0.56992996",
"0.56089664",
"0.5554631",
"0.55329955",
"0.5486389",
"0.5480637",
"0.54651725",
"0.5456111",
"0.54240644",
"0.5393178",
"0.5390145",
"0.5384537",
"0.5354011",
"0.53320277",
"0.5327844",
"0.53157... | 0.69758064 | 0 |
Scale the given value from the scale of src to the scale of dst. | def scale(val, src, dst):
return ((val - src[0]) / (src[1]-src[0])) * (dst[1]-dst[0]) + dst[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale(val, src, dst):\n return ((val - src[0]) / (src[1] - src[0])) * (dst[1] - dst[0]) + dst[0]",
"def scale(val, src, dst):\n return ((val - src[0]) / (src[1]-src[0])) * (dst[1]-dst[0]) + dst[0]",
"def scale(val, src, dst):\n return ((val - src[0]) / (src[1]-src[0])) * (dst[1]-dst[0]) + dst[0]",... | [
"0.8487897",
"0.84265393",
"0.84265393",
"0.8332354",
"0.71901447",
"0.67512923",
"0.6737802",
"0.67174697",
"0.6434968",
"0.6419172",
"0.6377996",
"0.63737845",
"0.63500005",
"0.62871647",
"0.6274189",
"0.6264413",
"0.6247027",
"0.6245077",
"0.622624",
"0.6220917",
"0.619808... | 0.86069685 | 0 |
Returns serialized chess board object as numpy array | def serialize(board):
bstate = np.zeros(shape=64, dtype=np.uint)
pieces_map = {"p": 1, "n": 2, "b": 3, "q": 4, "k": 5, "r": 6}
# General cases
for i, piece in board.piece_map().items():
piece = str(piece)
piece_num = 0
if piece.isupper():
piece_num += 8
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self):\n gstate = np.zeros((10,10, 3), dtype=np.uint8)\n\n gstate[:,:,1] = self.possible_moves_mask\n for move in self.board.lines:\n x, y = self.rotate_move(move)\n gstate[x,y,0] = 1\n gstate[x,y,1] = 0\n if self.board.player == 1:\n ... | [
"0.66000456",
"0.6299202",
"0.6193597",
"0.60386544",
"0.59891075",
"0.59628636",
"0.5919498",
"0.591163",
"0.5893122",
"0.5869942",
"0.5859589",
"0.58561474",
"0.5800036",
"0.57887626",
"0.5763239",
"0.5742434",
"0.5684998",
"0.5680067",
"0.5677869",
"0.5664567",
"0.564366",... | 0.6941484 | 0 |
Computes the error of the entries in a column across multiple files. | def compute_errors_per_column(filenames, cols, skip=0, stop=-1, column_major=True, separator='[\t ]'):
# Read the files
all_cols = [read_file_lines(file, cols, skip, stop, column_major, separator) for file in filenames]
# Initialise results array
res = [[[] for j in all_cols[0][0]] for i in all_cols[0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_error(self):\n \n self.error = pd.DataFrame()\n \n for name in self.conf[\"w_sizes\"].keys():\n \n self.error[f\"mae {name}\"] = self.predict[[name, \"test\"]].apply(lambda x: mae(x), axis=1)\n self.error[f\"mape {name}\"] = self.predict[[nam... | [
"0.6215522",
"0.6063872",
"0.5863203",
"0.5820256",
"0.58053666",
"0.57845646",
"0.5751959",
"0.57462215",
"0.57040566",
"0.5694365",
"0.5669763",
"0.56556886",
"0.5650874",
"0.5603829",
"0.55507576",
"0.55316526",
"0.5530259",
"0.55178493",
"0.54972315",
"0.5458472",
"0.5421... | 0.7694306 | 0 |
Reads real values from the columns from a file. | def read_file_lines(filename, cols, skip=0, stop=-1, column_major=False, separator='[\t ]'):
# Set current directory
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
# Open file
f = open(__location__ + '/' + filename, "r")
# Read lines and skip initial lin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_slurm_file(filename, cols, skip=54, stop=-34, column_major=True):\n\n # Set current directory\n __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))\n \n # Open file\n f = open(__location__ + '/' + filename, \"r\")\n\n # Read lines and skip initial lines ... | [
"0.64938724",
"0.62911093",
"0.62812585",
"0.6278511",
"0.6249281",
"0.62445945",
"0.6230227",
"0.6095228",
"0.60909957",
"0.6087778",
"0.6066423",
"0.60519576",
"0.6044522",
"0.6022845",
"0.6011452",
"0.6007024",
"0.60068893",
"0.59977126",
"0.5988593",
"0.5951619",
"0.59432... | 0.64935184 | 1 |
Reads real values from the columns from a file. | def read_slurm_file(filename, cols, skip=54, stop=-34, column_major=True):
# Set current directory
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
# Open file
f = open(__location__ + '/' + filename, "r")
# Read lines and skip initial lines if necessary
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_file_lines(filename, cols, skip=0, stop=-1, column_major=False, separator='[\\t ]'):\n\n # Set current directory\n __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))\n \n # Open file\n f = open(__location__ + '/' + filename, \"r\")\n\n # Read lines and ... | [
"0.6494621",
"0.6291655",
"0.6281785",
"0.62787837",
"0.6251961",
"0.62463695",
"0.6230768",
"0.60964423",
"0.6091404",
"0.6088806",
"0.60677314",
"0.6054541",
"0.6043523",
"0.6023332",
"0.60129094",
"0.60079306",
"0.60073435",
"0.59973216",
"0.5989721",
"0.5953103",
"0.59459... | 0.64948463 | 0 |
Returns True if y is within relative or absolute 'epsilon' of x. By default, 'epsilon' is 1e6. | def IsApproximatelyEqual(x, y, epsilon):
# Check absolute precision.
if -epsilon <= x - y <= epsilon:
return True
# Is x or y too close to zero?0.
if -epsilon <= x <= epsilon or -epsilon <= y <= epsilon:
return False
# Check relative precision.
return (-epsilon <= (x - y) / x <... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_almost_equal(self, x ,y ,epsilon=1*10**(-8)):\n \treturn abs(x-y) <= epsilon",
"def is_equal_approx(x, y, epsilon=1e-6):\r\n # Check absolute precision.\r\n if -epsilon <= x - y <= epsilon:\r\n return True\r\n\r\n # Is x or y too close to zero?\r\n if -epsilon <= x <= epsilon or -eps... | [
"0.7743972",
"0.76331717",
"0.7582528",
"0.7221906",
"0.7125757",
"0.69528764",
"0.6868787",
"0.68215877",
"0.68215877",
"0.68010455",
"0.67604196",
"0.6464339",
"0.6431911",
"0.6375656",
"0.6374513",
"0.6331767",
"0.6296578",
"0.6260685",
"0.6240717",
"0.6206992",
"0.6125644... | 0.7647292 | 1 |
Binary search tree create tree using ordered insert and lookup to get log N memory/time space value on left child is less than parent and right child is more binary search trees must be balanced to avoid losing log n time | def binary_search_tree_run():
# no need for Tree object as the Tree itself is a concept; its made of connected nodes
# nodes are the object; connections are self contained
def binary_insert(root, node):
if root is None:
root = node
else:
if root.data > node.data:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_bst(self, a, left, right):\n if left > right:\n return\n mid = (left + right) / 2\n self.insert(a[mid])\n self.create_bst(a, left, mid - 1)\n self.create_bst(a, mid + 1, right)",
"def binary_search_tree():\n\n class Node(object):\n def __init__(s... | [
"0.6588508",
"0.6389343",
"0.63731825",
"0.6320697",
"0.6289935",
"0.62560046",
"0.6254612",
"0.6248485",
"0.6205479",
"0.61466694",
"0.6144229",
"0.60761297",
"0.607561",
"0.6038372",
"0.6016458",
"0.6010935",
"0.59856427",
"0.5969648",
"0.596026",
"0.5916625",
"0.58945185",... | 0.67303145 | 0 |
Constructor for the LogMessage class. | def __init__(self, message_type: LogType, message: str):
self.timestamp = datetime.datetime.now().strftime("%m-%d-%Y %I:%M:%S %p")
self.message = message
self.message_type = message_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, message: str):\n\n self.message = message",
"def __init__(self, message: str):\n\n self.message = message",
"def __init__(self, message: str):\n\n self.message = message",
"def __init__(self, message: str):\n\n self.message = message",
"def __init__(self, mess... | [
"0.7281197",
"0.7281197",
"0.7281197",
"0.7281197",
"0.7281197",
"0.7281197",
"0.7281197",
"0.7281197",
"0.7281197",
"0.7281197",
"0.7277876",
"0.72747505",
"0.7267275",
"0.72616214",
"0.72616214",
"0.72616214",
"0.72508955",
"0.72508955",
"0.72508955",
"0.72508955",
"0.72508... | 0.8046264 | 0 |
Returns a tuple of a log message color dependent on the state of the LogType. | def get_log_message_color(self):
if self.message_type == LogType.INFORMATION:
return UIStyle.log_info_text_color
elif self.message_type == LogType.WARNING:
return UIStyle.log_warning_text_color
elif self.message_type == LogType.ERROR:
return UIStyle.log_error_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color(self, record):\n if record.level >= logbook.ERROR:\n return 'red'\n elif record.level >= logbook.NOTICE:\n return 'yellow'\n elif record.level >= logbook.INFO:\n return 'green'\n elif record.level >= logbook.DEBUG:\n return 'darkblue'\n ... | [
"0.7442609",
"0.6822685",
"0.6787821",
"0.6777019",
"0.6574323",
"0.6196784",
"0.61255735",
"0.6125034",
"0.6115945",
"0.59679276",
"0.5916352",
"0.5806504",
"0.57659876",
"0.5744685",
"0.5677736",
"0.56712615",
"0.56472",
"0.56465226",
"0.56109154",
"0.5595147",
"0.55810237"... | 0.7657121 | 0 |
Intializes the `spin_basis_general` object (basis for spin operators). | def __init__(self,N,Nup=None,m=None,S="1/2",pauli=True,Ns_block_est=None,**blocks):
self._S = S
self._pauli = pauli
sps,S = S_dict[S]
_Np = blocks.get("_Np")
if _Np is not None:
blocks.pop("_Np")
if Nup is not None and m is not None:
raise ValueError("Cannot use Nup and m at the same time")
if m i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initbasissolve(self,basis_):\n _basis_minlength = self.getnumcon()\n if self.getnumcon() > 0 and basis_ is not None and len(basis_) != self.getnumcon():\n raise ValueError(\"Array argument basis is not long enough: Is %d, expected %d\" % (len(basis_),self.getnumcon()))\n if isinstance(basis_,nump... | [
"0.5158439",
"0.49795485",
"0.4939714",
"0.4905152",
"0.48438475",
"0.48037356",
"0.47942337",
"0.47535267",
"0.4717103",
"0.46954396",
"0.46549383",
"0.46426424",
"0.46208468",
"0.46104455",
"0.45987937",
"0.45912796",
"0.45879892",
"0.45736608",
"0.45665684",
"0.45567396",
... | 0.52084184 | 0 |
Bounds on the parameters. | def param_bounds(self) -> Optional[Sequence[Tuple[float, float]]]:
return [(-1.0, 1.0)] * len(list(self.params())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_params_bounds(self) -> np.array:\n pass",
"def GetBounds(self):\n ...",
"def GetBounds(self):\n ...",
"def GetBounds(self):\n ...",
"def GetBounds(self):\n ...",
"def GetBounds(self):\n ...",
"def GetBounds(self):\n ...",
"def GetBounds(self):\... | [
"0.811433",
"0.78342634",
"0.78342634",
"0.78342634",
"0.78342634",
"0.78342634",
"0.78342634",
"0.78342634",
"0.78342634",
"0.75285256",
"0.73723954",
"0.72148615",
"0.717128",
"0.7118799",
"0.7110791",
"0.71085656",
"0.7095044",
"0.7082793",
"0.7064156",
"0.70503706",
"0.70... | 0.8024212 | 1 |
Produce qubits that can be used by the ansatz circuit. | def _generate_qubits(self) -> Sequence[cirq.Qid]:
return cirq.LineQubit.range(openfermion.count_qubits(self.hamiltonian)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_qubits(self):\n return cq.LineQubit.range(4)",
"def get_qubit_registers_for_adder(qc: QuantumComputer, num_length: int,\n qubits: Optional[Sequence[int]] = None)\\\n -> Tuple[Sequence[int], Sequence[int], int, int]:\n if qubits is None:\n una... | [
"0.73088723",
"0.62419426",
"0.6180455",
"0.6161495",
"0.6159421",
"0.61173415",
"0.6033614",
"0.60168266",
"0.6000866",
"0.5977901",
"0.59706104",
"0.5942236",
"0.5855001",
"0.5853487",
"0.5845756",
"0.58454186",
"0.5833242",
"0.57928675",
"0.5776464",
"0.5715595",
"0.570927... | 0.7294684 | 1 |
The qubit permutation induced by the ansatz circuit. | def qubit_permutation(self, qubits: Sequence[cirq.Qid]
) -> Sequence[cirq.Qid]:
# Every iteration reverses the qubit ordering due to the use of a
# swap network
if self.iterations & 1:
return qubits[::-1]
else:
return qubits | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_permutation(self):\n sp = SetPartitions(self.parent()._n)(self)\n perm = sp.to_permutation().to_cycles()\n return perm",
"def apply_permutation(hyper, pol, perm):\n pass",
"def PermutationTest(self):\n # U = union of B and T\n union_sample = np.concatenate((self.x_b... | [
"0.6072274",
"0.593876",
"0.59026754",
"0.5829597",
"0.58173853",
"0.5799541",
"0.5772073",
"0.57612824",
"0.57523465",
"0.5748956",
"0.5677568",
"0.56546587",
"0.56439143",
"0.5610788",
"0.5609975",
"0.5608455",
"0.5574333",
"0.55704415",
"0.552458",
"0.5520668",
"0.55134374... | 0.7303275 | 0 |
Get the square at x, y. | def getSquare(x, y):
global theMap, width, height
return theMap[x + y * width] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_square(self, x, y):\n if x < 0 or x > self.width-1 or y < 0 or y > self.height-1:\n return MapSquare(x, y, Tile.Wall, '~') # return a wall if at end of map\n return self.mapArray[y][x]",
"def get_map_square(x, y):\n result = MAP_SQUARE_ROCK\n if ((x >=0 and x< width) and (... | [
"0.8056625",
"0.7661196",
"0.7617629",
"0.7569339",
"0.75196046",
"0.7420817",
"0.74148685",
"0.73277044",
"0.7139688",
"0.7051713",
"0.69267684",
"0.68664426",
"0.6817653",
"0.68138",
"0.6699829",
"0.66974205",
"0.6687279",
"0.66759884",
"0.66500574",
"0.66420627",
"0.663247... | 0.8581364 | 0 |
Generate the point list for grass and the connectios | def pointListForGrass(x, y):
return [] # No points are made for grass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_points(self):\n for x in range(self.num_sides):\n for y in range(self.num_sides):\n for z in range(self.num_sides):\n col_name = y + 4\n top_num = 0\n if 1 < z < 4:\n top_name = 'b'\n ... | [
"0.665589",
"0.64751756",
"0.6373418",
"0.6180046",
"0.61651385",
"0.614001",
"0.6112908",
"0.61088437",
"0.61064774",
"0.60446703",
"0.60443026",
"0.60264635",
"0.6013619",
"0.601086",
"0.59885955",
"0.5961999",
"0.5931002",
"0.5922852",
"0.59078413",
"0.59078413",
"0.589237... | 0.6811711 | 0 |
Genereate the point list for a curve of the given type. | def pointListForCurve(x, y, type):
if x < 10:
xString = "0%d" % x
else:
xString = "%d" % x
if x < 11:
xMString = "0%d" % (x - 1)
else:
xMString = "%d" % (x - 1)
if x < 9:
xPString = "0%d" % (x + 1)
else:
xPString = "%d" % (x + 1)
if x < 8:
xPPString = "0%d" % (x + 2)
else:
xPPString = "%d" %... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pointListForT(x, y, type):\n\n\tpointList = []\n\n\tif x < 10:\n\t\txString = \"0%d\" % x\n\telse:\n\t\txString = \"%d\" % x\n\n\tif x < 11:\n\t\txMString = \"0%d\" % (x - 1)\n\telse:\n\t\txMString = \"%d\" % (x - 1)\n\n\tif x < 9:\n\t\txPString = \"0%d\" % (x + 1)\n\telse:\n\t\txPString = \"%d\" % (x + 1)\n\n... | [
"0.71324337",
"0.691689",
"0.6335365",
"0.6270263",
"0.6030151",
"0.6027437",
"0.60072774",
"0.5987724",
"0.5943275",
"0.5928884",
"0.58040994",
"0.5729193",
"0.56796753",
"0.56732965",
"0.56576484",
"0.56563926",
"0.5645432",
"0.5639133",
"0.56305695",
"0.5600551",
"0.559000... | 0.76540875 | 0 |
Genereate the point list for horizontal and the connections | def pointListForHorizontal(x, y):
pointList = []
if x < 10:
xString = "0%d" % x
else:
xString = "%d" % x
if x < 11:
xMString = "0%d" % (x - 1)
else:
xMString = "%d" % (x - 1)
if x < 9:
xPString = "0%d" % (x + 1)
else:
xPString = "%d" % (x + 1)
if y < 10:
yString = "0%d" % y
else:
yString =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_points(self):\n for x in range(self.num_sides):\n for y in range(self.num_sides):\n for z in range(self.num_sides):\n col_name = y + 4\n top_num = 0\n if 1 < z < 4:\n top_name = 'b'\n ... | [
"0.67405844",
"0.62107205",
"0.6182879",
"0.61354053",
"0.61052626",
"0.60390943",
"0.6023433",
"0.60185105",
"0.5978487",
"0.5890928",
"0.5874542",
"0.58692586",
"0.58622354",
"0.5859755",
"0.58525777",
"0.58480215",
"0.5839587",
"0.5824568",
"0.5807913",
"0.58020675",
"0.58... | 0.6551451 | 1 |
Genereate the point list for plus and the connections | def pointListForPlus(x, y):
pointList = []
if x < 10:
xString = "0%d" % x
else:
xString = "%d" % x
if x < 11:
xMString = "0%d" % (x - 1)
else:
xMString = "%d" % (x - 1)
if x < 9:
xPString = "0%d" % (x + 1)
else:
xPString = "%d" % (x + 1)
if y < 11:
yMString = "0%d" % (y - 1)
else:
yMString... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_points(self):\n if not '_list_of_points' in self.__dict__.keys():\n self._list_of_points = [] \n for point in self['point'].items():\n self._list_of_points.append(point[1])",
"def generate_points(self):\n for x in range(self.num_sides):\n for y... | [
"0.6563536",
"0.63029593",
"0.6042638",
"0.60285366",
"0.5971535",
"0.59708524",
"0.5878301",
"0.58246744",
"0.5796405",
"0.5781486",
"0.5772956",
"0.5750572",
"0.5747834",
"0.57398576",
"0.572293",
"0.57222605",
"0.5715896",
"0.5715878",
"0.57150316",
"0.5705263",
"0.5700301... | 0.6720082 | 0 |
Splits the input vector into the the NN bias weights and layer parameters. | def split_weights(weights, num_features, num_hidden):
# Check weights is the right length
expected_length = num_hidden * 2 + num_features * num_hidden
if expected_length != len(weights):
raise ValueError("NN weights array has an incorrect size.")
number_of_input_to_hidden_weights = num_features... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setParamsFromVector(self, params):\n #starting point of w_ih weights in vectorised params\n w_ih_start_pos = 0\n #end point of w_ih weights in vectorised params\n w_ih_end_pos = self.hiddenLayerSize * self.inputLayerSize\n\n self.w_ih = np.reshape( params[ w_ih_start_pos : w_... | [
"0.6474177",
"0.62150097",
"0.59028554",
"0.5891459",
"0.57512856",
"0.566297",
"0.5626369",
"0.55922675",
"0.55862004",
"0.55861807",
"0.5556493",
"0.5547451",
"0.5511686",
"0.55082804",
"0.54302204",
"0.54059917",
"0.5402397",
"0.53616774",
"0.5311002",
"0.52822673",
"0.525... | 0.66057736 | 0 |
This function finds the 2 norm for a given vector. It does this by squaring each value in the list, summing them, and then finally finding the square root of the sum | def norm(vector):
result = 0
# initial value for the result of this function
for z in range(len(vector)):
# this loop will continue as long as there are more values in the list
result += vector[z]**2
result = result**.5
# The two equations above find the sum of the squares and then the square... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l2_norm(v):\n res = 0\n for e in v:\n res += e * e\n return math.sqrt(res)",
"def norm(vec):\n n = 0.0\n for i in vec:\n n += math.pow(i, 2)\n return math.sqrt(n)",
"def norm_l2(v):\n return np.sqrt((v**2).sum())",
"def norm(vec):\n return sqrt(sum([i**2 for i in... | [
"0.81989217",
"0.8151633",
"0.81496537",
"0.81379104",
"0.7771093",
"0.7727026",
"0.7720259",
"0.7697699",
"0.7678383",
"0.7595459",
"0.7586427",
"0.7577254",
"0.7534515",
"0.74822927",
"0.7480247",
"0.738931",
"0.73876673",
"0.7382133",
"0.7350607",
"0.7265401",
"0.7262132",... | 0.8468561 | 0 |
This function finds the QR factorization using the modified gramschmidt algorithim | def GramSchmidt(A):
n = len(A)
# Finds the number of lists in the list, which is also the number of rows
m = len(A[0])
# Finds the number of elements in list one, which is also the number of columns
V = A
R = [[0]*n for i in range(n)]
# creates an empty list R with dimensions of n row... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qr(in_A):\n # input checks\n Ndim = numpy.ndim(in_A)\n assert Ndim == 2\n N,M = numpy.shape(in_A)\n assert N==M\n D,P = in_A[0,0].data.shape\n\n # prepare R and QT\n R = in_A.copy()\n QT = numpy.array([[UTPS(numpy.zeros((D,P))) for c in range(N)] for r in range(N) ])\n for n in ra... | [
"0.67742115",
"0.6551735",
"0.6470848",
"0.6464673",
"0.6276357",
"0.6145612",
"0.6095144",
"0.6068235",
"0.60322005",
"0.5960673",
"0.5914384",
"0.5910265",
"0.59033066",
"0.5884638",
"0.58554476",
"0.58224005",
"0.5813035",
"0.5805322",
"0.5787797",
"0.5778277",
"0.57749164... | 0.68643403 | 0 |
Get a new command buffer from the command pool If begin is true, the command buffer is also started so we can start adding commands | def getCommandBuffer(self, begin):
cmdBufAllocateInfo = vk.VkCommandBufferAllocateInfo(
sType = vk.VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
commandPool = self.cmdPool,
level = vk.VK_COMMAND_BUFFER_LEVEL_PRIMARY,
commandBufferCount = 1
)
cmdB... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_from_queue(self):\n while not self.receive_queue.empty():\n cmd, kwargs = bcp.decode_command_string(\n self.receive_queue.get(False))\n self._process_command(cmd, **kwargs)",
"def at_cmdset_creation(self):\n self.add(Command())",
"def Start(self):\n ... | [
"0.56817657",
"0.5379371",
"0.5371483",
"0.53511745",
"0.5340634",
"0.5257653",
"0.5256276",
"0.52443844",
"0.5236741",
"0.52008724",
"0.51378006",
"0.5133628",
"0.5128187",
"0.51190907",
"0.5075476",
"0.50641507",
"0.50641507",
"0.5049151",
"0.50220376",
"0.5021371",
"0.4964... | 0.77460027 | 0 |
End the command buffer and submit it to the queue Uses a fence to ensure command buffer has finished executing before deleting it | def flushCommandBuffer(self, commandBuffer):
assert(commandBuffer != vk.VK_NULL_HANDLE)
vk.vkEndCommandBuffer(commandBuffer)
submitInfo = vk.VkSubmitInfo(
sType = vk.VK_STRUCTURE_TYPE_SUBMIT_INFO,
commandBufferCount = 1,
pCommandBuffers = [commandBuffer]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Finish(self):\n\t\n self.queue.join()",
"def clean_queue(self):\n self._stdin_queue.put_nowait(None) # Release thread",
"def flush_buffer(self):\n if self._pipeline:\n self._pipeline.execute()",
"def __exit__(self, exc_type, exc_val, exc_tb):\n self.queue.channel.r... | [
"0.67026824",
"0.6398983",
"0.638941",
"0.627914",
"0.62354857",
"0.62224483",
"0.5975924",
"0.5974319",
"0.5931504",
"0.5847558",
"0.5828105",
"0.5789157",
"0.57790357",
"0.5765429",
"0.5765334",
"0.57420546",
"0.57420546",
"0.57077587",
"0.5702915",
"0.5694765",
"0.5686064"... | 0.71980137 | 0 |
Prepare and initialize a uniform buffer block containing shader uniforms Single uniforms like in OpenGL are no longer present in Vulkan. All Shader uniforms are passed via uniform buffer blocks | def prepareUniformBuffers(self):
# Vertex shader uniform buffer block
uboVSSize = sum([glm.sizeof(ubo) for ubo in self.uboVS.values()])
bufferInfo = vk.VkBufferCreateInfo(
sType = vk.VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
size = uboVSSize,
# This buffer will be... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_uniforms(self):\n\n # We might rebuild the program because of snippets but we must\n # keep already bound uniforms\n\n count = 0\n for (name,gtype) in self.all_uniforms:\n if name not in self._uniforms.keys():\n uniform = Uniform(self, name, gtype)\n... | [
"0.6646539",
"0.6123047",
"0.6095851",
"0.58981466",
"0.5672754",
"0.5619681",
"0.5496652",
"0.5472144",
"0.5455896",
"0.543085",
"0.53325665",
"0.52895594",
"0.52755904",
"0.5184214",
"0.51614475",
"0.51511097",
"0.51133764",
"0.50774616",
"0.5024764",
"0.50020206",
"0.50016... | 0.81025815 | 0 |
Setup layout of descriptors used in this example Basically connects the different shader stages to descriptors for binding uniform buffers, image samplers, etc. So every shader binding should map to one descriptor set layout binding | def setupDescriptorSetLayout(self):
# Binding 0: Uniform buffer (Vertex shader)
layoutBinding = vk.VkDescriptorSetLayoutBinding(
descriptorType = vk.VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
descriptorCount = 1,
stageFlags = vk.VK_SHADER_STAGE_VERTEX_BIT,
pImmuta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepareUniformBuffers(self):\n # Vertex shader uniform buffer block\n uboVSSize = sum([glm.sizeof(ubo) for ubo in self.uboVS.values()])\n bufferInfo = vk.VkBufferCreateInfo(\n sType = vk.VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,\n size = uboVSSize,\n # This buf... | [
"0.5419435",
"0.5320315",
"0.5233142",
"0.5209737",
"0.5187489",
"0.51615536",
"0.5123776",
"0.5083447",
"0.5070787",
"0.50693226",
"0.50690275",
"0.504469",
"0.50265414",
"0.50202864",
"0.5019947",
"0.4999012",
"0.49762246",
"0.49702406",
"0.49445206",
"0.4941675",
"0.492330... | 0.7861658 | 0 |
Create the graphics pipeline used in this example Vulkan uses the concept of rendering pipelines to encapsulate fixed states, replacing OpenGL's complex state machine A pipeline is then stored and hashed on the GPU making pipeline changes very fast | def preparePipelines(self):
# Construct the differnent states making up the pipeline
# Input assembly state describes how primitives are assembled
# This pipeline will assemble vertex data as a triangle lists (though we only use one triangle)
inputAssemblyState = vk.VkPipelineInputAsse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_pipeline():\r\n\r\n # Custom universe containing only desired assets (stocks with flag data)\r\n universe = StaticSids(my_stocks)\r\n\r\n return Pipeline(\r\n columns={\r\n #'flag_type': algo_data_full.flag_type.latest,\r\n #'flag_price': algo_data_full.flag_price.lat... | [
"0.6378791",
"0.6290651",
"0.61415225",
"0.6047017",
"0.59506804",
"0.5942253",
"0.59359884",
"0.58577967",
"0.58410114",
"0.5816642",
"0.5786323",
"0.5780881",
"0.57128596",
"0.5662136",
"0.56610256",
"0.5625465",
"0.56161696",
"0.55879205",
"0.5575038",
"0.553212",
"0.54995... | 0.7507885 | 0 |
Build separate command buffers for every framebuffer image Unlike in OpenGL all rendering commands are recorded once into command buffers that are then resubmitted to the queue This allows to generate work upfront and from multiple threads, one of the biggest advantages of Vulkan | def buildCommandBuffers(self):
cmdBufInfo = vk.VkCommandBufferBeginInfo(
sType = vk.VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
pNext = None
)
# Set clear values for all framebuffer attachments with loadOp set to clear
# We use two attachments (color and depth) t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_buffers(\n flags, \n screen_shape,\n minimap_shape,\n player_shape, \n num_actions, \n max_num_spatial_args, \n max_num_categorical_args\n) -> Buffers:\n T = flags.unroll_length\n # specs is a dict of dict which containt the keys 'size' and 'dtype'\n specs = dict(\n ... | [
"0.63265693",
"0.63135695",
"0.6131053",
"0.5685903",
"0.5673555",
"0.5658056",
"0.5561704",
"0.5539396",
"0.5480484",
"0.5457968",
"0.53911364",
"0.5387675",
"0.5355034",
"0.5291291",
"0.5282246",
"0.5242677",
"0.5242465",
"0.52235353",
"0.5213134",
"0.5185802",
"0.5123985",... | 0.78845245 | 0 |
store trip section information in db | def store_section(db_connector, description, geo_point_from, geo_point_to, section_type, duration=None, co2=None):
indentation = ''
if section_type == 'DELAY' or section_type == 'SUB_SECTION':
indentation = ' -> '
print(indentation + description)
db_connector.execute_nonquery(sql.SQL_INSERT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_trip_section(db_connector, all_waypoints, from_city_insee, to_city_insee, best_travel):\n\n from_city_name = all_waypoints.loc[all_waypoints[0]\n == from_city_insee].values[0][2]\n to_city_name = all_waypoints.loc[all_waypoints[0]\n ... | [
"0.72279733",
"0.6304549",
"0.5999902",
"0.5975435",
"0.5874828",
"0.58116764",
"0.5341775",
"0.52705944",
"0.5232123",
"0.5211239",
"0.50582373",
"0.5048588",
"0.50312614",
"0.5020902",
"0.501954",
"0.5006851",
"0.4998948",
"0.49954635",
"0.49950495",
"0.49817914",
"0.495106... | 0.67968285 | 1 |
format trip section informations then print & store in db | def save_trip_section(db_connector, all_waypoints, from_city_insee, to_city_insee, best_travel):
from_city_name = all_waypoints.loc[all_waypoints[0]
== from_city_insee].values[0][2]
to_city_name = all_waypoints.loc[all_waypoints[0]
== ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_trip_information(trip_id,first_arrive,first_depart,\n trip_length,trip_duration,total_stops):\n \n sql=\"\"\"insert into gtf_trip_information (trip_id,first_arrival,\n first_departure,trip_length_meters,trip_duration_seconds,\n total_num_stops)\n val... | [
"0.69572884",
"0.5763145",
"0.5508151",
"0.5421918",
"0.5396609",
"0.53950036",
"0.5359122",
"0.5355091",
"0.53492385",
"0.53376955",
"0.53373086",
"0.5285653",
"0.5258416",
"0.52471966",
"0.5224921",
"0.5220605",
"0.5219946",
"0.5193814",
"0.5172971",
"0.51667535",
"0.513241... | 0.6461886 | 1 |
run the treatment to find the best optimized trip | def run_travel_optimisation(trip_start_date, is_min_co2_search = False, is_force_compute = False):
waypoint_co2 = {}
waypoint_durations = {}
# get all prefectures referential
db_connector = Connector()
with db_connector:
results = db_connector.execute_query(sql.SQL_GET_ALL_PREFECTURE)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(keep_best_count, mutation_factor, rounds, target, stagnate):\n ways = [range(len(DISTANCES))]\n result = {'round':0,'cost':None}\n for i in range(rounds):\n ways = mutate(ways,mutation_factor)\n best = []\n for way in ways:\n best.append((rate(way),way))\n b... | [
"0.63218904",
"0.61972904",
"0.6169025",
"0.61457384",
"0.6127374",
"0.6114031",
"0.61111933",
"0.6098055",
"0.6070049",
"0.59788996",
"0.5967203",
"0.59510565",
"0.59407514",
"0.592666",
"0.59220177",
"0.59083986",
"0.5891103",
"0.5867732",
"0.58462054",
"0.5821583",
"0.5808... | 0.66106296 | 0 |
A detail mask aimed at preserving as much detail as possible within darker areas, even if it winds up being mostly noise. Currently still in the beta stage. Please report any problems or feedback in the IEW Discord (link in the README). | def detail_mask(clip: vs.VideoNode, sigma: float = 1.0,
detail_brz: int = 2500, lines_brz: int = 4500,
blur_func: Callable[[vs.VideoNode, vs.VideoNode, float],
vs.VideoNode] = core.bilateral.Bilateral, # type: ignore
edgemask_func: Cal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detail_mask(clip: vs.VideoNode,\n sigma: float = 1.0, rxsigma: List[int] = [50, 200, 350],\n pf_sigma: Optional[float] = 1.0, brz: Tuple[int, int] = (2500, 4500),\n rg_mode: int = 17) -> vs.VideoNode:\n bits, clip = _get_bits(clip)\n\n clip_y = get_y(clip)\n ... | [
"0.6744177",
"0.6162785",
"0.5764795",
"0.57113755",
"0.5619119",
"0.5591956",
"0.55528414",
"0.5439838",
"0.5388877",
"0.5359994",
"0.53350973",
"0.5329711",
"0.53266764",
"0.5312776",
"0.5301313",
"0.53009886",
"0.528899",
"0.52745306",
"0.5253635",
"0.524269",
"0.52235794"... | 0.7183847 | 0 |
Basic f3kdb debanding with detail mask | def masked_f3kdb(clip: vs.VideoNode,
rad: int = 16,
thr: Union[int, List[int]] = 24,
grain: Union[int, List[int]] = [12, 0],
mask_args: Dict[str, Any] = {},
show_mask: bool = False) -> vs.VideoNode:
from debandshit import dumb3kdb
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def masked_f3kdb(clip: vs.VideoNode,\n rad: int = 16,\n thr: Union[int, List[int]] = 24,\n grain: Union[int, List[int]] = [12, 0],\n mask_args: Dict[str, Any] = {}\n ) -> vs.VideoNode:\n from debandshit import dumb3kdb\n\n deb_ma... | [
"0.6515873",
"0.5664402",
"0.5623513",
"0.5446228",
"0.5435592",
"0.54205436",
"0.5417482",
"0.5377387",
"0.53754604",
"0.5362974",
"0.53250283",
"0.5313903",
"0.5280633",
"0.52528965",
"0.52442676",
"0.5219819",
"0.5216879",
"0.5213123",
"0.5209505",
"0.52039033",
"0.5188259... | 0.650098 | 1 |
Set the indicated geometry to be used as a proxy for the NodePath. Tag all descendant NodePaths with the ignore tag so they don't show up in the scene graph and cannot be selected. | def SetEditorGeometry( cls, geo ):
for childNp in geo.findAllMatches( '**' ):
childNp.setPythonTag( TAG_IGNORE, True )
geo.setLightOff()
geo.node().adjustDrawMask( *base.GetEditorRenderMasks() )
cls.geo = geo | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_geometry(self, selection_name, geometry):",
"def setSourceGeometry(self, *args):\n return _osgAnimation.RigGeometry_setSourceGeometry(self, *args)",
"def handle(self, geometry, fields=None, tags=None, id=None):\n pass",
"def exclude_nodes(self, nodes):",
"def setGeometryWrapper(self, ... | [
"0.5557034",
"0.52357733",
"0.48903382",
"0.4886184",
"0.4854586",
"0.48517445",
"0.48221344",
"0.48015222",
"0.47102425",
"0.47086805",
"0.46750647",
"0.45795387",
"0.45438376",
"0.45352253",
"0.4516824",
"0.4505609",
"0.44994342",
"0.4485186",
"0.4480443",
"0.44744867",
"0.... | 0.60783523 | 0 |
Remove the bounding box from the indicated node. | def OnDeselect( self ):
bbox = self.data.getPythonTag( TAG_BBOX )
if bbox is not None:
bbox.lines.removeNode()
self.data.clearPythonTag( TAG_BBOX ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeNode(self, node):",
"def remove_node(self, node):\n try:\n self._nodes.remove(node)\n del self._weights[node]\n except (KeyError, ValueError):\n pass\n self._rebuild_circle()",
"def remove_box(self, timeout=4):\n\n # Remove box from scene\n... | [
"0.67073244",
"0.6649052",
"0.65911657",
"0.6475848",
"0.6444238",
"0.6330156",
"0.6330099",
"0.63062084",
"0.6247503",
"0.62142473",
"0.61135864",
"0.6050176",
"0.6040413",
"0.6010252",
"0.6005553",
"0.59766144",
"0.5968444",
"0.59395164",
"0.59223753",
"0.5887153",
"0.58828... | 0.67836523 | 0 |
Return a list of wrappers for the children of this NodePath, ignoring those NodePaths tagged with TAG_IGNORE (like editor only geometry). | def GetChildren( self ):
children = [
cWrpr
for cWrpr in GameNodePath.GetChildren( self )
if not cWrpr.data.getPythonTag( TAG_IGNORE )
]
return children | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children(self):\r\n descendants = self.q(css=self._bounded_selector(self.BODY_SELECTOR)).map(\r\n lambda el: XBlockWrapper(self.browser, el.get_attribute('data-locator'))).results\r\n\r\n # Now remove any non-direct descendants.\r\n grandkids = []\r\n for descendant in de... | [
"0.6578318",
"0.64358324",
"0.6434924",
"0.6386809",
"0.63590413",
"0.63370013",
"0.63131684",
"0.62975323",
"0.6243124",
"0.6243124",
"0.62204456",
"0.6211949",
"0.62092155",
"0.6138754",
"0.6087848",
"0.6038856",
"0.6022106",
"0.6013068",
"0.5992584",
"0.5990325",
"0.599032... | 0.7566471 | 0 |
Returns a hexadecimal hash string of alphanumeric characters, given a digest list of integers ranging from 0 to 15. | def createHashcodeString(digest):
map_num2hex = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]
hashcodelist = [None] * len(digest)
for i1 in range(0, len(digest)):
digest_i = digest[i1] # Extracts the number from the digest.
hashco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hexdigest(self):\n return \"\".join(\"%02x\" % ord(x)\n for x in MegaCrypto.a32_to_str(self.digest()))",
"def hexdigest(self):\r\n return ''.join(['%02x' % ord(c) for c in self.digest()])",
"def hex_form(hash):\n final_hash = ''\n for i in range(len(hash)):... | [
"0.7094934",
"0.697",
"0.6936587",
"0.68342865",
"0.6823453",
"0.672896",
"0.67160213",
"0.66865003",
"0.6600243",
"0.65778923",
"0.6539398",
"0.65271586",
"0.65100735",
"0.64940983",
"0.6455862",
"0.6446388",
"0.6443029",
"0.6424878",
"0.6346973",
"0.6336623",
"0.6320517",
... | 0.73361576 | 0 |
Prints a 4 x 4 x 4 grid of alphanumeric hexadecimal characters, representing a 64 character hash string. | def hashcodeGrid4x4x4(hashcodestring):
hashcodegrid = [" "," "," "," "]
i1 = 0
while i1 < 64: # every character.
linenum = int(i1/16) # every 16th character.
if i1 % 4 == 3: # every 4th character.
hashcodegrid[linenum] = hashcodegrid[linenum] + hashcodestring[i1] + " "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triple_hash():\r\n board_format_1 = ' # #'\r\n print(board_format_1,'\\n',board_format_1,'\\n',board_format_1,'\\n',board_format_1,sep='')",
"def print_as_hex(s):\n print(\":\".join(\"{0:x}\".format(ord(c)) for c in s))",
"def str_bl... | [
"0.73230183",
"0.6553774",
"0.647367",
"0.63701504",
"0.6346509",
"0.6283754",
"0.62465835",
"0.6246272",
"0.62359357",
"0.62157315",
"0.62066936",
"0.6160292",
"0.6153152",
"0.6134926",
"0.60704553",
"0.60641307",
"0.60232943",
"0.60153383",
"0.6015069",
"0.5963655",
"0.5936... | 0.7693262 | 0 |
Returns an estimated time to compute a hash of a given meal string. The relationship is known to be linear. | def approximateTime(meal):
RATE = 4.2535969274764765e-05 # seconds per character.
time = len(meal)**1 * RATE
return time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fasthash(string):\r\n md4 = hashlib.new(\"md4\")\r\n md4.update(string)\r\n return md4.hexdigest()",
"def compute_ahash(im):\n return imagehash.average_hash(ensure_pil(im))",
"def computeHash(string):\n\tif isBytes(string):\n\t\tstring = string.decode(\"latin-1\")\n\thash_ = 63689\n\tfor char in ... | [
"0.5998406",
"0.5910803",
"0.58632004",
"0.57902205",
"0.57792366",
"0.57287246",
"0.56960714",
"0.5692423",
"0.5654419",
"0.5647884",
"0.5603353",
"0.5585719",
"0.5574575",
"0.55616933",
"0.5538439",
"0.552733",
"0.5504498",
"0.5493598",
"0.5462571",
"0.5462571",
"0.54422927... | 0.6610017 | 0 |
Returns a meal as a string of binary ones and zeros, from any file. | def prepareMealFromFile(filepath="meal.txt"):
print(f'Reading file: {filepath}')
if os.path.isfile(filepath):
pass
else:
print("<!> File `meal.txt` does not exist in the same directory.\n",
"To hash a file, make a copy of it in the same directory and rename it `meal.txt`.\n",
"To hash... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fable_string():\n f = open(\"fable.txt\", \"r\")\n fable = str(f.read())\n f.close()\n return fable",
"def get_binary(fname):\n with open(fname, 'rb+') as f_name:\n data = f_name.read()\n return data",
"def binary_conversion():\n file = filedialog.askopenfilename(title=\"Sel... | [
"0.5746603",
"0.5696758",
"0.567141",
"0.5485663",
"0.5281613",
"0.5186432",
"0.50696915",
"0.5036623",
"0.5021605",
"0.4939437",
"0.49322963",
"0.4909681",
"0.48907858",
"0.48510703",
"0.48486638",
"0.48427978",
"0.48117",
"0.4770185",
"0.47694293",
"0.4741271",
"0.4735175",... | 0.6451005 | 0 |
Prepares a meal as a string, from a string input. | def prepareMealFromString(string=""):
binstring = ""
for char in string:
binstring += bin(ord(char))
binstring = binstring.replace("b","10")
stringSuffix = "10"*128 # filler string of length 256.
# Adds enough filler string to be multiple of 256:
binstring += stringSuffix[:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use(self):\n return_string = ''\n item = input(f\"What do you want to use?\\n>\")\n if item in self.backpack:\n if self.backpack[item].type is \"Food\":\n if (self.health + self.backpack[item].heal_amount) > standard_health:\n self.health = stan... | [
"0.52457756",
"0.52341306",
"0.52079",
"0.51887935",
"0.5147375",
"0.5129352",
"0.50841486",
"0.49804473",
"0.49507144",
"0.49326622",
"0.49236405",
"0.49113765",
"0.4893361",
"0.48698086",
"0.4859769",
"0.48490328",
"0.4834685",
"0.48322466",
"0.48027813",
"0.48002502",
"0.4... | 0.55761516 | 0 |
Returns a list of equally long partitions of a very large meal string. Helps with frequent feedback between hashing partitions, such as print statements of estimated time left. | def splitUpMeal(bigmeal, max_multiple=16):
batch_size = 256 * max_multiple # 4096
stringSuffix = "10" * int(batch_size/2) # filler string of length 256.
# Adds enough filler string to be multiple of 256:
bigmeal += stringSuffix[:((len(stringSuffix)-len(bigmeal))%len(stringSuffix))]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rabin_partition(strlength=3e5,iter=20):\n from tqdm import tqdm\n from random import choice\n from string import ascii_lowercase\n longstr_rand = ''.join([choice(ascii_lowercase) for _ in xrange(int(strlength))])\n\n print(\"*rabin_partition* test completed.\")\n print(\"Mac Air baseline... | [
"0.5848919",
"0.5824159",
"0.5797886",
"0.5607199",
"0.5579995",
"0.55390054",
"0.5523368",
"0.54932624",
"0.5488904",
"0.54218626",
"0.5420226",
"0.5385941",
"0.5372967",
"0.53622735",
"0.53474617",
"0.53345776",
"0.5317274",
"0.5264612",
"0.52530104",
"0.524188",
"0.5222551... | 0.59791046 | 0 |
Returns a string made of characters returned from the nom() function, derived from the input meal string. | def nibble(meal):
broth = ""
for i1 in range(-len(meal), 0):
broth += nom(meal, i1)
return broth | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metaphlan_krona_string(input):\n s = []\n for f in input:\n name = bn(f).replace(\"_pe.krona\", \"\").replace(\"_se.krona\", \"\")\n s.append(f\"{f},{name}\")\n return \" \".join(s)",
"def calc_conservation_string(aln):\n\n percids = calc_conservation(aln)\n\n # find identity pos... | [
"0.5829242",
"0.57954675",
"0.5787559",
"0.5646823",
"0.5590917",
"0.5553596",
"0.55516875",
"0.5546972",
"0.5538934",
"0.5493616",
"0.5491828",
"0.5449877",
"0.5442809",
"0.54367405",
"0.5409349",
"0.53820056",
"0.5377484",
"0.53754056",
"0.5363218",
"0.5350802",
"0.5318482"... | 0.58090675 | 1 |
Generic arch makefile generation | def _edit_arch_generic(self, spec, prefix):
m64 = "-m64 " if not spec.satisfies("arch=aarch64:") else ""
with working_dir("arch"):
with open("{0}.arch".format(self.build_directory), "w") as fh:
# this options are take from the default provided
# configuration ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _edit_arch_target_based(self, spec, prefix):\n if spec.version < Version(\"2.14\"):\n return False\n\n found_special_opt = False\n with working_dir(\"arch\"):\n arch_filename = \"{0}.arch\".format(self.build_directory)\n\n replace = [\n [r\"^... | [
"0.66132593",
"0.64670676",
"0.60003257",
"0.5770383",
"0.5656904",
"0.5644668",
"0.56091577",
"0.5558116",
"0.5516897",
"0.5486528",
"0.545039",
"0.5429227",
"0.5375775",
"0.5373423",
"0.5367326",
"0.5352794",
"0.52899176",
"0.52593476",
"0.52494675",
"0.52058375",
"0.518408... | 0.65696543 | 1 |
Try to use target base arch file return True if succeed | def _edit_arch_target_based(self, spec, prefix):
if spec.version < Version("2.14"):
return False
found_special_opt = False
with working_dir("arch"):
arch_filename = "{0}.arch".format(self.build_directory)
replace = [
[r"^CHARMARCH = .*$", "CH... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matchDLLArch(filename):\n # TODO: check machine type on other platforms?\n if not is_win:\n return True\n\n global _exe_machine_type\n try:\n if _exe_machine_type is None:\n pefilename = sys.executable # for exception handling\n exe_pe = pefile.PE(sys.executable... | [
"0.6372178",
"0.63015664",
"0.62620646",
"0.6227419",
"0.60927576",
"0.595733",
"0.59508365",
"0.5909251",
"0.5867729",
"0.585151",
"0.58258724",
"0.5811928",
"0.5806449",
"0.5793847",
"0.5756409",
"0.57173747",
"0.57158715",
"0.57156146",
"0.5686355",
"0.5663708",
"0.5651367... | 0.7133018 | 0 |
Try to use target base arch file, if not make generic | def _edit_arch(self, spec, prefix):
if not self._edit_arch_target_based(spec, prefix):
self._edit_arch_generic(spec, prefix) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _edit_arch_target_based(self, spec, prefix):\n if spec.version < Version(\"2.14\"):\n return False\n\n found_special_opt = False\n with working_dir(\"arch\"):\n arch_filename = \"{0}.arch\".format(self.build_directory)\n\n replace = [\n [r\"^... | [
"0.67025477",
"0.61866486",
"0.6135039",
"0.6099733",
"0.607953",
"0.60631764",
"0.59351593",
"0.591413",
"0.58911556",
"0.5644941",
"0.56360906",
"0.55722624",
"0.55598074",
"0.5516818",
"0.5463256",
"0.54525524",
"0.54238904",
"0.540248",
"0.53883713",
"0.53727734",
"0.5338... | 0.66130894 | 1 |
Returns which crashes, per process type, to expect for the current test. | def GetExpectedCrashes(self, args: ct.TestArgs) -> None:
# args[0] is the PixelTestPage for the current test.
return args[0].expected_per_process_crashes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_number_of_crashes(result_info):\n assert isinstance(result_info, dict)\n # FIXME: We can't use analyse.get_generic_run_outcomes()\n # because we can't distinguish between a crash and an out\n # of memory situation properly\n #reports = analyse.get_generic_run_outcomes(result_info)\n is_me... | [
"0.6029878",
"0.57157075",
"0.5680796",
"0.5641099",
"0.5608145",
"0.54180264",
"0.53164726",
"0.52977693",
"0.52697",
"0.5251127",
"0.5213071",
"0.52107084",
"0.5172969",
"0.507468",
"0.50737274",
"0.50737274",
"0.50261766",
"0.50022787",
"0.4961809",
"0.49606964",
"0.489261... | 0.6754982 | 0 |
Redefines the equality of two students | def __eq__(self, student):
return self._name == student.name and self._id == student.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testEquality(self):\n pass",
"def __eq__(self, other) -> bool:\n return self.Firstname == other.Firstname and self.LastName == other.LastName",
"def values_eq(self, a, b):\r\n return a == b",
"def __eq__(self, other):\n return self.last_name == other.last_name and self.first_n... | [
"0.6642896",
"0.6422823",
"0.6229069",
"0.6163894",
"0.6156336",
"0.6145491",
"0.61214024",
"0.6109804",
"0.6083521",
"0.6077614",
"0.60670024",
"0.60249925",
"0.6006494",
"0.5990848",
"0.59903526",
"0.5989171",
"0.59632444",
"0.5955506",
"0.5955506",
"0.59436864",
"0.5941095... | 0.7327372 | 0 |
Partial string matching for student names | def partialMatch(self, studentName):
if studentName.lower() in self._name.lower():
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_student_by_full_name(self, full_name):\n name_list = full_name.split(\" \")\n for student in self.students:\n if student.first_name == name_list[0]:\n if student.last_name == name_list[1]:\n print(student.first_name, student.last_name + \" found i... | [
"0.70432377",
"0.6474987",
"0.61826646",
"0.61185604",
"0.606824",
"0.6064135",
"0.5994872",
"0.5994481",
"0.59266704",
"0.5920981",
"0.59167755",
"0.59167755",
"0.59043527",
"0.58957773",
"0.5859096",
"0.58543575",
"0.58462363",
"0.58178115",
"0.5772263",
"0.5743612",
"0.572... | 0.7899588 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.