query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Returns list of qs | def ttlist(qa,a1a,a0a,ans1,ans0,sentences):
(questions,answers1,answers0)=sentences
li=[]
ones=0
zeros=0
for i in range(0,len(ans1)):
li.append(q(qa[i],a1a[ones:ones+ans1[i]],a0a[zeros:zeros+ans0[i]],questions[i],
answers1[ones:ones+ans1[i]],answers0[zeros:zeros+ans0[i]])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_qs(self):\n if self.qs == None:\n # Get the Lemma PKs\n qs = self.get_queryset()\n else:\n qs = self.qs\n return qs",
"def get_qs(self):\n if self.qs == None:\n # Get the Lemma PKs\n qs = self.get_queryset()\n else:... | [
"0.77139455",
"0.77139455",
"0.7624155",
"0.7504078",
"0.7456416",
"0.74161375",
"0.7331651",
"0.732145",
"0.72809654",
"0.7242367",
"0.7231469",
"0.7228179",
"0.72244585",
"0.7213833",
"0.7202845",
"0.7179051",
"0.71603197",
"0.7144912",
"0.71108544",
"0.71063864",
"0.710333... | 0.0 | -1 |
Loss crossentropy function with regularization | def loss(labels,q,M,a,b):
x=-(labels*np.log(s.expit(z(q,M,a,b)))+(1-labels)*np.log(1-s.expit(z(q,M,a,b))))
return np.sum(x)+l/2*(np.sum(M**2)+b**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_entropy(y_observed, p):\n\n pass",
"def loss_fn(y_true,y_pred): \n loss = tf.nn.softmax_cross_entropy_with_logits_v2(y_true,\n y_pred,\n axis=-1,\n ... | [
"0.71149576",
"0.70147693",
"0.69773054",
"0.68859464",
"0.68451744",
"0.6839661",
"0.67333716",
"0.6693851",
"0.66667134",
"0.6659269",
"0.66420597",
"0.6639521",
"0.66324157",
"0.6616482",
"0.66118217",
"0.6601127",
"0.6586363",
"0.65777",
"0.6566795",
"0.65436304",
"0.6538... | 0.0 | -1 |
Conversation with only creator can be updated | def test_update_subject_on_conversation_with_only_creator(self):
conv = G(Conversation, type=CONVERSATION_TYPE_CHAT, creator=self.user1)
self.login(self.user1)
resp = self.client.patch(self.get_url(conv.pk), {'subject': '-'})
self.assert200(resp)
self.assertEqual(Conversation.obj... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_conversation_for_non_admin_is_allowed(self):\n conv = G(Conversation, type=CONVERSATION_TYPE_CHAT, creator=self.user1,\n users=[self.user1, self.user2])\n self.login(self.user2)\n resp = self.client.delete(self.get_url(conv.pk))\n self.assert204(resp)",
... | [
"0.6058879",
"0.58981216",
"0.5815126",
"0.5808535",
"0.57956684",
"0.5775062",
"0.5654341",
"0.5650557",
"0.5647851",
"0.56042695",
"0.5590857",
"0.5488573",
"0.5450811",
"0.543864",
"0.54332995",
"0.54319257",
"0.54193354",
"0.54064447",
"0.53974366",
"0.5390531",
"0.538842... | 0.71728563 | 0 |
Messages from other conversation is ignored for marking as deleted. | def test_delete_messages_other_conversation_excluded(self):
m1 = G(Message, user=self.user1, conversation=self.c1)
m2 = G(Message, user=self.user1, conversation=self.c2)
self.login(self.user1)
resp = self.client.post(self.get_url(self.c1.pk), {'messages': [
{'id': m1.id}, {'i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n for i, message in enumerate(self.owner.messages):\n if message == self.body:\n del self.owner.messages[i]\n break",
"def test_user_is_excluded_from_deleted_conversation(self):\n conv = G(Conversation, type=CONVERSATION_TYPE_CHAT, creator=... | [
"0.7328957",
"0.71066356",
"0.69904727",
"0.68844175",
"0.67487717",
"0.67139363",
"0.67139363",
"0.6709747",
"0.66483414",
"0.66097814",
"0.655986",
"0.64377016",
"0.64088583",
"0.6377931",
"0.6339672",
"0.6336671",
"0.6196926",
"0.6196528",
"0.6190449",
"0.6175412",
"0.6155... | 0.7743817 | 0 |
Recursive product with an iterable >>> prodri( iter([1,2,3,4,5,6,7]) ) 5040 | def prodri(items: Iterator[float]) -> float:
try:
head = next(items)
except StopIteration:
return 1
return head*prodri(items) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prodri( iterable ):\n try:\n head= next(iterable)\n except StopIteration:\n return 1\n return head*prodri(iterable)",
"def product(it):\n prod = 1\n for x in it:\n prod *= x\n return prod",
"def product(iterable):\n prod = 1\n for i in iterable:\n prod *=... | [
"0.7750113",
"0.76053524",
"0.7598357",
"0.75586593",
"0.75586593",
"0.75586593",
"0.7551345",
"0.74880195",
"0.6990527",
"0.68996537",
"0.685651",
"0.68562317",
"0.68520665",
"0.68135375",
"0.66980773",
"0.65759736",
"0.65731007",
"0.6569109",
"0.6529085",
"0.65238684",
"0.6... | 0.6971154 | 9 |
Return nodes in strongly connected components of graph. | def strongly_connected_components(G):
preorder={}
lowlink={}
scc_found={}
scc_queue = []
scc_list=[]
i=0 # Preorder counter
for source in G:
if source not in scc_found:
queue=[source]
while queue:
v=queue[-1]
if v not in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strongly_connected_components(graph):\n \n result = [ ]\n stack = [ ]\n low = { }\n \n def visit(node):\n if node in low: return\n\t\n num = len(low)\n low[node] = num\n stack_pos = len(stack)\n stack.append(node)\n\t\n for successor in graph[node... | [
"0.7772357",
"0.7733586",
"0.7666015",
"0.75262237",
"0.74718577",
"0.7256987",
"0.7200829",
"0.7139926",
"0.708048",
"0.70213926",
"0.69359195",
"0.69199467",
"0.6848723",
"0.6793009",
"0.6781925",
"0.67730206",
"0.6772925",
"0.6749829",
"0.6743078",
"0.6717615",
"0.66924965... | 0.6763987 | 17 |
Return nodes in strongly connected components of graph. | def kosaraju_strongly_connected_components(G,source=None):
components=[]
G=G.reverse(copy=False)
post=list(nx.dfs_postorder_nodes(G,source=source))
G=G.reverse(copy=False)
seen={}
while post:
r=post.pop()
if r in seen:
continue
c=nx.dfs_preorder_nodes(G,r)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strongly_connected_components(graph):\n \n result = [ ]\n stack = [ ]\n low = { }\n \n def visit(node):\n if node in low: return\n\t\n num = len(low)\n low[node] = num\n stack_pos = len(stack)\n stack.append(node)\n\t\n for successor in graph[node... | [
"0.7772357",
"0.7733586",
"0.7666015",
"0.75262237",
"0.74718577",
"0.7256987",
"0.7200829",
"0.7139926",
"0.70213926",
"0.69359195",
"0.69199467",
"0.6848723",
"0.6793009",
"0.6781925",
"0.67730206",
"0.6772925",
"0.6763987",
"0.6749829",
"0.6743078",
"0.6717615",
"0.6692496... | 0.708048 | 8 |
Return number of strongly connected components in graph. | def number_strongly_connected_components(G):
return len(strongly_connected_components(G)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_weakly_connected_components(G):\n return sum(1 for wcc in weakly_connected_components(G))",
"def _num_conn_comp(graph):\n\n return nx.number_connected_components(graph)",
"def number_of_strongly_connected_components(adj):\n result = 0\n # write your code here\n # Find the reverse ... | [
"0.81728214",
"0.8138118",
"0.80878407",
"0.7702412",
"0.77013683",
"0.7527082",
"0.7426144",
"0.7395024",
"0.736397",
"0.7229636",
"0.72164387",
"0.7146689",
"0.70309204",
"0.7029668",
"0.7028299",
"0.6982331",
"0.6954115",
"0.69013005",
"0.68400705",
"0.6789786",
"0.6753923... | 0.8533571 | 0 |
This is the only nonancient function in this module. Return a sequence of states. The returned sequence starts at the initial state and ends at the final state. Consecutive states may be the same if the transition matrix has positive diagonal elements. This function is derived from an earlier function in an old SampleP... | def sample_endpoint_conditioned_path(
initial_state, final_state, path_length, P):
# get the size of the state space and do some input validation
MatrixUtil.assert_transition_matrix(P)
nstates = len(P)
if not (0 <= initial_state < nstates):
raise ValueError('invalid initial state')
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_sequence(node):\n states = [node.state]\n while node.previous:\n node = node.previous\n states.append(node.state)\n return states[::-1]",
"def transitions(self, state):\n if len(set(state)) < len(state):\n yield self.STOP_STATE\n return\n for h... | [
"0.70933115",
"0.67044973",
"0.66848516",
"0.66744626",
"0.6617866",
"0.6615779",
"0.6603761",
"0.65104795",
"0.6470638",
"0.6339325",
"0.63255316",
"0.63019663",
"0.6251503",
"0.6202013",
"0.61452645",
"0.61289746",
"0.6077721",
"0.6050644",
"0.6048283",
"0.6010946",
"0.6007... | 0.0 | -1 |
Give uniformization a chance to fail. It should give the same results as modified rejection sampling. | def test_hky_uniformization(self):
distribution = {'A':.2,'C':.3,'G':.3,'T':.2}
kappa = 2
rate_matrix_object = RateMatrix.get_unscaled_hky85_rate_matrix(distribution, kappa)
rate_matrix_object.normalize()
rate_matrix = rate_matrix_object.get_dictionary_rate_matrix()
path_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_to_failure():\r\n return random.expovariate(BREAK_MEAN)",
"def rejection_sample(self, trial_count):\n count = 0\n valid_trial_count = 1\n\n for i in xrange(trial_count):\n values = {}\n\n valid_sample = True\n\n for letter in self.letters:\n ... | [
"0.65241975",
"0.62637645",
"0.62204564",
"0.6190218",
"0.60301286",
"0.60052574",
"0.5970992",
"0.5909808",
"0.5907843",
"0.58581835",
"0.58550996",
"0.5838175",
"0.5834997",
"0.57965374",
"0.57886165",
"0.5734465",
"0.5705115",
"0.5665028",
"0.56604254",
"0.5616774",
"0.561... | 0.5774219 | 15 |
Maximum input length supported by the encoder. | def max_positions(self):
if self.embed_positions is None:
return self.max_source_positions
return min(self.max_source_positions, self.embed_positions.max_positions()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_length(self) -> int | None:\n return self._underlying.max_length",
"def max_length(self):\n\t\treturn self._max_length",
"def _max_length(self):\n return self.__max_length",
"def max_size(self):\n raise NotImplementedError()",
"def len_max(self):\n return 16 + 16 + 8 + 8... | [
"0.79915965",
"0.7968504",
"0.7859362",
"0.7662151",
"0.7648042",
"0.7555859",
"0.74178326",
"0.74056953",
"0.73354554",
"0.7186268",
"0.71812737",
"0.7144131",
"0.7108449",
"0.7098418",
"0.70634687",
"0.7029977",
"0.7007656",
"0.69750416",
"0.69667345",
"0.69460034",
"0.6946... | 0.0 | -1 |
Maximum output length supported by the decoder. | def max_positions(self):
if self.embed_positions is None:
return self.max_target_positions
return min(self.max_target_positions, self.embed_positions.max_positions()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def len_max(self):\n return 16 + 16 + 8 + 8 + Tools.bin_to_dec(self.get_data_size()) + Tools.bin_to_dec(self.get_verification_size())",
"def setMaxOutputLength(self, value):\n return self._set(maxOutputLength=value)",
"def setMaxOutputLength(self, value):\n return self._set(maxOutputLength... | [
"0.7432989",
"0.73925817",
"0.73925817",
"0.73925817",
"0.7161096",
"0.71449983",
"0.70124006",
"0.69647205",
"0.69551724",
"0.69273204",
"0.68699276",
"0.68549514",
"0.684077",
"0.68397105",
"0.68026745",
"0.6781775",
"0.67704415",
"0.6759464",
"0.6752665",
"0.6748612",
"0.6... | 0.0 | -1 |
r"""Differential operator (for gradient and divergence). | def D(self):
if not hasattr(self, '_D'):
self.logger.warning('The differential operator G.D is not '
'available, we need to compute it. Explicitly '
'call G.compute_differential_operator() '
'once beforeh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative(func: Callable, x: float, delta: float) -> float:\n return (func(x + delta) - func(x - delta)) / (2.0 * delta)",
"def compute_differential_operator(self):\n\n v_in, v_out, weights = self.get_edge_list()\n\n n = len(v_in)\n Dr = np.concatenate((np.arange(n), np.arange(n)))\n... | [
"0.63359034",
"0.6326116",
"0.62590235",
"0.6250589",
"0.6192727",
"0.61656064",
"0.61545825",
"0.60752904",
"0.60627806",
"0.60592824",
"0.6022101",
"0.59842855",
"0.5977367",
"0.59573644",
"0.5953677",
"0.5921544",
"0.59088314",
"0.5901363",
"0.58832765",
"0.58678716",
"0.5... | 0.68235606 | 0 |
Fixes file.size sometimes being a floatingpoint rather than integer. | def upgrade_to_16():
acquisitions = config.db.acquisitions.find({'files.size': {'$type': 'double'}})
for x in acquisitions:
for y in x.get('files', []):
if y.get('size'):
y['size'] = int(y['size'])
config.db.acquisitions.update({"_id": x['_id']}, x)
sessions = c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __convert_file_size(self, file_size:float)->float:\n return file_size * 1000000",
"def fix_size(value):\n try:\n obj_size = int(float(value) * wx.GetApp().settings.size_coeff)\n except AttributeError:\n obj_size = int(value)\n return obj_size",
"def pretty_pr... | [
"0.8209852",
"0.67992485",
"0.6455337",
"0.6225333",
"0.6187625",
"0.61720407",
"0.6148377",
"0.61392516",
"0.6137717",
"0.61261123",
"0.60974586",
"0.6083997",
"0.60793495",
"0.60713756",
"0.59938735",
"0.59864074",
"0.5981325",
"0.5974343",
"0.5946332",
"0.5923672",
"0.5922... | 0.0 | -1 |
Add user passed stop list to default. | def _construct_stop_list(web_crawl):
# TODO: enable deselection of default and site dependent lists
stop_list = _get_default_stop_list()
if 'stopWords' in web_crawl:
new_list = [w.strip() for w in web_crawl['stopWords'].split(',')]
for word in new_list:
stop_list.append(word)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_default_stop_list():\n stop_list = []\n path = os.path.realpath(__file__).rpartition('/')[0] + '/misc/stoplists/'\n with open(path + 'default_stop_list.txt') as f:\n for line in f:\n stop_list.append(line.rstrip())\n return stop_list",
"def add_stopword(self, *args):\n ... | [
"0.68131363",
"0.6238606",
"0.6077842",
"0.5745611",
"0.56900907",
"0.56095725",
"0.5527527",
"0.5504724",
"0.5454464",
"0.53815323",
"0.5347543",
"0.5347543",
"0.5347543",
"0.5336415",
"0.5336415",
"0.53011626",
"0.5205147",
"0.5205147",
"0.5205147",
"0.5205147",
"0.5179131"... | 0.6376395 | 1 |
Get start time details and determine/set elapsed time. | def _mark_timer_complete(crawl_id, engine_redis):
config_file = engine_redis.get(crawl_id)
config = json.loads(config_file)
start_time = config['time']
stop_time = time.time()
config['time'] = stop_time - start_time
config_json = json.dumps(config)
engine_redis.set(crawl_id, config_json)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time(self) -> float:\r\n ...",
"def start_time(self):\n pass",
"def getStartTime(self):\n raise NotImplementedError",
"def start_time(self) -> float:\n return self._start_time",
"def start_time(self):\n return self.__start",
"def __get_starting_time(self):\n ... | [
"0.75939524",
"0.714147",
"0.7079385",
"0.70613337",
"0.7026619",
"0.7022909",
"0.69912815",
"0.69811106",
"0.6920934",
"0.6920934",
"0.6920934",
"0.6920934",
"0.6920934",
"0.6920934",
"0.6920934",
"0.6920934",
"0.69148046",
"0.68477774",
"0.6837122",
"0.68165135",
"0.6801280... | 0.0 | -1 |
Return location of SpiderEngine (current) file. | def _spdr_engine_location():
return os.path.realpath(__file__).rpartition('/')[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location(self):\n\n p = os.path.abspath(__file__)\n pathSP = os.path.split(p)\n return pathSP",
"def get_current_directory():\n\treturn os.path.dirname(os.path.abspath(__file__))",
"def get_location(self):\n return os.path.dirname(self.filename)",
"def _get_path(): # THIS IS JUST F... | [
"0.7663401",
"0.7137054",
"0.7113888",
"0.70296955",
"0.68987936",
"0.68007976",
"0.6772204",
"0.67515165",
"0.67515165",
"0.6739642",
"0.6734326",
"0.6702296",
"0.6625619",
"0.6620048",
"0.6620048",
"0.6620048",
"0.6613047",
"0.6594212",
"0.65861076",
"0.65785384",
"0.654201... | 0.794206 | 0 |
Return a custom 404 error. | def page_not_found(e):
return 'Sorry, Nothing at this URL.', 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def error_404(error):\n return '404 Error'",
"def error_404(error):\n return 'Bummer, there is nothing at this URL.'",
"def error_not_found(error):\n return 'No page here, dood. 404!', 404",
"def not_found(self, error):\n return jsonify({'error': 'NO... | [
"0.81159586",
"0.80410045",
"0.7738874",
"0.77369535",
"0.77182025",
"0.7689595",
"0.7670471",
"0.76112473",
"0.7602477",
"0.7570698",
"0.75528365",
"0.7545827",
"0.751882",
"0.74745256",
"0.7458403",
"0.7455682",
"0.74548143",
"0.74505144",
"0.7442062",
"0.7428278",
"0.74065... | 0.7254463 | 39 |
Get the current CONDA environment The environment name is gathered by first checking environment variable ``$CONDA_ENVNAME`` that is set by the hutchpython startup scripts. If for whatever reason that is not available we check ``$CONDA_DEFAULT_ENV`` which is set by Conda itself. The reason this is not relied on primari... | def get_current_environment():
# Search for the environment variable set by the hutch python setup
env = os.getenv('CONDA_ENVNAME')
# Otherwise look for built-in Conda environment variables
if not env:
env = os.getenv('CONDA_DEFAULT_ENV')
# Check the top level PYTHONPATH to see if we have pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_conda_env_name():\n env_name = os.popen('echo $CONDA_DEFAULT_ENV').read().strip()\n if env_name == '' or env_name == '$CONDA_DEFAULT_ENV':\n env_name = 'base'\n logging.info('Anaconda environment: ' + env_name)\n return env_name",
"def conda_list_environments():\n conda = '{0}/bin/c... | [
"0.6924124",
"0.6568505",
"0.64427227",
"0.6416775",
"0.63858175",
"0.6340028",
"0.6125788",
"0.6075254",
"0.60368603",
"0.5971495",
"0.5968194",
"0.59605145",
"0.59581",
"0.5951648",
"0.5949026",
"0.5928563",
"0.59193057",
"0.5912189",
"0.5903988",
"0.5897492",
"0.5894881",
... | 0.8518993 | 0 |
Reset the execution state of an entire workflow. Sets all task states to 'WAITING'. Changes the workflow ID of the Workflow and Task nodes with new_id. | def reset_workflow(self, new_id):
with self._driver.session() as session:
session.write_transaction(tx.reset_tasks_metadata)
session.write_transaction(tx.reset_workflow_id, new_id=new_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_workflow(self, workflow_id):\n self._workflow_id = workflow_id\n self._gdb_interface.reset_workflow(self._workflow_id)\n self._gdb_interface.set_workflow_state('SUBMITTED')",
"def reset_task_state(self) -> None:\n self.set_task_state(task_state=self.sample_task_state())",
... | [
"0.70638734",
"0.63346326",
"0.6267231",
"0.59290856",
"0.5885218",
"0.58003795",
"0.5788259",
"0.57470274",
"0.56310964",
"0.56100774",
"0.5567172",
"0.5551125",
"0.5536723",
"0.5516951",
"0.54497004",
"0.5397126",
"0.53860855",
"0.5384339",
"0.5376952",
"0.53628355",
"0.530... | 0.80682373 | 0 |
Return all workflow inputs and outputs from the Neo4j database. Returns a tuple of (inputs, outputs). | def get_workflow_inputs_and_outputs(self):
with self._driver.session() as session:
inputs = _reconstruct_workflow_inputs(session.read_transaction(tx.get_workflow_inputs))
outputs = _reconstruct_workflow_outputs(
session.read_transaction(tx.get_workflow_outputs))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_workflow_outputs(self):\n workflow = self._gdb_interface.get_workflow_description()\n return workflow.outputs",
"def get_inputs():\n inputs = tf.placeholder(tf.int32, [None,None], name='input')\n targets = tf.placeholder(tf.int32, [None, None], name='targets')\n lr = tf.placeholder... | [
"0.6527239",
"0.59051913",
"0.5754488",
"0.574317",
"0.5605768",
"0.5577789",
"0.5467822",
"0.54267794",
"0.5409322",
"0.5407638",
"0.5390912",
"0.53879267",
"0.53879267",
"0.53879267",
"0.53711426",
"0.53692204",
"0.52831316",
"0.52783585",
"0.52690136",
"0.5265815",
"0.5265... | 0.7471027 | 0 |
Get a task input object. | def get_task_input(self, task, input_id):
input_record = self._read_transaction(tx.get_task_input, task=task, input_id=input_id)
return _reconstruct_task_input(input_record["i"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_task_input(self, task, input_id):\n return self._gdb_interface.get_task_input(task, input_id)",
"def get_input(activity_task):\n try:\n input = json.loads(activity_task[\"input\"])\n except KeyError:\n input = None\n return input",
"def get_input_task(self, name='0'):\n ... | [
"0.7808478",
"0.7785932",
"0.728005",
"0.70826304",
"0.70027125",
"0.6958544",
"0.6958544",
"0.6958544",
"0.6958544",
"0.6958544",
"0.6958544",
"0.6958544",
"0.67204386",
"0.6641288",
"0.66134584",
"0.648235",
"0.6450063",
"0.6400933",
"0.63355494",
"0.63355494",
"0.633423",
... | 0.7996444 | 0 |
Set the type of a task input. | def set_task_input_type(self, task, input_id, type_):
self._write_transaction(tx.set_task_input_type, task=task, input_id=input_id, type_=type_) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_input_type(self, input_type):\n if input_type is not None: self._input_type.value = input_type\n return self",
"def task_type(self, task_type):\n\n self._task_type = task_type",
"def set_input_type_class(self, input_type_class):\n if input_type_class is not None:\n self._input_type... | [
"0.7627973",
"0.7611608",
"0.68472683",
"0.6822617",
"0.68052745",
"0.6766669",
"0.6756468",
"0.6654793",
"0.6646422",
"0.6646422",
"0.62510127",
"0.62510127",
"0.6218374",
"0.62135094",
"0.6089906",
"0.60563767",
"0.60448885",
"0.60448885",
"0.6034702",
"0.602389",
"0.599570... | 0.8633428 | 0 |
Determine if the Neo4j database is empty. | def empty(self):
return self._read_transaction(tx.is_empty) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_empty(self):\n return self.mdb.get().has_empty()",
"def _is_empty(conn):\n with Tx(conn) as c:\n c.execute('''\n SELECT COUNT(*) AS count FROM information_schema.tables\n WHERE table_catalog = %s AND table_schema = 'public'\n ''', [_db_name(conn)])\n i... | [
"0.7649909",
"0.7609945",
"0.7196108",
"0.71571267",
"0.71113515",
"0.6956356",
"0.6904931",
"0.6900277",
"0.6900277",
"0.6889135",
"0.68878514",
"0.6883935",
"0.6804964",
"0.68024623",
"0.6762402",
"0.6762402",
"0.6745683",
"0.67449385",
"0.67449385",
"0.6740307",
"0.6737153... | 0.0 | -1 |
Close the connection to the Neo4j database. | def close(self):
self._driver.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db_connection(cls):\n db.close()",
"def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None",
"def disconnect(self):\n self.db.close()",
"def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n ... | [
"0.7691422",
"0.731301",
"0.7291509",
"0.7210261",
"0.72070163",
"0.7193211",
"0.7173361",
"0.7163848",
"0.7096862",
"0.7084056",
"0.7063902",
"0.7055244",
"0.7017836",
"0.700673",
"0.7001163",
"0.69699883",
"0.6961719",
"0.69511735",
"0.6947686",
"0.69386667",
"0.69284564",
... | 0.0 | -1 |
Returns the number of items in the list. | def size(self):
"""
:type None
:rtype int
"""
curr = self.head
count = 0
while curr:
count += 1
curr = curr.getNext()
return count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_items(self):\r\n return self.num_items",
"def items_num(self):\n\t\treturn len(self.items)",
"def items_num(self):\n\t\treturn len(self.items)",
"def count(item):\n return len(item)",
"def items_num(self):\n return len(self.items)",
"def items_count(self):\n return len(s... | [
"0.8356582",
"0.8291789",
"0.8291789",
"0.8278332",
"0.821022",
"0.81689286",
"0.81617844",
"0.80156374",
"0.7985196",
"0.7944049",
"0.7944049",
"0.7929658",
"0.792146",
"0.78231484",
"0.7821722",
"0.77832294",
"0.7776991",
"0.77635854",
"0.77452826",
"0.77430403",
"0.7740341... | 0.0 | -1 |
Removes and returns the item. Position is optional and returns the last item if undefined. | def pop(self, pos=None):
"""
:type pos: int (optional)
:rtype item: Node()
"""
if pos == None:
pos = self.size() - 1
if pos == 0:
temp = self.head
self.head = self.head.getNext()
return temp.getData()
prev = curr = self.head
for idx in range(self.size())... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def popitem(self):\n return self.pop(0)",
"def pop(self, pos=None):\n \n if self.is_empty():\n raise IndexError('pop from empty list')\n \n if pos is None:\n pos = self.length() - 1\n \n elif pos >= self.length():\n raise IndexErro... | [
"0.78263104",
"0.75394535",
"0.7474529",
"0.74592084",
"0.74033016",
"0.73711836",
"0.7349703",
"0.7273903",
"0.72681737",
"0.72650576",
"0.724517",
"0.7213288",
"0.7159362",
"0.71405435",
"0.70913863",
"0.70827496",
"0.7063961",
"0.7054882",
"0.70505595",
"0.7038268",
"0.703... | 0.0 | -1 |
Add the incoming model_state data to self.ground_truth | def callback_model_state(self, model_state):
# find the model in the list of tracked gazebo models
model_index = model_state.name.index(self.model_name)
# grab the position of the robot model
self.ground_truth = model_state.pose[model_index].position | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_ground_truth_state_to_info(self):\n self._is_ground_truth_state_exposed = True\n return",
"def update_truth(self, ground_truth):\n self.ground_truth = ground_truth",
"def storeState(self):\n\n self.action_history[self.trial] = self.action\n self.ball_history[self.tria... | [
"0.7314329",
"0.69971913",
"0.55966604",
"0.54955846",
"0.5472062",
"0.54351777",
"0.54033965",
"0.5373464",
"0.53702646",
"0.53323215",
"0.5327362",
"0.5323086",
"0.5321157",
"0.5318462",
"0.52967715",
"0.5290709",
"0.5284121",
"0.52777",
"0.52634954",
"0.5246136",
"0.524471... | 0.6119398 | 2 |
Preprocessing of transition probabilities for guiding the random walks. | def preprocess_transition_probs(self):
G = self.G
alias_nodes = {}
for node in G.nodes():
unnormalized_probs = [G[node][nbr].get('weight', 1.0)
for nbr in G.neighbors(node)]
norm_const = sum(unnormalized_probs)
normalized_pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_transition_probs(self):\n n = len(self.speakers) # TODO why this line ???\n transitions = np.random.randint(5, size=(n, n)) + 1\n transitions += transitions.transpose()\n for i in range(0, math.floor(n / 2)):\n s1 = np.random.randint(n)\n s2 = np.random.r... | [
"0.6900611",
"0.68253887",
"0.6677817",
"0.63292843",
"0.62776667",
"0.6239705",
"0.61882937",
"0.61719954",
"0.6169469",
"0.6072568",
"0.6049207",
"0.6043964",
"0.60242873",
"0.60202354",
"0.6011292",
"0.6004952",
"0.5986239",
"0.5962387",
"0.59471303",
"0.5945915",
"0.59303... | 0.66861516 | 2 |
Given a scoring function f over slice tuples (as returned by find_objects), keeps at most nbest components whose scores is higher than min. | def select_regions(binary,f,min=0,nbest=100000):
if binary.max() == 1:
labels,_ = label(binary)
else:
labels = binary.astype(uint8)
objects = find_objects(labels)
scores = [f(o) for o in objects]
best = argsort(scores)
keep = zeros(len(objects)+1,'i')
if nbest > 0:
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _forward_best_subset(X, y, nbest=8, beamwidth=40, score=\"bic\"):\n \n assert nbest > 0, \"nbest must be positive\"\n beamwidth = max(beamwidth, nbest)\n \n # Add constant\n Xc = add_constant(X).rename(columns={'const': '(Intercept)'})\n \n def get_bic(feature_subset):\n return -... | [
"0.6569852",
"0.6298915",
"0.628445",
"0.6262472",
"0.607158",
"0.60456747",
"0.6036719",
"0.60212016",
"0.5982098",
"0.59783477",
"0.59565735",
"0.5885785",
"0.58565277",
"0.5840848",
"0.5783836",
"0.57810193",
"0.57730407",
"0.57394874",
"0.57313776",
"0.5709526",
"0.567268... | 0.0 | -1 |
Renumber the labels of the input array contiguously so that they range from 1...N | def renumber_labels_ordered(a,correspondence=0):
assert amin(a)>=0
assert amax(a)<=2**25
labels = sorted(unique(ravel(a)))
renum = zeros(amax(labels)+1,dtype='i')
renum[labels] = arange(len(labels),dtype='i')
if correspondence:
return renum[a],labels
else:
return renum[a] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repair_labels(labels):\n ret = np.copy(labels)\n ret[:, 0] = 10 # overwrite length to be stop seq\n ret = np.roll(ret, -1, axis=1) # move first to last\n return ret",
"def preprocess_labels(label, number_slices):\n labels = [[] for i in range(np.array(label).shape[0])]\n\n for j in range(... | [
"0.6608828",
"0.6608189",
"0.6566966",
"0.63712925",
"0.6267483",
"0.62315106",
"0.6227761",
"0.62187886",
"0.61990523",
"0.61990523",
"0.61412454",
"0.61192524",
"0.6053005",
"0.6029757",
"0.6022475",
"0.59716934",
"0.5930147",
"0.5905913",
"0.58874124",
"0.58638805",
"0.582... | 0.66183263 | 0 |
Like numpy's argsort, but using the builtin Python sorting function. Takes an optional cmp. | def pyargsort(seq,cmp=None,key=lambda x:x):
return sorted(list(range(len(seq))),key=lambda x:key(seq.__getitem__(x)),cmp=None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argsort(a, axis=-1, kind='quicksort', order=None):\r\n return ArgSortOp(kind, order)(a, axis)",
"def argsort(a, *args, **kwargs):\n warn('The function argsort is deprecated from JAMS. Use module pyjams.',\n category=DeprecationWarning)\n if isinstance(a, np.ma.MaskedArray):\n return n... | [
"0.7165046",
"0.7023848",
"0.7003376",
"0.6861288",
"0.6569742",
"0.65392536",
"0.6520392",
"0.6472053",
"0.646165",
"0.6428893",
"0.6421188",
"0.64070797",
"0.6325248",
"0.6298716",
"0.6261271",
"0.6260365",
"0.6236148",
"0.61687523",
"0.61607516",
"0.6152584",
"0.61024666",... | 0.75099546 | 0 |
r"""quantiles A list like array of the quantiles to perform the fitting. | def fitForQuantiles(self, quantiles):
results = []
for tau in quantiles:
res = self.fit(tau)
results.append(res.results)
convergence_failure = False
if res.regression.iterations >= 1000:
convergence_failure = True
self.convergen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantile(data, quantiles):\r\n\r\n assert isinstance(data, list) or isinstance(data, ndarray), \"Data must be either\" +\\\r\n \" a Python list or a NumPy 1-D array\"\r\n assert isinstance(quantiles, list) or isinstance(quantiles, ndarray), \"Quantiles\" +\\\r\n \" must be either a Python l... | [
"0.7415886",
"0.727571",
"0.7232864",
"0.71510047",
"0.71399325",
"0.7139782",
"0.7040977",
"0.7020183",
"0.6891097",
"0.68386656",
"0.6769709",
"0.6735961",
"0.66837966",
"0.6642027",
"0.66419566",
"0.6557064",
"0.654484",
"0.65318495",
"0.6521475",
"0.6518741",
"0.6468605",... | 0.7194186 | 3 |
Normalize a matrix excluding the diagonal. | def get_Q(Y_dists):
np.fill_diagonal(Y_dists, 0)
return Y_dists/np.sum(Y_dists) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(self):\n det = self._mat[0][0]*self._mat[1][1] - self._mat[0][1]*self._mat[1][0]\n for i in range(2):\n for j in range(2):\n self._mat[i][j] = (self._mat[i][j])/(np.sqrt(det))",
"def normalize(self):\r\n max = np.amax(self.matrix)\r\n min = np.a... | [
"0.78834426",
"0.7841015",
"0.77342093",
"0.7714694",
"0.76659214",
"0.75042325",
"0.7398645",
"0.73939127",
"0.7326241",
"0.71913457",
"0.7154502",
"0.71357834",
"0.71290773",
"0.7115468",
"0.71030086",
"0.6987473",
"0.698229",
"0.69133186",
"0.68979925",
"0.6867007",
"0.686... | 0.0 | -1 |
Compute probabilities conditioned on point i from a row of distances d and a Gaussian scale (scale = 2sigma^2). Uses numba. | def get_pij_numba(d, scale, i):
d_scaled = -d/scale
d_scaled -= np.max(d_scaled)
exp_D = np.exp(d_scaled)
exp_D[i] = 0
return exp_D/np.sum(exp_D) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_to_proba(self, d):\n e = np.exp(-d/self.kernel_windows) # TODO : find a good heuristic for that kernel_windows\n \n return e / e.sum(axis=1, keepdims=True)",
"def prob4():\n#raise NotImplementedError(\"Problem 4 Incomplete\")\n h = lambda x : x[0] < -1 and x[1] > 1\n f = l... | [
"0.61811143",
"0.5814924",
"0.5772172",
"0.5550842",
"0.5535394",
"0.54792416",
"0.5440208",
"0.5425315",
"0.54096395",
"0.5388293",
"0.5336268",
"0.53252244",
"0.53252244",
"0.5316932",
"0.5316683",
"0.5312884",
"0.53084046",
"0.53073573",
"0.5284592",
"0.5279539",
"0.527470... | 0.6760348 | 0 |
Timebased learning rate with decay d. | def time_based(t, eta_init, last_eta, d = 0.01):
return last_eta/(1+d*t) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate_decay(a, d_rate, g_step, d_step):\n return tf.train.inverse_time_decay(a, g_step, d_step, d_rate, True)",
"def learning_rate(self, t):\n # return self.init_learning_rate * (1 - t)\n return self.init_learning_rate / (1 + t)\n # return self.init_learning_rate * exp(-t)\n ... | [
"0.7662894",
"0.7316525",
"0.7178599",
"0.71740866",
"0.7159115",
"0.71245193",
"0.7068229",
"0.7044663",
"0.69611824",
"0.69486153",
"0.69446725",
"0.6924089",
"0.68941396",
"0.68941396",
"0.6849446",
"0.6826154",
"0.6825632",
"0.67599815",
"0.67126375",
"0.6662051",
"0.6643... | 0.0 | -1 |
Stepbased learning rate with decay d and rate r. | def step_based(t, eta_init, last_eta, d = 0.01, r = 50):
return eta_init*d**np.floor((1+t)/r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lr_decay(step):\n return(alpha / (1 + decay_rate * step))",
"def learning_rate_decay(a, d_rate, g_step, d_step):\n return tf.train.inverse_time_decay(a, g_step, d_step, d_rate, True)",
"def step_decay(epoch):\n initial_lrate = 0.1\n drop = 0.5\n epochs_drop = 10.0\n lrate = in... | [
"0.76529944",
"0.73148036",
"0.72277117",
"0.7220762",
"0.712954",
"0.7096645",
"0.70573217",
"0.70062214",
"0.70041806",
"0.6960201",
"0.6950202",
"0.6940434",
"0.6924155",
"0.6882613",
"0.685974",
"0.683906",
"0.6835201",
"0.6812383",
"0.68071246",
"0.67897695",
"0.677138",... | 0.6446787 | 55 |
Calculate the number of pairs with separations less than or equal to rbins[i]. | def npairs(data1, data2, rbins, period=None):
#work with arrays!
data1 = np.asarray(data1)
if data1.ndim ==1: data1 = np.array([data1])
data2 = np.asarray(data2)
if data2.ndim ==1: data2 = np.array([data2])
rbins = np.asarray(rbins)
if rbins.size ==1: rbins = np.array([rbins])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_pairs(seq):\n n = len(seq)\n return int(n * (n-1)/2) # sum of arphmetic progression (n-1)...1",
"def number_of_pairs(self, state):\n\n pairs = 0\n for i in range(0,len(state),2):\n if state[i] == 1 and state[i+1] == 1:\n pairs += 1\n return pairs"... | [
"0.63271475",
"0.6207419",
"0.5865756",
"0.584166",
"0.5819376",
"0.58143055",
"0.58042955",
"0.5780559",
"0.5758931",
"0.5736512",
"0.56830686",
"0.5657699",
"0.56224865",
"0.5611074",
"0.55664545",
"0.55583537",
"0.5542211",
"0.5542211",
"0.5522312",
"0.55076635",
"0.547283... | 0.57091737 | 10 |
Find the Euclidean distance between x1 & x2, accounting for box periodicity. | def distance(x1,x2,period=None):
#process inputs
x1 = np.asarray(x1)
if x1.ndim ==1: x1 = np.array([x1])
x2 = np.asarray(x2)
if x2.ndim ==1: x2 = np.array([x2])
if period is None:
period = np.array([np.inf]*np.shape(x1)[-1])
#check for consistency
if np.shape(x1)[-1] !=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euclidean_distance(x1, x2):\n return np.sqrt(np.sum(np.power(x1 - x2, 2)))",
"def euclidean_distance(x1, x2):\n return np.sqrt(np.sum(np.square(np.subtract(x1, x2))))",
"def euclidean_distance(x1, x2):\n return (x2[0] - x1[0])**2 + (x2[1] - x1[1])**2",
"def _euclidian_distance(self, x1, x2):\n ... | [
"0.83944505",
"0.8307753",
"0.82209224",
"0.8133152",
"0.80332834",
"0.79289407",
"0.78725564",
"0.77199537",
"0.77069855",
"0.742698",
"0.73953545",
"0.7389965",
"0.7337345",
"0.7331083",
"0.7299944",
"0.72698855",
"0.7257712",
"0.7253425",
"0.7251261",
"0.7246035",
"0.72250... | 0.0 | -1 |
Returns the distance from the (rgb_front) camera to the target | def _get_distance(self, target):
sensor_transform = self._sensors['rgb_front'].get_transform()
distance = np.sqrt(
(sensor_transform.location.x - target.x) ** 2 +
(sensor_transform.location.y - target.y) ** 2 +
(sensor_transform.location.z -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetDistanceFromTarget(self):\n return abs(int(self.position[0] - self.target_position[0])) + abs(int(self.position[1] - self.target_position[1]))",
"def DistanceFromOrigin(self):\r\n return ((self.x ** 2) + (self.y ** 2)) ** 0.5",
"def distance_from_origin(self):\n return ((self.x ** 2... | [
"0.6481738",
"0.6244502",
"0.62001747",
"0.6199816",
"0.6199816",
"0.6199816",
"0.6199816",
"0.6199816",
"0.6199816",
"0.6199816",
"0.6198945",
"0.6150683",
"0.613246",
"0.6024993",
"0.5989735",
"0.5953953",
"0.5942595",
"0.5942323",
"0.58337486",
"0.58175045",
"0.5773435",
... | 0.84388685 | 0 |
create dictionary for sparse feature | def sparseFeature(self, feat, feat_num, embed_dim=4):
return {'feat': feat, 'feat_num': feat_num, 'embed_dim': embed_dim} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparseFeature(feat_name, feat_num, embed_dim=4):\n return {'feat_name': feat_name, 'feat_num': feat_num, 'embed_dim': embed_dim}",
"def denseFeature(self, feat):\n return {'feat': feat}",
"def featurize(vector,features):\n dictionary = collections.defaultdict(lambda:0)\n for feature in iter... | [
"0.76782995",
"0.68565416",
"0.6779232",
"0.65597075",
"0.6550707",
"0.6534703",
"0.64986527",
"0.64876294",
"0.6419102",
"0.6395745",
"0.63638943",
"0.6296161",
"0.6294983",
"0.6291927",
"0.6231663",
"0.61766374",
"0.60696816",
"0.602503",
"0.600544",
"0.5999356",
"0.5997134... | 0.75767976 | 1 |
A barcode that's 14 digits long is treated as valid, no matter which PIN is used. That's so real barcode/PIN combos can be passed through to third parties. Otherwise, valid test PIN is the first character of the barcode repeated four times. | def pintest(self, barcode, pin):
u = self.dump(barcode)
if 'ERRNUM' in u:
return False
return len(barcode) == 14 or pin == barcode[0] * 4 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_barcode(s):\n # implement this function!\n odd_digits = 0\n even_digits = 0\n result = 0\n for i in range(len(s) - 1):\n if i % 2 == 0:\n odd_digits += int(s[i])\n else:\n even_digits += int(s[i])\n result = (3 * odd_digits + even_digits) % 10\n if... | [
"0.7539935",
"0.7034888",
"0.6893879",
"0.6791096",
"0.664426",
"0.6600586",
"0.6438837",
"0.6421184",
"0.6342083",
"0.6333583",
"0.62437123",
"0.62333155",
"0.6187384",
"0.6088142",
"0.6085941",
"0.6063137",
"0.6060049",
"0.6026859",
"0.6017495",
"0.5998989",
"0.59786063",
... | 0.72791946 | 1 |
Creates a window with an internal frame representing a table with three | def __init__(self, data):
self.root = Tk()
titleFont = ("Arial", 16, "bold")
# sensor table
self.sensorTable = Frame(master=self.root)
self.sensorNameColumn = LabelFrame(self.sensorTable, text="Name", font=titleFont)
self.sensorNameColumn.gr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displayTableWindow(self, login, name, title, size, pos, rows, rowsPerPage, \n\t\t\t\t\t\tcolumnWidths, headLine = None, useOldState = False):\n\t\twindow = TableWindow(title)\n\t\twindow.setName(name)\n\t\twindow.setSize(size)\n\t\twindow.setPos(pos)\n\t\twindow.setTable(rows, rowsPerPage, columnWidths, headLi... | [
"0.7073906",
"0.70141405",
"0.69318163",
"0.68739307",
"0.67567843",
"0.6661873",
"0.6628865",
"0.6625829",
"0.6585206",
"0.64565206",
"0.6453139",
"0.62979406",
"0.628764",
"0.6227983",
"0.62157655",
"0.61811084",
"0.6135854",
"0.61231756",
"0.61215603",
"0.6090442",
"0.6081... | 0.0 | -1 |
The name associated with the credential. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> str:\n return getattr(\n self.auth_accounts[-1], \"name\" # pylint: disable=unsubscriptable-object\n )",
"def getName(self):\n return self.__username",
"def account_name(self) -> str:\n return pulumi.get(self, \"account_name\")",
"def account_name(sel... | [
"0.7795048",
"0.73551905",
"0.7303934",
"0.7303934",
"0.721937",
"0.7205999",
"0.71436626",
"0.7124088",
"0.7115075",
"0.710203",
"0.710203",
"0.70975417",
"0.7089298",
"0.7080565",
"0.70772266",
"0.70772266",
"0.70772266",
"0.70772266",
"0.70772266",
"0.70772266",
"0.7077226... | 0.0 | -1 |
The name associated with the credential. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> str:\n return getattr(\n self.auth_accounts[-1], \"name\" # pylint: disable=unsubscriptable-object\n )",
"def getName(self):\n return self.__username",
"def account_name(self) -> str:\n return pulumi.get(self, \"account_name\")",
"def account_name(sel... | [
"0.7795048",
"0.73551905",
"0.7303934",
"0.7303934",
"0.721937",
"0.7205999",
"0.71436626",
"0.7124088",
"0.7115075",
"0.710203",
"0.710203",
"0.70975417",
"0.7089298",
"0.7080565",
"0.70772266",
"0.70772266",
"0.70772266",
"0.70772266",
"0.70772266",
"0.70772266",
"0.7077226... | 0.0 | -1 |
Get an existing ConsumerOauth2 resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
client_id: Optional[pulumi.Input[str]] = None,
client_secret: Optional[pulumi.Input[str]] = None,
consumer_id: Optional[pulumi.Input[str]] = None,
has... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n consumer_group_id: Optional[pulumi.Input[str]] = None,\n consumer_group_name: Optional[pulumi.Input[str]] = None,\n consumer_group_password: Optional[pulumi... | [
"0.57619816",
"0.5409898",
"0.5251829",
"0.49491835",
"0.4926514",
"0.48688927",
"0.48582163",
"0.4784676",
"0.4766108",
"0.47639427",
"0.46390697",
"0.45932525",
"0.45733634",
"0.45452413",
"0.4537221",
"0.45203996",
"0.45040077",
"0.45024246",
"0.45023966",
"0.44977865",
"0... | 0.73117787 | 0 |
The name associated with the credential. | def name(self) -> pulumi.Output[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> str:\n return getattr(\n self.auth_accounts[-1], \"name\" # pylint: disable=unsubscriptable-object\n )",
"def getName(self):\n return self.__username",
"def account_name(self) -> str:\n return pulumi.get(self, \"account_name\")",
"def account_name(sel... | [
"0.7795048",
"0.73551905",
"0.7303934",
"0.7303934",
"0.721937",
"0.7205999",
"0.71436626",
"0.7124088",
"0.7115075",
"0.710203",
"0.710203",
"0.70975417",
"0.7089298",
"0.7080565",
"0.70772266",
"0.70772266",
"0.70772266",
"0.70772266",
"0.70772266",
"0.70772266",
"0.7077226... | 0.0 | -1 |
Compute a list of distinct colors, ecah of which is represented as an RGB threetuple | def uniquecolors(n):
hues = [360.0 / n * i for i in range(n)]
hs = [math.floor(hue / 60) % 6 for hue in hues]
fs = [hue / 60 - math.floor(hue / 60) for hue in hues]
return [('rgb({}%, {}%, {}%)'.format(*tuple(a * 100 for a in rgbcolor(h, f)))) for h, f in zip(hs, fs)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_colors_rgb(n):\r\n hues = []\r\n # i is in the range 0, 1, ..., n - 1\r\n for i in range(1, n + 1):\r\n hues.append(360.0 / i)\r\n\r\n hs = []\r\n for hue in hues:\r\n h = math.floor(hue / 60) % 6\r\n hs.append(h)\r\n\r\n fs = []\r\n for hue in hues:\r\n ... | [
"0.7678464",
"0.75858486",
"0.7331564",
"0.7243517",
"0.7194211",
"0.7157349",
"0.7092384",
"0.7042427",
"0.7025582",
"0.6934144",
"0.68612325",
"0.6855381",
"0.682645",
"0.67611545",
"0.67340976",
"0.6688781",
"0.66725266",
"0.6658074",
"0.6643528",
"0.66418445",
"0.66404736... | 0.76324874 | 1 |
Returns true if the ball has collided with the ship | def checkBallCollision(self, ball):
res, cornx, corny = ball.collWithRect(self.bbox)
# print res,cornx, corny
if res==0:
return False
left = self.x-self.length/2
if ball.x >= left and ball.x <= self.x+self.length/2:
#bounce normally
magnitude = math.sqrt(ball.vx**2+ball.vy**2)
for i in range(1, 7... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shipCollided(self):\n self.shipHealth -= 1\n\n if self.shipHealth > 0:\n self.startInvincibilty()\n return True\n else:\n return False",
"def is_wall_collided(self)-> bool:\n # print('{} >= {} or {} <= 0'.format(self.x + self.width, self.windows_si... | [
"0.7327642",
"0.7324319",
"0.71398246",
"0.7088849",
"0.69992346",
"0.690358",
"0.68162924",
"0.67922664",
"0.6748724",
"0.67169",
"0.6686963",
"0.6672657",
"0.6658094",
"0.66579324",
"0.6564078",
"0.656325",
"0.6541366",
"0.65294325",
"0.65125537",
"0.6481841",
"0.6479891",
... | 0.63367474 | 31 |
m = modulus a = multiplier c = increment | def __init__(self, seed):
self.m = 2**32
self.a = np.uint32(1664525)
self.c = np.uint32(1013904223)
self.state = np.uint32(seed)
self._norm = np.float32(np.uint32(-1))
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modinv(a, m):\n b = 1\n while not (a * b) % m == 1:\n b += 1\n return b",
"def mod(p):\n return (p[0]**2 + p[1]**2 + p[2]**2)**0.5",
"def powmod(self, a, c):\r\n a %= self.base\r\n res = 1\r\n\r\n for _ in range(c):\r\n res = (res * a) % se... | [
"0.72126114",
"0.6865173",
"0.6861981",
"0.6771885",
"0.67328125",
"0.67156523",
"0.66604525",
"0.6627255",
"0.66240704",
"0.65957975",
"0.65806955",
"0.6578158",
"0.6576838",
"0.65630674",
"0.6562137",
"0.6520313",
"0.6508592",
"0.6451411",
"0.6447279",
"0.64075065",
"0.6365... | 0.0 | -1 |
Return name of training model. Returns String The name of the training model | def get_name():
return "SVM" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_name(self):\n\n model_name = []\n model_name.append(self.get_model_type_hash())\n model_name.append(str(int(time.time())))\n return \"_\".join(model_name) + \".model\"",
"def get_model_name(self) -> str:\n return self._get_string(openvr.Prop_RenderModelName_String... | [
"0.72882754",
"0.7244504",
"0.7224219",
"0.7057135",
"0.7029414",
"0.70246273",
"0.6925054",
"0.6909205",
"0.6869626",
"0.6859949",
"0.66999847",
"0.66965526",
"0.6638323",
"0.6637286",
"0.662203",
"0.65921146",
"0.6585346",
"0.64911133",
"0.6490891",
"0.64553547",
"0.6453046... | 0.6480005 | 19 |
Return name of training model. Returns String The name of the training model | def get_name():
return "SVM+" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_name(self):\n\n model_name = []\n model_name.append(self.get_model_type_hash())\n model_name.append(str(int(time.time())))\n return \"_\".join(model_name) + \".model\"",
"def get_model_name(self) -> str:\n return self._get_string(openvr.Prop_RenderModelName_String... | [
"0.72888386",
"0.7245531",
"0.72244436",
"0.7057993",
"0.70299315",
"0.70251256",
"0.692574",
"0.6909757",
"0.6870692",
"0.6860612",
"0.6699691",
"0.66972464",
"0.6639167",
"0.66384435",
"0.66229075",
"0.65931696",
"0.658604",
"0.6492347",
"0.64920706",
"0.64797485",
"0.64559... | 0.6214871 | 37 |
Get the number of negative support vectors Returns int The number of negative support vectors | def nNeg(self):
running_total = 0
for i in range(self.prob.num):
if self.alphas[i] > 1e-5 and self.prob.Y[i] == -1:
running_total += 1
return running_total if running_total > 0 else 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vectors_count(self) -> Optional[str]:\n return pulumi.get(self, \"vectors_count\")",
"def _get_vector_size(self):\n if len(self):\n return len(self.values()[0])\n else:\n return 0",
"def __len__(self):\n return self._vector.degree()",
"def __nonzero__(sel... | [
"0.6835181",
"0.66529423",
"0.6481774",
"0.6270907",
"0.6260305",
"0.6260305",
"0.6199202",
"0.6170327",
"0.614472",
"0.61371845",
"0.606862",
"0.6047072",
"0.60310966",
"0.6027804",
"0.602441",
"0.59957564",
"0.59895533",
"0.59882754",
"0.59798145",
"0.59695554",
"0.59447056... | 0.6136066 | 10 |
Return name of training model. Returns String The name of the training model | def get_name():
return "SVMd+ - simplified approach" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_name(self):\n\n model_name = []\n model_name.append(self.get_model_type_hash())\n model_name.append(str(int(time.time())))\n return \"_\".join(model_name) + \".model\"",
"def get_model_name(self) -> str:\n return self._get_string(openvr.Prop_RenderModelName_String... | [
"0.72888386",
"0.7245531",
"0.72244436",
"0.7057993",
"0.70299315",
"0.70251256",
"0.692574",
"0.6909757",
"0.6870692",
"0.6860612",
"0.6699691",
"0.66972464",
"0.6639167",
"0.66384435",
"0.66229075",
"0.65931696",
"0.658604",
"0.6492347",
"0.64920706",
"0.64797485",
"0.64559... | 0.57488227 | 61 |
Return name of training model. Returns String The name of the training model | def get_name():
return "SVMd+" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_name(self):\n\n model_name = []\n model_name.append(self.get_model_type_hash())\n model_name.append(str(int(time.time())))\n return \"_\".join(model_name) + \".model\"",
"def get_model_name(self) -> str:\n return self._get_string(openvr.Prop_RenderModelName_String... | [
"0.72888386",
"0.7245531",
"0.72244436",
"0.7057993",
"0.70299315",
"0.70251256",
"0.692574",
"0.6909757",
"0.6870692",
"0.6860612",
"0.6699691",
"0.66972464",
"0.6639167",
"0.66384435",
"0.66229075",
"0.65931696",
"0.658604",
"0.6492347",
"0.64920706",
"0.64797485",
"0.64559... | 0.5873806 | 55 |
Get the number of negative support vectors Returns int The number of negative support vectors | def n_neg(self):
running_total = 0
for i in range(self.prob.num):
if self.alphas[i] > 1e-5 > self.prob.C - self.deltas[i] and self.prob.Y[i] == -1:
running_total += 1
return running_total if running_total > 0 else 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vectors_count(self) -> Optional[str]:\n return pulumi.get(self, \"vectors_count\")",
"def _get_vector_size(self):\n if len(self):\n return len(self.values()[0])\n else:\n return 0",
"def __len__(self):\n return self._vector.degree()",
"def __nonzero__(sel... | [
"0.68336153",
"0.66523737",
"0.64815456",
"0.62708354",
"0.61987925",
"0.6169714",
"0.6144556",
"0.6137795",
"0.6137127",
"0.6068089",
"0.604665",
"0.6031293",
"0.6027495",
"0.6026314",
"0.59951985",
"0.5989864",
"0.59888285",
"0.5978896",
"0.5970045",
"0.59441155",
"0.591439... | 0.6262028 | 4 |
Return name of training model. Returns String The name of the training model | def get_name():
return "SVM Idea" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_name(self):\n\n model_name = []\n model_name.append(self.get_model_type_hash())\n model_name.append(str(int(time.time())))\n return \"_\".join(model_name) + \".model\"",
"def get_model_name(self) -> str:\n return self._get_string(openvr.Prop_RenderModelName_String... | [
"0.72888386",
"0.7245531",
"0.72244436",
"0.7057993",
"0.70299315",
"0.70251256",
"0.692574",
"0.6909757",
"0.6870692",
"0.6860612",
"0.6699691",
"0.66972464",
"0.6639167",
"0.66384435",
"0.66229075",
"0.65931696",
"0.658604",
"0.6492347",
"0.64920706",
"0.64797485",
"0.64559... | 0.592461 | 50 |
Get the number of negative support vectors Returns int The number of negative support vectors | def n_neg(self):
running_total = 0
for i in range(self.prob.num):
if self.alphas[i] > 1e-5 > self.prob.C - self.deltas[i] and self.prob.Y[i] == -1:
running_total += 1
return running_total if running_total > 0 else 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vectors_count(self) -> Optional[str]:\n return pulumi.get(self, \"vectors_count\")",
"def _get_vector_size(self):\n if len(self):\n return len(self.values()[0])\n else:\n return 0",
"def __len__(self):\n return self._vector.degree()",
"def __nonzero__(sel... | [
"0.6835181",
"0.66529423",
"0.6481774",
"0.6270907",
"0.6199202",
"0.6170327",
"0.614472",
"0.61371845",
"0.6136066",
"0.606862",
"0.6047072",
"0.60310966",
"0.6027804",
"0.602441",
"0.59957564",
"0.59895533",
"0.59882754",
"0.59798145",
"0.59695554",
"0.59447056",
"0.5915211... | 0.6260305 | 5 |
Create table if not exists, otherwise return the description. | def _get_or_create_table(self):
table_schema = self._get_table_schema()
try:
table_description = self.client.create_table(**table_schema)
logging.info('DynamoDB Table %s did not exist, creating.',self.table_name)
# In case we created the table, wait until it becomes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table():\n\tCURSOR.execute(\"\"\"CREATE TABLE IF NOT EXISTS {} (\n\t\t\t[ID] NVARCHAR NOT NULL PRIMARY KEY,\n\t\t\t[Name] NVARCHAR,\n\t\t\t[Definition] NVARCHAR)\"\"\".format(TABLE_NAME))",
"def create_table(self):\n self.db.query(f\"\"\"\n CREATE TABLE IF NOT EXISTS {self.table} (\n... | [
"0.7867048",
"0.7839219",
"0.7585507",
"0.7510485",
"0.7451673",
"0.74041283",
"0.7381355",
"0.7341994",
"0.7335253",
"0.7330691",
"0.7330691",
"0.73236346",
"0.72517526",
"0.72316074",
"0.72131246",
"0.7204787",
"0.71973175",
"0.71577555",
"0.71474266",
"0.71259075",
"0.7111... | 0.73869896 | 6 |
multi layer bidirectional rnn | def stacked_bidirectional_rnn(RNN, num_units, num_layers, inputs, seq_lengths, batch_size):
_inputs = inputs
for _ in range(num_layers):
with tf.variable_scope(None, default_name="bidirectional-rnn"):
rnn_cell_fw = RNN(num_units)
rnn_cell_bw = RNN(num_units)
initial_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self,\n n_in_channel=1,\n nclass=10,\n attention=True,\n activation=\"glu\",\n dropout=0.5,\n train_cnn=True,\n rnn_type=\"BGRU\",\n n_RNN_cell=128,\n n_layers_RNN=2,\n dropout_recurrent=0,\n cnn_integration=False,\... | [
"0.6716246",
"0.6627431",
"0.65452343",
"0.6428341",
"0.63572276",
"0.630499",
"0.63003767",
"0.62810075",
"0.6196823",
"0.61747205",
"0.6146319",
"0.61362743",
"0.60891384",
"0.60876757",
"0.60833544",
"0.6078601",
"0.6076121",
"0.60502106",
"0.6046007",
"0.6036551",
"0.6034... | 0.0 | -1 |
Return the connected links with input node, which may be replicated. | def find_connected_links(self, node):
connected_link_set = []
if node in self.outgoing_links:
for links in self.outgoing_links[node].values():
connected_link_set.extend(links)
if node in self.incoming_links:
for links in self.incoming_links[node].... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connections(self, src=False, dst=True, params=True): \n conns = []\n if params:\n if src:\n #grab the node params that this node is a src to\n edges = self.parent.graph.out_edges(self, data=True) \n conns.extend([ edge[2][\... | [
"0.6539224",
"0.649195",
"0.6460422",
"0.64494866",
"0.6342888",
"0.6300153",
"0.61971563",
"0.60832393",
"0.60769325",
"0.599205",
"0.597424",
"0.59154826",
"0.58642167",
"0.58552665",
"0.5844449",
"0.5843615",
"0.5824813",
"0.58133596",
"0.580742",
"0.5801593",
"0.57835615"... | 0.7330492 | 0 |
Property for self._name private attribute. Returns unicode self._name. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return utils.force_name_case(self._name)",
"def name(self):\n return str(self.name)",
"def get_name(self):\r\n return self._name",
"def get_name(self):\r\n return self._name",
"def get_name(self):\n return self.normalize_name(self.name)",
"def name(sel... | [
"0.8181476",
"0.8151778",
"0.81111866",
"0.81111866",
"0.81058764",
"0.81008786",
"0.81008786",
"0.81008786",
"0.81008786",
"0.808154",
"0.808154",
"0.80699897",
"0.8027217",
"0.8027217",
"0.8027217",
"0.8017233",
"0.8017233",
"0.8017233",
"0.8017233",
"0.8017233",
"0.8017233... | 0.0 | -1 |
Setter for self._name private attribute. | def name(self, value):
if value is not None:
assert is_string(value), (
('"{0}" attribute: "{1}" is not a "string" like object!'
).format('name', value))
self._name = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, name):\r\n self.__name = name",
"def set_name(self, _name):\n self.name = _name",
"def set_name(self, _name):\n self.name = _name\n return self.name",
"def set_name(self, name):\n self.__name = name",
... | [
"0.8775683",
"0.87620676",
"0.8750777",
"0.87427753",
"0.868641",
"0.868641",
"0.8626292",
"0.8626292",
"0.8626292",
"0.8626292",
"0.8626292",
"0.8608803",
"0.8585229",
"0.851289",
"0.8485177",
"0.8473077",
"0.8473077",
"0.84319437",
"0.84050626",
"0.8359823",
"0.8359823",
... | 0.0 | -1 |
Property for self._whitepoint private attribute. Returns array_like self._whitepoint. | def whitepoint(self):
return self._whitepoint | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getWhiteList(self):\n return self.whitelist",
"def whitepoint(self, value):\n\n if value is not None:\n assert isinstance(value, (tuple, list, np.ndarray, np.matrix)), ((\n '\"{0}\" attribute: \"{1}\" is not a \"tuple\", \"list\", \"ndarray\" '\n 'or \"m... | [
"0.65156925",
"0.65021294",
"0.5901629",
"0.58999336",
"0.5874281",
"0.585212",
"0.577127",
"0.5728522",
"0.5653823",
"0.5608196",
"0.5597706",
"0.5547323",
"0.55340576",
"0.55340576",
"0.55340576",
"0.55340576",
"0.55340576",
"0.54082",
"0.5378006",
"0.52868384",
"0.5284745"... | 0.74010783 | 0 |
Property for self._illuminant private attribute. Returns unicode self._illuminant. | def illuminant(self):
return self._illuminant | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def illuminant(self, value):\n\n if value is not None:\n assert is_string(value), (('\"{0}\" attribute: \"{1}\" is not a '\n '\"string\" like object!').format(\n 'illuminant', value))\n self._illuminant = value... | [
"0.7587767",
"0.7021667",
"0.59463036",
"0.57885855",
"0.57290244",
"0.5679126",
"0.55690086",
"0.5565512",
"0.5541848",
"0.5515806",
"0.55003446",
"0.54899913",
"0.5489057",
"0.5480913",
"0.54772496",
"0.54394484",
"0.5420377",
"0.54060704",
"0.53765744",
"0.5361959",
"0.534... | 0.8392125 | 0 |
Property for self._encoding_cctf private attribute. Returns callable self._encoding_cctf. | def encoding_cctf(self):
return self._encoding_cctf | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encoding_cctf(self, value):\n\n if value is not None:\n assert hasattr(\n value,\n '__call__'), ('\"{0}\" attribute: \"{1}\" is not callable!'.format(\n 'encoding_cctf', value))\n self._encoding_cctf = value",
"def decoding_cctf(self):... | [
"0.8209765",
"0.73215294",
"0.7100868",
"0.61552656",
"0.57068986",
"0.52759826",
"0.5231731",
"0.52149063",
"0.51674724",
"0.5141338",
"0.5119032",
"0.507773",
"0.507773",
"0.507773",
"0.507773",
"0.5075429",
"0.50185466",
"0.50093734",
"0.5000967",
"0.49870273",
"0.49152404... | 0.8174787 | 1 |
Property for self._use_derived_RGB_to_XYZ_matrix private attribute. Returns bool self._use_derived_RGB_to_XYZ_matrix. | def use_derived_RGB_to_XYZ_matrix(self):
return self._use_derived_RGB_to_XYZ_matrix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_derived_XYZ_to_RGB_matrix(self):\n\n return self._use_derived_XYZ_to_RGB_matrix",
"def RGB_to_XYZ_matrix(self):\n\n if not self._use_derived_RGB_to_XYZ_matrix:\n return self._RGB_to_XYZ_matrix\n else:\n return self._derived_RGB_to_XYZ_matrix",
"def XYZ_to_RGB_... | [
"0.8945623",
"0.7203707",
"0.7198486",
"0.68946207",
"0.6667623",
"0.6639062",
"0.55089045",
"0.5476438",
"0.49451455",
"0.49362117",
"0.49282897",
"0.49282897",
"0.4843633",
"0.48382834",
"0.48335704",
"0.47428885",
"0.47369626",
"0.4709251",
"0.46922436",
"0.46824715",
"0.4... | 0.9080075 | 0 |
Property for self._use_derived_XYZ_to_RGB_matrix private attribute. Returns bool self._use_derived_XYZ_to_RGB_matrix. | def use_derived_XYZ_to_RGB_matrix(self):
return self._use_derived_XYZ_to_RGB_matrix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_derived_RGB_to_XYZ_matrix(self):\n\n return self._use_derived_RGB_to_XYZ_matrix",
"def XYZ_to_RGB_matrix(self):\n\n if not self._use_derived_XYZ_to_RGB_matrix:\n return self._XYZ_to_RGB_matrix\n else:\n return self._derived_XYZ_to_RGB_matrix",
"def use_derived... | [
"0.87373805",
"0.72479254",
"0.6822157",
"0.65967005",
"0.65680283",
"0.6518598",
"0.574442",
"0.5670882",
"0.51267755",
"0.51267755",
"0.49875182",
"0.4954741",
"0.47969902",
"0.4793615",
"0.47469178",
"0.47123513",
"0.47087806",
"0.46631134",
"0.46558574",
"0.46137658",
"0.... | 0.9122347 | 0 |
Converts from given RGB colourspace to CIE XYZ tristimulus values. | def RGB_to_XYZ(RGB,
illuminant_RGB,
illuminant_XYZ,
RGB_to_XYZ_matrix,
chromatic_adaptation_transform='CAT02',
decoding_cctf=None):
if decoding_cctf is not None:
RGB = decoding_cctf(RGB)
M = chromatic_adaptation_matrix_VonKries... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def example_rgb_to_xyz():\r\n\r\n print(\"=== RGB Example: RGB->XYZ ===\")\r\n # Instantiate an Lab color object with the given values.\r\n rgb = sRGBColor(120, 130, 140)\r\n # Show a string representation.\r\n print(rgb)\r\n # Convert RGB to XYZ using a D50 illuminant.\r\n xyz = convert_color... | [
"0.7503742",
"0.6938482",
"0.6922531",
"0.68821764",
"0.67743766",
"0.6615076",
"0.65700406",
"0.65414315",
"0.6506826",
"0.64865446",
"0.63825524",
"0.6369172",
"0.6362145",
"0.6323811",
"0.6314519",
"0.6249719",
"0.61764866",
"0.61716986",
"0.6128594",
"0.6119293",
"0.60776... | 0.6594058 | 6 |
Converts from given input RGB colourspace to output RGB colourspace using given chromatic adaptation method. | def RGB_to_RGB(RGB,
input_colourspace,
output_colourspace,
chromatic_adaptation_transform='CAT02',
apply_decoding_cctf=False,
apply_encoding_cctf=False):
if apply_decoding_cctf:
RGB = input_colourspace.decoding_cctf(RGB)
M = RG... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertColorSpace(\n self,\n img, # Image in some color space\n srcColorSpace = 'BGR', # Source color space\n tgtColorSpace = 'RGB', # Traget color space\n ):\n\n if srcColorSpace == tgtColorSpace:\n return img\n\n if srcColorSpace == 'BGR':\n ... | [
"0.5873508",
"0.5810865",
"0.56480277",
"0.5597438",
"0.5592882",
"0.5569634",
"0.55335915",
"0.55061394",
"0.54814005",
"0.53661156",
"0.53450567",
"0.52264214",
"0.52227604",
"0.51930726",
"0.51727873",
"0.5155576",
"0.5137428",
"0.51328343",
"0.51169145",
"0.507286",
"0.50... | 0.68588084 | 0 |
Save (on POST) or load (on GET) a visualization then render. | def saved(self, trans, id=None, revision=None, type=None, config=None, title=None, **kwargs):
# TODO: consider merging saved and render at this point (could break saved URLs, tho)
if trans.request.method == 'POST':
self._POST_to_saved(trans, id=id, revision=revision, type=type, config=config... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put_visualization(self, visualization, *args, **kwargs):\n visualization = json.loads(visualization)\n file_name = kwargs.pop(\"file_name\", None)\n if file_name is not None:\n file_name = file_name.split(\".\")[0] + \".json\"\n else:\n file_name = \"visualizat... | [
"0.6641557",
"0.63549757",
"0.6330256",
"0.6232597",
"0.6086846",
"0.6057501",
"0.6030419",
"0.5939213",
"0.59227914",
"0.59139454",
"0.58214635",
"0.58080995",
"0.57901245",
"0.57695764",
"0.5749977",
"0.56918824",
"0.5662957",
"0.56037223",
"0.55995893",
"0.5594805",
"0.559... | 0.65384895 | 1 |
Create a Python instance from the given DOM node. The node tag must correspond to an element declaration in this module. | def CreateFromDOM (node, default_namespace=None):
if default_namespace is None:
default_namespace = Namespace.fallbackNamespace()
return pyxb.binding.basis.element.AnyCreateFromDOM(node, default_namespace) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateFromDOM (node, default_namespace=None):\n if default_namespace is None:\n default_namespace = Namespace.fallbackNamespace()\n return pyxb.binding.basis.element.AnyCreateFromDOM(node, _fallback_namespace=default_namespace)",
"def CreateFromDOM (node, default_namespace=None):\n if default... | [
"0.6950281",
"0.6950281",
"0.6950281",
"0.6947157",
"0.6700985",
"0.6700985",
"0.6700985",
"0.6699332",
"0.6668218",
"0.66530627",
"0.6623968",
"0.6596658",
"0.6586864",
"0.6566625",
"0.6511511",
"0.649196",
"0.64743096",
"0.6424634",
"0.6325778",
"0.6315109",
"0.63117343",
... | 0.701214 | 8 |
Test a generic media_player entity media source. | async def test_media_player_entity_with_source(
hass: HomeAssistant,
mock_client: APIClient,
hass_ws_client: WebSocketGenerator,
mock_generic_device_entry,
) -> None:
esphome_platform_mock = Mock(
async_get_media_browser_root_object=AsyncMock(
return_value=[
Brows... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_media_player_entity(\n hass: HomeAssistant, mock_client: APIClient, mock_generic_device_entry\n) -> None:\n entity_info = [\n MediaPlayerInfo(\n object_id=\"mymedia_player\",\n key=1,\n name=\"my media_player\",\n unique_id=\"my_media_player\"... | [
"0.64096344",
"0.6236989",
"0.61873525",
"0.616004",
"0.5956567",
"0.5908001",
"0.58890027",
"0.5866706",
"0.58557224",
"0.585071",
"0.5794101",
"0.57573724",
"0.57359296",
"0.5703834",
"0.56853944",
"0.5682842",
"0.5656274",
"0.5554885",
"0.55231273",
"0.5461215",
"0.5444193... | 0.75328547 | 0 |
Calculate the trigonometric logg and error | def logg_trigomonetric(teff, mass, v, bc, par, dpar, dteff, dmass):
#np.geterr()
if mass == 'nan':
logg, dlogg = 'nan', 'nan'
else:
e = 2.718281828
logg = 4.44 + np.log10(mass) + (4.0*np.log10(teff/5777.)) + (0.4*(v + bc)) + (2.0*np.log10(par/1000.0)) + 0.108
logg = np.roun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ga_log(R):\n phiP, t_normal_n, t_perpendicular_n = extractRotorComponents(R)\n return phiP + t_normal_n + t_perpendicular_n",
"def f(x):\n return np.tan(x) - np.sin(x) - (m*g)/(2*k*L)",
"def f(x):\n return math.exp(-x**2)/(1+x**2)+(2*math.cos(x)**2)/(1+(x-4)**2)",
"def log_deriv(error):\n ... | [
"0.63030815",
"0.62489015",
"0.62068045",
"0.60562694",
"0.6037404",
"0.59586823",
"0.59370434",
"0.5790289",
"0.57731366",
"0.5763438",
"0.575165",
"0.57470214",
"0.5742113",
"0.57102907",
"0.57053775",
"0.567955",
"0.56205356",
"0.5602283",
"0.5597884",
"0.5597735",
"0.5597... | 0.64143455 | 0 |
If the passed number is negative, returns None. Else, the number is returned. This deliberately raises an index error when the value None is passed as the index of the board. | def checkNonNegIndex(num):
if num < 0:
return None
else:
return num | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utility(board):\n if winner(board) is None:\n return 0\n elif winner(board) == X:\n return 1\n elif winner(board) == O:\n return -1",
"def utility(board) -> int:\n winner_player = winner(board)\n if winner_player == X:\n return 1\n elif winner_player == O:\n ... | [
"0.6391145",
"0.62463105",
"0.6187811",
"0.6149564",
"0.6144066",
"0.6116247",
"0.61130315",
"0.61100495",
"0.60869133",
"0.60754466",
"0.6056211",
"0.60280764",
"0.6026854",
"0.59965265",
"0.59965265",
"0.59965265",
"0.59965265",
"0.59965265",
"0.5987862",
"0.59867364",
"0.5... | 0.749563 | 0 |
Turn ind into onehot. | def as_one_hot(ind, n):
vec = np.zeros(n)
vec[ind] = 1
return vec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_to_one_hot(self,length,ind):\n one_hot = [0 for _ in range(length)]\n if (ind >= len(one_hot)):\n one_hot[-1] = 1\n else:\n one_hot[ind] = 1\n return one_hot",
"def get_one_hot(size, ind):\n one_hot = np.zeros((size,))\n one_hot[ind] = 1\n retur... | [
"0.8407736",
"0.8365177",
"0.8087348",
"0.80061436",
"0.7918201",
"0.7906615",
"0.7899308",
"0.78212243",
"0.77157116",
"0.77157116",
"0.77157116",
"0.77157116",
"0.77106076",
"0.77041525",
"0.76815987",
"0.7680675",
"0.7638737",
"0.7633299",
"0.76282895",
"0.76079625",
"0.75... | 0.83046377 | 2 |
Estimate discounted amount reward received given softmax policy over value. A way to assess how well your value function is doing. | def reward_amt(value, reward_vec, adj, softmax_inv_temp, discount, start_prob=None):
n = len(reward_vec)
softmax_value = np.exp(softmax_inv_temp * value) / np.sum(np.exp(softmax_inv_temp*value))
policy = adj * softmax_value.reshape(1, -1)
policy = util.l1_normalize_rows(policy)
sr = np.linalg.pinv(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(values):\n exps = np.exp(values)\n return exps / sum(exps)",
"def value_update(reward, value, current_state, next_state, learning_rate, discount, features=None):\n n = len(value)\n value_shape = value.shape\n value = value.reshape(-1, 1)\n if features is None:\n features = np... | [
"0.6954414",
"0.67290527",
"0.66370857",
"0.66353714",
"0.6609512",
"0.6522944",
"0.6518295",
"0.649618",
"0.64892924",
"0.64892924",
"0.64854854",
"0.64770085",
"0.6473047",
"0.6460264",
"0.64584184",
"0.6456486",
"0.6456486",
"0.6456486",
"0.6456486",
"0.6456486",
"0.645648... | 0.7478386 | 0 |
Adds AVG, OBP, SLG, and OPS columns to dataframe and rounds to 3 digits | def createStatistics(dataframe):
# AVG- hits divided by at bats (H/AB)
dataframe['AVG'] = dataframe['H']/dataframe['AB']
# OBP- times reached base (H + BB + HBP)/(AB + BB + HBP + SF).
dataframe['OBP'] = (dataframe['H']+dataframe['BB']+dataframe['HBP'])/ \
(dataframe['AB']+datafr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combine_mean_ui(df, df_type=\"pop\"):\n for col in [\"mean\", \"lower\", \"upper\"]:\n if df_type == \"pop\":\n df[col] = df[col] / 1000000\n df[col] = df[col].apply(lambda x: round(x, 2))\n \n df[\"value\"] = (df[\"mean\"].astype(str) + \" (\" + df[\"lower\"].astype(... | [
"0.60740507",
"0.5838134",
"0.5757699",
"0.5693481",
"0.5660854",
"0.5605412",
"0.55774254",
"0.5529876",
"0.5524968",
"0.5520738",
"0.55061686",
"0.55023694",
"0.54915166",
"0.5451545",
"0.54059106",
"0.5356832",
"0.53331816",
"0.5329651",
"0.53110075",
"0.5288664",
"0.52457... | 0.5944644 | 1 |
Computes the Levenshtein (i.e. edit) distance between two strings. | def edit_distance(left, right):
similarities = np.zeros((len(left) + 1, len(right) + 1), dtype=np.int32)
similarities[:, 0] = range(len(left) + 1)
similarities[0, :] = range(len(right) + 1)
for l in range(1, len(left) + 1):
for r in range(1, len(right) + 1):
sub_cost = 0 if left[l -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(str1, str2):\n return levenshtein.normalized_distance(str1, str2)",
"def levenshtein(str1, str2, normalise=False):\n\ttmp = Levenshtein.distance(str1, str2)\n\tif(normalise) and (len(str1) + len(str2)): tmp /= max(len(str1), len(str2))\n\treturn tmp",
"def levenshtein_distance(s1,s2):\n\n\t\tif... | [
"0.846103",
"0.83120507",
"0.83072543",
"0.81793934",
"0.8091516",
"0.7997546",
"0.7942761",
"0.79336584",
"0.7877354",
"0.7866262",
"0.7847007",
"0.7811629",
"0.7788306",
"0.7736275",
"0.7733514",
"0.7701445",
"0.7634405",
"0.7626078",
"0.75509626",
"0.7519845",
"0.75021684"... | 0.0 | -1 |
Gets distance between 2 checkpoints on a road | def get_distance_between_checkpoint(self, i1, i2):
ma = max(i1, i2)
mi = min(i1, i2)
dist = 0
while mi != ma:
dist += get_distance(self.cp[mi], self.cp[mi + 1])
mi += 1
return dist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_distance(first: Waypoint, second: Waypoint) -> int:\n return int(distance.vincenty(first.coords(), second.coords()).m)",
"def road_distance(lat1, lon1, lat2, lon2):\n point1 = lat1, lon1\n point2 = lat2, lon2\n url = \"https://maps.googleapis.com/maps/api/distancematrix/json?origins={0},... | [
"0.7524706",
"0.74062645",
"0.69967574",
"0.6950001",
"0.6923164",
"0.69049627",
"0.6904525",
"0.6870667",
"0.6857253",
"0.68500906",
"0.6845922",
"0.6825795",
"0.6809913",
"0.6792263",
"0.67694193",
"0.67553073",
"0.6744306",
"0.6728145",
"0.671836",
"0.67180663",
"0.6715505... | 0.74143267 | 1 |
Parser for the optional na_dict argument containing a dictionary of NASA Ames internal variables. These are saved as instance attributes with the name used in the NASA Ames documentation. | def _parseDictionary(self):
for i in self.na_dict.keys():
setattr(self, i, self.na_dict[i]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _defineNAGlobals(self):\n # Check if we should add to it with locally set rules\n local_attributes = nappy.utils.getLocalAttributesConfigDict()\n local_nc_atts = local_attributes[\"nc_attributes\"]\n local_nc_to_na_map = nc_to_na_map.copy()\n\n for att, value in local_nc_atts... | [
"0.61019325",
"0.58368427",
"0.5544113",
"0.5502021",
"0.53419197",
"0.5272353",
"0.5023442",
"0.49566567",
"0.49554634",
"0.49483204",
"0.48607507",
"0.48572603",
"0.48110318",
"0.47990358",
"0.47756737",
"0.47645792",
"0.4744935",
"0.47416276",
"0.4721498",
"0.47122025",
"0... | 0.6715907 | 0 |
Create an instance of BasThread class. | def __init__(self, client):
super().__init__(client) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,Thread):\n\t\tthreading.Thread.__init__(self)",
"def _make_thread(self):\r\n pass",
"def _create_thread(self, target=None, **kwargs):\n return PyonThread(target=target, **kwargs)",
"def __init__(self, name='KillableThread'):\n self._stopevent = threading.Event( )\n ... | [
"0.7174919",
"0.68961334",
"0.65105414",
"0.6441153",
"0.6434241",
"0.6343249",
"0.6341532",
"0.62961596",
"0.6131707",
"0.61302805",
"0.61033314",
"0.6093918",
"0.6093918",
"0.60222745",
"0.5998646",
"0.5989192",
"0.59783316",
"0.59771174",
"0.5966369",
"0.5940549",
"0.59300... | 0.0 | -1 |
Get the actual value of the status item. | def get_current_value(self) -> str:
if isinstance(self._function_args, dict):
# noinspection PyCallingNonCallable
value = self._value_function(**self._function_args)
else:
# noinspection PyCallingNonCallable
value = self._value_function(*self._function_arg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item(self):\n return self.wc_status.attrib['item']",
"def status(self):\n return self.get(self._names[\"status\"])",
"def GetStatus(self):\r\n return self.status",
"def status(self):\n return status_dict[self._get_property_(self.STATUS).upper()]",
"def Status(self):\r\n\t\tretur... | [
"0.7480368",
"0.7440283",
"0.7295259",
"0.7239824",
"0.717353",
"0.7170753",
"0.7147659",
"0.7105216",
"0.70842904",
"0.70842904",
"0.70842904",
"0.7035582",
"0.6991364",
"0.6947015",
"0.6946083",
"0.6939842",
"0.693034",
"0.6919277",
"0.69180405",
"0.69180405",
"0.69180405",... | 0.0 | -1 |
\ True if point p is in triangle t. | def pointInTriangle(p, t1, t2, t3):
return (clockwise(p, t1, t2) and clockwise(p, t2, t3) and clockwise(p, t3, t1)) or (not clockwise(p, t1, t2) and not clockwise(p, t2, t3) and not clockwise(p, t3, t1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_point_in_triangle(point, triangle):\n def is_on_same_side(p1, p2, segment):\n a, b = segment\n v = vector_from_points(a, b)\n c1 = cross_vectors(v, vector_from_points(a, p1))\n c2 = cross_vectors(v, vector_from_points(a, p2))\n if dot_vectors(c1, c2) >= 0:\n ... | [
"0.7690485",
"0.74811035",
"0.72503245",
"0.72147185",
"0.7113589",
"0.70814353",
"0.70042676",
"0.69036317",
"0.6882532",
"0.6847086",
"0.683507",
"0.6769979",
"0.6724477",
"0.65591455",
"0.6528782",
"0.6520094",
"0.64364827",
"0.6429899",
"0.63431156",
"0.63324744",
"0.6298... | 0.82583135 | 0 |
Sets the learning rate to the initial LR decayed by 10 every 30 epochs | def adjust_learning_rate(optimizer, epoch, gammas, schedule):
lr = args.learning_rate
assert len(gammas) == len(schedule), "length of gammas and schedule should be equal"
for (gamma, step) in zip(gammas, schedule):
if (epoch >= step):
lr = lr * gamma
else:
break
for param_group in optimizer.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l... | [
"0.79124767",
"0.7906177",
"0.7849136",
"0.7774903",
"0.77348644",
"0.77312475",
"0.77230847",
"0.77221286",
"0.7719281",
"0.7708911",
"0.7693468",
"0.76748097",
"0.7665629",
"0.7665629",
"0.7665629",
"0.7654658",
"0.7642339",
"0.7639322",
"0.76377",
"0.7625711",
"0.7624453",... | 0.0 | -1 |
Computes the precision for the specified values of k | def accuracy(output, target, topk=(1,)):
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].view(-1).float().sum(0)
res.append(correct_k.mul_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\... | [
"0.76427615",
"0.74189496",
"0.7418079",
"0.72710466",
"0.72456723",
"0.72446615",
"0.7237539",
"0.72213703",
"0.7210107",
"0.7058935",
"0.6852219",
"0.6786084",
"0.67836976",
"0.6768417",
"0.67273885",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.... | 0.0 | -1 |
Mock a fully setup config entry and all components based on fixtures. | async def setup_mocked_integration(hass: HomeAssistant) -> MockConfigEntry:
mock_config_entry = MockConfigEntry(**FIXTURE_CONFIG_ENTRY)
mock_config_entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
return mock_confi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_config():\n from .. import config\n\n _old_fs = os.getenv('FREESURFER_HOME')\n if not _old_fs:\n os.environ['FREESURFER_HOME'] = mkdtemp()\n\n filename = Path(pkgrf('fmriprep', 'data/tests/config.toml'))\n settings = loads(filename.read_text())\n for sectionname, configs in settin... | [
"0.7250074",
"0.7229448",
"0.7146156",
"0.7060083",
"0.7034474",
"0.6980311",
"0.68986493",
"0.68975407",
"0.6831019",
"0.67502934",
"0.6735811",
"0.67181355",
"0.6675969",
"0.6674934",
"0.663156",
"0.6629087",
"0.6629087",
"0.6629087",
"0.6629087",
"0.6629087",
"0.6629087",
... | 0.7108359 | 3 |
Add an edge (dependency) between the specified nodes. | def add_edge(self, ind_node, dep_node, graph=None):
if not graph:
graph = self.graph
if ind_node not in graph or dep_node not in graph:
raise KeyError("one or more nodes do not exist in graph")
test_graph = deepcopy(graph)
test_graph[ind_node].add(dep_node)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, nodes, X, U, V):\n assert(nodes[0] in self.nodes)\n assert(nodes[1] in self.nodes)\n\n if nodes[0] != nodes[1]:\n\n self.edges[nodes] = Graph.new_path([X, U, V])\n self.nodes[nodes[0]].linked_to.append(nodes[1])\n self.join_connex_groups(self... | [
"0.71596897",
"0.7130265",
"0.6977718",
"0.67558414",
"0.6698533",
"0.66963077",
"0.6675756",
"0.6670649",
"0.66134727",
"0.65849394",
"0.65810084",
"0.6523668",
"0.6502528",
"0.65001196",
"0.64767134",
"0.6429748",
"0.6385168",
"0.6357876",
"0.6355412",
"0.63436127",
"0.6287... | 0.6335514 | 20 |
Make sure homepage page returns correct HTML. | def test_index(self):
# make request to server
result = self.client.get("/")
# check that / route renders login page
self.assertIn(b'<h1>Login:</h1>',result.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_home_page_returns_correct_html(self):\n\n request = HttpRequest()\n response = home_view(request)\n html = response.content.decode('utf8')\n self.assertTrue(html.startswith('<!doctype html>'))\n self.assertIn('<title>home</title>', html)\n self.assertTrue(html.end... | [
"0.80715483",
"0.7899501",
"0.75493664",
"0.75007427",
"0.7481563",
"0.731595",
"0.7279896",
"0.72251815",
"0.7208372",
"0.7196892",
"0.7176104",
"0.71548593",
"0.71521676",
"0.71521676",
"0.7124685",
"0.7119003",
"0.71087253",
"0.7103294",
"0.70763534",
"0.7069125",
"0.70494... | 0.0 | -1 |
Get a document from the most recently fetched batch, or ``None``. | def next_object(self):
if not self._buffer_size():
return None
return next(self.delegate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_doc(self):\n try:\n result = self.elastic.search(\n index=self.meta_index_name,\n body={\n \"query\": {\"match_all\": {}},\n \"sort\": [{\"_ts\": \"desc\"}],\n },\n size=1\n )... | [
"0.7029295",
"0.6689316",
"0.64725715",
"0.6418167",
"0.63943493",
"0.63354665",
"0.6290378",
"0.6254543",
"0.62531334",
"0.60617685",
"0.6034138",
"0.601785",
"0.59818",
"0.5975595",
"0.5970692",
"0.5922456",
"0.5873597",
"0.58673984",
"0.5861155",
"0.58459085",
"0.58322",
... | 0.0 | -1 |
`tuple(x)` returns a tuple containing the elements of the iterable x. | def tuple(x):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tuple_from_sequence(*args):\n return tuple(args)",
"def _unpack_tuple(x):\n if len(x) == 1:\n return x[0]\n else:\n return x",
"def _unpack_tuple(x):\n if len(x) == 1:\n return x[0]\n else:\n return x",
"def vec2tuple(x):\n return (x.x, x.y, x.z)",
"def fla... | [
"0.7563587",
"0.72636724",
"0.72636724",
"0.7182882",
"0.7180057",
"0.7140476",
"0.7109017",
"0.7045293",
"0.6969255",
"0.68861973",
"0.6882426",
"0.68725204",
"0.6752039",
"0.66961664",
"0.6667604",
"0.6640206",
"0.66228473",
"0.66192013",
"0.6595749",
"0.656186",
"0.6537167... | 0.79614264 | 0 |
`zip()` returns a new list of ntuples formed from corresponding elements of each of the n iterable sequences provided as arguments to `zip`. That is, the first tuple contains the first element of each of the sequences, the second element contains the second element of each of the sequences, and so on. The result list i... | def zip() -> List:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lzip(*args):\n return list(zip(*args))",
"def exactZip(*args):\n lengths = [len(a) for a in args]\n if len(set(lengths)) <= 1:\n return zip(*args)\n else:\n raise ValueError(\"Iterables were of different lengths; {0}\".format(args))",
"def unzip(seq):\n return zip(*seq)",
"de... | [
"0.7155576",
"0.6791329",
"0.66759753",
"0.66177815",
"0.66175467",
"0.6401946",
"0.6337328",
"0.61810863",
"0.6171572",
"0.61240053",
"0.61195034",
"0.6024108",
"0.6022008",
"0.59753674",
"0.5888483",
"0.5874121",
"0.5873673",
"0.5851203",
"0.5851203",
"0.5851203",
"0.585120... | 0.66867137 | 2 |
`D.popitem()` returns the first key/value pair, removing it from the dictionary. | def popitem(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict_pop(d, key):\n return d.pop(key)",
"def popitem(self):\n if self.used == 0:\n raise KeyError(\"empty dictionary\")\n entry0 = self.table[0]\n entry = entry0\n i = 0\n if entry0.value is None:\n # The first entry in the table's hash is abused to... | [
"0.81488335",
"0.77453935",
"0.7504979",
"0.7492729",
"0.73985034",
"0.73561895",
"0.72807837",
"0.71553886",
"0.7150134",
"0.7135656",
"0.70909274",
"0.70880127",
"0.7086621",
"0.7055385",
"0.7011008",
"0.69924974",
"0.696131",
"0.6939722",
"0.68401617",
"0.6815942",
"0.6746... | 0.5919368 | 91 |
`L.extend(x)` appends the elements of `x`, which must be iterable, to the list L, and returns `None`. | def extend(self, x) -> None:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listExtend(lst, items):\n if lst is None:\n return list(items)\n else:\n lst.extend(items)\n return lst",
"def extend_list(some_list):\n print(f\"This is our list: {some_list}\")\n one_el = [9]\n tre_el = [9, 8, 7]\n some_list.append(one_el)\n print(f\"Appending some_lis... | [
"0.69198996",
"0.6881562",
"0.68569255",
"0.645381",
"0.6342397",
"0.6331744",
"0.61222416",
"0.6107541",
"0.60908073",
"0.6034822",
"0.60329324",
"0.6031042",
"0.60162467",
"0.59764045",
"0.592716",
"0.5906939",
"0.5876994",
"0.58665514",
"0.58553964",
"0.5822398",
"0.580548... | 0.6435049 | 4 |
`S.capitalize()` returns a copy of string S with its first code point changed to its title case and all subsequent letters changed to their lower case. | def capitalize(self) -> String:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capitalize1(s):\n return s[:1].upper() + s[1:]",
"def capitalize(result):\n\treturn result.upper()",
"def camel(s):\n return s[0].upper() + s[1:]",
"def to_camelcase(s):\n words = re.split(\"[^a-zA-Z0-9]+\", s)\n return \"\".join(\n w.lower() if i is 0 else w.title() for i, w in enumer... | [
"0.77810466",
"0.75108796",
"0.7434631",
"0.74079245",
"0.73660606",
"0.73621655",
"0.7333814",
"0.72770107",
"0.72483975",
"0.72175664",
"0.7214779",
"0.7206441",
"0.71823335",
"0.71687406",
"0.71413976",
"0.70740163",
"0.70544004",
"0.7046886",
"0.70337445",
"0.7027523",
"0... | 0.7485095 | 2 |
`S.codepoint_ords()` returns an iterable value containing the sequence of integer Unicode code points encoded by the string S. Each invalid code within the string is treated as if it encodes the Unicode replacement character, U+FFFD. | def codepoint_ords(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_codepoint_range(codepoints):\n\n begin, sep, end = codepoints.partition(\"..\")\n if not sep:\n return [int(begin, 16)]\n return range(int(begin, 16), int(end, 16) + 1)",
"def uCSIsCombiningDiacriticalMarksforSymbols(code):\n ret = libxml2mod.xmlUCSIsCombiningDiacriticalMarksforSymbo... | [
"0.61781317",
"0.5474946",
"0.54215395",
"0.5276923",
"0.5230268",
"0.521463",
"0.5204466",
"0.5173837",
"0.5140022",
"0.51358485",
"0.5130245",
"0.50909984",
"0.50548226",
"0.50443333",
"0.5011343",
"0.49326727",
"0.49170068",
"0.48738992",
"0.4867052",
"0.4860101",
"0.48484... | 0.55627066 | 1 |
`S.isalpha()` reports whether the string S is nonempty and consists only of Unicode letters. | def isalpha(self) -> bool:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isAlpha(string):\n return (True)",
"def is_letter(string_):\n if string_ not in string.ascii_letters or len(string_) > 1:\n return False\n return True",
"def alphanumeric(s: str) -> bool:\n return len(re.findall(r'[^A-Za-z0-9]', s)) == 0",
"def isalpha(self):\n return isalpha(self... | [
"0.7900161",
"0.77097523",
"0.76354194",
"0.74582005",
"0.73901504",
"0.73393655",
"0.7282032",
"0.7278952",
"0.7273501",
"0.72110236",
"0.71746093",
"0.7173233",
"0.7158564",
"0.71157366",
"0.7039745",
"0.70247805",
"0.7019232",
"0.6824515",
"0.6755156",
"0.674155",
"0.67240... | 0.77982914 | 1 |
`S.isdigit()` reports whether the string S is nonempty and consists only of Unicode digits. | def isdigit(self) -> bool:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_number(s):\r\n try:\r\n int(s)\r\n return True\r\n except ValueError:\r\n return False",
"def is_number(s):\n try:\n int(s)\n return True\n except ValueError:\n return False",
"def is_digit_regex(s: str) -> bool:\n if re.match(\"^\\d+?\\.\\d+?$\",... | [
"0.6877753",
"0.67717403",
"0.6755293",
"0.6743149",
"0.6716348",
"0.6663278",
"0.6599915",
"0.65969664",
"0.6577586",
"0.65715057",
"0.6559301",
"0.6546654",
"0.65280116",
"0.65207475",
"0.64913636",
"0.6465889",
"0.64534664",
"0.64482814",
"0.6434374",
"0.64125544",
"0.6411... | 0.66088355 | 6 |
`S.isspace()` reports whether the string S is nonempty and consists only of Unicode spaces. | def isspace(self) -> bool:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_whitespace(char):\n if char == ' ' or char == '\\t' or char == '\\n' or char == '\\r':\n return True\n cat = unicodedata.category(char)\n if cat == 'Zs':\n return True\n return False",
"def _is_whitespace(char):\n # \\t, \\n, and \\r are technically contorl characters but we ... | [
"0.7767863",
"0.770314",
"0.7674141",
"0.76547104",
"0.76173335",
"0.75871557",
"0.75403583",
"0.7485735",
"0.7079251",
"0.7001831",
"0.69847465",
"0.6666857",
"0.645141",
"0.63895273",
"0.6334742",
"0.6317155",
"0.62341076",
"0.6206159",
"0.6166289",
"0.6104209",
"0.60805404... | 0.7393068 | 8 |
`S.lstrip()` returns a copy of the string S with leading whitespace removed. | def lstrip(self) -> String:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lstrip(string):\n return \"\\n\".join(map(str.lstrip, string.split(\"\\n\")))",
"def lstrips(text, remove):\r\n return _strips('l', text, remove)",
"def LTrim(text):\n return str(text).lstrip()",
"def stripl(l):\n return filter(lambda x:x, map(lambda x: x.strip(), l))",
"def rstrip(self) ->... | [
"0.7141349",
"0.6884859",
"0.6856551",
"0.6638632",
"0.65222675",
"0.6447653",
"0.63862544",
"0.6377503",
"0.6329511",
"0.6295738",
"0.6292001",
"0.62877357",
"0.6211862",
"0.620936",
"0.6135689",
"0.6110608",
"0.6087113",
"0.6070681",
"0.60654205",
"0.6058227",
"0.6053589",
... | 0.75215983 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.