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 |
|---|---|---|---|---|---|---|
Getter for the y coordinate of a particle. Returns float The y coordinate of a particle. | def y(self):
return self._y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getYCoordinate(self) -> float:\n return self.y_coord",
"def get_y(self):\n return self.coords[1]",
"def _get_y(self):\n return self.position.y",
"def getY(self):\n return self.position[1]",
"def getY(self):\n return self.y",
"def getY(self):\n return self.y",... | [
"0.8031172",
"0.78316545",
"0.7778685",
"0.7776736",
"0.7775239",
"0.7775239",
"0.7764286",
"0.7754987",
"0.77312505",
"0.77244896",
"0.77064824",
"0.7695347",
"0.7688174",
"0.7672748",
"0.76362437",
"0.7630527",
"0.75724715",
"0.75681645",
"0.75372285",
"0.75372285",
"0.7504... | 0.72662437 | 36 |
Interface for a material stacker, to support e.g., stack = Si | air. | def __or__(self, other):
raise NotImplementedError("failed monkey-patch: material stacker needs"
" to replace __or__ in Scatterer") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stack(self, *args, **kwargs):\n return self._block(*args, container=\"stack\", **kwargs)",
"def create_stack():\n\n return Stack()",
"def __call__(self, *args, **kw):\n raise NotImplementedError(\"failed monkey-patch: material stacker needs\"\n \" to replac... | [
"0.61101735",
"0.604537",
"0.5795938",
"0.5777025",
"0.57206774",
"0.5676153",
"0.5670715",
"0.5616618",
"0.5590499",
"0.5580484",
"0.55559886",
"0.5537987",
"0.5515781",
"0.5513628",
"0.5478354",
"0.546652",
"0.5447304",
"0.5436564",
"0.5433909",
"0.5433909",
"0.5433909",
... | 0.0 | -1 |
Returns an alloy defined by relative mass of the constituents. Mixture.bymass(base, M2, F2, ..., name='mixture name') | def bymass(cls, base, *parts, **kw):
return cls(base, parts, by='mass', **kw) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def m2(self):\n return self.mass[1]",
"def get_M2(M1, num_sys=1):\n return M1*uniform(size=num_sys)",
"def mean_by_mass(self, name):\n m = np.asanyarray(self[\"mass\"])\n ret = array.SimArray(\n (self[name].transpose() * m).transpose().mean(axis=0) / m.mean(), self[name].unit... | [
"0.56320035",
"0.5259214",
"0.50910425",
"0.50587785",
"0.50541496",
"0.5018914",
"0.496936",
"0.49654782",
"0.4910878",
"0.486393",
"0.48429003",
"0.48299593",
"0.478215",
"0.47258285",
"0.47050986",
"0.46959585",
"0.46885803",
"0.4685525",
"0.4683247",
"0.46759623",
"0.4669... | 0.61888427 | 0 |
Compute the density of the mixture from the density and proportion of the individual components. | def _density(self):
fraction = np.array([0.]+[m.value for m in self.fraction])
# TODO: handle invalid fractions using penalty functions
# S = sum(fraction)
# scale = S/100 if S > 100 else 1
# fraction[0] = 100 - S/scale
# penalty = scale - 1
fraction[0] = 100 - su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_density(composition):\n density = 0.0\n\n for z, fraction in composition.items():\n density += fraction / ep.mass_density_kg_m3(z)\n\n return 1.0 / density",
"def probability_density(self, X):\n raise NotImplementedError",
"def test_probability_density(self)... | [
"0.7156759",
"0.6423372",
"0.63320816",
"0.62585247",
"0.6232724",
"0.6228395",
"0.6218764",
"0.6208273",
"0.6172866",
"0.6144694",
"0.6133219",
"0.6126653",
"0.6063127",
"0.6054448",
"0.601485",
"0.601485",
"0.601485",
"0.59881055",
"0.5986512",
"0.59815633",
"0.59663427",
... | 0.71525383 | 1 |
Extend a to match the number of dimensions of b. This adds dimensions to the end of a rather than the beginning. It is equivalent to a[..., None, None] with the right number of None elements to make the number of dimensions match (or np.newaxis if you prefer). | def extend(a, b):
if np.isscalar(a):
return a
# CRUFT: python 2.7 support
extra_dims = (1,)*(b.ndim-a.ndim)
return a.reshape(a.shape + extra_dims)
# python 3 uses
#extra_dims = (np.newaxis,)*(b.ndim-a.ndim)
#return a[(..., *extra_dims)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_expand_dims(a, axes):\n # if int is passed, retain the same behaviour\n if type(axes) == int:\n return np.expand_dims(a, axes)\n # insert axes to given indices\n for ax in sorted(axes):\n a = np.expand_dims(a, ax)\n return a",
"def add_dims_on_right(arr: array_like, new_axes_... | [
"0.60436183",
"0.5992693",
"0.57490283",
"0.57351136",
"0.5716952",
"0.57017934",
"0.5662988",
"0.5577876",
"0.549605",
"0.54837286",
"0.5458152",
"0.5403845",
"0.5391427",
"0.5391427",
"0.5391427",
"0.53542334",
"0.5346788",
"0.52701664",
"0.5269523",
"0.52688",
"0.5216148",... | 0.8198336 | 0 |
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected. | def recall(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
recall = true_positives / (possible_positives + K.epsilon())
return recall | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t... | [
"0.76047015",
"0.74474794",
"0.74041575",
"0.7280166",
"0.7208148",
"0.716517",
"0.7156958",
"0.7131029",
"0.710041",
"0.7096404",
"0.7096404",
"0.7096404",
"0.7096404",
"0.7096404",
"0.7096404",
"0.7096404",
"0.7096404",
"0.7096404",
"0.7096404",
"0.7096404",
"0.7096404",
... | 0.7144544 | 8 |
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant. | def precision(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
precision = true_positives / (predicted_positives + K.epsilon())
return precision | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)",
"def comp... | [
"0.7489789",
"0.7288577",
"0.7160126",
"0.71535283",
"0.7066027",
"0.69853693",
"0.6965701",
"0.69550425",
"0.69127744",
"0.6834017",
"0.68179363",
"0.6809387",
"0.6785694",
"0.67576426",
"0.67576426",
"0.67576426",
"0.67576426",
"0.67576426",
"0.67576426",
"0.67576426",
"0.6... | 0.68049496 | 13 |
Find max random eVal by fitting Marcenko's distribution | def findMaxEval(eVal, q, bWidth):
out = minimize(
lambda x, *args: errPDFs(x[0], *args),
0.5,
args=(eVal, q, bWidth),
bounds=((1e-5, 1 - 1e-5),),
)
if out["success"]:
var = out["x"][0]
else:
var = 1
eMax = var * (1 + (1.0 / q) ** 0.5) ** 2
return e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def e(self):\n if self._e is None:\n # self._e = self.distributions.uniform(0.3,0.33)\n # return self._e\n # max is set by q but also limited by users choice of e_max.\n res_a = 29.9*((self.j[0]/self.k[0])**(2/3))\n q = self.distributions.truncated_norm... | [
"0.6881554",
"0.68471813",
"0.64754087",
"0.64344823",
"0.6400722",
"0.63806707",
"0.63057715",
"0.62959087",
"0.628247",
"0.6230704",
"0.6211851",
"0.61930484",
"0.6144895",
"0.61265093",
"0.61006325",
"0.60901797",
"0.60901797",
"0.60828626",
"0.6082433",
"0.60670894",
"0.6... | 0.65277886 | 2 |
Returns true if position 'a' is at least as far along as 'b'. | def position_at_least(self, a, b):
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position_after(self, a, b):\n return self.position_at_least(a, b) and not self.position_equal(a, b)",
"def validate_points(a, b):\r\n\tdiff_y = b[0] - a[0]\r\n\tdiff_x = b[1] - a[1]\r\n\r\n\treturn (diff_y == 0 and diff_x != 0) or (diff_x == 0 and diff_y != 0) or abs(diff_x) == abs(diff_y)",
"def span_o... | [
"0.7240502",
"0.6646913",
"0.6580503",
"0.6432033",
"0.6425145",
"0.64237106",
"0.6342213",
"0.6326465",
"0.63134277",
"0.6301747",
"0.6262241",
"0.6261322",
"0.62323034",
"0.62176603",
"0.62143695",
"0.61994565",
"0.61577237",
"0.61227244",
"0.6122717",
"0.61041033",
"0.6086... | 0.6585925 | 2 |
Returns true if position 'a' is after 'b' | def position_after(self, a, b):
return self.position_at_least(a, b) and not self.position_equal(a, b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsAfter(self, node, start):\n return node.start > start;",
"def is_upwards(line:tuple)->bool:\n return line[1][1] > line[0][1]",
"def position_equal(self, a, b):\n return None",
"def is_after(self, other):\n if self.is_before(other) or self == other:\n return False\n els... | [
"0.670546",
"0.64037275",
"0.61174804",
"0.6063479",
"0.6032431",
"0.6004654",
"0.59408724",
"0.5939187",
"0.5934258",
"0.5909052",
"0.5857507",
"0.58499545",
"0.5839095",
"0.58281857",
"0.57706666",
"0.5753403",
"0.5752184",
"0.57051396",
"0.5697424",
"0.565242",
"0.564713",... | 0.8300808 | 0 |
Returns the config to initialize a `TensorAdapter`. | def TensorAdapterConfig(self) -> tensor_adapter.TensorAdapterConfig:
return tensor_adapter.TensorAdapterConfig(
self.ArrowSchema(), self.TensorRepresentations()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TensorAdapter(self) -> tensor_adapter.TensorAdapter:\n return tensor_adapter.TensorAdapter(self.TensorAdapterConfig())",
"def get_config():\n config = tf.ConfigProto(allow_soft_placement=True)\n config.gpu_options.allow_growth=True\n return config",
"def get_config():\n config = tf.ConfigPro... | [
"0.688907",
"0.6445407",
"0.64321053",
"0.6400288",
"0.63017076",
"0.62444454",
"0.62420505",
"0.6002032",
"0.599247",
"0.5987138",
"0.58802295",
"0.5878723",
"0.58364713",
"0.58364713",
"0.58323306",
"0.58259887",
"0.5805665",
"0.57914877",
"0.5779149",
"0.57739383",
"0.5769... | 0.830687 | 0 |
Returns a TensorAdapter that converts pa.RecordBatch to TF inputs. May raise an error if the TFMD schema was not provided at construction time. | def TensorAdapter(self) -> tensor_adapter.TensorAdapter:
return tensor_adapter.TensorAdapter(self.TensorAdapterConfig()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_tfrecords(self) -> tf.data.Dataset:\n dataset = self.parser()\n\n def decode_rawdata(input_records):\n return self.decoder(input_records) # pylint: enable=g-long-lambda\n\n dataset = dataset.map(decode_rawdata, num_parallel_calls=self.AUTOTUNE)\n dataset = dataset.p... | [
"0.6136353",
"0.602169",
"0.59734833",
"0.5922168",
"0.5779653",
"0.57790613",
"0.5744001",
"0.5658783",
"0.55623484",
"0.55615926",
"0.5549354",
"0.5529868",
"0.5529265",
"0.54796416",
"0.5472046",
"0.5454743",
"0.54431385",
"0.5434877",
"0.54239327",
"0.541194",
"0.5403455"... | 0.53859323 | 27 |
ARN of the IAM role used to create the stack. | def iam_role_arn(self) -> str:
return pulumi.get(self, "iam_role_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def role_arn(self) -> str:\n return pulumi.get(self, \"role_arn\")",
"def role_arn(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"role_arn\")",
"def role_arn(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"role_arn\")",
"def role_arn(self) -> Optional[pulumi.I... | [
"0.78653973",
"0.7670398",
"0.7619725",
"0.74739546",
"0.74739546",
"0.74739546",
"0.74739546",
"0.74074626",
"0.74074626",
"0.7174054",
"0.70448273",
"0.70448273",
"0.6996795",
"0.6977378",
"0.6965926",
"0.6965926",
"0.6850099",
"0.6796837",
"0.6770975",
"0.67069715",
"0.667... | 0.7655819 | 2 |
Map of tags associated with this stack. | def tags(self) -> Mapping[str, str]:
return pulumi.get(self, "tags") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> dict:\n return self._tags",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> dict:\n\n return self._tags or None # store trivial tags as emp... | [
"0.82098186",
"0.8172031",
"0.8172031",
"0.79406893",
"0.7720642",
"0.76715726",
"0.76715726",
"0.76715726",
"0.76715726",
"0.76715726",
"0.76715726",
"0.76715726",
"0.76715726",
"0.76652753",
"0.7578484",
"0.7576007",
"0.7509383",
"0.7461461",
"0.7432332",
"0.7432332",
"0.74... | 0.8147913 | 4 |
r"""\"?(\w+ \ \w\d \ )\"? | def t_STRING(t):
return t | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quotemeta(text):\n return re.sub(\"(\\W)\", r\"\\\\\\1\", text)",
"def esc_kw(kw):\n kw = kw.replace('\\\\', '\\\\\\\\') # be sure to do this first, as we inject \\!\n kw = kw.replace('(', '\\(')\n kw = kw.replace(')', '\\)')\n kw = kw.replace('+', '\\+')\n kw = kw.replace('-', '\\-')\n ... | [
"0.58149666",
"0.5590527",
"0.5557459",
"0.54897135",
"0.5483146",
"0.5472348",
"0.54616034",
"0.543409",
"0.54280347",
"0.5421222",
"0.5386508",
"0.5367306",
"0.53665555",
"0.53575504",
"0.52577657",
"0.5233827",
"0.52100337",
"0.5179832",
"0.51553875",
"0.51145166",
"0.5104... | 0.0 | -1 |
If the path is not fully qualified, prepend the original current working directory to the path | def qualify(path):
if not absoluteRegexp.search(path):
path = os.path.join(cwd, path)
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(path):\n if _prefix and not '/' in path:\n path = _prefix + path\n\n if not _cwd:\n return path\n\n return join(_cwd, path)",
"def modify_path():\r\n currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\r\n parentdir = os.path.dirname(cu... | [
"0.7620671",
"0.74919146",
"0.7460935",
"0.731429",
"0.7300813",
"0.6977725",
"0.6915363",
"0.6718533",
"0.67154497",
"0.66916203",
"0.66771317",
"0.6654359",
"0.663174",
"0.66099477",
"0.65857214",
"0.6553072",
"0.65458477",
"0.65247303",
"0.6524716",
"0.6442794",
"0.6418941... | 0.6567196 | 15 |
Transform column to numpy array | def get(self):
# -------------------------------------------
# Build command string
cmd = dict()
cmd["name_"] = self.thisptr["df_name_"]
cmd["type_"] = "BooleanColumn.get"
cmd["col_"] = self.thisptr
# -------------------------------------------
# Send... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row_to_array(r):\n a = np.ma.array([i for i in r.as_void()])\n return a",
"def to_numpy(x):\r\n return x.squeeze().detach().cpu().numpy()",
"def sparse_matrix_to_array(data_frame, sparse_column):\n array = data_frame[[sparse_column]]\n array[sparse_column] = array[sparse_column].apply(lambda... | [
"0.7197415",
"0.713459",
"0.6926442",
"0.6919213",
"0.6718125",
"0.6693851",
"0.6660445",
"0.66309017",
"0.66002786",
"0.6577402",
"0.65694815",
"0.6568747",
"0.65588635",
"0.65338016",
"0.6533754",
"0.6518823",
"0.6517641",
"0.6515271",
"0.65083706",
"0.64859676",
"0.6461372... | 0.0 | -1 |
Extract day (of the month) from a time stamp. If the column is discrete or numerical, that number will be interpreted as the number of days since epoch time (January 1, 1970). | def __day(self):
return _VirtualColumn(
df_name=self.thisptr["df_name_"],
operator="day",
operand1=self,
operand2=None
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_day_of_month(timestamps):\n return np.asarray([dt.day for dt in timestamps.astype(datetime)])",
"def date_day_of_month(date):\n return date.day",
"def date_day(date):\n return date_day_of_month(date)",
"def day_of_month():\n return datetime.date.today().day",
"def daysinmonth(dt64):... | [
"0.72674775",
"0.7132711",
"0.67705905",
"0.6641441",
"0.64805484",
"0.6470614",
"0.6470614",
"0.6320599",
"0.6237334",
"0.61512125",
"0.60725784",
"0.60700744",
"0.6020121",
"0.59909475",
"0.59447384",
"0.59447384",
"0.59400976",
"0.57701856",
"0.57391006",
"0.5735653",
"0.5... | 0.0 | -1 |
Transform column to numpy array | def __get(self, sock=None):
# -------------------------------------------
# Build command string
cmd = dict()
cmd["name_"] = self.thisptr["df_name_"]
cmd["type_"] = "Column.get"
cmd["col_"] = self.thisptr
# -------------------------------------------
# Establish communication with g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row_to_array(r):\n a = np.ma.array([i for i in r.as_void()])\n return a",
"def to_numpy(x):\r\n return x.squeeze().detach().cpu().numpy()",
"def sparse_matrix_to_array(data_frame, sparse_column):\n array = data_frame[[sparse_column]]\n array[sparse_column] = array[sparse_column].apply(lambda... | [
"0.7197415",
"0.713459",
"0.6926442",
"0.6919213",
"0.6718125",
"0.6693851",
"0.6660445",
"0.66309017",
"0.66002786",
"0.6577402",
"0.65694815",
"0.6568747",
"0.65588635",
"0.65338016",
"0.6533754",
"0.6518823",
"0.6517641",
"0.6515271",
"0.65083706",
"0.64859676",
"0.6461372... | 0.0 | -1 |
Transform column to numpy array | def __get_categorical(self, sock=None):
# -------------------------------------------
# Build command string
cmd = dict()
cmd["name_"] = self.thisptr["df_name_"]
cmd["type_"] = "CategoricalColumn.get"
cmd["col_"] = self.thisptr
# -------------------------------------------
# Send co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row_to_array(r):\n a = np.ma.array([i for i in r.as_void()])\n return a",
"def to_numpy(x):\r\n return x.squeeze().detach().cpu().numpy()",
"def sparse_matrix_to_array(data_frame, sparse_column):\n array = data_frame[[sparse_column]]\n array[sparse_column] = array[sparse_column].apply(lambda... | [
"0.7197415",
"0.713459",
"0.6926442",
"0.6919213",
"0.6718125",
"0.6693851",
"0.6660445",
"0.66309017",
"0.66002786",
"0.6577402",
"0.65694815",
"0.6568747",
"0.65588635",
"0.65338016",
"0.6533754",
"0.6518823",
"0.6517641",
"0.6515271",
"0.65083706",
"0.64859676",
"0.6461372... | 0.0 | -1 |
Extract month from a time stamp. If the column is discrete or numerical, that number will be interpreted as the number of days since epoch time (January 1, 1970). | def __month(self):
return _VirtualColumn(
df_name=self.thisptr["df_name_"],
operator="month",
operand1=self,
operand2=None
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_month_from_date(raw_format_date):\n date = None\n for pattern in NAMCS_DATASET_MONTH_PATTERNS:\n try:\n date = datetime.strptime(raw_format_date, pattern)\n if date:\n break\n except ValueError:\n continue\n\n # Numeric format for month... | [
"0.68955654",
"0.6881809",
"0.6862225",
"0.68166107",
"0.6807643",
"0.6762404",
"0.6590734",
"0.6555987",
"0.6469025",
"0.64303976",
"0.6420243",
"0.63874197",
"0.62579584",
"0.612969",
"0.6104456",
"0.60417455",
"0.60187334",
"0.5988254",
"0.59776855",
"0.5963438",
"0.594426... | 0.5401495 | 53 |
Extract second (of the minute) from a time stamp. If the column is discrete or numerical, that number will be interpreted as the number of days since epoch time (January 1, 1970). | def __second(self):
return _VirtualColumn(
df_name=self.thisptr["df_name_"],
operator="second",
operand1=self,
operand2=None
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_second(date):\n return date.second",
"def SECOND(time):\n\n return _make_datetime(time).second",
"def timestamp2sec(timestamp):\n return (int(timestamp.seconds) + 60 * int(timestamp.minutes) + 3600 * int(timestamp.hours) + float(int(timestamp.hours) / 1000))",
"def get_second(time_index):\n ... | [
"0.6949661",
"0.680905",
"0.6749577",
"0.6457093",
"0.64513844",
"0.6405497",
"0.63529843",
"0.6312502",
"0.6219344",
"0.6168191",
"0.6091094",
"0.60906607",
"0.6060383",
"0.6015944",
"0.5986964",
"0.5986964",
"0.59643793",
"0.59459335",
"0.5916862",
"0.58843815",
"0.5865007"... | 0.0 | -1 |
Transforms a categorical column to a numeric column. | def __to_num(self):
return _VirtualColumn(
df_name=self.thisptr["df_name_"],
operator="to_num",
operand1=self,
operand2=None
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cat_to_num(att_df):\n att_df_encode = att_df.copy(deep=True)\n for att in att_df_encode.columns:\n if att_df_encode[att].dtype != float:\n att_df_encode[att] = pd.Categorical(att_df_encode[att])\n att_df_encode[att] = att_df_encode[att].cat.codes\n return att_df_encode",
... | [
"0.7188043",
"0.6811991",
"0.67667705",
"0.66084474",
"0.6456137",
"0.6443407",
"0.63923967",
"0.6379456",
"0.6368147",
"0.6344595",
"0.62350583",
"0.6234621",
"0.6222905",
"0.61672026",
"0.6116077",
"0.60962564",
"0.6088739",
"0.60025185",
"0.60025185",
"0.60012805",
"0.5908... | 0.56527865 | 31 |
Close the data link connection with the SNEP server. | def close(self):
if self.socket:
self.socket.close()
self.socket = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_connection(self):\n self.nodesocket.close()",
"def closeConnection(self):\n print(\"closing connection...\")\n self.s.close()\n quit()",
"def close_connection(self):\n\n self._connection.close()\n print(\"Closed connection....\")",
"def do_disconnect(self, ... | [
"0.73130095",
"0.7239946",
"0.70138234",
"0.6988987",
"0.6901466",
"0.6899947",
"0.6850949",
"0.6842043",
"0.6822807",
"0.68138045",
"0.6799122",
"0.677157",
"0.6771503",
"0.6753925",
"0.6753925",
"0.67453843",
"0.6736168",
"0.6721766",
"0.670781",
"0.6704745",
"0.67007434",
... | 0.63161427 | 90 |
The set of arguments for constructing a Ipam resource. | def __init__(__self__, *,
description: Optional[pulumi.Input[str]] = None,
operating_regions: Optional[pulumi.Input[Sequence[pulumi.Input['IpamOperatingRegionArgs']]]] = None,
tags: Optional[pulumi.Input[Sequence[pulumi.Input['IpamTagArgs']]]] = None):
if descr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__, *,\n address_family: pulumi.Input[str],\n ipam_scope_id: pulumi.Input[str],\n allocation_default_netmask_length: Optional[pulumi.Input[int]] = None,\n allocation_max_netmask_length: Optional[pulumi.Input[int]] = None,\n ... | [
"0.63863933",
"0.6357599",
"0.63269305",
"0.6093002",
"0.60835433",
"0.60813326",
"0.6008819",
"0.5984128",
"0.59629196",
"0.59609276",
"0.5939549",
"0.5913157",
"0.5902689",
"0.5896046",
"0.5858542",
"0.5848704",
"0.5775459",
"0.577129",
"0.5757634",
"0.5750422",
"0.57475907... | 0.58011156 | 16 |
The Amazon Resource Name (ARN) of the IPAM. | def arn(self) -> pulumi.Output[str]:
return pulumi.get(self, "arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return p... | [
"0.73320585",
"0.73320585",
"0.73320585",
"0.73320585",
"0.73320585",
"0.7172065",
"0.6982838",
"0.69482833",
"0.69482833",
"0.69482833",
"0.6927228",
"0.68976563",
"0.6862851",
"0.6855026",
"0.6855026",
"0.6855026",
"0.6855026",
"0.6855026",
"0.6855026",
"0.6855026",
"0.6855... | 0.735993 | 10 |
Id of the IPAM. | def ipam_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "ipam_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def portlet_id(self):\n return id(self)",
"def get_id(self):\n return self.iid",
"def id(self) -> str:\n return pulumi.get(self, \"id\")",
"def id(self) -> str:\n return pulumi.get(self, \"id\")",
"def id(self) -> str:\n return pulumi.get(self, \"id\")",
"def id(self) -... | [
"0.6954828",
"0.6807734",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"0.6722497",
"... | 0.8265104 | 0 |
Returns the value of the node. | def get_node_value(self, n):
node = self.get_node(n)
if node:
return node.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self):\n return self.node_value",
"def getValue(self):\n return _libsbml.ASTNode_getValue(self)",
"def value(self):\n return self.get_attribute(\"value\", str(self.children))",
"def get_node_value(node: Node):\n if node.type != 'Const':\n raise Exception('Can\\'t get ... | [
"0.89655745",
"0.786774",
"0.78107053",
"0.76275945",
"0.7586012",
"0.75806415",
"0.75448227",
"0.75057507",
"0.74218774",
"0.74218774",
"0.7372386",
"0.73676634",
"0.733452",
"0.733452",
"0.730461",
"0.730461",
"0.730461",
"0.73026633",
"0.7300878",
"0.7300878",
"0.7300878",... | 0.8300337 | 1 |
Prepare image for inputting to the neural network. Returns a Variable | def prep_image(img, inp_dim):
orig_im = img
dim = orig_im.shape[1], orig_im.shape[0]
img = (letterbox_image(orig_im, (inp_dim, inp_dim)))
img_ = img[:,:,::-1].transpose((2,0,1)).copy()
img_ = torch.from_numpy(img_).float().div(255.0).unsqueeze(0)
return img_, orig_im, dim | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(self, img):\n img_ = image.load_img(img, target_size=(299, 299))\n img_ = image.img_to_array(img_)\n img_ = np.expand_dims(img_, axis=0)\n img_ = preprocess_input(img_)\n return img_",
"def recreate_image(im_as_var):\n recreated_im = im_as_var.data.numpy()[0]\... | [
"0.62916833",
"0.6211987",
"0.6211208",
"0.6197419",
"0.61689556",
"0.61650276",
"0.6141847",
"0.6129262",
"0.61196506",
"0.6114234",
"0.61141485",
"0.6100635",
"0.6094669",
"0.60811746",
"0.60798824",
"0.60216117",
"0.6013268",
"0.59965223",
"0.59670097",
"0.5966533",
"0.596... | 0.0 | -1 |
Initializes a new Affine instance with default values | def __init__(self, a=23, b=50):
self.characters = list(
self.characters
+ string.ascii_lowercase
+ string.digits
+ string.punctuation
+ " "
)
try:
# a and m must be coprimes,
# meaning that they cannot have a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testDefaultAffine(self):\n affineClass = xyTransformRegistry[\"affine\"]\n affineConfig = affineClass.ConfigClass()\n with lsst.utils.tests.getTempFilePath(\".py\") as filePath:\n self.checkConfig(affineClass, affineConfig, filePath)\n affine = affineClass(affineConfi... | [
"0.6638548",
"0.65145046",
"0.62317014",
"0.61064374",
"0.59976363",
"0.59914225",
"0.5963453",
"0.5944052",
"0.59122866",
"0.5878966",
"0.5768456",
"0.5730906",
"0.5635327",
"0.5635327",
"0.5578717",
"0.5554409",
"0.55494297",
"0.5540451",
"0.5512622",
"0.5511559",
"0.545105... | 0.531882 | 34 |
Constructs a cone by its ellipse intersection. | def construct_by_ellipse(a_xx, h_xy, b_yy, g_x, f_y, d, focal_length):
gamma = - focal_length
a = gamma**2 * a_xx
b = gamma**2 * b_yy
c = d
d = gamma**2 * d
f = -gamma*(f_y)
g = -gamma*(g_x)
h = gamma**2 * h_xy
#Not needed
u = gamma**2 * g_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cone(self, length):\n X, Y, Z = baseFromAngles(self.angles)\n result = polyhedron([], [], [])\n assert result.pnFacesInPoly()\n f = result.addVertex(self.focalPoint)\n for s in self.segments:\n vect0 = (self.focalDist * X +\n s[0][0] * Z +\n ... | [
"0.64262986",
"0.6255224",
"0.6185348",
"0.6177203",
"0.61609423",
"0.60686046",
"0.59440607",
"0.591871",
"0.5872244",
"0.5866773",
"0.585719",
"0.58543086",
"0.58384305",
"0.5803261",
"0.577742",
"0.5739006",
"0.56999755",
"0.5681495",
"0.56791973",
"0.5669729",
"0.5668109"... | 0.6315355 | 1 |
Use this API to count the nshttpprofile resources configured on NetScaler. | def count(cls, client) :
try :
obj = nshttpprofile()
option_ = options()
option_.count = True
response = obj.get_resources(client, option_)
if response :
return response[0].__dict__['___count']
return 0
except Except... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(cls, client) :\n\t\ttry :\n\t\t\tobj = lbprofile()\n\t\t\toption_ = options()\n\t\t\toption_.count = True\n\t\t\tresponse = obj.get_resources(client, option_)\n\t\t\tif response :\n\t\t\t\treturn response[0].__dict__['___count']\n\t\t\treturn 0\n\t\texcept Exception as e :\n\t\t\traise e",
"def count(c... | [
"0.6287189",
"0.6198469",
"0.5946004",
"0.5831939",
"0.57442707",
"0.55919224",
"0.5390651",
"0.53646576",
"0.5354177",
"0.52801627",
"0.52671957",
"0.52559274",
"0.5229863",
"0.5204532",
"0.5141443",
"0.5118464",
"0.51152074",
"0.5101045",
"0.509449",
"0.50832164",
"0.505680... | 0.71893114 | 0 |
Use this API to count filtered the set of nshttpprofile resources. | def count_filtered(cls, client, filter_) :
try :
obj = nshttpprofile()
option_ = options()
option_.count = True
option_.filter = filter_
response = obj.getfiltered(client, option_)
if response :
return response[0].__dict__['... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(cls, client) :\n try :\n obj = nshttpprofile()\n option_ = options()\n option_.count = True\n response = obj.get_resources(client, option_)\n if response :\n return response[0].__dict__['___count']\n return 0\n ... | [
"0.7018164",
"0.60775137",
"0.6072945",
"0.59472954",
"0.59049845",
"0.5901454",
"0.5779798",
"0.56615466",
"0.54069823",
"0.53780264",
"0.5328295",
"0.529881",
"0.5290429",
"0.52850246",
"0.5236266",
"0.52264166",
"0.5214276",
"0.51986754",
"0.5165597",
"0.5153964",
"0.51191... | 0.680692 | 1 |
Create an image from a given data. Returns a png image as a string. | def get_image(self,v):
# kludge to get the image to have no border
fig=pylab.figure(figsize=(self.hsize,self.hsize*float(v.shape[0])/v.shape[1]))
ax=fig.add_axes([0,0,1,1])
v = np.flipud(v)
#self.colormap.set_under("r", alpha = 0.0)
zeros = v<1.0
v[zeros]=np.NaN... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertdataTOimage(data):\n data = data.partition(\",\")[2]\n padding = len(data)%4\n data += \"=\"*padding\n image = Image.open(BytesIO(b64decode(data)))\n return image",
"def to_image_data(data):\n \n # removing image\n if not data:\n return u''\n\n # image path (not change... | [
"0.6842017",
"0.68145114",
"0.6727903",
"0.6723739",
"0.6694281",
"0.66845906",
"0.6559768",
"0.6548694",
"0.6332545",
"0.632956",
"0.6304356",
"0.62824196",
"0.6216008",
"0.61489815",
"0.61393625",
"0.6135189",
"0.61224425",
"0.6122261",
"0.6122087",
"0.60089344",
"0.5988018... | 0.0 | -1 |
Return the time interval information for this image using the kml format string `timestr'. Or an empty string to disable animations. | def get_time(self):
return '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(s):\n t = IntervalTimer()\n t.id = s.get(\"id\", None)\n t.name = s.get(\"name\", None)\n if s.has_key(\"interval\"):\n ival = s[\"interval\"]\n if ival[-1:] == \"s\":\n t.seconds = int(ival[:-1])\n if ival[-1:] == \"m\":\n ... | [
"0.52695566",
"0.526532",
"0.52152336",
"0.51752627",
"0.51453054",
"0.5118938",
"0.5115575",
"0.5101139",
"0.5072153",
"0.5040522",
"0.5027899",
"0.50040615",
"0.4964468",
"0.4955831",
"0.49558255",
"0.49392334",
"0.4923896",
"0.49041823",
"0.4901534",
"0.4860963",
"0.484665... | 0.44655097 | 88 |
Determine whether or not `n` is prime. | def is_prime(n):
if n in (2, 3, 5, 7, 11, 13, 17, 19): return(True)
if (n<=1 or n%2==0 or n%3==0): return(False)
# determine upper limit of test range =>
ulimit = (int(math.ceil(math.sqrt(n)))+1)
return(not any(n%k==0 for k in range(3, ulimit, 2))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isprime(n):\r\n\treturn is_prime(n)",
"def isprime(n):\n\treturn is_prime(n)",
"def is_prime(n):\n return mr_prime(n)",
"def if_prime(cls, n):\n\n if (n <= 1):\n return False\n if (n <= 3):\n return True\n\n if (n % 2 == 0 or n % 3 == 0):\n return ... | [
"0.86517954",
"0.8644571",
"0.84845525",
"0.84433305",
"0.8308401",
"0.8290361",
"0.827796",
"0.82606864",
"0.82584834",
"0.8245748",
"0.8239699",
"0.82380414",
"0.8230631",
"0.8222912",
"0.82188195",
"0.8203481",
"0.8203481",
"0.8201891",
"0.8200143",
"0.81981033",
"0.819364... | 0.7948411 | 57 |
Test Subject object str/unicode representation | def test_str(self):
self.assertEqual(str(self.subject), "Test Subject") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unicode(self):\n thread = mommy.prepare('connectmessages.Thread')\n self.assertEqual(str(thread), \"Thread %s\" % thread.subject)",
"def test_unicode_representation(self):\n student = Student.objects.get(user=self.test_user)\n self.assertEqual(unicode(student), \"test@test.co... | [
"0.7344731",
"0.71959597",
"0.6907719",
"0.68475324",
"0.68000567",
"0.67501134",
"0.6746139",
"0.6705036",
"0.666691",
"0.6655922",
"0.65556186",
"0.6528937",
"0.65061873",
"0.64942676",
"0.6489136",
"0.6488789",
"0.6452057",
"0.6400791",
"0.6366024",
"0.63625705",
"0.635013... | 0.79284596 | 0 |
Build the encoder network input_tensor = 1 batch = 1 episode (batch size, neurons) Assumes second last item is degraded input, last is target | def _build_rnn(self, input_tensor):
w_trainable = False
x_shift_trainable = False
eta_trainable = True
input_shape = input_tensor.get_shape().as_list()
input_area = np.prod(input_shape[1:])
batch_input_shape = (-1, input_area)
filters = self._hparams.filters + self._hparams.bias_neurons
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_encoder(self, hparams, is_training):\n with tf.variable_scope(\"trajectory_encoder\"):\n with tf.name_scope(\"source_placeholder\"):\n input_phs = list_ops.list_placeholder(self.num_gpu, (None, self.input_length, self.input_dims), tf.float32)\n for ph in input_phs:\n tf.add_to... | [
"0.6593034",
"0.65355295",
"0.6466942",
"0.6456194",
"0.6428047",
"0.63008356",
"0.6207852",
"0.6181998",
"0.6170921",
"0.6156885",
"0.61471003",
"0.6146541",
"0.61147505",
"0.61057067",
"0.60913515",
"0.6082964",
"0.6064296",
"0.6049051",
"0.6045714",
"0.60414076",
"0.604104... | 0.5959482 | 33 |
Remove ignored empty subelements from list subelems1. | def _remove_ignored_empty_subelems(subelems1, subelems2, parent_path, ignore_namespaces, ignored_empty_tags, debug_stream):
ds = debug_stream
if ds: print >>ds, "parent_path: %s" % parent_path
removed = []
for i, subelem1 in enumerate(subelems1):
if len(subelem1.getchildren()) > 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_empty(lst: List[T]) -> List[T]:\n return [elem for elem in lst if elem]",
"def remove_blanks_list(src):\n return [el for el in src if el]",
"def _filter_empty(lst):\n return [cell for cell in lst if cell is not Sudoku.EMPTY_CELL]",
"def clean_duplicate(self):\r\n self.elements =... | [
"0.60873926",
"0.59045243",
"0.5823922",
"0.56260103",
"0.5594796",
"0.5461794",
"0.54547054",
"0.54202217",
"0.54115343",
"0.54080206",
"0.54053164",
"0.54018784",
"0.5378819",
"0.53624374",
"0.5319633",
"0.5278939",
"0.52657926",
"0.52614665",
"0.5253238",
"0.52442133",
"0.... | 0.8047649 | 0 |
Returns the main saver nodes in the scene or an empty list. | def get_main_saver_node(self):
# list all the saver nodes in the current file
all_saver_nodes = self.comp.GetToolList(False, 'Saver').values()
saver_nodes = []
for saver_node in all_saver_nodes:
if saver_node.GetAttrs('TOOLS_Name').startswith(
self._main_outpu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scenelist(self):\n return self.caller.player_ob.db.random_scenelist or []",
"def get_scenes(self):\n scenes = []\n for i in self.scenes:\n scenes.append(self.scenes[i])\n\n return scenes",
"def getScene():\n #print \"servers direct scenes are \",soya.IDLER.scenes[:... | [
"0.6589055",
"0.6212284",
"0.6154428",
"0.6099545",
"0.60515314",
"0.60497767",
"0.602391",
"0.59723955",
"0.5965573",
"0.59623826",
"0.5957704",
"0.5957704",
"0.5957704",
"0.59216017",
"0.5908601",
"0.5896296",
"0.5854739",
"0.5794002",
"0.5746687",
"0.57233626",
"0.56957334... | 0.74653554 | 0 |
Returns an int64_list from a bool / enum / int / uint. | def _int64_feature(value):
return tf.train.Feature(
int64_list=tf.train.Int64List(value=[int(v) for v in value])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _BoolsToInts(arg_list):\n result = []\n for arg in arg_list:\n if isinstance(arg, (list, tuple)):\n result.append(_BoolsToInts(arg))\n elif arg is True:\n result.append(1)\n elif arg is False:\n result.append(0)\n else:\n result.append(arg)\n\n return result",
"def convertT... | [
"0.68822104",
"0.6595804",
"0.6461252",
"0.6448161",
"0.6367609",
"0.62926817",
"0.6269916",
"0.621823",
"0.6104528",
"0.59533274",
"0.5947467",
"0.5863832",
"0.5863832",
"0.58563983",
"0.5844792",
"0.58434534",
"0.5829844",
"0.5801042",
"0.5793561",
"0.5793561",
"0.5793561",... | 0.5901199 | 11 |
Helper for creating a serialized Example proto. | def _create_serialized_example(speakers, utterances, emotions):
example = tf.train.SequenceExample(feature_lists=tf.train.FeatureLists(feature_list={
'utterances': tf.train.FeatureList(
feature=[_float_feature(u) for u in utterances]),
'speakers': tf.train.FeatureList(
feature=[_int64_feature(spea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_serialized_example(predecessor, current, successor, vocab):\n example = tf.train.Example(features=tf.train.Features(feature={\n \"decode_pre\": _int64_feature(_sentence_to_ids(predecessor, vocab)),\n \"encode\": _int64_feature(_sentence_to_ids(current, vocab)),\n \"decode_post\": _int64... | [
"0.69729173",
"0.6940555",
"0.6913458",
"0.66323334",
"0.6630081",
"0.64159954",
"0.636575",
"0.62038136",
"0.61284894",
"0.6119847",
"0.6066663",
"0.6048224",
"0.60357213",
"0.6022706",
"0.5981263",
"0.59517866",
"0.59373945",
"0.5922947",
"0.5785494",
"0.578472",
"0.5734378... | 0.698503 | 0 |
Given a tensor name, returns the name of the op generating the tensor, prefixed with a special scope indicating that the op has been added by Sparkdl. | def _getSparkDlOpName(self, tensor_name):
op_name = tfx.op_name(tensor_name)
return tfx.add_scope_to_name(scope=self.SPARKDL_OP_SCOPE, name=op_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensor_flow_name(self):\n # Just to make sure we don't include characters that aren't allowed in TF\n # opnames, we strip all the non-word characters from the tag.\n tag = re.sub(r'\\W+', '', self.tag)\n if tag: tag = '_'+tag\n return '%s_%s%s' % (self.dtype, '_'.join(str(x) for x in self.shape)... | [
"0.7050225",
"0.67406046",
"0.6703274",
"0.664962",
"0.66281646",
"0.6575906",
"0.65679836",
"0.64626014",
"0.6395855",
"0.62461805",
"0.62423223",
"0.61312103",
"0.6037407",
"0.5957678",
"0.5956572",
"0.59418094",
"0.59319746",
"0.5930965",
"0.5918136",
"0.5770822",
"0.57148... | 0.7817917 | 0 |
Returns the status of the application, whether the application is healthy or not. | def is_healthy():
status = HEALTH_AGGREGATOR.is_healthy()
if status is True:
status_code = 200
else:
status_code = 503
return Response({}, status_code, mimetype='application/json') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n if self.app_id:\n return self.yarn_api.apps_info(self.app_id)\n else:\n raise KnitException(\"Cannot get status, app not started\")",
"def getStatus(self):\n pid = self._getPid()\n if pid:\n if q.system.process.isPidAlive(pid):\n ... | [
"0.78126806",
"0.77946573",
"0.7324687",
"0.72223175",
"0.72223175",
"0.7090448",
"0.7066058",
"0.69669664",
"0.69631153",
"0.6915402",
"0.68789726",
"0.6872001",
"0.68718374",
"0.6858139",
"0.68492746",
"0.68426496",
"0.68109775",
"0.68006766",
"0.67740697",
"0.67573667",
"0... | 0.0 | -1 |
Returns the list of all the resources, their condition (Healthy / Unhealthy), and reason that caused it. | def get_resource_state():
output = [f'{"S. No.":6}\t{"Resource":50}\t{"Health State":12}\t{"Reason":100}\n']
for index, resource in enumerate(HEALTH_AGGREGATOR.resource_state):
output.append(
f'{index + 1:<6}\t{resource:<50}\t'
f'{"Healthy" if HEALTH_AGGREGATOR.resource_state[re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_resources(self, statuses: [], resource_age_mins: int):\n existing_template_names = {}\n all_resources = self._get_all_resources()\n filtered_resources = self._filter_resources_by_age(all_resources, resource_age_mins)\n filtered_resources = self._filter_resources_by_status(filte... | [
"0.6243034",
"0.61976194",
"0.617127",
"0.59208584",
"0.58697176",
"0.5862257",
"0.58564204",
"0.5842596",
"0.5831965",
"0.58103293",
"0.5807915",
"0.5807915",
"0.5807915",
"0.5798504",
"0.5783467",
"0.5764604",
"0.5760925",
"0.57560474",
"0.5752172",
"0.5735913",
"0.5735913"... | 0.6228301 | 1 |
Check if two boards are equal | def board_equals(board, newboard):
return (newboard == board).all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other) -> None:\n\t\tfor k, v in enumerate(self.board):\n\t\t\tif v != other.board[k]:\n\t\t\t\treturn False\n\t\treturn True",
"def __eq__(self, other):\n for row in range( self.n ):\n if self.board[row] != other.board[row]:\n return False\n return True",... | [
"0.76765525",
"0.7590167",
"0.7520879",
"0.73166174",
"0.7049794",
"0.6997381",
"0.69779974",
"0.696249",
"0.69501203",
"0.6933911",
"0.6929893",
"0.68988365",
"0.6865647",
"0.68118745",
"0.6808368",
"0.67976785",
"0.67858136",
"0.6755733",
"0.673824",
"0.67163175",
"0.660529... | 0.7748529 | 1 |
A context manager for a temporary mount. | def mounted(source, dest=None, opts=None, fs_type=None,
mount_attempts=1, umount_attempts=3):
params = []
if opts:
params.extend(['-o', ','.join(opts)])
if fs_type:
params.extend(['-t', fs_type])
if dest is None:
dest = tempfile.mkdtemp()
clean_up = True
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_mounted_temp(self, path: str) -> \"Container\":\n _args = [\n Arg(\"path\", path),\n ]\n _ctx = self._select(\"withMountedTemp\", _args)\n return Container(_ctx)",
"def TempDirContextManager(prefix='tmp', base_dir=None, storage=None,\n sudo... | [
"0.6684779",
"0.6623937",
"0.6605116",
"0.65905076",
"0.6294695",
"0.62732834",
"0.61629766",
"0.61086386",
"0.6097886",
"0.6067137",
"0.60359883",
"0.6020762",
"0.6004185",
"0.59716064",
"0.5940682",
"0.58644783",
"0.58579874",
"0.58278334",
"0.5798571",
"0.57862985",
"0.575... | 0.644671 | 4 |
Unpickle, restoring unpicklable relationships | def __setstate__(self, state):
self.__dict__ = state
self.get_esoh_solver = lru_cache()(self._get_esoh_solver) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__pickle_unpickle(self):\n pass",
"def restore(self, serialized: bytes) -> None:\n loaded_state = pickle.loads(serialized)\n self.__dict__.update(loaded_state.__dict__)",
"def _restore_sub_obj(\n self,\n attr_name: pathlib.Path\n ):\n return pickle.load(attr... | [
"0.73612714",
"0.672248",
"0.6688589",
"0.64883816",
"0.6374593",
"0.62724084",
"0.6263405",
"0.6250536",
"0.61748654",
"0.61724526",
"0.610855",
"0.6080979",
"0.5913445",
"0.5899791",
"0.58983",
"0.5894404",
"0.58572745",
"0.58443195",
"0.58423454",
"0.5838881",
"0.5789083",... | 0.0 | -1 |
Test that the configured schema name is returned for a topic | def test_schema_name_for_topic(self):
self.assertEqual(
eventlogging.topic.schema_name_for_topic('test_topic'),
'TestSchema'
)
with self.assertRaises(eventlogging.topic.TopicNotConfigured):
eventlogging.topic.schema_name_for_topic('not a schema') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_regex_schema_lookup(self):\n test_topic_config = {\n '/^regex\\.*/': {\n 'schema_name': 'regex.schema'\n }\n }\n\n eventlogging.topic.update_topic_config(test_topic_config)\n\n self.assertEqual(\n eventlogging.topic.schema_name_fo... | [
"0.7529392",
"0.676147",
"0.6198551",
"0.6052444",
"0.59660745",
"0.5945555",
"0.58825374",
"0.5851181",
"0.58297294",
"0.5794581",
"0.57934237",
"0.5782582",
"0.5781492",
"0.5749154",
"0.57409734",
"0.57311475",
"0.5717271",
"0.56910455",
"0.56830275",
"0.5672669",
"0.565822... | 0.87503934 | 0 |
Plot 3D vectors in 3D | def plot3darray(vec, *args, **kwargs):
vec = np.reshape(vec, (-1, 3))
return plt.plot(vec[:, 0], vec[:, 1], vec[:, 2], *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_3d(vector_array, save_plot_dir):\n principal_df = pd.DataFrame(data=vector_array, columns=['pc1', 'pc2', 'pc3'])\n fig = plt.figure()\n ax = fig.add_subplot(111, projection='3d')\n\n xs = principal_df['pc1']\n ys = principal_df['pc2']\n zs = principal_df['pc3']\n ax.scatter(xs, ys, zs... | [
"0.7357655",
"0.7181526",
"0.70493865",
"0.7042275",
"0.701293",
"0.6982947",
"0.69759756",
"0.6970553",
"0.673817",
"0.6735246",
"0.6713215",
"0.6678552",
"0.66756463",
"0.6664053",
"0.666278",
"0.6576681",
"0.65756327",
"0.6572264",
"0.65662205",
"0.655414",
"0.6530669",
... | 0.76035553 | 0 |
Retrieve Post selected by slug in JSON format | def json_post_by_slug(slug):
post_result = posts_base.filter(Post.slug==slug).first()
if post_result is None:
abort(404)
post_dict = get_public_post_dict(post_result[0], post_result[2])
return jsonify(post_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_get_post(request, post_id):\n\n post = get_object_or_404(Post, id=post_id)\n\n json = serializers.serialize(\"json\", [post], fields=(\n \"pub_time\", \"_text_rendered\", \"title\", \"text\", \"image\",\n \"image_width\", \"image_height\", \"replies\", \"tags\"\n ))\n\n return Htt... | [
"0.66719913",
"0.64250666",
"0.63932985",
"0.62193274",
"0.61872536",
"0.6180209",
"0.61666185",
"0.60169053",
"0.599319",
"0.5987742",
"0.5890632",
"0.58787733",
"0.58772683",
"0.58458585",
"0.5832694",
"0.5815097",
"0.5812258",
"0.5770354",
"0.572046",
"0.5693896",
"0.56920... | 0.7541584 | 0 |
The identity block is the block that has no conv layer at shortcut. | def identity_building_block(input_tensor, kernel_size, filters, stage, block, training=None):
filters1, filters2 = filters
if tf.keras.backend.image_data_format() == 'channels_last':
bn_axis = 3
else:
bn_axis = 1
conv_name_base = 'res' + str(stage) + block + '_branch'
bn_name_ba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_block(self, input_tensor, filters, activation, stage, block, start_with_batch_norm = True):\n\n # Set the naming convention\n conv_name_base = 'res' + str(stage) + block + '_branch'\n batch_norm_name_base = 'batch_norm' + str(stage) + block + '_branch'\n\n x_shortcut = inpu... | [
"0.6863723",
"0.6613831",
"0.65261513",
"0.64593554",
"0.64359504",
"0.6433214",
"0.638604",
"0.6383168",
"0.6336141",
"0.63211936",
"0.63197666",
"0.62679076",
"0.62557864",
"0.624875",
"0.62460726",
"0.6225587",
"0.62168217",
"0.61974704",
"0.61882806",
"0.61882806",
"0.612... | 0.5732476 | 34 |
A block that has a conv layer at shortcut. | def conv_building_block(input_tensor, kernel_size, filters, stage, block, strides=(2, 2), training=None):
filters1, filters2 = filters
if tf.keras.backend.image_data_format() == 'channels_last':
bn_axis = 3
else:
bn_axis = 1
conv_name_base = 'res' + str(stage) + block + '_branch'
bn_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv_block(self, output_channel, filter_, activate):\n return self.add_layer(conv_block, output_channel, filter_, activate)",
"def __init__(self, dim, padding_type, norm_layer, use_dropout, use_bias):\r\n super(ResnetBlock, self).__init__()\r\n self.conv_block = self.build_conv_block(dim... | [
"0.70699036",
"0.64443517",
"0.64287764",
"0.6405969",
"0.63976103",
"0.6366892",
"0.6366892",
"0.6316457",
"0.63042253",
"0.62855816",
"0.62733924",
"0.6247351",
"0.6237473",
"0.62362826",
"0.62230587",
"0.62127405",
"0.6167685",
"0.61336136",
"0.61248565",
"0.61248565",
"0.... | 0.55873454 | 89 |
A block which applies conv followed by multiple identity blocks. | def resnet_block(input_tensor, size, kernel_size, filters, stage, conv_strides=(2, 2), training=None):
x = conv_building_block(input_tensor, kernel_size, filters, stage=stage,
strides=conv_strides, block='block_0',
training=training)
for i in range(size -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_block(filters, stage, block):\n\n def layer(input_tensor):\n conv_params = get_conv_params()\n bn_params = get_bn_params()\n conv_name, bn_name, relu_name, sc_name = handle_block_names(stage, block)\n\n x = BatchNormalization(name=bn_name + '0', **bn_params)(input_tensor... | [
"0.67161036",
"0.671363",
"0.66017777",
"0.659006",
"0.65577346",
"0.65103227",
"0.6497052",
"0.6413386",
"0.64049524",
"0.63726693",
"0.63662475",
"0.6362494",
"0.63368106",
"0.6326875",
"0.63124686",
"0.63029474",
"0.6301655",
"0.6270162",
"0.6267877",
"0.6267877",
"0.62654... | 0.0 | -1 |
Instantiates the ResNet architecture. | def resnet(num_blocks, classes=10, training=None):
input_shape = (32, 32, 3)
img_input = layers.Input(shape=input_shape)
if backend.image_data_format() == 'channels_first':
x = layers.Lambda(lambda x: backend.permute_dimensions(x, (0, 3, 1, 2)),
name='transpose')(img_input)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _resnet(arch, block, layers, pretrained, progress, **kwargs):\n model = ResNet(block, layers, **kwargs)\n if pretrained:\n state_dict = load_state_dict_from_url(model_urls[arch], progress=progress)\n model.load_state_dict(state_dict)\n return model",
"def __init__(self):\n self.... | [
"0.68416464",
"0.6734476",
"0.66279775",
"0.6583275",
"0.6381526",
"0.63464487",
"0.6279225",
"0.6233799",
"0.62183166",
"0.6157543",
"0.6128495",
"0.61096853",
"0.60788697",
"0.6077962",
"0.60732657",
"0.60661584",
"0.60580444",
"0.60450524",
"0.6033731",
"0.6006453",
"0.600... | 0.0 | -1 |
fl_get_formbrowser_topform(ptr_flobject) Finds out the form that is currently the first form in the formbrowser visible to the user. | def fl_get_formbrowser_topform(ptr_flobject):
_fl_get_formbrowser_topform = library.cfuncproto(
library.load_so_libforms(), "fl_get_formbrowser_topform",
cty.POINTER(xfdata.FL_FORM), [cty.POINTER(xfdata.FL_OBJECT)],
"""FL_FORM * fl_get_formbrowser_topform(FL_OBJECT * ob)""")
library.chec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fl_set_formbrowser_topform(ptr_flobject, ptr_flform):\n _fl_set_formbrowser_topform = library.cfuncproto(\n library.load_so_libforms(), \"fl_set_formbrowser_topform\",\n cty.c_int, [cty.POINTER(xfdata.FL_OBJECT),\n cty.POINTER(xfdata.FL_FORM)],\n \"\"\"int fl_set_formbrowser_topf... | [
"0.82495654",
"0.70543236",
"0.6692165",
"0.6565622",
"0.6377104",
"0.6065812",
"0.5868449",
"0.5867141",
"0.5820693",
"0.58161795",
"0.5811634",
"0.5795953",
"0.5795953",
"0.5794322",
"0.5751721",
"0.57496995",
"0.5686302",
"0.5678801",
"0.55942607",
"0.5590195",
"0.5563277"... | 0.88938385 | 0 |
fl_get_formbrowser_yoffset(ptr_flobject) > offset Finds out the current vertical offset from top in pixel of a formbrowser. | def fl_get_formbrowser_yoffset(ptr_flobject):
_fl_get_formbrowser_yoffset = library.cfuncproto(
library.load_so_libforms(), "fl_get_formbrowser_yoffset",
cty.c_int, [cty.POINTER(xfdata.FL_OBJECT)],
"""int fl_get_formbrowser_yoffset(FL_OBJECT * ob)""")
library.check_if_flinitialized()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fl_set_formbrowser_yoffset(ptr_flobject, offset):\n _fl_set_formbrowser_yoffset = library.cfuncproto(\n library.load_so_libforms(), \"fl_set_formbrowser_yoffset\",\n cty.c_int, [cty.POINTER(xfdata.FL_OBJECT), cty.c_int],\n \"\"\"int fl_set_formbrowser_yoffset(FL_OBJECT * ob, int offset)... | [
"0.76883155",
"0.6815306",
"0.63925767",
"0.62800264",
"0.6051936",
"0.59256405",
"0.5796087",
"0.5621576",
"0.5567504",
"0.5558454",
"0.5540203",
"0.5527888",
"0.5521293",
"0.5479259",
"0.54022866",
"0.538861",
"0.53879684",
"0.5373583",
"0.5371534",
"0.53263324",
"0.5297352... | 0.8302833 | 0 |
Returns a string representation of the internal structure. | def __str__(self):
s = "--\n"
for element in self:
s += element.__str__() + "\n"
s += "--"
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__ (self):\n\t\tStr = \"\"\n\t\tfor i in self.structref:\n\t\t\tStr = Str + \"%-15s = \"%(i[self.NAME])\n\t\t\tvalue = self.value [i[self.NAME]]\n\t\t\tif isInteger(value):\n\t\t\t\tStr = Str + \"%d, 0x%X\"%(value,value)\n\t\t\t\tif value >= 0x20 and value <= 0xFF:\n\t\t\t\t\tStr = Str + \" '\" + chr (va... | [
"0.76401013",
"0.75780433",
"0.737806",
"0.7371001",
"0.73026323",
"0.7280957",
"0.7232877",
"0.7216389",
"0.7207536",
"0.7200661",
"0.7200661",
"0.7172027",
"0.71693057",
"0.71568936",
"0.71568936",
"0.71568936",
"0.71568936",
"0.71568936",
"0.71568936",
"0.71568936",
"0.715... | 0.0 | -1 |
Adds a new element at the beginning of the list. | def prepend(self, element):
temp = Node(element, None, self.head)
self.size += 1
if self.size <= 1:
self.tail = self.head
self.head = temp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepend(self, item: Any):\n self.insert(0, item)",
"def push(self, item):\n self.list.prepend(item)",
"def add_first(self, e):\n self._insert_between(e, self._head, self._head._next)",
"def add_front(self, item):\n\n self.items.insert(0, item)",
"def prepend(self, x):\n ... | [
"0.7645144",
"0.74540466",
"0.7391316",
"0.73808426",
"0.7307733",
"0.72177297",
"0.71836996",
"0.713922",
"0.7095898",
"0.7085709",
"0.70738816",
"0.6933297",
"0.69114035",
"0.6891791",
"0.68781537",
"0.682188",
"0.67894083",
"0.6745922",
"0.67296624",
"0.6704134",
"0.669013... | 0.7547386 | 1 |
Not Equal comparator override needed to treat None as special case. | def __ne__(self, other):
if other != None:
return self != other
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\n return other != self._cmpkey()",
"def test_equal_on_not_equal_value(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_b, enums.OpaqueDataType.NONE)\n self.assertFalse(a == b)\n self.assert... | [
"0.65781915",
"0.6568875",
"0.6510773",
"0.6498509",
"0.64486724",
"0.6445185",
"0.6441627",
"0.64290476",
"0.64030296",
"0.6344365",
"0.63384914",
"0.63384914",
"0.63384914",
"0.63384914",
"0.6335178",
"0.6294304",
"0.6274809",
"0.62714094",
"0.62714094",
"0.62714094",
"0.62... | 0.6316833 | 16 |
Equal comparator override needed to treat None as special case. | def __eq__(self, other):
if other != None:
return self == other
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __cmp__(self,o):\n\t\tif o != None:\n\t\t\treturn cmp(self.value,o.value)\n\t\telse:\n\t\t\treturn cmp(self.value,0)",
"def none_comparison(func):\n @functools.wraps(func)\n def inner(obj1,obj2):\n if obj1 is not None and obj2 is not None:\n return func(obj1, obj2)\n if obj1 is... | [
"0.70458424",
"0.6012948",
"0.5855398",
"0.5847252",
"0.5752761",
"0.5639236",
"0.5564903",
"0.5561971",
"0.5502965",
"0.5502243",
"0.54622483",
"0.5406374",
"0.5382291",
"0.53739244",
"0.5370734",
"0.53640735",
"0.5348624",
"0.53068304",
"0.5303177",
"0.5302633",
"0.52997214... | 0.5685966 | 5 |
Class constructor. The default maximum amount of elements that a heap may contain is 100. | def __init__(self, maxSize = 100):
self.data = [None] * maxSize
self.size = 0
self.maxSize = maxSize
self._ratingsAdded = [] # A 'private' property to store the ratings of movies already added | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, noOfElements, limitOfRestructuring):\n\n self.heap = [ 'NaN' ] * noOfElements\n self.noOfElements = noOfElements\n self.i = 1\n self.noOfRemovedElements = 0\n self.limitOfRestructuring = limitOfRestructuring",
"def __init__(self):\n # max heap\n ... | [
"0.77659756",
"0.77134633",
"0.7709894",
"0.76250595",
"0.7601998",
"0.7590448",
"0.75754297",
"0.7572874",
"0.7562456",
"0.75383246",
"0.75383246",
"0.75383246",
"0.75302464",
"0.74907875",
"0.7488479",
"0.7438323",
"0.7387267",
"0.73687977",
"0.7335402",
"0.7334932",
"0.732... | 0.0 | -1 |
This method sorts the heap, heapsterheapsort 'maxheap' style. | def sort(self):
def siftDown(start, count):
"""
This method tries to swap down the children's of the branch
given by index 'start', making the lowest.
"""
root = start
while root * 2 + 1 < count:
child = root * 2 + 1 # 'chil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heapsort(heap):\n aux = heap.tamanio\n for i in range(0, heap.tamanio-1):\n quitar(heap)\n heap.tamanio = aux",
"def heap_sort(list):\n pass",
"def heap_sort(A):\n build_max_heap(A)\n for i in range(len(A) - 1, 1, -1):\n A[1], A[i] = A[i], A[1]\n A[0] -= 1\n ma... | [
"0.7954443",
"0.7704634",
"0.7661137",
"0.76418877",
"0.7568516",
"0.7566614",
"0.7566614",
"0.752546",
"0.751029",
"0.74851584",
"0.74764675",
"0.74764675",
"0.74259967",
"0.73818517",
"0.73349744",
"0.7279047",
"0.7161782",
"0.70729274",
"0.69781077",
"0.6911468",
"0.688382... | 0.7289161 | 15 |
Class constructor. By default, it has 200 buckets. | def __init__(self, buckets = 200):
self.data = [None] * buckets
self.slot = [None] * buckets
self.size = buckets | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.bucket_length = 997\n self.bucket_array = [Bucket() for i in range(self.bucket_length)]",
"def __init__(self):\n self.size = 1000\n self.bucket = [None] * self.size",
"def __init__(self):\n self.m = 1000\n self.bucket = [None] * 1000",
"def... | [
"0.83085835",
"0.81867886",
"0.8080716",
"0.8070462",
"0.80031365",
"0.7923197",
"0.7839979",
"0.7578241",
"0.75207067",
"0.741177",
"0.7305787",
"0.72986007",
"0.72080123",
"0.71899796",
"0.7007758",
"0.69700575",
"0.6967752",
"0.69194496",
"0.68415594",
"0.6833852",
"0.6831... | 0.8107324 | 2 |
Returns a string representation of the hash table's content. | def __str__(self):
s = "--\n"
for element in self:
s += element.__str__() + "\n"
s += "--"
"""
# Uncomment if you want to see the internal structure
s = "\n--\n"
for i in xrange(self.size):
s += "%d [%s, %s]\n" % ( i, self.slot[i], self.dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return 'HashTable({!r})'.format(self.items())",
"def __str__(self):\n\n table_list = [self.headers]\n\n for row in self.data:\n table_list.append([row[col] or \"\" for col in self.headers])\n\n return create_table_string(table_list)",
"def get_hash_s... | [
"0.709523",
"0.690549",
"0.6902213",
"0.6829075",
"0.6729887",
"0.6729887",
"0.6685864",
"0.66615003",
"0.6640291",
"0.6523178",
"0.650346",
"0.6426786",
"0.6399151",
"0.63738275",
"0.6373564",
"0.6370942",
"0.63311255",
"0.63195366",
"0.6309758",
"0.6300921",
"0.6294546",
... | 0.0 | -1 |
Not Equal comparator override needed to treat None as special case. | def __ne__(self, other):
if other != None:
return self != other
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\n return other != self._cmpkey()",
"def test_equal_on_not_equal_value(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_b, enums.OpaqueDataType.NONE)\n self.assertFalse(a == b)\n self.assert... | [
"0.65781915",
"0.6568875",
"0.6510773",
"0.6498509",
"0.64486724",
"0.6445185",
"0.6441627",
"0.64290476",
"0.64030296",
"0.6344365",
"0.63384914",
"0.63384914",
"0.63384914",
"0.63384914",
"0.6335178",
"0.6294304",
"0.6274809",
"0.62714094",
"0.62714094",
"0.62714094",
"0.62... | 0.6316833 | 15 |
Equal comparator override needed to treat None as special case. | def __eq__(self, other):
if other != None:
return self == other
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __cmp__(self,o):\n\t\tif o != None:\n\t\t\treturn cmp(self.value,o.value)\n\t\telse:\n\t\t\treturn cmp(self.value,0)",
"def none_comparison(func):\n @functools.wraps(func)\n def inner(obj1,obj2):\n if obj1 is not None and obj2 is not None:\n return func(obj1, obj2)\n if obj1 is... | [
"0.70458424",
"0.6012948",
"0.5855398",
"0.5847252",
"0.5752761",
"0.5639236",
"0.5564903",
"0.5561971",
"0.5502965",
"0.5502243",
"0.54622483",
"0.5406374",
"0.5382291",
"0.53739244",
"0.5370734",
"0.53640735",
"0.5348624",
"0.53068304",
"0.5303177",
"0.5302633",
"0.52997214... | 0.5685966 | 6 |
Returns the valid minimum and maximum integer values of rating to be accepted. | def getValidRatingInputs(self):
min = self.minRatingInput.get()
max = self.maxRatingInput.get()
try:
min = int(min)
except ValueError:
min = 0
try:
max = int(max)
except ValueError:
max = 100
return min, max | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_max_rating(self):\n return self.interaction_data.label.min(), self.interaction_data.label.max()",
"def validate_rating(self, key, value):\n assert value is None or value <= 10 and value >= 0\n return value",
"def get_min_max(ints):\n if not ints:\n return None, None\n if l... | [
"0.68871963",
"0.6037417",
"0.5943928",
"0.59224224",
"0.59139097",
"0.5906557",
"0.5896781",
"0.58612174",
"0.5858479",
"0.5740879",
"0.5719466",
"0.570176",
"0.56268877",
"0.5625947",
"0.5612996",
"0.5598409",
"0.55931854",
"0.55873454",
"0.5583822",
"0.5549162",
"0.5533472... | 0.86774224 | 0 |
Update maxdim to a new (possibly larger) value. If the new_maxdim is larger than the current maxdim, new CG coefficients should be calculated and the cg_dict will be updated. Otherwise, do nothing. | def update_maxdim(self, new_maxdim):
# If self is already initialized, and maxdim is sufficiently large, do nothing
if self and (self.maxdim >= new_maxdim):
return self
# If self is false, old_maxdim = 0 (uninitialized).
# old_maxdim = self.maxdim if self else 0
# O... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateVmaxCritDen(self, newVmax, newCritDen):\r\n Link.updateVmaxCritDen(self, newVmax, newCritDen)\r\n # now update cells, keep length and number of cells the same\r\n for cell in self.cells:\r\n cell.capacity = self.params['qcap'] / 3600.0 # already updated for link\r\n cell.delta = self.p... | [
"0.5415424",
"0.527124",
"0.5225765",
"0.5208541",
"0.51170534",
"0.51067793",
"0.50919217",
"0.5074529",
"0.50702584",
"0.50369895",
"0.5030819",
"0.50169176",
"0.50151",
"0.5014445",
"0.50011855",
"0.49827418",
"0.49399847",
"0.49080595",
"0.4892601",
"0.48839384",
"0.48415... | 0.890233 | 0 |
Function to get the missing number in the array. It uses array index and applies binary search to find the missing element | def missing_number(a, start, end):
mid = (start+end) // 2
if (a[mid] - mid) == 2 and (a[mid-1] - (mid-1)) == 1:
return a[mid]-1
elif a[mid] - mid == 1:
return missing_number(a, mid+1, end)
return missing_number(a, start, mid-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_missing_positive_int_linear(nums):\n\t\n\t# Here's the trick: the first missing positive number must be \n\t# between 1 and len(array) + 1 \t\n\ts = set(nums)\n\t\n\tfor i in range(1, len(nums) + 1):\n\t\tif i not in s:\n\t\t\treturn i",
"def firstMissingPositive(nums):\n\n n = len(nums)\n\n # Ba... | [
"0.74282336",
"0.74006873",
"0.7346324",
"0.7095865",
"0.7034864",
"0.70149314",
"0.68569654",
"0.6775487",
"0.6726845",
"0.6643612",
"0.6504375",
"0.650078",
"0.6283411",
"0.6255586",
"0.62332183",
"0.6200883",
"0.61429423",
"0.6142735",
"0.6136089",
"0.60460436",
"0.6018562... | 0.715457 | 3 |
Create a random maze with given dimensions. | def random(self, width, height, seed = None):
self.grid = [ [''] * width for i in range(height) ]
random.seed(seed)
start = ( random.randint(0, len(self.grid) - 1),
random.randint(0, len(self.grid[0]) - 1)
)
visited = set([start])
self._createP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate(width=20, height=20):\n m = Maze(width, height)\n m.randomize()\n return m",
"def create_maze(size):\n dots = MazeGenerator.generate_dot_positions(size.x, size.y)\n maze = MazeGenerator.create_grid_string(dots, size.x, size.y)\n return maze",
"def get_rand... | [
"0.81536824",
"0.7654686",
"0.72348464",
"0.70972234",
"0.7012057",
"0.6809065",
"0.6768927",
"0.66074973",
"0.6593092",
"0.65481275",
"0.6396931",
"0.63291836",
"0.63126177",
"0.6284645",
"0.6275926",
"0.627424",
"0.6270308",
"0.625854",
"0.62200063",
"0.6209391",
"0.6031401... | 0.6237441 | 18 |
Return a Manifest parsed from the file at `location` or None if this cannot be parsed. | def parse_manifest(location):
mode = 'r'
with open(location, mode) as manifest:
return parse_manifest_data(manifest.read()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(location):\n if not is_podspec(location):\n return\n\n podspec_object = Spec()\n podspec_data = podspec_object.parse_spec(location)\n return build_package(podspec_data)",
"def get(self, location):\n assert location\n try:\n # first use the path as is\n ... | [
"0.58562344",
"0.58349985",
"0.58210677",
"0.57527477",
"0.55973893",
"0.5497127",
"0.53391445",
"0.52457935",
"0.52388185",
"0.5170804",
"0.5119593",
"0.50760597",
"0.5070068",
"0.5002711",
"0.49651408",
"0.49273306",
"0.49158376",
"0.49129593",
"0.49103758",
"0.49025667",
"... | 0.7987999 | 0 |
Get the variant record for a specific variant | def get_var(self, chrom, *pargs, **kwargs):
oname = "vcf_%s" % str(chrom)
if oname not in self._obj:
raise AttributeError("Could not find chromosome '%s'" % chrom)
#fi
return self._obj[oname].get_var(chrom, *pargs, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_variant_by_id(variant_id):\n\n variant = Variant.get(lambda s: s.id == variant_id and s.deletedAt is None)\n if variant is None:\n return variant, \"Variant Not Found !\"\n\n return variant, \"\"",
"def get_event(variant):\n if isinstance(variant, dict) and \"dependenc... | [
"0.6785357",
"0.6437172",
"0.642053",
"0.6210719",
"0.61327404",
"0.61224264",
"0.6091645",
"0.60727954",
"0.59721285",
"0.59281015",
"0.5904911",
"0.57644695",
"0.57592535",
"0.57436377",
"0.5742235",
"0.57272667",
"0.5691172",
"0.56856006",
"0.56748956",
"0.5646046",
"0.564... | 0.0 | -1 |
check if the length of the key is exactly four characters and raise an exception if it isn't ) | def check_len( string_key ) :
if len( string_key ) != 4 :
raise Eggog( "'%s': EGI wants the key to be exactly four characters!" % (string_key, ) )
else :
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_authkey(value):\n if not len(value) == 32:\n raise ValidationError(\n 'Value must be a string containing 32 alphanumeric characters')",
"def check_type( string_key ) : \r\n\r\n if type( string_key ) != type( '' ) : \r\n\r\n # raise self.__class__( \"'%... | [
"0.72827256",
"0.7258681",
"0.70289433",
"0.65476596",
"0.64192337",
"0.6391955",
"0.63831055",
"0.6372131",
"0.63249785",
"0.6269419",
"0.62655115",
"0.62018806",
"0.6201516",
"0.6145788",
"0.61211675",
"0.61047417",
"0.6002564",
"0.5986112",
"0.59737736",
"0.596418",
"0.592... | 0.89149225 | 0 |
use this function to help convert the XYZ color to Lab color | def ft(t):
ft = t ** (1.0 / 3.0) if t > 0.008856 else 7.787 * t + 4 / 29
return ft | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Lab_to_XYZ(cobj, *args, **kwargs):\r\n\r\n illum = cobj.get_illuminant_xyz()\r\n xyz_y = (cobj.lab_l + 16.0) / 116.0\r\n xyz_x = cobj.lab_a / 500.0 + xyz_y\r\n xyz_z = xyz_y - cobj.lab_b / 200.0\r\n \r\n if math.pow(xyz_y, 3) > color_constants.CIE_E:\r\n xyz_y = math.pow(xyz_y, 3)\r\n ... | [
"0.80680877",
"0.8039829",
"0.79639745",
"0.79218674",
"0.7571032",
"0.75506425",
"0.7220851",
"0.7195475",
"0.7195235",
"0.6910048",
"0.68040377",
"0.6740893",
"0.6738716",
"0.67074794",
"0.6666223",
"0.66342336",
"0.6604",
"0.6582574",
"0.6561643",
"0.6557854",
"0.65265197"... | 0.0 | -1 |
Checks whether the other object is precisely of type Pred | def __eq__(self, other):
return type(other) == Pred | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __le__(self, other):\n return isinstance(other, Pred)",
"def __ge__(self, other):\n return type(other) == Pred or (isinstance(other, RealPred) and other <= self)",
"def __ge__(self, other):\n return type(other) == Pred or (isinstance(other, GPred) and other <= self)",
"def check_pred... | [
"0.7989573",
"0.691933",
"0.65437293",
"0.6371689",
"0.62266195",
"0.6081958",
"0.6079807",
"0.5973649",
"0.57671505",
"0.5752512",
"0.5745007",
"0.5717215",
"0.56954515",
"0.5656266",
"0.561868",
"0.5594256",
"0.55892855",
"0.55669737",
"0.5541569",
"0.5539564",
"0.55233693"... | 0.788401 | 1 |
Checks whether the other object is a Pred (including subclasses) | def __le__(self, other):
return isinstance(other, Pred) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return type(other) == Pred",
"def __ge__(self, other):\n return type(other) == Pred or (isinstance(other, RealPred) and other <= self)",
"def __ge__(self, other):\n return type(other) == Pred or (isinstance(other, GPred) and other <= self)",
"def check_predicat... | [
"0.72877574",
"0.6560735",
"0.6254987",
"0.60644215",
"0.6023281",
"0.59898055",
"0.5831223",
"0.57459927",
"0.573637",
"0.5680956",
"0.5669229",
"0.55886406",
"0.55696404",
"0.5550624",
"0.5522853",
"0.5522019",
"0.55095553",
"0.55095553",
"0.55082124",
"0.5502657",
"0.54914... | 0.76817876 | 0 |
Return a string, with leading underscore | def __str__(self):
if self.sense:
return "_{}_{}_{}".format(*self)
else:
return "_{}_{}".format(*self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_underscore(text):\n return f\"__{text}__\"",
"def underscore(text):\n # return '__'+text.replace(' ','__') + '__'\n return text.replace(' ', '__')",
"def _with_underscore(cls, key):\n try:\n return key.replace(\"-\", \"_\")\n except AttributeError:\n return ... | [
"0.80002666",
"0.79894155",
"0.78204006",
"0.76461875",
"0.7317165",
"0.7145789",
"0.71382326",
"0.70918024",
"0.6994601",
"0.68601984",
"0.685701",
"0.67795587",
"0.6767514",
"0.67275536",
"0.67186755",
"0.6694951",
"0.6694092",
"0.66866255",
"0.6668597",
"0.660507",
"0.6565... | 0.0 | -1 |
Checks whether the other GPred underspecifies or equals this GPred | def __ge__(self, other):
return type(other) == Pred or (isinstance(other, GPred) and other <= self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __le__(self, other):\n return isinstance(other, GPred) and (self.name == '?' or self.name == other.name)",
"def __ge__(self, other):\n return type(other) == Pred or (isinstance(other, RealPred) and other <= self)",
"def __eq__(self, other):\n return type(other) == Pred",
"def __eq__(... | [
"0.7768122",
"0.7301095",
"0.724538",
"0.68995285",
"0.6839322",
"0.68281305",
"0.67866725",
"0.6769135",
"0.6765716",
"0.6674404",
"0.6570947",
"0.65578675",
"0.6503561",
"0.6490967",
"0.6480386",
"0.64562446",
"0.64560777",
"0.64406484",
"0.6425388",
"0.64242107",
"0.641671... | 0.7680136 | 1 |
Instantiate from a dictionary mapping features to values | def _from_normalised_dict(cls, dictionary):
if 'cvarsort' in dictionary and dictionary['cvarsort'] != cls.cvarsort:
raise PydmrsValueError('{} must have cvarsort {}, not {}'.format(cls.__name__,
cls.cvarsort,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt) -> 'Features':\n return util.deserialize_model(dikt, cls)",
"def dict_to_feature(d):\n f = ee.Feature(None,ee.Dictionary(d))\n return f",
"def dict_to_example(dictionary):\n features = {}\n for k, v in six.iteritems(dictionary):\n features[k] = tf.train.Feature(int64_... | [
"0.6945418",
"0.6687065",
"0.64480686",
"0.6420319",
"0.6304808",
"0.6287154",
"0.6133221",
"0.60973674",
"0.6094694",
"0.6035275",
"0.600433",
"0.6002844",
"0.59536535",
"0.59388053",
"0.5912897",
"0.5825443",
"0.5800749",
"0.5800749",
"0.5788094",
"0.5785598",
"0.5770132",
... | 0.0 | -1 |
Checks whether this Sortinfo underspecifies or equals the other Sortinfo. Features can be underspecified using '?', or 'u', or None. | def __le__(self, other):
return (self.cvarsort == 'i' or self.cvarsort == other.cvarsort) \
and all(other[key] == value for key, value in self.iter_specified()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, AdditionalFeatures):\n return False\n\n return self.__dict__ == other.__dict__",
"def __eq__(self, other):\n return (isinstance(other, type(self)) and (self.get_all_features() == other.get_all_features()))",
"def __cmp__(self, ... | [
"0.6070401",
"0.5863833",
"0.5821739",
"0.57886076",
"0.57441217",
"0.57098776",
"0.56863517",
"0.56498265",
"0.5561309",
"0.5538162",
"0.55137753",
"0.54744035",
"0.54550236",
"0.5426506",
"0.5401985",
"0.53902215",
"0.5379935",
"0.53799117",
"0.5349858",
"0.53330594",
"0.53... | 0.5760416 | 4 |
Construct a datastructure from structured data contained in a json file. | def from_json(cls, filepath):
#If file cannot be found, create an empty file and write an empty cls data into it.
import os
if (os.path.isfile(filepath) == False):
empty_cls = cls()
empty_cls.to_json(filepath)
print('New Json Created: Type=', empty_cls.data['t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json_file(cls, json_file):\n with tf.io.gfile.GFile(json_file, \"r\") as reader:\n text = reader.read()\n return cls(**json.loads(text))",
"def from_json(cls, fname):\n d = read_json(fname)\n return cls.from_dict(d)",
"def from_json_file(cls, json_file):\n wit... | [
"0.70568234",
"0.70331746",
"0.6935122",
"0.6907662",
"0.68670607",
"0.686026",
"0.68299675",
"0.680536",
"0.680536",
"0.680536",
"0.6803864",
"0.67914397",
"0.6778058",
"0.67400634",
"0.6697472",
"0.6697084",
"0.6631146",
"0.66303545",
"0.6536246",
"0.65114516",
"0.6479827",... | 0.6241394 | 29 |
If user voted before for some post, the view will not add same record to DB. | def test_vote_view_dont_allow_to_vote_multiple_times(self):
self.client.login(username="John", password="newpass1234")
votes_len = len(PostVotes.objects.all())
try:
with transaction.atomic():
response1 = self.client.post('/posts/1/vote/', {"vote": "1"})
except... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_vote(request):\n if request.method == 'POST':\n user = request.user\n post_id = request.data['post_id']\n try:\n post = Post.objects.get(pk=post_id)\n except Post.DoesNotExist:\n return Response(status=status.HTTP_404_NOT_FOUND)\n\n is_positive =... | [
"0.65567726",
"0.6152567",
"0.60525256",
"0.60126126",
"0.5974876",
"0.59715676",
"0.5938795",
"0.5910688",
"0.5817493",
"0.5779226",
"0.5763908",
"0.57561576",
"0.5731106",
"0.5719798",
"0.5673531",
"0.56513643",
"0.56011975",
"0.557869",
"0.5566654",
"0.55463964",
"0.551864... | 0.57435757 | 12 |
Create the api flask app | def create_app(config_name):
from webapi.models import User, Event, Rsvp
api = Blueprint('api', __name__)
app = FlaskAPI(__name__, instance_relative_config=True)
CORS(app)
Swagger(app, template_file="docs.yml")
app.config.from_pyfile('config.py')
app.config.from_object(app_config[config_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app():\r\n app = Flask(__name__, instance_relative_config=False)\r\n app.config.from_object('config.Config') \r\n \r\n api = Api(app) \r\n \r\n with app.app_context():\r\n from .flights import TicketRoute, FlightRoute\r\n api.add_resource(TicketRoute,\"/api/ticket... | [
"0.8327965",
"0.8242621",
"0.8167216",
"0.81209785",
"0.811774",
"0.8066591",
"0.80617046",
"0.80022544",
"0.79124504",
"0.7880826",
"0.7843001",
"0.78110445",
"0.7779304",
"0.7741042",
"0.77386755",
"0.7710511",
"0.7679554",
"0.765608",
"0.7652868",
"0.7588703",
"0.7586857",... | 0.78834623 | 9 |
Class constructor, takes the same arguments as the builtin dict class. _factory argument expects dictlike class (dict by default). OrderedDict is useful to use. | def __init__(self, seq=None, _factory=dict, **kwargs):
self._factory = _factory
self.__dict__ = _factory()
self.__dict__.update(seq or [], **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, default_factory=None, **kwargs): # known case of _collections.defaultdict.__init__\n pass",
"def __init__(self, factory, *args, **kwargs):\n super(HelperDict, self).__init__(*args, **kwargs)\n self.factory = factory",
"def __init__(self, *args, **kwargs):\n dict._... | [
"0.75063807",
"0.7486621",
"0.7137487",
"0.69422853",
"0.69422853",
"0.68224156",
"0.67333937",
"0.66059273",
"0.6483352",
"0.6449121",
"0.6434168",
"0.6410364",
"0.6392783",
"0.63687307",
"0.6355196",
"0.633188",
"0.63273394",
"0.63273394",
"0.63139564",
"0.6303666",
"0.6282... | 0.6537128 | 8 |
Returns true if all positions overlap within a certain threshold | def overlap(id1, id2, th):
first = [int(pos) for pos in id1[:-2].replace('-', ':').split(':')[1:]]
second = [int(pos) for pos in id2[:-2].replace('-', ':').split(':')[1:]]
if all([abs(first[0] - second[0]) <= th,
first[1] == second[1],
first[2] == second[2],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_overlap(current, hit, overlap = 200):\n for prev in current:\n p_coords = prev[2:4]\n coords = hit[2:4]\n if get_overlap(coords, p_coords) >= overlap:\n return True\n return False",
"def _overlap(x1, w1, x2, w2):\r\n if x1+w1 < x2-w2: return False\r\n if x1-w1 > ... | [
"0.69130903",
"0.6816558",
"0.6797546",
"0.67819244",
"0.6711758",
"0.66718805",
"0.66590476",
"0.6657999",
"0.6631553",
"0.659259",
"0.6582453",
"0.65530163",
"0.6528308",
"0.65192884",
"0.6500429",
"0.6482811",
"0.6471511",
"0.64666826",
"0.64298123",
"0.6425962",
"0.642453... | 0.0 | -1 |
Get OS Version for instances. | def get_os_version(instance):
if instance.cloud == 'aws':
client = boto3.client('ec2', instance.region)
image_id = client.describe_instances(InstanceIds=[instance.id])['Reservations'][0]['Instances'][0]['ImageId']
return '16.04' if '16.04' in client.describe_images(ImageIds=[image_id])['Imag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_os_version(self):\n\t\treturn call_sdk_function('PrlVmCfg_GetOsVersion', self.handle)",
"def get_osversion(self):\n\t\treturn call_sdk_function('PrlFoundVmInfo_GetOSVersion', self.handle)",
"def get_os_version(self):\n\t\treturn call_sdk_function('PrlSrvInfo_GetOsVersion', self.handle)",
"def os_vers... | [
"0.79875946",
"0.79586005",
"0.7936079",
"0.7702793",
"0.76817834",
"0.75905967",
"0.7469308",
"0.7279414",
"0.72768956",
"0.71630955",
"0.7093232",
"0.69964516",
"0.6866415",
"0.6838467",
"0.67755955",
"0.6670259",
"0.6637329",
"0.6612405",
"0.6551434",
"0.6539134",
"0.65291... | 0.7800671 | 3 |
Transforms a 3D image array into a stack of strided squares | def imageRGB_as_strided(img, kernel_size=224, stride=32):
for ch in range(3):
channel = img[:,:,ch]
new_channel, x0, y0 = image2d_as_strided(channel, kernel_size=kernel_size, stride=stride)
if ch == 0:
new_img = np.zeros(new_channel.shape + (3,), dtype=np.uint8)
new_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess_3d(im_stack):\n im_stack /= 127.5\n im_stack -= 1.0\n return im_stack",
"def makestack(inputList):\n stack = []\n for img in inputList:\n if img.ndim == 2:\n stack.append(img[numpy.newaxis, ...])\n elif img.ndim == 3:\n stack.append(img)\n \n ... | [
"0.6696273",
"0.649901",
"0.64032286",
"0.6378003",
"0.6369362",
"0.62527514",
"0.6252344",
"0.62478673",
"0.62177765",
"0.62166095",
"0.62133825",
"0.6212621",
"0.6197302",
"0.61411",
"0.6066334",
"0.60573846",
"0.6042998",
"0.60328686",
"0.60328686",
"0.60328686",
"0.595025... | 0.56808317 | 51 |
Calculates the IoU score given two boxes. | def intersection_over_union_from_boxes(boxA, boxB):
# determine the (x, y)-coordinates of the intersection rectangle
xA = max(boxA[0], boxB[0])
yA = max(boxA[1], boxB[1])
xB = min(boxA[2], boxB[2])
yB = min(boxA[3], boxB[3])
# compute the area of intersection rectangle
interArea = max(0, xB -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IOU(self, box1, box2):\n\n\t\txmin_1, ymin_1, xmax_1, ymax_1 = map(int, box1)\n\t\txmin_2, ymin_2, xmax_2, ymax_2 = map(int, box2)\n\n\t\t# Evaluator to floats : YOU SHALL NOT PASS!!!\n\t\t# Seriously, don't pass floats.\n\n\t\t\"\"\"\n\t\t\tbox has format (x1,y1,x2,y2)\n\t\t\twhere x1,y1 is top left corner\n\... | [
"0.8232943",
"0.7747916",
"0.7723805",
"0.77119595",
"0.7681055",
"0.7601882",
"0.74615335",
"0.74348414",
"0.7381097",
"0.73438334",
"0.73378426",
"0.7334757",
"0.7329097",
"0.7280645",
"0.72627085",
"0.72627085",
"0.72585803",
"0.7240356",
"0.7240356",
"0.72254574",
"0.7222... | 0.0 | -1 |
Run nonmax suppression algorithm on bounding boxes. Delete "other" boxes from predictions. | def nonmax_suppression(pred_labels, probabilities, x0, y0, windowsize, overlap_thr=0.1):
# define list of proposals as list of indices over all predictions
proposals = np.arange(0, len(pred_labels), dtype='int')
# intialize final list of boxes
final = []
# delete all boxes labeled as "other"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_max_suppression(self, filtered_boxes, box_classes, box_scores):\n box_predictions = []\n predicted_box_classes = []\n predicted_box_scores = []\n for label in range(len(self.class_names)):\n # for each class\n boxes = []\n class_tmp = []\n ... | [
"0.7609908",
"0.7309103",
"0.7156956",
"0.7019556",
"0.6995653",
"0.6962792",
"0.6932959",
"0.68343633",
"0.6735911",
"0.67253315",
"0.6664882",
"0.66249186",
"0.66177607",
"0.6614669",
"0.6520627",
"0.65198725",
"0.64789647",
"0.6394972",
"0.6344385",
"0.6342206",
"0.6339941... | 0.712029 | 3 |
Sanitizes the reviewed string by removing punctuation and stop words | def sanitize(review):
# c) Remove all punctuation, as well as the stop-words.
# First replace punctuations with empty char then tokenize it
# Replace punctuation with spaces using fast method
clean = review.translate(review.maketrans(string.punctuation,
' ' * len(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanString(self, s):\r\n s = s.lower()\r\n for x in s: \r\n if x in punctuation:\r\n s = s.replace(x, '')\r\n return s",
"def clean_text ( self, text ) :\n text = BeautifulSoup ( text , \"lxml\" ).text # HTML decoding\n text = text.lower ( ) # l... | [
"0.78122836",
"0.7746282",
"0.7746282",
"0.7746282",
"0.7746282",
"0.7746282",
"0.7746282",
"0.7641063",
"0.75522417",
"0.7552097",
"0.7534518",
"0.75256824",
"0.7490996",
"0.7484867",
"0.7478481",
"0.7422949",
"0.74216217",
"0.7402721",
"0.7368999",
"0.7368086",
"0.7355277",... | 0.7883673 | 0 |
Loads a pretrained resnet for the vision model. | def create_vision_model(image_dims=(224, 224, 3), weights='imagenet'):
base_model = tf.keras.applications.ResNet50V2(
weights=weights, include_top=False, input_shape=image_dims)
inp = tf.keras.layers.Input(shape=image_dims)
x = base_model(inp)
x = tfkl.GlobalAveragePooling2D()(x)
len_visual_description ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet46(pretrained=False):\n model = ResNet(BasicBlock, [3, 6, 10, 3])\n if pretrained:\n pass\n #model.load_state_dict(model_zoo.load_url(model_urls['resnet18']))\n return model",
"def _resnet(arch, block, layers, pretrained, progress, **kwargs):\n model = ResNet(block, layers, **... | [
"0.74834746",
"0.73818487",
"0.7348241",
"0.7264618",
"0.71854216",
"0.718426",
"0.71669805",
"0.7113567",
"0.71053666",
"0.7078506",
"0.7078506",
"0.7078506",
"0.7078506",
"0.7078506",
"0.7058108",
"0.70563084",
"0.70329475",
"0.70329475",
"0.70329475",
"0.70091623",
"0.6969... | 0.0 | -1 |
Patch {resource} with 'identifier'. | def on_post_resource(self, req, resp, *args, **params):
instance = self.get_object(**params)
self.save_object(req.params, req, resp, instance, **params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch(self, resource, data, target=None, verb='patch', **kwargs):\n return self._modify_resource(resource, data, target, verb, **kwargs)",
"def patch(self, patch):\n if not patch:\n raise OperationOutcome('Patch data is required \\\nto patch a resource')\n if not self.id:\n ... | [
"0.71194124",
"0.6724157",
"0.65292746",
"0.6528879",
"0.649335",
"0.6492151",
"0.64744544",
"0.64331853",
"0.6411547",
"0.629487",
"0.6292101",
"0.6288072",
"0.6262141",
"0.62542963",
"0.62542963",
"0.62542963",
"0.6169901",
"0.6167785",
"0.6158397",
"0.615485",
"0.61273533"... | 0.0 | -1 |
Get {resource} version corresponding to 'version' number. | def on_get_version(self, req, resp, version, **kwargs):
instance = self.get_object(**kwargs)
version = instance.load_version(version)
if not version:
raise falcon.HTTPNotFound()
resp.json(**version.as_resource) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_version(self) -> str:\n return self._version",
"def resource_version(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_version\")",
"def get_version_by_number(version_manager, version_number, request):\n return version_manager.versions[version_number -... | [
"0.733593",
"0.716252",
"0.71117955",
"0.70612",
"0.694454",
"0.6934818",
"0.691447",
"0.682851",
"0.6801032",
"0.67890674",
"0.6756802",
"0.66987455",
"0.6673594",
"0.66270727",
"0.66244024",
"0.6616252",
"0.65965587",
"0.65735924",
"0.6571601",
"0.65665656",
"0.6533844",
... | 0.6608656 | 16 |
Returns the policy network. | def network(self):
return self.__network | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def network_policy(self) -> 'outputs.NetworkPolicyResponse':\n return pulumi.get(self, \"network_policy\")",
"def network_policy(self) -> Optional[pulumi.Input[Union[str, 'NetworkPolicy']]]:\n return pulumi.get(self, \"network_policy\")",
"def get_network(self):\n return self._network",
... | [
"0.85800314",
"0.8183918",
"0.7382225",
"0.7328549",
"0.7209905",
"0.7122168",
"0.7122168",
"0.7122168",
"0.7104112",
"0.7013619",
"0.69694334",
"0.68539214",
"0.6714824",
"0.66980344",
"0.6639451",
"0.657638",
"0.65745556",
"0.6526325",
"0.636042",
"0.6330798",
"0.6295388",
... | 0.71662897 | 5 |
Constructor for the Hash Map. Initiates an empty array with 20 slots | def __init__(self):
self._items = [[] for _ in range(20)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.hashmap = [[] for _ in range(self._cap)]",
"def __init__(self):\n self.hashmap = [[[],[]] for _ in range(self.N)]",
"def __init__(self):\n self.size = 10000\n self.hashmap = [None] * self.size",
"def __init__(self):\n # HashMap内部元素个数\n self... | [
"0.80606514",
"0.8022576",
"0.7895672",
"0.7743391",
"0.7635444",
"0.7609988",
"0.7579706",
"0.7505076",
"0.7503903",
"0.7483324",
"0.7423699",
"0.74089164",
"0.7358948",
"0.73384506",
"0.73104066",
"0.72739786",
"0.72486436",
"0.7229644",
"0.7209098",
"0.72066134",
"0.720186... | 0.66458315 | 58 |
Add image summary of input attention probabilities. | def _AddAttenProbsImageSummary(self, name, atten_probs):
def PlotAttention(fig, axes, cur_atten_probs, title):
plot.AddImage(fig, axes, cur_atten_probs, title=title)
axes.set_ylabel(plot.ToUnicode('Output sequence index'), wrap=True)
axes.set_xlabel(plot.ToUnicode('Input sequence index'), wrap=Tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_attention_images_summary(final_context_state):\n attention_images = (final_context_state)\n # Reshape to (batch, src_seq_len, tgt_seq_len,1)\n attention_images = tf.transpose(attention_images, [1, 2, 0])\n attention_images = tf.nn.l2_normalize(attention_images, axis=2, name='normalized_attention')\n... | [
"0.62113434",
"0.57106376",
"0.5489736",
"0.5444808",
"0.54258764",
"0.5422566",
"0.5287773",
"0.5283039",
"0.5242512",
"0.5225544",
"0.52208567",
"0.52154243",
"0.52083695",
"0.5206032",
"0.51894885",
"0.5148222",
"0.51121503",
"0.5079399",
"0.50693566",
"0.50638986",
"0.506... | 0.69535536 | 0 |
Uses path of this file to determine location of the data directory required for testing YAML files | def get_data_dir(
test_dir_name: str = 'tests', data_dir_name: str = 'data') -> str:
path = ''
# Get the current path and reduce to a list
path_parts = os.path.abspath(__file__).split(os.path.sep)
# Try to find the tests directory.
# If not found, log an error and return an empty string
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_data_dir(self):\n return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')",
"def data_dir():\n return os.path.join(os.path.dirname(__file__), 'test', 'data')",
"def data_dir():\n return os.path.join(os.path.dirname(_here), 'test', 'data')",
"def get_test_data_path():\n ... | [
"0.7702016",
"0.74392825",
"0.73016876",
"0.7264485",
"0.7111394",
"0.70671517",
"0.6826767",
"0.6821471",
"0.6690712",
"0.6672021",
"0.6651541",
"0.6612191",
"0.66018",
"0.65833336",
"0.65804845",
"0.6536781",
"0.65306693",
"0.6521055",
"0.65179825",
"0.65121657",
"0.6488952... | 0.0 | -1 |
Override 'get_queryset' method in order to customize filter | def get_queryset(self):
queryset = self.queryset.all()
#Filter based on query
query = self.request.query_params.get('q', None)
if query:
queryset = queryset.filter(Q(pk__icontains=query) |
Q(customer__name__icontains=query))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n qs = super().get_queryset()\n search_value = self.request.GET.get('search_box')\n\n if search_value is not None:\n qs = qs.search_by(search_value)\n\n return qs",
"def get_queryset(self):\n return None",
"def get_queryset(self):\n r... | [
"0.76590014",
"0.7476171",
"0.7476171",
"0.74560636",
"0.7435379",
"0.7390569",
"0.73302686",
"0.7254939",
"0.71744686",
"0.7169471",
"0.7166284",
"0.7161659",
"0.7134327",
"0.71224046",
"0.71109146",
"0.7102263",
"0.7079528",
"0.7068127",
"0.705371",
"0.70483613",
"0.7030815... | 0.0 | -1 |
Retrieves a list that describes one or more specified Directory Config objects for AppStream 2.0, if the names for these objects are provided. Otherwise, all Directory Config objects in the account are described. These objects include the information required to join streaming instances to an Active Directory domain. A... | def describe_directory_configs(DirectoryNames=None, MaxResults=None, NextToken=None):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_account_streamers(account:str):\n for config in accounts:\n if account in config['streamers']:\n return config['streamers']\n return",
"def _config_list(res, ctx):\n\n if _has_error_code(res):\n return print_errors(res, ctx)\n\n lines = []\n for config in res['co... | [
"0.5709695",
"0.5629899",
"0.55749893",
"0.55571437",
"0.54638493",
"0.54361755",
"0.5352287",
"0.53096795",
"0.5293821",
"0.5261037",
"0.5232696",
"0.5214524",
"0.5194618",
"0.5183116",
"0.5160518",
"0.5153592",
"0.51518035",
"0.5096261",
"0.5083338",
"0.50745064",
"0.506805... | 0.5920142 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.