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 |
|---|---|---|---|---|---|---|
User object name displayed in admin panel | def __str__(self):
return f"{self.id}: {self.username}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\t \n\t return self.user.username",
"def __str__(self):\n return self.user.username",
"def __str__(self):\n return self.user.username",
"def __str__(self):\n return self.user.username",
"def __str__(self):\n return self.user.username",
"def __str__(self... | [
"0.81383646",
"0.80146104",
"0.80146104",
"0.80146104",
"0.80146104",
"0.80146104",
"0.80146104",
"0.7860006",
"0.7832191",
"0.77992696",
"0.7770537",
"0.7745684",
"0.7699272",
"0.7644524",
"0.7644524",
"0.7644524",
"0.76000357",
"0.75969285",
"0.755314",
"0.7491493",
"0.7489... | 0.6871457 | 87 |
One hot encodes the target set. | def one_hot_encode(target):
ohe_target = empty(target.shape[0], 2)
ohe_target[:, 0] = target == 0
ohe_target[:, 1] = target == 1
return ohe_target | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(self, target='all'):\n if self.window == 0:\n split = int(0.8*len(self.sequences))\n # train/validation\n self.X = DataGenerator(self.sequences[:split])\n self.y = DataGenerator(self.sequences[split:])\n \"\"\"\n for s in s... | [
"0.8019406",
"0.79732275",
"0.7930377",
"0.7782279",
"0.7758781",
"0.77342886",
"0.7720961",
"0.76216793",
"0.7568969",
"0.75184137",
"0.75167847",
"0.75154334",
"0.751086",
"0.7502279",
"0.749452",
"0.74713445",
"0.74464947",
"0.7434291",
"0.74195576",
"0.74194807",
"0.74153... | 0.82779557 | 0 |
Convert between temperature units | def main():
menu_options = ["C", "F", "Q"]
print(MENU)
choice = get_valid_choice(menu_options)
while choice != "Q":
if choice == "C":
unit = "F"
celsius = get_temperature("Celsius: ")
fahrenheit = convert_celsius_to_fahrenheit(celsius)
print_result... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_temp(val, unit_from, unit_to):\n if unit_from == unit_to:\n return val\n if unit_from == \"Cel\":\n if unit_to == \"degF\":\n # return ((9/5) * val) + 32\n return _convert(val, factor=(9/5), intercept=32)\n elif unit_to == \"K\":\n return _co... | [
"0.7990443",
"0.7577743",
"0.7565573",
"0.7408898",
"0.7158228",
"0.7120767",
"0.7109749",
"0.69111395",
"0.6842131",
"0.6803201",
"0.67270225",
"0.67267185",
"0.6699244",
"0.6698152",
"0.6698152",
"0.66714036",
"0.66502345",
"0.66216",
"0.66216",
"0.66216",
"0.66216",
"0.6... | 0.0 | -1 |
Get a temperature float value | def get_temperature(prompt):
return float(input(prompt)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTemp(self):\r\n v = self._read16()\r\n # Check for error reading value.\r\n if v & 0x4:\r\n return float('NaN')\r\n # Check if signed bit is set.\r\n if v & 0x80000000:\r\n # Negative value, take 2's compliment. Compute this with subtraction\r\n ... | [
"0.79897153",
"0.7988796",
"0.79597867",
"0.779762",
"0.7768853",
"0.7758153",
"0.77157086",
"0.7691811",
"0.7661783",
"0.7649452",
"0.76473385",
"0.76284766",
"0.75786245",
"0.7573525",
"0.7545322",
"0.75372905",
"0.75086224",
"0.7496878",
"0.74860007",
"0.7462517",
"0.74527... | 0.7292985 | 32 |
Convert celsius temperatures to fahrenheit units | def convert_celsius_to_fahrenheit(celsius):
return celsius * 9.0 / 5 + 32 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def celsius_to_fahrenheit(tempc):\n return (tempc*(9/5))+32",
"def fahr_to_celsius(temp_fahrenheit):\n\n converted_temp=(temp_fahrenheit-32)/1.8\n return converted_temp",
"def celsius_to_fahrenheit(temp):\n return (temp * 1.8) + 32.0",
"def celsius_to_fahrenheit():\n celsius = entry_temp2.get()\n ... | [
"0.8428562",
"0.8262115",
"0.8154586",
"0.81471014",
"0.8107999",
"0.80091965",
"0.7990895",
"0.79579264",
"0.79263544",
"0.7878889",
"0.78598714",
"0.782825",
"0.77220094",
"0.7675096",
"0.75965655",
"0.7580688",
"0.75717384",
"0.75348294",
"0.74741703",
"0.74029493",
"0.739... | 0.77776843 | 12 |
Convert fahrenheit temperatures to celsius units | def convert_fahrenheit_to_celsius(fahrenheit):
return 5 / 9 * (fahrenheit - 32) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fahr_to_celsius(temp_fahrenheit):\n\n converted_temp=(temp_fahrenheit-32)/1.8\n return converted_temp",
"def convertFahrenheitToCelsius(fahrenheit):\n celsius = (fahrenheit - 32) / 1.8\n return celsius",
"def convert_to_celsius(fahrenheit):\n celsius = 5 / 9 * (fahrenheit - 32)\n return celsi... | [
"0.8616441",
"0.84994036",
"0.8399369",
"0.8396381",
"0.8385104",
"0.82986534",
"0.8200984",
"0.8192174",
"0.81359214",
"0.8092892",
"0.80206114",
"0.7816001",
"0.7814417",
"0.78033614",
"0.77892643",
"0.77678674",
"0.77163386",
"0.76289606",
"0.7617197",
"0.7579475",
"0.7467... | 0.8108665 | 9 |
Returns the dict as a model | def from_dict(cls, dikt) -> 'InlineResponse2005D':
return util.deserialize_model(dikt, cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt) -> 'Model':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt) -> 'ModelOutput':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt) -> 'ModelStat':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt):\n ... | [
"0.73100865",
"0.7226481",
"0.68927467",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67725724",
"0.67388964",
"0.66993856",
"0.6698291",
"0.6698291",
"0.6698291",
"0.6650225",
"... | 0.0 | -1 |
Gets the league_id of this InlineResponse2005D. | def league_id(self) -> str:
return self._league_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEPLleagueID():\n fileName = 'CachedJson/getLeagues.txt'\n if isTest:\n with open(fileName, 'r') as file:\n responseText = file.read()\n\n else:\n response = requests.get(\"https://api-football-v1.p.mashape.com/leagues\",\n headers={\n ... | [
"0.65882176",
"0.6039309",
"0.60033196",
"0.60033196",
"0.5868664",
"0.58201027",
"0.58040375",
"0.58006006",
"0.57166374",
"0.57061917",
"0.56520665",
"0.55866903",
"0.5560013",
"0.55450124",
"0.554098",
"0.5439248",
"0.54345906",
"0.54156303",
"0.5378712",
"0.5304445",
"0.5... | 0.78344524 | 0 |
Sets the league_id of this InlineResponse2005D. | def league_id(self, league_id: str):
self._league_id = league_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def league_id(self) -> str:\n return self._league_id",
"def team_id(self, team_id):\n\n self._team_id = team_id",
"def team_id(self, team_id):\n\n self._team_id = team_id",
"def team_id(self, team_id):\n\n self._team_id = team_id",
"def team_id(self, team_id):\n\n self._t... | [
"0.6404991",
"0.59235567",
"0.59235567",
"0.59235567",
"0.59235567",
"0.5896688",
"0.576086",
"0.5577659",
"0.5565257",
"0.5453032",
"0.5453032",
"0.5453032",
"0.5453032",
"0.53848034",
"0.53004175",
"0.5260635",
"0.52590525",
"0.5235144",
"0.5159967",
"0.51353556",
"0.508505... | 0.7818024 | 0 |
Check for nan values and replace with missing. | def _check_nan(value, missing=-9999):
return missing if math.isnan(value) else value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_nans(self) -> None:\n self.data.replace(self.nan_value, np.nan, inplace=True)",
"def test_input_contains_all_missingvalues():\n with pytest.raises(TypeError):\n rp.replace_na(toy_all_na, columns_2)",
"def apply_nan(self, nodatavals=None):\n nodatavals = nodatavals or dict(... | [
"0.8031041",
"0.71686864",
"0.7156307",
"0.7081796",
"0.69648284",
"0.6951899",
"0.6935635",
"0.6831365",
"0.6793579",
"0.6788462",
"0.67694575",
"0.67204326",
"0.6696236",
"0.66871893",
"0.66575634",
"0.6629801",
"0.66114837",
"0.6609928",
"0.6528439",
"0.6527806",
"0.650409... | 0.7373265 | 1 |
Return beginning position of a word in bytes. | def _word_to_position(word, bytes_per_word=BYTES_PER_WORD):
return (word * bytes_per_word) - bytes_per_word | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def starting_offset(source_code, offset):\r\n word_finder = worder.Worder(source_code, True)\r\n expression, starting, starting_offset = \\\r\n word_finder.get_splitted_primary_before(offset)\r\n return starting_offset",
"def getStartOffset(self) -> long:\n ...",
"def find_file_start(sel... | [
"0.66211987",
"0.6268897",
"0.6174057",
"0.60631806",
"0.6047987",
"0.598425",
"0.5870153",
"0.5853128",
"0.58423394",
"0.5830921",
"0.5814614",
"0.5761684",
"0.57163966",
"0.5703383",
"0.5689101",
"0.5673759",
"0.56729925",
"0.56612337",
"0.56466323",
"0.5644671",
"0.5633948... | 0.7094246 | 0 |
Interpolate missing sounding data. This function is similar to the MR_MISS subroutine in GEMPAK. | def _interp_logp_data(sounding, missing=-9999):
size = len(sounding['PRES'])
recipe = [('TEMP', 'DWPT'), ('DRCT', 'SPED'), ('DWPT', None)]
for var1, var2 in recipe:
iabove = 0
i = 1
more = True
while i < (size - 1) and more:
if sounding[var1][i] == missing:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def missing_interpolate(data):\n M,N, nr_j, _ = data.shape\n #flat = np.flatten()\n #print(np.where(data[:,:,:, 0].flatten()==0 and data[:,:,:, 1]!=0))\n print(data.shape)\n data = data[:,:,:12,:]\n\n for i in range(M):\n for j in range(N):\n for ... | [
"0.6496903",
"0.6382669",
"0.6166996",
"0.60067785",
"0.5992269",
"0.59515125",
"0.59462523",
"0.5922217",
"0.58961505",
"0.57979375",
"0.57752156",
"0.57702416",
"0.5767078",
"0.5750202",
"0.57065105",
"0.56833637",
"0.566395",
"0.5652971",
"0.5635068",
"0.5622109",
"0.55598... | 0.61309063 | 3 |
Convert integer vertical coordinate to name. | def _convert_vertical_coord(coord):
if coord <= 8:
return VerticalCoordinates(coord).name.upper()
else:
return struct.pack('i', coord).decode() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chr_no_to_name(chr_no):\n if chr_no == CHR_X:\n return \"chrX\"\n if chr_no == CHR_Y:\n return \"chrY\"\n return f\"chr{chr_no+1}\"",
"def get_coord_name(self):\n # this function should only be called in test mode\n assert self.mode == 'test' and len(self.coord) == 1\n ... | [
"0.60088015",
"0.5958664",
"0.5921606",
"0.572003",
"0.5713578",
"0.5606593",
"0.55999976",
"0.55929214",
"0.558252",
"0.5573787",
"0.55508626",
"0.54955786",
"0.5488052",
"0.5454198",
"0.54458755",
"0.54434824",
"0.5440146",
"0.54310066",
"0.53757596",
"0.5374069",
"0.536265... | 0.76719904 | 0 |
Return the array of the normals coordinates. | def get_normals(self, indices=None, loc="center"):
surf = self.get_surf(indices=indices)
if loc == "center":
return surf.cell_normals
elif loc == "point":
surf.compute_normals(cell_normals=False, point_normals=True, inplace=True)
return surf["Normals"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normals(self):\r\n return np.array([self.all[i].normal for i in range(self.n)])",
"def _triangle_normals(self):\n \n normals = np.zeros((self.triangles.shape[0], 3))\n components = self.vertices[self.triangles]\n \n for i, c in enumerate(components):\n d0 ... | [
"0.8668527",
"0.771277",
"0.7695012",
"0.7516998",
"0.73063254",
"0.72841954",
"0.70958364",
"0.709523",
"0.7084918",
"0.7050658",
"0.7001085",
"0.6951181",
"0.67714405",
"0.67710906",
"0.67168695",
"0.66545767",
"0.66001046",
"0.6583002",
"0.6561382",
"0.65115404",
"0.638359... | 0.6461305 | 20 |
Gets the username of the user who inserted the sample file | def getOwner(self, hadoopDirectory, filename):
return self.x("SELECT user FROM SampleFiles WHERE HadoopPath='%s' AND FileName='%s'" % (hadoopDirectory, filename) )[0][0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username():\n with open(\"user.txt\") as file:\n username = file.read()\n return username",
"def get_user_name(self):\n pass",
"def getName(self):\n\t\treturn self.username",
"def user(self):\n import pwd # doesn't work on windows\n return pwd.getpwuid(os.stat(self).st_... | [
"0.69931644",
"0.6981806",
"0.696502",
"0.6932004",
"0.68695354",
"0.68580604",
"0.68273854",
"0.68273854",
"0.68115556",
"0.6801191",
"0.6795037",
"0.67863166",
"0.67863166",
"0.67761946",
"0.67737025",
"0.6771594",
"0.6715014",
"0.6715014",
"0.6715014",
"0.6715014",
"0.6715... | 0.7006486 | 0 |
Hashes a password using pbkdf2_shah512 | def hash_password(password):
return pbkdf2_sha512.encrypt(password) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_pass( password ):\n salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii')\n pwdhash = hashlib.pbkdf2_hmac('sha512', password.encode('utf-8'), \n salt, 100000)\n pwdhash = binascii.hexlify(pwdhash)\n return (salt + pwdhash) # return bytes",
"def hash... | [
"0.8222772",
"0.80637556",
"0.80637556",
"0.80637556",
"0.804529",
"0.799627",
"0.79428726",
"0.7935118",
"0.79029363",
"0.7840364",
"0.7755873",
"0.77497315",
"0.7721037",
"0.7671436",
"0.75925046",
"0.7527237",
"0.75184804",
"0.74609804",
"0.7409787",
"0.73181796",
"0.73106... | 0.8022224 | 5 |
Do heapifying starting from bottom till it reaches the root. | def _inv_heapify(self, child_index):
heap, compare = self.heap, self.compare
child = child_index
while child > 0:
parent = child // 2
if compare(heap[parent], heap[child]):
return
heap[parent], heap[child] = heap[child], heap[parent]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_heapify_iter(heap, root=0):\n size = len(heap)\n while True:\n l = 2*root+1\n if size <= l:\n # no children at root\n break\n r = l+1\n if size <= r:\n # only a left child\n if heap[l] > heap[root]:\n heap[l], heap... | [
"0.7656137",
"0.75545293",
"0.7473611",
"0.7379692",
"0.7277971",
"0.7167441",
"0.7115685",
"0.7035651",
"0.69704753",
"0.69527495",
"0.69178027",
"0.6914666",
"0.6905834",
"0.69018555",
"0.68668467",
"0.68604153",
"0.68276954",
"0.67927206",
"0.6742578",
"0.6720171",
"0.6706... | 0.60716105 | 75 |
It calculated the magnitude of the Vector3 given. This is usefull for reading imu accelerations and knowing if there has been a crash | def get_vector_magnitude(self, vector):
contact_force_np = numpy.array((vector.x, vector.y, vector.z))
force_magnitude = numpy.linalg.norm(contact_force_np)
return force_magnitude | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magnitude(vector: Vec3) -> float:\n return m.sqrt(sum(x * x for x in vector))",
"def magnitude(self):\n output = math.sqrt(self.x**2 + self.y**2 + self.z**2)\n return output",
"def magnitude(v: Vector2) -> float:\n return sqrt(dot(v, v))",
"def magnitude(v):\n return math.sqrt(... | [
"0.7683492",
"0.74876857",
"0.72875094",
"0.71431565",
"0.71187407",
"0.7077702",
"0.7074442",
"0.7065187",
"0.6984365",
"0.6962967",
"0.6913941",
"0.68934345",
"0.6839291",
"0.6764434",
"0.67362463",
"0.6718299",
"0.6709355",
"0.66884756",
"0.668121",
"0.6657879",
"0.6649807... | 0.6237051 | 41 |
Remove a contact from the database. | def delete_contact(self, row):
self.model.removeRow(row)
self.model.submitAll()
self.model.select() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_contact(self, contact_id):\n self.cr.execute(\n 'delete from Contacts where contact_id = ?',\n (contact_id,)\n )\n self.connection.commit()\n self.find_all_contacts()",
"def del_contact(self):\n widget = self.ui.listWidgetContactList\n co... | [
"0.7293625",
"0.7111831",
"0.69365424",
"0.6918968",
"0.679591",
"0.6766988",
"0.6753715",
"0.6702024",
"0.6638722",
"0.6629398",
"0.6579138",
"0.6514007",
"0.6503279",
"0.6469732",
"0.64035034",
"0.6338955",
"0.63205445",
"0.631566",
"0.6310485",
"0.6285046",
"0.6244969",
... | 0.7048001 | 2 |
quote a string so that it will be later formatted correctly | def quote_js_str(text, *, quotes="'"):
return f"{quotes}{text}{quotes}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quote(string):\n return \"'%s'\" % string",
"def quote(self, s):\n return quote(s).replace('\"', '\"\"')",
"def make_quoted_string(string: str) -> str:\n return \"\\'{}\\'\".format(string)",
"def j2_quote(s):\n return '\"{}\"'.format(s)",
"def shquote(text):\n\treturn \"'%s'\" %... | [
"0.8398612",
"0.7920196",
"0.78780377",
"0.78028345",
"0.76676404",
"0.75803876",
"0.7546587",
"0.75273997",
"0.7476062",
"0.74677694",
"0.7452647",
"0.7436759",
"0.743063",
"0.7401038",
"0.7398099",
"0.73929006",
"0.73376393",
"0.7316945",
"0.7313738",
"0.7304299",
"0.725396... | 0.66174203 | 49 |
Transfers weights from torchenet if they are available as {PROJECT_ROOT}/models/pretrained/torch_enet.pkl after running from_torch.py. | def transfer_weights(model, weights=None, keep_top=False):
def special_cases(idx):
"""
Handles special cases due to non-matching layer sequences
:param idx: original index of layer
:return: the corrected index of the layer as well as the corresponding layer
"""
idx_m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_pretrained_weights(net):\n vgg = torchvision.models.vgg16(pretrained=True,progress=True)\n pretrained_dict = vgg.state_dict()\n model_dict = net.state_dict()\n list1 = ['layer10_conv.weight',\n 'layer10_conv.bias',\n 'layer11_conv.weight',\n 'layer11_conv.bias',\n 'layer20_conv.weight',\n ... | [
"0.73541516",
"0.70975924",
"0.69700366",
"0.6872442",
"0.6763713",
"0.6620401",
"0.65048605",
"0.64030254",
"0.6393986",
"0.63865656",
"0.6378509",
"0.6332776",
"0.6306661",
"0.6258719",
"0.6195301",
"0.61513954",
"0.6144145",
"0.61317223",
"0.60793763",
"0.60731286",
"0.603... | 0.65471655 | 6 |
Initialize the Replay Buffer dataset used for retrieving experiences | def __dataloader(self) -> DataLoader:
dataset = RLDataset(self.buffer, self.episode_length)
dataloader = DataLoader(
dataset=dataset,
batch_size=self.batch_size,
sampler=None,
)
return dataloader | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_replay_buffer(self):\n logger.info(\"setting up replay buffer\")\n if self.hps.prioritized_replay:\n if self.hps.unreal: # Unreal prioritized experience replay\n self.replay_buffer = UnrealReplayBuffer(self.hps.mem_size,\n ... | [
"0.7031753",
"0.7011085",
"0.6818483",
"0.6804546",
"0.6412201",
"0.63861376",
"0.63658726",
"0.6314448",
"0.62930936",
"0.6283913",
"0.6270331",
"0.6197919",
"0.61842364",
"0.6170145",
"0.6152685",
"0.6125215",
"0.60807157",
"0.6069517",
"0.60202056",
"0.6012217",
"0.599984"... | 0.5700399 | 57 |
Moves the given yearseason value one season forward. | def increment_year_season(year_season):
result = year_season + 1
if result % 10 == 4:
result = result + 10 - 4
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_season(date):\n year = date // 10000\n breakpoint = (year * 10000) + 700\n if date < breakpoint:\n return year\n else:\n return year + 1",
"def combine_year_season(year, season):\n return year * 10 + season",
"def player_season(self, player_season):\n\n self._pla... | [
"0.6415713",
"0.6359634",
"0.6189945",
"0.6073827",
"0.59926045",
"0.59926045",
"0.57498944",
"0.57152426",
"0.5655713",
"0.5607329",
"0.553813",
"0.54705155",
"0.538764",
"0.5366849",
"0.53483087",
"0.5338887",
"0.53160113",
"0.53022295",
"0.52788687",
"0.526418",
"0.5255114... | 0.774698 | 0 |
Gets the anime that should be included in the given survey. | def get_survey_anime(survey):
current_year_season = AnimeUtil.combine_year_season(survey.year, survey.season)
anime_queryset = AnimeUtil.annotate_year_season(
Anime.objects
).filter(
AnimeUtil.is_ongoing_filter_func(current_year_season)
)
anime_series_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def survey(self):\n return self._survey",
"def short_a():\n context = {\n 'request_path': '/gifts/a/',\n 'quiz_type': 'short_a'\n }\n return render_survey(**context)",
"def get_anime(anime_link):\n return selective_request('anime', anime_link, kwargs={'include': 'categories'})"... | [
"0.5808227",
"0.526688",
"0.52561545",
"0.5077352",
"0.4997541",
"0.4991227",
"0.480308",
"0.47890693",
"0.47786638",
"0.47521415",
"0.47488058",
"0.47208068",
"0.4719314",
"0.47032616",
"0.47032616",
"0.46955362",
"0.46623456",
"0.46488416",
"0.46438512",
"0.46330887",
"0.46... | 0.75509316 | 0 |
Gets displayable informatin about the user. Returns None if the user is not authenticated. | def get_user_info(user):
if not user.is_authenticated: return None
socialaccount_queryset = user.socialaccount_set.all()
reddit_account_queryset = socialaccount_queryset.filter(provider='reddit')
if len(reddit_account_queryset) == 1:
account = reddit_account_queryset[0]
username = accou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_user():\n return User.display_user()",
"def display_user():\n return User.display_user()",
"def user_show_me(context, resource_dict):\n auth_user_obj = context.get('auth_user_obj')\n if auth_user_obj:\n return auth_user_obj.as_dict()\n else:\n raise NotAuthorized",
"d... | [
"0.6450335",
"0.6450335",
"0.6312193",
"0.6087276",
"0.6080396",
"0.6064152",
"0.60431236",
"0.60431236",
"0.6037651",
"0.60075265",
"0.5955041",
"0.59084064",
"0.59001666",
"0.59001666",
"0.5886265",
"0.5877681",
"0.58381456",
"0.5816581",
"0.58023876",
"0.5791664",
"0.57868... | 0.5485783 | 57 |
Returns the recording of the state as a Numpy array. | def get(self):
return self.state_record | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(self):\n return np.array(self._state)",
"def get_state_array(self):\n return np.ones((self.seq_len, self.nstates))",
"def __array__(self):\n return self.state(numpy=True)",
"def asnumpy(self):\n return self.state",
"def get(self):\n arr = np.empty(0)\n ar... | [
"0.7658065",
"0.7510251",
"0.7343036",
"0.7307208",
"0.6910943",
"0.69074714",
"0.69010484",
"0.68662214",
"0.67890227",
"0.6761636",
"0.6736722",
"0.6710286",
"0.66199905",
"0.65964437",
"0.65807825",
"0.6580614",
"0.65557027",
"0.6547459",
"0.65358037",
"0.65284544",
"0.649... | 0.5625558 | 97 |
Returns iterable of all registered entry values. | def __iter__(self):
return iter(self.values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def values(self):\n\t\treturn self._entries.values()",
"def entries(self):\n return self.values.values()",
"def values(self):\n return self._entries.values()",
"def __iter__(self):\n return iter(self._entries.values())",
"def values(self):\n return dict.itervalues(self)",
... | [
"0.78555226",
"0.776341",
"0.76431614",
"0.73250973",
"0.726503",
"0.7249329",
"0.71963614",
"0.7187765",
"0.7144989",
"0.7037452",
"0.7030057",
"0.70295775",
"0.70182514",
"0.7009876",
"0.7003628",
"0.6986637",
"0.6986637",
"0.698398",
"0.698398",
"0.6980365",
"0.6979194",
... | 0.6495282 | 59 |
Test odd or even | def odd_or_even(number):
if number%2==0:
return 'Even'
else:
return 'Odd' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_odd(n):\n if is_even(n):\n return False\n return True",
"def is_odd(number):\n return not is_even(number)",
"def odd(number):\n\n return number % 2 == 1",
"def is_odd(number):\n\n if number % 2 == 0:\n return False\n else:\n return True",
"def is_even(number):\... | [
"0.8130717",
"0.806982",
"0.80534685",
"0.79626864",
"0.7908162",
"0.79029375",
"0.7883207",
"0.7872022",
"0.78717077",
"0.7871271",
"0.78442365",
"0.77992886",
"0.77788615",
"0.7743119",
"0.77128404",
"0.77056026",
"0.76987433",
"0.76933724",
"0.7669429",
"0.75887865",
"0.75... | 0.75075614 | 27 |
Ensure that get method returns status 404 with nonexisted object id. | def test_get_by_id_status_not_found(self):
response = self.client.get(url_with_trip(comment_id=BAD_COMMENT_ID))
self.assertEqual(response.status_code, 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_retrieve_with_bad_id(self):\n resp = self.api_client.get('/api/users/100000/')\n data = json.loads(resp.content)\n # Ensure request was successful\n self.assertEqual(resp.status_code, 404)\n # Ensure the returned json keys match the expected\n self.assertEqual(dat... | [
"0.77750134",
"0.7750945",
"0.7723289",
"0.7642103",
"0.748392",
"0.74440956",
"0.732321",
"0.7299476",
"0.72495013",
"0.72076446",
"0.72016364",
"0.7187165",
"0.7184031",
"0.71618485",
"0.7149442",
"0.71340364",
"0.712717",
"0.7121402",
"0.7118079",
"0.71180606",
"0.7100895"... | 0.7636514 | 4 |
Ensure that get method returns status 200 with given Object id, Object id, and Object id. | def test_get_by_trip_checkpoint_photo_id(self):
response = self.client.get(url_with_all_ids())
self.assertEqual(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_get(self):\n self.assertEqual(status.HTTP_200_OK, self.response.status_code)",
"def test_get_by_id_success(self):\n\n response = self.client.get(url_with_trip())\n self.assertEqual(response.status_code, 200)",
"def test_retrieve_with_bad_id(self):\n resp = self.api_clie... | [
"0.6698206",
"0.6550891",
"0.6488877",
"0.6470138",
"0.6470138",
"0.6470138",
"0.6470138",
"0.6470138",
"0.6470138",
"0.6470138",
"0.6470138",
"0.6470138",
"0.6470138",
"0.6470138",
"0.6470138",
"0.6443613",
"0.6443613",
"0.6443613",
"0.6414396",
"0.6402123",
"0.6378501",
"... | 0.0 | -1 |
Ensure that put method returns status 404 when wrong id were send. | def test_put_status_404(self):
data = {
'message': 'test message update'
}
response = self.client.put(url_with_trip(comment_id=BAD_COMMENT_ID),
json.dumps(data), content_type="application/json")
self.assertEqual(response.status_code, 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(self, id):\n return None, 200, None",
"def test_put_fail1(client):\n # test that viewing the page renders without template errors\n response = client.put(\"/api/books?author_id=48622\", data={'rating':4.3})\n # print(response)\n assert response.status_code == 400",
"def test_put_bad_... | [
"0.7331693",
"0.71220744",
"0.70271534",
"0.70145464",
"0.6912426",
"0.6893218",
"0.6890064",
"0.68884075",
"0.6857678",
"0.68378776",
"0.679673",
"0.6741819",
"0.6719388",
"0.6684917",
"0.66085553",
"0.65820605",
"0.65699905",
"0.6550772",
"0.65437025",
"0.6530343",
"0.65014... | 0.7578354 | 0 |
Ensure that delete method returns status 404 when wrong id were send. | def test_delete_404(self):
response = self.client.delete(url_with_trip(comment_id=BAD_COMMENT_ID))
self.assertEqual(response.status_code, 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_no_id():\n response = delete.main({}, {})\n\n assert response[\"statusCode\"] == 400",
"def test_delete_404(self):\n endpoint = Endpoint(self.root, 'delete', self.token)\n with self.assertRaises(HTTPError):\n endpoint.delete('{}/not-a-url'.format(endpoint.base_url))... | [
"0.7671993",
"0.7391626",
"0.73379874",
"0.72704566",
"0.7210995",
"0.7140418",
"0.71117854",
"0.7080043",
"0.7063665",
"0.7052194",
"0.69542396",
"0.69488406",
"0.6928613",
"0.6909146",
"0.68514955",
"0.6849872",
"0.68380564",
"0.68011945",
"0.67994356",
"0.67978823",
"0.678... | 0.7456649 | 1 |
Return the unique ID for this thermostat. | def unique_id(self) -> str:
return "_".join([DOMAIN, self.toon.agreement.id, "climate"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_id(self):\n return \"{}_{}_thermostat_{}\".format(\n DOMAIN_NIBE, self._system_id, self._external_id)",
"def unique_id(self):\n return \"{}.{}\".format(self.__class__, self._device.get_hardware_id())",
"def unique_id(self):\n return self.device.id",
"def unique_id(s... | [
"0.8397477",
"0.8048582",
"0.7976867",
"0.79642385",
"0.789097",
"0.789097",
"0.78805333",
"0.78419626",
"0.77618504",
"0.76945275",
"0.76945275",
"0.76945275",
"0.76945275",
"0.7679101",
"0.7673297",
"0.7673297",
"0.7656033",
"0.76468486",
"0.76273346",
"0.7614434",
"0.76100... | 0.69835913 | 96 |
Return the current running hvac operation. | def hvac_action(self) -> Optional[str]:
if self._heating:
return CURRENT_HVAC_HEAT
return CURRENT_HVAC_IDLE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hvac_mode(self):\n if self._power:\n return self._current_operation\n return HVAC_MODE_OFF",
"def hvac_action(self):\n if self._heating_status:\n return CURRENT_HVAC_HEAT\n elif self._cooling_status:\n return CURRENT_HVAC_COOL\n elif self._d... | [
"0.6880285",
"0.68092096",
"0.66066587",
"0.6440959",
"0.6440381",
"0.6440381",
"0.6440381",
"0.6440381",
"0.6372283",
"0.6321027",
"0.62762684",
"0.6262489",
"0.621643",
"0.61683404",
"0.61683404",
"0.6135783",
"0.61045057",
"0.6029861",
"0.59428537",
"0.5908512",
"0.5873235... | 0.6689002 | 2 |
Return the unit of measurement. | def temperature_unit(self) -> str:
return TEMP_CELSIUS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_of_measurement(self):\n return self._def[ATTR_UNIT]",
"def unit_of_measurement(self):\n\t\treturn self._unit_of_measurement",
"def unit_of_measurement(self):\n return self._unit",
"def unit_of_measurement(self):\n return self._unit",
"def unit_of_measurement(self):\n re... | [
"0.91430426",
"0.90646696",
"0.9043381",
"0.9043381",
"0.9043381",
"0.8998742",
"0.8998742",
"0.8944073",
"0.8927372",
"0.8919667",
"0.8919667",
"0.8919667",
"0.8919667",
"0.8919667",
"0.8919667",
"0.8919667",
"0.8919667",
"0.8919667",
"0.8919667",
"0.8919667",
"0.8919667",
... | 0.0 | -1 |
Return a list of available preset modes. | def preset_modes(self) -> List[str]:
return SUPPORT_PRESET | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preset_modes(self):\n return self._presets_list",
"def preset_modes(self):\r\n return self._preset_modes",
"def preset_modes(self):\n all_presets = []\n try:\n for item in self._api._ariston_data[\"allowedModes\"]:\n try:\n all_preset... | [
"0.88796866",
"0.865906",
"0.85847986",
"0.85274863",
"0.844301",
"0.8433665",
"0.8355132",
"0.82469445",
"0.8044678",
"0.7850238",
"0.7738",
"0.7646924",
"0.73821",
"0.7321546",
"0.71176827",
"0.69414616",
"0.67883766",
"0.6749105",
"0.6709243",
"0.6618374",
"0.65824705",
... | 0.817204 | 8 |
Return the current temperature. | def current_temperature(self) -> Optional[float]:
return self._current_temperature | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_temperature(self):\n return self.device.temperature.value",
"def current_temperature(self):\n return self._current_temp",
"def current_temperature(self):\n return self._current_temp",
"def current_temperature(self):\n return self._current_temp",
"def current_temperat... | [
"0.885649",
"0.8847039",
"0.8847039",
"0.8847039",
"0.88222444",
"0.8810965",
"0.8787774",
"0.8787774",
"0.8787774",
"0.8787774",
"0.8787774",
"0.8787774",
"0.8787774",
"0.8787774",
"0.8787774",
"0.8776789",
"0.8752283",
"0.8680356",
"0.8622063",
"0.8622063",
"0.8598221",
"... | 0.8321483 | 33 |
Return the temperature we try to reach. | def target_temperature(self) -> Optional[float]:
return self._target_temperature | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_temperature(self) -> float:\n if process_t := await self.process_temperature():\n return process_t\n return await self.internal_temperature() # type: ignore",
"def temperature(self):\n \n self.connection.send(b'T')\n data = self.connection.receive()\n ... | [
"0.81588054",
"0.8104275",
"0.8005534",
"0.79639745",
"0.7917325",
"0.7908634",
"0.7906227",
"0.79024893",
"0.78681344",
"0.78648716",
"0.78648716",
"0.78353804",
"0.7831247",
"0.7804234",
"0.7796089",
"0.77655727",
"0.7752096",
"0.7752096",
"0.7746204",
"0.77157533",
"0.7703... | 0.0 | -1 |
Return the minimum temperature. | def min_temp(self) -> float:
return DEFAULT_MIN_TEMP | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_temp(self):\n return MIN_TEMP",
"def min_temp(self):\n return self.device.target_temperature_min",
"def min_temp(self):\n return self.target_temperature_low or DEFAULT_MIN_TEMP",
"def min_temp(self):\n return self._min_temp",
"def min_temp(self):\n return self._mi... | [
"0.86168927",
"0.85845065",
"0.8497604",
"0.8438716",
"0.8438716",
"0.8438716",
"0.8438716",
"0.8438716",
"0.82013345",
"0.8125005",
"0.81010926",
"0.8086238",
"0.80624384",
"0.8047158",
"0.796023",
"0.792289",
"0.79127616",
"0.78653634",
"0.7752245",
"0.7752245",
"0.7558953"... | 0.8381455 | 9 |
Return the current state of the burner. | def device_state_attributes(self) -> Dict[str, Any]:
return {"heating_type": self._heating_type} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\r\n \r\n return self.state",
"def get_state(self):\n return self.curr_state",
"def state(self):\r\n return self._state.state()",
"def state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"state\")",
"def state(self) -> pulumi.Output[str]:\n ... | [
"0.7220254",
"0.72076935",
"0.7167559",
"0.7163771",
"0.7163771",
"0.7163771",
"0.7163771",
"0.7163771",
"0.7163771",
"0.7163771",
"0.7163771",
"0.7163771",
"0.7131015",
"0.7105635",
"0.7105635",
"0.7105635",
"0.7105635",
"0.7105635",
"0.70021194",
"0.6999496",
"0.69798416",
... | 0.0 | -1 |
3x3 convolution with padding | def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv3x3(in_planes, out_planes, stride=1, padding=1, groups=1, dilation=1, zero_init=False):\n conv = nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=padding, groups=groups, bias=False, dilation=dilation)\n if zero_init:\n conv.weight.data.zero_()\n return conv",
"def co... | [
"0.73706514",
"0.7335249",
"0.7216377",
"0.72037584",
"0.72037584",
"0.7199952",
"0.7192902",
"0.7183875",
"0.7178802",
"0.7172082",
"0.71645725",
"0.71645725",
"0.716185",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",
"0.7156602",... | 0.7081058 | 61 |
Changes the datetime formatting for the footer in the countdown message Run without formatting to reset it to use timestamps instead of footer | async def set_datetime_format(self, ctx, *, formatting:str=None):
await self.db.guild(ctx.guild).datetime_formatting.set(formatting)
msg = f"Set the new datetime formatting to {formatting}!"
if formatting is not None:
now = datetime.datetime.utcnow()
fmt = now.strfti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFooter():\n return \"# job finished in %i seconds at %s -- %s -- %s\" %\\\n (time.time() - global_starting_time,\n time.asctime(time.localtime(time.time())),\n \" \".join([\"%5.2f\" % x for x in os.times()[:4]]),\n global_id)",
"def tm_time(update, context):\n... | [
"0.6179154",
"0.5886188",
"0.585418",
"0.5661138",
"0.5637034",
"0.5495528",
"0.545672",
"0.545672",
"0.545672",
"0.5444383",
"0.54251945",
"0.5405432",
"0.53914464",
"0.53794277",
"0.5376427",
"0.5376427",
"0.53586537",
"0.5342945",
"0.5334913",
"0.52823985",
"0.5266332",
... | 0.52725554 | 20 |
Create a new harmonization rule that assign a dimension to a given header. The actual value will be resolved at the creation of the harmonized cubes | def create_rule_set_dimension(self, target, dimension):
resource = URIRef(self.namespaces['rules'] + str(uuid.uuid1()))
self.graph.add((resource,
RDF.type,
self.namespaces['harmonizer']['SetDimension']))
self.graph.add((resource,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_rule_add_dimension_value(self, target, source, dimensionvalue):\n (dimension, value) = dimensionvalue\n resource = URIRef(self.namespaces['rules'] + str(uuid.uuid1()))\n self.graph.add((resource,\n RDF.type,\n self.namespaces['harmonizer... | [
"0.5921006",
"0.53787434",
"0.53366643",
"0.5318566",
"0.51756746",
"0.51753473",
"0.5076938",
"0.49771553",
"0.49587655",
"0.4920898",
"0.48972282",
"0.48398465",
"0.47703",
"0.47572467",
"0.4748332",
"0.47077614",
"0.46920076",
"0.4684163",
"0.46769255",
"0.46723098",
"0.46... | 0.59148777 | 1 |
Check if a number is Self Division Number. | def isSDN(n):
digits = getDigits(n)
if 0 in digits:
return False
for d in digits:
if n % d != 0:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_self_dividing(self, i):\r\n if not i:\r\n return False\r\n\r\n p = i\r\n\r\n while p > 0:\r\n\r\n # Extract remaining digits and target digit\r\n p, d = divmod(p, 10)\r\n\r\n if (d == 0 or\r\n i % d != 0):\r\n # F... | [
"0.74643815",
"0.74643815",
"0.65888244",
"0.6554513",
"0.6264516",
"0.61761296",
"0.61745375",
"0.6154543",
"0.60444826",
"0.5969064",
"0.5940119",
"0.59389085",
"0.59335655",
"0.59258336",
"0.5851665",
"0.56636834",
"0.56421655",
"0.563759",
"0.55898833",
"0.5563362",
"0.55... | 0.55892086 | 19 |
Prepares data to be used as an attribute value. The return value is a quoted version of data. The resulting string can be used | def escapeAttribute(data):
return (saxutils.quoteattr(data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quoteattr(data, entities={}):\n if type(data) not in StringTypes:\n return '\"%s\"' % str(data)\n \n data = escape(data, entities)\n if '\"' in data:\n if \"'\" in data:\n data = '\"%s\"' % data.replace('\"', \""\")\n else:\n data = \"'%s'\" % data\n ... | [
"0.71940744",
"0.64415574",
"0.6401184",
"0.63993496",
"0.62028795",
"0.61473674",
"0.6133556",
"0.6107254",
"0.60526097",
"0.59322584",
"0.5914474",
"0.58788335",
"0.5866374",
"0.5768368",
"0.57133174",
"0.56802344",
"0.5634005",
"0.5627931",
"0.56231606",
"0.56090164",
"0.5... | 0.7131522 | 1 |
Returns True if n1 and n2 are coprime and False otherwise | def coprime(num1, num2):
return gcd(num1, num2) == 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def areCoprime(x, y):\n # Precondition: should take only positive integers.\n return (GCD(x,y) == 0)",
"def is_prime_complement(a,b):\n return same_prime(a.complement(),b)",
"def potencia(n1, n2):\n\n i = 1\n while n2 ** i < n1:\n i += 1\n if n2 ** i == n1:\n return True\n re... | [
"0.77201474",
"0.6608256",
"0.6553791",
"0.64903736",
"0.6322965",
"0.62871766",
"0.614425",
"0.6098916",
"0.6068168",
"0.6048876",
"0.6035563",
"0.6027292",
"0.5971939",
"0.5965198",
"0.5952843",
"0.5907696",
"0.5906399",
"0.586206",
"0.5785295",
"0.5761099",
"0.57533723",
... | 0.8485146 | 0 |
This is to set timezone and preferred language automatically. They can edit it later if they want. | def somebody_logged_in(request, user, **kwargs):
try:
if request.user.is_authenticated:
need_to_save = False
if request.user.profile.time_zone == "" or request.user.profile.country == "":
this_ip_address, location_city, location_region, location_country, location_cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tzset():\n global tzparams, timezone, altzone, daylight, tzname\n import os\n tzstr = os.environ['TZ']\n tzparams = tzparse(tzstr)\n timezone = tzparams[1] * 3600\n altzone = timezone - 3600\n daylight = 1\n tzname = tzparams[0], tzparams[2]",
"def tz_localize(self, *args, **kwargs): ... | [
"0.6929935",
"0.6586204",
"0.6562895",
"0.64010006",
"0.6315531",
"0.627395",
"0.6262908",
"0.62344575",
"0.62313616",
"0.6213766",
"0.6150805",
"0.61236185",
"0.60969263",
"0.60585326",
"0.60373604",
"0.60096645",
"0.5986875",
"0.5941776",
"0.59405404",
"0.5895049",
"0.58871... | 0.0 | -1 |
Returns True if the current user can edit the exploration editable. | def assert_can_edit(self, exp_id: str) -> None:
response = self.get_json(
'%s/%s' % (feconf.USER_PERMISSIONS_URL_PREFIX, exp_id))
self.assertEqual(response['can_edit'], True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allows_edit(self, user):\n return user.has_perm(\"questions.change_question\") or (\n self.editable and self.creator == user\n )",
"def has_edit_permission(self):\n return True",
"def has_admin_edit_permissions(user):\n if user.is_superuser:\n return True\n try:... | [
"0.81624943",
"0.8009842",
"0.78069925",
"0.78034955",
"0.77222896",
"0.75051963",
"0.7477778",
"0.7339067",
"0.73078007",
"0.728964",
"0.72554433",
"0.7211883",
"0.71805763",
"0.71282357",
"0.70194423",
"0.7001865",
"0.6979374",
"0.6955981",
"0.69129276",
"0.6900838",
"0.687... | 0.7046056 | 14 |
Returns True if the current user can voiceover the exploration. | def assert_can_voiceover(self, exp_id: str) -> None:
response = self.get_json(
'%s/%s' % (feconf.USER_PERMISSIONS_URL_PREFIX, exp_id))
self.assertEqual(response['can_voiceover'], True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_see(self, user):\n return self.lesson.can_see(user)",
"def check_view_permissions(self):\n return has_perm(self.request.user, \"motions.can_see\") and has_perm(\n self.request.user, \"motions.can_manage\"\n )",
"def can_see(self, user):\n return self.section.can_s... | [
"0.6505389",
"0.6336078",
"0.6271048",
"0.6149464",
"0.61427146",
"0.6130646",
"0.60873944",
"0.6074365",
"0.60466063",
"0.5991737",
"0.59714967",
"0.59467393",
"0.59192497",
"0.58934677",
"0.58411086",
"0.5790003",
"0.57741344",
"0.5766771",
"0.57446516",
"0.57375664",
"0.57... | 0.64209324 | 1 |
Returns True if the current user can not voiceover the exploration. | def assert_cannot_voiceover(self, exp_id: str) -> None:
response = self.get_json(
'%s/%s' % (feconf.USER_PERMISSIONS_URL_PREFIX, exp_id))
self.assertEqual(response['can_voiceover'], False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_nonrobot_user(self):\n pass",
"def has_nonrobot_user(self):\n return bool(self.authed_user and not self.robot)",
"def has_noninteractive(self):\n return self.assignment.has_noninteractive()",
"def canLevelUp(self):\n return self.experienceDelegate.canLevelUp()",
"def che... | [
"0.6500562",
"0.62293106",
"0.6203092",
"0.61864585",
"0.61742616",
"0.61513484",
"0.606568",
"0.6006846",
"0.59885204",
"0.59788764",
"0.59593034",
"0.5947721",
"0.59200084",
"0.59122944",
"0.5906207",
"0.58874804",
"0.58766884",
"0.5869702",
"0.58264905",
"0.5823268",
"0.58... | 0.6525608 | 0 |
Test rights management for deletion of unpublished explorations. | def test_deletion_rights_for_unpublished_exploration(self) -> None:
# Unpublished exploration id.
unpublished_exp_id = 'unpub_eid'
exploration = exp_domain.Exploration.create_default_exploration(
unpublished_exp_id)
exp_services.save_new_exploration(self.owner_id, exploration... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deletion_rights_for_published_exploration(self) -> None:\n # Published exploration id.\n published_exp_id = 'pub_eid'\n exploration = exp_domain.Exploration.create_default_exploration(\n published_exp_id, title='A title', category='A category')\n exp_services.save_ne... | [
"0.82200545",
"0.72154325",
"0.7141512",
"0.7097389",
"0.6756852",
"0.67512244",
"0.6730053",
"0.6723293",
"0.66901815",
"0.6686771",
"0.66290396",
"0.66022456",
"0.65896446",
"0.6576906",
"0.6561544",
"0.65444374",
"0.6521561",
"0.6515875",
"0.64467776",
"0.6338235",
"0.6329... | 0.85067546 | 0 |
Test rights management for deletion of published explorations. | def test_deletion_rights_for_published_exploration(self) -> None:
# Published exploration id.
published_exp_id = 'pub_eid'
exploration = exp_domain.Exploration.create_default_exploration(
published_exp_id, title='A title', category='A category')
exp_services.save_new_explorat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deletion_rights_for_unpublished_exploration(self) -> None:\n # Unpublished exploration id.\n unpublished_exp_id = 'unpub_eid'\n exploration = exp_domain.Exploration.create_default_exploration(\n unpublished_exp_id)\n exp_services.save_new_exploration(self.owner_id, e... | [
"0.83444124",
"0.6986759",
"0.69254297",
"0.69177365",
"0.691517",
"0.6869897",
"0.6720577",
"0.6713601",
"0.66981125",
"0.66006756",
"0.6554621",
"0.65180683",
"0.64985466",
"0.64182866",
"0.63768226",
"0.63526773",
"0.63440037",
"0.6338331",
"0.63351196",
"0.63039064",
"0.6... | 0.83655185 | 0 |
Test exploration rights handler for transfering ownership to the community. | def test_transfering_ownership_to_the_community(self) -> None:
# Owner creates an exploration.
self.login(self.OWNER_EMAIL)
exp_id = 'exp_id'
self.save_new_valid_exploration(
exp_id, self.owner_id, title='My Exploration',
end_state_name='END')
csrf_token =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rights_handler_returns_appropriate_rights(self) -> None:\n\n self.login(self.EDITOR_EMAIL)\n\n exp_id = exp_fetchers.get_new_exploration_id()\n self.save_new_valid_exploration(exp_id, self.editor_id)\n\n response = self.get_json(\n '%s/%s' % (feconf.USER_PERMISSIONS_... | [
"0.7446212",
"0.6717456",
"0.6692781",
"0.6383268",
"0.6360652",
"0.6355121",
"0.6195419",
"0.61333746",
"0.61286914",
"0.61131513",
"0.60740674",
"0.60313016",
"0.6018974",
"0.6018974",
"0.6018974",
"0.6018974",
"0.6018974",
"0.6018974",
"0.60047704",
"0.59999526",
"0.597364... | 0.78480726 | 0 |
Creates the mock explorations for testing. | def _create_explorations_for_tests(self) -> None:
self.save_new_valid_exploration(self.EXP_ID1, self.owner_id)
exploration = exp_fetchers.get_exploration_by_id(self.EXP_ID1)
exploration.add_states(['State A'])
exploration.states['State A'].update_interaction_id('TextInput')
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_http_mocks():\n\n httpretty.register_uri(httpretty.GET, node_addresses_site_format_url.format(site=badock_site.upper()),\n body=json.dumps([1, 2, 3]),\n content_type=\"application/json\")\n\n \"Mock for get status of individual device method\"\n ... | [
"0.6234879",
"0.62229043",
"0.6164496",
"0.6104529",
"0.6104529",
"0.5982421",
"0.5907663",
"0.57032084",
"0.57018274",
"0.56672794",
"0.5652063",
"0.5642819",
"0.56333107",
"0.5620874",
"0.5590473",
"0.5587758",
"0.5587758",
"0.5546803",
"0.54892206",
"0.548629",
"0.5461577"... | 0.61972696 | 2 |
Test that an error is returned when no image is uploaded. | def test_return_error_when_image_not_uploaded(self) -> None:
self.login(self.EDITOR_EMAIL)
csrf_token = self.get_new_csrf_token()
exp_id = exp_fetchers.get_new_exploration_id()
self.save_new_valid_exploration(exp_id, self.editor_id)
filename = 'image_file.svg'
filename... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_image(self):\n r = post(self.client, 'gallery.upload_async', {'file': ''},\n args=['image'])\n\n eq_(400, r.status_code)\n json_r = json.loads(r.content)\n eq_('error', json_r['status'])\n eq_('Could not upload your image.', json_r['message'])\n ... | [
"0.8044889",
"0.7993131",
"0.79339176",
"0.78576297",
"0.7846511",
"0.78177655",
"0.7796907",
"0.7793486",
"0.7702099",
"0.76475877",
"0.76217043",
"0.74928",
"0.74560153",
"0.74154854",
"0.73996806",
"0.73786753",
"0.7339936",
"0.7339936",
"0.7339936",
"0.7305127",
"0.726225... | 0.82330215 | 0 |
Get truncated name of room. | def truncated_name(self):
return self.name[:20] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def room_name(self):\n return self.get_room_name(full=True)",
"def get_room_name(self, full=True, verbose=False):\n assert sum([full, verbose]) <= 1\n if self.inherit_location and self.location_parent is None:\n return ''\n room = self.room\n if room is not None:\n ... | [
"0.7841587",
"0.71898514",
"0.669603",
"0.6563103",
"0.6479146",
"0.62845314",
"0.62493896",
"0.62106454",
"0.6193476",
"0.6186682",
"0.61380476",
"0.60981315",
"0.6079805",
"0.60592604",
"0.59655505",
"0.59553045",
"0.59553045",
"0.59553045",
"0.59553045",
"0.59553045",
"0.5... | 0.764985 | 1 |
Return True if all members have voted. | def all_voted(self) -> bool:
return all(m.has_voted(self) for m in self.room.active_members) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_voted(self, poker_round):\n return poker_round.votes.filter(member=self).exists()",
"def has_all_vote(voter):\n for x in voter:\n if x[2] == \"0\":\n return 0\n return 1",
"def get_user_has_voted(self, instance):\n request = self.context.get(\"request\")\n r... | [
"0.70589846",
"0.69051963",
"0.68253195",
"0.67727596",
"0.6763478",
"0.6553676",
"0.6517697",
"0.6268046",
"0.6242149",
"0.62127364",
"0.61798763",
"0.6115814",
"0.5994066",
"0.599158",
"0.5987208",
"0.59437877",
"0.58585435",
"0.5661093",
"0.56547815",
"0.5604266",
"0.54988... | 0.90314424 | 0 |
Get list of member votes. | def member_votes(self) -> list:
return [
(member, self.votes.filter(member=member).first())
for member in self.room.active_members
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def members_voted(self):\n return MembersVoted(self)",
"def get_votes_of_user(self, user):\n\n return user.votes.all()",
"def listvotes(self,irc,msgs,args,to):\n user = self._getUserID(to)\n nick = self._getNick(to)\n\n try:\n bancount = self.banvotes[user][\"votes... | [
"0.7518933",
"0.68336207",
"0.6805241",
"0.6612926",
"0.66100395",
"0.6296826",
"0.61328566",
"0.6019615",
"0.5966479",
"0.5944902",
"0.5934313",
"0.583669",
"0.58364826",
"0.5825043",
"0.57935387",
"0.56906915",
"0.5655804",
"0.5604382",
"0.5573281",
"0.5567726",
"0.55055285... | 0.81439185 | 0 |
Returns True if member is the only one who did not voted. | def is_last_one(self, poker_round):
members = poker_round.room.active_members
if poker_round.completed or members.count() == 1:
return False
who_voted = poker_round.votes.values('member_id')
qs = members.exclude(id__in=who_voted)
return qs.count() == 1 and qs.first(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_member(self, user):\n return len(list(filter(lambda member: member.id == user.id, self.members))) != 0",
"def is_victim():\n return False",
"def has_voter_vote(voter, index):\n return voter[index][2] != \"0\"",
"def all_voted(self) -> bool:\n return all(m.has_voted(self) for m i... | [
"0.6448492",
"0.63286984",
"0.6306951",
"0.6280934",
"0.62082464",
"0.6207174",
"0.61235374",
"0.6085158",
"0.6074181",
"0.6004879",
"0.5987503",
"0.5981274",
"0.59796625",
"0.5954167",
"0.5923794",
"0.58964664",
"0.5890099",
"0.58827096",
"0.58477366",
"0.5837798",
"0.582768... | 0.65666854 | 0 |
Returns the JSON string representation of ``list_dictionaries`` | def to_json_string(list_dictionaries):
if list_dictionaries is None:
list_dictionaries = []
return json.dumps(list_dictionaries) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json_string(list_dictionaries):\n if list_dictionaries is None:\n list_dictionaries = []\n return json.dumps(list_dictionaries)",
"def to_json_string(list_dictionaries):\n if not list_dictionaries or len(list_dictionaries) == 0:\n list_dictionaries = []\n ... | [
"0.8577293",
"0.84939504",
"0.8477001",
"0.84638065",
"0.84371275",
"0.8428776",
"0.837755",
"0.8372421",
"0.83562624",
"0.8356046",
"0.83555233",
"0.834473",
"0.83434147",
"0.8323647",
"0.83176965",
"0.83176965",
"0.83176965",
"0.8287692",
"0.8285658",
"0.8285658",
"0.828440... | 0.8564112 | 1 |
Return a list of instances based on a JSON file | def load_from_file(cls):
filename = cls.__name__ + ".json"
instances = []
try:
with open(filename, mode="r", encoding="utf-8") as f:
json_file = f.read()
except FileNotFoundError:
return instances
objs = cls.from_json_string(json_file)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_from_file(cls):\n try:\n with open(\"{}.json\".format(cls.__name__)) as json_file:\n ld = Base.from_json_string(json_file.read())\n except FileNotFoundError:\n return []\n instances = list(map((lambda d: cls.create(**d)), ld))\n return insta... | [
"0.8041945",
"0.7937604",
"0.7597872",
"0.75444657",
"0.7471199",
"0.7420681",
"0.73941517",
"0.7389501",
"0.73735195",
"0.73707104",
"0.73348105",
"0.7308403",
"0.72962034",
"0.72935313",
"0.7275416",
"0.72632426",
"0.72481894",
"0.7227158",
"0.72184837",
"0.72007453",
"0.71... | 0.77827 | 2 |
Initialize images with the same theta and scale. | def initialize_theta_scale(n_thetas, scales, verbose=False, **kwargs):
n_valid_links = len(
[k for k, v in kwargs['links'].items() if v is not None])
if len(kwargs['nodes']) == 1 or n_valid_links == 0:
return 0, scales[0] # return smallest scale
# theta initialization possibilities
thet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, imgs):\n self.imgs = imgs.transpose(2, 1, 0)",
"def _initialize_theta(self):\n if self.has_trained_once == False:\n self.has_trained_once = True\n r = np.sqrt(6.) / np.sqrt(self.num_features + self.num_classes + 1)\n theta_unroll = np.random.rand(... | [
"0.6053117",
"0.590865",
"0.58439225",
"0.5759958",
"0.57508534",
"0.5747333",
"0.5745441",
"0.5709478",
"0.56864375",
"0.56818795",
"0.5665284",
"0.5659195",
"0.56308544",
"0.5621143",
"0.56102836",
"0.5609064",
"0.560148",
"0.5579813",
"0.5578587",
"0.5563667",
"0.5562693",... | 0.0 | -1 |
Creates a confusion matrix labels is a onehot numpy.ndarray of shape (m, classes) containing the correct labels for each data point m is the number of data points classes is the number of classes logits is a onehot numpy.ndarray of shape (m, classes) containing the predicted labels | def create_confusion_matrix(labels, logits):
confusion = np.zeros((labels.shape[1], labels.shape[1]))
for row in range(labels.shape[0]):
pred = np.argmax(logits[row])
true = np.argmax(labels[row])
confusion[true][pred] += 1
return confusion | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_confusion_matrix(labels, logits):\n # print(labels.shape)\n classes = labels.shape[1]\n cm = np.zeros((classes, classes))\n # print(cm)\n for i in range(labels.shape[0]):\n x = np.where(labels[i] == 1)[0][0]\n y = np.where(logits[i] == 1)[0][0]\n # print(\"into loop ... | [
"0.79341245",
"0.78579724",
"0.7802847",
"0.7790832",
"0.77685744",
"0.7740264",
"0.7725706",
"0.7660016",
"0.7615867",
"0.7556979",
"0.7520211",
"0.748858",
"0.73605853",
"0.7342448",
"0.73075426",
"0.72731",
"0.72614217",
"0.7251024",
"0.7241007",
"0.72386336",
"0.72224146"... | 0.7904355 | 1 |
apply softmax fx > the `logits` and `labels` inputs of `tf.nn.softmax_cross_entropy_with_logits` are expected to be of shape (number of examples, num_classes). We have thus transposed ZL and Y. | def compute_cost(ZL, Y):
logits = tf.transpose(ZL)
labels = tf.transpose(Y)
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=logits,
labels=labels))
return cost | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax_cross_entropy_with_logits(logits, labels):\n\n ctx = tf.distribute.get_replica_context()\n assert ctx is not None, \"forward should be in replica context\"\n\n BC = tf.shape(logits)\n batch_size = BC[0]\n # Assuming logits are equally partitioned, thus this value is the same across all r... | [
"0.7161429",
"0.7099225",
"0.6954702",
"0.69403434",
"0.6823453",
"0.67923564",
"0.6757875",
"0.67220724",
"0.6681376",
"0.66728985",
"0.6617986",
"0.6589098",
"0.6572244",
"0.655878",
"0.65453464",
"0.65083885",
"0.6496172",
"0.64896846",
"0.6482955",
"0.6477848",
"0.6462647... | 0.66817886 | 8 |
Get the referrer from the request query and use urlparse to parse it into a url object | def parse_referer(r):
referrer = r.query.get("_referrer")
url = None
if referrer:
url_string = base64.b16decode(referrer.encode("utf8")).decode("utf8")
if url_string:
url = urlparse(url_string)
return url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_referrer(request: HttpRequest, default: str) -> str:\n url = request.headers.get(\"referer\")\n this_host = request.get_host()\n\n if default.startswith(\"https\"):\n default_url = default\n else:\n default_url = f\"https://{this_host}{default}\"\n\n if url is None:\n re... | [
"0.6760044",
"0.6480402",
"0.59408456",
"0.5839748",
"0.5810504",
"0.5798291",
"0.5745639",
"0.56467175",
"0.5645963",
"0.5505239",
"0.5499786",
"0.54757714",
"0.54757714",
"0.54757714",
"0.54757714",
"0.54757714",
"0.54757714",
"0.54757714",
"0.54757714",
"0.54757714",
"0.54... | 0.7692512 | 0 |
The material property of the engineering object. The material is key to the bill of materials. Components have specific materials such as eurofer or helium while assemblies may have homogenised materials for neutronics assessment. Returns MaterialData A class for the materials that contains access to the material data. | def material(self) -> MaterialData:
return self._material | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_material(self): # hack for Genie to know material\n return self.material",
"def material(self):\n return self.__material",
"def material(self, material):\n if material is not None:\n allowed_values = [\"Clear\", \"DkEdge\", \"Flat\", \"LegacyMatte\", \"LegacyMetal\", \"... | [
"0.7602083",
"0.752415",
"0.7141156",
"0.70494044",
"0.68272233",
"0.65873516",
"0.6584516",
"0.6470848",
"0.6431114",
"0.64283013",
"0.62812644",
"0.62812644",
"0.6270182",
"0.61938876",
"0.61419225",
"0.61353785",
"0.60802305",
"0.6059391",
"0.6035804",
"0.59189606",
"0.591... | 0.8182903 | 0 |
Setter for the material of the component. | def material(self, value: MaterialData):
self._material = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_material(self, material=None):\n self._material = elements[material]",
"def material(self, material):\n\n self._material = material",
"def material(self, material):\n\n self._material = material",
"def set_material( self, material ):\n self.material= material\n self... | [
"0.8176089",
"0.80296993",
"0.80296993",
"0.7643977",
"0.7480022",
"0.73519063",
"0.7216691",
"0.7155868",
"0.7021343",
"0.69840103",
"0.6963728",
"0.68810487",
"0.68635386",
"0.68054813",
"0.67146975",
"0.665029",
"0.6646588",
"0.6627769",
"0.6608318",
"0.65654165",
"0.65220... | 0.79075074 | 3 |
Returns a flat dict of components. | def flatten(self, flat: Optional[Dict[Optional[str], Any]] = None) -> dict:
if flat is None:
flat = {}
if self.ref in flat:
self.check_duplicate(self, flat[self.ref])
else:
flat[self.ref] = self
return flat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asdict(self):\n d = dict()\n try:\n if self.subcomponents:\n d = {key: value for key, value in self.__dict__.items()\n if key != \"subcomponents\"}\n d[\"subcomponents\"] = []\n for subcomponent in self.subcomponents:\n ... | [
"0.7151969",
"0.7045037",
"0.67460746",
"0.6629611",
"0.65273917",
"0.6213504",
"0.6211083",
"0.6078828",
"0.60421944",
"0.6017409",
"0.6010078",
"0.5947432",
"0.5936203",
"0.5898945",
"0.58851236",
"0.58745164",
"0.5795249",
"0.57828194",
"0.5769788",
"0.5746398",
"0.5743334... | 0.0 | -1 |
Creates a copy of the component. For the complex classess, using copy.deepcopy(x) did not work, therefore a inbuilt method was created. This function works by converting the class with to_dict copying that and then using the class factory to recreate it. Returns | def copy_part(self) -> Any:
skeleton = self.to_dict()
new_dict = copy.deepcopy(skeleton)
return self.create_class_from_data(self.ref, new_dict, self_copied=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __copy__(self):\n cls = self.__class__\n new = cls.__new__(cls)\n new.__dict__.update(self.__dict__)\n return new",
"def make_generic_copy(self, deeply=False):\n if deeply:\n kwargs = deepcopy(self.__dict__)\n else:\n kwargs = self.__dict__.copy()\n for ... | [
"0.7014609",
"0.66593236",
"0.66150665",
"0.6594698",
"0.6589773",
"0.6584389",
"0.65759563",
"0.6553931",
"0.6495988",
"0.6465681",
"0.6444551",
"0.63923484",
"0.6372276",
"0.6358997",
"0.6318979",
"0.6313401",
"0.63012093",
"0.62817156",
"0.627421",
"0.6272387",
"0.6248176"... | 0.72151864 | 0 |
Converts the component to a dictionary. This method uses super to call the to_dict from the BaseClass. | def to_dict(self, exclusions: list = []) -> dict:
component_dump = super().to_dict(exclusions=exclusions)
if self.ref in component_dump.keys():
return component_dump
else:
return {self.ref: component_dump} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n raise NotImplementedError()",
"def to_dict(self):\n raise NotImplementedError()",
"def to_dict(self):\n raise NotImplementedError()",
"def to_dict(self):\n raise NotImplementedError()",
"def to_dict(self):\n raise NotImplementedError",
"def _to_dict... | [
"0.7437277",
"0.7437277",
"0.7437277",
"0.7437277",
"0.742126",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0... | 0.0 | -1 |
Converts the component to a dictionary. This method uses super to call the to_dict from the BaseClass. | def to_dict(self, exclusions: list = ["master_register", "_sub_assembly"]) -> dict:
this_component_dump = super().to_dict(exclusions=exclusions)
dump = {self._ref: this_component_dump}
this_component_dump["children"] = {}
for ref, child in self._sub_assembly.items():
com... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n raise NotImplementedError()",
"def to_dict(self):\n raise NotImplementedError()",
"def to_dict(self):\n raise NotImplementedError()",
"def to_dict(self):\n raise NotImplementedError()",
"def to_dict(self):\n raise NotImplementedError",
"def _to_dict... | [
"0.7437277",
"0.7437277",
"0.7437277",
"0.7437277",
"0.742126",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0.74005604",
"0... | 0.0 | -1 |
Returns a component within the nested sub assembly based on a . delimited string. | def component_from_string(self, string: str) -> EngineeringObject:
component_list = string.split(".")
if (
component_list[0] == self.ref
and component_list[0] not in self._sub_assembly
):
component_list = component_list[1::]
component = self
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_string(cls, s: str) -> 'ComponentRef':\n\n components = s.split('.')\n return cls.from_tuple(components)",
"def import_component(component_name):\n name_parts = component_name.replace('-', '_').split('_')\n # Make the component name upper camel case\n component_name = ''.join([nam... | [
"0.5823985",
"0.57929045",
"0.553817",
"0.55247104",
"0.5440139",
"0.5419761",
"0.5410207",
"0.54036057",
"0.5274051",
"0.5268693",
"0.5233677",
"0.5229575",
"0.52019215",
"0.5179581",
"0.51336235",
"0.5072544",
"0.50631654",
"0.5054406",
"0.50354266",
"0.5029841",
"0.5023699... | 0.6862728 | 0 |
Returns a flat dict of components. Flattening the components is very useful as it allows an object to be called by its reference no matter where it sits in the hierarchy. | def flatten(self, flat: Optional[Dict[Optional[str], Any]] = None) -> dict:
flat = super().flatten(flat=flat)
for comp in self._sub_assembly.values():
comp.flatten(flat=flat)
return flat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asdict(self):\n d = dict()\n try:\n if self.subcomponents:\n d = {key: value for key, value in self.__dict__.items()\n if key != \"subcomponents\"}\n d[\"subcomponents\"] = []\n for subcomponent in self.subcomponents:\n ... | [
"0.6744936",
"0.6208608",
"0.62074614",
"0.6071365",
"0.5966009",
"0.57179123",
"0.5715607",
"0.5685831",
"0.56856114",
"0.562784",
"0.56226426",
"0.5561702",
"0.55298007",
"0.5525953",
"0.5498721",
"0.5441757",
"0.5385209",
"0.5365362",
"0.5341455",
"0.53273803",
"0.5321098"... | 0.61878026 | 3 |
Create the object from its ElementTree representation | def from_etree(elem):
assert elem.tag in ["input", "output", "clock"], elem.tag
# Create the port
port = Port(
type=PortType.from_string(elem.tag),
name=elem.attrib["name"],
width=int(elem.get("num_pins", "1")),
cls=elem.get("port_class", None),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_xml(cls, element):\r\n # pylint: disable=E0213\r\n raise NotImplementedError",
"def from_etree(self, e):\n pass",
"def from_etree(cls, etree_element):\n ins = SaltElement.from_etree(etree_element)\n # TODO: this looks dangerous, ask Stackoverflow about it!\n i... | [
"0.727927",
"0.6989618",
"0.6970165",
"0.68595123",
"0.6784163",
"0.67505634",
"0.66978854",
"0.6640748",
"0.6571381",
"0.65133727",
"0.63535905",
"0.6340806",
"0.6332607",
"0.6327367",
"0.62799823",
"0.6278529",
"0.62699324",
"0.62391025",
"0.6169704",
"0.6161739",
"0.614821... | 0.57727176 | 67 |
Create the object from its ElementTree representation | def from_etree(elem):
assert elem.tag == "pb_type", elem.tag
# Create the pb_type
name = elem.attrib["name"]
num_pb = int(elem.get("num_pb", "1"))
cls = elem.get("class", None)
pb_type = PbType(name, num_pb, cls)
# BLIF model
pb_type.blif_model = elem.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_xml(cls, element):\r\n # pylint: disable=E0213\r\n raise NotImplementedError",
"def from_etree(self, e):\n pass",
"def from_etree(cls, etree_element):\n ins = SaltElement.from_etree(etree_element)\n # TODO: this looks dangerous, ask Stackoverflow about it!\n i... | [
"0.7280497",
"0.6988717",
"0.69708544",
"0.6860045",
"0.6785062",
"0.6750725",
"0.66981095",
"0.6640667",
"0.657217",
"0.6512239",
"0.6353101",
"0.63415223",
"0.63323843",
"0.63264877",
"0.62797916",
"0.6278607",
"0.6270366",
"0.62372106",
"0.6171165",
"0.61619663",
"0.614944... | 0.5811425 | 63 |
Create the object from its ElementTree representation | def from_etree(elem):
assert elem.tag in ["mode", "pb_type"], elem.tag
# This element refers to a pb_type so it is the default mode
if elem.tag == "pb_type":
name = "default"
else:
name = elem.attrib["name"]
# Create the mode
mode = Mode(name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_xml(cls, element):\r\n # pylint: disable=E0213\r\n raise NotImplementedError",
"def from_etree(self, e):\n pass",
"def from_etree(cls, etree_element):\n ins = SaltElement.from_etree(etree_element)\n # TODO: this looks dangerous, ask Stackoverflow about it!\n i... | [
"0.7280497",
"0.6988717",
"0.69708544",
"0.6860045",
"0.6785062",
"0.6750725",
"0.66981095",
"0.6640667",
"0.657217",
"0.6512239",
"0.6353101",
"0.63415223",
"0.63323843",
"0.63264877",
"0.62797916",
"0.6278607",
"0.6270366",
"0.62372106",
"0.61619663",
"0.61494493",
"0.61413... | 0.6171165 | 18 |
Perform attention on the input. | def forward(self, x, x_mask):
x = self.linear(x).squeeze(dim=-1)
x = x.masked_fill(x_mask, -float('inf'))
return F.softmax(x, dim=-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, input, device):\n x = self.emb(input, device)\n\n output = self.attention(x)\n\n return output",
"def forward(self, input, device):\n x = self.emb(input, device)\n\n output = self.attention(x)\n\n return output",
"def forward(self, input):\n # ... | [
"0.7247096",
"0.7247096",
"0.6998395",
"0.6789944",
"0.67773753",
"0.6590291",
"0.6390543",
"0.63516617",
"0.63398963",
"0.62275964",
"0.6215518",
"0.6177292",
"0.6145714",
"0.61412656",
"0.6104532",
"0.6067147",
"0.60609764",
"0.6042576",
"0.60230523",
"0.6001583",
"0.597219... | 0.0 | -1 |
Define if a date is in seven days before today | def at_last_7_days(self, d_search:datetime):
d_current = self.Simulated_current_time if self.Simulating else datetime.fromtimestamp(time())
result = ((d_current - timedelta(days=7, minutes=self.TimeWindow)) <= d_search)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def over_weekend(date_for_check):\n if date_for_check.weekday() > 4:\n return date_for_check + timedelta(2)\n else:\n return date_for_check",
"def is_weekday() -> bool:\n return datetime.datetime.today().weekday() < 5",
"def isDateInPast(self):\n return self < datetime.today()",
... | [
"0.67121595",
"0.6700557",
"0.64815503",
"0.63500017",
"0.6299925",
"0.6243278",
"0.61895734",
"0.6140865",
"0.61350346",
"0.6088888",
"0.6069412",
"0.6048918",
"0.6027852",
"0.60223466",
"0.6006579",
"0.59758687",
"0.59614533",
"0.594118",
"0.5940076",
"0.5915457",
"0.590034... | 0.6771344 | 0 |
Define if a date and todey are in same month moment, for example, monthend | def at_same_month_moment(self, d_search:datetime):
d_current = self.Simulated_current_time if self.Simulating else datetime.fromtimestamp(time())
m_current = d_current.day / ((d_current + timedelta(days=31)).replace(day=1) - timedelta(days=1)).day
m_search = d_search.day / ((d_search + timedelta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_end_of_month(self):\n return monthrange(self.year, self.month)[1] == self.day",
"def isEndOfMonth(target_date):\n return target_date.day == daysInMonth(target_date.year, target_date.month)",
"def is_same_day(date1, date2):\r\n if date1.year == date2.year and date1.month == date2.month and d... | [
"0.7016083",
"0.6869564",
"0.64339954",
"0.6200446",
"0.61873084",
"0.6158907",
"0.6087025",
"0.6072191",
"0.60126686",
"0.60080993",
"0.5976931",
"0.59463835",
"0.5916119",
"0.5841594",
"0.58396983",
"0.5829917",
"0.5824435",
"0.58198506",
"0.5815848",
"0.5793667",
"0.578987... | 0.66151214 | 2 |
Normalize this URL by removing hash and adding domain | def normalize(seed_url, link):
link, _ = urlparse.urldefrag(link) # remove hash to avoid duplicates
return urlparse.urljoin(seed_url, link) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalize_url(self, url):\n ret = url.strip()\n if '#' in ret:\n idx = ret.index('#')\n ret = ret[:idx]\n return ret",
"def normalize_urls(self):\n find_url = re.compile(r\"^(http://|www|[^\\.]+)\\.([^\\.]+\\.)*[^\\.]{2,}\")\n dummy = \"_URL_\"\n self.normalize(find_u... | [
"0.7344546",
"0.7166163",
"0.7006991",
"0.69580984",
"0.690802",
"0.68839604",
"0.6831754",
"0.67929935",
"0.6791107",
"0.66742176",
"0.6596886",
"0.65465593",
"0.65207285",
"0.6470089",
"0.6467647",
"0.6463131",
"0.6382214",
"0.63085437",
"0.62405694",
"0.62386787",
"0.62296... | 0.69773215 | 3 |
Return True if both URL of belong to same domain | def same_domain(url1, url2):
return urlparse.urlparse(url1).netloc == urlparse.urlparse(url2).netloc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_origin(url1, url2):\r\n p1, p2 = urlparse.urlparse(url1), urlparse.urlparse(url2)\r\n return p1[0:2] == p2[0:2]",
"def _domain_differs(self, href: str) -> bool:\n target = utils.get_domain(href)\n if not target:\n return False\n\n origin = utils.get_domain(s... | [
"0.8021199",
"0.76079667",
"0.74853146",
"0.73234147",
"0.7273513",
"0.72324485",
"0.7229251",
"0.70006794",
"0.6787721",
"0.67413217",
"0.66652757",
"0.649411",
"0.6407472",
"0.63815856",
"0.6344938",
"0.6336518",
"0.63324785",
"0.62413645",
"0.623688",
"0.62327784",
"0.6221... | 0.8256989 | 0 |
Return True if asset is audio, otherwise False | def isaudio(self):
return self.media_type == Photos.PHAssetMediaTypeAudio | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_audio_file(self):\n return self.ext is not None",
"def has_audio(self):\n return bool(self.element.children('audio'))",
"def hasAudio(self):\n return _yarp.IAudioVisualStream_hasAudio(self)",
"def is_audio_only(self) -> bool:\n return self.paknum in self.audio_nums",
"def... | [
"0.78796875",
"0.759046",
"0.739414",
"0.72817934",
"0.72206736",
"0.71337074",
"0.69082683",
"0.6902499",
"0.66542107",
"0.66097677",
"0.64634496",
"0.6432059",
"0.64094394",
"0.6355921",
"0.62689286",
"0.61527145",
"0.6143374",
"0.6140739",
"0.6095429",
"0.608938",
"0.60452... | 0.85121274 | 0 |
Check to see if a PHAsset has adjustment data associated with it Returns False if no adjustments, True if any adjustments | def hasadjustments(self):
# reference: https://developer.apple.com/documentation/photokit/phassetresource/1623988-assetresourcesforasset?language=objc
adjustment_resources = Photos.PHAssetResource.assetResourcesForAsset_(
self.phasset
)
return any(
(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_adjustment(self) -> bool:\n return self._adjustment.has_adjustment",
"def has_adjustment(self, deep: bool) -> bool:\n if self._adjustment.has_adjustment:\n return True\n if deep:\n for sequence_zone in self._zones:\n if sequence_zone.adjustment.ha... | [
"0.7357805",
"0.67782956",
"0.6256062",
"0.60591334",
"0.5933326",
"0.5773419",
"0.55503803",
"0.5516092",
"0.546611",
"0.546611",
"0.53895557",
"0.538024",
"0.53782254",
"0.53469914",
"0.53067243",
"0.53000015",
"0.5239824",
"0.5227436",
"0.52234423",
"0.5223436",
"0.5217667... | 0.82438844 | 0 |
media type such as image or video | def media_type(self):
return self.phasset.mediaType() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"media_type\")",
"def media_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"media_type\")",
"def media_type(self) -> str:\n return self._media.type",
"def mime_type(self):\n if isinstance(self.media... | [
"0.7864678",
"0.7864678",
"0.7700589",
"0.74648255",
"0.7312091",
"0.72853315",
"0.7107441",
"0.71044546",
"0.7033918",
"0.698995",
"0.69193393",
"0.67897856",
"0.6788859",
"0.67716134",
"0.67345524",
"0.66669405",
"0.662951",
"0.6485935",
"0.6460461",
"0.6459909",
"0.6442831... | 0.76989627 | 3 |
return True if asset is streamed video, otherwise False | def streamed(self):
return bool(self.media_subtypes & Photos.PHAssetMediaSubtypeVideoStreamed) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasVideo(self):\n return _yarp.IAudioVisualStream_hasVideo(self)",
"def ismovie(self):\n return self.media_type == Photos.PHAssetMediaTypeVideo",
"def is_streaming(self):\n return self._is_streaming",
"def is_streaming(self):\n return self._attrs.get('is_streaming')",
"def i... | [
"0.6995981",
"0.6814713",
"0.6763877",
"0.6707754",
"0.65525484",
"0.6533745",
"0.64125675",
"0.638301",
"0.636864",
"0.63443166",
"0.6331184",
"0.6285873",
"0.62687624",
"0.6201904",
"0.6194722",
"0.6165238",
"0.6163285",
"0.61586857",
"0.6153918",
"0.6121376",
"0.61200434",... | 0.8425704 | 0 |
date asset was created | def date(self):
return self.phasset.creationDate() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_date(self) -> datetime:\n pass",
"def create_date(self):\n return self._create_date",
"def create_date(self):\n return self._create_date",
"def dateCreated(self):\n return self._date_created",
"def dateCreated(self):\n return self._date_created",
"def creat... | [
"0.75865436",
"0.7325982",
"0.7325982",
"0.7316839",
"0.7316839",
"0.7264174",
"0.7264174",
"0.7218448",
"0.7184469",
"0.7176801",
"0.7176801",
"0.7158942",
"0.7158942",
"0.7158942",
"0.71287924",
"0.7111854",
"0.7111854",
"0.71078837",
"0.71078837",
"0.7064197",
"0.6961156",... | 0.82703924 | 0 |
duration of the asset | def duration(self):
return self.phasset.duration() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration(self):\n pass",
"def duration(self):\n return 0",
"def duration(self) -> int:\n return 0",
"def duration(self) -> int:\n return 0",
"def getDuration(self):\r\n return self.duration",
"def duration(self):\n raise NotImplementedError()",
"def Duratio... | [
"0.7900659",
"0.7512469",
"0.73802745",
"0.73802745",
"0.733672",
"0.7298152",
"0.72960013",
"0.71843773",
"0.7178632",
"0.71638346",
"0.7140869",
"0.7073098",
"0.70682454",
"0.70682454",
"0.70682454",
"0.70682454",
"0.70682454",
"0.70682454",
"0.70682454",
"0.70682454",
"0.6... | 0.8067646 | 0 |
Initialize ImageManager instance. Requests authorization to use the Photos library if authorization has not already been granted. | def __init__(self):
# # pylint: disable=no-member
# options = Photos.PHContentEditingInputRequestOptions.alloc().init()
# options.setNetworkAccessAllowed_(network_access)
# check authorization status
auth_status = self.request_authorization()
if auth_status != Photos.PHA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n\t\tself._lock = allocate_lock()\n\t\tself._loaded = {}\n\t\tPictureManager.MANAGER = self",
"def __init__(self, endpoint):\n self.http_client = http.HTTPClient(endpoint)\n self.images = ImageManager(self.http_client)",
"def gallery_init(self):\n\n # create galaxy json... | [
"0.65788215",
"0.6250764",
"0.62111175",
"0.5821956",
"0.5786822",
"0.57735544",
"0.5597913",
"0.53816634",
"0.5347488",
"0.5332395",
"0.5266874",
"0.5186553",
"0.5161019",
"0.5144744",
"0.5144386",
"0.514148",
"0.5135499",
"0.5129282",
"0.5129057",
"0.5109736",
"0.51031625",... | 0.7617216 | 0 |
Constructs a sparse tensor from diagonal elements | def from_diagonal_data(cls, diags, **kw):
raise NotImplementedError("{}.{} is an abstract method".format(cls.__name__, 'from_diagonal_data'))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeSparse(matrix):\n n = matrix[0].size\n elements = []\n for i in range(n):\n for j in range(n):\n if matrix[i][j] != 0 :\n temp = MatrixElement(i, j, matrix[i][j])\n elements.append(temp)\n return SparseMatrix(n, elements)",
"def to_sparse(self) ... | [
"0.71286297",
"0.69821835",
"0.6980197",
"0.6963367",
"0.68879396",
"0.6844072",
"0.66758513",
"0.6656346",
"0.6595684",
"0.65768725",
"0.65699154",
"0.6561318",
"0.6448363",
"0.63336134",
"0.6283622",
"0.6255943",
"0.624649",
"0.6240174",
"0.6223871",
"0.61904895",
"0.618914... | 0.0 | -1 |
Returns a reshaped version of the tensor | def reshape(self, newshape):
raise NotImplementedError("{}.{} is an abstract method".format(type(self).__name__, 'reshape')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten_(t: Tensor) -> Tensor:\n return reshape_(t, (-1,))",
"def reconstruct(tensor, ref, keep):\n ref_shape = ref.get_shape().as_list()\n tensor_shape = tensor.get_shape().as_list()\n ref_stop = len(ref_shape) - keep\n tensor_start = len(tensor_shape) - keep\n pre_shape = [ref_shape[i] or tf.shape(... | [
"0.6886117",
"0.6819913",
"0.6754834",
"0.67428476",
"0.664679",
"0.6638537",
"0.6636383",
"0.65990746",
"0.657842",
"0.64762485",
"0.6473056",
"0.64380157",
"0.64380157",
"0.6426005",
"0.64142966",
"0.64027965",
"0.64027965",
"0.6396279",
"0.63902926",
"0.63533175",
"0.63236... | 0.0 | -1 |
Returns a resized version of the tensor | def resize(self, newsize):
raise NotImplementedError("{}.{} is an abstract method".format(type(self).__name__, 'resize')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize_tensor(tensor, new_shape):\n channels = tensor.shape[2]\n new_tensor = np.zeros(shape=(channels,) + new_shape)\n new_tensor=new_tensor.T\n for i in range(0, channels):\n new_tensor[:,:,i] = cv2.resize(tensor[:,:,i],dsize=new_shape)\n\n return new_tensor",
"def resize(self, newsiz... | [
"0.70640177",
"0.6789755",
"0.6545721",
"0.6444097",
"0.62672484",
"0.6199387",
"0.6191359",
"0.6149601",
"0.6060995",
"0.6051774",
"0.60096574",
"0.60094607",
"0.59890395",
"0.59811705",
"0.59073734",
"0.5905691",
"0.5890146",
"0.58884025",
"0.5880832",
"0.58737284",
"0.5871... | 0.0 | -1 |
Concatenates multiple SparseArrays along the specified axis | def concatenate(self, *others, axis=0):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concatenate(self, *others, axis=0):\n\n others = [ScipySparseArray(o) if not isinstance(o, ScipySparseArray) else o for o in others]\n\n # all_inds = [self.block_inds[1]] + [other.block_inds[1] for other in others]\n # all_vals = [self.block_vals] + [other.block_vals for other in others]\n... | [
"0.7048842",
"0.69636965",
"0.68118834",
"0.6773024",
"0.6660125",
"0.6466741",
"0.6461943",
"0.6416555",
"0.6414209",
"0.63827235",
"0.6339147",
"0.6314679",
"0.62241185",
"0.62241185",
"0.62241185",
"0.62241185",
"0.61186594",
"0.60995203",
"0.6086192",
"0.6067421",
"0.6047... | 0.6545324 | 5 |
Takes a tensor outer product of self and other | def outer(self, other):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensor_product(self, other, prod_sys=None):\n prod_graph = nx.product.tensor_product(self, other)\n # not populating ?\n if prod_sys is None:\n if self.states.mutants or other.states.mutants:\n mutable = True\n else:\n mutable = False\n prod_sys = LabeledDiGr... | [
"0.7139719",
"0.7082187",
"0.7075761",
"0.70214415",
"0.6947958",
"0.6936021",
"0.6868355",
"0.6863047",
"0.68461215",
"0.6837505",
"0.68114567",
"0.67791593",
"0.67398715",
"0.6695765",
"0.6664075",
"0.6652168",
"0.6646726",
"0.6634784",
"0.6628184",
"0.66238475",
"0.6618133... | 0.62983495 | 36 |
Returns a resized version of the tensor | def resize(self, newsize):
# we'll simply construct a totally new tensor by dropping any indices which are out of bounds
# in any coordinate
# otherwise the multidimensional indices are clean so we'll just use those
if len(newsize) != self.ndim:
raise ValueError("unclear how ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize_tensor(tensor, new_shape):\n channels = tensor.shape[2]\n new_tensor = np.zeros(shape=(channels,) + new_shape)\n new_tensor=new_tensor.T\n for i in range(0, channels):\n new_tensor[:,:,i] = cv2.resize(tensor[:,:,i],dsize=new_shape)\n\n return new_tensor",
"def resize(self, sample... | [
"0.7063698",
"0.65455085",
"0.6443413",
"0.62672824",
"0.61992186",
"0.619119",
"0.61482024",
"0.60611475",
"0.6050995",
"0.6008975",
"0.6008085",
"0.59881395",
"0.59807336",
"0.5906817",
"0.5905844",
"0.58900344",
"0.588784",
"0.5880278",
"0.5874543",
"0.5870209",
"0.5868066... | 0.67892313 | 1 |
Concatenates multiple arrays along the specified axis This is relatively inefficient in terms of not tracking indices throughout | def concatenate(self, *others, axis=0):
others = [ScipySparseArray(o) if not isinstance(o, ScipySparseArray) else o for o in others]
# all_inds = [self.block_inds[1]] + [other.block_inds[1] for other in others]
# all_vals = [self.block_vals] + [other.block_vals for other in others]
# a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concatenate(*arrays, axis=-1):\n\n # numpy.concatenate doesn't do broadcasting, so we need to do it explicitly\n return np.concatenate(\n broadcast(*arrays, ignore_axis=axis),\n axis=axis\n )",
"def concatenate(tensors, axis=0):\n\n concat_size = sum(t.shape[axis] for t in tensors)\... | [
"0.75929165",
"0.73072726",
"0.7253876",
"0.72232574",
"0.7156976",
"0.70290744",
"0.6994221",
"0.68814486",
"0.6875705",
"0.67039895",
"0.6695241",
"0.66141224",
"0.6609015",
"0.6569384",
"0.6552831",
"0.6552831",
"0.6552831",
"0.6552831",
"0.6533251",
"0.64894897",
"0.64612... | 0.6487476 | 20 |
Returns a reshaped version of the tensor | def reshape(self, newshape):
import tensorflow as tf
new = tf.sparse.reshape(self.tensor, newshape)
return type(self)(new) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten_(t: Tensor) -> Tensor:\n return reshape_(t, (-1,))",
"def reconstruct(tensor, ref, keep):\n ref_shape = ref.get_shape().as_list()\n tensor_shape = tensor.get_shape().as_list()\n ref_stop = len(ref_shape) - keep\n tensor_start = len(tensor_shape) - keep\n pre_shape = [ref_shape[i] or tf.shape(... | [
"0.6886117",
"0.6819913",
"0.6754834",
"0.67428476",
"0.664679",
"0.6638537",
"0.6636383",
"0.657842",
"0.64762485",
"0.6473056",
"0.64380157",
"0.64380157",
"0.6426005",
"0.64142966",
"0.64027965",
"0.64027965",
"0.6396279",
"0.63902926",
"0.63533175",
"0.6323691",
"0.630772... | 0.65990746 | 7 |
Protocols supported by the front end http/https | def protocols(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "protocols") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supported_protocol(request):\n return request.param",
"def list_protocols(self):\n return [\"http\", \"https\", \"tcp\", \"udp\", \"ftp\", \"smtp\"]",
"def ssl(self):\n return self.scheme in ssl_protocols",
"def protocol():\r\n return \"https\" if settings.SESSION_COOKIE_SECURE else \... | [
"0.72861916",
"0.7098096",
"0.667333",
"0.6548012",
"0.6337179",
"0.63213027",
"0.62771654",
"0.6239741",
"0.6219716",
"0.59678406",
"0.59678406",
"0.59678406",
"0.59678406",
"0.5958101",
"0.5940476",
"0.5911151",
"0.58924055",
"0.58829504",
"0.5838803",
"0.5823534",
"0.58198... | 0.6010422 | 9 |
Resource provider client id | def client_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "client_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_id(self) -> str:\n return pulumi.get(self, \"client_id\")",
"def client_id(self) -> str:\n return pulumi.get(self, \"client_id\")",
"def client_id(self) -> str:\n return pulumi.get(self, \"client_id\")",
"def client_id(self) -> str:\n return pulumi.get(self, \"client_id... | [
"0.77033746",
"0.77033746",
"0.77033746",
"0.77033746",
"0.77033746",
"0.77033746",
"0.77033746",
"0.77033746",
"0.77033746",
"0.77033746",
"0.77033746",
"0.77029073",
"0.77029073",
"0.77029073",
"0.77029073",
"0.77029073",
"0.77029073",
"0.77029073",
"0.77029073",
"0.77029073"... | 0.0 | -1 |
Client Secret needed for OAuth | def client_secret(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "client_secret") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_secret(self):\n return self._client_secret",
"def _get_client_secret(self):\n return self._client_secret",
"def client_secret(self) -> str:\n return self._client_secret",
"def client_secret(self) -> str:\n return pulumi.get(self, \"client_secret\")",
"def client_secre... | [
"0.80158967",
"0.80097264",
"0.7844281",
"0.78254783",
"0.78248096",
"0.78243196",
"0.78243196",
"0.78243196",
"0.78243196",
"0.78243196",
"0.78243196",
"0.78243196",
"0.78243196",
"0.78243196",
"0.78243196",
"0.78243196",
"0.78243196",
"0.78243196",
"0.78243196",
"0.78243196",... | 0.7211059 | 80 |
Name of the parameter in the connection provider's oauthSettings | def parameter_name(self) -> Optional[str]:
return pulumi.get(self, "parameter_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consumer_secret_setting_name(self) -> Optional[str]:\n return pulumi.get(self, \"consumer_secret_setting_name\")",
"def consumer_secret_setting_name(self) -> Optional[str]:\n return pulumi.get(self, \"consumer_secret_setting_name\")",
"def consumer_secret_setting_name(self) -> Optional[str]:\... | [
"0.6730077",
"0.6729896",
"0.6729896",
"0.6729375",
"0.6729375",
"0.6729375",
"0.6729375",
"0.6729375",
"0.6729323",
"0.6700254",
"0.6700254",
"0.6700254",
"0.67001635",
"0.67001635",
"0.670016",
"0.670016",
"0.670016",
"0.670016",
"0.670016",
"0.6699782",
"0.66996837",
"0.... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.