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 |
|---|---|---|---|---|---|---|
Test a few configurations of loading nested record definitions from a file. We're assuming that the loading of `Person` works fine as in the above test. | def test_reading_nested_user_map_definition_from_file():
with open("definitions/Person.buf") as f:
Person = Map.from_open_file(f)
expected = Map(
MapEntrySpec(1, "name", String),
MapEntrySpec(2, "members", List(Person))
)
with open("definitions/Club.buf") as f:
assert e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_02_ReadFile(self):\n l_node = config_tools.Yaml(self.m_pyhouse_obj).read_yaml(self.m_filename)\n l_config = l_node.Yaml\n # print(PrettyFormatAny.form(l_node, 'C1-02-A'))\n # print(PrettyFormatAny.form(l_config, 'C1-02-B'))\n self.assertEqual(l_config['Location']['Street... | [
"0.61501205",
"0.6011829",
"0.5964953",
"0.59200484",
"0.5812958",
"0.58031285",
"0.5800592",
"0.5768146",
"0.5748203",
"0.57136834",
"0.56707954",
"0.562173",
"0.5602652",
"0.5587003",
"0.55559576",
"0.5553246",
"0.5545484",
"0.55402386",
"0.55242026",
"0.55069757",
"0.55026... | 0.7113823 | 0 |
The `str` and `repr` of a user type should be clear and readable. | def test_user_type_repr():
Person = Map.from_file("definitions/Person.buf")
me = Person(name="Bede Kelly", age=20)
assert "Person(name='Bede Kelly', age=20)" == str(me) == repr(me) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _type_repr(t):\n string = repr(t)\n for type_, alias in _TYPE_ABBREVIATIONS.items():\n string = string.replace(repr(type_), alias)\n string = re.sub(r\"<(class|type) '([\\w.]+)'>\", r\"\\2\", string)\n string = re.sub(r\"typecheck\\.(\\w+)\", r\"\\1\", string)\n return string",
"def __str__(self) -> ... | [
"0.667904",
"0.6669914",
"0.6606698",
"0.6594914",
"0.6548062",
"0.6485456",
"0.6471644",
"0.6428384",
"0.6373333",
"0.6371493",
"0.63690996",
"0.6347887",
"0.6339384",
"0.6295424",
"0.62807375",
"0.6248851",
"0.62318534",
"0.6204671",
"0.6188865",
"0.6150888",
"0.6147257",
... | 0.7490933 | 0 |
Computing a missing type should raise a ValueError. | def test_value_error_for_computing_missing_type():
with pytest.raises(ValueError):
compute_type("missing_type", {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def missing_types():\n\n return ...",
"def test__specification_type_to_python_type_unsupported_type(self):\n with self.assertRaises(TypeError):\n _specification_type_to_python_type(\"unsupported_type\")",
"def test_type_errors():\n\n\ttry:\n\t\ttransmissions = compute_transmissions(cal_dir... | [
"0.6458707",
"0.6121331",
"0.60999084",
"0.6038492",
"0.6035922",
"0.6020021",
"0.5914601",
"0.59133106",
"0.58746004",
"0.587279",
"0.5811356",
"0.5743523",
"0.5711869",
"0.56873417",
"0.56709874",
"0.5628493",
"0.5622688",
"0.56208366",
"0.56137717",
"0.5603522",
"0.5581452... | 0.80203485 | 0 |
Attempting to read a nonexistent key should raise a KeyError. | def test_map_missing_key_encountered():
with pytest.raises(KeyError):
Map().read_key(10, b"") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getitem_when_not_present(self, index):\n raise KeyError(index)",
"def test_getObjectByKey_raises_KeyError(self):\n try:\n self.tile_bucket.getObjectByKey('foo_key')\n except KeyError:\n return\n assert(False)",
"def test_missing_entry_raises_KeyError(self):\n ... | [
"0.76314974",
"0.73090196",
"0.72747844",
"0.7161801",
"0.6877974",
"0.6853785",
"0.6804897",
"0.6804897",
"0.6775273",
"0.67367387",
"0.6732741",
"0.6689989",
"0.66274995",
"0.6611257",
"0.65961874",
"0.65663236",
"0.65585715",
"0.6540641",
"0.6540641",
"0.65172666",
"0.6511... | 0.7533058 | 1 |
After creating a user type, it should be possible to access attributes of any instance by name. | def test_user_type_attribute_access():
Person = Map.from_file("definitions/Person.buf")
me = Person(name="Bede Kelly", age=20)
assert 20 == me.age
assert "Bede Kelly" == me.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes(self):\n ...",
"def attributes(self):",
"def test_attributes(self):\n self.assertTrue(hasattr(User()), \"email\")\n self.assertTrue(hasattr(User()), \"password\")\n self.assertTrue(hasattr(User()), \"first_name\")\n self.assertTrue(hasattr(User(... | [
"0.59264183",
"0.5779609",
"0.57337564",
"0.5702959",
"0.5678026",
"0.5675536",
"0.5655046",
"0.5646836",
"0.5627248",
"0.5621952",
"0.5556889",
"0.555549",
"0.5536167",
"0.5532182",
"0.55302703",
"0.5518858",
"0.55067897",
"0.55055255",
"0.549975",
"0.549975",
"0.5496567",
... | 0.6081698 | 0 |
Returns first 'elite_count' fittest individuals from population | def _get_elite_individuals(self, elites):
# 适应度在这里被attrgetter调用,会计算适应度并排序
return sorted(self._population, key=attrgetter("fitness"))[-elites:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fittest(self, population, f_thres=None):\n pass",
"def getFitness(individual, X, y):\n\n if(individual.count(0) != len(individual)):\n # get index with value 0\n cols = [index for index in range(\n len(individual)) if individual[index] == 0]\n\n # get features subset... | [
"0.60551095",
"0.57839954",
"0.5620154",
"0.5584558",
"0.5567883",
"0.5536164",
"0.53768283",
"0.5342787",
"0.5275282",
"0.5269108",
"0.52533185",
"0.52096456",
"0.51871914",
"0.51759535",
"0.5119839",
"0.5111551",
"0.51017576",
"0.5096507",
"0.5091608",
"0.50838906",
"0.5080... | 0.61990106 | 0 |
Extract the filters from the file with description of filters in ENA as a dictionary with the key being the filter id and the value a dictionary with related results, type of filter, filter description | def get_filters(filepath):
filters = {}
with open(filepath, "r") as f:
reader = csv.DictReader(f, delimiter=';')
for row in reader:
filter_id = row["Filter Column"]
filters.setdefault(filter_id, {})
filters[filter_id]["results"] = row["Result"].split(", ")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_results(filepath, filters, return_fields):\n results = {}\n with open(filepath, \"r\") as f:\n reader = csv.DictReader(f, delimiter=';')\n for row in reader:\n result_id = row[\"Result\"]\n results.setdefault(result_id, {})\n results[result_id][\"descrip... | [
"0.6567464",
"0.6540329",
"0.61985815",
"0.59597963",
"0.5952341",
"0.5825332",
"0.57350796",
"0.5661707",
"0.5659539",
"0.56336784",
"0.5605745",
"0.55870676",
"0.55784094",
"0.55691296",
"0.5559988",
"0.55522555",
"0.55280113",
"0.5500791",
"0.54971665",
"0.5479508",
"0.536... | 0.7146735 | 0 |
Extract the returnable fields for results from the file with description of filters in ENA as a dictionary with the key being the field id and the value a list of returnable fields | def get_return_fields(filepath):
returnable_fields = {}
with open(filepath, "r") as f:
reader = csv.DictReader(f, delimiter=';')
for row in reader:
returnable_fields.setdefault(
row["Result"],
row["Returnable fields"].split(", "))
return returnable... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_results(filepath, filters, return_fields):\n results = {}\n with open(filepath, \"r\") as f:\n reader = csv.DictReader(f, delimiter=';')\n for row in reader:\n result_id = row[\"Result\"]\n results.setdefault(result_id, {})\n results[result_id][\"descrip... | [
"0.75320107",
"0.5911996",
"0.5886345",
"0.5808707",
"0.5804455",
"0.5642675",
"0.5530695",
"0.5446551",
"0.54160076",
"0.53638387",
"0.5349052",
"0.5345534",
"0.5343852",
"0.5339069",
"0.5328274",
"0.53202945",
"0.5314124",
"0.5308858",
"0.5308818",
"0.5304199",
"0.5280803",... | 0.61082685 | 1 |
Format the file with description of results in ENA as a dictionary with the key being the result id and the value a dictionary with the result description, the filter fields, the returnable fields | def get_results(filepath, filters, return_fields):
results = {}
with open(filepath, "r") as f:
reader = csv.DictReader(f, delimiter=';')
for row in reader:
result_id = row["Result"]
results.setdefault(result_id, {})
results[result_id]["description"] = row["Des... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_result(result, filter_name, outf):\n s = (f\"{result['lambda_c']:.5e} {result['lambda_mean']:.5e} \"\n f\"{result['lambda_1']:.5e} \"\n f\"{result['lambda_pivot']:.5e} \"\n f\"{result['lambda_eff']:.5e} \"\n f\"{result['lambda_eff_jv']:.5e} {result['isophotal_wt'... | [
"0.6534185",
"0.6301631",
"0.5833302",
"0.56950545",
"0.56709564",
"0.565285",
"0.56397444",
"0.56354654",
"0.5634863",
"0.56006235",
"0.557424",
"0.55418056",
"0.5483013",
"0.5456764",
"0.5426645",
"0.54023933",
"0.53925574",
"0.5388595",
"0.537994",
"0.5355226",
"0.5351728"... | 0.6945924 | 0 |
Serialize the ENA data descriptors | def serialize_ena_data_descriptors():
filter_fields = get_filters("enasearch_data/ena_filter_columns.csv")
return_fields = get_return_fields("enasearch_data/ena_result_returnable_fields.csv")
results = get_results(
"enasearch_data/ena_domain_results.csv",
filter_fields,
return_fields... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self, data):",
"def _serialise(self):\n # TODO (M Foley)\n pass",
"def serialize(self):",
"def serialize(self):\n pass",
"def serialize(self, data):\n raise NotImplementedError",
"def serialize(self):\n # fill sequences\n for keys, groups in groupby... | [
"0.6120707",
"0.61034334",
"0.61020106",
"0.59981906",
"0.57910806",
"0.5707245",
"0.5667497",
"0.55207527",
"0.5497663",
"0.54775834",
"0.54703224",
"0.5445238",
"0.54138684",
"0.539476",
"0.5380868",
"0.537456",
"0.5373118",
"0.53604984",
"0.53585887",
"0.53572357",
"0.5350... | 0.74567384 | 0 |
Execute the ghostscript command on the given in_file generating out raster and vector information with the given resolution. Width and height should be specified in pts. | def execute(in_file, resolution, width, height, raster_mode):
raster_tmpfile = tempfile.NamedTemporaryFile()
# Convert width and height to DPI.
width = (width/72) * resolution
height = (height/72) * resolution
args = [config.gs,
"-q",
"-dBATCH",
"-dNOPAUSE",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rsvg_export(input_file, output_file, dpi=90, rsvg_binpath=None):\n if not os.path.exists(input_file):\n log.error('File {} not found.'.format(input_file))\n raise IOError((0, 'File not found.', input_file))\n\n if rsvg_binpath is None:\n rsvg_binpath = which('rsvg-convert')\n ... | [
"0.56764907",
"0.54079854",
"0.52211016",
"0.51903",
"0.5090727",
"0.5072589",
"0.50311774",
"0.4985784",
"0.49632987",
"0.49585488",
"0.49428988",
"0.4929958",
"0.4899564",
"0.48928532",
"0.48894268",
"0.4881956",
"0.48795673",
"0.48755503",
"0.48733643",
"0.48634833",
"0.48... | 0.82343125 | 0 |
Given a raster mode return the ghostscript mode. | def raster_mode_to_ghostscript(mode):
if mode == 'mono':
return 'pngmono'
if mode in ['gray', 'grey']:
return 'pnggray'
elif mode in ['color', 'colour']:
return 'png16m'
elif mode == 'none':
return None
else:
log.crit("Invalid raster mode %s specified." % mode... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getmodebase(mode):\r\n return ImageMode().getmode(mode).basemode",
"def getmodetype(mode):\r\n return ImageMode().getmode(mode).basetype",
"def get_drawing_mode(self) -> int:\n return self._drawing_mode",
"def get_drag_mode(self) -> DragModeStr:\n return DRAG_MODE.inverse[self.dragMod... | [
"0.55927527",
"0.55815905",
"0.53287446",
"0.5240736",
"0.52022755",
"0.5146089",
"0.5070561",
"0.50420135",
"0.49340034",
"0.4927632",
"0.49265334",
"0.49084032",
"0.48961255",
"0.48912597",
"0.4860581",
"0.48369595",
"0.4828284",
"0.48254994",
"0.4811622",
"0.47984123",
"0.... | 0.82476324 | 0 |
Return azimuthal angle btwn vv and v0, with v1 defining phi=0. Originally written by Ryan Rygg. This is a modified version. | def azimuth(vv, v0, v1):
with np.errstate(divide='ignore', invalid='ignore'):
n0 = np.cross(v0, v1)
n0 /= np.dual.norm(n0, axis=-1)[..., np.newaxis]
nn = np.cross(v0, vv)
nn /= np.dual.norm(nn, axis=-1)[..., np.newaxis]
azi = np.arccos(np.sum(nn * n0, -1))
if len(np.shape(az... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _angle(u, v, w, d='+'):\n vu = np.arctan2(u[1] - v[1], u[0] - v[0])\n vw = np.arctan2(w[1] - v[1], w[0] - v[0])\n phi = vw - vu\n if phi < 0:\n phi += 2 * np.pi\n if d == '-':\n phi = 2 * np.pi - phi\n return np.round(phi, 6)",
"def vector_angle(v):\n assert len(v) == 2\n ... | [
"0.6837371",
"0.68146574",
"0.67569834",
"0.66214377",
"0.6614525",
"0.6548473",
"0.6523774",
"0.65151376",
"0.6511448",
"0.6444688",
"0.6419528",
"0.6415526",
"0.6405574",
"0.6404064",
"0.63467276",
"0.63387954",
"0.6323557",
"0.6318191",
"0.63069147",
"0.63042796",
"0.62610... | 0.8320249 | 0 |
Generate a polar tth corr map directly for all panels | def polar_tth_corr_map_rygg_pinhole(tth, eta, instrument, absorption_length,
pinhole_thickness, pinhole_radius,
num_phi_elements=60):
panels = list(instrument.detectors.values())
return calc_tth_rygg_pinhole(panels, absorption_length, tth, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correlation_map(self,property_list):\n\t\tself.property_existence(property_list)\n\n\t\tfig, ax = plt.subplots()\n\t\tcorr = self.df[property_list].corr()\n\t\tsns.heatmap(corr, mask=np.zeros_like(corr, dtype=np.bool), cmap=sns.diverging_palette(220, 10, \n\t\t\tas_cmap=True), annot=True, ax=ax)\n\t\tfig.tight... | [
"0.6007513",
"0.5876065",
"0.5769552",
"0.57296973",
"0.57121176",
"0.56763726",
"0.5667984",
"0.564799",
"0.55785215",
"0.55728304",
"0.55616057",
"0.5536332",
"0.55219084",
"0.54839826",
"0.54424584",
"0.54251313",
"0.5423645",
"0.54188794",
"0.54133356",
"0.5410115",
"0.54... | 0.62137616 | 0 |
Calculates accuracy of classifier using crossvalidation | def accuracy(clf, x, y, cv=5):
print_classification_info(clf, x, y)
return cross_val_score(clf, x, y, cv=cv).mean() * 100 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_validation_accuracy(clf, X, labels, k):\n ###TODO\n\n cv = KFold(n=len(labels),n_folds=k)\n accuracies = []\n\n \n for train_indices, test_indices in cv:\n \n clf.fit(X[train_indices], labels[train_indices])\n predicted = clf.predict(X[test_indices])\n acc = ac... | [
"0.8187059",
"0.78914505",
"0.776603",
"0.7756566",
"0.7727183",
"0.7647041",
"0.76321435",
"0.76294637",
"0.7561754",
"0.75610894",
"0.75514084",
"0.7535038",
"0.75276315",
"0.7526841",
"0.75000876",
"0.74949217",
"0.74705124",
"0.74654794",
"0.74471617",
"0.74382395",
"0.73... | 0.8274853 | 0 |
Creates pipeline by scaling data before applying classifier | def create_pipeline(clf):
return Pipeline([('scaler', MinMaxScaler()), ('clf', clf)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocessing_pipeline(self):\n self.__multilabel_processing()\n self.__split_dataset()\n self.__save_datasets()",
"def run(self):\n pipeline = set_pipeline()\n pipeline.fit(self.X_train, self.y_train)\n return pipeline",
"def build_own_pipeline() -> Pipeline:\n ... | [
"0.7216038",
"0.69135475",
"0.6812672",
"0.6771773",
"0.6728982",
"0.66303265",
"0.65908307",
"0.6548334",
"0.6543246",
"0.6534429",
"0.651682",
"0.6510948",
"0.64968145",
"0.64875764",
"0.6482989",
"0.6474565",
"0.6404334",
"0.6401119",
"0.63910276",
"0.63535756",
"0.6334185... | 0.7734406 | 0 |
Performs the EdgeProp algorithm on the given graph. returns the label distribution (|N|, |N|) matrix with scores between 1, 1 stating the calculated label distribution. | def _perform_edge_prop_on_graph(self, adj_mat: np.ndarray, y: np.ndarray, max_iter=100,
tol=1e-1) -> np.ndarray:
label_distributions = y.copy()
l_previous = None
D = np.sum(adj_mat, axis=0)
D[D == 0] = 1
edge_exists = y.sum(axis=-1) > 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_edge_logits(self):",
"def fit(self, input_matrix: Union[sparse.csr_matrix, np.ndarray], labels: Union[np.ndarray, dict] = None,\n labels_row: Union[np.ndarray, dict] = None, labels_col: Union[np.ndarray, dict] = None) -> 'Propagation':\n adjacency, seeds, self.bipartite = get_adjace... | [
"0.59302175",
"0.5685956",
"0.5590433",
"0.55390316",
"0.55306965",
"0.5512711",
"0.53973716",
"0.53906375",
"0.5384633",
"0.52966577",
"0.5276178",
"0.52583474",
"0.52521753",
"0.5227219",
"0.52263653",
"0.5201644",
"0.5192086",
"0.5181399",
"0.51795304",
"0.5179271",
"0.517... | 0.6850988 | 0 |
Returns set of unique words in the form of a dict. | def get_unique_words(allsents):
allwords = [x[0] for sent in allsents for (x, iob) in sent]
allwords = [w.lower() for w in allwords] # GloVe requires lowercase
allwords = set(allwords)
words = {}
for word in allwords:
words[word] = True
return words | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unique_words():\n # Unique words\n words_set = set()\n for i in range(1, 114+1):\n sura = quran.get_sura(i)\n for aya in sura:\n wordsList = aya.split(' ')\n for word in wordsList:\n words_set.add(word)\n\n return words_set",
"def wordset(wo... | [
"0.7718385",
"0.7414757",
"0.7403397",
"0.7391369",
"0.72894526",
"0.71404016",
"0.71334535",
"0.70610565",
"0.70064247",
"0.6886408",
"0.685462",
"0.6749185",
"0.6747076",
"0.67039764",
"0.66820496",
"0.66746885",
"0.6621559",
"0.6593449",
"0.6587095",
"0.657299",
"0.6567046... | 0.74756694 | 1 |
Compute the new target assignment that minimises the SSE between the minibatch feature space and the targets. | def calc_optimal_target_permutation(feats: np.ndarray, targets: np.ndarray) -> np.ndarray:
# Compute cost matrix
cost_matrix = np.zeros([feats.shape[0], targets.shape[0]])
# calc SSE between all features and targets
for i in range(feats.shape[0]):
cost_matrix[:, i] = np.sum(np.square(feats-targe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_targets(self):\n for ga_main, ga_targ in zip(self.ga.variables, self.ga_.variables):\n ga_targ.assign(self._polyak * ga_targ + (1 - self._polyak) * ga_main)\n if self.use_lyapunov:\n for lc_main, lc_targ in zip(self.lc.variables, self.lc_.variables):\n ... | [
"0.60301924",
"0.5749692",
"0.5725836",
"0.5651671",
"0.5638887",
"0.5486865",
"0.5486865",
"0.54687834",
"0.545722",
"0.54565793",
"0.54437315",
"0.5427891",
"0.5414094",
"0.5351632",
"0.5351278",
"0.5334296",
"0.53186554",
"0.52747434",
"0.52711505",
"0.5268436",
"0.5252491... | 0.60616624 | 0 |
Returns (Ordinal Hint, Ordinal String) | def getOrdinal(self):
hint = self['Ordinal Number']
return (hint, 'Ordinal%d'% hint) # microsoft-convention | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetOrdinalString(\n self,\n basic=0,\n truncation=0,\n ndp=0,\n zonePrecision=Precision.Complete,\n dp=\",\",\n tDesignator=\"T\"):\n return self.date.GetOrdinalString(basic, truncation) + tDesignator +\\\n self.time... | [
"0.6219699",
"0.571383",
"0.56969106",
"0.5657399",
"0.5527102",
"0.5496787",
"0.54831994",
"0.5383385",
"0.5362906",
"0.5334709",
"0.53166634",
"0.5304618",
"0.52503824",
"0.52387094",
"0.52261275",
"0.52153933",
"0.5167411",
"0.5161694",
"0.5147528",
"0.51361555",
"0.513615... | 0.7867511 | 0 |
Dereferences Name into it's IMAGE_IMPORT_HINT structure | def dereference(self):
offset = headers.calculateRelativeAddress(self, self['Name'])
return self.p.p.new(IMAGE_IMPORT_HINT, __name__='ImportName', offset=offset) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genImportWithAsName(self, name, asname):\n name = self._moreImportObject.getAbsName(name, '.'.join(self._module.getNames()))\n pass",
"def gen_new_import_lookup_table(self, fn_name, dll_name):\n # TODO : currently, this method modify import lookup table directly,\n # it must be abstract.\... | [
"0.5443918",
"0.53688246",
"0.5362101",
"0.5287956",
"0.5286559",
"0.5277196",
"0.5245458",
"0.5217765",
"0.5209089",
"0.5177268",
"0.5137656",
"0.50968564",
"0.50968564",
"0.50672805",
"0.5059682",
"0.5045493",
"0.50411856",
"0.5040776",
"0.50376713",
"0.5003028",
"0.5000434... | 0.7571249 | 0 |
Since we only support a very restricted setup (single medium within a single bounding shape), we can extract the only medium pointer within the scene and use is for all subsequent method calls. This avoids expensive virtual function calls on array pointers. | def get_single_medium(scene):
shapes = scene.shapes()
assert len(shapes) == 1, f'Not supported: more than 1 shape in the scene (found {len(shapes)}).'
medium = shapes[0].interior_medium()
assert medium is not None, 'Expected a single shape with an interior medium.'
return medium | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract_medium(publication, default_medium=Edition.BOOK_MEDIUM):\n medium = default_medium\n\n if publication.metadata.type:\n medium = Edition.additional_type_to_medium.get(\n publication.metadata.type, default_medium\n )\n\n return medium",
"def me... | [
"0.59219766",
"0.5617972",
"0.56100106",
"0.5154311",
"0.5154311",
"0.49101067",
"0.48518616",
"0.48442277",
"0.4812694",
"0.4779818",
"0.4779818",
"0.4779818",
"0.47743493",
"0.4769846",
"0.47537515",
"0.4732127",
"0.4732127",
"0.4695794",
"0.4686523",
"0.4677471",
"0.467554... | 0.714948 | 0 |
Flips a random neutral tile. | async def __auto_flip_tile(self) -> None:
valid_tiles = self.__get_neutral_tiles()
random_tile = roll(valid_tiles)
await self.flip(random_tile) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flip():\n return random.choice((True, False))",
"def random_flip(image ):\n if random.randint(0,1):\n image = flipud(image) # vertical flip\n if random.randint(0,1):\n image = fliplr(image) # horizontal flip\n return image",
"def flip(n=2):\n return np.random.randint(n)==0",
... | [
"0.68300736",
"0.6630526",
"0.6281742",
"0.62252593",
"0.6109169",
"0.6107942",
"0.60380316",
"0.6026049",
"0.5993376",
"0.59660095",
"0.59603053",
"0.59001076",
"0.5881228",
"0.5873901",
"0.5872346",
"0.58549196",
"0.58024675",
"0.57945734",
"0.57858306",
"0.57618576",
"0.57... | 0.7388292 | 0 |
Test case for address_to_bytes | def test_address_to_bytes(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_to_Bytes(self) -> None:\n self.assertEqual(to_bytes('Hello'),\n bytearray('Hello', 'utf-8'),\n \"Check that to_bytes creates byte array when presented with non byte string.\")",
"def getBytes(self, addr: ghidra.program.model.address.Address, dest: L... | [
"0.6778882",
"0.64866084",
"0.6474378",
"0.6467622",
"0.6416309",
"0.63798213",
"0.6332579",
"0.6310028",
"0.62989223",
"0.6276629",
"0.62692237",
"0.6260331",
"0.62458473",
"0.6241879",
"0.6214581",
"0.6175448",
"0.61632293",
"0.61379766",
"0.6129103",
"0.60927415",
"0.60865... | 0.94309103 | 0 |
Test case for address_to_tree | def test_address_to_tree(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_Tree():",
"def test_address_to_bytes(self):\n pass",
"def test_tree_binary_tree() -> None:\n t = generate_binary_tree_resources(4, 3)\n field(t, (\"root\", \"ds\", \"f1\")).identity = \"email\"\n field(t, (\"root.0.1.0\", \"ds.0.1.0\", \"f1\")).identity = \"ssn\"\n field(t, (\"root.... | [
"0.6265187",
"0.62106544",
"0.60868067",
"0.6072095",
"0.56820965",
"0.5657681",
"0.5552556",
"0.55398005",
"0.5538263",
"0.55201906",
"0.55070865",
"0.5486422",
"0.542491",
"0.54176444",
"0.54012173",
"0.5355775",
"0.5345383",
"0.53396857",
"0.5337377",
"0.53214246",
"0.5320... | 0.94997144 | 0 |
Test case for execute_with_context | def test_execute_with_context(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(self, driver, context):\n raise NotImplementedError",
"def execute(self, context: Any) -> Any:\n pass",
"def Run(self, context, result):\n\n # check if the test can be run on the current platform\n if not self.SupportedPlatform(context, result):\n return\n\n ... | [
"0.7353823",
"0.71140015",
"0.6636619",
"0.62521654",
"0.62521654",
"0.61902905",
"0.6078994",
"0.6016489",
"0.6004783",
"0.5975071",
"0.5930253",
"0.588746",
"0.58786607",
"0.5869089",
"0.58441156",
"0.5836378",
"0.5835771",
"0.58324724",
"0.580722",
"0.5783871",
"0.57703036... | 0.94072914 | 0 |
Test case for script_p2_s_address | def test_script_p2_s_address(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_script_p2_sh_address(self):\n pass",
"def test_address_info(self):\n from supvisors.rpcinterface import RPCInterface\n # prepare context\n self.supervisor.supvisors.context.addresses = {\n '10.0.0.1': Mock(**{'serial.return_value': 'address_info'})}\n # crea... | [
"0.85203135",
"0.62855506",
"0.6112364",
"0.6107662",
"0.6080626",
"0.60592806",
"0.59502065",
"0.5928296",
"0.5926245",
"0.5897614",
"0.588785",
"0.5886323",
"0.58589935",
"0.5799525",
"0.57664484",
"0.5722318",
"0.5722318",
"0.56948394",
"0.56924343",
"0.56604874",
"0.56517... | 0.9164723 | 0 |
Test case for script_p2_sh_address | def test_script_p2_sh_address(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_script_p2_s_address(self):\n pass",
"def test_get_address(self):\n with self.subprocess_getoutput_patch:\n ret = self.inst._get_address()\n self.assertEqual(ret, \"http://example\")",
"def test_6_1_1_script_exists(host):\n assert host.file(AUDIT_SYSTEM_SCRIPT).ex... | [
"0.86151713",
"0.60976464",
"0.5630181",
"0.5574849",
"0.55215544",
"0.5345127",
"0.529842",
"0.5297524",
"0.5285199",
"0.5276365",
"0.52494305",
"0.52334934",
"0.5213693",
"0.5202698",
"0.5199422",
"0.5184625",
"0.51157445",
"0.50511503",
"0.50333256",
"0.5033218",
"0.502674... | 0.946022 | 0 |
Creates a course with 3 orphan modules, one of which has a child that's also in the course tree. | def create_course_with_orphans(self, default_store):
course = CourseFactory.create(default_store=default_store)
# create chapters and add them to course tree
chapter1 = self.store.create_child(self.user.id, course.location, 'chapter', "Chapter1")
self.store.publish(chapter1.location, se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_course(self):\r\n super(TestOrphan, self)._create_course()\r\n\r\n self._create_item('chapter', 'Chapter1', {}, {'display_name': 'Chapter 1'}, 'course', 'runid')\r\n self._create_item('chapter', 'Chapter2', {}, {'display_name': 'Chapter 2'}, 'course', 'runid')\r\n self._crea... | [
"0.68607956",
"0.6608762",
"0.6544574",
"0.64357287",
"0.6068295",
"0.6061504",
"0.5966545",
"0.5892435",
"0.5871874",
"0.5817131",
"0.57982886",
"0.5791605",
"0.5782526",
"0.5780918",
"0.5668452",
"0.56496084",
"0.55987984",
"0.55903774",
"0.55850106",
"0.5564612",
"0.555590... | 0.6869201 | 0 |
Asserts that we have the expected count of orphans for a given course_key | def assertOrphanCount(self, course_key, number):
self.assertEqual(len(self.store.get_orphans(course_key)), number) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_split_orphan(self):\r\n orphans = self.split_mongo.get_orphans(self.split_course_key)\r\n self.assertEqual(len(orphans), 3, \"Wrong # {}\".format(orphans))\r\n location = self.split_course_key.make_usage_key('chapter', 'OrphanChapter')\r\n self.assertIn(location, orphans)\r\n ... | [
"0.6290156",
"0.608903",
"0.5951875",
"0.554769",
"0.554297",
"0.5534803",
"0.5441433",
"0.54222894",
"0.53685665",
"0.5353749",
"0.5353749",
"0.5326985",
"0.52949494",
"0.5293539",
"0.52470016",
"0.52079386",
"0.5205678",
"0.51956",
"0.51882374",
"0.51851887",
"0.5149998",
... | 0.8105335 | 0 |
Test that the orphan handler deletes the orphans | def test_delete_orphans(self, default_store, max_mongo_calls, min_mongo_calls):
course = self.create_course_with_orphans(default_store)
orphan_url = reverse_course_url('orphan_handler', course.id)
with check_mongo_calls_range(max_mongo_calls, min_mongo_calls):
self.client.delete(orp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mongo_orphan_delete(self):\r\n self.client.delete(self.orphan_url)\r\n orphans = json.loads(\r\n self.client.get(self.orphan_url, HTTP_ACCEPT='application/json').content\r\n )\r\n self.assertEqual(len(orphans), 0, \"Orphans not deleted {}\".format(orphans))",
"def ... | [
"0.75522655",
"0.6515802",
"0.6333377",
"0.62885606",
"0.62123966",
"0.61951613",
"0.6171661",
"0.61383927",
"0.6137848",
"0.61362386",
"0.61221623",
"0.6108413",
"0.60897154",
"0.60606265",
"0.6051992",
"0.6051492",
"0.605122",
"0.6044678",
"0.60393894",
"0.6034989",
"0.6026... | 0.7004957 | 1 |
r""" Make sure that path_to_location works with a component having multiple vertical parents, from which one of them is orphan. course | chapter | vertical vertical \ / html | def test_path_to_location_for_orphan_vertical(self, module_store):
# Get a course with orphan modules
course = self.create_course_with_orphans(module_store)
# Fetch the required course components.
vertical1 = self.store.get_item(BlockUsageLocator(course.id, 'vertical', 'Vertical1'))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_path_to_location_for_orphan_chapter(self, module_store):\n # Get a course with orphan modules\n course = self.create_course_with_orphans(module_store)\n orphan_chapter = self.store.get_item(BlockUsageLocator(course.id, 'chapter', 'OrphanChapter'))\n chapter1 = self.store.get_it... | [
"0.68519795",
"0.57279706",
"0.5535024",
"0.5508442",
"0.54906416",
"0.52880436",
"0.519043",
"0.5162865",
"0.5138621",
"0.5109236",
"0.5016568",
"0.5005245",
"0.4997533",
"0.4953093",
"0.48948973",
"0.4879544",
"0.48764443",
"0.48474765",
"0.4846478",
"0.48400465",
"0.483056... | 0.72941333 | 0 |
r""" Make sure that path_to_location works with a component having multiple chapter parents, from which one of them is orphan course | chapter chapter | | vertical vertical \ / html | def test_path_to_location_for_orphan_chapter(self, module_store):
# Get a course with orphan modules
course = self.create_course_with_orphans(module_store)
orphan_chapter = self.store.get_item(BlockUsageLocator(course.id, 'chapter', 'OrphanChapter'))
chapter1 = self.store.get_item(BlockU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_path_to_location_for_orphan_vertical(self, module_store):\n # Get a course with orphan modules\n course = self.create_course_with_orphans(module_store)\n\n # Fetch the required course components.\n vertical1 = self.store.get_item(BlockUsageLocator(course.id, 'vertical', 'Vertic... | [
"0.6673974",
"0.5610314",
"0.55335754",
"0.5508917",
"0.5464838",
"0.5452091",
"0.5365922",
"0.5188983",
"0.51420873",
"0.5130582",
"0.5111048",
"0.5108325",
"0.5085932",
"0.5063727",
"0.50412863",
"0.5016924",
"0.4946374",
"0.49249142",
"0.49044874",
"0.48972917",
"0.4883611... | 0.7129729 | 0 |
Check if two angles are equal within accuracy. | def equal_angles(a1, a2, angular_accuracy=1e-12): # pragma: no cover
return np.abs(np.fmod(a1 - a2, two_pi)) < angular_accuracy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def almost_equal_values(x, y, precision):\n return round(x - y, precision) == 0",
"def equals(a, b, tol=1e-10):\n return np.abs(a-b) <= tol",
"def test_calculate_angle():\n r1 = np.array([0, 0, -1])\n r2 = np.array([0, 0, 0])\n r3 = np.array([1, 0, 0])\n\n expected_angle = 90\n calcula... | [
"0.661872",
"0.6590631",
"0.6475491",
"0.6450457",
"0.641377",
"0.63739",
"0.63572586",
"0.6297004",
"0.62938595",
"0.62563515",
"0.61981934",
"0.6197667",
"0.61743605",
"0.6155734",
"0.61080444",
"0.61079806",
"0.61033523",
"0.6100595",
"0.60910225",
"0.60875523",
"0.6055375... | 0.8400439 | 0 |
Return the inverse cosine for an array of values | def acos_array(values): # pragma: no cover
result = np.empty_like(values, dtype=nb.float64)
flat_result = result.flat
flat_values = values.flat
for i in range(values.size):
flat_result[i] = acos(flat_values[i])
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cos_inplace(a):",
"def arccos_inplace(a):",
"def cos_vecs(x, y):\r\n _t = np.sum((x * y), axis=1)\r\n norm_x = np.linalg.norm(x, axis=1, keepdims=True)\r\n norm_y = np.linalg.norm(y, axis=1, keepdims=True)\r\n _t = np.reshape(_t, (-1, 1))\r\n ret = _t / (norm_x * norm_y + 1e-10)\r\n retur... | [
"0.71306306",
"0.6606203",
"0.65521806",
"0.6549253",
"0.6530676",
"0.64865565",
"0.64658767",
"0.63147134",
"0.6312855",
"0.6244566",
"0.62053174",
"0.61693215",
"0.61559963",
"0.61559796",
"0.61297685",
"0.6121121",
"0.6117113",
"0.6116147",
"0.6054422",
"0.60528576",
"0.60... | 0.6765562 | 1 |
Calculate a celestial pole based on a reference and native reference. The determination of a celestial pole may involve a few steps. The first is to determine the reference position about the native pole wrt the native reference. The next step involves finding the positions of the northern and southern poles. A number ... | def calculate_celestial_pole(native_reference_x, native_reference_cos_lat,
native_reference_sin_lat,
reference_x, reference_y,
reference_cos_lat, reference_sin_lat,
native_pole_x, native_pole_y,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_celestial_pole_array(native_reference_x,\n native_reference_cos_lat,\n native_reference_sin_lat,\n reference_x, reference_y,\n reference_cos_lat, reference_sin_lat,\... | [
"0.7444774",
"0.55747974",
"0.5164489",
"0.51368463",
"0.5096155",
"0.5082371",
"0.5034727",
"0.50118935",
"0.4989176",
"0.49763885",
"0.49591506",
"0.49584743",
"0.49394202",
"0.48800874",
"0.48643827",
"0.48518947",
"0.4825686",
"0.48082778",
"0.48075664",
"0.48049748",
"0.... | 0.8182503 | 0 |
Calculate the celestial pole when one or more of the inputs are arrays. | def calculate_celestial_pole_array(native_reference_x,
native_reference_cos_lat,
native_reference_sin_lat,
reference_x, reference_y,
reference_cos_lat, reference_sin_lat,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_cape(*args, **kwargs):\n if len(args)<6:\n raise ValueError(\"Too little arguments.\") \n \n if len(args)>6:\n raise ValueError(\"Too many arguments.\") \n \n allowed_vertical_levs = ['sigma', 'pressure']\n if kwargs['vertical_lev'] not in allowed_vertical_l... | [
"0.59027",
"0.54966605",
"0.5482907",
"0.5415061",
"0.54091364",
"0.531746",
"0.52209276",
"0.5217301",
"0.52102226",
"0.51907814",
"0.5146805",
"0.5133443",
"0.5092869",
"0.5082479",
"0.506334",
"0.50527245",
"0.5049143",
"0.5048876",
"0.5026364",
"0.50234246",
"0.50112456",... | 0.60059637 | 0 |
Flight model builder. Creates an instantiation of Flight object with the environment configuration. | def build_flight_v0(env_config={}):
config = {
'birds': 2,
'region': 25.0,
'max_speed': 1.0,
'min_speed': 0.5,
'acceleration': 0.1,
'max_relative_angle': 10.0,
'max_relative_angle_change': 5.0,
'collision_distance': 1.0,
'max_steps': 200,
}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_model(spec, log_path):\n\n # Part of the model to train\n if spec.train_region_layer is not None:\n train_layer = int(spec.train_region_layer[1])\n train_region = spec.train_region_layer[0]\n else:\n train_layer = train_region = None\n\n # Mode... | [
"0.58002007",
"0.5701515",
"0.5554713",
"0.52407736",
"0.52229315",
"0.5219555",
"0.5201309",
"0.5197081",
"0.5165909",
"0.51397014",
"0.51331514",
"0.51066124",
"0.5096215",
"0.5090981",
"0.50857276",
"0.50811327",
"0.50719005",
"0.5052261",
"0.49884057",
"0.49781686",
"0.49... | 0.65134084 | 0 |
Converts resources/demo.mkv ti resources/demo.gif | def convert_gif(ctx):
ctx.run(
'ffmpeg '
'-i resources/demo.mkv -filter_complex "[0:v] palettegen" '
'resources/palette.png',
pty=True
)
ctx.run(
'ffmpeg -i resources/demo.mkv '
'-i resources/palette.png '
'-filter_complex "[0:v][1:v] paletteuse" '
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n convert(\"env_100000.mp4\", TargetFormat.GIF)",
"def make_gif():\n if MIGRATION:\n import imageio\n for n, JPG_DIR in enumerate(JPG_DIRS):\n images, image_file_names = [], []\n for file_name in os.listdir(JPG_DIR):\n if file_name.endswith('.j... | [
"0.6622678",
"0.5854383",
"0.5790127",
"0.5694759",
"0.56610477",
"0.5649121",
"0.56105673",
"0.5523932",
"0.53972006",
"0.53888375",
"0.5377393",
"0.5366196",
"0.5326389",
"0.5314697",
"0.5265247",
"0.52527887",
"0.52226377",
"0.5216119",
"0.51639193",
"0.51375544",
"0.51321... | 0.7098376 | 0 |
Adds a new field to this format. factory the FieldFactory to add rowIndex the row to add the field to colIndex the position in the row for the new field. | def addFactory(self, factory: ghidra.app.util.viewer.field.FieldFactory, rowIndex: int, colIndex: int) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_field(self, field, dim_translation=None):\n raise NotImplementedError",
"def add_field(self, field_data):\n def_field = {'id':None,\n 'ref':None,\n 'posx':'0',\n 'posy':'0',\n 'size':'50',\n ... | [
"0.61408544",
"0.61305493",
"0.61203945",
"0.6119111",
"0.607393",
"0.5931997",
"0.5864733",
"0.57624185",
"0.5679476",
"0.56607974",
"0.5637412",
"0.561021",
"0.5591479",
"0.5582954",
"0.55268484",
"0.55247474",
"0.54971",
"0.5473604",
"0.5463168",
"0.5458677",
"0.54576904",... | 0.79020035 | 0 |
Returns the list factories valid for this format. | def getFactorys(self) -> List[ghidra.app.util.viewer.field.FieldFactory]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_factories(self):\n return self._factories",
"def getUnusedFactories(self) -> List[ghidra.app.util.viewer.field.FieldFactory]:\n ...",
"def getFactorys(self, row: int) -> List[ghidra.app.util.viewer.field.FieldFactory]:\n ...",
"def _getSortedFactoryList(self):\n def myfil... | [
"0.7280242",
"0.6984192",
"0.6591521",
"0.635182",
"0.63049614",
"0.5894855",
"0.57430154",
"0.574213",
"0.571742",
"0.571742",
"0.55867666",
"0.55703557",
"0.55639243",
"0.55495864",
"0.55495864",
"0.55427885",
"0.5514543",
"0.54933774",
"0.5437393",
"0.53609794",
"0.5319609... | 0.75111824 | 0 |
Returns the FieldFactorys on a given row. | def getFactorys(self, row: int) -> List[ghidra.app.util.viewer.field.FieldFactory]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFactorys(self) -> List[ghidra.app.util.viewer.field.FieldFactory]:\n ...",
"def row_factory(self):\n return self._hndl.row_factory",
"def getNumFactorys(self, row: int) -> int:\n ...",
"def _get_fields(self):\n table = self.ui.tableFields\n rows = table.rowCount()\n ... | [
"0.70517284",
"0.6542136",
"0.6033253",
"0.5877667",
"0.57884717",
"0.55768853",
"0.55274045",
"0.5477669",
"0.54262394",
"0.5350718",
"0.5322282",
"0.5297104",
"0.5277221",
"0.52574736",
"0.5244263",
"0.52132905",
"0.52036643",
"0.51951766",
"0.51943964",
"0.5193358",
"0.512... | 0.89031136 | 0 |
Returns the formatMgr that is managing this model. | def getFormatManager(self) -> ghidra.app.util.viewer.format.FormatManager:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_format(cls):\n return cls._format",
"def get_format(self):\n return self._format[0]",
"def _get_format(self, token):\n if token in self._formats:\n return self._formats[token]\n\n if self._style is None:\n result = self._get_format_from_document(token, ... | [
"0.647059",
"0.6441998",
"0.6158822",
"0.60644615",
"0.60211456",
"0.58986527",
"0.5890822",
"0.5841508",
"0.5783076",
"0.5783076",
"0.5768964",
"0.57511973",
"0.5736798",
"0.5680023",
"0.5672631",
"0.5622193",
"0.5611403",
"0.5563566",
"0.5529589",
"0.5529589",
"0.546112",
... | 0.81906265 | 0 |
Returns the number of FieldFactorys on any given row. | def getNumFactorys(self, row: int) -> int:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _count_fields(self, ws):\n\n field_number = 1\n while ws.cell(row=1, column=field_number).value:\n field_number += 1\n\n return field_number",
"def getFactorys(self, row: int) -> List[ghidra.app.util.viewer.field.FieldFactory]:\n ...",
"def get_row_count(self):\n\t\tr... | [
"0.707144",
"0.6703275",
"0.65927416",
"0.65834147",
"0.6415585",
"0.6413078",
"0.6394394",
"0.6394394",
"0.63606465",
"0.6316969",
"0.6253533",
"0.6248731",
"0.61931974",
"0.6192366",
"0.6182892",
"0.61667156",
"0.616093",
"0.6151285",
"0.61381763",
"0.61312497",
"0.61255014... | 0.8756597 | 0 |
Returns the number of rows in the model. | def getNumRows(self) -> int:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_rows(self):\n return self._num_rows",
"def row_count(self) -> int:\n return len(self.rows)",
"def row_count(self) -> int:\n return len(self.rows)",
"def num_rows(self):\n return len(self.rows)",
"def row_count(self):\n return self.__row_count",
"def num_rows... | [
"0.85382944",
"0.84325254",
"0.84325254",
"0.83518374",
"0.8345603",
"0.8314205",
"0.82892334",
"0.8265968",
"0.8252321",
"0.82438457",
"0.8191325",
"0.81005234",
"0.8068524",
"0.8025643",
"0.802367",
"0.7993545",
"0.78939414",
"0.78501284",
"0.78151244",
"0.77863514",
"0.773... | 0.84989536 | 1 |
Notifies the formatMgr that this format model has changed. | def modelChanged(self) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changed(self):\n\t\tpass",
"def changedUpdate(self, e):\n syncJSONtoUI()",
"def FireModified(self):\n self.OnChanged(wx.stc.StyledTextEvent(wx.stc.wxEVT_STC_CHANGE,\n self.GetId()))",
"def _modificationStatusChanged(self, m, editor):\n rai... | [
"0.6258767",
"0.62479717",
"0.5768273",
"0.5753638",
"0.56879294",
"0.56608564",
"0.5641528",
"0.5612631",
"0.55594814",
"0.5542698",
"0.5519396",
"0.5474974",
"0.54238075",
"0.542077",
"0.54032016",
"0.53960854",
"0.53872734",
"0.5383564",
"0.5341094",
"0.5340869",
"0.533569... | 0.6398284 | 0 |
Moves the Field at (oldrow,oldCol) to (row,col) oldRowIndex the row containing the field to be moved. oldColIndex the column index of the field to be moved. newRowIndex the row to move to. newColIndex the column to move to. IllegalArgumentException thrown if any of the parameters don't map to a valid grid position. | def moveFactory(self, oldRowIndex: int, oldColIndex: int, newRowIndex: int, newColIndex: int) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moveRow(self,oldRow,newRow):\n data = self.data\n if oldRow in data:\n data[newRow] = data[oldRow]\n del data[oldRow]\n self.hasChanged = True",
"def move(self, orig_pos, new_pos):\n orig_x, orig_y = orig_pos\n new_x, new_y = new_pos\n\n ori... | [
"0.62077206",
"0.601708",
"0.59981906",
"0.5785699",
"0.5765653",
"0.5518425",
"0.5517453",
"0.5505285",
"0.5385714",
"0.5366501",
"0.5354753",
"0.5332988",
"0.530513",
"0.52745885",
"0.5207108",
"0.51977783",
"0.51455855",
"0.51440024",
"0.5117571",
"0.5116521",
"0.50449264"... | 0.7244527 | 0 |
Notifies that the options have changed. options the Options object that changed. optionName the name of the property that changed. oldValue the old value of the property. newValue the new value of the property. | def optionsChanged(self, options: ghidra.framework.options.Options, optionName: unicode, oldValue: object, newValue: object) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _options_changed(self, name, old, new):\n if self.options_lock.acquire(False):\n try:\n self.options = new\n\n options = self._make_options(new)\n self._options_dict = {i[0]: i[1] for i in options}\n self._options_labels = [i[0] for ... | [
"0.7827445",
"0.6138804",
"0.6094064",
"0.58786595",
"0.5782008",
"0.56666994",
"0.53850913",
"0.52479446",
"0.52174425",
"0.51962477",
"0.5150992",
"0.51342624",
"0.5059312",
"0.50591975",
"0.50372356",
"0.5036521",
"0.4988139",
"0.48260337",
"0.48257986",
"0.48224092",
"0.4... | 0.83006614 | 0 |
Removes a field from the format. rowIndex the row index of the field to remove. colIndex the column index of the field to remove. | def removeFactory(self, rowIndex: int, colIndex: int) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_field_pattern(self):\n self.ui.tableFields.removeRow(self.ui.tableFields.currentRow())",
"def del_column(self, fieldname):\n ...",
"def delete_index_field(DomainName=None, IndexFieldName=None):\n pass",
"def removeRow(self, index: int) -> None:\n ...",
"def del_row(self, row... | [
"0.6373682",
"0.61741483",
"0.61648935",
"0.6061453",
"0.6002145",
"0.59604686",
"0.5894658",
"0.5844929",
"0.5704986",
"0.5682338",
"0.563644",
"0.56145144",
"0.55784667",
"0.5573758",
"0.5531659",
"0.54479194",
"0.54329354",
"0.5431956",
"0.54186803",
"0.5375662",
"0.535982... | 0.68109393 | 0 |
Removes the row currently at the given position. index the index of the row to remove. | def removeRow(self, index: int) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_row(self, index):\n self.data.remove(self.data[index])",
"def remove_row(self, index):\n _ = self.matrix.pop(index) ## Delete row\n self.matrix.append(self.empty_row.copy())",
"def __delitem__(self, index: int) -> None:\n del self._rows[index]",
"def del_row(self, row_inde... | [
"0.7975629",
"0.7843436",
"0.72066915",
"0.714499",
"0.7074064",
"0.7053001",
"0.7003575",
"0.6867011",
"0.67219394",
"0.66743135",
"0.66374546",
"0.66087157",
"0.6607441",
"0.6607441",
"0.64997494",
"0.64031637",
"0.639377",
"0.6378771",
"0.6258577",
"0.6257577",
"0.62363076... | 0.81330836 | 0 |
Restores the format for this model from XML. root the root XML element from which to get the format information. | def restoreFromXml(self, root: org.jdom.Element) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restoreXML(self, parser: ghidra.xml.XmlPullParser) -> None:\n ...",
"def readVersion(self):\n ds = self.root.findall(\"[@format]\")[0]\n raw_format = ds.attrib['format']\n try:\n self.documentFormatVersion = int(raw_format)\n except ValueError:\n # as ... | [
"0.616819",
"0.54438615",
"0.5255168",
"0.5196858",
"0.51881856",
"0.51383513",
"0.5087894",
"0.505456",
"0.502934",
"0.4999702",
"0.4970831",
"0.49589488",
"0.49375942",
"0.48839295",
"0.48085415",
"0.47962382",
"0.47863945",
"0.47836664",
"0.47796443",
"0.47795826",
"0.4770... | 0.6325248 | 0 |
Saves this format to XML. | def saveToXml(self) -> org.jdom.Element:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, pretty=True):\n self.endInstance()\n if pretty:\n _indent(self.root, whitespace=self._whiteSpace)\n tree = ET.ElementTree(self.root)\n tree.write(self.path, encoding=\"utf-8\", method='xml', xml_declaration=True)\n if self.logger:\n self.logge... | [
"0.7337845",
"0.7046538",
"0.69606113",
"0.6809595",
"0.67983425",
"0.6767082",
"0.672196",
"0.6671917",
"0.66456884",
"0.6606948",
"0.6602469",
"0.6588868",
"0.6586242",
"0.65430504",
"0.6538839",
"0.6509083",
"0.6505803",
"0.6463378",
"0.6463378",
"0.6463378",
"0.6463378",
... | 0.73940855 | 0 |
Notifies each row that the services have changed. | def servicesChanged(self) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify(self):\n for customer in self.customers:\n customer.update()",
"def refresh_services(self):\n\n services = self.backend.get_services()\n\n if not isinstance(services, list):\n services = []\n\n self.init_services()\n self.servicesTableWidget.set... | [
"0.63516766",
"0.62918216",
"0.5886318",
"0.5611578",
"0.5547145",
"0.5449485",
"0.54410547",
"0.543627",
"0.5430349",
"0.54259473",
"0.5418192",
"0.5409741",
"0.5330747",
"0.53195155",
"0.53143436",
"0.531014",
"0.5273669",
"0.5265163",
"0.52476156",
"0.52432317",
"0.5218426... | 0.7048437 | 0 |
Sets the base id for this model. Each row in a model gets an id which must be unique across all models. id the base id for this format. | def setBaseRowID(self, id: int) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_=None):\n if id_ is None:\n self.id = id(self)\n else:\n self.id = id_",
"def set_id(self, id_):\n\n self.id_ = id_",
"def setID(self, id):\... | [
"0.6845537",
"0.68056786",
"0.67752975",
"0.6616676",
"0.6573813",
"0.655814",
"0.6558015",
"0.6530799",
"0.6508139",
"0.6508139",
"0.6508139",
"0.6508139",
"0.6508139",
"0.64869297",
"0.64869297",
"0.64869297",
"0.6480976",
"0.6470111",
"0.6470111",
"0.6470111",
"0.6470111",... | 0.7768307 | 0 |
Updates the fields on the given row. index the row to update. | def updateRow(self, index: int) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_update_seatable(data, index, *args):\n row = convert_row(metadata, data)\n print(row)",
"def update_row(self, rowIndex=0, shape=None, *args, **attributes):\n # check if there is a shape edit, if not skip and do attribute update\n if shape:\n if not isinstance(shape, shapefil... | [
"0.6586661",
"0.65689254",
"0.6442689",
"0.6281226",
"0.61595315",
"0.60370123",
"0.59784627",
"0.5939528",
"0.5938257",
"0.5890808",
"0.58457625",
"0.5789747",
"0.57734597",
"0.5755909",
"0.5686738",
"0.5686736",
"0.5677635",
"0.5669604",
"0.56662095",
"0.56515926",
"0.56075... | 0.8230833 | 0 |
Inserts at the start of the LinkedList. | def insert_start(self, data):
if self.head is None:
self.head = ListNode(data)
else:
temp = self.head
self.head = ListNode(data)
self.head.next = temp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _first_insert(self, e):\n self._start = self._Node(e, None, None)\n self._start._prev = self._start\n self._start._next = self._start\n self._size += 1",
"def insert_first(self, item):\n if self.is_empty():\n self._first = item\n self._rest = LinkedListRec([None])\n ... | [
"0.7641221",
"0.7611075",
"0.74270654",
"0.7361757",
"0.72824967",
"0.72736365",
"0.72346425",
"0.7151362",
"0.7131744",
"0.7113231",
"0.70936376",
"0.70571244",
"0.6987067",
"0.69847274",
"0.69678026",
"0.69668454",
"0.69642395",
"0.69482046",
"0.69171953",
"0.6913917",
"0.6... | 0.81024736 | 0 |
Inserts at the end of the LinkedList. | def insert_end(self, data):
if self.head is None:
self.head = ListNode(data)
else:
temp = self.head
while temp.next is not None:
temp = temp.next
temp.next = ListNode(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insertAfter(self,p,e):\r\n \r\n if p == self.tail: #if p is the tail node\r\n e.prev = p #link e to p\r\n p.next = e #link p to e\r\n self.tail = e #set e to be the 'new' tail node\r\n \r\n else:\r\n e.next = p.next #link e to next nod... | [
"0.7420986",
"0.72702175",
"0.71244717",
"0.7027539",
"0.6993729",
"0.69688106",
"0.69421405",
"0.6920485",
"0.6872743",
"0.6851306",
"0.6816791",
"0.67921424",
"0.6716298",
"0.66644937",
"0.66349274",
"0.6625815",
"0.66023135",
"0.6585094",
"0.65703344",
"0.65688545",
"0.652... | 0.7885683 | 0 |
Download model from source to target directory | def download_model(source, target, filename):
if not os.path.exists(target):
os.mkdir(target)
target_file = str(Path(target).joinpath(filename))
if os.path.exists(target_file):
print('model already exists, skipping download')
return
print("Downloading from {} to {}".format(sourc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_model():\n logging.info(\"[genreml] Downloading model...\")\n with urllib.request.urlopen(config.FMAModelConfig.FMA_MODEL_URL) as f:\n data = f.read()\n open(config.FMAModelConfig.FMA_MODEL_PATH, 'wb').write(data)\n logging.info(\"[genreml] Model download complete\")",
"def do... | [
"0.69766647",
"0.69662714",
"0.68990195",
"0.6888807",
"0.67307734",
"0.6724415",
"0.6684481",
"0.6671754",
"0.66615635",
"0.6648242",
"0.6632067",
"0.662573",
"0.6603687",
"0.6602338",
"0.6566665",
"0.65553707",
"0.6541387",
"0.64643264",
"0.64275885",
"0.6423361",
"0.641697... | 0.7976202 | 0 |
Gets the policyid of this CreateCcRuleResponse. Policy ID. | def policyid(self):
return self._policyid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policy_id(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"policy_id\")",
"def policy_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"policy_id\")",
"def policy_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"policy_id\")",
"def policy_id(self... | [
"0.71869653",
"0.70272726",
"0.66735554",
"0.65377337",
"0.6409638",
"0.61068887",
"0.58747417",
"0.5775966",
"0.5775966",
"0.57558006",
"0.5664476",
"0.5654184",
"0.5654184",
"0.5654184",
"0.56081605",
"0.5586304",
"0.55531263",
"0.55446535",
"0.5529159",
"0.55233705",
"0.55... | 0.7301752 | 0 |
Sets the policyid of this CreateCcRuleResponse. Policy ID. | def policyid(self, policyid):
self._policyid = policyid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policy_id(self, policy_id):\n\n self._policy_id = policy_id",
"def policy_id(self, policy_id):\n\n self._policy_id = policy_id",
"def rule_id(self, rule_id):\n if self.local_vars_configuration.client_side_validation and rule_id is None: # noqa: E501\n raise ValueError(\"Inv... | [
"0.68123084",
"0.68123084",
"0.54625875",
"0.5370309",
"0.52680314",
"0.5140868",
"0.50436664",
"0.49458042",
"0.49458042",
"0.47753757",
"0.47435704",
"0.46656474",
"0.4633625",
"0.46130386",
"0.45901033",
"0.45841998",
"0.4564423",
"0.45584872",
"0.45259494",
"0.45065802",
... | 0.6867485 | 0 |
Gets the tag_condition of this CreateCcRuleResponse. | def tag_condition(self):
return self._tag_condition | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def condition(self) -> typing.Optional[\"RoutingRuleCondition\"]:\n return self._values.get('condition')",
"def condition(self) -> str | None:\n return self._condition",
"def condition(self) -> ExpressionNode:\n return self.__condition",
"def tag_condition(self, tag_condition):\n ... | [
"0.5777941",
"0.5621604",
"0.5565924",
"0.5528331",
"0.54846156",
"0.54621404",
"0.5443797",
"0.5443797",
"0.5443797",
"0.5443797",
"0.5443797",
"0.5443797",
"0.5439315",
"0.5410065",
"0.536127",
"0.5293487",
"0.5289721",
"0.5211088",
"0.520824",
"0.51013833",
"0.5053311",
... | 0.7523746 | 0 |
Sets the tag_condition of this CreateCcRuleResponse. | def tag_condition(self, tag_condition):
self._tag_condition = tag_condition | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def condition(self, condition):\n\n self._condition = condition",
"def tag_condition(self):\n return self._tag_condition",
"def condition(self, condition):\n if condition is None:\n raise ValueError(\"Invalid value for `condition`, must not be `None`\") # noqa: E501\n\n ... | [
"0.5934701",
"0.56182176",
"0.5572175",
"0.54196936",
"0.49960527",
"0.48137155",
"0.4766937",
"0.45994985",
"0.45828286",
"0.45486715",
"0.45435458",
"0.4495025",
"0.44897833",
"0.4488304",
"0.4404059",
"0.4404059",
"0.4404059",
"0.4404059",
"0.43572104",
"0.430792",
"0.4297... | 0.7465573 | 0 |
Contour a threedimensional array. | def contour_array(self, a, masked_values=None, head=None, **kwargs):
return self.__cls.contour_array(a=a, masked_values=masked_values,
head=head, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def points2contour(points):\n return points.reshape(-1, 1, 2)",
"def compute_contour(ptr_array):\n hull = ConvexHull(ptr_array)\n contour_index = hull.vertices.tolist() # indices are ordered\n # contour_index = hull.simplices.flatten()\n # contour_index = list(set(contour_index))\n return conto... | [
"0.6495765",
"0.62482005",
"0.5919016",
"0.58844334",
"0.58559674",
"0.58167905",
"0.5746248",
"0.55017674",
"0.5500378",
"0.5500378",
"0.54654455",
"0.5443554",
"0.5441754",
"0.5435644",
"0.5405775",
"0.53947777",
"0.5378676",
"0.5354499",
"0.53407866",
"0.53407866",
"0.5335... | 0.69363064 | 0 |
Make a plot of inactive cells. If not specified, then pull ibound from the self.ml | def plot_inactive(self, ibound=None, color_noflow='black', **kwargs):
if ibound is None:
if self.mg.idomain is None:
raise AssertionError("An idomain array must be provided")
else:
ibound = self.mg.idomain
plotarray = np.zeros(ibound.shape, dtype=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_ibound(self, ibound=None, color_noflow='black', color_ch='blue',\n color_vpt=\"red\", head=None, **kwargs):\n if ibound is None:\n if self.model is not None:\n if self.model.version == \"mf6\":\n color_ch = color_vpt\n\n if ... | [
"0.6793472",
"0.6435513",
"0.6226952",
"0.6197965",
"0.6087646",
"0.6082036",
"0.6072707",
"0.5890653",
"0.5845146",
"0.5708131",
"0.570506",
"0.56773657",
"0.5546332",
"0.55104244",
"0.5503366",
"0.54982764",
"0.54506254",
"0.54084057",
"0.53955626",
"0.5377102",
"0.5358153"... | 0.69416565 | 0 |
Make a plot of ibound. If not specified, then pull ibound from the self.model | def plot_ibound(self, ibound=None, color_noflow='black', color_ch='blue',
color_vpt="red", head=None, **kwargs):
if ibound is None:
if self.model is not None:
if self.model.version == "mf6":
color_ch = color_vpt
if self.mg.idomain ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_inactive(self, ibound=None, color_noflow='black', **kwargs):\n if ibound is None:\n if self.mg.idomain is None:\n raise AssertionError(\"An idomain array must be provided\")\n else:\n ibound = self.mg.idomain\n\n plotarray = np.zeros(ibound... | [
"0.61201423",
"0.5950144",
"0.59287924",
"0.5905448",
"0.58188736",
"0.56528",
"0.56048554",
"0.5590214",
"0.55823106",
"0.5506755",
"0.5493123",
"0.54735786",
"0.547004",
"0.5418166",
"0.54177845",
"0.5400533",
"0.5400077",
"0.5400077",
"0.5393774",
"0.5358371",
"0.5327433",... | 0.6918703 | 0 |
Get a LineCollection of the grid | def get_grid_line_collection(self, **kwargs):
return self.__cls.get_grid_line_collection(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grid_lines(self):\n # get edges initially in model coordinates\n use_ref_coords = self.use_ref_coords\n self.use_ref_coords = False\n xyedges = self.xyedges\n self.use_ref_coords = use_ref_coords\n\n xmin = xyedges[0][0]\n xmax = xyedges[0][-1]\n ymin = x... | [
"0.74788254",
"0.701267",
"0.6906031",
"0.6777046",
"0.64637226",
"0.6285276",
"0.6179306",
"0.6143224",
"0.6108909",
"0.60587543",
"0.60587543",
"0.6028593",
"0.59662163",
"0.59461606",
"0.5920467",
"0.5905517",
"0.58867365",
"0.5875234",
"0.58731395",
"0.5869862",
"0.583123... | 0.8864053 | 0 |
Convert rois into the torchvision format. | def _convert_boxes_to_roi_format(boxes):
concat_boxes = boxes.view((-1, 4))
ids = torch.full_like(boxes[:, :, :1], 0)
for i in range(boxes.shape[0]):
ids[i, :, :] = i
ids = ids.view((-1, 1))
rois = torch.cat([ids, concat_boxes], dim=1)
return rois | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_torch(self, nnlist):\n\n # Store weights and bias.\n self.w1 = np.array([nn.model.lin1.weight.data.numpy()\n for nn in nnlist])\n self.b1 = np.expand_dims(np.array([nn.model.lin1.bias.data.numpy()\n for nn in nnl... | [
"0.5301525",
"0.5161884",
"0.51550317",
"0.5143156",
"0.50910634",
"0.5077972",
"0.5060601",
"0.5047744",
"0.5037088",
"0.5009298",
"0.49832073",
"0.4966521",
"0.49586627",
"0.49393073",
"0.49243096",
"0.49045298",
"0.49044615",
"0.48911023",
"0.48892003",
"0.48779207",
"0.48... | 0.58418274 | 0 |
Check whether a nonpositive nu parameter raises a ValueError. | def test_nonpositive_nu_raises_exception(nu):
with pytest.raises(ValueError):
kernels.Matern(input_dim=1, nu=nu) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_negative_values(self):\n rain = self.rain_prob_cube\n high_prob = self.high_prob_cube\n msg = \"Negative values of sleet probability have been calculated.\"\n with self.assertRaisesRegex(ValueError, msg):\n calculate_sleet_probability(rain, high_prob)",
"def test_n... | [
"0.6613512",
"0.6525453",
"0.652385",
"0.64527684",
"0.63773626",
"0.63730496",
"0.6358268",
"0.63549554",
"0.6334748",
"0.63089204",
"0.6238872",
"0.6238872",
"0.6206772",
"0.61980456",
"0.61870426",
"0.61626995",
"0.613118",
"0.6126868",
"0.6073664",
"0.60554725",
"0.605300... | 0.69593793 | 0 |
Test whether a Matern kernel with nu large is close to an RBF kernel. | def test_nu_large_recovers_rbf_kernel(x0: np.ndarray, x1: np.ndarray, input_dim: int):
lengthscale = 1.25
kernmat_rbf = kernels.ExpQuad(lengthscale=lengthscale, input_dim=input_dim)
kernmat_matern = kernels.Matern(lengthscale=lengthscale, nu=15, input_dim=input_dim)
np.testing.assert_allclose(
k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kernel_test(l, v):\n\t\"Testing RBF and Matern kernels with: \"\n\tx = np.array([1,2,3,4])\n\ty = np.array([2,4,6])\n\tprint(x)\n\tprint(y)\n\tprint(\"RBF Kernel with l= \" + str(l) + \": \")\n\tprint(rbf_kernel(x,y,l))\n\tprint(\"Matern Kernel with l= \" + str(l) + \" and v= \" + str(v) + \": \")\n\tprint(mat... | [
"0.59596187",
"0.59069663",
"0.57982355",
"0.5762997",
"0.574996",
"0.574996",
"0.57257026",
"0.569043",
"0.5553753",
"0.55366164",
"0.5533788",
"0.54957527",
"0.5424191",
"0.53493965",
"0.5319997",
"0.5310438",
"0.53085715",
"0.52892303",
"0.52797973",
"0.5271721",
"0.526000... | 0.7476965 | 0 |
Peform a search given a query and return all results as Event objects. | def make_search(self, query_text):
query = metapy.index.Document()
query.content(query_text)
top_docs = self.ranker.score(self.idx, query, num_results=100)
events = []
for num, (d_id, _) in enumerate(top_docs):
events.append(Event(self.idx, d_id))
return event... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _search_events(self, query_string, rows=None, start=None, from_date=None, until_date=None,\n order=None, callback=None, output_format=None, fields=None):\n\n query_params = {\n 'q': query_string\n }\n\n if rows is not None:\n query_params['rows']... | [
"0.7027951",
"0.69834673",
"0.6553072",
"0.6551093",
"0.6524338",
"0.65016407",
"0.6470897",
"0.64449614",
"0.63932514",
"0.6381891",
"0.6250921",
"0.6223482",
"0.62085515",
"0.6198889",
"0.61800545",
"0.6131493",
"0.6126554",
"0.6095389",
"0.6062712",
"0.605151",
"0.60276216... | 0.717366 | 0 |
Builds the plan. First, run the function to be converted in a plan in a context which activates the tracing and record the actions in trace.logs Second, store the result ids temporarily to helper ordering the output placeholders at return time Third, loop through the trace logs and replace the tensors found in the acti... | def build(self, *args, trace_autograd=False):
# Reset previous build
self.role.reset()
def build_nested_arg(arg, leaf_function):
if isinstance(arg, list):
return [build_nested_arg(obj, leaf_function) for obj in arg]
elif isinstance(arg, tuple):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_plan(self):\n assert False, \"Not implemented.\"",
"def summarize_plan(plan: Generator):\n read_cache: list[str] = []\n daq_keys = ['events', 'record', 'use_l3t', 'duration']\n daq_cfg = {k: None for k in daq_keys}\n for msg in plan:\n cmd = msg.command\n if cmd == 'ope... | [
"0.5727875",
"0.55467755",
"0.5489103",
"0.5481745",
"0.5453218",
"0.5431434",
"0.5415068",
"0.5357479",
"0.52855635",
"0.5210805",
"0.5196097",
"0.51109934",
"0.51109934",
"0.51109934",
"0.51109934",
"0.51109934",
"0.51109934",
"0.51109934",
"0.51109934",
"0.51109934",
"0.51... | 0.5796057 | 0 |
Creates a copy of a plan. | def copy(self):
plan_copy = Plan(
name=self.name,
role=self.role.copy(),
include_state=self.include_state,
is_built=self.is_built,
id=sy.ID_PROVIDER.pop(),
owner=self.owner,
tags=self.tags,
input_types=self.input_typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_plan(modeladmin, request, queryset):\n for plan in queryset:\n plan_copy = deepcopy(plan)\n plan_copy.id = None\n plan_copy.available = False\n plan_copy.default = False\n plan_copy.created = None\n plan_copy.save(force_insert=True)\n\n for pricing in pl... | [
"0.6852751",
"0.679583",
"0.65226287",
"0.64998025",
"0.6474493",
"0.6317777",
"0.608116",
"0.59949726",
"0.5927801",
"0.5925487",
"0.5921649",
"0.5866671",
"0.58412504",
"0.5676104",
"0.5631718",
"0.56008047",
"0.55228895",
"0.5512021",
"0.5488207",
"0.5482737",
"0.54569125"... | 0.84749585 | 0 |
Add new tensors or parameter attributes to the state and register them in the owner's registry | def __setattr__(self, name, value):
if isinstance(value, torch.jit.ScriptModule):
object.__setattr__(self, name, value)
elif isinstance(value, FrameworkTensor):
self.role.register_state_tensor(value)
self.state_attributes[name] = value
elif isinstance(value, F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_params(self, node_entry, idx):\n param_name = node_entry[\"name\"]\n assert param_name in self._params, (\n f\"The parameter {param_name} is not present\" \"in params dict provided.\"\n )\n value = self._params[param_name]\n numpy_array = value.numpy()\n ... | [
"0.5817026",
"0.56752867",
"0.56506884",
"0.5634208",
"0.5613756",
"0.5608805",
"0.56055236",
"0.55511767",
"0.5536855",
"0.55351466",
"0.5527946",
"0.55101806",
"0.5506572",
"0.5473313",
"0.5450945",
"0.5450945",
"0.54131585",
"0.53989476",
"0.5382999",
"0.5371128",
"0.53622... | 0.69904757 | 0 |
Send plan to locations. If the plan was not built locally it will raise an exception. If `force` = true plan is going to be sent either way. | def send(self, *locations: AbstractWorker) -> PointerPlan:
if not self.is_built:
raise RuntimeError("A plan needs to be built before being sent to a worker.")
if len(locations) == 1:
location = locations[0]
# Check if plan was already sent at the location
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendWaypoints(self,waypoints):\n self.broadcaster.sendWaypoints(waypoints)",
"def plan(self, plan):\n\n self._plan = plan",
"def executePlan(self, plan, wait=True):\n return self.move_group.execute(plan, wait)",
"def force(self, **kwargs):\n log.info(\"Forcing a build\")\n ... | [
"0.5229927",
"0.49953502",
"0.49938816",
"0.493424",
"0.49075943",
"0.48620492",
"0.48481935",
"0.48335013",
"0.48335013",
"0.4832164",
"0.47803968",
"0.47744128",
"0.4767237",
"0.47662288",
"0.47231078",
"0.47083315",
"0.47050223",
"0.4696659",
"0.46513912",
"0.46231553",
"0... | 0.56450635 | 0 |
Returns dummy arguments matching built Plan arguments' types | def create_dummy_args(self):
if not self.is_built:
raise RuntimeError("A plan needs to be built before input shapes can be known.")
def traverse_nested_types(arg, leaf_function):
if isinstance(arg, list):
return [traverse_nested_types(obj, leaf_function) for obj ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_map_args_all_none():\n pass",
"def dummy(*args, **kwargs):\r\n pass",
"def get_arg_types(header):\n data_types = [param.dataType for param in header.params]\n\n if not data_types:\n return ArgType.Empty\n elif len(set(data_types)) > 1 or all(data_type == SSE.DUAL ... | [
"0.57025886",
"0.55594367",
"0.5524881",
"0.55104053",
"0.54975",
"0.5478878",
"0.54646266",
"0.54250145",
"0.5392406",
"0.5387283",
"0.5387283",
"0.5387283",
"0.5387283",
"0.5387283",
"0.5387283",
"0.5387283",
"0.53500795",
"0.53441447",
"0.5342106",
"0.5299628",
"0.529179",... | 0.67492557 | 0 |
This function takes the attributes of a Plan and saves them in a tuple | def simplify(worker: AbstractWorker, plan: "Plan") -> tuple:
if not plan.is_built:
raise RuntimeError("A Plan needs to be built before being serialized.")
return (
sy.serde.msgpack.serde._simplify(worker, plan.id),
sy.serde.msgpack.serde._simplify(worker, plan.role),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_tuple(self):\n\n return (self.raw_data.get('bill', {}).get(\"type\"),\n self.raw_data.get('chamber'),\n self.raw_data.get('session'),\n self.raw_data.get('date'),\n self._total_votes_cast(),\n self.passage_requirement,\n ... | [
"0.5932355",
"0.5735116",
"0.557209",
"0.5570147",
"0.5499327",
"0.54990005",
"0.5497273",
"0.5456071",
"0.5422196",
"0.5382225",
"0.5355775",
"0.5291805",
"0.5252838",
"0.5220064",
"0.5205926",
"0.5151995",
"0.514728",
"0.5133109",
"0.5117357",
"0.5113718",
"0.510015",
"0.... | 0.5782087 | 1 |
This function reconstructs a Plan object given its attributes in the form of a tuple. | def detail(worker: AbstractWorker, plan_tuple: tuple) -> "Plan":
(id_, role, include_state, name, tags, description, torchscript, input_types) = plan_tuple
id_ = sy.serde.msgpack.serde._detail(worker, id_)
role = sy.serde.msgpack.serde._detail(worker, role)
name = sy.serde.msgpack.serde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simplify(worker: AbstractWorker, plan: \"Plan\") -> tuple:\n if not plan.is_built:\n raise RuntimeError(\"A Plan needs to be built before being serialized.\")\n\n return (\n sy.serde.msgpack.serde._simplify(worker, plan.id),\n sy.serde.msgpack.serde._simplify(work... | [
"0.5720472",
"0.5496961",
"0.5479268",
"0.54163134",
"0.5414201",
"0.5380381",
"0.53612334",
"0.5306046",
"0.5265486",
"0.52468425",
"0.5234324",
"0.52126586",
"0.5187922",
"0.5173838",
"0.51701283",
"0.515798",
"0.51482993",
"0.51377237",
"0.51330197",
"0.51281714",
"0.51090... | 0.56970155 | 1 |
This function takes the attributes of a Plan and saves them in a Protobuf message | def bufferize(worker: AbstractWorker, plan: "Plan") -> PlanPB:
if not plan.is_built:
raise RuntimeError("A Plan needs to be built before being serialized.")
protobuf_plan = PlanPB()
sy.serde.protobuf.proto.set_protobuf_id(protobuf_plan.id, plan.id)
protobuf_plan.role.CopyF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self, buff):\n try:\n buff.write(_get_struct_b().pack(self.error))\n length = len(self.start_pos)\n buff.write(_struct_I.pack(length))\n pattern = '<%sf'%length\n buff.write(struct.pack(pattern, *self.start_pos))\n length = len(self.target_pos)\n buff.write(_stru... | [
"0.5734218",
"0.5666716",
"0.5543517",
"0.55234766",
"0.53101003",
"0.5298435",
"0.52492136",
"0.52451",
"0.52413785",
"0.52261215",
"0.52015626",
"0.5186328",
"0.5172607",
"0.5154945",
"0.5114013",
"0.5107917",
"0.5098729",
"0.5079575",
"0.50771827",
"0.5066785",
"0.50645477... | 0.6183537 | 0 |
This function reconstructs a Plan object given its attributes in the form of a Protobuf message | def unbufferize(worker: AbstractWorker, protobuf_plan: PlanPB) -> "Plan":
id_ = sy.serde.protobuf.proto.get_protobuf_id(protobuf_plan.id)
role = sy.serde.protobuf.serde._unbufferize(worker, protobuf_plan.role)
name = protobuf_plan.name
tags = set(protobuf_plan.tags) if protobuf_plan.ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bufferize(worker: AbstractWorker, plan: \"Plan\") -> PlanPB:\n if not plan.is_built:\n raise RuntimeError(\"A Plan needs to be built before being serialized.\")\n\n protobuf_plan = PlanPB()\n\n sy.serde.protobuf.proto.set_protobuf_id(protobuf_plan.id, plan.id)\n\n protobu... | [
"0.63206017",
"0.61841536",
"0.5835459",
"0.5790261",
"0.569005",
"0.55401856",
"0.5442663",
"0.54380345",
"0.54332626",
"0.5409316",
"0.540098",
"0.5369381",
"0.53568256",
"0.5352154",
"0.534639",
"0.5332706",
"0.5300507",
"0.5285836",
"0.5265404",
"0.5259517",
"0.52550447",... | 0.6413197 | 0 |
Injects a service into the endpoint handler One kwarg to inject endpoint self | def set_service(self):
if self.service:
self.service = self.service(
json=self.json,
google_user=self.google_user,
endpoint=self
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_service_endpoint(self) -> global___Snippet.ClientInitialization.ServiceEndpoint:",
"def add_endpoint(self, endpoint, **kwargs):\n endpoint.arguments = kwargs\n self.endpoints.append(endpoint)",
"def __create_handler():\n if not ServiceHandler.instance:\n ServiceHandler.instan... | [
"0.67849916",
"0.6163761",
"0.6140899",
"0.6131261",
"0.6115672",
"0.61037457",
"0.609442",
"0.6093532",
"0.5899057",
"0.5888621",
"0.5858717",
"0.5850539",
"0.5833035",
"0.58201826",
"0.57162285",
"0.56638664",
"0.56572086",
"0.5550377",
"0.55303967",
"0.550755",
"0.5488332"... | 0.62399554 | 1 |
Converts a layer from the ``decoded_data`` to a PIL image. | def extract_layer_image(decoded_data, layer_index):
layers = decoded_data.layer_and_mask_data.layers
layer = layers.layer_records[layer_index]
return _channel_data_to_PIL(
channel_data = layers.channel_image_data[layer_index],
channel_ids = _get_layer_channel_ids(layer),
color_mode ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_image(self, image_data):\n image = self._sess.run(self._decode,\n feed_dict={self._decode_data : image_data})\n if len(image.shape) != 3 or image.shape[2] not in (1,3):\n raise ValueError('The image channels not supported.')\n \n return i... | [
"0.5762077",
"0.57615674",
"0.57216966",
"0.57216966",
"0.5654094",
"0.5606342",
"0.5569526",
"0.5563922",
"0.5421708",
"0.5386318",
"0.5373703",
"0.53604245",
"0.5322284",
"0.5310209",
"0.52995133",
"0.5287944",
"0.52832884",
"0.5254009",
"0.51791453",
"0.509436",
"0.509436"... | 0.7293048 | 0 |
Converts a composite (merged) image from the ``decoded_data`` to a PIL image. | def extract_composite_image(decoded_data):
header = decoded_data.header
size = header.width, header.height
if size == (0, 0):
return
channel_ids = _get_header_channel_ids(header)
if channel_ids is None:
warnings.warn("This number of channels (%d) is unsupported for this color mode (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_layer_image(decoded_data, layer_index):\n layers = decoded_data.layer_and_mask_data.layers\n layer = layers.layer_records[layer_index]\n\n return _channel_data_to_PIL(\n channel_data = layers.channel_image_data[layer_index],\n channel_ids = _get_layer_channel_ids(layer),\n ... | [
"0.62715465",
"0.59889084",
"0.58903986",
"0.58246094",
"0.58219075",
"0.5705256",
"0.56908286",
"0.56689197",
"0.56474483",
"0.5576176",
"0.55512255",
"0.54979455",
"0.5438436",
"0.5428597",
"0.540524",
"0.5393021",
"0.5373285",
"0.5356585",
"0.5303299",
"0.53026646",
"0.530... | 0.81569755 | 0 |
Return ICC image profile if it exists and was correctly decoded | def get_icc_profile(decoded_data):
# fixme: move this function somewhere?
icc_profiles = [res.data for res in decoded_data.image_resource_blocks
if res.resource_id == ImageResourceID.ICC_PROFILE]
if not icc_profiles:
return None
icc_profile = icc_profiles[0]
if isinstan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_profile(self):\n self.cim.get_profile(customer_profile_id=u\"123\")",
"def ldap_get_picture(self, user):\n result = super(Auth42, self)._search_not_empty(user)\n if result is not None:\n print result\n picture = result.get(\"picture\")[0]\n retur... | [
"0.6070619",
"0.6022303",
"0.60212237",
"0.59180075",
"0.58640176",
"0.5746468",
"0.57095665",
"0.5667937",
"0.56507224",
"0.5561636",
"0.55598253",
"0.5548127",
"0.5547028",
"0.5540286",
"0.5503591",
"0.5455416",
"0.5454931",
"0.5410225",
"0.5400544",
"0.5388901",
"0.5387931... | 0.8131241 | 0 |
Apply opacity to an image. | def apply_opacity(im, opacity):
if im.mode == 'RGB':
im.putalpha(opacity)
return im
elif im.mode == 'RGBA':
r, g, b, a = im.split()
opacity_scale = opacity / 255
a = a.point(lambda i: i*opacity_scale)
return Image.merge('RGBA', [r, g, b, a])
else:
rais... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opacity(im,alpha):\n if im.mode != 'RGBA':\n im = im.convert('RGBA')\n else:\n im = im.copy()\n alphachannel = im.split()[3]\n alphachannel = ImageEnhance.Brightness(alphachannel).enhance(alpha)\n im.putalpha(alphachannel)\n return im",
"def reduce_opacity(im, opacity):\n i... | [
"0.80390346",
"0.7619555",
"0.7565845",
"0.75604177",
"0.6937739",
"0.67144203",
"0.6634033",
"0.66251636",
"0.65493864",
"0.6545953",
"0.6525783",
"0.6498599",
"0.6426075",
"0.63604033",
"0.634712",
"0.6313973",
"0.6294091",
"0.6294017",
"0.6184413",
"0.6150874",
"0.60593086... | 0.847726 | 0 |
str, names of pins | def get_pinnames(self):
return self.pnames | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def names(self) -> list[str]:",
"def names():\n pass",
"def __str__(self):\n \n return (\n f\"Pin: {self.__pin}\"\n f\"\\nHostname: {self.get_hostname()}\"\n f\"\\nIP: {self.get_ip()}\"\n f\"\\nInput status: {self.get_input_status()}\"\n ... | [
"0.5832446",
"0.5803371",
"0.5697869",
"0.5649375",
"0.55813473",
"0.5581336",
"0.5528313",
"0.54932445",
"0.5483449",
"0.5472478",
"0.54503316",
"0.5420818",
"0.54014385",
"0.53811485",
"0.53804946",
"0.53698856",
"0.5363202",
"0.5342639",
"0.53175026",
"0.53121597",
"0.5304... | 0.71020436 | 0 |
Test timings. Process all the configuration files in the test_config directory matching timing_.yaml and check the results. | async def test_timings(hass: ha.HomeAssistant, skip_setup):
for fname in glob.glob(test_config_dir + "timing_*.yaml"):
print(f"Processing: {fname}")
config = CONFIG_SCHEMA(load_yaml_config_file(fname))
if ha.DOMAIN in config:
await async_process_ha_core_config(hass, config[ha.D... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testRunConfiguration(self):\n loader = Loader()\n loader.loadFromDirectory(self.__exampleDirectory)\n\n self.assertEqual(len(loader.taskHolders()), 1)\n\n taskHolder = loader.taskHolders()[0]\n\n taskHolder.addVar(\n \"prefix\",\n self.__exampleTargetPre... | [
"0.6311969",
"0.6079315",
"0.5889518",
"0.5759367",
"0.5702001",
"0.5604116",
"0.5563912",
"0.5560916",
"0.55545783",
"0.55486107",
"0.5537799",
"0.55211496",
"0.55090004",
"0.550692",
"0.5489931",
"0.5480178",
"0.5471643",
"0.5471039",
"0.5469135",
"0.5458825",
"0.54544896",... | 0.77829176 | 0 |
Suitable for sorting array length of which is far bigger than alphabet O(n) = R + N where R is alphabet N is len of array Sort is stable | def count_sorting(array):
count = Counter(array)
alphabet = sorted(count.keys())
for letter, next_letter in zip(alphabet, alphabet[1:]):
count[next_letter] += count[letter]
previous = 0
for letter in alphabet:
previous, count[letter] = count[letter], previous
aux = array[:]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bigSorting(unsorted):\n lookup = defaultdict(lambda: [])\n print(lookup)\n for num_string in unsorted:\n lookup[len(num_string)].append(num_string)\n\n results = []\n lengths = list(lookup.keys())\n lengths.sort()\n for length in lengths:\n x = lookup[length]\n x.sort(... | [
"0.7006573",
"0.6585097",
"0.6567631",
"0.65324765",
"0.6508851",
"0.6291564",
"0.61703134",
"0.6094652",
"0.60851157",
"0.60026604",
"0.5976975",
"0.5965081",
"0.5949878",
"0.5949748",
"0.5946872",
"0.5933886",
"0.5910322",
"0.5902698",
"0.58937323",
"0.5888765",
"0.5882142"... | 0.6647502 | 1 |
Asserts that a check of the given lines with the given local bear either yields or does not yield any results. | def check_validity(self,
local_bear,
lines,
filename=None,
valid=True,
force_linebreaks=True,
create_tempfile=True,
tempfile_kwargs={}):
assert isinsta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_lines(self, lines: Sequence[str], needed_lines: NeedLines, ignore_spaces: bool = True) -> None:\n if ignore_spaces:\n lines = [vdns.common.compact_spaces(x) for x in lines]\n needed_lines0 = needed_lines\n needed_lines = []\n for line in needed_lines0:\... | [
"0.6415525",
"0.6258591",
"0.6175178",
"0.606589",
"0.60321593",
"0.5958627",
"0.5910324",
"0.5549529",
"0.5541374",
"0.5513141",
"0.5494467",
"0.54903716",
"0.5461839",
"0.53709966",
"0.53559434",
"0.5304975",
"0.52981645",
"0.529743",
"0.5291794",
"0.5274744",
"0.5261919",
... | 0.67332256 | 0 |
Asserts that a check of the given lines with the given local bear does yield exactly the given results. | def check_results(self,
local_bear,
lines,
results,
filename=None,
check_order=False,
force_linebreaks=True,
create_tempfile=True,
tempfile_kwar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_validity(self,\n local_bear,\n lines,\n filename=None,\n valid=True,\n force_linebreaks=True,\n create_tempfile=True,\n tempfile_kwargs={}):\n a... | [
"0.7150737",
"0.61911047",
"0.6114998",
"0.60883915",
"0.58336574",
"0.5641357",
"0.5551499",
"0.5543291",
"0.53952456",
"0.539478",
"0.53812826",
"0.53414416",
"0.53187835",
"0.52950704",
"0.52593815",
"0.5251897",
"0.523191",
"0.5226482",
"0.5224359",
"0.52174973",
"0.51967... | 0.7231649 | 0 |
Generates a test for a local bear by checking the given valid and invalid | def verify_local_bear(bear,
valid_files,
invalid_files,
filename=None,
settings={},
force_linebreaks=True,
create_tempfile=True,
timeout=None,
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_validity(self,\n local_bear,\n lines,\n filename=None,\n valid=True,\n force_linebreaks=True,\n create_tempfile=True,\n tempfile_kwargs={}):\n a... | [
"0.628023",
"0.60335445",
"0.57506186",
"0.56963545",
"0.56937087",
"0.5604104",
"0.5575294",
"0.55561817",
"0.5555509",
"0.5507285",
"0.5500143",
"0.5476482",
"0.54592216",
"0.545823",
"0.54504985",
"0.54379326",
"0.5428516",
"0.5416589",
"0.54055274",
"0.5402186",
"0.540201... | 0.62481314 | 1 |
update_balancer(b, protocol='HTTPS'), then get_balancer('3130') | def _v1_0_11111_loadbalancers_3130(self, method, url, body, headers):
if method == "PUT":
json_body = json.loads(body)
self.assertDictEqual(json_body, {"protocol": "HTTPS"})
return (httplib.ACCEPTED, "", {}, httplib.responses[httplib.ACCEPTED])
elif method == "GET":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balancer():\n pass",
"def _v1_0_11111_loadbalancers_3137(self, method, url, body, headers):\n if method == \"PUT\":\n json_body = json.loads(body)\n self.assertDictEqual(json_body, {\"protocol\": \"IMAPv4\"})\n return (httplib.ACCEPTED, \"\", {}, httplib.responses[h... | [
"0.6726276",
"0.6334141",
"0.63198364",
"0.6286935",
"0.62173873",
"0.62109286",
"0.61254036",
"0.6060142",
"0.6046123",
"0.6010055",
"0.58612436",
"0.5831774",
"0.56906956",
"0.5634523",
"0.5445967",
"0.5371479",
"0.53357",
"0.53116953",
"0.5206573",
"0.51914835",
"0.5189438... | 0.66761094 | 1 |
update_balancer(b, port=443), then get_balancer('3131') | def _v1_0_11111_loadbalancers_3131(self, method, url, body, headers):
if method == "PUT":
json_body = json.loads(body)
self.assertDictEqual(json_body, {"port": 1337})
return (httplib.ACCEPTED, "", {}, httplib.responses[httplib.ACCEPTED])
elif method == "GET":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balancer():\n pass",
"def network_load_balancer_update(event, context):\n print(\"NLB update Time remaining (MS):\", context.get_remaining_time_in_millis()) \n logger.info('Running network load balancer update')\n fwcontext = lib.get_ssl_context()\n total_fw_az = len(fw_azs)\n\n\n #Search... | [
"0.68570095",
"0.6042351",
"0.60051835",
"0.5985959",
"0.59674585",
"0.5960794",
"0.5902855",
"0.58358115",
"0.5784925",
"0.57206845",
"0.56373066",
"0.56303596",
"0.5569621",
"0.55447894",
"0.5453422",
"0.53167725",
"0.5287223",
"0.51992095",
"0.51407516",
"0.5130122",
"0.50... | 0.6093299 | 1 |
update_balancer(b, algorithm='ROUND_ROBIN'), then get_balancer('3133') | def _v1_0_11111_loadbalancers_3133(self, method, url, body, headers):
if method == "PUT":
json_body = json.loads(body)
self.assertDictEqual(json_body, {"algorithm": "ROUND_ROBIN"})
return (httplib.ACCEPTED, "", {}, httplib.responses[httplib.ACCEPTED])
elif method == "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balancer():\n pass",
"def calculate_subnets(total, breakdown):\n sanity_percent = 0 # if this isn't 100% by the end, we got issues.\n subnets = 0\n for nodep, netp in breakdown:\n sanity_percent += nodep\n if (sanity_percent > 100):\n return -1\n subtotal = int(tot... | [
"0.65080106",
"0.56225437",
"0.55456984",
"0.54962957",
"0.54614526",
"0.54008746",
"0.5387892",
"0.53599375",
"0.5332126",
"0.5256969",
"0.5238972",
"0.52199924",
"0.5210373",
"0.5208875",
"0.5169216",
"0.51328105",
"0.5116412",
"0.50898516",
"0.5082047",
"0.50613743",
"0.50... | 0.5824792 | 1 |
update_balancer(b, protocol='IMAPv3'), then get_balancer('3135') | def _v1_0_11111_loadbalancers_3135(self, method, url, body, headers):
if method == "PUT":
json_body = json.loads(body)
self.assertDictEqual(json_body, {"protocol": "IMAPv2"})
return (httplib.ACCEPTED, "", {}, httplib.responses[httplib.ACCEPTED])
elif method == "GET":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _v1_0_11111_loadbalancers_3136(self, method, url, body, headers):\n if method == \"PUT\":\n json_body = json.loads(body)\n self.assertDictEqual(json_body, {\"protocol\": \"IMAPv3\"})\n return (httplib.ACCEPTED, \"\", {}, httplib.responses[httplib.ACCEPTED])\n elif... | [
"0.63280153",
"0.6290756",
"0.6275665",
"0.57280207",
"0.54525864",
"0.5451998",
"0.5339443",
"0.52571595",
"0.5178559",
"0.514923",
"0.51448333",
"0.5129833",
"0.5124877",
"0.5077628",
"0.50666827",
"0.5051458",
"0.50320303",
"0.49932805",
"0.4958798",
"0.49580434",
"0.49444... | 0.63591367 | 0 |
update_balancer(b, protocol='IMAPv3'), then get_balancer('3136') | def _v1_0_11111_loadbalancers_3136(self, method, url, body, headers):
if method == "PUT":
json_body = json.loads(body)
self.assertDictEqual(json_body, {"protocol": "IMAPv3"})
return (httplib.ACCEPTED, "", {}, httplib.responses[httplib.ACCEPTED])
elif method == "GET":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _v1_0_11111_loadbalancers_3135(self, method, url, body, headers):\n if method == \"PUT\":\n json_body = json.loads(body)\n self.assertDictEqual(json_body, {\"protocol\": \"IMAPv2\"})\n return (httplib.ACCEPTED, \"\", {}, httplib.responses[httplib.ACCEPTED])\n elif... | [
"0.6252189",
"0.6207002",
"0.619052",
"0.56468",
"0.53950554",
"0.5380235",
"0.5235928",
"0.5160408",
"0.5109635",
"0.506248",
"0.5061793",
"0.5049065",
"0.5027275",
"0.50255936",
"0.50164396",
"0.50127935",
"0.5001049",
"0.5000197",
"0.49901208",
"0.49844384",
"0.49592122",
... | 0.626684 | 0 |
Command argument for receiving two options. | async def options(arg):
match = command_pattern.match(arg)
assert match
assert not match.group(1).lower() == match.group(2).lower(), "**The choices cannot be the same.**"
return match.group(1), match.group(2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CommandArgs(args):\n if len(args) > 1:\n if args[1].startswith('--'):\n option = args[1] [2:]\n if len(args) > 2:\n content = args[2]\n return option, content\n return True, None\n return False, None",
"def getOption(arg):\n return ... | [
"0.71427417",
"0.6505217",
"0.646961",
"0.63885385",
"0.6385097",
"0.6355194",
"0.61823934",
"0.6179596",
"0.6175215",
"0.6164789",
"0.6150138",
"0.6147115",
"0.61169976",
"0.61169976",
"0.61169976",
"0.6027751",
"0.6022649",
"0.60157776",
"0.6009817",
"0.5983008",
"0.5968989... | 0.71029496 | 1 |
Ask the bot if he would rather, or have the bot ask you. | async def wouldyourather(message: discord.Message, opt: options=None):
# If there are no options, the bot will ask the questions (if there are any to choose from)
if opt is None:
assert message.channel.id not in sessions, "**A would you rather session is already in progress.**"
sessions.add(mess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def ask(self, context):\n await self.send_message(context, await self.ask_msg_packed(context))",
"def confirm_wouldyou(self, update, context):\n chat_id = update.effective_chat.id\n response_code = update.callback_query[\"data\"] # wouldyou_{yes|no}\n request_id = context.user_... | [
"0.6405096",
"0.6290528",
"0.6268638",
"0.6258926",
"0.62041104",
"0.6105385",
"0.60811526",
"0.6063564",
"0.6045073",
"0.6037297",
"0.6008521",
"0.60030156",
"0.59602207",
"0.59592384",
"0.59442455",
"0.59380007",
"0.5931678",
"0.59041804",
"0.5894984",
"0.5894037",
"0.58883... | 0.69025594 | 0 |
Remove a wouldyourather question with the given options. | async def remove(message: discord.Message, opt: options):
for q in db.data["questions"]:
if q["choices"][0] == opt[0] and q["choices"][1] == opt[1]:
db.data["questions"].remove(q)
db.save()
await client.say(message, "**Entry removed.**")
break
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_answer(self, answer):\n index = self.find(answer)\n if index is not None:\n del self.answers[index]",
"def removeQuestion(self, search, questionIndex=False):\n if questionIndex == True and\\\n type(search) == int and search < len(self.questions):\n ... | [
"0.70653594",
"0.66630006",
"0.6347515",
"0.60602987",
"0.6053456",
"0.5951609",
"0.59333533",
"0.59205496",
"0.5873661",
"0.5859625",
"0.5729745",
"0.57019275",
"0.5543153",
"0.5516103",
"0.54964936",
"0.54964936",
"0.54964936",
"0.5473842",
"0.5463324",
"0.5456695",
"0.5451... | 0.7703739 | 0 |
Takes a node (which is an integer in this problem) and returns outgoing arcs (always two arcs in this problem) | def outgoing_arcs(self, tail_node):
connections = []
for arc in self.adj_list[tail_node]:
connections.append(Arc(tail_node,arc[0],action = f"{tail_node}->{arc[0]}", cost = arc[1]))
connections.sort(key = lambda x: x[1])
return connections | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_arc(graph, fromnode, tonode):\n graph[fromnode].append(tonode)\n # Update the count of incoming arcs in tonode.\n graph[tonode][0] += 1",
"def transmission (graph, r=.5, m=.5):\n\n routes = r*nx.adjacency_matrix(graph)\n medicn = m*sp.eye(nx.number_of_nodes(graph))\n\n retur... | [
"0.5700364",
"0.5529717",
"0.5468419",
"0.54251313",
"0.5339369",
"0.52667004",
"0.5236086",
"0.519002",
"0.51884776",
"0.5136214",
"0.50959224",
"0.50831157",
"0.50761133",
"0.50755864",
"0.50735295",
"0.50585467",
"0.50475514",
"0.5041057",
"0.50355625",
"0.50355625",
"0.50... | 0.6567164 | 0 |
Returns a sequence (list) of starting nodes. In this problem the seqence always has one element. | def starting_nodes(self):
return self.starting_nodes_ #abstract requires this exists! | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_begin(self):\n\t\tlist = []\n\t\tlist += self.ks['begin']\n\t\treturn list",
"def getStarts(self) -> List[int]:\n ...",
"def get_prefix(self, seq):\n cur_node = self.root\n prefix = []\n best_prefix = []\n for token_id in seq:\n children = cur_node.edg... | [
"0.6801562",
"0.64783114",
"0.63822013",
"0.63667685",
"0.6309392",
"0.63089913",
"0.6303712",
"0.6273123",
"0.62263596",
"0.62122494",
"0.62093264",
"0.6119944",
"0.60957515",
"0.6038037",
"0.6029027",
"0.6020231",
"0.5990354",
"0.5989552",
"0.5982161",
"0.5965251",
"0.59652... | 0.70693636 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.