query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return a dictionary with the workspaces for the given tracers. | def get_workspaces_dict(
self, tracer_names, bins, cache=None, fields=None, masks=None, **kwargs
):
mask_names = self.get_mask_names_dict(tracer_names)
if masks is None:
masks = self.get_masks_dict(tracer_names, cache)
if fields is None:
fields = self.get_fiel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workspaces(self):\n return WorkspaceCollection(client=self)",
"def _get_workspaces(environ, include_fuerte=False, include_non_existing=False):\n # get all cmake prefix paths\n env_name = 'CMAKE_PREFIX_PATH'\n value = environ[env_name] if env_name in environ else ''\n paths = [path for path... | [
"0.61350834",
"0.5921812",
"0.56038654",
"0.54939324",
"0.5484076",
"0.5455866",
"0.53780025",
"0.53523856",
"0.52552027",
"0.5165345",
"0.50992",
"0.5087015",
"0.5063419",
"0.50469375",
"0.5031635",
"0.49122727",
"0.49098918",
"0.4897525",
"0.48877034",
"0.48779872",
"0.4871... | 0.611199 | 1 |
Modify an instance with the given id. | def modify_rent(self, idBook, idCustomer, flag, id):
allR=self.__loadFromFile()
bk=Rent(idBook, idCustomer, flag, id)
if bk not in allR:
raise RepositoryExceptionRent("\n Id doesn't exit. \n".upper())
allR.remove(bk)
allR.append(bk)
self.__storeToFi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(self, id):\n self.not_supported()",
"def put(self, id):\n return update_msg(request.json, id)",
"def put(self,id):\r\n data = request.json\r\n return update(id=id,data=data)",
"def put(self, id):\n adm = Administration()\n print(api.payload)\n p = Pers... | [
"0.6979777",
"0.6617178",
"0.65552044",
"0.65305954",
"0.650712",
"0.64772105",
"0.64772105",
"0.64772105",
"0.64772105",
"0.64772105",
"0.6452408",
"0.6452408",
"0.6452408",
"0.6452408",
"0.6452408",
"0.6452408",
"0.6452408",
"0.6452408",
"0.6452408",
"0.6452408",
"0.6452408... | 0.0 | -1 |
Calculate learning rate with linear warmup and rsqrt decay. | def get_learning_rate(learning_rate, hidden_size, learning_rate_warmup_steps):
with tf.name_scope("learning_rate"):
warmup_steps = tf.to_float(learning_rate_warmup_steps)
step = tf.to_float(tf.train.get_or_create_global_step())
learning_rate *= (hidden_size ** -0.5)
# Apply linear w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __learning_rate(self, lr0, epoch):\n \n \"\"\"\n Dan's Methos\n \"\"\"\n lrs = lr0 * 0.001\n c = np.power((lrs/lr0), 1.0/self.__maxEpoch)\n \n return lr0*np.power(c, epoch)",
"def learning_rate_fn():\n start_learning_rate = FLAGS.start_learning_rate\n ... | [
"0.78579855",
"0.78059024",
"0.7659233",
"0.7541859",
"0.7498769",
"0.7498769",
"0.7494381",
"0.7482913",
"0.74484617",
"0.7300512",
"0.7273702",
"0.7242091",
"0.7216838",
"0.72043455",
"0.717586",
"0.7158193",
"0.71453744",
"0.71265227",
"0.7124896",
"0.71209353",
"0.7120935... | 0.7359549 | 9 |
Returns the minimax action using self.depth and self.evaluationFunction | def getAction(self, gameState):
"*** YOUR CODE HERE ***"
" Max value "
def max_value(gameState, depth, alpha, beta):
action = gameState.getLegalActions(0)
if gameState.isWin() or gameState.isLose() or depth == self.depth:
return (self.evaluat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o... | [
"0.7482665",
"0.7383559",
"0.71806973",
"0.7110041",
"0.70884514",
"0.70694935",
"0.70683014",
"0.7048308",
"0.70055133",
"0.69651455",
"0.69642085",
"0.69604385",
"0.6945924",
"0.68998593",
"0.6895832",
"0.688605",
"0.6826282",
"0.6767276",
"0.6758028",
"0.6751636",
"0.67054... | 0.0 | -1 |
Returns the argmax decoding given the probability matrix. Removes repeated elements in the sequence, as well as blanks. | def decode(self, probs, sizes=None, return_offsets=False):
if len(probs.shape) == 2:
return self.decode(probs.unsqueeze(0), sizes, return_offsets)
_, max_probs = torch.max(probs, 2)
strings, offsets = self.convert_to_strings(max_probs.view(max_probs.size(0), max_probs.size(1)), size... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_decode(M):\r\n return scipy.array([ f.val.argmax() for f in M])",
"def decode_data(matrix, reverse_vocab):\n try:\n return \"\".join([reverse_vocab[np.argmax(row)] for encoded_matrix in matrix for row in encoded_matrix]).strip(\n NOSYM)\n except:\n return \"ERROR\"",
"... | [
"0.70179653",
"0.658357",
"0.62192166",
"0.62161404",
"0.6200235",
"0.6182412",
"0.604933",
"0.6045412",
"0.60318315",
"0.60217685",
"0.6000075",
"0.5971258",
"0.5923959",
"0.5901419",
"0.5893658",
"0.5824791",
"0.576949",
"0.5739862",
"0.5738228",
"0.570926",
"0.56982225",
... | 0.0 | -1 |
Takes some floating point number and rounds to closest base | def my_round(x, base=10):
return base * round(x / base) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_round(x, base):\n\n return base * round(x/base)",
"def downround(x, base):\n return base * math.floor(float(x) / base)",
"def round_mult(x, base=10):\n a = ((abs(x) - 1) // base) * base # nearest multiple\n b = a + base # round up\n return b * np.sign(x)",
"def upround(x, base):\n ... | [
"0.7777093",
"0.76591784",
"0.74518603",
"0.7326182",
"0.7315885",
"0.7277933",
"0.69491935",
"0.6758171",
"0.67547965",
"0.673595",
"0.6641624",
"0.66161114",
"0.6604063",
"0.6602199",
"0.65796006",
"0.65039194",
"0.648536",
"0.64684826",
"0.6444194",
"0.6441123",
"0.6434845... | 0.767143 | 1 |
make pdf qr code sheet, 3 columns by 8 rows | def make_qr(df):
stuff = df.survey_name.tolist()
df = pd.DataFrame({'stuff': stuff})
df["num"] = df.index + 1
df["c"] = df.num % 3
df.c = df.c.replace(0, 3)
df["page"] = ((df.num + 23) // 24)
df["r"] = (((df.num - 1) // 3) + 1) % 8
df.r = df.r.replace(0, 8)
dt = str(datetime.datetim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_qr_codes(self, frame):\n for qr in self.codes:\n (x, y, w, h) = qr[\"rect\"]\n cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 0, 255), 2)\n cv2.putText(frame, qr[\"text\"], (x, y-10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 2)\n\n return frame",
"def myLa... | [
"0.5925497",
"0.5876405",
"0.57754964",
"0.5747474",
"0.57298267",
"0.5695784",
"0.55924565",
"0.5570672",
"0.55538553",
"0.55093914",
"0.54915774",
"0.54524034",
"0.53107464",
"0.5305039",
"0.5149739",
"0.5145077",
"0.5140877",
"0.5129712",
"0.5122738",
"0.51152617",
"0.5099... | 0.78536195 | 0 |
Sets the policy_name of this PatchPolicySummary. | def policy_name(self, policy_name):
self._policy_name = policy_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_policyname(self, policyname):\n self.options['policyname'] = policyname",
"def set_policyname(self, policyname):\n self.options[\"policyname\"] = policyname",
"def policy_type_name(self, policy_type_name):\n allowed_values = [\"patch\", \"custom\", \"required_software\"] # noqa: E... | [
"0.8010508",
"0.80012757",
"0.6755278",
"0.64122355",
"0.63197684",
"0.63197684",
"0.63197684",
"0.63197684",
"0.63197684",
"0.63197684",
"0.63197684",
"0.6210187",
"0.6210187",
"0.613095",
"0.58552504",
"0.5836135",
"0.5784503",
"0.5761935",
"0.5730833",
"0.5709306",
"0.5709... | 0.80451775 | 1 |
Sets the is_policy_enabled of this PatchPolicySummary. | def is_policy_enabled(self, is_policy_enabled):
self._is_policy_enabled = is_policy_enabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enabled(self, enabled):\n \n self._enabled = enabled",
"def set_enabled(self, enabled=True):\n self._enabled = enabled",
"def enabled(self, enabled):\n\n self._enabled = enabled",
"def enabled(self, enabled):\n\n self._enabled = enabled",
"def _set_pool_enabled(self, ... | [
"0.60635245",
"0.59737253",
"0.593007",
"0.593007",
"0.5916131",
"0.5863338",
"0.57438225",
"0.56845534",
"0.5684071",
"0.5664282",
"0.5664282",
"0.5641294",
"0.56162477",
"0.550019",
"0.550019",
"0.54787034",
"0.5475994",
"0.5456365",
"0.54445326",
"0.54328513",
"0.5419459",... | 0.78727084 | 0 |
Sets the software_title of this PatchPolicySummary. | def software_title(self, software_title):
self._software_title = software_title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_title(self, val):\n self._title = val",
"def updateTitle(self):\n proprietary = ''\n proprietaries = [pro for pro in self.getProprietaries()\n if api.content.get_state(pro) == 'enabled']\n if proprietaries:\n proprietary = ', '.join([prop.Title() for prop in pro... | [
"0.60734624",
"0.60639435",
"0.5901598",
"0.58792967",
"0.58631223",
"0.5862936",
"0.5852901",
"0.58465004",
"0.58138376",
"0.5766815",
"0.57366604",
"0.5723174",
"0.57122403",
"0.57122403",
"0.5696227",
"0.56577975",
"0.56518525",
"0.56461656",
"0.55976784",
"0.5593115",
"0.... | 0.804622 | 0 |
Sets the software_title_configuration_id of this PatchPolicySummary. | def software_title_configuration_id(self, software_title_configuration_id):
self._software_title_configuration_id = software_title_configuration_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def software_title(self, software_title):\n\n self._software_title = software_title",
"def setTitle(self,value):\n self.PDFreactorConfiguration.in1[\"title\"] = value",
"def updateTitle(self):\n proprietary = ''\n proprietaries = [pro for pro in self.getProprietaries()\n ... | [
"0.64721966",
"0.5395726",
"0.5196417",
"0.51226413",
"0.4947873",
"0.49061438",
"0.49008557",
"0.48724303",
"0.48666206",
"0.48647407",
"0.4862379",
"0.4854369",
"0.48127747",
"0.48008034",
"0.47868985",
"0.47771597",
"0.47617954",
"0.47458664",
"0.47293127",
"0.47251198",
"... | 0.8198959 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, PatchPolicySummary):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.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):
if not isinstance(other, PatchPolicySummary):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.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.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
inputs of x1 = 2, y1 = 1, x2 = 2, y2 = 1 yields Distance = 4.5 | def distance2(self):
self.spawn("java Distance").stdin("-2").stdin("-1").stdin("2").stdin("1").stdout("Distance = 4.5\n", "Distance = 4.5\n").exit(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(x1, y1, x2, y2):\n return ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5",
"def get_distance(x1, y1, x2, y2):\n return math.sqrt((x1 - x2) ** 2 + (y1 * 2.38 - y2 * 2.38) ** 2)",
"def getDistance(self, x1, x2, y1, y2):\n return ((x1 - x2)**2 + (y1 - y2)**2)**0.5",
"def distance(x1, y1, x2,... | [
"0.7975866",
"0.7937306",
"0.78418225",
"0.77506363",
"0.76456064",
"0.7515766",
"0.7401424",
"0.7393336",
"0.73912793",
"0.7372974",
"0.7326062",
"0.7317605",
"0.72965455",
"0.7293487",
"0.7277889",
"0.7277504",
"0.7271872",
"0.7259375",
"0.72527903",
"0.7251191",
"0.7227713... | 0.0 | -1 |
Uses action to obtain next state, reward, done. | def step(self, rotor_speeds):
reward = 0
pose_all = []
for _ in range(self.action_repeat):
self.prev_pose = self.sim.pose
done = self.sim.next_timestep(self.action_scale*(rotor_speeds)) # update the sim pose and velocities
reward += self.get_reward()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self, action):\n possible_states, probs = zip(*self.get_next_states(self._current_state, action).items())\n next_state = weighted_choice(possible_states, p=probs)\n reward = self.get_reward(self._current_state, action, next_state)\n is_done = self.is_terminal(next_state)\n ... | [
"0.8106777",
"0.8081674",
"0.79318964",
"0.788988",
"0.7873674",
"0.7870752",
"0.7751757",
"0.7744235",
"0.76798654",
"0.7671487",
"0.76401347",
"0.76312447",
"0.7612135",
"0.7603414",
"0.75804955",
"0.7557466",
"0.7556608",
"0.75313103",
"0.7524345",
"0.7512973",
"0.74929035... | 0.0 | -1 |
Sets the account of this Order. | def account(self, account):
self._account = account | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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",
"def account(self, account: str):\n self._account = account",
"def setAccount(self, account_id):\n self.data_... | [
"0.8283534",
"0.79240483",
"0.7569955",
"0.74243265",
"0.72648144",
"0.71684545",
"0.7167168",
"0.7107526",
"0.7107526",
"0.7107526",
"0.7107526",
"0.7107526",
"0.7107526",
"0.71072274",
"0.6958708",
"0.6903033",
"0.68738604",
"0.6733014",
"0.6733014",
"0.6733014",
"0.6733014... | 0.79821765 | 2 |
Sets the client_order_id of this Order. | def client_order_id(self, client_order_id):
self._client_order_id = client_order_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_id(self, client_id):\n\n self._client_id = client_id",
"def client_id(self, client_id):\n\n self._client_id = client_id",
"def client_id(self, client_id):\n\n self._client_id = client_id",
"def client_id(self, client_id):\n\n self._client_id = client_id",
"def order_i... | [
"0.72273254",
"0.72273254",
"0.72273254",
"0.72273254",
"0.7146626",
"0.7146626",
"0.7146626",
"0.6390582",
"0.63806397",
"0.63806397",
"0.6269393",
"0.5859672",
"0.57696575",
"0.5652904",
"0.54947543",
"0.5473651",
"0.5462106",
"0.5459",
"0.5452022",
"0.5425842",
"0.53977925... | 0.8995281 | 0 |
Sets the executions of this Order. | def executions(self, executions):
self._executions = executions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orders(self, orders):\n\n self._orders = orders",
"def orders(self, orders):\n\n self._orders = orders",
"def runs(self, runs):\n\n self._runs = runs",
"async def on_orders_replaced(self, orders: List[MetatraderOrder]):\n self._orders = orders",
"def set_task_order(self, ord... | [
"0.6528219",
"0.6528219",
"0.6497284",
"0.5922375",
"0.5879755",
"0.58360094",
"0.58360094",
"0.577507",
"0.5766933",
"0.57128286",
"0.5687762",
"0.5664175",
"0.5664175",
"0.55956113",
"0.5528094",
"0.54725283",
"0.5447561",
"0.5447561",
"0.5447561",
"0.5429043",
"0.54165614"... | 0.8400182 | 0 |
Sets the final_status of this Order. | def final_status(self, final_status):
self._final_status = final_status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_status(self, status):\n with self.status_lock:\n if (status in _ENDING_STATUSES) or (not self.status in _ENDING_STATUSES):\n self.status = status",
"def mark_as_done(self):\n self.status = \"DONE\"",
"def setStatus(self, status):\n self.__status = status"... | [
"0.5957665",
"0.5944739",
"0.5868945",
"0.5809267",
"0.5762172",
"0.5756844",
"0.57490873",
"0.57490873",
"0.57490873",
"0.57490873",
"0.57490873",
"0.57490873",
"0.57490873",
"0.57490873",
"0.57490873",
"0.57490873",
"0.57490873",
"0.57490873",
"0.57490873",
"0.57490873",
"0... | 0.86170995 | 0 |
Sets the instrument of this Order. | def instrument(self, instrument):
self._instrument = instrument | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setInstrument(self,instrument):\n self.instrument = instrument\n self.instrument.attach(self)",
"def instrumentName(self, instrumentName):\n\n self._instrumentName = instrumentName",
"def instrument(self, i: int) -> None:\n if i > INSTRUMENT_MAX:\n self._instrument = INSTRUME... | [
"0.77466714",
"0.6726721",
"0.6721906",
"0.65290666",
"0.6484874",
"0.63574517",
"0.59575987",
"0.55676174",
"0.5539324",
"0.5533037",
"0.54937655",
"0.5477979",
"0.5426462",
"0.53192365",
"0.53084505",
"0.52701813",
"0.5262059",
"0.5246512",
"0.52003753",
"0.5156716",
"0.511... | 0.7914742 | 2 |
Sets the leg_count of this Order. | def leg_count(self, leg_count):
self._leg_count = leg_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_legs(self, number_of_legs):\n self.legs = number_of_legs",
"def update_number_of_orders(self):\n self.chair_id.number_of_orders = len(self.env['salon.order'].search(\n [(\"chair_id\", \"=\", self.chair_id.id), (\"stage_id\", \"in\", [2, 3])]))",
"def setCount(self, num):\n ... | [
"0.5900831",
"0.570155",
"0.55898786",
"0.5467503",
"0.54631627",
"0.53746104",
"0.5325903",
"0.53021365",
"0.5284719",
"0.5185248",
"0.5167164",
"0.5162114",
"0.4980203",
"0.48279524",
"0.48175636",
"0.48167625",
"0.48121428",
"0.48100296",
"0.48100296",
"0.48100296",
"0.481... | 0.8199163 | 0 |
Sets the order_id of this Order. | def order_id(self, order_id):
self._order_id = order_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_order_id(self, client_order_id):\n\n self._client_order_id = client_order_id",
"def order_item_id(self, order_item_id):\n if order_item_id is None:\n raise ValueError(\"Invalid value for `order_item_id`, must not be `None`\")\n\n self._order_item_id = order_item_id",
... | [
"0.7365084",
"0.7302405",
"0.6543854",
"0.63200766",
"0.6272423",
"0.6272423",
"0.62082",
"0.6143586",
"0.60736436",
"0.5933947",
"0.593149",
"0.5732861",
"0.5732861",
"0.5732861",
"0.57311815",
"0.57159317",
"0.5701051",
"0.56888497",
"0.56849885",
"0.56789553",
"0.55634207"... | 0.8719017 | 2 |
Sets the price_link of this Order. | def price_link(self, price_link):
self._price_link = price_link | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price(self, price):\n\n self._price = price",
"def price(self, price):\n\n self._price = price",
"def price(self, price):\n\n self._price = price",
"def price(self, price):\n\n self._price = price",
"def price(self, price: float):\n\n self._price = price",
"def setP... | [
"0.7102889",
"0.7102889",
"0.7102889",
"0.7102889",
"0.70127594",
"0.69878346",
"0.6935744",
"0.6822496",
"0.678849",
"0.6514913",
"0.64307606",
"0.631698",
"0.60720426",
"0.60660625",
"0.5935674",
"0.59022474",
"0.59022474",
"0.59022474",
"0.59022474",
"0.59022474",
"0.59022... | 0.8722125 | 0 |
Sets the side of this Order. | def side(self, side):
self._side = side | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setSide(self, side):\r\n self.pack(side=side)",
"def setSide(self, side):\r\n self.pack(side=side)",
"def setSide(self, side):\r\n self.pack(side=side)",
"def set_side(self, side):\n raise RuntimeError(\"the 'set_side' method must be overriden\")",
"def side(self):\n ... | [
"0.76579183",
"0.76579183",
"0.76579183",
"0.7646631",
"0.6569197",
"0.64954686",
"0.6019405",
"0.5838618",
"0.5753927",
"0.57115936",
"0.5690976",
"0.5669271",
"0.56476754",
"0.55119276",
"0.55119276",
"0.54970145",
"0.5479687",
"0.54660726",
"0.5456265",
"0.5435103",
"0.533... | 0.8099121 | 0 |
Sets the status of this Order. | def status(self, status):
self._status = status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def setstatus(self, status):\n with self.lock:\n self.status = status",
"def setStatus(self, status)... | [
"0.8011641",
"0.8011641",
"0.8011641",
"0.7864938",
"0.78282785",
"0.7806965",
"0.7699049",
"0.76746535",
"0.7672833",
"0.7672833",
"0.7672833",
"0.7672833",
"0.7672833",
"0.7672833",
"0.7672833",
"0.7613429",
"0.7481602",
"0.7481602",
"0.74135995",
"0.7147335",
"0.7116571",
... | 0.7675846 | 23 |
Sets the transaction_time of this Order. | def transaction_time(self, transaction_time):
self._transaction_time = transaction_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_time(self, set_time):\n\n self._set_time = set_time",
"def set_time(self, time):\n self._time = time",
"def pay_time(self, pay_time):\n\n self._pay_time = pay_time",
"def transaction_amount(self, transaction_amount):\n\n self._transaction_amount = transaction_amount",
"d... | [
"0.6823752",
"0.6690837",
"0.6636187",
"0.63983077",
"0.6222438",
"0.61521524",
"0.61521524",
"0.61521524",
"0.61521524",
"0.61521524",
"0.6128218",
"0.60506505",
"0.603819",
"0.6000892",
"0.6000892",
"0.5984537",
"0.59787965",
"0.5975649",
"0.5972804",
"0.5949189",
"0.593479... | 0.86918926 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Order):
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 |
returns css file for /css url | def on_get(self, req, resp):
resp.status = falcon.HTTP_200
resp.content_type = 'text/css'
resp.body = self.csscontent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def propeller_css_url():\n return css_url()",
"def get_css():\n css = Path(__file__).parent.joinpath(\"resources\", \"style.css\")\n\n with open(css, \"r\") as style_file:\n css_data = style_file.read()\n\n return css_data",
"def bootstrap_css_url():\n return css_url()",
"def css_file(s... | [
"0.7309317",
"0.7245534",
"0.723506",
"0.7162877",
"0.683548",
"0.6575849",
"0.65532166",
"0.6533837",
"0.6499816",
"0.6321234",
"0.6240827",
"0.61483127",
"0.61290157",
"0.60940546",
"0.6092056",
"0.5972896",
"0.58653206",
"0.58631337",
"0.58364487",
"0.57903",
"0.5741797",
... | 0.64084566 | 9 |
Verify that the requester is an admin user | async def assert_requester_is_admin(auth: Auth, request: SynapseRequest) -> None:
requester = await auth.get_user_by_req(request)
await assert_user_is_admin(auth, requester) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def assert_user_is_admin(auth: Auth, requester: Requester) -> None:\n is_admin = await auth.is_server_admin(requester)\n if not is_admin:\n raise AuthError(HTTPStatus.FORBIDDEN, \"You are not a server admin\")",
"def _check_admin_only(self, request):\r\n api_key = request.params.get(sel... | [
"0.8449922",
"0.81485933",
"0.7908523",
"0.7862263",
"0.7862263",
"0.7824973",
"0.76954037",
"0.76795727",
"0.7626646",
"0.762449",
"0.7518792",
"0.75167245",
"0.74247247",
"0.7396018",
"0.73594654",
"0.7330633",
"0.7312187",
"0.72882414",
"0.7260789",
"0.7245386",
"0.7245386... | 0.8545741 | 0 |
Verify that the given user is an admin user | async def assert_user_is_admin(auth: Auth, requester: Requester) -> None:
is_admin = await auth.is_server_admin(requester)
if not is_admin:
raise AuthError(HTTPStatus.FORBIDDEN, "You are not a server admin") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isAdmin(user):\n return isUserType(user, Admin)",
"def user_is_admin(user):\n return user in admins",
"def is_admin(self, user):\n return user.name in self.admins",
"def is_admin(user):\n return user.is_authenticated and user.id == app.config.get('ADMIN')",
"def isAdmin(self, user):... | [
"0.8205139",
"0.80565995",
"0.79770845",
"0.79254925",
"0.79058695",
"0.78499144",
"0.781526",
"0.77958107",
"0.77286845",
"0.77002835",
"0.76058",
"0.7573334",
"0.756239",
"0.75418365",
"0.75389034",
"0.7532564",
"0.7524803",
"0.7509817",
"0.7497769",
"0.74937934",
"0.746816... | 0.7796255 | 7 |
Initializes a path specification. | def __init__(self, location=None, parent=None, **kwargs):
if not location:
raise ValueError('Missing location value.')
super(LocationPathSpec, self).__init__(parent=parent, **kwargs)
self.location = location | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, path, **kw):\n\n if not path:\n raise ValueError(\"Empty path\")\n\n if isinstance(path, list):\n ipath = path[:]\n self._drive_letter = ipath.pop(0)[0] if RX_LETTER.match(ipath[0]) else None\n self._components = _normalize_dots(ipath)\n ... | [
"0.6835479",
"0.6718708",
"0.6658452",
"0.6606759",
"0.651928",
"0.64637786",
"0.6448977",
"0.64467645",
"0.64467645",
"0.64467645",
"0.64467645",
"0.6441038",
"0.63962144",
"0.63641036",
"0.6333571",
"0.629494",
"0.6154486",
"0.612563",
"0.6118942",
"0.6101644",
"0.6087177",... | 0.6697097 | 2 |
Update the state estimation using the provided GPS measurement. | def update_gps(
self,
x_m,
y_m,
x_accuracy_m,
y_accuracy_m,
heading_d,
speed_m_s
):
self.GPS_MEASUREMENT_NOISE[0].itemset(0, x_accuracy_m)
self.GPS_MEASUREMENT_NOISE[1].itemset(1, y_accuracy_m)
now = time.ti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateState(self):\n\t\t# ask for current pose data\n\t\tcomm.write(b'id1 mav.pose_sensor get_local_data \\n')\n\t\t# update x value\n\t\tcomm.read_until(b'\"x\": ') # b'' as Telnet needs a bytes object instead of string since Python3\n\t\tread = comm.read_until(b',') # returns read values + finishing ','\n\... | [
"0.67576104",
"0.6714809",
"0.65793216",
"0.6536104",
"0.63853705",
"0.63432944",
"0.62674856",
"0.62458175",
"0.6236929",
"0.62354225",
"0.6194749",
"0.6161905",
"0.6131573",
"0.61117345",
"0.5985512",
"0.597056",
"0.5952911",
"0.5946343",
"0.5946183",
"0.5923242",
"0.586357... | 0.6095251 | 14 |
Sets the to_object_type_id of this LabelsBetweenObjectPair. | def to_object_type_id(self, to_object_type_id):
if self.local_vars_configuration.client_side_validation and to_object_type_id is None: # noqa: E501
raise ValueError("Invalid value for `to_object_type_id`, must not be `None`") # noqa: E501
self._to_object_type_id = to_object_type_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_object_id(self, to_object_id):\n if self.local_vars_configuration.client_side_validation and to_object_id is None: # noqa: E501\n raise ValueError(\"Invalid value for `to_object_id`, must not be `None`\") # noqa: E501\n\n self._to_object_id = to_object_id",
"def object_type(self... | [
"0.57930833",
"0.56202245",
"0.56202245",
"0.56202245",
"0.56202245",
"0.56202245",
"0.5310198",
"0.5129987",
"0.5014886",
"0.4837078",
"0.48125425",
"0.4790484",
"0.47267163",
"0.46558797",
"0.46442658",
"0.45802435",
"0.4567596",
"0.44857258",
"0.44692963",
"0.44448924",
"0... | 0.7019767 | 0 |
Sets the from_object_id of this LabelsBetweenObjectPair. | def from_object_id(self, from_object_id):
if self.local_vars_configuration.client_side_validation and from_object_id is None: # noqa: E501
raise ValueError("Invalid value for `from_object_id`, must not be `None`") # noqa: E501
self._from_object_id = from_object_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from(self, _from):\n if _from is None:\n raise ValueError(\"Invalid value for `_from`, must not be `None`\") # noqa: E501\n\n self.__from = _from",
"def token_id_from(self, token_id_from):\n\n self._token_id_from = token_id_from",
"def from_object_type_id(self, from_object... | [
"0.61979365",
"0.5974274",
"0.5795233",
"0.57569325",
"0.57569325",
"0.57569325",
"0.57569325",
"0.56445414",
"0.5488168",
"0.543962",
"0.5355043",
"0.5311075",
"0.53092664",
"0.53092664",
"0.5134461",
"0.5099668",
"0.5006803",
"0.49829057",
"0.4956328",
"0.49527872",
"0.4876... | 0.6955816 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, LabelsBetweenObjectPair):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.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):
if not isinstance(other, LabelsBetweenObjectPair):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.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.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Get the name of the key this TableSet is grouped by. (If created using | def key_name(self):
return self._key_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key(self):\n return key_for_name(self.name)",
"def key(self):\n return self.name",
"def name(self):\n return self.key",
"def key_name(self) -> str:\n return pulumi.get(self, \"key_name\")",
"def key(self)->str:\n return \"{}:{}.{}.{}\".format(self.source, self.db, sel... | [
"0.7324773",
"0.71510744",
"0.71039927",
"0.6896403",
"0.68424785",
"0.68320745",
"0.67791617",
"0.659292",
"0.6570213",
"0.6564781",
"0.6540517",
"0.6524352",
"0.64368635",
"0.64368635",
"0.6430601",
"0.64043087",
"0.6392812",
"0.637707",
"0.63737506",
"0.6373512",
"0.636910... | 0.71122944 | 2 |
List all episodes, or create a new episode. | def episode_list(request):
if request.method == 'GET':
user = request.GET.get('user')
episodes = Episodes()
episodes_list = episodes.get_user_episodes(user)
return JSONResponse(episodes_list)
elif request.method == 'POST':
data = JSONParser().parse(request)
seria... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def episode(self, title=None, season=None, episode=None):\n key = f'{self.key}/allLeaves'\n if title is not None:\n return self.fetchItem(key, Episode, title__iexact=title)\n elif season is not None and episode is not None:\n return self.fetchItem(key, Episode, parentInde... | [
"0.6597799",
"0.6581579",
"0.65798277",
"0.62934434",
"0.6283064",
"0.61562103",
"0.6033903",
"0.59940356",
"0.5935952",
"0.5919521",
"0.59080654",
"0.5904479",
"0.5892817",
"0.5888515",
"0.5884439",
"0.5869446",
"0.5863991",
"0.58552086",
"0.58040756",
"0.5785669",
"0.571892... | 0.6752665 | 0 |
Delete the character at the current cursor position. Leave the cursor in its current position. | def delete(self):
del self.characters[self.cursor.position] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n # If the position in the buffer is on a char\n if self.pos < self.buffer.line_length(self.line):\n self.buffer.delete_char(self.line, self.pos)\n self.has_changes = True",
"def _delChar(self, pos):\n nonGlyph = countInSet(self.text[:pos], self.NO_GLYPH_CHARS)\n\n ... | [
"0.7785326",
"0.73471785",
"0.6848375",
"0.66849",
"0.64721656",
"0.6427636",
"0.6403706",
"0.6342227",
"0.6291088",
"0.6216535",
"0.6088449",
"0.6076424",
"0.6010284",
"0.6008969",
"0.5915848",
"0.59127957",
"0.58669746",
"0.5862974",
"0.58580875",
"0.58353704",
"0.5813231",... | 0.8178493 | 0 |
Move the cursor back 1 character in the Document. | def back(self):
self.cursor.back() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrap_cursor_back(event):\n b = event.cli.current_buffer\n b.cursor_up(count=1)\n relative_end_index = b.document.get_end_of_line_position()\n b.cursor_right(count=relative_end_index)",
"def backspace(self):\n # If the position is at the beggining of a line that is not the first... | [
"0.7527851",
"0.6919884",
"0.68049157",
"0.6780137",
"0.6692052",
"0.66718274",
"0.65647304",
"0.6532943",
"0.6511843",
"0.6503312",
"0.6496688",
"0.6401373",
"0.63842785",
"0.6371495",
"0.6367071",
"0.6366814",
"0.6238326",
"0.62206435",
"0.621714",
"0.61951184",
"0.61786777... | 0.69443375 | 1 |
Move the cursor back 1 character in the document. | def back(self):
self.position -= 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrap_cursor_back(event):\n b = event.cli.current_buffer\n b.cursor_up(count=1)\n relative_end_index = b.document.get_end_of_line_position()\n b.cursor_right(count=relative_end_index)",
"def backspace(self):\n # If the position is at the beggining of a line that is not the first... | [
"0.7580037",
"0.69440705",
"0.69189334",
"0.6876776",
"0.67182046",
"0.6712217",
"0.6596274",
"0.659366",
"0.6535285",
"0.6513666",
"0.6473904",
"0.6452391",
"0.64431024",
"0.641141",
"0.6349514",
"0.6326987",
"0.62560326",
"0.6225307",
"0.6213855",
"0.6191571",
"0.6181482",
... | 0.67074823 | 6 |
String representation of this character with formatting. | def __str__(self):
bold = "*" if self.bold else ''
italic = "/" if self.italic else ''
underline = "_" if self.underline else ''
return bold + italic + underline + self.character | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringify(self):\n return self.char",
"def __repr__(self):\n return '{}<{}, line {} char {}>'.format(\n self.__class__.__name__, repr(self._data),\n self._lineno, self._charno)",
"def to_str(self):\n return pformat(self.to_dict())",
"def to_str(self):\n r... | [
"0.76008344",
"0.7524676",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
"0.7460253",
... | 0.7736675 | 0 |
Convert sparse matrix to tuple representation. | def sparse_to_tuple(sparse_mx):
def to_tuple(mx):
if not sp.isspmatrix_coo(mx):
mx = mx.tocoo()
coords = np.vstack((mx.row, mx.col)).transpose()
values = mx.data
shape = mx.shape
return coords, values, shape
if isinstance(sparse_mx, list):
for i in ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparse_to_tuple(sparse_mx):\n def to_tuple(mx):\n if not sp.isspmatrix_coo(mx):\n mx = mx.tocoo()\n coords = np.vstack((mx.row, mx.col)).transpose()\n values = mx.data\n shape = mx.shape\n return coords, values, shape",
"def sparse_to_tuple(sparse_mx):\r\n ... | [
"0.85870504",
"0.82527",
"0.82527",
"0.8091624",
"0.7986327",
"0.602773",
"0.59843755",
"0.5971062",
"0.59706587",
"0.59447116",
"0.59443593",
"0.5910293",
"0.5910293",
"0.5910293",
"0.5910293",
"0.5910293",
"0.58940256",
"0.58499134",
"0.5845008",
"0.577404",
"0.5689886",
... | 0.82655305 | 4 |
Get list of children for each nonleaf node. | def get_parent_child_mapping(child_parent_map):
parent_children_mapping = defaultdict(list)
if isinstance(child_parent_map, dict):
child_parent_map = list(child_parent_map.iteritems())
for child, parent in child_parent_map:
parent_children_mapping[parent].append(child)
return parent_chil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_children(self):\n return [node for node in self._children.values()]",
"def get_children(self):\n return []",
"def children(self):\n return self.leaves",
"def children(self) -> Iterable[Heirarchical]:\n return []",
"def get_node_children(self, node):\n return node.... | [
"0.77184075",
"0.76525956",
"0.76115876",
"0.7552538",
"0.7477724",
"0.74745893",
"0.7438982",
"0.7415529",
"0.7415378",
"0.74043876",
"0.7395605",
"0.7395605",
"0.7395605",
"0.7367469",
"0.7347944",
"0.73165876",
"0.73041075",
"0.72798175",
"0.7278937",
"0.726418",
"0.721847... | 0.0 | -1 |
Init a new dqueue. | def new_dque():
from dqueue import Dque
return Dque() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.queue = []\n self.queue.append(Queue())\n self.queue.append(Queue())\n self.tag = 0 # using to record which queue contain the data",
"def __init__(self) -> None:\n self._queue = []",
"def __init__(self):\n self.queue = Queue()",
"def __init... | [
"0.7442479",
"0.7317448",
"0.72406936",
"0.72349405",
"0.712574",
"0.712574",
"0.712574",
"0.712574",
"0.70671207",
"0.70640177",
"0.69909364",
"0.697032",
"0.697032",
"0.697032",
"0.697032",
"0.697032",
"0.68680143",
"0.68680143",
"0.6867319",
"0.6862888",
"0.6844452",
"0.... | 0.6822943 | 23 |
Instantiate a new dqueue, head and tail should be None. | def test_stack_none(new_dque):
assert new_dque.new_dll.head is None
assert new_dque.new_dll.tail is None
assert new_dque.size() == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\r\n self.point_to_head = MyQueueNode('head')\r\n self.point_to_tail = MyQueueNode('tail')",
"def __init__(self):\n self._head = None\n self._tail = None\n self._size = 0 # number of queue elements",
"def new_dque():\n from dqueu... | [
"0.70209277",
"0.69455826",
"0.6870933",
"0.6602584",
"0.6593373",
"0.63641983",
"0.6330618",
"0.63143533",
"0.6310622",
"0.62862056",
"0.62862056",
"0.62862056",
"0.62793666",
"0.6250587",
"0.6246805",
"0.62370116",
"0.62370116",
"0.62312543",
"0.6229442",
"0.6229442",
"0.62... | 0.0 | -1 |
Maps all the attributes into specific enums type or boolean or number, and return the dict after mapping. | def map_attributes(order: dict) -> dict:
map_dict = {
"has_batteries": FactoryMapping.cast_str_to_bool,
"has_glow": FactoryMapping.cast_str_to_bool,
"has_lactose": FactoryMapping.cast_str_to_bool,
"has_nuts": FactoryMapping.cast_str_to_bool,
"min_age":... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _serialize(self, data: Any) -> Dict[Any, Any]:\n\n return {field: value.value if isinstance(value, Enum) else value for field, value in data}",
"def to_dict(self):\n result = {}\n\n for attr, _ in six.iteritems(self.openapi_types):\n value = getattr(self, attr)\n if... | [
"0.6376764",
"0.6373905",
"0.6373905",
"0.6373905",
"0.6373905",
"0.6373905",
"0.6373905",
"0.6373905",
"0.62475324",
"0.6174338",
"0.6168905",
"0.61563706",
"0.60543674",
"0.6019224",
"0.6014222",
"0.60046154",
"0.60046154",
"0.60046154",
"0.5991247",
"0.5972614",
"0.5969980... | 0.68583864 | 0 |
removes any fields in ``d`` that are ``None`` and returns ``d``. | def _remove_none_fields(klass, d):
return dict((k, v) for k, v in d.iteritems() if v is not None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_none(self, data):\r\n for key, value in data.items():\r\n if value is None or isinstance(value, forms.Field):\r\n del data[key]\r\n if isinstance(value, dict):\r\n self._remove_none(data[key])",
"def del_none(d):\n for key, value in list(d... | [
"0.70349324",
"0.6984631",
"0.6844757",
"0.6813955",
"0.6803604",
"0.6767289",
"0.6695628",
"0.6660116",
"0.6639314",
"0.6500436",
"0.64441895",
"0.6432155",
"0.6427089",
"0.64172685",
"0.6340153",
"0.63339865",
"0.63128364",
"0.629096",
"0.6228382",
"0.6216547",
"0.61855537"... | 0.80907196 | 0 |
Returns True if more events exist in this series after ``date_data``. | def _more_events(klass, series, date_data):
if (series.ends_after
and len(series.events) >= series.num_occurrences
or series.ends_on
and date_data['start_date'] > series.recurrence_end_date):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_next(self) -> bool:\n return self.published_after().count() != 0",
"def has_next(self):\n return self.count < len(self)",
"def event_processing_finished(self):\n if self.status in ACTIVE_STATES:\n return False # tally of events is only available at end of run\n t... | [
"0.6318312",
"0.6183957",
"0.61430913",
"0.604283",
"0.5970718",
"0.5958615",
"0.59220284",
"0.5812415",
"0.57828635",
"0.5760963",
"0.5700052",
"0.5695627",
"0.56847566",
"0.5647049",
"0.5647049",
"0.5646737",
"0.56348205",
"0.56315655",
"0.56221753",
"0.5614341",
"0.5597905... | 0.8184778 | 0 |
Returns a chart by name. | def chart(self, name: str) -> Optional[ChartInfo]:
if name in self.entries:
return self.entries[name]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mustChart(self, name: str) -> ChartInfo:\n if name in self.entries:\n return self.entries[name]\n raise ParamError('Chart \"{}\" not found'.format(name))",
"def dataset_by_name(name):\n return _datasets[name.lower()]",
"def get_by_name(self, name: str) -> Optional[\"Dataset\"]:\... | [
"0.7109706",
"0.7019839",
"0.68239576",
"0.6764104",
"0.6628474",
"0.64535314",
"0.6372001",
"0.62289995",
"0.62045896",
"0.6184133",
"0.6104562",
"0.6100152",
"0.6086625",
"0.6022273",
"0.5972116",
"0.5958264",
"0.5913988",
"0.58905894",
"0.5880865",
"0.5863807",
"0.584529",... | 0.79517376 | 0 |
Returns a chart by name. | def mustChart(self, name: str) -> ChartInfo:
if name in self.entries:
return self.entries[name]
raise ParamError('Chart "{}" not found'.format(name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chart(self, name: str) -> Optional[ChartInfo]:\n if name in self.entries:\n return self.entries[name]\n return None",
"def dataset_by_name(name):\n return _datasets[name.lower()]",
"def get_by_name(self, name: str) -> Optional[\"Dataset\"]:\n raise NotImplementedError",
... | [
"0.79517376",
"0.7019839",
"0.68239576",
"0.6764104",
"0.6628474",
"0.64535314",
"0.6372001",
"0.62289995",
"0.62045896",
"0.6184133",
"0.6104562",
"0.6100152",
"0.6086625",
"0.6022273",
"0.5972116",
"0.5958264",
"0.5913988",
"0.58905894",
"0.5880865",
"0.5863807",
"0.584529"... | 0.7109706 | 1 |
Add donation to donor's history | def add_donation(self, amount):
self.donations.append(amount) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_donation(self):\n name = self.get_donor()\n # Update existing\n if name in self.all_donors:\n input_donation = int(input(\"Please enter a donation: \"))\n donations = int(self.r.hget(name, 'donations'))\n donations += input_donation\n\n self.... | [
"0.7176873",
"0.6903825",
"0.688624",
"0.68321955",
"0.6813224",
"0.67477596",
"0.6691522",
"0.6595631",
"0.6505548",
"0.6414089",
"0.64034224",
"0.6384012",
"0.60815823",
"0.60445434",
"0.6033811",
"0.5943901",
"0.59154606",
"0.5738607",
"0.5707274",
"0.56477076",
"0.5613074... | 0.69296217 | 1 |
Create new DonorCollection instance with empty donor dictionary | def __init__(self):
self.donors = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, donors=None):\n if donors is None:\n self.donor_info = {}\n else:\n for donor in donors:\n self.donor_info.update({donor.name: donor})",
"def __init__(self, donors=None):\n if donors is None:\n self.donor_inf = {}\n el... | [
"0.73822105",
"0.7197104",
"0.6503639",
"0.6479514",
"0.61990553",
"0.5853915",
"0.58509034",
"0.5798802",
"0.57853293",
"0.5709637",
"0.5514622",
"0.5479577",
"0.54727346",
"0.54555374",
"0.54511034",
"0.5446474",
"0.5405041",
"0.53912544",
"0.5374399",
"0.5299382",
"0.52428... | 0.72818685 | 1 |
Construct a ConvPool model. | def __init__(self, opts):
super(FftDelayKernel, self).__init__(opts)
self.batch_size = opts.batch_size
self.input_dim = opts.input_dim
self.input_len = opts.input_len
self.output_len = opts.output_len
self.conv_layer_num = opts.conv_layer_num
self.conv_kernel_num ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_conv_pool(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n k = [op.handle.kernel_h, op.handle.kernel_w]\n s = [op.handle.stride_h, op.handle.stride_w]\n oddp = op.odd_padding\n p = [\n op.handle.pad_h + oddp[0],\n op.h... | [
"0.69215906",
"0.67604595",
"0.66735834",
"0.66229254",
"0.6574806",
"0.64778924",
"0.64432716",
"0.6434137",
"0.640035",
"0.6381879",
"0.63792866",
"0.6371251",
"0.6355106",
"0.630213",
"0.6285229",
"0.6285229",
"0.6281775",
"0.6240917",
"0.62328815",
"0.623086",
"0.6222837"... | 0.0 | -1 |
Test we get a bad gateway error if we can't find supervisor. | async def test_bad_gateway_when_cannot_find_supervisor(
hassio_client, aioclient_mock: AiohttpClientMocker
) -> None:
aioclient_mock.get("http://127.0.0.1/app/entrypoint.js", exc=asyncio.TimeoutError)
resp = await hassio_client.get("/api/hassio/app/entrypoint.js")
assert resp.status == HTTPStatus.BAD_G... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_supervisor_parent_exception(self):\n session = self.login_to_apic()\n node = Pod('1')\n self.assertRaises(TypeError, Supervisorcard.get, session, node)",
"def test_get_process(self):\n from supvisors.rpcinterface import RPCInterface\n # prepare context\n sel... | [
"0.5981292",
"0.592272",
"0.580712",
"0.5779609",
"0.5628047",
"0.5513224",
"0.5409508",
"0.53530324",
"0.53169245",
"0.5304271",
"0.5298325",
"0.5278871",
"0.5268178",
"0.523301",
"0.5229871",
"0.5223141",
"0.5186227",
"0.5177942",
"0.5164635",
"0.5132779",
"0.51268506",
"... | 0.65441114 | 0 |
Enable user to buy a stock. | def search():
# POST
if request.method == "POST":
# validate form submission
if not request.form.get("intervention"):
return render_template("results.html", results=entries.values())
'''
elif not request.form.get("setting"):
return apology("missing sett... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy(self, stock, amount):\n self.orders[stock] += amount",
"def buy(self, symbol: str=None, quantity: int=0, in_force: str='gtc', extended: bool=False):\n return self.trader.buy(symbol, quantity, in_force, extended)",
"def buy_stock (self, ticker, buy_date, sell_date, amount):\n\n if s... | [
"0.6653856",
"0.6647518",
"0.65846837",
"0.65707827",
"0.6548142",
"0.63767505",
"0.6267546",
"0.62477654",
"0.6235365",
"0.62160015",
"0.62022454",
"0.6190609",
"0.6190339",
"0.6174273",
"0.6115096",
"0.6108209",
"0.60575914",
"0.6052103",
"0.6047494",
"0.604169",
"0.6035211... | 0.0 | -1 |
Calculate the IOU between boxes and anchors. | def iou(boxes, anchors):
# Calculate the intersection,
# the new dimension are added to construct shape (n, 1) and shape (1, k),
# so we can get (n, k) shape result by numpy broadcast
w_min = np.minimum(boxes[:, 0, np.newaxis], anchors[np.newaxis, :, 0])
h_min = np.minimum(boxes[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_iou_metric(anchor_boxes):\n y, x, h, w = np.transpose(anchor_boxes)\n ab_areas = w * h\n y0 = y - h // 2\n x0 = x - w // 2\n y1 = y + h // 2\n x1 = x + w // 2\n\n def iou(gt_boxes):\n ious = []\n for gt_box in gt_boxes:\n gt_y0, gt_x0, gt_y1, gt_x1 = gt_box\... | [
"0.7923001",
"0.79052544",
"0.7763466",
"0.7763466",
"0.7763466",
"0.77461624",
"0.7625856",
"0.75763726",
"0.74150914",
"0.73718035",
"0.73614705",
"0.7333996",
"0.7332774",
"0.7269138",
"0.7258896",
"0.71443504",
"0.70813495",
"0.70355195",
"0.7029728",
"0.70288104",
"0.702... | 0.7145202 | 15 |
Return a randomly generated binary string of size length. length the length of the binary string to generate | def generate_random_binary(length):
key = [str(random.randint(0,1)) for x in range(length)]
return "".join(key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_random(length, is_binary=False):\n limit = 255 if is_binary else 126\n return \"\".join([chr(choice(range(32, limit))) for _ in range(length)]) + \"\\n\"",
"def random_string(length):\n # this conservatively gets 8*length bits and then returns 6*length of\n # them. Grabbing (6/8)*length bits cou... | [
"0.82869774",
"0.82597584",
"0.82051337",
"0.81143016",
"0.80188406",
"0.8009309",
"0.78233474",
"0.7805365",
"0.77662945",
"0.7746474",
"0.76428586",
"0.7614428",
"0.7527163",
"0.75200224",
"0.7432218",
"0.7428669",
"0.74269825",
"0.74256045",
"0.73971635",
"0.7366984",
"0.7... | 0.85678524 | 0 |
This method will fetch the step1.end_year value from a .yml file | def __get_step1_end_year(yaml_content: dict) -> str:
end_year = None
try:
end_year = yaml_content['step1.end_year']
except KeyError as exc:
print(ConfigurationFactory.__get_key_missing_error_message(exc))
return end_year | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_step1_start_year(yaml_content: dict) -> str:\n\n start_year = None\n\n try:\n start_year = yaml_content['step1.start_year']\n except KeyError as exc:\n print(ConfigurationFactory.__get_key_missing_error_message(exc))\n\n return start_year",
"def __get_s... | [
"0.7207822",
"0.66823876",
"0.65050745",
"0.6140347",
"0.6137251",
"0.56748474",
"0.5528404",
"0.53147274",
"0.52570367",
"0.52453053",
"0.52218485",
"0.52172977",
"0.5072907",
"0.50610274",
"0.50140053",
"0.49715784",
"0.4956864",
"0.49504402",
"0.49141437",
"0.4909929",
"0.... | 0.8289978 | 0 |
True if vector x is monotonically ascendent, false otherwise | def ascend(x):
return alltrue(greater_equal(x[1:],x[0:-1])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sorted(x, ascending=True):\n return np.all((np.diff(x) * (1.0 if ascending else -1.0) >= 0))",
"def is_increasing_vec(x):\n return jnp.all(jnp.diff(x) > 0)",
"def is_nonincreasing_vec(x):\n return jnp.all(jnp.diff(x) <= 0)",
"def is_nondecreasing_vec(x):\n return jnp.all(jnp.diff(x) >= 0)"... | [
"0.70340335",
"0.7009624",
"0.6909266",
"0.67149264",
"0.6583171",
"0.6386162",
"0.63811964",
"0.6372677",
"0.6294193",
"0.62742597",
"0.60500646",
"0.5979637",
"0.5974679",
"0.59500647",
"0.5924411",
"0.5915272",
"0.59128165",
"0.5862604",
"0.58516103",
"0.585044",
"0.583824... | 0.6976582 | 2 |
Returns the complementary error function erfc(x) erfc(x)=1erf(x)=2/sqrt(pi)\int_x^\inf e^t^2 dt | def erfc(x):
try: x.shape
except: x=array([x])
z=abs(x)
t=1./(1.+0.5*z)
erfcc=t*exp(-z*z-
1.26551223+t*(
1.00002368+t*(
0.37409196+t*(
0.09678418+t*(
-0.18628806+t*(
0.27886807+t*(
-1.13520398+t*(
1.48851587+t*(
-0.82215223+t*0.170... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def erf(x):\n return 1.-erfc(x)",
"def erfc(x):\n return 0.0",
"def _erfcc(x):\n z = abs(x)\n t = 1. / (1. + 0.5 * z)\n r = t * math.exp(-z * z - 1.26551223 + t * (1.00002368 + t * (.37409196 +\n t * (.09678418 + t * (-.18628806 + t * (.27886807 +\n t ... | [
"0.75833994",
"0.722157",
"0.67651504",
"0.6690238",
"0.6629046",
"0.6597801",
"0.65771705",
"0.6304161",
"0.61688787",
"0.61411196",
"0.6019691",
"0.5983571",
"0.5976692",
"0.5840774",
"0.5838701",
"0.578113",
"0.5732829",
"0.57140386",
"0.5681563",
"0.5656592",
"0.5636446",... | 0.75425726 | 1 |
Returns the error function erf(x) erf(x)=2/sqrt(pi)\int_0^x \int e^t^2 dt | def erf(x):
return 1.-erfc(x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def erf(t):\n P = 0.3275911\n A = [0.254829592, -0.284496736, 1.421413741, -1.453152027, 1.061405429]\n T = 1.0 / (1 + P * t)\n Tn = T\n Poly = A[0] * Tn\n for i in range(1, 5):\n Tn = Tn * T\n Poly = Poly * A[i] * Tn\n return 1.0 - Poly * np.exp(-t * t)",
"def erf(x):\n ... | [
"0.7102826",
"0.6942013",
"0.68463993",
"0.6794912",
"0.6787168",
"0.6481229",
"0.64769936",
"0.64190036",
"0.62356",
"0.60737497",
"0.6038482",
"0.6011517",
"0.5874494",
"0.5852415",
"0.5848979",
"0.584599",
"0.5834047",
"0.5826507",
"0.5809764",
"0.5775347",
"0.5760114",
... | 0.677106 | 5 |
Find out how many connected components are in the graph | def components(self):
comps = 0
unexplored = self.nodes()
while unexplored:
comps += 1
queue = {unexplored.pop()}
while queue:
new = queue.pop()
unexplored.remove(new)
for adjacent in new.parents() | new.children... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connected_components(self) -> int:\n # visited = set()\n def get_component(vert: Tuple[int, int]) -> Set[Tuple[int, int]]:\n \"\"\" \"\"\"\n nonlocal visited\n visited.add(vert)\n if graph.vertices[vert]:\n for neighbor in graph.vertices[... | [
"0.84893906",
"0.8441421",
"0.813407",
"0.81115675",
"0.8110622",
"0.80094033",
"0.78391",
"0.77600485",
"0.74113125",
"0.7327618",
"0.7263765",
"0.7236958",
"0.7225985",
"0.7175493",
"0.71655893",
"0.7144106",
"0.70974714",
"0.7088789",
"0.70423055",
"0.7006759",
"0.7006341"... | 0.7546215 | 8 |
A single River Region | def river_region(rr_id):
try:
r = RiverRegionRenderer(request, rr_id, None)
except NotFoundError:
return abort(404)
return r.render() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def river_region(rr_id):\n r = RiverRegionRenderer(request, rr_id, None)\n return r.render()",
"def region(self):\n return self.random_element(self._regions)",
"def region(self):\n return regions.lookup(self.state)",
"def which_region(self, g):\n return NotImplementedError",
"def... | [
"0.7580077",
"0.6559608",
"0.6486316",
"0.6317798",
"0.6308154",
"0.6297248",
"0.62235177",
"0.61914796",
"0.6133975",
"0.6122831",
"0.6058341",
"0.6054975",
"0.6053758",
"0.59080696",
"0.5906734",
"0.5871702",
"0.5871702",
"0.5798303",
"0.57938373",
"0.5793105",
"0.5790699",... | 0.7056435 | 1 |
Check to ensure the password cannot be blank. | def test_blank(self):
form_data = {
'username': 'testuser',
'password1': '',
'password2': ''
}
form = StrictUserCreationForm(data=form_data)
self.assertFalse(form.is_valid()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_invalid_password(self):\n pass_field = Field(\"\")\n\n with self.assertRaises(ValidationError):\n valid_password(None, pass_field)",
"def _check_password(self, password):\n rule = re.compile(constant.password_regex)\n if not rule.match(password):\n ... | [
"0.79490334",
"0.77968377",
"0.77871263",
"0.77335155",
"0.7643131",
"0.76367515",
"0.7621422",
"0.7516139",
"0.7513022",
"0.7505487",
"0.7499173",
"0.74782765",
"0.7467791",
"0.74369264",
"0.74352205",
"0.7381777",
"0.7366632",
"0.73541045",
"0.7336154",
"0.7323264",
"0.7281... | 0.0 | -1 |
Check to ensure the password cannot be blank. | def test_blank(self):
form_data = self.form_data('')
form = self.form(data=form_data, user=self.u)
self.assertFalse(form.is_valid()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_invalid_password(self):\n pass_field = Field(\"\")\n\n with self.assertRaises(ValidationError):\n valid_password(None, pass_field)",
"def _check_password(self, password):\n rule = re.compile(constant.password_regex)\n if not rule.match(password):\n ... | [
"0.7948673",
"0.77985877",
"0.7789967",
"0.77350724",
"0.7644224",
"0.7637583",
"0.762202",
"0.75166345",
"0.75142026",
"0.7506286",
"0.7499982",
"0.74785256",
"0.7468479",
"0.7439236",
"0.74369186",
"0.7382595",
"0.7368371",
"0.7353784",
"0.7338197",
"0.7325224",
"0.7282342"... | 0.0 | -1 |
Reset all tensorflow objects to enable the model to be trained again | def reset_fit(self):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.close()\n self._sess = tf.Session(graph=self._graph)\n self._sess.run(self._initializer)",
"def reset(self):\n self.pred_classes.clear()\n self.gold_classes.clear()\n self.pred_probas.clear()\n self.gold_probas.clear()\n self.loss = ... | [
"0.7678339",
"0.75339043",
"0.7478618",
"0.7393605",
"0.73729026",
"0.7247076",
"0.72396255",
"0.7210391",
"0.70935744",
"0.70598245",
"0.70598245",
"0.7056544",
"0.70286405",
"0.7024844",
"0.70112365",
"0.70112365",
"0.6949345",
"0.6946845",
"0.69278085",
"0.69249105",
"0.69... | 0.0 | -1 |
Initializing the structure of the basic VGGlike block | def __init__(self, in_channels, out_channels, pool=True, last=False, stride=1):
super(Vggish, self).__init__()
# The two convolutional layers
self.conv_1 = nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=(3, 3),
stride=(stride, stride), p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_vgg(self):\n vgg = VGG19(weights=\"imagenet\")\n # Set outputs to outputs of last conv. layer in block 3\n # See architecture at: https://github.com/keras-team/keras/blob/master/keras/applications/vgg19.py\n vgg.outputs = [vgg.layers[9].output]\n\n img = Input(shape=sel... | [
"0.6718207",
"0.6704799",
"0.65439",
"0.64907247",
"0.6474263",
"0.6415233",
"0.63843143",
"0.63797164",
"0.63572806",
"0.6356659",
"0.6257027",
"0.6202369",
"0.60905993",
"0.60599446",
"0.6059049",
"0.6056629",
"0.60118115",
"0.6011722",
"0.60069317",
"0.599805",
"0.59728086... | 0.0 | -1 |
Should return False if 0 choices exist. | def test_check_category_input_1(self):
assert validation.check_category_input(1, []) == False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def noIdenticalChoices(choices):\r\n return not(max([choices.count(choice)-1 for choice in choices]))",
"def is_choice(self):\n return self.__class__.get_setting_choices(self.key, **self.get_kwargs()) is not None",
"def _check_student_choices(self, choices):\r\n student_choices = set(choices)\... | [
"0.70469284",
"0.6714852",
"0.67058134",
"0.6669307",
"0.66036755",
"0.6541022",
"0.64230967",
"0.63549656",
"0.6306329",
"0.6284618",
"0.6245853",
"0.6183903",
"0.61593246",
"0.61440676",
"0.6137393",
"0.611288",
"0.61077106",
"0.6099051",
"0.6086218",
"0.60855687",
"0.60794... | 0.0 | -1 |
Create a variable with L2 Regularization (Weight Decay) | def variable_with_weight_decay(kernel_shape, initializer, wd):
w = tf.get_variable('weights', kernel_shape, tf.float32, initializer=initializer)
collection_name = tf.GraphKeys.REGULARIZATION_LOSSES
if wd and (not tf.get_variable_scope().reuse):
weight_decay = tf.multiply(tf.nn.l2_loss(w), wd, name=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l2_regularization_penalty(self):\n return self.l2 * (np.linalg.norm(self.weights)**2)",
"def l2_reg_create_layer(prev, n, activation, lambtha):\n reg = tf.contrib.layers.l2_regularizer(lambtha)\n init = tf.contrib.layers.variance_scaling_initializer(mode=\"FAN_AVG\")\n t = tf.layers.Dense(uni... | [
"0.7227975",
"0.7207936",
"0.71978116",
"0.71629304",
"0.7081066",
"0.7052022",
"0.69422734",
"0.6893322",
"0.68926835",
"0.685357",
"0.6805765",
"0.67722416",
"0.6634887",
"0.6597912",
"0.64207006",
"0.64207006",
"0.64207006",
"0.6416478",
"0.63910633",
"0.637778",
"0.631143... | 0.5500005 | 77 |
Attach a lot of summaries to a Tensor (for TensorBoard visualization). | def variable_summaries(var):
with tf.name_scope('summaries'):
mean = tf.reduce_mean(var)
tf.summary.scalar('mean', mean)
with tf.name_scope('stddev'):
stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean)))
tf.summary.scalar('stddev', stddev)
tf.summary.scalar('ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_summary(self):\n for k, v in self.metrics.items():\n tf.summary.scalar(k, v)\n \n self.summary_op = tf.summary.merge_all()",
"def build_summaries(self):\n\n # Loss summary.\n tf.summary.scalar('loss', self.loss)\n\n merged = tf.summary.merge_all()\n self.summary_op = merged\n ... | [
"0.7071791",
"0.6970259",
"0.6970259",
"0.6800256",
"0.67872906",
"0.67407334",
"0.66669947",
"0.66576326",
"0.66193783",
"0.66085786",
"0.6595776",
"0.65836215",
"0.6581151",
"0.655297",
"0.6500364",
"0.6459978",
"0.64145213",
"0.6294558",
"0.62718755",
"0.62713677",
"0.6265... | 0.5535716 | 92 |
Return the camera model. | def model(self):
return self._device.device_data[self._uuid]['model'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model(self) -> CameraModel:\n pass",
"def model(self) -> Optional[CameraModel]:\n return self._model",
"def camera(self):\n return self.__camera",
"def camera(self):\n return self._camera",
"def camera(self):\n return self._camera",
"def model(self) -> str:\n ... | [
"0.83613294",
"0.8325475",
"0.7697577",
"0.7607879",
"0.7607879",
"0.7520355",
"0.7212203",
"0.7132207",
"0.69808793",
"0.6751965",
"0.6749515",
"0.66811454",
"0.66361666",
"0.6601008",
"0.65641713",
"0.6536921",
"0.64860415",
"0.64814687",
"0.642071",
"0.642071",
"0.642071",... | 0.6608781 | 13 |
Return the name of this camera. | def name(self):
return self._device.device_data[self._uuid]['name'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n friendly_camera_name = self._cam_name.replace('_', ' ')\n return f\"{friendly_camera_name} {self._obj_name}\".title()",
"def name(self) -> str:\n return self.camera_info[\"device_name\"]",
"def name(self):\n return self._scene_name",
"def name(self):\n\t\treturn ... | [
"0.86631787",
"0.8536238",
"0.7493173",
"0.7183577",
"0.71381986",
"0.7096534",
"0.70536137",
"0.703101",
"0.70261574",
"0.70229435",
"0.70229435",
"0.70229435",
"0.7022467",
"0.7017471",
"0.70168525",
"0.70163584",
"0.7012957",
"0.7012957",
"0.7012957",
"0.7011892",
"0.70003... | 0.69741833 | 61 |
Return the camera state attributes. | def state_attributes(self):
attrs = {"access_token": self.access_tokens[-1]}
if self.model:
attrs["model_name"] = self.model
if self.brand:
attrs["brand"] = self.brand
if self.motion_detection_enabled:
attrs["motion_detection"] = self.motion_detecti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\n return {\n ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION,\n ATTR_CAMERA_TYPE: self._camera_type,\n }",
"def device_state_attributes(self):\r\n return self.attributes",
"def state_attributes(self):\n return self._attributes",
"def ... | [
"0.79429895",
"0.77826995",
"0.7642746",
"0.7642746",
"0.7628107",
"0.7626915",
"0.75690836",
"0.75690836",
"0.75635165",
"0.75365305",
"0.75365305",
"0.75365305",
"0.75365305",
"0.75365305",
"0.75365305",
"0.75365305",
"0.75365305",
"0.75365305",
"0.75365305",
"0.75365305",
... | 0.71897674 | 37 |
Return the total distance between the player current location and its opponent's current location | def get_location_distance(game, player, opp_player):
player_location = game.get_player_location(player)
opp_location = game.get_player_location(opp_player)
x_distance = math.pow(player_location[0] - opp_location[0], 2)
y_distance = math.pow(player_location[1] - opp_location[1], 2)
return math.sqrt(x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_goal_distance(self) -> float:\n route = self.best_route\n return sum(route.values())",
"def distMe_Players(self, player):\n return self.playerPos.distance(player)",
"def __distance_from_center__(game, player):\n x,y = game.get_player_location(player)\n return sqrt( (x - ga... | [
"0.7476284",
"0.72073",
"0.6905476",
"0.6852965",
"0.68407226",
"0.6788661",
"0.6774009",
"0.6722211",
"0.6641275",
"0.66412115",
"0.662247",
"0.66153634",
"0.66075903",
"0.65856594",
"0.65809476",
"0.6568955",
"0.656288",
"0.65486693",
"0.6516577",
"0.6498255",
"0.64681447",... | 0.8173824 | 0 |
Calculate the heuristic value of a game state from the point of view of the given player. | def custom_score(game, player):
# return penalize_corners_heuristic(game, player)
# return favor_run_away_heuristic(game, player)
return look_ahead_heuristic(game, player) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utility(self, state, player):\n if state.isWin() or state.isLose():\n return state.getScore()\n\n # In case of cycle.\n if player == PACMAN:\n return INFINITY\n else:\n return -INFINITY",
"def calculate_utility(state, player):\n thisPlayer = pla... | [
"0.71605945",
"0.7127043",
"0.68422264",
"0.681838",
"0.67977256",
"0.6583937",
"0.64494747",
"0.64484817",
"0.6436802",
"0.64358234",
"0.6432952",
"0.6418598",
"0.6413811",
"0.6405533",
"0.6400188",
"0.6355528",
"0.6340021",
"0.6338477",
"0.6310529",
"0.6307838",
"0.62765163... | 0.659008 | 5 |
Return true if input signature contains a string dtype. This is used to determine if we should proceed with base64 decoding. | def does_signature_contain_str(signature=None):
# if we did not receive a signature we assume the model could require
# a string in it's input
if signature is None:
return True
return any(v.dtype == dtypes.string.as_datatype_enum
for v in signature.inputs.values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_string_type(obj: _std_typing.Any) -> bool:\n return obj.dtype == sc.DType.string",
"def _is_string(data):\n return len(data) and isinstance(_to_ndarray(data).flat[0], str)",
"def DataIsString(self):\n return self.data_type in (definitions.REG_SZ, definitions.REG_EXPAND_SZ)",
"def is_string(i... | [
"0.72504556",
"0.7218408",
"0.69056946",
"0.6770988",
"0.668558",
"0.6640686",
"0.66045827",
"0.6535771",
"0.6505363",
"0.6420533",
"0.6344336",
"0.6331311",
"0.6274873",
"0.6230991",
"0.6213599",
"0.61923146",
"0.6176861",
"0.615718",
"0.6113719",
"0.6069403",
"0.60643834",
... | 0.77119267 | 0 |
Checks the template hex vlad and returns the template name corresponding to it | def template_check(template_id_hex):
return {
'0001': 'SRC_IPV4',
'0002': 'DST_IPV4',
'0003': 'SRC_PORT',
'0004': 'DST_PORT',
'0005': 'PROTO',
'0006': 'SRC_IPV6',
'0007': 'DST_IPV6',
'0008': 'IPV4_TOS',
'0009': 'IPv6_FLOW_LABEL',
'0010'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_template_uuid(self):\n response = requests.get(self.url + 'editor/scan/templates', headers=self.headers, verify=False)\n templates = json.loads(response.text)\n for template in templates['templates']:\n if template['name'] == self.template_name:\n return templ... | [
"0.65291345",
"0.63532007",
"0.6203617",
"0.61391824",
"0.61038136",
"0.5980608",
"0.59394294",
"0.58779794",
"0.58727556",
"0.5831753",
"0.5827753",
"0.5803702",
"0.579694",
"0.57697505",
"0.5747736",
"0.57124245",
"0.57018036",
"0.5688378",
"0.565424",
"0.5646325",
"0.56406... | 0.68287593 | 0 |
Returns if the word is in the trie. | def search(self, word: str) -> bool:
parent = self.root
for char in word:
if char not in parent.children:
return False
parent = parent.children[char]
return parent.endhere | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return False\n else:\n if '_end_' in current_dict:\n return curr... | [
"0.838632",
"0.8150416",
"0.8123471",
"0.7856802",
"0.7830664",
"0.77935004",
"0.7792806",
"0.77642965",
"0.7753436",
"0.7747724",
"0.7711298",
"0.76816714",
"0.7677101",
"0.7664614",
"0.76506114",
"0.76338875",
"0.7628353",
"0.76114196",
"0.7577657",
"0.75695884",
"0.756079"... | 0.7419175 | 37 |
The name of a budget. | def budget_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "budget_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def budget_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"budget_name\")",
"def budget_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"budget_name\")",
"def get_name(self) -> str:\n return self.name + \" - \\u20ac\" + str(self.price)",
"def get_name(... | [
"0.8875005",
"0.8554875",
"0.64392585",
"0.6433424",
"0.64173913",
"0.6412452",
"0.6375973",
"0.63711876",
"0.6357378",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0... | 0.87428606 | 1 |
The ID of the target account for budget. Will use current user's account_id by default if omitted. | def account_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "account_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_id(self):\n return self.config.account_id",
"def account_id():\n return client.get_caller_identity()['Account']",
"def account_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"account_id\")",
"def account_id(self):\n return self._account_id",
"def account_id(se... | [
"0.7056499",
"0.6999657",
"0.6991194",
"0.6965253",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
... | 0.6752671 | 39 |
The ID of the target account for budget. Will use current user's account_id by default if omitted. | def account_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "account_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_id(self):\n return self.config.account_id",
"def account_id():\n return client.get_caller_identity()['Account']",
"def account_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"account_id\")",
"def account_id(self):\n return self._account_id",
"def account_id(se... | [
"0.7056499",
"0.6999657",
"0.6991194",
"0.6965253",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
"0.69278467",
... | 0.6752671 | 40 |
The id of the budget action. | def action_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "action_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"action_id\")",
"def get_action_id(output):\n return output['Action queued with id']",
"def get_action_id(self, action_text: str) -> int:\n\n actions_tuple = tuple(action_text.split('+'))\n return self.action_tuples2i... | [
"0.77101105",
"0.70399106",
"0.67500675",
"0.6627429",
"0.6505387",
"0.632288",
"0.62891614",
"0.6263326",
"0.6234972",
"0.62038046",
"0.6203409",
"0.6193177",
"0.61873525",
"0.6182867",
"0.6141784",
"0.6114931",
"0.6114931",
"0.6114931",
"0.6114931",
"0.6114931",
"0.6114931"... | 0.7536181 | 1 |
The ARN of the budget action. | def arn(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arn(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> pulumi.Output[str]:\n return pulumi.get... | [
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"0.6833833",
"... | 0.6568866 | 40 |
The name of a budget. | def budget_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "budget_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def budget_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"budget_name\")",
"def budget_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"budget_name\")",
"def get_name(self) -> str:\n return self.name + \" - \\u20ac\" + str(self.price)",
"def get_name(self):\n ... | [
"0.8875951",
"0.8744676",
"0.64365107",
"0.64322674",
"0.64137274",
"0.64087164",
"0.6372527",
"0.6371184",
"0.63544554",
"0.633888",
"0.633888",
"0.633888",
"0.633888",
"0.633888",
"0.633888",
"0.633888",
"0.633888",
"0.633888",
"0.633888",
"0.633888",
"0.633888",
"0.63388... | 0.85561144 | 2 |
The status of the budget action. | def status(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n return STATUS[self.fields['status']]",
"def status(self):\n self.refresh()\n # NOTE(priteau): Temporary compatibility with old and new lease status\n if self.lease.get('action') is not None:\n return self.lease['action'], self.lease['status']\n el... | [
"0.73068994",
"0.72556055",
"0.72151834",
"0.71604794",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",
"0.7086515",... | 0.0 | -1 |
The ID of the target account for budget. Will use current user's account_id by default if omitted. | def account_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "account_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_id(self):\n return self.config.account_id",
"def account_id():\n return client.get_caller_identity()['Account']",
"def account_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"account_id\")",
"def account_id(self):\n return self._account_id",
"def account_id(se... | [
"0.7056621",
"0.7000826",
"0.6991636",
"0.6965153",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6928198",
"0.6878709",
"... | 0.6543054 | 47 |
The id of the budget action. | def action_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "action_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"action_id\")",
"def get_action_id(output):\n return output['Action queued with id']",
"def get_action_id(self, action_text: str) -> int:\n\n actions_tuple = tuple(action_text.split('+'))\n return self.action... | [
"0.75367063",
"0.70411444",
"0.67519253",
"0.66289645",
"0.6508367",
"0.63262314",
"0.62919027",
"0.6266984",
"0.62385994",
"0.6206942",
"0.62062573",
"0.6196284",
"0.61886007",
"0.61811376",
"0.6144503",
"0.61187804",
"0.61187804",
"0.61187804",
"0.61187804",
"0.61187804",
"... | 0.7711328 | 0 |
The ARN of the budget action. | def arn(self) -> pulumi.Output[str]:
return pulumi.get(self, "arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arn(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n ... | [
"0.67860323",
"0.67507684",
"0.67507684",
"0.67507684",
"0.67507684",
"0.67507684",
"0.6568586",
"0.6568586",
"0.6568586",
"0.6568586",
"0.6568586",
"0.6568586",
"0.6568586",
"0.6568586",
"0.6568586",
"0.6568586",
"0.6568586",
"0.6568586",
"0.6568586",
"0.6568586",
"0.6568586... | 0.6833858 | 14 |
The name of a budget. | def budget_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "budget_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def budget_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"budget_name\")",
"def budget_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"budget_name\")",
"def get_name(self) -> str:\n return self.name + \" - \\u20ac\" + str(self.price)",
"def get_name(s... | [
"0.87428606",
"0.8554875",
"0.64392585",
"0.6433424",
"0.64173913",
"0.6412452",
"0.6375973",
"0.63711876",
"0.6357378",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"0.63426334",
"... | 0.8875005 | 0 |
The status of the budget action. | def status(self) -> pulumi.Output[str]:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n return STATUS[self.fields['status']]",
"def status(self):\n self.refresh()\n # NOTE(priteau): Temporary compatibility with old and new lease status\n if self.lease.get('action') is not None:\n return self.lease['action'], self.lease['status']\n el... | [
"0.73091716",
"0.7256718",
"0.72181976",
"0.7162094",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0.708874",
"0... | 0.0 | -1 |
Numpy implementation of the Frechet Distance. The Frechet distance between two multivariate Gaussians X_1 ~ N(mu_1, C_1) and X_2 ~ N(mu_2, C_2) is d^2 = ||mu_1 mu_2||^2 + Tr(C_1 + C_2 2sqrt(C_1C_2)). Stable version by Dougal J. Sutherland. | def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):
mu1 = np.atleast_1d(mu1)
mu2 = np.atleast_1d(mu2)
sigma1 = np.atleast_2d(sigma1)
sigma2 = np.atleast_2d(sigma2)
assert mu1.shape == mu2.shape, \
'Training and test mean vectors have different lengths'
assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):\r\n\r\n mu1 = np.atleast_1d(mu1)\r\n mu2 = np.atleast_1d(mu2)\r\n\r\n sigma1 = np.atleast_2d(sigma1)\r\n sigma2 = np.atleast_2d(sigma2)\r\n\r\n assert mu1.shape == mu2.shape, \\\r\n 'Training and test mean vectors have differ... | [
"0.76069444",
"0.75973827",
"0.758239",
"0.7578611",
"0.7578611",
"0.7578611",
"0.74629855",
"0.70032674",
"0.66978955",
"0.66526556",
"0.6602651",
"0.6415855",
"0.6381347",
"0.6249157",
"0.61492085",
"0.6145912",
"0.60787976",
"0.5981183",
"0.59776795",
"0.5944563",
"0.59085... | 0.7605066 | 1 |
Tests Boids constructor with incorrect array lengths | def test_boids_init_with_incorrect_array_length():
# Arrange
positions = np.array([[1., 2., 3., 4.], [3., 5., 7.,5.]])
velocities = np.array([[10., 11., 12.], [13., 14., 15.]])
# Act + Assert
with pytest.raises(IndexError):
Boids(positions, velocities) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_init_Error_b_wrong_shape(self):\n with self.assertRaises(ValueError):\n nbh.Polytope(b=[1, 2, 3])",
"def __init__(self, lengths):\n if len(set(lengths)) > 2:\n raise ValueError(\"This is not an isosceles triangle.\")\n super().__init__(lengths)",
"def test_wr... | [
"0.61505365",
"0.60347676",
"0.59886986",
"0.591583",
"0.58880466",
"0.5882969",
"0.5882414",
"0.58151376",
"0.57996976",
"0.5788143",
"0.57639104",
"0.56780684",
"0.56474936",
"0.56415105",
"0.5624732",
"0.56178606",
"0.5609381",
"0.56043065",
"0.5599556",
"0.5589645",
"0.55... | 0.79898036 | 0 |
Get datetime as string using custom format from settings. | def get_strftime(date_obj: dt.datetime) -> str:
return date_obj.strftime(get_settings().datetime_format) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_datetime_string():\n return datetime.now().strftime(DATETIME_FORMAT)",
"def get_datetime_str():\n return time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime())",
"def datetime_format(context):\n return {'DATETIME_FORMAT': settings.DATETIME_FORMAT.replace('%', '')}",
"def getFormattedDate(sel... | [
"0.76492363",
"0.72682583",
"0.72446215",
"0.7213162",
"0.70249367",
"0.6923086",
"0.69062227",
"0.6811708",
"0.68086225",
"0.68058574",
"0.6800442",
"0.67758554",
"0.676609",
"0.67372155",
"0.6716435",
"0.6710906",
"0.670832",
"0.6664178",
"0.66496336",
"0.664904",
"0.662031... | 0.69636285 | 5 |
get current OS type. | def get_os_type(cls):
return {
'Darwin': cls.MAC,
'Linux': cls.LINUX,
'Windows': cls.WINDOWS
}.get(platform.system(), cls.LINUX) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def os_type(self):\n\n return self._os_type",
"def os_type(self) -> Optional[str]:\n return pulumi.get(self, \"os_type\")",
"def os_type(self) -> Optional[str]:\n return pulumi.get(self, \"os_type\")",
"def get_os_type(self):\n\t\treturn call_sdk_function('PrlVmCfg_GetOsType', self.handl... | [
"0.8515933",
"0.8481272",
"0.8481272",
"0.84324276",
"0.8270059",
"0.81162024",
"0.8103817",
"0.7998018",
"0.7890929",
"0.78488916",
"0.77807957",
"0.7775268",
"0.7712083",
"0.7676643",
"0.765998",
"0.76508427",
"0.7522556",
"0.73818266",
"0.72563463",
"0.7168807",
"0.7152061... | 0.85660267 | 0 |
batching these instances together and return tensors. The seq_tensors for word and char contain their word id and char id. | def simple_batching(config, insts: List[Instance]) -> Tuple[torch.Tensor,torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor,torch.Tensor,torch.Tensor,torch.Tensor,torch.Tensor,torch.Tensor,torch.Tensor,torch.Tensor,torch.Tensor,torch.Tensor,torch.Tensor]:
batch_size = len(insts)
batch_data = insts
# pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, index):\n assert index < self.numBatches, \"%d > %d\" % (index, self.numBatches)\n lengths,max_len = self.getLengths(index )\n def wrap(b,l ):\n #batch, len, feature\n if b is None:\n return b\n b = torch.stack(b, 0).transpo... | [
"0.6394609",
"0.632983",
"0.62922436",
"0.62852645",
"0.6278272",
"0.6198009",
"0.6171594",
"0.6147196",
"0.6140273",
"0.6131661",
"0.6108745",
"0.6104221",
"0.6067046",
"0.60662264",
"0.6066175",
"0.60561395",
"0.6049364",
"0.6047542",
"0.6041223",
"0.60016394",
"0.5999275",... | 0.6995116 | 0 |
Method to decay the learning rate | def lr_decay(config, optimizer: optim.Optimizer, epoch: int) -> optim.Optimizer:
lr = config.learning_rate / (1 + config.lr_decay * (epoch - 1))
for param_group in optimizer.param_groups:
param_group['lr'] = lr
print('learning rate is set to: ', lr)
return optimizer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lr_decay(step):\n return(alpha / (1 + decay_rate * step))",
"def learning_rate_decay(alpha, decay_rate, global_step, decay_step):\n epoc_number = int(global_step / decay_step)\n alpha /= (1 + decay_rate * epoc_number)\n return alpha",
"def learning_rate_decay(alpha, decay_rate, glob... | [
"0.82532495",
"0.8228478",
"0.80260813",
"0.7933389",
"0.7848205",
"0.7769823",
"0.77343094",
"0.7724918",
"0.77237225",
"0.7698514",
"0.76632714",
"0.75876534",
"0.7513543",
"0.75111324",
"0.74338526",
"0.74338526",
"0.7388287",
"0.7339846",
"0.73239017",
"0.72736263",
"0.72... | 0.7084559 | 26 |
Loads data from `path` into a DataFrame. | def load_data(path, train=True):
COLUMNS = ['utterance_ID', 'dialog_act', 'utterance_t-3',
'utterance_t-2', 'utterance_t-1', 'utterance_t']
if not train:
COLUMNS.remove('dialog_act')
df = (pd.read_csv(path, sep='\t|;', engine='python', names=COLUMNS)
.set_index('utteran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadData(path):\n try:\n return pd.read_csv(path)\n except Exception as e:\n raise Exception(\"Could not read df, possbily incorrect path: {}\".format(e))",
"def get_data(path):\n df = pd.read_csv(path)\n\n return df",
"def load_data(path):\n try:\n data = pd.read_csv(pa... | [
"0.8278625",
"0.79471964",
"0.7895529",
"0.78884095",
"0.77912635",
"0.77314335",
"0.77314335",
"0.7635914",
"0.7527078",
"0.74598724",
"0.7431266",
"0.73749495",
"0.73397726",
"0.72604674",
"0.7230723",
"0.7225507",
"0.7201551",
"0.71941394",
"0.71825475",
"0.7058847",
"0.70... | 0.64957917 | 62 |
Prepares the data for the model by calling `process_seq` on each sentence in the data, then padding the sequence to max_len. If `top_words` is None, then the data will include all words; otherwise, it returns only `top_words` words. | def process_data(data, max_len, top_words=None, custom_vocab=None):
# We have to calculate this every time even though we
# only need it for the training data
if custom_vocab is None:
vocab, word_to_idx, idx_to_word = get_vocab(data['utterance_t'], top_words)
label_to_idx = {label:idx for idx, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_beam_search(\n self,\n input_ids,\n cur_len,\n max_length,\n min_length,\n do_sample,\n early_stopping,\n temperature,\n top_k,\n top_p,\n repetition_penalty,\n no_repeat_ngram_size,\n bad_words_ids,\n p... | [
"0.56266147",
"0.56003267",
"0.5562717",
"0.5557564",
"0.5508258",
"0.55027795",
"0.54890114",
"0.54268676",
"0.5372631",
"0.5285046",
"0.52661073",
"0.5264098",
"0.523292",
"0.51973",
"0.51848423",
"0.51837856",
"0.51832706",
"0.5180354",
"0.51076305",
"0.506523",
"0.5064267... | 0.6051912 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.