query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Transpose displayed dimensions. This swaps the order of the last two displayed dimensions. The order of the displayed is taken from Dims.order.
def transpose(self): order = list(self.order) order[-2], order[-1] = order[-1], order[-2] self.order = order
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transpose(x: torch.Tensor, dims):\n _dims = list(dims)\n for i in range(len(_dims)):\n if _dims[i] != i:\n x = x.transpose(i, _dims[i])\n j = _dims.index(i)\n _dims[i], _dims[j] = i, _dims[i]\n return x", "def transpose(self):\n temp_matrix = [[0] * sel...
[ "0.63431174", "0.6173414", "0.6122233", "0.6034227", "0.5997827", "0.5982194", "0.5824332", "0.5819166", "0.580872", "0.57203025", "0.56864727", "0.5642053", "0.5638656", "0.5600488", "0.5599005", "0.5567106", "0.553457", "0.55000365", "0.5453963", "0.5445961", "0.5442704", ...
0.6452598
0
Increment dimensions to the right along given axis, or last used axis if None
def _increment_dims_right(self, axis: int = None): if axis is None: axis = self.last_used self.set_current_step(axis, self.current_step[axis] + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _increment_dims_left(self, axis: int = None):\n if axis is None:\n axis = self.last_used\n self.set_current_step(axis, self.current_step[axis] - 1)", "def add_dims_on_right(arr: array_like, new_axes_on_right: int = 0, ndim: Optional[int] = None):\n arr = np.asarray(arr)\n if nd...
[ "0.80355656", "0.7058426", "0.68617535", "0.6362681", "0.6201553", "0.60930216", "0.59444535", "0.59240335", "0.5898968", "0.58951026", "0.5893552", "0.5891648", "0.58671963", "0.5823769", "0.5818595", "0.57780397", "0.57536596", "0.57078004", "0.5604907", "0.55618906", "0.55...
0.8818179
0
Increment dimensions to the left along given axis, or last used axis if None
def _increment_dims_left(self, axis: int = None): if axis is None: axis = self.last_used self.set_current_step(axis, self.current_step[axis] - 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _increment_dims_right(self, axis: int = None):\n if axis is None:\n axis = self.last_used\n self.set_current_step(axis, self.current_step[axis] + 1)", "def _expand_dims_nonnegative_axis(axis, rank):\n # Implementation note: equivalent to get_positive_axis(axis, rank + 1)\n if axis ...
[ "0.83335036", "0.6745814", "0.65627104", "0.6551638", "0.6089467", "0.60255677", "0.5910376", "0.5879978", "0.58637667", "0.58166647", "0.57958627", "0.575534", "0.5741809", "0.57007563", "0.5697291", "0.56896806", "0.5650914", "0.55656713", "0.55501705", "0.5513627", "0.5510...
0.8841973
0
Shift focused dimension slider to be the next slider above.
def _focus_up(self): sliders = [d for d in self.not_displayed if self.nsteps[d] > 1] if len(sliders) == 0: return index = (sliders.index(self.last_used) + 1) % len(sliders) self.last_used = sliders[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _focus_down(self):\n sliders = [d for d in self.not_displayed if self.nsteps[d] > 1]\n if len(sliders) == 0:\n return\n\n index = (sliders.index(self.last_used) - 1) % len(sliders)\n self.last_used = sliders[index]", "def focus_prev(self):\n self.focus_item(forwa...
[ "0.6433824", "0.6342774", "0.6247242", "0.5965561", "0.58986914", "0.58390594", "0.5688559", "0.5676884", "0.567108", "0.56085587", "0.55993825", "0.5581846", "0.55342835", "0.5532765", "0.54939634", "0.54316705", "0.54136", "0.53568226", "0.53568226", "0.5316149", "0.5311405...
0.637291
1
Shift focused dimension slider to be the next slider bellow.
def _focus_down(self): sliders = [d for d in self.not_displayed if self.nsteps[d] > 1] if len(sliders) == 0: return index = (sliders.index(self.last_used) - 1) % len(sliders) self.last_used = sliders[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _focus_up(self):\n sliders = [d for d in self.not_displayed if self.nsteps[d] > 1]\n if len(sliders) == 0:\n return\n\n index = (sliders.index(self.last_used) + 1) % len(sliders)\n self.last_used = sliders[index]", "def slider_dragged(self):\n pass", "def focus...
[ "0.6301336", "0.6267051", "0.61282104", "0.58639055", "0.57543343", "0.57306606", "0.57123274", "0.571175", "0.5625833", "0.55850744", "0.55349016", "0.5529265", "0.5522851", "0.55110556", "0.5489294", "0.5481077", "0.5481077", "0.5474194", "0.54698503", "0.546574", "0.542148...
0.6405031
0
Generate a synthetic matrix factorization dataset as suggested by Ben Recht.
def generate_synthetic_matrix_factorization_data(xdim=6, ydim=10, nsamples=1000, A_condition_number=1e-10): Atrue = np.linspace(1, A_condition_number, ydim ).reshape(-1, 1) * np.random.rand(ydim, xdim) # the inputs X = np.random.randn(xdim, nsamples) # the y's to fit Ytrue = Atrue.dot(X) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factor_mat(all_dat, f_num, iterations, regularization):\n\n\t# get # of users and # of items\n\t[u_num, i_num] = all_dat.shape\n\n\t# init user factors and item factors with random values\n\tu_fac = np.matrix(np.random.rand(u_num, f_num))\t# MxF\n\ti_fac = np.matrix(np.random.rand(i_num, f_num))\t# NxF\n\n\t# ...
[ "0.6346046", "0.61090165", "0.5843396", "0.5642854", "0.5520073", "0.54842937", "0.54265517", "0.5424973", "0.5417877", "0.54015404", "0.53981084", "0.53949046", "0.53921515", "0.53300136", "0.5301031", "0.5297291", "0.52782845", "0.5274809", "0.5271235", "0.5267814", "0.5251...
0.6540636
0
This function completes the API call for WNBA shot data with the provided parameters.
def wnba_shot_call(params, headers): pbp_list = [] for i in range(1, 10): try: api_response = get(BASE_WNBA_URL.format(season=params['season'], game_id=params['game_id'], quarter=i, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def capture_and_upload_screenshot(self) -> None:", "def download_screenshot_command():\n # 1. Get input scan id and resolution from Demisto\n scanid = demisto.args().get('scanid')\n resolution = demisto.args().get('resolution')\n # 2. Get the forensic webpage screenshot from SlashNext API\n ...
[ "0.5288771", "0.5045493", "0.5036799", "0.50346696", "0.49535924", "0.48924863", "0.47984523", "0.4763223", "0.47212905", "0.47086516", "0.47058362", "0.46831352", "0.46637723", "0.4658203", "0.4639247", "0.4588984", "0.45826423", "0.45756358", "0.45698747", "0.4566124", "0.4...
0.6163422
0
This function parses the API call returned from api_call and stores the response in a dictionary.
def parse_api_call(api_resp): data = {} if 'resultSets' in api_resp: dictionary_key = 'resultSets' elif 'resultSet' in api_resp: dictionary_key = 'resultSet' if isinstance(api_resp[dictionary_key], list): for result_set in api_resp[dictionary_key]: headers = result_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def massage_api_response(api_data):\n return_dict = defaultdict(list)\n legs = api_data['legs'][0]\n\n return_dict['start_address'].append(legs['start_address'])\n return_dict['end_address'].append(legs['end_address'])\n return_dict['distance'].append(legs['distance']['text'])\n ...
[ "0.68063694", "0.67208207", "0.620158", "0.6087096", "0.6062811", "0.6038745", "0.5941074", "0.5928393", "0.59209156", "0.59027296", "0.58981526", "0.58471745", "0.5836139", "0.5826573", "0.58249855", "0.5803496", "0.57840395", "0.57820934", "0.5779634", "0.57584476", "0.5750...
0.686593
0
Convert state to torch tensor.
def process_state(self, state): return torch.tensor(state, dtype=torch.float, device=self.device)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_tensor_convert(self,state):\n return torch.Tensor(state)", "def convert_state_to_tensor(self, state):\n tensor = []\n for i in range(len(state)):\n for j in range(len(state[i])):\n for k in range(len(state[i][j])):\n tensor.append(state[...
[ "0.91581875", "0.7870385", "0.78412116", "0.75492615", "0.7146038", "0.7068303", "0.70144564", "0.6954352", "0.67244875", "0.6661394", "0.65748036", "0.6557474", "0.654175", "0.6487248", "0.6462197", "0.6460731", "0.6441729", "0.6417149", "0.6398879", "0.63750464", "0.6373343...
0.8244859
1
Create profile for the registered user or Update user profile when user information changed
def create_or_update_user_profile(sender, instance, created, **kwargs): # Create profile and set ACTIVE status to account -- TODO : ACTIVE STATUS if created: Profile.objects.create(user=instance, status=Status.get_or_create_status(strings.ACTIVE_STATUS)) else: instance.profile.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_or_update_profile(sender, instance, created, **kwargs):\n if created:\n Profile.objects.get_or_create(user=instance)\n instance.profile.save()", "def create_user_profile(instance, created, **_):\n if created:\n Profile.objects.create(user=instance)", "def create_pr...
[ "0.8087056", "0.78401905", "0.7833288", "0.783039", "0.77336484", "0.7713397", "0.7689795", "0.76493394", "0.76493394", "0.76493394", "0.76256", "0.7616542", "0.7560712", "0.7535582", "0.7535575", "0.7532664", "0.74908847", "0.748587", "0.74857795", "0.74819976", "0.7458078",...
0.82174295
0
Check if a file is populated.
def file_populated(filepath): return file_exists(filepath) and os.stat(filepath).st_size > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def found_empty_file(self):\n self.is_empty = True", "def has_file(self) -> bool:\n return self._file is not None", "def check_file_exist(self):\n return False", "def is_present(self):\n return self.file_is_present()", "def is_file_exists(self):\n pass", "def is_empty_f...
[ "0.7667911", "0.73072773", "0.72717863", "0.72463685", "0.72180027", "0.7094383", "0.7057343", "0.7047968", "0.7028629", "0.6927831", "0.68633527", "0.6848957", "0.684656", "0.68207556", "0.6815947", "0.67939925", "0.6748642", "0.67227185", "0.6659184", "0.6623893", "0.661926...
0.78666717
0
The account's Internal auto reply message. Setting the value will change the auto reply message of the account, automatically setting the status to enabled (but not altering the schedule).
def auto_reply_message(self): if self._auto_reply is None: r = requests.get('https://outlook.office.com/api/v2.0/me/MailboxSettings/AutomaticRepliesSetting', headers=self._headers) check_response(r) self._auto_reply = r.json().get('InternalReplyMe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_auto_reply(self, message, status=AutoReplyStatus.ALWAYS_ENABLED, start=None, end=None,\n external_message=None, audience=AutoReplyAudience.ALL):\n # type: (str, OutlookAccount.AutoReplyStatus, datetime, datetime, str, OutlookAccount.AutoReplyAudience) -> None\n\n start_i...
[ "0.6212845", "0.59273", "0.5505941", "0.54334235", "0.54169136", "0.53866893", "0.53184944", "0.5285002", "0.52737916", "0.5161528", "0.512031", "0.50975454", "0.50813234", "0.50812536", "0.5072622", "0.50632584", "0.5059212", "0.50538313", "0.5039446", "0.5039446", "0.500768...
0.7541868
0
Set an automatic reply for the account.
def set_auto_reply(self, message, status=AutoReplyStatus.ALWAYS_ENABLED, start=None, end=None, external_message=None, audience=AutoReplyAudience.ALL): # type: (str, OutlookAccount.AutoReplyStatus, datetime, datetime, str, OutlookAccount.AutoReplyAudience) -> None start_is_none = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_reply_message(self):\n if self._auto_reply is None:\n r = requests.get('https://outlook.office.com/api/v2.0/me/MailboxSettings/AutomaticRepliesSetting',\n headers=self._headers)\n check_response(r)\n self._auto_reply = r.json().get('Inter...
[ "0.6822255", "0.6634621", "0.6558922", "0.6534961", "0.62508947", "0.6239137", "0.6180465", "0.6170087", "0.6034845", "0.59822196", "0.5949702", "0.58720595", "0.58430433", "0.58385617", "0.5808431", "0.5806353", "0.5805056", "0.57845074", "0.5754479", "0.57501876", "0.574460...
0.6943475
0
Gets message matching provided id. the Outlook email matching the provided message_id.
def get_message(self, message_id): r = requests.get('https://outlook.office.com/api/v2.0/me/messages/' + message_id, headers=self._headers) check_response(r) return Message._json_to_message(self, r.json())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message_by_id(message_id):\n return Message.query.get(message_id)", "def get_message_details(self, message_id):\n\n for message in self.message_list:\n if message['id'] == message_id:\n return message\n \n raise Exception('No message with this message id'...
[ "0.78535986", "0.78205234", "0.7796239", "0.7339236", "0.72552615", "0.7205678", "0.71562374", "0.7115411", "0.69955105", "0.69908214", "0.6974244", "0.6876343", "0.6876343", "0.6862131", "0.68361753", "0.68285155", "0.6822618", "0.67599744", "0.67383564", "0.65788144", "0.65...
0.8132603
0
Retrieve a Folder by its Outlook ID
def get_folder_by_id(self, folder_id): endpoint = 'https://outlook.office.com/api/v2.0/me/MailFolders/' + folder_id r = requests.get(endpoint, headers=self._headers) check_response(r) return_folder = r.json() return Folder._json_to_folder(self, return_folder)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_folder_by_name(client, folder_name):\n try:\n root_folder = client.folder(folder_id='0').get()\n items = root_folder.get_items(limit=100, offset=0)\n for item in items:\n if item.name == folder_name:\n return item.id\n\n except Exception as e:\n p...
[ "0.6885475", "0.6443769", "0.6369552", "0.631461", "0.62704647", "0.62427384", "0.62097865", "0.6133602", "0.61243296", "0.6084642", "0.60318583", "0.5976599", "0.5898619", "0.58710873", "0.58263177", "0.5796343", "0.5773922", "0.57420474", "0.5734184", "0.57243484", "0.56146...
0.7487275
0
Retrieves all messages from a folder, specified by its name, with parameters (select, filter, orderby ...). This only works with "Well Known" folders, such as 'Inbox' or 'Drafts'.
def _get_messages_from_folder_name(self, folder_name, parameters=None): r = requests.get('https://outlook.office.com/api/v2.0/me/MailFolders/' + folder_name + '/messages', headers=self._headers, params = parameters) check_response(r) return Message._json_to_messages(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(folderName):\n\n result, data = mailBox.select(folderName, True)\n\n if TESTING:\n searchResult, uid = mailBox.uid('SEARCH', None, 'UNSEEN')\n else:\n searchResult, uid = mailBox.uid('SEARCH', None, 'ALL')\n\n number_messages = len(uid[0].split(' ')) if uid[0] != \"\" else 0\n ...
[ "0.6673707", "0.65866196", "0.6399592", "0.6313883", "0.62269133", "0.61298865", "0.6107238", "0.60695887", "0.60485595", "0.60317636", "0.6013411", "0.58742994", "0.5861131", "0.585645", "0.5807729", "0.571571", "0.5713554", "0.57057387", "0.57035357", "0.5703024", "0.564911...
0.76949835
0
Get an operation and wait for it to complete.
def wait_for_operation(cls, client, operation_id): operation = cls.get(client, operation_id) operation.wait() return cls.get(client, operation.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_operation(\n self,\n ) -> Callable[[operations_pb2.WaitOperationRequest], None]:\n # Generate a \"stub function\" on-the-fly which will actually make\n # the request.\n # gRPC handles serialization and deserialization, so we just need\n # to pass in the functions for ...
[ "0.70637107", "0.6952674", "0.69171053", "0.68780625", "0.68767226", "0.68478763", "0.68283325", "0.6803523", "0.6783815", "0.66538864", "0.6450316", "0.63883734", "0.6374461", "0.6322837", "0.63165104", "0.62591165", "0.61911964", "0.6182441", "0.6182441", "0.6182441", "0.61...
0.8056656
0
Hash the value provided and scale it to fit the BF size
def hash_value(self, value): return hash(value) % self.size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _hash(self, hashKey):\n return hashKey % self.size", "def _gethash(self, invalue) -> int:\n return hash(invalue) % self.capacity", "def hash(self, key):\n return self._hash_function(key) % self.size # Modular hashing", "def _hash_value(value):\n return hashlib.md5(value.encode('u...
[ "0.6837128", "0.67926764", "0.6750015", "0.6720387", "0.65649515", "0.65522134", "0.6529396", "0.65074575", "0.64981407", "0.64848477", "0.64627427", "0.6421872", "0.6417577", "0.64055824", "0.6382984", "0.6369433", "0.6369433", "0.63618594", "0.63602084", "0.63411283", "0.62...
0.7468441
0
Patch project resource method to have certain return type messages.
def _PatchProjectReturnType(self): projects_method = registry.GetMethod('cloudresourcemanager.projects', 'list') self.StartObjectPatch(projects_method, 'GetResponseType', return_value=ProjectsMessage)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_project(self):\n pass", "def post_project_update(self, resource_id, resource_dict):\n pass", "def test_projects_patch(self):\n project = Project()\n response = self.client.open('/project-tracker/projects',\n method='PATCH',\n ...
[ "0.6162628", "0.59058964", "0.58300334", "0.5745906", "0.5632001", "0.5591009", "0.55600244", "0.5554185", "0.55276304", "0.548513", "0.54740405", "0.54582417", "0.5452977", "0.5446676", "0.5445278", "0.5433638", "0.540306", "0.53596485", "0.53596485", "0.534254", "0.53421736...
0.6952836
0
Patch book resource method to have certain return type messages.
def _PatchBookReturnType(self): books_method = registry.GetMethod('example.projects.shelves.books', 'list') self.StartObjectPatch(books_method, 'GetResponseType', return_value=BooksMessage)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PatchBookResourceReturnTypes(self):\n self._PatchProjectReturnType()\n shelves_method = registry.GetMethod('example.projects.shelves', 'list')\n self.StartObjectPatch(shelves_method, 'GetResponseType',\n return_value=ShelvesMessage)\n self._PatchBookReturnType()", "def te...
[ "0.6569911", "0.62493795", "0.5958584", "0.5953067", "0.5759714", "0.5613411", "0.55555844", "0.55500233", "0.5498806", "0.5473793", "0.5459403", "0.5431096", "0.54184985", "0.5395539", "0.53882766", "0.53436124", "0.5313809", "0.53026146", "0.528689", "0.5286017", "0.5285546...
0.758044
0
Patch each resource method to have certain return type messages.
def PatchBookResourceReturnTypes(self): self._PatchProjectReturnType() shelves_method = registry.GetMethod('example.projects.shelves', 'list') self.StartObjectPatch(shelves_method, 'GetResponseType', return_value=ShelvesMessage) self._PatchBookReturnType()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def methods(domain, resource, pathtype, param=None):\n ret = {}\n if pathtype == 'additional_lookup':\n method = 'GET'\n ret[method] = {}\n ret[method]['label'] = get_label(domain, pathtype, method)\n ret[method]['params'] = schema(resource, param)\n else:\n key = '{0}_m...
[ "0.589502", "0.5721973", "0.55744416", "0.5477759", "0.5474522", "0.5434186", "0.5405362", "0.5365491", "0.5357163", "0.53463465", "0.52922416", "0.529191", "0.5289779", "0.5280045", "0.52517265", "0.52291876", "0.52218944", "0.5193731", "0.5184144", "0.51712865", "0.51664895...
0.5930442
0
Helper function to build return message for fake books List method.
def BuildBooksList(self, books): return BooksMessage( books=[BooksMessage.Book(name=book) for book in books])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_message(self):\n\t\tmessage = \"\"\n\t\tlength = len(self.object_list)\n\t\tfor i in range(length - 1):\n\t\t\to = self.object_list[i]\n\t\t\tmessage += self.index_letter_string(i) + o.display_name(True) + \", \"\n\t\tlast_object = self.object_list[length - 1]\n\t\tmessage += self.index_letter_string(leng...
[ "0.60950553", "0.59722215", "0.5911773", "0.5757587", "0.55699974", "0.55692506", "0.5565037", "0.55460674", "0.55266684", "0.5493491", "0.54903764", "0.54728156", "0.5435321", "0.5430397", "0.54283637", "0.5424071", "0.5418549", "0.5412904", "0.5397561", "0.5389206", "0.5388...
0.7080842
0
Helper function to build return message for fake shelves List method.
def BuildShelvesList(self, shelves): return ShelvesMessage( shelves=[ShelvesMessage.Shelf(name=shelf) for shelf in shelves])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_message(self):\n\t\tmessage = \"\"\n\t\tlength = len(self.object_list)\n\t\tfor i in range(length - 1):\n\t\t\to = self.object_list[i]\n\t\t\tmessage += self.index_letter_string(i) + o.display_name(True) + \", \"\n\t\tlast_object = self.object_list[length - 1]\n\t\tmessage += self.index_letter_string(leng...
[ "0.61730474", "0.58105886", "0.57638717", "0.5576105", "0.5555753", "0.5535798", "0.5490517", "0.5455368", "0.54504293", "0.54418784", "0.5399472", "0.5391958", "0.53900445", "0.53672373", "0.53408873", "0.5324561", "0.5324561", "0.5275806", "0.52587867", "0.5243187", "0.5242...
0.67915756
0
Helper function to build return message for fake projects List method.
def BuildProjectsList(self, projects): return ProjectsMessage( projects=[ProjectsMessage.Project(projectId=project) for project in projects] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return_string = \"Project: {}-{}\".\\\n format(self.public_information[\"project_id\"],\n self.public_information[\"title\"])\n\n return return_string", "def multiple_projects():\n message = \"\"\"\nFound {} that match your change.\nSince there i...
[ "0.6208802", "0.61863935", "0.61587054", "0.6048111", "0.6047396", "0.5995888", "0.5973389", "0.59708565", "0.59399664", "0.5845293", "0.5833571", "0.5793085", "0.5793085", "0.5729089", "0.5729089", "0.569401", "0.5687926", "0.56830055", "0.56442344", "0.56329364", "0.5631969...
0.6687465
0
Asserts that arg in command has a resource argument completer.
def AssertCommandArgResourceCompleter(self, command, arg): self.AssertCommandArgCompleter(command, arg, _COMPLETER_MODULE_PATH)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RunResourceCompleter(self, resource_spec, attribute_name, prefix='',\n expected_completions=None, args=None,\n presentation_name=None, dest=None,\n flag_name_overrides=None, projects=None):\n args = args or {}\n flag_name_overr...
[ "0.63553154", "0.57756376", "0.5686924", "0.54825395", "0.53907144", "0.53843004", "0.5378544", "0.5372374", "0.5353488", "0.5348231", "0.5308486", "0.5275861", "0.52420455", "0.5213123", "0.5182557", "0.51743853", "0.51729286", "0.51724285", "0.51584214", "0.5154543", "0.512...
0.8022566
0
Run a test of a resource completer.
def RunResourceCompleter(self, resource_spec, attribute_name, prefix='', expected_completions=None, args=None, presentation_name=None, dest=None, flag_name_overrides=None, projects=None): args = args or {} flag_name_overrides = fla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AssertCommandArgResourceCompleter(self, command, arg):\n self.AssertCommandArgCompleter(command, arg, _COMPLETER_MODULE_PATH)", "def test_2(self):\n event = MockEvent(u\"%run aa\")\n mockself = None\n match = set(magic_run_completer(mockself, event))\n self.assertEqual(match, s...
[ "0.5947931", "0.52610797", "0.52518344", "0.5224835", "0.52106637", "0.51147044", "0.50972575", "0.50633025", "0.5059944", "0.50454164", "0.5036123", "0.5035484", "0.5021975", "0.4981828", "0.49479973", "0.49290627", "0.4925137", "0.492107", "0.49151045", "0.48998746", "0.489...
0.6321574
0
Verify TOR connection by connecting to check.torproject.org
def verify_tor_connection(): content = urlopen('https://check.torproject.org/').read() # <h1 class="off"> - not using tor # <h1 class="not"> - using tor without torbrowser # <h1 class="on"> - using tor with torbrowser return content.find(b'class="off"')==-1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_tor(self):\n response = self.get(\"https://check.torproject.org\")\n parsed = self.parse(response)\n title = parsed.get_title()\n if title == \"Sorry. You are not using Tor.\":\n self.logger.warning(\"Tor is NOT properly configured.\")\n return False\n ...
[ "0.7544404", "0.6652259", "0.6404984", "0.626812", "0.62472934", "0.6239273", "0.6227598", "0.61347693", "0.6115881", "0.6079948", "0.6079948", "0.6040862", "0.6031114", "0.5984239", "0.59594524", "0.59464335", "0.5900688", "0.5899588", "0.5899081", "0.5882159", "0.58812284",...
0.81268466
0
Modify the socket mdoule to use the TOR proxy
def use_tor_proxy(): if not socks.get_default_proxy(): # when proxy was not explicitly set, use 127.0.0.1:9050 set_tor_proxy('127.0.0.1', 9050) socket.socket = socks.socksocket socket.gethostbyname = sockshostbyname socket.gethostbyaddr = sockshostbyaddr socket.gethostbyname_ex = so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch():\n\n config(\"127.0.0.1\", 9050)\n\n socket.socket = socks.socksocket\n socket.create_connection = create_connection", "def setproxy(self,proxytype=None,addr=None,port=None,rdns=True,username=None,password=None):\r\n self.__proxy = (proxytype,addr,port,rdns,username,password)"...
[ "0.6650349", "0.65375197", "0.64568424", "0.62961507", "0.62961507", "0.62119687", "0.62029964", "0.6068232", "0.6067382", "0.60656387", "0.6003109", "0.59634733", "0.59600323", "0.5916334", "0.58848166", "0.587604", "0.58721715", "0.58721715", "0.5863", "0.58321184", "0.5827...
0.74029726
0
Return dtype if it is inexact, else float64.
def asinexact(dtype): if np.issubdtype(dtype, np.inexact): return dtype else: return np.float64
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_float():\n try:\n long_info = type_info(np.longdouble)\n except FloatingError:\n return np.float64\n if (long_info['nmant'] > type_info(np.float64)['nmant'] and\n machine() != 'sparc64'): # sparc has crazy-slow float128\n return np.longdouble\n return np.float6...
[ "0.7222556", "0.6958146", "0.6602176", "0.6504728", "0.64505535", "0.64294165", "0.6294321", "0.617765", "0.61307466", "0.6088964", "0.5978216", "0.58772594", "0.57965684", "0.57927835", "0.5781979", "0.57800686", "0.5776801", "0.5772606", "0.5763018", "0.5724814", "0.5686207...
0.82252294
0
Pure python implementation of scipy.linalg.solve_triangular for when a or b are object arrays.
def solve_triangular(a, b, lower=False): # TODO maybe commit this to gvar.linalg # TODO can I raise a LinAlgError if a[i,i] is 0, and still return the # result and have it assigned to a variable using try...finally inside this # function? x = np.copy(b) a = a.reshape(a.shape + (1,) * len(x.shape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def housetriang_solve(A, b):\n\n n, _ = A.shape\n b = np.reshape(b.copy(), (n, 1))\n R, c = housetriang(A, b)\n x = np.reshape(rbackwardsolve(R, c, n), (n,))\n\n\n return x", "def solve(a, b):\n #-> getrf + getrs\n a, _, _ = get_computation_matrix(a)\n b, cv2, isM2 = get_computation_matri...
[ "0.667923", "0.65151525", "0.6280545", "0.61302644", "0.6106955", "0.6083843", "0.6023184", "0.5951549", "0.59446204", "0.5920176", "0.5916783", "0.5853773", "0.58434296", "0.5821499", "0.5807036", "0.57871747", "0.57675123", "0.5766424", "0.5704925", "0.56889075", "0.5638771...
0.77219164
0
API endpoint to get a chart for power data which can be embedded in web pages.
def get_power_chart(chart_request): data = get_power_data( resource=chart_request["resource"], show_consumption_as_positive=chart_request["show_consumption_as_positive"], showing_individual_traces_for=chart_request["show_individual_traces_for"], metrics={}, # will be stored here, we...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chart(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"chart\")", "def linedata():\n get_values = request.args\n pc = get_values.get('pc') is not None # Per Capita\n gr = get_values.get('gr') is not None # Growth Rate\n place_args, _ = get_place_args(get_values)\n plot_data, _...
[ "0.6277182", "0.61903876", "0.61657965", "0.6133741", "0.612451", "0.6118392", "0.60309595", "0.6029583", "0.6028871", "0.6020951", "0.5977664", "0.5958139", "0.59504807", "0.59448594", "0.59348613", "0.59333634", "0.5929623", "0.587116", "0.58248526", "0.5816467", "0.5814661...
0.73452485
0
On initialization the ListProcessor receives the full list of all waypoints. This list is held in memory, so the ListProcessor has access to the whole list of waypoints at all time during the trip extraction process.
def __init__(self, waypoints: Tuple[Waypoint]): self._waypoints = waypoints
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_legs(self):\n if self._primary_mode == 'transit':\n for transit_leg in self._best_trip.get_transit_legs():\n self._legs.append(transit_leg.get_directions())\n else:\n self._legs.append(self._best_trip.get_directions())", "def __init__(self):\n\n ...
[ "0.61768115", "0.5960434", "0.59442604", "0.59428525", "0.57855904", "0.57328755", "0.57328755", "0.57147753", "0.56981033", "0.56979334", "0.5594869", "0.5559879", "0.5541759", "0.5513735", "0.55024344", "0.5501922", "0.55005276", "0.5494484", "0.546999", "0.5431615", "0.542...
0.6392167
1
This function returns a list of Trips, which is derived from the list of waypoints, passed to the instance on initialization.
def get_trips(self) -> Tuple[Trip]: def update_current_trip(trips, finish): current_trip = trips.pop() d = self.calc_distance(current_trip.start, finish) t = Trip(d, current_trip.start, finish) trips.append(t) if len(self._waypoints) < 2: retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trips(self) -> List[TripResponseTrips]:\n return self._trips", "def get_trips(self) -> Tuple[Trip]:\n ...", "def waypoints(self):\n\t\treturn [Star(star_id, galaxy=self.galaxy) for delay, star_id, order, num_ships in self.data.o]", "def buildWayPointList(dom):\n waypoints = []\n for ...
[ "0.7108095", "0.6903571", "0.6489643", "0.6418137", "0.63206124", "0.6307456", "0.6265638", "0.6173024", "0.6030936", "0.6028203", "0.5986084", "0.5923996", "0.59033453", "0.58866876", "0.5842499", "0.5829152", "0.5805312", "0.5799013", "0.5734565", "0.5734565", "0.57277346",...
0.6947403
1
Instead of a list of Waypoints, the StreamProcessor only receives one Waypoint at a time. The processor does not have access to the full list of waypoints. If the stream processor recognizes a complete trip, the processor returns a Trip object, otherwise it returns None.
def process_waypoint(self, waypoint: Waypoint) -> Union[Trip, None]: # ignore the first entry, just remember it for further compares if not self.prev_point: self.prev_point = waypoint return None if self.is_driving(self.prev_point, waypoint): if not self.sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_waypoint(self, waypoint: Waypoint) -> Union[Trip, None]:\n ...", "def get_trips(self) -> Tuple[Trip]:\n def update_current_trip(trips, finish):\n current_trip = trips.pop()\n d = self.calc_distance(current_trip.start, finish)\n t = Trip(d, current_trip.s...
[ "0.71810347", "0.662581", "0.6578164", "0.61865175", "0.60447747", "0.5670999", "0.5567962", "0.55303997", "0.5513158", "0.5484303", "0.54744774", "0.5460108", "0.5456011", "0.54341614", "0.5397874", "0.5393958", "0.5386682", "0.53331935", "0.5322069", "0.52804184", "0.522731...
0.69968843
1
Take any sequence of strings, str_seq, and return the count of element strings that start with the given prefix. >>> count_common_prefix(('ab', 'ac', 'ad'), 'a') 3 >>> count_common_prefix(['able', 'baker', 'adam', 'ability'], 'ab') 2 >>> count_common_prefix([], 'a') 0 >>> count_common_prefix(['a', 'a', 'ab'], 'a') 3 >>...
def count_common_prefix(str_seq, prefix): count = 0 for element in str_seq: if element.startswith(prefix): count += 1 return count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_common_prefix(list_of_strings):\n # https://stackoverflow.com/questions/6718196/determine-prefix-from-a-set-of-similar-strings\n def all_same(x):\n return all(x[0] == y for y in x)\n\n char_tuples = zip(*list_of_strings)\n prefix_tuples = itertools.takewhile(all_same, char_tuples)\n ...
[ "0.71970826", "0.6974177", "0.6917197", "0.68149304", "0.65477276", "0.6370917", "0.63265073", "0.6228929", "0.6057594", "0.6052519", "0.6026114", "0.6022409", "0.59032744", "0.57368153", "0.5714387", "0.56894344", "0.5656042", "0.563298", "0.5631768", "0.562366", "0.5601588"...
0.9034111
0
Take any sequence and return a list of all elements that are numbers. >>> get_numbers(range(10)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> get_numbers([1, 2.5, '3']) [1, 2.5] >>> get_numbers('abc123.4xyz') [] >>> get_numbers((1, 2.5, complex(3, 4), '5')) [1, 2.5, (3+4j)]
def get_numbers(sequence): new_list = [] for element in sequence: if isinstance(element, numbers.Number) == True: new_list.append(element) return new_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_numbers(string:str, type_=\"int\") -> list:\n \n num_list = []\n for word in string.split():\n if type_ == \"int\":\n try:\n num_list.append(int(word))\n except:\n pass\n elif type_ == \"float\":\n if isfloat(word):\n ...
[ "0.6840391", "0.6182859", "0.61705846", "0.6110136", "0.5887876", "0.58715194", "0.5834376", "0.5762153", "0.573113", "0.56692606", "0.5651106", "0.5595228", "0.55449486", "0.54777455", "0.5470738", "0.5403604", "0.53557354", "0.5350814", "0.5344329", "0.5285762", "0.52790505...
0.7987336
0
Inverse of dna_digit. >>> bp_from_digit(3) 't' >>> bp_from_digit(7)
def bp_from_digit(digit): # You must use the following dictionary: bp_map = {0: 'a', 1: 'c', 2: 'g', 3: 't'} # YOUR CODE HERE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dna_digit(bp):\r\n # You must use the following dictionary:\r\n bp_map = {'a': 0, 'c': 1, 'g': 2, 't': 3}\r\n\r\n # YOUR CODE HERE\r", "def dna_number(bp_seq):\r\n # Hint: use dna_digit\r\n\r\n # YOUR CODE HERE\r", "def complement_base(base):\n\n if base == 'A' or base == 'a':\n re...
[ "0.6980157", "0.61201626", "0.56881356", "0.55594414", "0.55402386", "0.5535841", "0.5491018", "0.547424", "0.53357327", "0.5317679", "0.5298355", "0.5296217", "0.52697694", "0.52548254", "0.52155155", "0.5207737", "0.52001643", "0.5196097", "0.5192527", "0.5165123", "0.51456...
0.6602838
1
Take a dna string, bp_seq, (a string of a's, c's, g's, and t's) and interpret that as a base4 number using dna_digit for each basepair. A ValueErorr is raised if there are any characters besides those accepted by dna_digit. >>> dna_number('') 0 >>> dna_number('aaa') 0 >>> dna_number('t') 3 >>> dna_number('ca') 4 >>> dn...
def dna_number(bp_seq): # Hint: use dna_digit # YOUR CODE HERE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dna_digit(bp):\r\n # You must use the following dictionary:\r\n bp_map = {'a': 0, 'c': 1, 'g': 2, 't': 3}\r\n\r\n # YOUR CODE HERE\r", "def pattern_to_number(dna):\n assert (is_dna(dna))\n idx = 'ACGT'\n return sum(idx.index(dna_base) * 4 ** i for i, dna_base in enumerate(dna[::-1]))", "d...
[ "0.70117366", "0.6626081", "0.63483727", "0.58927906", "0.5883037", "0.5798747", "0.56869143", "0.5573457", "0.5520541", "0.5464343", "0.5400514", "0.53591526", "0.5342177", "0.52771735", "0.5237312", "0.5151023", "0.5144183", "0.5139878", "0.5138876", "0.51262164", "0.512562...
0.8035558
0
Check to see if transforms match for 3D AABB's.
def transforms_match(bounds, extents, transforms): assert len(bounds) == len(extents) assert len(bounds) == len(transforms) box = g.trimesh.creation.box for b, t, e in zip(bounds, transforms, extents): # create a box with the placed bounds a = box(bounds=b) # create a box using ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _intersects_3D(A, B):\n return all([_intersects_1D((A[i], A[i+3]), (B[i], B[i+3]))\n for i in range(3)])", "def match(cube):\n \n #M1'\n M1 = (cube[1,1,0] & cube[1,1,1] & \n (not cube[0,0,2]) & (not cube[1,0,2]) & (not cube[2,0,2]) &\n (not cube[0,1,2]) & (not cube[1,1,2]) ...
[ "0.5945986", "0.5890566", "0.58164686", "0.57901424", "0.570529", "0.5591047", "0.5575964", "0.5559709", "0.5559709", "0.5529409", "0.5448441", "0.54193586", "0.54104954", "0.5398789", "0.537859", "0.537553", "0.53726596", "0.53680474", "0.5326483", "0.5305396", "0.52994144",...
0.6869145
0
Return a PIL image that is all one color.
def _solid_image(color, size): from PIL import Image # convert to RGB uint8 color = g.np.array(color, dtype=g.np.uint8)[:3] # create a one pixel RGB image image = Image.fromarray( g.np.tile(color, (g.np.prod(size), 1)).reshape( (size[0], size[1], 3))) assert image.size == tu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blank_image(height, width):\n all_green = create_uniform_image(height, width, [0, 255, 0])\n return all_green", "def get_image(self):\n image = Image.new('1', (8, 16))\n draw = ImageDraw.Draw(image)\n for x in xrange(8):\n for y in xrange(16):\n draw.point...
[ "0.66824204", "0.6635066", "0.6374929", "0.63247544", "0.61794895", "0.6133591", "0.60366756", "0.6019682", "0.6013168", "0.59070235", "0.5850156", "0.5841903", "0.57940644", "0.57445747", "0.57420737", "0.572145", "0.56919885", "0.5681022", "0.5611405", "0.56048757", "0.5602...
0.6654435
1
Move head in looking up position
def move_head_looking_up(): return _move_head(cozmo.robot.MAX_HEAD_ANGLE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_head_looking_forward():\n return _move_head(degrees(0))", "def _move_head(self, cmd):\n self.move_head(cmd.data)", "def move_head_looking_down():\n return _move_head(cozmo.robot.MIN_HEAD_ANGLE)", "def _move_to_head(self, node):\n self._remove_node(node)\n self._add_node(no...
[ "0.75905687", "0.71693414", "0.689879", "0.65886056", "0.65552706", "0.6536765", "0.65329057", "0.6478913", "0.63520193", "0.6337932", "0.63345844", "0.6263702", "0.6194596", "0.61626005", "0.61611587", "0.6146102", "0.6137257", "0.6124788", "0.6099965", "0.5910861", "0.58771...
0.7881115
0
Move head in looking down position
def move_head_looking_down(): return _move_head(cozmo.robot.MIN_HEAD_ANGLE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_head_looking_up():\n return _move_head(cozmo.robot.MAX_HEAD_ANGLE)", "def move_head_looking_forward():\n return _move_head(degrees(0))", "def up(self):\n if self.head.heading() != DOWN and self.last_direction != DOWN:\n self.head.setheading(UP)", "def down(self):\n if self.head.head...
[ "0.7909611", "0.78818965", "0.75105995", "0.7271034", "0.70760745", "0.69877636", "0.6986974", "0.6780396", "0.67051816", "0.6649998", "0.6605314", "0.6590552", "0.6552368", "0.65227723", "0.6515691", "0.64742297", "0.642539", "0.64098626", "0.6402091", "0.6370593", "0.635825...
0.81926703
0
Position head in looking forward (at ground level) position
def move_head_looking_forward(): return _move_head(degrees(0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def head_towards(self):\n dest = self.target_destination - self.location\n if dest.length() != 0:\n dest.scale_to_length(self.speed)\n dest.normalize()\n self.rect.left += dest.x\n self.rect.top += dest.y", "def move_head_looking_up():\n return _move_head(cozm...
[ "0.7200592", "0.69223684", "0.67997426", "0.64820814", "0.63488954", "0.62061757", "0.618071", "0.61070585", "0.6106752", "0.61032444", "0.60774773", "0.59292644", "0.5890282", "0.58369625", "0.58153296", "0.5808214", "0.5767609", "0.5738415", "0.5726572", "0.5726526", "0.569...
0.75380087
0
Move lift close to the ground level
def move_lift_down(): return _move_lift(0.2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_lift_ground():\n return _move_lift(0)", "def lift_down(self):\n\n # Can't reuse set_lift_pos due to bug above\n bottom_limit = self.get_lift_limit()\n self.send(self.cmd.SET_LIFT_SET, bottom_limit)", "def jump(self):\r\n if self.grounded == True:\r\n self.vel....
[ "0.8149269", "0.6854262", "0.68413323", "0.6714419", "0.65151966", "0.64415556", "0.62991387", "0.6228117", "0.61921024", "0.61904323", "0.617294", "0.6154423", "0.6126746", "0.60275495", "0.6003219", "0.59435475", "0.59210306", "0.59191656", "0.5919147", "0.5905214", "0.5900...
0.7417945
1
Move lift to lowest (groundlevel) position
def move_lift_ground(): return _move_lift(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_lift_up():\n return _move_lift(1)", "def lift_up(self):\n\n # Can't reuse set_lift_pos due to bug above\n self.send(self.cmd.SET_LIFT_SET, self.cmd.SET_LIFT_SET[\"check\"][\"min\"])", "def move_lift_down():\n return _move_lift(0.2)", "def default(self):\r\n if self.lift.cu...
[ "0.73050475", "0.6926683", "0.6793749", "0.65675867", "0.65607166", "0.6552803", "0.6522182", "0.6300354", "0.6278917", "0.62712395", "0.62628436", "0.62415427", "0.6172774", "0.61378413", "0.60493064", "0.6028695", "0.60269815", "0.6012585", "0.6012585", "0.6004337", "0.5984...
0.84103465
0
Move lift close to the highest position
def move_lift_up(): return _move_lift(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_lift_down():\n return _move_lift(0.2)", "def lift_down(self):\n\n # Can't reuse set_lift_pos due to bug above\n bottom_limit = self.get_lift_limit()\n self.send(self.cmd.SET_LIFT_SET, bottom_limit)", "def move_lift_ground():\n return _move_lift(0)", "def bring_down(self):\...
[ "0.75074756", "0.71321285", "0.6953186", "0.6579046", "0.6533172", "0.64709103", "0.6456872", "0.63544905", "0.62643474", "0.6252684", "0.6221965", "0.62079394", "0.6192262", "0.6185153", "0.6174713", "0.61646885", "0.61549836", "0.61504203", "0.6098028", "0.60750335", "0.607...
0.71893954
1
Reverse for certain amount of time in seconds
def reverse_in_seconds(duration): try: easy_cozmo._robot.drive_wheels(-1*df_reverse_speed, -1*df_reverse_speed, duration=duration) except Exception as e: say_error("I can't move in reverse") return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advance_time_seconds(seconds):\r\n advance_time_delta(datetime.timedelta(0, seconds))", "def goRight(self, seconds):\n self.change_x = 5", "def reverse(seq):\n return seq[::-1]", "def reverse(seq):\n return seq[::-1]", "def backward(self, speed):\n self.controller.reverse(speed)"...
[ "0.60997796", "0.590794", "0.57126427", "0.57126427", "0.5707142", "0.5647594", "0.5642141", "0.5627632", "0.5479803", "0.54722285", "0.5469334", "0.5447453", "0.54322964", "0.54316", "0.5427749", "0.53968924", "0.53934664", "0.53900844", "0.538714", "0.5358092", "0.5308835",...
0.6609068
0
Move forward for a given distance while avoiding landmarks on the way
def move_forward_avoiding_landmark(distance): distance = distance * 10 pose = Pose(distance, 0, 0, angle_z=degrees(0)) return _execute_go_to_pose(pose)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_forward(self, distance):\r\n return self.move('forward', distance)", "def forward(self, distance):\n self.logger.debug(\"forward \" + str(distance))", "def move_forward(self, distance):\n quad_offset = self.quad_offset_mapping['forward']\n client.moveByVelocityAsync(self.ve...
[ "0.74395466", "0.7402497", "0.6989545", "0.68794596", "0.6808184", "0.6726156", "0.6702615", "0.6566427", "0.6553348", "0.6377762", "0.63402694", "0.63278", "0.6286996", "0.62555915", "0.62512577", "0.62512577", "0.62431717", "0.6233589", "0.6223542", "0.6216122", "0.619673",...
0.8164994
0
Evaluates a trained neural network classifier on a partition of a data manager (e.g. "train", "dev", "test"). The accuracy (i.e. percentage of correct classifications) is returned, along with a list of the misclassifications. Each misclassification is a triple (phrase, guessed, actual), where phrase is the misclassifie...
def evaluate(net, dmanager, partition): def accuracy(outputs, labels, phrases, dmanager): correct = 0 total = 0 misclassified = [] for (i, output) in enumerate(outputs): total += 1 if labels[i] == output.argmax(): correct += 1 e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __calculate_classification_metrics(model, metric, evaluation_data, train_data, opt_data):\n model.eval()\n with torch.no_grad():\n all_triples = np.concatenate((evaluation_data, train_data, opt_data), axis=0)\n all_hashed = np.apply_along_axis(hash_triples, 1, all_triples)\n\n entity...
[ "0.68844604", "0.67071915", "0.6689958", "0.66273904", "0.6515462", "0.64979863", "0.64945793", "0.64835525", "0.6477064", "0.6471139", "0.6453934", "0.6429707", "0.6404337", "0.63565594", "0.6334361", "0.63319755", "0.6327112", "0.63240665", "0.6319546", "0.63133943", "0.630...
0.7388213
0
Adds path between the two nodes given
def addPath(self, from_node, to_node): x1,y1 = from_node.x,from_node.y x2,y2 = to_node.x,to_node.y pointsx = [] pointsy = [] m_new = 2 * (y2 - y1) slope_error_new = m_new - (x2 - x1) y=y1 for x in range(x1,x2+1): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_path(self, node1, node2, path=[]):\r\n\r\n path = path + [node1]\r\n if node1 == node2:\r\n return path\r\n if node1 not in self._graph:\r\n return None\r\n for node in self._graph[node1]:\r\n if node not in path:\r\n new_path = ...
[ "0.6751943", "0.656915", "0.65636885", "0.65265256", "0.65126884", "0.64361167", "0.642828", "0.64159256", "0.6312686", "0.631026", "0.6286674", "0.6258846", "0.6226627", "0.6181952", "0.61733156", "0.6161478", "0.61542237", "0.61473876", "0.61421573", "0.6123293", "0.6100024...
0.76333266
0
Function to draw the channel2energy calibration curves
def draw_en_calib_curves(list_channel_names, list_channel_arrays, \ list_energy_arrays, show=True): plt.figure(figsize=(10, 7), dpi=80) plt.title('Na Energy Calibration') plt.xlabel('Channel') plt.ylabel('Energy [MeV]') calib_ch0_x = [1917,466,2721,6594,3504,6044,6843] c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_and_visualize_energy_spectrum(CV):\n E = 1 / (2 / np.pi)**2 * np.fft.fft2(CV) * 0.33 * 0.33\n # here the unit of CV is still the same as U and V (typically px/s), thus the unit of the correlation is px2/s2.\n # To convert the unit to um2/s2, multiply the correlation by mpp^2 (0.33^2 for 20x ...
[ "0.60801697", "0.5949837", "0.58277285", "0.5798766", "0.5737879", "0.570477", "0.569897", "0.56542355", "0.56062794", "0.55953866", "0.5563266", "0.5561558", "0.5551439", "0.5549513", "0.55401355", "0.55340844", "0.55340576", "0.5533128", "0.54531765", "0.5450464", "0.543447...
0.7580857
0
Get a list of locations given the input parameters. Specify a search area by radius around a latitude and longitude, as well as any filter for specific systems. Each location will be a GeoJSON Feature, and aggregated into a GeoJSON FeatureCollection.
def location_search(self, latitude, longitude, radius_km, system_ids=None): path = f'{self.BIKE_ENDPOINT}location?latitude={latitude}&longitude={longitude}&radius_km={radius_km}&{self.secret_key}' response = requests.get(path).json() self.check_api_key(response) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def features_search(df, type_, keywords):\n PLACES_KEY = os.environ[\"PLACES_KEY\"]\n output_file = \"json\"\n radius = \"1500\"\n lst = []\n\n for i in range(len(df)):\n coor = df[\"latitude\"][i].astype(str) + \", \" + df[\"longitude\"][i].astype(str)\n url = \"https://maps.googleapi...
[ "0.69432235", "0.6408032", "0.63840026", "0.63622475", "0.6217564", "0.61683476", "0.6148148", "0.61463386", "0.61434495", "0.61077005", "0.60686666", "0.6068093", "0.60368913", "0.5989424", "0.5938921", "0.5931571", "0.5902933", "0.5902933", "0.5858726", "0.58187765", "0.576...
0.6676069
1
Provide quotes for renting a bike, via different types of passes that you can buy. Quotes can be obtained for all systems or for specific systems. Quotes may be associated with specific regions within a system. Please keep in mind that both the quotes and usage fees associated with the quotes are estimates.
def rental_quote_info(self, system_ids=None): path = f'{self.BIKE_ENDPOINT}quote?{self.secret_key}' response = requests.get(path).json() self.check_api_key(response) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_book(context, quote_type, quote):\n date, filterTime = str(context.config.trading_date), int(quote.int_time)\n # print(quote.symbol, quote.int_time)\n\n if ((filterTime > 93000000) and (filterTime < 113000000)) or (\n (filterTime > 130000000) and (filterTime < 150000000)):\n # print ...
[ "0.5831876", "0.569695", "0.553656", "0.5332494", "0.53220475", "0.5144027", "0.50976944", "0.50927013", "0.5080306", "0.5049257", "0.5032044", "0.5003307", "0.4973926", "0.49699786", "0.49636665", "0.4962488", "0.49302152", "0.4928655", "0.49229747", "0.49007526", "0.4897141...
0.59208894
0
Retrieve an environment variable. Any failures will cause an exception to be thrown.
def get_env_variable(self, var_name, optional=False): try: return environ[var_name] except KeyError: if optional: return False else: error_msg = f'Error: You must set the {var_name} environment variable.' raise Exception(error_msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_env_variable(var_name):\n try:\n return os.environ[var_name]\n except KeyError:\n error_msg = \"Set the {} environment variable\".format(var_name)\n\n raise Exception(error_msg)", "def get_env_variable(var_name):\n try:\n return os.environ[var_name]\n except KeyError:\...
[ "0.8219711", "0.7999004", "0.7904889", "0.7870026", "0.7826477", "0.7740203", "0.77336615", "0.77190036", "0.7707803", "0.76930946", "0.76501966", "0.7644564", "0.75845987", "0.7573528", "0.75723463", "0.7517979", "0.7484092", "0.7442207", "0.74171025", "0.74168986", "0.73590...
0.8043275
1
Download and install the latest codeql cli Download and install the latest codeql queries
def setup(): # check version and download the latest version get_latest_codeql() # install vscode? # clone codeql libs # setup vscode + codeql # wait for user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_codeql_query(query, database, output, search_path):\n # --search-path is required when the CLI needs to upgrade the database scheme.\n subprocess_run([\"codeql\", \"query\", \"run\", query, \"--database\", database,\n \"--output\", output + \".bqrs\", \"--search-path\", search_path]...
[ "0.60229224", "0.55783564", "0.5433331", "0.522893", "0.5157668", "0.49971527", "0.49750808", "0.49727553", "0.49529603", "0.4920116", "0.49196017", "0.48277876", "0.48154685", "0.47984973", "0.47673056", "0.4742191", "0.47271448", "0.47246155", "0.47236863", "0.47113135", "0...
0.7874407
0
Create Xija model object This function creates a Xija model object with initial parameters, if any. This function is intended to create a streamlined method to creating Xija models that can take both single value data and time defined data (e.g. [pitch1, pitch2, pitch3], [time1, time2, time3]), defined in the `init` di...
def setup_model(msid, t0, t1, model_spec, init): model = xija.ThermalModel(msid, start=t0, stop=t1, model_spec=model_spec) for key, value in init.items(): if isinstance(value, dict): model.comp[key].set_data(value['data'], value['times']) else: model.comp[key].set_data(v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_model():\n m = model_class(*argv[2:-1])\n modelobj[\"model\"] = m", "def create_model(self) -> None:\n self._model = create_model_with_temperature_scaling(self.config)", "def create_model(self, **inputs):\n raise NotImplementedError('This method has to be overwritten.')", ...
[ "0.5854473", "0.58154035", "0.5803041", "0.57467854", "0.57412326", "0.5697944", "0.5679864", "0.5657684", "0.5645403", "0.5603807", "0.5595166", "0.5580034", "0.5574634", "0.5568534", "0.5564313", "0.5545272", "0.5534687", "0.5534448", "0.5525057", "0.55246973", "0.54878163"...
0.64592767
0
Get ACIS Focal Plane limits based on SIM position. This function uses SIM position to assign temperature limits.
def get_acis_fp_limits(states, acis_s=-111.0, acis_i=-112.0): states_acis_limits = np.zeros(len(states)) + 20 # Set limit initially to 20C ind_acis_s = (states['simpos'] > 0) & (states['simpos'] < 80669) & (states['clocking'] == 1) & ( states['vid_board'] == 1) ind_acis_i = (states['simpos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_car_limits(self):\n # car's limits\n min_turning_radius = self.wheelbase/np.tan(self.max_steering_angle)\n max_angular_velocity = self.speed/min_turning_radius\n max_car = np.array([0, self.speed, max_angular_velocity])\n\n return max_car", "def get_acis_limits(states):...
[ "0.57339364", "0.57016706", "0.56508887", "0.5607178", "0.55084836", "0.5506954", "0.5452533", "0.5426434", "0.53256893", "0.53029037", "0.52605385", "0.5238085", "0.52323025", "0.5195507", "0.51862", "0.51857567", "0.5135426", "0.5093461", "0.5084093", "0.5070832", "0.506796...
0.5708714
1
Get ACIS DPA, DEA, PSMC limits. This function is intended to be temporary, to facilitate long term comparison of additional chip opportunities in past schedules.
def get_acis_limits(states): states_acis_fp_limits = get_acis_fp_limits(states, acis_s=-111.0, acis_i=-112.0) ind_old = states['tstart'] <= DateTime('2019:172:00:00:00').secs states_acis_fp_limits[(states_acis_fp_limits == -112.0) & ind_old] = -114.0 states_acis_fp_limits[(states_acis_fp_limits == -11...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLimits(self):\n lims = [x * self.getSign() + self.getOffset() for x in (self.connection.getChannel(self.chanNamePrefix % 'low_limit').read(), \\\n self.connection.getChannel(self.chanNamePrefix % 'high_limit').read())]\n return (mi...
[ "0.6717213", "0.6433776", "0.6427651", "0.6422575", "0.64155334", "0.64044297", "0.62778854", "0.62398833", "0.6198074", "0.6138675", "0.61210334", "0.6086518", "0.6062708", "0.60539", "0.6016216", "0.5981716", "0.59542805", "0.59519047", "0.5940754", "0.5940452", "0.5931553"...
0.67807853
0
Get maximum data for each dwell as defined in state_data in the Xija model object `model`.
def get_max_dwell_mvals(model, state_data): dwell_results = [] for ind in range(len(state_data)): ind_dwell = (model.times >= state_data['tstart'][ind]) & (model.times <= state_data['tstop'][ind]) if np.any(ind_dwell): dwell_results.append(np.max(model.mvals[ind_dwell])) else...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state_observed_max(self):\n maxValues = numpy.zeros(self.get_num_variables())\n i = 0\n for v in self.variables:\n maxValues[i] = v.get_max_value()\n i += 1\n return maxValues", "def Max(data):\n return data.max()", "def _get_max_sampled_bandit(self)...
[ "0.68863416", "0.61601216", "0.60094136", "0.5900275", "0.5891694", "0.58775216", "0.580818", "0.58072674", "0.5785431", "0.57757854", "0.57710737", "0.57614946", "0.5742574", "0.5739469", "0.5728732", "0.5727174", "0.572258", "0.5709562", "0.5707097", "0.5705269", "0.5644917...
0.7922475
0
Evaluate one case for one model/MSID
def evaluate_one_case_for_one_msid(state_limits, baseline_case_results, case_results, debug=True): if debug: state_limits = state_limits # The first case has zero changes, look for cases that chage more than 0.1 degrees (refine later). msid_inc_ind = np.array([c - b for c, b in zip(case_results, b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(QualityMeasure,ModelClass,dataset,subgroup,target1,target2): \r\n evaluator = {\r\n QualityMeasure.SCD: evaluate_scd,\r\n }\r\n return evaluator.get(QualityMeasure)(ModelClass,dataset,subgroup,target1,target2)", "def _compute_(self, case):\n dic = \"data/sim/{dn}/{rad}/\".form...
[ "0.59154487", "0.57015085", "0.5590141", "0.5463902", "0.54456145", "0.54454935", "0.540437", "0.53600127", "0.52872545", "0.52231187", "0.5206733", "0.5189098", "0.51769215", "0.5170207", "0.5170207", "0.5166084", "0.5152556", "0.5131439", "0.50984055", "0.50914276", "0.5076...
0.59381014
0
Visualization using user profile images as the points.
def icons(users, distance): # It would be pretty cool to put user thumbails where points are. # but i'm still not sure how to do this yet. images = [] try: print 'getting images..' for p in users: print p f = p.image img = imread('image.tmp') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, user, enabled=True):\n super().__init__()\n self.setObjectName(\"user-profile\")\n self.enabled = enabled\n self.setProperty(\"follow-mouse\", enabled)\n\n image, label = _get_visuals(user)\n\n grid = QGridLayout(self)\n i = QLabel()\n i.se...
[ "0.6102291", "0.59152985", "0.5812397", "0.5785912", "0.5781453", "0.56563425", "0.55763805", "0.55537695", "0.55522704", "0.55514014", "0.5545138", "0.5540783", "0.5524364", "0.5510808", "0.54797715", "0.54732275", "0.5429194", "0.5428557", "0.54024166", "0.5393831", "0.5389...
0.5977453
1
Find all the paths from start to goal recursively on a dict.
def dfs_paths_dict_recur( graph: Mapping[Node, set[Node]], start: Node, goal: Node, path: Optional[list[Node]] = None ) -> Iterable[list[Node]]: if path is None: path = [start] if start == goal: yield path else: for next_node in graph[start].difference(path): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path(start, child_father_dict):\n\n def _dfs(node, path, res):\n path.append(node)\n if node not in child_father_dict:\n res.append(path.copy())\n path.pop()\n return\n for ni in child_father_dict[node]:\n _dfs(ni, path, res)\n path...
[ "0.7048798", "0.67607284", "0.643885", "0.6375813", "0.63585025", "0.62897635", "0.62609977", "0.6206619", "0.6176041", "0.6093086", "0.6086056", "0.60289514", "0.6025127", "0.6021499", "0.6012426", "0.6009373", "0.596184", "0.59196025", "0.5900486", "0.5898333", "0.5861026",...
0.7483994
0
Function to update news with schedule
def update_news(system: ChatSystem): def update(system): """ update news as schedule function :param system: :return: """ session = system.db_session.create_session() for sett in session.query(system.db_session.Settings).filter( system.db_sess...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_news_to_model(self):\n internet = 1\n news_page_url_base = 'https://news.mydrivers.com/update/'\n url_to_get_list = []\n if self.dates_to_get[0] == 'Date entered error':\n self.show_in_browser.emit(f'Date entered error: {self.dates_to_get[1]}')\n self.sh...
[ "0.6767329", "0.67203206", "0.66092193", "0.636598", "0.6168731", "0.60896766", "0.60416806", "0.59389657", "0.59258604", "0.59028083", "0.5899791", "0.5885284", "0.5835838", "0.5824128", "0.5811874", "0.576966", "0.57586664", "0.57467675", "0.5735995", "0.5734876", "0.571546...
0.77732843
0
Initialize the downloader with the specified msgId string
def __init__(self, msgId): self.msgId = msgId # The HTTPDownloader self.downloader = None # Write the downloaded NZB here temporarily self.tempFilename = os.path.join(Hellanzb.TEMP_DIR, tempFilename(self.TEMP_FILENAME_PREFIX) + '.nzb') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, msg_id, msg_data=None, msg_priority=MSG_DEFAULT_PRIORITY, msg_is_waitable=False):\n self._id = int(msg_id)\n self._data = msg_data\n self._processed = False\n self._error = None\n self._condition = threading.Condition() if msg_is_waitable else None\n\n i...
[ "0.58565474", "0.5774373", "0.56294054", "0.56270933", "0.55998594", "0.5594729", "0.5539883", "0.5494888", "0.5494888", "0.5494888", "0.5494888", "0.5494888", "0.5494888", "0.5494888", "0.5494888", "0.5494888", "0.5494888", "0.5494888", "0.5494888", "0.5478392", "0.53790474"...
0.69161874
0
The downloader will feeds headers via this function
def gotHeaders(self, headers): super(self.__class__, self).gotHeaders(headers) if headers.has_key('x-dnzb-name'): name = headers.get('x-dnzb-name')[0] # XXX may want to sanitize a little more cleanName = name.replace('/', '_').replace('\\','_') self.nzbFil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getFile_urllib(self, _src, _dst):\n\n #-------------------- \n # Open the local destination file \n # so that it can start reading in the buffers.\n #-------------------- \n try:\n dstDir = os.path.dirname(_dst) \n if...
[ "0.64802045", "0.63556856", "0.6344954", "0.63279104", "0.6272933", "0.62594026", "0.62594026", "0.6174976", "0.60916114", "0.60540736", "0.59925616", "0.5934997", "0.5917263", "0.59070027", "0.5896219", "0.5875113", "0.58729607", "0.5870548", "0.5868026", "0.58543277", "0.58...
0.64953953
0
Start the NZB download process
def download(self): debug(str(self) + ' Downloading from newzbin.com..') if not NewzbinDownloader.canDownload(): debug(str(self) + ' download: No www.newzbin.com login information') return info('Downloading newzbin NZB: %s ' % self.msgId) self.handleNZBDownloadFr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_download(self) -> NoReturn:\n if self.threaded:\n self.threaded_download()\n else:\n self.regular_download()", "def x_download():\n\t#_loadconfig()\n\tconf = _get_config()\n\t#print conf['xplane']\n\tdownload_url = conf['xplane']['download']\n\tlocal(\"wget -P %s %s\...
[ "0.6757942", "0.63902557", "0.6272311", "0.6187265", "0.6104816", "0.6057119", "0.60374814", "0.5990123", "0.5872523", "0.58668387", "0.58480763", "0.5846919", "0.580224", "0.57705647", "0.5765174", "0.57354814", "0.5667718", "0.56237143", "0.561297", "0.56028575", "0.5600036...
0.7246163
0
Add the new NZB to the queue
def handleEnqueueNZB(self, page): if super(self.__class__, self).handleEnqueueNZB(page): Hellanzb.NZBQueue.writeStateXML() else: msg = 'Unable to download newzbin NZB: %s' % self.msgId if self.errMessage: error('%s (%s)' % [msg, self.errMessage]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queue_append(self, obj, value):\n self.queue.append((obj, value))\n if len(self.queue) > self.queue_size:\n self.dump_queue()", "def add_nb_queue_to_session_queue(self, session):\n rpc_list = []\n client_id = get_element('cid', session['client'])\n\n if client_id...
[ "0.6199243", "0.6176773", "0.6118145", "0.61039335", "0.61039335", "0.60769063", "0.6053558", "0.5965219", "0.5965219", "0.59588814", "0.59458435", "0.58998424", "0.58986986", "0.58671236", "0.58596694", "0.5859027", "0.5857519", "0.58512956", "0.5840158", "0.5835103", "0.581...
0.6672806
0
Computes and saves the reference sphere
def compute_reference_sphere(self, x, y): theta_0=np.pi/2.0 pictures=np.zeros(shape=(360, int(y.shape[0]), int(x.shape[0]), 3), dtype=np.uint8) xx, yy=np.meshgrid(x,y) rho=np.sqrt(xx**2+yy**2) c=2.0*np.arctan(rho/2.0) theta=theta_0-np.arcsin(yy*np.sin(c)/rho) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_sphere_full():\n \n num_voxels = 31\n c = (15.0, 15.0, 15.0)\n\n data_x = []\n data_y = []\n data_z = []\n data_intensity = []\n\n volume = numpy.zeros((num_voxels, num_voxels, num_voxels))\n\n for x in range(num_voxels):\n for y in range(num_voxels):\n for...
[ "0.599128", "0.59544706", "0.5854337", "0.58359677", "0.5774822", "0.57709026", "0.57272184", "0.570104", "0.56385297", "0.55973965", "0.5587924", "0.5579241", "0.5560049", "0.5556892", "0.5509854", "0.54964167", "0.5462277", "0.5460161", "0.5453829", "0.5449165", "0.5439587"...
0.6863035
0
Perform different collection dependent operations and validate we get CollectionNotAvailable exception for all the ops 1. Perform scope create/delete from SDK 2. Perform collection create/delete from SDK 3. Perform crud to target collection and validate
def test_collections_not_available(self): # Acquire SDK client for mutations client = self.sdk_client_pool.get_client_for_bucket(self.bucket) scope_name = self.bucket_util.get_random_name() col_name = self.bucket_util.get_random_name() try: client.create_collection(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basic_ops(self):\n load_spec = dict()\n verification_dict = dict()\n\n # Stat validation reference variables\n verification_dict[\"ops_create\"] = 0\n verification_dict[\"ops_update\"] = 0\n verification_dict[\"ops_delete\"] = 0\n verification_dict[\"rollba...
[ "0.6478409", "0.6240927", "0.6176871", "0.6035952", "0.60354066", "0.595611", "0.594751", "0.58774096", "0.57835233", "0.57726324", "0.57502973", "0.5734204", "0.5733641", "0.5721092", "0.5701316", "0.5699766", "0.5696797", "0.567209", "0.5648594", "0.5633532", "0.5613327", ...
0.6556466
0
Test to make sure timeout is handled in durability calls and no documents are loaded when durability cannot be met using error simulation in server node side This will validate failure in majority of nodes, where durability will surely fail for all CRUDs 1. Select a node from the cluster to simulate the specified error...
def test_timeout_with_crud_failures(self): # Local methods to validate vb_seqno def compare_vb_stat(stat_1, stat_2, vb, comparison="!="): keys_to_check = ["high_seqno", "high_completed_seqno"] result = True for key in keys_to_check: if vb in stat_1.k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_with_persistence_issues(self):\n\n if self.durability_level in [\n Bucket.DurabilityLevel.MAJORITY_AND_PERSIST_TO_ACTIVE,\n Bucket.DurabilityLevel.PERSIST_TO_MAJORITY]:\n self.log.critical(\"Test not valid for persistence durability\")\n return\n\...
[ "0.72220546", "0.7006495", "0.66652346", "0.6464856", "0.6201903", "0.6171258", "0.60649824", "0.6048298", "0.60285425", "0.59659433", "0.5917591", "0.5882442", "0.5838443", "0.5833825", "0.57513314", "0.5749805", "0.5723556", "0.5720168", "0.5686857", "0.5666851", "0.5659723...
0.7034123
1
Given a field, convert to a JSON serializable type
def _make_serializable(self, field): if isinstance(field, datetime): return str(field) elif isinstance(field, Decimal): return float(field) else: return field
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_field(value):\r\n if isinstance(value, basestring):\r\n return value\r\n\r\n return json.dumps(value, cls=EdxJSONEncoder)", "def _FieldToJsonObject(self, field, value):\n if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:\n return self._MessageToJsonObject(value)\...
[ "0.7454555", "0.7386094", "0.69976497", "0.6777119", "0.6751909", "0.66603667", "0.64811426", "0.63531446", "0.6318845", "0.6310226", "0.62857896", "0.6274474", "0.6269156", "0.62448287", "0.6216889", "0.61956656", "0.61125726", "0.61125726", "0.6108365", "0.6091767", "0.6085...
0.82485443
0
Given a dictionary of related entities names, nest the related entities into the given dictionary representation, of the original entity.
def _nest_dictionary_include(self, dictionary, include): related_entity = self.get_related_entity(list(include)[0]) if not isinstance(related_entity, InstrumentedList): dictionary[ related_entity.__singularfieldname__ ] = related_entity.to_nested_dict(include[list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _nest_string_include(self, dictionary, include):\n related_entity = self.get_related_entity(include)\n if not isinstance(related_entity, InstrumentedList):\n dictionary[related_entity.__singularfieldname__] = related_entity.to_dict()\n else:\n for entity in related_en...
[ "0.66751766", "0.61724216", "0.5608691", "0.5521861", "0.5493362", "0.54766047", "0.54461294", "0.54113847", "0.539981", "0.53932256", "0.53712", "0.5352817", "0.5349516", "0.53416413", "0.5324117", "0.5303318", "0.5291922", "0.52735025", "0.5255791", "0.52344567", "0.5196594...
0.7275026
0
Given the name of a single related entity, nest the related entity into the given dictionary representation of the original entity.
def _nest_string_include(self, dictionary, include): related_entity = self.get_related_entity(include) if not isinstance(related_entity, InstrumentedList): dictionary[related_entity.__singularfieldname__] = related_entity.to_dict() else: for entity in related_entity: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _nest_dictionary_include(self, dictionary, include):\n related_entity = self.get_related_entity(list(include)[0])\n if not isinstance(related_entity, InstrumentedList):\n dictionary[\n related_entity.__singularfieldname__\n ] = related_entity.to_nested_dict(in...
[ "0.6981927", "0.5456595", "0.5351446", "0.53328013", "0.52869356", "0.50926924", "0.5067823", "0.50247926", "0.4971832", "0.4952855", "0.4946507", "0.49437508", "0.49123368", "0.48964164", "0.48820087", "0.48600113", "0.48468426", "0.48367497", "0.48357335", "0.48296165", "0....
0.6343933
1
Given a string for the related entity name, return the related entity. This function is used to retrieve a related entity as a result of an include filter. Some related entities have a plural name (so end with an 's') so this is checked. If `entity` contains a name which is a singular, `entity` is uppercased (table nam...
def get_related_entity(self, entity): try: return getattr(self, entity if entity[-1] == "s" else entity.upper()) except AttributeError: raise FilterError(f" No related entity: {entity}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(name_or_entity):\n if isinstance(name_or_entity, (Subject, SubjectType)):\n return name_or_entity.name\n elif isinstance(name_or_entity, db.Model):\n return name_or_entity.key().name()\n else:\n return name_or_entity", "def get_entity_by_name(self, entity_name):\n ...
[ "0.59919703", "0.5937406", "0.58765435", "0.57505286", "0.56437147", "0.55702424", "0.55522764", "0.553932", "0.55249816", "0.5521107", "0.5295941", "0.5176583", "0.5176583", "0.5101699", "0.5007097", "0.499974", "0.4968771", "0.4964467", "0.49382612", "0.49290913", "0.491537...
0.74088454
0
Checks if privilaged access is enabled for the server. Throws an exception if it is not.
def __require_privilaged_access(self): if not self.getLoggedInUser(): raise codechecker_api_shared.ttypes.RequestFailed( codechecker_api_shared.ttypes.ErrorCode.UNAUTHORIZED, "The server must be start by using privilaged access to " "execute this actio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_access_priv(required_privilege_level):\n auth_user, prog_name, user, host, uuid = _get_client_info()\n priv_level = _get_priv_level(auth_user)\n if (PRIVILEGE_LEVELS.index(priv_level) <\n PRIVILEGE_LEVELS.index(required_privilege_level)):\n err = CONNECT_DENIED_PRIV_TMPL % (\n...
[ "0.7557653", "0.72404724", "0.6943704", "0.6715594", "0.6620799", "0.6591731", "0.6571485", "0.6571485", "0.6561439", "0.6561439", "0.63770384", "0.6369124", "0.6322632", "0.63182443", "0.6280057", "0.6267551", "0.6267551", "0.62510467", "0.6189843", "0.61657476", "0.61598116...
0.7526212
1
Checks if the curret user has PERMISSION_VIEW rights. Throws an exception if it is not.
def __require_permission_view(self): permission = codechecker_api_shared.ttypes.Permission.PERMISSION_VIEW if not self.__has_permission(permission): raise codechecker_api_shared.ttypes.RequestFailed( codechecker_api_shared.ttypes.ErrorCode.UNAUTHORIZED, "You a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view(self, user):\r\n return True", "def has_view_permission(self, request, obj=None):\n return True\n opts = self.opts\n codename = get_permission_codename('view', opts)\n return any([\n request.user.has_perm(\"%s.%s\" % (opts.app_label, codename)),\n ...
[ "0.7633026", "0.74133563", "0.73833144", "0.73323774", "0.73181283", "0.7290978", "0.7193194", "0.7171869", "0.70900744", "0.70630527", "0.7049611", "0.69974184", "0.6995054", "0.6973803", "0.6966059", "0.6943227", "0.69359297", "0.6922291", "0.6895127", "0.6892424", "0.68676...
0.7595057
1
Helper function to unpack the extra_params JSON string to a dict. If specified, add the config_db_session to this dict too.
def __unpack_extra_params(extra_params, session=None): if extra_params and extra_params != "": params = json.loads(extra_params) else: params = {} if session: params['config_db_session'] = session return params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extra_dejson(self):\n obj = {}\n if self.extra:\n try:\n obj = json.loads(self.extra)\n except Exception as e:\n self.log.exception(e)\n self.log.error(\"Failed parsing the json for conn_id %s\", self.conn_id)\n\n return ob...
[ "0.6527355", "0.5482184", "0.5454081", "0.541346", "0.53157496", "0.5295096", "0.5290023", "0.52707696", "0.5267996", "0.52658087", "0.52495235", "0.52490944", "0.52272344", "0.52263105", "0.5201891", "0.5200079", "0.51494527", "0.51418424", "0.5115259", "0.506082", "0.505991...
0.8805929
0
Helper function to transform the permissionspecific values from the API into the appropriate Python constructs needed by the permission library.
def __create_permission_args(perm_enum, extra_params_string, session): perm = permissions.permission_from_api_enum(perm_enum) params = ThriftAuthHandler.__unpack_extra_params(extra_params_string, session) return perm, params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_extract_permission_docstring(self):\n for permission, expected_dict in [\n (\n PermissionA & PermissionB,\n {\n \"PermissionA\": \"Permission A.\",\n \"PermissionB\": \"Permission B.\",\n },\n )...
[ "0.56616086", "0.5626562", "0.5614697", "0.54989165", "0.54741514", "0.5468934", "0.5415927", "0.5410423", "0.53547746", "0.5350134", "0.53181773", "0.5297058", "0.529078", "0.5254452", "0.52494055", "0.523184", "0.5169583", "0.51539904", "0.51349455", "0.50904536", "0.504561...
0.57189345
0
Returns all the defined permissions in the given permission scope.
def getPermissions(self, scope): return [permissions.api_enum_for_permission(p) for p in permissions.get_permissions(scope)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_permissions(self):\n # type: () -> List[Permission]\n headers = Headers({\"accept\": \"application/json\"})\n return self.connection.api_call(\n \"GET\", [\"resources\", self.id, \"permissions\"], model=Permission, headers=headers,\n )", "def get_permissions(self):...
[ "0.6820318", "0.6814613", "0.68080956", "0.6793074", "0.6764647", "0.66984344", "0.66721714", "0.6651246", "0.66414154", "0.66171235", "0.6599955", "0.6577237", "0.6561327", "0.6560519", "0.6550772", "0.65363073", "0.65345067", "0.65273196", "0.65273196", "0.65095675", "0.648...
0.8260817
0
Returns the permissions in the given permission scope and with the given scopespecific extra_params for the current logged in user, based on the permission filters. Filters in the perm_filter struct are joined in an AND clause.
def getPermissionsForUser(self, scope, extra_params, perm_filter): if perm_filter is None or not any(perm_filter.__dict__.values()): # If no filtering is needed, this function behaves identically # to getPermissions(). return self.getPermissions(scope) with DBSessio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def fetch_permissions(self, condensed=False):\n\n logging.debug(\"Getting permissions (%scondensed)\" % (\n \"\" if condensed else \"not \"))\n\n if condensed:\n perms = await self.client.request.get(\n \"/auth/permissions\", params={\"condensed\": True})\n ...
[ "0.5772158", "0.56378037", "0.5527674", "0.55151045", "0.5405103", "0.523535", "0.5208555", "0.5207722", "0.5189785", "0.5178944", "0.5175606", "0.5154353", "0.51384", "0.5122797", "0.5094861", "0.506578", "0.5061828", "0.50566465", "0.50273377", "0.5019476", "0.50016457", ...
0.72128654
0
Adds the given permission to the user or group named auth_name.
def addPermission(self, permission, auth_name, is_group, extra_params): with DBSession(self.__config_db) as session: perm, params = ThriftAuthHandler.__create_permission_args( permission, extra_params, session) if not require_manager(perm, params, self.__auth_session): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addUserPermission(self, name, _type):\n self._client.addUserPermission(name, _type)", "def add_permission(self, permission: str):\n setattr(self.scopes, permission, True)\n self.save(update_fields=[\"scopes\"])", "def add_user_grant(self, permission, user_id):\r\n acl = self.get...
[ "0.6800436", "0.6654492", "0.66036886", "0.65800774", "0.65765387", "0.6558139", "0.6409958", "0.6409958", "0.6350122", "0.6349882", "0.6331041", "0.6268157", "0.6261521", "0.6219297", "0.6207565", "0.6176919", "0.61668557", "0.6051228", "0.6022761", "0.60026187", "0.5873656"...
0.7970993
0
Removes the given permission from the user or group auth_name.
def removePermission(self, permission, auth_name, is_group, extra_params): with DBSession(self.__config_db) as session: perm, params = ThriftAuthHandler.__create_permission_args( permission, extra_params, session) if not require_manager(perm, params, self.__auth_session...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_permission(self, permission):\n self._permissions.remove(permission)", "def delPermission(self,request):\n request.needAuthType(request.ADMIN)\n request.checkArgs(\"admin_username\",\"perm_name\")\n request.getAuthNameObj().canDo(\"CHANGE ADMIN PERMISSIONS\")\n perm_...
[ "0.73214144", "0.7299543", "0.72618645", "0.71100914", "0.71083", "0.71083", "0.7041201", "0.7016033", "0.67834526", "0.67520237", "0.66453856", "0.6616732", "0.6514527", "0.6446896", "0.63673264", "0.6328633", "0.6277535", "0.6022995", "0.59801275", "0.5931496", "0.5857478",...
0.83243895
0
Generate a new personal access token with the given description.
def newToken(self, description): self.__require_privilaged_access() with DBSession(self.__config_db) as session: token = generate_session_token() user = self.getLoggedInUser() groups = ';'.join(self.__auth_session.groups) session_token = Session(token, use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_token(email):\n access_token = create_access_token(email)\n return access_token", "def auth_token_generate(identity_param_val, expires_delta=False):\n access_token = ''\n try:\n if expires_delta is not False:\n expires_delta = timedelta(minutes=e...
[ "0.6900923", "0.6899821", "0.6854177", "0.684906", "0.65835893", "0.6576911", "0.6561197", "0.6522176", "0.6501121", "0.6464966", "0.6422411", "0.64120436", "0.6355992", "0.6337109", "0.62936896", "0.6243143", "0.6217495", "0.61761385", "0.61607", "0.61149985", "0.6105348", ...
0.76991534
0
Removes the given personal access token of the logged in user.
def removeToken(self, token): self.__require_privilaged_access() with DBSession(self.__config_db) as session: # Check if the given token is a personal access token so it can be # removed. user = self.getLoggedInUser() num_of_removed = session.query(Session...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revoke_token(self, token, token_type_hint, request, *args, **kwargs):\n if token_type_hint:\n tok = self._tokengetter(**{token_type_hint: token})\n else:\n tok = self._tokengetter(access_token=token)\n if not tok:\n tok = self._tokengetter(refresh_t...
[ "0.68508357", "0.6681796", "0.66742015", "0.6516821", "0.6512082", "0.6453964", "0.641179", "0.63502675", "0.6316928", "0.626436", "0.6243326", "0.61909586", "0.6139808", "0.61332875", "0.61328125", "0.6090404", "0.60894763", "0.6081416", "0.6063863", "0.60013586", "0.5994144...
0.75845927
0
Show matplotlib plots immediately if using the inline backend. With ipywidgets 6.0, matplotlib plots don't work well with interact when using the inline backend that comes with ipykernel. Basically, the inline backend only shows the plot after the entire cell executes, which does not play well with drawing plots inside...
def show_inline_matplotlib_plots(): if 'matplotlib' not in sys.modules: # matplotlib hasn't been imported, nothing to do. return try: import matplotlib as mpl from ipykernel.pylab.backend_inline import flush_figures except ImportError: return if (mpl.get_backend...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed_matplotlib(self):", "def _ipython_display_(self):\n with self._sc:\n self._box._ipython_display_()", "def show():\n plt.show()", "def show():\n plt.show()", "def show():\n plt.show()", "def show():\n setup()\n plt.show()", "def update_plot():\n pass", ...
[ "0.67240685", "0.671005", "0.6426132", "0.6426132", "0.6426132", "0.64154273", "0.63586575", "0.63485914", "0.63166267", "0.62941664", "0.62881005", "0.6260716", "0.6200048", "0.61584425", "0.6113244", "0.6111419", "0.6110425", "0.6098969", "0.6076505", "0.60664433", "0.60629...
0.72732526
0
Match a pattern of types in a sequence.
def _matches(o, pattern): if not len(o) == len(pattern): return False comps = zip(o,pattern) return all(isinstance(obj,kind) for obj,kind in comps)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _match(self, *token_types):\n for token in token_types:\n if self._check(token):\n self._advance()\n return True\n\n return False", "def test_build_sequence_multiple_values(self):\n # Test basic sequence rule\n ...
[ "0.6306849", "0.6063895", "0.6062589", "0.60322946", "0.5910432", "0.5845407", "0.5746501", "0.5730287", "0.5725967", "0.57160014", "0.5696791", "0.5614536", "0.5550764", "0.5529471", "0.5435691", "0.54298306", "0.53875875", "0.53801197", "0.5365809", "0.53359324", "0.5335244...
0.65527374
0
Call the interact function and update the output widget with the result of the function call.
def update(self, *args): self.kwargs = {} if self.manual: self.manual_button.disabled = True try: show_inline_matplotlib_plots() with self.out: if self.clear_output: clear_output(wait=True) for widget in self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interact(self):\r\n pass", "def interact(self):\n # We use a library_interact instead of a normal interact here,\n # since this is an interact in the library, and a normal\n # \"@interact\" is all mangled.\n\n from sage.interacts.library import library_interact\n fro...
[ "0.6873947", "0.6764477", "0.6496218", "0.59996116", "0.584276", "0.5782574", "0.57297826", "0.5726981", "0.57025045", "0.5590474", "0.55040187", "0.54436517", "0.5438048", "0.54256636", "0.53991383", "0.5363977", "0.52975446", "0.5290476", "0.52520204", "0.52434456", "0.5166...
0.72222763
0
Find the abbreviations for the given function and kwargs. Return (name, abbrev, default) tuples.
def find_abbreviations(self, kwargs): new_kwargs = [] try: sig = self.signature() except (ValueError, TypeError): # can't inspect, no info from function; only use kwargs return [ (key, value, value) for key, value in kwargs.items() ] for param in sig....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_abbreviation(self, cell_content):\n span = cell_content.find(\"span\")\n full = span.attrs[\"title\"].strip()\n abbrv = span.text.strip()\n return abbrv, full", "def method_abbreviator(arg):\n regexp = re.compile(arg)\n matches = []\n for method in methods:\n if regex...
[ "0.55997264", "0.55988103", "0.55512005", "0.55499125", "0.54829174", "0.54123336", "0.5390938", "0.5324624", "0.53143686", "0.5279437", "0.5245413", "0.52400696", "0.52346224", "0.50955373", "0.5080197", "0.5065388", "0.5045806", "0.5037079", "0.503532", "0.5020661", "0.4980...
0.764695
0
Given a sequence of (name, abbrev, default) tuples, return a sequence of Widgets.
def widgets_from_abbreviations(self, seq): result = [] for name, abbrev, default in seq: widget = self.widget_from_abbrev(abbrev, default) if not (isinstance(widget, ValueWidget) or isinstance(widget, fixed)): if widget is None: raise ValueErro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def widget_from_abbrev(cls, abbrev, default=empty):\n if isinstance(abbrev, ValueWidget) or isinstance(abbrev, fixed):\n return abbrev\n\n if isinstance(abbrev, tuple):\n widget = cls.widget_from_tuple(abbrev)\n if default is not empty:\n try:\n ...
[ "0.65434057", "0.62620914", "0.5907812", "0.56015867", "0.53328896", "0.5304384", "0.52960455", "0.52779883", "0.5182024", "0.51722246", "0.51666266", "0.5141146", "0.51313585", "0.51123697", "0.5105806", "0.5079483", "0.5075808", "0.5056689", "0.5056689", "0.5035367", "0.503...
0.7826472
0
Build a ValueWidget instance given an abbreviation or Widget.
def widget_from_abbrev(cls, abbrev, default=empty): if isinstance(abbrev, ValueWidget) or isinstance(abbrev, fixed): return abbrev if isinstance(abbrev, tuple): widget = cls.widget_from_tuple(abbrev) if default is not empty: try: w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_widget(cls_or_instance: Any) -> ContainerWidget[ValueWidget]:\n values = None if isinstance(cls_or_instance, type) else _get_values(cls_or_instance)\n return _uifields_to_container(get_ui_fields(cls_or_instance), values=values)", "def create_widget(self, value: T | _Undefined = Undefined) -> Valu...
[ "0.7156323", "0.6786408", "0.58533776", "0.57980424", "0.57632685", "0.5763224", "0.5702193", "0.55954725", "0.53923345", "0.53619194", "0.5360439", "0.53555506", "0.53469926", "0.53051937", "0.51514065", "0.5137003", "0.51353097", "0.512663", "0.5123442", "0.5101219", "0.510...
0.72978383
0
Make widgets from an iterable. This should not be done for a string or tuple.
def widget_from_iterable(o): # Dropdown expects a dict or list, so we convert an arbitrary # iterable to either of those. if isinstance(o, (list, dict)): return Dropdown(options=o) elif isinstance(o, Mapping): return Dropdown(options=list(o.items())) else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _uifields_to_container(\n ui_fields: Iterable[UiField],\n values: Mapping[str, Any] | None = None,\n *,\n container_kwargs: Mapping | None = None,\n) -> ContainerWidget[ValueWidget]:\n from magicgui import widgets\n\n container = widgets.Container(\n widgets=[field.create_widget() for ...
[ "0.603943", "0.59534204", "0.58285683", "0.5662036", "0.564148", "0.5636002", "0.55858034", "0.5555193", "0.55464804", "0.5515366", "0.54974586", "0.5476306", "0.5476136", "0.54628336", "0.5435945", "0.5406763", "0.53550434", "0.52587557", "0.52172387", "0.52097", "0.5205433"...
0.6669193
0
Return the value for this widget which should be passed to interactive functions. Custom widgets can change this method to process the raw value ``self.value``.
def get_interact_value(self): return self.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(self):\n if self.notebook:\n return self.widget.value\n else:\n if hasattr(self.widget, \"value\"):\n return self.widget.value()\n elif hasattr(self.widget, \"currentText\"):\n return self.widget.currentText()\n e...
[ "0.82415944", "0.7548149", "0.7548149", "0.7548149", "0.7469256", "0.74551094", "0.74551094", "0.73919475", "0.73919475", "0.73919475", "0.73580617", "0.73580617", "0.7339713", "0.7287065", "0.7286482", "0.7276106", "0.72296405", "0.722479", "0.7199927", "0.71925837", "0.7192...
0.79434526
1
Returns True if clause is true (satisfied) or False if not satisfied.
def is_clause_satisfied(self, valuation_list, clause): for literal in clause: if literal < 0: v = 1 - valuation_list[-literal - 1] else: v = valuation_list[literal - 1] if v == 1: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_clause_satisfied(valuation_list, clause):\n for literal in clause:\n if literal < 0:\n v = 1 - valuation_list[-literal - 1]\n else:\n v = valuation_list[literal - 1]\n\n if v == 1:\n return True\n\n return False", "def one_true(conds):\n\n for...
[ "0.6426093", "0.59659606", "0.59554565", "0.59093994", "0.58817816", "0.582734", "0.58092874", "0.58092874", "0.5780725", "0.5756507", "0.5726416", "0.5719493", "0.5701392", "0.56912065", "0.56283927", "0.562499", "0.55559367", "0.55359155", "0.5531413", "0.55142295", "0.5512...
0.67531824
0
Fitness function with weights in order to identify the hard clauses
def fitness(self, valuation): return sum(map(lambda i: i['w'] * self.is_clause_satisfied(valuation, i['clause']), self.clauses))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitness(self):\n pass", "def _calculate_fitness(self):\n pass", "def fitness_function(neural_net):\r\n fitness = 25\r\n for i in range(1, 6):\r\n for j in range(1, 6):\r\n answer = np.exp(neural_net.calculate([np.log(i), np.log(j)])[0])\r\n ...
[ "0.73278224", "0.71118915", "0.6852314", "0.6778631", "0.6731181", "0.6659678", "0.6543733", "0.6529293", "0.65142494", "0.6491511", "0.64818954", "0.646624", "0.6402855", "0.63975805", "0.6379013", "0.6376958", "0.6361221", "0.6343551", "0.6323188", "0.62790895", "0.6278208"...
0.71778464
1
Update clauses weight to identify the hard clauses
def update_clauses_weight(self): for clause in self.clauses: clause['w'] = clause['w'] + 1 - self.is_clause_satisfied(self.global_best, clause['clause'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_clause_weights(self):\n self.clause_weights = np.ones(len(self.clauses), dtype=np.int)", "def updateWeights(self,weightUpdate):\n\t\n\t\tbranches = self.collectAllBranches()\n\n\t\tfor i in range(self.nBranches):\n\n\t\t\tbranches[i].weight -= weightUpdate[i]", "def update_weights(self):...
[ "0.68354654", "0.6344763", "0.62895304", "0.6028888", "0.6028666", "0.5940405", "0.58278716", "0.5811622", "0.57929915", "0.5784587", "0.5732507", "0.57304317", "0.5729231", "0.57145494", "0.56781715", "0.5653222", "0.5609049", "0.55869013", "0.5580688", "0.54819936", "0.5480...
0.8432571
0
Number of satisfied clauses with given valuation
def num_satisfied_clauses(self, val_list): num_true_clauses = 0 for c in self.clauses: num_true_clauses += self.is_clause_satisfied(val_list, c['clause']) return num_true_clauses
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitness(self, valuation):\n return sum(map(lambda i: i['w'] * self.is_clause_satisfied(valuation, i['clause']), self.clauses))", "def solution(i, literals, clauses):\n valuation_list = binary_list(i, literals)\n num_true_clauses = 0\n\n for c in clauses:\n num_true_clauses += is_clause...
[ "0.70631784", "0.67033887", "0.65471554", "0.61733276", "0.6066021", "0.6004589", "0.59886974", "0.5926692", "0.5896444", "0.5818225", "0.5800353", "0.5769594", "0.574551", "0.5736465", "0.57226527", "0.5703242", "0.56671673", "0.5644893", "0.5639909", "0.5623285", "0.5597545...
0.72403574
0
Local search that doesn't flip every bit of particle, but only randomly chosen k % of particle length
def local_search_random_k(self, particle, fitness, k): improvement = 1 nbrflip = 0 while improvement > 0 and nbrflip < self.max_flip and particle.position not in self.tabuList: improvement = 0 for i in sample(range(self.num_literals), int(self.num_literals*k)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_walk(n, p):\n random_array = np.random.uniform(0, 1, n)\n left = random_array[random_array > p].size\n right = n - left\n \n return (right-left)", "def solution3(nums, K):\n modSeen = {0:-1}\n s = 0\n for i in range(len(nums)):\n n = nums[i]\n s += n\n mod ...
[ "0.6029336", "0.5921499", "0.591397", "0.58484614", "0.58470005", "0.5806551", "0.57981557", "0.57783556", "0.57715005", "0.5751681", "0.575026", "0.5740897", "0.5667054", "0.5616238", "0.5614245", "0.55603385", "0.554581", "0.5543597", "0.55319035", "0.553032", "0.55213654",...
0.732121
0
Remove node object from list by index
def removeNode(self, index): del self.nodes[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_a_specific_item(self, index):\n\n current = self.head\n previous = None\n for i in range(index):\n previous = current\n current = current.next\n if previous is None: self.head = current.next\n else: previous.next = current.next\n self.size ...
[ "0.76427823", "0.7413118", "0.73565614", "0.73051375", "0.7282952", "0.7209629", "0.71623164", "0.71563464", "0.7112378", "0.7101152", "0.70595527", "0.7057477", "0.70570284", "0.7045277", "0.70423543", "0.70323426", "0.7025147", "0.70203966", "0.69942147", "0.6972183", "0.69...
0.7771887
0
Checks whether the object is a sheet
def isSheet(self): return True if self.leftSon is None and self.rightSon is None else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_sheet(path, sheet): \n xl = pd.ExcelFile(path)\n if sheet not in xl.sheet_names:\n raise ValueError(\"Invalid sheet name \\'\" + sheet +\"\\'\")", "def check_presSheetExists(self):\n\n if not self.pres_sheetname:\n self.raise_excelerror(\"Required sheet for preservation files\"...
[ "0.66219234", "0.61277586", "0.60819465", "0.5930213", "0.5887744", "0.5702059", "0.5631677", "0.56167376", "0.55882126", "0.5522886", "0.55084896", "0.5459295", "0.5446342", "0.54172677", "0.5390506", "0.5380341", "0.5351818", "0.53457916", "0.53396326", "0.533245", "0.53252...
0.7400545
0
Callback for a request to stop or start the turtlebot.
def handle_start_stop(self, req): # if turtlebot is moving, stop it if self.is_moving: self.is_moving = False r = rospy.Rate(2) cmd_msg = Twist() cmd_msg.linear.x = NO_SPEED cmd_msg.angular.z = NO_SPEED self.cmd_pub.publish(cmd_msg) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _stop_bot(_event):\n pass", "def start():\n\tdata = bottle.request.json\n\t(\"START:\", json.dumps(data))\n\n\tresponse = {\"color\": \"#4F1851\", \"headType\": \"evil\", \"tailType\": \"hook\"}\n\treturn HTTPResponse(\n\t\tstatus=200,\n\t\theaders={\"Content-Type\": \"application/json\"},\n\t\tbody=j...
[ "0.5796821", "0.5615687", "0.54661393", "0.5440809", "0.54155004", "0.5407269", "0.5348813", "0.52929497", "0.5290731", "0.5290731", "0.5290731", "0.5290731", "0.52868515", "0.521621", "0.5197771", "0.51816416", "0.5175744", "0.51570326", "0.5147758", "0.5133411", "0.5114982"...
0.7249804
0