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 |
|---|---|---|---|---|---|---|
Returns a list of items in the queue, starting with the item in the front of the queue. | def items(self):
current = self.first
output = []
while current is not None:
output.append(current.item)
current = current.next_node
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_to_list(queue):\n result = []\n while queue.qsize() != 0:\n result.append(queue.get())\n return result",
"def get_from_head(self, total_count = 1) -> list:\n return self.queue.get_all(total_count)",
"def get_all_nowait(queue: Queue) -> list:\n\n results = []\n\n while Tru... | [
"0.6878175",
"0.66443473",
"0.66142774",
"0.65437406",
"0.6519724",
"0.64220434",
"0.6421816",
"0.63827026",
"0.63620025",
"0.62990564",
"0.62929565",
"0.62783927",
"0.6251019",
"0.6233285",
"0.62047136",
"0.61885864",
"0.6186185",
"0.6179419",
"0.61729276",
"0.6167859",
"0.6... | 0.5712701 | 76 |
Returns items in the queue as a generator, starting with the item in the front of the queue. | def iteritems(self):
current = self.first
while current is not None:
yield current.item
current = current.next_node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_iter(queue: Queue) -> Generator[T, None, None]:\n while True:\n val = queue.get()\n yield val",
"def get_generator(self):\n while self._is_running():\n yield self._queue.get()",
"def get_generator(self):\n while self._is_running():\n yield self._qu... | [
"0.73305446",
"0.6846361",
"0.6846361",
"0.6739455",
"0.6710887",
"0.66482306",
"0.66402185",
"0.6560582",
"0.65385216",
"0.65255594",
"0.647886",
"0.6452622",
"0.6448023",
"0.63225293",
"0.6262202",
"0.62370265",
"0.62243056",
"0.622232",
"0.62099403",
"0.62061656",
"0.61503... | 0.6098278 | 24 |
Assign grille to a face or list of faces. | def assign_grille(
self,
air_faces,
free_loss_coeff=True,
free_area_ratio=0.8,
resistance_type=0,
external_temp="AmbientTemp",
expternal_pressure="AmbientPressure",
x_curve=["0", "1", "2"],
y_curve=["0", "1", "2"],
):
boundary_name = ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setFace(self, value):\n self.face = value",
"def setFace(self, value):\n self.face = value",
"def change_face(self, face):\n if self.face is not None:\n self.face.remove_point(self)\n\n self.face = face\n self.face.add_point(self)",
"def faces(self, f):\n ... | [
"0.66815275",
"0.66815275",
"0.6373914",
"0.6209701",
"0.59925044",
"0.5832084",
"0.5554151",
"0.55246836",
"0.54223424",
"0.54047036",
"0.5346412",
"0.5306642",
"0.52954996",
"0.52843904",
"0.52732515",
"0.5261938",
"0.5224992",
"0.4994123",
"0.49903914",
"0.49413803",
"0.49... | 0.57588255 | 6 |
load requirements from a pip requirements file | def parse_requirements(filename):
lineiter = (line.strip() for line in open(filename))
return [line for line in lineiter if line and not
line.startswith("#")] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_requirements():\n reqs_path = path.join('.', 'requirements.txt')\n with open(reqs_path, 'r') as f:\n requirements = [line.rstrip() for line in f]\n return requirements",
"def parse_requirements_from_pipfile():\n lineiter = (line.strip() for line in open('Pipfile'))\n requirements_p... | [
"0.7208096",
"0.71944356",
"0.71887195",
"0.7140441",
"0.7139842",
"0.70933205",
"0.7042971",
"0.7024391",
"0.7011328",
"0.69305325",
"0.6918911",
"0.69032866",
"0.69032866",
"0.6902263",
"0.6824025",
"0.6822713",
"0.68031853",
"0.6721816",
"0.67179585",
"0.67171687",
"0.6677... | 0.0 | -1 |
Return the ideal heavy outputs dictionary. | def heavy_outputs(self):
return self._heavy_outputs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outputs(self):\n\t\treturn {k: v * self.throughput for k, v in self.per_process_outputs.items()}",
"def _get_output_dictionary(self):\n\n return_dictionary = {}\n\n for output_path in self.provided_outputs:\n return_dictionary[output_path.full_path] = self.get_value(output_path)\n\n ... | [
"0.71540225",
"0.66443044",
"0.6476039",
"0.63870174",
"0.63750595",
"0.62371063",
"0.61654824",
"0.5891897",
"0.58325523",
"0.5820708",
"0.5816429",
"0.5775973",
"0.5712373",
"0.5689303",
"0.5686148",
"0.5658862",
"0.56549037",
"0.56337756",
"0.5616627",
"0.55943936",
"0.558... | 0.74387336 | 0 |
Constructor ui reference to the main window (UserInterface) parent reference to the parent widget (QWidget) | def __init__(self, ui, parent=None):
super(LogViewer, self).__init__(parent)
self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
self.__ui = ui
self.__logViewer = LogViewerEdit(self)
from .SearchWidget import SearchWidget
self.__searchWidget ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, parent=None):\n super(MainWindow, self).__init__(parent)\n self.setupUi(self)",
"def __init__(self, parent=None):\n super(MainWindow, self).__init__(parent)\n self.setupUi(self)",
"def __init__(self, parent=None):\n super(MainWindow, self).__init__(parent)\... | [
"0.82350004",
"0.82350004",
"0.82350004",
"0.82350004",
"0.82350004",
"0.8185358",
"0.8032135",
"0.79948115",
"0.7969998",
"0.79270154",
"0.7819043",
"0.7819043",
"0.773617",
"0.75984144",
"0.74537635",
"0.74435335",
"0.7442315",
"0.7403857",
"0.73323625",
"0.730685",
"0.7301... | 0.6493565 | 93 |
Set the player's throw. | def wrapped(widget):
if r:
obj.player_choice = random.choice(list(evilrps.Throws))
else:
# print(widget, 'throw', throw)
obj.player_choice = throw
obj.advance() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def throw(self, currentplayer):\n\t\tif self.roll_speed < 2000:\n\t\t\tself.roll()\n\t\t\tpygame.time.set_timer(STOP_DIE, self.roll_speed)\n\t\t\tself.roll_speed = round(self.roll_speed**1.53)\n\t\telse:\n\t\t\t# Die is still. Call roll one last time and set the number\n\t\t\tprint(\"die is still\")\n\t\t\tself.nu... | [
"0.65709543",
"0.601663",
"0.5953763",
"0.5794381",
"0.5505258",
"0.5496749",
"0.5469549",
"0.5466819",
"0.54637325",
"0.5406805",
"0.5403799",
"0.53923684",
"0.5384944",
"0.5324972",
"0.52134234",
"0.51807",
"0.51762146",
"0.5167459",
"0.51670873",
"0.51628953",
"0.51511955"... | 0.6507764 | 1 |
Returns the current price of the given bundle. | def _compute_bundle_price(self, bundle):
details = ''
# 1. Build a mapping from resource-specific info to price
res_to_price_map = self._res_man.get_res_to_price_mapping()
if self._use_price_token and bundle.has_price_token():
# Use token if enabled & provided. If token has e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price(self) -> float:\n if self.product:\n price = self.product.prices.filter(active=True).first()\n return int(price.unit_amount / 100)\n return -1",
"def get_product_price(product):\n return latest_product_version(product).price",
"def get_price(self):\r\n re... | [
"0.69588786",
"0.67926645",
"0.6792079",
"0.67808473",
"0.67808473",
"0.67808473",
"0.6713399",
"0.6700769",
"0.66505605",
"0.6636159",
"0.66124856",
"0.65355116",
"0.65275353",
"0.65275353",
"0.6403931",
"0.63826656",
"0.63824165",
"0.6373656",
"0.63707584",
"0.63482493",
"0... | 0.77867067 | 0 |
Return the version of the API. | def get_version():
f = open("version.txt", 'r')
version = f.readline().strip('\n')
f.close()
return jsonify({"version": version}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version(self):\n return self.api_version",
"def get_version(self):\n return self.__make_api_call('get/version')",
"def get_api_version(self):\n major, minor, patch = self.client.config['api_version']\n return '%s.%s.%s' % (major, minor, patch)",
"def api_version(self):\n\n... | [
"0.90025836",
"0.89061993",
"0.8716989",
"0.8657681",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
"0.86539876",
... | 0.0 | -1 |
Extract problem number and language from filename. | def parse_filename(f):
problem = f[2:5]
extension = f.split('.')[-1]
if extension not in langs.keys():
# if the extension isn't in our list we don't care about the file
return (None, None)
return (problem, extension) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_language_from_file_name(filename: str) -> str:\n return Path(filename).resolve().with_suffix(\"\").name",
"def get_language(fn):\n # FIXME - this expects the fn to be '.../XX/LC_MESSAGES/messages.po'\n return fn.split(os.sep)[-3]",
"def guess_problem(self, path):\n problem, ext = os.pat... | [
"0.65099007",
"0.6477955",
"0.5991345",
"0.5938866",
"0.592048",
"0.5904813",
"0.5881841",
"0.586952",
"0.58304256",
"0.5703422",
"0.570281",
"0.56935406",
"0.56826293",
"0.5662054",
"0.56574833",
"0.5641236",
"0.5618889",
"0.5614232",
"0.5544081",
"0.5519197",
"0.5504639",
... | 0.727911 | 0 |
computes KL divergences between two Gaussians with given parameters | def gaussian_kl_div(mean_0, cov_0, mean_1, cov_1, dim):
mean_diff = mean_1 - mean_0
cov_1_inv = tf.reciprocal(cov_1)
log_cov_1_det = tf.reduce_sum(tf.log(cov_1), axis=[1])
log_cov_0_det = tf.reduce_sum(tf.log(cov_0), axis=[1])
log_term = log_cov_1_det - log_cov_0_det
trace_term = tf.reduce_sum(c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def KL_divergence(model_1, model_2, samples):\n posterior_1 = create_posterior_object(model_1, samples)\n posterior_2 = create_posterior_object(model_2, samples)\n return posterior_1.KL(posterior_2)",
"def kl_gaussian_gaussian_analytic(mu_q, logvar_q, mu_p, logvar_p):\n # init\n batch_size = mu_q.... | [
"0.72388107",
"0.6910017",
"0.6894922",
"0.68472576",
"0.6779738",
"0.6659188",
"0.66573954",
"0.6615593",
"0.65750533",
"0.6552618",
"0.6473315",
"0.6462868",
"0.6447152",
"0.64378923",
"0.6435891",
"0.64307237",
"0.64105403",
"0.6390125",
"0.6342134",
"0.6315715",
"0.629020... | 0.6427663 | 16 |
Return a L{SSHSimpleAvatar} that uses ``self.proto`` as protocol. | def requestAvatar(self, avatarId, mind, *interfaces):
if conchinterfaces.IConchUser in interfaces:
avatar = SSHSimpleAvatar(avatarId, self.proto)
return interfaces[0], avatar, lambda: None
else:
raise Exception("No supported interfaces found.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self):\n \n p = self.protocol()\n p.factory = self\n return p",
"def ssh(self, new=False, waitUp=True):\n if new:\n return Ssh(self, \"\".join([self.username, '@', self.url]))\n\n if self._ssh:\n return self._ssh\n\n self._ssh = ... | [
"0.5337256",
"0.5119516",
"0.5052636",
"0.4982192",
"0.49626386",
"0.4958354",
"0.4958292",
"0.49484098",
"0.49389306",
"0.49389306",
"0.49389306",
"0.49307394",
"0.49133503",
"0.48593906",
"0.48505425",
"0.48438805",
"0.48305398",
"0.480467",
"0.478909",
"0.4756514",
"0.4752... | 0.48853382 | 13 |
Converts date string into UTC datetime object | def str_to_datetime(self, dt_string):
return datetime.datetime.strptime(dt_string, "%Y-%m-%d").replace(
tzinfo=timezone.utc) if dt_string is not None else datetime.datetime.utcnow() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_datetime(datestr):\r\n try:\r\n return dateutil.parser.parse(datestr).replace(tzinfo=utc)\r\n except ValueError:\r\n raise DashboardError(_(\"Unable to parse date: \") + datestr)",
"def parse(date_string: str):\n # parse the date string\n date = dateutil.parser.parse(date_stri... | [
"0.7567312",
"0.754763",
"0.754763",
"0.75145286",
"0.73969394",
"0.7324327",
"0.7264657",
"0.7232909",
"0.7204877",
"0.7177064",
"0.71701044",
"0.71201634",
"0.7108171",
"0.7096173",
"0.7055034",
"0.70515555",
"0.70351195",
"0.7005439",
"0.6998112",
"0.6957853",
"0.6954065",... | 0.72054285 | 8 |
Converts a datetime instance to an HTTP date string. | def dt_to_http(dt):
# Tue, 15 Nov 1994 12:45:26 GMT
return dt.strftime('%a, %d %b %Y %H:%M:%S GMT') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def httpdate(date_obj):\n return date_obj.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")",
"def http_date(d=None):\n if not d:\n d = datetime.datetime.utcnow()\n return d.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")",
"def http_date(epoch_seconds=None):\n return formatdate(epoch_seconds, usegmt=True)",
... | [
"0.7712367",
"0.73308283",
"0.70412636",
"0.69220614",
"0.674512",
"0.66672254",
"0.6651549",
"0.6576911",
"0.6574302",
"0.6549761",
"0.6496985",
"0.6476049",
"0.6476049",
"0.6464428",
"0.6451866",
"0.63511235",
"0.63375556",
"0.62699145",
"0.62502176",
"0.6221522",
"0.622039... | 0.7186173 | 3 |
Code from Stack Overflow's thread 2D gaussian mask should give the same result as MATLAB's fspecial('gaussian',[shape],[sigma]) | def gauss_2d(shape=(3, 3), sigma=0.5):
m, n = [(ss - 1.) / 2. for ss in shape]
y, x = np.ogrid[-m:m + 1, -n:n + 1]
h = np.exp(-(x * x + y * y) / (2. * sigma * sigma))
h[h < np.finfo(h.dtype).eps * h.max()] = 0
sumh = h.sum()
if sumh != 0:
h /= sumh
return h | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fspecial_gaussian(shape=(3, 3), sigma=0.5):\n m, n = [(ss - 1.) / 2. for ss in shape]\n y, x = np.ogrid[-m:m + 1, -n:n + 1]\n h = np.exp(-(x * x + y * y) / (2. * sigma * sigma))\n h[h < np.finfo(h.dtype).eps * h.max()] = 0\n sumh = h.sum()\n if sumh != 0:\n h /= sumh\n return h",
... | [
"0.78761524",
"0.7835241",
"0.7257477",
"0.7124766",
"0.7013949",
"0.6976483",
"0.69737065",
"0.6862989",
"0.6862989",
"0.68552184",
"0.6814549",
"0.67824596",
"0.677597",
"0.67612404",
"0.6757782",
"0.67248285",
"0.6699591",
"0.66922706",
"0.66522694",
"0.6613883",
"0.661035... | 0.6392105 | 37 |
Returns the number of key stored in self. | def num_keys(self):
return len(self.keys) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumberOfKeys(self) -> int:\n ...",
"def getKeyCount(self,\n key):\n if (self.hasKey(key) == 1):\n return self.__keyCount[key]\n else:\n return 0",
"def getNoOfKeys(self):\n return len(self.__keyList)",
"def size(self, key):\n ... | [
"0.8223332",
"0.8059746",
"0.772476",
"0.7713106",
"0.7676172",
"0.7665692",
"0.7628625",
"0.76206857",
"0.7604216",
"0.7455673",
"0.7455673",
"0.74253446",
"0.73838294",
"0.7367744",
"0.7305631",
"0.73002994",
"0.7284549",
"0.7284549",
"0.7281263",
"0.72693294",
"0.72623026"... | 0.7749467 | 2 |
Returns the smallest key in self's subtree. | def deep_min(self):
node = self
while not node.is_leaf():
node = node.children[0]
return node.keys[0] if node.keys else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_min(self):\n if self.root is None: # BC1\n return float('+inf')\n\n current = self.root\n while current.left is not None: # Traverse like a linked-list\n current = current.left\n\n return current.key",
"def min(self):\n if not self.root:\n ... | [
"0.82188064",
"0.8162049",
"0.7955827",
"0.77344906",
"0.768402",
"0.75149393",
"0.7390059",
"0.7334936",
"0.7302149",
"0.7246546",
"0.7226745",
"0.71841216",
"0.7107352",
"0.70095193",
"0.69946045",
"0.69824237",
"0.696417",
"0.6937441",
"0.6906481",
"0.69047743",
"0.6857602... | 0.76173735 | 5 |
Returns the index of the key potentially preceding key in self. If no predecessor exists, then 1 is returned. | def locate_predecessor(self, key):
index = self.search(key)
return index-1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predecessor(self, key):\r\n index = self.locate_predecessor(key)\r\n return self.keys[index] if index >= 0 else None",
"def predecessor(self, key):\r\n node = self.root\r\n predecessor = None\r\n while node:\r\n index = node.locate_predecessor(key)\r\n ... | [
"0.7872401",
"0.7589656",
"0.6912195",
"0.66506773",
"0.63922715",
"0.6348661",
"0.63404214",
"0.6321943",
"0.6298526",
"0.6276858",
"0.6144792",
"0.6108566",
"0.6081407",
"0.6023274",
"0.59759766",
"0.59638053",
"0.5955006",
"0.59512085",
"0.5928223",
"0.59244543",
"0.592433... | 0.8231871 | 0 |
Returns the key succeeding key in self. If no successor exists, then None is returned. | def successor(self, key):
index = self.locate_successor(key)
self.keys[index] if index < self.num_keys() else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def successor(self, key):\r\n node = self.root\r\n successor = None\r\n while node:\r\n index = node.locate_successor(key)\r\n if index < node.num_keys():\r\n successor = node.keys[index]\r\n node = node.children[index] if not node.is_leaf() else... | [
"0.8028854",
"0.73851246",
"0.7282003",
"0.7208794",
"0.7198265",
"0.6955634",
"0.6844323",
"0.6605388",
"0.6567931",
"0.64927167",
"0.64615375",
"0.64292336",
"0.640851",
"0.6341994",
"0.6266964",
"0.62656814",
"0.6251835",
"0.62339365",
"0.62281877",
"0.62220705",
"0.621249... | 0.80394524 | 0 |
Returns a string representing self. | def __str__(self):
T = Btree(2)
T.root = Node(self.keys, [Node(child.keys, []) for child in self.children])
return str(T) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self) -> str:\n return '{:s}({!r})'.format(self.__class__.__name__, self.getvalue())",
"def __repr__(self) -> str:\n return '{:s}({!r})'.format(self.__class__.__name__, self.getvalue())",
"def __repr__(self) -> str:\n return '{:s}({!r})'.format(self.__class__.__name__, self.ge... | [
"0.8629778",
"0.8629778",
"0.8629778",
"0.86215127",
"0.8617751",
"0.859226",
"0.859226",
"0.859226",
"0.859226",
"0.85823804",
"0.85522574",
"0.8511063",
"0.85021406",
"0.8465271",
"0.84598",
"0.84598",
"0.84598",
"0.84598",
"0.84598",
"0.84598",
"0.84598",
"0.84598",
"0... | 0.0 | -1 |
Returns an empty btree with the given degree. | def __init__(self, degree):
self.root = Node([], [])
self.min_num_keys = degree - 1
self.max_num_keys = 2*degree - 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty_trie():\n trie = Trie()\n return trie",
"def create_empty_node():\n from linked_list import Node\n return Node()",
"def generate_kdtree(self):\n if self.method==2:\n coordinates = self.unassigned_data[0:3,:]\n else:\n coordinates = self.unassigned_data[0:2,:]\n tree... | [
"0.54264593",
"0.5319066",
"0.5302084",
"0.5298092",
"0.5296648",
"0.5273489",
"0.5268416",
"0.5260879",
"0.52504086",
"0.52388066",
"0.52255917",
"0.52025175",
"0.5162751",
"0.51332253",
"0.51297206",
"0.5105742",
"0.51046455",
"0.50928676",
"0.50726986",
"0.50614315",
"0.50... | 0.60590124 | 0 |
Indicates if the group is discoverable for users to selfregister to it. | def discoverable(self):
return sa.Column(sa.Boolean(), default=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_registered(self) -> bool:\n from arkouda.util import is_registered\n\n if self.registered_name is None:\n return False\n return is_registered(self.registered_name)",
"def can_group(self) -> bool:\n return (\n self.all_icon is not None and\n self... | [
"0.6570439",
"0.6480385",
"0.64103687",
"0.63470215",
"0.62850165",
"0.62850165",
"0.61633754",
"0.6154956",
"0.61019635",
"0.607818",
"0.60778564",
"0.6061658",
"0.60249096",
"0.59742856",
"0.5905762",
"0.5863819",
"0.58594495",
"0.58562326",
"0.5855537",
"0.58496606",
"0.58... | 0.55592 | 65 |
List all groups a user belongs to, filtered by UserGroup status type. | def get_groups_by_status(self, status, db_session=None):
# type: (UserGroupStatus, Session) -> Set[Str]
from magpie.api.management.user.user_utils import get_user_groups_checked
cur_session = get_db_session(session=db_session) if db_session else get_db_session(obj=self)
group_names = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_groups_by_status(self, status, db_session=None):\n # type: (UserGroupStatus, Session) -> List[Str]\n return []",
"def list_user_groups(self, user_id):\n resp, body = self.get('users/%s/groups' % user_id)\n self.expected_success(200, resp.status)\n body = json.loads(body... | [
"0.7415561",
"0.73563224",
"0.7105298",
"0.6973147",
"0.69514817",
"0.69147885",
"0.6911052",
"0.6895397",
"0.6881288",
"0.6803313",
"0.67458916",
"0.6714019",
"0.6666444",
"0.66410464",
"0.662373",
"0.66146386",
"0.6581608",
"0.65467393",
"0.6506116",
"0.6485276",
"0.6473893... | 0.74114037 | 1 |
Email of the user. | def email(self):
return sa.Column(sa.Unicode(100), nullable=False, unique=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_useremail(self):\n return self.user.email",
"def get_user_email(self):\n member = self.get_user()\n if member:\n return member.getProperty('email')",
"def user_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"user_email\")",
"def email(self, instan... | [
"0.85852766",
"0.8581432",
"0.85670006",
"0.85598457",
"0.8300198",
"0.8293188",
"0.8293188",
"0.8293188",
"0.8182699",
"0.81291264",
"0.8074925",
"0.8074925",
"0.8074925",
"0.8074925",
"0.8064869",
"0.80555576",
"0.7989175",
"0.797051",
"0.79486954",
"0.7945147",
"0.79444593... | 0.0 | -1 |
Return list of hashes or if ``with_abundance`` a list of (hash, abund). | def get_mins(self, with_abundance=False):
mins = self.hashes
if not with_abundance:
return mins.keys()
return mins | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAbundances(self, species): \n return self.abundance_df[self.abundance_df[self.tax_levels[0]]==species]",
"def get_fingerprintable_for_scope(self, bottom_scope, include_passthru=False):\n pairs = []\n if include_passthru:\n pu_args = self.passthru_args_for_scope(bottom_scope)\n ... | [
"0.5129425",
"0.5110695",
"0.4949431",
"0.49324703",
"0.48975635",
"0.48139",
"0.4699067",
"0.46907076",
"0.46503294",
"0.46276388",
"0.46026292",
"0.4587694",
"0.45864993",
"0.45608535",
"0.45470384",
"0.45394257",
"0.45306677",
"0.44996083",
"0.44410548",
"0.44238195",
"0.4... | 0.41494182 | 79 |
If track_abundance=True, return a new flattened MinHash. | def flatten(self):
if self.track_abundance:
# create new object:
a = MinHash(
self.num, self.ksize,
is_protein=self.is_protein, dayhoff=self.dayhoff, hp=self.hp,
track_abundance=False, seed=self.seed, max_hash=self._max_hash
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inflate(self, from_mh):\n if not self.track_abundance and from_mh.track_abundance:\n orig_abunds = from_mh.hashes\n abunds = { h: orig_abunds.get(h, 0) for h in self.hashes }\n\n abund_mh = from_mh.copy_and_clear()\n\n abund_mh.downsample(scaled=self.scaled)\n... | [
"0.718268",
"0.5613122",
"0.48945636",
"0.48383635",
"0.47822806",
"0.46781078",
"0.4643958",
"0.46218306",
"0.4583534",
"0.45498845",
"0.4548925",
"0.45155597",
"0.45114824",
"0.45092195",
"0.4481805",
"0.44715574",
"0.44415337",
"0.4435643",
"0.4407659",
"0.43675295",
"0.43... | 0.81907636 | 0 |
Get absolute path to resource, works for dev and for PyInstaller | def resource_path(relative_path):
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep",
"def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa... | [
"0.8369502",
"0.82807344",
"0.82486343",
"0.8139249",
"0.81141466",
"0.80987823",
"0.8094279",
"0.8079923",
"0.8067883",
"0.80675626",
"0.806267",
"0.806267",
"0.806267",
"0.806267",
"0.806267",
"0.806267",
"0.806267",
"0.8057104",
"0.8054725",
"0.8040472",
"0.802546",
"0.8... | 0.8045005 | 30 |
Sets the name of this PutPlaceOfDeliveryRequest. | def name(self, name):
if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
if (self.local_vars_configuration.client_side_validation and
name is not None and len(n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self, name):\n\n self._set_field(\"name\", name)",
"def name(self, name):\n\n self._set_field(\"name\", name.get_json())",
"def setName(self, name):\n self._name = name",
"def setName(self, name):\n self._name = name",
"def setName(self, name): \n\n self._... | [
"0.6076372",
"0.6032923",
"0.6018987",
"0.6018987",
"0.60096157",
"0.5992969",
"0.5963822",
"0.5963822",
"0.59596694",
"0.5956696",
"0.5946499",
"0.5946499",
"0.5946499",
"0.5946499",
"0.5946499",
"0.5938504",
"0.59374225",
"0.5912693",
"0.5912693",
"0.5912693",
"0.5912693",
... | 0.0 | -1 |
Sets the address of this PutPlaceOfDeliveryRequest. | def address(self, address):
if self.local_vars_configuration.client_side_validation and address is None: # noqa: E501
raise ValueError("Invalid value for `address`, must not be `None`") # noqa: E501
self._address = address | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_address(self, address):\n pass",
"def address(self, address: object):\n\n self._address = address",
"def address(self, address):\n if address is None:\n raise ValueError(\"Invalid value for `address`, must not be `None`\")\n\n self._address = address",
"def addr... | [
"0.68177485",
"0.6768427",
"0.6641226",
"0.6530036",
"0.6525921",
"0.6525921",
"0.6525921",
"0.6525921",
"0.6525921",
"0.6525921",
"0.6525921",
"0.6525921",
"0.64892906",
"0.6471068",
"0.64590454",
"0.6444913",
"0.6377512",
"0.6147737",
"0.6036644",
"0.6008579",
"0.60085624",... | 0.6639484 | 3 |
Sets the is_active of this PutPlaceOfDeliveryRequest. | def is_active(self, is_active):
if self.local_vars_configuration.client_side_validation and is_active is None: # noqa: E501
raise ValueError("Invalid value for `is_active`, must not be `None`") # noqa: E501
self._is_active = is_active | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_active(self, is_active: bool):\n if is_active is None:\n raise ValueError(\"Invalid value for `is_active`, must not be `None`\")\n\n self._is_active = is_active",
"def is_active(self, is_active):\n \n self._is_active = is_active",
"def is_active(self, is_active):\n... | [
"0.6953809",
"0.69315886",
"0.6882505",
"0.6882505",
"0.6882505",
"0.6882505",
"0.65718555",
"0.6415791",
"0.6415791",
"0.6415791",
"0.6415791",
"0.63974744",
"0.63104624",
"0.62700874",
"0.6220443",
"0.6220443",
"0.6220443",
"0.6220443",
"0.61376953",
"0.6026736",
"0.5875359... | 0.66459626 | 6 |
Sets the preferred_certificates of this PutPlaceOfDeliveryRequest. | def preferred_certificates(self, preferred_certificates):
self._preferred_certificates = preferred_certificates | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _populate_placements(self, preferred):\n # local copy of placement energies\n self._placements = deepcopy(placements)\n \n # top right is the Imhof-approved default\n if preferred == 'top right' or not preferred:\n return\n \n # bump up the cost of ev... | [
"0.518077",
"0.48272905",
"0.47806227",
"0.47716486",
"0.47564572",
"0.44579473",
"0.42863858",
"0.41883492",
"0.40855017",
"0.40254852",
"0.40168348",
"0.3994004",
"0.39610207",
"0.39524785",
"0.3904179",
"0.3873847",
"0.3873847",
"0.3866805",
"0.3838608",
"0.38366878",
"0.3... | 0.7998088 | 0 |
Sets the user_custom_data of this PutPlaceOfDeliveryRequest. | def user_custom_data(self, user_custom_data):
self._user_custom_data = user_custom_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_data(self, custom_data):\n\n self._custom_data = custom_data",
"def user_defined_data(self, user_defined_data: UserDefinedDatadef):\n\n self._user_defined_data = user_defined_data",
"def replace_user_data(self, new_data):\n self._user_data = new_data",
"def custom_user_id(self... | [
"0.6408397",
"0.58488166",
"0.54311585",
"0.5422966",
"0.53631914",
"0.5330175",
"0.5229796",
"0.511307",
"0.5076588",
"0.49836394",
"0.49728966",
"0.49726078",
"0.49514154",
"0.49293578",
"0.4902357",
"0.48885697",
"0.4876837",
"0.48690352",
"0.4847708",
"0.48377663",
"0.483... | 0.7539687 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, PutPlaceOfDeliveryRequest):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, PutPlaceOfDeliveryRequest):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8457167",
"0.8393036",
"0.81455255",
"0.8139734",
"0.81333447",
"0.8094964",
"0.8093362",
"0.8093362",
"0.8093362",
"0.80863476",
"0.80863476",
"0.8077286",
"0.8077286",
"0.806682",
"0.80435175",
"0.80435175",
"0.80435175",
"0.80435175",
"0.80435175",
"0.80435175",
"0.8043... | 0.0 | -1 |
Expires the token in the given time. | def expires_in_seconds(self, seconds):
if not isinstance(seconds, int):
raise TypeError('Seconds must be an int')
self.token['expires'] = int((datetime.now().timestamp() + seconds)*1000.0)
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expire(self):\n logging.debug(\"Expiring token as wanted...\")\n self.expiration = datetime.now() - timedelta(seconds=(10))",
"def _set_token_expiration_time(self, expires_in):\n self.token_expiration_time = dt.datetime.utcnow() + dt.timedelta(0, expires_in) # timedelta(days, seconds)",... | [
"0.76917213",
"0.6979363",
"0.6799405",
"0.67159325",
"0.66909903",
"0.65411913",
"0.6493937",
"0.64727396",
"0.6457241",
"0.6428322",
"0.62765664",
"0.62321156",
"0.61634",
"0.6146268",
"0.61437196",
"0.6119173",
"0.60557485",
"0.6051389",
"0.5999419",
"0.5987485",
"0.596032... | 0.623812 | 11 |
Return the config. Use this method to get the bot config | def get_config(self) -> Dict[str, Any]:
if self.config is None:
self.config = self.load_config()
return self.config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config(self):\n if self.__config is None:\n self.__config = self._get_config(self.bot)\n return self.__config",
"def get_config(self):\n return self.config",
"def getConfig(self):\n \n return self.config",
"def get_config():\n return CONFIG",
"def config... | [
"0.8793585",
"0.825753",
"0.8087057",
"0.7923807",
"0.7904086",
"0.78217363",
"0.78192705",
"0.78192705",
"0.78192705",
"0.78192705",
"0.78192705",
"0.78192705",
"0.78192705",
"0.78192705",
"0.78192705",
"0.78192705",
"0.78192705",
"0.78192705",
"0.78192705",
"0.78192705",
"0... | 0.7942068 | 4 |
dy/dt = f(y,t) with y(0)=1 dy/dt = 2y > solution y(t) = c exp(2t) | def rhs(y,t):
return math.cos(t) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ret_f(t,y):\n\n f = np.zeros(3)\n f[0] = 77.27*(y(1) - y(0)*y(1)+ y(0)-8.375e-6*y(0)*y(0))\n f[1] = (1.0/77.27)*(-y(1)-y(0)*y(1)+y(2))\n f[2] = 0.161*(y(0)-y(2))\n\n return f",
"def dY_dt(self, y, t=0):\n\t\t \n\t\t#variables\n\t\tpSgg = y[0] / float(sum(y))\n\t\tpSgh = y[3] / float(sum(y))... | [
"0.69780666",
"0.6871589",
"0.6852503",
"0.6789334",
"0.6778427",
"0.66323686",
"0.6560891",
"0.6533457",
"0.65250427",
"0.6490271",
"0.64422923",
"0.6435977",
"0.64358383",
"0.6398747",
"0.6392627",
"0.6340595",
"0.63075",
"0.62892526",
"0.62366945",
"0.62335855",
"0.6227496... | 0.0 | -1 |
r"""Compute the sigmoid cross entropy with contiguous targets. | def sigmoid_cross_entropy(inputs, reduction='valid', **kwargs):
args = ArgHelper.parse(locals())
args['reduction'] = reduction.upper()
op_lib = loss_ops_lib.SigmoidCrossEntropy
if context.executing_eagerly():
return op_lib \
.instantiate(reduction=args['reduction']) \
.ap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sigmoid_cross_entropy(self):\n loss_op = pointwise_losses.SigmoidCrossEntropy()\n\n y_pred = loss_op.final_activation_op({\n \"logits\": self.logits,\n \"metadata\": {\n \"mask\": self.mask\n }\n })\n assert np.isclose(y_pred[0][0... | [
"0.733087",
"0.7251085",
"0.70497286",
"0.7024441",
"0.68964267",
"0.6850176",
"0.6775583",
"0.6740799",
"0.6706655",
"0.6696851",
"0.66841483",
"0.66245735",
"0.6619512",
"0.6565874",
"0.65273166",
"0.6526585",
"0.6509253",
"0.6495321",
"0.6495321",
"0.64779925",
"0.6461931"... | 0.6762066 | 7 |
r"""Compute the sigmoid focal loss with sparse labels. | def sigmoid_focal_loss(
inputs,
axis=1,
alpha=0.25,
gamma=2.,
negative_index=None,
reduction='valid',
**kwargs
):
args = ArgHelper.parse(locals())
args['alpha'] = float(args['alpha'])
args['gamma'] = float(args['gamma'])
args['reduction'] = reduction.upper()
op_lib = loss... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def focal_loss_sigmoid(labels, logits, alpha=0.5, gamma=2):\n\n prob = logits.sigmoid()\n labels = torch.nn.functional.one_hot(labels.squeeze().long(), num_classes=prob.shape[1])\n\n cross_ent = torch.clamp(logits, min=0) - logits * labels + torch.log(1+torch.exp(-torch.abs(logits)))\n prob_t = (la... | [
"0.7132021",
"0.7093548",
"0.66306",
"0.6588871",
"0.65455276",
"0.6520407",
"0.64797497",
"0.6420658",
"0.6377443",
"0.63494956",
"0.63168055",
"0.62914336",
"0.62914336",
"0.6280836",
"0.6270551",
"0.6268474",
"0.6265231",
"0.6265231",
"0.6265231",
"0.6265231",
"0.6265231",... | 0.65818846 | 4 |
r"""Compute the softmax cross entropy with contiguous targets. | def softmax_cross_entropy(inputs, axis=1, reduction='mean', **kwargs):
args = ArgHelper.parse(locals())
args['reduction'] = reduction.upper()
op_lib = loss_ops_lib.SoftmaxCrossEntropy
if context.executing_eagerly():
return op_lib \
.instantiate(
axis=axis,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_entropy(input: Tensor, target: Tensor) -> Tensor:\n norm_log = log_softmax(input, 1)\n\n np_one_hot = np.eye(input.shape[1])[target.data]\n tensor_one_hot = tensor(np_one_hot, 'one-hot', False, True)\n\n mask = -norm_log * tensor_one_hot\n mask_sum = sum(mask, 1)\n loss = sum(mask_sum, ... | [
"0.7206213",
"0.71602994",
"0.71359116",
"0.7133334",
"0.7103154",
"0.6957571",
"0.6934931",
"0.6868393",
"0.6858417",
"0.6841772",
"0.6818581",
"0.68184334",
"0.67718226",
"0.6725869",
"0.67039573",
"0.66911614",
"0.668195",
"0.665026",
"0.6638869",
"0.6636618",
"0.65985984"... | 0.67265826 | 13 |
Returns user with highest average rating | def most_positive_user(self):
rating_max = 0
rating_max_user = ""
for user in self.users.values():
rating = user.get_average_rating()
if rating > rating_max:
rating_max = rating
rating_max_user = user
else:
conti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_average_rating(self):\n count = 0\n total = 0\n num_books = len(self.books)\n if num_books > 0:\n for rating in self.books.values():\n if rating:\n count += 1\n total += rating\n average = total / count\n... | [
"0.70983166",
"0.6912731",
"0.68344504",
"0.6794513",
"0.67550117",
"0.6752274",
"0.6622795",
"0.6618791",
"0.657425",
"0.655887",
"0.6550182",
"0.65312135",
"0.6514526",
"0.65007603",
"0.64462924",
"0.64313",
"0.6414315",
"0.6395596",
"0.638889",
"0.6372267",
"0.63228005",
... | 0.7960793 | 0 |
Extract features from a sentence represented as a list of words. Includes a flag add_to_indexer to | def extract_features(self, ex_words: List[str], add_to_indexer: bool) -> List[int]:
raise Exception("Don't call me, call my subclasses") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_features(self, ex_words: List[str], add_to_indexer: bool=False) -> List[int]:\n raise Exception(\"Don't call me, call my subclasses\")",
"def _sentence_to_features(self,sentence):\n\n configured_features = self.configFeatures\n sentence_features = []\n\n for word_idx in ra... | [
"0.73790205",
"0.70586795",
"0.6696932",
"0.66269016",
"0.66092473",
"0.6585194",
"0.65552074",
"0.65417784",
"0.65111244",
"0.64883614",
"0.64856535",
"0.647473",
"0.64737093",
"0.6448127",
"0.64132744",
"0.63529783",
"0.631795",
"0.63178784",
"0.62807816",
"0.62771124",
"0.... | 0.739767 | 0 |
Get CCDF from a degree sequence. | def get_ccdf(degseq):
uniques, counts = np.unique(degseq, return_counts=True)
cumprob = np.cumsum(counts).astype(np.double) / (degseq.size)
return uniques[::-1], (1. - cumprob)[::-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cdf(self, points=None):\n if points is not None:\n return self.parent.cdf(points)\n else:\n raise ValueError( 'Please digit an input for getCDF method')",
"def getCDF(self):\n return self.cdfSample",
"def cdf(self,x):\n if self.method == 'spline':\n co... | [
"0.66865236",
"0.66738886",
"0.6528202",
"0.6394472",
"0.6394472",
"0.6280722",
"0.612189",
"0.6061525",
"0.6054699",
"0.6042136",
"0.6035633",
"0.6016287",
"0.59556776",
"0.59411925",
"0.593399",
"0.59306073",
"0.5848178",
"0.5825168",
"0.5806766",
"0.5793067",
"0.5657572",
... | 0.6885644 | 0 |
Forward pass of the convolutional neural network. Should not be called manually but by calling a model instance directly. | def forward(self, x):
#print('output of fetures.children() : %s'%str([i for i in self.features.children()]))
#print("shape of input is %s" % str(x.size()))
for layer_no, layer in enumerate(self.features.children()):
if layer_no is 23:
y = layer(x)
if laye... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n x = self.conv1(x)\n if self.use_bn:\n x = self.batchnorm(x)\n if self.use_dropout:\n x = self.dropout(x)\n x = self.activation(x)\n x = self.conv2(x)\n if self.use_bn:\n x = self.batchnorm(x)\n if self.use_dro... | [
"0.74265546",
"0.72891587",
"0.72310466",
"0.71984327",
"0.71327746",
"0.70876646",
"0.7082048",
"0.7066212",
"0.7045469",
"0.7042458",
"0.7019415",
"0.6999947",
"0.6985048",
"0.6975621",
"0.69695985",
"0.6968059",
"0.69360054",
"0.69360054",
"0.6899931",
"0.68841743",
"0.687... | 0.0 | -1 |
Check if model parameters are allocated on the GPU. | def is_cuda(self):
return next(self.parameters()).is_cuda | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cuda(model):\n\treturn next(model.parameters()).is_cuda",
"def is_gpu_available():\n ret = get_gpu_count() > 0\n if _HAS_PADDLE:\n import paddle\n if ret is True and not paddle.is_compiled_with_cuda():\n logger.warning(\"Found non-empty CUDA_VISIBLE_DEVICES. \\\n ... | [
"0.7035844",
"0.67039204",
"0.6659393",
"0.65733784",
"0.6548726",
"0.6418005",
"0.6284684",
"0.61922556",
"0.6084889",
"0.60580724",
"0.60226715",
"0.60047615",
"0.59713936",
"0.5916576",
"0.5914285",
"0.5895965",
"0.588647",
"0.58627695",
"0.584468",
"0.58226997",
"0.579909... | 0.64029634 | 9 |
Return True if ``other`` is a OperationsList containing the same operations. | def __eq__(self, other: Any) -> bool:
if not isinstance(other, OperationsList):
return False
if not self._operations_list == other._operations_list:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other: SymbolicObject) -> bool:\n\n if isinstance(other, ListObject):\n return self._subobjects == other._subobjects\n else:\n return False",
"def __eq__(self, other):\n if not isinstance(other, CashFlowList):\n return False\n\n return... | [
"0.7605562",
"0.7011663",
"0.68128866",
"0.67968446",
"0.6753017",
"0.6692754",
"0.6628194",
"0.6615114",
"0.6595707",
"0.6594383",
"0.6566219",
"0.6549629",
"0.65435344",
"0.6532957",
"0.6516649",
"0.6473852",
"0.6468497",
"0.646396",
"0.645403",
"0.64523",
"0.64292806",
"... | 0.8506768 | 0 |
Shortcut for ``bot.send_chat_action(update.message.chat.id, args, kwargs)`` | def send_action(self, *args, **kwargs):
return self.bot.send_chat_action(self.id, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_action(action):\n def decorator(func):\n @wraps(func)\n def command_func(self, update, context, *args, **kwargs):\n context.bot.send_chat_action(chat_id=update.effective_message.chat_id, action=action)\n return func(self, update, context, *args, **kwargs)\n re... | [
"0.7509384",
"0.7375992",
"0.6927227",
"0.6501493",
"0.6169821",
"0.6134623",
"0.6082273",
"0.60704964",
"0.60244894",
"0.6001735",
"0.596165",
"0.5954815",
"0.59119594",
"0.5823286",
"0.5799726",
"0.5714884",
"0.57128656",
"0.5614297",
"0.55790704",
"0.55705637",
"0.55119675... | 0.7766484 | 0 |
Shortcut for ``bot.get_chat_members_count(update.message.chat.id, args, kwargs)`` | def get_members_count(self, *args, **kwargs):
return self.bot.get_chat_members_count(self.id, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_chat_members_count(self, chat_id: typing.Union[base.Integer, base.String]) -> base.Integer:\n payload = generate_payload(**locals())\n result = await self.request(api.Methods.GET_CHAT_MEMBERS_COUNT, payload)\n\n return result",
"async def membercount(ctx, *args):\n if ctx.me... | [
"0.7653538",
"0.7079209",
"0.67141974",
"0.64766777",
"0.6410987",
"0.63265955",
"0.63157445",
"0.6290398",
"0.6003215",
"0.5918783",
"0.5874979",
"0.5852854",
"0.5671665",
"0.56622785",
"0.5651697",
"0.5633376",
"0.55913067",
"0.5557523",
"0.5552522",
"0.5539572",
"0.5515641... | 0.8773616 | 0 |
Gets all the meshes inside all the piper skinned nodes in the scene. | def getMeshes():
nodes = pipernode.get('piperSkinnedMesh')
return {mesh.getParent() for skin in nodes for mesh in skin.getChildren(ad=True, type='mesh') if mesh.getParent()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_meshes(self):\n for meta_mesh in self.gltf.meshes:\n # Returns a list of meshes\n meshes = meta_mesh.load(self.materials)\n self.meshes.append(meshes)\n\n for mesh in meshes:\n self.scene.meshes.append(mesh)",
"def get_meshes(scene):\r\n ... | [
"0.6114167",
"0.60293436",
"0.5757967",
"0.5612728",
"0.5534438",
"0.54922056",
"0.54847145",
"0.54710627",
"0.54542154",
"0.5363654",
"0.5363654",
"0.5363654",
"0.5363654",
"0.5305868",
"0.52891994",
"0.5282078",
"0.5273619",
"0.5245254",
"0.52361906",
"0.5214873",
"0.521100... | 0.8215878 | 0 |
Returns all available categories. | def get_all_categories():
return jsonify({
"success": True,
"categories": _read_all_categories()
}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAllCategories(self):\n return self.categories",
"def get_categories(self):\n _url = urljoin(self.base_url, self.API_CATEGORIES)\n return requests.get(_url)",
"def _get_all_categories() -> dict:\n categories = database.fetchall(\"Categories\", \"id\", \"name_ua\")\n ret... | [
"0.84352666",
"0.8040093",
"0.795076",
"0.7868622",
"0.78226036",
"0.781811",
"0.78094435",
"0.7806805",
"0.7805045",
"0.77995926",
"0.7742181",
"0.7735259",
"0.7709532",
"0.7694586",
"0.769186",
"0.7655308",
"0.76461715",
"0.7583643",
"0.7582509",
"0.7538103",
"0.7518969",
... | 0.7982361 | 2 |
Get all questions filtered by a category | def get_questions_by_category(category_id: int):
category = Category.query.get(category_id)
if category is None:
abort(400)
questions_by_category = Question.query.filter(
Question.category == str(category_id)).all()
return jsonify({
"success": True,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_questions_by_category(category_id):\n try:\n selection = Question.query.filter(\n Question.category == category_id).order_by(Question.id).all()\n\n if len(selection) == 0:\n abort(404)\n\n questions = []\n\n for question ... | [
"0.7045061",
"0.70348823",
"0.7026578",
"0.68939084",
"0.6882774",
"0.6860482",
"0.6797814",
"0.6765122",
"0.6690764",
"0.6680299",
"0.6671632",
"0.6665664",
"0.6628369",
"0.6480059",
"0.64080924",
"0.6332876",
"0.6249306",
"0.62117636",
"0.61584663",
"0.61449456",
"0.6097295... | 0.7141734 | 0 |
Stops Walabot and disconnect the device. | def stopAndDisconnectWalabot():
wlbt.Stop()
wlbt.Disconnect()
print ('Termination successful') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(self) -> None:\n self.mqttc.disconnect()",
"def stop(self):\n self.conn.stop()",
"def stop(self):\n self.bus.log('Stopping down OLA Plugin.')\n self.bus.unsubscribe(\n self.channel_names['channel_request'],\n self.handle_channel\n )\n sel... | [
"0.73858374",
"0.69355065",
"0.6850796",
"0.6815512",
"0.68138057",
"0.68138057",
"0.6790304",
"0.67658573",
"0.676303",
"0.6745841",
"0.67418426",
"0.67080593",
"0.6698249",
"0.66884",
"0.6684982",
"0.6664148",
"0.66465163",
"0.663873",
"0.66383976",
"0.66383976",
"0.6627888... | 0.832489 | 0 |
Convert np.float32 array to np.uint8 | def float32_to_uint8(inputs):
return np.uint8(np.clip(np.round(inputs * 255), 0, 255)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast_float_to_uint8(array_float):\n if not numpy.issubdtype(array_float.dtype, numpy.float):\n raise TypeError('`array_float.dtype` is not smaller than `numpy.float` in type hierarchy.')\n \n # If the above check did not exist and `array_float`\n # contained integers, the clipping below woul... | [
"0.7408117",
"0.73111886",
"0.7305541",
"0.7285258",
"0.7285258",
"0.7240387",
"0.7012514",
"0.69310755",
"0.68306875",
"0.68195",
"0.64354885",
"0.6360376",
"0.6294902",
"0.6274729",
"0.6251667",
"0.6224117",
"0.6179129",
"0.6171993",
"0.60785764",
"0.60785764",
"0.60175484"... | 0.80445904 | 0 |
Update the bullets location. Eventually do collision | def update(self):
a = [0.0, 0.0]
a[0] += cos(radians(self.rot+90)) * self.speed
a[1] += sin(radians(self.rot+90)) * self.speed
self.x -= a[0]
self.y -= a[1]
if self.x < 0 or self.y < 0:
self.owner.bullet_list.remove(self)
del(self)
elif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_bullet_pos(self):\n # Update the decimal position of the bullet.\n self.pos_y -= self.settings.bullet1_speed\n self.rect.top = self.pos_y",
"def _update_bullet(self):\n\n # update position of old bullets\n self.bullets.update()\n\n # Get rid of bullets that ar... | [
"0.80307853",
"0.800439",
"0.7949822",
"0.7944579",
"0.784271",
"0.77690405",
"0.7433373",
"0.73987687",
"0.7324632",
"0.729992",
"0.72290784",
"0.7221896",
"0.71860194",
"0.71506184",
"0.71461153",
"0.71153486",
"0.7109173",
"0.709251",
"0.70902157",
"0.70732075",
"0.7065424... | 0.7002948 | 22 |
The set of arguments for constructing a Job resource. | def __init__(__self__, *,
client_request_id: Optional[pulumi.Input[str]] = None,
create_time: Optional[pulumi.Input[str]] = None,
created_from_snapshot_id: Optional[pulumi.Input[str]] = None,
current_state: Optional[pulumi.Input['JobCurrentState']] = N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOptions] = None,\n copy: Optional[pulumi.Input[pulumi.InputType['JobCopyArgs']]] = None,\n extract: Optional[pulumi.Input[pulumi.InputType['JobExtractArgs']]] = None,\n ... | [
"0.6313999",
"0.62224513",
"0.60525095",
"0.60084665",
"0.5980095",
"0.5951786",
"0.59460354",
"0.5871665",
"0.5789236",
"0.5773867",
"0.57570434",
"0.5726385",
"0.5687861",
"0.5676784",
"0.5674849",
"0.5669908",
"0.56415373",
"0.56355846",
"0.5619292",
"0.56025356",
"0.56020... | 0.0 | -1 |
The timestamp when the job was initially created. Immutable and set by the Cloud Dataflow service. | def create_time(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "create_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_times... | [
"0.7821324",
"0.7821324",
"0.7821324",
"0.76665497",
"0.7642792",
"0.7503464",
"0.7491798",
"0.73561174",
"0.73259294",
"0.73136383",
"0.7292784",
"0.7292784",
"0.7292784",
"0.7254832",
"0.72322977",
"0.72313684",
"0.7128438",
"0.7124728",
"0.7124728",
"0.7124728",
"0.7124728... | 0.66525364 | 84 |
The unique ID of this job. This field is set by the Cloud Dataflow service when the Job is created, and is immutable for the life of the job. | def id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id(self):\n return self.job_proto.id",
"def job_id(self):\n return self._job_id",
"def job_id(self) -> JobId:\r\n return self._job_id",
"def job_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"job_id\")",
"def _get_job_id(self):\n return uuid.uuid4().hex",
"... | [
"0.81822854",
"0.8128831",
"0.80731195",
"0.7988574",
"0.7821112",
"0.77694994",
"0.77067876",
"0.7509466",
"0.7490635",
"0.7398191",
"0.7382582",
"0.72407186",
"0.7235205",
"0.72227263",
"0.7211302",
"0.7211302",
"0.72040904",
"0.72040904",
"0.72040904",
"0.72040904",
"0.720... | 0.0 | -1 |
The timestamp when the job was started (transitioned to JOB_STATE_PENDING). Flexible resource scheduling jobs are started with some delay after job creation, so start_time is unset before start and is updated when the job is started by the Cloud Dataflow service. For other jobs, start_time always equals to create_time ... | def start_time(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "start_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStartTime(self):\n assert not self.isWaitingToStart(), \"Too early to tell: %s\" % self\n return \"%s\" % self.__jobInfo.startTime",
"def schedule_start_time(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"schedule_start_time\")",
"def start_time(self) -> Optional[pulu... | [
"0.74199384",
"0.6982314",
"0.6640806",
"0.6640806",
"0.66306525",
"0.6626746",
"0.6612122",
"0.65286565",
"0.6484841",
"0.6484841",
"0.64837116",
"0.6461573",
"0.6385353",
"0.63692796",
"0.63692796",
"0.63692796",
"0.63692796",
"0.63692796",
"0.63692796",
"0.63692796",
"0.63... | 0.6651326 | 7 |
The type of Cloud Dataflow job. | def type(self) -> Optional[pulumi.Input['JobType']]:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_type(self):\n return self._job_type",
"def job_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"job_type\")",
"def task_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"task_type\")",
"def _get_task_type(self):\n\n if self.num_classes == 0:\n retu... | [
"0.770037",
"0.7477219",
"0.66080755",
"0.65520203",
"0.64328414",
"0.62835395",
"0.62835395",
"0.62835395",
"0.61214936",
"0.6060477",
"0.6027481",
"0.6005418",
"0.59883916",
"0.59883916",
"0.5927427",
"0.59206194",
"0.5799378",
"0.57809764",
"0.5778433",
"0.5758208",
"0.575... | 0.7241703 | 2 |
The timestamp when the job was initially created. Immutable and set by the Cloud Dataflow service. | def create_time(self) -> pulumi.Output[str]:
return pulumi.get(self, "create_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_times... | [
"0.7821249",
"0.7821249",
"0.7821249",
"0.7666056",
"0.76426727",
"0.75031984",
"0.74914265",
"0.73562527",
"0.7325593",
"0.7313306",
"0.72930527",
"0.72930527",
"0.72930527",
"0.72555506",
"0.72329324",
"0.72319573",
"0.7128509",
"0.71255094",
"0.71255094",
"0.71255094",
"0.... | 0.0 | -1 |
The timestamp when the job was started (transitioned to JOB_STATE_PENDING). Flexible resource scheduling jobs are started with some delay after job creation, so start_time is unset before start and is updated when the job is started by the Cloud Dataflow service. For other jobs, start_time always equals to create_time ... | def start_time(self) -> pulumi.Output[str]:
return pulumi.get(self, "start_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStartTime(self):\n assert not self.isWaitingToStart(), \"Too early to tell: %s\" % self\n return \"%s\" % self.__jobInfo.startTime",
"def schedule_start_time(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"schedule_start_time\")",
"def start_time(self) -> Optional[pulu... | [
"0.7418712",
"0.6981307",
"0.6650291",
"0.6650291",
"0.6650291",
"0.6650291",
"0.6650291",
"0.6650291",
"0.66399837",
"0.66399837",
"0.662977",
"0.6625753",
"0.66120976",
"0.6527449",
"0.64837384",
"0.64837384",
"0.6483078",
"0.64598805",
"0.6384474",
"0.63685197",
"0.6368519... | 0.6134093 | 39 |
The type of Cloud Dataflow job. | def type(self) -> pulumi.Output[str]:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_type(self):\n return self._job_type",
"def job_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"job_type\")",
"def type(self) -> Optional[pulumi.Input['JobType']]:\n return pulumi.get(self, \"type\")",
"def task_type(self) -> pulumi.Input[str]:\n return pulumi... | [
"0.77001727",
"0.7477569",
"0.72412294",
"0.66095674",
"0.65529525",
"0.6434112",
"0.6283899",
"0.6283899",
"0.6283899",
"0.61224675",
"0.6060817",
"0.60286397",
"0.60070115",
"0.59896797",
"0.59896797",
"0.5930083",
"0.59213054",
"0.57997596",
"0.57822764",
"0.5779378",
"0.5... | 0.0 | -1 |
Add formset inline instances loader | def __init__(self, *args, **kwargs):
super(ModifyModelAdmin, self).__init__(*args, **kwargs)
self.inline_instances_formset = []
self.formset_pages = {}
for item in self.inlines_formsets_pages:
self.formset_pages[item[1]] = {"title" : item[0], "instances" : []}
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_formset(self):\n result = generic_inlineformset_factory(\n self.inline_model, **self.get_factory_kwargs()\n )\n return result",
"def get_form_class(self):\n\t\treturn inlineformset_factory(self.get_model(), self.get_related_model(), **self.get_formset_kwargs())",
"def ge... | [
"0.66260713",
"0.63760936",
"0.61481315",
"0.5835347",
"0.57291687",
"0.56802773",
"0.55785143",
"0.54507494",
"0.5439991",
"0.5376351",
"0.5357723",
"0.5156536",
"0.5146585",
"0.49914783",
"0.4961563",
"0.49360067",
"0.49099067",
"0.49069086",
"0.48932287",
"0.4868302",
"0.4... | 0.7296372 | 0 |
Test that endpoint returns 401 for unauthenticated user deleting multiple messages | def test_delete_multiple_messages_returns_401(self):
response = self.client.delete(
self.url,
json={"messageIds": [self.test_message_one.id, self.test_message_two.id]},
)
response_body = response.get_json()
self.assertEqual(response.status_code, 401)
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_users_unauthenticated(client: FlaskClient) -> None:\n # Unauthenticated users are not allowed to make the request\n response = delete_users(client)\n assert_error_response(response, HTTPStatus.UNAUTHORIZED)",
"def test_unauthorized_delete_when_logged_out(self):\n\n u = User(userna... | [
"0.75231844",
"0.74979323",
"0.7413558",
"0.7349542",
"0.7341222",
"0.72604936",
"0.7097263",
"0.70646566",
"0.69870275",
"0.6958564",
"0.69475675",
"0.68969893",
"0.6896328",
"0.6882477",
"0.6880044",
"0.6878962",
"0.6876554",
"0.6853114",
"0.6849189",
"0.6784512",
"0.677897... | 0.82270634 | 0 |
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes. | def add_header(request):
request.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
request.headers["Pragma"] = "no-cache"
request.headers["Expires"] = "0"
request.headers['Cache-Control'] = 'public, max-age=0'
return request | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response",
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m... | [
"0.82231",
"0.8222272",
"0.8222272",
"0.8222272",
"0.8222272",
"0.8195367",
"0.81630635",
"0.81630635",
"0.81630635",
"0.81630635",
"0.81630635",
"0.81630635",
"0.81630635",
"0.81630635",
"0.81630635",
"0.81630635",
"0.81630635",
"0.81630635",
"0.81630635",
"0.81630635",
"0.8... | 0.7159241 | 39 |
Return `True` as we don't use model level perms. | def has_permission(self, request, view):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_perms(self, request):\n return {'add': False, 'change': False, 'delete': False, }",
"def _is_admin_only(self, pvm: PermissionView) -> bool:\n\n if (\n pvm.view_menu.name in self.READ_ONLY_MODEL_VIEWS\n and pvm.permission.name not in self.READ_ONLY_PERMISSION\n ... | [
"0.70082897",
"0.69775355",
"0.6856922",
"0.683917",
"0.6752787",
"0.66765624",
"0.6621211",
"0.6620923",
"0.66089404",
"0.65869",
"0.65841883",
"0.65841883",
"0.6580557",
"0.6547679",
"0.65472275",
"0.6534223",
"0.651912",
"0.64546007",
"0.64546007",
"0.64546007",
"0.6430724... | 0.6192341 | 64 |
Serve the index HTML | def index():
return render_template('index.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(self):\n single = os.path.join(\n os.path.dirname(os.path.abspath(__file__)),\n 'index.html')\n return serve_file(single)",
"def index():\n return render_template('index.html'), 200",
"def index():\n\n return render_template(\"index.html\"), 200",
"def inde... | [
"0.8685354",
"0.85523725",
"0.84890985",
"0.8468328",
"0.8451884",
"0.82966554",
"0.8292779",
"0.82886124",
"0.82686514",
"0.82686514",
"0.82643247",
"0.82445365",
"0.82445365",
"0.8232638",
"0.8232638",
"0.8232638",
"0.8232638",
"0.8232638",
"0.8232638",
"0.8232638",
"0.8232... | 0.82082915 | 53 |
Method to find the left of the censoring interval. | def _interval_left(self, current_id, previous_id, current_time,
previous_time):
_left = 0.0
# Create the next set of values to insert to the RTK Program database.
if current_id == previous_id: # Same assembly.
# Failures occurred at same time.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left(self):\n x, y = (self.loc[0] - 1, self.loc[1])\n\n if x < 0:\n return None # None\n\n return self.garden.cells[y][x]",
"def left(self) -> float:\n points = self.get_adjusted_points()\n x_points = [point[0] for point in points]\n return min(x_points)"... | [
"0.6929066",
"0.6657257",
"0.6575676",
"0.6462427",
"0.64477015",
"0.644351",
"0.63599294",
"0.63291794",
"0.62973046",
"0.6228218",
"0.62196445",
"0.6210174",
"0.6169352",
"0.6147318",
"0.6147318",
"0.61322093",
"0.61322093",
"0.6128858",
"0.609009",
"0.609009",
"0.60566986"... | 0.55960745 | 65 |
This function calculate the area limited by two parallels with latitude phi1 and phi2 and two meridians with longitudes lambda1 & lambda2 | def CalculateArea(**kwargs):
a = 0
b = 0
try:
if kwargs["ref"] == "local":
a = 6378249.145
b = 6356515
elif kwargs["ref"] == "global":
a = 6378137
b = 6356752.314
elif kwargs["a"] and kwargs["b"]:
a = kwargs["a"]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_area(self):\n min_lat_point = self.latitude_min\n max_lat_point = self.latitude_max\n min_lon_point = self.longitude_min\n max_lon_point = self.longitude_max\n self.rename_latitude()\n self.rename_longitude()\n all_lat_bounds = self.cube.coord('latitude').b... | [
"0.6399715",
"0.6087621",
"0.60766757",
"0.5999493",
"0.58296216",
"0.5825475",
"0.5802816",
"0.5800075",
"0.5776443",
"0.57385135",
"0.57352257",
"0.5726864",
"0.5686812",
"0.56670666",
"0.5606422",
"0.55991405",
"0.5575907",
"0.55371463",
"0.5506155",
"0.5502419",
"0.549210... | 0.71243757 | 0 |
Delete nonASCII characters from the value and replace spaces with underscores. Also strip slashes and percent signs. | def create_filename(value):
return '%s.mp3' % slugify(value, u'_') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize(value):\n from re import sub\n from unicodedata import normalize\n value = normalize('NFKD', value).encode('ascii', 'ignore')\n value = sub('[^\\w\\s\\.-]', '', value.decode('utf-8')).strip().lower()\n return sub('[-_\\s]+', '_', value)",
"def clean(value):\r\n return re.sub('_+', ... | [
"0.7760493",
"0.737788",
"0.7278582",
"0.71347755",
"0.7038228",
"0.6997225",
"0.6973475",
"0.6943967",
"0.68070024",
"0.67693675",
"0.673018",
"0.66745275",
"0.6669343",
"0.6668114",
"0.66416174",
"0.66414165",
"0.6625625",
"0.66158426",
"0.6610128",
"0.6579192",
"0.65424407... | 0.0 | -1 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(y_true, y_pred, classes,
normalize=False,
title=None,
cmap=plt.cm.Blues):
if not title:
if normalize:
title = 'Normalized confusion matrix'
else:
title = 'Confusion matrix,... | {
"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.8195649",
"0.8095532",
"0.803007",
"0.8019817",
"0.7994959",
"0.7991904",
"0.79818887",
"0.79766536",
"0.7961735",
"0.7957412",
"0.79385704",
"0.7935568",
"0.79352015",
"0.7932079",
"0.79270303",
"0.7925357",
"0.79243845",
"0.7923781",
"0.792341",
"0.79226786",
"0.7918532"... | 0.0 | -1 |
Checks if 'site' has been added to context | def test_context_data(self):
mixin = mixins.SiteMixin(site=Site(domain='test', name='test'))
ret = mixin.get_context_data()
# make sure data is just updated, not replaced
assert ret['builder'] is mixin
# check if 'site' is in context and if it's valid
assert ret['site'].d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_site_to_context(self):\n g.current_site = self",
"def check_site(site):\n return _READY(site)",
"def is_request_in_themed_site():\n # We need to give priority to theming/site-configuration over microsites\n return configuration_helpers.is_site_configuration_enabled()",
"def curren... | [
"0.6862472",
"0.6629423",
"0.66158265",
"0.6284106",
"0.6206635",
"0.6142709",
"0.6007134",
"0.59886575",
"0.5917819",
"0.591397",
"0.591397",
"0.591397",
"0.5897216",
"0.5873566",
"0.5806039",
"0.578241",
"0.5759842",
"0.57438666",
"0.57122135",
"0.569605",
"0.56820613",
"... | 0.63269395 | 3 |
Run the command in foreground. | def __call__(self, *args: tp.Any, **kwargs: tp.Any) -> tp.Any:
cmd_w_output = self.as_plumbum(**kwargs)
return watch(cmd_w_output)(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_current_selection(self):\n import subprocess\n name, data, _ = self.matches_copy[self.selected_item]\n try:\n needs_term = data[\"Terminal\"].lower() == \"true\"\n except KeyError:\n needs_term = False\n if needs_term:\n with open(os.devnu... | [
"0.63322735",
"0.62880206",
"0.6268796",
"0.61993796",
"0.6169974",
"0.6123801",
"0.5984392",
"0.5953493",
"0.5937315",
"0.59277993",
"0.5923064",
"0.58983076",
"0.5887867",
"0.58835435",
"0.5873847",
"0.5831763",
"0.5829652",
"0.58249116",
"0.5816179",
"0.5785724",
"0.576576... | 0.0 | -1 |
Return the current value of this connection. | def get_value(self):
attr = getattr(self.obj, self.attr)
try:
args = self.args
kwargs = self.kwargs
return attr(*args, **kwargs)
except AttributeError:
return attr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_value(self):\n assert(self.is_started())\n return self.currValue",
"def value(self):\n\n\t\treturn self.__value",
"def value(self):\n return self._read()",
"def value(self):\n return self.__value",
"def value(self):\n return self.__value",
"def get(self)... | [
"0.7694323",
"0.76275814",
"0.7609642",
"0.75263494",
"0.75263494",
"0.7512191",
"0.7442435",
"0.74387866",
"0.74387866",
"0.74387866",
"0.74387866",
"0.74387866",
"0.74387866",
"0.74387866",
"0.74387866",
"0.74387866",
"0.74387866",
"0.74387866",
"0.74387866",
"0.74387866",
... | 0.0 | -1 |
Add a sparse reservoir set by looping through different different connectivity values and assigining one reservoir weight matrix per connetivity level and storing these for downstream use by EchoStateNetwork We generate the reservoir weights and store them in the sparse library. | def addBook(self, random_seed):
book = {}
n = self.n_nodes_
random_state = Generator(device = self.device).manual_seed(random_seed)
accept = rand(n, n, generator = random_state, device = self.device)
reservoir_pre_weights = rand(n, n, generator = random_state, device =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparsify(W,conn):\n \n N = W.shape[0]\n W_sparse = sparse.lil_matrix((N,N)) \n for row, weights in itertools.izip(conn, W):\n W_sparse[row[0],row[1:]] = weights[1:]\n return W_sparse",
"def set_sparse_signals(self):\n\t\n\t\tparams_dSs = [self.mu_dSs, self.sigma_dSs]\n\t\tparams_Ss0... | [
"0.6089268",
"0.6017336",
"0.5878965",
"0.5767021",
"0.56920177",
"0.55312884",
"0.54914916",
"0.5485382",
"0.5406257",
"0.5383976",
"0.53821015",
"0.5346184",
"0.5324348",
"0.5309101",
"0.5281269",
"0.5279852",
"0.5268382",
"0.5256985",
"0.5256985",
"0.52415115",
"0.5205314"... | 0.56783235 | 5 |
bool int Position > Space Constructs an instance of Space. | def __init__(self, on_railroad, space_type, adjacent):
self.space_type = space_type
self.on_railroad = on_railroad
self.adjacent = adjacent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_space(self):\n return self.pos == self.SPACE_POS",
"def create_space(self):\n schema = SpaceSchema()\n data = {'show': str(self.show_id), 'show_title': self.show_title, 'space': self.location_array}\n space_object = schema.load(data)\n return space_object",
"def test_exten... | [
"0.7008498",
"0.621807",
"0.59040236",
"0.5801304",
"0.56820416",
"0.5652077",
"0.5604434",
"0.5552117",
"0.5462722",
"0.54436535",
"0.54188234",
"0.5411768",
"0.5401182",
"0.53933203",
"0.53815204",
"0.53607225",
"0.5338166",
"0.5291468",
"0.5291468",
"0.5270642",
"0.5238398... | 0.49680564 | 55 |
> iter(Position) Returns a generator of positions that are adjacent to this space. | def __iter__(self):
return iter(self.adjacent) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterate_adjacent(position):\n return iter(_board_graph[position])",
"def __iter__(self):\n for p in self.positions(): # use same order as positons()\n yield p.element() # but yield each element",
"def __iter__(self):\n for idx in range(0, self.Npoints):\n ... | [
"0.76649487",
"0.75231266",
"0.7464687",
"0.7459826",
"0.74092317",
"0.7372811",
"0.7335939",
"0.72174793",
"0.70786744",
"0.7071331",
"0.7003318",
"0.6992895",
"0.6963647",
"0.6930121",
"0.6862071",
"0.67932606",
"0.6783159",
"0.671852",
"0.66881925",
"0.66803485",
"0.654857... | 0.7284025 | 7 |
Position > bool Checks if the give position is a camp | def is_camp(p):
return _board_graph[p].space_type == CAMP | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __bool__(self):\n return (self.value == POS)",
"def is_position_availible(self, position):\n return self.positions[position] == ' '",
"def check_position(self, position):\n x_axis, y_axis = position\n try:\n return bool(self.full_map[x_axis][y_axis] not in \"#\"\n ... | [
"0.64722383",
"0.64340055",
"0.64084136",
"0.63969594",
"0.6365744",
"0.6255603",
"0.61885136",
"0.6162032",
"0.6148545",
"0.6137229",
"0.6058347",
"0.6002783",
"0.5990171",
"0.59791565",
"0.59631646",
"0.591652",
"0.5893191",
"0.58920956",
"0.58592474",
"0.5839528",
"0.58370... | 0.6246878 | 6 |
Mean absolute error regression loss. | def mean_absolute_error(y_true, y_pred, *, sample_weight=..., multioutput=...):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_absolute_error(self):\n print('Mean absolute error regression loss: ' + str(mean_absolute_error(self.model.dataset.get_y_test(),\n self.model.get_predicted())))",
"def mean_squared_error(self):\n print('Mean squ... | [
"0.82092834",
"0.75316024",
"0.73240125",
"0.715579",
"0.7151401",
"0.71104527",
"0.70501304",
"0.69472337",
"0.6935832",
"0.69307333",
"0.6914975",
"0.6842285",
"0.68380743",
"0.6825987",
"0.6815631",
"0.68115884",
"0.6807899",
"0.68038934",
"0.6796058",
"0.6781836",
"0.6764... | 0.71803063 | 3 |
Mean absolute percentage error regression loss. Note here that we do not represent the output as a percentage in range [0, 100]. Instead, we represent it in range [0, 1/eps]. Read more in the | def mean_absolute_percentage_error(y_true, y_pred, sample_weight=..., multioutput=...):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_absolute_percentage_error(y_true, y_pred):\n output_errors = 100*np.average(np.abs(y_true - y_pred)/y_true)\n return np.average(output_errors)",
"def mean_absolute_percentage_error(y_true, y_pred):\n if len(y_true.shape) > 1 or len(y_pred.shape) > 1:\n raise TypeError('Arrays need to be ... | [
"0.7640588",
"0.75075644",
"0.7496276",
"0.7408573",
"0.7408573",
"0.72649664",
"0.723839",
"0.71749765",
"0.7093771",
"0.70465857",
"0.6919462",
"0.6886161",
"0.6827793",
"0.68212134",
"0.66761184",
"0.6675",
"0.6651786",
"0.6617233",
"0.65321493",
"0.65271723",
"0.6506483",... | 0.76742464 | 0 |
Median absolute error regression loss. Median absolute error output is nonnegative floating point. The best value | def median_absolute_error(y_true, y_pred, *, multioutput=..., sample_weight=...):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def median_absolute_error(self):\n print('Median absolute error regression loss: ' + str(median_absolute_error(self.model.dataset.get_y_test(),\n self.model.get_predicted())))",
"def abs_median_error(self) -> float:\n ... | [
"0.79329205",
"0.7356527",
"0.6854822",
"0.68116266",
"0.6647143",
"0.65790784",
"0.6537083",
"0.6533045",
"0.6438318",
"0.64356536",
"0.6396276",
"0.63813764",
"0.6341217",
"0.6334593",
"0.6299007",
"0.6280763",
"0.6274058",
"0.62736255",
"0.62697214",
"0.6242023",
"0.622260... | 0.76567715 | 1 |
max_error metric calculates the maximum residual error. | def max_error(y_true, y_pred):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_error(self):\n print('Maximum residual error: ' + str(max_error(self.model.dataset.get_y_test(), self.model.get_predicted())))",
"def max_error(self) -> float:\n return float(np.max(np.abs(self._flattened_errors())))",
"def max_abs_error(self) -> float:\n return np.max(np.abs([self... | [
"0.82129323",
"0.77675945",
"0.71214306",
"0.6661287",
"0.65684533",
"0.65526795",
"0.64712137",
"0.62896025",
"0.62316483",
"0.6153844",
"0.61269325",
"0.59729195",
"0.5958617",
"0.5942597",
"0.5913103",
"0.5869475",
"0.58643377",
"0.58599776",
"0.5849801",
"0.5825196",
"0.5... | 0.7023922 | 3 |
Mean Poisson deviance regression loss. Poisson deviance is equivalent to the Tweedie deviance with the power parameter `power=1`. | def mean_poisson_deviance(y_true, y_pred, *, sample_weight=...):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_poisson_deviance(self):\n print('Mean Poisson deviance regression loss: ' + str(mean_poisson_deviance(self.model.dataset.get_y_test(),\n self.model.get_predicted())))",
"def mean_tweedie_deviance(y_true, y_pred, *,... | [
"0.84597147",
"0.66956586",
"0.66028935",
"0.6221233",
"0.5982527",
"0.59586567",
"0.5881107",
"0.56975716",
"0.5629051",
"0.56143314",
"0.5528999",
"0.5501544",
"0.5478511",
"0.5445082",
"0.54310447",
"0.54274666",
"0.5426783",
"0.5422665",
"0.5404065",
"0.540162",
"0.540162... | 0.7705277 | 1 |
[not settable, onlineonly] Total cache size (in bytes) in a hybrid aggregate. If the referenced aggregate is restricted or offline, or if it is not a hybrid aggregate, a value of 0 is returned. | def fs_hybrid_cache_size_total(self):
return self._fs_hybrid_cache_size_total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_size(self):\n return self.cachesize",
"def get_size(self):\n return len(self.cache)",
"def get_size(self) -> int:\n total_size = 0\n for entry in self.__entries:\n total_size += entry.get_size()\n return total_size",
"def cache_size(self):\n retu... | [
"0.6754768",
"0.671188",
"0.65282655",
"0.6520063",
"0.64089966",
"0.6407665",
"0.63737583",
"0.63638794",
"0.6302466",
"0.62790143",
"0.6275713",
"0.6260091",
"0.62569165",
"0.6254125",
"0.62438375",
"0.62292016",
"0.62211895",
"0.6212261",
"0.6185322",
"0.61822873",
"0.6172... | 0.79143655 | 0 |
Get the given duration in seconds | def get_duration(days=0, hours=0, minutes=0, seconds=0, millis=0):
duration = 0.0
duration += float(days) * 24 * 60 * 60
duration += float(hours) * 60 * 60
duration += float(minutes) * 60
duration += float(seconds)
duration += millis / 1000.0
return duration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seconds(duration):\n if not duration:\n return 0\n try:\n h, m, s = duration_parts(duration)\n return s\n except (ValueError, TypeError):\n return 0",
"def duration_in_seconds(self):\n return self.get_data(\"duration_in_seconds\")",
"def _duration_to_secs(duratio... | [
"0.8274603",
"0.76853216",
"0.76443124",
"0.75087965",
"0.7362068",
"0.73546374",
"0.7218812",
"0.7170379",
"0.71551794",
"0.7144807",
"0.713223",
"0.7123354",
"0.70880836",
"0.708677",
"0.7065162",
"0.70577097",
"0.70576304",
"0.7033154",
"0.7019381",
"0.69986045",
"0.699417... | 0.0 | -1 |
This function computes the MAC of message using key. The MAC function is CBCMAC with AES and both single1 padding and length strengthening provided by the padding function. key must be convertible to bytes of length 16 messuge must be convertible to bytes type | def CBCMACbasedOnAES(message, key):
# Convert the message into bytes
message1 = bytes(message)
# Convert the key into bytes
key1 = bytes(key)
# Create the AES object
aes_obj = AES.new(key1, AES.MODE_CBC, iv)
# Encrypt the message
MAC = aes_obj.encrypt(message1)
# Return the MAC of ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cbc_mac(key, data):\n engine = AES.new(key, AES.MODE_CBC, get_zero_vector(16))\n return engine.encrypt(data)[-16:]",
"def make_hmac(message, key):\n h = HMAC.new(key)\n h.update(message)\n return h.hexdigest()",
"def get_cipher_key(key):\n k = (\n key[0] ^ key[4],\n ... | [
"0.7086036",
"0.611308",
"0.5901191",
"0.5669914",
"0.56285095",
"0.5557149",
"0.5410308",
"0.5361496",
"0.5354697",
"0.53063726",
"0.5291547",
"0.52718997",
"0.52700454",
"0.5262614",
"0.5262613",
"0.5235734",
"0.5188047",
"0.5168812",
"0.5162046",
"0.51358014",
"0.5132436",... | 0.80590457 | 0 |
Derivative of the sigmoid function. | def sigmoid_prime(z):
return sigmoid(z)*(1-sigmoid(z)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_derivative(x):\n return x * (1-x)",
"def sigmoid_derivative(x):\n return x * (1.0 - x)",
"def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def sigmoid_der... | [
"0.84754366",
"0.8450928",
"0.8396931",
"0.83485264",
"0.83485264",
"0.8298343",
"0.80539966",
"0.7753385",
"0.77070266",
"0.7498153",
"0.7464916",
"0.7454039",
"0.7401582",
"0.7385017",
"0.73829913",
"0.7346935",
"0.7321687",
"0.73094004",
"0.7192053",
"0.7113881",
"0.709236... | 0.0 | -1 |
Generate a filename in folder. folder/prefixfolder.0.ext | def generateFilename(folder, prefix, ext):
filename = os.path.basename(os.path.normpath(folder))
if prefix:
filename = "{0}-{1}".format(prefix, filename)
path = getIncrementedFilename(os.path.join(folder, filename), ext)
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_filename(extension, with_path=True, base_folder=None):\n name = get_md5(str(uuid4()))\n # if not extension:\n # extension = get_file_extension()\n if base_folder is not None:\n base_folder = \"%s/\" % base_folder.rstrip(\"/\")\n else:\n base_folder = \"\"\n\n if with_pa... | [
"0.7385492",
"0.7333924",
"0.7312657",
"0.72930425",
"0.7238043",
"0.72070307",
"0.7178001",
"0.7148282",
"0.710962",
"0.70897174",
"0.7036363",
"0.69962245",
"0.6996097",
"0.69855136",
"0.69633824",
"0.6955315",
"0.69493705",
"0.6947302",
"0.6938939",
"0.69265604",
"0.692255... | 0.8751055 | 0 |
Test the reply_count property of the Status model. | def test_status_reply_count(self):
with self.app.app_context():
u = user(save=True)
s = status(user=u, project=None, save=True)
for i in range(5):
status(user=u, project=None, reply_to=s, save=True)
eq_(s.reply_count, 5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_status_replies(self):\n with self.app.app_context():\n p = project(save=True)\n u = user(save=True)\n s = status(project=p, user=u, save=True)\n\n for i in range(30):\n status(project=p, user=u, reply_to=s, save=True)\n\n page = ... | [
"0.7165764",
"0.65260106",
"0.64591074",
"0.64202434",
"0.6334059",
"0.6179951",
"0.6167599",
"0.61667216",
"0.6138746",
"0.6063657",
"0.605946",
"0.60412294",
"0.6024089",
"0.5998621",
"0.5979235",
"0.5946217",
"0.59048754",
"0.5891214",
"0.5882784",
"0.5866248",
"0.57976913... | 0.86650324 | 0 |
Test posting a status. | def test_status(self):
with self.app.app_context():
u = user(email='joe@example.com', save=True)
authenticate(self.client, u)
rv = self.client.post('/statusize/', data={'message': 'foo'},
follow_redirects=True)
eq_(rv.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _post_status(event, gh, status):\n await gh.post(event.data[\"pull_request\"][\"statuses_url\"], data=status)",
"def test_status_post(self):\n Parameters = Parameters1()\n response = self.client.open(\n '/status',\n method='POST',\n data=json.dumps(Para... | [
"0.745656",
"0.74509895",
"0.74124265",
"0.74124265",
"0.73885244",
"0.72250813",
"0.7212874",
"0.71124977",
"0.7078242",
"0.69433266",
"0.69389755",
"0.6911412",
"0.69109553",
"0.6865766",
"0.6787152",
"0.678631",
"0.6743121",
"0.67309874",
"0.6695728",
"0.66593856",
"0.6653... | 0.74267554 | 2 |
Test posting a status with no message. | def test_status_no_message(self):
with self.app.app_context():
u = user(email='joe@example.com', save=True)
authenticate(self.client, u)
rv = self.client.post('/statusize/', data={'message': ''},
follow_redirects=True)
# This kicks up a 404, bu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_status_no_login(self):\n self.logout()\n post_json = {\"submission_id\": self.status_check_submission_id}\n response = self.app.post_json(\"/v1/check_status/\", post_json, expect_errors=True,\n headers={\"x-session-id\": self.session_id})\n ... | [
"0.7201963",
"0.6949421",
"0.6923064",
"0.69161886",
"0.6813586",
"0.66684335",
"0.6579005",
"0.6507071",
"0.64746195",
"0.6440355",
"0.6384444",
"0.6365908",
"0.63456374",
"0.6339759",
"0.6318823",
"0.6302569",
"0.6298929",
"0.6298929",
"0.62898874",
"0.627214",
"0.6268902",... | 0.8056997 | 0 |
Change discrete observation from list(int) to list(one_hot) format. | def _maybe_one_hot(self, obs):
if self.toOneHot:
obs = np.reshape(obs, (1, -1))
ints = obs.dot(self.multiplication_factor)
x = np.zeros([obs.shape[0], self.one_hot_len])
for i, j in enumerate(ints):
x[i, j] = 1
return x
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_one_hot(a):\n a = a[:, 0]\n a = a.astype(int)\n A = np.zeros((len(a), config.num_classes))\n A[np.arange(len(a)), a] = 1\n return A",
"def one_hot_encode(x):\n # TODO: Implement Function\n x_l = list(x)\n for index in np.arange(len(x_l)):\n x_l[index] = get_one_hot_v... | [
"0.7416499",
"0.73966396",
"0.73918724",
"0.72971946",
"0.7207314",
"0.72037125",
"0.7139652",
"0.71099603",
"0.7033327",
"0.7021459",
"0.70200396",
"0.7019017",
"0.7016751",
"0.7008288",
"0.70073783",
"0.69921046",
"0.6990432",
"0.69456226",
"0.6942551",
"0.6907128",
"0.6907... | 0.7035223 | 8 |
The type of resource extracted by the particular resource. This should be a single word only meaning something like "info", "executable", ... This resource type is used for better log messages. | def resource_type(cls):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")",
"def ... | [
"0.7799778",
"0.7799778",
"0.77337795",
"0.77337795",
"0.77337795",
"0.77337795",
"0.77337795",
"0.7435112",
"0.73980755",
"0.7264488",
"0.7127422",
"0.7035029",
"0.6932327",
"0.6839248",
"0.677211",
"0.66678107",
"0.66678107",
"0.66678107",
"0.66678107",
"0.66678107",
"0.666... | 0.77825916 | 2 |
Extracts an email address from a valid password reset token. | def parse_password_reset_token(token):
try:
token = base64.urlsafe_b64decode(str(token))
except TypeError:
return None
cred = _parse_security_token(token)
return cred and cred.email | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_password_reset_token(token: str) -> tp.Optional[str]:\n try:\n decoded_token = jwt.decode(token, config.SECRET_KEY,\n algorithms=[ALGORITHM])\n except InvalidTokenError:\n return None\n if decoded_token[\"sub\"] != PASSWORD_RESET_SUBJECT:\n ... | [
"0.7039985",
"0.68341273",
"0.68253404",
"0.679571",
"0.67610675",
"0.6760937",
"0.6741547",
"0.6654214",
"0.65531987",
"0.640023",
"0.62692463",
"0.6200448",
"0.61567795",
"0.6123652",
"0.60978174",
"0.60570717",
"0.6042387",
"0.60345566",
"0.60287344",
"0.6026899",
"0.60162... | 0.80168754 | 0 |
Return the records as a dataframe. | def records(self, variables=None, **kwargs):
# Get necessary data for the variables
all_df = self._data.records_all().set_index(self.DATE)
variables = self._convert_variables(variables, all_df.columns.tolist())
df = all_df.loc[:, variables]
# Figure
if self._data.compleme... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataframe(self):\n if not self.all_records:\n print('No rows cached.')\n return\n dict_list = [row.as_dict() for row in self.all_records]\n columns = self.all_records[0].keys\n dataframe = pd.DataFrame(dict_list, columns=columns)\n return dataframe",
"... | [
"0.81605434",
"0.7689365",
"0.7654657",
"0.75927025",
"0.75107545",
"0.75014997",
"0.7491799",
"0.74763435",
"0.74449694",
"0.74304926",
"0.74304926",
"0.74304926",
"0.74304926",
"0.74304926",
"0.73737586",
"0.73647803",
"0.7351118",
"0.73190165",
"0.72353095",
"0.72085106",
... | 0.0 | -1 |
Index/home page of the website | def index():
if request.method =='POST':
session["place"] = request.form["place"] # Stores "place" input in session
return redirect(url_for("nearest"))
else:
return render_template("index.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"def home():\r\n return render_template(\r\n 'index.html',\r\n ... | [
"0.87146896",
"0.8548914",
"0.85075265",
"0.8418279",
"0.8418279",
"0.8418279",
"0.8418279",
"0.8418279",
"0.8418279",
"0.8418279",
"0.8418279",
"0.8418279",
"0.8418279",
"0.83925295",
"0.83726525",
"0.83699334",
"0.83652914",
"0.8361378",
"0.8359413",
"0.8331822",
"0.8314265... | 0.0 | -1 |
Report a time_t as an ISO8601 time format. Defaults to now. | def timet_iso(t=time.time()):
return datetime.datetime.now().isoformat()[0:19] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iso_date(self, t=None):\n if t is None:\n t = time.time()\n time_str = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime(t))\n\n return time_str",
"def formatted_time() -> datetime.datetime:\r\n return datetime.datetime.now()",
"def isoformat(self, timespec=\"auto\"):\n... | [
"0.7398466",
"0.706633",
"0.69513315",
"0.68297285",
"0.6829152",
"0.67798644",
"0.67408025",
"0.6729839",
"0.66987705",
"0.6689164",
"0.6689164",
"0.66699064",
"0.6641522",
"0.65828717",
"0.65425014",
"0.6505604",
"0.64849293",
"0.64819497",
"0.6459066",
"0.644515",
"0.64373... | 0.7495122 | 0 |
Loads the bash environment variables specified by 'export NAME=VALUE' into a dictionary and returns it. Take whatever variables not in that file from the Linux environment. | def GetBashEnvFromFile(this, filename):
DB_RE = re.compile("export (.+)=(.+)")
ret = {}
if filename is not None:
with open( filename, "r" ) as f:
for line in f:
m = DB_RE.search(line.strip())
if m:
name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_env(env_files):\n env = {}\n for env_file in env_files:\n with open(env_file) as f:\n for line in f:\n if line and line[0] != \"#\":\n try:\n index = line.index(\"=\")\n env[line[:index].strip()] = line... | [
"0.6895845",
"0.6810905",
"0.6783951",
"0.6769671",
"0.67103505",
"0.6698789",
"0.6692306",
"0.66548026",
"0.6652638",
"0.6608575",
"0.65690833",
"0.6533156",
"0.65055305",
"0.6478919",
"0.6466052",
"0.64383376",
"0.6395389",
"0.6377702",
"0.6372465",
"0.63347304",
"0.6331138... | 0.78436303 | 0 |
Evaluate the score of tuples with embeddings that are specific to every data sample | def answerer(embeddings, tuples: tf.Variable, scoring=multilinear):
n_data, n_slots, rank = [d.value for d in embeddings.get_shape()]
n_data, n_tuples, order = [d.value for d in tuples.get_shape()]
shift_indices = tf.constant(np.reshape(
np.outer(range(n_data), np.ones(n_tuples * n_slots)) * n_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_each_score(word_embeddings, each_id_pair): # without weighting scheme\n emb1 = word_embeddings[each_id_pair[0], :]\n emb2 = word_embeddings[each_id_pair[1], :]\n inn = np.inner(emb1, emb2)\n # print('inner product is {}'.format(inn))\n emb1norm = np.sqrt(np.inner(emb1, emb1))\n # prin... | [
"0.65966535",
"0.6271696",
"0.61693364",
"0.6096531",
"0.60055155",
"0.5940941",
"0.5937357",
"0.5903399",
"0.59002817",
"0.58706063",
"0.5868112",
"0.5857049",
"0.5816769",
"0.5789659",
"0.5776571",
"0.57489455",
"0.5739431",
"0.56953835",
"0.5690723",
"0.5675375",
"0.567082... | 0.59834903 | 5 |
take 1D float array of rewards and compute discounted reward | def discount_rewards(r):
discounted_r = np.zeros_like(r)
running_add = 0
for t in reversed(range(r.size)):
running_add = running_add * gamma + r[t]
discounted_r[t] = running_add
return discounted_r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discount_rewards(rewards):\r\n discounted_r = np.zeros_like(rewards)\r\n running_add = 0\r\n for t in reversed(range(0, len(rewards))): \r\n running_add = running_add * reward_discount + rewards[t]\r\n discounted_r[t] = running_add\r\n return discounted_r",
"def discoun... | [
"0.8100923",
"0.78397125",
"0.7792625",
"0.7742053",
"0.7653779",
"0.75987715",
"0.7583268",
"0.75820553",
"0.7579539",
"0.7519005",
"0.75047183",
"0.7467692",
"0.7456702",
"0.7433794",
"0.7426565",
"0.74062765",
"0.73950297",
"0.7370545",
"0.73564714",
"0.7328519",
"0.720184... | 0.7536054 | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.