query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Test that making a request without credentials returns an error.
def test_without_credentials(self, api_client): url = reverse('api-v4:search:public-company') response = api_client.post(url, data={}) assert response.status_code == status.HTTP_401_UNAUTHORIZED
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_credentials(self):\n\n response = self.client.post(\n self.config.AUTH_URL, data={})\n\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)\n self.assertNotIn('token', response.json())\n\n print(\"\\n[+] test_no_credentials PASSED\")", "def test...
[ "0.76036596", "0.75516355", "0.7535244", "0.7509812", "0.73981625", "0.73738515", "0.7349177", "0.7287827", "0.72531337", "0.7223815", "0.71695143", "0.7157083", "0.7145628", "0.71172637", "0.71125203", "0.7065414", "0.7039904", "0.7032176", "0.7025246", "0.7011364", "0.69893...
0.67117304
64
gets the default cluster name.
def get_cluster(cls): return cls.get("cluster", "general")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_name(self):\n node = self.get_node()\n try:\n return node.oget(\"cluster\", \"name\").lower()\n except Exception as exc:\n pass\n name = \"default\"\n from cluster import ClusterSvc\n svc = ClusterSvc()\n svc.set_multi([\"cluster.na...
[ "0.85363567", "0.7906097", "0.7825537", "0.76921266", "0.76921266", "0.76921266", "0.76921266", "0.76921266", "0.76921266", "0.7464552", "0.7464552", "0.71913314", "0.71880054", "0.7103525", "0.7103076", "0.697651", "0.6972442", "0.6932648", "0.6849117", "0.68011045", "0.6801...
0.6961189
17
Encodes a tree to a single string.
def serialize(self, root): str1 = "" if root is None: return "#" else: str1 +=str(root.val)+"," if root.left: str1 += self.serialize(root.left) else: str1 += "#," if root.right: str1 += self.serialize(root.right)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encodeTree(self, tree, key):\n return self.encode(pickle.dumps(tree), key)", "def serialize(self, root):\n if not root:\n return \"n\"\n s = \"\"\n stack = [root]\n while (stack):\n root = stack.pop(0)\n if root:\n s += str(ro...
[ "0.7828931", "0.7515101", "0.712925", "0.70517814", "0.7030771", "0.699828", "0.6997659", "0.6966083", "0.69326264", "0.68831754", "0.68652517", "0.68527114", "0.68081576", "0.67995906", "0.67964524", "0.67728794", "0.6764632", "0.67539173", "0.6750497", "0.67438686", "0.6664...
0.63568413
45
Test data for valid Location models
def test_data_valid_api_location(): return VALID_TEST_DATA.get("location_data")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_good_location(self):\n self.prep_location()\n # Create coords.\n self.loc.location_zip_postal = '12524'\n self.loc.save()\n coords = GEOCODE_LOCATION.get_coordinate(\n location=self.loc)\n # Test this is a reasonably valid response.\n self.assert...
[ "0.74253106", "0.69264865", "0.67893076", "0.67423314", "0.6670601", "0.66348976", "0.6541579", "0.65403587", "0.6536889", "0.6499904", "0.6492306", "0.64840037", "0.6450587", "0.64123076", "0.63949215", "0.6391408", "0.63620555", "0.636022", "0.63450354", "0.63399976", "0.63...
0.738817
1
Compute weighted salient color names feature descriptor.
def compute(self, img): descriptor = np.zeros(16) row = np.arange(img.shape[0]) col = np.arange(img.shape[1]) col, row = np.meshgrid(col, row) mu_row = img.shape[0]/2.2 mu_col = img.shape[1]/2. sigma_row = img.shape[0]/8. sigma_col = img.shape[1]/8. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_w(ss):\n features = ss.features\n labels = ss.labels\n alphas = ss.alphas\n samples, feature_num = np.shape(features)\n weights = np.zeros((feature_num, 1))\n for i in range(samples):\n weights += np.multiply(alphas[i][0] * labels[0, i], features[i, :].T)\n return weights", "d...
[ "0.58319604", "0.57102245", "0.56738794", "0.559616", "0.55934924", "0.5420995", "0.5297739", "0.5291136", "0.5282708", "0.52134615", "0.5170395", "0.5105245", "0.5048975", "0.5039162", "0.5028645", "0.5023553", "0.50177306", "0.49976647", "0.4960749", "0.49594647", "0.494365...
0.0
-1
Create labels from list and add them to the GUI.
def create_labels(self): print("creating labels here", self.names) for name in self.names: print(name) temp_label = Label(text=name) self.root.ids.main.add_widget(temp_label)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_label(self):\n for name in self.names:\n temp_label = Label(text=name)\n self.root.ids.entries_box.add_widget(temp_label)", "def create_labels(self):\n for character_name in self.character_names:\n print(character_name)\n temp_label = Label(tex...
[ "0.7828114", "0.77934366", "0.7337863", "0.71503156", "0.71239066", "0.7113103", "0.6979323", "0.69765115", "0.69738567", "0.67358124", "0.67197466", "0.660185", "0.6408173", "0.6362038", "0.63413", "0.63183093", "0.6290864", "0.6220582", "0.6182772", "0.6141478", "0.6124846"...
0.8093571
0
Move the alien right or left
def update(self): self.x += (self.ai_settings.alien_speed_factor * self.ai_settings.fleet_direction) self.rect.x = self.x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_right(self): \n pass", "def moveRight(self):\r\n self.rect.centerx += 10", "def move_right():\n self.mg_pos_x += 1 # Move for one sprite right.\n self.mg_x = self.mg_pos_x * Constants.SPRITE_DIM # Position in pixels.", "def go_right(self):\n self.x_c...
[ "0.72496164", "0.69774485", "0.69158554", "0.69001", "0.6813918", "0.6783758", "0.6783758", "0.6733168", "0.67101043", "0.6683742", "0.6678606", "0.6663552", "0.66526425", "0.66505694", "0.66367036", "0.66367036", "0.66367036", "0.6584397", "0.65415907", "0.65241367", "0.6489...
0.0
-1
Get the specified operation.
def Get(instance, database, operation): client = apis.GetClientInstance('spanner', 'v1') msgs = apis.GetMessagesModule('spanner', 'v1') ref = resources.REGISTRY.Parse( operation, params={'instancesId': instance, 'databasesId': database}, collection='spanner.projects.instances.databases.operation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_operation(operationId=None):\n pass", "def get_op(op: str):\n if op in binary_ops:\n op = binary_ops[op]\n elif op in binary_ops.values():\n pass\n else:\n raise ValueError(f\"Operation `{op}` not recognized.\")\n return xr.core.ops.get_op(op) # noqa", "def operatio...
[ "0.83835095", "0.7868039", "0.7593655", "0.7546822", "0.7508549", "0.745494", "0.745494", "0.73906684", "0.73857284", "0.73857284", "0.71815073", "0.71642745", "0.71130985", "0.70615333", "0.70390683", "0.69853413", "0.69781184", "0.6910668", "0.6810473", "0.6776971", "0.6718...
0.0
-1
Generate a list of NFO actions associated with this statement
def get_action_list(self): raise NotImplementedError('get_action_list must be implemented in BaseStatement-subclass {:r}'.format(type(self)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actions(self):\n actions = self.attributes['Actions']\n return self.formatOutput(actions)", "def action_list():\n\n rospy.loginfo(color.BOLD + color.PURPLE + '|-------------------|' + color.END)\n rospy.loginfo(color.BOLD + color.PURPLE + '| AVAILABLE ACTIONS |' + color.END)\n rospy.lo...
[ "0.71466106", "0.7051781", "0.68516266", "0.6755178", "0.66976124", "0.6684735", "0.66745627", "0.66435724", "0.6490971", "0.64808875", "0.64797455", "0.6448865", "0.6443475", "0.6433373", "0.6433373", "0.64229673", "0.6387447", "0.6387447", "0.63243175", "0.6315667", "0.6279...
0.6278623
21
Sets the latency_total of this NetworkGeneratorStats.
def latency_total(self, latency_total): self._latency_total = latency_total
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latency(self, latency):\n self._latency = latency", "def set_progress_total(self, total):\n pass", "def total(self, total):\n \n self._total = total", "def total(self, total):\n\n self._total = total", "def total(self, total):\n\n self._total = total", "def t...
[ "0.6647956", "0.59118414", "0.5834889", "0.5797812", "0.5797812", "0.5797812", "0.5797812", "0.5797812", "0.5797812", "0.57746094", "0.56631", "0.5421568", "0.5375644", "0.5364749", "0.52411234", "0.5232795", "0.52141565", "0.521004", "0.51750773", "0.51750773", "0.5134383", ...
0.8936276
0
Sets the latency_min of this NetworkGeneratorStats.
def latency_min(self, latency_min): self._latency_min = latency_min
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_min(self, min_value):\n self._min = min_value", "def latency(self, latency):\n self._latency = latency", "def duration_ms_min(self, duration_ms_min):\n\n self._duration_ms_min = duration_ms_min", "def set_norm_min(self, min_value):\n self._norm_min = min_value", "def min...
[ "0.64928234", "0.6257701", "0.6088038", "0.6026369", "0.5973659", "0.594207", "0.59374166", "0.59083134", "0.590229", "0.5801256", "0.57848984", "0.5737861", "0.5681143", "0.56687075", "0.56367415", "0.56225175", "0.5605066", "0.558897", "0.5584201", "0.55154043", "0.55154043...
0.89474285
0
Sets the latency_max of this NetworkGeneratorStats.
def latency_max(self, latency_max): self._latency_max = latency_max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_max(self, max_value):\n self._max = max_value", "def set_norm_max(self, max_value):\n self._norm_max = max_value", "def max_speed(self, value):\n self.__max_speed = value", "def set_max(self, *args, **kwargs):\n return _qtgui_swig.number_sink_sptr_set_max(self, *args, **kw...
[ "0.63461214", "0.61189264", "0.608668", "0.5993545", "0.5989043", "0.5875512", "0.58682775", "0.5866645", "0.5851666", "0.57936406", "0.5764376", "0.57381105", "0.56919116", "0.5676307", "0.5651754", "0.56367767", "0.56285363", "0.5607789", "0.55828834", "0.5559926", "0.55561...
0.88230056
0
Returns the string representation of the model
def to_str(self): return pprint.pformat(self.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_model_(self):\n return str(self)", "def __str__(self):\n\n return str(self.model)", "def get_model_string(self):\n raise NotImplementedError()", "def __str__(self):\n return self.model", "def serialize_model(self):\n return dill.dumps(self.model)", "def __str_...
[ "0.8602374", "0.85093755", "0.8237104", "0.8050309", "0.80128866", "0.79348034", "0.78766525", "0.77898884", "0.7786461", "0.7745792", "0.7627315", "0.76055235", "0.757999", "0.7514394", "0.75038797", "0.75035286", "0.74850684", "0.7440529", "0.74325883", "0.74239755", "0.740...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n return not self == other", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other):\n return self.__dict__ != other.__dict__", "def __eq__(self, other):\n return not self.__ne__(other)", ...
[ "0.8411639", "0.8393036", "0.8173086", "0.8139734", "0.8093362", "0.80898106", "0.8068739" ]
0.0
-1
Return version of the kernel running on the host associated with the 'proc' object. By default it is the local system. But one can pass a connect 'SSH' object via 'proc' in order to get the version of the kernel running on a remote system. By default this function returns the kernel version string (e.g., "4.18.1build0"...
def get_kver(split=False, proc=None): if not proc: proc = Procs.Proc() kver = proc.run_verify("uname -r")[0].strip() if split: return split_kver(kver) return kver
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_kver_bin(path, split=False, proc=None):\n\n if not proc:\n proc = Procs.Proc()\n\n cmd = f\"file -- {path}\"\n stdout = proc.run_verify(cmd)[0].strip()\n\n msg = f\"ran this command: {cmd}, got output:\\n{stdout}\"\n\n matchobj = re.match(r\".* Linux kernel.* executable .*\", stdout)\...
[ "0.7572572", "0.73049146", "0.6980764", "0.69422126", "0.69109166", "0.64486825", "0.63367647", "0.6130855", "0.5998805", "0.58841133", "0.5824729", "0.5641445", "0.55676115", "0.5551084", "0.5547706", "0.5459602", "0.5443532", "0.5421528", "0.53997046", "0.53997046", "0.5397...
0.77575433
0
Fetches belongsTo relation team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def data_source_ms_sqls_id_team_get(self, id, **kwargs): kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.data_source_ms_sqls_id_team_get_with_http_info(id, **kwargs) else: (data) = self.data_source_ms_sqls_id_team_get_with_http_info(id, **kw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def designs_id_team_get(self, id, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.designs_id_team_get_with_http_info(id, **kwargs)\n else:\n (data) = self.designs_id_team_get_with_http_info(id, **kwargs)\n return ...
[ "0.53608596", "0.5280552", "0.51307994", "0.5053002", "0.5041064", "0.49674404", "0.47715834", "0.47583807", "0.46665716", "0.46209025", "0.4607913", "0.4594139", "0.45525852", "0.45450196", "0.45417133", "0.45386952", "0.45386606", "0.4482482", "0.4458787", "0.44581246", "0....
0.5041077
4
Fetches belongsTo relation team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def data_source_ms_sqls_id_team_get_with_http_info(self, id, **kwargs): all_params = ['id', 'refresh'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def designs_id_team_get(self, id, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.designs_id_team_get_with_http_info(id, **kwargs)\n else:\n (data) = self.designs_id_team_get_with_http_info(id, **kwargs)\n return ...
[ "0.5364558", "0.5283176", "0.5135972", "0.5056609", "0.5044753", "0.50430983", "0.49725765", "0.47758478", "0.47609144", "0.4670905", "0.4625129", "0.46101683", "0.45972687", "0.4556621", "0.45495197", "0.45462105", "0.4543636", "0.4542867", "0.44832847", "0.44627348", "0.446...
0.4334675
29
Returns the current path to the DS3 Profile by checking the default location. Otherwise, returns None.
def get_ds3_profile(): appdata = os.environ.get('APPDATA') profile = appdata + '\DarkSoulsIII' if os.path.isdir(profile): for dirname, dirs, files in os.walk(profile): for file in files: if file.endswith('sl2'): return dirname return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_prov_profile(input):\n\n # check if it's a valid path first\n if os.path.exists(input):\n return os.patabspath(input)\n\n # assume it's a name of a provisioning profile\n path = provtool.path(input, path=defaults['provisioning_profile_dir'])\n\n return path", "def get_personality_...
[ "0.6797626", "0.65014035", "0.64428955", "0.639456", "0.6343769", "0.6289921", "0.6273445", "0.6179433", "0.61580795", "0.61236125", "0.61159945", "0.60901254", "0.60836154", "0.6071155", "0.6065272", "0.6031195", "0.6029757", "0.60209614", "0.60174257", "0.6011563", "0.59795...
0.74931896
0
Replaces all of the spaces in a string with %20 >>> urlify('hi my name is') 'hi%20my%20name%20is' >>> urlify('hi my name is ') 'hi%20my%20name%20is' >>> urlify('') ''
def urlify(s): without_whitespace = s.strip() split = without_whitespace.split(" ") return "%20".join(split)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urlify(string):\n\treturn string.replace(' ', '%20')", "def urlify(string):\n\tswap = []\n\tfor c in string:\n\t\tswap.append('%20') if c == ' ' else swap.append(c)\n\treturn ''.join(swap)", "def url_encode(str):\n return str.replace(' ', '%20')", "def urlify(word):\n\n # strip whitespace from both...
[ "0.87293625", "0.8315163", "0.7736689", "0.7319574", "0.7116413", "0.67558134", "0.6643693", "0.6643693", "0.6533359", "0.6357213", "0.6099885", "0.60388076", "0.598894", "0.5984581", "0.58756787", "0.58307874", "0.57209605", "0.56239665", "0.56078136", "0.5589745", "0.558207...
0.8339314
1
Generate random string with specified size and set of characters
def id_generator(size=6, chars=string.ascii_letters + string.digits): return ''.join(random.choice(chars) for _ in range(size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_random_string(size=6, chars=string.ascii_uppercase + string.digits):\n return ''.join(random.choice(chars) for _ in range(size))", "def random_string_generator(size=10, chars=string.ascii_lowercase + string.digits):\n\n return ''.join(random.choice(chars) for _ in range(size))", "def create_ra...
[ "0.86172754", "0.86004925", "0.8544733", "0.8530209", "0.84865683", "0.84706205", "0.83320975", "0.8315243", "0.831383", "0.8266869", "0.82087225", "0.8096916", "0.79614735", "0.79455626", "0.79196197", "0.7892149", "0.7870381", "0.7848168", "0.78420514", "0.78374726", "0.776...
0.7789272
20
Fake get_provider method to mirror the IBMQ provider.
def get_provider(self, hub=None, group=None, project=None): return self.fake_provider
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mock_provider(self):\n self.provider.register_retriever(MockRetriever)\n assert len(self.provider.retrievers) == 1\n assert isinstance(self.provider.get(\"mock:http://example.com\"), Task)\n assert TestProvider.retriever_initialized\n assert TestProvider.get_called", "...
[ "0.6423343", "0.63664937", "0.63207287", "0.6278161", "0.60767573", "0.5922156", "0.58756363", "0.5738173", "0.5701176", "0.5696144", "0.5658141", "0.55940604", "0.559067", "0.5586963", "0.55552024", "0.54694986", "0.54694986", "0.5453475", "0.5435523", "0.5394427", "0.538698...
0.59835505
5
Calculates the average test duration in nanoseconds.
def __average_duration(self, test: Test) -> int: # Find whether this test has ever been successful. if any(not t.failed for t in self.__test_results[test.id]): candidates = filter( lambda t: not t.failed, self.__test_results[test.id] ) else...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_duration(self):\n\n durations = []\n\n for trip_id in self.trip_sample:\n\n start = self.trip_coll.find_one({\n 'trip_start': 1,\n 'trip_id_iso' : trip_id\n })\n\n end = self.trip_coll.find_one({\n 'trip_end...
[ "0.70876515", "0.6873271", "0.6663502", "0.64688694", "0.64688694", "0.64158386", "0.63927454", "0.6372806", "0.63709325", "0.6302407", "0.6302407", "0.6267813", "0.62471867", "0.61504203", "0.61243886", "0.6090381", "0.60578203", "0.6021824", "0.6012851", "0.60076016", "0.59...
0.7467218
0
This function takes a list of responses, finds the section in which the questions came from, then returns a boolean if they amount of responses matches the amount of total questions in all of the sections
def __response_count_matches_question_count(response_list): total_responses = len(response_list) question_count = 0 sections_set = set() #For each response, add the section id from each question to the set for response in response_list: sections_set.add(response.question.section.id) #C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_contains_query(query_list, response):\n counter = 0\n for i in range(0, len(response)):\n for item in query_list:\n if item in response[i]:\n counter += 1\n else:\n print(f'{item} not in {response[i]}')\n break\n\n if c...
[ "0.6457776", "0.6285348", "0.58145034", "0.5804851", "0.5787198", "0.5743608", "0.5661944", "0.56398225", "0.56252766", "0.562025", "0.5595922", "0.557757", "0.55477214", "0.5546092", "0.55344415", "0.5523856", "0.5519493", "0.5504635", "0.5482391", "0.54820853", "0.54817766"...
0.8176897
0
Convert a quaternion into euler angles (roll, pitch, yaw) roll is rotation around x in radians (counterclockwise) pitch is rotation around y in radians (counterclockwise) yaw is rotation around z in radians (counterclockwise) inputs is a string of either the gv or robotic arm 'GV' or 'AR2' outputs the eular rotation
def quat2eul(self,robot): orientationQuat = self.RigidBodyOrientation[robot] w = 0 x = 0 y = 0 z = 0 # here we need to take the self.RigidBodyOrientation['GV'] and convert it to the w x y and z variables # w is scalar part, t0 = +2.0 * (w * x + y * z)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quaternion_to_euler_angle(self,w, x, y, z):\n ysqr = y * y\n\n t0 = +2.0 * (w * x + y * z)\n t1 = +1.0 - 2.0 * (x * x + ysqr)\n roll = math.atan2(t0, t1)\n\n t2 = +2.0 * (w * y - z * x)\n t2 = +1.0 if t2 > +1.0 else t2\n t2 = -1.0 if t2 < -1.0 else t2\n p...
[ "0.7651407", "0.7493343", "0.7493343", "0.7458839", "0.7383601", "0.7290698", "0.72558534", "0.72558534", "0.7208498", "0.7152329", "0.71491426", "0.71491426", "0.7145874", "0.7145874", "0.7108893", "0.7108893", "0.7059057", "0.7039396", "0.70150447", "0.7003506", "0.69952345...
0.7686633
0
Computes IUO between two bboxes in the form [x1,y1,x2,y2]
def iou(bb_test, bb_gt): xx1 = np.maximum(bb_test[0], bb_gt[0]) yy1 = np.maximum(bb_test[1], bb_gt[1]) xx2 = np.minimum(bb_test[2], bb_gt[2]) yy2 = np.minimum(bb_test[3], bb_gt[3]) w = np.maximum(0., xx2 - xx1) h = np.maximum(0., yy2 - yy1) wh = w * h o = wh / ((bb_test[2] - bb_test[0]) * (bb_test[3] - ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bboxes_iou(bboxes1, bboxes2):\r\n bboxes1 = np.transpose(bboxes1)\r\n bboxes2 = np.transpose(bboxes2)\r\n # Intersection bbox and volume.\r\n int_ymin = np.maximum(bboxes1[0], bboxes2[0])\r\n int_xmin = np.maximum(bboxes1[1], bboxes2[1])\r\n int_ymax = np.minimum(bboxes1[2], bboxes2[2])\r\n ...
[ "0.80237275", "0.78294206", "0.7803376", "0.7545863", "0.749703", "0.7459484", "0.7458796", "0.74476355", "0.73921514", "0.7381288", "0.7358189", "0.73042524", "0.7270188", "0.72238827", "0.721511", "0.7190565", "0.7189651", "0.7184271", "0.7184271", "0.7180109", "0.71794593"...
0.0
-1
Takes a bounding box in the form [x1,y1,x2,y2] and returns z in the form [x,y,s,r] where x,y is the centre of the box and s is the scale/area and r is the aspect ratio
def convert_bbox_to_z(bbox): w = bbox[2] - bbox[0] h = bbox[3] - bbox[1] x = bbox[0] + w/2. y = bbox[1] + h/2. s = w * h #scale is just area r = w / float(h) return np.array([x, y, s, r]).reshape((4, 1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box(x, y, z):\n return min(x), min(y), min(z), max(x), max(y), max(z)", "def convert_bbox_to_z(bbox):\n w = bbox[2] - bbox[0]\n h = bbox[3] - bbox[1]\n x = bbox[0] + w/2.\n y = bbox[1] + h/2.\n s = w * h #scale is just area\n r = w / float(h)\n return np.array([x, y, s, r]...
[ "0.76300865", "0.699531", "0.6943961", "0.6908756", "0.67753226", "0.6597057", "0.65082705", "0.64904374", "0.6482547", "0.64431685", "0.6344998", "0.6335352", "0.6301382", "0.6247066", "0.6217086", "0.6204247", "0.61998606", "0.61998606", "0.6196471", "0.61780936", "0.616574...
0.7070731
2
Takes a bounding box in the centre form [x,y,s,r] and returns it in the form [x1,y1,x2,y2] where x1,y1 is the top left and x2,y2 is the bottom right
def convert_x_to_bbox(x,score=None): w = np.sqrt(x[2] * x[3]) h = x[2] / w if(score==None): return np.array([x[0]-w/2.,x[1]-h/2.,x[0]+w/2.,x[1]+h/2.]).reshape((1,4)) else: return np.array([x[0]-w/2.,x[1]-h/2.,x[0]+w/2.,x[1]+h/2.,score]).reshape((1,5))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_bounding_box(s, centerx=0, centery=0):\n # result must be in the form: (left, bottom, right, top)\n return [ centerx - s/2, centery - s/2, centerx + s/2, centery + s/2 ]", "def bounding_box(self):\r\n\r\n return [(self.x + 10, self.y + 10),\r\n (self.x - 10, self.y + 10),\r\n...
[ "0.79085356", "0.7730993", "0.7326813", "0.7296002", "0.7243781", "0.7099447", "0.7058188", "0.70319843", "0.70178014", "0.6989209", "0.69779575", "0.69750994", "0.69668114", "0.69647026", "0.69557405", "0.6955099", "0.6941528", "0.68694353", "0.6837753", "0.6825664", "0.6818...
0.0
-1
Initializes a CrispOverlap object with the given parameters.
def __init__( self, graph, covers, modularities=None, optimal_count=None, modularity_measure="lazar", ): # Possibly figure out a better data structure like a merge # list that contains all information needed? # So far only know of Lazar's meas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, overlap_threshold=1.0):\n self.__overlap_threshold = overlap_threshold\n\n # pylint happiness block\n self.overlap_map = None\n self.spread_map = None\n self.ovstats_map = None", "def __init__(self, lbound, rbound):\n\n self._lbound = lbound\n s...
[ "0.67232484", "0.5819661", "0.5749935", "0.57362586", "0.5689233", "0.5666964", "0.5618719", "0.55841607", "0.5567156", "0.55619127", "0.55518866", "0.55470043", "0.553845", "0.5459188", "0.5457148", "0.5455034", "0.5449351", "0.54469746", "0.54306227", "0.54243374", "0.54140...
0.0
-1
Returns True when there is at least one cover in the list.
def __bool__(self): return bool(self._covers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsCoverPhotoSet(self):\r\n if self.cover_photo is not None:\r\n assert len(self.cover_photo) > 0, self\r\n return True\r\n return False", "def is_edge_cover(G, cover):\n return set(G) <= set(chain.from_iterable(cover))", "def covers(self, target_imp, f):\n for implicant in self.se...
[ "0.74266094", "0.6621813", "0.6570138", "0.6233444", "0.6217072", "0.6177829", "0.6164582", "0.5942103", "0.59367937", "0.5912879", "0.590699", "0.59000933", "0.5870103", "0.5866166", "0.5857154", "0.58242005", "0.58033264", "0.5786034", "0.5779829", "0.57688427", "0.5739292"...
0.6891087
1
Returns a string representation of the list of covers.
def __str__(self): return "{0} vertices in {1} possible covers.".format( len(self._graph.vs), len(self._covers) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return '[{}]'.format(', '.join(map(str, self.cards)))", "def __str__(self):\r\n impreso = \"\"\r\n for level in reversed(range(self.size())):\r\n impreso+=(self.discs[0]-self.discs[level])*\".\"+self.discs[level]*\"#\"+\"|\"+self.discs[level]*\"#\"+(self.discs...
[ "0.62402016", "0.6142451", "0.6005129", "0.5999859", "0.5966226", "0.59580266", "0.59371525", "0.58612067", "0.58436805", "0.5839166", "0.5817419", "0.57791394", "0.5776824", "0.57681376", "0.57517594", "0.5742739", "0.5699143", "0.5685541", "0.5674175", "0.56616455", "0.5621...
0.7182644
0
Returns the optimal number of clusters for this dendrogram. If an optimal count hint was given at construction time and recalculate_modularities has not been called, this property simply returns the hint. If such a count was not given, this method calculates the optimal cover by maximizing the modularity along all poss...
def optimal_count(self): if self._optimal_count is not None: return self._optimal_count else: modularities = self.modularities self._optimal_count = max( list(modularities.items()), key=operator.itemgetter(1) )[0] return self._o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMaxClustersCount(self): # real signature unknown; restored from __doc__\n pass", "def get_n_clusters(self) :\n return self.n_clusters", "def _numClusters(self, numFrames):\n import numpy as np\n K = int(max(np.round(0.6 * np.log10(numFrames / 1000) * 1000 + 50), 100)) # heur...
[ "0.64120483", "0.6234644", "0.6130191", "0.59260947", "0.5791805", "0.5780607", "0.5621067", "0.55630386", "0.55443084", "0.5502003", "0.54327726", "0.5391734", "0.5354503", "0.5345422", "0.53240067", "0.5318666", "0.5308641", "0.52894783", "0.52852976", "0.52852976", "0.5229...
0.6469748
0
Given a matrix, find an index of the minimum value (not including the diagonal).
def mat_min(M): # take a matrix we pass in, and fill the diagonal with the matrix max. This is # so that we don't grab any values from the diag. np.fill_diagonal(M, float("inf")) # figure out the indices of the cell with the lowest value. i, j = np.unravel_index(M.argmin(), M.shape) np.fill_dia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_min(mtx):\n\tminIdx = argmin(mtx)\n\treturn unravel_index(minIdx, mtx.shape)", "def matrix_min(mat):\n # Currently, this function is unused, as its result is\n # the same as that of mat_min, and it is not always\n # faster. Left in for reference in case mat_min becomes\n # a bottleneck.\n\n...
[ "0.85468316", "0.83662283", "0.7579216", "0.7300321", "0.69074297", "0.69053245", "0.68932205", "0.681604", "0.6815339", "0.67865354", "0.67195123", "0.6659997", "0.66379565", "0.6637133", "0.6596772", "0.65739375", "0.6553256", "0.65517926", "0.6526689", "0.6488828", "0.6434...
0.8522574
1
Test if adding a project works properly.
def test_add_project(self): test_project_name = "test_project" pr.add_project(test_project_name, TEST_DATA_DICT) # Check if the project name is indeed present in the config file test_dict = pr.get_default_specfile(test_project_name) self.assertTrue(test_dict, TEST_DATA_DICT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_remove_project(self, *args):\n self.manager.start_manager()\n\n self.manager.add_project(self.project_public_id, local=True)\n\n assert self.project_public_id in self.manager.list_projects()\n assert os.path.exists(self.project_path)\n\n with pytest.raises(ValueError...
[ "0.79346067", "0.7839439", "0.7751147", "0.7401165", "0.7372094", "0.73602766", "0.7310647", "0.7205415", "0.71047574", "0.7076033", "0.70335245", "0.7003472", "0.694529", "0.6920691", "0.69090605", "0.68819964", "0.685358", "0.6842783", "0.6822649", "0.67988634", "0.6788406"...
0.76651525
3
Test if the minimum rules work when data contains NaNs.
def test_min_nan(self): s = pd.Series(np.random.rand(10,)) s.loc[3] = np.nan schema = {'data': {'header': None, 'column_rules': {'0': {'min': 0.2}}}} with DummyProjectFactory(schema, s) as project: df = project.load_dataset("data") self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_min_dropna_on_cols(self):\n x1 = np.random.rand(10, 2) / 10\n x2 = np.random.rand(10, 2)\n x = np.r_[x1, x2]\n np.random.shuffle(x)\n df = pd.DataFrame(x, columns=\"col_a col_b\".split())\n df.loc[3, \"col_a\"] = np.nan\n df.loc[7, \"col_b\"] = np.nan\n ...
[ "0.7179743", "0.67781293", "0.66181517", "0.6521293", "0.63769126", "0.636887", "0.6366822", "0.63477176", "0.6300615", "0.62234324", "0.6209663", "0.61788756", "0.6176679", "0.61241674", "0.61089444", "0.60814214", "0.6064333", "0.6060457", "0.6043873", "0.6033288", "0.60219...
0.8161828
0
Test if specifying a minimum value for a column also drops the NaNs.
def test_min_dropna_on_cols(self): x1 = np.random.rand(10, 2) / 10 x2 = np.random.rand(10, 2) x = np.r_[x1, x2] np.random.shuffle(x) df = pd.DataFrame(x, columns="col_a col_b".split()) df.loc[3, "col_a"] = np.nan df.loc[7, "col_b"] = np.nan schema = {'data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_min_nan(self):\n s = pd.Series(np.random.rand(10,))\n s.loc[3] = np.nan\n schema = {'data': {'header': None,\n 'column_rules': {'0': {'min': 0.2}}}}\n with DummyProjectFactory(schema, s) as project:\n df = project.load_dataset(\"data\")\n ...
[ "0.79468256", "0.6873375", "0.66366684", "0.64871186", "0.62411803", "0.61490184", "0.60486066", "0.5889734", "0.58749646", "0.586273", "0.58511573", "0.5802964", "0.579828", "0.5793265", "0.5787593", "0.5781031", "0.57730865", "0.5761571", "0.5756683", "0.5748813", "0.574552...
0.77521044
1
Test if the specified index column is added to the usecols argument.
def test_indexcol_not_in_usecols(self): df = pd.read_csv(self.data_specs['iris']['path']) schema = {'data': {'index_col': 'Species', 'use_columns': ['Sepal Length', 'Petal Width']}} with DummyProjectFactory(schema, df) as project: df = project.load_dataset(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_valid_column(self, col_index):\n col = self._data[:, col_index]\n return Sudoku._is_valid_data(col)", "def _has_cols(trj: TrajaDataFrame, cols: list):\n return set(cols).issubset(trj.columns)", "def _is_valid_col_idx(self, cls_idx, col_idx, show_warning=True):\n assert(cls_idx <...
[ "0.64859265", "0.6397459", "0.59861284", "0.59273845", "0.58820826", "0.58754563", "0.5859035", "0.58040935", "0.5802309", "0.57325476", "0.57021147", "0.5684456", "0.56299466", "0.5522007", "0.5503508", "0.55034304", "0.5470958", "0.5461139", "0.5429543", "0.53930783", "0.53...
0.6224934
2
Test if excel spreadsheets are read properly from the schema.
def test_load_excel(self): xl_project = pr.Project("test_excel") ideal_iris = self.project.load_dataset("iris") actual_iris = xl_project.load_dataset("iris") self.assertDataFrameEqual(ideal_iris, actual_iris)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_sheetname():\n with pytest.raises(KeyError):\n io.xlsx_table(filename, 1, None)", "def test_extract_worksheet_data_not_in_workbook(self):\n print(\"@test_extract_worksheet_data_not_in_workbook\")\n # arrange\n url_str = \"https://assets.publishing.service.gov.uk/gove...
[ "0.67798764", "0.66100353", "0.6450677", "0.6336973", "0.63368154", "0.62749773", "0.6253447", "0.6224665", "0.6211187", "0.6200789", "0.61987376", "0.6193408", "0.61846447", "0.61807615", "0.6135889", "0.6118894", "0.6080759", "0.60764277", "0.607161", "0.60449", "0.6019982"...
0.6224239
8
Test if the NA representations are parsed properly.
def test_na_reps(self): project = pr.Project("pysemantic") loaded = project.load_dataset("bad_iris") self.assertItemsEqual(loaded.shape, (300, 5))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ans_parser(self):\n self.none_existence(True)", "def _check_null_values(data: str) -> bool:\n not_valid = data in NULL_VALUES or pd.isna(data)\n return bool(not_valid)", "def isna(value):\n\treturn (value is None) or (value is np.nan) or (value != value) or (str(value) == '')", "def any...
[ "0.65304804", "0.64156276", "0.63915545", "0.63848513", "0.63730025", "0.6356142", "0.6256757", "0.59899014", "0.59367484", "0.5933353", "0.5927452", "0.5907133", "0.5877942", "0.58776134", "0.58522296", "0.5832991", "0.5832534", "0.5825554", "0.57887274", "0.5780115", "0.575...
0.0
-1
Test is specifying a global NA value for a dataset works.
def test_global_na_reps(self): df = pd.DataFrame(np.random.rand(10, 10)) ix = np.random.randint(0, df.shape[0], size=(5,)) ix = np.unique(ix) for i in xrange(ix.shape[0]): df.iloc[ix[i], ix[i]] = "foobar" schema = {"data": {'na_values': "foobar", 'da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_na():\n assert check_na(data_df) == 1", "def na_value():\n return None", "def none_missing(data):\n if np.isnan(data).any():\n raise TimekeepCheckError(\"none_missing: data contains NaN values\")", "def na_value():\n return pd.NA", "def test_input_contains_all_missingvalues():\n...
[ "0.7512806", "0.6947426", "0.69024736", "0.68600035", "0.674168", "0.6575638", "0.6484304", "0.6399565", "0.63898", "0.6381343", "0.63305736", "0.63261986", "0.6297292", "0.62936527", "0.6258537", "0.62265444", "0.61992335", "0.6189275", "0.6185139", "0.6176347", "0.6163597",...
0.75718814
0
Round a datetime object to any time lapse in seconds
def round_time(date_time=None, round_to=60): if date_time is None: date_time = datetime.now() seconds = (date_time.replace(tzinfo=None) - date_time.min).seconds rounding = (seconds + round_to / 2) // round_to * round_to return date_time + timedelta(0, rounding - seconds, - date_time.microsecond)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_time(t,round_s=1):\n t0 = datetime.datetime(t.year,1,1)\n foo = t - t0\n foo_s = foo.days*24*3600 + foo.seconds + foo.microseconds*(1e-6)\n foo_s = np.round(foo_s/round_s)*round_s\n days = np.floor(foo_s/24/3600)\n seconds = np.floor(foo_s - 24*3600*days)\n microseconds = int(1e6*(fo...
[ "0.73672354", "0.7051939", "0.70084596", "0.70072883", "0.7005688", "0.6875829", "0.6829814", "0.6793587", "0.6789686", "0.67785764", "0.65837467", "0.6488375", "0.64099723", "0.6394375", "0.6309841", "0.6263163", "0.6257552", "0.6257552", "0.6240772", "0.62384516", "0.621610...
0.69084054
5
Helper function to access an Exception's message.
def exception_message(exc): return exc.message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exception_message(exc):\n return exc.args[0]", "def _extract_error_message(cls, ex: Exception) -> str:\n return utils.error_msg_from_exception(ex)", "def extract_message(self, exc_info):\n exception = exc_info[1]\n # get the custom message, if defined\n try:\n ...
[ "0.8139608", "0.76014566", "0.75158095", "0.7498405", "0.7480828", "0.733797", "0.7282056", "0.7039638", "0.70341945", "0.696134", "0.6894664", "0.685056", "0.6708579", "0.66537225", "0.6638287", "0.662358", "0.662358", "0.660841", "0.65729994", "0.65722406", "0.6556925", "...
0.8433264
0
Helper function to access and Exception's message.
def exception_message(exc): return exc.args[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exception_message(exc):\n return exc.message", "def _extract_error_message(cls, ex: Exception) -> str:\n return utils.error_msg_from_exception(ex)", "def extract_message(self, exc_info):\n exception = exc_info[1]\n # get the custom message, if defined\n try:\n ...
[ "0.84763235", "0.7666401", "0.7605037", "0.7408975", "0.73963547", "0.73745745", "0.7244226", "0.7210792", "0.7198802", "0.71833926", "0.7162562", "0.7123352", "0.7006278", "0.7006278", "0.6992835", "0.696828", "0.69303614", "0.69157076", "0.6893434", "0.6888844", "0.6887604"...
0.8134984
1
Create a new AES object.
def createAES(key, IV, implList=None): if implList == None: implList = ["cryptlib", "openssl", "pycrypto", "python"] for impl in implList: if impl == "cryptlib" and cryptomath.cryptlibpyLoaded: return Cryptlib_AES.new(key, 2, IV) elif impl == "openssl" and cryptomath.m2crypt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_aes(self, iv):\n sha = SHA256.new()\n sha.update(PASSWORD.encode())\n key = sha.digest()\n return AES.new(key, AES.MODE_CFB, iv)", "def __init__(self, key, iv, do, ciphername='aes-256-cbc'):\n self.cipher = OpenSSL.get_cipher(ciphername)\n self.ctx = OpenSSL.E...
[ "0.7329991", "0.67389935", "0.6355148", "0.6192046", "0.6125723", "0.5922422", "0.5907349", "0.5862711", "0.5845862", "0.5768251", "0.5730972", "0.57152444", "0.57139784", "0.5608038", "0.55832815", "0.5563161", "0.55561656", "0.55077267", "0.5505043", "0.54996574", "0.549634...
0.681759
1
Create a new 3DES object.
def createTripleDES(key, IV, implList=None): if implList == None: implList = ["cryptlib", "openssl", "pycrypto"] for impl in implList: if impl == "cryptlib" and cryptomath.cryptlibpyLoaded: return Cryptlib_TripleDES.new(key, 2, IV) elif impl == "openssl" and cryptomath.m2cryp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init_crypt(self):\r\n from third import pyDes\r\n self.crypt = pyDes.des(\"DESCRYPT\", pyDes.CBC, \"\\0\\0\\0\\0\\0\\0\\0\\0\",\\\r\n pad=None, padmode=pyDes.PAD_PKCS5)", "def New(*args, **kargs):\n obj = itkSparseFieldLayerNBNID3.__New_orig__()\n import itkTempla...
[ "0.62511104", "0.58367133", "0.5712872", "0.57053775", "0.56945324", "0.56466836", "0.55962795", "0.55601066", "0.55601066", "0.550047", "0.54826564", "0.5468852", "0.54560596", "0.5436009", "0.543219", "0.54215544", "0.5407466", "0.54064655", "0.5371529", "0.53542495", "0.53...
0.5870261
1
Converts Cartesian to Cylindrical
def cart2cyl(cls, x: float, y: float, z: float) -> Sequence[float]: return cls.from_cartesian(x, y, z)[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cylindrical(self):\n # TODO: if representations are updated to use a full transform graph,\n # the representation aliases should not be hard-coded like this\n return self.represent_as(\"cylindrical\", in_frame_units=True)", "def cart_to_cyl(x,y,z,vx,vy,vz):\n r, theta, z = bovy_...
[ "0.72350717", "0.6965944", "0.694039", "0.67708457", "0.6629755", "0.6529527", "0.6490721", "0.64343596", "0.64228976", "0.6356581", "0.6259597", "0.6241747", "0.6179475", "0.6177109", "0.61739993", "0.6122461", "0.6073028", "0.6010506", "0.5936517", "0.59235555", "0.59193546...
0.69401973
3
Converts Cylindrical to Cartesian
def cyl2cart(cls, polar_radius: float, polar_angle: float, z: float) -> Sequence[float]: return cls.from_cylindrical(polar_radius, polar_angle, z)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_cartesian(self) -> None:\n if self.is_direct():\n self.coordinate_type = \"Cartesian\"\n mat = self.cell_vecs.transpose()\n self.positions = [mat.dot(v) for v in self.positions]", "def toCartesian(ra, dec):\n x = cos(radians(ra)) * sin(radians(90 - dec))\n y =...
[ "0.7274119", "0.71756536", "0.6994594", "0.6908977", "0.68090034", "0.6779968", "0.6748552", "0.6696632", "0.6643341", "0.66352874", "0.66216487", "0.65954363", "0.6555756", "0.6518502", "0.64677", "0.64524347", "0.6429173", "0.6407603", "0.64004076", "0.6382615", "0.63561636...
0.5685055
90
Returns a list of words that describe number
def get_words(number): words = [] hundreds = 0 if number >= 1000: thousands = number / 1000 number %= 1000 words += get_words(thousands) + ['thousand'] if number >= 100: hundreds = number / 100 number %= 100 words += [(WORDS[hundreds]), 'hundred'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_to_words(n):\r\n nw = {\"0\":\"Zero\", \"1\":\"one\", \"2\":\"Two\", \"3\":\"Three\", \"4\":\"Four\", \"5\":\"Five\", \"6\":\"six\", \"7\":\"Seven\", \"8\":\"Eight\", \"9\":\"Nine\"}\r\n words = []\r\n n = str(n)\r\n for i in n :\r\n \twords.append(nw[i])\r\n return \" \".join(words)", "def getWord...
[ "0.6849221", "0.6848659", "0.6844507", "0.6650587", "0.66208017", "0.6599345", "0.6544606", "0.64272994", "0.6398796", "0.63443124", "0.6332954", "0.6290112", "0.6268405", "0.62601787", "0.6239544", "0.62008935", "0.6189182", "0.61646515", "0.6159429", "0.6152056", "0.6129767...
0.7435193
0
Given a train batch from a batch generator, return the appropriate feed_dict to pass to the model during training.
def _get_train_feed_dict(self, batch): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_validation_feed_dict(self, batch):\n raise NotImplementedError", "def create_feed_dict(self, input_batch, dropout=1):\n feed_dict = { \n self.sent_input_placeholder: input_batch[\"sent\"],\n self.char_input_placeholder: input_batch[\"char\"],\n self.n_gram_...
[ "0.75156105", "0.731913", "0.72959566", "0.729239", "0.7233465", "0.7130795", "0.70279944", "0.69871026", "0.696945", "0.69132394", "0.68392164", "0.6815801", "0.6815426", "0.6791593", "0.6783097", "0.673475", "0.67245686", "0.65761536", "0.65465146", "0.6545987", "0.65165585...
0.8091419
0
Funzione per caricare le bounding box in formato DarkNet
def darknet_bbox(file, height, width, padding=0): with open(file, 'r') as f: vals = [] for line in f: nums = line.split() for num in nums: vals.append(num) ndarray = np.array(vals, dtype=np.longfloat) ndarray = ndarray[ndarray > 0] k =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box(self):\r\n pass", "def drawbox(img,bbox):\n return img", "def show_bboxes(img, bounding_boxes, facial_landmarks=[]):\n\n img_copy = np.copy(img)\n\n for b in bounding_boxes:\n x1, y1, x2, y2 = int(b[0]), int(b[1]), int(b[2]), int(b[3])\n cv2.rectangle(img_copy,(x1...
[ "0.75167656", "0.69521403", "0.69087034", "0.68685496", "0.68656385", "0.68584484", "0.6791005", "0.67752045", "0.67346746", "0.6732469", "0.67290694", "0.6720846", "0.666805", "0.66451716", "0.664253", "0.66407835", "0.6639975", "0.66024655", "0.65945745", "0.6576006", "0.65...
0.6755011
8
Get a onetime snapshot look at the object.
def queryObjectAll(self, doId, context=0): assert self.notify.debugStateCall(self) # Create a message datagram = PyDatagram() datagram.addServerHeader( doId, self.ourChannel, STATESERVER_QUERY_OBJECT_ALL) # A context that can be used to index the response i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_snapshot(self, snapshot):\n return self._get(_snapshot.Snapshot, snapshot)", "def get_instance_snapshot(instanceSnapshotName=None):\n pass", "def get_snapshot(s, warp=math.log):\n dist = s.get_distance()\n cost = s.cost_distance(dist)\n vals = s.get_values()\n retu...
[ "0.69224024", "0.6640857", "0.63330406", "0.6152858", "0.6130765", "0.60662013", "0.59312445", "0.5926868", "0.59124964", "0.5904757", "0.5889355", "0.58691907", "0.58122295", "0.5746128", "0.5696092", "0.5630327", "0.5608669", "0.5606622", "0.5576023", "0.55383855", "0.55230...
0.0
-1
Get a onetime snapshot look at the object.
def queryObjectFieldId(self, doId, fieldId, context=0): assert self.notify.debugStateCall(self) # Create a message datagram = PyDatagram() datagram.addServerHeader( doId, self.ourChannel, STATESERVER_OBJECT_QUERY_FIELD) datagram.addUint32(doId) data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_snapshot(self, snapshot):\n return self._get(_snapshot.Snapshot, snapshot)", "def get_instance_snapshot(instanceSnapshotName=None):\n pass", "def get_snapshot(s, warp=math.log):\n dist = s.get_distance()\n cost = s.cost_distance(dist)\n vals = s.get_values()\n retu...
[ "0.69206524", "0.66407275", "0.63326114", "0.6151672", "0.6129429", "0.6065088", "0.5930824", "0.5928927", "0.59124774", "0.590532", "0.58900195", "0.5871009", "0.58123046", "0.57459646", "0.56957304", "0.56299186", "0.5609034", "0.5605797", "0.5576627", "0.5537278", "0.55220...
0.0
-1
Stores the vote that was place by the user
def insert_vote(): accid = find_accid() # gets an id # Prepare INSERT statement prep_insert = "INSERT INTO votes (accId, candidate, polParty) VALUES (%s, %s, %s)" # A tuple should always be used to bind placeholders (%s) cursor.execute(prep_insert, (accid, can, party[0])) db.commit() # save...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_vote(self):\n save_vote_query = \"\"\"\n INSERT INTO votes(user_id, question_id) VALUES(\n '{}', '{}'\n )\"\"\".format(self.user_id, self.question_id)\n\n db.query_data_from_db(save_vote_query)", "def vote( self, user_id, answer_id, vote ):\n \"\"\"up and down...
[ "0.75042176", "0.67503613", "0.6663193", "0.65433156", "0.6462809", "0.64089656", "0.61910915", "0.6183718", "0.6177704", "0.61430794", "0.6065796", "0.6043722", "0.5928848", "0.5847029", "0.5839898", "0.5831636", "0.58116907", "0.5792204", "0.5790603", "0.5789816", "0.573979...
0.6060799
11
This function converts a DataFrame to a csv file.
def df_to_csv(csv_path, df): try: df_rename(df) df.to_csv(csv_path, index=False) except: logging.error("exception occurred", exc_info=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def df2CSV(df: pd.DataFrame, path: str, fileName: str, timestamp: str):\n file = '%s%s_%s.csv' % (path, timestamp, fileName)\n df.to_csv(file)\n print(\"Saved results to: %s\" % file)", "def output_csv(df: pd.DataFrame, output_data_path: str):\n os.makedirs(os.path.dirname(output_data_path), exist_ok...
[ "0.8065036", "0.8062222", "0.8050293", "0.79578173", "0.7954013", "0.79006404", "0.7892515", "0.78757846", "0.7857242", "0.7840081", "0.78074807", "0.7662504", "0.7582365", "0.75814664", "0.75710857", "0.7568996", "0.75676334", "0.75184184", "0.75163037", "0.75107944", "0.747...
0.73722214
24
The input should be between [0,1] output is [0,255] in a unsigned byte array
def bytescale(im): imout = (im*255).astype('u1') return imout
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_uint8(chan: np.ndarray):\n # Normalize sample\n chan = 0.25 * (chan - chan.mean()) / (chan.std() + K.epsilon())\n # Clip to [0, 1]\n chan = np.clip(chan + 0.5, 0, 1)\n # Convert to uint8\n return np.clip(chan * 255, 0, 255).astype(np.uint8)", "def Binary(arr):\n ...
[ "0.6909757", "0.6599344", "0.6452649", "0.63738775", "0.63534015", "0.63398826", "0.6279751", "0.6242926", "0.6165818", "0.61516994", "0.6103267", "0.6087646", "0.60806316", "0.60736257", "0.6012211", "0.6003997", "0.5995303", "0.59881985", "0.595967", "0.5952557", "0.591917"...
0.60686713
14
Resize an array to larger shape, simply duplicating values.
def boost( a, factor): factor=int(factor) if factor < 1: raise ValueError("boost factor must be >= 1") newshape=np.array(a.shape)*factor slices = [ slice(0,old, float(old)/new) for old,new in zip(a.shape,newshape) ] coordinates = np.mgrid[slices] indices = coordinates.astype('i') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resize(self, c): # nonpublic utitity\n B = self._make_array(c) # new (bigger) array\n for k in range(self._n): # for each existing value\n B[k] = self._A[k]\n self._A = B # use the bigger array\n self._capacity = c", "def _resize(self, new_c):\n b = self._create...
[ "0.70467", "0.6614172", "0.6489368", "0.64782083", "0.6453457", "0.64311016", "0.6339259", "0.63062006", "0.62431985", "0.6237574", "0.6227919", "0.6224562", "0.6191038", "0.61666554", "0.6142532", "0.6128892", "0.61113876", "0.60955906", "0.6094967", "0.60884625", "0.6020381...
0.0
-1
Draw this polygon using the scene to project it into the rendered 2D space.
def draw(self): is_facing_camera = reduce(lambda acc, pt: acc or pt.is_facing_camera, self.points, False) if not is_facing_camera: return base = self.__find_base(self.points) point_coords = map(lambda p: p.coordinates, self.points) point_transformation = m3.find_tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DrawPolygon(self, *args, **kwargs):\n return _Box2D.b2DrawExtended_DrawPolygon(self, *args, **kwargs)", "def draw(self):\n glColor3f(0.0,0.0,1.0)\n pyglet.graphics.draw( len(self.vertices) / 2, pyglet.gl.GL_POINTS, ('v2f', self.vertices ))\n glColor3f(0.0,1.0,0.0)\n pyglet....
[ "0.6650223", "0.66253626", "0.6596585", "0.64794666", "0.64775556", "0.64659023", "0.633216", "0.63316315", "0.63216037", "0.6156041", "0.6133397", "0.6127795", "0.6044315", "0.60103655", "0.59674615", "0.59648716", "0.59496063", "0.593898", "0.58595467", "0.58518076", "0.582...
0.63182706
9
Converts a dict or list of Python data into a dict of numpy arrays.
def numpify(xs, pad=0, keys=None, dtypes=None): is_dict = isinstance(xs, dict) xs_np = {} if is_dict else [0] * len(xs) xs_iter = xs.items() if is_dict else enumerate(xs) for i, (key, x) in enumerate(xs_iter): if keys is None or key in keys: shape = get_list_shape(x) if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_list_to_dict_np(input_dict):\n input_dict = copy.copy(input_dict)\n if type(input_dict) is dict:\n for name in list(input_dict.keys()):\n input_dict.update({name: np.array(input_dict[name])})\n return input_dict\n else:\n return np.array(input_dict)", "def json_n...
[ "0.7206395", "0.70750153", "0.7039311", "0.6987565", "0.68755007", "0.67813903", "0.67009556", "0.6683948", "0.66455567", "0.66175973", "0.65505064", "0.65404123", "0.65166056", "0.6491396", "0.6467938", "0.6419776", "0.6413127", "0.641289", "0.6412008", "0.6352253", "0.62827...
0.52999556
94
3x3 floating matrix type.
def mat3(*args): return _gen_matrix(3, *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, *args) -> \"float const &\":\n return _itkMatrixPython.itkMatrixF33___call__(self, *args)", "def float(self):\n return array_funcs.cast(self, 'float32', False)", "def float_(self):\n return array_funcs.cast(self, 'float32', True)", "def __call__(self, *args) -> \"float const &...
[ "0.61989844", "0.6197373", "0.613628", "0.60193634", "0.59961843", "0.5924283", "0.58928066", "0.5881799", "0.5828281", "0.57971954", "0.57943666", "0.5745415", "0.57420015", "0.57381034", "0.5734526", "0.5726124", "0.570825", "0.5671168", "0.56653464", "0.5662803", "0.564890...
0.5504421
30
Performs a linear interpolation between `x` and `y` using `a` to weight between them. The return value is computed as
def mix(x, y, a): return x * (1.0 - a) + y * a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolate_linear(a,b,u):\n return vectorops.madd(a,vectorops.sub(b,a),u)", "def Lerp(x, a, b):\n lerped = a.Scaled(1.0-x)\n lerped.add(b.Scaled(x))\n return lerped", "def lerp(x, y, a):\r\n return (1 - a) * x + a * y", "def _lin(x: float, a: Flt, b: Flt) -> Flt:\n return (a * x) + b",...
[ "0.68368", "0.6724443", "0.67071956", "0.65941554", "0.65685517", "0.6500294", "0.6461348", "0.6449652", "0.64135456", "0.6408458", "0.6389453", "0.63887566", "0.6369852", "0.6322634", "0.6274001", "0.62663704", "0.62418157", "0.62288594", "0.6219795", "0.61698294", "0.611021...
0.61871195
19
Calculate the refraction direction for an incident vector. This function is equivalent to the `refract` function in GLSL.
def refract(x, n, eta): dxn = x.dot(n) result = ti.zero(x) k = 1.0 - eta * eta * (1.0 - dxn * dxn) if k >= 0.0: result = eta * x - (eta * dxn + ti.sqrt(k)) * n return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def direction(self):\n \n # First get the reciprocal of the magnitude...\n multiplier = 1/self.magnitude()\n print(\"multiplier = {}\".format(multiplier))\n\n # now multiply by the vector itself and return\n \n return(multiplier * self.coordinates)", "def refract(...
[ "0.6420435", "0.626071", "0.6063552", "0.6054207", "0.5897284", "0.5869922", "0.58464086", "0.58132195", "0.5805439", "0.57601815", "0.57249355", "0.5716589", "0.5655646", "0.5624366", "0.56046516", "0.5578446", "0.55720997", "0.55707425", "0.54246706", "0.54021734", "0.53766...
0.0
-1
Returns the matrix representation of a 2d counterclockwise rotation, given the angle of rotation.
def rot2(ang): ca, sa = ti.cos(ang), ti.sin(ang) return mat2([[ca, -sa], [sa, ca]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotation_matrix(angle):\n angle = degtorad(angle)\n return numpy.array([[math.cos(angle), -math.sin(angle)],\n [math.sin(angle), math.cos(angle)]])", "def rotation_matrix(angle: float, clockwise: bool = False) -> Matrix:\n angle = deg2rad(angle)\n if clockwise:\n ang...
[ "0.7657793", "0.75935024", "0.72677577", "0.7154912", "0.7019172", "0.6956675", "0.68796194", "0.6860973", "0.67896974", "0.67636436", "0.67426383", "0.6723323", "0.6709259", "0.66960573", "0.66902584", "0.66885024", "0.66833955", "0.6654263", "0.66223186", "0.65884835", "0.6...
0.64938706
39
Calculate the inverse of a matrix. This function is equivalent to the `inverse` function in GLSL.
def inverse(mat): # pylint: disable=R1710 return mat.inverse()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mat4_inverse(matrix):\n return np.linalg.inv(matrix)", "def inv(mat):\n return mat.inv()", "def _get_matrix_inverse(self) ->torch.Tensor:\n return torch.inverse(self._matrix)", "def inv(x):\n return _mat_mat_op(anp.linalg.inv, x)", "def inverse(self):\n\t\tif not self.is_square():\n\t\t...
[ "0.83968085", "0.81677425", "0.7963081", "0.78540504", "0.7811762", "0.7760438", "0.7724159", "0.7709587", "0.7701004", "0.76870286", "0.7608622", "0.7592467", "0.75606215", "0.75365114", "0.7445197", "0.74232864", "0.74204326", "0.73973954", "0.72805905", "0.7234288", "0.722...
0.83274984
1
Flip individual bit from {0,1} to {1,0}
def flip(stim,pm=True): if pm: if stim == -1: stim_o = 1 elif stim == 1: stim_o = -1 else: if stim == 0: stim_o = 1 elif stim == 1: stim_o =0 return stim_o
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip(self, bit_index):\n if self.values[bit_index] == 0:\n self.values[bit_index] = 1\n elif self.values[bit_index] == 1:\n self.values[bit_index] = 0", "def flip_the_bit(num):\n\n num_list=[1,0]\n \n return num_list[num]", "def flip_the_bit(num):\n\n if num ...
[ "0.8023592", "0.74250954", "0.73641974", "0.72991496", "0.71916735", "0.71453106", "0.7110276", "0.70353174", "0.70324063", "0.7004592", "0.69912", "0.69710696", "0.69496626", "0.6913533", "0.6865568", "0.6728321", "0.66870224", "0.6658969", "0.6646341", "0.6567921", "0.65672...
0.6200165
39
Instantiates and returns the list of permissions that the account view requires.
def get_permissions(self): if self.action == "create": permission_classes = [IsAuthenticated] if self.action == "list": permission_classes = [IsAdminUser] else: permission_classes = [IsAdminOrOwner] return [permission() for permission in permission_cla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_permissions(self):\n if self.action in ['retrieve', 'list', 'add_view']:\n permission_classes = [AllowAny]\n else:\n permission_classes = [IsAdminUser]\n return [permission() for permission in permission_classes]", "def get_permissions(self):\r\n\r\n if s...
[ "0.72791725", "0.72777957", "0.7256317", "0.723328", "0.71584344", "0.7150112", "0.71451783", "0.71245044", "0.7118396", "0.71018267", "0.70799905", "0.70650095", "0.7054851", "0.7040259", "0.7008225", "0.70074856", "0.7002558", "0.7002558", "0.6961972", "0.6957314", "0.69557...
0.7056935
12
Returns true if the state of the game is final (i.e. the board is complete and correct)
def is_final(self): # Sum of a line or row or 3*3 block for a correct board total = sum(range(1, 10)) # Check that all rows sum up to the total for row in self.state: if row.sum() != total: return False # Check that all columns sum up to the total ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_is_finish(self):\n # Check all the rows\n for raw in self.update_board:\n if(len(raw) > len(set(raw))):\n print(\"Raw Alert : \" + str(raw) )\n return False\n array = numpy.array(self.update_board)\n # Check all the columns\n for ...
[ "0.78779197", "0.75148195", "0.7493962", "0.7483144", "0.74203175", "0.7357029", "0.7354822", "0.7299917", "0.7227241", "0.72208416", "0.720005", "0.71645355", "0.7148181", "0.71069086", "0.7104345", "0.7087936", "0.70742273", "0.70351505", "0.70306695", "0.70201236", "0.7009...
0.7968599
0
Returns the first cell which has no number assigned yet
def find_empty(self): return np.unravel_index(np.argmax(self.state == 0), self.state.shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_empty(self):\n for i in range(9):\n for j in range(9):\n if self.state[i][j] == 0:\n return (i, j) # row, col\n return None", "def choose_start_cell(self,t=None):\n c=0\n try:\n while self.cells['deleted'][c]: \n ...
[ "0.67956734", "0.65313345", "0.648587", "0.63300294", "0.6268213", "0.6268213", "0.6268213", "0.6200615", "0.61739737", "0.61400026", "0.61276716", "0.61244947", "0.61056745", "0.5993884", "0.597679", "0.59276515", "0.58940387", "0.5892019", "0.58645153", "0.5860931", "0.5851...
0.5802955
29
Convert a hyphen string like "57" into a list [5,6,7] Returns
def rangeFromHyphen(hyphenString): x = [int(x) for x in hyphenString.split('-')] return list(range(x[0], x[-1] + 1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_string(string: str):\n string_arr = string.split(\"-\")\n int_list = []\n for string in string_arr:\n try:\n int_list.append(int(string))\n except:\n raise Exception(\"Invalid argument format on: \" + string)\n return int_list", "def array_from_shitstring...
[ "0.7182749", "0.7127423", "0.67633885", "0.67066425", "0.66943526", "0.66279167", "0.6502781", "0.6486047", "0.6475447", "0.64193255", "0.63885266", "0.63606614", "0.63260394", "0.63027847", "0.62757176", "0.62455666", "0.62355685", "0.6218316", "0.61701137", "0.61656797", "0...
0.7394469
1
Get middle line segment.
def _get_middle_segment(self): handles = self._handles m = len(handles) // 2 assert m - 1 >= 0 and m < len(handles) return handles[m - 1], handles[m]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def midpoint_line(line):\n return midpoint_point_point(*line)", "def NormalLineSegment( self ) :\n \n # mid:\n mx = ( self.x0 + self.x1 )/2.0\n my = ( self.y0 + self.y1 )/2.0\n \n # normal vector:\n nvec = self.NormalVector()\n \n # define segment...
[ "0.6955071", "0.6492566", "0.6476693", "0.6433102", "0.6432587", "0.621646", "0.60444504", "0.60249346", "0.6011265", "0.60070205", "0.5999411", "0.593595", "0.5882793", "0.58778065", "0.58512604", "0.58504826", "0.579082", "0.5790063", "0.57863766", "0.57761", "0.57748884", ...
0.805809
0
Return position in the centre of middle segment of a line. Angle of the middle segment is also returned.
def _get_center_pos(self, inverted=False): h0, h1 = self._get_middle_segment() pos = (h0.pos.x + h1.pos.x) / 2, (h0.pos.y + h1.pos.y) / 2 angle = atan2(h1.pos.y - h0.pos.y, h1.pos.x - h0.pos.x) if inverted: angle += pi return pos, angle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def midpoint_line_xy(line):\n return midpoint_point_point_xy(*line)", "def midpoint_line(line):\n return midpoint_point_point(*line)", "def get_center_point(self):\n # midpoint formula\n return (self.box[0] + self.box[2]) * 0.5, (self.box[1] + self.box[3]) * 0.5", "def get_center_pos(poin...
[ "0.69859856", "0.68865734", "0.6621166", "0.6391704", "0.62580013", "0.6231889", "0.61995983", "0.61921555", "0.6146682", "0.6137566", "0.6070549", "0.60620844", "0.59717774", "0.5970647", "0.59413904", "0.58819956", "0.5879116", "0.58677626", "0.5864979", "0.5861822", "0.584...
0.7026215
0
Apply a custom pitch transformation to predicted pitch values. This sample modification linearly increases the pitch throughout the utterance from 0.5 of predicted pitch to 1.5 of predicted pitch. In other words, it starts low and ends high. PARAMS
def pitch_transform_custom(pitch, pitch_lens): weights = torch.arange(pitch.size(1), dtype=torch.float32, device=pitch.device) # The weights increase linearly from 0.0 to 1.0 in every i-th row # in the range (0, pitch_lens[i]) weights = weights.unsqueeze(0) / pitch_lens.unsqueeze(1) # Shift the r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pitch(self, pitch):\n self.set.set_clip_pitch(self.track.index, self.index, pitch[0], pitch[1])", "def call(self, audio_data, sample_rate):\n p = self.config\n\n with tf.name_scope('pitch'):\n sample_rate = tf.cast(sample_rate, dtype=tf.int32)\n pitch = py_x_ops...
[ "0.63683087", "0.62048215", "0.6095614", "0.6041568", "0.59921974", "0.5913596", "0.5900705", "0.5859213", "0.5820229", "0.5740017", "0.5673008", "0.56661826", "0.56247413", "0.55982476", "0.5595033", "0.5570414", "0.5486217", "0.5483292", "0.54590994", "0.54420245", "0.54290...
0.7706505
0
Test that the password is more than 8 characters
def test_password_too_short(self): payload = {"email": "test@example.com", "password": "123"} response = self.client.post(self.create_user_endpoint, payload) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) user_exists = get_user_model().objects.filter(email=payload["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_user_password(password):\n return len(password) >= 8", "def passlen(password=\"\", passlen=8):\r\n return passlen <= len( password )", "def valid_password(password: str) -> bool: \n return len(password) >= 6", "def test_validate_password_when_password_greater_than_maximum(self):\...
[ "0.8486763", "0.8470045", "0.8310049", "0.8063229", "0.77877134", "0.77621806", "0.7716125", "0.76983315", "0.7670469", "0.76413447", "0.7619967", "0.75558484", "0.75122064", "0.737876", "0.73657405", "0.7352244", "0.72794116", "0.727565", "0.72659546", "0.7264639", "0.725502...
0.0
-1
Test getting profile as logged in user
def test_get_user_success(self): response = self.client.get(self.user_endpoint) self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual( response.data, {"name": self.user.name, "email": self.user.email} )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_can_see_its_profile(self):\n one_user = User.objects.first()\n self.assertIsNotNone(one_user.profile)", "def test_user_get_profile(self):\n try:\n self.user.get_profile()\n except SiteProfileNotAvailable:\n pass", "def test_profile_object(self):\n...
[ "0.8278741", "0.82207304", "0.8201841", "0.81315047", "0.803582", "0.80353373", "0.802414", "0.80190474", "0.80106395", "0.7960744", "0.79235166", "0.78607094", "0.78317815", "0.77936214", "0.7748205", "0.7742065", "0.77280927", "0.7711572", "0.76594937", "0.7656848", "0.7654...
0.6824141
92
Test that POST requests are not allowed on user endpoint
def test_post_not_allowed(self): response = self.client.post(self.user_endpoint, {}) self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_user_detail_not_allowed(self):\n res = self.client.post(USER_URL, {})\n\n self.assertEqual(res.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)", "def test_post_not_allowed(self):\n self.user.is_staff = True\n request = self.create_request('post', user=self.user)\n ...
[ "0.80914414", "0.79471344", "0.79231155", "0.79120564", "0.7817573", "0.77392524", "0.76849616", "0.75804", "0.7380255", "0.73720664", "0.7353459", "0.73349637", "0.73203754", "0.7270892", "0.72294635", "0.7202696", "0.7193268", "0.71790844", "0.7093726", "0.70770127", "0.705...
0.8750925
0
iterates over chunks of data. Useful for long (longer than 5 minutes) edf files, saves memory.
def chunk_file_iterator(chunk_samples,seiz_file, good_channels = None): n = 0 try: while True: data,_,labels = edfread(seiz_file, rec_times=(n*chunk_samples/float(fs),(n+1)*chunk_samples/float(fs)), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_in_chunks(fileObj, chunkSize=2048):\n while True:\n data = fileObj.read(chunkSize)\n if not data:\n break\n yield data", "def next_chunk(file_obj, chunk_size=2048):\n while True:\n data = file_obj.read(chunk_size)\n if not data:\n ...
[ "0.69192904", "0.6767987", "0.6618123", "0.6568116", "0.6567781", "0.6560468", "0.65414864", "0.65374124", "0.6530993", "0.65218675", "0.65156955", "0.65156955", "0.65156955", "0.65156955", "0.65156955", "0.65156955", "0.6458219", "0.6451133", "0.64397466", "0.64397466", "0.6...
0.70595545
0
Path of uploaded file
def original_path(self): return '%(root)s%(file)s' % {'root': vid_settings.VIDEOLA_VIDEO_ROOT, 'file': self.video.name}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fullpath(self):\n return os.path.join(self._state.uploads_path, self.filename)", "def file_path(self) -> str:\n return pulumi.get(self, \"file_path\")", "def filepath(self):\n return os.path.join(\"static\", \"uploads\", self.filename)", "def get_file_path(self) -> str:\n retu...
[ "0.79632646", "0.78465915", "0.7763669", "0.7682416", "0.75272375", "0.75225824", "0.75225824", "0.7522326", "0.744594", "0.7427453", "0.7413641", "0.73850656", "0.7372213", "0.7313668", "0.7290217", "0.725695", "0.720095", "0.71986544", "0.71734214", "0.7152303", "0.7067275"...
0.0
-1
Structurally compares two A objects, and check if their corresponding leaves are definitely the same A object (namewise or hashidentity wise).
def structurally_match(self, o): # TODO: Convert a and b into canonical forms if self.op != o.op: return False if len(self.args) != len(o.args): return False for arg_a, arg_b in zip(self.args, o.args): if not isinstance(arg_a, Base): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_trees_have_same_structure(a, b):\n return jax.tree_structure(a) == jax.tree_structure(b)", "def equal(nm, A, B):\n # check type\n if not A.__class__ == B.__class__:\n pri.pr('{}, different types: {} vs {}'.format(nm, A.__class__, B.__class__))\n return False\n\n # dictionary, che...
[ "0.7308852", "0.6387392", "0.61704105", "0.61057246", "0.6089576", "0.60191524", "0.60191375", "0.59967417", "0.5966242", "0.5965873", "0.5965355", "0.59652466", "0.5963952", "0.5956432", "0.5904109", "0.58413", "0.58278215", "0.5821241", "0.5803863", "0.57813257", "0.5781325...
0.5603425
40
Return a string representation of the MQTT object.
def __repr__(self): return '<MQTTConfig: server: {self.server_name}:{self.server_port:d}>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n strn = 'Sensor ID: {}\\n'.format(self.ID)\n strn += 'desc: {}\\n'.format(self.desc)\n strn += 'tmprt: {}\\n'.format(self.tmprt)\n strn += 'cosTarg: {}\\n'.format(self.cosTarg)\n strn += 'scale: {}\\n'.format(self.scale)\n strn += '{}\\n'.format(self.e...
[ "0.67714113", "0.6669789", "0.66360456", "0.65837514", "0.65777713", "0.6576819", "0.6562292", "0.6548135", "0.6535404", "0.6531845", "0.6508838", "0.6479694", "0.6444386", "0.6435298", "0.6419233", "0.64065176", "0.63396084", "0.6337239", "0.62767255", "0.626851", "0.6267972...
0.66854084
1
Test on circuit with an existing classical register. Should not overwrite measurements on existing classial registers.
def test_add_measurements2(self): qc = qiskit.QuantumCircuit(2, 1) qc.x(1) qc.measure(0, 0) Measurement.add_measurements(qc, [1]) counts = utility.get_counts(qc, measure_all=False) self.assertTrue(counts['1 0'] == 1024) # space separates different classical registers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_quantum_register_circuit(self, method, device):\n\n qubits = QuantumRegister(3)\n clbits = ClassicalRegister(3)\n\n circuit = QuantumCircuit(qubits, clbits)\n circuit.h(qubits[0])\n circuit.cx(qubits[0], qubits[1])\n circuit.cx(qubits[0], qubits[2])\n\n for...
[ "0.69223547", "0.65128636", "0.644469", "0.63935274", "0.61139244", "0.6018321", "0.5977078", "0.58871645", "0.58616227", "0.5807468", "0.5797054", "0.579608", "0.57236516", "0.5682206", "0.5664829", "0.5659308", "0.5639688", "0.5496205", "0.548625", "0.5471586", "0.544362", ...
0.52590376
40
Register a scheduler config class by name.
def register_scheduler_config(name: str, dependencies: Optional[List[Tuple[str]]] = None): def wrap(scheduler_config: Type["BaseSchedulerConfig"]) -> Type["BaseSchedulerConfig"]: # noqa: F821 """Add a parameter config class to the registry. Args: cls: a subclass of `BaseParameterConfi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_scheduler_cls(name: str) -> Type[\"BaseSchedulerConfig\"]: # noqa: F821\n return search_algorithm_config_registry[name]", "def register_config_factory(name):\n return registry.register(_REGISTERED_CONFIGS, name)", "def register_task(name):\n\n def register_task_cls(cls):\n if name in TAS...
[ "0.6500383", "0.61604893", "0.61433613", "0.5950727", "0.59152436", "0.59004766", "0.5811952", "0.57452196", "0.57177067", "0.5685681", "0.56050617", "0.5567635", "0.55481493", "0.5532166", "0.54477394", "0.53531706", "0.53517294", "0.5330281", "0.52843285", "0.5276174", "0.5...
0.71413094
0
Get url for user's detail view.
def get_absolute_url(self): context = { 'username': self.username, 'temperature': self.at, 'exhaust_vacuum': self.v, 'relative_humidity': self.rh, 'ambient_pressure': self.ap, 'electrical_energy':self.ep } return reverse("us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_url(self):\n return reverse('userdetail', args=[str(self.user)])", "def get_absolute_url(self):\n return reverse('farmer-detail-view', args=[str(self.user.username)])", "def get_absolute_url(self):\n if self.user:\n return ('savoy.core.profiles.profile_detail', None, { 'usern...
[ "0.8448698", "0.7679413", "0.7628728", "0.7588663", "0.7488962", "0.7478745", "0.74354875", "0.73844147", "0.7331624", "0.7307075", "0.7297962", "0.7280593", "0.7249759", "0.71108174", "0.70829487", "0.7059699", "0.6971243", "0.69703245", "0.6951855", "0.6951855", "0.6918093"...
0.7603598
3
Set output port to high.
def set_high(self): if self.port_type != PORT_IS_WRITEABLE: raise ValueError() if self.__ADDRESS < 1000: self.pi.write(self.__ADDRESS, 1) self.state = PORT_STATE_HIGH
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_high(self):\n if self._mode == self.INPUT:\n raise GPIOError('Failed to write pin %d high. Pin %d is an input.'\n % (self._pin, self._pin))\n self._write(HIGH)", "def set_high(self, line):\n self.output(line, HIGH)", "def set_pin_high(self,port...
[ "0.70072573", "0.67961466", "0.6361317", "0.621472", "0.6119809", "0.61183333", "0.6007167", "0.5985714", "0.5964675", "0.5936617", "0.5813554", "0.5807606", "0.57853216", "0.5784315", "0.5772351", "0.57659185", "0.5755068", "0.5682716", "0.5668836", "0.5659884", "0.56586117"...
0.7575463
0
Set output port to low.
def set_low(self): if self.port_type != PORT_IS_WRITEABLE: raise ValueError() if self.__ADDRESS < 1000: self.pi.write(self.__ADDRESS, 0) self.state = PORT_STATE_LOW
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_high(self):\n if self.port_type != PORT_IS_WRITEABLE:\n raise ValueError()\n\n if self.__ADDRESS < 1000:\n self.pi.write(self.__ADDRESS, 1)\n\n self.state = PORT_STATE_HIGH", "def set_low(self):\n if self._mode == self.INPUT:\n raise GPIOError(...
[ "0.71315193", "0.68729216", "0.6603332", "0.65784216", "0.65688324", "0.6558001", "0.6476415", "0.63617986", "0.6286926", "0.6269503", "0.6224917", "0.61847645", "0.614187", "0.609929", "0.6040133", "0.60040146", "0.5893386", "0.5863981", "0.5822839", "0.5730409", "0.567388",...
0.7507927
0
Check if input port is high.
def is_high(self) -> bool: if self.__ADDRESS < 1000: self.state = self.pi.read(self.__ADDRESS) return bool(self.state == PORT_STATE_HIGH)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_port(port):\r\n return (port > 0) and (port < 65536)", "def is_low(self) -> bool:\n if self.__ADDRESS < 1000:\n self.state = self.pi.read(self.__ADDRESS)\n\n return bool(self.state == PORT_STATE_LOW)", "def is_high(self):\n return self._read() == HIGH", "def check_po...
[ "0.7238543", "0.6469372", "0.64266694", "0.6380264", "0.6325127", "0.62796193", "0.6182413", "0.6175994", "0.6124089", "0.6106904", "0.60164356", "0.60064447", "0.5993697", "0.5948663", "0.5941912", "0.59401876", "0.59267616", "0.57416713", "0.5739721", "0.5737436", "0.572350...
0.6862142
1
Check if input port is low.
def is_low(self) -> bool: if self.__ADDRESS < 1000: self.state = self.pi.read(self.__ADDRESS) return bool(self.state == PORT_STATE_LOW)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_port(port):\r\n return (port > 0) and (port < 65536)", "def allowsPort (self, port):\n return ((self.portmin <= port) and (port <= self.portmax))", "def check_port_correctness(port):\n try:\n port = int(port)\n\n if port < 0 or port > 65535:\n raise ValueError('Port is ...
[ "0.7270494", "0.6564239", "0.65283394", "0.64012474", "0.6356766", "0.62716347", "0.6226076", "0.62071604", "0.6189339", "0.6185882", "0.60975504", "0.6090079", "0.6071967", "0.6042799", "0.6025319", "0.5939918", "0.5918891", "0.59099823", "0.5892962", "0.58394134", "0.580458...
0.70940304
1
Toggle output port from either from low > high/low or from high to low/high.
def toggle(self): if self.port_type != PORT_IS_WRITEABLE: raise ValueError() if self.__ADDRESS >= 1000: return if self.is_high(): self.set_low() time.sleep(0.4) self.set_high() self.state = PORT_STATE_HIGH else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turnOff(self):\n self.write(\"OUTP OFF\")\n return self.output()", "def toggle(self, state):\n if state == 0:\n GPIO.output(self.pin1, False)\n GPIO.output(self.pin2, False)\n elif state == 1:\n GPIO.output(self.pin1, True)\n GPI...
[ "0.666903", "0.6409244", "0.63783664", "0.6364909", "0.6359972", "0.6352459", "0.63194346", "0.6308527", "0.62584287", "0.623347", "0.6205906", "0.61904514", "0.61831063", "0.61715907", "0.61709833", "0.60481477", "0.60406333", "0.60296345", "0.5983122", "0.5980074", "0.59733...
0.78986007
0
Returns the default datadir by first looking in the setup dict and searching for a location defined by the mac address. If there is no location specified, it will fall back to pycqed/data as a default location.
def get_default_datadir(): try: # Try extracting the location from the setup_dict mac = get_mac() setup_name = setup_dict.mac_dict[str(mac)] datadir = setup_dict.data_dir_dict[setup_name] except KeyError as e: # If the mac_address is unknown # Stores data in the d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_data_dir(self):\n return self._currDataDir", "def xdg_data_config(default):\n config = os.environ.get('XDG_DATA_HOME', '').strip()\n if config != '':\n config_path = os.path.join(config, 'gist')\n if os.path.isfile(config_path):\n return config_path\n\n re...
[ "0.62306213", "0.60281926", "0.5978509", "0.57834166", "0.5772036", "0.5755562", "0.5726266", "0.57171273", "0.5651559", "0.5649478", "0.56038785", "0.55787313", "0.5563003", "0.5544356", "0.55419624", "0.55415887", "0.5525785", "0.5525751", "0.5477376", "0.54747367", "0.5473...
0.8779837
0
Yields a connection from the connection pool and returns the connection to the pool after the yield completes
def get_conn(self) -> Iterator[RealDictConnection]: if self.postgres_pool is None: raise Exception( "Cannot get db connection before connecting to database") conn: RealDictConnection = self.postgres_pool.getconn() if conn is None: raise Exception( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_connection(self):\n conn = self.connection_pool.getconn()\n try:\n yield conn\n finally:\n self.connection_pool.putconn(conn)", "def conn_context(self):\n conn = None\n try:\n conn = self._connect()\n yield conn\n fina...
[ "0.8681382", "0.75963426", "0.733661", "0.72997236", "0.72172016", "0.7185987", "0.71633184", "0.7094282", "0.69882506", "0.6887382", "0.6821907", "0.6793285", "0.6791144", "0.67813885", "0.6748062", "0.674213", "0.67393667", "0.6674695", "0.6652084", "0.6582733", "0.6554891"...
0.7645736
1
Closes all connections in the connection pool
def cleanup(self): if self.postgres_pool is None: return self.postgres_pool.closeall()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_all_connections(cls):\n Database.__connection_pool.closeall()", "def close_connections(self):\n if self._connection_pool is not None:\n with suppress(Exception):\n #print \"Closing current HTTP1.1 persistent connection\"\n self._connection_pool.clo...
[ "0.880754", "0.82058483", "0.8140563", "0.8137542", "0.7897723", "0.78884023", "0.78884023", "0.782085", "0.77354276", "0.7444658", "0.7368681", "0.7292939", "0.72915536", "0.72499883", "0.72316116", "0.7162068", "0.710469", "0.70951366", "0.7038338", "0.7013053", "0.701017",...
0.69514453
23
u""" Converts aware ``datetime`` ``dt`` to UTC and returns its day as ``date``.
def utc_date(dt): return utc_date_func(dt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_naive_utc_dt(dt):\r\n if not isinstance(dt, datetime):\r\n raise TypeError('Arg must be type datetime')\r\n\r\n if dt.tzinfo is None:\r\n return dt\r\n\r\n return dt.astimezone(pytz.utc).replace(tzinfo=None)", "def normalize_datetime(self, dt: date) -> date:\n if isinstance(d...
[ "0.6878789", "0.68112826", "0.6790269", "0.6278374", "0.6231486", "0.6225897", "0.6116275", "0.5985427", "0.5985427", "0.59784186", "0.5967605", "0.59609973", "0.59596246", "0.58779997", "0.5838621", "0.577052", "0.57243896", "0.57243896", "0.57036585", "0.566773", "0.5642948...
0.7808042
1
u""" Converts aware ``datetime`` ``dt`` to timezone ``tz``, by default the current time zone, and returns its day as ``date``.
def local_date(dt, tz=None): return local_date_func(dt, tz=tz)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coerce_timezone(dt) -> datetime.datetime:\n if isinstance(dt, datetime.datetime):\n if timezone.is_aware(dt):\n return dt\n else:\n return timezone.make_aware(dt)\n\n elif isinstance(dt, datetime.date):\n return timezone.make_aware(datetime.datetime(dt.year, dt....
[ "0.72409415", "0.63409084", "0.6224449", "0.6150986", "0.61097014", "0.5989176", "0.5989176", "0.59824634", "0.587896", "0.5848702", "0.58093023", "0.57797945", "0.5746586", "0.57447445", "0.5730369", "0.5730165", "0.5725366", "0.5695697", "0.5683128", "0.5658105", "0.5615415...
0.66434443
2
u""" Substitutes all whitespace including new lines with single spaces, striping any leading or trailing whitespace. Beware that the filter does not treat HTML tags specially and it will replace all whitespace in them as well.
def squeeze(text): return squeeze_func(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simplify_white_space(self, text):\n text = re.sub('\\s*<\\s*', '<', text)\n text = re.sub('\\s*>\\s*', '>', text)\n text = re.sub('\\s+', ' ', text)\n return text", "def normalize_whitespace(text, no_line_breaks=False):\n if no_line_breaks:\n text = MULTI_WHITESPACE_TO_O...
[ "0.7458973", "0.69856906", "0.69758964", "0.69148475", "0.6769323", "0.667973", "0.6573655", "0.65560347", "0.6541719", "0.652892", "0.65128565", "0.6501264", "0.64948124", "0.64936185", "0.64485", "0.6399208", "0.63988703", "0.6348874", "0.6345506", "0.6341613", "0.6303815",...
0.0
-1
u""" Returns ``ContentType`` object for given model class or model instance.
def generic_type(value): return ContentType.objects.get_for_model(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_content_object(self):\n # TODO: Ugly but works. There must be a cleaner way. isinstance doesn't\n # work of course.\n if self.__class__.__name__.lower() == \"basecontent\":\n return getattr(self, self.content_type)\n else:\n return self", "def object(self...
[ "0.707014", "0.69768375", "0.69768375", "0.68982524", "0.68982524", "0.68431455", "0.68260276", "0.67162836", "0.6565642", "0.6452853", "0.64371216", "0.63901746", "0.6286518", "0.6279185", "0.6249319", "0.6234572", "0.6234572", "0.6234572", "0.6171045", "0.6156577", "0.61511...
0.6819331
8
True se path1 interno a path2, False altrimenti.
def pathPath(path1, path2, tester): for p in path1: if not tester(p, path2): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same_path(path1, path2):\n if path1 is path2: # use id system to avoid work.\n return True\n if len(path1) != len(path2) or set(path1) != set(path2):\n return False\n\n starts = (ix for ix, n2 in enumerate(path2) if path1[0] == n2)\n return any(all(a == b for a, b in zip(path1, chain...
[ "0.7906819", "0.73382866", "0.71773887", "0.7162897", "0.7162336", "0.7160087", "0.67993134", "0.678439", "0.6593182", "0.649708", "0.6491478", "0.6265832", "0.62215513", "0.62102926", "0.61796784", "0.6141232", "0.6121488", "0.6114777", "0.609794", "0.60859317", "0.60752946"...
0.7757144
1
Draw the ship at its current location
def blitme(self): self.screen.blit(self.image, self.rect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_ship(self):\n ship_location = self._ship.get_location_tuple()\n self._screen.draw_ship(ship_location[0],\n ship_location[1],\n self._ship.get_direction_angle_in_degrees())", "def draw_ship(self):\n x_coordinate = self.__scr...
[ "0.86486834", "0.83686674", "0.79426545", "0.76829004", "0.7139121", "0.7114206", "0.7025539", "0.6842749", "0.6810232", "0.6779798", "0.6767512", "0.6756554", "0.6692083", "0.6681475", "0.6675693", "0.6663747", "0.66558397", "0.66472405", "0.6646259", "0.6597042", "0.6586835...
0.0
-1
Return the default label for the axis.
def get_axis_label(self): return "Bin #"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_axis_name(self) -> str:\n raise NotImplementedError()", "def default_label(self):\n return self._default_label", "def node_label(self, node):\n return self.default_node_label(node)", "def getLabel(self):\n return self.axisItem.labelText", "def label_or(self, default=...
[ "0.8061131", "0.8052492", "0.7012815", "0.6994521", "0.6848224", "0.6830916", "0.6724768", "0.6724768", "0.6722262", "0.67215276", "0.671964", "0.671964", "0.66812366", "0.66639125", "0.66639125", "0.66450447", "0.6639099", "0.6605075", "0.6605075", "0.6605075", "0.65606636",...
0.67663026
6
Return the default label for the axis.
def get_axis_label(self, j_binning): return "Binning %d Bin #" % (j_binning,)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_axis_name(self) -> str:\n raise NotImplementedError()", "def default_label(self):\n return self._default_label", "def node_label(self, node):\n return self.default_node_label(node)", "def getLabel(self):\n return self.axisItem.labelText", "def label_or(self, default=...
[ "0.8061131", "0.8052492", "0.7012815", "0.6994521", "0.6848224", "0.6830916", "0.67663026", "0.6724768", "0.6724768", "0.6722262", "0.67215276", "0.671964", "0.671964", "0.66812366", "0.66639125", "0.66639125", "0.66450447", "0.6639099", "0.6605075", "0.6605075", "0.6605075",...
0.0
-1
Checks if the Trajectory in front is free.
def checkTrajectory(self, scan, offset, min_distance): center = len(scan)/2 for i in range(center-offset, center+offset): if(scan[i] < min_distance and scan[i] > 0): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\r\n return self._front is None", "def is_empty(self):\n if self.front:\n return False\n return True", "def is_free(self):\n\n return self.qsize() < self.threshold", "def is_empty(self):\n if self.front == None:\n return True\n else:\n ...
[ "0.68679994", "0.6852629", "0.6756953", "0.67299837", "0.6719611", "0.6686662", "0.6444307", "0.6333731", "0.633349", "0.633349", "0.633349", "0.632897", "0.6299348", "0.6286913", "0.6232458", "0.61861986", "0.61861986", "0.61861986", "0.61861986", "0.61716586", "0.6152149", ...
0.0
-1
Get the root configuration object from any subsection level.
def get_root(self): try: return self._parent.get_root() except AttributeError: return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_section_data():\n config_data = None\n\n return config_data", "def config(section='DEFAULT'):\n global _load\n if _load:\n return _CFG[section]\n else:\n raise Exception(\"Config not load\")", "def get(self, key=None, section=None):\n if key is not None:\n ...
[ "0.6123369", "0.6008337", "0.5998092", "0.59224856", "0.5835735", "0.5816488", "0.5797516", "0.57719445", "0.57676506", "0.5764768", "0.57315254", "0.5723893", "0.5638241", "0.5612765", "0.56009364", "0.56000966", "0.55956626", "0.5594394", "0.55878717", "0.5553843", "0.55236...
0.0
-1
Construct the issuer full url. Basically is the site url with some path appended.
def get_issuer(): site_url = settings.get('SITE_URL') path = reverse('oidc_provider:provider_info') \ .split('/.well-known/openid-configuration')[0] issuer = site_url + path return issuer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_url(self):\n url_path = '/'.join([self.year_folder, self.file_type, self.file_name])\n return urljoin(self.BASE, url_path)", "def issuer_url(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"issuer_url\")", "def build_url(self, enclosure):\n\n url_bits = urlsplit...
[ "0.6849036", "0.6823848", "0.6671054", "0.6590426", "0.6590426", "0.65783966", "0.6573149", "0.65558505", "0.65342295", "0.6502176", "0.6502176", "0.6502176", "0.6502176", "0.64269733", "0.64269733", "0.64269733", "0.64241695", "0.64197487", "0.6405072", "0.63995993", "0.6394...
0.6682977
2
Return the repository url.
def url(self): return self.attr_value(key='repository', subkey='url')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repo_url(self) -> str:\n return pulumi.get(self, \"repo_url\")", "def repo_url(self) -> str:\n return pulumi.get(self, \"repo_url\")", "def repo_url(self) -> Optional[str]:\n return pulumi.get(self, \"repo_url\")", "def repo_url(self) -> Optional[str]:\n return pulumi.get(self...
[ "0.8995898", "0.8995898", "0.85730064", "0.85730064", "0.83485806", "0.81252337", "0.7711393", "0.7673348", "0.76326215", "0.7511242", "0.7459251", "0.7459251", "0.7459251", "0.7459251", "0.7459251", "0.7347159", "0.7341678", "0.733543", "0.7332966", "0.7322096", "0.73169816"...
0.8316706
5