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 |
|---|---|---|---|---|---|---|
GIVEN a Flask application WHEN the '/group/' page is requested (GET) THEN check the response is valid | def test_group_job_fail(client):
response = client.get('/group/group_b')
assert response.status_code == 400 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_group_404(self):\n resp = self.app.get('/groups/thisgroupdoesntexist')\n assert resp.status_code == 404",
"def user_should_get_an_ok_response():\n assert web_app.validate_reponse()",
"def test_group_pass(client):\n\n response = client.get('/group/group_a')\n assert response... | [
"0.627794",
"0.6199485",
"0.61482036",
"0.5997167",
"0.59170043",
"0.59149694",
"0.5833783",
"0.5794869",
"0.57719165",
"0.57495207",
"0.5625725",
"0.56032896",
"0.5568838",
"0.5563249",
"0.5552579",
"0.5552107",
"0.552524",
"0.5517104",
"0.5511099",
"0.54999584",
"0.5453071"... | 0.52755153 | 35 |
Creates a barplot of the total candidate mentions | def candidate_mentions_plot(self, fig_out):
chart = sns.barplot(x = 'count', y = 'candidate',
data = self.total_candidate_mentions())
plt.setp(chart.get_yticklabels(), rotation = 40)
plt.title('Total Candidate Mentions - Sentence-level')
if fig_out is True:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dem_mentions_plot(self, fig_out):\n # filter out Trump\n total_candidate_mentions = self.total_candidate_mentions()\n mentions_no_trump = total_candidate_mentions[total_candidate_mentions['candidate'] != 'Trump']\n \n # plot\n chart = sns.barplot(x = 'count', y = 'cand... | [
"0.6654502",
"0.6106479",
"0.60229605",
"0.5901741",
"0.58831334",
"0.58776844",
"0.58633304",
"0.58209467",
"0.5817596",
"0.5813118",
"0.5802224",
"0.56970036",
"0.56353885",
"0.5634733",
"0.5624432",
"0.5528919",
"0.54821265",
"0.5470522",
"0.54657274",
"0.54477805",
"0.544... | 0.7517014 | 0 |
Return a list of CommentTuples in tree insertion order. Also add a MissingChildrenTuple to the end of the list if there are missing root level comments. | def get_comment_order(self):
with g.stats.get_timer('comment_tree.get.1') as comment_tree_timer:
comment_tree = CommentTree.by_link(self.link, comment_tree_timer)
sort_name = self.sort.col
sorter = get_comment_scores(
self.link, sort_name, comment_tree.cids, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_initial_comment_list(self, comment_tree):\n comment_tuples = []\n\n if self.link.sticky_comment_id:\n root_level_comments = comment_tree.tree.get(None, [])\n sticky_comment_id = self.link.sticky_comment_id\n if sticky_comment_id in root_level_comments:\n ... | [
"0.735578",
"0.7132088",
"0.6797401",
"0.6593672",
"0.6305268",
"0.61618036",
"0.60713553",
"0.6040265",
"0.60374725",
"0.5852866",
"0.5812998",
"0.57652",
"0.57540303",
"0.5669864",
"0.5665627",
"0.5624199",
"0.56221527",
"0.56191903",
"0.5618786",
"0.5612505",
"0.5525475",
... | 0.6406785 | 4 |
Get a test config | def get_test_config() -> Config:
# overwrite some settings for unit tests
args = dict(
datapath=os.path.abspath(os.path.join(os.path.dirname(__file__), 'testdata')),
debug=True
)
return Config(**args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config():\n return CONFIG",
"def get_config():\n return _config",
"def test_get_config(self):\r\n config = self.profile.get_config('testing.conf', TestConfig, storage_args=['this_section'])\r\n self.assertIsInstance(config, TestConfig)\r\n self.assertIsNone(config.save())",
... | [
"0.7595289",
"0.7530069",
"0.7494138",
"0.7440118",
"0.7383537",
"0.732649",
"0.7236002",
"0.7215251",
"0.7173367",
"0.71728283",
"0.7099939",
"0.70873916",
"0.70702296",
"0.70660865",
"0.7057578",
"0.7057578",
"0.7057578",
"0.7057578",
"0.7057578",
"0.7057578",
"0.7057578",
... | 0.7827272 | 0 |
Sends a 401 response that enables basic auth | def authenticate():
return Response(
'Could not verify your access level for that URL.\n'
'You have to login with proper credentials', 401,
{'WWW-Authenticate': 'Basic realm="Login Required"'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093736",
"0.80926424",
"0.7958403",
"0.7852648",
"0.7843114",
"0.7824419",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
... | 0.774767 | 31 |
Return a string formatted so that it can be printed in an error msg. | def get_error_name(self):
if hasattr(self, "ui_name"):
# If this instance is part of the UI (has attribute "ui_name"), use
# that to form a "pretty" error message.
return self.parent.get_error_name()+"."+self.ui_name
else:
# If not, revert to the regular w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def err_str(err):\n return \"\".join(format_exception_only(type(err), err))",
"def formatError(self,error):\n return '<font color=\"#f00\"><b><i>%s</i></b></font><br />\\n' % error",
"def error(err):\n\n return str(err) + '\\n'",
"def error_string(self):\n return self._error_string",
"d... | [
"0.7921959",
"0.76792246",
"0.7591627",
"0.7405109",
"0.7328291",
"0.7319533",
"0.7266934",
"0.7238458",
"0.7232615",
"0.72110945",
"0.7203619",
"0.7190047",
"0.717457",
"0.7157622",
"0.7090458",
"0.7074579",
"0.70706534",
"0.7050389",
"0.7050389",
"0.7050389",
"0.7049158",
... | 0.0 | -1 |
Normalize runtime expressions. Runtime expressions may have parameter names prefixed with their location `path.id`. At the same time, parameters could be defined without a prefix `id`. We need to normalize all parameters to the same form to simplify working with them. | def normalize_parameter(parameter: str, expression: str) -> Tuple[Optional[str], str, str]:
try:
# The parameter name is prefixed with its location. Example: `path.id`
location, name = tuple(parameter.split("."))
return location, name, expression
except ValueError:
return None, p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalize_hint_expression(hint_expression, hint_name):\n hdict = _extract_hint_operator_and_values(hint_expression, hint_name)\n result = hdict['op'].join([' %s ' % urlparse.quote(t)\n for t in hdict['values']])\n return (hdict['op'] + result).strip()",
"def _clean_fil... | [
"0.5540095",
"0.55091006",
"0.53597754",
"0.51706356",
"0.51514447",
"0.50659454",
"0.5009996",
"0.49631405",
"0.48321366",
"0.4778096",
"0.4710973",
"0.47079575",
"0.46693176",
"0.46420652",
"0.46306798",
"0.46230572",
"0.461377",
"0.46048534",
"0.45961353",
"0.4588971",
"0.... | 0.48532632 | 8 |
Give proper lower bound and upper bound for proper learning rate | def learning_rate_range():
# Lower and upper bounds
#######
lower_bound = 0.1
upper_bound = 1e-6
#######
return lower_bound, upper_bound | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(optimizer, epoch):\n \n boundary = [args.epochs//2,args.epochs//4*3,args.epochs]\n lr = args.lr * 0.1 ** int(bisect.bisect_left(boundary, epoch))\n print('Learning rate: %f'%lr)\n #print(epoch, lr, bisect.bisect_left(boundary, epoch))\n # lr = args.lr * (0.1 ** (epoch // ... | [
"0.7003922",
"0.6926021",
"0.68716943",
"0.67949873",
"0.67446923",
"0.67332447",
"0.6708009",
"0.66876",
"0.66859627",
"0.6645371",
"0.6641712",
"0.66290194",
"0.66106164",
"0.65999776",
"0.65935546",
"0.65879184",
"0.65794694",
"0.6552069",
"0.65517676",
"0.65444505",
"0.65... | 0.8397371 | 0 |
Get secondary sort values. Virtual columns are handled in `__ColumnSorter`. | def GetSecondarySortValues(self, col, key1, key2):
sscol = 1 if col == 0 else 0
return (self.itemDataMap[key1][sscol], self.itemDataMap[key2][sscol]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _custom_sorter(self, key1, key2):\n\n col = self._col\n ascending = self._colSortFlag[col]\n real = self.get_real_col(col)\n item1 = self.itemDataMap[key1][real]\n item2 = self.itemDataMap[key2][real]\n\n # Internationalization of string sorting with locale module\n ... | [
"0.62071997",
"0.58730274",
"0.5621224",
"0.5518866",
"0.54773545",
"0.5393",
"0.5341888",
"0.53232557",
"0.52600133",
"0.5190061",
"0.5181699",
"0.5151981",
"0.5151981",
"0.51229507",
"0.51078665",
"0.50911766",
"0.5082159",
"0.5018418",
"0.4954935",
"0.49236172",
"0.491044"... | 0.74383354 | 0 |
Custom virtual columns sorter. | def _custom_sorter(self, key1, key2):
col = self._col
ascending = self._colSortFlag[col]
real = self.get_real_col(col)
item1 = self.itemDataMap[key1][real]
item2 = self.itemDataMap[key2][real]
# Internationalization of string sorting with locale module
if isinst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetColumnSorter(self):\n\n return self._custom_sorter",
"def sortby(self):\n ...",
"def cols_sorted(self, cmp=None, key=None, reverse=False):\n return self.select(*sorted(self.names, cmp, key, reverse))",
"def get_sort_columns_raw(self):\n col_sort_orders = self.gridpreference... | [
"0.65281457",
"0.6102227",
"0.601787",
"0.58314013",
"0.56135947",
"0.5597947",
"0.54681903",
"0.53441566",
"0.53441566",
"0.5333031",
"0.53098905",
"0.53037524",
"0.52963907",
"0.5284364",
"0.5238234",
"0.5227253",
"0.5201991",
"0.5192361",
"0.51891035",
"0.5168167",
"0.5159... | 0.5765904 | 4 |
Reset all metrics to zero (need to do each epoch) | def reset(self):
self.train_loss.reset_states()
self.train_accuracy.reset_states()
self.val_loss.reset_states()
self.val_accuracy.reset_states()
self.train_mIoU.reset_states()
self.val_mIoU.reset_states() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_metrics(self):\n self.metrics['loss'] = 0.0\n self.metrics['num_tokens'] = 0\n self.metrics['correct_tokens'] = 0\n self.metrics['correct_pred'] = 0\n self.metrics['pred_count'] = 0",
"def reset(self):\n self.sum_metric = 0.\n self.num_inst = 0.\n ... | [
"0.8496252",
"0.81314856",
"0.77527833",
"0.77318305",
"0.7647041",
"0.7577927",
"0.7505078",
"0.74102134",
"0.73813385",
"0.7365769",
"0.73467314",
"0.7285014",
"0.72767705",
"0.7248069",
"0.7236277",
"0.7224332",
"0.7217214",
"0.7214814",
"0.71930635",
"0.71708196",
"0.7123... | 0.7057798 | 28 |
Returns a single Stream. | def get(self, id_stream):
session = current_app.session
stream = session.query(StreamDao).filter(StreamDao.id == id_stream).first()
if stream is None:
return None, 204
return stream, 200 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stream(self):\n return streams.Stream(self)",
"def get_stream(self):\n self.lock.acquire()\n stream=self.stream\n self.lock.release()\n return stream",
"def stream(self):\r\n return streams.Stream(self)",
"def stream(self):\r\n return streams.Stream(self)"... | [
"0.7747039",
"0.77306217",
"0.7725054",
"0.7725054",
"0.7380293",
"0.72829276",
"0.7248339",
"0.7060736",
"0.70309925",
"0.69151545",
"0.6739036",
"0.6654738",
"0.6629158",
"0.637735",
"0.6323343",
"0.62993824",
"0.6277728",
"0.6276736",
"0.6271744",
"0.6268093",
"0.606737",
... | 0.6158483 | 20 |
Performs the forward pass on a batch of states to generate the action probabilities. This returns a policy tensor of shape [episode_length, num_actions], where each row is a probability distribution over actions for each state. | def call(self, states, hand):
states = tf.convert_to_tensor(states)
hand = tf.convert_to_tensor(hand)
# 1. Raise each state in states with an embedding layer.
state_embedding = self.state_embedding(states)
# 2. Raise the hand with a different embedding layer.
hand_embeddi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward_step(self, state, return_probs_vector=False):\n state_id = self.env.get_num_from_state(state)\n probs = (\n sum(\n self.env.T_matrix[state_id * self.env.nA + a, :]\n * self.policy[state_id, a]\n for a in range(self.env.nA)\n ... | [
"0.66907716",
"0.66742134",
"0.65807354",
"0.6501595",
"0.6477979",
"0.6455489",
"0.64171404",
"0.63594675",
"0.6356999",
"0.6338009",
"0.6322942",
"0.62669086",
"0.61235493",
"0.61220336",
"0.61174953",
"0.6093815",
"0.6071995",
"0.60661024",
"0.606355",
"0.60573167",
"0.605... | 0.0 | -1 |
rebin 2D array pix into bins of size n x n New binsize must be evenly divisible into original pix image | def rebin_image(image, n):
assert image.shape[0] % n == 0
assert image.shape[1] % n == 0
s = image.shape[0]//n, n, image.shape[1]//n, n
return image.reshape(s).sum(-1).sum(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bin_2d(image, binning_factor):\n sh = np.shape(image)\n new_image = image.reshape(sh[0] // binning_factor, binning_factor, sh[1] // binning_factor, binning_factor).mean(\n -1).mean(1)\n\n return new_image",
"def rebin_image(self):\r\n\r\n # bin the image down to smaller size by combini... | [
"0.71244156",
"0.6861248",
"0.6771941",
"0.6206139",
"0.61923176",
"0.6159075",
"0.61325747",
"0.61067647",
"0.61021465",
"0.60795593",
"0.6072788",
"0.6056896",
"0.60401285",
"0.6016391",
"0.6014821",
"0.5905085",
"0.58886683",
"0.58848727",
"0.5882583",
"0.58790064",
"0.586... | 0.7151763 | 0 |
Add labelled edge between 2 nodes in the dependency graph | def add_edge(self, head, child, label=None):
self._heads[child] = head
self._labels[child] = label
# keep track of all dependents of a node
self._deps[head].append(child)
# keep track of the left/rights dependents
if child < head:
self._left_deps[head].appen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, v1, v2):\n pass # TODO",
"def add_edge(source, sink, label=\"\"):\n source.add_outgoing_edge(sink, label)\n sink.add_incoming_edge(source, label)",
"def add_edge(source, target, label, side_label):\n if (elements is not self and\n target not in... | [
"0.7362751",
"0.72575456",
"0.70459825",
"0.69533885",
"0.6930411",
"0.69220734",
"0.68644285",
"0.68520117",
"0.679381",
"0.67648506",
"0.6735517",
"0.66993856",
"0.667923",
"0.667237",
"0.66660583",
"0.66481894",
"0.6645584",
"0.6637192",
"0.6562251",
"0.65525043",
"0.65157... | 0.6746656 | 10 |
Render the homepage of the UI. Users query here. | def search_page():
return render_template('page_query.html', search_label=g_search_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\n # sets the page to load depending on the type of user\n # if none specified the login screen will be displayed\n pageName = ''\n userType = session.get('UserType', None)\n if userType == None:\n pageName = 'anonHome.jade'\n elif userType == 'Seeker':\n pageName = 'in... | [
"0.7765877",
"0.75022775",
"0.7501923",
"0.74749863",
"0.7439066",
"0.74265903",
"0.7424037",
"0.7402315",
"0.73976994",
"0.73958814",
"0.7393874",
"0.73911065",
"0.73742354",
"0.7372547",
"0.73630387",
"0.73470455",
"0.7338477",
"0.7338477",
"0.73351115",
"0.7324074",
"0.730... | 0.0 | -1 |
Get the RIB of the node. It can either be an AS or a router | def get_rib(self, node):
if not self.net.is_running:
error("The network is not running.")
r = self._get_node(node)
if r not in self.net.routers:
return None
out = r.cmd(self.RIBCommand)
if 'Connection refused' not in out:
return self._parse_rib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rib_out(self, node_id: str) -> ADJ_RIB_out:\n if node_id not in self.nodes_rib_out.keys():\n raise KeyError(\"{} not in the nodes rib out dict\".format(node_id))\n return self.nodes_rib_out[node_id]",
"def get_rpki_rib(self):\n cur = self.sql.cursor()\n cur.execute(... | [
"0.62995046",
"0.6155415",
"0.6010725",
"0.5768443",
"0.5704807",
"0.55112433",
"0.54687697",
"0.5466765",
"0.54094404",
"0.5377101",
"0.53746",
"0.53544825",
"0.5331491",
"0.5295416",
"0.52798563",
"0.52588284",
"0.5246311",
"0.52389044",
"0.5234734",
"0.5213477",
"0.5173211... | 0.76469797 | 0 |
Get the suffix of a LeafNodePath. | def _get_leaf_node_path_suffix(p):
return _LeafNodePath(_as_root_node_tensor(p.middle[0]), p.middle[1:], p.tail) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pathLeaf(path):\n head, tail = ntpath.split(path)\n return tail or ntpath.basename(head)",
"def suffix(self):\n return self[\"suffix\"]",
"def suffix(self):\n return self[\"suffix\"]",
"def path_leaf(path):\n head, tail = ntpath.split(path)\n return tail or ntpath.basename(head)... | [
"0.7573001",
"0.7312858",
"0.7312858",
"0.7301499",
"0.7191482",
"0.71273154",
"0.71062005",
"0.71062005",
"0.71062005",
"0.7069467",
"0.7069467",
"0.6821236",
"0.67081004",
"0.66396767",
"0.66022146",
"0.65634286",
"0.6484998",
"0.6435447",
"0.63797605",
"0.6360053",
"0.6348... | 0.8178771 | 0 |
Gets a ragged tensor from a leaf node path. | def _get_ragged_tensor_from_leaf_node_path(nodes,
options
):
if not nodes.middle:
return from_value_rowids_bridge(
nodes.tail.values,
value_rowids=nodes.tail.parent_index,
nrows=nodes.head.size,
va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_prensor_to_ragged_tensor_fn(session, proto_descriptor, path):\n protos = tf.compat.v1.placeholder(dtype=tf.string, shape=(None,))\n expr = s2t.expression_impl.proto.create_expression_from_proto(\n protos, proto_descriptor)\n expr = expr.project(path)\n [prensor] = s2t.calculate.calculate_prensors... | [
"0.59941137",
"0.5936841",
"0.58930516",
"0.5641258",
"0.5544587",
"0.5292013",
"0.5270012",
"0.52692187",
"0.51720107",
"0.51599723",
"0.50401396",
"0.5030945",
"0.5023733",
"0.4921559",
"0.492152",
"0.4920837",
"0.49044225",
"0.48774263",
"0.48718417",
"0.48705763",
"0.4866... | 0.8062186 | 0 |
Instance of `click.testing.CliRunner` with automagically `isolated_filesystem()` called. | def isolated_cli_runner(cli_runner: CliRunner) -> Generator[CliRunner, None, None]:
with cli_runner.isolated_filesystem():
yield cli_runner | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runner() -> CliRunner:\n return click.testing.CliRunner()",
"def isolated_cli_runner(cli_runner: CliRunner) -> Iterator[CliRunner]:\n with cli_runner.isolated_filesystem():\n yield cli_runner",
"def runner() -> CliRunner:\n return CliRunner()",
"def runner() -> CliRunner:\n return CliR... | [
"0.7636925",
"0.7612185",
"0.6908521",
"0.6908521",
"0.6775731",
"0.6749159",
"0.6405702",
"0.6405702",
"0.6405702",
"0.63916785",
"0.62555254",
"0.6226581",
"0.62091875",
"0.5909383",
"0.58321357",
"0.57652116",
"0.5692561",
"0.5677757",
"0.5665565",
"0.5644147",
"0.56371844... | 0.7678398 | 0 |
Set the name option of an interface. | def setName(self, name):
# type: (str)->None
self._validator.validate_one('name', VALID_OPTS['name'], name)
self._ifAttributes['name'] = str(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n self.options['name'] = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, ... | [
"0.7927644",
"0.761786",
"0.761786",
"0.761786",
"0.761786",
"0.761786",
"0.76026356",
"0.75299543",
"0.75299543",
"0.7495098",
"0.7487375",
"0.7487375",
"0.7487375",
"0.7487375",
"0.7467488",
"0.7439541",
"0.74296266",
"0.7408798",
"0.7408798",
"0.7406296",
"0.7406296",
"0... | 0.717915 | 27 |
Return a copy of the ifAttributes data structure as dict. You may optionally pass a list of options to return | def export(self, options_list=None):
# type: (tp.Optional[tp.List[str]])->tp.Dict[str, tp.Any]
attrs = self._ifAttributes
if options_list:
attrs = {}
for k in options_list:
try:
attrs[k] = self._ifAttributes[k]
except K... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n if self._dict is not None:\n return self._dict\n\n result = {}\n for key in self.ATTRIBUTES:\n value = getattr(self, key)\n if value:\n result[key] = value\n self._dict = result\n return result",
"def capabili... | [
"0.6421872",
"0.63037103",
"0.6301704",
"0.60913396",
"0.60145134",
"0.5957705",
"0.593351",
"0.58859384",
"0.5756",
"0.5751398",
"0.572051",
"0.5699228",
"0.56977993",
"0.56977993",
"0.56977993",
"0.5693103",
"0.56866974",
"0.5673942",
"0.5673518",
"0.56541675",
"0.56414783"... | 0.7673515 | 0 |
Ensure the data for the given key will be in a list. If value is a list, it will be flattened | def _ensure_list(dic, key, value):
# type: (tp.Any, str, tp.Any)->None
if key not in dic:
dic[key] = []
if not isinstance(dic[key], list):
tmp = dic[key]
dic[key] = [tmp]
if isinstance(value, list):
dic[key] += value
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getlist(self, key):\n \n value = self.get(key, [])\n if value is None or isinstance(value, (list, tuple)):\n return value\n else:\n return [value]",
"def ensure_list(data, key1, key2=None):\n if key2 is None:\n key2 = key1[:-1]\n\n if isinstance(... | [
"0.6927049",
"0.68954504",
"0.66051114",
"0.63449544",
"0.6278143",
"0.62477684",
"0.6166957",
"0.6160428",
"0.61310923",
"0.609465",
"0.6091963",
"0.6078081",
"0.60602844",
"0.6016851",
"0.6016851",
"0.5978201",
"0.595474",
"0.5950147",
"0.59288824",
"0.59203184",
"0.587845"... | 0.7332933 | 0 |
Compute the output shape of a transposed convolution. | def conv_transpose_output_shape(h_w, kernel_size=1, stride=1, pad=0, output_padding=0):
if type(kernel_size) is not tuple:
kernel_size = (kernel_size, kernel_size)
h = (h_w[0] - 1) * stride - (2 * pad) + kernel_size[0] + output_padding
w = (h_w[1] - 1) * stride - (2 * pad) + kernel_size[1] + output_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv2d_transpose(self, output_shape, filter_):\n return self.add_layer(conv2d_transpose, output_shape, filter_)",
"def get_output_shape(self):\n weights = self.W.get_shape().as_list()\n input_size = np.asarray(self.incoming_shape[-3:-1])\n strides = np.asarray(self.strides[-3:-1])... | [
"0.67945755",
"0.6751335",
"0.6743639",
"0.674018",
"0.6666403",
"0.663166",
"0.6598355",
"0.6591298",
"0.6591298",
"0.6591298",
"0.6588099",
"0.6576763",
"0.6574438",
"0.6572137",
"0.6563509",
"0.6542618",
"0.6531531",
"0.6480934",
"0.64753306",
"0.6453491",
"0.64316714",
... | 0.73243505 | 0 |
Normalize this URL by removing hash and adding domain | def normalize(seed_url, link):
link, _ = urldefrag(link) # remove hash to avoid duplicates
return urljoin(seed_url, link) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_url(self, url):\n pass",
"def url_norm(url, encoding=None, strip=False, lowercase_path=False, remove_fragment=False):\n\n if strip:\n url = url.strip()\n\n if isinstance(url, unicode):\n # try to decode the URL to ascii since urllib.unquote()\n # handles non-unicod... | [
"0.7577206",
"0.70005417",
"0.69015867",
"0.687918",
"0.6866126",
"0.68180645",
"0.67399746",
"0.6734249",
"0.6622277",
"0.65595686",
"0.6503708",
"0.6454672",
"0.6429661",
"0.6376121",
"0.6374432",
"0.6314381",
"0.6303243",
"0.6273526",
"0.62709045",
"0.62659615",
"0.6249797... | 0.6808679 | 6 |
Update the provided environment dict by running the script. | def handle_software_environment(cwl_env: Dict[str, str], script: str) -> Dict[str, str]:
exec_env = cwl_env.copy()
exec_env["_CWLTOOL"] = "1"
res = subprocess.run(["bash", script], shell=False, env=exec_env) # nosec
if res.returncode != 0:
sys.stderr.write("Error while using SoftwareRequirement... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, system, environment_input):\n pass",
"def update(self, env):\n del env\n return",
"def run_env(self, key, value):\n pass",
"def set_environment_variables(env_dict, session):\n for key, value in env_dict.items():\n session.env[key] = value",
"def update_env_var... | [
"0.7108166",
"0.6429448",
"0.634358",
"0.6342019",
"0.6178882",
"0.6154017",
"0.6132157",
"0.612212",
"0.6102744",
"0.606657",
"0.6042623",
"0.6007719",
"0.5991362",
"0.59453464",
"0.59425396",
"0.5900077",
"0.58668816",
"0.58595634",
"0.58545315",
"0.58395714",
"0.5825485",
... | 0.6010714 | 11 |
Return the coverage of the node, discounted by the coverage of neighbouring nodes not in the path | def get_discounted_node_cov(node,path,G):
pred_covs = [(get_cov_from_spades_name_and_graph(p,G),p) for p in G.predecessors(node)]
succ_covs = [(get_cov_from_spades_name_and_graph(s,G),s) for s in G.successors(node)]
non_path_cov = sum([p[0] for p in pred_covs if p[1] not in path]) + sum([s[0] for s in succ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coverage_metrics(area_map, path):\n path = np.array(path).T\n assert path.shape[0] == 2\n x, y = path\n\n \"\"\"\n calculates the distance to travel by the drone\n \"\"\"\n traveled = 0\n angle = 0\n curves = 0\n\n for m in range(len(x)-1):\n traveled += math.sqrt(math.... | [
"0.67791444",
"0.6045567",
"0.59110355",
"0.5787587",
"0.5774801",
"0.5734735",
"0.5679498",
"0.5648852",
"0.5645363",
"0.56408286",
"0.5597137",
"0.5597137",
"0.5573487",
"0.5559893",
"0.5550853",
"0.5550853",
"0.5550853",
"0.5546039",
"0.55389106",
"0.55268824",
"0.5468943"... | 0.7314865 | 0 |
retrieves set of nodes mapped to by read pairs having one mate on node; discards isolated nodes because they tend to reflect irrelevant alignments | def get_contigs_of_mates(node, bamfile, G):
mate_tigs = set([])
if node[-1] == "'": node=node[:-1]
try:
for hit in bamfile.fetch(node):
nref = bamfile.getrname(hit.next_reference_id)
if nref != node:
mate_tigs.add(nref)
except ValueError:
pass
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_ring_nodes(m, namin=3, namax=9, remove_redudant=T):\n # first search for rings\n sets = []\n for i in range(namin, namax+1):\n #if i in [3,4,5]:\n pat_i = '*~1' + '~*'*(i-2) + '~*1'\n #else:\n # pat_i = '*:1' + ':*'*(i-2) + ':*1'\n Qi = Chem.MolFromSmarts( pa... | [
"0.6151634",
"0.58929336",
"0.58251715",
"0.5658056",
"0.56443065",
"0.55982834",
"0.5587286",
"0.55176324",
"0.55136156",
"0.55103695",
"0.5446049",
"0.53892326",
"0.5336814",
"0.5336567",
"0.53179324",
"0.53052384",
"0.5298034",
"0.5284326",
"0.52798134",
"0.527656",
"0.527... | 0.6397694 | 0 |
Verifies whether not only As are Bs in a sequence. | def notonly_ver(seq):
for item in seq:
if np.array_equal(item, Quantifier.BnotA):
return Quantifier.T
return Quantifier.F | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CheckSeq(Seq):\n OkNucleo = (\"A\", \"C\", \"G\", \"T\")\n for i in Seq:\n if i not in OkNucleo:\n raise InputError(Seq,\"malformed input\")",
"def check_other(seq_iter):\n\treturn any(filter(has_abba, seq_iter))",
"def _check_items(cls, sequence):\n all([cls._check_item(x) f... | [
"0.67467326",
"0.65715164",
"0.6517284",
"0.64706063",
"0.6415162",
"0.6397542",
"0.61048204",
"0.60953486",
"0.6092488",
"0.60846347",
"0.6054272",
"0.6050505",
"0.6020228",
"0.59959936",
"0.594599",
"0.59299797",
"0.59054095",
"0.5903566",
"0.58913046",
"0.5881871",
"0.5870... | 0.5814031 | 22 |
Generates a Quantifier corresponding to all but n. | def all_but_n(n):
return Quantifier("all_but_{}".format(n),
isom=True, cons=True, lcons=False, rmon=None, lmon=None,
fn=lambda seq: all_but_n_ver(seq, n)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_but_n_ver(seq, n):\r\n num_AnotB = 0\r\n for item in seq:\r\n if np.array_equal(item, Quantifier.AnotB):\r\n num_AnotB += 1\r\n return Quantifier.T if num_AnotB == n else Quantifier.F",
"def drop(n):\n def _drop_xducer(step):\n outer = {\"count\": 0}\n def _dro... | [
"0.73132485",
"0.6602352",
"0.63106775",
"0.61999327",
"0.6059634",
"0.59755254",
"0.5950317",
"0.59258187",
"0.59131724",
"0.5889656",
"0.5668129",
"0.564914",
"0.56325084",
"0.5620147",
"0.5618542",
"0.56029224",
"0.5598489",
"0.55872035",
"0.5563999",
"0.5537969",
"0.55283... | 0.8269607 | 0 |
Returns the content of the element pointed by the CSS selector, or an empty string if not found | def _css_select(soup, css_selector):
selection = soup.select(css_selector)
if len(selection) > 0:
if hasattr(selection[0], 'text'):
retour = selection[0].text.strip()
else:
retour = ""
else:
retour = ""
return retour | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_text(self, selector):\n el = self.locate_element(selector)\n return el.text",
"def _get_element_text(self, selector):\r\n text_list = self._find_within(selector).text\r\n return text_list[0] if text_list else None",
"def get_inner_text(self, css_selector):\n element =... | [
"0.7807155",
"0.75559545",
"0.7347338",
"0.7177119",
"0.71689636",
"0.6964603",
"0.6919934",
"0.6628587",
"0.6464039",
"0.6378006",
"0.61686534",
"0.6139356",
"0.6057531",
"0.6057098",
"0.60482126",
"0.60424733",
"0.60120195",
"0.59997714",
"0.59809774",
"0.5951575",
"0.59339... | 0.71902966 | 3 |
Returns the main page with default of minerals starting with A listed. | def index(request):
minerals = Mineral.objects.filter(name__startswith='A')
messages.success(request, "Successfully found {} of the following minerals!".format(len(minerals)))
return render(request, 'index.html', {'minerals': minerals}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialPage():\n\treturn header() + footer()",
"def home_page():\n return (\n f\"Available Routes:<br/>\"\n f\"/api/v1.0/precipitation<br/>\"\n f\"/api/v1.0/stations<br/>\"\n f\"/api/v1.0/tobs<br/>\"\n f\"/api/v1.0/start<br/>\"\n f\"/api/v1.0/start/end<br/>\"\n ... | [
"0.67111564",
"0.6113366",
"0.60944694",
"0.60894",
"0.5865181",
"0.5819003",
"0.57833713",
"0.5762131",
"0.5744716",
"0.57151186",
"0.57060885",
"0.5696606",
"0.5653075",
"0.5646128",
"0.5622696",
"0.56058514",
"0.55835867",
"0.55835867",
"0.5572589",
"0.5567097",
"0.5564662... | 0.63797146 | 1 |
Returns an index view with only the minerals displayed which meet the query criteria. | def search_by_name(request):
search_term = request.GET.get('q')
minerals = Mineral.objects.filter(name__icontains=search_term)
messages.success(request, "Successfully found {} of the following minerals!".format(len(minerals)))
return render(request, 'index.html', {'minerals': minerals}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(request):\n minerals = Mineral.objects.filter(name__startswith='A')\n messages.success(request, \"Successfully found {} of the following minerals!\".format(len(minerals)))\n return render(request, 'index.html', {'minerals': minerals})",
"def index_queryset(self):\n return self.get_model... | [
"0.64888036",
"0.6145249",
"0.612185",
"0.5989232",
"0.5989232",
"0.5989232",
"0.5989232",
"0.5989232",
"0.5989232",
"0.5989232",
"0.5989232",
"0.5989232",
"0.5989232",
"0.5989232",
"0.5882558",
"0.5807392",
"0.57840645",
"0.57823706",
"0.57547057",
"0.57471263",
"0.57203317"... | 0.59267694 | 14 |
This function uses the fucntion createRandom to fold protein until the protein is validly folded. Returns the folded protein. | def randomFold(proteinString, plane):
protein = Protein(proteinString, plane)
# Fold the protein
validFolding = createRandom(protein)
while not validFolding:
# Fold the protein again
validFolding = createRandom(protein)
return protein | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createRandom(protein):\n\n protein.occupied = []\n protein.aminoList = []\n\n for id in range(protein.proteinLength):\n protein.aminoList.append(Amino(id, protein.proteinString[id]))\n\n # Place the first and second amino acid\n if id in {0, 1}:\n thisCoordinate = [0, i... | [
"0.66577893",
"0.5151083",
"0.5089178",
"0.50648373",
"0.5049932",
"0.5034096",
"0.5013142",
"0.5009248",
"0.49666798",
"0.49506995",
"0.49476516",
"0.4929508",
"0.4861598",
"0.48447198",
"0.48283947",
"0.48241118",
"0.48234522",
"0.48175165",
"0.47955433",
"0.4794365",
"0.47... | 0.7396538 | 0 |
Random folding of the protein. The first and second amino acids are always placed at coordinates (0, 0) and (0, 1) (or for 3D (0, 0, 0) and (0, 1, 0)) respectively. This excludes rotationally symmetric folds. Returns True if the protein is validly folded and False if the protein is not validly folded. | def createRandom(protein):
protein.occupied = []
protein.aminoList = []
for id in range(protein.proteinLength):
protein.aminoList.append(Amino(id, protein.proteinString[id]))
# Place the first and second amino acid
if id in {0, 1}:
thisCoordinate = [0, id]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomFold(proteinString, plane):\n\n protein = Protein(proteinString, plane)\n\n # Fold the protein\n validFolding = createRandom(protein)\n\n while not validFolding:\n # Fold the protein again\n validFolding = createRandom(protein)\n\n return protein",
"def _pre_check(self) -> ... | [
"0.5876433",
"0.5085454",
"0.5073674",
"0.5069469",
"0.5042128",
"0.49635172",
"0.49400097",
"0.49311003",
"0.49236113",
"0.48493937",
"0.48486397",
"0.48427165",
"0.48308676",
"0.4817986",
"0.4777201",
"0.47732565",
"0.47505078",
"0.47221968",
"0.4717568",
"0.46741062",
"0.4... | 0.62171626 | 0 |
DT_IGNORE Creates or gets a numeric group id from namespace and identifier. | def get_group_id(namespace: str, identifier: str) -> int:
return Murmur3().get_group_id(namespace, identifier) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_group_id(self):\n if not hasattr(self.space, '_group_ctr'):\n self.space._group_ctr = 999\n self.space._group_ctr += 1\n return self.space._group_ctr",
"def get_grouping_id(metric_key, metric_grouping):\n for index in range(3):\n grouping_candidate = random.... | [
"0.6014531",
"0.5997219",
"0.5970293",
"0.59467477",
"0.5872595",
"0.58627933",
"0.58627933",
"0.58181095",
"0.57615536",
"0.5737611",
"0.5705402",
"0.567109",
"0.5637106",
"0.5598504",
"0.5598504",
"0.5598504",
"0.5588042",
"0.5584629",
"0.5584629",
"0.5584629",
"0.5575309",... | 0.65737486 | 0 |
Returns CLI arguments parser | def get_parser():
parser = parser.ArgumentParser()
return parser | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_cli():\n parser = OptionParser()\n return parser.parse_args()",
"def parse_cli():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"ENV\", help=\"Enviorment SCANNER, PC, REMOMTE\")\n args = parser.parse_args()\n\n return args",
"def cmdline_parser():\n\n # http://docs.... | [
"0.8196402",
"0.8080752",
"0.7898864",
"0.785061",
"0.78047395",
"0.78047395",
"0.7798605",
"0.7776068",
"0.77624434",
"0.775629",
"0.7723223",
"0.7687207",
"0.7681091",
"0.7679781",
"0.7665985",
"0.7640004",
"0.76204604",
"0.7618474",
"0.76173127",
"0.76065207",
"0.75747454"... | 0.7452342 | 37 |
Get all cars from db. | def get_all_cars(self):
all_cars = TheCar.objects.all()
return all_cars | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_cars(self):\n return self.cars.get_all_cars()",
"async def get_cars(session: AsyncSession = Depends(get_session)) -> list[Car]:\n result = await session.execute(select(Car))\n return [Car(name=car.name, manufacturer=car.manufacturer, id=car.id) for car in result.scalars().all()]",
"def... | [
"0.78536844",
"0.7527779",
"0.71802926",
"0.7013079",
"0.6924098",
"0.6866876",
"0.6755445",
"0.6738459",
"0.6693889",
"0.6615636",
"0.6498028",
"0.6483031",
"0.6480473",
"0.64601976",
"0.63902754",
"0.63862395",
"0.63851434",
"0.6332205",
"0.63264626",
"0.63193595",
"0.62939... | 0.8369058 | 0 |
Add new rate to specified car. | def rate_car(self, make, model, rate):
try:
found_car = TheCar.objects.get(make=make.upper(), model=model.upper())
except:
return False
else:
found_car.rates += 1
if rate == 1:
found_car.rate1 = int(found_car.rate1) + 1 if found_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_car(self, car):\n\n TheCar.objects.update_or_create(make=car.make, model=car.model.upper())",
"def rate(self, rate):\n\n self._rate = rate",
"def rate(self, rate):\n\n self._rate = rate",
"def addCars(self, amount):\n speedMultiplier = self.params['speed'][1] - self.params... | [
"0.6657067",
"0.61015946",
"0.61015946",
"0.6028448",
"0.59873486",
"0.5932462",
"0.5919552",
"0.5886213",
"0.57961136",
"0.5748402",
"0.57039",
"0.56761694",
"0.5627035",
"0.5587056",
"0.5584775",
"0.5571537",
"0.55713296",
"0.55517775",
"0.55193055",
"0.5517628",
"0.5503428... | 0.6834427 | 0 |
Return the color property. | def rgb_color(self):
return self._color | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color(self):\n if \"color\" in self._prop_dict:\n return self._prop_dict[\"color\"]\n else:\n return None",
"def get_color(self):\r\n return self.__color",
"def get_color(self):\n return self.color",
"def get_color(self):\r\n return self._color",
... | [
"0.87653166",
"0.87366503",
"0.8715803",
"0.8709524",
"0.8682282",
"0.8670377",
"0.8670377",
"0.86526895",
"0.8624963",
"0.8608365",
"0.8608365",
"0.85546553",
"0.8554106",
"0.854379",
"0.85098284",
"0.85098284",
"0.85098284",
"0.84986424",
"0.8456452",
"0.83982414",
"0.83982... | 0.7656027 | 39 |
Return true if we do optimistic updates. | def assumed_state(self):
return self._command_state is False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_update(self) -> bool:\n return self.statement.is_dml and self.statement.is_update",
"def _can_do_updates(self):\n return True",
"def hasChanged(self):\r\n if self.is_updated:\r\n self.is_updated = False\r\n return True\r\n else:\r\n return Fal... | [
"0.73964417",
"0.7278663",
"0.7245927",
"0.6944468",
"0.68290955",
"0.6739517",
"0.6733149",
"0.6692119",
"0.6631447",
"0.65886956",
"0.65801424",
"0.6547911",
"0.653025",
"0.65019864",
"0.6399094",
"0.63840306",
"0.63647705",
"0.63334054",
"0.6331249",
"0.62145007",
"0.61863... | 0.0 | -1 |
Check that embeddings are uniform, are not both None, and have same embedding_size | def check_uniform_embeddings(
embedding_num: Optional[EmbeddingBase],
embedding_cat: Optional[EmbeddingBase],
) -> EmbeddingInfo:
# check embedding sizes and get derived values
if embedding_num is None and embedding_cat is None:
raise ValueError("embedding_num and embedding_cat cannot both be No... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_embeddings(\n embedding_num: Optional[EmbeddingBase],\n embedding_cat: Optional[EmbeddingBase],\n) -> EmbeddingInfo:\n # get number of fields and total output size\n if embedding_num is None and embedding_cat is None:\n return EmbeddingInfo(0, 0)\n\n num_fields = 0\n output_size ... | [
"0.64989173",
"0.63688195",
"0.6341857",
"0.6131795",
"0.60367113",
"0.600345",
"0.60014683",
"0.59798205",
"0.5979441",
"0.5967271",
"0.58119464",
"0.5798997",
"0.57981473",
"0.5794713",
"0.57849044",
"0.5762123",
"0.5761433",
"0.57531583",
"0.57480466",
"0.5745545",
"0.5710... | 0.69622046 | 0 |
Plot an image along with its histogram and cumulative histogram | def plot_img_and_hist(image, axes, bins=256):
image = img_as_float(image)
ax_img, ax_hist = axes
ax_cdf = ax_hist.twinx()
# Display image
ax_img.imshow(image, cmap=plt.cm.gray)
ax_img.set_axis_off()
# Display histogram
ax_hist.hist(image.ravel(), bins=bins, histtype='step', color='blac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_img_and_hist(image, axes, bins=256):\n# image = img_as_float(image)\n ax_img, ax_hist = axes\n ax_cdf = ax_hist.twinx()\n\n # Display image\n ax_img.imshow(image, cmap=plt.cm.gray);\n ax_img.set_axis_off()\n\n # Display histogram\n ax_hist.hist(image.ravel(), bins=bins, histtype='... | [
"0.79712605",
"0.77877474",
"0.7662112",
"0.7385908",
"0.7265469",
"0.71918064",
"0.70633245",
"0.69852966",
"0.6891767",
"0.68743986",
"0.68024004",
"0.68024004",
"0.68024004",
"0.66946405",
"0.6639566",
"0.65769684",
"0.65732086",
"0.6505056",
"0.6369845",
"0.63639116",
"0.... | 0.7724569 | 2 |
Convert class labels from scalars to onehot vectors. | def dense_to_one_hot(self, labels_dense, num_classes):
return np.eye(num_classes)[labels_dense] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(labels, classes=None):\n return K.utils.to_categorical(labels, classes)",
"def one_hot(labels, classes=None):\n\n one_hot_ = K.utils.to_categorical(labels, classes)\n return(one_hot_)",
"def to_onehot(labels: torch.Tensor, num_classes: int) -> torch.Tensor:\n if len(labels.size()) == 1:... | [
"0.8250402",
"0.807683",
"0.80523187",
"0.7977843",
"0.7908335",
"0.7900327",
"0.7892233",
"0.7869711",
"0.7849721",
"0.7849721",
"0.7826951",
"0.7826122",
"0.77677035",
"0.7765413",
"0.77540547",
"0.77540547",
"0.77540547",
"0.77489346",
"0.7742955",
"0.7737176",
"0.77226317... | 0.7555525 | 44 |
Constructs an IPTag object. | def __init__(self, **kwargs):
members = ('ip', 'mac', 'port', 'timeout', 'flags',
'index', 'tag', 'hostname')
# copy the given value or default to None
for member in members:
self.__dict__[member] = kwargs.setdefault (member, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__, *,\n ip_tag_type: Optional[pulumi.Input[str]] = None,\n tag: Optional[pulumi.Input[str]] = None):\n if ip_tag_type is not None:\n pulumi.set(__self__, \"ip_tag_type\", ip_tag_type)\n if tag is not None:\n pulumi.set(__self__... | [
"0.6941745",
"0.6145799",
"0.60613406",
"0.60026276",
"0.59347343",
"0.5879756",
"0.58414394",
"0.57297677",
"0.5694575",
"0.56703776",
"0.5666385",
"0.56635576",
"0.5648694",
"0.5542343",
"0.55409145",
"0.5537023",
"0.5447569",
"0.5439185",
"0.5427557",
"0.54247904",
"0.5421... | 0.0 | -1 |
Mark a video as flagged. | def flag_video(self, video_id, flag_reason=""):
videos = self._video_library.get_all_videos()
matched = False
for video_f in self.flagged:
if video_id.lower() in video_f:
print("Cannot flag video: Video is already flagged")
break
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flag_video(self, video_id, flag_reason=\"Not supplied\"):\n video = self._video_library.get_video(video_id)\n if not video:\n print(\"Cannot flag video: Video does not exist\")\n return\n if video.flag is not None:\n print(\"Cannot flag video: Video is alre... | [
"0.7585753",
"0.7543017",
"0.7286989",
"0.7286989",
"0.68738246",
"0.67508376",
"0.6579819",
"0.65071416",
"0.59914064",
"0.5956641",
"0.583062",
"0.5781579",
"0.5766682",
"0.57447886",
"0.57447886",
"0.57447886",
"0.57447886",
"0.56196725",
"0.5476563",
"0.54668385",
"0.5389... | 0.6934897 | 4 |
Public method to set the list of blocked domains. list_ list of blocked domains (list of strings) | def setBlockedCookies(self, list_):
if not self.__loaded:
self.__load()
self.__exceptionsBlock = list_[:]
self.__exceptionsBlock.sort()
self.__saveTimer.changeOccurred() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetDomainsList(self, domainsList) :\n\t\t...",
"def set_search_domains(self, hSearchDomainsList):\n\t\tcall_sdk_function('PrlVmDevNet_SetSearchDomains', self.handle, conv_handle_arg(hSearchDomainsList))",
"def set_search_domains(self, hSearchDomainsList):\n\t\tcall_sdk_function('PrlVmCfg_SetSearchDomains',... | [
"0.7745539",
"0.6183828",
"0.6166877",
"0.6150794",
"0.59379864",
"0.588753",
"0.57991415",
"0.57857275",
"0.57089376",
"0.56997347",
"0.56793857",
"0.5671253",
"0.5650077",
"0.5568337",
"0.5538602",
"0.5538602",
"0.55260533",
"0.5504782",
"0.5498809",
"0.5423998",
"0.5373138... | 0.63237345 | 1 |
Take a string and return a valid filename constructed from the string. | def format_filename(s):
valid_chars = "-_.() %s%s" % (string.ascii_letters, string.digits)
filename = ''.join(c for c in s if c in valid_chars)
filename = filename.replace(' ', '_') # I don't like spaces in filenames.
return filename | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_filename(s: str):\n # from: https://gist.github.com/seanh/93666\n\n valid_chars = \"-_.() %s%s\" % (string.ascii_letters, string.digits)\n filename = ''.join(c for c in s if c in valid_chars)\n filename = filename.replace(' ', '_') # I don't like spaces in filenames.\n return filename",
... | [
"0.80485183",
"0.798944",
"0.7949801",
"0.787847",
"0.7862182",
"0.7727231",
"0.77141064",
"0.76735306",
"0.75296444",
"0.7505588",
"0.747976",
"0.743618",
"0.7330777",
"0.73069334",
"0.7068746",
"0.70555854",
"0.6852573",
"0.68469024",
"0.6833942",
"0.6758523",
"0.6737564",
... | 0.7855741 | 6 |
View function for home page of site. | def index(request):
# Generate counts of some of the main objects
##num_books=Book.objects.all().count()
##num_instances=BookInstance.objects.all().count()
# Available books (status = 'a')
##num_instances_available=BookInstance.objects.filter(status__exact='a').count()
num_authors=Post.objects.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home(request):\n\treturn render(request, \"compta/home.html\")",
"def home_page(request):\r\n return render(request, 'ez_main/home_page.html')",
"def home(request):\r\n return render(request, 'home.html')",
"def homepage(request):\n\treturn render(request, 'core/homepage.html')",
"def homepage(req... | [
"0.8493426",
"0.84268916",
"0.83415145",
"0.83306193",
"0.82976943",
"0.8295291",
"0.8276345",
"0.82545686",
"0.82155704",
"0.8132563",
"0.81246215",
"0.81224865",
"0.8121264",
"0.81049734",
"0.8098485",
"0.80935514",
"0.80935514",
"0.80935514",
"0.80935514",
"0.80935514",
"0... | 0.0 | -1 |
Changes the column col from a categorical type to it's integer codes. | def numericalize(df, col, name, max_n_cat):
if not is_numeric_dtype(col) and ( max_n_cat is None or col.nunique()>max_n_cat):
df[name] = col.cat.codes+1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_categorical(df):\n cat_cols = df.select_dtypes(\"category\").columns\n for col in cat_cols:\n df[col] = df[col].cat.codes + 1\n unique_no = len(df[col].unique())\n if unique_no < 50:\n df[col] = df[col].astype(\"uint8\")\n elif unique_no < 16000:\n ... | [
"0.70822436",
"0.6667424",
"0.66295624",
"0.65453863",
"0.6460738",
"0.6441559",
"0.63394433",
"0.6199746",
"0.6192149",
"0.61766446",
"0.6158148",
"0.61502683",
"0.6119392",
"0.6006197",
"0.6002804",
"0.59568983",
"0.5953708",
"0.5856821",
"0.58450335",
"0.5830752",
"0.58287... | 0.6408884 | 6 |
Given a list of comments, returns them in linear order (to display them as a simple list and not as a threaded tree. | def linear(comments):
return {'root': comments} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_comments(self, tree, comments):\n comments = list(comments)\n comments.sort(key=lambda c: c.line)\n\n idx_by_line = {0: 0} # {line_no: comment_idx}\n\n for i, c in enumerate(comments):\n if c.line not in idx_by_line:\n idx_by_line[c.line] = i\n\n ... | [
"0.65758336",
"0.6571873",
"0.656471",
"0.641244",
"0.6356432",
"0.62170196",
"0.62037086",
"0.62008995",
"0.61759603",
"0.6117252",
"0.6084452",
"0.6076712",
"0.60607237",
"0.6048085",
"0.5993899",
"0.5969844",
"0.59563303",
"0.5944167",
"0.58613896",
"0.58442205",
"0.580879... | 0.60784525 | 11 |
Mark book as 'read' in database. | def change_to_read(name):
for book in BOOKS:
if book['name'] == name:
book['read'] = True
else:
print('No book with this name!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_book_read(self, id, read):\n\n try:\n with self._db as db:\n cur = db.cursor()\n cur.execute('UPDATE books SET read = ? WHERE rowid = ?', (read, id))\n if not cur.rowcount:\n raise BookError('Tried to ... | [
"0.77980536",
"0.6957018",
"0.6493594",
"0.63089144",
"0.61195487",
"0.6074243",
"0.6056877",
"0.5946356",
"0.5886812",
"0.58660597",
"0.5850923",
"0.58459544",
"0.58335173",
"0.5825747",
"0.5822148",
"0.5759673",
"0.5673591",
"0.5624998",
"0.5584248",
"0.5583868",
"0.5561756... | 0.6718219 | 2 |
Mark book as 'unread' in the list. | def change_to_unread(name):
for book in BOOKS:
if book['name'] == name:
book['read'] = False
else:
print('No book with this name!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_messages_unread(self, mbox, msgset):\n self._remove_flag(mbox, msgset, r'(\\Seen)')",
"def mark_as_unread(self):\n\n response = self._api_client.session.post(\n self._api_client._construct_url('/reader/mark_story_as_unread'),\n data={'story_id': self.id, 'feed_id': se... | [
"0.74355054",
"0.7010162",
"0.66955197",
"0.6640406",
"0.6497718",
"0.64903724",
"0.6455583",
"0.63732564",
"0.62078065",
"0.61880463",
"0.6010605",
"0.5975449",
"0.59176105",
"0.57258046",
"0.5638565",
"0.56362236",
"0.5629387",
"0.55496776",
"0.5543765",
"0.5519029",
"0.550... | 0.6569718 | 4 |
Index an individual page | def add_to_index(self, url, soup):
# Check if its been indexed
if self.is_indexed(url):
return
print('Indexing ' + url)
# Get the individual words
text = self.get_text_only(soup)
words = separate_words(text)
# Get the URL id
urlid = self.get_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n\n return {\n 'page': 'index',\n }",
"def index():\n return render_template('pages/index.html', isNav=True)",
"def index_page():\n\n return render_template(\"index.html\")",
"def index_page():\n\n return render_template(\"index.html\")",
"def index_page():\n\n return ... | [
"0.8004293",
"0.77858204",
"0.7505834",
"0.7505834",
"0.7505834",
"0.7442034",
"0.7441919",
"0.7394196",
"0.73724174",
"0.73605466",
"0.7340058",
"0.73361444",
"0.73288715",
"0.7298505",
"0.7255734",
"0.7245193",
"0.72437596",
"0.7219295",
"0.71849555",
"0.71849555",
"0.71679... | 0.0 | -1 |
Get a body of text and seperate into words by any nonwhitespace character | def separate_words(text):
splitter = re.compile('\\W*')
return [s.lower() for s in splitter.split(text) if s != ''] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n return text.split(' ')",
"def get_words(text):\n\n only_words_text = re.compile(r'[^0-9^a-z^A-Z\\s]').sub('', text)\n return only_words_text.split(' ')",
"def _preprocess_text(text: str) -> List[List[str]]:\n\n # replace all except characters_to_keep with space\n characters_to... | [
"0.7051718",
"0.6961819",
"0.694195",
"0.69268847",
"0.675521",
"0.6723694",
"0.6709493",
"0.666723",
"0.6634504",
"0.66195375",
"0.65483016",
"0.6543867",
"0.6532208",
"0.6526927",
"0.650539",
"0.6502522",
"0.6487951",
"0.6487372",
"0.6474143",
"0.64734024",
"0.64734024",
... | 0.67866534 | 4 |
Return the value of the state (computed in __init__). | def getValue(self, state):
return self.values[state] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self, state):\n raise NotImplementedError",
"def value(self, state):\n raise NotImplementedError",
"def value(self, state):\n\t\traise NotImplementedError",
"def getValue(self, state):\n util.raiseNotDefined()",
"def getValue(self, state):\n util.raiseNotDefined()",
... | [
"0.83014333",
"0.83014333",
"0.826012",
"0.8086146",
"0.8086146",
"0.79581815",
"0.79296756",
"0.78013283",
"0.77367806",
"0.77336967",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
"0.76010257",
... | 0.77333474 | 16 |
The policy is the best action in the given state according to the values currently stored in self.values. You may break ties any way you see fit. Note that if there are no legal actions, which is the case at the terminal state, you should return None. | def computeActionFromValues(self, state):
"*** YOUR CODE HERE ***"
actions = self.mdp.getPossibleActions(state)
# Initialize max_value as - infinity
# Initialize best action as None, choose max_value action
max_value = float("-inf")
computed_action = None
for act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPolicy(self, state):\n \"*** YOUR CODE HERE ***\"\n # OUR CODE HERE\n possibleActions = self.mdp.getPossibleActions(state)\n #checking for terminal state (no possible actions)\n if len(possibleActions) is 0: \n return None\n \n #attempt at using the Counter\n eValsActions = ut... | [
"0.7792549",
"0.7711781",
"0.76139647",
"0.76062703",
"0.74914557",
"0.7466959",
"0.73729706",
"0.73415923",
"0.73398566",
"0.73370594",
"0.733471",
"0.7314126",
"0.7310347",
"0.73096246",
"0.7293995",
"0.7272919",
"0.7243716",
"0.7243716",
"0.7155405",
"0.70879567",
"0.70817... | 0.70621777 | 21 |
The set of arguments for constructing a PartnerTopic resource. | def __init__(__self__, *,
resource_group_name: pulumi.Input[str],
activation_state: Optional[pulumi.Input[Union[str, 'PartnerTopicActivationState']]] = None,
event_type_info: Optional[pulumi.Input['EventTypeInfoArgs']] = None,
expiration_time_if_not_ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: PartnerTopicArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOptions] = None,\n ... | [
"0.78356504",
"0.61782336",
"0.6106452",
"0.58668435",
"0.57719415",
"0.5769083",
"0.5662153",
"0.5656129",
"0.56495136",
"0.5648354",
"0.56277585",
"0.5588112",
"0.5516129",
"0.5508478",
"0.54229593",
"0.5396338",
"0.5360924",
"0.5336146",
"0.5277301",
"0.5241184",
"0.520807... | 0.5647071 | 10 |
The name of the resource group within the user's subscription. | def resource_group_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "resource_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_group(self) -> str:\n return pulumi.get(self, \"resource_group\")",
"def resource_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_group_name\")",
"def res... | [
"0.84030455",
"0.8127863",
"0.80530316",
"0.80530316",
"0.80530316",
"0.80530316",
"0.80530316",
"0.80530316",
"0.80530316",
"0.80530316",
"0.80530316",
"0.80530316",
"0.80530316",
"0.80530316",
"0.8035883",
"0.79388916",
"0.7760978",
"0.7760978",
"0.7760978",
"0.7760978",
"0... | 0.78005606 | 42 |
Identity information for the Partner Topic resource. | def identity(self) -> Optional[pulumi.Input['IdentityInfoArgs']]:
return pulumi.get(self, "identity") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topic_identity(self, name=None):\n identity = self._wc2identity.get(name)\n if not identity:\n identity = self.next_topic_identity(name)\n if name:\n self._wc2identity[name] = identity\n return identity",
"def topic_id(self) -> TopicId:\n retur... | [
"0.6886656",
"0.6623032",
"0.64313686",
"0.64098066",
"0.6331101",
"0.6208277",
"0.61234844",
"0.6042728",
"0.5966717",
"0.5858832",
"0.5853809",
"0.583567",
"0.5832993",
"0.57943475",
"0.5748155",
"0.5623574",
"0.5609267",
"0.5594959",
"0.55931133",
"0.5578477",
"0.55669093"... | 0.5187308 | 50 |
Name of the partner topic. | def partner_topic_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "partner_topic_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topic(self):\n return self._topic_name",
"def response_kafka_topic_name(self) -> str:\n return self._response_kafka_topic_name",
"def kafka_topic(self) -> str:\n return self._kafka_topic",
"def partner_name(self) -> str:\n return pulumi.get(self, \"partner_name\")",
"def par... | [
"0.7823629",
"0.7583535",
"0.73803765",
"0.7343445",
"0.7343445",
"0.734234",
"0.7143401",
"0.69896066",
"0.69613945",
"0.684552",
"0.6818732",
"0.6785819",
"0.6711438",
"0.670527",
"0.6643874",
"0.6643361",
"0.6622226",
"0.64118963",
"0.63731056",
"0.633877",
"0.6336797",
... | 0.86357975 | 0 |
Source associated with this partner topic. This represents a unique partner resource. | def source(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "source") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_source(self):\n if \"externalSource\" in self._prop_dict:\n if isinstance(self._prop_dict[\"externalSource\"], OneDriveObjectBase):\n return self._prop_dict[\"externalSource\"]\n else :\n self._prop_dict[\"externalSource\"] = EducationExternal... | [
"0.6673639",
"0.65819967",
"0.6546422",
"0.6380972",
"0.6380972",
"0.6380972",
"0.6380972",
"0.6380972",
"0.6380972",
"0.6330744",
"0.6330744",
"0.63012516",
"0.62928265",
"0.6279115",
"0.622665",
"0.6172322",
"0.61239976",
"0.6085777",
"0.6085777",
"0.60760003",
"0.60760003"... | 0.5648904 | 44 |
Identity information for the Partner Topic resource. | def identity(self) -> pulumi.Output[Optional['outputs.IdentityInfoResponse']]:
return pulumi.get(self, "identity") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topic_identity(self, name=None):\n identity = self._wc2identity.get(name)\n if not identity:\n identity = self.next_topic_identity(name)\n if name:\n self._wc2identity[name] = identity\n return identity",
"def topic_id(self) -> TopicId:\n retur... | [
"0.6888875",
"0.66260356",
"0.643438",
"0.6413152",
"0.6334319",
"0.6210963",
"0.6126564",
"0.6045784",
"0.5967025",
"0.5860845",
"0.5856062",
"0.58388317",
"0.58369374",
"0.57963043",
"0.5747999",
"0.56260896",
"0.56116307",
"0.5596375",
"0.5594573",
"0.55798215",
"0.5565331... | 0.49167752 | 95 |
Name of the resource. | def name(self) -> pulumi.Output[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_name(self):\n return self._resource_name",
"def name(self):\n return self.raw_resource[\"name\"]",
"def name(self):\n\n return self.resource[\"metadata\"][\"name\"]",
"def resource_name(self) -> Optional[str]:\n return pulumi.get(self, \"resource_name\")",
"def ... | [
"0.88154817",
"0.8800684",
"0.8529886",
"0.82741654",
"0.82741654",
"0.8056137",
"0.8005665",
"0.8005665",
"0.8005665",
"0.8005665",
"0.8005665",
"0.78669566",
"0.76202524",
"0.76202524",
"0.76202524",
"0.76202524",
"0.76202524",
"0.76202524",
"0.76202524",
"0.76202524",
"0.7... | 0.0 | -1 |
Source associated with this partner topic. This represents a unique partner resource. | def source(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "source") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_source(self):\n if \"externalSource\" in self._prop_dict:\n if isinstance(self._prop_dict[\"externalSource\"], OneDriveObjectBase):\n return self._prop_dict[\"externalSource\"]\n else :\n self._prop_dict[\"externalSource\"] = EducationExternal... | [
"0.66738045",
"0.6584153",
"0.6546258",
"0.6381058",
"0.6381058",
"0.6381058",
"0.6381058",
"0.6381058",
"0.6381058",
"0.6331146",
"0.6331146",
"0.6301486",
"0.62933725",
"0.62802786",
"0.6227462",
"0.6171499",
"0.61236185",
"0.60862833",
"0.60862833",
"0.6076713",
"0.6076713... | 0.56146723 | 50 |
The system metadata relating to Partner Topic resource. | def system_data(self) -> pulumi.Output['outputs.SystemDataResponse']:
return pulumi.get(self, "system_data") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topic(self):\n return self.config.get('topic', f'{NAMESPACE}/{self.id}')",
"def topic(self):\n return self._topic_name",
"def get_topic(self):\n return self.topic",
"def topic(self) -> str:\n return self._topic",
"def _get_generic_topic(self):\n\n content_type = Conte... | [
"0.6580708",
"0.6521669",
"0.646996",
"0.6321143",
"0.61550206",
"0.614183",
"0.60498375",
"0.60498375",
"0.59442234",
"0.59391886",
"0.5931491",
"0.58317256",
"0.582995",
"0.58204836",
"0.58115375",
"0.5754641",
"0.57222563",
"0.5701514",
"0.5696956",
"0.5676829",
"0.5614970... | 0.0 | -1 |
Type of the resource. | def type(self) -> pulumi.Output[str]:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(cls):\n pass",
"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 pu... | [
"0.87251276",
"0.8417671",
"0.8417671",
"0.8300375",
"0.8300375",
"0.8300375",
"0.8300375",
"0.8300375",
"0.8043247",
"0.7727425",
"0.7472895",
"0.7472895",
"0.7472895",
"0.7472895",
"0.7472895",
"0.7472895",
"0.7472895",
"0.7472895",
"0.7472895",
"0.7472895",
"0.7472895",
... | 0.0 | -1 |
Retrieves clean formatted products | def get_products(self):
formatted_products = []
resp = woo_api
for product in resp:
formatted = self._format_product(product)
formatted_products.append(formatted)
return formatted_products | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_final_response(self, all_products):\n keys = [\n 'id',\n 'product_name_fr',\n 'main_category',\n 'generic_name_fr']\n for product in all_products:\n if self.validate_the_data(keys, product):\n return product",
"def ret... | [
"0.70092434",
"0.6906355",
"0.68401086",
"0.68373805",
"0.67740494",
"0.67245483",
"0.66044503",
"0.65554696",
"0.6447282",
"0.63737714",
"0.63647705",
"0.6334757",
"0.6324832",
"0.6294138",
"0.6225194",
"0.62095654",
"0.6186663",
"0.6185772",
"0.61837184",
"0.6160519",
"0.61... | 0.6550141 | 8 |
if somehow the user inputted word is in the dictionary then exclude it from the dictionary | def removeWordFromDict(self, word):
if word in self.dictionary:
self.setDict(self.dictionary.remove(word)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filterDict(self, char):\n newDict = [word for word in self.dictionary if char not in word.lower()]\n if len(newDict) < 5:\n dictlen = len(self.dictionary)\n word = self.dictionary[randint(0, dictlen - 1)]\n self.setWord(word)\n else:\n self.setDi... | [
"0.68887514",
"0.6327034",
"0.612838",
"0.61101866",
"0.6094598",
"0.6094588",
"0.604624",
"0.60273707",
"0.599985",
"0.597724",
"0.59758425",
"0.5972747",
"0.5967966",
"0.5943246",
"0.5903427",
"0.58125865",
"0.5807034",
"0.57958305",
"0.57521117",
"0.574984",
"0.57195044",
... | 0.6814912 | 1 |
filters the dictionary, takes out all the words that do not contain the inputted char from user | def filterDict(self, char):
newDict = [word for word in self.dictionary if char not in word.lower()]
if len(newDict) < 5:
dictlen = len(self.dictionary)
word = self.dictionary[randint(0, dictlen - 1)]
self.setWord(word)
else:
self.setDict(newDict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allPossibleWords(Rack):\n def checkWord(word):\n return stringInRack(word,Rack)\n return filter(checkWord, Dictionary)",
"def _filter_typos(typos, char_vocab): \n\n new_typos = dict()\n\n for key,values in typos.items():\n new_values = list()\n for v in values: \... | [
"0.7008636",
"0.675887",
"0.6682296",
"0.65300703",
"0.64833623",
"0.6483",
"0.64756745",
"0.64511883",
"0.6259788",
"0.62390786",
"0.6178667",
"0.61751574",
"0.6122911",
"0.61099094",
"0.60813874",
"0.6038597",
"0.60373604",
"0.602203",
"0.6012134",
"0.5995703",
"0.5983771",... | 0.77047414 | 0 |
creates the inital string that only contains '_' | def createWordKnown(self):
return ''.join(['_ ' for m in range(self.wordLen)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def underscore(text):\n # return '__'+text.replace(' ','__') + '__'\n return text.replace(' ', '__')",
"def pre_underscore(text):\n return f\"__{text}__\"",
"def gen_build_str_def():\n\treturn \"\"",
"def _with_underscore(cls, key):\n try:\n return key.replace(\"-\", \"_\")\n ... | [
"0.721435",
"0.70548093",
"0.65881675",
"0.655576",
"0.6555178",
"0.6505256",
"0.6485826",
"0.646432",
"0.6452991",
"0.64157265",
"0.64133215",
"0.6362011",
"0.6276848",
"0.62648255",
"0.6220121",
"0.6202735",
"0.6173401",
"0.61682427",
"0.6149937",
"0.6139517",
"0.6103996",
... | 0.5962828 | 32 |
Send message to the articles with notFound 404 status. | def page_not_found(e):
# Message to the articles
message = {
"err":
{
"msg": "This route is currently not supported. Please refer API documentation (on Github https://github.com/wdelenclos/messier-registry.)"
}
}
# Making the message looks good
resp = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send404(self):\n\t\tself.send_error(404, \"File not found\")",
"def _send_404(self):\n template_filename = self._get_config_template('404')\n text = read_template(\n template_filename,\n title='%s - 404' % SERVER_NAME,\n header='404 — Page not ... | [
"0.7638985",
"0.7525144",
"0.72701716",
"0.7213369",
"0.7013067",
"0.6980928",
"0.6973982",
"0.6962501",
"0.6958567",
"0.6958567",
"0.6949911",
"0.6948801",
"0.6920872",
"0.69150364",
"0.6902169",
"0.6902169",
"0.6902169",
"0.6902169",
"0.6902169",
"0.6902169",
"0.6902169",
... | 0.7519205 | 2 |
Get the normalized form of the vector. | def get_normalized_vector(vector):
# WARN: Zero length may cause problems!
vector_lenght = get_vector_length(vector)
if vector_lenght != 0:
return np.divide(vector, get_vector_length(vector))
else:
return [0, 0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized(self):\n len = self.length\n return Vector(self.x / len, self.y / len)",
"def normalize(vector):\n return vector / np.linalg.norm(vector)",
"def getNormalizedVector(self):\n return self.scalarMultiplication(self.norm() ** -1.0)",
"def normalized(v):\n norm = np.l... | [
"0.836751",
"0.83353364",
"0.83043295",
"0.8294043",
"0.8194295",
"0.81843823",
"0.817011",
"0.8157136",
"0.81325483",
"0.81012905",
"0.8092552",
"0.80362314",
"0.8029327",
"0.79849833",
"0.79632694",
"0.79615265",
"0.7955596",
"0.79343927",
"0.77548116",
"0.7735425",
"0.7733... | 0.847537 | 0 |
Set up a test directory and certificates. | def setUp(self):
self._tmp_dir = tempfile.mkdtemp(prefix='ssm')
# Some functions require the hardcoded expired certificate and
# key to be files.
key_fd, self._key_path = tempfile.mkstemp(prefix='key',
dir=self._tmp_dir)
os.close... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial_setup():\n\n if os.path.exists(cfg.ca_private_key_path()):\n pkey = _try_load_ca_private_key(cfg.ca_private_key_path())\n else:\n pkey = _generate_ca_private_key(cfg.ca_private_key_path())\n\n if os.path.exists(cfg.ca_cert_path()):\n _try_load_ca_cert(cfg.ca_cert_path())\n... | [
"0.6333526",
"0.6199618",
"0.61593074",
"0.6134559",
"0.61031705",
"0.59510183",
"0.5906789",
"0.58629507",
"0.5861542",
"0.5850422",
"0.58380795",
"0.5824561",
"0.5772405",
"0.5761869",
"0.5738897",
"0.5724962",
"0.5717445",
"0.5716755",
"0.5716755",
"0.571423",
"0.56986934"... | 0.65360105 | 0 |
Remove test directory and all contents. | def tearDown(self):
try:
shutil.rmtree(self._msgdir)
shutil.rmtree(self._tmp_dir)
except OSError as e:
print('Error removing temporary directory %s' % self._tmp_dir)
print(e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vtest_ut_cleanup(self):\n shutil.rmtree(self.get_test_file_path(), ignore_errors=True)",
"def tearDown(self):\n for root, dirs, files in os.walk(TEMPDIR, topdown=False):\n for name in files:\n os.remove(os.path.join(root, name))\n for name in dirs:\n ... | [
"0.797974",
"0.79471564",
"0.78174627",
"0.7802646",
"0.7796483",
"0.77740633",
"0.7773133",
"0.7773133",
"0.7759895",
"0.7681515",
"0.7642195",
"0.76201904",
"0.7595368",
"0.7568953",
"0.7535265",
"0.7494912",
"0.74640816",
"0.7455091",
"0.7434781",
"0.73948133",
"0.73912483... | 0.6791579 | 90 |
Test right exception is thrown creating an SSM with expired cert. | def test_init_expired_cert(self):
expected_error = ('Certificate %s has expired or will expire '
'within a day.' % self._expired_cert_path)
try:
# Indirectly test crypto.verify_cert_date
Ssm2(self._brokers, self._msgdir, self._expired_cert_path,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_init_expired_server_cert(self):\n self.assertRaises(\n Ssm2Exception, Ssm2, self._brokers, self._msgdir, TEST_CERT_FILE,\n self._key_path, dest=self._dest, enc_cert=self._expired_cert_path,\n verify_enc_cert=False\n )\n # verify_enc_cert is set to Fals... | [
"0.738411",
"0.6624867",
"0.65002376",
"0.63056135",
"0.61994475",
"0.6158625",
"0.61400414",
"0.6118681",
"0.60490763",
"0.6041454",
"0.6007164",
"0.5970719",
"0.59633946",
"0.5940831",
"0.5932326",
"0.5853149",
"0.5830252",
"0.5821888",
"0.5795149",
"0.57866246",
"0.5783629... | 0.80587095 | 0 |
Check that exception is raised if server cert has expired. | def test_init_expired_server_cert(self):
self.assertRaises(
Ssm2Exception, Ssm2, self._brokers, self._msgdir, TEST_CERT_FILE,
self._key_path, dest=self._dest, enc_cert=self._expired_cert_path,
verify_enc_cert=False
)
# verify_enc_cert is set to False as we don... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_init_expired_cert(self):\n expected_error = ('Certificate %s has expired or will expire '\n 'within a day.' % self._expired_cert_path)\n try:\n # Indirectly test crypto.verify_cert_date\n Ssm2(self._brokers, self._msgdir, self._expired_cert_path... | [
"0.7249058",
"0.653092",
"0.63788354",
"0.6312557",
"0.61574906",
"0.6104876",
"0.60061705",
"0.5995503",
"0.5981729",
"0.5949824",
"0.5933108",
"0.5912041",
"0.5909809",
"0.59097075",
"0.5894113",
"0.5882813",
"0.58597815",
"0.5857916",
"0.5855695",
"0.5839516",
"0.5823081",... | 0.7183783 | 1 |
Remove words from Top 5 words Frame. | def clean_5_words(self):
self.first_word.configure(text="")
self.second_word.configure(text="")
self.third_word.configure(text="")
self.fourth_word.configure(text="")
self.fifth_word.configure(text="") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_5_words(self):\n del self.words[:]\n text = self.textbox.get(\"1.0\", tk.END)\n self.file.text = text\n self.words = self.file.find_top_5_words(self.language.get())\n words_count = len(self.words)\n if words_count == 0:\n self.first_word.configure(\"All... | [
"0.6894695",
"0.62445885",
"0.61320674",
"0.6104778",
"0.6065875",
"0.60495543",
"0.59997916",
"0.599091",
"0.589135",
"0.586399",
"0.58593005",
"0.58227736",
"0.5763823",
"0.57336956",
"0.5691351",
"0.56889063",
"0.568863",
"0.56753874",
"0.56678116",
"0.5661778",
"0.5651341... | 0.6616723 | 1 |
A method to test that the API creates a bucket | def test_bucketlist_creation(self):
post_data = self.post_a_bucket()
self.assertEqual(post_data.status_code, 201)
self.assertIn('Climb the Himalayas', str(post_data.data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_bucket(self):\n pass",
"def test_creating_a_bucket(self):\n with self.client:\n self.create_bucket(self.get_user_token())",
"def test_create(self):\n responses.add(\n responses.Response(\n method='POST',\n url='https://con... | [
"0.90092",
"0.8905458",
"0.8558081",
"0.8016729",
"0.79140574",
"0.77704597",
"0.7754582",
"0.76972276",
"0.76946753",
"0.75765675",
"0.7565823",
"0.7500666",
"0.7492139",
"0.7409128",
"0.74070597",
"0.74050313",
"0.73874277",
"0.73850155",
"0.7352152",
"0.73487127",
"0.73190... | 0.78092855 | 5 |
Display an image, save it, then DESTROY ALL WINDOWS to prevent hanging. | def display(image, name="Image"):
cv2.imshow(name, image)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imwrite("{}.png".format(name), image) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self.image.close()",
"def image_window_destroy(self, widget, data=None):\n self._quit()",
"def close(self):\n if self.proc:\n self.proc.terminate()\n self.proc.wait()\n self.proc = None\n del os.environ['DISPLAY']\n if s... | [
"0.6786114",
"0.64944184",
"0.6389404",
"0.6317692",
"0.62998563",
"0.62313765",
"0.6224885",
"0.6211465",
"0.62071484",
"0.61761653",
"0.60784364",
"0.60462075",
"0.59495974",
"0.59281445",
"0.58881235",
"0.5875685",
"0.5869154",
"0.5860808",
"0.5828903",
"0.5816108",
"0.576... | 0.56537265 | 28 |
Check if the given collation is the first collation of this shard | def is_first_collation(self, collation):
return collation.header.parent_collation_hash == self.env.config['GENESIS_PREVHASH'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collation(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> Optional[str]:\n return pulumi.get(self, \"collation\")",
"def add_collat... | [
"0.58747655",
"0.58747655",
"0.5844685",
"0.5517331",
"0.54947346",
"0.5469385",
"0.5425195",
"0.52509284",
"0.52193666",
"0.52070606",
"0.50391644",
"0.50186807",
"0.50186807",
"0.50009316",
"0.49220517",
"0.48799407",
"0.47282365",
"0.47112072",
"0.47074565",
"0.4700864",
"... | 0.82540464 | 0 |
Compute the forward prop in the tthlayer xt1 = D.T ( rho ( D ( xt (learning_rate)h_flip( hxt y ) ) D.T ) ) D here '' denotes linear convolution | def forward(self,y,xt,D,h,param):
h_flip=h.flip(2,3)
a=conv(h,xt)-y
b=xt-self.learning_rate*conv(h_flip,a)
u=tor.matmul(D,tor.matmul(b,D.transpose(2,3)))
u_=rho(u,param)
xt1=tor.matmul(D.transpose(2,3),tor.matmul(u_,D))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, h_prev, x_t):\n hidden_con = np.concatenate((h_prev.T, x_t.T), axis=0)\n h_next = np.tanh((np.matmul(hidden_con.T, self.Wh)) + self.bh)\n y = self.softmax((np.matmul(h_next, self.Wy)) + self.by)\n return h_next, y",
"def forward(self, z_t_1, h_x):\n h_combined... | [
"0.68204814",
"0.6706295",
"0.6648027",
"0.66293174",
"0.6627553",
"0.65813905",
"0.65761364",
"0.65698963",
"0.6487676",
"0.64830995",
"0.64679873",
"0.64200664",
"0.6395235",
"0.63620454",
"0.6326722",
"0.63256425",
"0.6295131",
"0.628253",
"0.6245956",
"0.6244323",
"0.6228... | 0.7932475 | 0 |
Tokenize, padding and truncate several texts. And convert it to several lists of id. | def texts2ids(self, texts: list, length: int):
return [self.text2ids(text, length) for text in texts] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text2ids(self, text: str, length: int):\n # Tokenize\n tokens = self.tokenizer.tokenize(text)\n token_ids = self.tokenizer.tokens2ids(tokens)\n # Padding\n while len(token_ids) < length:\n token_ids.append(0)\n # Truncate\n if len(token_ids) > length:... | [
"0.70445424",
"0.6839107",
"0.65420055",
"0.65291977",
"0.63794094",
"0.6368797",
"0.62720805",
"0.62672365",
"0.6261614",
"0.618808",
"0.6150797",
"0.61503077",
"0.6118935",
"0.60622245",
"0.60378397",
"0.602653",
"0.60225195",
"0.6021455",
"0.60097915",
"0.59215",
"0.591884... | 0.66200083 | 2 |
Return length of the dataset. | def __len__(self):
raise NotImplementedError("Not implmented!") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __len__(self):\n return self._dataset.size(dirs=self._dirs)",
"def length(self) -> int:\n return len(self.data)",
"def __len__(self):\n return len(self.dataset)",
"def length(self):\n return len(self.data)",
"def length(self):\n return len(self.data)",
"def length(s... | [
"0.84091496",
"0.83170474",
"0.8265268",
"0.8248992",
"0.8248992",
"0.8248992",
"0.82161266",
"0.8199378",
"0.81841874",
"0.81841874",
"0.81841874",
"0.81841874",
"0.8171502",
"0.81609553",
"0.8118806",
"0.80845845",
"0.80825365",
"0.8074313",
"0.8069076",
"0.80667603",
"0.80... | 0.0 | -1 |
Return string of founded subtree. | def extract_words(tree: Tree, template: Tree) -> str:
list_words = find_step(tree, template)
return " ".join(list_words) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree_string(self, indent=0): # pragma: no cover\r\n return \"\"",
"def get_tree_str(self, depth: int = 0) -> str:\n temp = \" \" * depth + str(self.head) + \"\\n\"\n for son in self.sons:\n temp += son.get_tree_str(depth + 1)\n return temp",
"def get_string(tree): ... | [
"0.7352494",
"0.71847874",
"0.7159799",
"0.713061",
"0.69730467",
"0.6971386",
"0.68619806",
"0.6836799",
"0.6832373",
"0.6762572",
"0.6743713",
"0.6735705",
"0.66620106",
"0.6653678",
"0.6607493",
"0.6571597",
"0.6567003",
"0.6517397",
"0.6506341",
"0.6506341",
"0.6480494",
... | 0.0 | -1 |
Create a regular grid. The x directions is NorthSouth and y EastWest. Imagine the grid as a matrix with x varying in the lines and y in columns. Returned arrays will be flattened to 1D with ``numpy.ravel``. | def regular(area, shape, z=None):
nx, ny = shape
x1, x2, y1, y2 = area
assert x1 <= x2, \
"Invalid area dimensions {}, {}. x1 must be < x2.".format(x1, x2)
assert y1 <= y2, \
"Invalid area dimensions {}, {}. y1 must be < y2.".format(y1, y2)
xs = numpy.linspace(x1, x2, nx)
ys = nu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_grid(self, nx, ny):\n nx_vec = np.arange(nx)\n ny_vec = np.arange(ny)\n yv, xv = np.meshgrid(ny_vec, nx_vec)\n grid = np.stack((yv, xv), axis=2)\n grid = grid.reshape(1, 1, ny, nx, 2)\n return grid",
"def makeStartingGrid(self):\n return util.make2DArray(... | [
"0.7346607",
"0.6862837",
"0.66530985",
"0.6602682",
"0.6513759",
"0.6486887",
"0.64634854",
"0.63892967",
"0.6389119",
"0.638553",
"0.63355213",
"0.63057065",
"0.62836707",
"0.6270582",
"0.624208",
"0.62172365",
"0.6159004",
"0.615494",
"0.6152466",
"0.6149082",
"0.61463696"... | 0.0 | -1 |
Create a grid with empty cells on odd row/column combinations. | def _create_grid_with_cells(self, width, height):
grid = []
for row in range(height):
grid.append([])
for column in range(width):
if column % 2 == 1 and row % 2 == 1:
grid[row].append(TILE_EMPTY)
elif (
colum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_empty_grid(width, height):\n return [[None] * width for _ in range(height)]",
"def create_grid(grid):\r\n inner = [0]*4\r\n for i in range(4):\r\n grid.append(inner[:])",
"def create_grid(grid):\r\n for i in range(4):\r\n grid.append([0]*4)\r\n return grid",
"def creat... | [
"0.7380209",
"0.7032278",
"0.70264184",
"0.696529",
"0.6863394",
"0.6852068",
"0.67608",
"0.674068",
"0.6676773",
"0.6668073",
"0.6640447",
"0.66098666",
"0.6596621",
"0.65722555",
"0.6557412",
"0.6553812",
"0.6536684",
"0.6478831",
"0.6477884",
"0.64581335",
"0.63752574",
... | 0.7013357 | 3 |
Provides a molecule from the data set. | def __getitem__(self, idx):
sample = {'num_atoms': self.num_atoms[idx],\
'symbols': self.symbols[idx],\
'charges': self.charges[idx],\
'positions': self.positions[idx],\
'data': self.data[int(np.floor(idx/2))]}
return samp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def molecule(self):\n return self._molecule",
"def make_molecule(self):\n\n self.data.molecules = self.data.Smiles.apply(Chem.MolFromSmiles)\n\n return self.data.molecules",
"def molecule_data(self) -> Union[QMolecule, WatsonHamiltonian]:\n return self._molecule_data",
"def featuri... | [
"0.6786925",
"0.664774",
"0.6177603",
"0.61288464",
"0.5838296",
"0.57789975",
"0.57203794",
"0.569179",
"0.5683834",
"0.56208366",
"0.5615823",
"0.55792415",
"0.55471957",
"0.5535577",
"0.5534828",
"0.5529618",
"0.5504393",
"0.5475967",
"0.5471528",
"0.54606044",
"0.545294",... | 0.0 | -1 |
Given a name get the flavor. | def get_flavor(name):
return nova.flavors.find(name=name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flavor(self, name=None):\n return self.find(self.flavors(), name=name)",
"def flavor(self, name=None):\n raise NotImplementedError",
"def get_flavor(self, flavor):\n return self._get(_flavor.Flavor, flavor)",
"def get_flavor(self, flavor):\n return self._get(_flavor.Flavor, fl... | [
"0.88826114",
"0.7698141",
"0.76182497",
"0.76182497",
"0.72676706",
"0.72570574",
"0.7091499",
"0.7032659",
"0.70184267",
"0.6866913",
"0.6851472",
"0.68340856",
"0.6725708",
"0.6646898",
"0.6633248",
"0.6480577",
"0.64312696",
"0.6182553",
"0.6155328",
"0.61530703",
"0.6037... | 0.87129796 | 1 |
Helper function to check if an string is number. | def is_number(s):
try:
int(s)
return True
except ValueError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_number(s):\n try:\n int(s)\n return True\n except ValueError:\n return False",
"def is_number(string):\r\n try:\r\n float(string)\r\n return True\r\n except ValueError: return False",
"def is_number(string):\n try:\n float(string)\n return ... | [
"0.86285704",
"0.8473477",
"0.8452078",
"0.83891255",
"0.82578814",
"0.8245179",
"0.8235957",
"0.8231262",
"0.82229507",
"0.82229507",
"0.82229507",
"0.81218696",
"0.8107412",
"0.8073369",
"0.8028884",
"0.79911476",
"0.7953287",
"0.78288436",
"0.7815099",
"0.7752293",
"0.7751... | 0.86483467 | 0 |
Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
hass.data[DOMAIN].pop(entry.entry_id)
return unload_ok | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok",
"async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True",
... | [
"0.697284",
"0.6888074",
"0.6779855",
"0.6747459",
"0.6689002",
"0.6657831",
"0.66162205",
"0.6603433",
"0.65925974",
"0.65595686",
"0.65411645",
"0.6507643",
"0.6507643",
"0.6507643",
"0.6507643",
"0.64977276",
"0.64931643",
"0.6486601",
"0.6486601",
"0.6486601",
"0.6486601"... | 0.64530563 | 33 |
Get new update interval. | def _get_update_interval(self, data: T) -> timedelta:
if self.expect_change_until > monotonic():
return timedelta(seconds=5)
return timedelta(seconds=30) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_interval(self):\n return self._refresh_interval",
"def _update_interval(self):\n current_value = self._interval\n next_interval = self._next_interval()\n self._assign_interval(next_interval)\n return current_value",
"def interval(self):\n if self.keep_inter... | [
"0.7572569",
"0.7514748",
"0.73994493",
"0.72694916",
"0.72012436",
"0.7100087",
"0.70839584",
"0.70839584",
"0.70041406",
"0.6987486",
"0.6954472",
"0.6576914",
"0.6568273",
"0.65341085",
"0.6436011",
"0.6416675",
"0.64039457",
"0.6385871",
"0.6340458",
"0.63182074",
"0.6304... | 0.71402967 | 5 |
Get new update interval. | def _get_update_interval(self, data: T) -> timedelta:
if data and any(
data["state"]["flags"][key] for key in ("pausing", "cancelling")
):
return timedelta(seconds=5)
return super()._get_update_interval(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_interval(self):\n return self._refresh_interval",
"def _update_interval(self):\n current_value = self._interval\n next_interval = self._next_interval()\n self._assign_interval(next_interval)\n return current_value",
"def interval(self):\n if self.keep_inter... | [
"0.7573973",
"0.7514375",
"0.7401374",
"0.7271406",
"0.7203208",
"0.71405566",
"0.71013695",
"0.70854014",
"0.70854014",
"0.7005402",
"0.69866574",
"0.6956308",
"0.6578258",
"0.65693635",
"0.6536012",
"0.64380735",
"0.64153636",
"0.6405892",
"0.6388819",
"0.6339117",
"0.63202... | 0.6081161 | 35 |
Sets the view_form_data of this UserPermissions. | def view_form_data(self, view_form_data):
if view_form_data is None:
raise ValueError("Invalid value for `view_form_data`, must not be `None`") # noqa: E501
self._view_form_data = view_form_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_form(self, form):\n self.parameters = form",
"def form_valid(self, form):\n form.instance.user = self.request.user\n return super().form_valid(form)",
"def form_valid(self, form):\n form.instance.member = self.request.user\n return super(UploadMealView, self).form_val... | [
"0.5344736",
"0.5213755",
"0.5199485",
"0.518855",
"0.51547873",
"0.5152879",
"0.51491547",
"0.5119594",
"0.5119594",
"0.5109532",
"0.5107363",
"0.5103568",
"0.50986934",
"0.5060119",
"0.5056123",
"0.5056123",
"0.5030066",
"0.49590677",
"0.4929919",
"0.4874672",
"0.48483694",... | 0.7347223 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, UserPermissions):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Returns the set of tags. | def tagset(self):
return self._tagset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tags(self) -> Set[Text]:\r\n return {tag for tag in self.tags}",
"def tag_set(self):\n tag_set = set()\n for tag_token in self.tags:\n tag_set.add(tag_token['tag'])\n return tag_set",
"def getTags(self,):\n\t\treturn self.tags;",
"def get_tags(self):\n re... | [
"0.85659504",
"0.853088",
"0.8271827",
"0.8260412",
"0.82325554",
"0.80552864",
"0.80552864",
"0.80552864",
"0.80552864",
"0.80552864",
"0.80552864",
"0.80552864",
"0.80552864",
"0.8000866",
"0.7901809",
"0.78851986",
"0.78701633",
"0.7798919",
"0.7787463",
"0.77562624",
"0.7... | 0.8039666 | 13 |
Test subtract function if at least one argument is zero. | def test_subtract_zero_arg(self):
try:
self.assertEqual(subtract(0, -6), 7)
except Exception as error:
print(f'Got error in {inspect.stack()[0][3]}, {error}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_subtract_all_args_less_zero(self):\n try:\n self.assertEqual(subtract(-18, -5), -13)\n except Exception as error:\n print(error)",
"def test_subtract_all_args_greater_zero(self):\n try:\n self.assertEqual(subtract(30, 16), 15)\n except Excepti... | [
"0.7879061",
"0.75155544",
"0.6657913",
"0.6548686",
"0.65165603",
"0.6352206",
"0.6315036",
"0.6315036",
"0.629578",
"0.6290599",
"0.6287071",
"0.6249441",
"0.62401634",
"0.62373185",
"0.61812997",
"0.6176353",
"0.6155871",
"0.61218834",
"0.61122596",
"0.6110233",
"0.6070563... | 0.75145787 | 2 |
Returns the current date/time as a yymmdd_HHMM_S string, e.g. 091016_1916_21 for 16th Oct, 2009, at 7.16pm in the evening. By default, returns for NOW, unless you feed in DT. | def dt_str(dt=None, hoursmins=True, seconds=True):
if dt is None:
dt = datetime.utcnow()
fmt = '%y%m%d'
if hoursmins:
fmt += '_%H%M'
if seconds:
fmt += '_%S'
return dt.strftime(fmt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_time():\n\n\treturn datetime.now().strftime(\"%d%m%Y_%H%M%S\")",
"def now_datetime():\n now = datetime.datetime.now()\n return now.strftime('%Y%m%d%H%M%S')",
"def nowdt():\n from datetime import datetime\n\n now = datetime.now()\n return now.strftime(\"%d/%m/%Y %H:%M:%S\")",
"def get_... | [
"0.7801499",
"0.7791871",
"0.76779056",
"0.76540834",
"0.7534715",
"0.752291",
"0.750241",
"0.74421066",
"0.7420074",
"0.74123764",
"0.738029",
"0.732564",
"0.72892195",
"0.7281918",
"0.7266261",
"0.72600436",
"0.7242853",
"0.72177196",
"0.72134334",
"0.72101974",
"0.7198944"... | 0.0 | -1 |
Tests whether the command line argument of the image name is the right one. | def test_parsing_cmd_args(self):
self.__args = vars(self.parser.parse_args())
self.assertEqual(str(self.__args["image"]), "images/img_0004.png") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_check(kwargs) -> bool:\n\n # Kwarg argument check\n return kwarg_check(\n kwargs=kwargs,\n options=[\n \"min_captured_at\",\n \"max_captured_at\",\n \"radius\",\n \"image_type\",\n \"organization_id\",\n \"fields\",\n ... | [
"0.63589114",
"0.6314555",
"0.62667364",
"0.6227315",
"0.621942",
"0.6164501",
"0.61002696",
"0.60971624",
"0.6088537",
"0.60784745",
"0.6074089",
"0.6073642",
"0.6067847",
"0.6035141",
"0.6025781",
"0.60129935",
"0.5980264",
"0.5958352",
"0.59399575",
"0.5921569",
"0.5893264... | 0.67466074 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.