query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
List all team permission.
def get(self, namespace_name, repository_name): repo_perms = model.get_repo_permissions_by_team(namespace_name, repository_name) return { "permissions": {repo_perm.team_name: repo_perm.to_dict() for repo_perm in repo_perms} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_permissions(self, obj=None):", "def permission_list(**kwargs):\n print(AppPermissionSchema(many=True).dumps(\n get_protected_routes(ignored_methods=[\"HEAD\", \"OPTIONS\"]), indent=4))", "def list_permissions(self):\n # type: () -> List[Permission]\n headers = Headers({\"acc...
[ "0.69757116", "0.66345817", "0.660606", "0.64571464", "0.63002855", "0.628889", "0.62780464", "0.61253816", "0.61128354", "0.61018157", "0.5995363", "0.5976183", "0.5949294", "0.59394085", "0.5909458", "0.58587104", "0.5855204", "0.5845181", "0.58366287", "0.581424", "0.58099...
0.0
-1
List all user permissions.
def get(self, namespace_name, repository_name): perms = model.get_repo_permissions_by_user(namespace_name, repository_name) return {"permissions": {p.username: p.to_dict() for p in perms}}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_permissions(self, obj=None):", "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=heade...
[ "0.75751245", "0.73834115", "0.72949976", "0.7267417", "0.72163457", "0.7042651", "0.70280373", "0.6959966", "0.68964267", "0.68892825", "0.6889239", "0.6811673", "0.6780667", "0.67715466", "0.6721219", "0.67054623", "0.66290385", "0.6620296", "0.6596797", "0.65005773", "0.64...
0.0
-1
Get the fetch the permission for the specified user.
def get(self, namespace_name, repository_name, username): roles = model.get_repo_roles(username, namespace_name, repository_name) if not roles: raise NotFound return {"permissions": [r.to_dict() for r in roles]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_permission_user(self, user_id):\n return self.execute(TABELLE[\"id_users\"]['select']['from_id'], (user_id,))", "def get_permissions(self, user_id):\n response = self.request(\n \"{0}/{1}/permissions\".format(self.version, user_id), {}\n )[\"data\"]\n return {x[\"pe...
[ "0.7239079", "0.65985906", "0.6469698", "0.64613885", "0.6277166", "0.62625575", "0.59860975", "0.59800744", "0.59741765", "0.59494346", "0.5915776", "0.585663", "0.583475", "0.5777678", "0.5766168", "0.5751022", "0.5751022", "0.5751022", "0.57379436", "0.57203126", "0.569092...
0.0
-1
Get the permission for the specified user.
def get(self, namespace_name, repository_name, username): logger.debug( "Get repo: %s/%s permissions for user %s", namespace_name, repository_name, username ) perm = model.get_repo_permission_for_user(username, namespace_name, repository_name) return perm.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_permission_user(self, user_id):\n return self.execute(TABELLE[\"id_users\"]['select']['from_id'], (user_id,))", "def get_user_access(self, user):\n return self._access_lists.get_user_access(user)", "def get_permissions(self, user_id):\n response = self.request(\n \"{0}/{...
[ "0.7769315", "0.6808219", "0.6732032", "0.665257", "0.6546927", "0.64956015", "0.6325469", "0.6297617", "0.62080187", "0.617003", "0.60951394", "0.6093674", "0.60287756", "0.60243547", "0.5992891", "0.59886146", "0.5979663", "0.5977385", "0.5977385", "0.5977385", "0.58665884"...
0.0
-1
Update the perimssions for an existing repository.
def put(self, namespace_name, repository_name, username): # Also needs to respond to post new_permission = request.get_json() logger.debug("Setting permission to: %s for user %s", new_permission["role"], username) try: perm = model.set_repo_permission_for_user( use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n with enforce_unique_instance('repository', blocking=True):\n for dist, component in self.pending:\n self.update_sources(dist, component)", "def run(self):\n self.update_repos()", "def update_from_repo():\n\treturn", "def patch_repos(self):", "def ...
[ "0.5624948", "0.55694103", "0.551335", "0.5509461", "0.5326865", "0.51712257", "0.5032234", "0.5023246", "0.49632308", "0.49441203", "0.49252254", "0.49054015", "0.49000284", "0.48886573", "0.4875982", "0.48709068", "0.4857324", "0.48136276", "0.48007572", "0.47947913", "0.47...
0.49540687
9
Delete the permission for the user.
def delete(self, namespace_name, repository_name, username): try: model.delete_repo_permission_for_user(username, namespace_name, repository_name) except DeleteException as ex: raise request_error(exception=ex) log_action( "delete_repo_permission", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteUserPermission(self, name, _type):\n self._client.deleteUserPermission(name, _type)", "def delPermission(self,request):\n request.needAuthType(request.ADMIN)\n request.checkArgs(\"admin_username\",\"perm_name\")\n request.getAuthNameObj().canDo(\"CHANGE ADMIN PERMISSIONS\")\...
[ "0.8090717", "0.7764836", "0.7151028", "0.71079904", "0.70989025", "0.7064908", "0.7009354", "0.6998759", "0.6984596", "0.69559675", "0.69559675", "0.69559675", "0.69385684", "0.6929453", "0.69187593", "0.69175446", "0.69071263", "0.6871483", "0.68463683", "0.68181336", "0.67...
0.0
-1
Fetch the permission for the specified team.
def get(self, namespace_name, repository_name, teamname): logger.debug( "Get repo: %s/%s permissions for team %s", namespace_name, repository_name, teamname ) role = model.get_repo_role_for_team(teamname, namespace_name, repository_name) return role.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_team(self, filter_) -> Optional[Team]:\n have_access_to_all_data = current_user.has_role(\n \"superadmin\"\n ) or current_user.has_role(\"dataprovider\")\n if have_access_to_all_data:\n return super()._get_team(filter_)\n\n return current_user.writable_tea...
[ "0.6106908", "0.5748608", "0.56881076", "0.56774604", "0.55650204", "0.55000824", "0.5437011", "0.5423022", "0.5415314", "0.537421", "0.5367137", "0.536253", "0.53582126", "0.5344388", "0.5340846", "0.5338855", "0.53167564", "0.52845156", "0.5233721", "0.5189439", "0.51863176...
0.58408916
1
Update the existing team permission.
def put(self, namespace_name, repository_name, teamname): new_permission = request.get_json() logger.debug("Setting permission to: %s for team %s", new_permission["role"], teamname) try: perm = model.set_repo_permission_for_team( teamname, namespace_name, repository...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch(self, team_id, project_id):\n try:\n role = request.get_json(force=True)[\"role\"]\n except DataError as e:\n current_app.logger.error(f\"Error validating request: {str(e)}\")\n return {\"Error\": str(e), \"SubCode\": \"InvalidData\"}, 400\n\n try:\n ...
[ "0.6878937", "0.6413856", "0.63367105", "0.6301946", "0.6131176", "0.6117391", "0.6080835", "0.6073183", "0.60508394", "0.5943088", "0.5899792", "0.5887498", "0.5872705", "0.58438593", "0.58361334", "0.5809778", "0.5783322", "0.57781184", "0.5766685", "0.57608736", "0.5757116...
0.7250105
0
Delete the permission for the specified team.
def delete(self, namespace_name, repository_name, teamname): try: model.delete_repo_permission_for_team(teamname, namespace_name, repository_name) except DeleteException as ex: raise request_error(exception=ex) log_action( "delete_repo_permission", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, team_id, project_id):\n try:\n if not ProjectAdminService.is_user_action_permitted_on_project(\n token_auth.current_user, project_id\n ):\n raise ValueError()\n TeamService.delete_team_project(team_id, project_id)\n r...
[ "0.7109674", "0.6906455", "0.68499994", "0.65539867", "0.6553986", "0.6496513", "0.6424808", "0.6421946", "0.6375451", "0.6275419", "0.62340474", "0.61389846", "0.60871977", "0.60866475", "0.60756767", "0.60446537", "0.6017358", "0.59312886", "0.5928676", "0.58963335", "0.588...
0.66470784
3
Print game completion message.
def mystery_solved(): print("\nThe butler: The mystery is solved! I knew it was someone in the family. Well done!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_start_game():\n print(HANGMAN_ASCII_ART)\n print(MAX_TRIES)", "def completion() -> None:", "def finishTurn(self):\n print \"go\"\n sys.stdout.flush()", "def print_message(self):\r\n # print(\"Word : \" + game_instance.get_word())\r\n print(\"\\nCurrent gues...
[ "0.64319634", "0.64281833", "0.63054615", "0.63038766", "0.6295851", "0.6287898", "0.6244639", "0.62441856", "0.6229415", "0.62243104", "0.6224273", "0.62100625", "0.6146835", "0.61362207", "0.6119687", "0.61089575", "0.610242", "0.6088267", "0.60251814", "0.6006519", "0.5987...
0.0
-1
Set character's energy to zero which ends the game.
def game_over(char_dict: dict, family_name: str): char_dict['Energy'] = 0 print(family_name + " is persistent and painful and you lose all interest in the case.\n" "You secretly slink out the back entrance so the butler doesn't see that\n" "you've given up.\n\nGam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self.change_power(0)", "def reset_hp():\n\n global character\n character['HP'] = 10", "def reset(self):\r\n pg.event.clear()\r\n self.stop_powerpellet()\r\n if not self.eaten:\r\n self.dot_counter = 0\r\n self.eaten = False\r\n self.e...
[ "0.64097255", "0.62823176", "0.6174342", "0.6149164", "0.6142883", "0.610212", "0.6058763", "0.60425085", "0.60215926", "0.5955238", "0.59329295", "0.586241", "0.58558756", "0.58372647", "0.5812641", "0.5810026", "0.5805393", "0.5804163", "0.5733548", "0.5711218", "0.56904644...
0.5333339
73
Check if buffer size exceeds self.maxBuffer
def addToBuffer(self, request): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _buffer_capacity_reached(self) -> bool:\n return self.size() >= self.buffer_capacity", "def bufferIsFull(self):\n return len(self.buffer) == self.bufferSize", "def _is_frame_legal_size(data: bytes) -> bool:\n return len(data) < UDP_MAX_SIZE", "def is_full(self):\n return len(s...
[ "0.80721533", "0.73998564", "0.68600214", "0.6791188", "0.6791188", "0.6791188", "0.6791188", "0.6718588", "0.662366", "0.65661204", "0.6531256", "0.65231436", "0.65231436", "0.6522921", "0.6437966", "0.63562244", "0.63402045", "0.6331438", "0.63282627", "0.6315132", "0.63104...
0.0
-1
add event 'event', which is of type event to minheap of events assign an id to it return the assigned id
def addEvent(self, event): event.__id=id id+=1 self.addToHeap(event) return event.__id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_id(self, event_name):\n try:\n event_id = self.gui_event_ids[event_name]\n except KeyError:\n event_id = len(self.gui_events)\n self.gui_event_ids[event_name] = event_id\n self.gui_events.append(event_name)\n if event_id >= 16383:\n ...
[ "0.64335954", "0.6268853", "0.61110896", "0.61066127", "0.6027039", "0.5884291", "0.587974", "0.5795214", "0.5773811", "0.57574904", "0.56374335", "0.56098413", "0.56089914", "0.5601371", "0.5556427", "0.5553871", "0.5553545", "0.55280185", "0.5497093", "0.5451976", "0.544849...
0.82262385
0
Remove and return next event with least timestamp
def removeEvent(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _next_to_purge_timestamp(self):\n if self.ages and self._samples_max_age:\n # Take the oldest entry from the ages list and add the configured max_age.\n # If executed after purging old states, the result is the next timestamp\n # in the future when the oldest state will ...
[ "0.63159525", "0.6143254", "0.6135074", "0.599013", "0.5976243", "0.590961", "0.5905217", "0.5878188", "0.58584446", "0.5806181", "0.5803459", "0.58032966", "0.56974655", "0.5686538", "0.5634093", "0.5618402", "0.55854666", "0.55747867", "0.557122", "0.55228305", "0.54264927"...
0.0
-1
make sure the total size of all queues remains less than max size of thread pool.
def runQueueEnqueue(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_appropriate_async_thread_pool_size(env):\n\n controllers = env.get_nodes_by_role('controller')\n controller = random.choice(controllers)\n with controller.ssh() as remote:\n # wait when rabbit will be ok after snapshot revert\n wait_for_rabbit_running_nodes(remote, len(control...
[ "0.67586976", "0.6637494", "0.6598654", "0.63998634", "0.6377809", "0.6371986", "0.6368412", "0.6361182", "0.63530034", "0.6224969", "0.61984015", "0.61849844", "0.61803305", "0.6170862", "0.61289024", "0.6123547", "0.61158615", "0.6104547", "0.61040914", "0.6098823", "0.6086...
0.0
-1
Creates a new instance of DeployWidget.
def __init__(self, parent, **kwargs): PyGlassWidget.__init__(self, parent, **kwargs) self.deployBtn.clicked.connect(self._handleDeployClick) self.cancelBtn.clicked.connect(self._handleCancelClick) self._canceled = True self._includeEmails = False self._buildMessage = u'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy(self):\n\n netlify_cli = getattr(settings, \"NETLIFY_PATH\", None)\n if not netlify_cli:\n raise CommandError(\"NETLIFY_PATH is not defined in settings\")\n\n deployment = Deployment()\n deployment.save()\n\n command = [netlify_cli, \"deploy\"]\n comm...
[ "0.657977", "0.61469895", "0.56630373", "0.5582046", "0.5580566", "0.5563732", "0.55471534", "0.5516898", "0.54893273", "0.5438963", "0.5425074", "0.5425074", "0.5425074", "0.53777945", "0.53723174", "0.5352244", "0.5342512", "0.5328122", "0.5319035", "0.5315195", "0.5309673"...
0.58545977
2
Given `src_lines`, a list of lines of a single record, this will instantiate and populate an object corresponding to the data.
def __init__(self, src_lines): self.study_id = None self.citation = None self.abstract = None self.authors = [] self.study_matrices = {} self.history_date = None self.history_time = None self.history_person = None self.history_event = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_lines(cls, lines: List[str], mode: str):\n for line in lines:\n if line.startswith('Original Input'):\n _input = line[line.find(':') + 1 :].strip()\n elif line.startswith('Predicted Str'):\n pred = line[line.find(':') + 1 :].strip()\n e...
[ "0.6313051", "0.614401", "0.60776645", "0.60666007", "0.5890082", "0.5835735", "0.57116175", "0.56871676", "0.56600964", "0.5596233", "0.5578453", "0.556857", "0.556857", "0.556857", "0.55126864", "0.5510738", "0.54882395", "0.54770136", "0.54094434", "0.5392297", "0.53723717...
0.7402475
0
Return a string representing the key sequence used to get the specified message using the given dictionary
def messagetokeystring(message, keydict): return ''.join([' ' + str(keydict[char]) if i - 1 >= 0 and str(keydict[char])[0] == str(keydict[message[i - 1]])[0] else str(keydict[char]) for i, char in enumerate(mes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetKeyString(self):", "def _GetKeyString(self):", "def keysequence(value):\r\n return value.toString()", "def _get_key(self, val: Span) -> str:\n return \"\".join(val._.phonemes)", "def create_key(message, key):\n if len(key) > len(message):\n return key[0:len(message)]\n ne...
[ "0.6046165", "0.6046165", "0.59045553", "0.5791385", "0.5728902", "0.56914884", "0.56797653", "0.56692123", "0.5655976", "0.56355053", "0.5619594", "0.5616496", "0.55933964", "0.5576578", "0.5567661", "0.55604446", "0.5541098", "0.5538641", "0.5535081", "0.5518018", "0.550610...
0.7381706
0
Return a dict mapping each alphabet letter to the corresponding T9 number sequence
def getT9dict(): T9dict = {} all_letters = string.lowercase T9dict.update(mapkeystoletter(2, all_letters[0:3])) T9dict.update(mapkeystoletter(3, all_letters[3:6])) T9dict.update(mapkeystoletter(4, all_letters[6:9])) T9dict.update(mapkeystoletter(5, all_letters[9:12])) T9dict.update(ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetAlphabet(self):\n alphabet = list(self._charAlphabet) #Creates a list of the alphabet characters\n numbers = [i for i in range(0,26)] #Creates a list of numbers up to 25\n numberOff = dict( zip(alphabet, numbers)) #Pairs each character with a number in a chronological sequence to number...
[ "0.6782532", "0.6357176", "0.63480806", "0.6239313", "0.61492985", "0.613621", "0.6120783", "0.6088525", "0.59723955", "0.59683824", "0.5959332", "0.59540445", "0.59540445", "0.59315383", "0.59235865", "0.5881295", "0.58502054", "0.5826376", "0.5803708", "0.5794347", "0.56974...
0.7683451
0
Return a dict mapping each key appropriately to each letter such that each letter is mapped to a string containing the key n number of times, where n is the position of the letter in the given letters string
def mapkeystoletter(key, letters): return dict((v, ''.join([str(key) for i in range(k)])) for k, v in enumerate(letters, 1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dictionaries(chars):\n return dict((c, i) for i, c in enumerate(chars)), dict((i, c) for i, c in enumerate(chars))", "def english_dictionary(letters, n): \n assert (isinstance(letters, list)), \"First argument must be a list\"\n assert (isinstance(n, int)), \"Second argument must be an intege...
[ "0.72586536", "0.7226152", "0.71658975", "0.7153065", "0.71221644", "0.7014463", "0.6943903", "0.68634564", "0.6783479", "0.6693765", "0.66723007", "0.6574703", "0.65711844", "0.6381239", "0.63740134", "0.63730866", "0.63467705", "0.6322638", "0.62977695", "0.6290113", "0.627...
0.7698916
0
split a univariate sequence into samples
def split_sequence(sequence, input_dim, output_dim, first_demand_column=0): x, y = list(), list() for i in range(input_dim,len(sequence),1): """ gather input and output parts of the pattern """ seq_x, seq_y = sequence[i-input_dim:i], sequence[i:i+output_dim,first_demand_column:] if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_dataset(dataset):\n sequence = dataset.split()\n return sequence", "def split_dataset(dataset):\n sequence = dataset.split()\n return sequence", "def split_into_samples(seq, n_steps_past, n_steps_future):\n \n X_Series, Y_Series = list(), list()\n\n for step in range(0,len(seq)):...
[ "0.6677756", "0.6677756", "0.66103435", "0.6389658", "0.6378601", "0.63705593", "0.63063943", "0.6151374", "0.61302936", "0.6097308", "0.60888433", "0.6078925", "0.6040081", "0.6023353", "0.60004735", "0.5985896", "0.5974302", "0.59282416", "0.5897232", "0.5871716", "0.586609...
0.6648033
2
model creation and training
def model_create_ffnn(input_dim, output_dim, n_features, n_houses, x_train, y_train, x_test, y_test, early=None): model = Sequential() for _ in range(nn_hparams['num_layers']): model.add(Dense(nn_hparams['units'], activation=nn_hparams['activation'], input_shape=(input_dim,n_features))) mode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model():", "def trainModel( self, featureTrain, classTrain):", "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def _train_model(self):\n raise NotImplementedError(...
[ "0.76967067", "0.76256853", "0.7620588", "0.7585362", "0.757728", "0.7512155", "0.7403861", "0.7369158", "0.73606354", "0.73377156", "0.7330682", "0.7310062", "0.7298011", "0.7276678", "0.7276678", "0.72764146", "0.72536695", "0.725211", "0.725211", "0.725211", "0.725211", ...
0.0
-1
model creation and training
def model_create_lstm(input_dim, output_dim, n_features, n_houses, x_train, y_train, x_test, y_test, early=None): model = Sequential() for _ in range(nn_hparams['num_layers']): model.add(LSTM(nn_hparams['units'], activation=nn_hparams['activation'], input_shape=(input_dim,n_features), return_sequence...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model():", "def trainModel( self, featureTrain, classTrain):", "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def _train_model(self):\n raise NotImplementedError(...
[ "0.7697017", "0.7625617", "0.76197934", "0.7584975", "0.7576618", "0.7511508", "0.740331", "0.7369288", "0.7360732", "0.73377633", "0.73307186", "0.7310097", "0.72974545", "0.7277442", "0.7277442", "0.7276225", "0.7253741", "0.72519624", "0.72519624", "0.72519624", "0.7251962...
0.0
-1
model creation and training
def model_create_gru(input_dim, output_dim, n_features, n_houses, x_train, y_train, x_test, y_test, early=None): model = Sequential() for _ in range(nn_hparams['num_layers']): model.add(GRU(nn_hparams['units'], activation=nn_hparams['activation'], input_shape=(input_dim,n_features), return_sequences=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model():", "def trainModel( self, featureTrain, classTrain):", "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def _train_model(self):\n raise NotImplementedError(...
[ "0.7697649", "0.7625889", "0.76210135", "0.75852257", "0.7577639", "0.7512638", "0.7404862", "0.7369361", "0.73614246", "0.7338201", "0.73306173", "0.73102576", "0.729796", "0.7276884", "0.7276884", "0.72766906", "0.7253512", "0.7253205", "0.7253205", "0.7253205", "0.7253205"...
0.0
-1
model creation and training
def model_create_cnn(input_dim, output_dim, n_features, n_houses, x_train, y_train, x_test, y_test, early=None): model = Sequential() for _ in range(nn_hparams['num_layers']): model.add(Conv1D(filters=nn_hparams['filters'], kernel_size=nn_hparams['kernel_size'], activation=nn_hparams['activation'], i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model():", "def trainModel( self, featureTrain, classTrain):", "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def _train_model(self):\n raise NotImplementedError(...
[ "0.7697017", "0.7625617", "0.76197934", "0.7584975", "0.7576618", "0.7511508", "0.740331", "0.7369288", "0.7360732", "0.73377633", "0.73307186", "0.7310097", "0.72974545", "0.7277442", "0.7277442", "0.7276225", "0.7253741", "0.72519624", "0.72519624", "0.72519624", "0.7251962...
0.0
-1
use the created model to get predictions for any unprocessed input
def model_predict(model, x_input): stacked, _ = stack_multiple_series(x_input, preprocessed=True, scaler=scales) stacked = stacked.reshape(-1,stacked.shape[0],stacked.shape[1]) res = model.predict(stacked) res = res.reshape(-1, 1, 1) ans = [] for i, facility in enumerate(facilities): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _predict_preproc_model(self, model_cfg, model,):\n model = self._make_model(model_cfg['model_name'], databunch=self._data)\n model.model_param = model_cfg['model_param']\n model.wrapper_params = model_cfg['wrapper_params']\n return(model)", "def fit_predict(self):\n self.cl...
[ "0.7526022", "0.7109503", "0.70403886", "0.6940798", "0.69303405", "0.6907373", "0.688796", "0.68690026", "0.6831816", "0.6825305", "0.68184257", "0.6811659", "0.67703575", "0.67471313", "0.67283165", "0.67034394", "0.6683318", "0.6679439", "0.6673481", "0.6667711", "0.666553...
0.0
-1
Test that the Resource class is instantiated as expected.
def test_init(self, r, attribute_tup): num_wires, num_gates, gate_types, gate_sizes, depth, shots = attribute_tup assert r.num_wires == num_wires assert r.num_gates == num_gates assert r.depth == depth assert r.shots == shots assert r.gate_types == gate_types ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init(self):\n\n class TestResource(BaseResource):\n\n name = 'test_resource'\n\n def process(self, message):\n pass\n\n api = Mock()\n api.endpoint = 'http://an_endpoint'\n route = '/a_route'\n TestResource.init(api, route)\n\n ...
[ "0.79470116", "0.7535846", "0.72418135", "0.7161957", "0.7018344", "0.69540334", "0.6840166", "0.67427105", "0.6730258", "0.67228204", "0.6720178", "0.6697142", "0.66389906", "0.66130424", "0.6577583", "0.65483236", "0.6547399", "0.6512696", "0.6500128", "0.6499864", "0.64974...
0.0
-1
Test that an error is raised if we try to set any attribute.
def test_set_attributes_error(self): r = Resources() attr_lst = ["num_wires", "num_gates", "depth", "shots", "gate_types"] for attr_name in attr_lst: with pytest.raises(FrozenInstanceError, match="cannot assign to field"): setattr(r, attr_name, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_property_invalid(self):\n\n self.assertRaises(DataObjectError,\n setattr(self, \"foobar\", \"some value\")\n )", "def test_set_invalid_attribute(test_file):\n md = OSXMetaData(test_file.name)\n with pytest.raises(AttributeError):\n md.invalid_attribute = \"value\"",...
[ "0.7774631", "0.7728713", "0.73779714", "0.7314839", "0.718269", "0.7158087", "0.7150085", "0.7049921", "0.69631135", "0.6948488", "0.6886619", "0.6859293", "0.68010056", "0.6789779", "0.6789234", "0.67759836", "0.67382133", "0.6715289", "0.670365", "0.66835713", "0.66804326"...
0.7709142
2
Test the string representation of a Resources instance.
def test_str(self, r, rep): assert str(r) == rep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str(self):\n \n # Create a Resource object\n resource = Resource(1, \"White Noise\", Name(\"Don\", \"\", \"DeLillo\"), \n \"Delillo's White Noise follows narrator Jack \"\\\n \"Gladney, a professor at a small Liberal Arts \"\\\n ...
[ "0.69858843", "0.6690042", "0.65925443", "0.65398246", "0.63936853", "0.6231223", "0.6173892", "0.61191833", "0.60786456", "0.5948287", "0.5941849", "0.588382", "0.5881345", "0.5877128", "0.5874582", "0.5856679", "0.58358604", "0.5779244", "0.577448", "0.57712156", "0.5765452...
0.5395529
63
Test the repr method of a Resources instance looks as expected.
def test_repr(self, r, rep): assert repr(r) == rep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_repr(self):\n \n # Create a Resource object\n resource = Resource(1, \"White Noise\", Name(\"Don\", \"\", \"DeLillo\"), \n \"Delillo's White Noise follows narrator Jack \"\\\n \"Gladney, a professor at a small Liberal Arts \"\\\n ...
[ "0.80957806", "0.79900897", "0.7360948", "0.72866344", "0.7135619", "0.71316963", "0.7114563", "0.7029921", "0.7014224", "0.6987679", "0.69360983", "0.69288915", "0.69223106", "0.6910305", "0.68883425", "0.6882751", "0.6816729", "0.6804138", "0.67528766", "0.6745733", "0.6745...
0.7317369
3
Test that the equality dunder method is correct for Resources.
def test_eq(self): r1 = Resources(4, 2, {"Hadamard": 1, "CNOT": 1}, {1: 1, 2: 1}, 2, Shots(100)) r2 = Resources(4, 2, {"Hadamard": 1, "CNOT": 1}, {1: 1, 2: 1}, 2, Shots(100)) r3 = Resources(4, 2, {"CNOT": 1, "Hadamard": 1}, {2: 1, 1: 1}, 2, Shots(100)) # all equal r4 = Resources(1, 2, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testEquality(self):\n pass", "def __eq__(self, other: 'Resource') -> bool:\n if not isinstance(other, self.__class__):\n return False\n return self.__dict__ == other.__dict__", "def assert_equal_resource(res1, res2):\n assert isinstance(res1, FakedBaseResource)\n asser...
[ "0.7314152", "0.72189605", "0.7174685", "0.7077528", "0.6794791", "0.6717936", "0.67031395", "0.66849434", "0.6618718", "0.6528539", "0.6495091", "0.6438724", "0.6425555", "0.63503706", "0.63453996", "0.6344413", "0.63160825", "0.62906426", "0.6265871", "0.62443507", "0.62326...
0.73252475
0
Test that the ipython display prints the string representation of a Resources instance.
def test_ipython_display(self, r, rep, capsys): r._ipython_display_() # pylint: disable=protected-access captured = capsys.readouterr() assert rep in captured.out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_repr(self):\n \n # Create a Resource object\n resource = Resource(1, \"White Noise\", Name(\"Don\", \"\", \"DeLillo\"), \n \"Delillo's White Noise follows narrator Jack \"\\\n \"Gladney, a professor at a small Liberal Arts \"\\\n ...
[ "0.68942446", "0.6583981", "0.65676314", "0.654316", "0.6541214", "0.65176785", "0.64646506", "0.6456249", "0.6401724", "0.63562655", "0.6340307", "0.62746656", "0.62510204", "0.6236841", "0.62143993", "0.6207715", "0.6203427", "0.6173558", "0.61604804", "0.6155224", "0.61087...
0.6292343
11
Test that a not type error is raised if the class is initialized without a `resources` method.
def test_raise_not_implemented_error(self): class CustomOpNoResource(ResourcesOperation): # pylint: disable=too-few-public-methods num_wires = 2 class CustomOPWithResources(ResourcesOperation): # pylint: disable=too-few-public-methods num_wires = 2 def resources(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_instance(self):\n with self.assertRaises(exceptions.NoInitiation):\n Config()", "def test_cannot_instantiate(self):\n with self.assertRaises(TypeError):\n Distribution()", "def raise_init(cls):\r\n def init(self):\r\n raise TypeError(\"Instance crea...
[ "0.6509014", "0.6454623", "0.64346546", "0.64189184", "0.6415098", "0.6371529", "0.6346806", "0.63281137", "0.63169825", "0.63013685", "0.6288929", "0.62795115", "0.6273733", "0.6269042", "0.6252056", "0.62284595", "0.62220055", "0.622168", "0.6193215", "0.61502784", "0.61481...
0.7228034
0
Test the count resources method.
def test_count_resources(ops_and_shots, expected_resources): ops, shots = ops_and_shots computed_resources = _count_resources(QuantumScript(ops=ops, shots=shots)) assert computed_resources == expected_resources
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_resource_license_resource_count_list(self):\n pass", "def count(self, resource):\n return len(self.all(resource))", "def test_get_resource_license_resource_count_by_moid(self):\n pass", "def test_count(self):\n self._test_count_func(count)", "def test_all_count(self...
[ "0.780781", "0.7554697", "0.72033167", "0.71104103", "0.7008526", "0.690465", "0.6903304", "0.6899983", "0.679157", "0.67801946", "0.6760998", "0.6760998", "0.6760998", "0.6760998", "0.67398643", "0.6697201", "0.66854256", "0.66848224", "0.6672156", "0.6637181", "0.6620758", ...
0.76768863
1
Load a font from the wclib/assets folder. Results are cached.
def font(size=20, name=None): name = name or "regular" path = ROOT_DIR / "wclib" / "assets" / (name + ".ttf") return pygame.font.Font(path, size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadCustomFont(path,name,size):\n\n fullname = os.path.join(path,name)\n f = pygame.font.Font(fullname,size)\n return f", "def _load_font(file: str) -> None:\n\n pyglet.font.add_file(Config.RES_DIR + \"font\" + Config.FILE_SEPARATOR + file)\n pyglet.font.load(\"Munro\")", "def load_f...
[ "0.7459551", "0.68890184", "0.6854826", "0.6764804", "0.66212964", "0.6554096", "0.65520585", "0.64056826", "0.6397413", "0.62355036", "0.6181871", "0.6128273", "0.611437", "0.611437", "0.60721064", "0.6005732", "0.5972758", "0.59316516", "0.5894605", "0.5887855", "0.57644296...
0.6527492
7
Render a text on a surface. Results are cached.
def text(txt, color, size=20, font_name=None): return font(size, font_name).render(str(txt), True, color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_text_on_surface(text, surface, font, color=BLACK, top_padding=0, left_pading=0):\n rect = surface.get_rect()\n \n last_top = rect.top + top_padding\n for index, line in enumerate(text.split(\"\\n\")):\n text_surf = font.render(line, True, color)\n text_rect = text_surf.get_rect...
[ "0.7948859", "0.7806399", "0.7732327", "0.75384945", "0.73772097", "0.7350806", "0.726988", "0.7241373", "0.7227958", "0.7174702", "0.7170725", "0.7158598", "0.7115535", "0.7100436", "0.69991535", "0.69736105", "0.6911754", "0.690929", "0.688639", "0.688535", "0.6874672", "...
0.60740095
92
Clamp value between mini and maxi
def clamp(value, mini, maxi): if value < mini: return mini elif maxi < value: return maxi else: return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clamp(value, mn, mx):\n\n return max(min(value, mx), mn)", "def clamp(n, min_, max_):\n return max(min(max_,n),min_)", "def clamp(self, value, minv, maxv):\n if value > maxv:\n return maxv\n if value < minv:\n return minv\n return value", "def clamp(value,...
[ "0.80389065", "0.7782929", "0.77185524", "0.76578045", "0.76456124", "0.74849397", "0.74809366", "0.7454212", "0.73672295", "0.7320122", "0.72616553", "0.7163171", "0.7146835", "0.71296495", "0.71129787", "0.71004564", "0.7080147", "0.70638114", "0.70379007", "0.70337254", "0...
0.8780609
0
Split the data to train, validate and test from two csv files
def prepare_data(train_csv, test_csv): train = pd.read_csv(train_csv) test = pd.read_csv(test_csv) train = train[test.shape[0]:] valid = train[0:test.shape[0]] x_train = train.drop(columns="label") / 255 y_train = train.label x_valid = valid.drop(columns="label") / 255 y_valid = valid....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_data(self, val_size=0.1, test_size=0.5):\n df = pd.read_csv(self.csv_path, delimiter=';')\n train, val = train_test_split(df, test_size=val_size)\n val, test = train_test_split(df, test_size=test_size)\n return train, val, test", "def load_data(trainfile, testfile):\n raw...
[ "0.70791936", "0.6959531", "0.6874723", "0.68191665", "0.6756852", "0.6668917", "0.6633911", "0.66283387", "0.65963745", "0.65925604", "0.65851057", "0.65774757", "0.6561444", "0.6541944", "0.6537651", "0.6509679", "0.6489415", "0.6481746", "0.6471208", "0.6443245", "0.644324...
0.6911419
2
Get the mistakes made by the model
def get_mistakes(model, x_test, y_test): predictions = model.predict(x_test) for i in range(len(predictions)): if np.argmax(predictions[i]) != np.argmax(y_test[i]): yield i
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_errors(self):\n return [result for result in self.values() if result.outcome == Result.ERROR]", "def refined_errors(self):\r\n errs = []\r\n for err in self.errors:\r\n if err['typo'].lower() not in self.terms:\r\n errs.append(err)\r\n return errs", ...
[ "0.6376252", "0.62925667", "0.6184163", "0.6139758", "0.60692775", "0.5927276", "0.5908681", "0.5893474", "0.5883254", "0.58324635", "0.58316386", "0.582516", "0.58234584", "0.5806735", "0.5797444", "0.5760866", "0.5759147", "0.5759147", "0.57536906", "0.56849885", "0.5682893...
0.59771997
5
Visualize Fashion MNIST samples via pyplot
def visualize_predictions(generator, model, x_test, y_test, convolutional=False): class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot'] titles = {} for i in generator: if not convolutional: img_p = x_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_image(self):\n \n pixel_array = self.imageprepare(self.image_path)\n newArr = self.reshape_pixel_array(pixel_array)\n plt.imshow(newArr, interpolation='nearest')\n plt.savefig('MNIST_IMAGE.png')#save MNIST image\n plt.show()#Show / plot that image", "def display_i...
[ "0.7037436", "0.7002827", "0.6939112", "0.69223297", "0.6922288", "0.6649379", "0.6452064", "0.6440104", "0.6397068", "0.6394533", "0.6347079", "0.63302267", "0.63108045", "0.63045776", "0.6270363", "0.6266844", "0.6266804", "0.62562644", "0.62232316", "0.6215262", "0.6177606...
0.0
-1
Show a saved search.
def show(ctx, saved_search_id): r = SavedSearch(ctx.obj['TOKEN'], ctx.obj['DEBUG']).show(saved_search_id) click.echo(json_dumps(r, ctx.obj['PRETTY']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_save_search(self, event):\r\n\r\n search = self.m_searchfor_textbox.GetValue()\r\n if search == \"\":\r\n errormsg(_(\"There is no search to save!\"))\r\n return\r\n dlg = SaveSearchDialog(self, search, self.m_regex_search_checkbox.GetValue())\r\n dlg.ShowMo...
[ "0.684537", "0.66723734", "0.65726525", "0.6466039", "0.62601984", "0.6245371", "0.6242621", "0.62300265", "0.6214036", "0.6172219", "0.6159994", "0.6143998", "0.60995394", "0.6086033", "0.60684097", "0.6028625", "0.59793204", "0.5916503", "0.5916453", "0.5899437", "0.583377"...
0.79775244
0
Create a saved search.
def create(ctx, payload): payload = parse_payload(ctx, payload) r = SavedSearch(ctx.obj['TOKEN'], ctx.obj['DEBUG']).create(payload) click.echo(json_dumps(r, ctx.obj['PRETTY']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createSearch(self, authenticationToken, search):\r\n pass", "def saveSearch(self, queryString, searchName):\n facade = self._getFacade()\n if facade.noSaveSearchProvidersPresent():\n return DirectResponse.succeed()\n\n creator = self._getLoggedinUserId()\n\n # save t...
[ "0.6784601", "0.6628552", "0.65851784", "0.6335346", "0.6261639", "0.6222785", "0.61650014", "0.6154353", "0.6143282", "0.60384107", "0.6017802", "0.6017802", "0.60088694", "0.59932554", "0.5887634", "0.58723336", "0.586306", "0.5861253", "0.5856038", "0.5761087", "0.57178247...
0.7173232
0
Update a saved search.
def update(ctx, saved_search_id, payload): payload = parse_payload(ctx, payload) r = SavedSearch(ctx.obj['TOKEN'], ctx.obj['DEBUG']).update(payload) click.echo(json_dumps(r, ctx.obj['PRETTY']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateSavedSearch(self, searchName, queryString):\n facade = self._getFacade()\n if facade.noSaveSearchProvidersPresent():\n return DirectResponse.succeed()\n\n # save the search\n facade.updateSavedSearch(searchName, queryString)\n return DirectResponse.succeed()"...
[ "0.7534025", "0.7301899", "0.69800997", "0.68826675", "0.67916095", "0.62492573", "0.62392795", "0.62191606", "0.6211305", "0.60335565", "0.5985524", "0.59692556", "0.59547627", "0.5949781", "0.59346545", "0.5899091", "0.58907944", "0.5874972", "0.5809071", "0.5713413", "0.57...
0.7637842
0
Delete a saved search.
def delete(ctx, saved_search_id): r = SavedSearch(ctx.obj['TOKEN'], ctx.obj['DEBUG']).delete(saved_search_id) click.echo(json_dumps(r, ctx.obj['PRETTY']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeSavedSearch(self, searchName):\n facade = self._getFacade()\n if facade.noSaveSearchProvidersPresent():\n return DirectResponse.succeed()\n\n # save the search\n facade.removeSavedSearch(searchName)\n return DirectResponse.succeed()", "def delete(self):\n ...
[ "0.71051794", "0.6984621", "0.6617019", "0.64270055", "0.62136894", "0.6194005", "0.6189915", "0.61731374", "0.6161926", "0.61286575", "0.6077793", "0.60397846", "0.6024016", "0.6024016", "0.6024016", "0.6024016", "0.60068905", "0.59796524", "0.59796524", "0.59375215", "0.591...
0.8261131
0
Extend the size of an image by adding borders. The sides argument defaults to
def add_border(image: np.ndarray, width=2, value=0, sides='ltrb'): result = image sides = sides.upper() if 'L' in sides: result = add_left(result, width, value) if 'T' in sides: result = add_top(result, width, value) if 'R' in sides: result = add_right(result, width, value) if 'B' in sides: resu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_border(original_img,border_size):\r\n new_image=SimpleImage.blank(2 * border_size + original_img.width ,2 * border_size + original_img.height )\r\n\r\n \"\"\"\r\n Task 2: Creating black border\r\n \r\n \"\"\"\r\n for y in range(new_image.height):\r\n for x in range(new_image.width)...
[ "0.6268577", "0.62324625", "0.607379", "0.597834", "0.5885386", "0.58061814", "0.5716965", "0.5715706", "0.5707968", "0.5658754", "0.5645058", "0.56255275", "0.55907595", "0.5515744", "0.543367", "0.53568774", "0.5346766", "0.53422046", "0.53231376", "0.5271381", "0.52616733"...
0.68208927
0
Horizontally concatenate a list of images with a border. This is similar to numpy's hstack except that it adds a border around each image. The borders can be controlled with the optional border_width and border_value arguments. See also vstack.
def hstack(images, border_width=2, border_value=0): if border_width == 0: return np.hstack(images) T, V = border_width, border_value result = [] for image in images[:-1]: result.append(add_border(image, T, V, 'LTB')) result.append(add_border(images[-1], T, V)) return np.hstack(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vstack(images, border_width=2, border_value=0):\n if border_width == 0: return np.vstack(images)\n T, V = border_width, border_value\n result = []\n for image in images[:-1]:\n result.append(add_border(image, T, V, 'LTR'))\n result.append(add_border(images[-1], T, V))\n return np.vstac...
[ "0.7960261", "0.69222003", "0.67834777", "0.6604934", "0.6577598", "0.6484754", "0.6211543", "0.61573285", "0.6119428", "0.61114365", "0.61083424", "0.5949176", "0.5925623", "0.59040356", "0.5842073", "0.5829911", "0.581459", "0.58126813", "0.5722141", "0.56652904", "0.564144...
0.83008605
0
Vertically concatenate a list of images with a border. This is similar to numpy's vstack except that it adds a border around each image. The borders can be controlled with the optional border_width and border_value arguments. See also hstack.
def vstack(images, border_width=2, border_value=0): if border_width == 0: return np.vstack(images) T, V = border_width, border_value result = [] for image in images[:-1]: result.append(add_border(image, T, V, 'LTR')) result.append(add_border(images[-1], T, V)) return np.vstack(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hstack(images, border_width=2, border_value=0):\n if border_width == 0: return np.hstack(images)\n T, V = border_width, border_value\n result = []\n for image in images[:-1]:\n result.append(add_border(image, T, V, 'LTB'))\n result.append(add_border(images[-1], T, V))\n return np.hstac...
[ "0.7994192", "0.62722176", "0.6255651", "0.61048955", "0.61031604", "0.6095366", "0.6059274", "0.60569215", "0.6039915", "0.58855444", "0.584056", "0.5793362", "0.5777069", "0.57281417", "0.57201326", "0.56275475", "0.5617591", "0.5614883", "0.5610327", "0.5589554", "0.558250...
0.82072884
0
Remap the values so that they span the range from 0 to +1.
def unitize(img): return (img - np.amin(img)) / (np.amax(img) - np.amin(img))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remap(self, value, from1, to1, from2, to2):\n return from2 + (value - from1) * (to2 - from2) / (to1 - from1)", "def translate(value, from_min, from_max, to_min, to_max):\n # Figure out how 'wide' each range is\n left_span = from_max - from_min\n right_span = to_max - to_min\n\n # Convert t...
[ "0.6935862", "0.65586096", "0.64726895", "0.63875026", "0.6341044", "0.6324244", "0.63105595", "0.6302549", "0.62592286", "0.6185319", "0.6141511", "0.610922", "0.6045255", "0.6027549", "0.6026459", "0.60195893", "0.6006938", "0.599998", "0.59828144", "0.5918278", "0.59096044...
0.0
-1
Compute X derivatives and Y derivatives.
def gradient(img): nx, ny = np.gradient(unshape(img)) return reshape(nx), reshape(ny)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _derX(self, x, y):\n m = len(x)\n temp = np.zeros((m, self.funcCount))\n for j in range(self.funcCount):\n temp[:, j] = self.functions[j](x, y)\n i = self.argcompare(temp, axis=1)\n dfdx = np.zeros_like(x)\n for j in range(self.funcCount):\n c = i...
[ "0.7545054", "0.7464404", "0.74221903", "0.74221903", "0.732518", "0.72501993", "0.7183411", "0.71397114", "0.70617044", "0.70110726", "0.6998686", "0.69753754", "0.69585145", "0.6922582", "0.68528795", "0.68379533", "0.6832356", "0.68175185", "0.67984575", "0.67573935", "0.6...
0.0
-1
Rotate image counterclockwise by a multiple of 90 degrees.
def rotate(source: np.ndarray, degrees) -> np.ndarray: assert len(source.shape) == 3, 'Shape is not rows x cols x channels' assert source.dtype == np.float, 'Images must be doubles.' h, w, c = source.shape degrees %= 360 if degrees == 90: result = np.empty([w, h, c]) rotate90(result,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate90(self):", "def rotate_right_90(img):\r\n #reading image\r\n im = Image.open(\"filename\")\r\n \r\n #flipping image 90 degrees\r\n newimg = im.transpose(PIL.Image.ROTATE_90)\r\n \r\n return img", "def rotated_image(image):\n orientation = parameter('Orientation',90) # in degr...
[ "0.7634732", "0.7178968", "0.70573974", "0.6980872", "0.69558376", "0.6898886", "0.6888692", "0.6832036", "0.6826903", "0.67874795", "0.6756599", "0.6750899", "0.6742845", "0.67091614", "0.66313154", "0.6606551", "0.66013294", "0.65659064", "0.655501", "0.65405726", "0.651513...
0.66063815
16
Horizontally mirror the given image.
def hflip(source: np.ndarray) -> np.ndarray: assert len(source.shape) == 3, 'Shape is not rows x cols x channels' assert source.dtype == np.float, 'Images must be doubles.' h, w, c = source.shape result = np.empty([h, w, c]) jit_hflip(result, source) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mirrorImage(self):\n\n im = Image.open(self.ActivePhoto)\n out = im.transpose(PIL.Image.FLIP_LEFT_RIGHT)\n out.save(self.ActivePhoto)\n self.photo.setPixmap(QtGui.QPixmap(self.ActivePhoto))\n print (\"Flipped image\")", "def mirror(image):\n\n return cv2.flip(image, ...
[ "0.7574539", "0.75367993", "0.7442532", "0.73771894", "0.7280686", "0.71478504", "0.69472986", "0.67642117", "0.66574013", "0.66574013", "0.66060495", "0.6552217", "0.65077645", "0.63403815", "0.62895715", "0.6287383", "0.6179056", "0.6112265", "0.60896003", "0.60217", "0.593...
0.0
-1
Vertically mirror the given image.
def vflip(source: np.ndarray) -> np.ndarray: assert len(source.shape) == 3, 'Shape is not rows x cols x channels' assert source.dtype == np.float, 'Images must be doubles.' h, w, c = source.shape result = np.empty([h, w, c]) jit_vflip(result, source) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_vertical(image: Image) -> Image:\r\n flipped_image = copy(image)\r\n middle_pixel = get_width(flipped_image) // 2\r\n width = get_width(flipped_image)\r\n height = get_height(flipped_image)\r\n \r\n for x in range(middle_pixel):\r\n for y in range(height):\r\n r,g,b = g...
[ "0.75699246", "0.7523289", "0.75070745", "0.7496301", "0.7495237", "0.74199146", "0.72273934", "0.7222015", "0.680112", "0.67225003", "0.67225003", "0.6686093", "0.6582804", "0.64003575", "0.6361711", "0.6324668", "0.62831163", "0.61866224", "0.60476637", "0.59888166", "0.593...
0.5046253
94
Compose a source image with alpha onto a destination image.
def compose(dst: np.ndarray, src: np.ndarray) -> np.ndarray: a, b = ensure_alpha(src), ensure_alpha(dst) alpha = extract_alpha(a) result = b * (1.0 - alpha) + a * alpha if dst.shape[2] == 3: return extract_rgb(result) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alpha_composite(self, im, dest=(0, 0), source=(0, 0)):\r\n\r\n if not isinstance(source, (list, tuple)):\r\n raise ValueError(\"Source must be a tuple\")\r\n if not isinstance(dest, (list, tuple)):\r\n raise ValueError(\"Destination must be a tuple\")\r\n if not len(s...
[ "0.7422852", "0.70978785", "0.6976313", "0.6866716", "0.6865255", "0.68406856", "0.6805374", "0.6720108", "0.6681318", "0.66069293", "0.65929514", "0.65593785", "0.6482925", "0.6482741", "0.6438921", "0.63782775", "0.6372395", "0.63322204", "0.6287815", "0.6284114", "0.623002...
0.7438169
0
Draw an image with premultiplied alpha over the destination.
def compose_premultiplied(dst: np.ndarray, src: np.ndarray): a, b = ensure_alpha(src), ensure_alpha(dst) alpha = extract_alpha(a) result = b * (1.0 - alpha) + a if dst.shape[2] == 3: return extract_rgb(result) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_alpha(self):\n if self.alpha == 255:\n self.current_sprite_alpha = self.current_sprite\n else:\n mask = pygame.Surface(self.current_sprite.get_size(), flags=pygame.SRCALPHA)\n mask.fill((255, 255, 255, self.alpha))\n self.current_sprite_alpha = sel...
[ "0.65455157", "0.6524085", "0.64212435", "0.6375677", "0.6306788", "0.62964463", "0.61798614", "0.61754334", "0.6065134", "0.6003725", "0.59990025", "0.5968152", "0.59480757", "0.59296876", "0.59208333", "0.5908587", "0.5894114", "0.5885356", "0.5873413", "0.58538276", "0.585...
0.6370964
4
Calculate bandpass filters with adjustable length for given frequency ranges. This function returns for the given frequency band ranges the filter coefficients with length "filter_len". Thus the filters can be sequentially used for band power estimation.
def calc_band_filters(f_ranges, sfreq, filter_length="1000ms", l_trans_bandwidth=4, h_trans_bandwidth=4): filter_list = list() for f_range in f_ranges: h = mne.filter.create_filter(None, sfreq, l_freq=f_range[0], h_freq=f_range[1], fir_design='firwin', l_trans_ban...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bandpass_filtfilt(rawsong, samp_freq, freq_cutoffs=(500, 10000)):\n if freq_cutoffs[0] <= 0:\n raise ValueError('Low frequency cutoff {} is invalid, '\n 'must be greater than zero.'\n .format(freq_cutoffs[0]))\n\n Nyquist_rate = samp_freq / 2\n if...
[ "0.6331097", "0.6286624", "0.62640613", "0.6151228", "0.613698", "0.60637957", "0.60447794", "0.60300845", "0.60072994", "0.59426826", "0.59128374", "0.58972484", "0.587391", "0.5848961", "0.5806512", "0.5764639", "0.57619053", "0.57331616", "0.5716473", "0.57109064", "0.5686...
0.78691727
0
Apply previously calculated (bandpass) filters to data.
def apply_filter(data, filter_bank, sfreq): if data.ndim == 1: filtered = np.zeros((1, filter_bank.shape[0], sfreq)) for filt in range(filter_bank.shape[0]): filtered[0, filt, :] = np.convolve(filter_bank[filt,:], data)[int(sfreq-sfreq/2):int(sfreq+sfreq/2)] e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute(self):\n Y = self.data[1]\n # Create an order 3 lowpass butterworth filter\n b, a = signal.butter(3, 0.05)\n # Apply the filter to Y. Use lfilter_zi to choose the initial condition of the filter\n zi = signal.lfilter_zi(b, a)\n z, _ = signal.lfilter(b, a, Y, zi...
[ "0.7208654", "0.71156347", "0.6689604", "0.66721535", "0.6629495", "0.662171", "0.6504675", "0.6456558", "0.64312357", "0.6421079", "0.6362034", "0.63046914", "0.63022745", "0.62948835", "0.62476856", "0.6220952", "0.6203804", "0.61930573", "0.6187179", "0.616862", "0.6153139...
0.6251041
14
Generates a database from images in the 'image' folder in the repo. To run this code, change 'myPath' to navigate to the folder on your local computer.
def generate_database(): database = {} for name in images: descriptors = [] for path in images[name]: descriptors.append(ConvertToDescriptor.jpeg_to_descriptors(myPath + path)) database[name] = person.Person(name, descriptors) output = open('database.p', 'wb') pickl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_images(image_filename):\n\n # Write code here to loop over image data and populate DB.", "def write_img_to_db():\n with lite.connect(\"test.db\") as con:\n cur = con.cursor()\n data = read_image_from_fs()\n binary = lite.Binary(data)\n cur.execute(\"INSERT INTO Images(D...
[ "0.6503758", "0.64194554", "0.62614226", "0.61858886", "0.61540896", "0.6086964", "0.5995975", "0.59934014", "0.5938966", "0.59345305", "0.5896261", "0.58814937", "0.5768266", "0.57612544", "0.5707061", "0.56702924", "0.56381816", "0.5637028", "0.557922", "0.55778253", "0.557...
0.5988434
8
Loads the database of People objects as a specified data type
def load_database(database_type): f = open("database.p", "rb") database = pickle.load(f) f.close() if database_type is "dict": return database elif database_type is "list": return database.values()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_db(self):\n for type_ in self._types:\n try:\n type_.table(self._metadata)\n except InvalidRequestError:\n pass\n # Reflect metadata so auto-mapping works\n self._metadata.reflect(self._engine)\n # Make sure the tables exist\...
[ "0.6036072", "0.5892125", "0.5795159", "0.5658464", "0.56407386", "0.5621719", "0.54812354", "0.54151523", "0.53258556", "0.5289917", "0.5287105", "0.52844226", "0.52658", "0.5242722", "0.5219611", "0.5181131", "0.5163433", "0.5148321", "0.5140113", "0.51361847", "0.5131861",...
0.61409664
0
Verify the test composition and container.
def test_container_count(dockerc): # stopped parameter allows non-running containers in results assert ( len(dockerc.containers(stopped=True)) == 2 ), "Wrong number of containers were started."
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_composition(self):", "def final_check(self, test_collection):\n assert True", "def test_verify(self):\n self.testObject.verify()", "def test_show_container(self):\n pass", "def test_get_composition(self):\n pass", "def test_basic(self):\n self.check_4_way('cont...
[ "0.7515", "0.6885529", "0.6822341", "0.67657787", "0.6681888", "0.66711056", "0.6665601", "0.6633619", "0.6441265", "0.6409816", "0.63753545", "0.63149035", "0.6231963", "0.6179076", "0.6159452", "0.6148183", "0.6125178", "0.6099585", "0.60987747", "0.6089999", "0.6089999", ...
0.0
-1
Verify enironment is set correctly.
def test_environment_credentials(main_container): # Check for credential variables. # These are not required for pre-built images. assert ( "FOUNDRY_USERNAME" in os.environ ), "FOUNDRY_USERNAME was not in the environment" assert ( "FOUNDRY_PASSWORD" in os.environ ), "FOUNDRY_PASS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_environment():\n reqs = ['NAME', 'RECIPIENT', 'SUBJECT', 'MESSAGE',\n 'MAILGUN_API_KEY', 'MAILGUN_DOMAIN']\n for req in reqs:\n if not os.getenv(req):\n logging.error('Environment variable ' + req + ' is not set')\n sys.exit(2)", "def _check_env():\n\tif o...
[ "0.7674604", "0.75897914", "0.72960544", "0.7046408", "0.70378274", "0.7011285", "0.6935771", "0.6903303", "0.6852732", "0.6845685", "0.67665195", "0.6686361", "0.6642744", "0.6638952", "0.66338205", "0.6518428", "0.651361", "0.6485859", "0.6483212", "0.6452844", "0.6449968",...
0.0
-1
Wait for container to be ready.
def test_wait_for_ready(main_container): # This could take a while, as we download the application. TIMEOUT = 180 for i in range(TIMEOUT): logs = main_container.logs().decode("utf-8") if READY_MESSAGE in logs: break time.sleep(1) else: raise Exception( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def wait_until_ready(self):\n await self._ready.wait()", "async def wait_until_ready(self) -> None:\n await self._ready.wait()", "def wait_until_ready(self):\n while not self.is_ready():\n time.sleep(0.01)", "def wait(self):\n self.mainloop().wait()", "def waitF...
[ "0.75483984", "0.7493702", "0.73587227", "0.7216531", "0.7100128", "0.70559436", "0.686858", "0.6835775", "0.68304235", "0.68187135", "0.68187135", "0.6766386", "0.67497957", "0.665554", "0.66353935", "0.6586175", "0.6551319", "0.6548688", "0.65171885", "0.65166503", "0.64649...
0.6858103
7
Wait for container to be healthy.
def test_wait_for_healthy(main_container): # This could take a while TIMEOUT = 180 for i in range(TIMEOUT): inspect = main_container.inspect() status = inspect["State"]["Health"]["Status"] assert status != "unhealthy", "The container became unhealthy." if status == "healthy":...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_container():\n for i in xrange(30):\n print(\"Waiting for service to come up\")\n try:\n requests.get(URL).raise_for_status()\n return True\n except Exception as e:\n print e\n sleep(1)\n\n return False", "def wait_for_container(...
[ "0.70266175", "0.69631106", "0.6873483", "0.68020195", "0.6711998", "0.6690538", "0.6673794", "0.6620189", "0.6472391", "0.6412175", "0.63628274", "0.6351408", "0.63411796", "0.63291925", "0.6318016", "0.63093585", "0.6306202", "0.6234826", "0.6229725", "0.62052643", "0.61958...
0.7739588
0
Wait for containers to exit.
def test_wait_for_exits(main_container, version_container): assert ( version_container.wait() == 0 ), "Container service (version) did not exit cleanly"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_termination(self):\n self.server.wait_for_termination()", "def wait(self) -> None:\n self._executor.shutdown(wait=True)", "def wait_for_termination(self):\n self.server.wait_for_termination()", "def wait_for_stop(timeout=30):\n starttime = time.time()\n while(time....
[ "0.7033026", "0.6967925", "0.6909914", "0.68500364", "0.67150754", "0.6529941", "0.6527739", "0.64836293", "0.6441292", "0.64279807", "0.6425159", "0.6388", "0.6388", "0.6388", "0.6388", "0.6386584", "0.63711345", "0.6333819", "0.63210857", "0.6277999", "0.62738025", "0.626...
0.72377574
0
Verify that release tag version agrees with the module version.
def test_release_version(): pkg_vars = {} with open(VERSION_FILE) as f: exec(f.read(), pkg_vars) # nosec project_version = pkg_vars["__version__"] assert ( RELEASE_TAG == f"v{project_version}" ), "RELEASE_TAG does not match the project version"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_release_tag(self) -> None:\n self.assertEqual(\"v3.14.15\", release_tag())", "def test_release_tag_for_dev_version(self) -> None:\n self.assertEqual(\"v42.12\", release_tag())", "def validate_module_versioning(module_name):\n module = sys.modules[module_name]\n\n _validate_continuo...
[ "0.7734646", "0.75832057", "0.73865366", "0.7223013", "0.71789634", "0.7159444", "0.71579933", "0.7136775", "0.69557977", "0.6925597", "0.6924353", "0.69236374", "0.69007146", "0.6892736", "0.6873031", "0.6850223", "0.68487895", "0.6834248", "0.6817076", "0.6815059", "0.68049...
0.7434978
2
Verify the container outputs the correct version to the logs.
def test_log_version(version_container): version_container.wait() # make sure container exited if running test isolated log_output = version_container.logs().decode("utf-8").strip() pkg_vars = {} with open(VERSION_FILE) as f: exec(f.read(), pkg_vars) # nosec project_version = pkg_vars["__v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_version_release(self):\n with self.assertLogs(\"dakara_feeder.version\", \"DEBUG\") as logger:\n with patch.multiple(\n \"dakara_feeder.version\", __version__=\"0.0.0\", __date__=\"1970-01-01\"\n ):\n check_version()\n\n # assert effe...
[ "0.69504476", "0.6847581", "0.6835782", "0.67436117", "0.66984177", "0.66706485", "0.66361153", "0.66052985", "0.6452293", "0.64389616", "0.63589865", "0.6269801", "0.6172591", "0.616603", "0.614854", "0.6137157", "0.61313576", "0.61284804", "0.61186343", "0.60721433", "0.603...
0.78575236
0
Verify the container version label is the correct version.
def test_container_version_label_matches(version_container): pkg_vars = {} with open(VERSION_FILE) as f: exec(f.read(), pkg_vars) # nosec project_version = pkg_vars["__version__"] assert ( version_container.labels["org.opencontainers.image.version"] == project_version ), "Dockerfile...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_version(ctx, _, value):\n if not value or ctx.resilient_parsing:\n return\n\n click.echo(f\"geocube v{importlib.metadata.version('geocube')}\")\n\n ctx.exit()", "def test_versionString(self):\n self.assertIn(\"%d.%d.%d\" % nevow.__version_info__, nevow.__version__)", "def test_...
[ "0.66752607", "0.64611894", "0.6417991", "0.6392024", "0.6365091", "0.6316447", "0.6304623", "0.62754697", "0.62334216", "0.6207172", "0.6132876", "0.6128137", "0.61197776", "0.6101531", "0.6085407", "0.60392827", "0.60341907", "0.6024869", "0.6014097", "0.5978784", "0.596673...
0.83354795
0
Test the main splash page.
def test_splash_page(self): response = self.testapp.get('/') self.assertEqual(response.status_int, 200) response.mustcontain( 'Bite-sized learning journeys', 'Browse the explorations gallery', '100% free!', 'Learn', 'About', 'Contact', # No navbar ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login_and_logout_on_splash_page(self):\n response = self.testapp.get('/')\n self.assertEqual(response.status_int, 200)\n response.mustcontain(\n 'Login', 'Create an Oppia account', 'Contribute',\n self.get_expected_login_url('/'),\n no=['Profile', 'Log...
[ "0.70376253", "0.6987304", "0.6967448", "0.68484825", "0.6787349", "0.67342925", "0.66842026", "0.666418", "0.6645239", "0.66426563", "0.66338295", "0.6604585", "0.6584727", "0.6584727", "0.6568594", "0.6441818", "0.64151394", "0.6395155", "0.6382844", "0.63790137", "0.629545...
0.8406544
0
Test that the correct buttons/navbar show on login and logout.
def test_login_and_logout_on_splash_page(self): response = self.testapp.get('/') self.assertEqual(response.status_int, 200) response.mustcontain( 'Login', 'Create an Oppia account', 'Contribute', self.get_expected_login_url('/'), no=['Profile', 'Logout', 'Crea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_homepage_has_correct_buttons_showing_when_logged_in(testapp):\n resp = testapp.post('/login',\n params={'Username': 'amos',\n 'Password': 'password'}).follow().html\n logout = resp.find(class_=\"navbar-right\").text\n create = resp.find(href=\...
[ "0.8102087", "0.7870244", "0.72465783", "0.72082067", "0.7183518", "0.7175371", "0.71512717", "0.7136859", "0.7105349", "0.7051221", "0.70220363", "0.6966146", "0.6966055", "0.6909731", "0.6892767", "0.68700117", "0.6836972", "0.6823493", "0.68031514", "0.6801471", "0.6796459...
0.6767459
25
Test the About page.
def test_about_page(self): response = self.testapp.get('/about') self.assertEqual(response.status_int, 200) self.assertEqual(response.content_type, 'text/html') response.mustcontain('Community Guidelines', 'Lifecycle', 'License')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_about(self):\n\t\tresponse = self.client.get('/about')\n\t\tself.assertContains(response, 'About', 3, 200)", "def test_about(self):\n response = self.client.get('/about')\n self.assertContains(response, 'About', 3, 200)", "def test_about(self):\n self.selenium.get('{}/about'.forma...
[ "0.8776164", "0.87197524", "0.85738724", "0.8519668", "0.8518995", "0.8491346", "0.8471988", "0.84383833", "0.84382826", "0.84045774", "0.8315195", "0.80406505", "0.7334273", "0.73117393", "0.731053", "0.72784615", "0.7157784", "0.71203816", "0.70989525", "0.7095211", "0.7075...
0.85716695
3
__init__ is used to establish baseline of calss for each instantiation
def __init__(self): self.items = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n self.is_initialized = False\n self.delta = 1", "def __init__(self):\n\n self.elapsed_time = 0", "def __init__(self) -> None:\n self.metrics = {}\n self.current = None\n self.run = None", "def __init__(self, *args, **kwargs) -> None:\n ...
[ "0.72384554", "0.70940834", "0.698048", "0.6912496", "0.6908046", "0.68891984", "0.6888686", "0.6793515", "0.6789974", "0.676935", "0.67679554", "0.67570174", "0.6748445", "0.6733382", "0.67243737", "0.67220473", "0.670453", "0.6694226", "0.6682818", "0.66826624", "0.6673459"...
0.0
-1
take the item passed as an argument and append to end of list
def push(self, item): self.items.append(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addItem(list,item):\n print \"I added this item: \", item\n list.append(item)", "def append (self, item):\n pass", "def append(self, item):\n self.update([item])", "def append(self, item):\n # type: (Any) -> None\n list.append(self, self.ref(item))", "def append(*, item : ...
[ "0.74627405", "0.74130166", "0.7393185", "0.73304754", "0.7306182", "0.7227722", "0.7203488", "0.7132543", "0.7077156", "0.7063894", "0.7024013", "0.6965546", "0.69537246", "0.68976897", "0.68585306", "0.68585306", "0.6846291", "0.6820997", "0.6813895", "0.6813895", "0.681389...
0.6271898
67
return and Remove the last element from the Stack, items does this natively
def pop(self): if self.items: return self.items.pop() return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_last_item_from_stack(self):\n if self.length > 0:\n return self.container.pop()\n else:\n return None", "def pop(self):\n item = self.stack[-1]\n self.stack = self.stack[:-1]\n return item", "def pop(self): # 06:30 Lecture Week 2 \"Stacks\" (1...
[ "0.87582505", "0.84155095", "0.82518315", "0.81114966", "0.80842197", "0.8064425", "0.8054359", "0.79932296", "0.7927726", "0.78785", "0.7877539", "0.7840552", "0.7744405", "0.77307534", "0.771132", "0.7702652", "0.7700707", "0.7695597", "0.76941514", "0.7693058", "0.7689969"...
0.7351245
64
look at the last item on the stack, without removing
def peek(self): if self.items: return self.items[-1] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop(self):\n item = self.stack[-1]\n self.stack = self.stack[:-1]\n return item", "def remove_last_item_from_stack(self):\n if self.length > 0:\n return self.container.pop()\n else:\n return None", "def pop_last(self):\n self.pop_item(-1)", ...
[ "0.7891489", "0.78797466", "0.7542018", "0.7380731", "0.7376301", "0.73706114", "0.7299436", "0.7298057", "0.71662515", "0.71245754", "0.7107657", "0.7092803", "0.7059115", "0.7041235", "0.70396966", "0.7030337", "0.7028404", "0.7024946", "0.7012373", "0.69939923", "0.6985024...
0.0
-1
Return the length of the stack
def size(self): return len(self.items)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self) -> int:\n return len(self.stack)", "def size(self):\n return len(self.stack)", "def __len__(self):\n return len(self.stack)", "def size(self):\n return len(self.__stack)", "def size(self):\n return len(self.__stack)", "def size(self):\n return self.N #...
[ "0.84773064", "0.8442819", "0.8409331", "0.8395181", "0.8395181", "0.8084406", "0.79170597", "0.773431", "0.76036435", "0.7582088", "0.73311454", "0.69261354", "0.6830596", "0.6829584", "0.68245417", "0.68190914", "0.6788814", "0.6717932", "0.6691747", "0.6653151", "0.6578185...
0.0
-1
Return true or false if there are any items in the list
def is_empty(self): return self.items == []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasNext(self) -> bool:\n return len(self.list) != 0", "def filled(self):\n return self.list.count(0) == 0", "def its_empty(self) -> bool:\n return self.items == []", "def isEmpty(self):\n return not bool(len(self.ItemList))", "def is_empty(self):\n return self.list.le...
[ "0.77634686", "0.77160156", "0.76643634", "0.762495", "0.7607274", "0.7607274", "0.7564963", "0.7549602", "0.7543481", "0.7503431", "0.7481312", "0.74413675", "0.7434366", "0.7433249", "0.73940367", "0.7376678", "0.73360527", "0.73314464", "0.7311426", "0.7311426", "0.7307668...
0.732647
18
init_grid must be a grid of booleans
def __init__(self, init_grid=None): self.height = len(init_grid) self.width = len(init_grid[0]) self.grid = [[Cell(self, c) for c in row] for row in init_grid] self.g = nx.Graph() self.tangle()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, width, height):\r\n\t\tself.grid = np.zeros(width*height, dtype=np.bool).reshape(width,height)\r\n\t\tself.width = width\r\n\t\tself.height = height", "def grid_init_check(self):\n #try:\n #assert isinstance(self.conf.dim_x,int),(\n # 'Bad dimension x:{0}'.forma...
[ "0.7037687", "0.6612", "0.65555984", "0.6515657", "0.6503577", "0.64982694", "0.6443239", "0.6398483", "0.6368833", "0.6309067", "0.6301773", "0.62859386", "0.6251131", "0.6250382", "0.6243857", "0.62138927", "0.61646396", "0.61468625", "0.61320025", "0.61282015", "0.61050105...
0.60455173
26
creates edges in network, connects neighbors together
def tangle(self): for x in range(self.width): for y in range(self.height): cell = self.grid[y][x] # connect to neighborhood for i in [x-1, x, x+1 if x+1 < self.width else -1]: for j in [y-1, y, y+1 if y+1 < self.height else -1]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_edges(self):\n print(\"Constructing Edges.\")\n # -----------------------------------------\n # TODO: You should write this method!\n\n # Note: this method may take some time to run - it is likely to be O(N^2), and some lists have N = 10,000 words or more.\n # (I've ha...
[ "0.7274999", "0.7098207", "0.7081175", "0.70223093", "0.696671", "0.68693787", "0.6866858", "0.6841617", "0.6824476", "0.67590827", "0.67221117", "0.67200255", "0.6635317", "0.6633752", "0.6604058", "0.65815806", "0.6557673", "0.6525268", "0.65085554", "0.64929134", "0.649046...
0.0
-1
Accepts list of nested dictionaries and produces a single dictionary containing mean values and estimated errors from these dictionaries. Errors are estimated as confidence intervals lengths.
def dict_recur_mean_err(dlist): if isinstance(dlist[0], dict): res_dict = {} for k in dlist[0]: n_dlist = [d[k] for d in dlist] res_dict[k] = dict_recur_mean_err(n_dlist) return res_dict else: n = len(dlist) mean = float(sum(dlist)) / n var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_dictlist(dict_list):\r\n avg=sum(dict_list)/len(dict_list)\r\n return avg", "def summaries(e_dict, m_dict):\n for key, value in m_dict.items():\n e_dict[key].append(np.mean(value))\n return e_dict", "def calculate_averages(data):\n def mean(item_key):\n all_items = [i[item_...
[ "0.6419814", "0.6262054", "0.61799544", "0.6119319", "0.59288824", "0.5902225", "0.5875992", "0.58529663", "0.5829413", "0.5736729", "0.5708193", "0.5633498", "0.55455", "0.5544103", "0.55197287", "0.54795134", "0.5463006", "0.54573137", "0.544684", "0.5438539", "0.5426526", ...
0.78539246
0
Helper function to connect reach from/to wastewater network elements
def connect_reach(self, reach_id, from_id=None, to_id=None): data = {} if from_id is not None: data['rp_from_fk_wastewater_networkelement'] = from_id if to_id is not None: data['rp_to_fk_wastewater_networkelement'] = to_id self.update('vw_qgep_reach', data, reach_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swconnect(localpop, remotepop, mac, vc, meter):\n core = Container.fromAnchor(localpop.properties['CoreRouter'])\n corename = core.resourceName\n (corename,coredom,coreport,corevlan) = getvcnode(vc, corename)\n remotecore = Container.fromAnchor(remotepop.properties['CoreRouter'])\n remotecorenam...
[ "0.6267456", "0.61050874", "0.6091898", "0.5930662", "0.59238946", "0.5836637", "0.5822732", "0.5821258", "0.58018726", "0.58003306", "0.5727876", "0.5715374", "0.5697749", "0.5681944", "0.5681944", "0.5671002", "0.5660585", "0.5634978", "0.562125", "0.56210154", "0.56170815"...
0.6569376
0
Create a new node.
def __init__(self, id, x, y, z): self.id = id self._dof_x = Dof(id=(id, 'u'), value=x) self._dof_y = Dof(id=(id, 'v'), value=y) self._dof_z = Dof(id=(id, 'w'), value=z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_node(\n self,\n name,\n ):\n pass", "def node_create(self, **kwargs):\n node = self.ironic_client.node.create(**kwargs)\n self.addCleanup(self.node_delete, node)\n return node", "def create_node(self, **kwargs):\n if not self.nodes:\n ...
[ "0.83968526", "0.829411", "0.8216814", "0.7956574", "0.786538", "0.765477", "0.75807256", "0.7490357", "0.7468313", "0.7388707", "0.73502946", "0.73339564", "0.73055464", "0.73018134", "0.7253752", "0.7235506", "0.7231156", "0.71696454", "0.71689934", "0.7149393", "0.7107512"...
0.0
-1
Resolve activelink values into x and y directions. Takes a set of values defined on active links, and returns those values
def resolve_values_on_active_links(grid, active_link_values): link_lengths = grid.length_of_link[grid.active_links] return ( np.multiply( ( ( grid.node_x[grid._activelink_tonode] - grid.node_x[grid._activelink_fromnode] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_values_on_links(grid, link_values):\n return (\n np.multiply(\n (\n (\n grid.node_x[grid.node_at_link_head]\n - grid.node_x[grid.node_at_link_tail]\n )\n / grid.length_of_link\n ),\n ...
[ "0.6321813", "0.56443125", "0.5429352", "0.53935385", "0.52528846", "0.5167584", "0.5058837", "0.5045933", "0.50244004", "0.49784845", "0.49667338", "0.4963591", "0.4912155", "0.4907423", "0.48758897", "0.48721966", "0.48685086", "0.48672333", "0.4834237", "0.4823273", "0.480...
0.75788385
0
Resolve link values into x and y directions. Takes a set of values defined on active links, and returns those values
def resolve_values_on_links(grid, link_values): return ( np.multiply( ( ( grid.node_x[grid.node_at_link_head] - grid.node_x[grid.node_at_link_tail] ) / grid.length_of_link ), link_valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_values_on_active_links(grid, active_link_values):\n link_lengths = grid.length_of_link[grid.active_links]\n return (\n np.multiply(\n (\n (\n grid.node_x[grid._activelink_tonode]\n - grid.node_x[grid._activelink_fromnode]\n ...
[ "0.7462041", "0.5736362", "0.5348133", "0.5260617", "0.5245823", "0.5127555", "0.5098766", "0.50402445", "0.49898282", "0.49610978", "0.496048", "0.49522752", "0.4950983", "0.49342787", "0.48836175", "0.48753074", "0.48695916", "0.48694083", "0.4847132", "0.48457292", "0.4829...
0.71486044
1
Temporary fix until master of pyzmq is released
def fix_zmq_exit(): import zmq ctx = zmq.Context.instance() ctx.term()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zmq_version():\n return \"%i.%i.%i\" % zmq_version_info()", "def zmq_version():\n return \"%i.%i.%i\" % zmq_version_info()", "def __init__(self, ip='127.0.0.1', port='50020'):\n self.ip = ip \n self.port = port\n self.ctx = zmq.Context()\n self.socket = zmq.Socket(self.ctx...
[ "0.6027707", "0.6027707", "0.58552617", "0.58471286", "0.58471286", "0.57001704", "0.56426144", "0.5506162", "0.54845864", "0.540713", "0.53992295", "0.5322331", "0.53118736", "0.5300016", "0.5295095", "0.5244118", "0.5238676", "0.52331984", "0.5188429", "0.5173681", "0.51529...
0.6925526
0
loads any cached endpoint data
def load_satellite_endpoint(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _retrieveCachedData(self):", "def getData(self, local_cache):", "def reload_cache(self):\n self.data = self.read_data_cache()", "def _load_cache(self):\n self.cache = self.cache_manager.retrieve(self.cache_file)\n if self.cache is None:\n self.cache = {}\n return", ...
[ "0.7226634", "0.6504619", "0.64686245", "0.644251", "0.63786346", "0.63269603", "0.630396", "0.6263083", "0.62569904", "0.61387116", "0.61214733", "0.61009794", "0.607778", "0.60665256", "0.6013252", "0.60094726", "0.6003467", "0.59913933", "0.5914529", "0.58992904", "0.58779...
0.55069077
64
caches endpoint data in config
def save_satellite_endpoint(endpoint): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __initCacheSection(self):\n m = hashlib.md5()\n for i in [self.AUTHZ_ENDPOINT, self.CLIENT_ID]:\n m.update(bytes(self.conf[i], \"utf-8\"))\n self.cacheSection = str(m.hexdigest())", "def endpoint_config(self, endpoint_name=None):\n if endpoint_name is None:\n ...
[ "0.62821656", "0.59112763", "0.5848005", "0.58431375", "0.58003515", "0.57257694", "0.56959885", "0.56897545", "0.5681411", "0.5598243", "0.557959", "0.5578218", "0.557389", "0.5570347", "0.55363965", "0.5532489", "0.55160964", "0.55037296", "0.5493448", "0.54910964", "0.5481...
0.5025329
74
Runs n_iter Gibbs sweeps on the data and returns the assignment vector.
def fit(self, n_iter=1, sm_prop=.1, num_sm_sweeps=5, sm_burn=10): _ = self.thisptr.fit(n_iter, sm_prop, num_sm_sweeps, sm_burn) return self.thisptr.get_Z()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gibbs_sampling_iteration(self):\n for m, dm in enumerate(self.corpus):\n for n, w_mn in enumerate(dm):\n k = self.z_mn[m, n]\n self.n_mk[m, k] -= 1\n self.n_m[m] -= 1\n self.n_kt[k, w_mn] -= 1\n self.n_k[k] -= 1\n ...
[ "0.64349025", "0.6368143", "0.60940975", "0.5838068", "0.57427555", "0.5693699", "0.5643789", "0.5591859", "0.5575805", "0.55605334", "0.54700565", "0.54551566", "0.54093194", "0.5389517", "0.5385396", "0.5383037", "0.5361836", "0.5339924", "0.53356373", "0.53271544", "0.5315...
0.0
-1
Enforces that all numpy arrays are 2D
def __check_2d_and_reshape(X): if len(X.shape) == 1: X = np.reshape(X, (-1, X.shape[0])) return X
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nd_shape_checking(x, y, mvaxis, traxis):\n assert x.ndim == y.ndim\n dims = np.delete(np.arange(x.ndim), -2)\n assert all([x.shape[k] == y.shape[k] for k in dims])", "def _assert_2d(field):\n assert len(np.shape(field))==2, \"Variable fields must be a 2D array\"", "def enforce_2D(self,):\n ...
[ "0.69607204", "0.69541734", "0.685842", "0.68151885", "0.675131", "0.67469525", "0.6726605", "0.67196745", "0.6677873", "0.6656172", "0.6653277", "0.66295964", "0.66173494", "0.6605646", "0.6597243", "0.65929127", "0.65756637", "0.65693486", "0.6558567", "0.65577745", "0.6527...
0.66363525
11
'Partial Gibbs' importance sampling estimator for NIW DPMM marginal likelihood.
def pgibbs_estimator(X, data_model, crp_alpha, n_samples=100, n_sweeps=0, return_logps=False): n_data = X.shape[0] logps = np.zeros(n_samples) dpgmm = PyDPGMM(data_model, X, crp_alpha, seed=random.randrange(2**31)) lambda_0 = data_model.lambda_0 mu_0 = data_model.mu_0 kappa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gibbs_sample(self):\n # Initialize the initial state of Markov Chain.\n self.initialize()\n # Gibbs Sampling.\n for iteration_index in range(0, self.iteration_number, 1):\n for m in range(0,self.document_number,1):\n for n in range(0, len(self.documents[m])...
[ "0.6256301", "0.6242265", "0.61594075", "0.6053953", "0.60510284", "0.6005833", "0.59367317", "0.584721", "0.5808873", "0.5685996", "0.5675693", "0.5675565", "0.56702447", "0.56690717", "0.566265", "0.5647645", "0.5620897", "0.5576744", "0.5575298", "0.5569953", "0.55577844",...
0.53995025
31
log Normal, NormalinverseWishart mixture model marginal likelihood (multiprocessing wrapper). See niw_mmml
def niw_mmml_mp(args): return niw_mmml(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GSM_log_likelihood(X, model):\n D, M = X.shape\n k = model.mix.shape[0]\n log_likelihood = 0\n for i in range(M):\n logpdf_X = 0\n for j in range(k):\n mvn = multivariate_normal(cov=model.cov[j, :])\n logpdf_X = mvn.logpdf(x=X[:, i]) * model.mix[j]\n log_l...
[ "0.7129682", "0.68791443", "0.68791443", "0.677993", "0.67566806", "0.6739996", "0.64581996", "0.6452493", "0.64519227", "0.64319754", "0.6418545", "0.6356138", "0.6347906", "0.6317059", "0.63140416", "0.6290158", "0.62781036", "0.62750334", "0.62631077", "0.6263068", "0.6256...
0.625828
20
log Normal, NormalinverseWishart mixture model marginal likelihood. Computes, through enumeration, the log marginal likelihood of the data X under NIW.
def niw_mmml(X, lambda_0, mu_0, kappa_0, nu_0, crp_alpha, Z_start, k_start, hist_start, ncalc): ml = lgniwmmml(X, lambda_0, mu_0, kappa_0, nu_0, crp_alpha, Z_start, k_start, hist_start, ncalc) return ml
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_marginal_likelihood(self, X, W):\n phi_X = self.phi(X, W)\n S_n = phi_X.T @ phi_X + np.eye(self.M)\n mu_n = np.linalg.inv(S_n) @ phi_X.T @ self.Y\n a_n = self.gamma_a0 + self.N / 2\n A = np.diag(self.Y.T @ self.Y)\n C = np.diag(mu_n.T @ S_n @ mu_n)\n ...
[ "0.78063273", "0.7508167", "0.73808867", "0.73432183", "0.7330141", "0.7316478", "0.7285915", "0.71652114", "0.71091264", "0.706634", "0.6967109", "0.6942692", "0.69155854", "0.6898422", "0.6890838", "0.686687", "0.67498034", "0.67291266", "0.67130864", "0.67073977", "0.67015...
0.0
-1
log Normal, NormalinverseWishart marginal likelihood
def niw_ml(X, lambda_0, mu_0, kappa_0, nu_0, Z_0): X = __check_2d_and_reshape(X) ml = lgniwml(X, mu_0, lambda_0, kappa_0, nu_0, Z_0) return ml
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_marginal(self):\n #\n # Predictive covariance of x is sum of covariance of phi a and covariance of x|a\n x_Sigma = self.phi @ self.phi.T + np.diag(self.sigma_n**2 * np.ones(self.M))\n #\n # Predictive mean is 0 by symmetry\n # so given that x is distributed as a MVN, the exact marginal is...
[ "0.7544242", "0.73597986", "0.7338848", "0.7236446", "0.72054094", "0.7177918", "0.7146649", "0.7097351", "0.70971406", "0.70118856", "0.6948188", "0.69440687", "0.6940398", "0.6935459", "0.6919221", "0.6891145", "0.68668437", "0.68515944", "0.6832043", "0.67718047", "0.67520...
0.0
-1
log Normal, NormalinverseWishart posterior predictive probabiliy, P(Y|X)
def niw_pp(Y, X, lambda_0, mu_0, kappa_0, nu_0): X = __check_2d_and_reshape(X) Y = __check_2d_and_reshape(Y) pp = lgniwpp(Y, X, mu_0, lambda_0, kappa_0, nu_0) return pp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def posterior_loss(X, mu, sigma, log_pi):\r\n log_PDF = log_GaussPDF(X, mu, sigma)\r\n log_post = log_posterior(log_PDF, log_pi)\r\n\r\n loss = torch.logsumexp(log_post, dim=1)\r\n # loss = torch.exp(log_post)\r\n # loss = torch.sum(loss, dim=1)\r\n # loss = torch.log(loss)\r\n loss = torch.su...
[ "0.73209095", "0.7124443", "0.70512974", "0.6935843", "0.6934605", "0.6898014", "0.6841875", "0.68088543", "0.67531884", "0.6725506", "0.6724444", "0.67063886", "0.67037183", "0.66599774", "0.66452086", "0.6638591", "0.6627576", "0.66270715", "0.66200286", "0.661813", "0.6585...
0.0
-1
This test ensures that after movement the tail is within one of the head.
def always_touching(self): assert int(self.snake[0].real - self.snake[1].real) in [1, 0, -1] and int( self.snake[0].real - self.snake[1].real) in [1, 0, -1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tail_after_push_in_list(new_dll):\n assert new_dll.tail.value == 5", "def test_deque_append_one_head_is_tail(dq):\n dq.append(8)\n assert dq._dll.head == dq._dll.tail", "def test_tail_after_append_in_list(new_dll):\n new_dll.append(6)\n assert new_dll.tail.value == 6", "def test_appen...
[ "0.633991", "0.630887", "0.62105596", "0.62083244", "0.61631024", "0.6139506", "0.6122812", "0.61027414", "0.60680336", "0.604083", "0.6018178", "0.6001944", "0.59997857", "0.5978458", "0.5947692", "0.59368396", "0.5927887", "0.5915343", "0.589054", "0.58878154", "0.5807712",...
0.0
-1
Applies filters and stores job postings in a database job_list a list of Job_Posting objects avoids saving duplicate job postings into the database by hashing job_description creates the database if it does not exist yet
def store_data(job_list): if not job_list: raise ValueError('Job list is empty. To proceed, it must contain at least one item.') if not isfile('/data/visited_jobs.db'): print('DB not found') ds.create_db() accepted, not_accepted = 0, 0 for job in job_list: jo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateJobDB(request,Q={}):\n\tuser = request.user\n\t# Get metadata\n\tresponse = agaveRequestMetadataList(user,Q=Q)\n\t# Add job if not in db\n\tfor metadata in response['result']:\n\t\tvalue = metadata['value']\n\t\tif 'jobName' in value and 'parameters' in value:\n\t\t\tlogger.info('SetName: ' + value['jobN...
[ "0.6064062", "0.5675799", "0.561844", "0.55301267", "0.5519273", "0.53884274", "0.5382857", "0.53754044", "0.536694", "0.5362908", "0.5361829", "0.53558755", "0.53386945", "0.5303524", "0.52626956", "0.5243744", "0.5243744", "0.5236328", "0.5209559", "0.5199003", "0.5169366",...
0.6501171
0
It's a method to select the object with a mouse LEFT click.
def select_me(self, mouse_pos): #self.active = self.rect.collidepoint(mouse_pos) self.active = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_left_down(self):\n pass", "def LeftClick(self):\n self._PressLeftButton()\n self._ReleaseAllButtons()", "def on_left_mouse_click(self, event: Event) -> None:\n\t\tself.mouse_state.set_click(event.x, event.y)", "def leftButtonDown(self):\n\t\tautopy.mouse.toggle(True,autopy.mouse.LEFT_B...
[ "0.7850286", "0.7682228", "0.75443804", "0.74690956", "0.70894885", "0.7034655", "0.69766456", "0.68895245", "0.6713843", "0.6668079", "0.66600037", "0.6633893", "0.66278917", "0.6621199", "0.66195446", "0.66033846", "0.65921617", "0.6585022", "0.65716195", "0.65329665", "0.6...
0.6151848
39
It's a method to select the object with a mouse LEFT click.
def deselect_me(self): self.active = False #print('Frame active')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_left_down(self):\n pass", "def LeftClick(self):\n self._PressLeftButton()\n self._ReleaseAllButtons()", "def on_left_mouse_click(self, event: Event) -> None:\n\t\tself.mouse_state.set_click(event.x, event.y)", "def leftButtonDown(self):\n\t\tautopy.mouse.toggle(True,autopy.mouse.LEFT_B...
[ "0.7848693", "0.7680536", "0.75437725", "0.74669474", "0.7088645", "0.7034065", "0.6975405", "0.68896013", "0.67126954", "0.66690433", "0.6658792", "0.6631664", "0.6627139", "0.66198033", "0.66179967", "0.6602205", "0.6590366", "0.6582882", "0.6571094", "0.65318286", "0.65072...
0.0
-1
It's a method to select the object with a mouse LEFT click.
def select_me(self, mouse_pos): self.active = self.rect.collidepoint(mouse_pos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_left_down(self):\n pass", "def LeftClick(self):\n self._PressLeftButton()\n self._ReleaseAllButtons()", "def on_left_mouse_click(self, event: Event) -> None:\n\t\tself.mouse_state.set_click(event.x, event.y)", "def leftButtonDown(self):\n\t\tautopy.mouse.toggle(True,autopy.mouse.LEFT_B...
[ "0.7849615", "0.7681661", "0.7543148", "0.7468128", "0.7089086", "0.7034825", "0.69766486", "0.6889817", "0.67133605", "0.66693765", "0.6659412", "0.6632614", "0.6627473", "0.6620587", "0.66194576", "0.66029096", "0.6590843", "0.65843195", "0.6572333", "0.6533226", "0.6508757...
0.58478814
77
It's a method to set up the attributes of movement.
def select_route(self, mouse_pos): if self.active: self.reset_route() self.start_pos = self.rect.center self.goal_pos = mouse_pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def movement(self):", "def __init__(self):\r\n self.position=(0,0)\r\n self.direction = 0.\r\n self.speed = 0\r\n self.state = 0\r\n pass", "def setMovement(self, movement):\n self.ma = movement", "def player_movement(self):", "def __init__(self):\n self.pos...
[ "0.73551285", "0.7005285", "0.68719834", "0.6794279", "0.6764713", "0.6399003", "0.6320349", "0.63135964", "0.6251428", "0.6246477", "0.6231585", "0.62272686", "0.6213573", "0.62046844", "0.61602026", "0.6157043", "0.6152432", "0.613486", "0.6130092", "0.6127408", "0.61240387...
0.0
-1
It's a method to reset the attributes of movement.
def reset_route(self): self.shift = 0 self.start_pos = None self.goal_pos = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_movement(self):\n self.direction = [0, 0]", "def reset(self):\n self.position = self.initial_position\n self.velocity = [0, 0, 0]", "def reset(self):\n self.x_pos1 = 0\n self.x_pos2 = self.x_pos1 + self.width\n self.y_pos = self.offset_y\n self.velocit...
[ "0.81388026", "0.7350005", "0.72513926", "0.71481067", "0.7129603", "0.70808697", "0.7048279", "0.7019597", "0.70115805", "0.6921982", "0.6845", "0.6844228", "0.6834343", "0.6832207", "0.6819661", "0.68065673", "0.67942864", "0.678764", "0.678764", "0.678764", "0.6776324", ...
0.6769358
21
It's a method to reset the attributes of movement.
def next_point(self, start_pos, goal_pos): self.shift = 0 self.start_pos = start_pos self.goal_pos = goal_pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_movement(self):\n self.direction = [0, 0]", "def reset(self):\n self.position = self.initial_position\n self.velocity = [0, 0, 0]", "def reset(self):\n self.x_pos1 = 0\n self.x_pos2 = self.x_pos1 + self.width\n self.y_pos = self.offset_y\n self.velocit...
[ "0.8138531", "0.7349508", "0.7251003", "0.7148113", "0.7129765", "0.7080313", "0.7047862", "0.7019804", "0.70114785", "0.69211113", "0.6844563", "0.68436134", "0.6833529", "0.683257", "0.6819753", "0.68054134", "0.67932", "0.67873365", "0.67873365", "0.67873365", "0.6776275",...
0.0
-1