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 |
|---|---|---|---|---|---|---|
Ensures correct output from _get_iou_components_one_time. In this case, doing neighbourhoodbased evaluation. | def test_get_iou_components_one_time_neigh(self):
this_intersection, this_union = (
learning_curves._get_iou_components_one_time(
actual_target_matrix=ACTUAL_TARGET_MATRIX,
probability_matrix=PROBABILITY_MATRIX,
eval_mask_matrix=MASK_MATRIX,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_neigh_csi_components_one_time(self):\n\n (\n this_num_pred_oriented_tp, this_num_obs_oriented_tp,\n this_num_false_positives, this_num_false_negatives\n ) = learning_curves._get_neigh_csi_components_one_time(\n actual_target_matrix=ACTUAL_TARGET_MATRIX,\n... | [
"0.654468",
"0.6326256",
"0.60461146",
"0.60309106",
"0.599043",
"0.59168845",
"0.5880403",
"0.58382696",
"0.5837896",
"0.58320624",
"0.57940495",
"0.5780195",
"0.5772378",
"0.5772378",
"0.5772378",
"0.576113",
"0.57531786",
"0.5749915",
"0.5694016",
"0.5667581",
"0.5666695",... | 0.7705424 | 0 |
Generate random state data for validation by using random action policy | def generate_random_states(n):
val_memory = Memory(size=n)
while val_memory.records_added < n:
t = TicTacToe()
game_transactions = []
while t.game_over == 0:
current_state = t.get_current_state()
action, _ = RandomAgent.play(current_sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_action(self, state):\n # YOUR CODE HERE\n \n action = np.random.choice(1)\n \n \n return action",
"def __call__(self, state):\n if random.random() > self._epsilon:\n return self._max_policy(state)\n return random.choice(np.arange(self.... | [
"0.71323407",
"0.71263736",
"0.7075376",
"0.67957383",
"0.67642283",
"0.6667903",
"0.65879947",
"0.65799415",
"0.6573118",
"0.6544584",
"0.648769",
"0.6464503",
"0.64248234",
"0.6356988",
"0.6342773",
"0.63412493",
"0.6326506",
"0.631951",
"0.6296601",
"0.62839854",
"0.627007... | 0.0 | -1 |
conversion of time delta get_tot_hours to hours | def proxy_hours_minutes(self):
td = self.convert_last_col_filtered()
resultat = td.days * 24 + td.seconds // 3600, (td.seconds // 60) % 60
# print('{} H {} M'.format(*resultat))
print(resultat)
return resultat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_hours(time):\n return int(time / 3600)",
"def get_time_delta_in_hours(start, end):\n dhour = end.hour - start.hour\n dmin = end.minute - start.minute\n dsec = end.second - start.second\n dtime = timedelta(hours=dhour, minutes=dmin, seconds=dsec) # NOTE rounds to near... | [
"0.7914219",
"0.7607302",
"0.7312186",
"0.7312186",
"0.7312186",
"0.7312186",
"0.6960098",
"0.6938948",
"0.68313473",
"0.68171376",
"0.67777026",
"0.67481923",
"0.6648005",
"0.6628144",
"0.6571386",
"0.64448154",
"0.63601094",
"0.6337727",
"0.6240376",
"0.62283003",
"0.620640... | 0.6154005 | 21 |
Return attenuation constant in nepers/m | def attenuation_constant(self,freq):
return np.real(self.propagation_constant(freq)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_a(self):\n return 0.5*-G*self._mm*self._sm/self.geten()",
"def abbott_elec():\n per_kwh = 0.08 # [$/kWh]\n return per_kwh",
"def real_attenuation(og, fg):\n\n oe = sg2plato(og)\n re = real_extract(og, fg)\n return (oe - re) / oe * 100.",
"def attenuation(distance, specific_atte... | [
"0.6501873",
"0.62570816",
"0.6246513",
"0.622385",
"0.6218788",
"0.6133374",
"0.61161625",
"0.60767555",
"0.60295755",
"0.6010618",
"0.5995117",
"0.59484255",
"0.5926363",
"0.5918101",
"0.58975005",
"0.5882883",
"0.58814436",
"0.586475",
"0.58579195",
"0.5845408",
"0.5841112... | 0.7283188 | 0 |
Check if expr is a Dirac delta function. | def is_DiracDelta(expr):
if len(expr.args) != 1:
return False
arg = expr.args[0]
return DiracDelta(arg) == expr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative(func: Callable, x: float, delta: float) -> float:\n return (func(x + delta) - func(x - delta)) / (2.0 * delta)",
"def test_dg_de(self):\n dfn = lambda x: self.model.g(self.s, x, self.t, self.T)\n nderiv = differentiate(dfn, self.e)\n cderiv = self.model.dg_de(self.s, self.e, self.t, se... | [
"0.5703906",
"0.5464847",
"0.54637367",
"0.5442174",
"0.53730756",
"0.53271043",
"0.52996457",
"0.5255576",
"0.5232413",
"0.5225096",
"0.5223932",
"0.52079666",
"0.51255625",
"0.5120646",
"0.5094949",
"0.5092331",
"0.5060909",
"0.5054449",
"0.50396556",
"0.500741",
"0.5002689... | 0.8715481 | 0 |
Get words from sentence. | def get_words_from_sentence(sentence):
cursor, i, sentence = 0, 0, sentence.strip().lower() + " "
while i <= len(sentence) - 1:
if not sentence[i].isalpha() and not sentence[i] == "'":
if i - 1 >= cursor:
word = sentence[cursor:i]
if "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getWords(speech):\r\n return speech.split()",
"def sentence_to_words(sentence: str) -> List[str]:\n return list(map(clean_word, sentence.split(\" \")))",
"def _get_words(self, sentence):\n _uniq_words = set()\n for word in sentence.split():\n word = normed_word(re.sub(\"\\W\"... | [
"0.7856958",
"0.7671903",
"0.75154656",
"0.74418765",
"0.7405105",
"0.74046093",
"0.74046093",
"0.73726",
"0.7340329",
"0.7323419",
"0.72272426",
"0.72243416",
"0.7220859",
"0.72130877",
"0.71672744",
"0.7111174",
"0.70913255",
"0.709132",
"0.70416296",
"0.70312345",
"0.69663... | 0.7562919 | 2 |
Returns difficulty of observation of object with given magnitude. | def difficulty(mag):
mag = float(mag)
if mag <= -4:
return "Visible in daytime."
elif mag <= 6:
return "Visible at night."
else:
flux = mag_def("%s x" % mag)
needed_flux = mag_def("6 x")
eye_area = math.pi * (0.005**2)
needed_power = needed_flux * eye_area
diameter = 2 * math.sqrt(ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magnitude(x):\n return x.magnitude if hasattr(x, 'magnitude') else x",
"def magnitude(self):\n return sqrt(self & self)",
"def __abs__(self):\n return self.magnitude()",
"def magnitude(self):\n\t\treturn sqrt(self.dot(self))",
"def get_mag(self):\n raise NotImplementedError",
... | [
"0.65812624",
"0.6294409",
"0.6173023",
"0.6167414",
"0.5941639",
"0.591066",
"0.5901391",
"0.5821784",
"0.5785138",
"0.57653624",
"0.5739236",
"0.5739236",
"0.5733744",
"0.56548774",
"0.5639234",
"0.55608654",
"0.5550283",
"0.5541167",
"0.55342555",
"0.5534123",
"0.55249417"... | 0.6539571 | 1 |
Returns the default collector settings | def get_default_config(self):
config = super(EndecaDgraphCollector, self).get_default_config()
config.update({
'path': 'endeca.dgraph',
'host': 'localhost',
'port': 8080,
'timeout': 1,
})
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_config(self):\r\n config = super(CMDCollector, self).get_default_config()\r\n config.update({\r\n 'enabled': 'True',\r\n 'fs': ',',\r\n 'timeout': 300,\r\n })\r\n return config",
"def getDefaultSettings():\n return {}",
"def ge... | [
"0.70514023",
"0.7008024",
"0.69490683",
"0.6713433",
"0.65743333",
"0.6521635",
"0.6515402",
"0.6466526",
"0.6447688",
"0.641337",
"0.6397818",
"0.6380512",
"0.63683224",
"0.6357208",
"0.63517016",
"0.6331759",
"0.63120294",
"0.62353724",
"0.6231899",
"0.62074906",
"0.620161... | 0.65309024 | 5 |
Get current player from turn number | def get_player(self):
return int(4 - floor(abs(3.5 - self.turn_number))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_player(self):\r\n\r\n return self.players[(self.turn_number) % len(self.players)].get_id()",
"def get_current_player(player_one_turn):\n \n # Get appropriate player whether the parameter is True or False\n if player_one_turn == True:\n return 'Player One'\n return 'Player Tw... | [
"0.8239846",
"0.7792623",
"0.7668035",
"0.7571887",
"0.7560293",
"0.7520701",
"0.72682476",
"0.71806824",
"0.7180616",
"0.71399415",
"0.70409834",
"0.69984084",
"0.6992262",
"0.6982138",
"0.6951829",
"0.69436055",
"0.693918",
"0.69283867",
"0.692277",
"0.6918733",
"0.69084215... | 0.7641345 | 3 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.7448925 | 51 |
Return the string identifier of a EphemeralDB if the mongodb option is not active | def db_type(pytestconfig, request):
if pytestconfig.getoption("--mongodb"):
pytest.skip("ephemeraldb tests disabled")
yield "ephemeraldb" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_single_db_name():\n expected_db_name = os.environ.get(\"MONGO_DB\")\n if not expected_db_name and is_testing():\n expected_db_name = f\"Test-{time.time_ns() // 1000000}\"\n\n return expected_db_name",
"def db_instance_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"db_i... | [
"0.6568734",
"0.6426056",
"0.6402769",
"0.6390709",
"0.6354981",
"0.6262097",
"0.625936",
"0.6226829",
"0.620281",
"0.61515594",
"0.6137969",
"0.6101961",
"0.6079889",
"0.60490084",
"0.60225564",
"0.6016175",
"0.59956235",
"0.59633905",
"0.5936385",
"0.5921883",
"0.5917537",
... | 0.63691354 | 4 |
Test $ne operator with document | def test_match_ne(self, document):
assert document.match({"hello": {"$ne": "here"}})
assert not document.match({"hello": {"$ne": "there"}}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ne(self):\n # By default, __ne__ always returns true on different objects.\n # Thus, just check the distinguishing case to verify that the\n # code defines __ne__.\n self.assertFalse(ProcessorOptions().__ne__(ProcessorOptions()))",
"def NOT(expression):\n return {'$not': [... | [
"0.6640391",
"0.66214025",
"0.65779066",
"0.63972956",
"0.6379626",
"0.63706625",
"0.6353131",
"0.6292283",
"0.62859166",
"0.6274574",
"0.6266387",
"0.62656605",
"0.6259152",
"0.6253949",
"0.62457114",
"0.62281835",
"0.6218347",
"0.61695266",
"0.6168734",
"0.61614853",
"0.615... | 0.86186737 | 0 |
Temporal convolution block based on a residual block from Sulabh Kumra and Christopher Kanan 2017 | def __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, dropout):
super().__init__()
# Padding on the left side
pad = torch.nn.ZeroPad2d((padding, 0, 0, 0))
# Convolutional network (we didnt include weight norms)
conv2d1 = nn.Conv2d(in_channels=in_ch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def residual_block(layer_input, filters):\n d = Conv2D(filters, kernel_size=3, strides=1, padding='same')(layer_input)\n d = Activation('relu')(d)\n d = BatchNormalization(momentum=0.8)(d)\n d = Conv2D(filters, kernel_size=3, strides=1, padding='same')(d)\n d ... | [
"0.7232544",
"0.7101564",
"0.70572656",
"0.7008421",
"0.69198",
"0.68231994",
"0.6742119",
"0.66849196",
"0.6660117",
"0.6566384",
"0.6565902",
"0.6546538",
"0.64836246",
"0.64498216",
"0.6377641",
"0.6377345",
"0.6373147",
"0.6372181",
"0.6335261",
"0.626211",
"0.6256768",
... | 0.0 | -1 |
Get absolute path to resource, works for dev and for PyInstaller | def resource_path(relative_path):
base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
path = os.path.join(base_path, relative_path)
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep",
"def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa... | [
"0.83695436",
"0.8280479",
"0.82485795",
"0.8139178",
"0.8114118",
"0.80985415",
"0.80940944",
"0.80797124",
"0.80677074",
"0.80673695",
"0.8062465",
"0.8062465",
"0.8062465",
"0.8062465",
"0.8062465",
"0.8062465",
"0.8062465",
"0.80569947",
"0.80545217",
"0.80448323",
"0.804... | 0.7769183 | 54 |
Sets the identifier of this Type. | def identifier(self, identifier):
self._identifier = identifier | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setId(self, identifier):\n self.identifier = identifier",
"def identifier(self, identifier):\n self._identifier = identifier",
"def identifier(self, identifier):\n self._identifier = identifier",
"def identifier(self, identifier: str):\n\n self._identifier = identifier",
"de... | [
"0.79696417",
"0.78911763",
"0.78911763",
"0.7729359",
"0.76282567",
"0.7510847",
"0.7510847",
"0.72738326",
"0.70281833",
"0.69566834",
"0.69545335",
"0.67372155",
"0.6730112",
"0.6712399",
"0.6704808",
"0.6688177",
"0.66160214",
"0.6590533",
"0.6562901",
"0.64664084",
"0.64... | 0.7856765 | 4 |
Sets the fr of this Type. | def fr(self, fr):
self._fr = fr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(self):\n\n raise Exception(\"Can't set frmt.\")",
"def tkfr(self, tkfr):\n\n self._tkfr = tkfr",
"def set_f(self, f):\n self.f = f\n self.refresh()",
"def frtype(self):\n return self._frtype",
"def mkfr(self, mkfr):\n\n self._mkfr = mkfr",
"def setFen(sel... | [
"0.7641681",
"0.69328636",
"0.62867624",
"0.62038726",
"0.61740875",
"0.59866315",
"0.59163433",
"0.58734035",
"0.578068",
"0.578068",
"0.578068",
"0.578068",
"0.56811875",
"0.56445044",
"0.559959",
"0.55873966",
"0.5579177",
"0.5579177",
"0.5579177",
"0.5579177",
"0.55049026... | 0.84884554 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Type):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Return a custom 404 error. | def page_not_found(e):
return 'Sorry, No Valid Game There.', 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def error_404(error):\n return '404 Error'",
"def error_404(error):\n return 'Bummer, there is nothing at this URL.'",
"def error_not_found(error):\n return 'No page here, dood. 404!', 404",
"def not_found(self, error):\n return jsonify({'error': 'NO... | [
"0.81159586",
"0.80410045",
"0.7738874",
"0.77369535",
"0.77182025",
"0.7689595",
"0.7670471",
"0.76112473",
"0.7602477",
"0.7570698",
"0.75528365",
"0.7545827",
"0.751882",
"0.74745256",
"0.7458403",
"0.7455682",
"0.74548143",
"0.74505144",
"0.7442062",
"0.7428278",
"0.74065... | 0.0 | -1 |
For an array of indices, return a new array result that satisfies ``result[indices] == arange(len(indices)) | def reverse_index_array(indices, target_size=None, result_fill_value=None,
queue=None):
queue = queue or indices.queue
if target_size is None:
target_size = len(indices)
result = cl.array.empty(queue, target_size, indices.dtype)
if result_fill_value is not None:
result.fill(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subset_from_indices(self, indices):\n return self.extract_inds(indices)",
"def gather_nd_python(a_np, indices_np):\n a_shape = a_np.shape\n indices_np = indices_np.astype(\"int32\")\n indices_shape = indices_np.shape\n assert len(indices_shape) > 1\n assert indices_shape[0] <= len(a_sha... | [
"0.58300096",
"0.5761505",
"0.5709801",
"0.5684811",
"0.56476206",
"0.5571939",
"0.55621576",
"0.5486984",
"0.53489107",
"0.53268456",
"0.5319873",
"0.5291163",
"0.5276521",
"0.52487755",
"0.52180874",
"0.52180874",
"0.52067465",
"0.51825994",
"0.5178657",
"0.5159234",
"0.515... | 0.48784631 | 48 |
Return a copy of `self` where all device and host arrays are transformed to `ImmutableHostDeviceArray` objects. | def to_host_device_array(self, queue, exclude_fields=frozenset()):
def _to_host_device_array(attr):
if isinstance(attr, (np.ndarray, cl.array.Array)):
return ImmutableHostDeviceArray(queue, attr)
elif isinstance(attr, DeviceDataRecord):
return attr.to_host... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self) -> JaggedArray:\n\n return self.__class__(self.data.copy(), self.shape.copy())",
"def copy(self):\n\n return ArrayCoordinates1d(self.coordinates, **self.properties)",
"def copy(self):\n return MultiterminalDevice(\n self.center.copy(),\n list(i.copy() f... | [
"0.6617736",
"0.64030606",
"0.6383048",
"0.61982405",
"0.6016259",
"0.59427273",
"0.59363025",
"0.5898411",
"0.5897306",
"0.58820176",
"0.58354074",
"0.58152294",
"0.57421875",
"0.57301337",
"0.5694351",
"0.5683624",
"0.5680693",
"0.5667292",
"0.5663493",
"0.5640594",
"0.5618... | 0.6677162 | 0 |
Compresses box info arrays after empty leaf pruning and, optionally, maps old box IDs to new box IDs (if the array being operated on contains box IDs). | def __call__(self, queue, allocator, new_shape, ary, src_indices=None,
dst_indices=None, map_values=None, zero_fill=False,
wait_for=None, range=None, debug=False):
have_src_indices = src_indices is not None
have_dst_indices = dst_indices is not None
have_map_va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dedup_boxes(boxes):\n # When mapping from image ROIs to feature map ROIs, there's some aliasing\n # (some distinct image ROIs get mapped to the same feature ROI).\n spatial_scale = 1. / 16\n v = np.array([1, 1e3, 1e6, 1e9, 1e12])\n hashes = np.round(boxes * spatial_scale).dot... | [
"0.59780544",
"0.5543052",
"0.54583085",
"0.54519814",
"0.5351176",
"0.53060985",
"0.5244233",
"0.52195245",
"0.52148366",
"0.5150051",
"0.51424986",
"0.5066212",
"0.50543636",
"0.5049735",
"0.504771",
"0.5036733",
"0.50184715",
"0.4974947",
"0.49729374",
"0.496246",
"0.49501... | 0.0 | -1 |
Return the set of source nodes at the current communication stage. The current rank receives messages from these ranks. | def sources(self):
if self.rank < self.midpoint:
partner = self.midpoint + (self.rank - self.left)
if self.rank == self.midpoint - 1 and partner == self.right:
partners = set()
elif self.rank == self.midpoint - 1 and partner == self.right - 2:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes(self):\n return self.source_net.nodes()",
"def sources(self):\n s = [node for node in self.nodes() if node.isSource()]\n s.sort(lambda x,y: cmp(x._id, y._id))\n return s",
"def node_sources(self, node):\r\n node = self.coalesce_node(node)\r\n nodes =[conn[0] ... | [
"0.7514719",
"0.6948303",
"0.6934991",
"0.67258215",
"0.6377358",
"0.6375086",
"0.6375086",
"0.6375086",
"0.63637024",
"0.63340116",
"0.63119256",
"0.630921",
"0.6272949",
"0.6272504",
"0.6272504",
"0.62688017",
"0.6219407",
"0.6208487",
"0.6116071",
"0.61064786",
"0.60920286... | 0.6840111 | 3 |
Return the set of sink nodes at this communication stage. The current rank sends a message to these ranks. | def sinks(self):
if self.rank < self.midpoint:
partner = self.midpoint + (self.rank - self.left)
if partner == self.right:
partner -= 1
else:
partner = self.left + (self.rank - self.midpoint)
if partner == self.midpoint:
par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sinks(self):\n s = [node for node in self.nodes() if node.isSink()]\n s.sort(lambda x,y: cmp(x._id, y._id))\n return s",
"def sinks(self):\n return [x for x in self if self.out_degree(x)==0]",
"def find_targetnodes(self):\n\n self.connect_backwards()\n\n targetnode... | [
"0.7398541",
"0.6639113",
"0.6499079",
"0.6221557",
"0.6221557",
"0.62091917",
"0.5976742",
"0.5925134",
"0.58502364",
"0.5843769",
"0.5714399",
"0.56940776",
"0.5688821",
"0.56705076",
"0.5665965",
"0.5593471",
"0.55770636",
"0.55770636",
"0.55770636",
"0.5574762",
"0.557041... | 0.6988486 | 1 |
Last hour start timestamp | def last_hour_start_ts(tz=DEFAULT_ZONE):
t = datetime.now().replace(minute=0, second=0, microsecond=0) - timedelta(hours=1)
return int(datetime.timestamp(t)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_hour_end_ts(tz=DEFAULT_ZONE):\n t = datetime.now().replace(minute=0, second=0, microsecond=0)\n return int(datetime.timestamp(t))",
"def last_seen_hours(self):\n return self.last_seen.seconds / 3600",
"def hour(self):\n return \"%s:00:00\" % self.timestamp[:13]",
"def sta... | [
"0.71816915",
"0.69597614",
"0.68238413",
"0.6820555",
"0.67857695",
"0.66604304",
"0.6598028",
"0.65708065",
"0.6546866",
"0.6512802",
"0.6501467",
"0.6454788",
"0.64543754",
"0.64187294",
"0.6404076",
"0.63555473",
"0.63555473",
"0.6352674",
"0.63421106",
"0.6314568",
"0.62... | 0.7646981 | 0 |
Last hour end timestamp | def last_hour_end_ts(tz=DEFAULT_ZONE):
t = datetime.now().replace(minute=0, second=0, microsecond=0)
return int(datetime.timestamp(t)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time(self):\n # TODO: use pd.Timestamp instead\n return self.time[-1].to_pydatetime()",
"def end_timestamp(self):\n return ms_from_dt(self.range().end())",
"def end_time(self):\n pass",
"def _get_end_time(self):\n return self.__end_time",
"def end_time(self) -> float:... | [
"0.7328241",
"0.7248652",
"0.7054035",
"0.6984426",
"0.69804436",
"0.6977515",
"0.6955418",
"0.6936304",
"0.6898136",
"0.6819274",
"0.6793862",
"0.6793862",
"0.6793862",
"0.6793862",
"0.6793862",
"0.6793862",
"0.66878426",
"0.6678984",
"0.6676093",
"0.6670156",
"0.66634613",
... | 0.7897876 | 0 |
Utility to find the index of the element of ``array`` that most closely matches ``value`` | def find_idx(array, value):
idx = np.searchsorted(array, value, side="left")
if idx > 0 and (
idx == len(array)
or math.fabs(value - array[idx - 1]) < math.fabs(value - array[idx])
):
return idx - 1
else:
return idx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nearestIndex(array, value):\n idx = np.searchsorted(array, value, side='left')\n if idx > 0 and (idx == len(array) or math.fabs(value - array[idx-1]) < math.fabs(value - array[idx])):\n return idx-1\n return idx",
"def find_nearest(array, value):\n if isinstance(array, list):\n arra... | [
"0.803083",
"0.7985056",
"0.7860093",
"0.7860093",
"0.7830387",
"0.7829763",
"0.7756762",
"0.76643646",
"0.7548033",
"0.75152594",
"0.75122863",
"0.7426945",
"0.7422947",
"0.74223775",
"0.74210966",
"0.7400896",
"0.7400896",
"0.7198665",
"0.716935",
"0.71611196",
"0.71606326"... | 0.84965104 | 0 |
Close the database connection pool. | async def close_db(app):
LOG.info('Closing database connection pool.')
await app['pool'].close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db_connection(cls):\n db.close()",
"def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None",
"def close_connections(self):\n self.db_connection.close_connections()",
"def close(self):\n Log.debug('DB -> close... | [
"0.8015801",
"0.786524",
"0.7712119",
"0.76835203",
"0.7649989",
"0.76417565",
"0.7614164",
"0.76062137",
"0.75990623",
"0.7585732",
"0.7551289",
"0.7499918",
"0.7481007",
"0.74593586",
"0.7437139",
"0.74300915",
"0.7408636",
"0.740564",
"0.740564",
"0.740564",
"0.73900646",
... | 0.8218661 | 0 |
Returns the amount of singular edges as a list over all timesteps. Note that an edge of a local graph usually represents multiple, aggregated edges/interactions. | def total_edges_per_time_step(graphs: typ.Iterable[vtna.graph.Graph]) -> typ.List[int]:
return [sum(edge.get_count() for edge in graph.get_edges()) for graph in graphs] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes_per_time_step(graphs: typ.Iterable[vtna.graph.Graph]) -> typ.List[int]:\n return [len(set(node for edge in graph.get_edges() for node in edge.get_incident_nodes())) for graph in graphs]",
"def number_of_direct_deviation_edges(self):\n return len(list(self.direct_deviation_edges()))",
"def n... | [
"0.6105148",
"0.58294904",
"0.5766796",
"0.57531416",
"0.5734514",
"0.56653804",
"0.5658657",
"0.55685747",
"0.5564104",
"0.5558759",
"0.5545953",
"0.5528661",
"0.5524287",
"0.5504836",
"0.5501622",
"0.5480397",
"0.5466175",
"0.54463357",
"0.5406085",
"0.534853",
"0.53395385"... | 0.6163013 | 0 |
Return the full name of a video file, including suffix. | def _findVideoFile(self, videofile):
for vf in self.vflist:
if vf.startswith(videofile + '.'):
videosource = os.path.join(self.vfdir, vf)
return videosource | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video_path(self):\n return os.path.splitext(self.file_path)[0]",
"def _get_video_name(self, fname):\n csv_name_split = fname.split(\"_\")\n thirty_fps_loc = csv_name_split.index(\"30fps\")\n video_name = \"_\".join(csv_name_split[0:thirty_fps_loc+1])\n return video_name",
... | [
"0.7823536",
"0.76983047",
"0.7686774",
"0.73343885",
"0.71679753",
"0.7158706",
"0.71119845",
"0.70912266",
"0.70524377",
"0.6937354",
"0.6903274",
"0.68786585",
"0.6878384",
"0.68306977",
"0.6801002",
"0.6773784",
"0.6766138",
"0.67593056",
"0.6758496",
"0.6742102",
"0.6737... | 0.0 | -1 |
Return a function of canvas coords that describes an elliptic area. | def _getReliefFcn(self, centerx, centery, a, b, angle):
if a == 0 or b == 0:
return (lambda x, y: 0)
def f(x, y):
center = Vect(centerx, centery)
point = Vect(x, y)
# angle coord of the point with respect to the ellipse center:
phi = point.ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ellipse_area(semi_major_axis: number, semi_minor_axis : number) -> number:\n area = pi*semi_major_axis*semi_minor_axis\n return area",
"def area(x, y):\n return x*y/2",
"def PolyArea(Coords):\n\n area = 0.0\n for i in range(np.shape(Coords)[0]-1):\n # cros multiplication\n... | [
"0.6537306",
"0.6342309",
"0.62207294",
"0.6199896",
"0.6118287",
"0.602477",
"0.59994847",
"0.5998547",
"0.5989612",
"0.5955086",
"0.5933823",
"0.5932367",
"0.5928091",
"0.59216046",
"0.5895993",
"0.58847606",
"0.5871639",
"0.5871639",
"0.58602136",
"0.58550394",
"0.58381534... | 0.0 | -1 |
Select the action with the highest Q value from the root node in the MCTS tree. | def choose_action(self, node: dict, exploit: bool = False) -> tuple:
best_val = -np.inf
mcts_policy = torch.zeros(1, len(node["childs"])).cuda(self.controller.device)
n_children = len(node["childs"])
# Get back to the root node and evaluate its children. Choose the best estimated action... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_action(self) -> int:\n # simulation loop\n for i in range(self.iterations):\n self.__simulate(self.root, self.iterations)\n\n # action choice\n max_q = 0\n best_action = 0\n for action in actions:\n new_node = self.root.children[action]\n ... | [
"0.7978512",
"0.73428863",
"0.7236807",
"0.7165474",
"0.68907017",
"0.6890583",
"0.6800133",
"0.67650133",
"0.6742238",
"0.6726585",
"0.6722064",
"0.67136467",
"0.6680678",
"0.6669713",
"0.66628456",
"0.6654032",
"0.6617922",
"0.65809476",
"0.6559519",
"0.6526507",
"0.6510899... | 0.0 | -1 |
Test that a request for an invalid resource yields the right response. | def test_request_invalid_resource(self):
response = requests.get(self.url + '/invalid')
self.assertEqual(response.status_code, 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request_users_user_invalid_resource(self):\n response = requests.get(self.url + '/users/John/invalid')\n\n self.assertEqual(response.status_code, 404)",
"def test_request_failure(self):\n httpretty.register_uri(httpretty.POST, 'http://somewhere.com/test', status=500)\n r = Ck... | [
"0.78615135",
"0.74824226",
"0.74171007",
"0.7333071",
"0.73154664",
"0.7307473",
"0.7269474",
"0.72461486",
"0.7238642",
"0.7234713",
"0.7220158",
"0.7215801",
"0.71966505",
"0.7185507",
"0.7176531",
"0.71707153",
"0.71658564",
"0.7141762",
"0.7130946",
"0.71260834",
"0.7098... | 0.85969055 | 0 |
Test that a users request for a specific user yields the right response. | def test_request_users_user(self):
response = requests.get(self.url + '/users/John')
self.assertEqual(response.status_code, 200)
self.assertIsNone(response.json()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_responsse(user_response, client):\n resp = client.get_user()\n assert resp.keys() == user_response.keys()",
"def test_api_user_get(self):\n pass",
"def test_getUser(self):\n\t\turl = \"/users/2/\"\n\t\tresponse = self.client.get(url, format='json')\n\t\tself.assertEqual(response.stat... | [
"0.733757",
"0.7184783",
"0.6956288",
"0.69443226",
"0.69312507",
"0.6861358",
"0.68568677",
"0.6839095",
"0.67865986",
"0.6785922",
"0.67749923",
"0.6750286",
"0.67463946",
"0.6715742",
"0.6704427",
"0.66908896",
"0.66678804",
"0.66397184",
"0.66190374",
"0.6616518",
"0.6592... | 0.7446149 | 0 |
Test that a users request for an invalid user yields the right response. | def test_request_users_user_invalid(self):
response = requests.get(self.url + '/users/invalid')
self.assertEqual(response.status_code, 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request_users_user_invalid_resource(self):\n response = requests.get(self.url + '/users/John/invalid')\n\n self.assertEqual(response.status_code, 404)",
"def test_request_groups_group_users_user_invalid(self):\n response = requests.get(self.url + '/groups/Female/users/invalid')\n\n ... | [
"0.79878527",
"0.74910915",
"0.74176085",
"0.73818785",
"0.73067594",
"0.7298357",
"0.72863954",
"0.7275002",
"0.7205227",
"0.7195524",
"0.7187006",
"0.7153529",
"0.7129636",
"0.7095536",
"0.7072213",
"0.70694655",
"0.70694274",
"0.70563143",
"0.7049385",
"0.701216",
"0.70035... | 0.83186823 | 0 |
Test that a users request for an invalid user resource yields the right result. | def test_request_users_user_invalid_resource(self):
response = requests.get(self.url + '/users/John/invalid')
self.assertEqual(response.status_code, 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request_users_user_invalid(self):\n response = requests.get(self.url + '/users/invalid')\n\n self.assertEqual(response.status_code, 404)",
"def test_request_groups_group_users_user_invalid(self):\n response = requests.get(self.url + '/groups/Female/users/invalid')\n\n self.as... | [
"0.8336682",
"0.7431441",
"0.73760676",
"0.73565894",
"0.7282519",
"0.7227472",
"0.71379566",
"0.7132444",
"0.71209866",
"0.7120542",
"0.71131986",
"0.70882076",
"0.70616275",
"0.7056545",
"0.70395607",
"0.7012823",
"0.7008453",
"0.70059",
"0.6985266",
"0.6953834",
"0.6952733... | 0.84612894 | 0 |
Sets an optional serial number of the SSH Certificate. | def set_serial(self, serial=0):
self.serial = serial | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialno(self, serialno):\n\n self._serialno = serialno",
"def serial_number(self, serial_number: str):\n\n self._serial_number = serial_number",
"def set_serial_number(self, sSerialNumber):\n\t\tcall_sdk_function('PrlVmDevHd_SetSerialNumber', self.handle, sSerialNumber)",
"def set_pypi_ser... | [
"0.67133594",
"0.65986013",
"0.6532558",
"0.6387893",
"0.5969777",
"0.58912265",
"0.5705987",
"0.5694129",
"0.55129766",
"0.54771787",
"0.5343193",
"0.5306608",
"0.5301717",
"0.5262085",
"0.52439183",
"0.52037054",
"0.5191685",
"0.51821816",
"0.517027",
"0.5157253",
"0.510350... | 0.6787014 | 0 |
Sets the key id of a certificate, which is just a string that ends up getting singed by the CA. This key id is super useful because it gets logged by sshd when the certificate is used to successfully authenticate users. Depending on your environment, the logging of this string will eventually be truncated at ~325 chara... | def set_key_id(self, key_id=''):
self.key_id = key_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def certificate_id(self) -> str:\n return pulumi.get(self, \"certificate_id\")",
"def __init__(__self__, *,\n certificate_id: pulumi.Input[str]):\n pulumi.set(__self__, \"certificate_id\", certificate_id)",
"def certificate_id(self) -> pulumi.Input[str]:\n return pulumi.get... | [
"0.67490095",
"0.670716",
"0.6511312",
"0.6473834",
"0.63985693",
"0.6390589",
"0.63414496",
"0.6316873",
"0.6310788",
"0.6300829",
"0.61904037",
"0.616685",
"0.6035319",
"0.59158033",
"0.5863699",
"0.57576877",
"0.5658518",
"0.5645421",
"0.55325234",
"0.55192053",
"0.5519205... | 0.68915963 | 0 |
Monte carlo estimation of pi; based on ratio between area in quarter circle vs unit square | def estimate_pi(n):
points_out = 0
points_in = 0
for i in range(n):
x = random.uniform(0,1)
y = random.uniform(0,1)
if math.sqrt(x**2 + y**2) <= 1:
points_in += 1
else:
points_out += 1
est_pi = (points_in / (points_out + points_in)) * 4
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate_pi(sims):\n \n # counter to hold points lying inside the circle\n in_circle = 0\n \n for s in range(0,sims):\n \n x = np.random.rand()\n y = np.random.rand()\n \n if (x**2 + y**2) <= 1:\n in_circle += 1\n \n # The ratio of pts. ins... | [
"0.7543111",
"0.7390281",
"0.72446716",
"0.70295966",
"0.6959972",
"0.6753024",
"0.65617657",
"0.65617657",
"0.6513931",
"0.64577955",
"0.6450562",
"0.64337265",
"0.6412338",
"0.64061886",
"0.6331023",
"0.6284487",
"0.62823284",
"0.62690425",
"0.62545675",
"0.6254404",
"0.624... | 0.72957206 | 2 |
Only logged user can add post | def test_guest_not_logged_cant_post(self):
response = self.c.post('/wall/',
json.dumps(
{'message': 'I am the message :)', }),
content_type="application/json")
assert 403 == response.status_code
asse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_post(request):\n if request.session.get('id_user') is None:\n request.session['res'] = 'Warn'\n messages.add_message(request, messages.WARNING,\n \"The session has expired\")\n return HttpResponseRedirect(reverse('home'))\n form = PostForm(request.POST... | [
"0.77432764",
"0.7171864",
"0.7014",
"0.6927429",
"0.68867075",
"0.68390507",
"0.6760455",
"0.6747345",
"0.6743525",
"0.6743525",
"0.663873",
"0.663873",
"0.6597466",
"0.6586036",
"0.6496377",
"0.64766145",
"0.643753",
"0.64332193",
"0.6430139",
"0.6397528",
"0.639341",
"0.... | 0.6393639 | 20 |
custom function to remove the rare words | def remove_rarewords(text):
return " ".join([word for word in str(text).split() if word not in RAREWORDS]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeNonDictionaryWords(self, words):\n\t\twordList = [w.strip() for w in words.split(' ')]\n\t\trtnWords = []\n\t\tfor word in wordList:\n\t\t\tif word.lower() in self.dictionary:\n\t\t\t\trtnWords.append(word)\n\t\treturn \" \".join(rtnWords)",
"def clean(word):\n word = word.lower()\n stopwords = [... | [
"0.7361204",
"0.73324484",
"0.7253777",
"0.7204225",
"0.71941537",
"0.71541125",
"0.7153541",
"0.7131758",
"0.71081185",
"0.70926994",
"0.7080353",
"0.7078706",
"0.69413763",
"0.6933016",
"0.688315",
"0.6878428",
"0.68742424",
"0.6855846",
"0.6854986",
"0.6853327",
"0.6827143... | 0.8035617 | 0 |
custom function to remove the stopwords | def remove_stopwords(text):
return " ".join([word for word in str(text).split() if word not in STOPWORDS]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)",
"def remove_stopwords(text):\n stopwords = [\"i\", \"me\", \"my\", ... | [
"0.8823565",
"0.8401623",
"0.8289207",
"0.8248563",
"0.8228253",
"0.82197374",
"0.8181915",
"0.8181915",
"0.8181915",
"0.8181915",
"0.8164255",
"0.81541234",
"0.81183577",
"0.8115647",
"0.81121063",
"0.8105464",
"0.8080783",
"0.8072988",
"0.80382043",
"0.80332667",
"0.7997704... | 0.806302 | 18 |
The direction indicator is a tiny arrow on the minimap always pointing into the same direction as the camera. | def create_direction_indicator(self):
self.indicator = Actor.Actor(self.PATHS["INDICATOR_MODEL"])
self.indicator.setColor(0, 0, 0, 1)
self.indicator.setScale(Location.SCALE)
loc_x, loc_y = self.active_location.get_position()
self.indicator.setPos(loc_x, 0, loc_y)
# the i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def direction(self):\r\n return 180 - atan2(self.x, self.y)*180/pi",
"def _calc_relative_move_direction(self, char, direction):\n if char in (\"Left\", \"Right\"):\n di = -1 if self.video.hflip else 1\n else:\n di = -1 if self.video.vflip else 1\n return directio... | [
"0.67694265",
"0.63034743",
"0.6246591",
"0.62413013",
"0.6237144",
"0.62368673",
"0.620387",
"0.6190864",
"0.61835223",
"0.612281",
"0.6117483",
"0.6112175",
"0.6037749",
"0.6033594",
"0.60279524",
"0.60082567",
"0.5965038",
"0.59460807",
"0.5935944",
"0.5924121",
"0.5920968... | 0.6609834 | 1 |
Make sure all paths have a URI scheme. | def fixpaths(d):
if isinstance(d, dict):
if "path" in d:
if ":" not in d["path"]:
local_path = os.path.normpath(
os.path.join(os.getcwd(), basedir, d["path"])
)
d["location"] = pathname2url(local_path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supports_uri_scheme():\n\n pass",
"def test_uris(self):\r\n invariant = [ \r\n u\"ftp://ftp.is.co.za/rfc/rfc1808.txt\",\r\n u\"http://www.ietf.org/rfc/rfc2396.txt\",\r\n u\"ldap://[2001:db8::7]/c=GB?objectClass?one\",\r\n u\"mailto:Joh... | [
"0.7095117",
"0.6588678",
"0.6215418",
"0.6109806",
"0.6099256",
"0.58391935",
"0.5805309",
"0.57788754",
"0.57159275",
"0.5700178",
"0.5665232",
"0.5637722",
"0.5598174",
"0.5597841",
"0.55906487",
"0.55787253",
"0.55481",
"0.5519729",
"0.5504342",
"0.5491937",
"0.5481519",
... | 0.0 | -1 |
First DC component of nonsmooth PWLRL1 function. | def f1(x):
# Sum over data points
f = 0.0
for m_ind in range(cfg.ntrain):
f += f1_part_i(x,m_ind)
return f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def p1(self) -> float:\n return self.distortion_coefficients[3]",
"def r_dc(self, phi, tl):\n\t # return self.r_d(tl)*(1. - exp(-phi))\n\t return 0.",
"def calc_c1(self):\n dc1hw_s = self.src_shape[0]\n _, d_d, h_d, w_d, _ = self.dst_shape\n c_1 = dc1hw_s // (d_d * h_d * w_d)\... | [
"0.59150743",
"0.5867034",
"0.58555835",
"0.57763284",
"0.5761853",
"0.57545215",
"0.57157475",
"0.5613587",
"0.5555605",
"0.5553972",
"0.55518186",
"0.5516809",
"0.550712",
"0.54793596",
"0.5453373",
"0.54472816",
"0.54027545",
"0.53788024",
"0.53738356",
"0.53473246",
"0.53... | 0.0 | -1 |
Part i (i=1,...,m) of the first DC component of nonsmooth PWLRL1 function. | def f1_part_i(x,m_ind):
#f = max(2.0*rho1(x,m_ind)-cfg.a[m_ind,cfg.nfea-1] ,2.0*rho2(x,m_ind)+cfg.a[m_ind,cfg.nfea-1])
tmp1 = 2.0*rho1(x,m_ind)-cfg.a[m_ind,cfg.nfea-1]
tmp2 = 2.0*rho2(x,m_ind)+cfg.a[m_ind,cfg.nfea-1]
# checking absolute value of rho-b_i = rho1-rho2-b_i
#if (tmp1-tmp2 > cfg.a[m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nd1(self):\n d1 = self.d1()\n return norm.cdf(d1)",
"def nd1(self):\r\n return norm.cdf(self.d1())",
"def decode_DC_progressive_first(self, interleaved_components, Al):\n for cp in interleaved_components: cp.prev_DC = 0\n for i in range(self.VMCUNo):\n for j in... | [
"0.53053343",
"0.52461135",
"0.5223148",
"0.5162865",
"0.5102852",
"0.50867707",
"0.5079343",
"0.50582385",
"0.5043074",
"0.5019006",
"0.49774098",
"0.49680427",
"0.49607396",
"0.49114105",
"0.490231",
"0.48838598",
"0.48836628",
"0.48823527",
"0.48795784",
"0.48676026",
"0.4... | 0.44999486 | 84 |
Plot example of reconstruction images | def plot_reconstruction_images(inputs, pred, name):
plt.clf()
nb_plots = min(inputs.shape[0], 4)
#inputs
for i in range(nb_plots):
ax = plt.subplot2grid((2, nb_plots), (0, i), rowspan=1, colspan=1)
ax.imshow(inputs[i])
ax.axis('off')
#pred
for i in range(nb_plots):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visualize(original, s, m, l, s_pred, m_pred, l_pred):\n\tfig = plt.figure(figsize=(20, 10))\n\tplt.subplot(1,7,1)\n\tplt.title('Original image')\n\tplt.imshow(original)\n\n\tplt.subplot(1,7,2)\n\tplt.title('S image')\n\tplt.imshow(s)\n\tplt.subplot(1,7,3)\n\tplt.title('S Pred image')\n\tplt.imshow(s_pred)\n\n\... | [
"0.71351206",
"0.7100315",
"0.68887264",
"0.68847746",
"0.6871806",
"0.6786557",
"0.6732243",
"0.672935",
"0.66899496",
"0.6674696",
"0.6642875",
"0.66186666",
"0.6553463",
"0.65143347",
"0.6502824",
"0.64993995",
"0.6469899",
"0.64335006",
"0.6426813",
"0.6426813",
"0.642681... | 0.7295809 | 0 |
Tranforms a relative home path into an absolute one | def relativeToAbsoluteHomePath(path):
if "~" in path:
return path.replace("~",expanduser("~"))
else:
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absolute_path(path):\n path = re.sub('~', os.environ['HOME'], str(path))\n if path[0] != '/':\n path = str(sh.pwd()).strip() + '/' + path\n return path",
"def translate_home_path(home_path: Path) -> Path:\n if repo_home in home_path.parents:\n relative_path = home_path.relative_to(r... | [
"0.76739156",
"0.75821143",
"0.72498953",
"0.7196339",
"0.7029503",
"0.6890417",
"0.6834069",
"0.6763113",
"0.67286956",
"0.67250884",
"0.6713811",
"0.66212195",
"0.6599428",
"0.6598643",
"0.6593712",
"0.6561902",
"0.6521954",
"0.6515864",
"0.65013003",
"0.65012443",
"0.64929... | 0.83240473 | 0 |
Check if an object is one of the builtin character types. | def is_chars(obj: Any) -> bool:
return isinstance(obj, (str, bytes, bytearray)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_string(self, obj):\n return isinstance(obj, unicode) or isinstance(obj, str)",
"def typeIsString(obj):\n return type(obj) is str or _haveTypeUnicode and type(obj) is unicode",
"def strtype(x):\n if type(x) == str:\n return True\n if type(x) == unicode:\n return True\n ... | [
"0.6733396",
"0.6707335",
"0.6541074",
"0.6465043",
"0.64260364",
"0.640103",
"0.6384294",
"0.6353569",
"0.62944776",
"0.6286962",
"0.6124329",
"0.61046565",
"0.60863304",
"0.6075099",
"0.6064807",
"0.6064401",
"0.6035964",
"0.60135233",
"0.60017663",
"0.59867156",
"0.5963808... | 0.74845713 | 0 |
Check if an object is iterable. By default, characters (str, bytes, or bytearray) are treated as NOT being iterable, even though these builtin types are normally iterable. In most situations where it would make sense to check for an iterable (e.g., recursion through a nested data structure), it would typically make sen... | def is_iterable(
obj: Any,
*,
suppress_chars: bool = True,
exclude_types: Optional[Tuple[Type, ...]] = None,
) -> bool:
if suppress_chars and is_chars(obj):
return False
elif exclude_types is not None and isinstance(obj, exclude_types):
return False
elif isins... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isiterable(obj, strings=False, isinstance=isinstance, Iterable=Iterable):\n return (isinstance(obj, Iterable) and\n not (isinstance(obj, str) and not strings))",
"def is_iterable(obj):\n if isinstance(obj, (str, bytes, bytearray)):\n return False\n return isinstance(obj, Iterable)"... | [
"0.82951033",
"0.8259235",
"0.804135",
"0.7996882",
"0.7986966",
"0.79549503",
"0.7904725",
"0.77582365",
"0.7753825",
"0.77387357",
"0.7732031",
"0.76788",
"0.7677708",
"0.76514536",
"0.76472557",
"0.76384866",
"0.7625282",
"0.7609361",
"0.7576565",
"0.75647086",
"0.75411093... | 0.7986848 | 5 |
Check whether an object is an iterator. | def is_iterator(obj: Any) -> bool:
if isinstance(obj, collections.abc.Iterator):
return True
else:
try:
return iter(obj) is obj
except TypeError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_iterator(obj):\n return isinstance(obj, collections.Iterator)",
"def is_iterator(obj):\n cls = obj.__class__\n return hasattr(cls, '__next__') and not hasattr(cls, '__len__')",
"def isiter(obj):\r\n \r\n try:\r\n iter(obj)\r\n return True\r\n except TypeError:\r\n ... | [
"0.89624107",
"0.8579682",
"0.83005774",
"0.7963923",
"0.77198297",
"0.7237639",
"0.72222495",
"0.7054901",
"0.703993",
"0.70337015",
"0.6962367",
"0.6915763",
"0.69066936",
"0.6831035",
"0.6736616",
"0.67176056",
"0.6586603",
"0.6582243",
"0.6527394",
"0.64252996",
"0.642373... | 0.8775804 | 1 |
Test login error when an invalid/inexistent email is informed | def test_error_login_with_invalid_email(self, test_client, init_database, insert_user_db):
url = '/api/v1/auth/login'
data = {
'email': 'invalid',
'password': 'password'
}
response = test_client.post(url, json=data)
assert response.status_code == 401
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sad_login_wrong_email(self):\n\n rv = self.login(\"wrong@email.com\")\n assert rv.status_code in [404]\n assert b\"The provided email is invalid\" in rv.data",
"def test_invalid_email_when_logging_in(self):\n pass",
"def test_invalid_email(self):\n rv = self.login('B... | [
"0.8743149",
"0.87186867",
"0.8525323",
"0.8436362",
"0.8228499",
"0.8071272",
"0.80491644",
"0.7942332",
"0.7924021",
"0.7880542",
"0.7838998",
"0.78217804",
"0.77855855",
"0.77702993",
"0.76210475",
"0.7611643",
"0.75928843",
"0.758855",
"0.7557538",
"0.7514679",
"0.7378118... | 0.804139 | 7 |
Test login error when an invalid password is informed | def test_error_login_with_invalid_password(self, test_client, init_database, insert_user_db):
url = '/api/v1/auth/login'
data = {
'email': insert_user_db.email,
'password': 'word'
}
response = test_client.post(url, json=data)
assert response.status_code =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_password(self):\n pass",
"def test_failedLoginPassword(self):\n login = self.failureResultOf(\n self.portal.login(\n credentials.UsernamePassword(b\"bob\", b\"h3llo\"), self, ITestable\n )\n )\n self.assertTrue(login)\n self... | [
"0.85367435",
"0.8460837",
"0.8374802",
"0.8305762",
"0.82151645",
"0.81768364",
"0.804227",
"0.80135405",
"0.7965283",
"0.7939823",
"0.7934849",
"0.7917468",
"0.7897174",
"0.7865498",
"0.7850142",
"0.7846992",
"0.78260493",
"0.7797374",
"0.7788914",
"0.7754143",
"0.7719486",... | 0.78229505 | 17 |
Test return error when no user exists with bearer token user_id | def test_error_inexistent_user_data(self, test_client, init_database, insert_user_db):
login_url = '/api/v1/auth/login'
login_data = {
'email': insert_user_db.email,
'password': 'password'
}
login_response = test_client.post(login_url, json=login_data)
ini... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_non_existing_token_authenticated_user(self):\r\n\r\n user_no_tokens = UserFactory.create_batch(2)[1]\r\n\r\n res = self.app.get('/api/token/twitter?api_key=' + user_no_tokens.api_key)\r\n error = json.loads(res.data)\r\n\r\n assert res.status_code == 404, error\r\n a... | [
"0.77896976",
"0.7461016",
"0.73660845",
"0.7353242",
"0.7339315",
"0.7338671",
"0.73347986",
"0.7327173",
"0.7304636",
"0.7264226",
"0.72523373",
"0.72129315",
"0.71963936",
"0.719639",
"0.71809304",
"0.7166424",
"0.7163745",
"0.715927",
"0.71317756",
"0.71024436",
"0.709958... | 0.0 | -1 |
Test return error when no user exists with bearer token user_id | def test_error_find_no_authentication_header(self, test_client):
url = '/api/v1/auth/me'
response = test_client.get(url)
assert response.status_code == 401
assert response.json['msg'] == 'Missing Authorization Header' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_non_existing_token_authenticated_user(self):\r\n\r\n user_no_tokens = UserFactory.create_batch(2)[1]\r\n\r\n res = self.app.get('/api/token/twitter?api_key=' + user_no_tokens.api_key)\r\n error = json.loads(res.data)\r\n\r\n assert res.status_code == 404, error\r\n a... | [
"0.77875584",
"0.7457736",
"0.73658913",
"0.73520404",
"0.73383725",
"0.73370916",
"0.73330736",
"0.7327368",
"0.7303277",
"0.7263361",
"0.7250999",
"0.7211996",
"0.71934325",
"0.719341",
"0.7178021",
"0.71632665",
"0.71620464",
"0.71592647",
"0.7128548",
"0.7099172",
"0.7096... | 0.0 | -1 |
Convert a matrix of onehot rowvector labels into smoothed versions. Arguments | def smooth_labels(y: np.ndarray,
smooth_factor: float) -> np.ndarray:
assert len(y.shape) == 2
if 0 <= smooth_factor <= 1:
y *= 1 - smooth_factor
y += smooth_factor / y.shape[1]
else:
raise Exception(
'Invalid label smoothing factor: ' + str(smooth_fact... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(labels):\n one_hot_labels = np.zeros(labels.shape + (n_actions,))\n for c in range(n_actions):\n one_hot_labels[labels == c, c] = 1.0\n return one_hot_labels",
"def label2onehot(self, batch_size, labels):\r\n dim = 6\r\n out = torch.zeros(batch_size, dim)\r\n out[... | [
"0.5951354",
"0.59054005",
"0.5843753",
"0.5816529",
"0.5804733",
"0.5735554",
"0.5723977",
"0.5676459",
"0.56648993",
"0.5644317",
"0.5624824",
"0.55992556",
"0.5575487",
"0.5572602",
"0.5559454",
"0.5547349",
"0.5521741",
"0.55102277",
"0.55070776",
"0.55033034",
"0.549766"... | 0.0 | -1 |
A generator for creating random string data of letters plus ' ' (whitespace) | def random_string(random_length=None):
choices = string.letters + ' '
text = []
if not random_length:
random_length = random.randint(1, 30)
for x in range(random_length):
text.append(random.choice(choices))
return "".join(text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand_string():\n out = ''\n for _ in range(24):\n out += choice(ascii_letters)\n return out",
"async def generate(self):\n lastword = \"\"\n previous = \"\"\n out = []\n\n while True:\n key = self._make_key(self.separator.join([previous, lastword]))\n ... | [
"0.7656295",
"0.7372092",
"0.73262835",
"0.72987974",
"0.72707534",
"0.72491264",
"0.72318995",
"0.7187993",
"0.714681",
"0.7132888",
"0.7126158",
"0.7042087",
"0.7036958",
"0.7029216",
"0.6982218",
"0.6962822",
"0.6961775",
"0.6928222",
"0.69131416",
"0.68971336",
"0.6886542... | 0.6542047 | 88 |
Opens a dialog for converting files to fif. | def on_pushButtonConvertEdf_clicked(self, checked=None):
if checked is None: return
self.mneRoot = self.ui.lineEditMneRoot.text()
if str(self.mneRoot) is '':
QtGui.QMessageBox.critical(self, "Cannot convert",
"MNE_ROOT must be set before conversion",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_open_button(self, event):\n wildcard = \"All files (*.*)|*.*|\"\\\n \"Preprocessed _iso_res.csv file (*_iso_res.csv)|*_iso_res.csv|\"\\\n \"Massacre iso_csv file (*_iso.csv)|*_iso.csv|\"\n dlg = wx.FileDialog(\n self, message=\"Choose a file\",... | [
"0.66",
"0.6555186",
"0.655065",
"0.64365965",
"0.6434188",
"0.6405336",
"0.636537",
"0.63381976",
"0.6322163",
"0.6267893",
"0.622372",
"0.6193836",
"0.61518097",
"0.61020494",
"0.60990685",
"0.60529697",
"0.6017804",
"0.59045416",
"0.58866554",
"0.58754104",
"0.5857886",
... | 0.0 | -1 |
Filter data matrix and target vector. Selecting only instances that belong to y_sel. | def _filter_dataset(data_matrix, y, y_sel):
targets = []
instances = []
for target, instance in zip(y, data_matrix):
if target in y_sel:
targets.append(target)
instances.append(instance)
y = np.array(np.hstack(targets))
data_matrix = np.array(np.vstack(instances))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_filtered_y_selected_xi(ft_ll_mvar_diffuse, Yt_mvar_diffuse_missing,\n theta_ll_mvar_diffuse):\n kf = Filter(ft_ll_mvar_diffuse, Yt_mvar_diffuse_missing, for_smoother=True)\n kf.fit(theta_ll_mvar_diffuse)\n\n Yt_filtered, Yt_filtered_cov, xi_t, P_t = kf.get_filtered_val(xi_col=[1])\n ... | [
"0.61345506",
"0.6070175",
"0.5789391",
"0.5716998",
"0.55448633",
"0.55296534",
"0.552856",
"0.54475015",
"0.54305905",
"0.532205",
"0.5315523",
"0.5311356",
"0.52997905",
"0.52886343",
"0.5269368",
"0.5262583",
"0.525977",
"0.52470815",
"0.5238103",
"0.5230181",
"0.52021295... | 0.8484909 | 0 |
Creates dataset init ops | def get_data(self, t_img_path, v_img_path, t_label_path, v_label_path):
train_label_names = tf.constant(sorted(os.path.join(t_label_path, name) for name in os.listdir(t_label_path)))
val_label_names = tf.constant(sorted(os.path.join(v_label_path, name) for name in os.listdir(v_label_path)))
trai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dataset: List, ops: Callable):\n self.dataset = dataset\n self.ops = ops",
"def initialize(labels, init_data):\n ds = None\n init_data = {k: list(v) for k, v in init_data.items()}\n\n logger.info(\n \"Initializing dataset from metadata:\\n %s\",\n ... | [
"0.7228326",
"0.71012825",
"0.6987401",
"0.6496032",
"0.6493157",
"0.6420163",
"0.6392162",
"0.6320458",
"0.6305765",
"0.62881154",
"0.62773603",
"0.62770873",
"0.62629074",
"0.62583405",
"0.62443435",
"0.6227779",
"0.6221623",
"0.6217566",
"0.6180067",
"0.6175939",
"0.615840... | 0.0 | -1 |
Input n>=6, Returns a array of primes, 2 <= p < n | def primesfrom2to( n ):
sieve = numpy.ones( n / 3 + ( n % 6 == 2 ), dtype = numpy.bool )
for i in range( 1, int( ( n ** 0.5 ) / 3 ) + 1 ):
if sieve[i]:
k = 3 * i + 1 | 1
sieve[ k * k / 3 ::2 * k] = False
sieve[k * ( k - 2 * ( i & 1 ) + 4 ) / 3::2 * k] = Fals... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_probable_prime(n: int) -> [int]:\n return [6*n-1, 6*n+1]",
"def get_primes(n):\n\n return list(primes_sieve(n))",
"def prime_array(number_of_primes) -> array:\n p = array('i',list(primes(number_of_primes)))\n return p",
"def make_primes(n):\n out_list = []\n for i in range(2, n):\n ... | [
"0.78794837",
"0.7844462",
"0.7794001",
"0.7650399",
"0.76267445",
"0.75199157",
"0.75007695",
"0.7485805",
"0.7467418",
"0.7456889",
"0.74280035",
"0.7408829",
"0.739569",
"0.7378604",
"0.73657995",
"0.7363449",
"0.7356423",
"0.73505896",
"0.7329447",
"0.7302531",
"0.7290287... | 0.7057185 | 41 |
MillerRabin primality test. A return value of False means n is certainly not prime. A return value of True means n is very likely a prime. | def is_probable_prime( n, trials = 5 ):
if n in smallprimeset: return True
if n < 2: return False
# special case 2
if n == 2:
return True
# ensure n is odd
if n % 2 == 0:
return False
# write n-1 as 2**s * d
# repeatedly try to divide n-1 by 2
s = 0
d = n - 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_miller_rabin_prime(n):\n if n <= 1:\n return False\n elif n == 2:\n return True\n elif n % 2 == 0:\n return False\n \n witnesses = get_witnesses(n)\n if witnesses is None:\n msg = 'No definite Miller-Rabin test is available for %d' % n\n raise ValueError(... | [
"0.84417737",
"0.84417737",
"0.7847736",
"0.76265544",
"0.7461997",
"0.7272998",
"0.72655344",
"0.7262457",
"0.7244091",
"0.72411853",
"0.72353023",
"0.7231865",
"0.7213993",
"0.7198422",
"0.7157901",
"0.7113998",
"0.71125114",
"0.70688444",
"0.70592713",
"0.7039264",
"0.7028... | 0.0 | -1 |
Apply a transformation matrix on a 3D vector. | def transform(vector3, matrix4x4):
if numpy:
return numpy.dot(matrix4x4, numpy.append(vector3, 1.))
else:
m0,m1,m2,m3 = matrix4x4; x,y,z = vector3
return [
m0[0]*x + m0[1]*y + m0[2]*z + m0[3],
m1[0]*x + m1[1]*y + m1[2]*z + m1[3],
m2[0]*x + m2[1]*y + m2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TransformVector(self, *args):\n return _itkTranslationTransformPython.itkTranslationTransformD3_TransformVector(self, *args)",
"def rigid_transform_3d(v, mapping, alpha = 1):\r\n p_wgt = vec3(0, 0, 0)\r\n q_wgt = vec3(0, 0, 0)\r\n w = len(mapping)*[None]\r\n w_sum = 0\r\n for i in range... | [
"0.738713",
"0.7186637",
"0.7058797",
"0.6812435",
"0.6684755",
"0.6658956",
"0.6642793",
"0.6627984",
"0.6591423",
"0.65812194",
"0.64994043",
"0.64821887",
"0.64798087",
"0.64449435",
"0.643927",
"0.64314204",
"0.6343357",
"0.6315317",
"0.6253186",
"0.6221762",
"0.621584",
... | 0.7092017 | 2 |
List all comments for an issue. | def issues_comments_list(self, mar, request):
issue = self._services.issue.GetIssueByLocalID(
mar.cnxn, mar.project_id, request.issueId)
comments = self._services.issue.GetCommentsForIssue(
mar.cnxn, issue.issue_id)
comments = [comment for comment in comments if not comment.approval_id]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(self, number, user=None, repo=None):\n request = self.make_request('issues.comments.list', user=user,\n repo=repo, number=number)\n return self._get_result(request)",
"def _get_comments(self, issue_id):\n data = self._get(\"/issues/{}/comments\".format(issue_id))\n ... | [
"0.7558981",
"0.7420481",
"0.727329",
"0.6936172",
"0.6936172",
"0.6916634",
"0.67353374",
"0.6678606",
"0.66298175",
"0.6625643",
"0.66230786",
"0.6616737",
"0.6607049",
"0.6538406",
"0.6468817",
"0.64393175",
"0.6423474",
"0.6390914",
"0.6377556",
"0.6278862",
"0.6278862",
... | 0.6965185 | 3 |
List all comments for an issue approval. | def approvals_comments_list(self, mar, request):
issue = self._services.issue.GetIssueByLocalID(
mar.cnxn, mar.project_id, request.issueId)
if not permissions.CanViewIssue(
mar.auth.effective_ids, mar.perms, mar.project, issue,
mar.granted_perms):
raise permissions.PermissionExcept... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_comments_for_approval(self):\n comments = self.session.query(Comment).join(Approval) \\\n .filter(Approval.status == 'pending') \\\n .all()\n return comments",
"def comments(accountable):\n comments = accountable.issue_comments()\n headers = sorted(['author_name... | [
"0.71432596",
"0.6547865",
"0.6429646",
"0.6302375",
"0.61952096",
"0.6126566",
"0.6038103",
"0.6038103",
"0.59228766",
"0.58632547",
"0.5829449",
"0.5776908",
"0.5746285",
"0.5710434",
"0.56944376",
"0.56560457",
"0.56541723",
"0.56222004",
"0.56105626",
"0.55982727",
"0.556... | 0.7495892 | 0 |
Add an approval comment. | def approvals_comments_insert(self, mar, request):
approval_fd = tracker_bizobj.FindFieldDef(
request.approvalName, mar.config)
if not approval_fd or (
approval_fd.field_type != tracker_pb2.FieldTypes.APPROVAL_TYPE):
raise endpoints.BadRequestException(
'Field definition for %s n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_comment_to_announcement():\n vars = request.vars\n logger.info(\"vars.comment_text: %r\" % (vars.comment_text))\n comment_id = db.Comments.insert(\n comment_text = vars.comment_text,\n score = 1,\n ann_id= vars.ann_id,\n )\n comment = db.Announcements(comment_id)\n\n ... | [
"0.6542173",
"0.6320357",
"0.6003473",
"0.5963254",
"0.5932991",
"0.5869523",
"0.5863791",
"0.5860519",
"0.5799463",
"0.57653475",
"0.5749814",
"0.57496434",
"0.5732111",
"0.57003474",
"0.56941843",
"0.5690149",
"0.56673384",
"0.56437105",
"0.5637857",
"0.5633682",
"0.5616684... | 0.7415307 | 0 |
List all group settings. | def groups_settings_list(self, mar, request):
all_groups = self._services.usergroup.GetAllUserGroupsInfo(mar.cnxn)
group_settings = []
for g in all_groups:
setting = g[2]
wrapper = api_pb2_v1_helpers.convert_group_settings(g[0], setting)
if not request.importedGroupsOnly or wrapper.ext_gro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listAllSettingNames(self):\n\t\treturn sorted(self.settings.iterkeys())",
"def settings_grp(self):\n settings_grp = self.h5[SETTINGS]\n return settings_grp",
"def list_idrac_settings(self):\n return self._idrac_cfg.list_idrac_settings()",
"def settings_group_options():\n return [(... | [
"0.7001259",
"0.6889376",
"0.66286945",
"0.6598292",
"0.6534674",
"0.6448873",
"0.63422287",
"0.63405025",
"0.62368613",
"0.6215511",
"0.6202234",
"0.6138922",
"0.61109143",
"0.60884297",
"0.60884297",
"0.6062838",
"0.6047851",
"0.6034185",
"0.5997378",
"0.59945416",
"0.59922... | 0.7284026 | 0 |
Copy from keras==2.0.6 Batchwise dot product. `batch_dot` is used to compute dot product of `x` and `y` when `x` and `y` are data in batch, i.e. in a shape of | def batch_dot(x, y, axes=None):
if isinstance(axes, int):
axes = (axes, axes)
x_ndim = K.ndim(x)
y_ndim = K.ndim(y)
if x_ndim > y_ndim:
diff = x_ndim - y_ndim
y = tf.reshape(y, tf.concat([tf.shape(y), [1] * (diff)], axis=0))
elif y_ndim > x_ndim:
diff = y_ndi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tensor_batch_dot(t1: Tensor, t2: Tensor) -> Tensor:\n\n msg = (\n \"Please ensure each batch member has the same feature dimension. \"\n f\"First input has {torch.numel(t1) / t1.shape[0]} features, and \"\n f\"second input has {torch.numel(t2) / t2.shape[0]} features.\"\n )\n ass... | [
"0.76498836",
"0.72431135",
"0.69678617",
"0.69678617",
"0.69678617",
"0.69678617",
"0.6965133",
"0.6958034",
"0.69558865",
"0.6905313",
"0.68616223",
"0.6828577",
"0.65278554",
"0.64602166",
"0.6410188",
"0.63609344",
"0.6334415",
"0.6219706",
"0.6196385",
"0.6155781",
"0.61... | 0.7387567 | 1 |
Get the base name of a file, without the extension | def get_base_name(path):
return os.path.basename(path).split('.')[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basefname(fname):\n return os.path.splitext(fname.split(\"\\\\\")[-1])[0]",
"def base_filename(self):\n return self.filename.split('.')[0]",
"def base_name(self):\n return \".\".join(posixpath.basename(self.file_name).split(\".\")[:-1])",
"def base_name(path):\n return os.path.basenam... | [
"0.8722492",
"0.8718379",
"0.86850685",
"0.8615665",
"0.8470557",
"0.82295775",
"0.7987349",
"0.797385",
"0.7939366",
"0.7893867",
"0.77716887",
"0.774493",
"0.7717036",
"0.7717036",
"0.7705588",
"0.76775694",
"0.76683044",
"0.76265204",
"0.7623315",
"0.760707",
"0.75980675",... | 0.85497314 | 4 |
Get just the IWP file 'ID' code from the full path name that includes a twopart suffix | def id_from_input_path(input):
input = get_base_name(input)
parts = input.split('_')
parts = parts[:-2]
input = '_'.join(parts)
return input | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_id(file_path):\n # An example of file path is AlkEthOH_tripos/AlkEthOH_chain_filt1/AlkEthOH_c555.crd\n return os.path.splitext(os.path.basename(file_path))[0][9:]",
"def _get_aso_id_from_file_name(self, filename: str) -> str:\n id_parts = filename.split('/')\n prefix = id_... | [
"0.76802593",
"0.73816335",
"0.6998597",
"0.6933438",
"0.6660552",
"0.6653681",
"0.65873957",
"0.6504624",
"0.6502001",
"0.6498844",
"0.6459968",
"0.6430352",
"0.6394085",
"0.63763714",
"0.63728666",
"0.63685185",
"0.63311136",
"0.62877166",
"0.6273874",
"0.62726235",
"0.6266... | 0.61424935 | 35 |
Get the IWP subdirectory name from the footprint file path. The subdirectory of the input file is the the filename of the matching footprint, minus the prefix 'selection_', plus the suffix '_iwp' | def subdir_from_footprint_path(footprint_path):
subdir = get_base_name(footprint_path)
subdir = subdir.removeprefix(options['footprint_file_prefix'])
subdir += options['subdir_suffix']
return subdir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_dir_name(input_file):\r\n fname = PurePath(input_file).__str__()\r\n s = fname.split('.')\r\n name = '.'.join(s[:-1])\r\n return name",
"def GetBase(self, fname, suffix):\n wds = fname.split('/')\n suff = suffix.replace('.BRIK','')\n suff = suff.replace('.HEAD','')\n ... | [
"0.6320035",
"0.5867224",
"0.57166874",
"0.571109",
"0.5705613",
"0.5688762",
"0.56745434",
"0.56715184",
"0.55898315",
"0.55681175",
"0.5538828",
"0.552435",
"0.5518",
"0.5501995",
"0.547681",
"0.54724747",
"0.5450016",
"0.5432672",
"0.5432672",
"0.5432672",
"0.5432428",
"... | 0.64883614 | 0 |
Gets the account_moid of this WorkflowBatchApiExecutor. The Account ID for this managed object. | def account_moid(self):
return self._account_moid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_id(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"account_id\")",
"def account_id(self):\n return self._account_id",
"def account_id(self):\n\n return self._account_id",
"def account_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"account_id\")",
... | [
"0.64738625",
"0.64040136",
"0.64032",
"0.6378414",
"0.6378414",
"0.6378414",
"0.63115627",
"0.6276894",
"0.62712806",
"0.62583804",
"0.62583804",
"0.62583804",
"0.62583804",
"0.62583804",
"0.62583804",
"0.62583804",
"0.62583804",
"0.6175577",
"0.6144302",
"0.61271894",
"0.61... | 0.7088792 | 0 |
Sets the account_moid of this WorkflowBatchApiExecutor. The Account ID for this managed object. | def account_moid(self, account_moid):
self._account_moid = account_moid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_moid(self):\n return self._account_moid",
"def account_moid(self):\n return self._account_moid",
"def set_account(self, account: str):\n ret = self._call_txtrader_api('set_account', {'account': account})\n if ret:\n self.account = account\n return ret",... | [
"0.5753331",
"0.5753331",
"0.5707494",
"0.5618736",
"0.5618736",
"0.5618736",
"0.5618736",
"0.55217457",
"0.55036414",
"0.55036414",
"0.5502706",
"0.54269034",
"0.5405541",
"0.5405541",
"0.5405541",
"0.5405541",
"0.5405541",
"0.5405541",
"0.4975552",
"0.48523232",
"0.48296833... | 0.76433355 | 0 |
Gets the create_time of this WorkflowBatchApiExecutor. The time when this managed object was created. | def create_time(self):
return self._create_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_time(self) -> datetime.datetime:\n return self.__created_time",
"def created_time(self) -> datetime.datetime:\n return self.__created_time",
"def create_time(self) -> str:\n return pulumi.get(self, \"create_time\")",
"def create_time(self) -> str:\n return pulumi.get(s... | [
"0.7639924",
"0.7639924",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
"0.74981153",
... | 0.79129165 | 0 |
Gets the domain_group_moid of this WorkflowBatchApiExecutor. The DomainGroup ID for this managed object. | def domain_group_moid(self):
return self._domain_group_moid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_id(self):\n return self._id",
"def group_id(self):\n return self._group_id",
"def group_id(self):\n return self._group_id",
"def group_id(self):\n return self._group_id",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self)... | [
"0.6587563",
"0.6582382",
"0.6582382",
"0.6582382",
"0.65722436",
"0.65722436",
"0.6560763",
"0.65091735",
"0.6433825",
"0.64053357",
"0.63860744",
"0.6360527",
"0.6333345",
"0.63146704",
"0.62019366",
"0.6163591",
"0.613648",
"0.613648",
"0.613648",
"0.60795635",
"0.60084134... | 0.7252836 | 0 |
Gets the moid of this WorkflowBatchApiExecutor. The unique identifier of this Managed Object instance. | def moid(self):
return self._moid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getId(self):\n\n return self.__id",
"def managed_object_id(self):\n o = self._data[\"managed_object\"]\n if type(o) in (int, long):\n return o\n return o.id",
"def id(self):\n return self.job_proto.id",
"def objectId( self ):\n return self._objectId",
... | [
"0.6357956",
"0.63547254",
"0.6315938",
"0.63015085",
"0.60821563",
"0.6072721",
"0.6072721",
"0.60697675",
"0.6067663",
"0.6066526",
"0.6038326",
"0.60256547",
"0.6012163",
"0.5965512",
"0.595504",
"0.59375596",
"0.5929771",
"0.59208244",
"0.59027165",
"0.59027165",
"0.58687... | 0.0 | -1 |
Sets the moid of this WorkflowBatchApiExecutor. The unique identifier of this Managed Object instance. | def moid(self, moid):
self._moid = moid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setObjectID(self, id):\n\n self.objectID = id[0]",
"def batch_id(self, batch_id):\n\n self._batch_id = batch_id",
"def _set_id(self):\n raise NotImplementedError()",
"def setObjectID(self, objectid):\n self._objectid = objectid",
"def device_mo_id(self, device_mo_id):\n\n ... | [
"0.5905101",
"0.5628933",
"0.5473338",
"0.53723526",
"0.5206016",
"0.51794267",
"0.51664287",
"0.5124598",
"0.5101887",
"0.5100491",
"0.5063439",
"0.50485593",
"0.5043015",
"0.5032352",
"0.50299937",
"0.498543",
"0.49520868",
"0.4946386",
"0.49347198",
"0.49347198",
"0.493471... | 0.6309051 | 0 |
Gets the object_type of this WorkflowBatchApiExecutor. The fullyqualified type of this managed object, i.e. the class name. This property is optional. The ObjectType is implied from the URL path. If specified, the value of objectType must match the class name specified in the URL path. | def object_type(self):
return self._object_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_type(self) -> Optional[str]:\n return pulumi.get(self, \"object_type\")",
"def object_type(self) -> Optional[str]:\n return pulumi.get(self, \"object_type\")",
"def object_type(self) -> str:\n return pulumi.get(self, \"object_type\")",
"def object_type(self) -> str:\n r... | [
"0.722901",
"0.722901",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.71433955",
"0.70819426",
"0.70532066",
... | 0.7109746 | 18 |
Sets the object_type of this WorkflowBatchApiExecutor. The fullyqualified type of this managed object, i.e. the class name. This property is optional. The ObjectType is implied from the URL path. If specified, the value of objectType must match the class name specified in the URL path. | def object_type(self, object_type):
self._object_type = object_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_type(self, object_type: str):\n allowed_values = [\"actuator\", \"sensor\", \"human\", \"service\", \"skill\", \"task\", \"action\", \"healthdata\",\n \"humanrole\", \"message\", \"permission\", \"preference\", \"property\"] # noqa: E501\n if object_type not in al... | [
"0.75258404",
"0.62527084",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.57409626",
"0.5712905",... | 0.7513475 | 2 |
Gets the owners of this WorkflowBatchApiExecutor. The array of owners which represent effective ownership of this object. | def owners(self):
return self._owners | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owners(self):\n return self.find_users_by_rel('owner')",
"def owners(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"owners\")",
"def owners(self):\n return self.properties.get('owners',\n DirectoryObjectCollection(self.con... | [
"0.69466597",
"0.6894403",
"0.68243307",
"0.6687064",
"0.6687064",
"0.62827796",
"0.622095",
"0.6179555",
"0.60986096",
"0.60633194",
"0.59689367",
"0.581512",
"0.581512",
"0.5785311",
"0.5783476",
"0.57661813",
"0.57558376",
"0.5723181",
"0.55766666",
"0.5479084",
"0.5401708... | 0.733332 | 0 |
Sets the owners of this WorkflowBatchApiExecutor. The array of owners which represent effective ownership of this object. | def owners(self, owners):
self._owners = owners | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manage_owners():\n\n owner_data = request.get_json(force=True)\n return _get_owner_service().create_owner(owner_data)",
"def owners(self):\n return self._owners",
"def owners(self):\n return self._owners",
"def owners(self):\n from hubspot3.owners import OwnersClient\n\n ret... | [
"0.58207035",
"0.5671876",
"0.5671876",
"0.56253904",
"0.56157494",
"0.5493242",
"0.5458117",
"0.5380697",
"0.5380697",
"0.5324698",
"0.5275815",
"0.5214939",
"0.51906705",
"0.51845175",
"0.51845175",
"0.51845175",
"0.5124524",
"0.5124524",
"0.5124524",
"0.5124524",
"0.512218... | 0.7698695 | 0 |
Gets the tags of this WorkflowBatchApiExecutor. The array of tags, which allow to add key, value metadata to managed objects. | def tags(self):
return self._tags | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> list[str]:\n _args: list[Arg] = []\n _ctx = self._select(\"tags\", _args)\n return _ctx.execute_sync(list[str])",
"def get_tags(self, *args, **kwargs):\n \n tags_data = api.get_tags(\n *args,\n api_key=self.__creds.api_key_v2,\n ... | [
"0.69283295",
"0.6869225",
"0.6647828",
"0.6643744",
"0.6631541",
"0.6606152",
"0.6565971",
"0.656242",
"0.65588933",
"0.6546558",
"0.651932",
"0.64576626",
"0.6456996",
"0.64560634",
"0.6454542",
"0.64260453",
"0.64079446",
"0.6403049",
"0.6403049",
"0.63795036",
"0.6357683"... | 0.65358555 | 14 |
Sets the tags of this WorkflowBatchApiExecutor. The array of tags, which allow to add key, value metadata to managed objects. | def tags(self, tags):
self._tags = tags | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tags(self, session, *tags):\n if not tags:\n return list()\n\n result = self._tag(session.put, tags=list(tags), session=session)\n return result['tags']",
"def tags(self, tags: List[Tag]):\n\n self._tags = tags",
"def tags(self, tags):\n self._tags = tags",... | [
"0.69735074",
"0.6759822",
"0.67440313",
"0.67440313",
"0.67440313",
"0.6605888",
"0.6589526",
"0.65419126",
"0.6440928",
"0.6313918",
"0.6256243",
"0.6099469",
"0.5985622",
"0.5906782",
"0.5902245",
"0.5879297",
"0.5861648",
"0.5785989",
"0.5774208",
"0.5744609",
"0.5707991"... | 0.6742126 | 8 |
Gets the version_context of this WorkflowBatchApiExecutor. The versioning info for this managed object. | def version_context(self):
return self._version_context | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_info(self):\n\n return __version_info__",
"def ver(self, context=None):\n return self._client.call_method(\n 'NarrativeMethodStore.ver',\n [], self._service_ver, context)",
"def ver(self, context=None):\n return self._client.call_method(\n 'User... | [
"0.5791689",
"0.5785344",
"0.57385397",
"0.5612428",
"0.560886",
"0.5603485",
"0.5475502",
"0.5456402",
"0.5451085",
"0.5451085",
"0.5445164",
"0.5424925",
"0.5424925",
"0.5408815",
"0.5365859",
"0.535927",
"0.5325427",
"0.52964747",
"0.52897614",
"0.52897614",
"0.52897614",
... | 0.737504 | 0 |
Gets the batch of this WorkflowBatchApiExecutor. Intersight Orchestrator supports one or a batch of APIs to be executed as part of a task execution. The batch cannot be empty. | def batch(self):
return self._batch | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_batch(self):\n return self.batch",
"def _get_batch(self):\n url = self._base_url + urlConfig.URLS['Project'] + '/' + self._project_id + '/batch'\n response = apiCall.get(self._get_token(), url,self._proxy, {}, 10)\n logging.debug(response)\n return response",
"def get... | [
"0.72361815",
"0.72317165",
"0.69421154",
"0.6336531",
"0.62995505",
"0.62995505",
"0.61615914",
"0.5883295",
"0.588326",
"0.5870845",
"0.58513755",
"0.58292747",
"0.57510924",
"0.5728043",
"0.5696091",
"0.5695166",
"0.5655465",
"0.56521666",
"0.5628056",
"0.55229825",
"0.549... | 0.6750247 | 3 |
Sets the description of this WorkflowBatchApiExecutor. A detailed description about the batch APIs. | def description(self, description):
self._description = description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_description(self, description):\r\n self.__description = description",
"def set_description(self, description):\n self.__description = description",
"def set_description(self, desc: str) -> None:\n self.metadata.data[\"description\"] = desc",
"def set_description(self, descriptio... | [
"0.5943588",
"0.59281826",
"0.59096336",
"0.59051067",
"0.5885087",
"0.58637273",
"0.58637273",
"0.58637273",
"0.58637273",
"0.58118945",
"0.5811894",
"0.5811894",
"0.5811894",
"0.5811894",
"0.5723714",
"0.5694468",
"0.56862426",
"0.5641625",
"0.56126744",
"0.557989",
"0.5544... | 0.58578444 | 27 |
Gets the name of this WorkflowBatchApiExecutor. Name for the batch API task. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._job",
"def task_name(self) -> str:\n return self._task_name",
"def task_name(self):\n pass",
"def getTaskName(self):\n return self._taskName",
"def job_name(self) -> str:\n return self._step_execution_context.job_name",
"def task_label(sel... | [
"0.6761571",
"0.6741195",
"0.66268325",
"0.65874505",
"0.6504719",
"0.6442825",
"0.6057092",
"0.60493976",
"0.60322344",
"0.60297066",
"0.602359",
"0.602359",
"0.602359",
"0.602359",
"0.5998743",
"0.59662205",
"0.5948686",
"0.590635",
"0.5892384",
"0.5889946",
"0.5885611",
... | 0.0 | -1 |
Sets the name of this WorkflowBatchApiExecutor. Name for the batch API task. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name: str):\n self._name = name",
"def set_name(self, _name):\n self.name = _name\n return self.name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",... | [
"0.5984576",
"0.5951507",
"0.5899186",
"0.5899186",
"0.5899186",
"0.5899186",
"0.5899186",
"0.58977747",
"0.5890896",
"0.5890896",
"0.58880836",
"0.5880362",
"0.5834161",
"0.5834161",
"0.5832337",
"0.5828101",
"0.5824842",
"0.5804772",
"0.57953644",
"0.5789383",
"0.57802093",... | 0.0 | -1 |
Gets the outcomes of this WorkflowBatchApiExecutor. All the possible outcomes of this task are captured here. Outcomes property is a collection property of type workflow.Outcome objects. The outcomes can be mapped to the message to be shown. The outcomes are evaluated in the order they are given. At the end of the outc... | def outcomes(self):
return self._outcomes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_outcomes(self):\n return [r.outcome for r in self.values()]",
"def get_registered_outcomes(self):\n return tuple(self._outcomes)",
"def outcomes(self):\n return self._get_child_page_of_type(LearningOutcomesPage)",
"def get_outcome(self):\n return self.__outcome",
"def ou... | [
"0.73016924",
"0.63151336",
"0.6299855",
"0.58973",
"0.5824979",
"0.56866753",
"0.5658167",
"0.5596112",
"0.5565674",
"0.5491214",
"0.5328147",
"0.5324455",
"0.5287844",
"0.527698",
"0.52695507",
"0.51610583",
"0.50958276",
"0.50441843",
"0.5041611",
"0.4964966",
"0.49406797"... | 0.7377749 | 0 |
Sets the outcomes of this WorkflowBatchApiExecutor. All the possible outcomes of this task are captured here. Outcomes property is a collection property of type workflow.Outcome objects. The outcomes can be mapped to the message to be shown. The outcomes are evaluated in the order they are given. At the end of the outc... | def outcomes(self, outcomes):
self._outcomes = outcomes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outcomes(self):\n return self._outcomes",
"def split_by_outcome(self, outcomes=None, subdir='by_outcome'):\n if outcomes is not None:\n allowed_outcomes = ['passed', 'failed', 'skipped']\n unexpected_outcomes = set(outcomes) - set(allowed_outcomes)\n if unexpect... | [
"0.6238879",
"0.5986167",
"0.59731",
"0.5737686",
"0.5367333",
"0.5330748",
"0.5121668",
"0.50631475",
"0.50191414",
"0.4891231",
"0.48628262",
"0.48551583",
"0.48533133",
"0.4823886",
"0.47819117",
"0.47554523",
"0.4754102",
"0.46995634",
"0.464953",
"0.46213305",
"0.4590198... | 0.7469257 | 0 |
Gets the task_definition of this WorkflowBatchApiExecutor. The interface task definition for which this batch API is one of the implementation. | def task_definition(self):
return self._task_definition | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_definition_arn(self) -> str:\n return pulumi.get(self, \"task_definition_arn\")",
"def task(self) -> base_model.BaseTask:\n return self._task",
"def task(self):\n return self._task",
"def task(self):\n return self._task",
"def task(self):\n return self._task",
"def... | [
"0.602242",
"0.6003091",
"0.5933643",
"0.5933643",
"0.5933643",
"0.5933643",
"0.5933643",
"0.58794576",
"0.57077056",
"0.5690264",
"0.5689639",
"0.5662935",
"0.56494564",
"0.5640612",
"0.5628572",
"0.5591912",
"0.557512",
"0.54452246",
"0.54404",
"0.5428053",
"0.5413085",
"... | 0.7491101 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, WorkflowBatchApiExecutor):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Hands off a new asset creation request and returns the result of the request. Like all brokerage methods, this method always returns an HTTP response. The idea is to call this in requestprocessing workflow when you know that you've got an asset creation request. | def new_user_asset(asset_type=None):
if asset_type == "settlement":
S = settlements.Settlement()
return S.serialize()
elif asset_type == "survivor":
S = survivors.Survivor()
return S.serialize()
elif asset_type == "survivors":
output = survivors.create_many_survivors... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self) -> requests.request:\n # Check needed values\n if None in [self.args.type, self.args.title, self.args.label, self.args.url]:\n raise Exception('Provide all parameters for asset creation')\n # Check type\n if self.args.type not in ['photo', 'video']:\n ... | [
"0.71044713",
"0.6824637",
"0.6371647",
"0.62373734",
"0.6138768",
"0.5841025",
"0.57494426",
"0.5714956",
"0.5697723",
"0.56971925",
"0.56697994",
"0.56697994",
"0.56697994",
"0.56697994",
"0.56697994",
"0.56697994",
"0.56697994",
"0.56697994",
"0.56697994",
"0.56697994",
"0... | 0.5486003 | 81 |
Helper function to convert from alpha string representation to index tuple position on board | def fromAlphaToIndex(pos):
posx = pos[0]
posx = map_from_alpha_to_index[posx]
posy = int(pos[1]) - 1
return (posx, posy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toindex(col, row):\n a2z = 'ABCDEFGHIJLKMNOPQRSTUVWXYZ'\n\n total = 0\n mult = 0\n for char in col:\n total += (a2z.find(char) + (26 * mult))\n mult += 1\n\n return total, row - 1",
"def str_to_tile_index(s, index_of_a = 0xe6, index_of_zero = 0xdb, special_cases = None):\n\n\tres... | [
"0.68529546",
"0.66593647",
"0.6576745",
"0.6576745",
"0.65248114",
"0.6418106",
"0.63666874",
"0.6338965",
"0.63121986",
"0.6287619",
"0.62801754",
"0.62801754",
"0.622487",
"0.61387396",
"0.6130582",
"0.6126494",
"0.61034834",
"0.6081706",
"0.607489",
"0.60608727",
"0.60608... | 0.74910635 | 0 |
Finds and returns the king of the player on the board | def findKing(player, board):
foundKing = False
for col in board:
for item in col:
if type(item) == King.King and item.player == player:
foundKing = True
return item
if foundKing == False:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_winner(self):\n for row in self.board.values():\n if all([mark == \"x\" for mark in row]):\n return self.player_1\n elif all([mark == \"o\" for mark in row]):\n return self.player_2\n\n # checks every column\n for i in range(3):\n ... | [
"0.69748396",
"0.6878227",
"0.68528605",
"0.6839314",
"0.68342173",
"0.6774345",
"0.6749222",
"0.67408013",
"0.67295915",
"0.6717853",
"0.6712404",
"0.6702228",
"0.66877615",
"0.66014135",
"0.657088",
"0.6564646",
"0.65353686",
"0.6519155",
"0.65164864",
"0.6513603",
"0.65052... | 0.75798047 | 0 |
Return all possible moves the player can make that would result in a board that the player is NOT in check Returns a list of tuples. Each tuple has beginning location of piece to move and end location for that piece | def getPossibleMovesOutCheck(player, board):
possibleMoves = []
for col in board:
for piece in col:
if type(piece) != int and piece.player == player:
pieceMoves = piece.availableMoves(board)
piecePosX = piece.posx
piecePosY = piece.posy
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_moves(self, board, player):\n result = []\n for startx in range(8):\n for starty in range(8):\n for destx in range(8):\n for desty in range(8):\n if self.is_legal_move(board, [startx, starty], [destx, desty], player):\n ... | [
"0.7928111",
"0.7865913",
"0.78287655",
"0.77758765",
"0.7759376",
"0.7671728",
"0.76646775",
"0.7600633",
"0.7576858",
"0.7573768",
"0.7565908",
"0.75644505",
"0.7427706",
"0.7390528",
"0.7353388",
"0.7349019",
"0.7332688",
"0.7305832",
"0.73003733",
"0.72845924",
"0.7239056... | 0.80215305 | 0 |
Return all possible drops the player can make that would result in a board that the player is NOT in check Returns a list of tuples. Each tuple has piece to drop, and position to drop the piece | def getPossibleDropsOutCheck(player, board, playerCaptures):
listDropOutCheck = []
for piece in playerCaptures:
#Get all available places to drop the piece
listDropPiece = piece.availableDrops(board)
if type(listDropPiece) == list:
for item in listDropPiece:
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPossibleMovesOutCheck(player, board):\n possibleMoves = []\n for col in board:\n for piece in col:\n if type(piece) != int and piece.player == player:\n pieceMoves = piece.availableMoves(board)\n piecePosX = piece.posx\n piecePosY = piece.... | [
"0.68249255",
"0.658092",
"0.63780254",
"0.6345417",
"0.6344377",
"0.63378346",
"0.6320061",
"0.6210662",
"0.62022746",
"0.6171664",
"0.6165296",
"0.6125685",
"0.60248363",
"0.6007115",
"0.5993438",
"0.59803414",
"0.59419686",
"0.5934674",
"0.59222656",
"0.59205973",
"0.59093... | 0.79056436 | 0 |
Divides the data into batches of sequences so that all the sequences in one batch continue in the next batch. This is a generator that will keep returning batches until the input data has been seen nb_epochs times. Sequences are continued even between epochs, apart from one, the one corresponding to the end of raw_data... | def rnn_minibatch_sequencer(raw_data, batch_size, sequence_size, nb_epochs):
data = np.array(raw_data)
data_len = data.shape[0]
# using (data_len-1) because we must provide for the sequence shifted by 1 too
nb_batches = (data_len - 1) // (batch_size * sequence_size)
assert nb_batches > 0, "Not enoug... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_batch(self):\n batch_size = self.batch_size\n shuffle = self.shuffle\n data = np.array(self.sentences)\n\n data_size = len(data)\n num_batches_per_epoch = int((len(data) - 1) / batch_size) + 1\n while True:\n # shuffle the data at starting of each epoch\... | [
"0.7287645",
"0.71434605",
"0.70285875",
"0.7019102",
"0.68249834",
"0.66926587",
"0.66899943",
"0.6600294",
"0.6544496",
"0.654233",
"0.6531302",
"0.65159994",
"0.65147334",
"0.6508471",
"0.65073603",
"0.6490444",
"0.6488181",
"0.6477988",
"0.6466805",
"0.6433293",
"0.642861... | 0.70348835 | 2 |
If the provided password does not match the user who created the verification, the serializer should fail to validate. | def test_validate_invalid_password(email_verification_factory, user_factory):
user = user_factory(password=PASSWORD)
verification = email_verification_factory(email__user=user)
data = {
'password': PASSWORD * 2,
'token': verification.token,
}
serializer = serializers.EmailVerificati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self, data):\n if not self._verification.email.user.check_password(data['password']):\n raise serializers.ValidationError(\n code='invalid_password',\n detail={\n 'password': (\n _('The provided password does not... | [
"0.8222394",
"0.76007265",
"0.7474513",
"0.74269116",
"0.7414218",
"0.717126",
"0.7116366",
"0.7102825",
"0.7036165",
"0.6997485",
"0.698447",
"0.69178486",
"0.6913654",
"0.6894756",
"0.6888146",
"0.6884209",
"0.68353486",
"0.6818993",
"0.68124557",
"0.6776924",
"0.6762811",
... | 0.7041085 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.