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 |
|---|---|---|---|---|---|---|
Test to confirm that we are copying the email address from a found contact | def test_copy_email(self):
self.new_contact.save_contact()
Contact.copy_email("0712345678")
self.assertEqual(self.new_contact.email, pyperclip.paste())
# Below we are simply stating that if the module being tested is running we collect the test methods and execute them. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_copy_email(self):\n self.new_contact.save_contact()\n Contact.copy_email(254719702373)\n\n self.assertEqual(self.new_contact.email, pyperclip.paste())",
"def test_copy_email(self):\n\n\n self.new_credential.save_credential()\n Credential.copy_email(\"Chris\")\n\n ... | [
"0.83343744",
"0.7601879",
"0.6900183",
"0.6812739",
"0.6561415",
"0.6468561",
"0.6455767",
"0.64429235",
"0.6356866",
"0.6320259",
"0.62970245",
"0.62465024",
"0.6236399",
"0.6219535",
"0.6197941",
"0.6197167",
"0.6179059",
"0.6178218",
"0.61507607",
"0.6110539",
"0.60834587... | 0.7637972 | 1 |
undraw the arrow and draw a new one for the current values of angle and velocity. | def redraw(self):
self.arrow.undraw()
pt2 = Point(self.vel*cos(self.angle), self.vel*sin(self.angle))
self.arrow = Line(Point(0,0), pt2).draw(self.win)
self.arrow.setArrow("last")
self.arrow.setWidth(3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redraw(self): \r\n\r\n self.arrow.undraw() \r\n pt2 = Point(self.vel*cos(self.angle), self.vel*sin(self.angle))\r\n self.arrow = Line(Point(0,0), pt2).draw(self.win) \r\n self.arrow.setArrow('last')\r\n self.arrow.setWidth(3)",
"def get_quiver_arrows(self):\n dif_x =... | [
"0.77334005",
"0.65644336",
"0.6287359",
"0.6213265",
"0.61974335",
"0.6153086",
"0.5998839",
"0.5908423",
"0.5908423",
"0.59016716",
"0.5891196",
"0.58837223",
"0.5872633",
"0.5846972",
"0.58233887",
"0.5820985",
"0.5800393",
"0.57933944",
"0.5788004",
"0.5777631",
"0.575778... | 0.7731802 | 1 |
return the current x coordinate of the shot's center | def getX(self):
return self.proj.getX() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_x_position(self):\n return self.rect.x",
"def _get_x(self):\n return self.position.x",
"def centerx(self):\n return self.left + self.width / 2",
"def get_x_position(self):\n return self.actual_coordinates[0]",
"def get_x(self):\n return self.posX",
"def get_x(se... | [
"0.8170842",
"0.79965454",
"0.7950228",
"0.78056806",
"0.7790852",
"0.7761694",
"0.7672446",
"0.7604114",
"0.75850916",
"0.7479844",
"0.74445426",
"0.7407246",
"0.74059206",
"0.7337172",
"0.7303859",
"0.727023",
"0.7150097",
"0.71477306",
"0.71369725",
"0.71034396",
"0.704470... | 0.65873474 | 50 |
return the current y coordinate of the shot's center | def getY(self):
return self.proj.getY() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_y_position(self): \n return self.rect.y",
"def _get_y(self):\n return self.position.y",
"def y(self):\r\n return self.position.y",
"def get_y_position(self):\n return self.actual_coordinates[1]",
"def get_y(self):\n\t\treturn self._collision_rect.y + 25",
"def get_y... | [
"0.7937652",
"0.7730214",
"0.76843345",
"0.76624733",
"0.7574403",
"0.7466444",
"0.7450869",
"0.7435911",
"0.7431255",
"0.73885834",
"0.7357961",
"0.73478985",
"0.7332926",
"0.7316668",
"0.7212563",
"0.71838593",
"0.7172444",
"0.7161277",
"0.7153415",
"0.7126375",
"0.71033573... | 0.68248624 | 30 |
Returns the expected test configurations for the default datastore defined in the Test Config as dbaas_datastore. | def expected_default_datastore_configs():
default_datastore = CONFIG.get('dbaas_datastore', None)
datastore_test_configs = CONFIG.get(default_datastore, {})
return datastore_test_configs.get("configurations", {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expected_instance_datastore_configs(instance_id):\n instance = instance_info.dbaas.instances.get(instance_id)\n datastore_type = instance.datastore['type']\n datastore_test_configs = CONFIG.get(datastore_type, {})\n return datastore_test_configs.get(\"configurations\", {})",
"def ... | [
"0.778061",
"0.63270247",
"0.6234825",
"0.6132579",
"0.5991797",
"0.5882307",
"0.58755237",
"0.58285725",
"0.58114976",
"0.5798612",
"0.5786422",
"0.5751315",
"0.57506293",
"0.57444537",
"0.5743285",
"0.5723634",
"0.5672421",
"0.56719977",
"0.566023",
"0.5647218",
"0.5636959"... | 0.9044427 | 0 |
urljoin replaces base_url's path if endpoints start with with / | def test_endpoints_urljoin(self):
for endpoint in self.client.user.endpoints.values():
assert not endpoint.startswith('/') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urljoin(base, *path):\n return reduce(_join, path, base)",
"def urljoin(cls, base, end):\n\n if base and not base.endswith('/'):\n base = base + '/'\n return urljoin(base, str(end))",
"def urljoin(cls, base, end):\r\n if base and not base.endswith(\"/\"):\r\n b... | [
"0.82374907",
"0.8162815",
"0.81212187",
"0.79887116",
"0.7946308",
"0.79049665",
"0.78104043",
"0.76742834",
"0.7556705",
"0.7537379",
"0.7511424",
"0.7474246",
"0.74705774",
"0.74505424",
"0.7418653",
"0.7378205",
"0.737034",
"0.7370095",
"0.7353267",
"0.72845113",
"0.72163... | 0.63997936 | 44 |
Make sure the name field is correct | def test_name_field(self):
field = self.record.find('field[@name=\'name\']')
self.assertEqual(field.text, 'GUH-ADT', 'Incorrect Name Field') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_name(self):\n\t\tpass",
"def test_should_name_field(self):\n self.assertIn(\"name\", self.fields)",
"def test_reserved_name(self):\n with self.assertRaises(ValidationError):\n field_name_validator('_id')",
"def test_nonreserved_name(self):\n try:\n field_... | [
"0.80483794",
"0.76999706",
"0.75463855",
"0.7521705",
"0.7409506",
"0.7372538",
"0.7320282",
"0.71896374",
"0.7162188",
"0.71472406",
"0.71424186",
"0.7107738",
"0.7054699",
"0.70347553",
"0.7023951",
"0.69843197",
"0.6968333",
"0.6964454",
"0.69297624",
"0.6903072",
"0.6881... | 0.73358804 | 6 |
Fetch organization details from the API. | def fetch_details_from_api(self, org_names=None):
logger.debug('Fetching org details from API...')
details = {}
if org_names is None:
org_names = self._all_page_names(without_namespace=True)
for org in org_names:
code = self._code_by_name(org)
if code ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_organization(organization):\n return fetch_json(organization_url, organization)",
"def test_get_organization(self):\n pass",
"def test_retrieve_l_organization(self):\n pass",
"def test_get_organization_from_api_key(self):\n pass",
"def get_organization(self, id: str) -> di... | [
"0.82742935",
"0.7215253",
"0.71555364",
"0.71401477",
"0.70368063",
"0.6870949",
"0.6747574",
"0.67154455",
"0.6695743",
"0.66767126",
"0.66356957",
"0.6629043",
"0.65509844",
"0.6486175",
"0.64638036",
"0.64497346",
"0.64293605",
"0.6352869",
"0.6321579",
"0.62873846",
"0.6... | 0.7452373 | 1 |
Retrieves the total amount of cart items for a given cart. | def total_amount(self):
total_amount = 0
for cart_item in self.get_cart_items():
total_amount += cart_item.total_price
return total_amount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_total_of_cart(session_id):\n cart_items = CartItem.objects.filter(cart_id=session_id)\n cart_total_list = [cart_item.total() for cart_item in cart_items]\n return sum(cart_total_list)",
"def cart_subtotal(request):\n cart_total = decimal.Decimal('0.00')\n cart_products = get_ca... | [
"0.78944373",
"0.7428659",
"0.74166524",
"0.7226727",
"0.6956555",
"0.66739833",
"0.6626357",
"0.6577171",
"0.65215605",
"0.6469818",
"0.64654446",
"0.644342",
"0.6432942",
"0.6390239",
"0.6378628",
"0.62492317",
"0.6200687",
"0.6190806",
"0.61329013",
"0.6089602",
"0.6088345... | 0.7810109 | 1 |
Yield successive chunks from iterable of length size. | def chunker(iterable, size):
for i in range(0, len(iterable), size):
yield iterable[i:i + size] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(iterator, size):\n for index in range(0, len(iterator), size):\n yield iterator[index:index + size]",
"def iter_chunks(iterable, size):\n it = iter(iterable)\n while True:\n chunk = tuple(itertools.islice(it, size))\n if len(chunk) == 0:\n break\n yield ... | [
"0.8773219",
"0.8520928",
"0.8467599",
"0.841324",
"0.8410151",
"0.8247795",
"0.8213483",
"0.8210779",
"0.810383",
"0.8072789",
"0.8064006",
"0.80410075",
"0.7970535",
"0.79383165",
"0.79333675",
"0.7927991",
"0.7896404",
"0.7862617",
"0.77980405",
"0.7778066",
"0.7762152",
... | 0.8812423 | 2 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in xrange(0, len(l), n):
yield l[i:i+n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.80388075",
"0.7924573",
"0.79226995",
"0.788447",
"0.7877021",
"0.781505",
"0.7764907",
"0.77549165",
"0.7743869",
"0.7731126",
"0.77281487",
"0.77241385",
"0.77024275",
"0.7688614",
"0.7688614",
"0.7663561",
"0.7656419",
"0.76552874",
"0.76552874",
"0.76452404",
"0.764524... | 0.0 | -1 |
Validates if each elements contain the previous and their are equal | def verify_chain(blockchain):
for index, block in enumerate(blockchain):
if index == 0:
continue
if block.previous_hash != hash_block(blockchain[index - 1]):
return False
if not Verification.valid_proof(block.transactions[:-1], block.previous... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allsame(xs):\n assert len(xs) > 0\n return all(x == xs[0] for x in xs[1:])",
"def check():\r\n for a in l:\r\n for b in l:\r\n assert not(b in comes_after[a] and a in comes_after[b])",
"def all_same(items):\n \n return all(x == items[0] for x in items)",
"def ... | [
"0.67529505",
"0.6488937",
"0.642974",
"0.6424669",
"0.6401508",
"0.63954824",
"0.63903385",
"0.6365632",
"0.6273884",
"0.62532556",
"0.6236504",
"0.61716396",
"0.612882",
"0.6124451",
"0.61181426",
"0.61021763",
"0.61009073",
"0.6067597",
"0.60629946",
"0.60506934",
"0.60454... | 0.0 | -1 |
Probability of an random event theta given current state s. | def theta_given_s(theta, q):
if q == 0:
return .3333
else:
if theta == 0:
return 0.25
elif theta == 1:
return 0.25
else:
return 0.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _starting_prob(self, s):\n return self._starting_state_distribution.pdf(s)",
"def compute_probability_of_state(state):\n p = compute_log_probability_of_text(state[\"text\"], state[\"char_to_ix\"], \n state[\"frequency_statistics\"], state[\"transition_matrix\"... | [
"0.67219484",
"0.6633048",
"0.6455988",
"0.64483786",
"0.6309092",
"0.6300978",
"0.62985826",
"0.6290623",
"0.62792915",
"0.62534195",
"0.62534195",
"0.62534195",
"0.62534195",
"0.62534195",
"0.6252587",
"0.62439626",
"0.623991",
"0.62372935",
"0.62270015",
"0.62248063",
"0.6... | 0.579814 | 59 |
Convert a URL to IDN notation | def _convert_to_idn(url):
# this function should only be called with a unicode string
# strategy: if the host cannot be encoded in ascii, then
# it'll be necessary to encode it in idn form
parts = list(urllib.parse.urlsplit(url))
try:
parts[1].encode('ascii')
except UnicodeEncodeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_to_doi(url):\n return url[url.index(prefix):].rstrip(url_suffix).rstrip(INT_URL_SUFFIX)",
"def iri2uri(uri): \r\n if isinstance(uri ,unicode):\r\n (scheme, authority, path, query, fragment) = urlparse.urlsplit(uri)\r\n authority = authority.encode('idna')\r\n # For each charact... | [
"0.7021145",
"0.65356356",
"0.6437324",
"0.6412383",
"0.6395479",
"0.6311997",
"0.61961514",
"0.6158848",
"0.61555415",
"0.6119481",
"0.6110008",
"0.61025923",
"0.60946435",
"0.6066466",
"0.6030167",
"0.6021279",
"0.6020139",
"0.6007491",
"0.60052556",
"0.5983566",
"0.5945938... | 0.8388875 | 0 |
Return comments tree by entity or root comment | async def get_comments_tree(request):
comment_id = request.match_info.get('comment_id')
if comment_id:
# valitation was in route (\d+)
comment_id = int(comment_id)
tree = CommentsTreeDAO.create_by_parent(comment_id)
else:
entity_type = request.match_info.get('entity_type')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_by_entity(entity_type, entity_id, only_roots=False):\n\n return CommentsTreeDAO(entity_type=entity_type, entity_id=entity_id,\n only_roots=only_roots)",
"async def fetch(self, conn, page=None, fdt=None, tdt=None):\n\n sql = \"\"\"SELECT\n ... | [
"0.65842324",
"0.63664144",
"0.63229674",
"0.6065913",
"0.6050549",
"0.6045573",
"0.60114443",
"0.5975179",
"0.5946544",
"0.58939505",
"0.587878",
"0.58299065",
"0.58249295",
"0.5780401",
"0.57469136",
"0.5738545",
"0.57361287",
"0.57340264",
"0.5731925",
"0.5722351",
"0.5712... | 0.7140785 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.80388075",
"0.7924573",
"0.79226995",
"0.788447",
"0.7877021",
"0.781505",
"0.7764907",
"0.77549165",
"0.7743869",
"0.7731126",
"0.77281487",
"0.77241385",
"0.77024275",
"0.7688614",
"0.7688614",
"0.7663561",
"0.7656419",
"0.76552874",
"0.76552874",
"0.76452404",
"0.764524... | 0.7448291 | 79 |
This fn prints and plots the confusion matrix. Normalization can be applied by setting 'normalize=True'. | def plot_confusion_matrix(cm, classes, normalize=False, 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=45)
plt.yticks(tick_marks, class... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.79747516",
"0.7972701",
"0.7916397",
"0.78010035",
"0.77952605",
"0.7757487",
"0.7756975",
"0.775108",
"0.77393556",
"0.7737718",
"0.7737082",
"0.7719532",
"0.7714036",
"0.7700674",
"0.7696943",
"0.7685643",
"0.76693594",
"0.76639557",
"0.766282",
"0.766219",
"0.7659201",
... | 0.767042 | 16 |
Returns True if the coord is in Part or any of its children. May be a better idea to call the get_part_containing function instead though, which returns the lowest level Part that contains the coord (none of its children contain the coord, but the Part does) | def contains(self, coord):
# print(coord, self.position, self.size)
return (0 <= coord[0] - self.position[0] < self.size[0] and
0 <= coord[1] - self.position[1] < self.size[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_part_containing(self, coord):\n # print('in', self)\n for k, child in self.children.items():\n # print('try', k, child)\n if child.ignore:\n # print('ignore', k, child)\n continue\n if child.contains(coord):\n # pri... | [
"0.75447255",
"0.6645123",
"0.66114485",
"0.6500257",
"0.6442654",
"0.64163774",
"0.6345653",
"0.63166255",
"0.61932963",
"0.6176176",
"0.6176057",
"0.61623186",
"0.61566186",
"0.6145891",
"0.6117253",
"0.60773057",
"0.60773057",
"0.6069949",
"0.6057143",
"0.6003461",
"0.5990... | 0.7134822 | 1 |
Returns a duplicate of the profile instance. | def duplicate(self):
duplicate = Profile()
for i in self.__dict__:
if type(getattr(self, i)) is dict:
setattr(duplicate, i, getattr(self, i).copy())
else:
setattr(duplicate, i, getattr(self, i))
return duplicate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return Population(self)",
"def copy(self):\n return self.__class__(dict(self))",
"def copy(self):\n return self.__class__(self)",
"def copy(self):\n return self.__class__(self)",
"def strip_copy(self):\n return strip_profiles_copy(self)",
"def get_full... | [
"0.65038234",
"0.6457992",
"0.6320341",
"0.6320341",
"0.6286995",
"0.62803096",
"0.6278374",
"0.62589824",
"0.6257265",
"0.62398297",
"0.62353045",
"0.6209959",
"0.6207495",
"0.61983556",
"0.61954135",
"0.61781174",
"0.61590487",
"0.6154005",
"0.6154005",
"0.6154005",
"0.6138... | 0.81918967 | 0 |
Writes a dictionary to an xml file in the form of etc. attribute_name>The name of the dictonary attribute to write. xmlwriter>The xml writer to write with. write_empty>A bool of whether to write empty values to the xml file. Default is don't write them. | def write_dict_to_xml(self, attribute_name, xmlwriter, write_empty=False):
if attribute_name in ("IllegalCharacters", "Months"):
write_empty = True
dictionary = getattr(self, attribute_name)
xmlwriter.WriteStartElement(attribute_name)
for key in dictionary:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writeDictToXMLFile(outfile, target, dict):\n targetStr = \"\\t\\t<Target>%s</Target>\\n\" % (escape(target),)\n for key in dict.keys():\n outfile.write('\\t<AVU>\\n')\n outfile.write(targetStr)\n outfile.write(\"\\t\\t<Attribute>%s</Attribute>\\n\" % (escape(key),) )\n outfile... | [
"0.6729531",
"0.65415585",
"0.6262941",
"0.6016264",
"0.5983849",
"0.5939113",
"0.58700234",
"0.58539236",
"0.5813194",
"0.5684836",
"0.56377923",
"0.56335074",
"0.5623472",
"0.56098765",
"0.55822074",
"0.5524061",
"0.5433924",
"0.5403624",
"0.5400973",
"0.53912425",
"0.53563... | 0.80239266 | 0 |
This function returns the softmax value for the given input | def softmax(X):
if len(X) > 1:
expo = np.exp(X)
expo_sum = np.sum(np.exp(X))
ret = expo/expo_sum
print(f'The softmax result on the given input {ret}')
return ret
else:
raise ValueError("Sorry, lenght of the list should be more than one") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x):\n #pass # TODO: Compute and return softmax(x)\n return np.exp(x) / np.sum(np.exp(x), axis=0)",
"def softmax(x):\n \"\"\"\"\"\"\n return exp(x) / sum(exp(x), axis=0)",
"def softmax(x): \n e_x = np.exp(x - np.max(x)) \n return e_x / e_x.sum()",
"def softmax(x)... | [
"0.85517555",
"0.85172",
"0.85039085",
"0.85021806",
"0.8486158",
"0.8471101",
"0.84642345",
"0.84226495",
"0.84178317",
"0.84178317",
"0.84136945",
"0.84076935",
"0.83944535",
"0.8392644",
"0.8392644",
"0.8392644",
"0.8392644",
"0.8392644",
"0.8392644",
"0.8392644",
"0.83926... | 0.0 | -1 |
This function returns the softmax derivative value for the given input | def softmax_derivative(x):
der = derivative(softmax,x,dx=1e-9)
return der | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax_derivative(Z):\n\treturn None",
"def softmax(x):\n e_x = np.exp(x - np.max(x))\n return e_x / e_x.sum(axis=0) # only difference",
"def softmax(x):\r\n e_x = np.exp(x - np.max(x))\r\n return e_x / e_x.sum(axis=0) # only difference\r",
"def softmax(x):\r\n e_x = np.exp(x - np... | [
"0.78823423",
"0.7861486",
"0.7818649",
"0.78063107",
"0.7801125",
"0.7801125",
"0.7801125",
"0.7801125",
"0.77747434",
"0.7771414",
"0.7755482",
"0.7754241",
"0.76962405",
"0.7687193",
"0.7682934",
"0.76776224",
"0.76399696",
"0.7632133",
"0.7632133",
"0.76276577",
"0.762613... | 0.8873611 | 0 |
Construct a layernorm module in the TF style (epsilon inside the square root). | def __init__(self, hidden_size, eps=1e-12):
super(LayerNorm, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.bias = nn.Parameter(torch.zeros(hidden_size))
self.variance_epsilon = eps
self.bias.data.zero_()
self.weight.data.fill_(1.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verhulst(nb_init, t0, tf, eps, methode, gamma, K) :\n f=lambda y,t : gamma*y*(1-y/K)\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n return Y",
"def malthusiens(nb_init, t0, tf, eps, methode, gamma ) :\n\n f=lambda y, t : gamma*y\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n ... | [
"0.62754345",
"0.60140204",
"0.5792275",
"0.57416606",
"0.55366963",
"0.55194634",
"0.54221153",
"0.5412391",
"0.5388891",
"0.53688395",
"0.5351537",
"0.5287469",
"0.5258017",
"0.5232318",
"0.5227428",
"0.52260095",
"0.5220578",
"0.5220438",
"0.5192999",
"0.5192457",
"0.51924... | 0.0 | -1 |
Return categorical dqn loss. | def _compute_dqn_loss(self, samples: Dict[str, np.ndarray], gamma: float) -> torch.Tensor:
device = self.device # for shortening the following lines
state = torch.FloatTensor(samples["obs"]).permute(0,3,1,2).to(device)
next_state = torch.FloatTensor(samples["next_obs"]).permute(0,3,1,2).to(devi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_loss(self):\n return categorical_cross_entropy.get_loss(loss_key=self.loss_key,\n output_name=self.args.output_name)",
"def loss_function(self, probs, labels):\n return tf.keras.losses.sparse_categorical_crossentropy(labels, probs)",
"def c... | [
"0.68605304",
"0.67149806",
"0.6686219",
"0.6592555",
"0.64848787",
"0.6320027",
"0.6248912",
"0.6234563",
"0.62179315",
"0.62094903",
"0.6202983",
"0.6202983",
"0.6185646",
"0.6164023",
"0.6157712",
"0.61265653",
"0.61004794",
"0.6093955",
"0.6060213",
"0.6043495",
"0.602176... | 0.0 | -1 |
Given a complex folder path with multiple embedded slashes, check that the code tries to make the folder and returns the path with a single trailing '/' appended only if required | def test_make_output_folder_path_with_multi_slashes(self, mock_makedirs):
mock_makedirs.return_value = True
test_object = Maic()
path = '/c/o/m/p/l/e/x_p/a/t/h/'
expected_result = path
self.assertEqual(expected_result,
test_object.make_output_folder(outpu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_folder_path(folder_path):\n if folder_path[-1] != '/':\n folder_path += '/'\n\n return folder_path",
"def test_fix_path(self):\n\n expected = \"hello\" + PyFunceble.directory_separator + \"world\" + PyFunceble.directory_separator # pylint: disable=line-too-long\n actual = D... | [
"0.7249269",
"0.6797798",
"0.6691372",
"0.6648862",
"0.6491748",
"0.6453401",
"0.6421338",
"0.63004524",
"0.62997335",
"0.6285595",
"0.62594306",
"0.6247562",
"0.62401736",
"0.62397146",
"0.6239207",
"0.6219014",
"0.62041944",
"0.61918926",
"0.6191478",
"0.61791414",
"0.61717... | 0.6893744 | 1 |
Returns the base name of the specified file name, of the specified type. A bare=True keyword argument specifies that prefixes and suffixes shouldn't be applied. | def built_file_basename(self, name, type=None, **kw):
if not kw.get('bare'):
if type == self.EXECUTABLE:
name = name + self._exe
elif type == self.STATIC_LIB:
name = self.lib_ + name + self._lib
elif type == self.SHARED_LIB:
name = self.dll_ + name + self._dll
return na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_fullname(basename, _type=None):\n return '{}.{}'.format(basename, extensions.get(_type, None))",
"def base_name(self):\n return \".\".join(posixpath.basename(self.file_name).split(\".\")[:-1])",
"def basefname(fname):\n return os.path.splitext(fname.split(\"\\\\\")[-1])[0]",
"def base_n... | [
"0.7135192",
"0.6425883",
"0.63058126",
"0.62789595",
"0.61583006",
"0.615667",
"0.61490166",
"0.60626936",
"0.59788233",
"0.59788233",
"0.59788233",
"0.59684837",
"0.5965139",
"0.59572744",
"0.5927984",
"0.59277415",
"0.5919521",
"0.59044087",
"0.5902169",
"0.5895096",
"0.58... | 0.76263374 | 0 |
Returns an appropriate TestGyp instance for a specified GYP format. | def TestGyp(*args, **kw):
format = kw.pop('format', os.environ.get('TESTGYP_FORMAT'))
if format != 'ninja':
raise Exception("unknown format %r" % format)
return TestGypNinja(*args, **kw) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_driver(browser_name):\n if browser_name == BaseConstants.CHROME:\n options = webdriver.ChromeOptions()\n options.add_argument('headless')\n if BaseConstants.HEADLESS_MODE:\n return webdriver.Chrome(options=options)\n else:\n return webdriver.Chrome()\... | [
"0.48283198",
"0.4679778",
"0.46405205",
"0.46262017",
"0.4596164",
"0.4575837",
"0.45242107",
"0.45190325",
"0.449273",
"0.44799712",
"0.44797117",
"0.44374356",
"0.4432995",
"0.43943155",
"0.4385032",
"0.43449232",
"0.43261662",
"0.43182468",
"0.43172392",
"0.4313307",
"0.4... | 0.7641839 | 0 |
Control whether mosek should wait for an available license if no license is available. putlicensewait(self,licwait_) | def putlicensewait(self,licwait_):
res = __library__.MSK_XX_putlicensewait(self.__nativep,licwait_)
if res != 0:
raise Error(rescode(res),Env.getcodedesc(rescode(res))[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putlicensewait(self,licwait_): # 3\n res = self.__obj.putlicensewait(licwait_)\n if res != 0:\n raise Error(rescode(res),\"\")",
"def license(self, license):\n\n self._license = license",
"def accept_license():\r\n msg, status = \"\", True\r\n\r\n try:\r\n sleep(5)\r\n ... | [
"0.8608505",
"0.61256635",
"0.6123673",
"0.5970834",
"0.5939061",
"0.58548045",
"0.5833694",
"0.5822022",
"0.57427907",
"0.5724147",
"0.56733525",
"0.5650425",
"0.5636824",
"0.5599726",
"0.5547277",
"0.5536273",
"0.5516888",
"0.5485797",
"0.5453408",
"0.5441463",
"0.5418717",... | 0.84320354 | 1 |
Computes the inner product of two vectors. dot(self,n_,x_,y_) | def dot(self,n_,x_,y_):
_x_minlength = (n_)
if (n_) > 0 and x_ is not None and len(x_) != (n_):
raise ValueError("Array argument x is not long enough: Is %d, expected %d" % (len(x_),(n_)))
if x_ is None:
raise ValueError("Argument x cannot be None")
if x_ is None:
raise ValueError("Arg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vec_dot(x, y):\r\n return sum(a * b for a, b in zip(x, y))",
"def vector_dot(x, y):\n\n if(len(x) != len(y)):\n raise ValueError(\"vector lengths differ\")\n else:\n # return x1*y1+x2*y2+...xn*yn\n return sum([x[i] * y[i] for i in range(len(x))])",
"def dot(x,y):\n\treturn sum([... | [
"0.7724258",
"0.7549486",
"0.7496103",
"0.7352206",
"0.732253",
"0.73218113",
"0.73188835",
"0.72784954",
"0.7264976",
"0.7238966",
"0.72267455",
"0.72038215",
"0.7178318",
"0.7174941",
"0.7155059",
"0.71423924",
"0.7082818",
"0.70600927",
"0.70422834",
"0.7040143",
"0.703703... | 0.67537916 | 42 |
Performs a rankk update of a symmetric matrix. syrk(self,uplo_,trans_,n_,k_,alpha_,a_,beta_,c_) | def syrk(self,uplo_,trans_,n_,k_,alpha_,a_,beta_,c_):
_a_minlength = ((n_) * (k_))
if ((n_) * (k_)) > 0 and a_ is not None and len(a_) != ((n_) * (k_)):
raise ValueError("Array argument a is not long enough: Is %d, expected %d" % (len(a_),((n_) * (k_))))
if a_ is None:
raise ValueError("Argument... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def syrk(self,uplo_,trans_,n_,k_,alpha_,a,beta_,c): # 3\n if not isinstance(uplo_,uplo): raise TypeError(\"Argument uplo has wrong type\")\n if not isinstance(trans_,transpose): raise TypeError(\"Argument trans has wrong type\")\n if a is None: raise TypeError(\"Invalid type for argument a\")\n ... | [
"0.7740319",
"0.5345925",
"0.5307275",
"0.5296073",
"0.51972955",
"0.51492083",
"0.51247174",
"0.5056189",
"0.50554264",
"0.5031491",
"0.5031491",
"0.50260574",
"0.50148124",
"0.49368647",
"0.4909689",
"0.48912278",
"0.4885631",
"0.48802838",
"0.47982484",
"0.4793419",
"0.478... | 0.6716742 | 1 |
Appends semidefinite variables to the problem. appendbarvars(self,dim_) | def appendbarvars(self,dim_):
num_ = None
if num_ is None:
num_ = len(dim_)
elif num_ != len(dim_):
raise IndexError("Inconsistent length of array dim")
if dim_ is None:
raise ValueError("Argument dim cannot be None")
if dim_ is None:
raise ValueError("Argument dim may not be... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appendbarvars(self,dim): # 3\n num_ = None\n if num_ is None:\n num_ = len(dim)\n elif num_ != len(dim):\n raise IndexError(\"Inconsistent length of array dim\")\n if num_ is None: num_ = 0\n if dim is None: raise TypeError(\"Invalid type for argument dim\")\n if dim... | [
"0.8159918",
"0.55441445",
"0.53684646",
"0.533822",
"0.5304417",
"0.5274865",
"0.51826805",
"0.51651216",
"0.5160413",
"0.5143895",
"0.5126579",
"0.49842018",
"0.49332213",
"0.4922936",
"0.48779106",
"0.47955328",
"0.47735283",
"0.47632688",
"0.47520563",
"0.47460842",
"0.47... | 0.80840147 | 1 |
Changes the bounds for one constraint. chgconbound(self,i_,lower_,finite_,value_) | def chgconbound(self,i_,lower_,finite_,value_):
res = __library__.MSK_XX_chgconbound(self.__nativep,i_,lower_,finite_,value_)
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chgconbound(self,i_,lower_,finite_,value_): # 3\n res = self.__obj.chgconbound(i_,lower_,finite_,value_)\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def chgbound(self,accmode_,i_,lower_,finite_,value_): # 3\n if not isinstance(accmode... | [
"0.9179256",
"0.7916872",
"0.7376792",
"0.7195413",
"0.6016417",
"0.6004763",
"0.5817389",
"0.5724509",
"0.5707932",
"0.56736284",
"0.5642968",
"0.5613745",
"0.5549648",
"0.5543372",
"0.55391896",
"0.5501184",
"0.5480884",
"0.5466385",
"0.5455747",
"0.54376006",
"0.543686",
... | 0.8795833 | 1 |
Obtains a sequence of columns from the coefficient matrix. getacolslice(self,first_,last_,ptrb_,ptre_,sub_,val_) | def getacolslice(self,first_,last_,ptrb_,ptre_,sub_,val_):
maxnumnz_ = self.getacolslicenumnz((first_),(last_))
_ptrb_minlength = ((last_) - (first_))
if ((last_) - (first_)) > 0 and ptrb_ is not None and len(ptrb_) != ((last_) - (first_)):
raise ValueError("Array argument ptrb is not long enough: Is ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putacolslice(self,first_,last_,ptrb_,ptre_,asub_,aval_):\n if ptrb_ is None:\n raise ValueError(\"Argument ptrb cannot be None\")\n if ptrb_ is None:\n raise ValueError(\"Argument ptrb may not be None\")\n if isinstance(ptrb_, numpy.ndarray) and ptrb_.dtype is numpy.dtype(numpy.int64) and pt... | [
"0.68298435",
"0.68189096",
"0.6633351",
"0.6410343",
"0.635861",
"0.62143683",
"0.59577066",
"0.58845204",
"0.5850808",
"0.5840428",
"0.5830795",
"0.5818751",
"0.5787353",
"0.5729822",
"0.57094395",
"0.5652637",
"0.5626832",
"0.5602785",
"0.557522",
"0.55677515",
"0.5536629"... | 0.8195238 | 0 |
Obtains all objective coefficients. getc(self,c_) | def getc(self,c_):
_c_minlength = self.getnumvar()
if self.getnumvar() > 0 and c_ is not None and len(c_) != self.getnumvar():
raise ValueError("Array argument c is not long enough: Is %d, expected %d" % (len(c_),self.getnumvar()))
if isinstance(c_,numpy.ndarray) and not c_.flags.writeable:
rais... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coefficients(self) :\n return self.__coefficients",
"def coefficients(self) :\n raise NotImplementedError",
"def coefficients(self):\r\n return self.coef_['x']",
"def coefficients(self):\n return self._coefficients",
"def coefficients(self):\n return self._coefficient... | [
"0.65427005",
"0.63974696",
"0.63769525",
"0.635677",
"0.635677",
"0.625591",
"0.62489706",
"0.6245763",
"0.6245763",
"0.61773825",
"0.61445075",
"0.612955",
"0.6082035",
"0.60051066",
"0.5921834",
"0.5798229",
"0.57925135",
"0.5790028",
"0.57677597",
"0.5748355",
"0.56996524... | 0.61323375 | 11 |
Obtains the fixed term in the objective. getcfix(self) | def getcfix(self):
cfix_ = ctypes.c_double()
res = __library__.MSK_XX_getcfix(self.__nativep,ctypes.byref(cfix_))
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
cfix_ = cfix_.value
_cfix_return_value = cfix_
return (_cfix_return_value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getcfix(self): # 3\n res,resargs = self.__obj.getcfix()\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n _cfix_return_value = resargs\n return _cfix_return_value",
"def getCF(self):\r\n return self.lEq;",
"def CFL(self):\n ... | [
"0.7102011",
"0.69387436",
"0.61814743",
"0.61706793",
"0.6118419",
"0.6102831",
"0.60178024",
"0.59100634",
"0.58950984",
"0.5895022",
"0.5848309",
"0.58352464",
"0.5788822",
"0.5725575",
"0.57214016",
"0.56842697",
"0.56441844",
"0.56353074",
"0.56272084",
"0.56272084",
"0.... | 0.723974 | 0 |
Obtains the maximum number variables allowed. getmaxnumvar(self) | def getmaxnumvar(self):
maxnumvar_ = ctypes.c_int32()
res = __library__.MSK_XX_getmaxnumvar(self.__nativep,ctypes.byref(maxnumvar_))
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
maxnumvar_ = maxnumvar_.value
_maxnumvar_return_value = maxnumvar_
return (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getmaxnumvar(self): # 3\n res,resargs = self.__obj.getmaxnumvar()\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n _maxnumvar_return_value = resargs\n return _maxnumvar_return_value",
"def getmaxnumbarvar(self): # 3\n res,resargs ... | [
"0.91340536",
"0.8637792",
"0.7974361",
"0.7505648",
"0.7296605",
"0.7150658",
"0.7150658",
"0.70268613",
"0.698536",
"0.6970442",
"0.6931399",
"0.69260097",
"0.6923727",
"0.6923727",
"0.68803716",
"0.6879021",
"0.6849884",
"0.68469465",
"0.6821696",
"0.6783697",
"0.6712363",... | 0.8318064 | 2 |
Obtains the name of a semidefinite variable. getbarvarname(self,i_) | def getbarvarname(self,i_):
sizename_ = (1 + self.getbarvarnamelen((i_)))
name_ = (ctypes.c_char * (sizename_))()
res = __library__.MSK_XX_getbarvarname(self.__nativep,i_,sizename_,name_)
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
_name_retval = name_.val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getbarvarname(self,i_): # 3\n sizename_ = (1 + self.getbarvarnamelen((i_)))\n arr_name = array.array(\"b\",[0]*((sizename_)))\n memview_arr_name = memoryview(arr_name)\n res,resargs = self.__obj.getbarvarname(i_,sizename_,memview_arr_name)\n if res != 0:\n result,msg = self.__ge... | [
"0.83525527",
"0.7066876",
"0.70244217",
"0.6815771",
"0.6767695",
"0.6751615",
"0.6699136",
"0.6654075",
"0.660367",
"0.6567873",
"0.65562636",
"0.652688",
"0.63431066",
"0.6170237",
"0.61540467",
"0.6131156",
"0.5982232",
"0.59685725",
"0.592272",
"0.59037554",
"0.5895002",... | 0.8312654 | 1 |
Sets the name of a constraint. putconname(self,i_,name_) | def putconname(self,i_,name_):
if isinstance(name_,unicode):
name_ = name_.encode("utf-8",errors="replace")
res = __library__.MSK_XX_putconname(self.__nativep,i_,name_)
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putconname(self,i_,name_): # 3\n res = self.__obj.putconname(i_,name_)\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def putconename(self,j_,name_): # 3\n res = self.__obj.putconename(j_,name_)\n if res != 0:\n result,msg = ... | [
"0.8193894",
"0.7109492",
"0.6670976",
"0.66550237",
"0.6557067",
"0.6499532",
"0.64980155",
"0.6484204",
"0.6475017",
"0.6475017",
"0.64716566",
"0.64716566",
"0.64716566",
"0.64716566",
"0.64716566",
"0.64367193",
"0.64367193",
"0.64250505",
"0.64250505",
"0.64250505",
"0.6... | 0.7829893 | 1 |
Sets the name of a variable. putvarname(self,j_,name_) | def putvarname(self,j_,name_):
if isinstance(name_,unicode):
name_ = name_.encode("utf-8",errors="replace")
res = __library__.MSK_XX_putvarname(self.__nativep,j_,name_)
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putvarname(self,j_,name_): # 3\n res = self.__obj.putvarname(j_,name_)\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def putbarvarname(self,j_,name_): # 3\n res = self.__obj.putbarvarname(j_,name_)\n if res != 0:\n result,ms... | [
"0.8883954",
"0.7846457",
"0.7583609",
"0.7371796",
"0.6804934",
"0.6749491",
"0.6718",
"0.6678017",
"0.6662674",
"0.66056114",
"0.66056114",
"0.6533437",
"0.65012705",
"0.65012705",
"0.6494305",
"0.64568096",
"0.64568096",
"0.6420372",
"0.64115626",
"0.64104736",
"0.6387735"... | 0.8425244 | 1 |
Sets the name of a cone. putconename(self,j_,name_) | def putconename(self,j_,name_):
if isinstance(name_,unicode):
name_ = name_.encode("utf-8",errors="replace")
res = __library__.MSK_XX_putconename(self.__nativep,j_,name_)
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putconename(self,j_,name_): # 3\n res = self.__obj.putconename(j_,name_)\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def putconname(self,i_,name_): # 3\n res = self.__obj.putconname(i_,name_)\n if res != 0:\n result,msg = ... | [
"0.8515966",
"0.77436495",
"0.7510013",
"0.6582177",
"0.6530854",
"0.6465643",
"0.64578557",
"0.64150274",
"0.63634545",
"0.63573754",
"0.63573754",
"0.6346879",
"0.6346033",
"0.6333818",
"0.6333818",
"0.6333818",
"0.6333818",
"0.6326524",
"0.6326524",
"0.6326524",
"0.6326524... | 0.7865969 | 1 |
Sets the name of a semidefinite variable. putbarvarname(self,j_,name_) | def putbarvarname(self,j_,name_):
if isinstance(name_,unicode):
name_ = name_.encode("utf-8",errors="replace")
res = __library__.MSK_XX_putbarvarname(self.__nativep,j_,name_)
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putbarvarname(self,j_,name_): # 3\n res = self.__obj.putbarvarname(j_,name_)\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def putvarname(self,j_,name_): # 3\n res = self.__obj.putvarname(j_,name_)\n if res != 0:\n result,ms... | [
"0.8725043",
"0.78685296",
"0.73790705",
"0.63185453",
"0.62304795",
"0.61820215",
"0.6175833",
"0.60793555",
"0.60779697",
"0.6025984",
"0.5947061",
"0.5932117",
"0.58367765",
"0.58295",
"0.58150184",
"0.5744822",
"0.57223016",
"0.5708944",
"0.5708944",
"0.57083535",
"0.5683... | 0.83028346 | 1 |
Obtains the number of cones. getnumcone(self) | def getnumcone(self):
numcone_ = ctypes.c_int32()
res = __library__.MSK_XX_getnumcone(self.__nativep,ctypes.byref(numcone_))
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
numcone_ = numcone_.value
_numcone_return_value = numcone_
return (_numcone_return_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getnumcone(self): # 3\n res,resargs = self.__obj.getnumcone()\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n _numcone_return_value = resargs\n return _numcone_return_value",
"def num_cones(self):\n return self._shape_count(_sf... | [
"0.9106919",
"0.81965643",
"0.7543785",
"0.7437887",
"0.69181544",
"0.67456555",
"0.67095584",
"0.65884423",
"0.65678185",
"0.6465956",
"0.64427835",
"0.64152044",
"0.6377484",
"0.6377402",
"0.63385695",
"0.62976825",
"0.62972224",
"0.62365496",
"0.62121636",
"0.6148317",
"0.... | 0.8135312 | 2 |
Obtains the number of members in a cone. getnumconemem(self,k_) | def getnumconemem(self,k_):
nummem_ = ctypes.c_int32()
res = __library__.MSK_XX_getnumconemem(self.__nativep,k_,ctypes.byref(nummem_))
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
nummem_ = nummem_.value
_nummem_return_value = nummem_
return (_nummem_re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getnumconemem(self,k_): # 3\n res,resargs = self.__obj.getnumconemem(k_)\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n _nummem_return_value = resargs\n return _nummem_return_value",
"def getconeinfo(self,k_):\n ct_ = ctypes.c_int... | [
"0.87193775",
"0.65474",
"0.63329744",
"0.6301218",
"0.6256797",
"0.60519123",
"0.60468775",
"0.6043543",
"0.6008538",
"0.6007757",
"0.5989896",
"0.5959924",
"0.59045166",
"0.58832043",
"0.5873087",
"0.5872675",
"0.58704096",
"0.58684206",
"0.5850679",
"0.5849518",
"0.5849518... | 0.79310596 | 1 |
Obtains maximum number of symmetric matrix variables for which space is currently preallocated. getmaxnumbarvar(self) | def getmaxnumbarvar(self):
maxnumbarvar_ = ctypes.c_int32()
res = __library__.MSK_XX_getmaxnumbarvar(self.__nativep,ctypes.byref(maxnumbarvar_))
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
maxnumbarvar_ = maxnumbarvar_.value
_maxnumbarvar_return_value = ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getmaxnumbarvar(self): # 3\n res,resargs = self.__obj.getmaxnumbarvar()\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n _maxnumbarvar_return_value = resargs\n return _maxnumbarvar_return_value",
"def getmaxnumvar(self): # 3\n res... | [
"0.8353058",
"0.7625918",
"0.7178526",
"0.7173014",
"0.6900788",
"0.67549825",
"0.67534035",
"0.6604703",
"0.65953386",
"0.65564364",
"0.6491961",
"0.6491961",
"0.64415246",
"0.6377342",
"0.6367016",
"0.6346783",
"0.63250744",
"0.63224643",
"0.6280085",
"0.623158",
"0.6207333... | 0.7973662 | 1 |
Obtains the problem type. getprobtype(self) | def getprobtype(self):
probtype_ = ctypes.c_int32()
res = __library__.MSK_XX_getprobtype(self.__nativep,ctypes.byref(probtype_))
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
_probtype_return_value = problemtype(probtype_.value)
return (_probtype_return_valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getprobtype(self): # 3\n res,resargs = self.__obj.getprobtype()\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n _probtype_return_value = resargs\n _probtype_return_value = problemtype(_probtype_return_value)\n return _probtype_retu... | [
"0.9006907",
"0.85797167",
"0.85797167",
"0.85797167",
"0.85797167",
"0.85797167",
"0.75342023",
"0.64539766",
"0.6302305",
"0.6269259",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.6167121",
"0.616712... | 0.81917536 | 6 |
Obtains the status keys for the scalar variables. getskx(self,whichsol_,skx_) | def getskx(self,whichsol_,skx_):
_skx_minlength = self.getnumvar()
if self.getnumvar() > 0 and skx_ is not None and len(skx_) != self.getnumvar():
raise ValueError("Array argument skx is not long enough: Is %d, expected %d" % (len(skx_),self.getnumvar()))
if isinstance(skx_,numpy.ndarray) and not skx_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getskx(self,whichsol_,skx): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n _copyback_skx = False\n if skx is None:\n skx_ = None\n else:\n try:\n skx_ = memoryview(skx)\n except TypeError:\n try:\n ... | [
"0.78065765",
"0.63683814",
"0.62353045",
"0.6215446",
"0.61820394",
"0.61591494",
"0.6133144",
"0.61062807",
"0.6047507",
"0.59702194",
"0.5943474",
"0.5915708",
"0.580595",
"0.5664523",
"0.5435939",
"0.53950316",
"0.5300313",
"0.52181596",
"0.51550823",
"0.51532644",
"0.510... | 0.78649473 | 0 |
Obtains the y vector for a solution. gety(self,whichsol_,y_) | def gety(self,whichsol_,y_):
_y_minlength = self.getnumcon()
if self.getnumcon() > 0 and y_ is not None and len(y_) != self.getnumcon():
raise ValueError("Array argument y is not long enough: Is %d, expected %d" % (len(y_),self.getnumcon()))
if isinstance(y_,numpy.ndarray) and not y_.flags.writeable:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gety(self,whichsol_,y): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n if y is None: raise TypeError(\"Invalid type for argument y\")\n _copyback_y = False\n if y is None:\n y_ = None\n else:\n try:\n y_ = memo... | [
"0.8433188",
"0.7439271",
"0.72740275",
"0.7210725",
"0.7059704",
"0.70467824",
"0.7036395",
"0.69869375",
"0.6916276",
"0.6868019",
"0.686457",
"0.686457",
"0.686457",
"0.686457",
"0.686457",
"0.686457",
"0.686457",
"0.686457",
"0.686457",
"0.686457",
"0.6860071",
"0.68104... | 0.8305004 | 1 |
Obtains a slice of the slc vector for a solution. getslcslice(self,whichsol_,first_,last_,slc_) | def getslcslice(self,whichsol_,first_,last_,slc_):
_slc_minlength = ((last_) - (first_))
if ((last_) - (first_)) > 0 and slc_ is not None and len(slc_) != ((last_) - (first_)):
raise ValueError("Array argument slc is not long enough: Is %d, expected %d" % (len(slc_),((last_) - (first_))))
if isinstanc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getslcslice(self,whichsol_,first_,last_,slc): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n _copyback_slc = False\n if slc is None:\n slc_ = None\n else:\n try:\n slc_ = memoryview(slc)\n except TypeError:\n... | [
"0.89666843",
"0.7970776",
"0.78357977",
"0.7790351",
"0.776608",
"0.7743089",
"0.7721771",
"0.76019967",
"0.75482076",
"0.7174418",
"0.6999907",
"0.6974384",
"0.6937394",
"0.68553096",
"0.677563",
"0.6760067",
"0.67554903",
"0.6729202",
"0.67274904",
"0.6555274",
"0.65497065... | 0.8908974 | 1 |
Sets the y vector for a solution. puty(self,whichsol_,y_) | def puty(self,whichsol_,y_):
_y_minlength = self.getnumcon()
if self.getnumcon() > 0 and y_ is not None and len(y_) != self.getnumcon():
raise ValueError("Array argument y is not long enough: Is %d, expected %d" % (len(y_),self.getnumcon()))
if y_ is None:
raise ValueError("Argument y cannot be ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def puty(self,whichsol_,y): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n if y is None: raise TypeError(\"Invalid type for argument y\")\n if y is None:\n y_ = None\n else:\n try:\n y_ = memoryview(y)\n except T... | [
"0.8003171",
"0.73679346",
"0.7363532",
"0.7336165",
"0.72183335",
"0.7205905",
"0.71375144",
"0.71375144",
"0.71099883",
"0.7101774",
"0.7048544",
"0.69963944",
"0.69963944",
"0.69483393",
"0.69331676",
"0.6927535",
"0.6890241",
"0.6728458",
"0.6610014",
"0.6607487",
"0.6497... | 0.7967985 | 1 |
Sets the slc vector for a solution. putslc(self,whichsol_,slc_) | def putslc(self,whichsol_,slc_):
_slc_minlength = self.getnumcon()
if self.getnumcon() > 0 and slc_ is not None and len(slc_) != self.getnumcon():
raise ValueError("Array argument slc is not long enough: Is %d, expected %d" % (len(slc_),self.getnumcon()))
if slc_ is None:
raise ValueError("Argum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putslc(self,whichsol_,slc): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n if slc is None: raise TypeError(\"Invalid type for argument slc\")\n if slc is None:\n slc_ = None\n else:\n try:\n slc_ = memoryview(slc)\n... | [
"0.81765276",
"0.71909016",
"0.70336485",
"0.6900895",
"0.6891917",
"0.65892226",
"0.6535961",
"0.6420544",
"0.6415206",
"0.62880546",
"0.62139344",
"0.5922277",
"0.5874246",
"0.58729297",
"0.5872463",
"0.57787675",
"0.5756639",
"0.56310564",
"0.5614232",
"0.5538193",
"0.5517... | 0.8158033 | 1 |
Sets the slx vector for a solution. putslx(self,whichsol_,slx_) | def putslx(self,whichsol_,slx_):
_slx_minlength = self.getnumvar()
if self.getnumvar() > 0 and slx_ is not None and len(slx_) != self.getnumvar():
raise ValueError("Array argument slx is not long enough: Is %d, expected %d" % (len(slx_),self.getnumvar()))
if slx_ is None:
raise ValueError("Argum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putslx(self,whichsol_,slx): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n if slx is None: raise TypeError(\"Invalid type for argument slx\")\n if slx is None:\n slx_ = None\n else:\n try:\n slx_ = memoryview(slx)\n... | [
"0.84727997",
"0.757701",
"0.734609",
"0.70459515",
"0.69720054",
"0.6686734",
"0.6545576",
"0.6458134",
"0.63578767",
"0.6129842",
"0.6112239",
"0.60045344",
"0.5910696",
"0.59034264",
"0.58935696",
"0.58419704",
"0.5817452",
"0.58091056",
"0.57681745",
"0.57624376",
"0.5740... | 0.82795686 | 1 |
Sets the snx vector for a solution. putsnx(self,whichsol_,sux_) | def putsnx(self,whichsol_,sux_):
_sux_minlength = self.getnumvar()
if self.getnumvar() > 0 and sux_ is not None and len(sux_) != self.getnumvar():
raise ValueError("Array argument sux is not long enough: Is %d, expected %d" % (len(sux_),self.getnumvar()))
if sux_ is None:
raise ValueError("Argum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putsnx(self,whichsol_,sux): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n if sux is None: raise TypeError(\"Invalid type for argument sux\")\n if sux is None:\n sux_ = None\n else:\n try:\n sux_ = memoryview(sux)\n... | [
"0.8124215",
"0.7021743",
"0.6980632",
"0.6966811",
"0.6813222",
"0.6800751",
"0.67092973",
"0.66968876",
"0.66748786",
"0.6496435",
"0.63811874",
"0.6318186",
"0.62490666",
"0.5961369",
"0.59006256",
"0.58907515",
"0.57933617",
"0.57347393",
"0.5712153",
"0.56779563",
"0.562... | 0.80041677 | 1 |
Sets the status keys for a slice of the constraints. putskcslice(self,whichsol_,first_,last_,skc_) | def putskcslice(self,whichsol_,first_,last_,skc_):
_skc_minlength = ((last_) - (first_))
if ((last_) - (first_)) > 0 and skc_ is not None and len(skc_) != ((last_) - (first_)):
raise ValueError("Array argument skc is not long enough: Is %d, expected %d" % (len(skc_),((last_) - (first_))))
if skc_ is n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putskcslice(self,whichsol_,first_,last_,skc): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n if skc is None:\n skc_ = None\n else:\n try:\n skc_ = memoryview(skc)\n except TypeError:\n try:\n _... | [
"0.79454774",
"0.75047725",
"0.7407678",
"0.7173813",
"0.7109814",
"0.69620323",
"0.688445",
"0.6570131",
"0.65653163",
"0.644008",
"0.64193016",
"0.63047063",
"0.6149271",
"0.61239773",
"0.60884666",
"0.60470337",
"0.6041082",
"0.6021966",
"0.6010248",
"0.59961426",
"0.59598... | 0.80113786 | 0 |
Sets the status keys for a slice of the variables. putskxslice(self,whichsol_,first_,last_,skx_) | def putskxslice(self,whichsol_,first_,last_,skx_):
_skx_minlength = ((last_) - (first_))
if ((last_) - (first_)) > 0 and skx_ is not None and len(skx_) != ((last_) - (first_)):
raise ValueError("Array argument skx is not long enough: Is %d, expected %d" % (len(skx_),((last_) - (first_))))
if skx_ is N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putskxslice(self,whichsol_,first_,last_,skx): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n if skx is None: raise TypeError(\"Invalid type for argument skx\")\n if skx is None:\n skx_ = None\n else:\n try:\n skx_ =... | [
"0.78931737",
"0.7580194",
"0.75786614",
"0.70705414",
"0.6861257",
"0.6841048",
"0.6743091",
"0.65563947",
"0.6522296",
"0.64854133",
"0.64648354",
"0.6417967",
"0.64111745",
"0.6388277",
"0.6313509",
"0.6206941",
"0.61367166",
"0.60655457",
"0.60014707",
"0.5933573",
"0.589... | 0.79880005 | 0 |
Sets a slice of the slc vector for a solution. putslcslice(self,whichsol_,first_,last_,slc_) | def putslcslice(self,whichsol_,first_,last_,slc_):
_slc_minlength = ((last_) - (first_))
if ((last_) - (first_)) > 0 and slc_ is not None and len(slc_) != ((last_) - (first_)):
raise ValueError("Array argument slc is not long enough: Is %d, expected %d" % (len(slc_),((last_) - (first_))))
if slc_ is N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putslcslice(self,whichsol_,first_,last_,slc): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n if slc is None: raise TypeError(\"Invalid type for argument slc\")\n if slc is None:\n slc_ = None\n else:\n try:\n slc_ =... | [
"0.8701502",
"0.8133429",
"0.806384",
"0.76658696",
"0.7658473",
"0.7546955",
"0.74436045",
"0.7409827",
"0.7223596",
"0.6984172",
"0.6980541",
"0.6971406",
"0.69320714",
"0.6919073",
"0.68930155",
"0.68504506",
"0.6744624",
"0.65483",
"0.65033495",
"0.6489441",
"0.63791984",... | 0.86964875 | 1 |
Sets a slice of the suc vector for a solution. putsucslice(self,whichsol_,first_,last_,suc_) | def putsucslice(self,whichsol_,first_,last_,suc_):
_suc_minlength = ((last_) - (first_))
if ((last_) - (first_)) > 0 and suc_ is not None and len(suc_) != ((last_) - (first_)):
raise ValueError("Array argument suc is not long enough: Is %d, expected %d" % (len(suc_),((last_) - (first_))))
if suc_ is N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putsucslice(self,whichsol_,first_,last_,suc): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n if suc is None: raise TypeError(\"Invalid type for argument suc\")\n if suc is None:\n suc_ = None\n else:\n try:\n suc_ =... | [
"0.85092914",
"0.79236835",
"0.7901774",
"0.710677",
"0.6811282",
"0.6809746",
"0.67143184",
"0.66562814",
"0.6645037",
"0.6538894",
"0.650998",
"0.64967585",
"0.63445026",
"0.63221073",
"0.6295248",
"0.61873865",
"0.6112312",
"0.6103999",
"0.61039084",
"0.606613",
"0.5948238... | 0.8509022 | 1 |
Sets a slice of the slx vector for a solution. putslxslice(self,whichsol_,first_,last_,slx_) | def putslxslice(self,whichsol_,first_,last_,slx_):
_slx_minlength = ((last_) - (first_))
if ((last_) - (first_)) > 0 and slx_ is not None and len(slx_) != ((last_) - (first_)):
raise ValueError("Array argument slx is not long enough: Is %d, expected %d" % (len(slx_),((last_) - (first_))))
if slx_ is N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putslxslice(self,whichsol_,first_,last_,slx): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n if slx is None: raise TypeError(\"Invalid type for argument slx\")\n if slx is None:\n slx_ = None\n else:\n try:\n slx_ =... | [
"0.87658566",
"0.8256838",
"0.82101905",
"0.7792551",
"0.76803",
"0.7590878",
"0.754748",
"0.73802775",
"0.73302394",
"0.73208",
"0.7255603",
"0.7252787",
"0.72040206",
"0.7198659",
"0.71512777",
"0.7144093",
"0.7055716",
"0.70355844",
"0.7016022",
"0.6608226",
"0.6572912",
... | 0.8742748 | 1 |
Sets a slice of the sux vector for a solution. putsuxslice(self,whichsol_,first_,last_,sux_) | def putsuxslice(self,whichsol_,first_,last_,sux_):
_sux_minlength = ((last_) - (first_))
if ((last_) - (first_)) > 0 and sux_ is not None and len(sux_) != ((last_) - (first_)):
raise ValueError("Array argument sux is not long enough: Is %d, expected %d" % (len(sux_),((last_) - (first_))))
if sux_ is N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putsuxslice(self,whichsol_,first_,last_,sux): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n if sux is None: raise TypeError(\"Invalid type for argument sux\")\n if sux is None:\n sux_ = None\n else:\n try:\n sux_ =... | [
"0.8508719",
"0.83340466",
"0.8057801",
"0.69197226",
"0.6710496",
"0.64897186",
"0.6475755",
"0.6451187",
"0.6406239",
"0.6389337",
"0.6378048",
"0.63440204",
"0.63357335",
"0.63132656",
"0.62359446",
"0.62201715",
"0.6173615",
"0.616365",
"0.61357236",
"0.6130329",
"0.61110... | 0.83344233 | 1 |
Sets a slice of the snx vector for a solution. putsnxslice(self,whichsol_,first_,last_,snx_) | def putsnxslice(self,whichsol_,first_,last_,snx_):
_snx_minlength = ((last_) - (first_))
if ((last_) - (first_)) > 0 and snx_ is not None and len(snx_) != ((last_) - (first_)):
raise ValueError("Array argument snx is not long enough: Is %d, expected %d" % (len(snx_),((last_) - (first_))))
if snx_ is N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putsnxslice(self,whichsol_,first_,last_,snx): # 3\n if not isinstance(whichsol_,soltype): raise TypeError(\"Argument whichsol has wrong type\")\n if snx is None: raise TypeError(\"Invalid type for argument snx\")\n if snx is None:\n snx_ = None\n else:\n try:\n snx_ =... | [
"0.85671264",
"0.805008",
"0.79371846",
"0.79229695",
"0.7840644",
"0.7586533",
"0.75405127",
"0.7280455",
"0.7215171",
"0.6978972",
"0.6911959",
"0.67005694",
"0.66865796",
"0.6662985",
"0.66343945",
"0.662925",
"0.6617821",
"0.66010696",
"0.65472627",
"0.6508029",
"0.645928... | 0.86426115 | 0 |
Obtains the length the task name. gettasknamelen(self) | def gettasknamelen(self):
len_ = ctypes.c_int32()
res = __library__.MSK_XX_gettasknamelen(self.__nativep,ctypes.byref(len_))
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
len_ = len_.value
_len_return_value = len_
return (_len_return_value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gettasknamelen(self): # 3\n res,resargs = self.__obj.gettasknamelen()\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n _len_return_value = resargs\n return _len_return_value",
"def gettaskname(self):\n sizetaskname_ = (1 + self.gett... | [
"0.8965651",
"0.7397242",
"0.72126365",
"0.667672",
"0.6508015",
"0.6390483",
"0.6323408",
"0.62874895",
"0.61902267",
"0.61406875",
"0.61028075",
"0.61009693",
"0.61009693",
"0.60868466",
"0.58861375",
"0.58722395",
"0.58384854",
"0.5818338",
"0.5761852",
"0.5759502",
"0.575... | 0.88484406 | 1 |
Obtains the task name. gettaskname(self) | def gettaskname(self):
sizetaskname_ = (1 + self.gettasknamelen())
taskname_ = (ctypes.c_char * (sizetaskname_))()
res = __library__.MSK_XX_gettaskname(self.__nativep,sizetaskname_,taskname_)
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg)
_taskname_retval = t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTaskName(self):\n return self._taskName",
"def task_name(self) -> str:\n return self._task_name",
"def task_name(self):\n pass",
"def task(self) -> str:\n return self._task",
"def gettaskname(self): # 3\n sizetaskname_ = (1 + self.gettasknamelen())\n arr_tasknam... | [
"0.9225546",
"0.9222605",
"0.8905019",
"0.80700994",
"0.7833355",
"0.7788377",
"0.7711659",
"0.7691786",
"0.7691786",
"0.7611951",
"0.7544766",
"0.7498057",
"0.74122566",
"0.73614204",
"0.7213984",
"0.7192169",
"0.71578455",
"0.7126896",
"0.7096741",
"0.70961493",
"0.7053906"... | 0.7600426 | 10 |
Sets the objective sense. putobjsense(self,sense_) | def putobjsense(self,sense_):
res = __library__.MSK_XX_putobjsense(self.__nativep,sense_)
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putobjsense(self,sense_): # 3\n if not isinstance(sense_,objsense): raise TypeError(\"Argument sense has wrong type\")\n res = self.__obj.putobjsense(sense_)\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def objective(self, objective):\... | [
"0.79471225",
"0.52841735",
"0.5171148",
"0.5096876",
"0.50680315",
"0.48795915",
"0.48363435",
"0.48355487",
"0.48335677",
"0.48176384",
"0.47935885",
"0.47814864",
"0.4768401",
"0.47334376",
"0.4723602",
"0.469889",
"0.46933207",
"0.46930823",
"0.4692844",
"0.46748367",
"0.... | 0.75217026 | 1 |
Changes one element in barc. putbarcj(self,j_,sub_,weights_) | def putbarcj(self,j_,sub_,weights_):
num_ = None
if num_ is None:
num_ = len(sub_)
elif num_ != len(sub_):
raise IndexError("Inconsistent length of array sub")
if num_ is None:
num_ = len(weights_)
elif num_ != len(weights_):
raise IndexError("Inconsistent length of array wei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putbarcj(self,j_,sub,weights): # 3\n num_ = None\n if num_ is None:\n num_ = len(sub)\n elif num_ != len(sub):\n raise IndexError(\"Inconsistent length of array sub\")\n if num_ is None:\n num_ = len(weights)\n elif num_ != len(weights):\n raise IndexError(\... | [
"0.8175987",
"0.73748964",
"0.7216971",
"0.62823015",
"0.62727207",
"0.6010744",
"0.58721524",
"0.5819966",
"0.57759297",
"0.5744071",
"0.56815547",
"0.5676308",
"0.55539197",
"0.54821527",
"0.53647524",
"0.53490466",
"0.52245176",
"0.52084583",
"0.5198786",
"0.5183286",
"0.5... | 0.77634215 | 1 |
Sets the number of preallocated conic constraints in the optimization task. putmaxnumcone(self,maxnumcone_) | def putmaxnumcone(self,maxnumcone_):
res = __library__.MSK_XX_putmaxnumcone(self.__nativep,maxnumcone_)
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putmaxnumcone(self,maxnumcone_): # 3\n res = self.__obj.putmaxnumcone(maxnumcone_)\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def putmaxnumcon(self,maxnumcon_): # 3\n res = self.__obj.putmaxnumcon(maxnumcon_)\n if res != 0:\n ... | [
"0.7859737",
"0.687435",
"0.6576984",
"0.6516009",
"0.6250021",
"0.5742838",
"0.57224095",
"0.5664653",
"0.5662323",
"0.5644606",
"0.5565795",
"0.55509084",
"0.55272174",
"0.54718906",
"0.5445443",
"0.54382503",
"0.5431226",
"0.5375135",
"0.53488725",
"0.5343298",
"0.5334908"... | 0.76632214 | 1 |
Sets the number of preallocated symmetric matrix variables. putmaxnumbarvar(self,maxnumbarvar_) | def putmaxnumbarvar(self,maxnumbarvar_):
res = __library__.MSK_XX_putmaxnumbarvar(self.__nativep,maxnumbarvar_)
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putmaxnumbarvar(self,maxnumbarvar_): # 3\n res = self.__obj.putmaxnumbarvar(maxnumbarvar_)\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def putmaxnumvar(self,maxnumvar_): # 3\n res = self.__obj.putmaxnumvar(maxnumvar_)\n if res !=... | [
"0.7951648",
"0.6959753",
"0.6795598",
"0.65727705",
"0.6438065",
"0.6048308",
"0.5996996",
"0.5852882",
"0.5841968",
"0.5822205",
"0.5682764",
"0.5667983",
"0.5649398",
"0.5640302",
"0.5615086",
"0.56006753",
"0.55580956",
"0.5552524",
"0.5495012",
"0.54564613",
"0.5411751",... | 0.78251684 | 1 |
Replaces one coefficient in the quadratic term in the objective. putqobjij(self,i_,j_,qoij_) | def putqobjij(self,i_,j_,qoij_):
res = __library__.MSK_XX_putqobjij(self.__nativep,i_,j_,qoij_)
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def putqobjij(self,i_,j_,qoij_): # 3\n res = self.__obj.putqobjij(i_,j_,qoij_)\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)",
"def getqobjij(self,i_,j_): # 3\n res,resargs = self.__obj.getqobjij(i_,j_)\n if res != 0:\n result,msg ... | [
"0.8022443",
"0.67813957",
"0.659472",
"0.62387276",
"0.6219436",
"0.61874425",
"0.6092477",
"0.6030711",
"0.6007447",
"0.58423615",
"0.58029187",
"0.5546479",
"0.5543163",
"0.54854363",
"0.54592514",
"0.54140776",
"0.5403207",
"0.54002947",
"0.537518",
"0.5340782",
"0.533449... | 0.78803056 | 1 |
Load task data from a string in JSON format. readjsonstring(self,data_) | def readjsonstring(self,data_):
if isinstance(data_,unicode):
data_ = data_.encode("utf-8",errors="replace")
res = __library__.MSK_XX_readjsonstring(self.__nativep,data_)
if res != 0:
_,msg = self.__getlasterror(res)
raise Error(rescode(res),msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_data_from_str(self, data_as_str):\n try:\n data = json.loads(data_as_str)\n except json.JSONDecodeError:\n data = data_utils.data_generator(data_as_str.splitlines())\n data = data_utils.read_json(\n data_generator=data,\n select... | [
"0.7473371",
"0.73492724",
"0.70103645",
"0.6908961",
"0.67095613",
"0.66338253",
"0.6541871",
"0.65246135",
"0.6445135",
"0.643727",
"0.6423963",
"0.6287553",
"0.6281268",
"0.62648505",
"0.6253007",
"0.62117",
"0.6190784",
"0.61543965",
"0.6138435",
"0.6130036",
"0.6093991",... | 0.6714592 | 4 |
Returns True if this type is used in an optional argument. bool | def is_optional(self):
raise exceptions.NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optional(self) -> bool:\n return False",
"def is_optional(cls) -> bool:\n return cls.optional",
"def NeedsOptional(self, type_):\n return self._NameComponents(type_) in self._optional_types",
"def bool_option (arg: Any) -> bool:\n return True",
"def is_simple_in_opt_and_not_opt(self... | [
"0.7237668",
"0.72037935",
"0.709011",
"0.69880986",
"0.66822135",
"0.66811407",
"0.66736525",
"0.6660319",
"0.65815026",
"0.65815026",
"0.65815026",
"0.65815026",
"0.65815026",
"0.65815026",
"0.6533586",
"0.64503354",
"0.64380187",
"0.6419174",
"0.6419174",
"0.6419174",
"0.6... | 0.6169652 | 62 |
Returns True if this type is used in a variadic argument. bool | def is_variadic(self):
raise exceptions.NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_variadic(self):\n if self.is_function() and self.args:\n return self.args[-1].endswith(\"...\")\n return False",
"def check_args(args):\n for arg in vars(args):\n if getattr(args, arg):\n return True\n return False",
"def takes_multiple_ar... | [
"0.7789966",
"0.6522471",
"0.6384409",
"0.6294994",
"0.6294994",
"0.62792814",
"0.6124202",
"0.6067434",
"0.60662395",
"0.6052541",
"0.60394627",
"0.60286164",
"0.59856653",
"0.59645915",
"0.59602636",
"0.5950267",
"0.59254897",
"0.5895693",
"0.5832743",
"0.5820968",
"0.57882... | 0.7150723 | 1 |
Returns True if |self| is a BooleanType. bool | def is_boolean_type(self):
raise exceptions.NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_bool(self):\n answer = self._call('is_bool')\n return answer.yes",
"def isBoolean(self):\n return _libsbml.ASTNode_isBoolean(self)",
"def as_bool(self):\n return self.as_type(bool)",
"def __bool__(self):\n return bool(self._value)",
"def __bool__(self):\n re... | [
"0.81790584",
"0.79737103",
"0.79040664",
"0.75805515",
"0.75393873",
"0.7524598",
"0.75197995",
"0.7460989",
"0.74104637",
"0.72200793",
"0.72200793",
"0.71395105",
"0.7098527",
"0.70766455",
"0.7033548",
"0.7030978",
"0.7024969",
"0.6913013",
"0.68852055",
"0.68579674",
"0.... | 0.7735801 | 3 |
Returns True if |self| is an ObjectType. bool | def is_object_type(self):
raise exceptions.NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isinstance_blender_object(self, b_obj):\n # lame and slow, but functional\n return b_obj in Blender.Object.Get()",
"def verify_type(self, obj):\n return isinstance(obj, self.type_)",
"def object_type_present(self, object_type):\n # Check input.\n if not isinstance(object_... | [
"0.7290644",
"0.6918381",
"0.6855239",
"0.681674",
"0.6812159",
"0.66543907",
"0.664714",
"0.65621924",
"0.65621924",
"0.65621924",
"0.65621924",
"0.65621924",
"0.6510388",
"0.64790374",
"0.64409184",
"0.6381249",
"0.63387465",
"0.6333009",
"0.62965983",
"0.62965983",
"0.6294... | 0.73837817 | 0 |
Returns True if |self| is an InterfaceType. bool | def is_interface_type(self):
raise exceptions.NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_interface(self, file, i):\n\n # Get doc_str for class\n doc_str = self.get_doc_str(file, i)\n\n # Check if line specifies interface\n class_type = None\n\n # Iterate over lines in docstring\n for line in doc_str:\n\n # Search for string match \"class type... | [
"0.7116907",
"0.69529134",
"0.6768456",
"0.65538967",
"0.6530441",
"0.6227138",
"0.61110246",
"0.6041694",
"0.60142016",
"0.59563255",
"0.58967304",
"0.5890976",
"0.588442",
"0.58537626",
"0.5843988",
"0.579155",
"0.5761401",
"0.5754417",
"0.5736469",
"0.5722448",
"0.5722448"... | 0.7915525 | 0 |
Returns True if |self| is an EnumerationType. bool | def is_enumeration_type(self):
raise exceptions.NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_enum(self):\n return self.is_complex and not self.is_class",
"def is_enum(self):\n return False",
"def __bool__(self):\n raise ValueError(\"never bool enums\")",
"def is_enum(schema_obj):\n\n return (isinstance(schema_obj, schema.Enum) or\n (isinstance(schema_obj, schema... | [
"0.75733083",
"0.7569544",
"0.6962072",
"0.6221248",
"0.593877",
"0.5817571",
"0.5783149",
"0.57705",
"0.57169104",
"0.5677263",
"0.56612563",
"0.56568766",
"0.5621548",
"0.5560102",
"0.55483013",
"0.5544188",
"0.5514909",
"0.5514909",
"0.5502364",
"0.5480135",
"0.5452716",
... | 0.7311989 | 2 |
Returns True if |self| is a NullableType. bool | def is_nullable_type(self):
raise exceptions.NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_nullable(self) -> bool:\n return self.__nullable",
"def is_nullable(self):\n return self._is_nullable",
"def is_nullable(self) -> bool: # pragma: no cover\n pass",
"def isNullable(self):\n if self.isPrimaryKey():\n return False\n else:\n retur... | [
"0.8178933",
"0.7918046",
"0.79070556",
"0.76075095",
"0.69676435",
"0.6672594",
"0.65094495",
"0.6502415",
"0.647941",
"0.6284314",
"0.6273103",
"0.62613225",
"0.62450457",
"0.6224936",
"0.6208757",
"0.6208757",
"0.6208757",
"0.6208757",
"0.6208757",
"0.6177551",
"0.61642456... | 0.72613966 | 4 |
Returns True if |self| is a RecordType. bool | def is_record_type(self):
raise exceptions.NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supports_book_record_type(self, book_record_type=None):\n if book_record_type is None:\n raise NullArgument()\n return False",
"def supports_catalog_record_type(self, catalog_record_type=None):\n if catalog_record_type is None:\n raise NullArgument()\n return... | [
"0.657329",
"0.6553393",
"0.6409709",
"0.6220432",
"0.6149315",
"0.6113821",
"0.61134356",
"0.6092015",
"0.603679",
"0.5925932",
"0.58947814",
"0.5886511",
"0.5882126",
"0.5842346",
"0.58168924",
"0.5733191",
"0.57082087",
"0.5686609",
"0.5648512",
"0.56156236",
"0.56152785",... | 0.79121345 | 0 |
Returns True if |self| is a UnionType. bool | def is_union_type(self):
raise exceptions.NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_union(typeval: Type) -> bool:\n return get_origin(typeval) is Union",
"def is_union(type_):\n if not is_class(type_):\n return False\n decl = class_traits.get_declaration(type_)\n return decl.class_type == class_declaration.CLASS_TYPES.UNION",
"def is_Union(tp):\n if tp is Union:\... | [
"0.8105555",
"0.7861087",
"0.7817273",
"0.7705603",
"0.7646727",
"0.7483963",
"0.7477847",
"0.74555516",
"0.69131905",
"0.6808421",
"0.65584767",
"0.58904076",
"0.5881067",
"0.570471",
"0.56558865",
"0.56558865",
"0.5652963",
"0.562509",
"0.5571252",
"0.5558063",
"0.5529574",... | 0.81638217 | 0 |
Returns the enumeration that |self| points if |self| is an EnumerationType. Enumeration | def enumeration(self):
raise exceptions.NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enum(self):\r\n raise NotImplementedError",
"def type(self):\n if self.__type is None:\n found_type = find_definition(\n self.__type_name, self.message_definition())\n if not (found_type is not Enum and\n isinstance(found_type, type) and\n... | [
"0.6754995",
"0.6505485",
"0.6498391",
"0.64226437",
"0.64147794",
"0.6215564",
"0.62026507",
"0.6193123",
"0.6181149",
"0.61001414",
"0.6067181",
"0.5867183",
"0.5742926",
"0.5690248",
"0.5673847",
"0.55770445",
"0.55766934",
"0.55766934",
"0.5558914",
"0.5537204",
"0.550784... | 0.6433254 | 3 |
Calculate derivative of f at x ... | def derivative(f, x, epsilon = 1e-10):
x_ = x + epsilon
value = (f(x_) - f(x)) / epsilon
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative(func: Callable, x: float, delta: float) -> float:\n return (func(x + delta) - func(x - delta)) / (2.0 * delta)",
"def dalf(x):\n return derivative(alf, x, dx=1e-6)",
"def ddalf(x):\n return derivative(dalf, x, dx=1e-6)",
"def ddalf(x):\n return derivative(dalf, x, dx=1e... | [
"0.8399586",
"0.8368309",
"0.8243807",
"0.8243807",
"0.80135554",
"0.76355505",
"0.76177835",
"0.759907",
"0.75759",
"0.7549782",
"0.7521599",
"0.7458555",
"0.7403107",
"0.7348985",
"0.7286614",
"0.72405046",
"0.7226039",
"0.72241956",
"0.7214791",
"0.7148547",
"0.70950574",
... | 0.822914 | 4 |
Updates relu activation functions so that 1 stores output in forward pass 2 imputes zero for gradient values that are less than zero | def update_relus(self):
def relu_backward_hook_function(module, grad_in, grad_out):
"""
If there is a negative gradient, change it to zero
"""
# Get last forward output
corresponding_forward_output = self.forward_relu_outputs[-1]
correspond... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_relus(self):\n def relu_backward_hook_function(module, grad_in, grad_out):\n \"\"\"\n If there is a negative gradient, change it to zero\n \"\"\"\n # Get last forward output\n corresponding_forward_output = self.forward_relu_outputs[-1]\n corresponding_forward_output[c... | [
"0.71002835",
"0.7058546",
"0.7051403",
"0.7016013",
"0.6980029",
"0.6936653",
"0.6891817",
"0.68849665",
"0.68542355",
"0.67622566",
"0.6736303",
"0.66012645",
"0.65662277",
"0.656202",
"0.6528573",
"0.64789206",
"0.6472497",
"0.6466472",
"0.64646626",
"0.64496136",
"0.64196... | 0.6970306 | 5 |
The function converts the quaternion vector to a rotation matrix | def quaternion_to_rotation_matrix(q0, q1, q2, q3) -> np:
# First row of the rotation matrix
r00 = 2 * (q0 * q0 + q1 * q1) - 1
r01 = 2 * (q1 * q2 - q0 * q3)
r02 = 2 * (q1 * q3 + q0 * q2)
# Second row of the rotation matrix
r10 = 2 * (q1 * q2 + q0 * q3)
r11 = 2 * (q0 * q0 + q2 * q2) - 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quaternion_to_rotation_matrix(quaternion):\n\n q_w, q_x, q_y, q_z = quaternion\n sqw, sqx, sqy, sqz = np.square(quaternion)\n norm = (sqx + sqy + sqz + sqw)\n rotation_matrix = np.zeros((3, 3))\n\n # division of square length if quaternion is not already normalized\n rotation_matrix[0, 0] = (... | [
"0.75867957",
"0.74146473",
"0.73953855",
"0.72882676",
"0.7253188",
"0.72290003",
"0.71538144",
"0.71532506",
"0.7126588",
"0.7108177",
"0.7099389",
"0.70787674",
"0.7061855",
"0.7034862",
"0.7003994",
"0.70023286",
"0.6997477",
"0.697881",
"0.69561833",
"0.69520205",
"0.693... | 0.683938 | 25 |
The function converts rotation matrix to quaternion vector | def rotation_matrix_to_quaternion(rotation_matrix: np) -> object:
cosine_for_pitch = math.sqrt(rotation_matrix[0][0] ** 2 + rotation_matrix[1][0] ** 2)
is_singular = cosine_for_pitch < 10 ** -6
if not is_singular:
yaw = math.atan2(rotation_matrix[1][0], rotation_matrix[0][0])
pitch = math.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotation_matrix_to_quaternion(rotation_matrix):\n trace = np.trace(rotation_matrix)\n\n if trace > 0:\n S = np.sqrt(trace + 1) * 2\n q_w = 0.25 * S\n q_x = (rotation_matrix[2, 1] - rotation_matrix[1, 2]) / S\n q_y = (rotation_matrix[0, 2] - rotation_matrix[2, 0]) / S\n ... | [
"0.76806",
"0.75808585",
"0.757304",
"0.7515583",
"0.7400028",
"0.7371076",
"0.72685283",
"0.72596556",
"0.722488",
"0.71143645",
"0.70881724",
"0.7081711",
"0.70517707",
"0.7031683",
"0.70243925",
"0.7013156",
"0.70124847",
"0.7006788",
"0.69838303",
"0.69710416",
"0.6961587... | 0.7486031 | 4 |
Retrieves a location using this LocationProvider. Should be overwritten in specialisations of this class. | def get_location(self):
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_location(self) -> models.Location:\n return models.Location.get(region=self, name=self.name, deleted=False)",
"def get_location(self):\n return self.location",
"def get_location(self):\n\t\treturn self.location",
"def get_location(self):\r\n return self.__location",
"def _get_l... | [
"0.7753154",
"0.76495415",
"0.7630321",
"0.7557997",
"0.75226474",
"0.74665785",
"0.7435566",
"0.74313676",
"0.73154056",
"0.7309289",
"0.72279537",
"0.7225498",
"0.7192612",
"0.7192612",
"0.71177167",
"0.7008181",
"0.69932073",
"0.69932073",
"0.6984769",
"0.69491065",
"0.693... | 0.68752146 | 23 |
Given data about a Collection returned by any blockstore REST API, convert it to a Collection instance. | def _collection_from_response(data):
return Collection(uuid=UUID(data['uuid']), title=data['title']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_collection(self, collection, request, environ, start_response,\n response_headers):\n response_type = self.content_negotiation(\n request, environ, self.ValueTypes)\n if response_type is None:\n return self.odata_error(\n reques... | [
"0.6577779",
"0.6343278",
"0.6237831",
"0.6221495",
"0.6207642",
"0.6203012",
"0.6195551",
"0.6181388",
"0.6098431",
"0.6020433",
"0.60099417",
"0.5990563",
"0.5976519",
"0.5969405",
"0.5889118",
"0.58554935",
"0.58416325",
"0.5817092",
"0.5749313",
"0.57408684",
"0.57094455"... | 0.71289414 | 0 |
Retrieve metadata about the specified draft. | def get_or_create_bundle_draft(bundle_uuid, draft_name):
bundle = get_bundle(bundle_uuid)
try:
return get_draft(bundle.drafts[draft_name]) # pylint: disable=unsubscriptable-object
except KeyError:
# The draft doesn't exist yet, so create it:
response = api_request('post', api_url('d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self,\n draft_id,\n ):\n return self._invoke('get',\n {\n 'draft_id': draft_id,\n })",
"def get(self, oauth, resource_id, draft_id):\n d = Deposition.get(resource_id, user=current_user)\n ... | [
"0.6504005",
"0.60097516",
"0.57217854",
"0.5682793",
"0.5668223",
"0.5561862",
"0.5507919",
"0.54667366",
"0.5463275",
"0.54286134",
"0.5427839",
"0.54156",
"0.5385616",
"0.5367478",
"0.5338896",
"0.5338896",
"0.5327211",
"0.53266174",
"0.53234196",
"0.5313462",
"0.52506757"... | 0.0 | -1 |
Get a dict of all the files in the specified bundle. Returns a dict where the keys are the paths (strings) and the values are BundleFile or DraftFile tuples. | def get_bundle_files_dict(bundle_uuid, use_draft=None):
bundle = get_bundle(bundle_uuid)
if use_draft and use_draft in bundle.drafts: # pylint: disable=unsupported-membership-test
draft_uuid = bundle.drafts[use_draft] # pylint: disable=unsubscriptable-object
return get_draft(draft_uuid).files
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bundle_files(bundle_uuid, use_draft=None):\n return get_bundle_files_dict(bundle_uuid, use_draft).values() # lint-amnesty, pylint: disable=dict-values-not-iterating",
"def get_bundle_version_files(bundle_uuid, version_number):\n if version_number == 0:\n return []\n version_info = get_bu... | [
"0.7790072",
"0.64431036",
"0.63394016",
"0.63182753",
"0.630003",
"0.62759304",
"0.6194732",
"0.6178175",
"0.61479455",
"0.6144583",
"0.6076846",
"0.60737944",
"0.6040074",
"0.5976576",
"0.59606755",
"0.5862239",
"0.5857732",
"0.58249676",
"0.5790602",
"0.5765096",
"0.576296... | 0.8014129 | 0 |
Initialize the weights of the model. The weights are initialized to small random values and the biases to zero. Weights are stored in the variable dictionary named self.params. | def initialize_weights(self, input_dim, std_dev=1e-2):
self.params = {}
hidden_size = self.hidden_size
num_classes = self.num_classes
num_layers = self.num_layers
#############################################################################
# TODO: Initialize th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_parameters(self):\n stdv = 1. / math.sqrt(self.weight.data.size(1))\n self.weight.data.uniform_(-stdv, stdv)\n if self.bias is not None:\n self.bias.data.uniform_(-stdv, stdv)",
"def init_weights(model):\n ...",
"def init_weights(self):\n \n self.w ... | [
"0.84454",
"0.83300084",
"0.83285135",
"0.8306398",
"0.81789726",
"0.8172356",
"0.81278425",
"0.80801696",
"0.80633783",
"0.8052339",
"0.8016938",
"0.8014385",
"0.7996117",
"0.7978683",
"0.7978683",
"0.7978683",
"0.79736733",
"0.791141",
"0.791141",
"0.7864369",
"0.7859745",
... | 0.7425541 | 56 |
Computes the backward pass for a sigmoid activation function. | def sigmoid_backward(self, dUpper, cache):
out = cache
#############################################################################
# TODO: Implement the backward pass for the sigmoid function. #
#############################################################################... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_backward(dout, cache):\n dx, x = None, cache\n\n f = lambda x: 1/(1 + np.exp(-x)) # activation function (sigmoid)\n\n fun = f(x)\n\n dx = np.multiply(fun, (1-fun))\n dx = np.multiply(dx,dout)\n\n return dx",
"def sigmoid_backward(dA, Z):\r\n dsig = sigmoid(Z) * (1 - sigmoid(Z))\... | [
"0.7805891",
"0.76624775",
"0.75691813",
"0.7389613",
"0.72973096",
"0.72793454",
"0.72200996",
"0.72104853",
"0.72072583",
"0.7176278",
"0.7166796",
"0.71486557",
"0.712793",
"0.7086538",
"0.7080874",
"0.70740503",
"0.7072516",
"0.70650476",
"0.7015476",
"0.70073223",
"0.698... | 0.7265221 | 6 |
Compute the softmax function for each row of the input x. | def softmax(self, x):
#############################################################################
# TODO: Implement the softmax function. #
#############################################################################
meanValue = np.mean(x, axis=1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, x):\n\n out = np.zeros(x.shape)\n for i in range(x.shape[0]):\n max_x = x[i] - np.max(x[i])\n out[i] = np.exp(max_x) / np.sum(np.exp(max_x), axis=0)\n\n return out",
"def softmax(x: npt.NDArray) -> npt.NDArray:\n row_wise_max = np.max(x, axis=1).res... | [
"0.8561103",
"0.8524938",
"0.8485795",
"0.84788704",
"0.84645116",
"0.84644413",
"0.84097195",
"0.8395736",
"0.8390502",
"0.8372838",
"0.8333905",
"0.8323554",
"0.8323105",
"0.8323105",
"0.8323105",
"0.8323105",
"0.8323105",
"0.8323105",
"0.8323105",
"0.8323105",
"0.8309577",... | 0.8095466 | 48 |
Computes the forward pass of a rectified linear unit (ReLU). | def relu_forward(self, x):
#out = None
#############################################################################
# TODO: Implement the ReLU forward pass. #
#############################################################################
out = n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relu_forward(x):\n ############################################################################\n # TODO: Implement the ReLU forward pass. #\n ############################################################################\n ######################################################... | [
"0.6923425",
"0.6670239",
"0.6663412",
"0.6650045",
"0.6630312",
"0.65392053",
"0.64895386",
"0.648836",
"0.64600945",
"0.6429588",
"0.6399773",
"0.63981783",
"0.63528794",
"0.63357466",
"0.63077855",
"0.62966233",
"0.6285175",
"0.6278084",
"0.62459034",
"0.62427825",
"0.6203... | 0.67316556 | 1 |
Computes the backward pass for a layer of rectified linear units (ReLUs). | def relu_backward(self, dUpper, cache):
x = cache
#############################################################################
# TODO: Implement the ReLU backward pass. #
#############################################################################
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backward(ctx, grad_output):\n loss, reg, u, lbda = ctx.saved_tensors\n\n device = u.device\n\n # do clever computations\n eps = 1e-10\n grad, = torch.autograd.grad(loss, u, only_inputs=True,\n retain_graph=True)\n x = (u - eps * grad)... | [
"0.6948249",
"0.6898323",
"0.6847992",
"0.6847992",
"0.68477255",
"0.68407637",
"0.68200904",
"0.6768128",
"0.67572653",
"0.67565167",
"0.67562467",
"0.6743265",
"0.67394495",
"0.6715497",
"0.67090523",
"0.67006433",
"0.669643",
"0.669643",
"0.66886026",
"0.6666757",
"0.66667... | 0.70406467 | 0 |
Given gradient, will update the layer weights | def update_params(self, update_weights, update_bias):
if not self.trainable:
return
update_weights = np.squeeze(update_weights)
update_bias = np.squeeze(update_bias)
# some have non-trainable parameters, in addition to the
# weights and biases
if len(self.p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_update(self, gradient):\n w = sys.modules[self.shared_mem_name].__dict__[\"w\"]\n w -= self.learning_rate * gradient",
"def update_weights(self, X, Y, learning_rate):\n grads = self.calculate_gradients(X, Y)\n #update weights and biases\n self.weights[0] = self.weig... | [
"0.7662058",
"0.756946",
"0.7527331",
"0.73841107",
"0.7367387",
"0.72501403",
"0.7238229",
"0.7204643",
"0.71658003",
"0.7152769",
"0.71068096",
"0.7099971",
"0.70949143",
"0.7080805",
"0.70684385",
"0.70570195",
"0.70487124",
"0.70160997",
"0.6927363",
"0.6914079",
"0.68777... | 0.6196009 | 100 |
Return the first_name plus the last_name, with a space in between. | def get_full_name(self):
full_name = '%s %s' % (self.first_name, self.last_name)
return full_name.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name(first_name, last_name):\n return first_name + \" \" + last_name",
"def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name",
"def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()",
"def get_full_name(se... | [
"0.83418363",
"0.82269484",
"0.8099016",
"0.80672693",
"0.8052289",
"0.80440307",
"0.7993753",
"0.7992884",
"0.7992884",
"0.7992884",
"0.79781276",
"0.79624933",
"0.7956748",
"0.79396284",
"0.7936353",
"0.79332894",
"0.79148924",
"0.79008836",
"0.7892486",
"0.7869447",
"0.785... | 0.7785872 | 54 |
Override equality operator for testing primer objects | def __eq__(self,
other):
return (self.seq == other.seq and
self.aligned_index == other.aligned_index and
self.unaligned_index == other.unaligned_index and
self.numeric_seq == other.numeric_seq and
self.upstream_regions == other.upst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n pass",
"def __eq__(self, other):\n pass",
"def __eq__(self, p_object):\n if any([self[i] != p_object[i] for i in range(9)]):\n return False\n return True",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq... | [
"0.72263765",
"0.72263765",
"0.71889865",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147",
"0.71733147"... | 0.0 | -1 |
returns max number of missed seqs to be above threshold | def get_deletion_threshold(percent_match,
seq_total):
return int(float(1-percent_match)*seq_total) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_repeats(seq):\n max_item = 0\n item_count = [seq.count(item) for item in seq]\n try:\n max_item = max(item_count)\n except ValueError:\n \"arg is an empty sequence\"\n return max_item",
"def num_larger(threshold, values):\n num = sum([1 for n in values if (n>threshold)])\n... | [
"0.63247347",
"0.6317331",
"0.6310057",
"0.6004469",
"0.5953126",
"0.5931313",
"0.59071994",
"0.5869132",
"0.5867101",
"0.5866491",
"0.5832915",
"0.5804919",
"0.5800774",
"0.5782871",
"0.57597333",
"0.5745662",
"0.5734066",
"0.57165194",
"0.571367",
"0.56970453",
"0.5675978",... | 0.60113037 | 3 |
Generate random int `n` such that `0 <= n <= prime`. | def random_int(self, top):
return random.randint(0, top) % self.prime | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime(n):\n assert n > 3\n k = int(log2(n))\n m = n - 1\n d = 0\n while(m % 2 == 0):\n m //= 2\n d += 1\n for _ in range(k):\n a = randint(2, n - 2)\n x = pow(a, m, n)\n if x == 1 or x == n - 1:\n continue\n for _ in range(d - 1):\n ... | [
"0.7877164",
"0.7752492",
"0.76700974",
"0.7575768",
"0.73313224",
"0.7323237",
"0.7304841",
"0.7234368",
"0.7212159",
"0.718724",
"0.7154295",
"0.710153",
"0.70722497",
"0.7051513",
"0.704767",
"0.7031115",
"0.70165616",
"0.7007428",
"0.69956565",
"0.6977279",
"0.6942",
"0... | 0.0 | -1 |
Add last splitting llh to subtree llh. Assumes delta_min and lam are the same for both a_node and b_node | def get_energy_of_split(self, elem_l, elem_r):
# logging.debug(f"computing energy of split: {ch_l, ch_r}")
# elem_l = self.clusters[ch_l]
# elem_r = self.clusters[ch_r]
# To follow the convention on Ginkgo, to get the correct result, we set t==0 if we have a leaf, i.e. t<t_cut
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _finalize_leaf(self, node):\n node.value = -self.shrinkage * node.sum_gradients / (\n node.sum_hessians + self.splitter.l2_regularization)\n self.finalized_leaves.append(node)",
"def _compute_best_split_and_push(self, node):\n\n node.split_info = self.splitter.find_node_split(... | [
"0.55932456",
"0.55510145",
"0.54642284",
"0.5366041",
"0.5326848",
"0.5302723",
"0.5289726",
"0.51891357",
"0.51791817",
"0.5175469",
"0.5147306",
"0.5121746",
"0.5092955",
"0.5072795",
"0.50273865",
"0.50056016",
"0.49869534",
"0.49738866",
"0.49672574",
"0.49655488",
"0.49... | 0.48502734 | 34 |
Return the given string as a native string in the given encoding. | def tonative(n, encoding='ISO-8859-1'):
# In Python 2, the native string type is bytes.
if isinstance(n, six.text_type): # unicode for Python 2
return n.encode(encoding)
return n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_native_string(string, encoding='ascii'):\n if isinstance(string, str):\n out = string\n else:\n out = string.decode(encoding)\n\n return out",
"def native_(s, encoding='latin-1', errors='strict'):\n if isinstance(s, text_type):\n return s.encode(encoding, errors)\... | [
"0.8789175",
"0.79968244",
"0.7674134",
"0.7387134",
"0.7373827",
"0.72284156",
"0.7190662",
"0.7112319",
"0.7099836",
"0.70713055",
"0.6986353",
"0.6885627",
"0.6806217",
"0.66796917",
"0.66330653",
"0.6579638",
"0.65549314",
"0.6536207",
"0.6463338",
"0.6441715",
"0.6439027... | 0.6085863 | 44 |
Shutdown connection and socket. | def shutdown(self):
self.factory.reactor.removeReader(self)
self.factory.connections.discard(self)
self.socket.close()
self.socket = None
self.factory = None
if self.read_scheduled is not None:
self.read_scheduled.cancel()
self.read_scheduled =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shutdown(self):\n self.sock.close()",
"def shutdown(self):\r\n self.socket.close()\r\n # self.socket_video.close()\r\n self.socket_state.close()",
"def shutdown(self):\n self.connected = False\n self.protocol.send_message(self.sock, '__!shutdown__')\n data =... | [
"0.8116628",
"0.8094799",
"0.8060814",
"0.79759955",
"0.78641194",
"0.7841892",
"0.7702921",
"0.7702643",
"0.7657929",
"0.7616718",
"0.7593503",
"0.749319",
"0.74762684",
"0.7362442",
"0.7351249",
"0.73482984",
"0.7346527",
"0.73362386",
"0.7329469",
"0.73156035",
"0.73146766... | 0.6914994 | 69 |
returns an instance for tracking max value | def max():
return KeeperOfMinOrMax(int.__lt__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max(self):\n raise NotImplementedError(\"This is an abstract method and needs to be implemented in derived classes.\")",
"def _get_maximum(self):\n return self._maximum",
"def get_maximum ( self, object ):\n return self.maximum",
"def _get_maximum_value(self):\n if hasattr... | [
"0.801089",
"0.79525405",
"0.78954244",
"0.7758301",
"0.7726418",
"0.76395977",
"0.762583",
"0.7622539",
"0.76116127",
"0.7597168",
"0.75255555",
"0.74806607",
"0.74806607",
"0.7441403",
"0.7303434",
"0.7303434",
"0.7265719",
"0.7265719",
"0.7265719",
"0.7265719",
"0.7265719"... | 0.6979214 | 35 |
Convert an image from LAB color space to XYZ color space | def lab_to_xyz(image: tf.Tensor) -> tf.Tensor:
l, a, b = tf.unstack(image, axis=-1)
var_y = (l + 16) / 116
var_x = a / 500 + var_y
var_z = var_y - b / 200
var_x = tf.where(tf.pow(var_x, 3) > 0.008856, tf.pow(var_x, 3),
(var_x - 16 / 116) / 7.787)
var_y = tf.where(tf.pow(var... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Lab_to_XYZ(cobj, *args, **kwargs):\r\n\r\n illum = cobj.get_illuminant_xyz()\r\n xyz_y = (cobj.lab_l + 16.0) / 116.0\r\n xyz_x = cobj.lab_a / 500.0 + xyz_y\r\n xyz_z = xyz_y - cobj.lab_b / 200.0\r\n \r\n if math.pow(xyz_y, 3) > color_constants.CIE_E:\r\n xyz_y = math.pow(xyz_y, 3)\r\n ... | [
"0.72538626",
"0.6935359",
"0.6835545",
"0.6804529",
"0.6711759",
"0.66599464",
"0.6521106",
"0.64231324",
"0.6351376",
"0.63161516",
"0.62939584",
"0.62429935",
"0.6191677",
"0.6155172",
"0.6133433",
"0.60679656",
"0.605217",
"0.600619",
"0.6003839",
"0.5994653",
"0.5972754"... | 0.72095025 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.