query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return the minimum pairwise score in this entity. | def min_pw(self, entity):
return float(entity['pw_bb'][0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_score(self):\n return min(self._extract_set('score') or [0])",
"def min(self):\n return min(self)",
"def find_min(self):\n return self.min",
"def find_min(self):\n return self.min",
"def getmin(self):\n\n return self.X",
"def min(self):\n least = self.dat... | [
"0.7597172",
"0.7159401",
"0.7099284",
"0.7099284",
"0.70661646",
"0.70521104",
"0.7031809",
"0.69758976",
"0.69574755",
"0.6907929",
"0.68334943",
"0.6823418",
"0.68157876",
"0.68157876",
"0.681005",
"0.67746747",
"0.67746747",
"0.67439175",
"0.6730132",
"0.67173404",
"0.665... | 0.0 | -1 |
Return the minimum pairwise score in this entity. | def max_pw(self, entity):
return float(entity['pw_bb'][1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_score(self):\n return min(self._extract_set('score') or [0])",
"def min(self):\n return min(self)",
"def find_min(self):\n return self.min",
"def find_min(self):\n return self.min",
"def getmin(self):\n\n return self.X",
"def min(self):\n least = self.dat... | [
"0.7601159",
"0.71640253",
"0.7104862",
"0.7104862",
"0.70703626",
"0.70559096",
"0.7035829",
"0.698133",
"0.6962272",
"0.6912915",
"0.6838934",
"0.6827227",
"0.6821604",
"0.6821604",
"0.681461",
"0.6776928",
"0.6776928",
"0.6748577",
"0.6733002",
"0.6722401",
"0.66591287",
... | 0.0 | -1 |
Return the average pairwise score in this subentity. | def avg_pw(self, entity):
return float(entity['pw']) / float(entity['count']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAverage(self):\n return sum(self.scores) / len(self.scores)",
"def get_average(self) -> float:\n return sum(self._scores) / len(self._scores)",
"def avg_e_score(self, entity):\n return float(entity['es']) / float(entity['count'])",
"def _get_average(self):\n norm = 1.0\n ... | [
"0.74047804",
"0.7201846",
"0.7139817",
"0.69191563",
"0.6888882",
"0.6880394",
"0.6808859",
"0.6778779",
"0.6722814",
"0.6697185",
"0.669515",
"0.6681956",
"0.6661809",
"0.6607946",
"0.65531296",
"0.65421295",
"0.65421295",
"0.65421295",
"0.65123206",
"0.6506696",
"0.6480846... | 0.0 | -1 |
Return the average entity score in this subentity. | def avg_e_score(self, entity):
return float(entity['es']) / float(entity['count']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAverage(self):\n return sum(self.scores) / len(self.scores)",
"def get_average(self) -> float:\n return sum(self._scores) / len(self._scores)",
"def getAvg(self):\r\n\t\treturn self.data['avg']",
"def average(self):\n return self.properties.get('average')",
"def average(self):\n... | [
"0.7799699",
"0.7497335",
"0.7215426",
"0.7203512",
"0.7157242",
"0.7098437",
"0.70452535",
"0.7044013",
"0.7005493",
"0.6976076",
"0.69647014",
"0.69399375",
"0.6936981",
"0.69197166",
"0.6899835",
"0.6894542",
"0.6794682",
"0.6758425",
"0.6758425",
"0.6758425",
"0.6747891",... | 0.8440185 | 0 |
Return the average entity score in this subentity. | def min_e_score(self, entity):
return float(entity['es_bb'][0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avg_e_score(self, entity):\n return float(entity['es']) / float(entity['count'])",
"def getAverage(self):\n return sum(self.scores) / len(self.scores)",
"def get_average(self) -> float:\n return sum(self._scores) / len(self._scores)",
"def getAvg(self):\r\n\t\treturn self.data['avg']... | [
"0.84409",
"0.7800358",
"0.7498058",
"0.7216316",
"0.7203919",
"0.71584976",
"0.7098806",
"0.70464385",
"0.7045119",
"0.7007651",
"0.6977412",
"0.6965596",
"0.69421935",
"0.6937881",
"0.6920694",
"0.6899753",
"0.6896273",
"0.6796417",
"0.6759626",
"0.6759626",
"0.6759626",
... | 0.617952 | 81 |
Return the average entity score in this subentity. | def max_e_score(self, entity):
return float(entity['es_bb'][1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avg_e_score(self, entity):\n return float(entity['es']) / float(entity['count'])",
"def getAverage(self):\n return sum(self.scores) / len(self.scores)",
"def get_average(self) -> float:\n return sum(self._scores) / len(self._scores)",
"def getAvg(self):\r\n\t\treturn self.data['avg']... | [
"0.8439817",
"0.78006226",
"0.74981993",
"0.7216157",
"0.72037786",
"0.7157771",
"0.7098583",
"0.7046004",
"0.70440245",
"0.70065194",
"0.69773227",
"0.69648683",
"0.69407433",
"0.69379723",
"0.69217795",
"0.68992525",
"0.6895469",
"0.6795337",
"0.67590386",
"0.67590386",
"0.... | 0.0 | -1 |
Returns the number of new 'edges' introduced by this merge. | def new_edges(self, entity):
return float(entity['new_edges']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_edges(self):\r\n return len(self.__generate_edges())",
"def num_edges(self):\n return sum(1 for _ in self.iteredges())",
"def EdgesCount(self):\n return len(self.edges)",
"def number_of_edges(self) -> int:\n return self.graph.number_of_edges()",
"def Nedges(self):\n ... | [
"0.78781456",
"0.7872353",
"0.78302294",
"0.7731362",
"0.7659065",
"0.7658958",
"0.7618385",
"0.76179594",
"0.7602388",
"0.75837255",
"0.75546455",
"0.7519724",
"0.7472166",
"0.74677306",
"0.7424954",
"0.7281639",
"0.72358763",
"0.7222344",
"0.71567804",
"0.7112408",
"0.70654... | 0.7495844 | 12 |
Get all features of entity. | def emb(self, entity):
fv = []
# fv.append(self.sum_pw(entity))
fv.append(self.avg_pw(entity))
fv.append(self.min_pw(entity))
fv.append(self.max_pw(entity))
fv.append(self.my_pw(entity))
fv.append(self.min_e_score(entity))
fv.append(self.max_e_score(entity... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_features(self) :\n raise NotImplementedError",
"def get_features(self):\n return []",
"def get_features(self):\n return self._features",
"def all(cls):\n results = []\n for name in FEATURES:\n feat = cls.get_by_name(name)\n if feat is None:... | [
"0.80864763",
"0.72966963",
"0.7187111",
"0.7046984",
"0.6899245",
"0.6855923",
"0.67866296",
"0.678346",
"0.6630942",
"0.65737665",
"0.65528774",
"0.65406877",
"0.6531052",
"0.65299827",
"0.6496581",
"0.6496581",
"0.6496581",
"0.6392731",
"0.6329313",
"0.62903166",
"0.625454... | 0.0 | -1 |
Return a string representation of the given clause in DIMACS format | def clause_to_string(clause):
return " ".join(map(str, clause)) + " 0" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dimacs_string(self, clauses):\n self.varname_dict = {}\n self.varobj_dict = {}\n variables = prop_symbols_from_clause_list(clauses)\n ret = 'p cnf %d %d' % (len(variables), len(clauses))\n varis = dict(list(zip(sorted(variables, key=lambda v: v.op),\n ... | [
"0.7148823",
"0.6522882",
"0.63644606",
"0.6062219",
"0.5972342",
"0.5686479",
"0.55405873",
"0.5539543",
"0.5490623",
"0.54605454",
"0.5407693",
"0.5374766",
"0.5262927",
"0.52460927",
"0.523993",
"0.52349705",
"0.52165234",
"0.52085066",
"0.5193419",
"0.5183593",
"0.5167734... | 0.75723165 | 0 |
Takes in slit_width, wavelength, screen distance and a numpy array X(an array of distances from the center). Outputs an array of normalized intensities corresponding to X. | def single_slit_diffraction_intensity(slit_width, wavelength, screen_distance, X):
return ((np.sin((np.pi * slit_width * X) / (wavelength * screen_distance))) / (
(np.pi * slit_width * X) / (wavelength * screen_distance))) ** 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalise(self, x):\n norm = ((x + 1.2) / 2.4) * self.w\n clipped = np.clip(norm, 0, self.w)\n # convert to list to use base numpy type int\n return clipped.astype(int).tolist()",
"def _normalize(X: np.ndarray) -> np.ndarray:\n # return X * np.sqrt(1 / np.sum(X ** 2, axis=1))[:... | [
"0.59540147",
"0.57589984",
"0.57050526",
"0.5555193",
"0.5555193",
"0.554314",
"0.5518748",
"0.551125",
"0.5485161",
"0.5449757",
"0.5433689",
"0.5433689",
"0.53811353",
"0.5365096",
"0.5364787",
"0.5362945",
"0.5297261",
"0.5281275",
"0.5253729",
"0.52493566",
"0.5241639",
... | 0.70764595 | 0 |
Takes text as input and return a list of sentences | def split_sentence(self,sentence):
sents = self.sentence_splitter.tokenize(sentence)
return sents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sentences(text):\n \n return text.split('.')",
"def sentences(self) -> List[str]:\n\t\treturn [sentence for sentence in re.split('(?<=[.!?])', self.text)]",
"def split(text):\n doc = nlp(text)\n sentences = [x.text_with_ws for x in doc.sents]\n return sentences",
"def sente... | [
"0.8644751",
"0.8373806",
"0.82083434",
"0.8105775",
"0.80660814",
"0.80660814",
"0.8019134",
"0.78437096",
"0.78341097",
"0.77824146",
"0.7673993",
"0.7667824",
"0.76604414",
"0.76515794",
"0.76396847",
"0.7633886",
"0.7618477",
"0.75231296",
"0.7519069",
"0.7423092",
"0.741... | 0.63687086 | 96 |
Compute softmax values for each sets of scores in x. | def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7797849",
"0.77619886",
"0.776157",
"0.775872",
"0.76596135",
"0.76596135",
"0.76596135",
"0.76596135",
"0.7586109",
"0.7431844",
"0.74070084",
"0.7393994",
"0.7358404",
"0.7317217",
"0.7268679",
"0.72625685",
"0.7261825",
"0.7256399",
"0.7229374",
"0.7214238",
"0.72015005... | 0.7090477 | 49 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
print("Normalized confusion matrix")
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8193067",
"0.8093563",
"0.80270845",
"0.80171025",
"0.7992049",
"0.79890734",
"0.79785955",
"0.7973588",
"0.7959112",
"0.79545826",
"0.79353666",
"0.7932262",
"0.79320717",
"0.79288954",
"0.792416",
"0.7922282",
"0.7921632",
"0.79207784",
"0.7920719",
"0.79201275",
"0.7915... | 0.78266144 | 76 |
Sets the id of this AddonReview. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id_):\n\n self.id_ = id_",
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id_=None):\n if id_ is None:\n self.id = id(self)\n else:\... | [
"0.7380014",
"0.72055674",
"0.71874046",
"0.69977677",
"0.6904393",
"0.68745106",
"0.68745106",
"0.68745106",
"0.68745106",
"0.68745106",
"0.6837734",
"0.6837734",
"0.6837734",
"0.6837734",
"0.6837734",
"0.6837734",
"0.6837734",
"0.6837734",
"0.6837734",
"0.6837734",
"0.67749... | 0.6771661 | 89 |
Sets the author of this AddonReview. | def author(self, author):
self._author = author | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_author (self, author):\n self.author = author",
"def set_author(self, author):\n self.author = author\n self.opf.author = author",
"def author(self, author):\n self._author = author",
"def author(self, author: str):\n\n self._author = author",
"def author(self, va... | [
"0.79848194",
"0.7938094",
"0.7830009",
"0.7641773",
"0.75113225",
"0.7337916",
"0.72963196",
"0.7191509",
"0.6891381",
"0.6890092",
"0.68804467",
"0.6780522",
"0.66320026",
"0.6630592",
"0.65963024",
"0.65963024",
"0.65963024",
"0.6542953",
"0.6542953",
"0.64430547",
"0.6410... | 0.7750484 | 4 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, AddonReview):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8089204",
"0.8089204",
"0.8055265",
"0.7983358",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, AddonReview):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8457179",
"0.8393067",
"0.81457263",
"0.8140635",
"0.8133462",
"0.8094992",
"0.8093376",
"0.8093376",
"0.8093376",
"0.80863357",
"0.80863357",
"0.8077303",
"0.8077303",
"0.8066831",
"0.8043635",
"0.8043635",
"0.8043635",
"0.8043635",
"0.8043635",
"0.8043635",
"0.8043635",
... | 0.0 | -1 |
Returns the X coordinate outx | def getOutX(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetX(self):\r\n\r\n return self._x",
"def Getxcoord(self):\n return self.x_coord",
"def get_x(self):\n return self.coords[0]",
"def x(self):\n return self.coords[0]",
"def x(self):\n if self._x is None:\n self.compute_coordinates()\n return self._x",... | [
"0.7144472",
"0.704571",
"0.69884753",
"0.69036925",
"0.6886327",
"0.6882466",
"0.6876571",
"0.68262666",
"0.68221694",
"0.6783471",
"0.67542624",
"0.67264175",
"0.67185736",
"0.67100406",
"0.669933",
"0.667946",
"0.6672563",
"0.6651424",
"0.6590078",
"0.65885395",
"0.6587251... | 0.81587476 | 0 |
Returns the Y coordinate outx | def getOutY(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getOutX(self):\n pass",
"def get_y(self, x):\n p, y = self.get_p_y(x)\n return y",
"def y(self):\n return self.coords[1]",
"def GetY(self):\r\n\r\n return self._y",
"def y(self, x):\n return x",
"def findY(self):\n return self.y",
"def y(self):\n ... | [
"0.7041606",
"0.6938869",
"0.6815363",
"0.6749958",
"0.67223054",
"0.669634",
"0.66469204",
"0.6637387",
"0.6562666",
"0.6554838",
"0.6518246",
"0.6490876",
"0.6485447",
"0.6485204",
"0.6485204",
"0.6479372",
"0.6475308",
"0.6464286",
"0.64640564",
"0.645611",
"0.64519066",
... | 0.75225174 | 0 |
Finds the centre theta angle for the detector boxes. Then removes these detectors from the list. | def average_angle_for_box(n_detectors, n_detectors_middle, n_detectors_upper_lower):
angles_for_middle_box = n_detectors[0:n_detectors_middle]
middle_angle = sum(angles_for_middle_box) / len(angles_for_middle_box)
angles_for_upper_lower_box = n_detectors[0:n_detectors_upper_lower]
if len(angles_for_up... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avoid_duplicates_by_angle():\n right = np.transpose(vision.pqr_r)\n left = np.transpose(vision.pqr_l)\n \n #all_blobs = np.zeros((3,1))\n all_blobs = np.empty((3,0))\n all_angles = np.empty(0)\n\n for r in right:\n angle = np.arctan2(r[1], r[0]) * 180 / pi\n if angle > -5:\n ... | [
"0.5332642",
"0.5275871",
"0.5237453",
"0.5198165",
"0.51221174",
"0.49811113",
"0.49526542",
"0.48942333",
"0.48536772",
"0.4786374",
"0.47859287",
"0.4784002",
"0.47788873",
"0.4778333",
"0.47771534",
"0.47717276",
"0.47715685",
"0.47710082",
"0.4745159",
"0.474441",
"0.471... | 0.49864346 | 5 |
Add pressure value in hPa | def appendAsHPa(self,value):
if value != 0:
self.values.append(value)
self.lastUpdate = time.time()
self.__calculateAltitude()
self.__calculateVerticalSpeed()
if self.calibrated == False:
self.calibrateElevation(self.calibratedElevation... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appendAsInHg(self,value):\n hPa = value * 3386.38866666667 / 100.0\n self.appendAsHPa(hPa)",
"def pressure(self):\r\n self._read_temperature()\r\n\r\n # Algorithm from the BME280 driver\r\n # https://github.com/BoschSensortec/BME280_driver/blob/master/bme280.c\r\n ad... | [
"0.65474117",
"0.63399184",
"0.63012373",
"0.6230542",
"0.6138843",
"0.60602725",
"0.6022717",
"0.59869814",
"0.59565854",
"0.59565854",
"0.59565854",
"0.5951667",
"0.5949968",
"0.59026426",
"0.5842469",
"0.5776172",
"0.57687736",
"0.5744407",
"0.5714455",
"0.5705264",
"0.570... | 0.68459624 | 0 |
computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity. | def density_lens(self, r, Rs, alpha_Rs, gamma_inner, gamma_outer):
rho0 = self.alpha2rho0(alpha_Rs, Rs, gamma_inner, gamma_outer)
return self.density(r, Rs, rho0, gamma_inner, gamma_outer) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_densities(self, r):\n # Handle scalar r values as single element array\n if not np.isscalar(r):\n r = np.array((r))\n\n assert np.min(r) > 0, \"Error: distances must be non-zero and positive.\"\n\n if self.s_exp is not None:\n oS, doS, ddoS = self.get_orbit... | [
"0.62610763",
"0.6154016",
"0.5986892",
"0.5943095",
"0.59039974",
"0.5778561",
"0.5742141",
"0.57339984",
"0.56859547",
"0.5618881",
"0.5588497",
"0.55418515",
"0.5529989",
"0.5523634",
"0.5515343",
"0.55067545",
"0.55043894",
"0.5460086",
"0.5434444",
"0.5431753",
"0.540857... | 0.63554454 | 0 |
Gets the headword of this Features. | def headword(self) -> str:
return self._headword | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def headline(self):\n \n return self._headline",
"def lemma_headwords(self):\n new_var = 'lemma_headword'\n lemma_heads = [clx._lemmas[i]['Head'] for i in xrange(len(clx._lemmas))]\n has_item = self.compare_items(lemma_heads)\n new_column = []\n if False in has_it... | [
"0.6860674",
"0.68538785",
"0.685257",
"0.6668449",
"0.6668449",
"0.66341144",
"0.65503645",
"0.65503645",
"0.6480602",
"0.63797927",
"0.6379214",
"0.62822765",
"0.62731886",
"0.6260279",
"0.62376165",
"0.6200014",
"0.61961657",
"0.61846155",
"0.6140328",
"0.612257",
"0.60990... | 0.85303146 | 0 |
Sets the headword of this Features. | def headword(self, headword: str):
if headword is None:
raise ValueError("Invalid value for `headword`, must not be `None`") # noqa: E501
self._headword = headword | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def headword(self) -> str:\n return self._headword",
"def head(self, head):\n\n self._head = head",
"def lemma_headwords(self):\n new_var = 'lemma_headword'\n lemma_heads = [clx._lemmas[i]['Head'] for i in xrange(len(clx._lemmas))]\n has_item = self.compare_items(lemma_heads)... | [
"0.6955211",
"0.67966014",
"0.6347886",
"0.6174029",
"0.61009586",
"0.6066841",
"0.59008574",
"0.5889142",
"0.58777565",
"0.5743371",
"0.5725861",
"0.56888956",
"0.56814015",
"0.56549245",
"0.5627944",
"0.55639756",
"0.5531547",
"0.547035",
"0.547035",
"0.54597026",
"0.544199... | 0.7884353 | 0 |
Sets the features of this Features. | def features(self, features: List[Feature]):
if features is None:
raise ValueError("Invalid value for `features`, must not be `None`") # noqa: E501
self._features = features | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_features(self, features: np.ndarray):\n self.features = features",
"def set_features(self, features: list):\n self._features = features",
"def set_features(self, features):\n self.features_ = list(features)",
"def features(self, features):\n\n self._features = features",
... | [
"0.8524767",
"0.847594",
"0.8302488",
"0.8272724",
"0.7906704",
"0.7366369",
"0.72811675",
"0.6804041",
"0.6618833",
"0.65810674",
"0.6458648",
"0.6458648",
"0.6349703",
"0.6148163",
"0.6144438",
"0.6139152",
"0.60952586",
"0.6054114",
"0.60118216",
"0.5974977",
"0.5935658",
... | 0.7276082 | 7 |
it can cast to list | def test_list(self, env: yaenv.Env):
_val = env.list('LIST_VAR', separator=':')
_expect = ['item1', 'item2']
assert _val == _expect and type(_val) == list
_expect.append('item3')
_val = env.list('MISSING', _expect)
assert _val == _expect and type(_val) == list
ass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_list(obj):\n if not isinstance(obj, list):\n return [obj]\n else:\n return obj",
"def list_cast(inputs, dst_type):\n return iter_cast(inputs, dst_type, return_type=list)",
"def tolist(x):\n return x if isinstance(x, list) else [x]",
"def to_list(x):\n if isinstance(x, list)... | [
"0.75821555",
"0.744226",
"0.73420995",
"0.72503155",
"0.724641",
"0.71924204",
"0.7178681",
"0.71703243",
"0.71094763",
"0.70966065",
"0.70889264",
"0.69534516",
"0.69296837",
"0.68623567",
"0.6854597",
"0.6849486",
"0.6826553",
"0.68180573",
"0.68172383",
"0.6800692",
"0.67... | 0.0 | -1 |
Ensures that RuntimeError is raised in the situations where ``y_data``, ``x_data``, and/or ``y_std`` aren't onedimensional arrays. | def test_not_one_dimensional_arrays(self, x_vals, y_vals, y_std):
with pytest.raises(RuntimeError):
extrapolated_lowess(x_vals, y_vals, alpha=1, y_std=y_std) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_2D_dvalues_array(self):\n self.assertRaises(splines.DValuesError, splines.Spline.__init__,\n splines.Spline, np.array([0.1, 0.5, 0.9]),\n np.array([1, 2, 3, 4]))",
"def validate_data(self, y, x=None, verbose=True):\n # Check dimensions\... | [
"0.66363215",
"0.6598652",
"0.65775746",
"0.6471084",
"0.64506006",
"0.6417221",
"0.6371268",
"0.63465166",
"0.63339865",
"0.6329666",
"0.6326405",
"0.63115",
"0.62909544",
"0.6188189",
"0.6181296",
"0.61522305",
"0.614227",
"0.6107352",
"0.6101713",
"0.6086358",
"0.6067188",... | 0.77549756 | 0 |
class_name returns the name of the class of this instance. | def class_name(self):
return "Wall" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_name(self) -> str:\n return pulumi.get(self, \"class_name\")",
"def class_name(self) -> str:\n return self.__class__.__name__",
"def f_get_class_name(self):\n return self.__class__.__name__",
"def class_name(cls):\n return cls.__name__",
"def class_name(cls):\n return c... | [
"0.88284683",
"0.8687595",
"0.85586625",
"0.84620094",
"0.84620094",
"0.83800036",
"0.8343944",
"0.8282965",
"0.81931704",
"0.81853914",
"0.80695516",
"0.7914546",
"0.7914546",
"0.7798547",
"0.7789764",
"0.77245504",
"0.76725507",
"0.7640857",
"0.7640857",
"0.76246464",
"0.76... | 0.0 | -1 |
Returns a SQLAlchemy session. | def sa_session( self ):
return self.model.context.current | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_session():\n session = scoped_session(sessionmaker(bind=engine))\n return session",
"def get_session():\n return scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))",
"def get_session(self):\n # Create the session\n kwargs = self._get_database_specific_se... | [
"0.8610989",
"0.8528189",
"0.84236026",
"0.82809293",
"0.8102113",
"0.804496",
"0.80422753",
"0.7985043",
"0.7925666",
"0.78332883",
"0.78188944",
"0.77840346",
"0.7714902",
"0.7676854",
"0.76368773",
"0.7631893",
"0.76062703",
"0.7600843",
"0.75768983",
"0.7543173",
"0.75359... | 0.699715 | 68 |
Computes the hidden state that the RNN decoder should start with. | def get_rnn_init_state(combiner_outputs: Dict[str, torch.Tensor], sequence_reducer: SequenceReducer, num_layers: int) ->torch.Tensor:
if ENCODER_OUTPUT_STATE not in combiner_outputs:
encoder_output_state = combiner_outputs[HIDDEN]
else:
encoder_output_state = combiner_outputs[ENCODER_OUTPUT_STAT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_hidden_state(self):\n initializer = tf.keras.initializers.Zeros()\n rnnten = initializer(shape=(self.batch, self.units))\n return rnnten",
"def init_hidden(self):\n # TODO ========================\n # initialize the hidden states to zero\n\n initial_hidden... | [
"0.7365687",
"0.7285843",
"0.72708154",
"0.71049565",
"0.7075189",
"0.7075189",
"0.7075189",
"0.70705295",
"0.70705295",
"0.70691097",
"0.70691097",
"0.70623356",
"0.69283736",
"0.6861648",
"0.6807063",
"0.67662126",
"0.6702251",
"0.66405463",
"0.66365856",
"0.65644884",
"0.6... | 0.0 | -1 |
Function to gather all tensors from several processes onto a list that is broadcast to all processes. Works on tensors that have the same number of dimensions, but where each dimension may differ. In this case tensors are padded, gathered and then trimmed to secure equal workload for all processes. | def gather_all_tensors(result: torch.Tensor, group: Optional[Any]=None) ->List[torch.Tensor]:
if group is not None:
raise ValueError('Horovod does not support allgather using a subcommunicator at this time. Unset `group`.')
if _HVD is None or not _HVD.is_initialized():
return [result]
if len... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gather_all_tensors(result: Tensor, group: Optional[Any]=None) ->List[Tensor]:\n if group is None:\n group = torch.distributed.group.WORLD\n result = result.contiguous()\n world_size = torch.distributed.get_world_size(group)\n torch.distributed.barrier(group=group)\n if result.ndim == 0:\n... | [
"0.64991826",
"0.60119003",
"0.59108883",
"0.5896165",
"0.5877208",
"0.58289486",
"0.5825451",
"0.5816037",
"0.5815197",
"0.5794774",
"0.57451737",
"0.5593687",
"0.5518189",
"0.55010974",
"0.54669666",
"0.5439722",
"0.54231274",
"0.5422362",
"0.5390832",
"0.5338321",
"0.53204... | 0.5252914 | 25 |
Returns the appropriate tokenizer from the tokenizer registry. Raises a KeyError if a tokenizer that does not exist in the registry is requested, with additional help text if the requested tokenizer would be available for a different version of torchtext. | def get_tokenizer_from_registry(tokenizer_name: str) ->torch.nn.Module:
if tokenizer_name in tokenizer_registry:
return tokenizer_registry[tokenizer_name]
if torch.torch_version.TorchVersion(torchtext.__version__) < (0, 12, 0) and tokenizer_name in TORCHTEXT_0_12_0_TOKENIZERS:
raise KeyError(f"t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tokenizer(tokenizer_type: str, tokenizer_vocab_file: str, pretrained_model_name_or_path: str):\n return get_tokenizer_from_registry(tokenizer_type)(\n vocab_file=tokenizer_vocab_file,\n pretrained_model_name_or_path=pretrained_model_name_or_path,\n )",
"def get_tokenizer_class(model_n... | [
"0.6932316",
"0.65151507",
"0.6211736",
"0.5683044",
"0.55956423",
"0.55873615",
"0.532946",
"0.52995294",
"0.52914906",
"0.52351135",
"0.5226498",
"0.5084208",
"0.50726",
"0.50354356",
"0.50354356",
"0.50353926",
"0.5031914",
"0.49799556",
"0.49179465",
"0.49120674",
"0.4894... | 0.7811575 | 0 |
Reads image from bytes object from a numpy file. | def read_image_as_numpy(bytes_obj: Optional[bytes]=None) ->Optional[torch.Tensor]:
try:
with BytesIO(bytes_obj) as buffer:
image = np.load(buffer)
return torch.from_numpy(image)
except Exception as e:
warnings.warn(f'Failed to read image from numpy file. Original exceptio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_decoder(rawbytes):\n img = Image.open(BytesIO(rawbytes))\n array = np.asarray(img, dtype=np.uint8)\n return array",
"def bytes_to_np(img: bytes) -> np.ndarray:\n im = Image.open(BytesIO(img))\n im = im.convert(\"RGB\")\n return np.array(im)",
"def imfrombytes(content, flag='color', float3... | [
"0.7186838",
"0.6947284",
"0.6729533",
"0.6708283",
"0.6652406",
"0.66466206",
"0.65552956",
"0.65343666",
"0.6502569",
"0.6500541",
"0.6487845",
"0.6451106",
"0.6416025",
"0.6390454",
"0.63616335",
"0.63452363",
"0.6327411",
"0.63257164",
"0.63243675",
"0.63176537",
"0.63082... | 0.7594153 | 0 |
Converts int or tuple to tuple of ints. | def to_tuple(v: Union[int, Tuple[int, int]]) ->Tuple[int, int]:
if torch.jit.isinstance(v, int):
return v, v
else:
return v | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_tuple(values: Union[int, Iterable[int]]) -> Tuple[int, ...]:\n try:\n return tuple(values)\n except TypeError:\n return (values,)",
"def _tuple_from_one_or_two_ints(self, v):\n try:\n a, b = [int(x) for x in v]\n except TypeError:\n a, b = int(v), i... | [
"0.8046068",
"0.7455156",
"0.67862165",
"0.6766072",
"0.6582368",
"0.65491015",
"0.65058875",
"0.64197224",
"0.633446",
"0.62622243",
"0.6201901",
"0.6185957",
"0.618163",
"0.6177418",
"0.6145469",
"0.6140226",
"0.6122639",
"0.609583",
"0.60865235",
"0.6075911",
"0.6057181",
... | 0.7828776 | 1 |
torchscriptcompatible implementation of pad. | def pad(img: torch.Tensor, new_size: Union[int, Tuple[int, int]]) ->torch.Tensor:
new_size = to_tuple(new_size)
old_size = img.shape[-2:]
pad_size = (torch.tensor(new_size) - torch.tensor(old_size)) / 2
padding = torch.cat((torch.floor(pad_size), torch.ceil(pad_size)))
padding[padding < 0] = 0
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(self, src):\n if(self.pre_pad):\n dst = src.new(\n src.size(0),\n src.size(1),\n src.size(2),\n src.size(3),\n 2\n ).zero_()\n dst.narrow(dst.ndimension()-1, 0, 1).copy_(\n torc... | [
"0.72458404",
"0.6990202",
"0.68733495",
"0.6681599",
"0.658251",
"0.6514352",
"0.6432019",
"0.63512146",
"0.63297063",
"0.63292867",
"0.62269056",
"0.61807215",
"0.61452216",
"0.61006916",
"0.6098804",
"0.6095782",
"0.5979381",
"0.59760636",
"0.59721065",
"0.59706455",
"0.59... | 0.60636526 | 16 |
Takes a list of float values and creates a padded torch.Tensor. | def forward(self, v: TorchscriptPreprocessingInput) ->torch.Tensor:
if torch.jit.isinstance(v, List[torch.Tensor]):
return self.forward_list_of_tensors(v)
if torch.jit.isinstance(v, List[str]):
return self.forward_list_of_strs(v)
raise ValueError(f'Unsupported input: {v}'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_list(xs: torch.Tensor, pad_value: int):\n n_batch = len(xs)\n max_len = max(x.size(0) for x in xs)\n pad = xs[0].new(n_batch, max_len, *xs[0].size()[1:]).fill_(pad_value)\n\n for i in range(n_batch):\n pad[i, : xs[i].size(0)] = xs[i]\n\n return pad",
"def pad_lists(lists, pad_int, p... | [
"0.74099237",
"0.7046948",
"0.6468431",
"0.63267577",
"0.6208813",
"0.6051837",
"0.6025906",
"0.6004397",
"0.60012424",
"0.5948561",
"0.592952",
"0.58699805",
"0.5866198",
"0.58455294",
"0.5793485",
"0.57922745",
"0.57538325",
"0.5751678",
"0.5733133",
"0.5677816",
"0.564319"... | 0.0 | -1 |
Show confusion matrix in the models predictions for each `output_feature_name`. For each model (in the aligned lists of test_statistics and model_names) it produces a heatmap of the confusion matrix in the predictions for each output_feature_name that has a confusion matrix in test_statistics. The value of `top_n_class... | def confusion_matrix(test_stats_per_model: List[dict], metadata: dict, output_feature_name: Union[str, None], top_n_classes: List[int], normalize: bool, model_names: Union[str, List[str]]=None, output_directory: str=None, file_format: str='pdf', **kwargs) ->None:
test_stats_per_model_list = test_stats_per_model
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_test_results(true_labels: List[int], predictions: List[int], class_names: List[str]):\n confusion_mtx = confusion_matrix(true_labels, predictions)\n plt.figure(figsize=(10, 8))\n sns.heatmap(confusion_mtx, xticklabels=class_names, yticklabels=class_names,\n annot=True, fmt='g')\n ... | [
"0.67046136",
"0.6542396",
"0.64330494",
"0.6371753",
"0.63016176",
"0.62905127",
"0.62885064",
"0.6239082",
"0.6179755",
"0.61596113",
"0.61429626",
"0.6116021",
"0.6095083",
"0.60672265",
"0.6063781",
"0.60632175",
"0.6060207",
"0.6053498",
"0.6036354",
"0.60258293",
"0.602... | 0.71308845 | 0 |
Gets the maximum probability per timestep. | def compute_token_probabilities(probabilities: Union[list, tuple, np.ndarray]) ->np.ndarray:
if isinstance(probabilities, (list, tuple)):
max_probs = []
for timestep_probs in probabilities:
max_probs.append(np.max(timestep_probs))
max_probs = np.array(max_probs)
elif isinstan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_max_probability(self, x):\n probabilities = dict()\n for r in range(0, 10):\n self.check_overall_probability(x, r)\n probabilities[r] = self.check_overall_probability(x, r)\n return max(probabilities, key=probabilities.get)",
"def dirichlet_max(sampled_probas)... | [
"0.69242597",
"0.6880004",
"0.68158865",
"0.6684094",
"0.66667616",
"0.659712",
"0.6525153",
"0.6467051",
"0.64595526",
"0.6449971",
"0.6415577",
"0.64086103",
"0.6402273",
"0.63840574",
"0.63840574",
"0.63840574",
"0.63840574",
"0.63840574",
"0.63840574",
"0.6372147",
"0.635... | 0.0 | -1 |
Repeatedly go through all of the nodes in the graph, moving each of the nodes that has all its edges resolved, onto a sequence that forms our sorted graph. A node has all of its edges resolved and can be moved once all the nodes its edges point to, have been moved from the unsorted graph onto the sorted one. | def topological_sort(graph_unsorted):
graph_sorted = []
graph_unsorted = dict(graph_unsorted)
while graph_unsorted:
acyclic = False
for node, edges in list(graph_unsorted.items()):
if edges is None:
edges = []
for edge in edges:
if edge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort(self):\n while self.nodes != []:\n iterated = False\n for node in self.leaf_nodes():\n iterated = True\n self.prune_node(node)\n yield node\n if not iterated:\n raise CyclicGraphError(\"Sorting has found a ... | [
"0.6613181",
"0.6436364",
"0.63631773",
"0.6344224",
"0.63043034",
"0.61940384",
"0.6131431",
"0.61140776",
"0.6080406",
"0.6055466",
"0.6052996",
"0.6007211",
"0.596684",
"0.5962214",
"0.5950801",
"0.5950208",
"0.58603275",
"0.5842912",
"0.58381754",
"0.5833707",
"0.58147246... | 0.56435585 | 35 |
Returns custom dataclass field for `ludwig.modules.optimization_modules.GradientClippingConfig`. Allows `None` by default. | def GradientClippingDataclassField(description: str, default: Dict={}):
allow_none = True
class GradientClippingMarshmallowField(fields.Field):
"""Custom marshmallow field class for gradient clipping.
Deserializes a dict to a valid instance of `ludwig.modules.optimization_modules.GradientClip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clip_gradient(optimizer, grad_clip):\r\n for group in optimizer.param_groups:\r\n for param in group['params']:\r\n if param.grad is not None:\r\n param.grad.data.clamp_(-grad_clip, grad_clip)",
"def clip_gradient(optimizer, grad_clip):\n for group in optimizer.param_gr... | [
"0.54549825",
"0.542919",
"0.542919",
"0.542919",
"0.542919",
"0.542919",
"0.53763163",
"0.53555983",
"0.513759",
"0.5063428",
"0.49500924",
"0.49339613",
"0.49132928",
"0.4895377",
"0.48541188",
"0.485303",
"0.4837912",
"0.4816035",
"0.4816035",
"0.48073378",
"0.48039523",
... | 0.7565714 | 0 |
Removes unsupported feature types from the given JSON schema. Designed for use with `get_{input/output}_feature_jsonschema`. | def prune_gbm_features(schema: Dict):
gbm_feature_types = ['binary', 'category', 'number']
pruned_all_of = []
for cond in schema['items']['allOf']:
if_type = cond['if']['properties']['type']['const']
if if_type in gbm_feature_types:
pruned_all_of += [cond]
schema['items']['al... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schemaCleanupTypes():\n libxml2mod.xmlSchemaCleanupTypes()",
"def clean_schema(schema):\n # type: (Dict) -> Dict\n return {k: v for k, v in schema.items()\n if k not in _SWAGGER_FIELDS and not k.lower().startswith(\"x-\")}",
"def _check_for_unsupported_schema_fields(schema):\n if schem... | [
"0.61883664",
"0.6180169",
"0.57744074",
"0.5642379",
"0.55615807",
"0.5445781",
"0.5445781",
"0.5424547",
"0.5355024",
"0.52620095",
"0.5184814",
"0.5130405",
"0.51075065",
"0.5100749",
"0.50728637",
"0.50677973",
"0.5060568",
"0.50539994",
"0.50453323",
"0.49848992",
"0.497... | 0.6224048 | 0 |
Returns the filename for a stage of inference. | def get_filename_from_stage(stage: str, device: TorchDevice) ->str:
if stage not in [PREPROCESSOR, PREDICTOR, POSTPROCESSOR]:
raise ValueError(f'Invalid stage: {stage}.')
if stage == PREDICTOR:
return f'inference_{stage}-{device}.pt'
else:
return f'inference_{stage}.pt' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title(self):\n if self.file_name is None:\n return None\n else:\n fname = os.path.split(self.file_name)[-1]\n fname, *ext = fname.rsplit('.', 1)\n procgen = ext and ext[0] in ('json', 'yaml')\n if procgen and self._seed and self._seed.spawn_k... | [
"0.67717093",
"0.6729912",
"0.6703513",
"0.66605616",
"0.6591312",
"0.6491994",
"0.6490706",
"0.64670163",
"0.64322525",
"0.64200824",
"0.6362181",
"0.63601136",
"0.63601136",
"0.63356036",
"0.63253987",
"0.6307907",
"0.62813157",
"0.6236171",
"0.62060213",
"0.61992997",
"0.6... | 0.7852959 | 0 |
Converts a dictionary of predictions into a pandas DataFrame. | def convert_dict_to_df(predictions: Dict[str, Dict[str, Union[List[Any], torch.Tensor, np.array]]]) ->pd.DataFrame:
output = {}
for of_name, preds_dict in predictions.items():
for key, value in preds_dict.items():
output_key = f'{of_name}_{key}'
if not isinstance(value, list):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dataframe(self):\n import pandas as pd\n\n d = OrderedDict({\"y\": self.y})\n for pred in self.predictors:\n d[pred.name] = pred.x\n \n df = pd.DataFrame(d)\n return df",
"def to_dataframe(self, data_dict):\n return pd.DataFrame.from_dict(dat... | [
"0.7134627",
"0.7088393",
"0.70794797",
"0.70079124",
"0.6999202",
"0.6766331",
"0.66250104",
"0.6609191",
"0.6601869",
"0.65813565",
"0.6569423",
"0.6474816",
"0.6465655",
"0.63928306",
"0.6367752",
"0.62442786",
"0.622169",
"0.62078553",
"0.617692",
"0.617528",
"0.61686736"... | 0.8672173 | 0 |
Forward pass through the predictor. Ensures that the inputs are on the correct device. The outputs are on the same device as self.predictor. | def predictor_forward(self, preproc_inputs: Dict[str, torch.Tensor]) ->Dict[str, torch.Tensor]:
for k, v in preproc_inputs.items():
preproc_inputs[k] = v
with torch.no_grad():
predictions_flattened = self.predictor(preproc_inputs)
return predictions_flattened | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _forward(self):\n\n tf.summary.image(\"image\", tensor=tf.reshape(self.x, (self.batch_size, 28, 28, 1)), max_outputs=10)\n x = self.x\n\n # x = layers.dropout(self.x, keep_prob=0.7)\n # with tf.variable_scope(\"layer1\") as scope:\n h = tf.nn.relu(layers.fully_connected(x, nu... | [
"0.69631",
"0.6903938",
"0.68522716",
"0.68467283",
"0.6772732",
"0.6745883",
"0.6720709",
"0.6701661",
"0.66913366",
"0.666534",
"0.665999",
"0.6652311",
"0.66331595",
"0.6628414",
"0.66244787",
"0.6614972",
"0.65962327",
"0.6588843",
"0.6541954",
"0.6538636",
"0.6509545",
... | 0.0 | -1 |
Full path file name of the SQL database file | def file(self):
return self._file | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_database_filename() -> str:\n config_dir = get_config_dir()\n return os.path.join(config_dir, DATABASE_FILENAME)",
"def filename(self):\n return self._dbfile",
"def database_file(file):\r\n fpath = path.join('databases', '{0}'.format(file))\r\n db_path = path.join(mod_path, fpath)\r\... | [
"0.7734779",
"0.76639014",
"0.7617889",
"0.7582012",
"0.7383742",
"0.7242772",
"0.7196829",
"0.7179363",
"0.7029488",
"0.6984213",
"0.69673747",
"0.6651508",
"0.6626306",
"0.66090417",
"0.64260036",
"0.64236784",
"0.6420329",
"0.6413597",
"0.6392382",
"0.6372003",
"0.6341216"... | 0.0 | -1 |
Stop previouslystarted listening sessions. | def stop_listening(self) -> None:
assert self.client_recv
self.client_recv = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(self) -> None:\n self.stop_listening = True",
"def _stopListening(self):\n if self.listener:\n self.listener.stopListening()",
"def stop_listen(self):\n if self.stop_flag is not None:\n self.stop_flag.set()",
"def stop(self):\n if self.running:\n ... | [
"0.7506976",
"0.74805695",
"0.7356824",
"0.7166463",
"0.71475077",
"0.7137252",
"0.7110063",
"0.7097007",
"0.70884806",
"0.7029489",
"0.70192957",
"0.6998198",
"0.69814783",
"0.6965208",
"0.6959934",
"0.69020873",
"0.68814963",
"0.6833605",
"0.6713976",
"0.66331416",
"0.66100... | 0.7380344 | 2 |
Sends a bunch of messages and verifies each one is received exactly once. | def test_mock_transport_without_random_failures(self): # pylint: disable=too-many-locals
msgcount = 10000
expected_msgcount = 0
failurerate = 0
maxdelay = 1
def genmsg(index):
nonlocal expected_msgcount
msg = 'msg-' + str(index)
if self.cointo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_multiple_messages_received_at_once(self):\n # Send 2 messages\n self.sock.send(message + message)\n # Receive them back\n ident, payload = self.inverter.receive()\n self.assertEqual(b\"\\x00\\x01\\x02\", ident)\n self.assertEqual(b\"\", payload)\n ident, pa... | [
"0.71459395",
"0.683277",
"0.6680603",
"0.665214",
"0.648256",
"0.6441604",
"0.6294099",
"0.62871695",
"0.6267423",
"0.6255334",
"0.6249038",
"0.6204902",
"0.61748075",
"0.6156605",
"0.6147245",
"0.6129862",
"0.61195487",
"0.6112097",
"0.61098164",
"0.607688",
"0.6039108",
... | 0.0 | -1 |
Verify that the count of messages that still remain in our map is exactly equal to the number of messages dropped by the transport i.e., they were never received. | def final_send_message_validation(self):
stats = self.transport.get_stats()
randomdrops = stats.randomdrops
forcedrops = stats.forcedrops
mapsize = len(self.msgmap)
msg = "Final verification ForceDrops: %d RandomDrops: %d MISSING: %d"
_LOGGER.info(msg, forcedrops, randomd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_received_message_deletion(self):\n # Send and receive on the channel first to make the channel key\n self.channel_layer.send(\"test-deletion\", {\"first\": True})\n self.receive([\"test-deletion\"])\n # Get the number of keys in the Redis database before we send\n num_ke... | [
"0.61592174",
"0.6045346",
"0.60270584",
"0.59984934",
"0.5781858",
"0.57705855",
"0.57617444",
"0.5726655",
"0.56904763",
"0.56840694",
"0.5683854",
"0.5673073",
"0.5666461",
"0.56659603",
"0.56505466",
"0.564725",
"0.5620546",
"0.5587591",
"0.55720824",
"0.55534524",
"0.555... | 0.7626821 | 0 |
Calculates and returns the surface area of the cube | def surfaceArea(self):
surfaceArea = self.sideLength**2 * 6
return surfaceArea | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surface_area_of_cube(side):\n return side",
"def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())",
"def surface_area_cube(side_length: float) -> float:\r\n if side_length < 0:\r\n raise ValueError(\"surface_area_cube() only accepts non-negative values\")\r\n ... | [
"0.8243938",
"0.7746029",
"0.77131724",
"0.7386761",
"0.73718613",
"0.7304005",
"0.72820234",
"0.7138774",
"0.7007039",
"0.6898807",
"0.68708813",
"0.6836546",
"0.68086857",
"0.6770699",
"0.67436135",
"0.6673381",
"0.65992916",
"0.6555283",
"0.6523717",
"0.6516486",
"0.650901... | 0.7716237 | 2 |
Visiting a nonexistent shortlink presents a link not found error. | def test_missing_shortlink(self):
rv = self.app.get('/TheStakeOut')
assert 'No url found' in rv.data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_404(error):\n return 'Bummer, there is nothing at this URL.'",
"def error_not_found(error):\n return 'No page here, dood. 404!', 404",
"def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404",
"def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404",
"def page_no... | [
"0.6707295",
"0.6355926",
"0.6321469",
"0.6321469",
"0.6321469",
"0.6321469",
"0.6321469",
"0.6321469",
"0.6321469",
"0.63080055",
"0.63025105",
"0.6287139",
"0.6287139",
"0.6287139",
"0.6287139",
"0.6287139",
"0.6287139",
"0.6287139",
"0.6287139",
"0.6216288",
"0.6193737",
... | 0.74362814 | 0 |
Add a plane to the scene. | def addPlaneToScene(self, foot, x, y):
#research
profprint()
scene = slicer.mrmlScene
# Create model node
model = slicer.vtkMRMLModelNode()
model.SetScene(scene)
model.SetName(scene.GenerateUniqueName(".ObturatorPlane"))
planeSource = vtk.vtkPlaneSource()
foot-=25*(x+y)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_plane(self, plane):\n self.__plane_list.append(plane)",
"def addElement( self, element, plane = 0):\n if plane not in self.mElements:\n self.mElements[plane] = []\n \n self.mElements[plane].append( element )",
"def add_planet(self,x,y,z):\n\t\tself.ob.append(v... | [
"0.824134",
"0.66390467",
"0.6552949",
"0.62218213",
"0.6158426",
"0.5864087",
"0.58619595",
"0.58610123",
"0.58062255",
"0.57678956",
"0.5756324",
"0.5682945",
"0.5608015",
"0.5588542",
"0.5556781",
"0.554467",
"0.5536508",
"0.55351496",
"0.5525702",
"0.55016047",
"0.548711"... | 0.74481606 | 1 |
Reset coronal segment orientation. | def resetCoronalSegment(self):
#research
profprint()
sGreen = slicer.mrmlScene.GetNodeByID("vtkMRMLSliceNodeGreen")
if sGreen == None :
sGreen = slicer.mrmlScene.GetNodeByID("vtkMRMLSliceNode3")
reformatLogic = slicer.vtkSlicerReformatLogic()
#sGreen.SetSliceVisible(0)
sGreen.S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orient(self):\n if self.oriented:\n return\n self.substrates = self.substrates.simplify(SHP_EPSILON)\n self.substrates = shapely.ops.orient(self.substrates)\n self.oriented = True",
"def change_orientation(self):\n self.shape = self.shape.T",
"def reset_to_orig... | [
"0.62244356",
"0.6110344",
"0.59891415",
"0.5974032",
"0.5969279",
"0.58223754",
"0.57261384",
"0.5674075",
"0.55200714",
"0.5513303",
"0.55112165",
"0.5492887",
"0.5476411",
"0.5448116",
"0.5445093",
"0.5438349",
"0.53278756",
"0.5326647",
"0.5323922",
"0.53049713",
"0.52963... | 0.714825 | 0 |
Calculates the Hausdorff's distance [HD]_ of two needles. Both needles are truncated to start and end at the same slices. | def hausdorffDistance(self, id1, id2):
# productive #math
if frequent: profprint()
node1 = slicer.mrmlScene.GetNodeByID(id1)
polydata1 = node1.GetPolyData()
node2 = slicer.mrmlScene.GetNodeByID(id2)
polydata2 = node2.GetPolyData()
nb1 = polydata1.GetNumberOfPoints()
nb2 = polydat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Hausdorff_distance(clust1, clust2, forward, dir):\n if forward == None:\n return max(Hausdorff_distance(clust1,clust2,True,dir),Hausdorff_distance(clust1,clust2,False,dir))\n else:\n clstart, clend = (clust1,clust2) if forward else (clust2,clust1)\n dx, dy = dir if forward else (-dir[0],-dir[1])\n return s... | [
"0.6700508",
"0.66352427",
"0.6626204",
"0.6493618",
"0.64190805",
"0.63637537",
"0.6325545",
"0.6302611",
"0.6280827",
"0.6232068",
"0.6176193",
"0.61688465",
"0.6160264",
"0.6121613",
"0.6097928",
"0.6075825",
"0.607546",
"0.60616726",
"0.59389544",
"0.591738",
"0.5889618",... | 0.65440655 | 3 |
Returns the distance between the tip of two needles | def distTip(self, id1, id2):
# productive #math
if frequent: profprint()
node = slicer.mrmlScene.GetNodeByID('vtkMRMLModelNode' + str(id1))
polydata = node.GetPolyData()
node2 = slicer.mrmlScene.GetNodeByID('vtkMRMLModelNode' + str(id2))
polydata2 = node2.GetPolyData()
p, pbis = [0, 0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self, first_tape, second_tape):\n pairs = zip(first_tape, second_tape)\n return math.sqrt(abs(sum(map((lambda n: self.subsq(*n)), pairs))))",
"def dist(pnt1, pnt2):\n return ((pnt2[0] - pnt1[0])**2 + (pnt2[1] - pnt1[1])**2 + (pnt2[2] - pnt1[2])**2)**0.5",
"def calc_distance(first:... | [
"0.7278756",
"0.7114014",
"0.7066871",
"0.7044566",
"0.7012027",
"0.70021296",
"0.6969307",
"0.695868",
"0.6954002",
"0.6939553",
"0.69126475",
"0.69067514",
"0.68834025",
"0.68827206",
"0.6839414",
"0.68245524",
"0.6820189",
"0.6810298",
"0.6799104",
"0.67873675",
"0.6765572... | 0.68236417 | 16 |
Returns the distance between the base of two needles | def distBase(self, id1, id2):
# productive #math
if frequent: profprint()
node = slicer.mrmlScene.GetNodeByID('vtkMRMLModelNode' + str(id1))
polydata = node.GetPolyData()
node2 = slicer.mrmlScene.GetNodeByID('vtkMRMLModelNode' + str(id2))
polydata2 = node2.GetPolyData()
p, pbis = [0, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_distance(a, b):\n return np.sqrt(np.sum((a - b) ** 2))",
"def distance(a, b):\n return (np.sum((a - b)**2))**0.5",
"def dist(a, b):\n return np.sum((a-b)**2.0)**.5",
"def dist(gene1, gene2):\n return abs(len(gene1.goal) - len(gene2.goal))",
"def _dist(a, b):\n return... | [
"0.7452129",
"0.7053205",
"0.69995016",
"0.6960214",
"0.69244105",
"0.6893356",
"0.68543047",
"0.6840622",
"0.68222964",
"0.68041885",
"0.6792362",
"0.6790861",
"0.67707527",
"0.67614615",
"0.67474234",
"0.6713002",
"0.6708609",
"0.67074704",
"0.670717",
"0.66980654",
"0.6691... | 0.6587368 | 29 |
Get a Qt bold font ??? Used? | def getBoldFont(self):
# obsolete?
profbox()
boldFont = qt.QFont("Sans Serif", 12, qt.QFont.Bold)
return boldFont | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBoldFont( self ):\n #obsolete?\n profbox()\n boldFont = qt.QFont( \"Sans Serif\", 12, qt.QFont.Bold )\n return boldFont",
"def asBold(self):\n\t\treturn TextFont( self.name[0:2]+'B', self.size)",
"def get_default_font(bold=False):\n font = _QFont()\n font.setPointSize(FONT_SIZE)\n f... | [
"0.86582637",
"0.7380761",
"0.7377628",
"0.70487034",
"0.68645406",
"0.6864019",
"0.6856015",
"0.68205136",
"0.6728196",
"0.66383237",
"0.66360015",
"0.65626144",
"0.65626144",
"0.65588915",
"0.65588915",
"0.65588915",
"0.646702",
"0.6365736",
"0.63470936",
"0.6321657",
"0.63... | 0.8530899 | 1 |
Encode query values for RAPI URL. | def _EncodeQuery(query):
result = []
for name, value in query:
if value is None:
result.append((name, ""))
elif isinstance(value, bool):
# Boolean values must be encoded as 0 or 1
result.append((name, int(value)))
elif isinstance(value, (list, tuple, dict)):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_query_string(self):\n \n query_items = {}\n \n for key, val in self.__dict__.iteritems():\n if not key.startswith('_'):\n query_items[key] = val.encode('utf-8')\n \n return urllib.urlencode(query_items)",
"def encoded_query_str(req... | [
"0.75739545",
"0.7011164",
"0.67879283",
"0.67101306",
"0.66943675",
"0.66450316",
"0.653409",
"0.6517327",
"0.65054566",
"0.6364978",
"0.6315464",
"0.627922",
"0.62099165",
"0.6191805",
"0.6141534",
"0.6101483",
"0.6090304",
"0.6079465",
"0.60540074",
"0.60085505",
"0.600017... | 0.5682679 | 51 |
Gets the Remote API version running on the cluster. | def GetVersion(self):
return self._SendRequest(HTTP_GET, "/version", None, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_api_version(self):\n return self.connector.request('GET', '/app/webapiVersion')",
"def get_version(self):\n return self.__make_api_call('get/version')",
"def get_version(self):\n\n r = self._create_operation_request(self, method=\"GET\")\n root_info = send_session_request(se... | [
"0.7660233",
"0.7454487",
"0.74486893",
"0.73802835",
"0.73116934",
"0.7291367",
"0.72758824",
"0.72734594",
"0.7242295",
"0.7213896",
"0.7129838",
"0.7097745",
"0.7068309",
"0.7052281",
"0.7017182",
"0.7017182",
"0.7017182",
"0.7017182",
"0.7017182",
"0.7017182",
"0.7017182"... | 0.7041777 | 14 |
Gets the Operating Systems running in the Ganeti cluster. | def GetOperatingSystems(self, reason=None):
query = []
_AppendReason(query, reason)
return self._SendRequest(HTTP_GET, "/%s/os" % GANETI_RAPI_VERSION,
query, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_operating_systems():\n pass",
"def getOperatingSystems(self, df: str = None, ts: str = None, cursor: str = None, pageSize: int = None):\n params = {\n 'df': df,\n 'ts': ts,\n 'cursor': cursor,\n 'pageSize': pageSize\n }\n return sel... | [
"0.6700258",
"0.6574702",
"0.6549351",
"0.6326118",
"0.6319257",
"0.6123464",
"0.60488504",
"0.60477626",
"0.59815216",
"0.5945717",
"0.59159374",
"0.58763456",
"0.58601785",
"0.583147",
"0.5811455",
"0.57937026",
"0.5735086",
"0.5730722",
"0.5715846",
"0.5710523",
"0.5683537... | 0.7976296 | 0 |
Gets the cluster tags. | def GetClusterTags(self, reason=None):
query = []
_AppendReason(query, reason)
return self._SendRequest(HTTP_GET, "/%s/tags" % GANETI_RAPI_VERSION,
query, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tags(self):\n return self.tags",
"def getTags(self,):\n\t\treturn self.tags;",
"def get_tags(self):\n\n return self.tags",
"def get_tags(self):\n resp = self.get(_u.build_uri(\"tags\", domain=self.domain))\n return utils.handle_response(resp)",
"def get_tags_metadata(cls... | [
"0.6864384",
"0.6832567",
"0.68292093",
"0.6794803",
"0.67510396",
"0.6663525",
"0.6663525",
"0.6663525",
"0.6663525",
"0.6663525",
"0.6663525",
"0.6663525",
"0.6663525",
"0.6641292",
"0.66268444",
"0.6566453",
"0.6527105",
"0.6521894",
"0.6521267",
"0.6473524",
"0.6461728",
... | 0.82661825 | 0 |
Changes the name of an instance. | def RenameInstance(self, instance, new_name, ip_check=None, name_check=None,
reason=None):
body = {
"new_name": new_name,
}
_SetItemIf(body, ip_check is not None, "ip_check", ip_check)
_SetItemIf(body, name_check is not None, "name_check", name_check)
query = []
_A... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_instance_name(self, name):\n self.__instance_name = name",
"def instance_name(self, instance_name):\n\n self._instance_name = instance_name",
"def new_name(self,new_name):\n self.name = new_name",
"def update_name(self, new_name):\r\n self.__name = new_name",
"def update_na... | [
"0.86135644",
"0.82912153",
"0.79495335",
"0.79138136",
"0.79138136",
"0.7865067",
"0.7745966",
"0.7662284",
"0.76384914",
"0.7621367",
"0.7562817",
"0.7559987",
"0.7539256",
"0.7539256",
"0.75296307",
"0.75296307",
"0.75296307",
"0.75296307",
"0.75296307",
"0.7528852",
"0.75... | 0.0 | -1 |
Gets information about a network. | def GetNetwork(self, network, reason=None):
query = []
_AppendReason(query, reason)
return self._SendRequest(HTTP_GET,
"/%s/networks/%s" % (GANETI_RAPI_VERSION, network),
query, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_network(self, network, **_params):\r\n return self.get(self.network_path % (network), params=_params)",
"def get_network_info(self, network_id):\n return DictModel(self.call(self.context,\n self.make_msg('get_network_info',\n ... | [
"0.7870924",
"0.7537712",
"0.74541664",
"0.73275393",
"0.7263234",
"0.7188031",
"0.7140477",
"0.70513743",
"0.70479214",
"0.7029827",
"0.7010742",
"0.69964474",
"0.69964474",
"0.69964474",
"0.698262",
"0.6904681",
"0.6899942",
"0.68259794",
"0.6822848",
"0.67348385",
"0.67308... | 0.7533764 | 2 |
Changes the name of a network. | def RenameNetwork(self, network, new_name, reason=None):
body = {
"new_name": new_name,
}
query = []
_AppendReason(query, reason)
return self._SendRequest(HTTP_PUT,
("/%s/networks/%s/rename" %
(GANETI_RAPI_VERSION, network)), query... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def computer_network_name(self, computer_network_name: str):\n self._computer_network_name = computer_network_name",
"def set_name(net_id, name):\n connection = get_connection()\n cursor = connection.cursor()\n sql_string = \"UPDATE Member SET name='\"+name+\"' WHERE netID='\"+net_id+\"'\"\n c... | [
"0.70586956",
"0.6979021",
"0.6911888",
"0.6911888",
"0.6866134",
"0.6828192",
"0.6790098",
"0.6776005",
"0.676296",
"0.6624278",
"0.6593671",
"0.6593671",
"0.65389216",
"0.65389216",
"0.65389216",
"0.65389216",
"0.65389216",
"0.6538464",
"0.65201926",
"0.6506854",
"0.6475134... | 0.7256318 | 0 |
Modifies a node group. More details for parameters can be found in the RAPI documentation. | def ModifyGroup(self, group, reason=None, **kwargs):
query = []
_AppendReason(query, reason)
return self._SendRequest(HTTP_PUT,
("/%s/groups/%s/modify" %
(GANETI_RAPI_VERSION, group)), query, kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_modify_group(self):\n response = self.client.modify_group(\"ABC123\")\n self.assertEqual(response[\"method\"], \"POST\")\n self.assertEqual(response[\"uri\"], \"/admin/v1/groups/ABC123\")\n self.assertEqual(util.params_to_dict(response[\"body\"]), {\"account_id\": [self.client.... | [
"0.682379",
"0.6750026",
"0.6575771",
"0.6373879",
"0.63275546",
"0.62604076",
"0.6245872",
"0.6083333",
"0.60151297",
"0.598862",
"0.5982472",
"0.59615487",
"0.58908355",
"0.58741146",
"0.58082783",
"0.5785362",
"0.5772808",
"0.5751344",
"0.5742247",
"0.5741941",
"0.57399744... | 0.6176435 | 7 |
Deletes a node group. | def DeleteGroup(self, group, dry_run=False, reason=None):
query = []
_AppendDryRunIf(query, dry_run)
_AppendReason(query, reason)
return self._SendRequest(HTTP_DELETE,
("/%s/groups/%s" %
(GANETI_RAPI_VERSION, group)), query, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_group(self, group):\n raise NotImplementedError('delete_group')",
"def test_070_delete_group_from_group(self):\n\n testflow.step(\n \"Removing group %s from group %s\",\n TEST_GROUP1, TEST_GROUP2\n )\n assert MANAGE_CLI.run(\n 'groupdel',\n ... | [
"0.78381073",
"0.7600806",
"0.7591933",
"0.7565552",
"0.7451756",
"0.74299043",
"0.7406101",
"0.7356044",
"0.735522",
"0.72833896",
"0.7259411",
"0.72563714",
"0.7242603",
"0.72238857",
"0.72181976",
"0.71383035",
"0.7064544",
"0.7047574",
"0.7011035",
"0.6895438",
"0.6874328... | 0.68213016 | 25 |
Verify that the API result list matches the given user batch. | def assert_json_results(response, json, users):
items = json['items']
assert json['total'] == len(items) == len(users)
items.sort(key=lambda i: i['id'])
users.sort(key=lambda u: u.id)
for n, user in enumerate(users):
assert_json_result(response, items[n], user) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_list(self, mapp, user_list):\n user_list = set(user_list)\n res = set(mapp.getuserlist())\n assert len(user_list) == len(res) and user_list.issubset(res)",
"def test_results_success(self, affiliate_items):\n success_count = 0\n\n updater = mock.Mock()\n bat... | [
"0.63900673",
"0.63054204",
"0.629964",
"0.6272876",
"0.6176654",
"0.6142222",
"0.61326265",
"0.6125377",
"0.6082505",
"0.60588104",
"0.605772",
"0.604553",
"0.60254097",
"0.6023426",
"0.5984345",
"0.59431154",
"0.5932028",
"0.5920379",
"0.5878478",
"0.58754677",
"0.58683336"... | 0.6452859 | 0 |
Determine whether ``__tablename__`` should be automatically generated for a model. If no class in the MRO sets a name, one should be generated. If a declared attr is found, it should be used instead. If a name is found, it should be used if the class is a mixin, otherwise one should be generated. Abstract models should... | def should_set_tablename(cls):
if (
cls.__dict__.get('__abstract__', False)
or not any(isinstance(b, BaseDeclarativeMeta) for b in cls.__mro__[1:])
):
return False
for base in cls.__mro__:
if '__tablename__' not in base.__dict__:
continue
if isinstance(b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_model(thing):\n return (isinstance(thing, sqlalchemy.ext.declarative.api.DeclarativeMeta)\n and hasattr(thing, '__table__')) # disard sqlalchemy.ext.declarative.declarative_base()",
"def test_abstract_name(self):\n\n app = Zask(__name__)\n app.config['SQLALCHEMY_DATABASE_URI']... | [
"0.6124218",
"0.5964463",
"0.5929828",
"0.57448363",
"0.5613623",
"0.55516785",
"0.5507123",
"0.5406385",
"0.5372495",
"0.536238",
"0.52975935",
"0.5242416",
"0.5195567",
"0.50673515",
"0.50410277",
"0.5034955",
"0.5020842",
"0.5003092",
"0.49991414",
"0.4974286",
"0.4925317"... | 0.7093151 | 0 |
Generate a random string of fixed length | def randomString(stringLength=10):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))",
"def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",... | [
"0.8678726",
"0.85725635",
"0.8546959",
"0.852769",
"0.85201234",
"0.84315515",
"0.84307504",
"0.84138894",
"0.84099346",
"0.8388408",
"0.8344307",
"0.8342706",
"0.83389807",
"0.8332531",
"0.83217525",
"0.829651",
"0.829245",
"0.8281027",
"0.8280717",
"0.8279932",
"0.8263646"... | 0.7760928 | 94 |
Convert ISIN security identifiers to CUSIP identifiers. | def cusip_from_isin(isin):
if not isin.startswith('US'):
raise CountryCodeError
return Cusip().validate(isin[2:-1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_pert_id_to_InChI(pert_ids):\n _download_metadata()\n l1000meta_df = pd.read_csv(L1000FWD_METADATA, index_col=0)\n return list(map(lambda s: s.replace('InChIKey=', '') if isinstance(s, str) else s, l1000meta_df['inchi_key'].loc[pert_ids]))",
"def well_known_sids(username=None, sid=None) -> s... | [
"0.538051",
"0.5255025",
"0.51657736",
"0.5111349",
"0.5084173",
"0.5063481",
"0.50406253",
"0.50258136",
"0.50128704",
"0.49986157",
"0.49720624",
"0.4948667",
"0.49434647",
"0.49370503",
"0.49286604",
"0.49013054",
"0.48946846",
"0.48822594",
"0.48780808",
"0.4870729",
"0.4... | 0.60541135 | 0 |
Return a the path to a file that is gzipped without any content This file will not have the size = 0 due to gzip header and footer | def fixture_gzipped_empty_file(fastq_dir: Path) -> Path:
return fastq_dir / "dummy_run_R1_001.fastq.gz" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixture_filled_gzip_file(non_existing_gzipped_file_path: Path, content: str) -> Path:\n with gzip.open(non_existing_gzipped_file_path, \"wb\") as outfile:\n with io.TextIOWrapper(outfile, encoding=\"utf-8\") as enc:\n enc.write(content)\n return non_existing_gzipped_file_path",
"def f... | [
"0.6547188",
"0.64927524",
"0.624662",
"0.624662",
"0.61653006",
"0.6050532",
"0.6040014",
"0.59761995",
"0.5908149",
"0.5871158",
"0.58167094",
"0.5799919",
"0.57902",
"0.57890695",
"0.5777233",
"0.5734589",
"0.57124144",
"0.5710192",
"0.57023513",
"0.5678824",
"0.56695855",... | 0.63220054 | 2 |
Returns the time projection matrix. | def getTimeP(self, timesall):
time_inds = np.in1d(timesall, self.times)
return time_inds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trajectory(self):\n traj = np.zeros((2, self.times.size))\n for t, time in enumerate(self.times):\n traj[:, t] = self.center_of_mass(time)\n return traj",
"def PNmatrix(t, inp):\n from pypride.vintlib import taitime, eop_iers, t_eph, ter2cel, load_cats\n # preces... | [
"0.61495924",
"0.6117341",
"0.6111303",
"0.6041262",
"0.60038954",
"0.587832",
"0.58507717",
"0.5830019",
"0.5830019",
"0.58074045",
"0.57902265",
"0.56982136",
"0.56681913",
"0.5612708",
"0.55956674",
"0.55644375",
"0.55496144",
"0.55272704",
"0.54652196",
"0.545332",
"0.544... | 0.0 | -1 |
Number of data in the receiver. | def nD(self):
return self.locations[0].shape[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_count(self):\n return(len(self.data))",
"def getNumData(self):\n return len(self.data)",
"def count(self):\r\n return self.data_array.size",
"def len (self):\n\t\treturn len (self.data)",
"def getLen(self):\n return len(self.data)",
"def length(self):\n return ... | [
"0.8447973",
"0.82967305",
"0.80269593",
"0.79553485",
"0.78169024",
"0.7816902",
"0.7816902",
"0.7816902",
"0.7795181",
"0.7777264",
"0.7777264",
"0.7777264",
"0.7777264",
"0.7777264",
"0.77715033",
"0.776622",
"0.76774514",
"0.7648562",
"0.7648562",
"0.7648562",
"0.7638385"... | 0.0 | -1 |
Number of data in the receiver. | def nD(self):
return self.locations.shape[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_count(self):\n return(len(self.data))",
"def getNumData(self):\n return len(self.data)",
"def count(self):\r\n return self.data_array.size",
"def len (self):\n\t\treturn len (self.data)",
"def getLen(self):\n return len(self.data)",
"def length(self):\n return ... | [
"0.84484094",
"0.8297525",
"0.80271894",
"0.79556096",
"0.7818251",
"0.78175116",
"0.78175116",
"0.78175116",
"0.779564",
"0.7777739",
"0.7777739",
"0.7777739",
"0.7777739",
"0.7777739",
"0.77722603",
"0.77662164",
"0.7677813",
"0.7648265",
"0.7648265",
"0.7648265",
"0.763812... | 0.0 | -1 |
Gets a random factoid, eithers prints it on context or stores it on a context variable {% get_factoid 'greetings' %} {% get_factoid 'greetings' as factoid %} | def do_get_factoid(parser, token):
bits = token.split_contents()[::-1]
tag_name = bits.pop() # Tag name is first bit
if not bits:
raise TemplateSyntaxError(u'%r requires at least one argument', tag_name)
type = bits.pop() # Second argument is the type
if type[0] in ('"', "'"): # Its a quot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def dogfact(self, ctx: DogbotContext):\n await ctx.send(random.choice(self.dogfacts))",
"def fact_command(update: Update, context: CallbackContext) -> None:\n update.message.reply_text(get_random_fact())",
"async def nfact(self, ctx):\n fact = nekos.fact()\n await ctx.send('Here i... | [
"0.62337977",
"0.61155105",
"0.61114836",
"0.6004894",
"0.5838735",
"0.5828193",
"0.57676136",
"0.5678986",
"0.55800474",
"0.55446285",
"0.55274427",
"0.54452497",
"0.53982365",
"0.53615576",
"0.53333604",
"0.5317298",
"0.53116393",
"0.52700067",
"0.5246236",
"0.52308583",
"0... | 0.49762636 | 37 |
Returns the url to access a detail record for the Sponsor. | def get_absolute_url(self):
return reverse('sponsor-detail', args=[str(self.sponsorId)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sponsor(request, sponsor):\n sponsor = get_object_or_404(models.Sponsor, slug = sponsor)\n return {\n 'sponsor': sponsor.sponsor,\n 'slug': sponsor.slug,\n 'url': sponsor.url\n }",
"def sponsor(self) -> object:\n return self._sponsor",
"def get_absolute_url(self):\n ... | [
"0.760928",
"0.67023534",
"0.64557934",
"0.62588716",
"0.6227809",
"0.6204574",
"0.6190395",
"0.6158854",
"0.6156298",
"0.6104466",
"0.6075555",
"0.6054468",
"0.6038518",
"0.60021156",
"0.5983956",
"0.59415776",
"0.5940987",
"0.59335285",
"0.5922653",
"0.59218955",
"0.5907964... | 0.7674386 | 0 |
Returns the url to access a detail record for the Participant. | def get_absolute_url(self):
return reverse('participant-detail', args=[str(self.participantId)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_participant_url(self): \n return \"/participantportal/%s/%s/%s/%s/\" % (self.site, self.participantId, self.sessionId, self.componentId)",
"def details_url(self):\n if self._data.get('details_url'):\n path = self._data.get('details_url')\n try:\n ... | [
"0.716924",
"0.7084224",
"0.6557643",
"0.6493883",
"0.64822257",
"0.6390233",
"0.6309537",
"0.6263083",
"0.6242836",
"0.6162974",
"0.61408067",
"0.6136609",
"0.61082226",
"0.6077404",
"0.60485333",
"0.6044728",
"0.603051",
"0.6030013",
"0.6003359",
"0.5996123",
"0.5991107",
... | 0.7229389 | 0 |
Returns the url to access a detail record for the Criteria. | def get_absolute_url(self):
return reverse('criteria-detail', args=[str(self.criteriaId)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details_url(self):\n if self._data.get('details_url'):\n path = self._data.get('details_url')\n try:\n path, hash_ = path.split('#')\n hash_ = '#' + hash_\n except ValueError:\n hash_ = ''\n return '{}?from_activity... | [
"0.68815947",
"0.6780237",
"0.66401905",
"0.6627948",
"0.6547293",
"0.6512361",
"0.6512361",
"0.64775014",
"0.6455476",
"0.64270705",
"0.64257646",
"0.63758004",
"0.6331328",
"0.6328736",
"0.6325539",
"0.63204956",
"0.63134855",
"0.63045686",
"0.62890613",
"0.6281558",
"0.628... | 0.73339236 | 0 |
Returns the url to access a detail record for the Category. | def get_absolute_url(self):
return reverse('category-detail', args=[str(self.categoryId)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category_details_url(id):\n return reverse('category:category-detail', args=[id])",
"def get_absolute_url(self):\n return reverse('market:category-detail', args=[str(self.id)])",
"def get_absolute_url(self):\n return reverse('csv-detail', args=[str(self.id)])",
"def get_absolute_url(self... | [
"0.78718424",
"0.7319393",
"0.65100574",
"0.64843434",
"0.64781696",
"0.63904893",
"0.6374697",
"0.6348256",
"0.63366544",
"0.6317995",
"0.628293",
"0.6281304",
"0.62768424",
"0.62750804",
"0.62750804",
"0.62750804",
"0.62677985",
"0.6240174",
"0.6220813",
"0.6218361",
"0.621... | 0.7446559 | 1 |
Creates vocabularies for words and slots | def create_dicts():
load_data_for_dict('data/atis/train/seq.in', 'data/atis/voc/vocabulary.json')
load_data_for_dict('data/atis/valid/seq.in', 'data/atis/voc/vocabulary.json')
load_data_for_dict('data/atis/test/seq.in', 'data/atis/voc/vocabulary.json')
load_data_for_dict('data/atis/train/seq.out', 'dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vocab():\n symbols = DEFAULT_SPECIAL_SYMBOLS + [\"mouse\", \"dog\", \"tree\"]\n return Vocabulary(symbols)",
"def build_vocab(sentences):\n # Build vocabulary\n word_counts = Counter(itertools.chain(*sentences)) # 实际没用到\n # Mapping from index to word\n vocabulary_inv = [x[0] for x in word_... | [
"0.70016485",
"0.6513072",
"0.6328747",
"0.624563",
"0.6238553",
"0.62266856",
"0.62255174",
"0.62175316",
"0.6196918",
"0.61855334",
"0.61753714",
"0.6168095",
"0.6166663",
"0.6163259",
"0.6158383",
"0.61465883",
"0.6143417",
"0.6134924",
"0.6118822",
"0.6109418",
"0.6109418... | 0.0 | -1 |
Constructor for the Random agent | def __init__(self,agent_host,agent_port, mission_type, mission_seed, solution_report, state_space):
self.AGENT_MOVEMENT_TYPE = 'Discrete'
self.AGENT_NAME = 'Random'
self.AGENT_ALLOWED_ACTIONS = ["movenorth 1", "movesouth 1", "movewest 1", "moveeast 1"]
self.agent_host = agent_host
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, node):\r\n # set the agent's id and increment class counter\r\n self.__id = Agent.agent_id; Agent.agent_id+= 1\r\n self.__health_status = { \"label\": \"healthy\", \r\n \"days_infected\": -1 }\r\n\r\n self.__age_categorize(random.randin... | [
"0.77640736",
"0.77100533",
"0.74305177",
"0.7366764",
"0.7214003",
"0.72034544",
"0.71553475",
"0.71527356",
"0.7094469",
"0.70594746",
"0.70497936",
"0.70010346",
"0.6997491",
"0.69815093",
"0.69769895",
"0.6959583",
"0.69566077",
"0.69517183",
"0.69449735",
"0.69304657",
"... | 0.70583385 | 10 |
Convert a date into the number of days from today. date str or datetime lang language format format to use string | def convert_into_days(date, lang="fr", format="%Y-%m-%dT%H:%M:%S"):
if lang != "fr":
raise NotImplementedError(
"Language '{0}' is not supported.".format(lang))
now = datetime.datetime.now()
if isinstance(date, str):
date = datetime.datetime.strptime(date, format)
delta = now... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_in_days(date):\n delta = delta_from_now(date)\n return (delta.days) + delta.seconds / 86400",
"def date_to_days(self, date):\n date = str_to_date(date)\n return (date-self.start_date).days",
"def DAY(date):\n return _make_datetime(date).day",
"def _date_string_to_date_number(dat... | [
"0.7196697",
"0.70129275",
"0.70069027",
"0.6644598",
"0.650632",
"0.6487801",
"0.64603674",
"0.6458072",
"0.6425003",
"0.63688153",
"0.6230028",
"0.612465",
"0.6116487",
"0.6111362",
"0.599132",
"0.5914898",
"0.5848826",
"0.58393",
"0.5821564",
"0.5809242",
"0.58002543",
"... | 0.5909315 | 16 |
This method will return the favicon.ico file ;) | def get(self):
return send_from_directory("", "favicon.ico") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def favicon():\n return ''",
"def favicon():\n return send_from_directory(os.path.join(application.root_path, 'static'),\n 'favicon.ico',\n mimetype='image/vnd.microsoft.icon')",
"def favicon():\n return send_from_directory(os.path.join(app.r... | [
"0.84240407",
"0.8328611",
"0.82575655",
"0.8057738",
"0.79462796",
"0.7872607",
"0.78151536",
"0.77498",
"0.7558401",
"0.7514477",
"0.7397805",
"0.7284955",
"0.7059152",
"0.69205743",
"0.68080264",
"0.66078144",
"0.65427697",
"0.6523811",
"0.64172405",
"0.63834083",
"0.63734... | 0.75885195 | 8 |
Check parameters mostly just that shape of ndarrays match | def check_param(self):
if scipy.ndim(self.param['initial_heading'].shape) > 1:
raise(ValueError, 'initial_heading must have ndim=1')
equal_shape_list = ['x_start_position','y_start_position','flight_speed','release_time']
for item in equal_shape_list:
if self.param[item]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nd_shape_checking(x, y, mvaxis, traxis):\n assert x.ndim == y.ndim\n dims = np.delete(np.arange(x.ndim), -2)\n assert all([x.shape[k] == y.shape[k] for k in dims])",
"def check_shapes(arrs):\r\n shps = [i.shape for i in arrs]\r\n eq = np.all(np.array([shps[0] == i for i in shps[1:]]))\r\n e... | [
"0.71017754",
"0.7049944",
"0.698519",
"0.6942874",
"0.6914211",
"0.6893466",
"0.6882964",
"0.68786114",
"0.6874017",
"0.68559754",
"0.68466663",
"0.6829971",
"0.6819575",
"0.674958",
"0.67481023",
"0.6743101",
"0.67259914",
"0.6702625",
"0.6691952",
"0.6685225",
"0.667151",
... | 0.71011794 | 1 |
Compute the probability of each token of the test_tokens list in the given text. The probability distribution will be smoothed by additive Lidstone Smoothing | def get_probabilities_lidstone(test_tokens, train_tokens, lidstone_lamda, vocabulary=None, get_log_prob=False):
# create vocabulary
if vocabulary is not None:
vocab = list(set(vocabulary))
else:
vocab = list(set(train_tokens))
# compute frequencies
train_freqs = get_frequencies(trai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy(self, text):\n\n# text = self.myReplacer.replace(text)\n# text = self.tokenizer.tokenize(text)\n new_text = []\n for word in text:\n if word.count('\\'') > 0:\n words = word.split('\\'')\n for w in words:\n new_text... | [
"0.65765005",
"0.65438235",
"0.6508399",
"0.65027386",
"0.640917",
"0.63153934",
"0.6296147",
"0.62809837",
"0.62324613",
"0.62324613",
"0.62041897",
"0.61728907",
"0.60797864",
"0.6043342",
"0.6027604",
"0.6005039",
"0.60016",
"0.5964927",
"0.59475183",
"0.5908764",
"0.59016... | 0.599814 | 17 |
Check if a row is for detele | def compare_resources_resource_exists(data_packages_path, identifier):
encoded_identifier = helpers.encode_identifier(identifier)
expected_filename = f'data-json-{encoded_identifier}.json'
expected_path = os.path.join(data_packages_path, expected_filename)
logger.debug(f'Expected path {expected_path}')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_instrument_type(row):\n instrument_type = row[2]\n return instrument_type == \"DEED\" or \"DEED OF TRUST\"",
"def is_inspection_row(elem):\n is_tr = elem.name == 'tr'\n if not is_tr:\n return False\n td_children = elem.find_all('td', recursive=False)\n has_four = len(td... | [
"0.64861685",
"0.6222575",
"0.6197743",
"0.6023418",
"0.5921392",
"0.5899822",
"0.58261406",
"0.5785691",
"0.5752021",
"0.573352",
"0.5721495",
"0.56972176",
"0.56318647",
"0.5626211",
"0.5584729",
"0.55529743",
"0.55513847",
"0.5538759",
"0.5536562",
"0.5526015",
"0.549674",... | 0.0 | -1 |
Checks if a row has three in a row | def find_three_in_row(self, row):
if row[0] != ' ' and row[0] == row[1] and row[1] == row[2]:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_complete_three_in_row(self, row_positions, board):\n\n row = [board.get_piece(row_positions[0][0], row_positions[0][1]), board.get_piece(row_positions[1][0], row_positions[1][1]), board.get_piece(row_positions[2][0], row_positions[2][1])]\n\n if row.count(' ') == 1 and row.count(self._piece) ... | [
"0.71760213",
"0.7074155",
"0.69003093",
"0.68210864",
"0.6616384",
"0.6589363",
"0.65676326",
"0.64947134",
"0.6451565",
"0.6437302",
"0.6417623",
"0.64139426",
"0.63974464",
"0.639033",
"0.63859904",
"0.63674164",
"0.6345441",
"0.6344673",
"0.6331006",
"0.6312336",
"0.61935... | 0.811962 | 0 |
Creates the board based on dimension | def create_board(self, dimension):
board = []
for i in range(dimension):
row = []
for j in range(dimension):
row.append(' ')
board.append(row)
return board | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_board(self, size):\n x = np.arange(0, size[0])\n y = np.arange(0, size[1])\n board = np.meshgrid(x, y)\n return board",
"def create_board(board_size):\n board = []\n for i in range(board_size):\n row = []\n for j in range(board_size):\n row.ap... | [
"0.79493386",
"0.7316799",
"0.7285577",
"0.72337383",
"0.72244805",
"0.7223925",
"0.72213703",
"0.72189856",
"0.70755184",
"0.7049359",
"0.700954",
"0.69986147",
"0.6990424",
"0.6983193",
"0.6975055",
"0.696802",
"0.6940105",
"0.6903485",
"0.68475115",
"0.68468916",
"0.681935... | 0.81886405 | 0 |
Used to determine if two in a row can be made for two rows | def can_complete_two_in_row(self, board):
row1 = [(0, 0), (0, 1), (0, 2)]
row2 = [(1, 0), (1, 1), (0, 2)]
return (-1, -1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_crossing_len2_ob(self) -> bool:\n fcell = self.first_cell\n scell = self.second_cell\n if self._fuse_row:\n possible_obs = [\n GriddedPerm((0, 1), (fcell, scell)),\n GriddedPerm((1, 0), (scell, fcell)),\n ]\n else:\n ... | [
"0.6849422",
"0.67015064",
"0.6665389",
"0.66530347",
"0.6571584",
"0.6552821",
"0.650272",
"0.64883655",
"0.6473175",
"0.6430528",
"0.637959",
"0.633552",
"0.62914306",
"0.6291321",
"0.6251831",
"0.61991215",
"0.61680585",
"0.6140428",
"0.6128354",
"0.60728264",
"0.6054192",... | 0.7735133 | 0 |
Plots the first 2 columns of an Array as a scatterplot, with the points optionally colored by cluster assignments resulting from a cluster analysis model. | def display_clusters(data, model_fit = [], num_clusters = 0, file = None):
color = ['r', 'g', 'b', 'c', 'm', 'y', 'black', 'orange', 'aqua', 'yellow', 'brown']
plt.figure(figsize = (12, 10))
if num_clusters == 0:
plt.scatter(data[:, 0], data[:, 1], c = color[0])
plt.xticks(fontsize = 12)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot(self):\n\t\tif (2 <= len(self.X) <= 3):\n\t\t\tvDataFrame(self.name, self.cursor).scatter(columns = self.X, catcol = \"dbscan_cluster\", max_cardinality = 100, max_nb_points = 10000)\n\t\telse:\n\t\t\traise ValueError(\"Clustering Plots are only available in 2D or 3D\")",
"def scatter_plot(self):\n\n ... | [
"0.7410342",
"0.7242202",
"0.7069867",
"0.68493354",
"0.6812089",
"0.6707657",
"0.67075527",
"0.6690304",
"0.66895473",
"0.6676716",
"0.6675918",
"0.66005933",
"0.65947914",
"0.64756274",
"0.64707506",
"0.64690274",
"0.6443006",
"0.64394414",
"0.64292216",
"0.634475",
"0.6344... | 0.60351497 | 45 |
Sets the learning rate | def adjust_learning_rate(optimizer, gamma, epoch, step_index, iteration, epoch_size):
if epoch < 0:
lr = 1e-6 + (args.lr - 1e-6) * iteration / (epoch_size * 5)
else:
lr = args.lr * (gamma ** (step_index))
for param_group in optimizer.param_groups:
param_group['lr'] = lr
return lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)",
"def adjust_lr(self):\n learning_rate = self.params.base_lr * (1 - float(self.epoch) / self.params.num_epoch) ** self.params.power\n for param_group in self.opt.param_groups:\n param_group['lr'] = learning_rat... | [
"0.8623272",
"0.76981455",
"0.7697208",
"0.7697208",
"0.7636927",
"0.758479",
"0.7572249",
"0.7514606",
"0.7490861",
"0.74744666",
"0.74288964",
"0.7413075",
"0.739503",
"0.73916996",
"0.73894364",
"0.73817927",
"0.73783433",
"0.7377333",
"0.7363047",
"0.7362884",
"0.7362884"... | 0.0 | -1 |
UUID for this descriptor. | def uuid(self) -> str:
return self.obj.uuid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uuid(self) -> str:\n return self.__uuid",
"def uuid(self):\n return self.__uuid",
"def uuid(self):\n return self.__uuid",
"def uuid(self):\n\n return self.__uuid",
"def uuid(self): # type: ignore\n return self._uuid",
"def uuid(self) -> str:\n return self._u... | [
"0.8296571",
"0.828175",
"0.828175",
"0.82651806",
"0.81748253",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81293577",
"0.81293577",
"0.811065",
"0.80257535",
"0.7904834",
"0.7904834",
"0.7904834",
"0.7724899",
"0.76225054",
"0.76225054",
"0.759579",
"0.74588156",
"0.740488... | 0.8163131 | 5 |
Returns a single Organization, specified by the organizationID parameter. | def get_organization_by_id(self, organization_id, **kwargs):
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.get_organization_by_id_with_http_info(organization_id, **kwargs)
else:
(data) = self.get_organization_by_id_with_http_info(organizat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_organization(\n self, organization_id: Union[str, int], *, params: Optional[dict] = None\n ) -> \"resource_types.Organization\":\n\n return communicator.Organization(self.__requester).from_id(\n organization_id=organization_id, parameters=params\n )",
"def organization(... | [
"0.8280249",
"0.78732705",
"0.74778724",
"0.7268284",
"0.7043003",
"0.702893",
"0.69926304",
"0.69506794",
"0.6902319",
"0.6893131",
"0.6893131",
"0.6878081",
"0.6815119",
"0.6787131",
"0.66634285",
"0.66368335",
"0.6463735",
"0.6326341",
"0.6284042",
"0.626296",
"0.62261",
... | 0.65877205 | 16 |
Returns a single Organization, specified by the organizationID parameter. | def get_organization_by_id_with_http_info(self, organization_id, **kwargs):
all_params = ['organization_id', 'organizations']
all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals()
for key, val in iteritems(params['kwargs']):
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_organization(\n self, organization_id: Union[str, int], *, params: Optional[dict] = None\n ) -> \"resource_types.Organization\":\n\n return communicator.Organization(self.__requester).from_id(\n organization_id=organization_id, parameters=params\n )",
"def organization(... | [
"0.8282004",
"0.78754544",
"0.74785435",
"0.72713476",
"0.7042515",
"0.7031926",
"0.6994991",
"0.6955305",
"0.6905933",
"0.6895583",
"0.6895583",
"0.68170685",
"0.67892665",
"0.6665491",
"0.6641641",
"0.658698",
"0.6464678",
"0.63238955",
"0.6286193",
"0.6266781",
"0.6229126"... | 0.68773645 | 11 |
Returns a single Organization, specified by the name parameter. | def get_organization_by_name(self, name, **kwargs):
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.get_organization_by_name_with_http_info(name, **kwargs)
else:
(data) = self.get_organization_by_name_with_http_info(name, **kwargs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_one_organization_by_name(ctx, org_name):\n pprint(cmd.get_one_organization_by_name(\n client=ctx.obj, organization_name=org_name))",
"def get_organization_by_name(self, name: str | None = None) -> dict[str, Any]:\n params = {}\n\n return self.client.get(self._url(\"name\", name), ... | [
"0.8315246",
"0.8272719",
"0.7284343",
"0.7091651",
"0.7033109",
"0.69959915",
"0.69605905",
"0.6905648",
"0.6762904",
"0.6760653",
"0.6740967",
"0.67321056",
"0.67158014",
"0.67051387",
"0.65987444",
"0.6594945",
"0.6572985",
"0.6508599",
"0.64482003",
"0.6378958",
"0.635115... | 0.60807306 | 31 |
Returns a single Organization, specified by the name parameter. | def get_organization_by_name_with_http_info(self, name, **kwargs):
all_params = ['name', 'organizations']
all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_param... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_one_organization_by_name(ctx, org_name):\n pprint(cmd.get_one_organization_by_name(\n client=ctx.obj, organization_name=org_name))",
"def get_organization_by_name(self, name: str | None = None) -> dict[str, Any]:\n params = {}\n\n return self.client.get(self._url(\"name\", name), ... | [
"0.8315246",
"0.8272719",
"0.7284343",
"0.7033109",
"0.69959915",
"0.69605905",
"0.6905648",
"0.6762904",
"0.6760653",
"0.6740967",
"0.67321056",
"0.67158014",
"0.67051387",
"0.65987444",
"0.6594945",
"0.6572985",
"0.6508599",
"0.64482003",
"0.6378958",
"0.63511527",
"0.62861... | 0.7091651 | 3 |
The shard for the match associated with this participant. | def shard(self):
return self._shard or self._pubg.shard | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shard(self):\n return self._shard",
"def shard(self, shard: str) -> str:\n return self.shards(shard)[shard]",
"def get_marathon_shard(self) -> Optional[int]:\n return self.config_dict.get(\"marathon_shard\", None)",
"def shards(self) -> pulumi.Output[Sequence['outputs.ClusterShard']]... | [
"0.8352179",
"0.7254957",
"0.6841986",
"0.6457557",
"0.62771434",
"0.62007105",
"0.61813813",
"0.60398203",
"0.60195726",
"0.60131973",
"0.59109247",
"0.580036",
"0.57127315",
"0.56959057",
"0.5683556",
"0.5617164",
"0.5617164",
"0.55219513",
"0.54987013",
"0.54811245",
"0.54... | 0.7801085 | 2 |
The player's account id. | def id(self):
return self.data["id"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")",
"def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")",
"def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")",
"def account_id(self) -> str:\n return pulumi.get(self, \"ac... | [
"0.81423986",
"0.81423986",
"0.81423986",
"0.81423986",
"0.81423986",
"0.81423986",
"0.81423986",
"0.81423986",
"0.80779576",
"0.80684024",
"0.7934841",
"0.7924013",
"0.7780243",
"0.775661",
"0.775661",
"0.775661",
"0.7744938",
"0.7744938",
"0.7744938",
"0.7744938",
"0.774493... | 0.0 | -1 |
The match specific participant id of the player. | def participant_id(self):
return self.data["id"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player_id(self):\n return self.game.get_player_id()",
"def get_player_id(self):\n\n return self.player_id",
"def player_id(self):\n return self.data[\"attributes\"][\"stats\"][\"playerId\"]",
"def get_player_id(self, player_email):\n return self.player_ids[player_email]",
... | [
"0.77060664",
"0.7698602",
"0.7559915",
"0.75530523",
"0.73656774",
"0.73262256",
"0.7260046",
"0.72483885",
"0.7090019",
"0.7010991",
"0.684852",
"0.6828935",
"0.67233866",
"0.66533285",
"0.65712535",
"0.6555727",
"0.6541252",
"0.6438787",
"0.6399783",
"0.63065046",
"0.62239... | 0.7854776 | 0 |
The player's account id. | def player_id(self):
return self.data["attributes"]["stats"]["playerId"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")",
"def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")",
"def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")",
"def account_id(self) -> str:\n return pulumi.get(self, \"ac... | [
"0.81450903",
"0.81450903",
"0.81450903",
"0.81450903",
"0.81450903",
"0.81450903",
"0.81450903",
"0.81450903",
"0.80807525",
"0.80706036",
"0.793729",
"0.7926071",
"0.7782581",
"0.77597106",
"0.77597106",
"0.77597106",
"0.77475303",
"0.77475303",
"0.77475303",
"0.77475303",
... | 0.73717445 | 46 |
Get a Player object for this participant. | def get_player(self):
return self._pubg.player(self.player_id, self.shard) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player(self,p):\n self._validate(p)\n return p.player()",
"def get_player(self):\n\n return self._player",
"def get_player(self):\n return self.player",
"def get_player(self):\n return self.player",
"def getPlayer(self):\n return self.__player__",
"def ge... | [
"0.7898596",
"0.75885373",
"0.7542681",
"0.7542681",
"0.75034004",
"0.75032854",
"0.73201466",
"0.7279313",
"0.72653425",
"0.7252144",
"0.71695876",
"0.7119049",
"0.7107647",
"0.7071474",
"0.7051978",
"0.7003645",
"0.69285256",
"0.68711996",
"0.68437845",
"0.6794744",
"0.6790... | 0.76753014 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.