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 |
|---|---|---|---|---|---|---|
Returns a list of fit ranges for any number of Lorentzians. | def find_all_fit_ranges(lorentz_params_array):
f_low_stop_list = []
f_low_list = []
f_high_list = []
f_high_stop_list = []
for i in range(0, lorentz_params_array.shape[0]):
fit_range = find_single_fit_range(lorentz_params_array[i])
f_low_stop_list.append(fit_range[0])
f_low_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_partitioned_fit_ranges(lorentz_params_list):\n fit_range_list = []\n for a in lorentz_params_list:\n fit_range_list.append(find_full_fit_range(a))\n return fit_range_list",
"def find_full_fit_range(lorentz_params_array):\n (f_low_stop_list, f_low_list, f_high_list,\n f_high_stop_l... | [
"0.7285226",
"0.6762786",
"0.6399311",
"0.625972",
"0.6222026",
"0.6214888",
"0.6120783",
"0.60093063",
"0.59800434",
"0.5979426",
"0.59106266",
"0.5847486",
"0.57940626",
"0.57646203",
"0.5736512",
"0.5649675",
"0.5635029",
"0.5615303",
"0.5611636",
"0.5535063",
"0.55102885"... | 0.74051803 | 0 |
Counts how many Lorentzians from the 2D array are within the fit range. | def count_lorentz(fit_range, lorentz_array_2d):
counter = 0
for i in range(0, lorentz_array_2d.shape[0]):
f0 = lorentz_array_2d[i][1]
if f0 > fit_range[1] and f0 < fit_range[2]:
counter += 1
return counter | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_carnivores_island(self):\n return np.sum(self.carnivores_on_island)",
"def number_of_herbivores_island(self):\n return np.sum(self.herbivores_on_island)",
"def get_count_life_neighbor(arr, x, y, max_x, max_y):\n\tres_count = 0\n\n\tif x > 0 and y > 0:\n\t\tif arr[y-1][x-1]:\n\t\t\tr... | [
"0.64254093",
"0.62938917",
"0.6275392",
"0.6262897",
"0.62277997",
"0.62054366",
"0.6147678",
"0.61383504",
"0.61025006",
"0.6095924",
"0.60285074",
"0.60267067",
"0.6000353",
"0.5997132",
"0.5992748",
"0.59711856",
"0.5967242",
"0.5965536",
"0.5950054",
"0.5948882",
"0.5925... | 0.8557343 | 0 |
Returns a list of fit ranges from the provided Lorentzians. | def find_partitioned_fit_ranges(lorentz_params_list):
fit_range_list = []
for a in lorentz_params_list:
fit_range_list.append(find_full_fit_range(a))
return fit_range_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_all_fit_ranges(lorentz_params_array):\n f_low_stop_list = []\n f_low_list = []\n f_high_list = []\n f_high_stop_list = []\n for i in range(0, lorentz_params_array.shape[0]):\n fit_range = find_single_fit_range(lorentz_params_array[i])\n f_low_stop_list.append(fit_range[0])\n ... | [
"0.7114713",
"0.6613891",
"0.62306076",
"0.6074389",
"0.60542375",
"0.60019",
"0.59878093",
"0.59852135",
"0.59066486",
"0.58930117",
"0.5688445",
"0.5572674",
"0.5557901",
"0.55060256",
"0.5499172",
"0.54491556",
"0.54483145",
"0.5432008",
"0.5429985",
"0.5427089",
"0.539192... | 0.7012187 | 1 |
Determines if the provided fit ranges are violated. | def evaluate_fit_range(predicted, fit_range):
test1 = (predicted[0] >= fit_range[0])
test2 = (predicted[0] <= fit_range[1])
test3 = (predicted[1] >= fit_range[2])
test4 = (predicted[1] <= fit_range[3])
return all([test1, test2, test3, test4]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isRangeValid(self) -> bool:\n ...",
"def evaluate_all_fit_ranges(predicted, fit_range_list):\n tests = []\n for i in range(0, len(fit_range_list)):\n tests.append(evaluate_fit_range(predicted[i], fit_range_list[i]))\n return all(tests)",
"def ValidClusterRanges(self):\n for cl... | [
"0.702363",
"0.6886986",
"0.6535017",
"0.6515546",
"0.6502272",
"0.6481691",
"0.64424205",
"0.63215506",
"0.6296414",
"0.6291332",
"0.6241599",
"0.6162144",
"0.61491084",
"0.61299",
"0.6125228",
"0.61192054",
"0.61125624",
"0.610297",
"0.6079883",
"0.606156",
"0.6038077",
"... | 0.72874916 | 0 |
Given a list of fit ranges, will check all of them to see how much they overlap and are violated. | def evaluate_all_fit_ranges(predicted, fit_range_list):
tests = []
for i in range(0, len(fit_range_list)):
tests.append(evaluate_fit_range(predicted[i], fit_range_list[i]))
return all(tests) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_fit_range(predicted, fit_range):\n test1 = (predicted[0] >= fit_range[0])\n test2 = (predicted[0] <= fit_range[1])\n test3 = (predicted[1] >= fit_range[2])\n test4 = (predicted[1] <= fit_range[3])\n return all([test1, test2, test3, test4])",
"def range_overlap(ranges):\n max_left =... | [
"0.68485665",
"0.67510664",
"0.65680766",
"0.64209783",
"0.6261407",
"0.622884",
"0.6220859",
"0.6183473",
"0.6152111",
"0.615113",
"0.60441506",
"0.603964",
"0.60261244",
"0.60047334",
"0.59990096",
"0.5998286",
"0.59801865",
"0.59584326",
"0.5942634",
"0.5936842",
"0.593636... | 0.761391 | 0 |
Normalizes indices around the provided scale values. | def normalize_index(x, input_scale, output_scale):
return np.round(x / input_scale[2] * output_scale[2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(dataset):\n minVals = dataset.min(axis=0)\n maxVals = dataset.max(axis=0)\n factors = maxVals-minVals\n num = dataset.shape[0]\n norm_data = (dataset - np.tile(minVals,(num,1)))/np.tile(factors,(num,1)) \n return norm_data",
"def normalize(vals):\n min_val = torch.min(vals)\n ... | [
"0.6454586",
"0.63452435",
"0.6282466",
"0.625563",
"0.62407726",
"0.62047225",
"0.61790663",
"0.613382",
"0.61121345",
"0.6079454",
"0.6032364",
"0.6022773",
"0.60184497",
"0.60176563",
"0.6017227",
"0.6015516",
"0.6005191",
"0.5973479",
"0.5970328",
"0.59555286",
"0.5935252... | 0.7172047 | 0 |
Separates all data from the provided list of data arrays. | def separate_all_data(data_arrays_list):
separated_data_list = []
for i in range(0, len(data_arrays_list)):
separated_data_list.append(separate_data(data_arrays_list[i]))
return separated_data_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_data_into_input_and_output(data):\n data_in, data_out = list(zip(*[((x[\"synopsis\"]), x[\"gross\"]) for x in data]))\n return np.array(data_in), np.array(data_out)",
"def split_data(data):\n data_values = []\n target_drugs = []\n cell_lines = []\n states = []\n replicates = []\n ... | [
"0.6662969",
"0.6148002",
"0.61327296",
"0.6129852",
"0.6123791",
"0.6101107",
"0.6041561",
"0.60198987",
"0.59998",
"0.59608936",
"0.595544",
"0.5935175",
"0.5929865",
"0.5928099",
"0.5910257",
"0.5870998",
"0.5863196",
"0.58493555",
"0.5829964",
"0.58066344",
"0.57978094",
... | 0.8171554 | 0 |
Equalizes the provided data with the provided labels. | def equalize_data(class_labels, class_data):
a1 = class_data[np.where(class_labels == 1)[0]]
a2 = class_data[np.where(class_labels == 2)[0]]
max_len = min(len(a1), len(a2))
a1 = a1[0:max_len]
a2 = a2[0:max_len]
arr = np.concatenate((a1, a2))
b1 = np.ones((max_len, 1)) * 0
b2 = np.ones((m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit(self, data: np.array, labels: np.array):\n raise NotImplementedError",
"def match_data(self, datasets):\n raise NotImplementedError",
"def shuffle_data(data, labels):\n idx = np.arange(len(labels))\n np.random.shuffle(idx)\n return data[idx], labels[idx]",
"def test_keep_labels... | [
"0.60097593",
"0.5801564",
"0.5799009",
"0.57169294",
"0.56686497",
"0.56124026",
"0.55428267",
"0.5529858",
"0.5524994",
"0.5492298",
"0.5490576",
"0.5490576",
"0.5490576",
"0.54689044",
"0.54631615",
"0.5447162",
"0.54461753",
"0.54271036",
"0.54227924",
"0.541604",
"0.5413... | 0.73087734 | 0 |
Zooms in on the data from the provided array given the start and end values (not indices). | def scale_zoom(x, start, end):
length = len(x)
start_index = int(np.round(length * start))
end_index = int(np.round(length * end))
if start_index >= end_index:
if start_index <= 3:
start_index = 0
end_index = 3
else:
start_index = end_index - 3
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zoom(self, xmin, xmax, xlen, ymin, ymax, ylen):\n self.xmax = xmax\n self.xmin = xmin\n self.xmax = xmax\n self.xlen = xlen\n self.ymin = ymin\n self.ymax = ymax\n self.ylen = ylen\n self.refresh()",
"def zoom(x, zoom_range=(0.9, 1.1), flags=None, borde... | [
"0.6253182",
"0.59934676",
"0.59080833",
"0.5736605",
"0.5712007",
"0.57052714",
"0.5656563",
"0.5629115",
"0.5567505",
"0.55253446",
"0.55196124",
"0.546359",
"0.54413986",
"0.5434951",
"0.5418681",
"0.5418158",
"0.54119253",
"0.5409303",
"0.5391146",
"0.53810525",
"0.537543... | 0.7182224 | 0 |
This method creates sample objects with id, list of genes values and label. Finally adds each object into a set. | def create_samples(self):
for s_id in range(len(self.data["sample"])):
self.samples.add(Sample(s_id, [self.data[key][s_id] for key in self.data.keys() if key not in WRONG_KEYS],
self.data["label"][s_id])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_samples(self):\n sample_list = []\n genes = []\n for record in range(len(self.data_dict[\"samples\"])):\n sample_id = self.data_dict[\"samples\"][record]\n genes_cols = list(self.data_dict.keys())[2:]\n for gene in genes_cols:\n genes.... | [
"0.6535915",
"0.61899817",
"0.6138435",
"0.6101976",
"0.5932322",
"0.5857315",
"0.58382785",
"0.5779062",
"0.5770248",
"0.57271856",
"0.57156974",
"0.57156974",
"0.57156974",
"0.57156974",
"0.56949335",
"0.5678384",
"0.5673562",
"0.5673562",
"0.5673562",
"0.5671993",
"0.56710... | 0.70887476 | 0 |
bert_out [batch_size, num_pieces, bert_dim] ner_labels [batch_size, num_tokens, num_tokens] logits [batch_size, num_entities_max, bert_bim or cell_dim 2] num_entities [batch_size] | def _get_entities_representation(self, bert_out: tf.Tensor, ner_labels: tf.Tensor) -> Tuple[tf.Tensor, tf.Tensor]:
# dropout
bert_out = self.bert_dropout(bert_out, training=self.training_ph)
# pieces -> tokens
x = tf.gather_nd(bert_out, self.first_pieces_coords_ph) # [batch_size, num_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_entities_representation(self, bert_out: tf.Tensor, ner_labels: tf.Tensor) -> Tuple[tf.Tensor, tf.Tensor]:\n # dropout\n bert_out = self.bert_dropout(bert_out, training=self.training_ph)\n\n # pieces -> tokens\n x = tf.gather_nd(bert_out, self.first_pieces_coords_ph) # [batch_s... | [
"0.7017721",
"0.65414536",
"0.64125735",
"0.641119",
"0.63961434",
"0.6274954",
"0.626673",
"0.6253104",
"0.6248822",
"0.62403977",
"0.61421293",
"0.61392903",
"0.6130086",
"0.60804313",
"0.60351855",
"0.6006601",
"0.59186924",
"0.5911412",
"0.58631665",
"0.585489",
"0.585234... | 0.6839857 | 1 |
Initialize the parameters of the redshift distribution | def __init__(self, *args, gals_per_arcmin2=1.0, zmax=10.0, **kwargs):
self._norm = None
self._gals_per_arcmin2 = gals_per_arcmin2
super(redshift_distribution, self).__init__(*args, zmax=zmax, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initializeDistribution(self):\n self.convertToDistrDict['Legendre'] = self.convertLegendreToUniform\n self.convertToQuadDict ['Legendre'] = self.convertUniformToLegendre\n self.measureNormDict ['Legendre'] = self.stdProbabilityNorm\n self.convertToDistrDict['ClenshawCurtis'] = s... | [
"0.684462",
"0.65190303",
"0.6467644",
"0.6275441",
"0.62404406",
"0.6174671",
"0.6133149",
"0.61111027",
"0.61059797",
"0.6104147",
"0.6081232",
"0.6081232",
"0.60739183",
"0.6056392",
"0.6048688",
"0.6048617",
"0.6014442",
"0.5999496",
"0.59946394",
"0.59822905",
"0.5981397... | 0.71920824 | 0 |
Computes the normalized n(z) | def __call__(self, z):
if self._norm is None:
self._norm = simps(lambda t: self.pz_fn(t), 0.0, self.config["zmax"], 256)
return self.pz_fn(z) / self._norm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normP(z):\n a = abs(float(z))\n if a >= 8.3:\n sum = 0.5\n else:\n sum2 = term = a * normZ(a)\n z2 = a*a\n sum = 0.0\n i = 1.0\n while sum != sum2:\n sum = sum2\n i += 2.0\n term *= z2 / i\n sum2 += term\n if z >=... | [
"0.7281957",
"0.6819332",
"0.67382604",
"0.6712397",
"0.66859823",
"0.660855",
"0.6581884",
"0.6580511",
"0.6570861",
"0.6551349",
"0.6547544",
"0.64813066",
"0.6470022",
"0.64322037",
"0.64217",
"0.64180964",
"0.6399796",
"0.6372825",
"0.6364685",
"0.63618666",
"0.6342491",
... | 0.683296 | 1 |
Sends a command to the controller and reads response till sentinel. ... | async def send_command(self, message, sentinel=None):
content = None
reader = None
writer = None
try:
reader, writer = await asyncio.open_connection(self.ip, self.port)
await reader.readuntil('Shade Controller'.encode())
writer.write(message.encode()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_command(command):\n send_command(command)\n # time.sleep(0.1) # may be required on slow machines\n response = get_response()\n print(\"Rcvd: <<< \" + response)\n return response",
"def do_command(command):\n send_command(command)\n response = get_response()\n print(\"Rcvd: <<< \\n\... | [
"0.7318585",
"0.7268756",
"0.7256673",
"0.71035695",
"0.7073737",
"0.70539814",
"0.6737549",
"0.66912174",
"0.6677075",
"0.6671855",
"0.6647288",
"0.66217965",
"0.65874344",
"0.65237653",
"0.65228593",
"0.6515189",
"0.6495269",
"0.64013916",
"0.638553",
"0.63659376",
"0.63586... | 0.7291226 | 1 |
Returns a shade or list of shades by id, name or room. ... | def get_shade(self, name=None, id=None, room=None):
if(name):
return self.shades[name] if name in self.shades else None
if(id):
return next((v for (k,v) in self.shades.items() if v.id == id), None)
if(room):
return [value for (key, value) in self.shades.item... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_shading(idf):\n shading_types = [\n 'SHADING:ZONE:DETAILED',\n ]\n shading = []\n for shading_type in shading_types:\n shading.extend(idf.idfobjects[shading_type])\n\n return shading",
"def _get_shading(idf):\n shading_types = [\"SHADING:ZONE:DETAILED\", \"SHADING:SITE:DE... | [
"0.6397236",
"0.6340739",
"0.54618305",
"0.5227301",
"0.51006895",
"0.5088018",
"0.50390553",
"0.4937814",
"0.4921498",
"0.4903132",
"0.48849708",
"0.48353836",
"0.48347652",
"0.4829977",
"0.4819395",
"0.4765281",
"0.4754795",
"0.4750929",
"0.47332567",
"0.4720043",
"0.470979... | 0.87231266 | 0 |
Returns a scene by id, name. ... | def get_scene(self, name=None, id=None):
if(name):
return self.scenes[name] if name in self.scenes else None
if(id):
return next((v for (k,v) in self.scenes.items() if v.id == id), None)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_scene(self, id):\n if not isinstance(id, int):\n id = int(id)\n payload = self.get('data_request?id=scene&action=list&scene=%d&output_format=json' % id)\n return payload",
"def get_scene(self, label: str) -> Scene:\r\n return self._get_resource(label, self._scenes, ... | [
"0.75645673",
"0.6810093",
"0.67390275",
"0.6410099",
"0.63792884",
"0.6325701",
"0.6316916",
"0.6302579",
"0.62926245",
"0.6202763",
"0.61154115",
"0.60161304",
"0.5944256",
"0.58407444",
"0.5816475",
"0.57812643",
"0.569572",
"0.5652859",
"0.5634631",
"0.56111723",
"0.55534... | 0.80932325 | 0 |
Returns a room by id, name. ... | def get_room(self, name=None, id=None):
if(name):
return self.rooms[name] if name in self.rooms else None
if(id):
return next((v for (k,v) in self.rooms.items() if v.id == id), None)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_room_by_id(self, id):\n if not isinstance(id, int):\n id = int(id)\n if self.rooms.has_key(id):\n return self.rooms[id]\n raise RuntimeError, \"Room not known\"",
"def getRoomById(self, id):\n for room in self.rooms:\n if room.id == id:\n ... | [
"0.7797739",
"0.77863914",
"0.77051705",
"0.75168824",
"0.74997234",
"0.7433976",
"0.73123324",
"0.7082925",
"0.69859445",
"0.6925302",
"0.6741494",
"0.6669315",
"0.6657263",
"0.6575138",
"0.6530603",
"0.6472281",
"0.63832384",
"0.6358689",
"0.6310027",
"0.629031",
"0.6273129... | 0.81214106 | 0 |
Moves a shade to a certain level ... | async def set_level(self, hd_value):
if "up" == hd_value:
move_value = 255
elif "down" == hd_value:
move_value = 0
else:
if hd_value.isdigit():
move_value = min(int(round(int(hd_value)*255.0/100)),255)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle_shade(self,shade):\n\n # First toggle the user specified shade\n if self.shades[shade][0]:\n self.shades[shade][0] = 0\n else:\n self.shades[shade][0] = 1\n\n # Now draw the image with the active shades\n self.image.blit(self.pic,(0,0))\n f... | [
"0.60875034",
"0.5967362",
"0.56659037",
"0.56065786",
"0.55501646",
"0.54971755",
"0.5455497",
"0.5408988",
"0.5370139",
"0.536985",
"0.5331347",
"0.53241134",
"0.5312588",
"0.5311817",
"0.5307982",
"0.53076214",
"0.530625",
"0.529946",
"0.529168",
"0.5290535",
"0.52777773",... | 0.64587575 | 0 |
expects a single video_descriptors object. videos_desciptors objects are defined in IDT_feature.py fv_file is the full path to the fisher vector that is created. this single video_desc contains the (trajs, hogs, hofs, mbhs) np.ndarrays | def create_fisher_vector(gmm_list, video_desc, fv_file, fv_sqrt=False, fv_l2=False):
vid_desc_list = []
vid_desc_list.append(video_desc.traj)
vid_desc_list.append(video_desc.hog)
vid_desc_list.append(video_desc.hof)
vid_desc_list.append(video_desc.mbh)
# For each video create and normalize a fis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_video(input_file, output_file):\n with open('all-features-rbf-svm.p', 'rb') as svm_fd:\n clf = pickle.load(svm_fd)\n with open('all-features-scaler.p', 'rb') as scaler_fd:\n hog_scaler = pickle.load(scaler_fd)\n hog_parameters = HogParameters(orientations=18, pixels_per_cell=8, c... | [
"0.5853698",
"0.58261716",
"0.58009344",
"0.57504493",
"0.5748328",
"0.56914437",
"0.5660913",
"0.56450725",
"0.56331164",
"0.55929637",
"0.55355614",
"0.5513413",
"0.5511495",
"0.5501213",
"0.5457628",
"0.54356545",
"0.5407858",
"0.5399465",
"0.53928477",
"0.536543",
"0.5329... | 0.680568 | 0 |
Tests whether ``ApplicationCommandOptionMetadataNested.copy`` works as intended. | def test__ApplicationCommandOptionMetadataNested__copy():
options = [
ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),
ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),
]
option_metadata = ApplicationCommandOptionMetadataNested... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__ApplicationCommandOptionMetadataNested__copy_with__0():\n options = [\n ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),\n ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),\n ]\n \n option_metadata = ApplicationCommandO... | [
"0.82652885",
"0.79703516",
"0.780934",
"0.75012493",
"0.6400259",
"0.5888461",
"0.5698658",
"0.5678107",
"0.55697507",
"0.548862",
"0.5454601",
"0.5418766",
"0.541613",
"0.53691906",
"0.5353441",
"0.5324269",
"0.530283",
"0.5283179",
"0.52616227",
"0.5254519",
"0.5235558",
... | 0.853201 | 0 |
Tests whether ``ApplicationCommandOptionMetadataNested.copy_with`` works as intended. | def test__ApplicationCommandOptionMetadataNested__copy_with__0():
options = [
ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),
ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),
]
option_metadata = ApplicationCommandOptionMetada... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__ApplicationCommandOptionMetadataNested__copy_with__1():\n old_options = [\n ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),\n ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),\n ]\n \n new_options = [\n Applicat... | [
"0.82846016",
"0.82825077",
"0.783432",
"0.76424795",
"0.60399324",
"0.56920767",
"0.56646764",
"0.56398094",
"0.54707545",
"0.54132897",
"0.5359981",
"0.53015655",
"0.5291997",
"0.5286711",
"0.5269476",
"0.5247235",
"0.5226635",
"0.51984507",
"0.51572126",
"0.5151077",
"0.51... | 0.8415621 | 0 |
Tests whether ``ApplicationCommandOptionMetadataNested.copy_with`` works as intended. | def test__ApplicationCommandOptionMetadataNested__copy_with__1():
old_options = [
ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),
ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),
]
new_options = [
ApplicationCommandOp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__ApplicationCommandOptionMetadataNested__copy_with__0():\n options = [\n ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),\n ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),\n ]\n \n option_metadata = ApplicationCommandO... | [
"0.8415422",
"0.82816464",
"0.7833251",
"0.7641688",
"0.603807",
"0.5691608",
"0.5663075",
"0.56397116",
"0.5470525",
"0.54134774",
"0.5359175",
"0.53021",
"0.52902424",
"0.5285765",
"0.52686834",
"0.52468044",
"0.52264625",
"0.5198269",
"0.5156163",
"0.5150142",
"0.5147566",... | 0.82847905 | 1 |
Tests whether ``ApplicationCommandOptionMetadataNested.copy_with_keyword_parameters`` works as intended. | def test__ApplicationCommandOptionMetadataNested__copy_with_keyword_parameters__0():
options = [
ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),
ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),
]
option_metadata = Application... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__ApplicationCommandOptionMetadataNested__copy_with_keyword_parameters__1():\n old_options = [\n ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),\n ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),\n ]\n \n new_options = ... | [
"0.84156406",
"0.64966935",
"0.64326566",
"0.6406456",
"0.6285689",
"0.57689905",
"0.5185993",
"0.51273936",
"0.5105928",
"0.50947016",
"0.49798912",
"0.49645314",
"0.49302363",
"0.49265942",
"0.49123338",
"0.49068585",
"0.49034593",
"0.48958218",
"0.48899037",
"0.4866531",
"... | 0.8621432 | 0 |
Tests whether ``ApplicationCommandOptionMetadataNested.copy_with_keyword_parameters`` works as intended. | def test__ApplicationCommandOptionMetadataNested__copy_with_keyword_parameters__1():
old_options = [
ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),
ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),
]
new_options = [
A... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__ApplicationCommandOptionMetadataNested__copy_with_keyword_parameters__0():\n options = [\n ApplicationCommandOption('nue', 'nue', ApplicationCommandOptionType.string),\n ApplicationCommandOption('seija', 'seija', ApplicationCommandOptionType.integer),\n ]\n \n option_metadata = ... | [
"0.8621432",
"0.64966935",
"0.64326566",
"0.6406456",
"0.6285689",
"0.57689905",
"0.5185993",
"0.51273936",
"0.5105928",
"0.50947016",
"0.49798912",
"0.49645314",
"0.49302363",
"0.49265942",
"0.49123338",
"0.49068585",
"0.49034593",
"0.48958218",
"0.48899037",
"0.4866531",
"0... | 0.84156406 | 1 |
Converts field value according to Proto3 JSON Specification. | def _FieldToJsonObject(self, field, value):
if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
return self._MessageToJsonObject(value)
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM:
if self.use_integers_for_enums:
return value
if field.enum_type.full_name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_python(self, value):\r\n if value == \"\":\r\n return None\r\n\r\n try:\r\n if isinstance(value, basestring):\r\n return json.loads(value, object_hook=decode_object)\r\n except ValueError:\r\n pass\r\n\r\n return value",
"def pyth... | [
"0.67961097",
"0.6790377",
"0.6737963",
"0.6736852",
"0.6707676",
"0.6657049",
"0.66529644",
"0.65867305",
"0.6578081",
"0.65457255",
"0.65231425",
"0.6489149",
"0.6431126",
"0.6407083",
"0.6384642",
"0.62754834",
"0.6260983",
"0.6197847",
"0.6180876",
"0.614973",
"0.61275357... | 0.7200631 | 0 |
Converts Value message according to Proto3 JSON Specification. | def _ValueMessageToJsonObject(self, message):
which = message.WhichOneof('kind')
# If the Value message is not set treat as null_value when serialize
# to JSON. The parse back result will be different from original message.
if which is None or which == 'null_value':
return None
if which == 'li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ConvertValueMessage(self, value, message, path):\n if isinstance(value, dict):\n self._ConvertStructMessage(value, message.struct_value, path)\n elif isinstance(value, list):\n self._ConvertListValueMessage(value, message.list_value, path)\n elif value is None:\n message.null_value = 0... | [
"0.70455927",
"0.67580605",
"0.66462195",
"0.65693295",
"0.64589524",
"0.6401128",
"0.634685",
"0.6332219",
"0.6224827",
"0.62141585",
"0.62116534",
"0.61846167",
"0.61561126",
"0.61458415",
"0.6127548",
"0.60824424",
"0.6081679",
"0.6076701",
"0.6075578",
"0.6065006",
"0.606... | 0.7129789 | 0 |
Converts ListValue message according to Proto3 JSON Specification. | def _ListValueMessageToJsonObject(self, message):
return [self._ValueMessageToJsonObject(value)
for value in message.values] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ConvertListValueMessage(self, value, message, path):\n if not isinstance(value, list):\n raise ParseError('ListValue must be in [] which is {0} at {1}'.format(\n value, path))\n message.ClearField('values')\n for index, item in enumerate(value):\n self._ConvertValueMessage(item, me... | [
"0.7013634",
"0.685717",
"0.65037054",
"0.6291756",
"0.6090016",
"0.59357435",
"0.58841217",
"0.58276695",
"0.5822548",
"0.57320887",
"0.57257706",
"0.5724359",
"0.5719613",
"0.5713998",
"0.56724715",
"0.56446856",
"0.5631722",
"0.56274474",
"0.56192994",
"0.56081516",
"0.558... | 0.72282684 | 0 |
Converts Struct message according to Proto3 JSON Specification. | def _StructMessageToJsonObject(self, message):
fields = message.fields
ret = {}
for key in fields:
ret[key] = self._ValueMessageToJsonObject(fields[key])
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ConvertStructMessage(self, value, message, path):\n if not isinstance(value, dict):\n raise ParseError('Struct must be in a dict which is {0} at {1}'.format(\n value, path))\n # Clear will mark the struct as modified so it will be created even if\n # there are no values.\n message.Cl... | [
"0.6435233",
"0.6357753",
"0.62425196",
"0.61674505",
"0.6043727",
"0.6017806",
"0.59631026",
"0.59506017",
"0.5937487",
"0.5930762",
"0.5905",
"0.5899448",
"0.58817047",
"0.58716124",
"0.5871543",
"0.5863583",
"0.5849398",
"0.5827539",
"0.57849705",
"0.57812923",
"0.57690793... | 0.67135566 | 0 |
Creates a message from a type URL. | def _CreateMessageFromTypeUrl(type_url, descriptor_pool):
db = symbol_database.Default()
pool = db.pool if descriptor_pool is None else descriptor_pool
type_name = type_url.split('/')[-1]
try:
message_descriptor = pool.FindMessageTypeByName(type_name)
except KeyError:
raise TypeError(
'Can not... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, url, type):\n self.url = url\n self.type = type",
"def from_message_content(\n cls, content: bytes, content_type: str, **kwargs: Any\n ) -> \"MessageType\":",
"def getType(self, url):\n pass",
"def from_url(cls, url, **kwargs):\n kwargs = dict(kwargs)\... | [
"0.6026557",
"0.5703642",
"0.567676",
"0.5482758",
"0.53648317",
"0.53635514",
"0.531186",
"0.5305075",
"0.5281574",
"0.52725166",
"0.5226264",
"0.518142",
"0.5125005",
"0.5124074",
"0.5112921",
"0.5077941",
"0.5069982",
"0.5033279",
"0.5032861",
"0.4992918",
"0.4987056",
"... | 0.8195468 | 0 |
Convert a JSON representation into Any message. | def _ConvertAnyMessage(self, value, message, path):
if isinstance(value, dict) and not value:
return
try:
type_url = value['@type']
except KeyError:
raise ParseError(
'@type is missing when parsing any message at {0}'.format(path))
try:
sub_message = _CreateMessageFrom... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(message):\n try:\n return json.loads(message)\n except TypeError:\n print(\"Ignoring message because it did not contain valid JSON.\")",
"def _json_txt_to_binary(self, json_text):\n message = self.message_class()\n try:\n message = json_forma... | [
"0.6135556",
"0.60722244",
"0.5825213",
"0.5813197",
"0.5779281",
"0.57353634",
"0.5705867",
"0.56558543",
"0.5647803",
"0.56395495",
"0.56238866",
"0.5581609",
"0.55560017",
"0.5549167",
"0.5548153",
"0.55468905",
"0.5512181",
"0.55071795",
"0.5503812",
"0.5499571",
"0.54839... | 0.6200978 | 0 |
Convert a JSON representation into ListValue message. | def _ConvertListValueMessage(self, value, message, path):
if not isinstance(value, list):
raise ParseError('ListValue must be in [] which is {0} at {1}'.format(
value, path))
message.ClearField('values')
for index, item in enumerate(value):
self._ConvertValueMessage(item, message.value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ListValueMessageToJsonObject(self, message):\n return [self._ValueMessageToJsonObject(value)\n for value in message.values]",
"def to_python(self, value):\n if isinstance(value, (dict, list)):\n return value\n try:\n return json.loads(value)\n except ... | [
"0.6948909",
"0.6379288",
"0.63605946",
"0.6299422",
"0.60831195",
"0.60798275",
"0.6069047",
"0.5996719",
"0.59340507",
"0.59220725",
"0.5827064",
"0.5789415",
"0.5709988",
"0.569617",
"0.5695142",
"0.5669852",
"0.5651025",
"0.56476074",
"0.56385607",
"0.5634746",
"0.5622930... | 0.66147846 | 1 |
Convert map field value for a message map field. | def _ConvertMapFieldValue(self, value, message, field, path):
if not isinstance(value, dict):
raise ParseError(
'Map field {0} must be in a dict which is {1} at {2}'.format(
field.name, value, path))
key_field = field.message_type.fields_by_name['key']
value_field = field.messa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_value(field):\n\n if is_map(field):\n return field\n return None",
"def _transform_value_map(self, value: str, map_: dict, passthrough: bool = False) -> str:\n _default = value if passthrough is True else None\n if isinstance(value, str):\n # a static map is a dict of key/va... | [
"0.769902",
"0.6454913",
"0.6274766",
"0.61075085",
"0.60333574",
"0.5855495",
"0.5799717",
"0.57953143",
"0.57876945",
"0.5707817",
"0.56415164",
"0.5627169",
"0.5581823",
"0.54515505",
"0.5434565",
"0.5424559",
"0.5421374",
"0.5412025",
"0.539458",
"0.53854233",
"0.5366257"... | 0.81638914 | 0 |
Convert a single scalar field value. | def _ConvertScalarFieldValue(value, field, path, require_str=False):
try:
if field.cpp_type in _INT_TYPES:
return _ConvertInteger(value)
elif field.cpp_type in _FLOAT_TYPES:
return _ConvertFloat(value, field)
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_BOOL:
return _Convert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_scalar(self, v, t):\n return v.asnumpy().item()",
"def convert(self, value):\r\n return value",
"def convert(self, value):\n return value",
"def to_scalar(self, v):\n raise NotImplementedError('to_scalar')",
"def to_scalar(obj):\n if isinstance(obj, np.generic):\n... | [
"0.6715429",
"0.66929597",
"0.6612562",
"0.6588822",
"0.65001494",
"0.64344215",
"0.6376013",
"0.63054603",
"0.63030523",
"0.62973917",
"0.6280717",
"0.6238612",
"0.6193321",
"0.6193228",
"0.61632305",
"0.6129661",
"0.60864514",
"0.6054982",
"0.6041072",
"0.6019693",
"0.60038... | 0.70711017 | 0 |
Tries each provider uri in provider_uris until the command succeeds | def add_provider_uri_fallback_loop(python_callable, provider_uris):
def python_callable_with_fallback(**kwargs):
for index, provider_uri in enumerate(provider_uris):
kwargs['provider_uri'] = provider_uri
try:
python_callable(**kwargs)
break
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_providers(self, argv):\n\n for name, provider in self.providermanager:\n provider = provider(self)\n self.produce_output(provider.title,\n provider.location,\n provider.run(argv))",
"def _invoke_providers(self, met... | [
"0.6064879",
"0.5432243",
"0.5217643",
"0.51074266",
"0.50786406",
"0.50186515",
"0.49707466",
"0.4952361",
"0.49237448",
"0.48629606",
"0.48394924",
"0.48083997",
"0.47877803",
"0.47646394",
"0.47541487",
"0.47250047",
"0.4715897",
"0.47094855",
"0.47075677",
"0.47023752",
"... | 0.5879259 | 1 |
Returns the x,y coordinates. Convert_to may be set to 'deg' or 'rad' for convenience. | def coordsxy(self, convert_to=False):
if convert_to == 'rad':
return (self.x*3.14159/180., self.y*3.14159/180.)
elif convert_to == 'deg':
return (self.x/3.14159*180., self.y/3.14159*180.)
else:
return (self.x, self.y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_coords(self, px, py):\n if px not in range(self.SIZE**2) or py not in range(self.SIZE**2):\n raise IndexError\n return (px // self.SIZE, py // self.SIZE,\n px % self.SIZE, py % self.SIZE)",
"def cartesian_coordinates(self):\n # extract RA items\n ra_ho... | [
"0.64772433",
"0.6372282",
"0.6323273",
"0.6280135",
"0.622272",
"0.6203903",
"0.6132433",
"0.61041605",
"0.5989822",
"0.59877276",
"0.5943679",
"0.59110785",
"0.58790195",
"0.58544147",
"0.5844347",
"0.58369446",
"0.5829917",
"0.5824859",
"0.58105505",
"0.58014715",
"0.57902... | 0.86445534 | 0 |
Returns the compass azimuth from self to other in degrees, measured clockwise with north at 0. | def azimuth(self, other, projected=True):
x0, y0 = self.x, self.y
if self.crs != other.crs:
x1, y1 = other.get_vertex(self.crs)[:2]
else:
x1, y1 = other.x, other.y
if (x0, y0) == (x1, y1):
az = np.nan
elif projected and not isinstance(self.crs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAzimuthAngle(self):\n return self._azimuth",
"def azimuth(self, right: GeoSpatialValue) -> ir.FloatingValue:\n return ops.GeoAzimuth(self, right).to_expr()",
"def get_azimuth(self):\n self.degrees = self.azimuth_encoder.get_degrees()\n self.tele_azimuth = self.Calculations.co... | [
"0.6956195",
"0.688949",
"0.67786837",
"0.6746946",
"0.6629266",
"0.6570971",
"0.6549534",
"0.652737",
"0.65118974",
"0.6473741",
"0.64624715",
"0.64558804",
"0.6396988",
"0.6351316",
"0.6322507",
"0.63087964",
"0.6304688",
"0.62811756",
"0.623084",
"0.6199077",
"0.6140139",
... | 0.754953 | 0 |
Whether bounding box overlaps with that of another Geometry. | def _bbox_overlap(self, other):
reg0 = self.bbox
reg1 = other.bbox
return (reg0[0] <= reg1[2] and reg1[0] <= reg0[2] and
reg0[1] <= reg1[3] and reg1[1] <= reg0[3]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doBoundingBoxesIntersect(self, other):\n if(self.upperLeft.x <= other.lowerRight.x and\n self.lowerRight.x >= other.upperLeft.x and\n self.upperLeft.y >= other.lowerRight.y and\n self.lowerRight.y <= other.upperLeft.y):\n return True\n return False"... | [
"0.77179265",
"0.75654334",
"0.74858403",
"0.74017805",
"0.73451793",
"0.7171606",
"0.70872945",
"0.7005762",
"0.6982138",
"0.69691104",
"0.6915805",
"0.69115734",
"0.69057184",
"0.69010395",
"0.68797314",
"0.68691045",
"0.6867025",
"0.6853567",
"0.6852208",
"0.6820989",
"0.6... | 0.7843778 | 0 |
Shift geometry in space. | def shift(self, shift_vector, inplace=False):
if len(self.vertices) == 0:
raise GGeoError('cannot shift zero length geometry')
if len(shift_vector) != len(self.vertices[0]):
raise GGeoError('shift vector length must equal geometry rank')
if inplace:
self.vert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand(self):\n self.vertices[-1, :] = self.expanded",
"def shift(self, ds):\n p = np.array(self.GetPosition())\n\n self.SetPosition(p + ds)\n return self",
"def toggle_geom(self,event):\n \n geom=self.winfo_geometry()\n print(geom,self._geom)\n self.... | [
"0.5879704",
"0.587021",
"0.57361186",
"0.57046163",
"0.56539124",
"0.5636753",
"0.5624064",
"0.56193995",
"0.55680996",
"0.55567974",
"0.5552913",
"0.55317724",
"0.55240893",
"0.551748",
"0.5514585",
"0.547753",
"0.54708683",
"0.5467002",
"0.54436713",
"0.5419017",
"0.541646... | 0.5908959 | 0 |
Apply an affine transform given by matrix M to data and return a new geometry. | def apply_affine_transform(self, M):
vertices = []
for x,y in self.get_vertices():
vertices.append(tuple(np.dot(M, [x, y, 1])[:2]))
return type(self)(vertices, properties=self.properties, crs=self.crs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affine_transform(geom, matrix):\n if geom.is_empty:\n return geom\n if len(matrix) == 6:\n ndim = 2\n a, b, d, e, xoff, yoff = matrix\n if geom.has_z:\n ndim = 3\n i = 1.0\n c = f = g = h = zoff = 0.0\n matrix = a, b, c, d, e, f, g, ... | [
"0.7327515",
"0.7253752",
"0.66390914",
"0.65522397",
"0.62692875",
"0.61622787",
"0.60738885",
"0.6032741",
"0.60129356",
"0.59350854",
"0.59272826",
"0.5866467",
"0.58197725",
"0.578229",
"0.5720486",
"0.57083577",
"0.5703233",
"0.56809163",
"0.5679227",
"0.5665809",
"0.561... | 0.80626094 | 0 |
Return the "flat Earth" distance from each vertex to a point. | def flat_distances_to(self, pt):
A = np.array(self.vertices)
P = np.tile(np.array(pt.vertex), (A.shape[0], 1))
d = np.sqrt(np.sum((A-P)**2, 1))
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_distances(centroid, points):\r\n return np.linalg.norm(points - centroid, axis=1)",
"def point_distances(self, params=None):\n if params is None:\n params = self.collocation_points()\n with self.fix_evaluator():\n pts = np.array([self(la) for la in params])\n ... | [
"0.6095655",
"0.6068057",
"0.6039134",
"0.6029877",
"0.5977602",
"0.59353286",
"0.59106493",
"0.58953476",
"0.5721852",
"0.56845444",
"0.5682769",
"0.5618832",
"0.5578704",
"0.55567944",
"0.5556669",
"0.5545428",
"0.5504067",
"0.54958415",
"0.54712826",
"0.54498285",
"0.54224... | 0.7307021 | 0 |
Returns the index of the vertex that is nearest to a point. If two points are equidistant, only one will be returned. | def nearest_vertex_to(self, point):
distances = self.distances_to(point)
idx = np.argmin(distances)
return idx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nearest_point_index(self, point):\n return _nearest_point_index(self._points, point)",
"def _nearest_point_index(points, point):\n distance = sys.float_info.max\n index = None\n for i, p in enumerate(points):\n temp = _vec_distance(p, point)\n if temp < distance:\n di... | [
"0.828809",
"0.79029685",
"0.76004535",
"0.74556184",
"0.7248492",
"0.7201774",
"0.71850497",
"0.71522737",
"0.713012",
"0.7078899",
"0.70753443",
"0.7028066",
"0.70083356",
"0.7001677",
"0.6985583",
"0.69655836",
"0.68653727",
"0.68527097",
"0.6790523",
"0.6754529",
"0.66650... | 0.86845005 | 0 |
Return whether any vertices are inside poly | def any_within_poly(self, poly):
for pt in self:
if poly.contains(pt):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def points_inside_poly(points, all_verts):\n return Path(all_verts, close=True).contains_points(points)",
"def polygon_contains(self, poly_outer, poly_inner):\n inner_list = self.poly_to_list(poly_inner, \"Global\")\n contain_list = []\n\n # Loop over all points in the inner polygon to se... | [
"0.7586584",
"0.73962224",
"0.73897374",
"0.7314073",
"0.7287562",
"0.7266144",
"0.7166667",
"0.7152957",
"0.70757294",
"0.6963018",
"0.6960835",
"0.6946974",
"0.6905456",
"0.6845782",
"0.68389165",
"0.68163204",
"0.6801132",
"0.67936563",
"0.67753893",
"0.66875124",
"0.66848... | 0.8297107 | 0 |
Return a Polygon representing the convex hull. Not implemented for geographical coordinate systems. | def convex_hull(self):
if isinstance(self.crs, GeographicalCRS):
raise CRSError("not implemented for geographical coordinate "
"systems. Project to a projected coordinate system.")
points = [pt for pt in self]
# Find the lowermost (left?) point
pt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convex_hull(self):\n return self._geomgen(capi.geom_convex_hull)",
"def convex_hull(self):\n return _property_geo(arctern.ST_ConvexHull, self)",
"def polygonFromInteriorPoints(geom, preferredEpsg):\n (projTr, llTr) = makeTransformations(4326, preferredEpsg)\n\n geomProj = copyGeom(geom)... | [
"0.7653656",
"0.763517",
"0.7284385",
"0.7248397",
"0.6943731",
"0.68607104",
"0.683088",
"0.6729767",
"0.67210287",
"0.66569257",
"0.66119975",
"0.6602661",
"0.65916",
"0.65087306",
"0.64786166",
"0.6470744",
"0.64608467",
"0.6443573",
"0.6437295",
"0.64219373",
"0.6411345",... | 0.8205611 | 0 |
Datelineaware get_bbox for geometries consisting of connected vertices. | def get_bbox(self, crs=None):
if (isinstance(self.crs, GeographicalCRS) and
(crs is None or isinstance(crs, GeographicalCRS))):
x, y = self.get_coordinate_lists(crs=crs)
return _cdateline.dateline_bbox(np.array(x, dtype=np.float64),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getbbox(self):\n pass",
"def compute_bb(self):\n all_shapes = list(self.parts.values()) + list(self.edges.values())\n bbox_vertices = cascaded_union(all_shapes).envelope.exterior.coords.xy\n min_x = min(bbox_vertices[0])\n max_x = max(bbox_vertices[0])\n min_y = min(... | [
"0.6707174",
"0.6574737",
"0.6380136",
"0.6365615",
"0.6224314",
"0.6149051",
"0.61419165",
"0.6098083",
"0.6093626",
"0.60520446",
"0.60263014",
"0.6018274",
"0.6012395",
"0.6007882",
"0.6006903",
"0.5997296",
"0.59944123",
"0.59928906",
"0.5984309",
"0.5968962",
"0.59688205... | 0.72755325 | 0 |
Returns an generator of adjacent line segments as coordinate tuples. | def segment_tuples(self):
return ((self.vertices[i], self.vertices[i+1])
for i in range(len(self.vertices)-1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segment_tuples(self):\n return ((self.vertices[i-1], self.vertices[i])\n for i in range(len(self.vertices)))",
"def lines(self):\n for pair in pairs(self.points):\n yield Line(pair, shape=self)",
"def iter_coords():\n yield (0, 0)\n incr = 0\n x = 1\n y =... | [
"0.69940746",
"0.6738684",
"0.6601939",
"0.6345121",
"0.6317297",
"0.623271",
"0.6204825",
"0.61664194",
"0.6116063",
"0.60578525",
"0.60418737",
"0.59932834",
"0.59818065",
"0.5974203",
"0.5936784",
"0.5908802",
"0.5903839",
"0.58623254",
"0.58488476",
"0.58351547",
"0.58173... | 0.7113118 | 0 |
Return whether an intersection exists with another geometry. | def intersects(self, other):
if isinstance(self.crs, CartesianCRS):
if not self._bbox_overlap(other):
return False
interx = _cintersection.all_intersections(self.vertices, other.vertices)
return len(interx) != 0
else:
for a in self.segment_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_on_intersection(intersection, coord):\n return intersection.is_on_intersection(coord)",
"def intersects(self, other): # -> bool:\n ...",
"def intersection(self, other): # -> BaseGeometry:\n ...",
"def intersects(self, *__args): # real signature unknown; restored from __doc__ with mu... | [
"0.7146063",
"0.7073713",
"0.6950299",
"0.6944222",
"0.6865356",
"0.6807325",
"0.67986333",
"0.6795163",
"0.6670107",
"0.6655653",
"0.664007",
"0.6613652",
"0.6565097",
"0.64998454",
"0.64849424",
"0.6483578",
"0.64534587",
"0.64422154",
"0.6380794",
"0.6347629",
"0.6323843",... | 0.71580076 | 0 |
Return the intersections with another geometry as a Multipoint. | def intersections(self, other, keep_duplicates=False):
if isinstance(self.crs, CartesianCRS):
interx = _cintersection.all_intersections(self.vertices, other.vertices)
if not keep_duplicates:
interx = list(set(interx))
return Multipoint(interx, crs=self.crs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersection(self, other): # -> BaseGeometry:\n ...",
"def intersection(self, other):\n return self._geomgen(capi.geom_intersection, other)",
"def intersection(self, other):\n new_ieqs = []\n new_ieqs.extend(self.inequalities())\n new_ieqs.extend(other.inequalities())\n\... | [
"0.7079715",
"0.68553203",
"0.6039081",
"0.6028911",
"0.6022933",
"0.5999609",
"0.59977376",
"0.59743077",
"0.596015",
"0.5953339",
"0.59057844",
"0.5870069",
"0.5861019",
"0.58535075",
"0.5837564",
"0.5823799",
"0.57714176",
"0.5719549",
"0.57141334",
"0.56954104",
"0.569256... | 0.78527284 | 0 |
Return a tuple of the shortest distance on the geometry boundary to a point, and the vertex at that location. If necessary, project coordinates to the local coordinate system. | def _nearest_to_point(self, point):
ptvertex = point.get_vertex(crs=self.crs)
segments = zip(self.vertices.slice(0, -1), self.vertices.slice(1, 0))
if isinstance(self.crs, CartesianCRS):
func = _cvectorgeo.pt_nearest_planar
def func(seg):
return _cvectorg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertex(self):\n if self.a != 0.0:\n # Find x where f'(x) = 2ax + b = 0\n x = -0.5 * self.b / self.a\n return (x, self.f(x))\n else:\n # Quadratic is actually a line, no minimum!\n return (None, None)",
"def nearest_vertex_to(self, point):\n... | [
"0.6327832",
"0.63200974",
"0.62450075",
"0.6190293",
"0.616065",
"0.61353123",
"0.59961027",
"0.59861755",
"0.5968286",
"0.59256595",
"0.5924805",
"0.59187776",
"0.5859679",
"0.5840402",
"0.58189106",
"0.5799556",
"0.5797328",
"0.5769938",
"0.5762889",
"0.574463",
"0.5726566... | 0.6739551 | 0 |
Return the shortest distance from any position on the geometry boundary to a point. | def shortest_distance_to(self, pt):
return self._nearest_to_point(pt)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_distance(self, point):\n if not isinstance(point, Point):\n point = Point(*point)\n\n distances = [(point.distance_to_point(p), p) for p in self.points]\n sortpoints = sorted(distances, key=lambda x: x[0])\n closest = sortpoints[0][1]\n\n vc = Vector(*closest)\... | [
"0.71626055",
"0.70415014",
"0.7030515",
"0.70177543",
"0.6968384",
"0.6838099",
"0.68010473",
"0.67737216",
"0.67720014",
"0.6750446",
"0.66570556",
"0.6564319",
"0.6553357",
"0.6530817",
"0.6504384",
"0.6479721",
"0.6421779",
"0.64112306",
"0.6388246",
"0.6361284",
"0.63457... | 0.73034644 | 0 |
Returns the position on the geometry boundary that is nearest to a point. If two points are equidistant, only one will be returned. | def nearest_on_boundary(self, point):
_, minpt = self._nearest_to_point(point)
return Point(minpt, crs=self.crs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _nearest_to_point(self, point):\n ptvertex = point.get_vertex(crs=self.crs)\n segments = zip(self.vertices.slice(0, -1), self.vertices.slice(1, 0))\n\n if isinstance(self.crs, CartesianCRS):\n func = _cvectorgeo.pt_nearest_planar\n def func(seg):\n retu... | [
"0.79632324",
"0.7618633",
"0.7478915",
"0.7386346",
"0.7317236",
"0.7249764",
"0.71707773",
"0.713583",
"0.7080252",
"0.70637083",
"0.7045037",
"0.7009592",
"0.6960497",
"0.6959613",
"0.69301987",
"0.69205797",
"0.6900029",
"0.6896417",
"0.68884605",
"0.6881952",
"0.6876837"... | 0.81955284 | 0 |
Test whether a point is within distance geometry. | def within_distance(self, point, distance):
return all(distance >= seg.shortest_distance_to(point)
for seg in self.segments) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def around(self, point, distance):\n return self.distance(point) <= distance",
"def is_point_within(self, x, y):\n return abs(x - self._x_position) <= self._x_length / 2 and abs(y - self._y_position) <= self._y_length / 2",
"def isinsidepointXY(x,p):\n \n return dist(x,p) < epsilon",
"def... | [
"0.7708055",
"0.7341019",
"0.73393613",
"0.70537585",
"0.6970852",
"0.6870798",
"0.6853161",
"0.67900825",
"0.67550725",
"0.6695921",
"0.6684049",
"0.66476214",
"0.66476214",
"0.66132176",
"0.6608983",
"0.660223",
"0.6569669",
"0.65596193",
"0.65516526",
"0.6533938",
"0.65261... | 0.7727843 | 0 |
Return a boolean that indicates whether any segment crosses the dateline | def crosses_dateline(self):
if not isinstance(self.crs, GeographicalCRS):
raise CRSError("Dateline detection only defined for geographical "
"coordinates")
return any(self._seg_crosses_dateline(seg) for seg in self.segments) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_crossed(self):\n left_boundary_clusters = np.extract(self.cluster[0] > 0,\n self.cluster[0])\n right_boundary_clusters = np.extract(self.cluster[-1] > 0,\n self.cluster[-1])\n return np.in1d(left_boun... | [
"0.6607927",
"0.6356583",
"0.62756115",
"0.6245991",
"0.62219757",
"0.61910516",
"0.61535555",
"0.6138779",
"0.61205125",
"0.6087211",
"0.60471845",
"0.59927",
"0.59875774",
"0.5970511",
"0.5951828",
"0.5936839",
"0.59188765",
"0.58882046",
"0.58858097",
"0.5861567",
"0.58578... | 0.79373693 | 0 |
Return n equally spaced Point instances along line. | def to_npoints(self, n):
segments = self.segments
Ltotal = self.cumulength()[-1]
step = Ltotal / float(n-1)
step_remaining = step
vertices = [self[0].get_vertex()]
x = 0.0
pos = self[0]
seg = next(segments)
seg_remaining = seg.displacement()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scatter_points(n):\r\n P1 = np.random.randn(int(np.ceil(n/2)), 2) - 4\r\n P2 = 3 * np.random.rand(int(np.ceil(n/4)), 2) - np.array([10, 0])\r\n P3 = np.random.randn(int(np.ceil(n/4)), 2) + 3\r\n \"\"\"\r\n P1=np.floor(P1)\r\n P2=np.floor(P2)\r\n P3=np.floor(P3)\r\n \"\"\"\r\n L = lis... | [
"0.69544923",
"0.67949694",
"0.66221786",
"0.6599535",
"0.6559533",
"0.6415043",
"0.63654",
"0.62974787",
"0.6266857",
"0.6114115",
"0.61019856",
"0.61003006",
"0.60456514",
"0.60444546",
"0.5995354",
"0.5977591",
"0.59704256",
"0.5954243",
"0.5943083",
"0.5921426",
"0.591710... | 0.71344036 | 0 |
Returns a generator of adjacent line segments as coordinate tuples. | def segment_tuples(self):
return ((self.vertices[i-1], self.vertices[i])
for i in range(len(self.vertices))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segment_tuples(self):\n return ((self.vertices[i], self.vertices[i+1])\n for i in range(len(self.vertices)-1))",
"def lines(self):\n for pair in pairs(self.points):\n yield Line(pair, shape=self)",
"def iter_coords():\n yield (0, 0)\n incr = 0\n x = 1\n y... | [
"0.715293",
"0.67410505",
"0.6620828",
"0.6367525",
"0.6346879",
"0.6254025",
"0.6209958",
"0.6191048",
"0.61157435",
"0.6104955",
"0.61017865",
"0.59952706",
"0.59926134",
"0.5985285",
"0.5961862",
"0.59376603",
"0.5917845",
"0.5901189",
"0.58752346",
"0.58511436",
"0.585050... | 0.7031273 | 1 |
Return the perimeter of the polygon. If there are subpolygons, their perimeters are added recursively. | def perimeter(self):
return sum(seg.length for seg in self.segments) + \
sum([p.perimeter for p in self.subs]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perimeter(self):\n perimeter = (2 * self.__length) + (2 * self.__width)\n\n return perimeter",
"def regular_polygon_area(perimeter, apothem):\n return (perimeter * apothem) / 2",
"def perimeter(self):\n return self.sidelength1 + self.sidelength2 + self.baselength1 + self.baselength2",
... | [
"0.7186427",
"0.70697755",
"0.69416517",
"0.68473876",
"0.6841241",
"0.68409795",
"0.6787762",
"0.6767427",
"0.67621464",
"0.67539823",
"0.6737352",
"0.67133826",
"0.6701848",
"0.66883594",
"0.6678018",
"0.6673983",
"0.66370654",
"0.66370654",
"0.6616455",
"0.6563083",
"0.653... | 0.7194337 | 0 |
Return Multipoint subset that is within a polygon. | def within_polygon(self, poly):
if hasattr(self, "quadtree"):
bbox = poly.get_bbox(crs=self.crs)
candidate_indices = self.quadtree.search_within(*bbox)
confirmed_indices = []
for i in candidate_indices:
if poly.contains(self[i]):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polygon_contains(self, poly_outer, poly_inner):\n inner_list = self.poly_to_list(poly_inner, \"Global\")\n contain_list = []\n\n # Loop over all points in the inner polygon to see if they are contained by the outer polygon\n for point in inner_list:\n # Points are defined... | [
"0.6297723",
"0.6253876",
"0.61703825",
"0.61182815",
"0.6049263",
"0.6045901",
"0.6041495",
"0.6013533",
"0.60089123",
"0.600128",
"0.5987214",
"0.59486645",
"0.59256536",
"0.58757865",
"0.58745575",
"0.58647645",
"0.58523357",
"0.5839855",
"0.5801143",
"0.57911325",
"0.5776... | 0.68432844 | 0 |
Return sign of 2D cross product a x b | def _signcross(a, b):
c = (a[0]*b[1]) - (a[1]*b[0])
if c != 0:
return c/abs(c)
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross(a, b):\n #return np.cross(a,b)\n\n return vector(a[1] * b[2] - a[2] * b[1],\n a[2] * b[0] - a[0] * b[2],\n a[0] * b[1] - a[1] * b[0])",
"def cross(a,b):\n \n return [ a[1]*b[2] - a[2]*b[1],\n a[2]*b[0] - a[0]*b[2],\n a[0]*b[1] - a[1]... | [
"0.7505393",
"0.7451593",
"0.7429798",
"0.736543",
"0.7262867",
"0.72435075",
"0.7170541",
"0.71355873",
"0.704141",
"0.68902755",
"0.6888325",
"0.68745303",
"0.6855617",
"0.653257",
"0.65145767",
"0.643799",
"0.64371663",
"0.64182824",
"0.6377469",
"0.6364269",
"0.6336189",
... | 0.80433637 | 0 |
Merge singlepart geometries into a multipart geometry. Properties contained by all inputs are stored in Multipart data attribute. | def multipart_from_singleparts(parts, crs=None):
if len(parts) == 0:
raise ValueError("cannot construct multipart from zero singleparts")
if crs is None:
crs = parts[0].crs
keys = list(parts[0].properties.keys())
for part in parts[1:]:
for key in keys:
if key not in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _multigeometry(self, ogr_geometry):\n\n geo_type = ogr_geometry.GetGeometryType()\n\n if geo_type == ogr.wkbPolygon:\n return ogr.ForceToMultiPolygon(ogr_geometry)\n elif geo_type == ogr.wkbPoint:\n return ogr.ForceToMultiPoint(ogr_geometry)\n elif geo_type in ... | [
"0.6145798",
"0.6081951",
"0.55836874",
"0.54750675",
"0.5431208",
"0.5403941",
"0.540309",
"0.5313788",
"0.5191177",
"0.5175071",
"0.5164827",
"0.5153981",
"0.51327556",
"0.51296246",
"0.5082399",
"0.5038169",
"0.4944022",
"0.49330214",
"0.4920461",
"0.49070293",
"0.49016753... | 0.6567471 | 0 |
Return the (z, x, y) locator for an OpenStreetMap tile containing a point. | def get_tile_tuple(point, zoom):
z = int(zoom)
dlon = 256
dlat = 256
lon0, lat0 = point.crs.project(*point.vertex[:2], inverse=True)
c = 128/math.pi * 2**z
x0 = c * (lon0*math.pi/180+math.pi)
y0 = c * (math.pi-math.log(math.tan(math.pi/4+lat0*math.pi/360)))
x = int(x0 // dlon)
y = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tile(self, point):\n print \"Getting tile for %s\" % repr(point)\n return self.matrix[point.y][point.x]",
"def locate(x, y):\n position(x * 6, y)",
"def locate_point(self, coord):\n lowest_lat = self.lower_left[0]\n leftmost_lng = self.lower_left[1]\n dist_lat = u... | [
"0.651814",
"0.6328146",
"0.6271226",
"0.61940026",
"0.61864424",
"0.6177288",
"0.61505836",
"0.6112619",
"0.6106475",
"0.6029588",
"0.6026629",
"0.5999808",
"0.5999023",
"0.5971483",
"0.5950413",
"0.5942625",
"0.59398496",
"0.59365",
"0.59105754",
"0.59043545",
"0.5902915",
... | 0.7069515 | 0 |
Generate a bank name. | def bank(self) -> str:
return self.random_element(self.banks) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_name_generator():\n return 'jdoe-' + str(uuid()).lower()[:16]",
"def generate_name(prefix):\n suffix = generate_uuid()[:8]\n return '{0}_{1}'.format(prefix, suffix)",
"def name_generator():\n firsts = [\"Albrecht\", \"Lysa\", \"Yvette\", \"Jésus\", \"Amanitus\"]\n lasts = [\"Andersso... | [
"0.7085868",
"0.6811347",
"0.6739656",
"0.67290354",
"0.6709285",
"0.66914254",
"0.6655932",
"0.66433144",
"0.6640339",
"0.6595586",
"0.6594896",
"0.6540819",
"0.65045387",
"0.65033466",
"0.6471213",
"0.6468621",
"0.64577246",
"0.64391166",
"0.63789153",
"0.6375091",
"0.63652... | 0.7042265 | 1 |
Load ROOT 1D histogram RHist1D specified by `path`. | def get_rhist1d(self, path):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rhist2d(self, path):\n raise NotImplementedError",
"def get1d(infile, histname, subdir='',verbose=False):\n \n ### 1d Histogram\n Hist = getter(infile,histname,subdir,verbose)\n \n nbinsHist = Hist.GetSize()-2\n axesX = np.zeros(nbinsHist)\n edgesX = np.zeros(nbinsHist+1)\n ... | [
"0.6613586",
"0.6587686",
"0.65182257",
"0.64931625",
"0.59116226",
"0.5724139",
"0.560152",
"0.55740666",
"0.5482249",
"0.54483205",
"0.5394309",
"0.53900856",
"0.5294247",
"0.5278379",
"0.52629507",
"0.52413446",
"0.52320486",
"0.5208201",
"0.5189715",
"0.51884425",
"0.5172... | 0.78885394 | 0 |
Load ROOT 2D histogram RHist2D specified by `path`. | def get_rhist2d(self, path):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rhist1d(self, path):\n raise NotImplementedError",
"def get2d(infile, histname, subdir='',verbose=False): \n\n ## 2d Histogram\n Hist = getter(infile,histname,subdir,verbose)\n\n nbinsX, nbinsY = Hist.GetNbinsX(), Hist.GetNbinsY()\n Arr = np.zeros((nbinsY,nbinsX))\n dArr = np.zeros(... | [
"0.66015404",
"0.6321508",
"0.60574615",
"0.59776837",
"0.58603084",
"0.5761273",
"0.5737613",
"0.56485015",
"0.5528445",
"0.5461557",
"0.5457594",
"0.5376583",
"0.5366913",
"0.5366024",
"0.5314136",
"0.5281988",
"0.5256996",
"0.5251448",
"0.5242959",
"0.5174668",
"0.5169984"... | 0.77357185 | 0 |
Blogger Page view. Get logged Blogger and retrieve Posts | def bloggerView(request):
blogger = request.user.blogger
posts = blogger.post_set.all()
paginator = Paginator(posts, 6) # Show 6 posts per page.
page_number = request.GET.get('page')
page_obj = paginator.get_page(page_number)
context = {
'blogger': blogger,
'posts': posts,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bloggerVisitView(request, pk):\n blogger = Blogger.objects.get(id=pk)\n posts = blogger.post_set.all()\n paginator = Paginator(posts, 6) # Show 6 posts per page.\n page_number = request.GET.get('page')\n page_obj = paginator.get_page(page_number)\n\n context = {\n \"blogger\": blogger... | [
"0.7353528",
"0.7261787",
"0.7087147",
"0.68386877",
"0.6489228",
"0.644766",
"0.63585824",
"0.63513374",
"0.6325915",
"0.63006777",
"0.6284564",
"0.623397",
"0.6210439",
"0.62063456",
"0.61824656",
"0.6174333",
"0.61642545",
"0.61555856",
"0.6147081",
"0.6143481",
"0.614089"... | 0.7845671 | 0 |
Create Blog view. Uses BloggerForm | def createBlogView(request):
data = {
'user': request.user,
'email': request.user.email,
}
bloggerForm = BloggerForm(initial=data)
if request.method == "POST":
bloggerForm = BloggerForm(request.POST, request.FILES)
if bloggerForm.is_valid():
bloggerForm.save... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(request):\n\n if request.method == 'POST':\n data = request.POST\n form = BlogEntryForm(creator=request.user, data=data)\n if form.is_valid():\n form.save()\n # Should we redirect to single entry view or to all?\n return HttpResponseRedirect(reverse(... | [
"0.8139532",
"0.78588754",
"0.7835222",
"0.7556097",
"0.7552492",
"0.753118",
"0.72936",
"0.7240096",
"0.7204767",
"0.7189439",
"0.7084852",
"0.68760717",
"0.6820733",
"0.6785585",
"0.6713064",
"0.6679969",
"0.6660116",
"0.6622713",
"0.6619219",
"0.6595594",
"0.6554748",
"0... | 0.83010304 | 0 |
Perform a Blogger search based on a given name | def searchResultsView(request):
bloggerName = request.GET.get("search_blogger")
bloggers = Blogger.objects.all().filter(name__icontains=bloggerName)
context = {
"bloggers": bloggers,
}
return render(request, "blog/search_results.html", context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self, term):",
"def search_postman(text):\n result = _search_blog('postman', text)\n _print_results(result)\n return result",
"def search(query_string):",
"def search(self, query):",
"def name_search(self, name, args=None, operator='ilike', limit=1000):\n args = self.compute_doma... | [
"0.65143675",
"0.64493984",
"0.6422849",
"0.641757",
"0.6355611",
"0.62823343",
"0.6282289",
"0.6256191",
"0.6254421",
"0.62521833",
"0.62293917",
"0.6184052",
"0.6177285",
"0.6163507",
"0.6121027",
"0.6119984",
"0.61030936",
"0.6071477",
"0.60698646",
"0.6066175",
"0.6063724... | 0.6999357 | 0 |
Blogger Visit view. User cannot edit an object as a visitor. | def bloggerVisitView(request, pk):
blogger = Blogger.objects.get(id=pk)
posts = blogger.post_set.all()
paginator = Paginator(posts, 6) # Show 6 posts per page.
page_number = request.GET.get('page')
page_obj = paginator.get_page(page_number)
context = {
"blogger": blogger,
"post... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def personal(request):\n \n visits = Visit.objects.filter(user=request.user)\n \n \n return render(request, \"personal.html\", {'visits':visits})",
"def view_blog(self):",
"def can_view(self, user):\r\n return True",
"def can_be_viewed_by(self,user):\n return True",
"def view(s... | [
"0.6139467",
"0.6138581",
"0.6055281",
"0.5885141",
"0.57998735",
"0.57755685",
"0.56898385",
"0.5654777",
"0.56004786",
"0.55868304",
"0.5565741",
"0.5548467",
"0.5537673",
"0.5537673",
"0.5523017",
"0.5457954",
"0.54362935",
"0.5432095",
"0.5432095",
"0.5432095",
"0.5412155... | 0.63149756 | 0 |
Devuelve el primer elemento de la lista l | def _primerElem(l):
return l[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(self):\n if self.is_empty():\n raise Empty('La cola está vacía')\n return self._head._element # frente alineado con la cabeza de la lista",
"def first(self):\n if self.is_empty():\n raise Empty('list is empty')\n return self._head._element # front ali... | [
"0.70487195",
"0.6339398",
"0.62800133",
"0.616803",
"0.6075651",
"0.6070574",
"0.6021551",
"0.5990592",
"0.5973173",
"0.5938169",
"0.5919058",
"0.5903061",
"0.5833062",
"0.5762044",
"0.5729169",
"0.5719193",
"0.57049614",
"0.5698349",
"0.56738156",
"0.5644571",
"0.5616934",
... | 0.7395258 | 0 |
Store a copy of given cuds_object in the session. Return the stored object. | def _store(self, cuds_object):
assert cuds_object.session == self
self._registry.put(cuds_object)
for t in cuds_object._graph:
self.graph.add(t)
cuds_object._graph = self.graph
if self.root is None:
self.root = cuds_object.uid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, obj):\n self.uow.save(obj)\n self.imap.save(obj)\n state(obj).session = self",
"def save_session(self, session):\n db = self.open()\n db[session.id] = session",
"def add(self, obj):\n self.getSession().add(obj)\n self.commit() # paranoia... | [
"0.6037772",
"0.56279814",
"0.5627626",
"0.54596764",
"0.5422658",
"0.54027086",
"0.53169113",
"0.51905566",
"0.5154689",
"0.515216",
"0.515216",
"0.515216",
"0.515216",
"0.515216",
"0.515216",
"0.515216",
"0.515216",
"0.5100185",
"0.5100185",
"0.50904584",
"0.5071586",
"0.... | 0.6512543 | 0 |
Load the cuds_objects with the given iris. | def load_from_iri(self, *iris):
return self.load(*[uid_from_iri(iri) for iri in iris]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_iris_dataset():\n \n # Location and file name for the dataset\n file_location = 'iris'\n data_file = file_location + os.sep + 'iris.data'\n \n # We have to map the categorical class names to numbers\n mapping = { 'Iris-setosa':'0', 'Iris-versicolor':'1', 'Iris-virginica':'2'}\n \n # Prepare a... | [
"0.5936839",
"0.5485702",
"0.5464887",
"0.53894585",
"0.53259593",
"0.50935024",
"0.508654",
"0.50631493",
"0.5018918",
"0.49893793",
"0.49798614",
"0.49575514",
"0.4945388",
"0.49393252",
"0.4937813",
"0.4937813",
"0.4937813",
"0.4937813",
"0.4937813",
"0.4931248",
"0.492957... | 0.6231737 | 0 |
Remove all elements not reachable from the sessions root. Only consider given relationship and its subclasses. | def prune(self, rel=None):
deleted = self._registry._get_not_reachable(self.root, rel=rel)
for d in deleted:
self._delete_cuds_triples(d) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_relatives(self):\n category_ratings = list(self.category_ratings.all())\n self.category_ratings.clear()\n for category_rating in category_ratings:\n if category_rating.isOrphaned():\n category_rating.delete()\n\n word_counts = list(self.word_counts.a... | [
"0.59632075",
"0.57751644",
"0.5720135",
"0.5703994",
"0.5616309",
"0.5602337",
"0.5599958",
"0.55512786",
"0.552562",
"0.5510098",
"0.55065084",
"0.5483939",
"0.54551613",
"0.54483396",
"0.542626",
"0.5425417",
"0.54111886",
"0.5401231",
"0.5381681",
"0.5375581",
"0.5375507"... | 0.6656962 | 0 |
Remove a CUDS object. Will not delete the cuds objects contained. | def delete_cuds_object(self, cuds_object):
from osp.core.namespaces import cuba
if cuds_object.session != self:
cuds_object = next(self.load(cuds_object.uid))
if cuds_object.get(rel=cuba.relationship):
cuds_object.remove(rel=cuba.relationship)
self._delete_cuds_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delete_cuds_triples(self, cuds_object):\n del self._registry[cuds_object.uid]\n t = self.graph.value(cuds_object.iri, rdflib.RDF.type)\n self.graph.remove((cuds_object.iri, None, None))\n cuds_object._graph = rdflib.Graph()\n cuds_object._graph.set((cuds_object.iri, rdflib.R... | [
"0.6688269",
"0.6023268",
"0.593724",
"0.58032006",
"0.5773144",
"0.57190627",
"0.57050467",
"0.56995726",
"0.565701",
"0.5633847",
"0.5625903",
"0.5598243",
"0.5598243",
"0.5598243",
"0.5598243",
"0.5598243",
"0.5598243",
"0.5598243",
"0.5598243",
"0.5598243",
"0.5598243",
... | 0.79730034 | 0 |
Delete the triples of a given cuds object from the session's graph. | def _delete_cuds_triples(self, cuds_object):
del self._registry[cuds_object.uid]
t = self.graph.value(cuds_object.iri, rdflib.RDF.type)
self.graph.remove((cuds_object.iri, None, None))
cuds_object._graph = rdflib.Graph()
cuds_object._graph.set((cuds_object.iri, rdflib.RDF.type, t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_cuds_object(self, cuds_object):\n from osp.core.namespaces import cuba\n\n if cuds_object.session != self:\n cuds_object = next(self.load(cuds_object.uid))\n if cuds_object.get(rel=cuba.relationship):\n cuds_object.remove(rel=cuba.relationship)\n self._d... | [
"0.71080196",
"0.58119476",
"0.57656646",
"0.5614195",
"0.56018686",
"0.5587958",
"0.55316937",
"0.5525167",
"0.55165225",
"0.5511246",
"0.54630536",
"0.5452715",
"0.54386044",
"0.5427099",
"0.5371569",
"0.5371075",
"0.5367434",
"0.53638875",
"0.5350799",
"0.53348744",
"0.532... | 0.8331826 | 0 |
Notify the session that some object has been deleted. | def _notify_delete(self, cuds_object): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _objectDeleted(self, obj):\n pass",
"def after_delete(self, obj, st):\n pass",
"def delete(self, obj):",
"def ticket_deleted(self, ticket):",
"def delete_view(self, request, object_id):\r\n obj = self.get_object(unquote(object_id))\r\n obj.delete()\r\n return HttpResp... | [
"0.770581",
"0.6994212",
"0.6758057",
"0.67128766",
"0.6609607",
"0.6601623",
"0.65847635",
"0.65703833",
"0.6507389",
"0.64804596",
"0.6468308",
"0.646402",
"0.64384013",
"0.6383814",
"0.6380475",
"0.6365013",
"0.63554525",
"0.6351711",
"0.6350027",
"0.6350027",
"0.6350027",... | 0.7716953 | 0 |
Notify the session that some object has been updated. | def _notify_update(self, cuds_object): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, obj):\n self._updater.update(obj)",
"def after_update(self, obj, st):\n pass",
"def _notify():\n for observer in Bots._observers:\n observer.update(Bots.BOT_UPDATE)",
"def update(self):\n\n pass",
"def notifyObservers(self):",
"def on_update(self):\... | [
"0.69205743",
"0.68881637",
"0.6626344",
"0.6623903",
"0.65949976",
"0.65719056",
"0.6562528",
"0.65576136",
"0.65576136",
"0.65576136",
"0.65576136",
"0.65576136",
"0.65576136",
"0.65576136",
"0.65576136",
"0.65576136",
"0.65576136",
"0.65576136",
"0.65576136",
"0.65576136",
... | 0.7501285 | 0 |
Notify the session that given cuds object has been read. This method is called when the user accesses the attributes or the relationships of the cuds_object cuds_object. | def _notify_read(self, cuds_object): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _notify_update(self, cuds_object):",
"def observeRead(self, observer):\n self.observerRead = observer",
"def read(self):\n if self.status == 'read':\n return\n self.status = 'read'\n self.emit('read')\n self.emit('modified')",
"def _notify_delete(self, cuds_o... | [
"0.65367055",
"0.5686354",
"0.56474304",
"0.54367346",
"0.5217771",
"0.5152421",
"0.5003396",
"0.49703428",
"0.496839",
"0.49404702",
"0.48440725",
"0.48380065",
"0.48195547",
"0.48000637",
"0.47998515",
"0.47806075",
"0.4780026",
"0.47731587",
"0.47445166",
"0.47427675",
"0.... | 0.7982085 | 0 |
Given a toc_path, write rst and return a file object. | def rst_for_module(toc_path):
f = open(toc_path + '.rst', 'w+')
heading = ":mod:`{}`".format(os.path.basename(toc_path))
dotted = toc_path.replace('/', '.')
w(f, heading)
w(f, "=" * len(heading))
w(f, ".. automodule:: {}", dotted)
return f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def savecontents(contents, pathname):\n _maybe_mkdir(pathname)\n with open(pathname, 'w') as htmlfile:\n htmlfile.write(contents)",
"def test_writetofile():\n sat_before_nuc = \\\n t('circumstance', [\n ('S', ['sat first']),\n ('N', ['nuc second'])\n ])\n\n tempfile... | [
"0.59833705",
"0.5917662",
"0.5878469",
"0.58248115",
"0.57782185",
"0.57658887",
"0.5698923",
"0.5689296",
"0.567704",
"0.56515765",
"0.5631918",
"0.55241704",
"0.54576814",
"0.545646",
"0.54224616",
"0.54189515",
"0.54112554",
"0.5407183",
"0.53466356",
"0.5308416",
"0.5298... | 0.6728384 | 0 |
Given ../mylib/path/to/package and lists of dir/file names, write rst. | def rst_for_package(root, dirs, files):
doc_path = root[3:]
if not os.path.isdir(doc_path):
os.mkdir(doc_path)
# Start a rst doc for this package.
# =================================
f = rst_for_module(doc_path)
# Add a table of contents.
# ========================
w(f, ".... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_docs(root_dir, session):\n ...",
"def pkgbuildContentPackage( self, pars, directory ):\n\n return \"\"\"\\\n # Assemble your package in ${pkgdir}\n\"\"\"",
"def get_content(parser, path: str, split_char='-', delimiter=os.sep):\n\n logging.debug(\"Searching directory\")\n library... | [
"0.6325145",
"0.62585986",
"0.6213911",
"0.61741537",
"0.611827",
"0.6037399",
"0.6017594",
"0.60141426",
"0.59680563",
"0.5944161",
"0.59054524",
"0.5832099",
"0.57655126",
"0.5760323",
"0.57221013",
"0.571616",
"0.568726",
"0.5667425",
"0.56473696",
"0.562151",
"0.5575921",... | 0.72617656 | 0 |
Returns a generator for skimming lines in this file | def skim_generator(lines, file):
total_length = 0
count = 0
seekable = True
# Try and seek in the file. If it's a stream, we can't do it
try:
file.seek(0, WHENCE_RELATIVE)
except IOError, e:
seekable = False
log.debug("File is not seekable, falling back to reading")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skim(lines, file):\n for line in skim_generator(lines, file):\n sys.stdout.write(line)",
"def file_iterator(file_path):\n with open(file_path, 'r') as f:\n\n for line in f:\n\n #each line is an example\n\n #each example is made of the function name and then a sequenc... | [
"0.6660651",
"0.6303816",
"0.6256514",
"0.6256514",
"0.62528116",
"0.62453866",
"0.62244964",
"0.6170835",
"0.6063165",
"0.6040894",
"0.60256475",
"0.6018239",
"0.5997849",
"0.5973391",
"0.5971821",
"0.5931982",
"0.5894423",
"0.5799321",
"0.5798672",
"0.57985884",
"0.5795792"... | 0.72690934 | 0 |
Skim through the provided file printing out one line in every (lines) | def skim(lines, file):
for line in skim_generator(lines, file):
sys.stdout.write(line) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_file(self, file, line):\n self._file = file\n self._line = line\n try:\n self._file = open(file)\n except IOError:\n print \"can't open\", file \n \n n = 0\n retour =\"....\\n\"\n for line in self._file:\n n +=1\n ... | [
"0.65303695",
"0.6432913",
"0.63081074",
"0.6165218",
"0.61311847",
"0.5986177",
"0.5931289",
"0.5893335",
"0.58416873",
"0.58198565",
"0.57593554",
"0.5758298",
"0.5752309",
"0.57252324",
"0.57219803",
"0.5697066",
"0.5692392",
"0.5682988",
"0.5672934",
"0.56552875",
"0.5648... | 0.73074585 | 0 |
Adds a new wall picture to the node definition Launches a dialog, and validates and posts the entered information to the repository for the creation of a new wall picture for the node that is being edited | def _add_new_wall_pic(self, pic=None):
# Display the dialogue
results = pic
if results is None:
results = NodePictureDialog(self)
results = results._entries
item_id = results["name"]
item = results
# Extract the return values
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_profile_photo():\n pass",
"async def add_element(message: types.Message):\n cmd = ''\n try:\n cmd = str(message.caption)\n except KeyError:\n pass\n\n match = re.match(patterns.ADDPIC, cmd)\n if match:\n caption = match[2]\n bg = match[3]\n\n image = m... | [
"0.5825319",
"0.55100507",
"0.5373126",
"0.5299094",
"0.5283024",
"0.5278802",
"0.52417755",
"0.5216429",
"0.5206676",
"0.5183593",
"0.51801044",
"0.5173707",
"0.5141207",
"0.51337004",
"0.5122092",
"0.50985754",
"0.5092046",
"0.50624406",
"0.5043047",
"0.5042829",
"0.5016437... | 0.71388453 | 0 |
Remove the wall picture that is currently selected | def _remove_wall_pic(self):
# Retrieve the item that was selected
key = self._listbox.get(ACTIVE)
# Post a delete notice to the manager
self._remove(key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_texture(self):\n # Retrieve the item that was selected\n key = self._listbox.get(ACTIVE)\n # Post a delete notice to the manager\n self._remove(key)",
"def delAvatarImage(self, imgName = None): \n if imgName:\n self.window.remove_child(self.images[imgName])\n ... | [
"0.71262974",
"0.6694326",
"0.6506798",
"0.64586765",
"0.64586765",
"0.64268833",
"0.64221984",
"0.6374316",
"0.6330068",
"0.63133293",
"0.63085455",
"0.6293977",
"0.6281847",
"0.6230075",
"0.61665374",
"0.6154073",
"0.6082028",
"0.60807776",
"0.6076745",
"0.6071824",
"0.6068... | 0.8739054 | 0 |
Remove the wall picture that is currently selected | def _remove_texture(self):
# Retrieve the item that was selected
key = self._listbox.get(ACTIVE)
# Post a delete notice to the manager
self._remove(key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_wall_pic(self):\n # Retrieve the item that was selected\n key = self._listbox.get(ACTIVE)\n # Post a delete notice to the manager\n self._remove(key)",
"def delAvatarImage(self, imgName = None): \n if imgName:\n self.window.remove_child(self.images[imgName])\n ... | [
"0.8738855",
"0.6695502",
"0.65084374",
"0.64601827",
"0.64601827",
"0.6426573",
"0.6423785",
"0.6376793",
"0.6332735",
"0.6314312",
"0.63100874",
"0.62958467",
"0.62838733",
"0.6231572",
"0.6169098",
"0.61565775",
"0.608434",
"0.60835093",
"0.6079155",
"0.6072204",
"0.606980... | 0.71274126 | 1 |
Slow, naive solution. The available coins are 1, 3, and 4. Takes input m (amount to arrive at) and returns the minimum number of moves to arrive there. | def get_change_recursive(m):
if m < 0:
raise ValueError("Invalid negative amount")
if m == 0:
raise ValueError("ok 0 moves, but this shouldn't happen either.")
if m in [1, 3, 4]:
return 1
alt_paths = [get_change_recursive(m-1)]
if m > 3:
alt_paths.append(get_change... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve (M, cpos, move): \n if move == 64:\n print (\"\\n\\nmove: \", move)\n print (\"sum: \", sum(M))\n pprint (M)\n #exit()\n for next in get_moves(cpos, M):\n solve(ulist(M, next, move+1), next, move+1)",
"def knapsack(items, m, n):\r\n population = generate_pop(items, population=[])\r... | [
"0.6207268",
"0.61463416",
"0.6075057",
"0.60413104",
"0.60325265",
"0.6012943",
"0.6012674",
"0.59134966",
"0.5897034",
"0.5816689",
"0.5677915",
"0.5655924",
"0.5642863",
"0.56156117",
"0.5608902",
"0.56047684",
"0.55827725",
"0.5570639",
"0.55645096",
"0.5562232",
"0.55210... | 0.6466234 | 0 |
QMdiArea.addSubWindow(QWidget, Qt.WindowFlags flags=0) > QMdiSubWindow | def addSubWindow(self, QWidget, Qt_WindowFlags_flags=0): # real signature unknown; restored from __doc__
return QMdiSubWindow | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,currentExperiment):\n super(AmoebaCreateExperimentWindow,self).__init__()\n\n self.currentExperiment = currentExperiment\n\n #Create the window\n self.subWindow = QMdiSubWindow()\n\n self.widget = AmoebaCreateExperiment(self.subWindow,self.currentExperiment)\n ... | [
"0.6413831",
"0.6211379",
"0.6209192",
"0.60334355",
"0.5763827",
"0.5746077",
"0.5722692",
"0.5692009",
"0.5690505",
"0.5643446",
"0.5624679",
"0.5624087",
"0.5565972",
"0.55554175",
"0.5541099",
"0.5516692",
"0.5462922",
"0.5460722",
"0.54434246",
"0.54241467",
"0.54201496"... | 0.858587 | 0 |
QMdiArea.eventFilter(QObject, QEvent) > bool | def eventFilter(self, QObject, QEvent): # real signature unknown; restored from __doc__
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eventFilter(self, qobject, event):\n return False",
"def event(self, QEvent): # real signature unknown; restored from __doc__\n return False",
"def event(self, QEvent): # real signature unknown; restored from __doc__\n return False",
"def event(self, QEvent): # real signature unknown... | [
"0.7777463",
"0.74524975",
"0.74524975",
"0.74524975",
"0.74524975",
"0.74524975",
"0.7040431",
"0.6847388",
"0.6603724",
"0.63682765",
"0.63184744",
"0.6305561",
"0.6180361",
"0.61097395",
"0.6036618",
"0.5955971",
"0.5908953",
"0.58581626",
"0.578307",
"0.57659864",
"0.5764... | 0.81431574 | 0 |
QMdiArea.subWindowList(QMdiArea.WindowOrder order=QMdiArea.CreationOrder) > listofQMdiSubWindow | def subWindowList(self, QMdiArea_WindowOrder_order=None): # real signature unknown; restored from __doc__
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getChildwindows(ReferenceID):\n try:\n ldtp.wait(3)\n window = ReferenceID.windowsR()[0]\n logging.info(\"child windows : %s\" % window)\n except Exception as er:\n logging.info('Not able to get child windows')\n return False\n return window",
"def _windows(session... | [
"0.6657819",
"0.6124593",
"0.59815896",
"0.59103096",
"0.58543587",
"0.5831366",
"0.57653284",
"0.57399505",
"0.56528133",
"0.5600246",
"0.55545974",
"0.54835",
"0.5457354",
"0.5454828",
"0.5384163",
"0.5346279",
"0.53241014",
"0.5292846",
"0.5215965",
"0.52063775",
"0.520369... | 0.77207005 | 0 |
This method is for editing the record of a status | def edit_status(self,id,type,status):
current_user = get_jwt_identity()
try:
con = init_db()
cur = con.cursor()
cur.execute("SELECT is_admin FROM users WHERE email = %s",(current_user,))
user = cur.fetchall()
user_role = user[0][0]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_record(self, record):\r\n self.record.editObject(record, id=record['id'])",
"def status(self, id):",
"def edit(self):\n\n pass",
"def _update_status(self):\n self._db_update({'status': self.status})",
"def updateStatus(self, status):\n pass",
"def update_record_status... | [
"0.70151556",
"0.6988718",
"0.6825883",
"0.6781697",
"0.6754425",
"0.6670217",
"0.6636074",
"0.65818006",
"0.65365946",
"0.65237236",
"0.65109324",
"0.64626807",
"0.64311016",
"0.64087576",
"0.63974583",
"0.63935614",
"0.63821197",
"0.6351219",
"0.6288683",
"0.62173706",
"0.6... | 0.7076854 | 0 |
Given a list of query_results, asks feedback to the user and adds it to each JSON in the list | def ask_feedback(query_results):
print('Google Search Results:')
print('======================')
for i, result in enumerate(query_results):
print('Result ', i+1)
print('[')
print('URL: ', result['url'])
print('Title: ', result['title'])
print('Summary: ', result['su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_result(self, test_ids, status, comment):\n for test_id in test_ids:\n data = {\n 'case_id': test_id,\n 'comment': comment,\n 'status_id': status,\n }\n self.results.append(data)",
"def collect(self, query_list):\n ... | [
"0.6192807",
"0.6165262",
"0.592634",
"0.5925863",
"0.5855002",
"0.5830008",
"0.5787157",
"0.577938",
"0.5776444",
"0.5774505",
"0.5762489",
"0.5717546",
"0.5710341",
"0.5699069",
"0.5657962",
"0.5644797",
"0.5634462",
"0.5554389",
"0.55498415",
"0.5527087",
"0.5510052",
"0... | 0.6328883 | 0 |
This function gets called when a player presses Buzz. | def buzz(self, name):
self.server.buzzMutex.lock()
if self.server.buzzed == False:
self.server.buzzed = True
else:
self.server.buzzMutex.unlock()
return
self.server.buzzMutex.unlock()
self.server.changeStatus(name, 'Answering')
for player in self.server.players.items():
try:
player[1][0].d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_house_blackjack(self) -> None:\n if 21 in self.user.hand.value:\n self.event_player_push()\n else:\n print(\"The house has blackjack\")\n self.event_house_wins()",
"def event_player_blackjack(self) -> None:\n win_amount = self.user.bet + 1.5\n ... | [
"0.6132485",
"0.59956074",
"0.59894633",
"0.5899612",
"0.5897936",
"0.58309436",
"0.5827423",
"0.58077663",
"0.5754764",
"0.5733652",
"0.5728315",
"0.5718822",
"0.5716174",
"0.57022834",
"0.56400925",
"0.56397873",
"0.5594339",
"0.5548335",
"0.5522187",
"0.5521121",
"0.551412... | 0.64827967 | 0 |
Turn the phrase into a list of skipgrams and index them with their offset(s) as values. | def _index_skipgrams(self) -> None:
for skipgram in self.skipgrams:
self.skipgram_index[skipgram.string] += [skipgram]
for skipgram in self.skipgrams_lower:
self.skipgram_index_lower[skipgram.string] += [skipgram] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skipgram_offsets(self, skipgram_string: str) -> Union[None, List[int]]:\n if not self.has_skipgram(skipgram_string):\n return None\n return [skipgram.offset for skipgram in self.skipgram_index[skipgram_string]]",
"def skipgram(line, vocab, ws):\n\tinputs = []; labels = []\n\tword_lis... | [
"0.6860445",
"0.64783335",
"0.63394105",
"0.6057104",
"0.596561",
"0.5767387",
"0.5752549",
"0.5712053",
"0.5712053",
"0.5712053",
"0.5709039",
"0.5708961",
"0.55494267",
"0.5515065",
"0.54880863",
"0.5461672",
"0.5452784",
"0.54478645",
"0.5431396",
"0.5427048",
"0.5403709",... | 0.7520621 | 0 |
Set the label(s) of a phrase. Labels must be string and can be a single string or a list. | def set_label(self, label: Union[str, List[str]]) -> None:
if not is_valid_label(label):
raise ValueError("phrase label must be a single string or a list of strings:", label)
self.label = label
if isinstance(label, str):
self.label_set = {label}
self.label_lis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def labels(self, labels):\n self._instructions_setter('LABEL', labels)",
"def add_labels(self, phrase_labels: List[Union[Phrase, Dict[str, Union[str, List[str]]]]]):\n for phrase in phrase_labels:\n phrase = as_phrase_object(phrase, ngram_size=self.ngram_size, skip_size=self.skip_size)\n... | [
"0.73766917",
"0.71631247",
"0.6867124",
"0.6811252",
"0.6796435",
"0.66700023",
"0.6663597",
"0.6663597",
"0.6663597",
"0.6663597",
"0.6663597",
"0.6644654",
"0.65786505",
"0.65786505",
"0.65786505",
"0.65786505",
"0.65786505",
"0.6509921",
"0.6472717",
"0.64279836",
"0.6352... | 0.815577 | 0 |
Add key/value pairs as metadata for this phrase. | def add_metadata(self, metadata_dict: Dict[str, any]) -> None:
for key in metadata_dict:
self.metadata[key] = metadata_dict[key]
if key == "label":
self.set_label(metadata_dict[key])
elif key == "max_offset":
self.add_max_offset(metadata_dict["... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_metadata(self, metadata: dict) -> None:",
"def add_metadata (self, name, value):\n self.metadata[name] = value\n return self",
"def add_metadata(self, key, value):\n self._h5.attrs[key] = value",
"def add_metadata(self, name, val: str = None):\n if isinstance(name, Metadata):\n ... | [
"0.6973168",
"0.67903686",
"0.67763823",
"0.65788686",
"0.63114613",
"0.6182035",
"0.6104821",
"0.61047906",
"0.6087461",
"0.59975255",
"0.5967261",
"0.5956471",
"0.59500057",
"0.591849",
"0.5914668",
"0.5898736",
"0.589122",
"0.5888013",
"0.58725137",
"0.58723515",
"0.586715... | 0.68569475 | 1 |
Add a maximum offset for matching a phrase in a text. | def add_max_offset(self, max_offset: int) -> None:
if not isinstance(max_offset, int):
raise TypeError("max_offset must be a positive integer")
if max_offset < 0:
raise ValueError("max_offset must be positive")
self.max_offset = max_offset
self.max_end = self.max_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_match(text, pos):\n m, _ = parse_ent('<' + text + '>', pos - len(text))\n return len(text) - len(m) + 2",
"def highlight_next_match(self):\n self.text.tag_remove('found.focus', '1.0',\n tk.END) # remove existing tag\n try:\n start, end = sel... | [
"0.54003865",
"0.53380144",
"0.53380144",
"0.5251521",
"0.5246758",
"0.5219786",
"0.5219786",
"0.5217477",
"0.52080584",
"0.51961535",
"0.51948756",
"0.51453316",
"0.5119649",
"0.50976527",
"0.5036056",
"0.5036056",
"0.50347286",
"0.4986199",
"0.49683502",
"0.4964326",
"0.495... | 0.6977307 | 0 |
For a given skipgram, return boolean whether it is in the index | def has_skipgram(self, skipgram: str) -> bool:
return skipgram in self.skipgram_index.keys() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __contains__(self, ngram):\n return ngram in self._ngrams",
"def __contains__(self, ngram):\n return ngram in self.root",
"def is_early_skipgram(self, skipgram: str) -> bool:\n return skipgram in self.early_skipgram_index",
"def is_pos(self, term):\n return term in self.pos",
... | [
"0.66996205",
"0.6429223",
"0.64059967",
"0.63835377",
"0.6358472",
"0.625639",
"0.62040144",
"0.61626846",
"0.61560684",
"0.61552745",
"0.60142046",
"0.59650683",
"0.59589183",
"0.5940154",
"0.5839112",
"0.58202636",
"0.58167094",
"0.58131635",
"0.57963574",
"0.578725",
"0.5... | 0.77394986 | 0 |
For a given skipgram return the list of offsets at which it appears. | def skipgram_offsets(self, skipgram_string: str) -> Union[None, List[int]]:
if not self.has_skipgram(skipgram_string):
return None
return [skipgram.offset for skipgram in self.skipgram_index[skipgram_string]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _index_skipgrams(self) -> None:\n for skipgram in self.skipgrams:\n self.skipgram_index[skipgram.string] += [skipgram]\n for skipgram in self.skipgrams_lower:\n self.skipgram_index_lower[skipgram.string] += [skipgram]",
"def get_offsets(word, raw_text):\n try:\n ... | [
"0.67257696",
"0.62908816",
"0.61978155",
"0.61978155",
"0.61099225",
"0.59847236",
"0.59754837",
"0.5956373",
"0.5811764",
"0.57724696",
"0.5722569",
"0.5690474",
"0.5678434",
"0.5678434",
"0.5678434",
"0.56712556",
"0.5661226",
"0.5657479",
"0.56462157",
"0.5618882",
"0.558... | 0.8189027 | 0 |
For a given skipgram, return boolean whether it appears early in the phrase. | def is_early_skipgram(self, skipgram: str) -> bool:
return skipgram in self.early_skipgram_index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_skipgram(self, skipgram: str) -> bool:\n return skipgram in self.skipgram_index.keys()",
"def should_skip(self, text):\n return self.skipper and self.skipper.match(text)",
"def has_next_Ngram(self, label):\n return label in self.next_grams",
"def and_sum (self, phrase):\r\n ... | [
"0.7803427",
"0.63070005",
"0.6279483",
"0.59935075",
"0.59614444",
"0.58881456",
"0.5799423",
"0.57581526",
"0.57494074",
"0.574271",
"0.5606998",
"0.55909693",
"0.55683446",
"0.55553806",
"0.55544746",
"0.5503841",
"0.5488771",
"0.5486397",
"0.54658014",
"0.5426037",
"0.541... | 0.8195953 | 0 |
Connect postgresql and create a table for index. | def create_new_index(self, dict_pg_info):
# ! Setting if fun can use default setting
ruler = Rules()
str_conn = ruler.pg_info_rules(dict_pg_info)
conn = psycopg2.connect(str_conn)
with conn:
with conn.cursor() as cur:
str_create_table = "CREATE TABLE ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table():\n conn = psycopg2.connect(host=\"localhost\", database=\"integration\", user=\"postgres\", password=\"postgres\")\n cursor = conn.cursor()\n cursor.execute(CREATE_TABLE)\n conn.commit()\n cursor.close()",
"def create_index():",
"def index_tables(query_root, data_dir, host, po... | [
"0.7333971",
"0.73077625",
"0.69529635",
"0.69231045",
"0.68590647",
"0.6806495",
"0.6806495",
"0.67003715",
"0.66499776",
"0.66194284",
"0.6588432",
"0.65757203",
"0.6573387",
"0.65287745",
"0.6506149",
"0.64998454",
"0.64606357",
"0.6459588",
"0.6442122",
"0.64405465",
"0.6... | 0.81145066 | 0 |
Function for clearing log file. | def _clear_log(log_path):
with logging._lock:
with open(log_path, 'w'):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clearLog():\n logPath = getLogPath()\n\n with open(logPath, 'w') as f:\n f.write('')",
"def clearLog(self):\n self.logBuffer = None",
"def clear_log(self):\n\n self.__logs = []",
"def clearOldMarketLogs(self):\n file = open(\"./data/market_logs.txt\", \"r+\")\n fi... | [
"0.88353026",
"0.7790419",
"0.76897234",
"0.7622484",
"0.75471425",
"0.74731153",
"0.73089707",
"0.72973615",
"0.726093",
"0.7215378",
"0.71193963",
"0.7108171",
"0.70919645",
"0.69376004",
"0.69067174",
"0.6827218",
"0.6818702",
"0.6787262",
"0.6778182",
"0.6764372",
"0.6734... | 0.81434315 | 1 |
Create another instance of the same class with another DELAYED. | def duplicate(self, delayed):
return self.__class__(delayed) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args):\n this = _libsbml.new_Delay(*args)\n try: self.this.append(this)\n except: self.this = this",
"def __init__(self, delay=0):\n self.delay = delay",
"def createDelay(self):\n return _libsbml.Model_createDelay(self)",
"def _delay(self, n=None):",
"def ... | [
"0.6427851",
"0.61636287",
"0.5698666",
"0.56490386",
"0.5616896",
"0.56159735",
"0.55248255",
"0.5516933",
"0.55089086",
"0.54705346",
"0.53879136",
"0.5360477",
"0.5333945",
"0.5308932",
"0.52803075",
"0.5275711",
"0.52444524",
"0.51893044",
"0.5165154",
"0.5137733",
"0.512... | 0.62636214 | 1 |
Convert (list of )+ tokens to a padded LongTensor. | def get_long_tensor(tokens_list, batch_size, pad_id=PAD_ID):
sizes = []
x = tokens_list
while isinstance(x[0], list):
sizes.append(max(len(y) for y in x))
x = [z for y in x for z in y]
tokens = torch.LongTensor(batch_size, *sizes).fill_(pad_id)
for i, s in enumerate(tokens_lis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_long_tensor(tokens_list, batch_size, pad_id=constant.PAD_ID):\n sizes = []\n x = tokens_list\n while isinstance(x[0], list):\n sizes.append(max(len(y) for y in x))\n x = [z for y in x for z in y]\n tokens = torch.LongTensor(batch_size, *sizes).fill_(pad_id)\n for i, s in enumer... | [
"0.82005394",
"0.8014137",
"0.7413235",
"0.6460052",
"0.6340751",
"0.6146796",
"0.60953116",
"0.6057259",
"0.59972954",
"0.597745",
"0.5963818",
"0.5939974",
"0.5921533",
"0.58514607",
"0.57604337",
"0.57345676",
"0.56887496",
"0.5680914",
"0.56642675",
"0.5639345",
"0.563502... | 0.8212152 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.