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 |
|---|---|---|---|---|---|---|
Uses generate_df_city_subject to create one large dataframe that encompasses all data for a particular ACS series. If a filename is given, then csv is created Argument(s) | def generate_csv_subject(subject: str, start_year: str = "2011", end_year: str = "2019", cities: list = [PALM_SPRINGS], filename = None):
dfs = []
for city in cities:
df = generate_df_city_subject(subject, start_year, end_year, str(city))
dfs.append(df)
final_df = pd.concat(dfs)
if file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_csv(\n group: str,\n start_year: str = \"2011\",\n end_year: str = \"2019\",\n cities: list = [PALM_SPRINGS],\n filename: str = None,\n):\n dfs = []\n\n for city in cities: # generate the df for all cities in list of cities\n df = generate_df_city(group, start_year, end_ye... | [
"0.6805159",
"0.66447574",
"0.6087695",
"0.5990074",
"0.5927616",
"0.59087884",
"0.59087276",
"0.5825194",
"0.5743463",
"0.5722522",
"0.5678771",
"0.566618",
"0.56600857",
"0.561577",
"0.55680543",
"0.55470353",
"0.55466425",
"0.55268925",
"0.5525609",
"0.5517385",
"0.5504905... | 0.783747 | 0 |
Compute the Mahalanobis Distance between each row of x and the data | def mahalanobis(x=None, data=None, cov=None):
x_minus_mu = x - np.mean(data)
if not cov:
cov = np.cov(data.values.T)
inv_covmat = sp.linalg.inv(cov)
left_term = np.dot(x_minus_mu, inv_covmat)
mahal = np.dot(left_term, x_minus_mu.T)
return mahal.diagonal() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mahalanobis_distance_sq(self, x: np.ndarray) -> float:\r\n # this method could be vectorized for efficient calls\r\n error = x - self.mean\r\n mahalanobis_distance = error.T @ nla.solve(self.cov, error)\r\n return mahalanobis_distance",
"def distances_mahalanobis(X, Y, tensor=None... | [
"0.7522185",
"0.73338354",
"0.6924014",
"0.6914476",
"0.6793527",
"0.67348427",
"0.6546128",
"0.6500343",
"0.65003306",
"0.6301406",
"0.613263",
"0.60382277",
"0.6028054",
"0.5995905",
"0.58957434",
"0.5869288",
"0.58573365",
"0.580173",
"0.57212996",
"0.5668728",
"0.5632773"... | 0.6508745 | 7 |
Return a symmetrized version of NumPy array a. Values 0 are replaced by the array value at the symmetric position (with respect to the diagonal), i.e. if a_ij = 0, then the returned array a' is such that a'_ij = a_ji. Diagonal values are left untouched. a square NumPy array, such that a_ij = 0 or a_ji = 0, for i != j. | def symmetrize(a):
return a + a.T - np.diag(a.diagonal()); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symmetrize(A: np.ndarray) -> np.ndarray:\r\n A += np.swapaxes(A, -1, -2)\r\n A /= 2\r\n return A",
"def symarray(input_array):\n return symmetrize(np.asarray(input_array)).view(SymArray)",
"def symmetrize(a):\n d = a.shape[0] #assuming index=0\n m = d//2 # the middle-of-array in... | [
"0.7022104",
"0.66487634",
"0.6549921",
"0.6393017",
"0.59944636",
"0.58687025",
"0.584073",
"0.5840115",
"0.58149153",
"0.5795277",
"0.5758811",
"0.5706618",
"0.56906116",
"0.56856173",
"0.5673191",
"0.5668808",
"0.56660664",
"0.5664703",
"0.564525",
"0.56436837",
"0.5602237... | 0.73384345 | 0 |
If there are items in the list, removes the selected item. | def _remove(self):
if self._theList.size() > 0:
self._theList.delete(ACTIVE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_selected(self):\n if self._selected_index is not None:\n self._list = self._model.stringList()\n self._list.pop(self._selected_index)\n self._model.setStringList(self._list)\n self._selected_index = None",
"def remove_selected_item(self):\n roo... | [
"0.81039023",
"0.8023093",
"0.79088736",
"0.77304924",
"0.76606214",
"0.7378907",
"0.7346032",
"0.7339659",
"0.7299048",
"0.7245169",
"0.7228877",
"0.7226284",
"0.71772647",
"0.71141857",
"0.70284826",
"0.70080924",
"0.69944614",
"0.6839507",
"0.6838748",
"0.6817536",
"0.6806... | 0.67732114 | 21 |
Test to check if the people returned by get_all_recovered() are returned correctly; only recovered people are returned | def test_get_all_recovered(self):
persons = self.population.get_person()
# Test if get_all_recovered returns indices of all people who recovered
self.assertEqual(persons[persons[:, 9] == 2].size, self.population.get_all_recovered().size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_donor_verification(self):\n Load_Tables.populate_redis(self.__class__.r)\n result = d.Individual.donor_verification(self.__class__.r, 'Joe')\n self.assertEqual(result, ['Slinger', '677-0182', 'js@gmail.com'])",
"def test_donor_verification(self):\n Load_Tables.populate_redis(... | [
"0.6496743",
"0.6496743",
"0.64285684",
"0.63156086",
"0.61703235",
"0.6049892",
"0.58297855",
"0.56789094",
"0.5639777",
"0.56240827",
"0.5623865",
"0.56098914",
"0.55845195",
"0.5579419",
"0.55719334",
"0.55638266",
"0.55559486",
"0.5539862",
"0.5530727",
"0.5509125",
"0.55... | 0.82267505 | 0 |
Gets commandline inputs for training module | def get_train_input_args():
# Creates Argument Parser object named parser
parser = argparse.ArgumentParser()
parser.add_argument("data_dir", help = "Provide data directory. Mandatory argument", type = str)
parser.add_argument("--save_dir", type=str, default=".",
help="directory w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_args():\n train_parser = argparse.ArgumentParser()\n # Non-optional argument\n train_parser.add_argument('data_dir', type=str, default=\"flowers/\", help='data_dir')\n # Choose directory to save checkpoint\n train_parser.add_argument('--save_dir', type=str, default=\"checkpoint.pth\", ... | [
"0.7746989",
"0.75723475",
"0.7535258",
"0.73675096",
"0.73125273",
"0.72031754",
"0.698404",
"0.6944326",
"0.68999976",
"0.6870923",
"0.6798535",
"0.67981",
"0.6760387",
"0.67419475",
"0.6685647",
"0.6683821",
"0.6674853",
"0.667435",
"0.6668583",
"0.665206",
"0.6637302",
... | 0.7396998 | 3 |
Formatter for Y axis, values are in billions | def billions(x, pos):
return '%1.fbn' % (x*1e-6) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _format_yaxis(\n axis: plt.axis,\n pdata: dict,\n fontsize: int = 12,\n fontweight: str = 'normal',\n label: str = None,\n **kwargs\n) -> plt.axis:\n if 'var_lims' in kwargs:\n axis.set_ylim(kwargs['var_lims'])\n else:\n axis.set_ylim(pdata['var_lim... | [
"0.6461122",
"0.63896984",
"0.63895917",
"0.63733405",
"0.6344002",
"0.61430067",
"0.6126056",
"0.6089027",
"0.603632",
"0.60328525",
"0.60226375",
"0.6006652",
"0.6005605",
"0.5969046",
"0.5947462",
"0.5933987",
"0.58891326",
"0.5884096",
"0.5863413",
"0.58620673",
"0.582869... | 0.0 | -1 |
Formatter for Y axis, values are in billions | def billions(x, pos):
return '%1.fbn' % (x*1e-6) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _format_yaxis(\n axis: plt.axis,\n pdata: dict,\n fontsize: int = 12,\n fontweight: str = 'normal',\n label: str = None,\n **kwargs\n) -> plt.axis:\n if 'var_lims' in kwargs:\n axis.set_ylim(kwargs['var_lims'])\n else:\n axis.set_ylim(pdata['var_lim... | [
"0.64606595",
"0.6390845",
"0.6389978",
"0.6373112",
"0.63424504",
"0.61457676",
"0.61283076",
"0.6091438",
"0.60386074",
"0.60351056",
"0.6025233",
"0.600741",
"0.6006657",
"0.597166",
"0.5949826",
"0.59358287",
"0.58909833",
"0.58866245",
"0.58649886",
"0.5863766",
"0.58300... | 0.0 | -1 |
Define path of log file | def __init__(self):
file_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'logfile.log')
logging.basicConfig(filename=file_path, format='%(asctime)s - %(levelname)s - %(lineno)d - %(message)s') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_log_file(self, path):\n self.__log_file = path",
"def get_log_path():\n return config.get(\"etc\", \"log_path\")",
"def set_arquivo_log(path_arquivo_log: str) -> None:\r\n global g_arquivo_log\r\n g_arquivo_log = path_arquivo_log",
"def log_file():\n return os.path.join(get... | [
"0.7714346",
"0.76365095",
"0.75809395",
"0.7523671",
"0.74824035",
"0.7453013",
"0.74092937",
"0.73545474",
"0.7329657",
"0.7286933",
"0.72703826",
"0.72117835",
"0.71899956",
"0.71589917",
"0.7139514",
"0.713531",
"0.7088842",
"0.7055519",
"0.699152",
"0.6987414",
"0.697584... | 0.64696074 | 49 |
Test adding a refund with status 'Approved'. This is the only status allowed when creating a record at the moment. | def test_add(self):
order = OrderPaidFactory()
now_datetime = now()
now_date_str = now_datetime.date().isoformat()
now_time_str = now_datetime.time().isoformat()
assert Refund.objects.count() == 0
url = reverse('admin:omis-payment_refund_add')
data = {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cannot_change_status(self, refund_factory):\n refund = refund_factory()\n\n now_datetime = now()\n date_str = now_datetime.date().isoformat()\n time_str = now_datetime.time().isoformat()\n\n url = reverse('admin:omis-payment_refund_change', args=(refund.id,))\n de... | [
"0.7170392",
"0.7144373",
"0.6762672",
"0.6705249",
"0.6570661",
"0.6542918",
"0.6318478",
"0.61682814",
"0.6145537",
"0.6136951",
"0.60911447",
"0.6075637",
"0.60593325",
"0.6058488",
"0.6050461",
"0.6048242",
"0.6047578",
"0.6032624",
"0.6019446",
"0.6012784",
"0.60065144",... | 0.7351922 | 0 |
Converts a 1 or 2dimensional list, tuple or numpy.ndarray to string | def array2string(
array: Union[Iterable[float], Iterable[Iterable[float]]],
col_sep: str = ', ',
row_sep: str = '; ') -> str:
try:
return matrix2string(array, col_sep, row_sep)
except TypeError:
return row2string(array, col_sep) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_array(\n array: Union[ndarray, Sequence[float], Sequence[Sequence[float]]]\n) -> str:\n if not isinstance(array, ndarray):\n array = asarray(array)\n num_axis = len(array.shape)\n if num_axis == 1:\n return \"[\" + \", \".join([f\"{x:.3g}\" for x in array]) + \"]\"\n return... | [
"0.740679",
"0.71955127",
"0.70833063",
"0.693581",
"0.67876256",
"0.66737187",
"0.6647652",
"0.6627443",
"0.65807116",
"0.6491089",
"0.64726794",
"0.6462466",
"0.6457914",
"0.64568543",
"0.6415231",
"0.6410003",
"0.6398804",
"0.63981646",
"0.6382802",
"0.6357827",
"0.6333797... | 0.68419254 | 4 |
Check whether the matrix is infinitesimal. | def is_infinitesimal(mat: ndarray) -> bool:
return (is_square(mat) and
((mat - diag(mat.diagonal().flatten())) >= 0).all() and
(mat.sum(axis=1) == zeros(order_of(mat))).all()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_infinitesimal(self):\n\t\tpass",
"def is_subinfinitesimal(mat: ndarray) -> bool:\n if not is_square(mat):\n return False\n row_sum = mat.sum(axis=1)\n return (((mat - diag(mat.diagonal().flatten())) >= 0).all() and\n (row_sum <= 0).all() and (row_sum < 0).any())",
"def is_infi... | [
"0.7501143",
"0.74660516",
"0.7395286",
"0.72688496",
"0.7192595",
"0.71770555",
"0.7131198",
"0.7119489",
"0.7082182",
"0.7074392",
"0.70426774",
"0.6987945",
"0.6954527",
"0.6936219",
"0.6923915",
"0.69236577",
"0.6899819",
"0.6868292",
"0.6845157",
"0.6816206",
"0.673664",... | 0.83723706 | 0 |
Get accelerometer or gyroscope output and store in ImuSensorOutput instance. | def get_processed_sensor_output(self, gyro: bool=False) -> List[float]:
if gyro:
sensor_registers = [
MpuRegisters.GYRO_XOUT_H.value,
MpuRegisters.GYRO_YOUT_H.value,
MpuRegisters.GYRO_ZOUT_H.value
]
else:
sensor_registers = [
MpuRegisters.ACCEL_XOUT_H.value,
MpuRegisters.ACCEL_YOUT_H... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_accelerometer_raw(self):\n\n # Check if accelerometer has been enabled\n if not self.is_accel_enabled:\n raise(Exception('Accelerometer is not enabled!'))\n\n return self.read_sensor(LSM6DS33_Address, self.accel_registers)",
"def readSensor(self):\n\n\t\tdata = self.__read... | [
"0.66841537",
"0.66598165",
"0.6619694",
"0.6379787",
"0.63238317",
"0.6224148",
"0.6168195",
"0.61114484",
"0.5981119",
"0.5968299",
"0.59598064",
"0.5913982",
"0.5907513",
"0.58811605",
"0.584139",
"0.5839524",
"0.5828644",
"0.5802129",
"0.57899094",
"0.57689625",
"0.568115... | 0.6106308 | 8 |
Determines whether a date is valid | def _is_valid_date(day, month, year):
if not 1 <= month <= 12:
return False
days_in_month = yearinfo.get_month_to_day_dict(year)
if not 1 <= day <= days_in_month[month]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_date_valid(d):\n\n pass",
"def valid_date(self, value):\n try:\n year = {'1': 1800, '2': 1800, '3': 1900, '4': 1900, '5': 2000,\n '6': 2000}[value[0]] + int(value[1:3])\n date(year, int(value[3:5]), int(value[5:7]))\n return True\n e... | [
"0.90644026",
"0.80146784",
"0.7866093",
"0.7863273",
"0.7841149",
"0.77843034",
"0.7692288",
"0.7665098",
"0.7629455",
"0.7614669",
"0.76040244",
"0.75217474",
"0.7483221",
"0.7419754",
"0.74018884",
"0.7352234",
"0.7324695",
"0.724946",
"0.7205679",
"0.7201984",
"0.7162206"... | 0.779146 | 5 |
Yield successive ``n``sized chunks from ``l``. Merges the last two chunks if the last chunk would be smaller than ``n``. | def Chunks(l, n):
for i in range(0, len(l), n):
if i + 2 * n <= len(l):
yield l[i:i+n]
else:
yield l[i:]
break | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(l, n):\n for i in xrange(0, len(l)-1, 1):\n yield l[i:i+n]",
"def chunks(l, n):\n # https://stackoverflow.com/a/312464/2806632\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def chunk(self, l, n):\n for i in range(0, len(l), n):\n y... | [
"0.8308442",
"0.82833713",
"0.82728994",
"0.8272737",
"0.8266419",
"0.8266419",
"0.8266419",
"0.82653266",
"0.8234794",
"0.82341355",
"0.82255584",
"0.8224467",
"0.82177925",
"0.82044995",
"0.81863993",
"0.81801313",
"0.81617165",
"0.81617165",
"0.81440234",
"0.81430125",
"0.... | 0.8137652 | 23 |
Return the nearest position in the periodic space. | def nearest(self, array: Sequence[float], point: np.ndarray,) -> np.ndarray:
return min(array, key=lambda pos: np.linalg.norm(pos - point)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_nearest_in_index(self, p: complex, index: KDTree) -> tuple[int | None, float]:\n\n dists, idxs = index.query((p.real, p.imag), k=100)\n for dist, idx in zip(dists, idxs):\n if ~np.isinf(dist) and self.available[idx]:\n return idx, dist\n\n return None, 0.0",... | [
"0.6761984",
"0.6522206",
"0.6519944",
"0.6508096",
"0.6493447",
"0.641865",
"0.64171195",
"0.6415407",
"0.6415407",
"0.63838124",
"0.63682055",
"0.6314309",
"0.6283795",
"0.62619114",
"0.6239727",
"0.62282014",
"0.6217377",
"0.6182455",
"0.6181957",
"0.6177137",
"0.6177137",... | 0.64294994 | 5 |
Rotate unitcell (rotation angle is set by degree). | def rotate_cell(self, theta_deg: float, axis_name: str = "Z") -> None:
original_is_cartesian = False
if self.is_cartesian():
original_is_cartesian = True
self.to_direct()
axis_name = axis_name.capitalize()
rotate: Dict["str", Callable[[float], np.ndarray]] = {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate(self, rad):\n raise NotImplementedError",
"def testRotate():\n \n cuboid = shape.Cuboid((100,100,10), (20,30,40))\n cuboid.outputNodes()\n \n # Find rotation matrix\n (x,y,z) = cuboid.findCentre() \n translation_matrix = wf.translationMatrix(-x, -y, -z)\n rotation_mat... | [
"0.6689329",
"0.6627483",
"0.6498222",
"0.645254",
"0.6340832",
"0.6279119",
"0.62696",
"0.6265051",
"0.6240855",
"0.6240659",
"0.6231838",
"0.622759",
"0.6219965",
"0.62157273",
"0.6200255",
"0.61628276",
"0.6145143",
"0.6144294",
"0.6139459",
"0.61292577",
"0.61133593",
"... | 0.6974818 | 0 |
Rotation matrix around Xaxis. | def rotate_x(theta_deg: float) -> np.ndarray:
degree: float = np.pi / 180.0
return np.array(
[
[1.0, 0.0, 0.0],
[0.0, np.cos(theta_deg * degree), -np.sin(theta_deg * degree)],
[0.0, np.sin(theta_deg * degree), np.cos(theta_deg * degree)],
]
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_rotation_x(angle):\n return Mat4(\n [\n [1, 0, 0, 0],\n [0, math.cos(angle), -math.sin(angle), 0],\n [0, math.sin(angle), math.cos(angle), 0],\n [0, 0, 0, 1],\n ]\n )",
"def matRotX(th=0.0):\n v0 = 1.0\n v1 = 0.0\n v2... | [
"0.7300173",
"0.7259152",
"0.71555525",
"0.6982136",
"0.6978307",
"0.69675887",
"0.6964778",
"0.6954215",
"0.69432694",
"0.69041395",
"0.68855625",
"0.68483514",
"0.6785175",
"0.67718476",
"0.67489034",
"0.67451",
"0.6675723",
"0.6657731",
"0.66565",
"0.66248804",
"0.6620101"... | 0.0 | -1 |
Rotation matrix around Yaxis. | def rotate_y(theta_deg: float) -> np.ndarray:
degree: float = np.pi / 180.0
return np.array(
[
[np.cos(theta_deg * degree), 0.0, np.sin(theta_deg * degree)],
[0.0, 1.0, 0.0],
[-np.sin(theta_deg * degree), 0.0, np.cos(theta_deg * degree)],
]
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotation_matrix_y(ry: float) -> numpy.ndarray:\n return _rotation_matrix(ry, order=\"y\")",
"def matRotY(th=0.0):\n\n v0 = math.cos(th)\n v1 = 0.0\n v2 = -math.sin(th)\n v3 = 0.0\n\n v4 = 0.0\n v5 = 1.0\n v6 = 0.0\n v7 = 0.0\n\n v8 = ... | [
"0.76688486",
"0.7612451",
"0.757926",
"0.7349628",
"0.7296625",
"0.71452844",
"0.71452844",
"0.7115505",
"0.7115505",
"0.7007283",
"0.7007283",
"0.698873",
"0.697273",
"0.68645126",
"0.67176646",
"0.6634259",
"0.6543093",
"0.6543093",
"0.6534813",
"0.6494955",
"0.6494955",
... | 0.67179215 | 14 |
Rotation matrix around Zaxis. | def rotate_z(theta_deg: float) -> np.ndarray:
degree: float = np.pi / 180.0
return np.array(
[
[np.cos(theta_deg * degree), -np.sin(theta_deg * degree), 0.0],
[np.sin(theta_deg * degree), np.cos(theta_deg * degree), 0.0],
[0.0, 0.0, 1.0],
]
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matRotZ(th=0.0):\n v0 = math.cos(th)\n v1 = math.sin(th)\n v2 = 0.0\n v3 = 0.0\n\n v4 = -math.sin(th)\n v5 = math.cos(th)\n v6 = 0.0\n v7 = 0.0\n\n v8 = 0.0\n v9 = 0.0\n v10 = 1.0\n v11 = 0.0\n\n v12 = 0.0\n ... | [
"0.79974306",
"0.77876556",
"0.7748014",
"0.77303195",
"0.74792373",
"0.7425082",
"0.7423559",
"0.73869646",
"0.73536247",
"0.7277527",
"0.7275871",
"0.7275871",
"0.7260723",
"0.725155",
"0.725155",
"0.7196486",
"0.71774197",
"0.71773344",
"0.7144877",
"0.7136054",
"0.7132979... | 0.6716772 | 37 |
Return True if vec can be converted into the 3x3 matrix. | def three_by_three(vec: Sequence[float]) -> bool:
if not isinstance(vec, (np.ndarray, np.matrix, list, tuple)):
return False
if len(vec) != 3:
return False
return [3, 3, 3] == [len(i) for i in vec] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_incidence_matrix(v):\n return (\n (len(v.shape) == 3)\n and (v.shape[0] == v.shape[1] == v.shape[2])\n and np.all((v.sum(axis=0) == np.ones_like(v)))\n and np.all((v.sum(axis=1) == np.ones_like(v)))\n and np.all((v.sum(axis=2) == np.ones_like(v))... | [
"0.60961545",
"0.60526013",
"0.60003227",
"0.59548646",
"0.5934709",
"0.5888926",
"0.57855093",
"0.57118225",
"0.5704342",
"0.56849277",
"0.5636788",
"0.5579675",
"0.5558269",
"0.55558413",
"0.5519194",
"0.5478816",
"0.54777503",
"0.5460542",
"0.5458811",
"0.5452374",
"0.5433... | 0.73052067 | 0 |
To display Owner's details | def __str__(self):
return self.email + " " + self.phone + " " + self.user_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"{0}\".format(self.owner_name)",
"def __repr__(self):\n\n return \"<Owner owner_id=%s user_id=%s>\" % (self.owner_id, self.user_id)",
"def owner_info(self):\n owner = self.getOwnerTuple()\n\n if owner is None or owner is UnownableOwner:\n retu... | [
"0.7471933",
"0.71473986",
"0.69911116",
"0.6910234",
"0.6910234",
"0.68740547",
"0.6808877",
"0.6787486",
"0.66639626",
"0.65488577",
"0.64454246",
"0.6444535",
"0.64361936",
"0.6433877",
"0.6433877",
"0.64230555",
"0.6413695",
"0.64090604",
"0.64087427",
"0.64087427",
"0.64... | 0.0 | -1 |
Test incorrect x_vec dimension | def test_x_more_dim(self):
qkclass = QuantumKernel(feature_map=self.feature_map, quantum_instance=self.qasm_simulator)
with self.assertRaises(ValueError):
_ = qkclass.evaluate(x_vec=self.sample_more_dim) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_x_dimension(x):\n x = np.atleast_1d(x)\n if len(x.shape) > 2 or (len(x.shape) == 2 and x.shape[1] != 1):\n raise ValueError('Wrong dimension in x.')\n return x.reshape((-1, ))",
"def test_fail_dimension_requirement(self):\n msg = \"The cube does not contain the e... | [
"0.7043776",
"0.673239",
"0.6510206",
"0.64392656",
"0.64314544",
"0.6351062",
"0.6326256",
"0.6183636",
"0.6179328",
"0.6154786",
"0.6152217",
"0.61413866",
"0.61304605",
"0.611781",
"0.61167985",
"0.61167985",
"0.6107557",
"0.61062145",
"0.60977507",
"0.60973424",
"0.609596... | 0.7077139 | 0 |
Returns the string representation of the model | def to_str(self):
import simplejson as json
if six.PY2:
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n return self.model",
"def serialize_model(self):\n return dill.dumps(self.model)",
"def __str_... | [
"0.8603206",
"0.85092425",
"0.82360387",
"0.80498564",
"0.80115753",
"0.79343045",
"0.7878523",
"0.77903897",
"0.7789903",
"0.7746775",
"0.76299804",
"0.76084584",
"0.75825435",
"0.75152516",
"0.75066316",
"0.7504789",
"0.7487798",
"0.7443518",
"0.74352336",
"0.74271595",
"0.... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n return not self == other",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return self.__dict__ != other.__dict__",
"def __eq__(self, other):\n return not self.__ne__(other)",
... | [
"0.8410411",
"0.8391477",
"0.8172175",
"0.81410587",
"0.80920255",
"0.8088807",
"0.80676955"
] | 0.0 | -1 |
The idea is to create, hashmap for indexes on B whose values are not 0. One might think that, two hashmaps can be created both on A and B, and only loop on these hashmaps, and fill those values and leave the rest of them as zero. But, One HashMap is also a good solution. | def multiply_table_appraoch(self, A: List[List[int]], B: List[List[int]]) -> List[List[int]]:
if A is None or B is None: return None
m, n, l = len(A), len(A[0]), len(B[0])
if len(B) != n:
raise Exception("A's column number must be equal to B's row number.")
C = [[0 for _ in r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_missing_element_hashtable(arr1, arr2):\n from collections import defaultdict\n\n d = defaultdict(int)\n\n for n in arr2:\n d[n] += 1\n\n for n in arr1:\n if d[n] == 0:\n return n\n else:\n d[n] -= 1",
"def fast_lookup(A, B):\n vals = np.zeros(B.s... | [
"0.6258591",
"0.61520314",
"0.59151584",
"0.5683102",
"0.5554311",
"0.55396754",
"0.55071735",
"0.54226255",
"0.5391781",
"0.53842753",
"0.5377815",
"0.53403443",
"0.5263745",
"0.5251586",
"0.52360713",
"0.5222375",
"0.5212698",
"0.52055305",
"0.51814455",
"0.51625055",
"0.51... | 0.6157616 | 1 |
Get server hostname from an atest dict. | def _get_hostname(server):
return server['hostname'].partition('.')[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_hostname(self):\n\n hostname = self.attrs(\"hostname\")\n\n if hostname:\n return hostname[0].value\n else:\n return self.entity.name",
"def get_hostname():\n return _hostname",
"def get_hostname():\n\treturn socket.gethostname().split('.',1)[0]",
"def h... | [
"0.6718743",
"0.6618874",
"0.6527999",
"0.6499049",
"0.64129156",
"0.6409538",
"0.6385849",
"0.63615316",
"0.63307065",
"0.62601614",
"0.6256996",
"0.6214518",
"0.6182672",
"0.61816597",
"0.61712104",
"0.6170462",
"0.6170462",
"0.61496913",
"0.6144012",
"0.6120415",
"0.610517... | 0.75095004 | 0 |
scan through matrix, count how many mines are near the space, if none, leave as 1, otherwise as the count | def placeNumbers(self):
for i in range(self.w):
for j in range(self.w):
count = 0
if self.buttons[i][j].val != 100:
if i - 1 >= 0 and self.buttons[i - 1][j].val == 100:
count += 1
if j - 1 >= 0 and self.b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_used(matrix):\n return sum([line.count('1') for line in matrix])",
"def count_mines(self):\n for i in range(0, self.field_height):\n for j in range(0, self.field_width):\n if self.field[i][j] != FIELD_MINE:\n for delta_i in range(-1, 2):\n ... | [
"0.7524632",
"0.728684",
"0.69522977",
"0.6874793",
"0.68667084",
"0.68296826",
"0.68296826",
"0.6560437",
"0.6552906",
"0.648616",
"0.6446916",
"0.6443011",
"0.64190286",
"0.6393373",
"0.63161427",
"0.62992305",
"0.62684673",
"0.6266281",
"0.6265191",
"0.6212756",
"0.6203977... | 0.0 | -1 |
A useful util that returns the state other than self.cur_state | def get_other_state(self,state):
if state == 0:
return 0
else:
return [st for st in range(2)
if st != state][0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def... | [
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"0.8278215",
"... | 0.0 | -1 |
Returns the top node that has valid data The _head node is initialized with None data | def head(self):
if self._head is None:
return None
return self._head.next_node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(self) -> Node:\n if len(self.data) == 0:\n return\n return self.data[0]",
"def get_head(self):\n return self.head_node",
"def head_element(self):\r\n return self.data[self.head]",
"def head_element(self):\r\n return self.data[self.head]",
"def peek(self... | [
"0.77057505",
"0.7120489",
"0.6888338",
"0.6888338",
"0.6864276",
"0.68607676",
"0.68585145",
"0.6835495",
"0.6742289",
"0.6742289",
"0.6738142",
"0.6703166",
"0.66634816",
"0.6642437",
"0.6599432",
"0.65858656",
"0.6555768",
"0.6532244",
"0.6520966",
"0.6468364",
"0.6453248"... | 0.692841 | 2 |
Returns the string representation of the model | def to_str(self):
import simplejson as json
if six.PY2:
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n return self.model",
"def serialize_model(self):\n return dill.dumps(self.model)",
"def __str_... | [
"0.8602374",
"0.85093755",
"0.8237104",
"0.8050309",
"0.80128866",
"0.79348034",
"0.78766525",
"0.77898884",
"0.7786461",
"0.7745792",
"0.7627315",
"0.76055235",
"0.757999",
"0.7514394",
"0.75038797",
"0.75035286",
"0.74850684",
"0.7440529",
"0.74325883",
"0.74239755",
"0.740... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n return not self == other",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return self.__dict__ != other.__dict__",
"def __eq__(self, other):\n return not self.__ne__(other)",
... | [
"0.8410411",
"0.8391477",
"0.8172175",
"0.81410587",
"0.80920255",
"0.8088807",
"0.80676955"
] | 0.0 | -1 |
Return an array of wavelengths. | def wavevector(minfullwave, maxfullwave, zeropoint=3.5, binsz=1.0e-4,
wavemin=None, wavemax=None):
from numpy import arange
if wavemin is not None:
spotmin = 0
if wavemax is not None:
spotmax = int((wavemax - wavemin)/binsz)
else:
spotmax = int((max... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wavelengths(self):\n fspsDir = os.environ['SPS_HOME'] # environment variable for FSPS\n # print fspsDir\n if self.specType == \"basel\":\n lambdaPath = os.path.join(\n fspsDir, \"SPECTRA\", \"BaSeL3.1\", \"basel.lambda\")\n elif self.specType == \"miles\":... | [
"0.76552683",
"0.7517277",
"0.73409325",
"0.69427836",
"0.6913971",
"0.67220074",
"0.6711707",
"0.67047447",
"0.65335655",
"0.6476858",
"0.6468651",
"0.6468651",
"0.6292627",
"0.6292201",
"0.6265697",
"0.62557185",
"0.62238264",
"0.61984444",
"0.6145973",
"0.6097678",
"0.6094... | 0.0 | -1 |
Compute Emprical Cumulative Distribution Function (ECDF) | def ecdf(data):
x = np.sort(data)
n = x.size
y = np.linspace(0.0, 1.0, len(data))
return (x,y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cdf(x, dfn, dfd):\n with mp.extradps(5):\n x = mp.mpf(x)\n if x <= 0:\n return mp.zero\n dfn = mp.mpf(dfn)\n dfd = mp.mpf(dfd)\n dfnx = dfn * x\n return mp.betainc(dfn/2, dfd/2, x2=dfnx/(dfnx + dfd),\n regularized=True)",
"def e... | [
"0.7040497",
"0.6986083",
"0.6946795",
"0.69233835",
"0.69002575",
"0.6879098",
"0.67764586",
"0.66860217",
"0.66842085",
"0.66546375",
"0.66365445",
"0.6628437",
"0.6607168",
"0.66063565",
"0.65969485",
"0.65969485",
"0.65924084",
"0.6578474",
"0.65669996",
"0.65669996",
"0.... | 0.6658427 | 9 |
Take in a formed PNLF, completeness correct it and calculate the Cumulative distribution function of the incompleteness corrected PNLF. | def form_PNLF_CDF(data, PNLF, dM, obs_comp, M_5007, m_5007):
sorted_data = np.sort(data)
PNLF_comp_corr = np.array(np.interp(m_5007, M_5007+dM, PNLF)*obs_comp)
PNLF_comp_corr[PNLF_comp_corr < 0] = 0.0
PNLF_CDF = np.array(np.interp(sorted_data, m_5007, np.nancumsum(PNLF_comp_corr)/np.nansum(PNLF_comp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def computeCTF(amp,freq,phase):\n #Create distortion\n dist = createDist(amp,freq,phase)\n #Remove tilt\n dist = dist - np.mean(dist)\n #Compute pre-correction RMS slope\n prerms = anal.rms(dist*10000)\n\n #Apply correction\n cor = slv.rawOptimizer(ifs2*10000,dist*10000)\n\n #Compute pos... | [
"0.56461394",
"0.5623644",
"0.5577951",
"0.55622935",
"0.5522063",
"0.55064",
"0.5444366",
"0.54089385",
"0.54027855",
"0.53496176",
"0.5348809",
"0.534058",
"0.5340033",
"0.53072333",
"0.5303694",
"0.52609235",
"0.5242358",
"0.5241826",
"0.5231113",
"0.5212377",
"0.5212238",... | 0.5967604 | 0 |
Test the Transcriber class's `_parse_diacritics` in Greek. | def test_greek_parse_diacritics(self):
inputs = ["ἄ", "Φ", "ῷ", "ὑ", "ϊ", "ῑ"]
outputs = [self.greek_transcriber._parse_diacritics(char) for char in inputs]
target = [
unicodedata.normalize("NFC", c)
for c in [
"α/" + grc.chars.ACUTE + "//",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_latin_parse_diacritics(self):\n inputs = [\"a\", \"ū\", \"ï\"]\n outputs = [self.latin_transcriber._parse_diacritics(char) for char in inputs]\n target = [\n unicodedata.normalize(\"NFC\", c)\n for c in [\n \"a///\",\n \"u/\" + lat... | [
"0.7778193",
"0.6383753",
"0.6301485",
"0.590603",
"0.5879254",
"0.5782802",
"0.57034284",
"0.5701913",
"0.5687294",
"0.5678266",
"0.565978",
"0.56579596",
"0.5634604",
"0.56342685",
"0.5607993",
"0.55700123",
"0.5562038",
"0.5542802",
"0.55361944",
"0.54928946",
"0.5489914",... | 0.8043087 | 0 |
Test the Transcriber class's `_parse_diacritics` in Latin. | def test_latin_parse_diacritics(self):
inputs = ["a", "ū", "ï"]
outputs = [self.latin_transcriber._parse_diacritics(char) for char in inputs]
target = [
unicodedata.normalize("NFC", c)
for c in [
"a///",
"u/" + lat.chars.LONG + "//",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_greek_parse_diacritics(self):\n inputs = [\"ἄ\", \"Φ\", \"ῷ\", \"ὑ\", \"ϊ\", \"ῑ\"]\n outputs = [self.greek_transcriber._parse_diacritics(char) for char in inputs]\n target = [\n unicodedata.normalize(\"NFC\", c)\n for c in [\n \"α/\" + grc.chars.... | [
"0.76268244",
"0.61787534",
"0.60749996",
"0.596943",
"0.5936282",
"0.5922405",
"0.59045213",
"0.5829679",
"0.5782261",
"0.5777652",
"0.5771786",
"0.5727786",
"0.5689698",
"0.5655628",
"0.56432366",
"0.56306636",
"0.5618778",
"0.5585911",
"0.5576041",
"0.556476",
"0.554862",
... | 0.8325527 | 0 |
Builds a string of length n with characters selected pseudorandomly from the string parameter symbols. | def build_random_string(n, symbols):
result = ""
while len(result) < n:
result = result + choice(symbols) # Add a random character from symbols
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_random_string(**kw):\n length = kw.get(\"len\", 5)\n temp_str = \"\".join([random.choice(string.ascii_letters) for _ in range(length)])\n return temp_str",
"def create_random_string(N=7):\n return ''.join(random.choices(string.ascii_uppercase +\n string.di... | [
"0.73229814",
"0.730637",
"0.72059005",
"0.71814215",
"0.7111396",
"0.7108329",
"0.7108329",
"0.7089156",
"0.70583147",
"0.70430297",
"0.70087487",
"0.69834244",
"0.6978785",
"0.69697744",
"0.69566256",
"0.6947161",
"0.6922431",
"0.6921051",
"0.6920139",
"0.69183475",
"0.6887... | 0.8542279 | 0 |
Test post id and check it. | def test_post_bear_check_status_code_body():
response = requests.post(workUrl, json=payload[0])
assert response.status_code == 200
assert response.text
response = requests.get(workUrl + '/' + str(response.text))
assert response.status_code == 200
body = response.json()
assert body["bear... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_post(self, post_id: int):\n raise NotImplementedError",
"def test_post_detail_exists(cls):\n response = cls.client.get(\"/feeds/{}/posts/read\".format(cls.f1.id))\n\n cls.assertEqual(response.status_code, 200)",
"def test_author_id_posts_get(self):\n\n request = self.fa... | [
"0.7637311",
"0.70373976",
"0.6921451",
"0.68427265",
"0.67509323",
"0.6749117",
"0.6738032",
"0.6724946",
"0.6591929",
"0.6586705",
"0.65737516",
"0.6560187",
"0.6555382",
"0.6524788",
"0.65103763",
"0.65078527",
"0.65078527",
"0.65078527",
"0.65078527",
"0.6499307",
"0.6489... | 0.0 | -1 |
Resize an image and its corresponding box | def resize_data_and_box(data, box, new_width, new_height):
# Get the old dimensiones
old_width, old_height = data.shape[0:2]
old_x, old_y, old_w, old_h = box
# Resize image
new_img = imresize(data, size=(new_height, new_width))
# Compute the resized dimensions for the boxs
new_x = old_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _resize_image(self, event):\n new_width = event.width\n new_height = event.height\n\n self.image = self.img_copy.resize((new_width, new_height))\n\n self.image12 = ImageTk.PhotoImage(self.image)\n self.image1.configure(image=self.image12)",
"def resize_i... | [
"0.7260667",
"0.71321344",
"0.7028378",
"0.7002155",
"0.6978444",
"0.697756",
"0.694671",
"0.68664724",
"0.6842024",
"0.67903554",
"0.6790314",
"0.6752905",
"0.6735866",
"0.6724277",
"0.6700231",
"0.6689226",
"0.6686391",
"0.6634083",
"0.6624039",
"0.6624039",
"0.66224027",
... | 0.65442646 | 30 |
Return all zones (with optional advanced properties). | async def all(
self, *, details: bool = False, include_inactive: bool = False
) -> list:
endpoint: str = "zone"
if details:
endpoint += "/properties"
data: dict = await self._request("get", endpoint)
return [z for z in data["zones"] if include_inactive or z["activ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_zones(self) -> List[Zone]:\n pass",
"def all_zones(self):\n if not self.__all_zones:\n self.__all_zones = [\n item['name']\n for item in self.__agent.list_resource(ExecutionContext(), 'zones')]\n return self.__all_zones",
"def get_all_zones():\n global _all_zones\n ... | [
"0.8081279",
"0.77994573",
"0.76176244",
"0.75977373",
"0.75209796",
"0.7437359",
"0.73975563",
"0.70662415",
"0.70482206",
"0.6932319",
"0.6927535",
"0.6921607",
"0.69173336",
"0.69173336",
"0.6880593",
"0.68554235",
"0.68554235",
"0.68119496",
"0.68039584",
"0.67847073",
"0... | 0.79957 | 1 |
Go to the next state that has not been explored. If a game state leads to more than one unexplored game states, explore in the order implied by the GameMaster.getMovables() function. If all game states reachable from a parent state has been explored, the next explored state should conform to the specifications of the D... | def solveOneStep(self):
# Student code goes here
curr = self.currentState
# check the base case
# if the victory condition is met, just return True, and done.
if curr.state == self.victoryCondition:
return True
# however, if the victory condition is not met, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solveOneStep(self):\n ### Student code goes here 1. Victory Condition 2. Children 3. Search parameter\n ### Student code goes here\n #Step 1\n if self.currentState.state==self.victoryCondition:\n return True\n \n \n #Step 2\n moveoptions=self.g... | [
"0.7731033",
"0.74106395",
"0.7335719",
"0.73091805",
"0.7303743",
"0.7230197",
"0.71076703",
"0.69720453",
"0.67950916",
"0.67420083",
"0.6713808",
"0.6681312",
"0.66146505",
"0.65678644",
"0.6514896",
"0.64811105",
"0.6465889",
"0.6454799",
"0.63974005",
"0.63910085",
"0.63... | 0.73120797 | 3 |
Request response headers should be available in Response.headers property | def test_response_headers(self):
httpretty.register_uri(
httpretty.GET,
self.mock_url_builder_base,
status=200,
adding_headers={"x-test-1": "foo", "x-test-2": "bar"},
content_type="application/json",
)
response = self.resource.get(sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_headers(response):\n return response.headers",
"def get_headers(self,response):\n headers, content = response\n return headers",
"def show_request_headers(response):\n return response.request.headers",
"def test_headers(self):\n self.assertEqual(\n self.res.... | [
"0.79950243",
"0.7706687",
"0.76873773",
"0.76346713",
"0.7457346",
"0.73381853",
"0.7329223",
"0.71358925",
"0.7106429",
"0.70542604",
"0.7051621",
"0.70126647",
"0.6958952",
"0.6958952",
"0.6871951",
"0.68499273",
"0.6839316",
"0.68365234",
"0.67358106",
"0.6729712",
"0.671... | 0.7183757 | 7 |
Result.one should raise EmptyContent for GET 202 | def test_get_nocontent(self):
httpretty.register_uri(
httpretty.GET,
self.mock_url_builder_base,
body=get_serialized_result(self.record_response_get_one),
status=202,
content_type="application/json",
)
result = self.resource.get(self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_empty_response_content(self):\n responses.add(\n method='GET',\n url='{}/test-get-method'.format(self.client.BASE_API_URL),\n body='',\n status=200,\n content_type='text/html')\n data = self.client._get(path='/test-get-method', model... | [
"0.702105",
"0.6866167",
"0.6762389",
"0.6750665",
"0.6750665",
"0.6750665",
"0.6750665",
"0.6750665",
"0.6750665",
"0.6750665",
"0.6750665",
"0.6750665",
"0.6750665",
"0.6750665",
"0.6750665",
"0.67241335",
"0.67241335",
"0.67241335",
"0.6627974",
"0.662371",
"0.6608459",
... | 0.7572916 | 0 |
Function to return the average of the top n values in an array | def partition_top(data, n, return_indices=False):
data = np.asarray(data)
if n is None or n <= 0 or n >= data.size:
return data
n = min(data.size, n) - 1
idx = np.argpartition(data, n)[:n]
result = data[idx]
if return_indices:
return result, idx
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flat_top_average(data, n):\n return np.average(partition_top(data, n, return_indices=False))",
"def _downsample_avg(arr, n):\n\tend = n * int(len(arr)/n)\n\treturn np.mean(arr[:end].reshape(-1, n), 1)",
"def topK(arr,k):\n c=np.copy(arr)\n value=[]\n idxs=[]\n for i in range(k):\n id... | [
"0.8305116",
"0.70415604",
"0.6468891",
"0.63598007",
"0.6331062",
"0.629403",
"0.6292614",
"0.6282709",
"0.6280524",
"0.62355965",
"0.62318826",
"0.6210229",
"0.6138292",
"0.61370474",
"0.60974526",
"0.6092439",
"0.6075894",
"0.6065992",
"0.6049932",
"0.60495335",
"0.6018857... | 0.563887 | 65 |
Function to return the average of the top n values in an array | def flat_top_average(data, n):
return np.average(partition_top(data, n, return_indices=False)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _downsample_avg(arr, n):\n\tend = n * int(len(arr)/n)\n\treturn np.mean(arr[:end].reshape(-1, n), 1)",
"def topK(arr,k):\n c=np.copy(arr)\n value=[]\n idxs=[]\n for i in range(k):\n idx=np.argmax(c)\n idxs.append(idx)\n val=float(\"{0:.5f}\".format(c[idx]))\n value.ap... | [
"0.70388013",
"0.646959",
"0.635728",
"0.6328989",
"0.6295968",
"0.629084",
"0.62805027",
"0.6277741",
"0.6234092",
"0.6230694",
"0.62123",
"0.6137516",
"0.61361516",
"0.6095522",
"0.60906607",
"0.60755014",
"0.6064665",
"0.6049433",
"0.6046734",
"0.6016747",
"0.597659",
"0... | 0.83049 | 0 |
Setup Nest binary sensors. | def setup_platform(hass, config, add_devices, discovery_info=None):
for structure, device in nest.devices():
add_devices([NestBinarySensor(structure, device, variable)
for variable in config[CONF_MONITORED_CONDITIONS]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(self):\n \n # preload buffer with four chunks to avoid wacky noises on startup\n preload_data = np.zeros(self.buffer_size * 2 * 4, dtype='int16')\n preload_data = struct.pack('%dh'%(len(preload_data)), *list(preload_data))\n self.output_device.write(preload_data)\n ... | [
"0.6341481",
"0.61780584",
"0.60407466",
"0.5868195",
"0.586354",
"0.5824514",
"0.57414657",
"0.57035834",
"0.57005495",
"0.5658691",
"0.56319517",
"0.5631608",
"0.55903554",
"0.5580193",
"0.5568151",
"0.5544205",
"0.5540418",
"0.55179113",
"0.54891276",
"0.5467693",
"0.54648... | 0.62116873 | 1 |
True if the binary sensor is on. | def is_on(self):
return bool(getattr(self.device, self.variable)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_binary_state(self):\r\n if self.hubitat_device.properties['value'] in FIB_STATES_ON:\r\n return True\r\n else: \r\n return False",
"def is_on(self):\n return self.sensor.is_opened",
"def is_on(self) -> bool:\n return self.device.level == \"on\"",
... | [
"0.78780264",
"0.7843752",
"0.7758174",
"0.7726612",
"0.7696837",
"0.7630128",
"0.76028013",
"0.75570244",
"0.7545911",
"0.7516667",
"0.7417705",
"0.7368821",
"0.73476976",
"0.7338975",
"0.73298365",
"0.7326824",
"0.7314599",
"0.72987354",
"0.7249874",
"0.72160643",
"0.720441... | 0.78239995 | 2 |
Generate a random string of fixed length | def randomString(stringLength=10):
letters = string.ascii_letters + string.digits
return ''.join(random.choice(letters) for i in range(stringLength)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_string(length=15):\n\n rand_str = \"\"\n for _ in range(length):\n rand_str += random.choice(\"abcdefABCDEF\" + string.digits) # nosec\n\n return rand_str",
"def _rand_str(self, string_len):\n return binascii.hexlify(os.urandom(string_len))",
"def random_strin... | [
"0.8622677",
"0.8519229",
"0.8465095",
"0.8434765",
"0.8404023",
"0.8397009",
"0.83947253",
"0.8381278",
"0.8377062",
"0.83605546",
"0.8351346",
"0.83512384",
"0.83195645",
"0.826418",
"0.8247328",
"0.822978",
"0.82281053",
"0.8217121",
"0.81867296",
"0.8178301",
"0.81648356"... | 0.78544986 | 50 |
Convert rotation matrix to quaternion. Note that this function calls self_adjoint_eig which is extremely expensive on the GPU. If at all possible, this function should run on the CPU. | def rot_to_quat(rot, unstack_inputs=False):
if unstack_inputs:
rot = mnp.transpose(rot, [2, 1, 0])
xx, xy, xz = rot[0][0], rot[0][1], rot[0][2]
yx, yy, yz = rot[1][0], rot[1][1], rot[1][2]
zx, zy, zz = rot[2][0], rot[2][1], rot[2][2]
k = mnp.stack((mnp.stack((xx + yy + zz, zy - yz, xz - zx,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotation_matrix_to_quaternion(m):\n\n # Original C++ method ('GetQuaternionRotation()') is defined in\n # pba/src/pba/DataInterface.h\n # Parallel bundle adjustment (pba) code (used by visualsfm) is provided\n # here: http://grail.cs.washington.edu/projects/mcba/\n q = np.arr... | [
"0.7669474",
"0.70537",
"0.7017621",
"0.7004715",
"0.6924886",
"0.6864845",
"0.686136",
"0.6839608",
"0.6774512",
"0.6770076",
"0.675963",
"0.67509884",
"0.67484903",
"0.6741929",
"0.6725284",
"0.6705977",
"0.6705977",
"0.6636035",
"0.6547842",
"0.65306",
"0.65293264",
"0.6... | 0.59948593 | 49 |
Convert a normalized quaternion to a rotation matrix. | def quat_to_rot(normalized_quat):
rot_tensor = mnp.sum(mnp.reshape(QUAT_TO_ROT, (4, 4, 9)) * normalized_quat[..., :, None, None] *
normalized_quat[..., None, :, None], axis=(-3, -2))
rot = mnp.moveaxis(rot_tensor, -1, 0) # Unstack.
return [[rot[0], rot[1], rot[2]],
[rot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quaternion_to_rotation_matrix(q):\n\n # Original C++ method ('SetQuaternionRotation()') is defined in\n # pba/src/pba/DataInterface.h.\n # Parallel bundle adjustment (pba) code (used by visualsfm) is provided\n # here: http://grail.cs.washington.edu/projects/mcba/\n qq = math... | [
"0.8044682",
"0.78233767",
"0.7663979",
"0.7593794",
"0.758917",
"0.75692195",
"0.7515368",
"0.738047",
"0.73704875",
"0.7346453",
"0.73050207",
"0.722184",
"0.71635115",
"0.71075",
"0.70901936",
"0.70003396",
"0.6988532",
"0.6971027",
"0.69379234",
"0.68585724",
"0.6748479",... | 0.74352306 | 7 |
create quat affine representations | def quat_affine(quaternion, translation, rotation=None, normalize=True, unstack_inputs=False):
if unstack_inputs and rotation is not None:
rotation = mnp.transpose(rotation, [2, 1, 0])
translation = mnp.moveaxis(translation, -1, 0) # Unstack.
if normalize and quaternion is not None:
quater... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromQuaternion(*q):\n if(len(q) == 1):\n q = q[0]\n if isinstance(q, Quaternion):\n q = q.q # access member of Quaternion\n return Affine3(xform.quaternion_matrix(q))",
"def to_pyquat(trans_quat):\n return np.concatenate([trans_quat[1:], [trans_quat[0]]])",
"de... | [
"0.7084932",
"0.6981736",
"0.660273",
"0.6585111",
"0.6585111",
"0.656542",
"0.6519405",
"0.6519405",
"0.649593",
"0.64728314",
"0.6458178",
"0.6457923",
"0.6420242",
"0.63886064",
"0.63075864",
"0.6300432",
"0.62942797",
"0.62836075",
"0.6269895",
"0.6238537",
"0.62171316",
... | 0.68005186 | 2 |
Converts from tensor of shape (3,) to Vecs. | def vecs_from_tensor(x): # shape (...)
# num_components = x.shape[-1]
# assert num_components == 3
return x[..., 0], x[..., 1], x[..., 2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scalar_to_vector(val):\n if isinstance(val, arrays.ndarray):\n return tensor_to_ndarray(tf.reshape(val.data, [-1]))\n elif isinstance(val, np.ndarray):\n return np.ravel(val)\n else:\n return [val]",
"def toVector(self, *args):\n return _almathswig.Position3D_toVector(self, *args)",
"def... | [
"0.6911898",
"0.67703635",
"0.67703635",
"0.6768094",
"0.672751",
"0.66675806",
"0.6552061",
"0.64855504",
"0.62869734",
"0.6269247",
"0.6269247",
"0.6255723",
"0.6197296",
"0.6197296",
"0.61748284",
"0.6089913",
"0.60858387",
"0.60323995",
"0.59832346",
"0.59614897",
"0.5956... | 0.7664531 | 0 |
Converts 'v' to tensor with shape 3, inverse of 'vecs_from_tensor'. | def vecs_to_tensor(v):
return mnp.stack([v[0], v[1], v[2]], axis=-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inv_vec(v, dim=None):\n # JDW 2009\n # Ville Bergholm 2009\n\n d = v.size\n if dim == None:\n # assume a square matrix\n n = sqrt(d)\n if floor(n) != n:\n raise ValueError('Length of vector v is not a squared integer.')\n dim = (n, n)\n else:\n if pr... | [
"0.66595733",
"0.6409233",
"0.63567346",
"0.6276394",
"0.6131584",
"0.60007143",
"0.5969137",
"0.59408426",
"0.5915653",
"0.5893182",
"0.58216494",
"0.5819931",
"0.57856476",
"0.5783348",
"0.57802",
"0.57786435",
"0.5742899",
"0.57323813",
"0.5690815",
"0.56891704",
"0.562640... | 0.72452354 | 0 |
Convert rotation matrix to quaternion. Note that this function calls self_adjoint_eig which is extremely expensive on the GPU. If at all possible, this function should run on the CPU. | def batch_rot_to_quat(rot, unstack_inputs=False):
if unstack_inputs:
rot = mnp.transpose(rot, [0, 3, 2, 1])
xx, xy, xz = rot[:, 0, 0, :], rot[:, 0, 1, :], rot[:, 0, 2, :]
yx, yy, yz = rot[:, 1, 0, :], rot[:, 1, 1, :], rot[:, 1, 2, :]
zx, zy, zz = rot[:, 2, 0, :], rot[:, 2, 1, :], rot[:, 2, 2, :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotation_matrix_to_quaternion(m):\n\n # Original C++ method ('GetQuaternionRotation()') is defined in\n # pba/src/pba/DataInterface.h\n # Parallel bundle adjustment (pba) code (used by visualsfm) is provided\n # here: http://grail.cs.washington.edu/projects/mcba/\n q = np.arr... | [
"0.7668825",
"0.70542365",
"0.70177394",
"0.7004638",
"0.6925934",
"0.6866443",
"0.68627936",
"0.6842635",
"0.6774449",
"0.6771989",
"0.6761289",
"0.67504907",
"0.67491615",
"0.6742194",
"0.67271435",
"0.6707347",
"0.6707347",
"0.6636313",
"0.6545813",
"0.65319973",
"0.653199... | 0.0 | -1 |
return true if state is terminal or false otherwise | def is_terminal(self, state):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isTerminal(self, state):\n return True if state is 100 or state is 0 else False",
"def is_terminal_state(self, state):\n pass",
"def is_terminal(self) -> bool:\n return self._is_terminal",
"def is_terminal(self) -> bool:\n pass",
"def is_terminal(self, state):\n return state.cach... | [
"0.8531479",
"0.84985256",
"0.82153934",
"0.82016176",
"0.81123286",
"0.7946538",
"0.7908288",
"0.79054",
"0.77757895",
"0.77574104",
"0.7727924",
"0.76481634",
"0.75520426",
"0.75520426",
"0.7541033",
"0.7495134",
"0.74674946",
"0.7410097",
"0.7408736",
"0.7392998",
"0.73874... | 0.87848824 | 0 |
return a set of possible next states and probabilities of moving into them | def get_next_states(self, state, action):
assert action in self.get_possible_actions(
state), "cannot do action %s from state %s" % (action, state)
return self._transition_probs[state][action] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_transition_states_and_probs(self, state, action):\n li=[]\n newstate = self.P[self.pos2idx(state)][action][0][1]\n possibleactions = self.P[newstate]\n for a in possibleactions:\n print(possibleactions[a])\n li.append((self.idx2pos(possibleactions[a][0][1])... | [
"0.7172756",
"0.7170897",
"0.7029727",
"0.6937943",
"0.6905553",
"0.6823691",
"0.6811016",
"0.6752087",
"0.6733759",
"0.67252654",
"0.67097515",
"0.6668885",
"0.666633",
"0.6665362",
"0.66541934",
"0.6593187",
"0.65821815",
"0.6558723",
"0.65518326",
"0.6539216",
"0.65205246"... | 0.70673597 | 2 |
Test equality between self and ``another_moc`` | def __eq__(self, another_moc):
if not isinstance(another_moc, AbstractMOC):
raise TypeError('Cannot compare an AbstractMOC with a {0}'.format(type(another_moc)))
return self._interval_set == another_moc._interval_set | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, InvoiceDetailsM):\n return False\n\n return self.__dict__ == other.__dict__",
"def _eq(self, other):\n return True",
"def __eq__(self, other):\n if not isinstance(other, MetaPropDefinition):\n return False\n\n... | [
"0.67920744",
"0.6759699",
"0.6695321",
"0.65642583",
"0.6508773",
"0.64696187",
"0.6448063",
"0.6432916",
"0.6426308",
"0.6411651",
"0.63594574",
"0.63593984",
"0.6357056",
"0.63516307",
"0.63511944",
"0.6351017",
"0.63444763",
"0.6343012",
"0.63359445",
"0.633412",
"0.63225... | 0.7822877 | 0 |
Return True if user (User object) has perm (string), False otherwise. The omnipotent permission grants any perm. | def has_perm(user, perm):
for r in user.roles.filter():
if r.permissions.filter(name=Perms.OMNIPOTENT).exists():
return True
if r.permissions.filter(name=perm).exists():
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_perm(user, perm):\r\n return user.has_perm(perm)",
"def has_perm(self, user, perm):\n #superuser always has all permissions\n if user.is_superuser:\n return True\n if perm == OI_READ and self.public_read:\n return True\n if perm == OI_ANSWER and self.p... | [
"0.8397183",
"0.8206415",
"0.8105228",
"0.8037458",
"0.80211085",
"0.78504825",
"0.78317565",
"0.7825006",
"0.7825006",
"0.78216624",
"0.7820047",
"0.77924776",
"0.7789814",
"0.7783213",
"0.77038115",
"0.7686181",
"0.74341226",
"0.7380795",
"0.7379208",
"0.7246995",
"0.719360... | 0.7853095 | 5 |
Decorator raises PermissionDenied if the user is not logged in. This is similar to Django's login_required, only that one redirects to the login page. | def login_required_or_forbidden(view_func):
def wrapped_view(request, *posargs, **kwargs):
if not request.user.is_authenticated():
raise PermissionDenied('You must be logged in')
return view_func(request, *posargs, **kwargs)
return wrapped_view | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_required(permission=None):\n def decorator(fn):\n def wrapped_function(*args, **kwargs):\n # User must be logged in.\n if not auth_utils.check_login():\n return auth_utils.login_redirect()\n # Check permissions.\n if permission is not None:\n if not auth_utils.check_... | [
"0.7677909",
"0.76615363",
"0.7537073",
"0.7272085",
"0.71812516",
"0.71268106",
"0.71207523",
"0.71110815",
"0.7076553",
"0.70158225",
"0.70158225",
"0.7015772",
"0.6960857",
"0.69435453",
"0.69405544",
"0.6928626",
"0.69283056",
"0.69151",
"0.6914822",
"0.69112104",
"0.6897... | 0.80585945 | 0 |
Creates and saves a User with the given username and password. | def create_user(self, username, password=None):
if not username:
raise ValueError('Users must have an username')
user = self.model(
username=username,
)
user.set_password(password)
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signup(cls, username, email, password):\n\n hashed_pwd = bcrypt.generate_password_hash(password).decode('UTF-8')\n\n user = User(\n username=username,\n email=email,\n password=hashed_pwd,\n )\n\n db.session.add(user)\n return user",
"def _c... | [
"0.83647",
"0.834464",
"0.8332203",
"0.83091927",
"0.8294667",
"0.8251227",
"0.82363147",
"0.8159262",
"0.8159262",
"0.81383944",
"0.81351596",
"0.81267023",
"0.81253725",
"0.81208235",
"0.81154275",
"0.811527",
"0.8103812",
"0.8103812",
"0.8103812",
"0.8103812",
"0.8083411",... | 0.8027275 | 26 |
Creates and saves a superuser with the given username and password. | def create_superuser(self, username, password=None):
user = self.create_user(
username=username,
password=password
)
user.is_admin = True
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_superuser(self, username, password):\n\n user = self.create_user(username=username, password=password)\n\n user.is_superuser = True\n user.is_staff = True\n user.save(using=self._db)",
"def create_superuser(self, username, email, password):\n\n\n\t\tif password is None:\n\t... | [
"0.8296499",
"0.81820625",
"0.8126889",
"0.8080545",
"0.8070115",
"0.8041772",
"0.8037306",
"0.8037306",
"0.8015476",
"0.8012048",
"0.7989813",
"0.7961737",
"0.79578793",
"0.795302",
"0.7940617",
"0.79260635",
"0.7923767",
"0.7903312",
"0.7886676",
"0.78604114",
"0.7813476",
... | 0.79513204 | 14 |
Method returns JSON string representation of list_dictionaries attribute | def to_json_string(list_dictionaries):
if list_dictionaries is None or len(list_dictionaries) == 0:
return "[]"
else:
return json.dumps(list_dictionaries) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json_string(list_dictionaries):\n if list_dictionaries is None:\n list_dictionaries = []\n return json.dumps(list_dictionaries)",
"def to_json_string(list_dictionaries):\n if list_dictionaries is None:\n return '[]'\n return json.dumps(list_dictionaries)",... | [
"0.79873234",
"0.7960355",
"0.79451525",
"0.7944651",
"0.7942173",
"0.79244125",
"0.79201615",
"0.7917553",
"0.78894967",
"0.78882205",
"0.7883479",
"0.7877185",
"0.7871658",
"0.78625286",
"0.78625286",
"0.7861892",
"0.7856718",
"0.7856718",
"0.785614",
"0.785614",
"0.785614"... | 0.7777891 | 26 |
Test setting ssl profile to intermediate. | async def test_ssl_profile_change_intermediate(opp):
assert (
await async_setup_component(
opp, "http", {"http": {"ssl_profile": "intermediate"}}
)
is True
)
opp.http.ssl_certificate = "bla"
with patch("ssl.SSLContext.load_cert_chain"), patch(
"openpeerpower... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_ssl_profile_change_modern(opp):\n assert (\n await async_setup_component(opp, \"http\", {\"http\": {\"ssl_profile\": \"modern\"}})\n is True\n )\n\n opp.http.ssl_certificate = \"bla\"\n\n with patch(\"ssl.SSLContext.load_cert_chain\"), patch(\n \"openpeerpower.util.s... | [
"0.6881771",
"0.68373096",
"0.6121922",
"0.5783279",
"0.56241286",
"0.55981106",
"0.55778605",
"0.54230803",
"0.54161954",
"0.5411303",
"0.5360759",
"0.5331078",
"0.52146393",
"0.5199365",
"0.5168861",
"0.51542157",
"0.5147769",
"0.513881",
"0.513366",
"0.5123217",
"0.5122658... | 0.7833551 | 0 |
Test setting ssl profile to modern. | async def test_ssl_profile_change_modern(opp):
assert (
await async_setup_component(opp, "http", {"http": {"ssl_profile": "modern"}})
is True
)
opp.http.ssl_certificate = "bla"
with patch("ssl.SSLContext.load_cert_chain"), patch(
"openpeerpower.util.ssl.server_context_modern",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_ssl_profile_defaults_modern(opp):\n assert await async_setup_component(opp, \"http\", {}) is True\n\n opp.http.ssl_certificate = \"bla\"\n\n with patch(\"ssl.SSLContext.load_cert_chain\"), patch(\n \"openpeerpower.util.ssl.server_context_modern\",\n side_effect=server_context_... | [
"0.73923475",
"0.65662855",
"0.645069",
"0.61411256",
"0.6019121",
"0.57557315",
"0.57206833",
"0.56584203",
"0.56301",
"0.5622867",
"0.56170326",
"0.55845094",
"0.55646735",
"0.55646735",
"0.55646735",
"0.55646735",
"0.55646735",
"0.55646735",
"0.5535741",
"0.5490076",
"0.54... | 0.76744205 | 0 |
Test the CORS default settings. | async def test_cors_defaults(opp):
with patch("openpeerpower.components.http.setup_cors") as mock_setup:
assert await async_setup_component(opp, "http", {})
assert len(mock_setup.mock_calls) == 1
assert mock_setup.mock_calls[0][1][1] == ["https://cast.openpeerpower.io"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cors_configuration(self):\n try:\n self.client.connect()\n expected = ['allow_credentials', 'enable_cors', 'origins']\n cors = self.client.cors_configuration()\n self.assertTrue(all(x in expected for x in cors.keys()))\n finally:\n self.... | [
"0.7991288",
"0.7469582",
"0.7211733",
"0.7163497",
"0.69437796",
"0.6763215",
"0.67468745",
"0.66273177",
"0.661136",
"0.65960497",
"0.6510888",
"0.64278495",
"0.64014214",
"0.6277962",
"0.62651217",
"0.6216544",
"0.6189044",
"0.6189044",
"0.6189044",
"0.61820483",
"0.616693... | 0.685682 | 5 |
Constructor of the DeepSAD loss Subspace. INPUT | P (torch.Tensor) The projection matrix to the subspace of normal | sample. P is a MxM matrix where M is the embedding dimension. | eta (float) control the importance given to known or unknonw | samples. 1.0 gives equal weights, 1.0 gives more weight to the | known sampl... | def __init__(self, P, eta, eps=1e-6):
nn.Module.__init__(self)
self.P = P
self.eta = eta
self.eps = eps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, eta, eps=1e-6):\n nn.Module.__init__(self)\n self.eta = eta\n self.eps = eps",
"def __init__(self, size: int, eps=1e-6):\n super(LayerNormalization, self).__init__()\n\n # instantiate the learnable parameters, with appropriate device\n self.a_2 = nn.Pa... | [
"0.58849645",
"0.54078424",
"0.5381849",
"0.5381849",
"0.53604174",
"0.5326977",
"0.5326977",
"0.5326977",
"0.5325522",
"0.53176194",
"0.5315491",
"0.53150904",
"0.5292494",
"0.5292494",
"0.5280704",
"0.52361447",
"0.51930517",
"0.5188168",
"0.5118952",
"0.5114072",
"0.510989... | 0.6196065 | 0 |
Constructor of the DeepSVDD loss. INPUT | c (torch.Tensor) the center of the hypersphere as a multidimensional vector. | nu (float) a priory fraction of outliers. | eps (float) epsilon to ensure numerical stability in the | inverse distance. | soft_boundary (bool) whether to use a soft boundary OUTPUT | None | def __init__(self, c, nu, eps=1e-6, soft_boundary=False):
nn.Module.__init__(self)
self.c = c
self.nu = nu
self.eps = eps
self.soft_boundary = soft_boundary | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, nu, eps=1e-6, soft_boundary=False):\n nn.Module.__init__(self)\n self.nu = nu\n self.eps = eps\n self.soft_boundary = soft_boundary",
"def __init__(self, P, nu, eps=1e-6, soft_boundary=False):\n nn.Module.__init__(self)\n self.P = P\n self.nu = ... | [
"0.5804843",
"0.527121",
"0.52092606",
"0.5095535",
"0.49571717",
"0.48509318",
"0.47813085",
"0.47762123",
"0.474943",
"0.46977258",
"0.4673731",
"0.46691057",
"0.46691057",
"0.4656572",
"0.463335",
"0.4632859",
"0.46061355",
"0.46028635",
"0.45939267",
"0.45586196",
"0.4537... | 0.64896196 | 0 |
Forward pass of the DeepSVDD loss Subspace. INPUT | input (torch.Tensor) the point to project onto the subspace. | (must thus have the same dimension (B x embed.dim)). | R (flaot) radius for the soft boundary. OUTPUT | loss (torch.Tensor) the DeepSVDD loss Subspace. | def forward(self, input, R):
# distance between center c and the input (tranpose to manage the batch dimension)
dist = torch.sum((input - torch.matmul(self.P, input.transpose(0,1)).transpose(0,1))**2, dim=1)
# compute the loss
if self.soft_boundary:
scores = dist - R ** 2
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x: Tensor, sublayer: nn.Module) -> Tensor:\n return x + self.dropout(sublayer(self.norm(x)))",
"def forward(self, x, sublayer):\n # return x + self.dropout(sublayer(self.norm(x)))\n reg = self.norm((x + self.dropout(sublayer(x))))\n return reg",
"def forward(self, ... | [
"0.5978883",
"0.5804001",
"0.57566303",
"0.575265",
"0.5562411",
"0.5482741",
"0.5228429",
"0.5208179",
"0.51123667",
"0.51103973",
"0.50978553",
"0.5017629",
"0.4898598",
"0.4847021",
"0.48363245",
"0.48137543",
"0.48015985",
"0.47791407",
"0.47649023",
"0.47580045",
"0.4744... | 0.57165605 | 4 |
3x3 convolution with padding | def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv3x3(in_planes, out_planes, stride=1, padding=1, groups=1, dilation=1, zero_init=False):\n conv = nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=padding, groups=groups, bias=False, dilation=dilation)\n if zero_init:\n conv.weight.data.zero_()\n return conv",
"def co... | [
"0.73706514",
"0.7335249",
"0.7216377",
"0.72037584",
"0.72037584",
"0.7199952",
"0.7192902",
"0.7183875",
"0.7178802",
"0.7172082",
"0.71645725",
"0.71645725",
"0.716185",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",... | 0.7081058 | 63 |
Constructs a ResNet10 model. | def resnet10(**kwargs):
model = ResNet(BasicBlock, [1, 1, 1, 1], **kwargs)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(self):\n self.model = ResNet50('channels_last', classes=10,\n kernel_initializer=self.params['kernel_initializer'],\n kernel_regularizer=self.params['kernel_regularizer'],\n dropout=self.params['dropout'])",
"... | [
"0.7110964",
"0.70169234",
"0.68016785",
"0.67913884",
"0.66857356",
"0.6680301",
"0.6610379",
"0.6565403",
"0.6565403",
"0.6565403",
"0.6565403",
"0.6526284",
"0.6491994",
"0.6491994",
"0.6491994",
"0.6475705",
"0.647375",
"0.64735055",
"0.6413578",
"0.6403529",
"0.63740367"... | 0.7767007 | 1 |
Constructs a ResNet34 model. | def resnet34(**kwargs):
model = ResNet(BasicBlock, [3, 4, 6, 3], **kwargs)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet34(pretrained=False, **kwargs):\n model = ResNetlist(BasicBlock, [3, 4, 6, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet34']))\n return model",
"def resnet34(pretrained=False, **kwargs):\n model = ResNet(BasicBlock, [3, 4, 6, 3], **kwarg... | [
"0.74619204",
"0.7425328",
"0.7425328",
"0.73675907",
"0.73114467",
"0.7231324",
"0.72123164",
"0.7105468",
"0.7098438",
"0.70858634",
"0.70610267",
"0.7053645",
"0.7035042",
"0.7001086",
"0.694085",
"0.69312596",
"0.69155324",
"0.67291754",
"0.6668313",
"0.6608718",
"0.65903... | 0.73485917 | 5 |
Constructs a ResNet50 model. | def resnet50(**kwargs):
model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet50(self):\n\n base_model = ResNet50(weights=self.weights, include_top=self.include_top,\n pooling=self.pooling)\n x = base_model.layers[-1]\n out = Dense(units=self.num_classes, activation=self.activation, name='output',\n use_bias=True... | [
"0.7858666",
"0.78175455",
"0.74759895",
"0.74759895",
"0.74557495",
"0.7448512",
"0.7448512",
"0.7448512",
"0.74316454",
"0.73798925",
"0.7372855",
"0.7316456",
"0.730408",
"0.7277307",
"0.72542447",
"0.7217906",
"0.7214323",
"0.7126571",
"0.710355",
"0.709511",
"0.7025253",... | 0.7386862 | 10 |
Padding the input prior to the media operators given the parameters | def _pad_input(self, x):
if(self.same):
_, _, row, col = x.shape
x_pad = (col * (self.stride[0] - 1) + self.kernel[0] - self.stride[0])
# x_pad = (self.kernel[0]-1) # this assumes stride=1
l_pad = x_pad//2
r_pad = x_pad - l_pad
y_pad = (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dynamic_padding(self, batch_data, pad_id):\n # pad_p_len = min(self.max_p_len, max(batch_data['passage_length']))\n pad_q_len = min(self.max_q_len, max(batch_data['question_length']))\n # batch_data['passage_token_ids'] = [(ids + [pad_id] * (pad_p_len - len(ids)))[: pad_p_len]\n # ... | [
"0.62824345",
"0.59413147",
"0.59228176",
"0.59107727",
"0.5895508",
"0.5855404",
"0.5830819",
"0.5799079",
"0.57690716",
"0.57588965",
"0.57439333",
"0.57425106",
"0.5740764",
"0.57293797",
"0.56592524",
"0.5631231",
"0.5594326",
"0.5540992",
"0.55155766",
"0.54661095",
"0.5... | 0.535669 | 30 |
Initializer of the Wiener layer | def __init__(self, K=3, device=None):
super(WienerFilter, self).__init__()
self.kernel_size = _pair(K)
self.device = device
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_layers(self):\n pass",
"def _initialize_weights(self):\n init.orthogonal_(self.conv1.weight, init.calculate_gain('relu'))\n init.orthogonal_(self.conv2.weight, init.calculate_gain('relu'))\n init.orthogonal_(self.conv3.weight, init.calculate_gain('relu'))\n init... | [
"0.6982651",
"0.6930689",
"0.68334717",
"0.68250155",
"0.6806055",
"0.67498106",
"0.67484236",
"0.6737412",
"0.67314464",
"0.6720429",
"0.6716937",
"0.67166686",
"0.67145574",
"0.6709067",
"0.668585",
"0.6663587",
"0.6656246",
"0.6647876",
"0.6621859",
"0.6609194",
"0.6599924... | 0.6278323 | 69 |
Padding the input prior to the media operators given the parameters | def _pad_input(self, x):
_, _, row, col = x.shape
x_pad = (self.kernel_size[0]-1)
y_pad = (self.kernel_size[1]-1)
pad_dim = (x_pad//2, y_pad//2)
return pad_dim | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dynamic_padding(self, batch_data, pad_id):\n # pad_p_len = min(self.max_p_len, max(batch_data['passage_length']))\n pad_q_len = min(self.max_q_len, max(batch_data['question_length']))\n # batch_data['passage_token_ids'] = [(ids + [pad_id] * (pad_p_len - len(ids)))[: pad_p_len]\n # ... | [
"0.62824345",
"0.59413147",
"0.59228176",
"0.59107727",
"0.5895508",
"0.5855404",
"0.5830819",
"0.5799079",
"0.57690716",
"0.57588965",
"0.57439333",
"0.57425106",
"0.5740764",
"0.57293797",
"0.56592524",
"0.5631231",
"0.5594326",
"0.5540992",
"0.55155766",
"0.54661095",
"0.5... | 0.0 | -1 |
This function takes in an array of byte32 strings and returns an array of hex strings. | def _convert_byte32_arr_to_hex_arr(byte32_arr):
hex_ids = []
for byte32_str in byte32_arr:
hex_ids = hex_ids + [byte32_str.hex()]
return hex_ids | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _binary_array_to_hex(arr):\n\th = 0\n\ts = []\n\tfor i, v in enumerate(arr.flatten()):\n\t\tif v:\n\t\t\th += 2**(i % 8)\n\t\tif (i % 8) == 7:\n\t\t\ts.append(hex(h)[2:].rjust(2, '0'))\n\t\t\th = 0\n\treturn \"\".join(s)",
"def numpy2hex(clr):\n\n if len(clr) < 3: return clr\n clr = [int(round(255*c)) ... | [
"0.7081",
"0.6608694",
"0.65544283",
"0.6380451",
"0.6376145",
"0.63562024",
"0.63364905",
"0.62194806",
"0.61987644",
"0.61776626",
"0.61685807",
"0.6134656",
"0.61131763",
"0.6108995",
"0.6083299",
"0.6045738",
"0.6043849",
"0.5997241",
"0.59718955",
"0.5947686",
"0.5924726... | 0.85211456 | 0 |
Returns this subnetwork's name. | def name(self):
name = "NasNet_A_{}_{}".format(self._hparams.num_cells / 3,
self._hparams.num_conv_filters * 24)
if self._knowledge_distillation != KnowledgeDistillation.NONE:
name += "_" + self._knowledge_distillation
name += "_" + self._model_version
return nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> str:\n return self.__configuration['network']['name']",
"def subnet_name(self) -> str:\n return pulumi.get(self, \"subnet_name\")",
"def get_name(self):\n return self.node_name",
"def subnet_name(self) -> Optional[str]:\n return pulumi.get(self, \"subnet_name\")"... | [
"0.7688665",
"0.7687545",
"0.73660135",
"0.73216987",
"0.7252274",
"0.72439706",
"0.7241316",
"0.7190563",
"0.7150902",
"0.7150902",
"0.7150902",
"0.7132591",
"0.7109932",
"0.7109932",
"0.7109932",
"0.7109932",
"0.7109932",
"0.7098904",
"0.7098891",
"0.7098891",
"0.7098891",
... | 0.0 | -1 |
Merge two lists of dictionaries according to their keys. | def merge_lists(l1, l2, key):
merged = {}
for item in l1 + l2:
if item[key] in merged:
merged[item[key]].update(item)
else:
merged[item[key]] = item
return [val for (_, val) in merged.items()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_dicts(a, b):\n return dict(list(a.items()) + list(b.items()))",
"def _MergeDicts(a, b):\n for key, value in six.iteritems(b):\n if key not in a:\n a[key] = value\n continue\n value_a = a[key]\n if not isinstance(value_a, list) or not isinstance(value, list):\n raise ValueErr... | [
"0.79570407",
"0.7823368",
"0.76375425",
"0.7597039",
"0.75311506",
"0.7453522",
"0.74233574",
"0.7421262",
"0.74153036",
"0.740776",
"0.740776",
"0.740776",
"0.740776",
"0.740776",
"0.740776",
"0.740776",
"0.73410916",
"0.7333489",
"0.73123616",
"0.72956395",
"0.72922164",
... | 0.7393075 | 16 |
x is a vector of activations. Returns a vector which is softmax(x) | def softmax(x):
exp_vec = np.exp(x)
s = np.sum(exp_vec,axis = 0)
try:
if s != 0:
softmax = exp_vec/s
return softmax
else:
return np.zeros(exp_vec.shape)
except:
return np.zeros(exp_vec.shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x):\n x = np.asarray(x)\n return np.exp(x)/np.sum(np.exp(x), axis=0)",
"def softmax(self,x):\n result=np.zeros_like(x)\n M,N = x.shape\n for m in range(M):\n S=np.sum(np.exp(x[m,:]))\n result[m,:]=np.exp(x[m,:])/S\n return result",
"def softma... | [
"0.8371118",
"0.8268536",
"0.8243782",
"0.8242494",
"0.82354",
"0.8231854",
"0.82303554",
"0.8228279",
"0.82241416",
"0.82241416",
"0.82241416",
"0.82241416",
"0.82241416",
"0.82241416",
"0.82241416",
"0.82206285",
"0.82191724",
"0.81847304",
"0.81846315",
"0.81592625",
"0.81... | 0.792785 | 76 |
returns the derivative of the relu function | def relu_prime(x):
return 0.5*np.sign(x) + 0.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative(self, x):\n return self.d_elu(x)",
"def derivative(self, x):\n z = x.clone()\n tan_z = 2 * (1 / (1 + torch.exp(-2*z))) - 1\n grad = 1 - tan_z.pow(2)\n return grad",
"def derivative(cls, x: np.float) -> np.float:\n return cls.eval(x) * (1 - cls.eval(x))",... | [
"0.75850034",
"0.7215734",
"0.70300174",
"0.7008419",
"0.7001662",
"0.6984823",
"0.6876346",
"0.6865623",
"0.6855105",
"0.6804266",
"0.68020725",
"0.68013793",
"0.6799121",
"0.6762808",
"0.6757593",
"0.6686569",
"0.6676856",
"0.667129",
"0.6597656",
"0.65544695",
"0.6525593",... | 0.0 | -1 |
e.g. 20180129 to 20180101 and vice versa | def df_switch_trade_date(trade_date):
if "-" in str(trade_date):
return str(trade_date).replace("-", "")
else:
return str(str(trade_date)[0:4] + "-" + str(trade_date)[4:6] + "-" + str(trade_date)[6:8]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_to_version(tag):\n if re.match(r\"\\d\\d\\d\\d\\d\\d\\d\\d\", tag):\n year = int(tag[2:4]) - 20\n month = int(tag[4:6])\n day = int(tag[6:8])\n return f\"{year}.{month}.{day}\"\n return tag",
"def _to_yyyymmdd(timestamp):\r\n s = str(timestamp)\r\n r = s[0... | [
"0.59038574",
"0.5778658",
"0.57096034",
"0.56633425",
"0.56633425",
"0.5661648",
"0.55811757",
"0.55436444",
"0.55193126",
"0.5470483",
"0.5452148",
"0.5388133",
"0.5354288",
"0.5353749",
"0.5347133",
"0.53352576",
"0.53272253",
"0.528095",
"0.527578",
"0.52735406",
"0.52693... | 0.53337145 | 16 |
Get the current estimator of the instance. Returns | def get_model(self):
return self._model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEstimator(self) -> Estimator:\n return self.getOrDefault(self.estimator)",
"def estimator(self):\n if self._estimator is None:\n self.load_estimator()\n return self._estimator",
"def estimator_class(self):\n return self._estimator_class",
"def estimator_(self):\n... | [
"0.8407313",
"0.8377157",
"0.78076065",
"0.72726655",
"0.69558626",
"0.66693354",
"0.6424613",
"0.63328534",
"0.6159997",
"0.60873723",
"0.6048607",
"0.59769297",
"0.5883408",
"0.58342385",
"0.5800127",
"0.578455",
"0.568732",
"0.56637985",
"0.56637985",
"0.5632979",
"0.56159... | 0.0 | -1 |
Returns an iterator over a range of colors | def colors_cycle(lightness_factor=1.0, color_shift=0):
if MATPLOTLIB_AVAILABLE:
cycle = itertools.cycle(
[cm.Paired(color_shift + 0.21 + 0.21 * i % 1.0) for i in range(30)]
)
return (
"#%02x%02x%02x"
% tuple([int(255 * c * lightness_factor) for c in rgb_tu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rgb_colors() -> Iterator[Tuple[int, int, int]]:\n\n while True:\n rgb = randrange(0, 256**3) # nosec\n rg, b = divmod(rgb, 256)\n r, g = divmod(rg, 256)\n yield (r, g, b)",
"def color_generator(self):\r\n\r\n while True:\r\n colors = []\r\n for i i... | [
"0.75111127",
"0.7255035",
"0.6800404",
"0.6715708",
"0.66707516",
"0.645223",
"0.63799906",
"0.63606954",
"0.62401396",
"0.6166363",
"0.61044043",
"0.6094975",
"0.60724175",
"0.6043538",
"0.6027476",
"0.5992332",
"0.59525",
"0.59384936",
"0.59194046",
"0.59167194",
"0.587438... | 0.52761453 | 100 |
Gets the image_data of this LineFormat. | def image_data(self):
return self.container['image_data'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_data(self):\n return self._image_data",
"def get_image_data(self):\n return self._image.get_data()",
"def get_image_data(self):\n raise ImageException('Cannot retrieve image data for %r' % self)",
"def get_rgb_data(self):\n if self.auto_resume: self.resume()\n ... | [
"0.75999445",
"0.7509199",
"0.67993176",
"0.6610363",
"0.6582647",
"0.6559275",
"0.6488718",
"0.6450854",
"0.6364416",
"0.6331484",
"0.6277718",
"0.62586814",
"0.61877996",
"0.6157428",
"0.61499244",
"0.61499244",
"0.61077344",
"0.6088208",
"0.60804373",
"0.6052851",
"0.60242... | 0.72239494 | 2 |
Sets the image_data of this LineFormat. | def image_data(self, image_data):
if image_data is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', image_data):
raise ValueError("Invalid value for `image_data`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetData(*args, **kwargs):\n return _core_.Image_SetData(*args, **kwargs)",
"def _change_image(self, img_path, img_data, img_format):\n if img_format:\n self._image['format'] = img_format\n if img_path:\n pfile, data = img_path, ''\n else:\n pfile, ... | [
"0.68714684",
"0.6628727",
"0.65983903",
"0.65656143",
"0.65115726",
"0.6282843",
"0.62827605",
"0.62827605",
"0.62827605",
"0.62827605",
"0.62229896",
"0.62067527",
"0.61793727",
"0.6147044",
"0.61141664",
"0.60793126",
"0.5985757",
"0.5965708",
"0.59601235",
"0.59349453",
"... | 0.6363358 | 5 |
Gets the pattern_fill of this LineFormat. | def pattern_fill(self):
return self.container['pattern_fill'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pattern_fill(self, pattern_fill):\n\n self.container['pattern_fill'] = pattern_fill",
"def fill(self):\n return self.options['fill']",
"def Pattern(self):\n return self.__Pattern",
"def fill(self):\n tcPr = self._tc.get_or_add_tcPr()\n return FillFormat.from_fill_parent... | [
"0.70773864",
"0.67704934",
"0.66305506",
"0.6586734",
"0.6586734",
"0.6559298",
"0.6506319",
"0.61297953",
"0.6120088",
"0.6100791",
"0.6068126",
"0.59879994",
"0.59694284",
"0.59694284",
"0.59646285",
"0.58945084",
"0.5847556",
"0.56922144",
"0.5652151",
"0.5652151",
"0.565... | 0.82696766 | 0 |
Gets the type of this LineFormat. | def type(self):
return self.container['type'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_type(self) -> int:\n if self._line_type is None:\n return 1\n return max(self._line_type, 1)",
"def type(self):\n if self.not_present:\n return ' '.join(self.raw_line.split()[-2:])\n return self.raw_line.split()[-1]",
"def record_type(self, line: str) ... | [
"0.7391372",
"0.66113245",
"0.6606593",
"0.6537662",
"0.6514456",
"0.6514456",
"0.6512062",
"0.6505416",
"0.64885515",
"0.64885515",
"0.64833874",
"0.64784515",
"0.64784515",
"0.64784515",
"0.64784515",
"0.64784515",
"0.64784515",
"0.64784515",
"0.64784515",
"0.64784515",
"0.... | 0.0 | -1 |
Gets the begin_arrowhead_length of this LineFormat. | def begin_arrowhead_length(self):
return self.container['begin_arrowhead_length'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def begin_arrowhead_width(self):\n return self.container['begin_arrowhead_width']",
"def begin_arrowhead_length(self, begin_arrowhead_length):\n\n self.container['begin_arrowhead_length'] = begin_arrowhead_length",
"def end_arrowhead_width(self):\n return self.container['end_arrowhead_widt... | [
"0.8341132",
"0.74493724",
"0.7391443",
"0.73319256",
"0.7303348",
"0.71187824",
"0.6316642",
"0.62600315",
"0.6154378",
"0.601276",
"0.5900777",
"0.5889215",
"0.58630025",
"0.5803031",
"0.5785848",
"0.57704777",
"0.5705356",
"0.56852555",
"0.56688124",
"0.5659439",
"0.554337... | 0.8511934 | 0 |
Sets the begin_arrowhead_length of this LineFormat. | def begin_arrowhead_length(self, begin_arrowhead_length):
self.container['begin_arrowhead_length'] = begin_arrowhead_length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def begin_arrowhead_width(self, begin_arrowhead_width):\n\n self.container['begin_arrowhead_width'] = begin_arrowhead_width",
"def begin_arrowhead_style(self, begin_arrowhead_style):\n\n self.container['begin_arrowhead_style'] = begin_arrowhead_style",
"def end_arrowhead_width(self, end_arrowhead... | [
"0.8088181",
"0.7547806",
"0.649869",
"0.6487653",
"0.62592167",
"0.6119821",
"0.60876256",
"0.58789873",
"0.570193",
"0.55758804",
"0.5531541",
"0.5300418",
"0.5283436",
"0.52642304",
"0.5249671",
"0.5232569",
"0.52010614",
"0.51903987",
"0.51644236",
"0.5140245",
"0.5128164... | 0.84727335 | 0 |
Gets the dash_style of this LineFormat. | def dash_style(self):
return self.container['dash_style'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_dash(self):\n return self._line_dash",
"def dash(self):\n return self['dash']",
"def dash_style(self, dash_style):\n\n self.container['dash_style'] = dash_style",
"def strokestyle(style=None):\n global _strokestyle\n if style is not None and style != _strokestyle:\n ... | [
"0.75073385",
"0.6759784",
"0.64047855",
"0.63171315",
"0.61684537",
"0.5772665",
"0.57054424",
"0.56358665",
"0.5633023",
"0.5551927",
"0.55196",
"0.5500071",
"0.5497934",
"0.5402931",
"0.5402931",
"0.5364146",
"0.5351081",
"0.5317265",
"0.53017724",
"0.528929",
"0.5220337",... | 0.8177336 | 0 |
Gets the end_arrowhead_width of this LineFormat. | def end_arrowhead_width(self):
return self.container['end_arrowhead_width'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_arrowhead_length(self):\n return self.container['end_arrowhead_length']",
"def end_arrowhead_width(self, end_arrowhead_width):\n\n self.container['end_arrowhead_width'] = end_arrowhead_width",
"def end_arrowhead_style(self):\n return self.container['end_arrowhead_style']",
"def b... | [
"0.80187887",
"0.75313544",
"0.7305858",
"0.7234046",
"0.7030846",
"0.6916026",
"0.68689275",
"0.631147",
"0.6269279",
"0.60638964",
"0.5997694",
"0.59870285",
"0.5926251",
"0.5905699",
"0.5815322",
"0.57805145",
"0.5754738",
"0.5723383",
"0.57156146",
"0.55911225",
"0.558601... | 0.84880763 | 0 |
Sets the end_arrowhead_width of this LineFormat. | def end_arrowhead_width(self, end_arrowhead_width):
self.container['end_arrowhead_width'] = end_arrowhead_width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_arrowhead_length(self, end_arrowhead_length):\n\n self.container['end_arrowhead_length'] = end_arrowhead_length",
"def end_arrowhead_style(self, end_arrowhead_style):\n\n self.container['end_arrowhead_style'] = end_arrowhead_style",
"def begin_arrowhead_width(self, begin_arrowhead_width):... | [
"0.782927",
"0.75261503",
"0.66249466",
"0.65099555",
"0.6471104",
"0.6159707",
"0.6017102",
"0.5967867",
"0.5895882",
"0.58189267",
"0.5794256",
"0.574982",
"0.5675005",
"0.55840695",
"0.5386106",
"0.53750896",
"0.5372199",
"0.5367136",
"0.5353836",
"0.53450936",
"0.5341843"... | 0.84432054 | 0 |
Gets the end_arrowhead_length of this LineFormat. | def end_arrowhead_length(self):
return self.container['end_arrowhead_length'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_arrowhead_width(self):\n return self.container['end_arrowhead_width']",
"def end_arrowhead_length(self, end_arrowhead_length):\n\n self.container['end_arrowhead_length'] = end_arrowhead_length",
"def begin_arrowhead_length(self):\n return self.container['begin_arrowhead_length']",
... | [
"0.8167388",
"0.7419181",
"0.72921425",
"0.7188335",
"0.71559006",
"0.70053804",
"0.6713122",
"0.65448326",
"0.64855945",
"0.6029863",
"0.60130054",
"0.58994865",
"0.5842212",
"0.58178914",
"0.5807562",
"0.57970095",
"0.57743144",
"0.57482094",
"0.5671269",
"0.5664493",
"0.56... | 0.8546655 | 0 |
Sets the end_arrowhead_length of this LineFormat. | def end_arrowhead_length(self, end_arrowhead_length):
self.container['end_arrowhead_length'] = end_arrowhead_length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_arrowhead_width(self, end_arrowhead_width):\n\n self.container['end_arrowhead_width'] = end_arrowhead_width",
"def end_arrowhead_style(self, end_arrowhead_style):\n\n self.container['end_arrowhead_style'] = end_arrowhead_style",
"def begin_arrowhead_length(self, begin_arrowhead_length):\n... | [
"0.8046504",
"0.74673444",
"0.6776356",
"0.62521595",
"0.62463415",
"0.6098028",
"0.6096595",
"0.6019175",
"0.5911767",
"0.57481587",
"0.5598852",
"0.551436",
"0.5440457",
"0.54160273",
"0.5413851",
"0.53745943",
"0.53736454",
"0.5328184",
"0.5328184",
"0.5328184",
"0.5328184... | 0.84768784 | 0 |
Gets the begin_arrowhead_width of this LineFormat. | def begin_arrowhead_width(self):
return self.container['begin_arrowhead_width'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def begin_arrowhead_length(self):\n return self.container['begin_arrowhead_length']",
"def begin_arrowhead_width(self, begin_arrowhead_width):\n\n self.container['begin_arrowhead_width'] = begin_arrowhead_width",
"def begin_arrowhead_style(self):\n return self.container['begin_arrowhead_st... | [
"0.7929679",
"0.7533481",
"0.7443221",
"0.73833865",
"0.6992034",
"0.65003306",
"0.6313116",
"0.62532455",
"0.61098355",
"0.60532224",
"0.6029784",
"0.5931575",
"0.5914594",
"0.58440673",
"0.5794617",
"0.5738187",
"0.5666036",
"0.5643689",
"0.5642882",
"0.56245977",
"0.562459... | 0.8559942 | 0 |
Sets the begin_arrowhead_width of this LineFormat. | def begin_arrowhead_width(self, begin_arrowhead_width):
self.container['begin_arrowhead_width'] = begin_arrowhead_width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def begin_arrowhead_length(self, begin_arrowhead_length):\n\n self.container['begin_arrowhead_length'] = begin_arrowhead_length",
"def begin_arrowhead_style(self, begin_arrowhead_style):\n\n self.container['begin_arrowhead_style'] = begin_arrowhead_style",
"def begin_arrowhead_width(self):\n ... | [
"0.7926792",
"0.7770337",
"0.6653057",
"0.6507576",
"0.6368252",
"0.57884175",
"0.5655477",
"0.5581255",
"0.5496049",
"0.54612285",
"0.5452924",
"0.54139006",
"0.5392577",
"0.5390503",
"0.5388884",
"0.5344055",
"0.52971494",
"0.5293491",
"0.5292689",
"0.5291028",
"0.52855355"... | 0.8506145 | 0 |
Gets the compound_type of this LineFormat. | def compound_type(self):
return self.container['compound_type'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contract_type(self):\n return self._contract_type",
"def compound(self):\n return self._compound",
"def compound_type(self, compound_type):\n\n self.container['compound_type'] = compound_type",
"def formatType(self):\n if not self.parsed:\n self._parse_values()\n ... | [
"0.6187679",
"0.60246164",
"0.60214293",
"0.57418793",
"0.57235366",
"0.5700792",
"0.55195767",
"0.55195767",
"0.5505839",
"0.5500241",
"0.54873466",
"0.54717106",
"0.54717106",
"0.5457429",
"0.54538184",
"0.54538167",
"0.5441774",
"0.541949",
"0.541949",
"0.541949",
"0.54194... | 0.79390603 | 0 |
Sets the compound_type of this LineFormat. | def compound_type(self, compound_type):
self.container['compound_type'] = compound_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_compound(self, is_compound):\n\n self._is_compound = is_compound",
"def contract_type(self, contract_type):\n\n self._contract_type = contract_type",
"def compound_type(self):\n return self.container['compound_type']",
"def candle_type(self, candle_type):\n\n self._candle_t... | [
"0.6224567",
"0.5970025",
"0.5697272",
"0.5470661",
"0.5382276",
"0.53303695",
"0.5202341",
"0.5173027",
"0.51451087",
"0.5023543",
"0.50098455",
"0.49584344",
"0.4932754",
"0.49226177",
"0.48914364",
"0.48893246",
"0.4875665",
"0.48729128",
"0.48675558",
"0.4852656",
"0.4852... | 0.7936391 | 0 |
Gets the join_type of this LineFormat. | def join_type(self):
return self.container['join_type'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_type(self, join_type):\n\n self.container['join_type'] = join_type",
"def line_join(self):\n return self._line_join",
"def line_type(self) -> int:\n if self._line_type is None:\n return 1\n return max(self._line_type, 1)",
"def get_type(self):\n return s... | [
"0.61439407",
"0.58539695",
"0.58108705",
"0.5717139",
"0.56960577",
"0.5665651",
"0.56554145",
"0.5601504",
"0.55644757",
"0.55189764",
"0.5458596",
"0.53709865",
"0.5345902",
"0.52692735",
"0.52692735",
"0.52692735",
"0.52692735",
"0.52692735",
"0.52692735",
"0.52539724",
"... | 0.75064397 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.