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 |
|---|---|---|---|---|---|---|
Property for the enumeration of this transaction () | def protection_eligibility_enum(self) -> ProtectionElegibility:
try:
return ProtectionElegibility(int(self.protection_eligibility))
except:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enum(self):\r\n raise NotImplementedError",
"def transaction_status_enum(self) -> TransactionStatus:\n return _TRANSACTION_STATUS_MAPPING.get(self.transaction_status)",
"def enumeration(self):\n raise exceptions.NotImplementedError()",
"def __index__(cls): # pylint: disable=invalid-... | [
"0.71118397",
"0.6593331",
"0.6270592",
"0.62465674",
"0.6158069",
"0.59486014",
"0.58366627",
"0.58330446",
"0.58252573",
"0.5776557",
"0.5740692",
"0.57314277",
"0.5705731",
"0.5659605",
"0.565769",
"0.5623061",
"0.56176597",
"0.56176597",
"0.561505",
"0.561505",
"0.5612701... | 0.0 | -1 |
Forward process. Only 4x feature maps is used to calculate loss. Additional feature maps supervising can be added if calculating resource is enough. | def forward(self, x):
x_4 = x[0]
x_p4 = self.P4_conv(x_4)
x_4_1x7 = self.channel4_1x7_conv(x_4)
x_p4_1x7 = self.P4_1x7_conv(x_p4)
x_4 = x_p4_1x7 + x_p4 + x_4_1x7
x_4 = self.rpn4(x_4)
# predict results of aligned cell region mask and global pyramid mask
m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n sources = list()\n new_sources = list()\n\n # apply lds to the initial image\n x_pool = self.lds(x)\n\n # apply vgg up to conv4_3\n for k in range(22):\n x = self.features[k](x)\n conv4_3_bn = self.ibn1(x)\n x_pool1_skip, x_... | [
"0.69317913",
"0.68093896",
"0.67466486",
"0.66855973",
"0.6674017",
"0.6602134",
"0.65924376",
"0.657881",
"0.65654254",
"0.65557927",
"0.6488124",
"0.64579856",
"0.6447587",
"0.6445193",
"0.6444281",
"0.642611",
"0.64092565",
"0.6401186",
"0.63872015",
"0.6384943",
"0.63688... | 0.62248266 | 32 |
If the billing account already has an IOU account, return the update form. If there isn't an account yet, then return the creation form | def get_billing_details_form(billing_account):
try:
iou_account = billing_account.simple_processor_iou_account
return IOUAccountUpdateForm
except IOUAccount.DoesNotExist:
return IOUAccountCreationForm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manage():\n if current_user.is_agency:\n form = ManageAgencyUserAccountForm(user=current_user)\n else:\n form = ManageUserAccountForm(user=current_user)\n\n if request.method == \"POST\":\n if form.validate_on_submit():\n update_openrecords_user(form)\n redir... | [
"0.6070687",
"0.6037547",
"0.5988173",
"0.5983497",
"0.5789755",
"0.57439816",
"0.56556976",
"0.563131",
"0.5623569",
"0.5617682",
"0.5516923",
"0.54676425",
"0.5454282",
"0.54209024",
"0.5419233",
"0.5396492",
"0.53896946",
"0.53603184",
"0.5337848",
"0.52935314",
"0.5287341... | 0.7438349 | 0 |
Returns the Channels Group name that sockets should subscribe to to get sent messages as they are generated. | def group_name(self):
return "room-%s" % self.pk | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_name(self):\n\t\treturn \"DocumentChat-%s\" % self.id",
"def _get_peer_group_name(self):\n return self.__peer_group_name",
"def _get_peer_group_name(self):\n return self.__peer_group_name",
"def get_group_name(self):\n return self.groupname",
"def websocket_group(self):\n ... | [
"0.67033607",
"0.647381",
"0.647381",
"0.6465417",
"0.6434411",
"0.64291686",
"0.642359",
"0.6367134",
"0.63132614",
"0.6228915",
"0.62003005",
"0.6188551",
"0.6169147",
"0.6107189",
"0.60954183",
"0.6086085",
"0.60798824",
"0.6052177",
"0.60476255",
"0.6019649",
"0.6003893",... | 0.58056945 | 37 |
The ID of the user to add the GPG key to. If this field is omitted, this resource manages a GPG key for the current user. Otherwise, this resource manages a GPG key for the specified user, and an admin token is required. | def user_id(self) -> Optional[pulumi.Input[int]]:
return pulumi.get(self, "user_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"user_id\")",
"def user_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"user_id\")",
"def user_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"user_id\")",
"def user_id(self) -> Optional[pu... | [
"0.59973806",
"0.59973806",
"0.59461033",
"0.59461033",
"0.59461033",
"0.58855414",
"0.5857102",
"0.57523966",
"0.5672502",
"0.56256455",
"0.561052",
"0.561052",
"0.561052",
"0.561052",
"0.561052",
"0.56017846",
"0.5598544",
"0.55765146",
"0.55765146",
"0.5566953",
"0.5566593... | 0.5794713 | 8 |
The ID of the user to add the GPG key to. If this field is omitted, this resource manages a GPG key for the current user. Otherwise, this resource manages a GPG key for the specified user, and an admin token is required. | def user_id(self) -> Optional[pulumi.Input[int]]:
return pulumi.get(self, "user_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"user_id\")",
"def user_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"user_id\")",
"def user_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"user_id\")",
"def user_id(self) -> Optional[pu... | [
"0.59973806",
"0.59973806",
"0.59461033",
"0.59461033",
"0.59461033",
"0.58855414",
"0.5857102",
"0.57523966",
"0.5672502",
"0.56256455",
"0.561052",
"0.561052",
"0.561052",
"0.561052",
"0.561052",
"0.56017846",
"0.5598544",
"0.55765146",
"0.55765146",
"0.5566953",
"0.5566593... | 0.5794713 | 7 |
The ID of the user to add the GPG key to. If this field is omitted, this resource manages a GPG key for the current user. Otherwise, this resource manages a GPG key for the specified user, and an admin token is required. | def user_id(self) -> pulumi.Output[Optional[int]]:
return pulumi.get(self, "user_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"user_id\")",
"def user_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"user_id\")",
"def user_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"user_id\")",
"def user_id(self) -> Optional[pu... | [
"0.59973806",
"0.59973806",
"0.59461033",
"0.59461033",
"0.59461033",
"0.58855414",
"0.5857102",
"0.5794713",
"0.5794713",
"0.57523966",
"0.5672502",
"0.56256455",
"0.561052",
"0.561052",
"0.561052",
"0.561052",
"0.561052",
"0.56017846",
"0.5598544",
"0.55765146",
"0.55765146... | 0.53703696 | 36 |
Returns a formatted filename using the template stored in self.filename Arguments | def format_filename(self, data, row):
return self.filename.format(**self.filename_formatters(data, row)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_template_filename(self):\n file_name = ReportMeta.reports[self._report_key]['fileName']\n return '{}.html'.format(file_name)",
"def get_filename(self, path, params, type_=None):\n phase = self.phase\n\n if type_:\n phase += ('_' + type_)\n\n filename = self.... | [
"0.7372324",
"0.72205263",
"0.7211966",
"0.71357596",
"0.7116954",
"0.70353585",
"0.70277053",
"0.69741374",
"0.69528997",
"0.6951184",
"0.6936264",
"0.6915955",
"0.6906335",
"0.6891999",
"0.68614364",
"0.68525696",
"0.67716825",
"0.67658573",
"0.67550075",
"0.6733696",
"0.67... | 0.71709263 | 3 |
Test getting dataset path. | def test_get_dataset_path(self) -> None:
framework = "tensorflow"
domain = "image_recognition"
result = get_dataset_path(framework, domain)
self.assertEqual(result, "examples/test/dataset/imagenet") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_make_dataset_happy_path(self):\n # User story: user runs src.make_dataset() on the current directory\n # and gets a fully functional dataset\n pass",
"def test_data_path(self):\n path = self._api.GetDatapath()\n self._api.End()\n self.assertRaises(\n ... | [
"0.75778013",
"0.75268173",
"0.7313395",
"0.70568323",
"0.6979461",
"0.69666904",
"0.69261616",
"0.6925592",
"0.6921823",
"0.69095963",
"0.679207",
"0.6753882",
"0.6716215",
"0.67095876",
"0.6703324",
"0.6695395",
"0.6667533",
"0.66508496",
"0.6650378",
"0.66204023",
"0.66069... | 0.82967913 | 0 |
Check if a given bbUser object is stored in the database. Currently only checks if a user with the same ID is stored in the database, not if the objects are the same. | def userObjExists(self, user : bbUser.bbUser) -> bool:
return self.userIDExists(user.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists_in_db(self) -> bool:\n query = \"\"\"SELECT * \n FROM Users \n WHERE Username=?;\"\"\"\n return len(self.db.fetchall(query, values=(self.username,))) > 0",
"def isOwner(id, userId):\n db = core.connect()\n return db[id][\"createdBy\"] == userId",... | [
"0.66454977",
"0.6629096",
"0.6502776",
"0.64873165",
"0.6384",
"0.63549405",
"0.634741",
"0.6321379",
"0.63175",
"0.63037634",
"0.62980324",
"0.6297806",
"0.6245325",
"0.62262326",
"0.62138486",
"0.62071496",
"0.6190167",
"0.6176963",
"0.616143",
"0.615577",
"0.6141846",
"... | 0.7575999 | 0 |
Reset the stats for the user with the specified ID. | def reinitUser(self, id : int):
id = self.validateID(id)
# ensure the ID exists in the database
if not self.userIDExists(id):
raise KeyError("user not found: " + str(id))
# Reset the user
self.users[id].resetUser() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stats_reset(self):\n self.stats.reset()",
"def stats_reset(self):\n self.stats.reset()",
"def reset_stats(self):\n print(\"Reseting stats\")\n self.player_lives = self.ai_stts.player_lives\n self.score = 0\n self.level = 1",
"def resetUser(self):\n\t\turl = \"htt... | [
"0.6416",
"0.6416",
"0.63771105",
"0.6241124",
"0.6069007",
"0.6018874",
"0.6008657",
"0.5996576",
"0.59836346",
"0.59318155",
"0.5928619",
"0.5910059",
"0.5876897",
"0.58712983",
"0.58664316",
"0.58137023",
"0.5787853",
"0.5773324",
"0.5766223",
"0.5684285",
"0.5558619",
"... | 0.694401 | 0 |
If a bbUser exists in the database with the requested ID, return it. If not, create and store a new bbUser and return it. | def getOrAddID(self, id : int) -> bbUser.bbUser:
return self.getUser(id) if self.userIDExists(id) else self.addUser(id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUser(self, id : int) -> bbUser.bbUser:\n id = self.validateID(id)\n return self.users[id]",
"def addUser(self, id : int) -> bbUser.bbUser:\n id = self.validateID(id)\n # Ensure no user exists with the specified ID in the database\n if self.userIDExists(id):\n ... | [
"0.71380436",
"0.7094037",
"0.70649517",
"0.6900218",
"0.68044686",
"0.67403007",
"0.6731143",
"0.67079204",
"0.6696172",
"0.6682262",
"0.6681719",
"0.6681719",
"0.6681719",
"0.6681719",
"0.6681203",
"0.666396",
"0.6660379",
"0.66603625",
"0.6650168",
"0.6632992",
"0.6603484"... | 0.797189 | 0 |
Fetch the bbUser from the database with the given ID. | def getUser(self, id : int) -> bbUser.bbUser:
id = self.validateID(id)
return self.users[id] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def fetch_user(self, id: utils.Intable) -> User | None:\n id64 = make_id64(id=id, type=Type.Individual)\n return await self._connection.fetch_user(id64)",
"def get_user_by_id(self, id):\n\t\treturn self.users.get(id)",
"def load_user(id):\n return User.query.get(int(id))",
"def load_us... | [
"0.8142412",
"0.7948193",
"0.79404026",
"0.79404026",
"0.79404026",
"0.79404026",
"0.7924561",
"0.7899446",
"0.7896432",
"0.7849403",
"0.78431547",
"0.78220767",
"0.78131187",
"0.7770938",
"0.7769073",
"0.77454466",
"0.77377176",
"0.7650907",
"0.7642752",
"0.7618635",
"0.7615... | 0.8525421 | 0 |
Serialise this bbUserDB into dictionary format. | def toDict(self, **kwargs) -> dict:
data = {}
# Iterate over all user IDs in the database
for id in self.getIds():
# Serialise each bbUser in the database and save it, along with its ID to dict
# JSON stores properties as strings, so ids must be converted to str first.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user2dict(self):\n d = {}\n d['username'] = self.username\n d['level'] = self.level\n d['name'] = self.name\n d['email'] = self.email\n d['creation'] = self.creation\n d['update'] = self.update\n d['nsentences'] = self.nsentences\n d['nsessions'] =... | [
"0.73725003",
"0.72896534",
"0.71920073",
"0.71753246",
"0.716274",
"0.7151962",
"0.71234363",
"0.7105887",
"0.7040066",
"0.69651514",
"0.6952894",
"0.6938799",
"0.6933408",
"0.6907724",
"0.68980014",
"0.68346447",
"0.6777401",
"0.67636013",
"0.6733848",
"0.67159617",
"0.6711... | 0.7482245 | 0 |
Construct a bbUserDB from a dictionaryserialised representation the reverse of bbUserDB.toDict() | def fromDict(cls, userDBDict : dict, **kwargs) -> bbUserDB:
# Instance the new bbUserDB
newDB = bbUserDB()
# iterate over all user IDs to spawn
for id in userDBDict.keys():
# Construct new bbUsers for each ID in the database
# JSON stores properties as strings, so... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt: dict) -> 'UserBase':\n return util.deserialize_model(dikt, cls)",
"def toDict(self, **kwargs) -> dict:\n data = {}\n # Iterate over all user IDs in the database\n for id in self.getIds():\n # Serialise each bbUser in the database and save it, along ... | [
"0.67769945",
"0.6622561",
"0.65516293",
"0.63922143",
"0.63320786",
"0.62116504",
"0.6042782",
"0.6004884",
"0.5900546",
"0.5864641",
"0.5853948",
"0.578413",
"0.5688235",
"0.5666956",
"0.56637603",
"0.5660747",
"0.5650265",
"0.5648268",
"0.56327444",
"0.5618494",
"0.560434"... | 0.71973324 | 0 |
The shrink (softthresholding) operator, which is also the proximal operator for the L1norm. The shrink operator reducing the magnitudes of all entries in x by t, leaving them at zero if they're already less than t. | def shrink(x: np.ndarray, t: float) -> np.ndarray:
return np.sign(x) * np.maximum(np.abs(x) - t, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_softshrink(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n dtype = infer_type(x).checked_type.dtype\n threshold = _expr.const(op.attr(\"lambda\"), dtype=dtype)\n zeros = _op.zeros_like(x)\n out = _op.where(x < -threshold, x + threshold, zeros) + _op.where(\n x > threshold,... | [
"0.65450245",
"0.6496893",
"0.64630055",
"0.6456143",
"0.6226922",
"0.61587155",
"0.5946745",
"0.5927948",
"0.5875077",
"0.57929087",
"0.57728153",
"0.5728194",
"0.5728194",
"0.5728194",
"0.5629461",
"0.5480745",
"0.543062",
"0.5420821",
"0.54135394",
"0.5374806",
"0.53720266... | 0.78240633 | 0 |
Does the user have the permission to publish a data. | def has_perm_publish_data(user):
has_perm_publish(user, rights.PUBLISH_DATA) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canPublish(id, userId):\n db = core.connect()\n theShift = db[id]\n return user.isAdmin(userId) or (userId == theShift['createdBy'])",
"def has_add_permission(self, request):\n if not settings.PUBLISHER_CODE:\n return False\n return super().has_add_permission(request)",
"d... | [
"0.7401715",
"0.68930787",
"0.6854572",
"0.68086797",
"0.6761256",
"0.67495507",
"0.6707519",
"0.6702206",
"0.6684865",
"0.66546744",
"0.6624943",
"0.66060966",
"0.6596229",
"0.65667605",
"0.6543968",
"0.6537075",
"0.6512933",
"0.65074724",
"0.6503338",
"0.64965105",
"0.64941... | 0.889468 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, StandardizedTierTier):
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 dataframe from a json file. | def json(path):
try:
# TODO: Check a better way to handle this Spark.instance.spark. Very verbose.
df = Spark.instance.spark.read.json(path)
except IOError as error:
logging.error(error)
raise
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_file(filename):\n with open(filename, 'rt') as f:\n d = json.load(f)\n return pd.DataFrame.from_records(d['dataset'])",
"def load_data(filepath):\n \n return pd.read_json(filepath)",
"def load_data(self, filepath: str) -> pd.DataFrame:\n \n with open(filepath) as f:\n ... | [
"0.819254",
"0.7823375",
"0.78119093",
"0.77657497",
"0.75791085",
"0.75206435",
"0.7203945",
"0.7167869",
"0.71065944",
"0.7062188",
"0.6910279",
"0.6895788",
"0.6882497",
"0.68209225",
"0.67718965",
"0.67359996",
"0.6689824",
"0.666205",
"0.6643767",
"0.66075075",
"0.659852... | 0.7011017 | 10 |
Return a dataframe from a parquet file. | def parquet(path, *args, **kwargs):
try:
df = Spark.instance.spark.read.parquet(path, *args, **kwargs)
except IOError as error:
logging.error(error)
raise
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pq2df(data_file):\n df = pd.read_parquet(data_file)\n return df",
"def read_parquet(self, filename):\n if filename is None:\n raise ValueError(\"File name is None\")\n self.logger.info(\"# Reading a Parquet file \" + filename)\n sqlContext = SQLContext(self.spar... | [
"0.8080801",
"0.7680819",
"0.75473124",
"0.71808255",
"0.70952356",
"0.66877913",
"0.65009177",
"0.64348716",
"0.642109",
"0.64079404",
"0.63399845",
"0.63359207",
"0.62860304",
"0.624169",
"0.6233218",
"0.62246",
"0.6219255",
"0.61767995",
"0.61527157",
"0.6148135",
"0.61377... | 0.7916956 | 1 |
Save the trained vectorizer for future use. | def pickle_vectorizer(self, path='models/TFIDFVectorizer.pkl'):
with open(path, 'wb') as f:
pickle.dump(self.vectorizer, f)
print("Pickled vectorizer at {}".format(path)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_vectorizer(self, vectorizer_filepath):\n with open(vectorizer_filepath, \"w\") as fp:\n json.dump(self._vectorizer.to_serializable(), fp)",
"def save(self, tfidf_vectorizer_path):\n with open(tfidf_vectorizer_path, \"wb\") as fw:\n pickle.dump(self, fw)",
"def save_... | [
"0.76096624",
"0.73109317",
"0.7164249",
"0.70169145",
"0.66974753",
"0.6566269",
"0.6522058",
"0.64056844",
"0.63931715",
"0.6316061",
"0.6313552",
"0.6313552",
"0.6276785",
"0.62720037",
"0.623774",
"0.62127876",
"0.62069654",
"0.6184085",
"0.6171327",
"0.61685747",
"0.6127... | 0.7430699 | 1 |
Get the x, y, z, yaw, pitch and roll of the blender object. | def default_action(self):
x = self.position_3d.x
y = self.position_3d.y
z = self.position_3d.z
yaw = self.position_3d.yaw
pitch = self.position_3d.pitch
roll = self.position_3d.roll
# Gather information about all segments of the kuka-arm
self._segments = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAngles(self) -> tuple:\n return self.getHeading(), self.getPitch(), self.getRoll()",
"def get_draw_data(self):\n x, y = self._coordinates\n return x, y, self.__heading",
"def get_pos_and_orientation(self):\n pos, rot = p.getBasePositionAndOrientation(self.pybullet_id)\n ... | [
"0.63418734",
"0.6309489",
"0.6254961",
"0.6254961",
"0.6254961",
"0.6217224",
"0.60536915",
"0.6044034",
"0.6017542",
"0.6001574",
"0.5949086",
"0.5943164",
"0.58633053",
"0.58633053",
"0.58574796",
"0.58550453",
"0.5844058",
"0.5816276",
"0.58038104",
"0.576194",
"0.5691996... | 0.0 | -1 |
Initialize the client. Requires a BuiltWith API key. Optionally takes in the API version. If no API version is specified, a default of `12` is used. | def __init__(self, key, api_version=12):
if api_version not in ENDPOINTS_BY_API_VERSION.keys():
raise UnsupportedApiVersion(VERSION_EXCEPTION_TEMPLATE % api_version)
self.key = key
self.api_version = api_version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, client_id: str, client_secret: str,\n x_api_key: str, version: str):\n super().__init__(client_id, client_secret, x_api_key, version)",
"def __init__(self, app_key=None, app_sid=None, base_url=None,\n api_version=None, debug=False, proxy=None):\n c... | [
"0.7145586",
"0.70431364",
"0.6840511",
"0.6745353",
"0.6723974",
"0.67110234",
"0.66834116",
"0.6665458",
"0.661136",
"0.66090286",
"0.6545305",
"0.6392615",
"0.631137",
"0.62908876",
"0.62697035",
"0.6265824",
"0.6171141",
"0.61463577",
"0.61458045",
"0.61331064",
"0.611292... | 0.68917906 | 2 |
The name of the resource group. The name is case insensitive. | def resource_group_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "resource_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def resource_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_gr... | [
"0.8591833",
"0.83624226",
"0.8203686",
"0.8203686",
"0.8203686",
"0.8203686",
"0.8203686",
"0.8203686",
"0.8203686",
"0.8203686",
"0.8203686",
"0.8203686",
"0.8203686",
"0.8203686",
"0.81753516",
"0.80862474",
"0.80862474",
"0.80862474",
"0.80862474",
"0.80862474",
"0.808624... | 0.8088815 | 48 |
The name of the Application Insights component resource. | def resource_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "resource_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self.raw_resource[\"name\"]",
"def name(self):\n\n return self.resource[\"metadata\"][\"name\"]",
"def name(self) -> str:\n if self._name is None:\n return 'AutoML Metric'\n else:\n return self._name",
"def name(self):\n\n retu... | [
"0.6259344",
"0.62363994",
"0.61032945",
"0.60528404",
"0.6051231",
"0.60437256",
"0.60437256",
"0.60114765",
"0.5920258",
"0.5920258",
"0.58952844",
"0.58867717",
"0.58867717",
"0.5839472",
"0.57963365",
"0.5767712",
"0.57452095",
"0.5737283",
"0.5734956",
"0.5734956",
"0.57... | 0.54356354 | 74 |
Getter of the user id. | def get_user_id(self):
return self.id_user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_id(self):\n return self.user_id",
"def get_id(self) -> int:\n return self.user_id",
"def user_id(self):\n return self._user_id",
"def user_id(self):\n return self._user_id",
"def user_id(self):\n return self._user_id",
"def user_id(self):\n return self._u... | [
"0.8740212",
"0.8674682",
"0.8466421",
"0.8466421",
"0.8466421",
"0.8466421",
"0.8466421",
"0.84438294",
"0.84438294",
"0.8365442",
"0.8362073",
"0.83430153",
"0.8284895",
"0.8284895",
"0.8263458",
"0.8238554",
"0.82361627",
"0.82293457",
"0.8197898",
"0.8093313",
"0.80851257... | 0.8879019 | 0 |
Method to check if a movie have been already seen for the given user. | def check_movie_seen(self, id_movie):
if id_movie in self.seen:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_watched_movie(username: str, movie_id: int) -> bool:\n with connection:\n all_movies = connection.execute(MOVIES_IDS, (movie_id,)).fetchone()\n all_usernames = connection.execute(USERS_IDS, (username,)).fetchone()\n if all_usernames is not None and all_movies is not None:\n ... | [
"0.62960756",
"0.6231976",
"0.609444",
"0.6070275",
"0.60486317",
"0.6042864",
"0.6039808",
"0.6021467",
"0.5981415",
"0.59635645",
"0.5831276",
"0.58286434",
"0.5827806",
"0.5819191",
"0.579271",
"0.5785383",
"0.57851636",
"0.5760467",
"0.57585835",
"0.57534826",
"0.5748277"... | 0.7359592 | 0 |
Iteratively splits data with stratification. This function is based on the iterative_train_test_split function from the skmultilearn.model_selection package, but uses pandas dataframes as input and output. | def iterative_train_test(X, y, test_size):
stratifier = IterativeStratification(n_splits=2, order=2, sample_distribution_per_fold=[test_size, 1.0-test_size])
train_indexes, test_indexes = next(stratifier.split(X, y))
X_train, y_train = X.iloc[train_indexes], y[train_indexes]
X_test, y_test = X.iloc[tes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_data(input_df, output_df):\n return train_test_split(input_df, output_df, test_size=0.2, random_state=42,\n stratify=output_df)",
"def split(df, stratify_by=None):\n \n if stratify_by == None:\n train, test = train_test_split(df, test_size=.3, random_state=123... | [
"0.7940847",
"0.77700734",
"0.73608685",
"0.72325754",
"0.7231763",
"0.7201539",
"0.7191493",
"0.71370035",
"0.7097345",
"0.70749754",
"0.7068613",
"0.70635283",
"0.703297",
"0.7010203",
"0.69998264",
"0.6987067",
"0.69493777",
"0.6917207",
"0.69099796",
"0.6895471",
"0.68920... | 0.682493 | 24 |
Quick way of getting all hosts or a subset for this stack. (list); list of primary keys of hosts in this stack (QuerySet); | def get_hosts(self, host_ids=None):
if not host_ids:
return self.hosts.all()
return self.hosts.filter(id__in=host_ids) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(self, **kwargs):\n\n return self.getResourceManager() \\\n .getSdk() \\\n .hosts \\\n .list(**kwargs)",
"def get_hosts(self):\n\n raise NotImplementedError",
"def hosts(self):\n\n return self._get_list_field(\"hosts\", lambda x... | [
"0.6386337",
"0.6371365",
"0.63523024",
"0.63523024",
"0.6272247",
"0.6215245",
"0.6201035",
"0.6201035",
"0.616472",
"0.6138865",
"0.6128013",
"0.6115967",
"0.6107518",
"0.60520285",
"0.6051724",
"0.60374975",
"0.6008605",
"0.6000928",
"0.599559",
"0.59938854",
"0.598613",
... | 0.6725173 | 0 |
Compute the KL divergence KL[q || p] between q(x) = N(q_mu, q_sqrt^2) and p(x) = N(0, K) We assume N multiple independent distributions, given by the columns of q_mu and the last dimension of q_sqrt. Returns the sum of the divergences. q_mu is a matrix (M x N), each column contains a mean. q_sqrt can be a 3D tensor (M ... | def gauss_kl(q_mu, q_sqrt, K=None):
#print(q_sqrt._tf_array)
#q_sqrt = q_sqrt._tf_array
#q_mu = q_mu._tf_array
if K is None:
white = True
alpha = q_mu
else:
white = False
Lp = tf.cholesky(K)
alpha = tf.matrix_triangular_solve(Lp, q_mu, lower=True)
if q_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kl_divergence(self, params_q, params_p):\n means_q = params_q[:, :, 0]\n log_std_q = params_q[:, :, 1]\n\n means_p = params_p[:, :, 0]\n log_std_p = params_p[:, :, 1]\n\n std_q = torch.exp(log_std_q)\n std_p = torch.exp(log_std_p)\n\n kl_div = log_std_p - log_st... | [
"0.71765184",
"0.7019512",
"0.6987265",
"0.69375336",
"0.69356835",
"0.6904298",
"0.689787",
"0.6729169",
"0.6645247",
"0.65512383",
"0.6495925",
"0.64693046",
"0.6374325",
"0.63563484",
"0.6350259",
"0.6266845",
"0.6263321",
"0.6241391",
"0.62203217",
"0.6207716",
"0.6193783... | 0.67699784 | 7 |
test that timestamp is really remembered | def test_timestamp(self):
# apply real memoize to do proper testing
minwebhelpers.beaker_cache = memoize
css_source_1 = stylesheet_link('/deep/a.css', '/b.css', combined=True, minified=True, timestamp=True)
time.sleep(1)
css_source_2 = stylesheet_link('/deep/a.css', '/b.css', co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isFresh(self, timestamp):\n pass;",
"def __expired_timestamp(self, timestamp):\n return int(time.time()) > timestamp + self.__ttl",
"def test_last_used(self, monkeypatch):\n monkeypatch.setenv('ENABLE_AUTO_EXPIRE', 'true')\n monkeypatch.setenv('INACTIVITY_AGE', '10')\n cr... | [
"0.7103609",
"0.7088542",
"0.6672816",
"0.65801454",
"0.64244413",
"0.641137",
"0.64082605",
"0.63636667",
"0.63623965",
"0.6352042",
"0.6347807",
"0.6344862",
"0.6342813",
"0.6341419",
"0.6334243",
"0.6309578",
"0.62998533",
"0.62858075",
"0.62832284",
"0.6267803",
"0.624547... | 0.59452564 | 49 |
Check that the response is not cached when the behavior is disabled. | def test_cache_page_disabled(self):
content = self.unique()
calls = []
def get(self, request, *args, **kwargs):
calls.append(None)
return http.HttpResponse(content)
self.assertViewBehavior(
{"cache_page": False, "get": get},
repeat=2,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)",
"def test_disabled(self):\n content = self.unique()\n self.assertViewBehavior(\n ... | [
"0.81057525",
"0.76422733",
"0.75728554",
"0.7479882",
"0.7288173",
"0.7107524",
"0.7067377",
"0.7039522",
"0.68838865",
"0.6812274",
"0.676797",
"0.6756619",
"0.6708938",
"0.6700436",
"0.6537605",
"0.65188557",
"0.65129423",
"0.65013593",
"0.64976686",
"0.6464215",
"0.645495... | 0.7505479 | 3 |
Check that the default HTTP method name protection takes precedence. | def test_cache_page_precedence(self):
self.assertViewBehavior(
status_code=405) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _method_check(self, request, allowed=None):\n if allowed is None:\n allowed = []\n\n request_method = request.method.lower()\n allows = ','.join(map(str.upper, allowed))\n\n if request_method == \"options\":\n response = HttpResponse(allows)\n respon... | [
"0.7103364",
"0.70686543",
"0.70461714",
"0.69518584",
"0.68466485",
"0.6784883",
"0.6704716",
"0.67026776",
"0.66991746",
"0.6694735",
"0.66651976",
"0.65623546",
"0.65139705",
"0.64794755",
"0.64261013",
"0.64012486",
"0.63546383",
"0.6338937",
"0.6317658",
"0.63083893",
"0... | 0.0 | -1 |
Check that the defaults do not set any cache control headers on the response. | def test_defaults(self):
content = self.unique()
self.assertViewBehavior(
{"get": content},
status_code=200,
content=content,
headers_exclude="Cache-Control") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)",
"def never_cache_preview(response):\n response.cache_control.max_age = 0\n response.cache... | [
"0.7360473",
"0.7291879",
"0.72360945",
"0.7173469",
"0.704552",
"0.70238",
"0.69512165",
"0.68105143",
"0.67153543",
"0.6714631",
"0.6711166",
"0.6690023",
"0.66247284",
"0.6617076",
"0.6613454",
"0.6605222",
"0.6562822",
"0.6557137",
"0.6548916",
"0.6548916",
"0.6537977",
... | 0.6132521 | 68 |
Check that the public cache control header is set on the resopnse. | def test_public(self):
content = self.unique()
self.assertViewBehavior(
{"cache_control_public": True, "get": content},
status_code=200,
content=content,
headers_exact={"Cache-Control": "public"}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surrogate_control(self):\n def on_update(surrogate_control):\n if not surrogate_control and \"surrogate-control\" in self.headers:\n del self.headers[\"surrogate-control\"]\n elif surrogate_control: # pragma: no cover\n self.headers[\"Surrogate-Contro... | [
"0.6707758",
"0.6568386",
"0.64592665",
"0.6406012",
"0.63427687",
"0.6286725",
"0.6247568",
"0.6247568",
"0.6219212",
"0.61471593",
"0.6057611",
"0.59990674",
"0.5977669",
"0.5969899",
"0.5969899",
"0.5955601",
"0.59221154",
"0.5918134",
"0.59029275",
"0.589787",
"0.5883854"... | 0.6245776 | 8 |
Check that the no_cache cache control header is set on the resopnse. | def test_no_cache(self):
content = self.unique()
self.assertViewBehavior(
{"cache_control_no_cache": True, "get": content},
status_code=200,
content=content,
headers_exact={"Cache-Control": "no-cache"}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)",
"def nocache(response):\n response.headers['Cache-Control'] = 'no-store, no-cache, m... | [
"0.7414972",
"0.6805398",
"0.67788416",
"0.67497075",
"0.6657216",
"0.6639991",
"0.6516709",
"0.6489518",
"0.6489176",
"0.64887327",
"0.644979",
"0.6448329",
"0.6426001",
"0.63928515",
"0.63785326",
"0.6366645",
"0.63470674",
"0.63470674",
"0.63428575",
"0.6316757",
"0.628442... | 0.7025476 | 1 |
Check that the no_transform cache control header is set on the resopnse. | def test_no_transform(self):
content = self.unique()
self.assertViewBehavior(
{"cache_control_no_transform": True, "get": content},
status_code=200,
content=content,
headers_exact={"Cache-Control": "no-transform"}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)",
"def test_not_modified_headers(self):\n\n def get_response(req):\n resp = sel... | [
"0.6575073",
"0.62584645",
"0.6253825",
"0.61756957",
"0.6135134",
"0.61045665",
"0.6085116",
"0.6053426",
"0.6017882",
"0.58883804",
"0.5885764",
"0.5883365",
"0.58609915",
"0.58609915",
"0.577764",
"0.5760166",
"0.57544553",
"0.5737813",
"0.5737813",
"0.5734081",
"0.5727316... | 0.72058463 | 0 |
Check that the must_revalidate cache control header is set on the resopnse. | def test_must_revalidate(self):
content = self.unique()
self.assertViewBehavior(
{"cache_control_must_revalidate": True, "get": content},
status_code=200,
content=content,
headers_exact={"Cache-Control": "must-revalidate"}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)",
"def has_cached(self,ourmod,etag=None):\n if \"If-Modified-Since\" in self.request.heade... | [
"0.70986366",
"0.67210567",
"0.6683338",
"0.6584366",
"0.6584366",
"0.6293861",
"0.62422216",
"0.62041104",
"0.6199004",
"0.6124973",
"0.6101025",
"0.608115",
"0.6053864",
"0.60428745",
"0.60428745",
"0.6038889",
"0.6029584",
"0.6014237",
"0.600515",
"0.5989785",
"0.59765875"... | 0.7850928 | 0 |
Check that the max_age cache control header is set on the resopnse. | def test_max_age(self):
content = self.unique()
self.assertViewBehavior(
{"cache_control_max_age": 1, "get": content},
status_code=200,
content=content,
headers_exact={"Cache-Control": "max-age=1"}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_max_age_3600(self, sess):\r\n r = sess.get(self.url)\r\n assert self.cache.get(self.url) == r.raw\r\n\r\n # request that we don't want a new one unless\r\n r = sess.get(self.url, headers={'Cache-Control': 'max-age=3600'})\r\n assert r.from_cache is True\r\n\r\n ... | [
"0.72107726",
"0.6873612",
"0.68624157",
"0.66889685",
"0.6536094",
"0.6532378",
"0.6311946",
"0.62280434",
"0.6197227",
"0.61068356",
"0.61068356",
"0.6103469",
"0.60647094",
"0.6050893",
"0.5995915",
"0.5928432",
"0.58629507",
"0.58624345",
"0.5841793",
"0.5827531",
"0.5821... | 0.7228714 | 0 |
Check that the s_maxage cache control header is set on the response. | def test_s_maxage(self):
content = self.unique()
self.assertViewBehavior(
{"cache_control_s_maxage": 1, "get": content},
status_code=200,
content=content,
headers_exact={"Cache-Control": "s-maxage=1"}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_max_age(self):\n content = self.unique()\n self.assertViewBehavior(\n {\"cache_control_max_age\": 1, \"get\": content},\n status_code=200,\n content=content,\n headers_exact={\"Cache-Control\": \"max-age=1\"})",
"def test_client_max_age_3600(self... | [
"0.7056533",
"0.69589156",
"0.6764175",
"0.6662597",
"0.6601882",
"0.6553718",
"0.6453501",
"0.640816",
"0.6405672",
"0.63611406",
"0.63209236",
"0.63209236",
"0.63096035",
"0.6251666",
"0.6251313",
"0.6150831",
"0.6150831",
"0.6129807",
"0.6030514",
"0.6019444",
"0.60143363"... | 0.71437556 | 0 |
Check that the defaults set the never cache control headers on the response. | def test_defaults(self):
content = self.unique()
self.assertViewBehavior(
{"get": content},
status_code=200,
content=content,
headers_exact={"Cache-Control": "max-age=0"}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_modified_headers(self):\n\n def get_response(req):\n resp = self.client.get(req.path_info)\n resp[\"Date\"] = \"Sat, 12 Feb 2011 17:35:44 GMT\"\n resp[\"Last-Modified\"] = \"Sat, 12 Feb 2011 17:35:44 GMT\"\n resp[\"Expires\"] = \"Sun, 13 Feb 2011 17:3... | [
"0.74749523",
"0.730792",
"0.72691476",
"0.7204676",
"0.7196334",
"0.71114993",
"0.70886433",
"0.7050699",
"0.70001507",
"0.69911003",
"0.69644284",
"0.69644284",
"0.68751776",
"0.68522364",
"0.6808271",
"0.6753384",
"0.67490506",
"0.672789",
"0.67168194",
"0.66634655",
"0.66... | 0.64401513 | 65 |
Gets the next expiration date for controller init | def get_expiration_date():
dt = datetime.now()
bdays_indx = pd.bdate_range(
dt.strftime("%Y-%m-%d"),
(dt + timedelta(days=20)).strftime("%Y-%m-%d"),
freq=pd.offsets.CustomBusinessDay(calendar=USFederalHolidayCalendar()),
).tolist()
expiration = [x.strftime("%Y-%m-%d") for x in bd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_expiration_date(self):\n return self.expiration_date",
"def new_token_expiry_date():\n\treturn timezone.now() + datetime.timedelta(days=TOKEN_VALID_DATE)",
"def expireDate(self)->datetime:\n return self.firstAccessDate + timedelta(seconds=self.expirePeriodInSeconds)",
"def default_expir... | [
"0.7094592",
"0.7065402",
"0.69285613",
"0.69055295",
"0.689841",
"0.68810546",
"0.673245",
"0.6552515",
"0.6523685",
"0.6479755",
"0.64234036",
"0.63735986",
"0.6339951",
"0.63121927",
"0.63121927",
"0.62286556",
"0.6214449",
"0.62109494",
"0.6199436",
"0.6199257",
"0.619664... | 0.5652823 | 51 |
Create your Flask app here, with any configuration you need | def create_app(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(self):\r\n self.app = Flask(__name__, instance_relative_config=True)\r\n\r\n # Init the secret key of the app -it is a must for flask to run\r\n self.app.config.from_mapping(\r\n SECRET_KEY='!ZNeverSayNever116Z!',\r\n MONGODB_SETTINGS= {'host': 'mongodb://l... | [
"0.8607028",
"0.8580267",
"0.84813267",
"0.8429017",
"0.8415944",
"0.8400027",
"0.83875513",
"0.83820134",
"0.8361291",
"0.8326353",
"0.8321436",
"0.8311477",
"0.83113503",
"0.8264292",
"0.82542884",
"0.82488364",
"0.82475644",
"0.82314956",
"0.82283074",
"0.8227069",
"0.8216... | 0.0 | -1 |
Checks if a HTTP 404 returned e.g. resp = self.client.get("/") self.assert404(resp) | def assert404(self, response):
self.assertTrue(response.status_code == 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertHttpNotFound(self, resp):\r\n return self.assertEqual(resp.status_code, 404)",
"def assert404(self, response):\n self.assertEqual(response.status_code, 404)",
"def test_404_not_found(self):\n response = self.client.get('/testPage404')\n self.assertEqual(response.status_cod... | [
"0.9120416",
"0.8772316",
"0.83236855",
"0.8294703",
"0.8184818",
"0.8164809",
"0.8145341",
"0.8111421",
"0.8110962",
"0.81032133",
"0.80804664",
"0.80263186",
"0.801481",
"0.8005329",
"0.79936945",
"0.79776466",
"0.7923277",
"0.79124707",
"0.77978474",
"0.7754215",
"0.772836... | 0.8698492 | 2 |
Delivers HTML for the index (search) page | def get(self):
return render_template("index.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search():\r\n return render_template(\"/home/search.html\")",
"def index(self) -> HTMLBody:\n\t\treturn render_template(\"index.jinja2\")",
"def index(self):\n\t\treturn render_template('index.html')",
"def search_page():\n return render_template('page_query.html', search_label=g_search_type)",
"... | [
"0.7677268",
"0.73201054",
"0.72925377",
"0.7237074",
"0.7205405",
"0.7118157",
"0.7075616",
"0.7043515",
"0.7043515",
"0.7014733",
"0.7010515",
"0.70035577",
"0.6989658",
"0.6979827",
"0.6978994",
"0.69691384",
"0.69691384",
"0.6959514",
"0.6951294",
"0.6951294",
"0.6951294"... | 0.66266 | 98 |
Configures CUDA environment variable and returns tensorflow GPU config. | def set_gpu(gpu):
os.environ['CUDA_VISIBLE_DEVICES'] = gpu
tf_config = tf.ConfigProto()
tf_config.gpu_options.allow_growth = True
return tf_config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_gpu_tf():\n\n try:\n # locate available devices & set required environment variables\n available_device_ids = GPUtil.getFirstAvailable(order='first', maxLoad=0.7, maxMemory=0.7, attempts=1, interval=10)\n available_device_id = available_device_ids[0]\n os.environ['CUDA_... | [
"0.7806248",
"0.71696466",
"0.7148312",
"0.7142579",
"0.69135433",
"0.686044",
"0.6859421",
"0.6798698",
"0.6659943",
"0.66523975",
"0.6578853",
"0.64233935",
"0.6382924",
"0.63151455",
"0.62676334",
"0.6249967",
"0.6245296",
"0.620838",
"0.6173646",
"0.6164236",
"0.61608374"... | 0.78912264 | 0 |
Create baseline convolutional recurrent model. Arguments | def create_baseline_model(filters, gru_units, dropout, bias, mels, nb_classes):
inp = Input(shape=(259, mels, 1))
x = Conv2D(filters, (3,3), padding='same', activation='relu', use_bias=bias)(inp)
x = MaxPooling2D(pool_size=(1,5))(x)
x = Conv2D(filters, (3,3), padding='same', activation='relu', use_bias=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_baseline(cls: Type['ResNet'], *, d_in: int, n_blocks: int, d_main: int, d_hidden: int, dropout_first: float, dropout_second: float, d_out: int) ->'ResNet':\n return cls(d_in=d_in, n_blocks=n_blocks, d_main=d_main, d_hidden=d_hidden, dropout_first=dropout_first, dropout_second=dropout_second, normal... | [
"0.647522",
"0.6304403",
"0.6284953",
"0.6194349",
"0.60414153",
"0.5895362",
"0.587735",
"0.58602476",
"0.58557093",
"0.5830293",
"0.5820108",
"0.5811813",
"0.5765692",
"0.576528",
"0.5761624",
"0.57612926",
"0.5757742",
"0.5744773",
"0.573896",
"0.57358533",
"0.573499",
"... | 0.64495075 | 1 |
Update the node Weights. | def update_weights(self, inputVec, sigma, lrate, bmu):
dist = self.get_nodeDistance(bmu)
gauss = np.exp(-dist * dist / (2 * sigma * sigma))
if gauss > 0:
for i in range(len(self.weights)):
self.weights[i] = self.weights[i] - gauss * lrate * (self.weights[i] - i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value",
"def update_weights(self):\n\t\tpass",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value\n self.weights_clipping()",
"def update_weights(self):\r\n\r\n ined... | [
"0.7578588",
"0.75189555",
"0.71403605",
"0.71005577",
"0.7062587",
"0.69478846",
"0.6734397",
"0.6722941",
"0.6722521",
"0.66968465",
"0.6692374",
"0.6667497",
"0.6484811",
"0.6466809",
"0.6404177",
"0.63912404",
"0.6376099",
"0.6338962",
"0.63102174",
"0.6305071",
"0.630327... | 0.0 | -1 |
Update the node Weights. | def update_weights_hamming(self, inputVec, sigma, lrate, bmu):
MAX_CHANGE_BITS = 8
dist = self.get_nodeDistance(bmu)
gauss = np.exp(-dist * dist / (2 * sigma * sigma))
if gauss > 0 and dist > 0:
num_bits = int(round((gauss * lrate) + 0.5))
if (num_bits < 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value",
"def update_weights(self):\n\t\tpass",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value\n self.weights_clipping()",
"def update_weights(self):\r\n\r\n ined... | [
"0.7578588",
"0.75189555",
"0.71403605",
"0.71005577",
"0.7062587",
"0.69478846",
"0.6734397",
"0.6722941",
"0.6722521",
"0.66968465",
"0.6692374",
"0.6667497",
"0.6484811",
"0.6466809",
"0.6404177",
"0.63912404",
"0.6376099",
"0.6338962",
"0.63102174",
"0.6305071",
"0.630327... | 0.0 | -1 |
Get a pydicom.FileDataset from the instance's Orthanc identifier | def get_pydicom(orthanc: Orthanc, instance_identifier: str) -> pydicom.FileDataset:
dicom_bytes = orthanc.get_instances_id_file(instance_identifier)
return pydicom.dcmread(BytesIO(dicom_bytes)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pydicom(self) -> pydicom.FileDataset:\n return util.get_pydicom(self.client, self.id_)",
"def get_dataset(self, identifier):\n # Test if a subfolder for the given dataset identifier exists. If not\n # return None.\n dataset_dir = self.get_dataset_dir(identifier)\n if no... | [
"0.76758665",
"0.6792178",
"0.6289413",
"0.628798",
"0.62494963",
"0.6189763",
"0.6181921",
"0.6159265",
"0.6122643",
"0.60905063",
"0.6083762",
"0.60353416",
"0.6018338",
"0.6012588",
"0.59544116",
"0.5922192",
"0.5917395",
"0.59086275",
"0.5863918",
"0.58565897",
"0.5843114... | 0.75693786 | 1 |
Turn off all LEDs. | def off(l):
l.do_static_colour(255, 0, 0, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_all_off(self):\n for led_type in LED:\n self.led_off(led_type)\n logging.info('LED: ALL - Status: 0')",
"def off(self):\n for light in self.all:\n GPIO.output(light, 0)",
"def turn_off(self):\n print(\"Turning the lights off\")\n self.led.all_of... | [
"0.8682389",
"0.85096216",
"0.8233179",
"0.78701323",
"0.78341633",
"0.7745513",
"0.77019066",
"0.75074905",
"0.74071926",
"0.7406597",
"0.7396668",
"0.7395751",
"0.7395048",
"0.7351189",
"0.7350677",
"0.73119456",
"0.7311833",
"0.7267839",
"0.7256568",
"0.7236224",
"0.721898... | 0.0 | -1 |
Computes the precision for the specified values of k | def accuracy(output, target, topk=(1,)):
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].view(-1).float().sum(0)
res.append(correct_k.mul_(100.0 / ba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\... | [
"0.7642627",
"0.7417984",
"0.7417116",
"0.72703016",
"0.7245068",
"0.7244174",
"0.72359973",
"0.7221287",
"0.72093123",
"0.70574844",
"0.68535876",
"0.6785699",
"0.6785369",
"0.6770165",
"0.6727407",
"0.67198336",
"0.67198336",
"0.67198336",
"0.67198336",
"0.67198336",
"0.671... | 0.0 | -1 |
Function to create a Flask instance for testing. | def create_app(self):
template_folder = T_SYSTEM_PATH + "/remote_ui/www"
static_folder = template_folder + "/static"
remote_ui = RemoteUI(args={"host": "localhost", "port": "5000", "debug": True, "mode": "testing"})
return remote_ui.app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(test_config=None) -> Flask:\n app = Flask(\"front-end-web-server\", instance_relative_config=True)\n\n if test_config is None:\n # Get path to configuration file and load that configuration into Flask's app.config object.\n curr_dir = os.path.abspath(os.path.dirname(__file__))\n ... | [
"0.800137",
"0.79899365",
"0.7917945",
"0.7903484",
"0.78777474",
"0.7799609",
"0.7797458",
"0.77839214",
"0.77667195",
"0.77507985",
"0.773824",
"0.7732427",
"0.7711934",
"0.7660504",
"0.7659221",
"0.7613417",
"0.7591966",
"0.75756544",
"0.756021",
"0.75428635",
"0.7511057",... | 0.0 | -1 |
Function to create a Flask instance for testing. | def create_app(self):
template_folder = T_SYSTEM_PATH + "/remote_ui/www"
static_folder = template_folder + "/static"
remote_ui = RemoteUI(args={"host": "localhost", "port": "5000", "debug": True, "mode": "testing"}, template_folder=template_folder, static_folder=static_folder)
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(test_config=None) -> Flask:\n app = Flask(\"front-end-web-server\", instance_relative_config=True)\n\n if test_config is None:\n # Get path to configuration file and load that configuration into Flask's app.config object.\n curr_dir = os.path.abspath(os.path.dirname(__file__))\n ... | [
"0.8001913",
"0.79912984",
"0.7919605",
"0.79042524",
"0.7879039",
"0.78006184",
"0.779912",
"0.7784838",
"0.7769028",
"0.7751926",
"0.7739027",
"0.7733947",
"0.7712897",
"0.7661446",
"0.7659738",
"0.7614846",
"0.75935984",
"0.75766546",
"0.75618625",
"0.75437117",
"0.7512033... | 0.0 | -1 |
Check a given line to see if a move is valid. Return the squares that will change, if the move is valid, otherwise an empty list. | def valid_line(board, x, y, dx, dy):
if not 0 <= x + dx + dx < 8:
return []
if not 0 <= y + dy + dy < 8:
return []
coords_1 = board.columns[x+dx] + board.rows[y+dy]
coords_2 = board.columns[x+dx+dx] + board.rows[y+dy+dy]
if board[coords_1] != -self.color:
# If the neighbour square... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legal_moves(player, board):\n return [sq for sq in Othello.squares() if Othello.is_legal(sq, player, board)]",
"def is_valid(move):\n return isinstance(move, int) and move in Othello.squares()",
"def is_valid_move(state, move):\n row, col = move\n if row not in [1, 2, 3] or col not in [... | [
"0.6370445",
"0.62957835",
"0.6113358",
"0.61125934",
"0.59849495",
"0.5977295",
"0.5965192",
"0.5934297",
"0.59330297",
"0.59321463",
"0.5929608",
"0.5929004",
"0.5915414",
"0.5898067",
"0.58975315",
"0.5873103",
"0.5867404",
"0.586026",
"0.5846924",
"0.58331126",
"0.5830166... | 0.7884284 | 0 |
Change pieces color according to the given squares | def update_board(self, symbol, modified_squares):
for coord in modified_squares:
self.board[coord] = symbol | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_square_colors(self):\n\n for flea in self.fleas.sprites():\n flea.square.change_color()",
"def draw_multicolor_square(t,sz):\r\n for i in [\"red\", \"purple\", \"hotpink\", \"blue\"]:\r\n t.color(i)\r\n t.forward(sz)\r\n t.left(90)",
"def squareColour(square... | [
"0.74945563",
"0.70106286",
"0.66607684",
"0.65294814",
"0.64497787",
"0.6353148",
"0.6281977",
"0.62021154",
"0.61708444",
"0.60909253",
"0.6083564",
"0.60631675",
"0.60601044",
"0.602275",
"0.59414184",
"0.5882508",
"0.5834815",
"0.5812058",
"0.57959276",
"0.57789",
"0.5765... | 0.62668204 | 7 |
Sets default root category id. Is set to 1, because the default root category is 1 | def default_magento_root_category_id():
return 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_id(root: TreeNode):\n current_id = [0]\n init_id_helper(root, current_id)\n return current_id[0]",
"def PrimaryCategory(self, default=None):\n return self.data.get('categories', [default])[0]",
"def root(self) -> 'Category':\n if self.parent:\n return self.parent.... | [
"0.65238833",
"0.60481906",
"0.5950954",
"0.5714606",
"0.5712186",
"0.5594999",
"0.55752224",
"0.55726135",
"0.5566532",
"0.5562183",
"0.55386394",
"0.55160403",
"0.5515742",
"0.5502178",
"0.5425077",
"0.5389408",
"0.5376485",
"0.53576773",
"0.5263281",
"0.52428555",
"0.52280... | 0.82208395 | 0 |
read a json file directly into an object | def read_json_to_object(fn):
with open(fn, "r") as fid:
obj = json.load(fid, object_hook=lambda d: SimpleNamespace(**d))
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_from_json_file(filename):\n with open(filename, 'r') as f:\n obj = json.loads(f.read())\n return obj",
"def read_json(fpath):\n with open(fpath, 'r') as f:\n obj = json.load(f)\n return obj",
"def convert_json_to_object(file_content):\n object = json.loads(file_content... | [
"0.8234452",
"0.8224244",
"0.8179653",
"0.810801",
"0.8070145",
"0.8070145",
"0.8020177",
"0.7981813",
"0.79800755",
"0.79516125",
"0.79361403",
"0.79361403",
"0.79121983",
"0.790699",
"0.7869537",
"0.78496486",
"0.7820066",
"0.7800198",
"0.7795892",
"0.77883345",
"0.77602947... | 0.77658606 | 20 |
Convert a scipy sparse matrix to a torch sparse tensor. | def sparse_mx_to_torch_sparse_tensor(sparse_mx):
sparse_mx = sparse_mx.tocoo().astype(np.float32)
indices = torch.from_numpy(
np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64))
values = torch.from_numpy(sparse_mx.data)
shape = torch.Size(sparse_mx.shape)
return torch.sparse.Fl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csr2tensor(self, matrix: sp.csr_matrix):\n matrix = matrix.tocoo()\n x = torch.sparse.FloatTensor(\n torch.LongTensor(np.array([matrix.row, matrix.col])),\n torch.FloatTensor(matrix.data.astype(np.float32)),\n matrix.shape,\n ).to(self.device)\n retu... | [
"0.83033675",
"0.8148503",
"0.8045674",
"0.8032235",
"0.8029749",
"0.8029749",
"0.8029749",
"0.8029749",
"0.8029749",
"0.8029749",
"0.8029749",
"0.8029749",
"0.8029749",
"0.8029749",
"0.8029749",
"0.8029749",
"0.8029749",
"0.80132157",
"0.7997072",
"0.7997072",
"0.79769105",
... | 0.7984944 | 22 |
Modifies self.heap to 'heapify' a new node | def bubble_up(self, i):
parent = self.parent(i)
while (parent is not None) and (self.heap[i][1] < self.heap[parent][1]):
self.switch(i, parent)
parent = self.parent(parent) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, node: object) -> None:\n end_index=self.heap.length()\n parent_index=((end_index-1)//2)\n if end_index==0:\n self.heap.append(node)\n else:\n self.heap.append(node)\n while self.heap.get_at_index(end_index)<self.heap.get_at_index(parent_ind... | [
"0.7368758",
"0.7256856",
"0.71981007",
"0.70830905",
"0.70596296",
"0.7052933",
"0.69609797",
"0.6955587",
"0.6944264",
"0.69201875",
"0.691447",
"0.67921174",
"0.670558",
"0.670558",
"0.670558",
"0.66921777",
"0.66847306",
"0.66812456",
"0.6663765",
"0.66413444",
"0.6616077... | 0.0 | -1 |
Modifies self.heap such that index is a root of a heap (bubble down) | def bubble_down(self, i):
smallest = self.find_smallest(i)
org = i
while smallest != org:
self.switch(org, smallest)
org = smallest
smallest = self.find_smallest(smallest) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def up_heap(self, index):\r\n while index: # while not at the root\r\n parent = self._parent(index) # who is my parent?\r\n # Am I smaller than my parent?\r\n if self._data[index] < self._data[parent]:\r\n self.swap(index, parent) ... | [
"0.7791737",
"0.7766719",
"0.75886184",
"0.74473083",
"0.74288684",
"0.73768574",
"0.73337054",
"0.727225",
"0.723698",
"0.72127444",
"0.71719474",
"0.71710014",
"0.7146507",
"0.71445376",
"0.71445376",
"0.7124536",
"0.7057905",
"0.70264316",
"0.6930473",
"0.6907069",
"0.6878... | 0.0 | -1 |
Returns left child of node at n; None if there isn't a left_child | def left_child(self, n):
if 2 * n + 1 >= len(self.heap):
return None
else:
return 2 * n + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left_most_child(n):\n if n == None:\n return None\n while n.left:\n n = n.left\n return n",
"def get_node_left(self, n: MazeCell) -> MazeCell:\n if n.x == 0:\n return None\n else:\n return self.get_node(n.x - 1, n.y)",
"def left(self, n):\n ... | [
"0.805531",
"0.8024023",
"0.7819353",
"0.7786342",
"0.77025276",
"0.75769603",
"0.7557661",
"0.7511605",
"0.749778",
"0.72762555",
"0.72099817",
"0.7190135",
"0.7172796",
"0.7068378",
"0.7064818",
"0.69917893",
"0.69912624",
"0.69391996",
"0.69372314",
"0.69372314",
"0.693026... | 0.7845012 | 2 |
Returns right child of node at n; None if there isn't a right_child | def right_child(self, n):
if 2 * n + 2 >= len(self.heap):
return None
else:
return 2 * n + 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_node_right(self, n: MazeCell) -> MazeCell:\n if n.x == self._ncols - 1:\n return None\n else:\n return self.get_node(n.x + 1, n.y)",
"def right_child(self, position):\n child = 2 * position + 2\n if child > len(self.table) - 1:\n return None\n ... | [
"0.76178944",
"0.7611006",
"0.725117",
"0.71613806",
"0.71096224",
"0.7073449",
"0.69539064",
"0.6897677",
"0.6885739",
"0.6885739",
"0.68463993",
"0.68296987",
"0.6825695",
"0.67875445",
"0.6721572",
"0.67042595",
"0.6691901",
"0.6611986",
"0.65743893",
"0.6552465",
"0.64684... | 0.7729437 | 0 |
1hot encodes a tensor | def to_categorical(y, num_classes):
return np.eye(num_classes, dtype='uint8')[y] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output",
"def one_hot_encode(self, arr, n_labels):\n one_hot = np.zeros((np.multiply(*arr.shape), n_labels), dtype=np.float32)\... | [
"0.82578593",
"0.8061468",
"0.80140257",
"0.7917851",
"0.7914897",
"0.7883416",
"0.78429884",
"0.78089696",
"0.7765784",
"0.77376443",
"0.77376443",
"0.7733915",
"0.7728651",
"0.77133274",
"0.7686273",
"0.76797515",
"0.75851345",
"0.7560708",
"0.75560004",
"0.75353223",
"0.75... | 0.0 | -1 |
Test case for aws_service_api_flavor_get | def test_aws_service_api_flavor_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aws_service_api_flavors_get(self):\n pass",
"def test_get_flavor(self):\n response = self.flavors_client.get_flavor_details(self.flavor_ref)\n flavor = response.entity\n self.assertEqual(self.flavor_ref, flavor.id)",
"def get_flavor(name):\r\n return nova.flavors.find(na... | [
"0.86479574",
"0.7678447",
"0.71027285",
"0.70904493",
"0.7076974",
"0.6954673",
"0.68324184",
"0.6791326",
"0.6621454",
"0.657417",
"0.65623415",
"0.65623415",
"0.6551517",
"0.652183",
"0.637626",
"0.63374686",
"0.63270867",
"0.6284752",
"0.62383753",
"0.62356555",
"0.622235... | 0.9599665 | 0 |
Test case for aws_service_api_flavors_get | def test_aws_service_api_flavors_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aws_service_api_flavor_get(self):\n pass",
"def get_flavors(self):\n url = '%s/flavors/detail' % self.catalog['compute']\n res = self.get(url)\n if res['status'] == 200:\n return json.loads(res['body'])['flavors']\n else:\n LOG.error('Get flavors ... | [
"0.8574573",
"0.7565045",
"0.714905",
"0.71012104",
"0.70156753",
"0.7013291",
"0.68955284",
"0.6883247",
"0.6825781",
"0.6584661",
"0.65827054",
"0.6564486",
"0.64388686",
"0.64029205",
"0.6390174",
"0.6388977",
"0.63272315",
"0.6317298",
"0.6264503",
"0.62626445",
"0.620792... | 0.95660037 | 0 |
Test case for aws_service_api_network_subnets_get | def test_aws_service_api_network_subnets_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subnets(self):\n url = '%s/v2.0/subnets' % self.catalog['network']\n res = self.get(url)\n if res['status'] == 200:\n return json.loads(res['body'])['subnets']\n else:\n LOG.error('Get subnets failed: %s %s %s' %\n (res['status'], res['... | [
"0.8326366",
"0.8207443",
"0.77458423",
"0.773097",
"0.76437336",
"0.7635327",
"0.75836563",
"0.747489",
"0.73467875",
"0.73467875",
"0.731024",
"0.72891515",
"0.7184063",
"0.7079082",
"0.70580095",
"0.69772714",
"0.6942426",
"0.6940601",
"0.6905459",
"0.68559116",
"0.6825933... | 0.9566142 | 0 |
Method to remove the stop words used in get_left_right_lists() This method does not work for Catalan language. | def remove_stop_words(tokens, language):
if not remove_stop_words_activated or language.__eq__("Catalan"):
return tokens
output = []
stop = stopwords.words(language.lower())
for token in tokens:
if token not in stop:
output.append(token)
return output | {
"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_stop_words(self):\n self.word_list = [word for word... | [
"0.8411666",
"0.79770213",
"0.7972711",
"0.7953195",
"0.7869722",
"0.78230315",
"0.7814691",
"0.7796424",
"0.773496",
"0.77157074",
"0.7703494",
"0.7695574",
"0.76948166",
"0.76899654",
"0.76872563",
"0.76872563",
"0.76872563",
"0.76872563",
"0.7681711",
"0.76450783",
"0.7597... | 0.7611969 | 20 |
Method to get the tokens on the left and right of the target word. The result list of tokens will be filtered according to different settings. | def get_left_right_lists(sentence, language):
left_list = nltk.word_tokenize(replace_accented(sentence.childNodes[0].nodeValue.replace('\n', '')))
right_list = nltk.word_tokenize(replace_accented(sentence.childNodes[2].nodeValue.replace('\n', '')))
left_list = remove_stop_words(left_list, language)
rig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tokens(self):\n\t\treturn self.get_starttokens() + self.get_endtokens()",
"def tokens(self):\n\t\tlabels_and_synonyms = list(itertools.chain.from_iterable(list(self.term_to_tokens.values())))\n\t\ttokens = set(list(itertools.chain.from_iterable([word_tokenize(x) for x in labels_and_synonyms])))\n\t\tretu... | [
"0.6641464",
"0.65268147",
"0.64090097",
"0.62245643",
"0.62148035",
"0.6099981",
"0.6064908",
"0.60643786",
"0.6055512",
"0.60490125",
"0.60379094",
"0.6024344",
"0.6016069",
"0.59767205",
"0.5975851",
"0.59644526",
"0.58826864",
"0.58402985",
"0.5834286",
"0.581225",
"0.580... | 0.58912784 | 16 |
Current Location Accessor Function to get the current location for this path. | def get_current_location(self):
return self._current_loc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_location(self):\n return self.enu_2_local()",
"def get_current_location():\n global current_location\n return current_location",
"def get_location(self):\r\n return self.__location",
"def get_location(self):\n\t\treturn self.location",
"def get_location(self):\n r... | [
"0.82560873",
"0.8195256",
"0.8011756",
"0.79347134",
"0.7920117",
"0.78825885",
"0.7742611",
"0.7653603",
"0.7653603",
"0.7628534",
"0.7536863",
"0.75195265",
"0.75195265",
"0.75195265",
"0.75195265",
"0.75195265",
"0.75195265",
"0.75195265",
"0.75195265",
"0.75195265",
"0.7... | 0.8912243 | 0 |
Column Number Accessor Accessor to get the column number of this location. | def get_column(self):
return self._column_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column(self) -> int:\n return self._column",
"def get_column(self, pos, **opts):\n lnum, cnum = self._get_column(pos, **opts)\n return lnum + self.LINE_NUM_BASE, cnum + self.COLUMN_NUM_BASE",
"def column(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"column\")",
"def ... | [
"0.784214",
"0.7419771",
"0.7389335",
"0.7389335",
"0.7389335",
"0.7389335",
"0.7389335",
"0.7389335",
"0.7389335",
"0.7389335",
"0.7389335",
"0.7389335",
"0.7389335",
"0.7389335",
"0.7389335",
"0.7389335",
"0.7389335",
"0.71282494",
"0.6932579",
"0.6846213",
"0.68336886",
... | 0.82080346 | 0 |
Special function for != operator | def __ne__(self, other):
return not (self == other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, rhs):\n return not self.__eq__(rhs)",
"def __ne__(left, right):\n return (not (left == right))",
"def __ne__(self, other):\n return not self.__eq__(other)",
"def __ne__(self, other):\n return not (self == other) # opposite of __eq__",
"def __ne__(self, othe... | [
"0.8012074",
"0.7888594",
"0.7855215",
"0.7828879",
"0.779572",
"0.7794179",
"0.7726372",
"0.7711095",
"0.76889086",
"0.76813257",
"0.7669499",
"0.7669306",
"0.76685494",
"0.76685494",
"0.76685494",
"0.76685494",
"0.7649886",
"0.76432693",
"0.7642552",
"0.7642552",
"0.762906"... | 0.0 | -1 |
Function to return user_song_list_count which has data of all users and the count of songs the user has listened to. | def preprocessing():
track_metadata = pd.read_csv('/home/sachet/Artificial Intelligence/song_data.csv')
count_play = pd.read_csv('/home/sachet/Artificial Intelligence/10000.txt', sep='\t', header=None, names=['user','song','play_count'])
unique_track_metadata = track_metadata.groupby('song_id').max().reset_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_count(username):\n return get_contributor(username)[\"count\"]",
"def user_counts(user_id):\n return _fetch_records(f\"SELECT rating_type, count FROM counts_by_rating_type WHERE user_id = {user_id} AND count > 0\")",
"def get_counts(self, obj: User):\n uploader = obj.id\n public_cou... | [
"0.6450388",
"0.62384784",
"0.621782",
"0.62003124",
"0.6174985",
"0.6170376",
"0.61630744",
"0.6100274",
"0.60886586",
"0.6022709",
"0.59969884",
"0.5996942",
"0.5968442",
"0.5961288",
"0.5941371",
"0.5929401",
"0.5906927",
"0.5895797",
"0.5879137",
"0.58469474",
"0.5841158"... | 0.5567753 | 39 |
Rotates the point around the X axis by the given angle in degrees. | def rotateX(self, angle):
rad = math.radians(angle)
cosa = math.cos(rad)
sina = math.sin(rad)
y = self.y * cosa - self.z * sina
z = self.y * sina + self.z * cosa
return Point3D(self.x, y, z) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_x(self, angle):\n angle *= np.pi / 180\n return self.transform(np.matrix([[1, 0, 0],\n [0, np.cos(angle), -np.sin(angle)],\n [0, np.sin(angle), np.cos(angle)]]))",
"def rotate_x(self, angle:... | [
"0.7946597",
"0.75407946",
"0.7309387",
"0.7100913",
"0.70926636",
"0.70239174",
"0.6984318",
"0.6948638",
"0.6939483",
"0.68799853",
"0.687543",
"0.6835535",
"0.6781335",
"0.6731041",
"0.6605782",
"0.65896446",
"0.6499886",
"0.64935017",
"0.6486113",
"0.64761364",
"0.6472282... | 0.64040524 | 27 |
Transforms this 3D point to 2D using a perspective projection. | def project(self, win_width, win_height, fov, viewer_distance):
factor = fov / (viewer_distance + self.z)
x = self.x * factor + win_width / 2
y = -self.y * factor + win_height / 2
return Point3D(x, y, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_point(self, point: Point3D) -> Point3D:\n x, y, z = point\n cam_x, cam_y, cam_z = self._pos\n x -= cam_x\n y -= cam_y\n z -= cam_z\n dx = self._cy*(self._sz*y + self._cz*x) - self._sy*z\n dy = self._sx*(self._sy*(self._sz*y + self._cz*x) + self._cy*z) + ... | [
"0.7485761",
"0.7218691",
"0.6950993",
"0.6886399",
"0.68223923",
"0.66571516",
"0.6603911",
"0.65672183",
"0.6495761",
"0.64801496",
"0.6474243",
"0.6377783",
"0.6376653",
"0.6376052",
"0.6375711",
"0.63709044",
"0.6364304",
"0.63624424",
"0.63512695",
"0.63367707",
"0.63009... | 0.62003535 | 30 |
Custom repr for easier debugging. | def __repr__(self):
text = str(self)
text_ellips = (text[:31] + ".." + text[-31:]) if len(text) > 64 else text
return f"{self.element_id}. {text_ellips}..." | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\r\n return repr(self)",
"def __repr__(self) -> str:\n items = (\"{}={}\".format(k, repr(v)) for k, v in self.__dict__.items())\n return \"<{}({})>\".format(self.__class__.__name__, \", \".join(items))",
"def __str__(self):\n return repr(self)",
"def __repr__(sel... | [
"0.82584816",
"0.8253082",
"0.82329077",
"0.8191106",
"0.81365615",
"0.81327766",
"0.81327766",
"0.81327766",
"0.8118914",
"0.8113123",
"0.80449194",
"0.80449194",
"0.80449194",
"0.80449194",
"0.80425906",
"0.801727",
"0.7994082",
"0.79937655",
"0.798417",
"0.79790634",
"0.79... | 0.0 | -1 |
Get a list of token objects for the sentiment expression extent. The extent can be set to include targets. Setting this to an empty list will only return the original tokens. | def get_extent_tokens(self, extent=[], source_order=True):
all_tokens = self.tokens.copy()
for ext in extent:
if getattr(self, ext):
all_tokens.extend(t for x in getattr(self, ext) for t in x.tokens)
all_tokens = list(
set(all_tokens)
) # this i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_extent_tokens(self, extent=[\"discontiguous_triggers\"], source_order=True):\n all_tokens = self.tokens.copy()\n core_sen_idx = all_tokens[0].in_sentence.element_id # to ensure discont is in same sentence\n\n for ext in extent:\n if getattr(self, ext):\n all_t... | [
"0.79144996",
"0.66847426",
"0.64567703",
"0.64525014",
"0.6422023",
"0.63470286",
"0.6025481",
"0.5879312",
"0.5853642",
"0.58203405",
"0.58203405",
"0.55929494",
"0.5589577",
"0.55816835",
"0.5545209",
"0.553422",
"0.54197466",
"0.54197466",
"0.54197466",
"0.5392735",
"0.53... | 0.82137984 | 0 |
Function to converts XML attributes into a dictionary | def __convertAttributes__(xml_source):
attributes = {}
for attrName, attrValue in xml_source.attributes.items():
attributes[attrName] = attrValue
return attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attrs_dict(self, root_element):\n attr_elements = root_element.findall(\"attribute\")\n attrs_dict = {}\n for el in attr_elements:\n attrs_dict[el.attrib[\"name\"]] = {\n \"value\": el.attrib[\"value\"],\n \"type\": el.attrib.get(\"type\", None)... | [
"0.7548967",
"0.722563",
"0.71245855",
"0.711149",
"0.7095163",
"0.7094138",
"0.70292187",
"0.6932637",
"0.69197536",
"0.68689096",
"0.6855458",
"0.68021226",
"0.68001693",
"0.6756407",
"0.6698822",
"0.6619554",
"0.6612907",
"0.6576497",
"0.6554866",
"0.6512518",
"0.6490863",... | 0.7341555 | 1 |
Custom repr for easier debugging. | def __repr__(self):
return f"{self.document_id} {self.annotator_id}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\r\n return repr(self)",
"def __repr__(self) -> str:\n items = (\"{}={}\".format(k, repr(v)) for k, v in self.__dict__.items())\n return \"<{}({})>\".format(self.__class__.__name__, \", \".join(items))",
"def __str__(self):\n return repr(self)",
"def __repr__(sel... | [
"0.8258345",
"0.8253225",
"0.82328606",
"0.81909287",
"0.8136453",
"0.8132754",
"0.8132754",
"0.8132754",
"0.81184274",
"0.81119144",
"0.8045108",
"0.8045108",
"0.8045108",
"0.8045108",
"0.80425274",
"0.801632",
"0.79938865",
"0.7993399",
"0.79841006",
"0.79778564",
"0.797201... | 0.0 | -1 |
Get a OptimizerDef for the given configuration and training_steps. | def optimizer_for_idx(idx, training_steps):
config = common.get_optimizer_config(idx)
config['training_steps'] = training_steps
return NAdamWCosineDecay(**config) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_optimizer(\n batch_size: int,\n steps_per_epoch: int,\n lr_name: Text = defaults.LR_NAME_DEFAULT,\n optimizer_name: Text = defaults.OP_NAME_DEFAULT,\n lr_params: Dict[Text, Any] = defaults.LR_CONFIG_DEFAULT,\n optimizer_params: Dict[Text, Any] = defaults.OP_CONFIG_DEFAULT,\n) -> tf.keras... | [
"0.56548405",
"0.5534678",
"0.5419",
"0.53470206",
"0.53421885",
"0.5340555",
"0.53079665",
"0.511747",
"0.50874454",
"0.50743484",
"0.5059995",
"0.5049988",
"0.50252277",
"0.5016428",
"0.50158036",
"0.49935558",
"0.498744",
"0.49774894",
"0.49573946",
"0.49332434",
"0.491900... | 0.5022623 | 13 |
Returns True is the alien is in the scree's edge. | def check_edges(self):
screen_rect = self.screen.get_rect()
if self.rect.right >= screen_rect.right:
return True
elif self.rect.left <= 0:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isEdge(self,x,y):\n\t\treturn y in self._dict[x]",
"def isEdge(self,x,y):\n\t\treturn y in self._dictOut[x]",
"def containsEdge(self, e):\n return any(e.nvt in [self.vertices[i-2], self.vertices[i]] and self.vertices[i-1] == e.pvt for i in range(len(self.vertices)))",
"def __contains__(self, edge)... | [
"0.67390007",
"0.6689531",
"0.66346663",
"0.65844536",
"0.6580659",
"0.6557901",
"0.65327895",
"0.64890575",
"0.6484122",
"0.6412592",
"0.6396653",
"0.63721454",
"0.63186455",
"0.6302562",
"0.6260699",
"0.6248611",
"0.6222273",
"0.6212628",
"0.6211989",
"0.620916",
"0.6201092... | 0.59922844 | 36 |
Return a serializable form of the AddressStatus. | def serial(self):
return {'address_name': self.address_name,
'statecode': self.state,
'statename': self.state_string(),
'remote_time': capped_int(self.remote_time),
'local_time': capped_int(self.local_time),
'loading': self.loading(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_string(self):\n return AddressStates._to_string(self.state)",
"def get_receipt_address_status(self):\n return self.get_document_status_choice(self.receipt_address_status)",
"def status(self):\n return status_dict[self._get_property_(self.STATUS).upper()]",
"def summary(self):\n... | [
"0.65376735",
"0.6407179",
"0.6125908",
"0.61190885",
"0.6088738",
"0.5990919",
"0.5974651",
"0.59298563",
"0.590801",
"0.590526",
"0.58993244",
"0.5894258",
"0.58879745",
"0.5871039",
"0.5828656",
"0.5824285",
"0.5814415",
"0.5784133",
"0.5779725",
"0.5777793",
"0.57745993",... | 0.5553306 | 48 |
Given 4 sorted corners, compute the homography between the corners and the rectangle's ground truth and return the information on the mapped plane. In other words, this function returns information on a plane (in particular, the desk's or wall's). The plane's origin is in the topleft corner of the rectangle, and the no... | def get_H_R_t(self, corners: np.ndarray) -> Plane:
H = cv.findHomography(self.inner_rectangle, corners)[0]
result = self.K_inv @ H
result /= cv.norm(result[:, 1])
r0, r1, t = np.hsplit(result, 3)
r2 = np.cross(r0.T, r1.T).T
_, u, vt = cv.SVDecomp(np.hstack([r0, r1, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prepare_plane(self):\n verticies = [\n # main plane - note that the mainplane is scaled so the mat_plane\n # matrix will it transform to the correct coordinates\n -self.i_border[0]/self._scaling[0], self.i_border[1]/self._scaling[1],\n -self.i... | [
"0.58668405",
"0.58515084",
"0.5808322",
"0.5808322",
"0.5799701",
"0.5799701",
"0.5593243",
"0.55419457",
"0.5481281",
"0.5459112",
"0.54404145",
"0.5418466",
"0.541714",
"0.53940755",
"0.53733194",
"0.5373061",
"0.5357221",
"0.5352762",
"0.5341513",
"0.53396374",
"0.5331517... | 0.6981937 | 0 |
Write a program that takes as input a BST and an interger k, and returns the k largest elements in the BST in decreasing order. | def find_k_largest_in_bst_recursively(tree, k):
def find_k_largest_in_bst_helper(tree):
if tree and len(k_largest_elements) < k: # Smart: Recursion iff we don't have K largest elements collected
find_k_largest_in_bst_helper(tree.right)
if len(k_largest_elements) < k:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findKthLargest(self, nums: List[int], k: int) -> int:\n return sorted(nums)[-k]",
"def _get_k_largest(lst, k):\n sorted_lst = sorted([(val, index) for index, val in enumerate(lst)])\n return list(reversed(sorted_lst[-k:]))",
"def kth_largest(arr: list, k: int):\n # Do not search if k is lar... | [
"0.7045558",
"0.701398",
"0.6677336",
"0.6673362",
"0.66666937",
"0.65226465",
"0.65028167",
"0.646503",
"0.6402724",
"0.63980407",
"0.6357561",
"0.6304622",
"0.617777",
"0.61401814",
"0.6116958",
"0.6113665",
"0.6077666",
"0.60618454",
"0.60614383",
"0.60428995",
"0.60170496... | 0.8523908 | 0 |
Returns a dataloader over the `Placement` dataset. | def get_placement_loader(
foldername,
dtype="train",
batch_size=1,
sample_ratio=1.0,
shuffle=True,
stateless=True,
augment=False,
background_subtract=None,
num_channels=2,
radius=2,
num_workers=4,
use_cuda=True,
):
def _collate_fn(batch):
"""A custom collate ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dataloader(self):\n shuffle = True if self.mode == \"train\" else False\n return DataLoader(self.get_dataset(), batch_size=self.batch_size, shuffle = shuffle, \n collate_fn=create_mini_batch)",
"def dataloader(self):\n return DataLoader",
"def get_datalo... | [
"0.6528042",
"0.6296754",
"0.6117473",
"0.5985506",
"0.5861961",
"0.58134794",
"0.576722",
"0.5752375",
"0.5730256",
"0.5723458",
"0.5705245",
"0.5683443",
"0.5645826",
"0.55966157",
"0.55555403",
"0.5552447",
"0.5544895",
"0.5537698",
"0.5531602",
"0.552853",
"0.5525307",
... | 0.6269584 | 2 |
Takes in a document, returns the individual words (no punctuation) in it | def tokenize(doc):
# Calls NLTK function to tokenize the document. Broken into individual words, cleans out punctuation
tokens = nltk.word_tokenize(doc)
return tokens | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_words(doc):\n splitter = re.compile('\\\\W*')\n # Split the words by non-alpha characters\n words = [s.lower() for s in splitter.split(doc) \n if len(s)>2 and len(s)<20]\n # Return the unique set of words only\n return dict([(w,1) for w in words])",
"def tokens(doc):\n return (... | [
"0.7785867",
"0.7555599",
"0.7534922",
"0.75300217",
"0.75241643",
"0.74158704",
"0.7410245",
"0.7398779",
"0.73895",
"0.7206151",
"0.71567714",
"0.7117067",
"0.7102596",
"0.7061617",
"0.70349526",
"0.69996923",
"0.6893931",
"0.6889518",
"0.6820737",
"0.67384434",
"0.67279804... | 0.6920817 | 16 |
The function 'match' when given a list of words, finds all indices pairs such that the concatenation of the two words is a palindrome. | def match(list_string):
assert type(list_string)==list
for i in list_string:
assert type(i)==str
assert i.isalpha()
#Loops through all the possible substrings of the list of words to find the word pairs that are palindromes.
my_match = []
for i in range(0,len(list_string)):
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def palindromePairs(self, words: List[str]) -> List[List[int]]:\n d = {w : i for i, w in enumerate(words)}\n \n res = []\n for idx, word in enumerate(words):\n for i in range(len(word)+1):\n str1 = word[:i]\n str2 = word[i:]\n # fi... | [
"0.75175416",
"0.7488159",
"0.6926305",
"0.6626271",
"0.6542914",
"0.63874125",
"0.63204014",
"0.630162",
"0.62365013",
"0.622492",
"0.611714",
"0.6113025",
"0.609781",
"0.6046568",
"0.604634",
"0.6016963",
"0.6004262",
"0.60025907",
"0.6000019",
"0.59904724",
"0.59786916",
... | 0.8192264 | 0 |
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key | def get(self, key: int) -> int:
chain, idx = self._search(key)
if idx is not None:
return chain[idx][1]
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key: int) -> int:\n if key not in self.map:\n return -1\n return self.map[key]",
"def get(self, key: int) -> int:\n if key in self.hashmap.keys():return self.hashmap[key]\n else:return -1",
"def get(self, key: int) -> int:\n sh = key % 37\n if ... | [
"0.8002989",
"0.7909007",
"0.76288855",
"0.7565029",
"0.7557547",
"0.7529507",
"0.7525005",
"0.74928814",
"0.7372854",
"0.7294311",
"0.72926253",
"0.72211987",
"0.7216913",
"0.718049",
"0.7165574",
"0.698056",
"0.69297296",
"0.67844254",
"0.67563844",
"0.6735803",
"0.6611858"... | 0.7176771 | 14 |
This function prints and plots the confusion matrix. | def plot_confusion_matrix(cm, classes,
title='Confusion matrix',
cmap=plt.cm.Blues):
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
plt.colorbar()
tick_marks = np.arange(len(classes))
plt.xticks(tick_marks, classes, rotation=0)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(self):\r\n interp = ClassificationInterpretation.from_learner(self.learn)\r\n interp.plot_confusion_matrix()",
"def showConfusionMatrix(self): \r\n sn.heatmap(self.conf_matrix, annot=True)\r\n plt.plot( label=\"Accuracy\")\r\n plt.plot( label=\"Error\"... | [
"0.80913913",
"0.8078153",
"0.7999024",
"0.7947685",
"0.7922891",
"0.7846677",
"0.7834236",
"0.77823174",
"0.77771777",
"0.7758015",
"0.77074605",
"0.7704409",
"0.76958793",
"0.768",
"0.76602453",
"0.7643174",
"0.76248074",
"0.76126397",
"0.76126075",
"0.75999814",
"0.7589856... | 0.0 | -1 |
head, tail = os.path.split(path) return tail or os.path.basename(head) | def path_leaf(path):
return re.sub('[^A-Za-z0-9]+', '_', path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pathLeaf(path):\n head, tail = ntpath.split(path)\n return tail or ntpath.basename(head)",
"def path_leaf(path):\n\thead, tail = ntpath.split(path)\n\treturn tail or ntpath.basename(head)",
"def path_leaf(path):\n head, tail = ntpath.split(path)\n return tail or ntpath.basename(head)",
"def b... | [
"0.8084616",
"0.8074502",
"0.8041229",
"0.78678495",
"0.78282255",
"0.78110695",
"0.7523113",
"0.72164637",
"0.7181861",
"0.7169209",
"0.7126973",
"0.70769894",
"0.68622905",
"0.68341327",
"0.6810272",
"0.67949396",
"0.67901784",
"0.678849",
"0.6783288",
"0.67816633",
"0.6759... | 0.0 | -1 |
r""" Calculate partial derivatives of zeta function. | def zeta_deriv(self, increment_filter, k, zeta='', inconn=0, outconn=0):
data = self.get_attr(zeta)
f = self.zeta_func
outpos = self.num_i + outconn
if not increment_filter[inconn, 0]:
self.jacobian[k, inconn, 0] = self.numeric_deriv(
f, 'm', inconn, zeta=zeta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeta_function(s,a = 1,derivative = 0):\n return mp.zeta(s,a,derivative)",
"def zeta(z, x, beta2):\n return 3 * (4* z**2 - beta2 * x**2) / 4 / beta2 / (1+x)",
"def get_partial_derivatives(self) -> List[Callable]:\n return [self.dfda, self.dfdb, self.dfdc]",
"def get_partial_derivatives(self) ... | [
"0.69251996",
"0.65251493",
"0.6342588",
"0.63092345",
"0.6277536",
"0.62325907",
"0.622904",
"0.6221183",
"0.62180126",
"0.6203884",
"0.6199135",
"0.6153695",
"0.61268854",
"0.61135817",
"0.6100138",
"0.60925937",
"0.60837436",
"0.6048938",
"0.60380226",
"0.60230154",
"0.601... | 0.56824744 | 36 |
Return an executable string representation. This method returns a string so that ``eval(cls.vrepr())`` returns a new `BvFunction` object with the same content. | def vrepr(cls):
return cls.__name__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self) -> str:\n return f\"<Function[{self.name}](line:{self.line})>\"",
"def __repr__(self):\n klass = self.__class__.__qualname__\n cmd = \" \".join(sys.argv)\n cmd_ = f\"$ {cmd}\"\n args = pformat(self.get_args())\n repr_ = \"\\n\".join((klass, cmd_, args)... | [
"0.62824535",
"0.6251113",
"0.5906001",
"0.5871243",
"0.58202857",
"0.5671611",
"0.56357455",
"0.5634955",
"0.5599026",
"0.5592916",
"0.5587618",
"0.5570723",
"0.5525011",
"0.5512445",
"0.5512445",
"0.5512445",
"0.5488936",
"0.54781395",
"0.547464",
"0.54700714",
"0.5468626",... | 0.60587823 | 2 |
Return an executable string representation. This method returns a string so that ``eval(self.vrepr())`` returns a new `SSA` object with the same content. >>> from cascada.bitvector.core import Variable >>> from cascada.bitvector.operation import BvXor, BvIdentity >>> from cascada.bitvector.ssa import BvFunction >>> z =... | def vrepr(self):
return "{}(input_vars={}, output_vars={}, assignments={}{})".format(
type(self).__name__,
f"[{', '.join([v.vrepr() for v in self.input_vars])}]",
f"[{', '.join([v.vrepr() for v in self.output_vars])}]",
f"[{', '.join([f'({v.vrepr()}, {e.vrepr()})'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_(self):\n s = 'An equation '\n have_A = not self.A().is_zero()\n if have_A:\n s += repr(self.A()) + ' x '\n if self.b()>=0:\n if have_A:\n s += '+'\n else:\n s += '-'\n if have_A:\n s += ' '\n s +=... | [
"0.61188376",
"0.61188376",
"0.60854304",
"0.6069777",
"0.6012829",
"0.5928467",
"0.5817199",
"0.58145636",
"0.5814443",
"0.5811863",
"0.57879734",
"0.5767751",
"0.57263815",
"0.5706116",
"0.5697784",
"0.5687782",
"0.5685565",
"0.56687975",
"0.5661975",
"0.56314254",
"0.56243... | 0.6500199 | 0 |
Return the round separators if the SSA was obtained from a `RoundBasedFunction`. If the `SSA` object was obtained from `RoundBasedFunction.to_ssa` of a `RoundBasedFunction` including `add_round_outputs` calls in its ``eval``, this method returns a list with the round outputs delimiting the rounds. Otherwise, ``None`` i... | def get_round_separators(self):
if getattr(self, "_rounds_outputs", None) is None:
return None
if len(self._rounds_outputs) == 0:
return None
return self._rounds_outputs[:-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rounds(self) -> List[Round]:\n return self._rounds",
"def get_rounds_outputs(cls):\n if cls._rounds_outputs is None:\n raise ValueError(\"eval must be called before get_rounds_outputs\")\n return cls._rounds_outputs",
"def roundParameters(self, roundNum):\n ruleName =... | [
"0.5567383",
"0.5464221",
"0.5120953",
"0.511039",
"0.5052884",
"0.48159716",
"0.46500137",
"0.46258867",
"0.45040205",
"0.44882062",
"0.4462644",
"0.4399613",
"0.43700054",
"0.43601322",
"0.43520933",
"0.42661065",
"0.42626894",
"0.4245764",
"0.42430812",
"0.42364082",
"0.42... | 0.6987893 | 0 |
Return a random `BvFunction` with given shape. | def get_random_bvfunction(width, num_inputs, num_outputs, num_assignments, seed,
external_variable_prefix=None, operation_set_index=0, num_rounds=None,
extra_operations=None):
assert num_inputs + num_assignments >= num_outputs
import random
import functoo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def b_init(shape, name=None):\n values = np.random.normal(loc=0.5, scale=1e-2, size=shape)\n return K.variable(values, name=name)",
"def __call__(self, shape):\n return np.random.uniform(low=self.minval, high=self.maxval, size=shape)",
"def b_init(shape, name=None):\n values = rng.norma... | [
"0.60691446",
"0.6022296",
"0.5954505",
"0.57499504",
"0.57022244",
"0.5671044",
"0.5671044",
"0.5621131",
"0.56195396",
"0.5616216",
"0.5603668",
"0.55633956",
"0.5560976",
"0.5538763",
"0.55148214",
"0.5467586",
"0.54356635",
"0.54152143",
"0.53970236",
"0.53505164",
"0.532... | 0.5444272 | 16 |
Create an instance by evaluating all constraints in the problem. The ``problem`` is a DnaChisel DnaOptimizationProblem. | def from_problem(problem, autopass_constraints=True):
def evaluate(constraint):
if (
autopass_constraints
and constraint.enforced_by_nucleotide_restrictions
):
return SpecEvaluation(
constraint,
prob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phase_I_problem_from(cls, problem: LinearConstraintsProblem) -> LinearProblem:\n n = problem.n\n m = len(problem.constraints)\n\n e_x = np.zeros(shape=n)\n e_z = np.ones(shape=m)\n e = np.concatenate((e_x, e_z))\n\n x0 = np.zeros(n)\n # we dont need to look at s... | [
"0.6295126",
"0.60471386",
"0.5886922",
"0.5765422",
"0.5730006",
"0.5707503",
"0.565367",
"0.5576092",
"0.5528963",
"0.54968774",
"0.5491965",
"0.54807454",
"0.5393297",
"0.53774476",
"0.53702635",
"0.5276206",
"0.52658254",
"0.5262188",
"0.5253071",
"0.5241584",
"0.52301854... | 0.6974452 | 0 |
Returns a Collection of Opportunities. | def index(self):
args = index_reqparse.parse_args()
args.api_key = "8l3xbEmsQMq7AG7mXoSy3IuJAqehmWGRC754Otx7"
url = 'http://api.data.gov/gsa/fbopen/v0/opps?%s' % urlencode(query=args)
return json.loads(urlopen(url=url).read()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_all(self):\n return self.opportunities.find()",
"def get_opportunities_for_maintenance(self, limit=None,\n batch_size=None):\n cursor = self.iter_all()\n\n if limit:\n limit = int(limit)\n cursor = cursor.limit(limit)\n\... | [
"0.75928587",
"0.6055248",
"0.56843185",
"0.5382803",
"0.5341676",
"0.52663434",
"0.5257113",
"0.5237074",
"0.51992303",
"0.5176973",
"0.5175872",
"0.51342726",
"0.51293606",
"0.5111544",
"0.50776553",
"0.50687754",
"0.5067086",
"0.5067079",
"0.5047134",
"0.5043661",
"0.50391... | 0.0 | -1 |
Checks for a comma | def _is_comma(self, symbol):
if symbol.type == self.scanner.COMMA:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_comma(text):\n err = \"style-guide.serial-comma\"\n msg = \"Use serial comma after penultimate item.\"\n regex = \"\\,\\s[a-zA-Z0-9]*\\sand\\s\"\n\n return existence_check(text, [regex], err, msg, require_padding=False)",
"def contains_comma(self, *args):\n return _ida_hexrays.cexpr_... | [
"0.78176993",
"0.7652777",
"0.75575286",
"0.739962",
"0.6958344",
"0.68487954",
"0.67709404",
"0.6737014",
"0.654276",
"0.6426066",
"0.6025317",
"0.60239697",
"0.590207",
"0.5873435",
"0.5853992",
"0.58382696",
"0.5835906",
"0.579905",
"0.579905",
"0.5768135",
"0.5726377",
... | 0.78183836 | 0 |
Checks if symbol is a number | def _is_number(self, symbol):
if symbol.type == self.scanner.NUMBER:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_numeral(self, symbol: str) -> bool:\n return symbol in self.numerals",
"def is_number(symbol):\n return isa(symbol, complex) or is_rational(symbol)",
"def is_int(symbol):\n return isa(symbol, int)",
"def _is_num(w):\n symbols = list(w)\n for s in symbols:\n ... | [
"0.7981778",
"0.796459",
"0.7456952",
"0.71271473",
"0.7109606",
"0.7074188",
"0.7070969",
"0.70643014",
"0.7049879",
"0.70249534",
"0.7018031",
"0.701756",
"0.701756",
"0.701756",
"0.7005208",
"0.69720167",
"0.6957312",
"0.69454503",
"0.69375134",
"0.6913471",
"0.6888762",
... | 0.87825435 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.