query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Returns a boolean of whether provided_password matches the stored password/hash
def verify_pwd_str(provided_password: str, stored_hash: str) -> bool: salt = stored_hash[:64].encode('ascii') stored_password = stored_hash[64:] provided_password = provided_password.encode('utf-8') pwdhash = hashlib.pbkdf2_hmac('sha256', provided_password, salt, 100000) pwdhash = binascii.hexlify(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_password(stored_passwd, provided_passwd):\n salt = stored_passwd[:64]\n stored_password = stored_passwd[64:]\n pwdhash = hashlib.pbkdf2_hmac(\n 'sha512', provided_passwd.encode('utf-8'), salt.encode('ascii'), 100000\n )\n pwdhash = binascii.hexlify(pwdhash).decode('ascii')\n ret...
[ "0.827573", "0.8247292", "0.8237658", "0.82278806", "0.8143177", "0.81419307", "0.8141262", "0.813452", "0.81270456", "0.81268185", "0.81268185", "0.81268185", "0.8123447", "0.80535436", "0.8022487", "0.801157", "0.798846", "0.7955522", "0.795291", "0.7952168", "0.79221773", ...
0.81975955
4
insert a new node after the node with the value == data
def add_after(self, data, new_node): if not self.head: raise Exception("List is empty") for node in self: if node.data == data: new_node.next = node.next node.next = new_node return raise Exception("Node with data '{}' not f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_after(self, node_to_insert_after, data):\n node = Node(data)\n temp = self.head\n while temp:\n if temp.data == node_to_insert_after:\n break\n temp = temp.next\n if not temp:\n print('Item does not exist')\n return\n...
[ "0.8017719", "0.7703781", "0.76902115", "0.76686096", "0.7664726", "0.75333846", "0.7481502", "0.74634695", "0.7428696", "0.7394129", "0.73860925", "0.73712695", "0.7349627", "0.7346601", "0.72991115", "0.72915673", "0.7268491", "0.7251054", "0.7234074", "0.72160935", "0.7214...
0.77405715
1
insert a new node before the node with the value == data
def add_before(self, data, new_node): if not self.head: raise Exception("List is empty") if self.head.data == data: return self.add_first(new_node) prev_node = self.head for node in self: if node.data == data: prev_node.next = new_node ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_before(self, node_to_insert_before, data):\n node = Node(data)\n temp = self.head\n if temp.data == node_to_insert_before:\n node.next = temp\n self.head = node\n return\n while temp.next:\n if temp.next.data == node_to_insert_befor...
[ "0.81363773", "0.76943445", "0.76072025", "0.75714976", "0.75696844", "0.7525285", "0.7499273", "0.7499042", "0.74718624", "0.74718356", "0.74684525", "0.7457942", "0.74416155", "0.7441248", "0.7431289", "0.74264103", "0.74258816", "0.7389223", "0.73806584", "0.73194534", "0....
0.75990194
3
insert a node as the first node of the linkedlist
def add_first(self, node_to_add): node_to_add.next = self.head self.head = node_to_add
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_start(self, data):\n\n if self.head is None:\n self.head = ListNode(data)\n else:\n temp = self.head\n self.head = ListNode(data)\n self.head.next = temp", "def add_first(self, value):\n self.head = Node(value, self.head)", "def insert...
[ "0.8008903", "0.79346806", "0.7932764", "0.7787919", "0.77347374", "0.7636905", "0.7605167", "0.7597865", "0.7585223", "0.74866986", "0.748416", "0.74723214", "0.73881465", "0.7337074", "0.7327192", "0.7324161", "0.7305776", "0.72627205", "0.7247517", "0.7244222", "0.72424436...
0.7864434
3
insert a node as the last one of the linkedlist
def add_last(self, node_to_add): if self.head == None: self.head = node_to_add return node = self.head # while node.next is not None:* while node.next is not None: node = node.next node.next = node_to_add
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_last(self, data):\n node = self.Node(data, None)\n\n if self.is_empty():\n self.head = node\n else:\n tail = self.getNode(self.list_size - 1)\n tail.next_node = node\n\n self.list_size += 1", "def add_last(self, elem):\n if self.is_empty...
[ "0.78137267", "0.77608234", "0.7719841", "0.75934094", "0.7559352", "0.7526606", "0.7486747", "0.7443759", "0.73251873", "0.7285716", "0.7256405", "0.7070984", "0.69895655", "0.69473404", "0.6851709", "0.68324643", "0.682861", "0.6751393", "0.6713299", "0.67095584", "0.669534...
0.797479
0
Generate the KML Placemark (line style) for a given item.
def __create_line(self, item): doc = xml.dom.minidom.Document() pm = doc.createElement("Placemark") doc.appendChild(pm) if 'style' in item: style_url = doc.createElement("styleUrl") pm.appendChild(style_url) style_url_text = doc.createTextNode('#%(styl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_placemark(self, item):\n doc = xml.dom.minidom.Document()\n pm = doc.createElement(\"Placemark\")\n doc.appendChild(pm)\n if 'style' in item:\n style_url = doc.createElement(\"styleUrl\")\n pm.appendChild(style_url)\n style_url_text = doc.cr...
[ "0.6814284", "0.5569151", "0.52429074", "0.5226637", "0.520135", "0.5189265", "0.5174033", "0.51711875", "0.5134652", "0.51036316", "0.5066916", "0.5013039", "0.49738675", "0.49460444", "0.4934254", "0.49219415", "0.48308852", "0.47897384", "0.4775293", "0.47418913", "0.47367...
0.7545575
0
Return a ``set`` of endpoint expressions which match the provided ``method`` and ``request``. The items in this set can be provided to ``PluginConfiguration.endpoint`` to get the adapter configuration.
def match_endpoint(self, method, request): if "?" in request: raise InvalidRequest() all_endpoints = self.config.endpoints() match_str = "%s %s" % (method, request) matched_endpoints = set() # Note: fnmatch.filter seemed to be broken when trying to do exaclty this. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_endpoints(self, request):\n enumerator = self.endpoint_enumerator_class(\n self._gen.patterns, self._gen.urlconf, request=request)\n endpoints = enumerator.get_api_endpoints()\n view_paths = defaultdict(list)\n view_cls = {}\n for path, method, callback, decora...
[ "0.6353602", "0.53934693", "0.53166735", "0.5291346", "0.5146101", "0.5138414", "0.5113241", "0.5098418", "0.50606406", "0.505815", "0.5045406", "0.5031968", "0.5016269", "0.49336115", "0.49290004", "0.492719", "0.49132147", "0.49003595", "0.48830202", "0.48762262", "0.487305...
0.7727221
0
For each bbox (backround excluded), ordered by X axis of each centroid, bbxes_data returns centroid coordinates, area, width, height (approx) start and end of the bbox on x axis.
def bbxes_data(img): _, _, stats, centr = cv2.connectedComponentsWithStats(img) # (xCentr, yCentr, area, width, height, xStart, xEnd , yStart, yEnd ) return sorted([(cent[0], cent[1], stat[4], stat[2], stat[3], stat[0], stat[0] + stat[2], stat[1], stat[1] + sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_bb(self):\n all_shapes = list(self.parts.values()) + list(self.edges.values())\n bbox_vertices = cascaded_union(all_shapes).envelope.exterior.coords.xy\n min_x = min(bbox_vertices[0])\n max_x = max(bbox_vertices[0])\n min_y = min(bbox_vertices[1])\n max_y = max...
[ "0.6629442", "0.64265776", "0.63815784", "0.63765675", "0.63518363", "0.63476306", "0.6339828", "0.6327926", "0.632311", "0.62815636", "0.6277487", "0.624912", "0.6248139", "0.62443334", "0.62272245", "0.6211139", "0.61762685", "0.61475766", "0.612279", "0.6060051", "0.605037...
0.6745201
0
Takes a list & returns a new list with only the unique elements from the original
def remove_duplicates(lst): new_lst = list() for item in lst: if item not in new_lst: new_lst.append(item) return new_lst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique(input_list):\n output = []\n for item in input_list:\n if item not in output:\n output.append(item)\n return output", "def unique(li):\r\n seen = set()\r\n seen_add = seen.add\r\n return [x for x in li if not (x in seen or seen_add(x))]", "def _unique(li):\n re...
[ "0.83567464", "0.82539195", "0.81471103", "0.8056484", "0.80559146", "0.8028145", "0.7963171", "0.7959442", "0.79517716", "0.79497576", "0.79425174", "0.7871519", "0.78296536", "0.7826357", "0.78106976", "0.7770838", "0.7758128", "0.7687371", "0.7676039", "0.76574063", "0.765...
0.74613106
30
Extract the audio from a .mp4 into a .wav file
def extract_audio(file_name, audio_directory): basename = os.path.splitext(os.path.basename(file_name))[0] audio_file_name = audio_directory + '/' + basename + '.wav' subprocess.call(['ffmpeg', '-y', '-i', file_name, '-ac', '1', audio_file_name]) return audio_file_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_wav (filename, name, origpath, wavpath, mono):\n print(\"Converting {0} to .wav...\".format(filename))\n if not re.match(r\".*_\\d+$\",name):\n # If filenames do include video titles\n name = name.rsplit('_',1)[0]\n\n channel, vid_num = name.rsplit('_', 1)\n channel = re.su...
[ "0.7061239", "0.66612095", "0.6653004", "0.6589058", "0.6399253", "0.6387151", "0.63443315", "0.6324186", "0.6286349", "0.626849", "0.61686367", "0.6108693", "0.6077022", "0.5950882", "0.5915118", "0.5894831", "0.5840047", "0.5821041", "0.57953334", "0.57953334", "0.5785092",...
0.65188646
4
Get a specific dataset.
def get_dataset(self, dataset_id): return self.session.query(self.Dataset).get(dataset_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset(self):\n return datasets.get_dataset(self.dataset_id)", "def get(self, name):\n assert name, \"Must input a valid dataset name.\"\n return self.manager.get_data(name)", "def get(id: str) -> DataSet:\n pass", "def get(log, session, args):\n url = \"{}datasets/{}\...
[ "0.8136231", "0.7664556", "0.7584615", "0.7521811", "0.74774003", "0.73521787", "0.73015463", "0.723902", "0.7237518", "0.72152746", "0.7213452", "0.7174922", "0.7135897", "0.71247834", "0.71148634", "0.70325136", "0.702808", "0.70146763", "0.69836175", "0.6968691", "0.690905...
0.796387
1
Get the maximum value of a numeric column by name, or None.
def get_maximum_y(self, datarun_id, score_target): query = self.session.query(func.max(getattr(self.Classifier, score_target))) result = query.filter(self.Classifier.datarun_id == datarun_id).first() if result: return float(result) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max(self):\n max_value= self.df[self.col_name].max()\n return max_value", "def get_max(self, line_number):\n if self.isIndexError(line_number):\n return 'null'\n return max(self.numbers[line_number])", "def max(self, column):\n if not column:\n columns =...
[ "0.74639744", "0.64101475", "0.6389478", "0.63882947", "0.6381379", "0.6365704", "0.63021165", "0.6196105", "0.61763996", "0.61741793", "0.6142465", "0.60454375", "0.60396963", "0.6029864", "0.59929687", "0.5960068", "0.5959012", "0.59545106", "0.59138006", "0.58954173", "0.5...
0.0
-1
Get the repository root for the given path in the repository.
def get_repo_root_from_file_in_repo(path_to_file_in_repo): try: repo = Repo(path=path_to_file_in_repo, search_parent_directories=True) submodules_root = repo.git.rev_parse("--show-superproject-working-tree") if submodules_root: return submodules_root git_root = repo.git...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_git_root(path):\n\tgit_repo = git.Repo(path, search_parent_directories=True)\n\tgit_root = git_repo.git.rev_parse(\"--show-toplevel\")\n\treturn git_root", "def repo_root_path() -> str:\n\n global __REPO_ROOT\n if __REPO_ROOT:\n return __REPO_ROOT\n\n path = os.path.normpath(os.getcwd())\...
[ "0.80345696", "0.72423124", "0.7108167", "0.7094221", "0.68003386", "0.67979795", "0.6768204", "0.67447466", "0.6739204", "0.6728868", "0.65765256", "0.6542218", "0.6538222", "0.6530961", "0.6530321", "0.6467533", "0.6401485", "0.6377694", "0.6244043", "0.6230077", "0.6225637...
0.75202703
1
Read the requirements.txt file
def read_requirements(): with open('requirements.txt') as f: requirements = f.readlines() return [element.strip() for element in requirements]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_requirements():\r\n reqs_path = os.path.join('.', 'requirements.txt')\r\n with open(reqs_path, 'r') as f:\r\n requirements = [line.rstrip() for line in f]\r\n return requirements", "def read_requirements():\n reqs_path = path.join('.', 'requirements.txt')\n with open(reqs_path, 'r'...
[ "0.85352737", "0.8522094", "0.8343633", "0.8074831", "0.78657067", "0.78519624", "0.7612409", "0.7513151", "0.75105083", "0.7447678", "0.74335086", "0.7428316", "0.73573995", "0.7310156", "0.719673", "0.713364", "0.7127345", "0.71165085", "0.7093113", "0.70769054", "0.7070489...
0.8412274
2
Sets the referent_id of this Referent.
def referent_id(self, referent_id): self._referent_id = referent_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reviewer_id(self, reviewer_id: int):\n\n self._reviewer_id = reviewer_id", "def recipe_id(self, recipe_id):\n\n self._recipe_id = recipe_id", "def dentist_id(self, dentist_id: float):\n\n self._dentist_id = dentist_id", "def crf_id(self, crf_id):\n\n self._crf_id = crf_id", ...
[ "0.7521882", "0.6889835", "0.65200734", "0.64941335", "0.64941335", "0.64922696", "0.63027835", "0.62594944", "0.6239435", "0.6201605", "0.61407244", "0.6119599", "0.60819674", "0.6037206", "0.6003683", "0.5982003", "0.5977151", "0.5955647", "0.59283316", "0.5920757", "0.5918...
0.8791246
0
Sets the sentence_id of this Referent.
def sentence_id(self, sentence_id): self._sentence_id = sentence_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def survey_id(self, survey_id):\n\n self.logger.debug(\"In 'survey_id' setter.\")\n\n self._survey_id = survey_id", "def survey_id(self, survey_id):\n\n self._survey_id = survey_id", "def set_sentences(self, sentences):\n self._sentences = sentences", "def setInputSentence(self, s...
[ "0.66087586", "0.627227", "0.62115383", "0.61738455", "0.596489", "0.5828634", "0.5827506", "0.5798886", "0.57576066", "0.5734348", "0.57200944", "0.56938773", "0.5671339", "0.56022173", "0.5592578", "0.5589209", "0.5575985", "0.5511537", "0.5506638", "0.54660535", "0.5466053...
0.89273924
0
Sets the token_id_from of this Referent.
def token_id_from(self, token_id_from): self._token_id_from = token_id_from
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_id_to(self, token_id_to):\n\n self._token_id_to = token_id_to", "def token_requestor_id(self, token_requestor_id):\n if self.local_vars_configuration.client_side_validation and token_requestor_id is None: # noqa: E501\n raise ValueError(\"Invalid value for `token_requestor_id`...
[ "0.7220802", "0.5874213", "0.5807001", "0.5787265", "0.5642188", "0.56048626", "0.55462164", "0.55462164", "0.55462164", "0.55462164", "0.5503635", "0.5503635", "0.5492421", "0.5487638", "0.5487638", "0.5470028", "0.5442582", "0.5354153", "0.53522474", "0.53370667", "0.533158...
0.9152123
0
Sets the token_id_to of this Referent.
def token_id_to(self, token_id_to): self._token_id_to = token_id_to
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_id_from(self, token_id_from):\n\n self._token_id_from = token_id_from", "def to(self, to):\n\n self._to = to", "def to(self, to):\n if to is None:\n raise ValueError(\"Invalid value for `to`, must not be `None`\") # noqa: E501\n\n self._to = to", "def to_obje...
[ "0.7385047", "0.6005398", "0.59363765", "0.5635064", "0.56154656", "0.5479565", "0.54676884", "0.5430671", "0.5430671", "0.5424294", "0.5417659", "0.538281", "0.53706664", "0.53610456", "0.5342044", "0.5337537", "0.53265816", "0.53037125", "0.52333987", "0.5217597", "0.521521...
0.91768914
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Referent): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.76282835
88
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Set whether this is open registration or not
def one_election_set_reg(request, election): # only allow this for public elections if not election.private_p: open_p = bool(int(request.GET['open_p'])) election.openreg = open_p election.save() return HttpResponseRedirect(settings.SECURE_URL_HOST + reverse(voters_list_pretty, args=[election.uuid])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registration_allowed(self):\n return getattr(settings, 'REGISTRATION_OPEN', True)", "def registration_allowed(self):\n return getattr(settings, 'REGISTRATION_OPEN', True)", "def registration_allowed(self, request):\n\t\treturn getattr(settings, 'REGISTRATION_OPEN', True)", "def toggle(self)...
[ "0.69418806", "0.69418806", "0.6690661", "0.5962001", "0.59311855", "0.5887783", "0.58260906", "0.5812583", "0.57975376", "0.5650458", "0.56357485", "0.5617381", "0.5600693", "0.55924124", "0.5592393", "0.55629504", "0.5538304", "0.5533244", "0.5520195", "0.5506137", "0.54909...
0.53321993
33
Get reports by state name returns a list of reports as JSON objects
async def report_by_state(state: str): return DF[DF["state"] == state.title()].to_dict(orient="records")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_reports(request: Request):\n reports_collection = request.app.state.db.data.reports \n res = reports_collection.find()\n\n if res is None:\n raise HTTPException(404)\n\n return [Report(**i) for i in res]", "def get_all_states():\n states = storage.all(State).values()\n return...
[ "0.61376506", "0.61224073", "0.6072325", "0.5932306", "0.5925593", "0.5912382", "0.5897774", "0.5835839", "0.58245033", "0.5821449", "0.5820336", "0.5819001", "0.58042216", "0.5748587", "0.5717628", "0.57144326", "0.56763345", "0.56554556", "0.5640699", "0.5625667", "0.560093...
0.66826916
0
Get all reports returns a list of reports as JSON objects
async def full_report(): return DF.to_dict(orient="records")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_reports(request: Request):\n reports_collection = request.app.state.db.data.reports \n res = reports_collection.find()\n\n if res is None:\n raise HTTPException(404)\n\n return [Report(**i) for i in res]", "def get_reporters(self):\n url = self._get_api_url() + 'reporters'\n...
[ "0.8172183", "0.76013315", "0.71494836", "0.7011814", "0.69434434", "0.68754", "0.6761572", "0.6703724", "0.6670496", "0.66646093", "0.66258824", "0.6622954", "0.6612912", "0.65788347", "0.6559011", "0.65585995", "0.6515574", "0.6481294", "0.64416504", "0.6425122", "0.6407001...
0.5644745
100
Retrieve list of names of available annotation datasets. Returns
def available_datasets(self) -> List[str]: return sorted(self.__by_name.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_datasets():\n return METADATA.keys()", "def dataset_names(self) -> List[str]:\n return list(self._datasets.keys())", "def datasets(self):\n return [Dataset.GWAS_CATALOG, Dataset.CLINVAR, Dataset.EFO]", "def get_available_datasets():\n files = [file for file in glob.glob(os.path.join(...
[ "0.7301539", "0.71920174", "0.7124981", "0.7017626", "0.6794456", "0.67852193", "0.67726344", "0.6567309", "0.6563017", "0.6425694", "0.6400178", "0.6369227", "0.63549435", "0.6353314", "0.6290142", "0.62696636", "0.6207522", "0.61889446", "0.6126577", "0.6117318", "0.6091558...
0.7238505
1
Add annotations from datasets specified by name.
def annotate_rows_db(self, rel: Union[Table, MatrixTable], *names: str) -> Union[Table, MatrixTable]: rel = self._row_lens(rel) if len(set(names)) != len(names): raise ValueError( f'cannot annotate same dataset twice, please remove duplicates from: {names}') self._che...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_annotations(\n self,\n names: Mapping[str, Annotation],\n ) -> None:\n for name, refers_to in names.items():\n self.logger.info(f\"load_annotations {name!r} : {refers_to!r}\")\n if not self.extended_name_path.match(name):\n raise ValueEr...
[ "0.617287", "0.60448694", "0.58400685", "0.57229775", "0.5715708", "0.5713988", "0.57027924", "0.56789935", "0.56688243", "0.5644832", "0.5554821", "0.5549002", "0.55083346", "0.5502115", "0.54455227", "0.5436146", "0.54208475", "0.5406267", "0.54031473", "0.5388887", "0.5317...
0.0
-1
Returns string representation of a item set
def __str__(self): return ( f'{self.quantity}x {self.item.name} ' f'({self.shopping_cart.user.email})' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return 'TreeSet([{0}])'.format(','.join(str(item) for item in self))", "def __str__(self):\n # string representation includes values of all inner fields\n return \"Nodeset: \" + \"\\n\".join([node.__str__() for node in self.nodeset]) + \"\\n\"", "def rsset2str(self, e...
[ "0.717553", "0.71110284", "0.70947605", "0.7091383", "0.7040137", "0.7033818", "0.7027997", "0.7027997", "0.6888126", "0.6716146", "0.65908384", "0.6552841", "0.6517455", "0.6449033", "0.64335895", "0.6423281", "0.6407385", "0.6389387", "0.63543683", "0.63391906", "0.63108784...
0.0
-1
Sorted solution. Due to sort, the time complexity is O(nlogn). This solution is done in constant space.
def first_missing_num(the_list): the_list.sort() first_index = 0 next_min = 0 for i, v in enumerate(the_list): if v > 0: first_index = i next_min = v break for num in the_list[first_index:]: if num < next_min: continue elif num ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(A):\n \"\"\"method 2 n**2\n east=[] #0\n west=[] #1\n for i in range(len(A)):\n if A[i] == 0:\n east.append(i)\n else:\n west.append(i)\n\n result = 0\n for e in east:\n count = 0\n for j in range(len(west)):\n if e > west[...
[ "0.63832295", "0.63393384", "0.6324915", "0.62144834", "0.6203475", "0.6194561", "0.6157075", "0.61442906", "0.61211437", "0.6090001", "0.6076195", "0.606942", "0.6067964", "0.6064291", "0.60571194", "0.60361373", "0.60217315", "0.6001496", "0.5980471", "0.59191364", "0.59155...
0.0
-1
Returns the string representing this fold object. The string includes the IDs of entities newly created on Amazon ML.
def __str__(self): return """\n\ Evalaution {fold_ordinal} of {kfolds}: - Evaluation ID: {ev_id} - ML Model ID: {ml_id}""".format( fold_ordinal=self.fold.fold_ordinal, kfolds=self.fold.kfolds, **self.__dict__ )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n \n result = '<' + self._name + ', ' + str(self._id) + ', ' + self._age + ', ' \n for elem in self._direct:\n result += elem.getID() + ', '\n result += self._fitness + ', ' + self._immune + '>'\n\n return result", "def __repr__(self):\n ret...
[ "0.6192051", "0.6177395", "0.61160946", "0.606825", "0.60377395", "0.59295857", "0.5923487", "0.5907789", "0.59013", "0.58689886", "0.5867087", "0.5849414", "0.58350664", "0.5830325", "0.581972", "0.5811471", "0.58044297", "0.5803807", "0.5802214", "0.57935286", "0.5786294", ...
0.68488395
0
Returns a custom color map Various colors were used from matplotlib They were then appended onto eachother through a numpy stack
def get_color_in_rgb_decimal(): # Grabbing custom colormap from matplotlib a = cm.get_cmap('cool', 32) b = cm.get_cmap('spring', 32) c = cm.get_cmap('autumn_r', 64) d = cm.get_cmap('bwr_r', 192) e = cm.get_cmap('Greens', 192) # Adding the colormaps into one stack to have a more comprehensi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_colormap(self):\n\n max_count = max(self.data['rects'], key=lambda r: r['count'])['count']\n ranges_list = [\n [\n int(max_count/x[0])+1,\n int(max_count/x[1])+1\n ] for x in [[6, 3], [3, 2], [2, 1]]\n ]\n ranges_list = [[0...
[ "0.6914215", "0.6912237", "0.69095856", "0.687261", "0.67282987", "0.67074794", "0.66875607", "0.66224325", "0.6582393", "0.65720534", "0.6548382", "0.65403974", "0.6530409", "0.6513784", "0.6508086", "0.64889693", "0.64565307", "0.64473397", "0.63850605", "0.6370945", "0.636...
0.6284208
23
Returns a list of colors but in hexidecimal format Matplotlib colormaps come in rgb decimal and bokeh uses rgb hex rgb_colors np stack of rgb decimals i.e. [7, 102, 230]
def get_color_map_in_hex(rgb_colors): list_of_hex_colors = [] # Iterating through the list of colors given for i in range(len(rgb_colors)): rgb = [] # Iterating through each rgb to get them into a range of 0-255 for j in range(3): num = int(rgb_colors[i][j] * 255) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color_in_rgb_decimal():\n\n # Grabbing custom colormap from matplotlib\n a = cm.get_cmap('cool', 32)\n b = cm.get_cmap('spring', 32)\n c = cm.get_cmap('autumn_r', 64)\n d = cm.get_cmap('bwr_r', 192)\n e = cm.get_cmap('Greens', 192)\n\n # Adding the colormaps into one stack to have a mo...
[ "0.7651158", "0.75405186", "0.74582803", "0.7299335", "0.7259617", "0.7233812", "0.71402436", "0.7082142", "0.70600075", "0.703069", "0.7030668", "0.7025914", "0.7021629", "0.6983346", "0.69517714", "0.6950613", "0.6918061", "0.6912652", "0.6873565", "0.682949", "0.6777423", ...
0.7187493
6
Create a statically typed version of numpy.ndarray.
def create_typed_numpy_ndarray( dims: int, data_type: t.ClassVar, required_shape: t.Optional[t.Sequence[int]] = None): def typed_ndarray(*args, **kwargs): """Create an instance of numpy.ndarray which must conform to declared type constraints.""" shape_loc = (args, 0) if len(args) > 0 else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_array_type(cls, *args):\n if len(args) > 0:\n raise NotImplementedError(\n \"construct_array_type does not support arguments\")\n return XndframesArray", "def ndarray(dtype, shape):\n if isinstance(shape, numbers.Number):\n shape = (shape, )\n if...
[ "0.6853299", "0.6757241", "0.6731255", "0.67273086", "0.6691442", "0.6666705", "0.662499", "0.64728487", "0.63982505", "0.6354238", "0.6346747", "0.63277704", "0.6281439", "0.62492996", "0.62471074", "0.6244819", "0.6167833", "0.6163412", "0.61231416", "0.6085534", "0.6084960...
0.6759376
1
Returns all stored views such that the specified x_axis is eliminated from the full set of stack keys (i.e. each tuple key has one element removed corresponding to eliminated dimension). As the set of reduced keys is a subset of the original data, each reduced key must store multiple x_axis values. The return value is ...
def split_axis(self, x_axis): self._check_key_type = False # Speed optimization x_ndim = self.dim_index(x_axis) keys = self._data.keys() x_vals, dim_values = self._split_keys_by_axis(keys, x_axis) split_data = map_type() for k in dim_values: # The shortened keys ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_keys_by_axis(self, keys, x_axis):\n x_ndim = self.dim_index(x_axis)\n xvals = [k[x_ndim] for k in keys]\n dim_vals = [k[:x_ndim] + k[x_ndim+1:] for k in keys]\n return list(map_type.fromkeys(xvals)), list(map_type.fromkeys(dim_vals))", "def delete_duplicate(x):\n ...
[ "0.58076483", "0.4976145", "0.49680132", "0.46932256", "0.46619776", "0.46436074", "0.46038464", "0.4592955", "0.45891985", "0.45572186", "0.45565677", "0.4550843", "0.45477736", "0.45163074", "0.45141596", "0.4513318", "0.4511826", "0.44874173", "0.4480382", "0.44534326", "0...
0.557723
1
Given a sample as processed by _compute_sample to extract a scalar sample value from the view. Uses __getitem__ by default but can operate on the view's data attribute if this helps optimize performance.
def _get_sample(self, view, sample): return view[sample]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, index):\n return self.data_source.get_sample(index)", "def __getitem__(self, idx):\n return self.samples[idx]", "def __getitem__(self, idx):\n \n sample = get_samples(s_sample = self.s_sample,\n nsamples = 1,\n ...
[ "0.72007066", "0.7176963", "0.69934535", "0.6546742", "0.64840865", "0.6389996", "0.6331182", "0.63029474", "0.63029474", "0.62884", "0.62264556", "0.6217635", "0.620977", "0.61905324", "0.6189328", "0.6178962", "0.61537576", "0.6134296", "0.61125594", "0.6072439", "0.6063795...
0.72621894
0
Returns the cell type given a row and column index. The common basic cell types are 'data' and 'heading'.
def cell_type(self, row, col): if col == 0: return 'heading' else: return 'data'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def celltype(self) -> str:\n\n hcell = self._get_hcell2()\n return hcell[\"celltype\"]", "def get_tile_type(index_i, index_j, tile_arrangement):\n\n # Validate inputs\n if not (0 <= index_i <= len(tile_arrangement) - 1):\n raise IndexError\n if not (0 <= index_j <= len(tile_arrangem...
[ "0.75108814", "0.6798327", "0.65699315", "0.6444966", "0.62518936", "0.6012941", "0.5869636", "0.58634424", "0.57252693", "0.57119733", "0.5694574", "0.5675026", "0.5476125", "0.5434066", "0.53914684", "0.5370319", "0.5341055", "0.5339296", "0.53162324", "0.52679217", "0.5253...
0.8390574
0
Return the primary drive channel of this qubit.
def drive(self) -> DriveChannel: if self._drives: return self._drives[0] else: raise PulseError("No drive channels in q[%d]" % self._index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channel(self):\n return self._channel", "def channel(self):\n return self._channel", "def get_channel_ID(self):\n return self.CHC.get_channel_ID()", "def getChannel(self):\r\n return self.channel", "def get_channel_ID(self):\n return self._CHANNEL_ID", "def channel(...
[ "0.68511194", "0.68511194", "0.6825969", "0.6751451", "0.6636332", "0.6620911", "0.65583163", "0.6528662", "0.6512679", "0.6338842", "0.63119364", "0.63007903", "0.62886", "0.6233149", "0.6220916", "0.6200338", "0.6183054", "0.6183054", "0.6092627", "0.60727507", "0.59845966"...
0.74227375
0
Return the primary control channel of this qubit.
def control(self) -> ControlChannel: if self._controls: return self._controls[0] else: raise PulseError("No control channels in q[%d]" % self._index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channel(self):\n return self._channel", "def channel(self):\n return self._channel", "def conan_channel(self):\n return self._conan_channel", "def get_channel_ID(self):\n return self.CHC.get_channel_ID()", "def getChannel(self):\r\n return self.channel", "def get_ch...
[ "0.7104766", "0.7104766", "0.70863384", "0.6992405", "0.69257545", "0.6761804", "0.67214787", "0.67101014", "0.6686803", "0.66258657", "0.6612172", "0.6552097", "0.6513431", "0.6409422", "0.6386347", "0.6386347", "0.63312703", "0.6311127", "0.62938935", "0.62677217", "0.62082...
0.71801966
0
Return the primary acquire channel of this qubit.
def acquire(self) -> AcquireChannel: if self._acquires: return self._acquires[0] else: raise PulseError("No acquire channels in q[%d]" % self._index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channel(self):\n return self._channel", "def channel(self):\n return self._channel", "def channel(self):\n if not hasattr(self, '_channel'):\n self._channel = self.new_channel()\n return self._channel", "def get_channel(self):\n if self.channel is None or not...
[ "0.6732644", "0.6732644", "0.66534567", "0.66395766", "0.6519147", "0.6508998", "0.6474591", "0.64656246", "0.63887715", "0.6378889", "0.63563883", "0.6347377", "0.6207668", "0.5895047", "0.58800226", "0.58701605", "0.5852683", "0.5844882", "0.58412987", "0.58412987", "0.5834...
0.7407548
0
Returns all nodes in the trap boundary
def get_traps_boundaries(traps, nx, ny, d4): indices = np.arange(0, nx * ny, 1) nbrs = util.get_neighbor_indices(indices, nx, d4) # N.B: If boundary pairs to domain should be removed, include line below # domain_bnd_nodes = get_domain_boundary_indices(nx, ny) trap_boundary = [] for trap in t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_traversable_nodes(self):\n nodes = self.local_environment.get_node_neighborhood(self.location)\n potential_nodes = [node for node in nodes if self.local_environment.get_node_deadline(node) >= 0]\n edges_to_potential_nodes = self.local_environment.graph.edges(self.location)\n\n ...
[ "0.6566023", "0.63286436", "0.62521136", "0.60527104", "0.60496455", "0.60418475", "0.5999734", "0.59952927", "0.59920764", "0.5959211", "0.5908276", "0.58750784", "0.5853478", "0.58519584", "0.58462644", "0.581877", "0.58075625", "0.58053577", "0.5801931", "0.5801698", "0.58...
0.5916786
10
Generates the URL to connect to postgresql DB.
def get_postgres_url(self, username, password, hostname, port, database): args = (username, password, hostname, port, database) return 'postgresql://%s:%s@%s:%d/%s' % args
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pg_url():\n return URL(DEFAULT_PG_URL)", "def create_url(self):\n\n # Format the template strings with the user credentials and host\n # information provided upon instantiation.\n url = self.sql_url_template\n url = url.format(\n username=self.sql_username,\n ...
[ "0.82023567", "0.7726155", "0.7699775", "0.75781476", "0.75715", "0.7321927", "0.7307047", "0.72663754", "0.7003918", "0.6907728", "0.6736735", "0.6704047", "0.6699735", "0.6668213", "0.6602623", "0.6527259", "0.65221894", "0.65182966", "0.650133", "0.6484007", "0.6482006", ...
0.80611575
1
Builds params for conv layers.
def _build_conv_layer_params(self, input_shape): conv_layer_params = [] if self._conv_type == '3d': conv_layer_params.append( dict( filters=self._filters, kernel_size=[self._kernel_size] * 3, strides=self._strides, dilation_rate=self._rates...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_activation_layer_params(self, conv_param):\n return {}", "def _build_norm_layer_params(self, conv_param):\n return dict(\n axis=self._channel_axis,\n momentum=self._norm_momentum,\n epsilon=self._norm_epsilon,\n scale=False,\n gamma_initializer='ones')", "def...
[ "0.7540958", "0.70596856", "0.69487154", "0.66364455", "0.6628025", "0.6528697", "0.639538", "0.6325186", "0.6319469", "0.6319469", "0.63044083", "0.6303174", "0.6243497", "0.6240654", "0.6207343", "0.6177218", "0.61760545", "0.616126", "0.61504924", "0.61326885", "0.6130421"...
0.80924225
0
Builds params for the activation layer after one conv layer.
def _build_activation_layer_params(self, conv_param): return {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_conv_layer_params(self, input_shape):\n conv_layer_params = []\n if self._conv_type == '3d':\n conv_layer_params.append(\n dict(\n filters=self._filters,\n kernel_size=[self._kernel_size] * 3,\n strides=self._strides,\n dilation_rat...
[ "0.7032807", "0.6809348", "0.6700646", "0.6700646", "0.64629215", "0.6432187", "0.6318535", "0.63105124", "0.6274618", "0.62383395", "0.62303376", "0.61833745", "0.61697036", "0.6168755", "0.6160999", "0.6154259", "0.61487687", "0.6131179", "0.6119666", "0.6087118", "0.607528...
0.8675148
0
Parsing a valid protocol should not error.
def parse_valid(self): try: self.test_proto.parse() except avro.errors.ProtocolParseException: # pragma: no coverage self.fail(f"Valid protocol failed to parse: {self.test_proto!s}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_invalid(self):\n with self.assertRaises(\n (avro.errors.ProtocolParseException, avro.errors.SchemaParseException),\n msg=f\"Invalid protocol should not have parsed: {self.test_proto!s}\",\n ):\n self.test_proto.parse()", "def check_error_protocol_exists(se...
[ "0.738953", "0.65939766", "0.60587853", "0.6035425", "0.6027584", "0.5896476", "0.58949107", "0.5876034", "0.5827522", "0.57827055", "0.5740921", "0.56615573", "0.5645641", "0.5643115", "0.56393826", "0.56393826", "0.56180644", "0.559571", "0.55552554", "0.55028695", "0.54993...
0.78461564
0
Gets the resource_types of this ComAdobeCqUiWcmCommonsInternalServletsRteRTEFilterServletFactProperties.
def resource_types(self) -> ConfigNodePropertyArray: return self._resource_types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sling_servlet_resource_types(self) -> ConfigNodePropertyString:\n return self._sling_servlet_resource_types", "def resource_types(self) -> Sequence[str]:\n return pulumi.get(self, \"resource_types\")", "def resource_types_scopes(self) -> Sequence[str]:\n return pulumi.get(self, \"resou...
[ "0.69040596", "0.6532884", "0.59162796", "0.590941", "0.578122", "0.56290317", "0.551623", "0.5473513", "0.5398308", "0.5363955", "0.5307901", "0.5271013", "0.52668446", "0.520812", "0.52050304", "0.5196185", "0.5157257", "0.5060021", "0.5043216", "0.50235546", "0.5022688", ...
0.67449313
1
Return the email address to satisfy FlaskLogin's requirements.
def get_id(self): return self.username
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self,...
[ "0.74636996", "0.74636996", "0.74636996", "0.74636996", "0.744493", "0.744493", "0.744493", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7421634", "0.72910833", "0.7233626", "0.7228416", "0.72064245", "0.7176058", "0.71472573",...
0.0
-1
Return True if the user is authenticated.
def is_authenticated(self): return self.authenticated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_authenticated(self):\n return self.user is not None and self.state == AuthenticationOptions.authenticated", "def is_authenticated(self):\n return bool(get_auth_token())", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_aut...
[ "0.8739372", "0.87086535", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.8613915", "0.8609252", "0.8578436", "0.83723366", "0.83587176", "0.8258534", "0.82273275", "0.8209421", "0.8200795", "0.8174884", "0.81280386", "0.8...
0.8580474
12
False, as anonymous users aren't supported.
def is_anonymous(self): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_anonymous():\n return False", "def is_anonymous(self):\r\n return False", "def is_anonymous(self):\n return False", "def is_anonymous_access_allowed(self):\n return self._is_anonymous_access_allowed", "def is_authenticated(self):\n return False", "def _is_anonymous_u...
[ "0.85624325", "0.83800477", "0.82456774", "0.7815806", "0.7576082", "0.72904116", "0.72619915", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72338396", "0.715833", "0.7106215", "0.70944613", "0.70567185", "0.70209265", "...
0.8360155
12
Create MutatorMath designspace and generate instances. Returns instance UFOs.
def interpolate(ufos, master_dir, out_dir, instance_data, round_geometry=True): from mutatorMath.ufo import build designspace_path, instance_files = build_designspace( ufos, master_dir, out_dir, instance_data) logger.info('Building instances') for path, _ in instance_files: clean_ufo(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_designspace(masters, master_dir, out_dir, instance_data):\n from mutatorMath.ufo.document import DesignSpaceDocumentWriter\n\n base_family = masters[0].info.familyName\n assert all(m.info.familyName == base_family for m in masters), \\\n 'Masters must all have same family'\n\n for font...
[ "0.5946678", "0.5629737", "0.5596343", "0.55934143", "0.53932965", "0.52855706", "0.52755445", "0.5207564", "0.51822406", "0.5151314", "0.5110569", "0.5091252", "0.5090374", "0.5078935", "0.50779325", "0.50678515", "0.50574124", "0.5052025", "0.5049903", "0.5021526", "0.50103...
0.0
-1
Find the "regular" master among the master UFOs. Tries to find the master with the passed 'regularName'. If there is no such master or if regularName is None, tries to find a base style shared between all masters (defaulting to "Regular"), and then tries to find a master with that style name. If there is no master with...
def find_regular_master(masters, regularName=None): assert len(masters) > 0 if regularName is not None: for font in masters: if font.info.styleName == regularName: return font base_style = find_base_style(masters) if not base_style: base_style = 'Regular' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_master(searchname):\n masters = get_masters()\n masternames = []\n master_lookup = {}\n for mn, path in masters:\n master = {}\n master['mastername'] = mn\n master_lookup[mn] = path\n masternames.append(master)\n\n candidates = [mn for mn in masternames if mn['mastername'] == searchname...
[ "0.5947138", "0.5378786", "0.5371785", "0.5040561", "0.48598647", "0.48522377", "0.4850648", "0.4850648", "0.4842068", "0.4695088", "0.4666141", "0.46218765", "0.46019086", "0.45858613", "0.4529471", "0.45066962", "0.45066962", "0.44656652", "0.4447098", "0.4443125", "0.44226...
0.8180839
0
Add instances from Glyphs data to a MutatorMath document writer. Returns a list of pairs, corresponding to the instances which will be output by the document writer. The font data is the Glyphs data for this instance as a dict.
def add_instances_to_writer(writer, family_name, axes, instances, out_dir): ofiles = [] for instance in instances: familyName, postScriptFontName, ufo_path = None, None, None for p in instance.customParameters: param, value = p.name, p.value if param == 'familyName': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_instance_data(instance_data):\n from defcon import Font\n\n instance_ufos = []\n for path, data in instance_data:\n ufo = Font(path)\n set_weight_class(ufo, data)\n set_width_class(ufo, data)\n set_custom_params(ufo, data=data)\n ufo.save()\n instance_uf...
[ "0.6253095", "0.5869637", "0.56717426", "0.5538822", "0.5461394", "0.53745735", "0.5311007", "0.5231743", "0.518397", "0.5169803", "0.5119319", "0.5090096", "0.49923247", "0.49285626", "0.49124566", "0.49068627", "0.48949322", "0.4881143", "0.48333773", "0.4814302", "0.481130...
0.62856245
0
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine1(self, lon1, lat1, lon2, lat2): # 经度1,纬度1,经度2,纬度2 (十进制度数) # 将十进制度数转化为弧度 lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine公式 dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat / 2) ** 2 + cos(lat1) * cos(lat2) * sin(dlon / 2) ** 2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.81450045", "0.7863265", "0.76322985", "0.76064754", "0.75978696", "0.75965863", "0.75944835", "0.75720793", "0.75630087", "0.7555095", "0.7528691", "0.7517629", "0.7492963", "0.7467739", "0.7452678", "0.7434477", "0.73914117", "0.7357736", "0.73484355", "0.73318124", "0.73...
0.0
-1
Gets the file content length.
def _get_file_length(self, file): self[file] = file.stat().st_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filelength(self):\r\n with open(self.fileName, 'rb') as f:\r\n f.seek(0, 2) # move to end of file\r\n length = f.tell() # get current position\r\n return length", "def file_size():\n return os.path.getsize(FILE_NAME)", "def content_length(self):\n if isinsta...
[ "0.8282492", "0.79197776", "0.7911881", "0.79059136", "0.789842", "0.78850174", "0.78640026", "0.7839321", "0.7750872", "0.77086765", "0.7692877", "0.7633051", "0.762624", "0.756486", "0.7558685", "0.7556822", "0.7553134", "0.7523234", "0.752127", "0.7487771", "0.7476616", ...
0.7211972
44
Return a random sample of size elements from the set values with the specified probabilities
def weighted_values(values, probabilities, size): bins = np.add.accumulate(probabilities) return values[np.digitize(random_sample(size), bins)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(probs):\n\n probs = probs / probs.sum()\n return np.random.choice(np.arange(len(probs)), p=probs.flatten())", "def sample(self, probabilities):\n return self.sample_bernoulli(probabilities)", "def sample_from_probabilities(probabilities, topn=ALPHASIZE):\n p = np.squeeze(probabilities)\n...
[ "0.773701", "0.7685272", "0.7265837", "0.7155044", "0.70998913", "0.6874625", "0.6835768", "0.6806354", "0.6799155", "0.67314327", "0.67314327", "0.67265946", "0.6653857", "0.66339856", "0.6592515", "0.6589461", "0.65481406", "0.65452516", "0.65274304", "0.651309", "0.6485539...
0.6991657
5
Return a random sample of n elements from the set choices with the specified probabilities
def draw_random_sample(choices, probabilities, n): values = np.array(range(len(choices))) probs = np.array(probabilities) bins = np.add.accumulate(probs) inds = values[np.digitize(random_sample(n), bins)] samples = [] for i in inds: samples.append(deepcopy(cho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_sampling(elements, n):\r\n import random\r\n return [random.choice(elements) for i in range(n)]", "def sample_from_probabilities(probabilities, topn=ALPHASIZE):\n p = np.squeeze(probabilities)\n p[np.argsort(p)[:-topn]] = 0\n p = p / np.sum(p)\n return np.random.choice(ALPHASIZE, 1, ...
[ "0.7815225", "0.7686356", "0.7629034", "0.7597796", "0.7493688", "0.74829376", "0.74718535", "0.73287404", "0.7248151", "0.72240484", "0.72059196", "0.71689224", "0.7094087", "0.7021664", "0.7014129", "0.70087314", "0.7001349", "0.69519603", "0.694879", "0.68868476", "0.68560...
0.80704635
0
Get all table adapters managed by this manager.
def get_all_adapters(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adapters(self) -> api.Adapters:\n return self._get_model(model=api.Adapters)", "def tables(self):\n return Table.objects.filter(schema__database=self)", "def tables(self) -> list:\n return self.list_tables()", "def get_tables(self):\n r = self.client.query(\"show tables\")\n ...
[ "0.7144976", "0.63805944", "0.6366131", "0.6334956", "0.61558384", "0.61366266", "0.61097383", "0.6061334", "0.6046335", "0.6025247", "0.60183126", "0.5988381", "0.58255583", "0.58097833", "0.5791408", "0.5697206", "0.566709", "0.5639803", "0.5631631", "0.5594752", "0.5592029...
0.75147456
0
Returns the name of Docker Image for the given runtime
def _get_image(runtime): return "{}:{}".format(LambdaContainer._IMAGE_REPO_NAME, runtime)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def container_image_name(registry, component_name, version):\n if version is None:\n image = component_name + ':dev'\n else:\n image = '%s/%s:%s' % (registry, component_name, version)\n\n return image", "def docker_image_name(self):\n raise NotImplementedError", "def get_image_nam...
[ "0.7292465", "0.7066659", "0.67631257", "0.67532206", "0.66224194", "0.6346975", "0.6311156", "0.6206764", "0.61706996", "0.6152815", "0.6152815", "0.6053823", "0.60514385", "0.5993874", "0.59632117", "0.59128463", "0.5891286", "0.58867854", "0.588115", "0.5817416", "0.581536...
0.7887549
0
returns a list of dictionaries containing the bounding vertices of each detection.
def get_bounding_boxes(dets): bounding_boxes = [] for box in dets: bounding_box = {'top_left_x': box.left(), 'top_left_y': box.top(), 'bottom_right_x': box.right(), 'bottom_right_y': box.bottom()} bounding_boxes.append(bound...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_detection_bboxes(detector):\r\n with open('../datasets/AICity_data/train/S03/c010/det/det_' + detector + '.txt') as f:\r\n lines = f.readlines()\r\n bboxes = dict()\r\n num_of_instances = 0\r\n for line in lines:\r\n num_of_instances += 1\r\n line = (lin...
[ "0.63789386", "0.63571227", "0.630838", "0.6306651", "0.63004094", "0.6275479", "0.6265642", "0.62287647", "0.61737233", "0.6108607", "0.6095158", "0.6069438", "0.60014665", "0.59708184", "0.59708184", "0.59708184", "0.59660155", "0.5918936", "0.59058225", "0.58974093", "0.58...
0.6126025
9
Create a colorized logger (see the logging package for more information).
def logger(level, format='%(levelname)s %(message)s'): # Remove previous handlers root = logging.getLogger() if root.handlers: for handler in root.handlers: root.removeHandler(handler) # Create logger logger = logging.getLogger() logger.setLevel(getattr(logging, level.upper...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_logger():\n log = logging.getLogger() # root logger\n log.setLevel(logging.DEBUG)\n format_str = '%(asctime)s - %(levelname)-8s - %(message)s'\n date_format = '%Y-%m-%d %H:%M:%S'\n if os.isatty(2):\n cformat = '%(log_color)s' + format_str\n colors = {'DEBUG': 'reset',\n ...
[ "0.7980128", "0.7620671", "0.73714167", "0.7251248", "0.71601677", "0.70518726", "0.7039009", "0.678459", "0.67101324", "0.66850686", "0.66072077", "0.6534906", "0.65191925", "0.65120524", "0.64844495", "0.6476407", "0.6375882", "0.63487864", "0.63225126", "0.6272908", "0.624...
0.0
-1
Draw a card. If deck is empty, reshuffle then draw.
def draw(self): if len(self.cards) > 0: return self.cards.pop(0) else: self.reshuffle() return self.cards.pop(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_a_card(cards):\n import random\n card_drawn = random.choices(card_deck)\n cards.append(card_drawn[0])\n return", "def testDraw(self):\n self.initDeck([1,2,3,4,5,6,7,8,9,10])\n\n card = self.testDeck.draw()\n assert len(self.testDeck.deck) == 9, \"Test Deck did not reduce...
[ "0.7797033", "0.72376853", "0.71615064", "0.71208", "0.70670146", "0.7052809", "0.7026345", "0.6975769", "0.6924633", "0.6905416", "0.6865292", "0.68431735", "0.68326795", "0.67887026", "0.6755287", "0.6749519", "0.67489296", "0.6748377", "0.6722224", "0.6698382", "0.66967267...
0.7620913
1
Get the region of a variable.
def get_region(self, variable): return self.__region_ids[variable]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def region(self):\n # type: () -> string_types\n return self._region", "def region(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"region\")", "def region(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"region\")", "def region(self) -> pulumi.Output[str]:\n ...
[ "0.7048416", "0.6886011", "0.6886011", "0.6886011", "0.6886011", "0.6886011", "0.6886011", "0.6881206", "0.6868011", "0.6840443", "0.6793463", "0.6793463", "0.6793463", "0.67795265", "0.6764612", "0.6764612", "0.67349416", "0.67349416", "0.67004794", "0.6637484", "0.6621797",...
0.8403941
0
Get the indices being recorded for a given variable.
def get_recorded_indices(self, application_vertex, variable): if variable not in self.__sampling_rates: return [] if self.__indexes[variable] is None: return range(application_vertex.n_atoms) return self.__indexes[variable]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self, variables):\n return [self._variables.index(v) for v in variables]", "def indices_of_var(v):\n name = v.varName\n indices = name[2:].split(',')\n i, j = int(indices[0]), int(indices[1])\n return i, j", "def get_indices(self):\r\n return self._indices", ...
[ "0.67919433", "0.67012197", "0.6627911", "0.65700334", "0.6543022", "0.6460727", "0.63176495", "0.6295017", "0.6262847", "0.624139", "0.62137526", "0.61733127", "0.6143849", "0.61179656", "0.6116175", "0.60949016", "0.60908717", "0.6084915", "0.60471094", "0.59451973", "0.593...
0.80391294
0
Query MySQL database and returns dictionaries for database tables, views, and metadata for database. sql_engine SQL Alchemy Engine object returned from create_engine() with an url passed
def plot_mysql_db(sql_engine: Engine): db_name = sql_engine.url.database # Table level SQL, schema name, table name, row count version_sql = pd.read_sql("""SELECT version();""", sql_engine) table_sql = pd.read_sql( """SELECT table_schema AS schemaname, table_name AS table_name, table_rows AS row...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_database(db, sql_query):\n logging.info(f\"Querying database: {sql_query}\")\n con = connection_for_db(db)\n try:\n cur = con.execute(sql_query)\n dicts = cur.fetchall()\n return dicts\n except Exception as ex:\n db_name = Path(db).name\n raise Exception(\n ...
[ "0.66703725", "0.66524667", "0.6450681", "0.6450681", "0.6450681", "0.6450681", "0.6450681", "0.6437011", "0.61688095", "0.6051184", "0.6050707", "0.6042484", "0.5878469", "0.5789135", "0.5773615", "0.57726806", "0.5692852", "0.5657766", "0.5645207", "0.5645207", "0.5645207",...
0.6186796
8
load yaml file by yaml
def get_ymal_load(yamlfile): with open(yamlfile, 'r', encoding='utf-8') as fr: filedata = fr.read() yamldata = yaml.full_load(filedata) return yamldata
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(content):\n from yaml import load, FullLoader\n return load(content, Loader=FullLoader)", "def load_yaml(file: Text):\n with open(file) as fp:\n return yaml.load(fp, yaml.FullLoader)", "def load_yaml_file(self, path):\n with path.open('r') as handle:\n da...
[ "0.73833084", "0.7376415", "0.7348577", "0.7339498", "0.73154134", "0.7303897", "0.7295758", "0.7291895", "0.72861606", "0.72680455", "0.7260186", "0.7257544", "0.72573614", "0.72525704", "0.72449815", "0.7233891", "0.72299033", "0.71423465", "0.71338224", "0.7119565", "0.710...
0.68008256
44
Return the dot product of the given vectors.
def dot(xs: List[float], ys: List[float]) -> float: return sum(x * y for x, y in zip(xs, ys))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(vector1, vector2):\n return sum(a1 * a2 for a1, a2 in zip(vector1, vector2))", "def dotproduct(vec1, vec2):\n return sum((a*b) for a, b in zip(vec1, vec2))", "def dotproduct(vec1, vec2):\n import operator\n return sum(map(operator.mul, vec1, vec2))", "def dot_vectors(u, v):\n return u[...
[ "0.8313236", "0.8232401", "0.8188335", "0.8187269", "0.8101369", "0.8094099", "0.80788404", "0.8049391", "0.80408514", "0.7985024", "0.79741657", "0.7950691", "0.79349643", "0.7836105", "0.7813932", "0.7803564", "0.7765896", "0.7758458", "0.77359813", "0.7726207", "0.7707828"...
0.7246447
43
Return the derivative of the ReLU function.
def relu_prime(z: float) -> float: return 1.0 if z > 0 else 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grad_ReLU(self):\n y = self.x\n y[y<=0] = 0\n y[y>0] = 1\n return y\n raise NotImplementedError(\"ReLU gradient not implemented\")", "def derivative ( self ):\n return self.__derivative", "def relu_backward(dout, x):\n ###########################################...
[ "0.73731726", "0.70264703", "0.70084655", "0.6982083", "0.6882564", "0.6882564", "0.6792186", "0.67215216", "0.6683834", "0.6657023", "0.66531396", "0.66190934", "0.6600837", "0.65665746", "0.6489817", "0.6422918", "0.6411975", "0.64049834", "0.63960135", "0.6368461", "0.6359...
0.0
-1
Generate random string .
def generate_random_string(prefix="", suffix="", size=20): import random import string left_size = size - len(prefix) - len(suffix) random_str = "" if left_size > 0: random_str = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(left_size)) else: print(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateRandomString():\n return ''.join(b64encode(urandom(32)).decode('utf-8'))", "def generate_random_string():\n return \"\".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16)) # nosec", "def __generate_random_string():\n return uuid4().hex[:6].upper()", "def r...
[ "0.8635078", "0.84493166", "0.83262223", "0.8009337", "0.7946448", "0.79347456", "0.7920454", "0.7918671", "0.7908916", "0.7867601", "0.78303945", "0.7795594", "0.77655584", "0.7758686", "0.7748804", "0.77403396", "0.77213657", "0.7694533", "0.76429945", "0.76317865", "0.7601...
0.0
-1
Creates a matrix of zeroes.
def zeroes(height, width): g = [[0.0 for _ in range(width)] for __ in range(height)] return Matrix(g)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeroes(height, width):\n g = [[0.0 for _ in range(width)] for __ in range(height)]\n return Matrix(g)", "def init_zero_matrix(self,rows,cols):\n\t\ttmpMatrix = []\n\t\tfor i in range(rows):\n\t\t\ttmp = [0 for j in range(cols)]\n\t\t\ttmpMatrix.append(tmp)\n\t\treturn tmpMatrix", "def zeros_m...
[ "0.8253079", "0.8115332", "0.8112645", "0.8058636", "0.7998705", "0.7998705", "0.7991481", "0.7961953", "0.7903478", "0.7851954", "0.7753049", "0.77253217", "0.76235515", "0.75657403", "0.75162", "0.7456788", "0.74495494", "0.73435724", "0.73126847", "0.72773176", "0.7277003"...
0.816446
1
Returns the name of the last email template sent in response to this report
def recent_email_sent(self): recent_contact_activity = self.activity().filter(verb='Contacted complainant:', description__contains='Email sent').first() if recent_contact_activity: try: email = recent_contact_activity.description.split("'")[1] except IndexError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_template_filename(self):\n file_name = ReportMeta.reports[self._report_key]['fileName']\n return '{}.html'.format(file_name)", "def template_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"template_name\")", "def last(self):\n if len(self._messages) ...
[ "0.6687163", "0.6506663", "0.63691175", "0.62114257", "0.6199328", "0.6084213", "0.6072373", "0.596168", "0.5953632", "0.5930418", "0.5905258", "0.59026104", "0.59018266", "0.5897817", "0.5844782", "0.5833879", "0.5812431", "0.5807521", "0.5778262", "0.57621455", "0.5757546",...
0.5786502
18
Return full name if both first and last are present otherwise return whichever value is present If both are missing, return an empty string
def contact_full_name(self): first = self.contact_first_name last = self.contact_last_name if first and last: return f'{first} {last}' return first or last
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_short_name(self):\n last_name = self.last_name\n first_name = self.first_name\n if (not (last_name and not last_name.isspace())):\n \"\"\" If last name is empty or none then return first name\"\"\"\n return first_name\n else:\n return last_name",...
[ "0.80520564", "0.79902065", "0.7899827", "0.78343874", "0.78309804", "0.78187877", "0.77880317", "0.7767749", "0.77047193", "0.76803535", "0.76164716", "0.7598546", "0.75735307", "0.75633854", "0.75633854", "0.75283927", "0.7527492", "0.7507778", "0.7507778", "0.7507778", "0....
0.7989999
2
Called when the user specifies an intent for this skill
def on_intent(intent_request, session): print("on_intent requestId=" + intent_request['requestId'] + ", sessionId=" + session['sessionId'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_intent(intent_request, session):\n\n intent = intent_request['intent']\n intent_name = intent_request['intent']['name']\n\n # Dispatch to your skill's intent handlers\n\n if intent_name not in skillmap:\n intent_name = \"NullSkill\"\n\n if intent_name in skillmap:\n try:\n ...
[ "0.7143966", "0.6956116", "0.6949057", "0.6905333", "0.68928874", "0.67641324", "0.6754843", "0.6722764", "0.6720773", "0.67161995", "0.6699252", "0.6691263", "0.6670276", "0.6645522", "0.6642719", "0.6638686", "0.6607724", "0.6594981", "0.6575682", "0.6570076", "0.65620786",...
0.62312067
42
Return the name of the sensor.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.91896784", "0.9168378", "0.890185", "0.8770976", "0.8511273", "0.8479953", "0.844435", "0.8299758", "0.8186503", "0.8105667", "0.8079737", "0.8066149", "0.8049647", "0.7700968", "0.7612295", "0.7611456", "0.7600605", "0.7600605", "0.7600605", "0.75392073", "0.75166553", ...
0.0
-1
Return the state attributes.
def device_state_attributes(self): if self._data is not None: return { "阳历": self._data.yangli, "阴历": self._data.yinli, "五行": self._data.wuxing, "冲煞": self._data.chongsha, "百忌": self._data.baiji, "吉神": se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_attributes(self):\n return self._attributes", "def state_attributes(self):\n return self._attributes", "def device_state_attributes(self):\r\n return self.attributes", "def device_state_attributes(self):\n return self._state_attrs", "def device_state_attributes(self):\...
[ "0.8953404", "0.8953404", "0.85239846", "0.8366765", "0.8366765", "0.8363429", "0.83362615", "0.8334551", "0.8310377", "0.8292682", "0.8289349", "0.8289349", "0.82871646", "0.82871646", "0.82871646", "0.82871646", "0.82871646", "0.82871646", "0.82871646", "0.82871646", "0.828...
0.760433
62
Strips whitespace from each line.
def process_file(file_name): f_in = open(file_name) return list(map(lambda s: s.strip(), f_in.readlines()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _strip_lines(lines):\n for line in lines:\n stripped = line.strip()\n if stripped:\n yield stripped", "def _remove_whitespace(file_contents):\n whitespace_stripped = [line.strip() for line in file_contents]\n return [line for line in whitespace_stripped if line != \"\"]", "def _st...
[ "0.7235666", "0.71521765", "0.7104999", "0.6973432", "0.6966409", "0.6877217", "0.6854352", "0.6789998", "0.6776998", "0.6763268", "0.67390364", "0.6719698", "0.67022413", "0.670158", "0.664095", "0.65822816", "0.65508693", "0.6534531", "0.64877564", "0.6486867", "0.64836", ...
0.0
-1
Takes in a str date in the format 'yyyymmdd' and returns the date in words, for example 'Aug 2' or 'Jan 10'
def _get_date_in_words(number_date): month_list = ['Jan ', 'Feb ', 'Mar ', 'Apr ', 'May ', 'Jun ', 'Jul ', 'Aug ', 'Sep ', 'Oct ', 'Nov ', 'Dec '] month = int(number_date[5:7]) - 1 day = str(int(number_date[-2:])) return month_list[month] + day
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_date_suffix(date_str: str):\n day = int(date_str[-2:])\n if 4 <= day <= 20 or 24 <= day <= 30:\n suffix = \"th\"\n else:\n suffix = [\"st\", \"nd\", \"rd\"][day % 10 - 1]\n return date_str + suffix", "def reformat_date(date_str: str) -> str:\n if date_str is None or date_s...
[ "0.6902838", "0.6838329", "0.67971", "0.6716399", "0.6698557", "0.6678962", "0.6672809", "0.65687734", "0.6550743", "0.654786", "0.65226984", "0.65160584", "0.65137625", "0.64882773", "0.64492136", "0.6434144", "0.63635725", "0.6329673", "0.63277733", "0.6317267", "0.62927806...
0.8054604
0
Takes in a LIST of songs and the string name of a song one wants to find the index of and returns the index of that song, or None if it can't be found
def _get_song_index_by_name(playlist_list, song_name): for song in playlist_list: if song['title'] == song_name: return playlist_list.index(song) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_playlist_index_by_name(library_list, playlist_name):\n for playlist in library_list:\n if playlist['name'] == playlist_name:\n return library_list.index(playlist)\n return None", "def index_of_ticker(l, name):\n for i in range(len(l)):\n if l[i].stock_ticker == name:\n ...
[ "0.8023226", "0.7318137", "0.68928236", "0.67137575", "0.65846723", "0.6549115", "0.6534394", "0.65242016", "0.64101356", "0.63773674", "0.6317363", "0.62065566", "0.6199832", "0.61938995", "0.6188421", "0.616891", "0.6154112", "0.614928", "0.6126339", "0.6108104", "0.6097851...
0.89069784
0
Gets the price for a given product code
def _get_product_price(self, product_code: str) -> float: return float(self._product_prices[product_code])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _product_price_by_id(self, product_id):\n product_spec = self._product_spec_by_id(product_id)\n return product_spec['price']", "def get_product(self, code):\n candidates = list(filter(lambda c: c.code == code, self.list_products()))\n if not len(candidates):\n return No...
[ "0.73255837", "0.7197444", "0.70480007", "0.7038931", "0.69563806", "0.69498146", "0.693089", "0.6871867", "0.68392944", "0.65853125", "0.6539731", "0.64562297", "0.64177996", "0.6414671", "0.6378633", "0.6353405", "0.6353405", "0.6353405", "0.6343938", "0.63435274", "0.62981...
0.86591196
0
returns a matrix Array equivalent with $\vec{A} \times$ operation, where $\vec{A}$ is a vector while $\times$ is cross product.
def m_A_x(A): return _tcontract(_tprod(t_LC, A), (1,3))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matTimesVec(M, x):\n return [dot(m, x) for m in M]", "def vecTimesMat(x, M):\n return [dot(m, x) for m in transpose(M)]", "def matrix_mult_vec(matrix_a, x):\n m = len(matrix_a)\n b = [0 for i in xrange(m)]\n for i in xrange(m):\n b[i] = dot_product(matrix_a[i], x)\n return b", "d...
[ "0.7226122", "0.7087291", "0.68687755", "0.6831622", "0.6803193", "0.6775398", "0.6652009", "0.6556745", "0.6517005", "0.6392051", "0.6363288", "0.61309844", "0.60764354", "0.6011185", "0.600607", "0.5956556", "0.59064263", "0.5898898", "0.5875196", "0.58751714", "0.58566415"...
0.5356527
94
Returns invalid credit card data.
def mock_invalid_credit_card_data(): return { "CreditCardNumber": "1234", "CardHolder": "Test Name", "ExpirationDate": (dt.datetime.now() + dt.timedelta(minutes=1)).isoformat(), "SecurityCode": "1234", "Amount": 100 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def card_validating(card_info: dict) -> dict:\n card = pycard.Card(number=card_info['number'],\n month=int(card_info['month']),\n year=int(card_info['year']),\n cvc=int(card_info['cvc']))\n\n if card.is_expired:\n return_status = False\...
[ "0.6365661", "0.6363766", "0.6199764", "0.613843", "0.6055441", "0.6007779", "0.59119195", "0.58383113", "0.58207685", "0.5819795", "0.5792937", "0.57428914", "0.57291204", "0.5724999", "0.57090676", "0.5706906", "0.56876284", "0.56651926", "0.56142753", "0.55668867", "0.5506...
0.7187259
0
Returns normal vector for 3 points, which is the normalized cross
def normal_vector_3p(a: Vector, b: Vector, c: Vector) -> Vector: return (b - a).cross(c - a).normalize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal(self) -> Vec:\n # The three points are in clockwise order, so compute differences\n # in the clockwise direction, then cross to get the normal.\n point_1 = self.planes[1] - self.planes[0]\n point_2 = self.planes[2] - self.planes[1]\n\n return Vec.cross(point_1, point_2...
[ "0.7936424", "0.7678679", "0.75385064", "0.74657667", "0.74049574", "0.7319684", "0.7310687", "0.7298918", "0.7248854", "0.71217287", "0.7059065", "0.7030062", "0.7029911", "0.69158304", "0.6876856", "0.6852634", "0.6836792", "0.67890733", "0.6764423", "0.6756211", "0.6735223...
0.83267546
0
Normal vector of the plane.
def normal(self) -> Vector: return self._normal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Normal(self):\n return Vector(self.normal)", "def normal(self) -> Vec:\n # The three points are in clockwise order, so compute differences\n # in the clockwise direction, then cross to get the normal.\n point_1 = self.planes[1] - self.planes[0]\n point_2 = self.planes[2] - ...
[ "0.84549886", "0.8369483", "0.82544786", "0.80879366", "0.80483675", "0.800671", "0.7652479", "0.759199", "0.7589575", "0.7576302", "0.75486827", "0.7500217", "0.7477587", "0.74443895", "0.7422747", "0.73313284", "0.7320161", "0.729996", "0.7214393", "0.7210132", "0.7201701",...
0.8405414
1
Returns a new plane from 3 points in space.
def from_3p(cls, a: Vector, b: Vector, c: Vector) -> 'Plane': n = (b - a).cross(c - a).normalize() return Plane(n, n.dot(a))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_3d_points_to_plane(points, p1, p2 ,p3, numpoints):\n p1 = np.asarray(p1)\n p2 = np.asarray(p2)\n p3 = np.asarray(p3)\n\n # get vectors in plane\n v1 = p3 - p1\n v2 = p2 - p1\n\n # compute cross product\n cp = np.cross(v1, v2)\n a, b, c = cp # normal to plane is ax + by + cz\n...
[ "0.7478752", "0.72062516", "0.71426517", "0.7111818", "0.7089783", "0.6989774", "0.6891087", "0.6770124", "0.67205334", "0.6662763", "0.6641919", "0.65634", "0.6410307", "0.6405445", "0.6404546", "0.63392174", "0.63149893", "0.6303995", "0.62956655", "0.6294775", "0.627926", ...
0.7936257
0
Returns signed distance of vertex `v` to plane, if distance is > 0, `v` is in 'front' of plane, in direction of the normal vector, if distance is < 0, `v` is at the 'back' of the plane, in the opposite direction of the normal vector.
def signed_distance_to(self, v: Vector) -> float: return self._normal.dot(v) - self._distance_from_origin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_to(self, v: Vector) -> float:\n return math.fabs(self.signed_distance_to(v))", "def distance(v, w):\n return magnitude_of_vector(vector_subtract(v, w))", "def distance(v: Vector, w: Vector) -> float:\n return magnitude(subtract(v, w))", "def distance(v, w):\n\treturn magnitude(vecto...
[ "0.6975906", "0.64359623", "0.6423365", "0.6274992", "0.6220888", "0.619807", "0.5988904", "0.59763736", "0.5936499", "0.5924778", "0.5895827", "0.58744717", "0.5865434", "0.5863154", "0.585176", "0.57962036", "0.5793333", "0.5724069", "0.57111263", "0.5682674", "0.5678437", ...
0.7700597
0
Returns absolute (unsigned) distance of vertex `v` to plane.
def distance_to(self, v: Vector) -> float: return math.fabs(self.signed_distance_to(v))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signed_distance_to(self, v: Vector) -> float:\n return self._normal.dot(v) - self._distance_from_origin", "def distance(v: Vector, w: Vector) -> float:\n return magnitude(subtract(v, w))", "def distance(v, w):\n return magnitude_of_vector(vector_subtract(v, w))", "def __dist(u, v):\n retu...
[ "0.73889744", "0.7101507", "0.70826006", "0.70243454", "0.6982769", "0.6981788", "0.68746614", "0.67277175", "0.6710449", "0.65335035", "0.6461716", "0.63674486", "0.63588667", "0.6221755", "0.6214192", "0.62122387", "0.6195964", "0.6177506", "0.61736345", "0.6150884", "0.614...
0.74316454
0
Returns ``True`` if plane `p` is coplanar, normal vectors in same or opposite direction.
def is_coplanar_plane(self, p: 'Plane', abs_tol=1e-9) -> bool: n_is_close = self._normal.isclose return n_is_close(p._normal, abs_tol) or n_is_close(-p._normal, abs_tol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isInPlane(self, p) -> bool:\n # Testing for zero is done with math.isclose, to avoid rounding/floating point errors.\n # Since we are testing near zero, abs_tol is set to 1e-09\n return math.isclose(\n math.fabs(\n dot(\n self.normal(),\n ...
[ "0.72366977", "0.6469054", "0.64421874", "0.63607", "0.63037115", "0.6209641", "0.6011635", "0.60074943", "0.59806484", "0.59753937", "0.59728974", "0.59502244", "0.5945286", "0.5868938", "0.58464175", "0.5825594", "0.5795389", "0.5764036", "0.571636", "0.5714981", "0.5700769...
0.7806708
0
Generate a JWT token for this account
def generate_auth_token(self): token = Serializer( app.config['API_SECRET_KEY'], expires_in=app.config['JWT_TOKEN_EXPIRATION'] ) return token.dumps({'id': self.id})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_jwt_token(self):\n import jwt\n from datetime import datetime, timedelta\n from django.conf import settings\n\n dt = datetime.now() + timedelta(days=60)\n\n token = jwt.encode({\n 'id': self.pk,\n 'username': self.username,\n 'exp': ...
[ "0.8399016", "0.83032477", "0.8174132", "0.81707025", "0.80003715", "0.7980891", "0.79271495", "0.7915714", "0.7915714", "0.7915714", "0.7913415", "0.7896149", "0.7857025", "0.7827478", "0.7657335", "0.765661", "0.74148273", "0.7317915", "0.7244114", "0.721568", "0.71755916",...
0.7703992
14
Get absolute path to resource, works for dev and for PyInstaller
def resource_path(relative_path): base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__))) return os.path.join(base_path, relative_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep", "def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa...
[ "0.83695436", "0.8280479", "0.82485795", "0.8139178", "0.8114118", "0.80985415", "0.80940944", "0.80797124", "0.80677074", "0.80673695", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.80569947", "0.80545217", "0.80448323", "0.804...
0.78359824
47
Return a human readable representation of the model instance.
def __str__(self): return "{}".format(self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"", "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",...
[ "0.79865694", "0.778825", "0.778825", "0.7578485", "0.7573961", "0.7508439", "0.73869205", "0.725669", "0.725669", "0.72521317", "0.7250976", "0.72447103", "0.72447103", "0.7238946", "0.72377145", "0.72135806", "0.7196659", "0.71778005", "0.7177506", "0.7173099", "0.7172897",...
0.0
-1
This function assumes that both left and right child of this position are minheaps already and tries to make minheap which is rooted at this position.
def heapify_top_down(self, position): start_index = position while True: left_child = 2 * start_index + 1 right_child = 2 * start_index + 2 if left_child < len(self.heap): if right_child < len(self.heap): # If right child is present...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_heapify(self, pos): \n \n # If the node is a non-leaf node and greater \n # than any of its child \n if not self.is_leaf(pos): \n if (self.Heap[pos] > self.Heap[self.left_child(pos)] or \n self.Heap[pos] > self.Heap[self.right_child(pos)]): \n \n ...
[ "0.7957725", "0.7559128", "0.72892916", "0.7180069", "0.7170857", "0.7047623", "0.7042811", "0.6852647", "0.679238", "0.6763201", "0.6542049", "0.6385732", "0.6356763", "0.6349854", "0.63028395", "0.6301241", "0.62569046", "0.6243081", "0.6201946", "0.61959237", "0.618127", ...
0.659204
10
This function inserts the elements to the heap by calling heapify function.
def build_heap(self): n = int((len(self.array) / 2) - 1) while n >= 0: self.heapify_top_down(n) n -= 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heapify(x):\n pass", "def insert_elements_to_heap(heap, elements):\n for element in elements:\n heap.insert(element)", "def _heapify(self):\n for _ in range(len(self.elements)):\n for i in range(len(self.elements)-1, 0, -1):\n parentPosition = (i-1)/2 # default...
[ "0.8264763", "0.79707", "0.7748791", "0.7546222", "0.7538917", "0.7501213", "0.7501213", "0.7424299", "0.73240536", "0.72938967", "0.7288742", "0.7198231", "0.7191982", "0.7144217", "0.7124375", "0.7103184", "0.708292", "0.7072638", "0.7053073", "0.69598734", "0.69582814", ...
0.65819013
51
Simplifies UNIXlike directory path and returns it.
def simplifyPath(self, path): pwd = [] # stack, present working directory path = path.split("/") for curr in path: if not curr or curr == ".": # skip current dir continue elif curr == "..": if pwd: # if we're not in the root directory, g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _path(unix_path):\n return unix_path.replace(\"/\", os.path.sep)", "def get_directory(path):\n return mangle_path(path).rsplit('/',1)[0]", "def normalized_file_path(path: str) -> str:\n # Convert Unix path to Windows path for WSL\n if PLATFORM == \"WSL\":\n return path.replace(\"/\", \"\...
[ "0.73632354", "0.7153417", "0.7127065", "0.70558596", "0.6971976", "0.688627", "0.6849376", "0.68010765", "0.6789206", "0.67723954", "0.6679829", "0.666443", "0.6634625", "0.65842676", "0.65731055", "0.65505224", "0.65505224", "0.65347385", "0.6524168", "0.6524002", "0.651465...
0.6323394
37
Returns a list of words without punctuations and all lower case.
def words(self): punctuation = '''!()-[]{};:'"\,<>./?@#$%^&*_~''' lst = [] for lines in self.lines: words = lines.split(' ') for word in words: no_punc = '' for c in word: if c not in punctuation: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_text(text):\n words = word_tokenize(text)\n return [word.lower() for word in words if word not in string.punctuation]", "def removePunctuation(self, words):\n\t\tnewWords = []\n\t\tfor word in words:\n\t\t\tnewWord = re.sub(r'[^\\w\\s]', '', word)\n\t\t\tif newWord != '':\n\t\t\t\tnewWo...
[ "0.7771453", "0.7596024", "0.75448704", "0.75262934", "0.7505561", "0.74758923", "0.74758923", "0.74758923", "0.74758923", "0.74758923", "0.74758923", "0.7466228", "0.74657434", "0.7454427", "0.7426689", "0.73762405", "0.7376161", "0.7362098", "0.73203015", "0.7268601", "0.72...
0.81463915
0
Returns a list of the unique words in the text, sorted in alphabetical order. Capitalization and punctuation should be ignored, so 'Cat!' is the same word as 'cat'. The returned words should be all lowercase.
def vocabulary(self): lst = [] for key in self.frequencies().keys(): lst.append(key) return sorted(lst) #for lines in self.lines: # line = lines.strip(os.linesep) # wordslst = line.split() # for word in wordslst: # if word not i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def words(self):\n # BEGIN Question 2\n x= str(self.text).lower()\n # m = str(x).translate(string.punctuation)\n y= x.split()\n\n y = set([''.join(c for c in s if c not in string.punctuation) for s in y])\n y = [s for s in y if s]\n while(len(y) != 0):\n ...
[ "0.7472964", "0.74377304", "0.7381599", "0.72567207", "0.7247332", "0.72134864", "0.7161358", "0.7045169", "0.7015658", "0.69902164", "0.69706136", "0.6942604", "0.69383055", "0.69335747", "0.693289", "0.6922467", "0.6919469", "0.68998414", "0.68959814", "0.6892965", "0.68711...
0.64997256
47
Writes the details of the textual analysis to the csvfile. Refer to sample.csv for an example of how this should look. Note that for most common word, just write the word and not its frequency
def write_analysis_details(self, csvfile): #filepath, total words, line count, most common word f = open(csvfile, 'w') most_common = self.most_common() f.write('filepath,total words,line count,most common word\n') f.write(f'{self.filepath},{self.word_count()},{self.sentence_count...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_to_txt():\n print('csv to text')\n input_files = sys.argv[1]\n i = 0\n for filename in os.listdir(input_files):\n print(i, filename[11:-4])\n output_txt_file = ''\n current_csv_df = pd.read_csv(sys.argv[1] + filename)\n for index, row in current_csv_df.iterrows():\n ...
[ "0.62759537", "0.62624913", "0.62408286", "0.6060307", "0.60197896", "0.5969074", "0.59000343", "0.5895921", "0.5879614", "0.5774739", "0.57590204", "0.5732889", "0.57172024", "0.571038", "0.5679879", "0.56694376", "0.5664706", "0.5649812", "0.5621967", "0.55777115", "0.55661...
0.8018262
0
Helper function. Decreases index from cur while condition is satisfied.
def step_back_while(cur_index, condition): while cur_index >= 0 and condition(cur_index): cur_index -= 1 return cur_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def down(self):\n if self.bottom == self.current:\n return\n else:\n self.current -= 1", "def _shift_down(self, idx):\n\n child = (idx + 1) * 2 - 1\n while child < self.size and (\n self.value(idx) < self.value(child) or\n self.value...
[ "0.5842707", "0.5812001", "0.56641114", "0.5657174", "0.5593547", "0.55890137", "0.55678105", "0.5514007", "0.55082506", "0.5497985", "0.54959667", "0.5494643", "0.5491458", "0.54640454", "0.54434985", "0.54362077", "0.54251957", "0.5417456", "0.5408234", "0.54062444", "0.540...
0.7449011
0
penalties should be composable, and this is done by adding all penalties on a single term, NOT multiplying them. so a term with a derivative penalty and a None penalty should be equvalent to a term with a derivative penalty.
def test_compose_penalties(self): base_term = SplineTerm(0) term = SplineTerm(feature=0, penalties=['auto', 'none']) # penalties should be equivalent assert (term.build_penalties() == base_term.build_penalties()).A.all() # multitple penalties should be additive, not multiplicat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def penalty(self):\n return 0", "def compute_penalty(self, spec_nums: Union[float, Iterable[float]], spec_kwrd: str) \\\n -> Union[float, List[float]]:\n raise NotImplementedError", "def gPenalty(d):\n return -1/(d+0.2)**2 if d > -0.1 else 0", "def test_penalty_compute(self):\n ...
[ "0.6124967", "0.60591024", "0.6024827", "0.60053545", "0.59405464", "0.5905281", "0.58888704", "0.5887348", "0.5849331", "0.5767339", "0.5736689", "0.57307726", "0.5710513", "0.5676616", "0.56699586", "0.5666378", "0.5659067", "0.55894995", "0.5569669", "0.5556137", "0.554533...
0.72096515
0
Returns LiDAR sensor pose array.
def poses(self) -> List[Dict[str, Dict[str, float]]]: return self._poses
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self):\n stable_poses = []\n f = open(self.filepath_, \"r\")\n data = [line.split() for line in f]\n for i in range(len(data)):\n if len(data[i]) > 0 and data[i][0] == \"p\":\n p = float(data[i][1])\n r = [[data[i+1][1], data[i+1][2], da...
[ "0.6767274", "0.66189986", "0.6467329", "0.64326495", "0.63133603", "0.6296538", "0.6291442", "0.6223234", "0.61910456", "0.6091942", "0.60291886", "0.59986985", "0.5971867", "0.59413034", "0.5926063", "0.58328253", "0.5798243", "0.5761088", "0.57437414", "0.5722628", "0.5720...
0.0
-1
Returns Camera sensor pose array.
def poses(self) -> List[Dict[str, Dict[str, float]]]: return self._poses
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPose(self):\n\t\treturn self.__subs['pose'].getData()", "def pose_list_to_array(poses):\n tmp_list = list()\n for p in poses:\n tmp_list.append([p.pose.position.x,\n p.pose.position.y,\n p.pose.position.z,\n\n p.pose.orie...
[ "0.6874182", "0.68287724", "0.67298615", "0.66220224", "0.6613094", "0.6546824", "0.6520148", "0.64356744", "0.63362044", "0.63153946", "0.6296449", "0.62667173", "0.62315774", "0.6209867", "0.618141", "0.6143504", "0.6108632", "0.6094601", "0.60554063", "0.6050244", "0.60446...
0.0
-1
Look up if we have already persisted an event for the transaction ID, returning the event ID if so.
async def get_event_id_from_transaction_id_and_device_id( self, room_id: str, user_id: str, device_id: str, txn_id: str ) -> Optional[str]: return await self.db_pool.simple_select_one_onecol( table="event_txn_id_device_id", keyvalues={ "room_id": room_id, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_id(self):\n return self._event_id", "def get_one(self, message_id):\r\n event_filter = storage.EventFilter(message_id=message_id)\r\n events = [event for event\r\n in pecan.request.storage_conn.get_events(event_filter)]\r\n if not events:\r\n rais...
[ "0.6040086", "0.5922069", "0.587264", "0.57490796", "0.5746647", "0.57317364", "0.56828314", "0.5633895", "0.5626108", "0.5614367", "0.55635506", "0.542527", "0.53866976", "0.5357123", "0.53535", "0.5345264", "0.53417975", "0.53380275", "0.5325525", "0.5309159", "0.5287632", ...
0.52430177
24
Check if the given event is next to a backward gap of missing events. A(False)>B(False)>C(True)>
async def is_event_next_to_backward_gap(self, event: EventBase) -> bool: assert not event.internal_metadata.is_outlier(), ( "is_event_next_to_backward_gap(...) can't be used with `outlier` events. " "This function relies on `event_backward_extremities` which won't be filled in for `outl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def is_event_next_to_forward_gap(self, event: EventBase) -> bool:\n\n assert not event.internal_metadata.is_outlier(), (\n \"is_event_next_to_forward_gap(...) can't be used with `outlier` events. \"\n \"This function relies on `event_edges` and `event_forward_extremities` which w...
[ "0.7377763", "0.6399617", "0.60602355", "0.5884161", "0.5862222", "0.5820409", "0.5781847", "0.576641", "0.5747997", "0.57152504", "0.5703478", "0.5697144", "0.5691525", "0.56846976", "0.5665091", "0.565693", "0.56518334", "0.5651525", "0.5646143", "0.5585314", "0.55782807", ...
0.7858854
0
Update a post if the current user is the author.
def update(id): post = get_post(id) if request.method == 'POST': title = request.form['title'] body = request.form['body'] error = None if not title: error = 'Title is required.' if error is not None: flash(error) else: db = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, request, pk=None):\n user = RareUser.objects.get(user=request.auth.user)\n\n # Do mostly the same thing as POST, but instead of\n # creating a new instance of Post, get the Post record\n # from the database whose primary key is `pk`\n post = Post.objects.get(pk=p...
[ "0.6402288", "0.63080543", "0.6191634", "0.6187933", "0.6152581", "0.61517787", "0.6136023", "0.61076", "0.60637295", "0.5993216", "0.59245545", "0.591297", "0.59033036", "0.5816044", "0.57806003", "0.5779193", "0.57767224", "0.57723206", "0.57613695", "0.5746237", "0.5740192...
0.57241786
23
Initialize the Resnet block A resnet block is a conv block with skip connections We construct a conv block with build_conv_block function, and implement skip connections in function.
def __init__(self, dim, padding_type, norm_layer, use_dropout, use_bias): super(ResnetBlock, self).__init__() self.conv_block = self.build_conv_block(dim, padding_type, norm_layer, use_dropout, use_bias)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, dim, padding_type, norm_layer, use_dropout, use_bias):\n super(ResnetBlock, self).__init__()\n self.conv_block = self.build_conv_block(dim, padding_type, norm_layer, use_dropout, use_bias)", "def __init__(self, dim, padding_type, norm_layer, use_dropout, use_bias):\n super...
[ "0.76025397", "0.76025397", "0.746708", "0.6530159", "0.63259524", "0.6279012", "0.6274945", "0.61703575", "0.6157694", "0.6148756", "0.6147246", "0.6127337", "0.6041138", "0.60288996", "0.59828717", "0.59716845", "0.59694374", "0.5932264", "0.5929742", "0.59222394", "0.59222...
0.7650802
0