query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
returns the level of the document. returns None if the document does not have the level field
def get_level(self): try: return self.root_node()['document_level'] except KeyError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_level(self, level):\n return", "def getLevel(self):\n return self._level", "def getLevel(self):\n return self.level", "def level(self) -> pulumi.Input[Union[str, 'Level']]:\n return pulumi.get(self, \"level\")", "def level(self):\n return self._level", "def level(se...
[ "0.7229525", "0.7134172", "0.70112604", "0.69806916", "0.69539994", "0.69539994", "0.69539994", "0.69539994", "0.69499403", "0.6930254", "0.69154507", "0.69154507", "0.6851163", "0.6846561", "0.679262", "0.66974926", "0.6696177", "0.668854", "0.666606", "0.6616842", "0.661064...
0.8458222
0
adds to 'ref' to the list of 'level' from node with 'node_key'. if level is None, 'ref' is added to 'unknown' field
def append_references_for_level(self, node_key, level, ref, ref_key='references'): if level: level_key = "level_{}".format(level) self.node(node_key)[ref_key][level_key].append(ref) else: # unknown level references self.node(node_key)[ref_key]['unknown'].a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_level_node(self, level, node):\n self.levels[level].append(node)", "def __assign_level(vertex: \"Vertex\", level, already_assigned: \"List[Vertex]\"):\n vertex.level = level\n already_assigned.append(vertex)\n for neighbour in vertex.neighbours:\n if neighbour not in already_assign...
[ "0.6152145", "0.5897589", "0.57109284", "0.54680127", "0.5446417", "0.5319803", "0.5271993", "0.52598345", "0.5164526", "0.51364", "0.5130477", "0.50943375", "0.5052482", "0.50303316", "0.49876687", "0.49844113", "0.49324152", "0.4926889", "0.49159244", "0.4914638", "0.489826...
0.7866178
0
simple verification report that gives that count of occurrences of each level of the given structure e.g
def flat_report(self, consider_leafs=False): report = {} for node, data in self.traverse(): if data['pad'] or (data['level'] == self.max_depth and not consider_leafs): continue elif int(data['level']) not in report: report[int(data['level'])] = 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_nests(nest_spec):\n\n def count_each_nest(spec, count):\n if isinstance(spec, dict):\n return (\n count\n + 1\n + sum([count_each_nest(alt, count) for alt in spec[\"alternatives\"]])\n )\n else:\n assert isinst...
[ "0.63388646", "0.6208464", "0.6098036", "0.6058811", "0.60332495", "0.58624095", "0.5831375", "0.5815117", "0.5795828", "0.5789024", "0.5732004", "0.57288164", "0.5709203", "0.57035613", "0.5699831", "0.56729585", "0.5666994", "0.565461", "0.5646905", "0.56246024", "0.5615494...
0.5368079
53
merge accumulators elements that are of the same type
def _merge_accumulator(acc, new_acc): if not acc: return new_acc if not new_acc: new_acc.append(acc[0]) return _merge_accumulator(acc[1:], new_acc) elif acc[0][0]['level'] == new_acc[-1][-1]['level']: new_acc[-1] += acc[0] return _merge_accumulator(acc[1:], new_acc)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_accumulators(self, accumulators):\n raise NotImplementedError", "def merge(self):\n elems = []\n for x in self.elems:\n if isinstance(x, self.__class__):\n elems.extend(x.merge().elems)\n else:\n elems.append(x)\n return _cocon...
[ "0.7500667", "0.62064946", "0.59812695", "0.59615946", "0.5770991", "0.56387854", "0.5545372", "0.5374116", "0.53673095", "0.5349064", "0.5308214", "0.52599114", "0.52499443", "0.5232555", "0.52270174", "0.517737", "0.5115886", "0.5098969", "0.5079163", "0.50664353", "0.50288...
0.57157266
5
Represent a node identifier (key) by a numeric value to be used in the representation Useful to sorting operations
def key_to_numeric(x): reg = re.compile(r'\[(\d+\_?(\d+)?)[a-z]?\]') inspect = reg.search(x).groups(0)[0] if '_' in inspect: left, right = inspect.split('_') return int(left), int(right) else: return int(inspect), 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getIdHash(self, val):\n return PublicTransit.TANA_NODE_NUMBER_OFFSET + int((\"%1.0f\" % val)[7:])", "def _(self, node: Number):\n if node.number not in self.val_map:\n self.val_map.append(node.number)\n\n idx = self.val_map.index(node.number)\n\n return f\"Val{idx}\""...
[ "0.65811443", "0.6523094", "0.62325406", "0.5900623", "0.5836005", "0.57593066", "0.57571405", "0.5746606", "0.5740979", "0.57244986", "0.56824046", "0.567275", "0.5643796", "0.56058645", "0.56052595", "0.5534903", "0.55122375", "0.54919827", "0.54852366", "0.5484862", "0.545...
0.0
-1
Exports the modified text lines from pretty directories
def main(): arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--ENCODING', dest='encoding', required=False, action='store_true') # If export.py is called from ENCODING.py args = arg_parser.parse_args() pretty_fps = [] for (root, subdirs, files) in os.walk(constants.PRETTY_PATH_CURREN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_files_into_pretty_text(text_files):\n list_of_all_lines = []\n for item in text_files:\n for line in item:\n line = line.rstrip()\n if line not in list_of_all_lines:\n list_of_all_lines.append(line)\n\n for item in list_of_all_lines:\n\n words = ...
[ "0.57957274", "0.5688347", "0.5577733", "0.54699945", "0.5466664", "0.54244006", "0.54067063", "0.538683", "0.53839576", "0.5328709", "0.5258833", "0.52431655", "0.5203066", "0.51793617", "0.5175246", "0.5146486", "0.51360023", "0.51338744", "0.5129519", "0.5125243", "0.50799...
0.5075692
21
Descarrega la web guardada a la variable self.url
def __download_web(self): page = requests.get(self.url) if page.status_code == 200: return BeautifulSoup(page.content, "html.parser")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_url(self): \n self.url = self.geturl()", "def url(self):\n ...", "def Url(self) -> str:", "def set_url(self, url):\n self.url = url", "def _make_url(self):\n ...", "def getUrl(self): #$NON-NLS-1$\r", "def getUrl(self): #$NON-NLS-1$\r", "def url(self):\n ...
[ "0.7776016", "0.7581979", "0.7366138", "0.69642234", "0.688765", "0.68120074", "0.68120074", "0.67507243", "0.6749691", "0.67255527", "0.671884", "0.6711359", "0.6674001", "0.65647143", "0.64835906", "0.64819074", "0.64819074", "0.6449262", "0.6429355", "0.64123356", "0.63940...
0.0
-1
Reads data from buffer or fileas pandas.DataFrame. Gets the same arguments like pandas.read_csv and pandas.read_xlsx.Uses proper function depending on file extension.
def read_data(file_name: str, buffer=None, **kwargs) -> pd.DataFrame: file_name = file_name.strip() extension = file_name.split('.')[-1].lower() if extension in _read_methods.keys(): if not buffer: if os.path.exists(os.path.dirname(file_name)): data = _read_methods[ext...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read(**kwargs) -> DataFrame:\n Engine.subscribe(_update_engine)\n\n try:\n pd_obj = FactoryDispatcher.read_csv_glob(**kwargs)\n except AttributeError:\n raise AttributeError(\"read_csv_glob() is only implemented for pandas on Ray.\")\n\n # This happens when `read_csv` returns a TextF...
[ "0.68633926", "0.68517303", "0.67032105", "0.6589057", "0.6454073", "0.6440621", "0.6402511", "0.6398542", "0.6308621", "0.6294428", "0.62939626", "0.6235024", "0.62328905", "0.6164969", "0.61351067", "0.6109234", "0.6075392", "0.6034535", "0.60162234", "0.60016567", "0.59829...
0.8271098
0
Extracts numeric data from data frame.
def generate(data: pd.DataFrame) -> np.ndarray: # TODO tests return data.apply(pd.to_numeric, errors='coerce')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numerical(df):\r\n numerical_var=df.select_dtypes(include =['float64','int64']).columns.tolist()\r\n return numerical_var", "def to_numeric_and_downcast_data(df: pd.DataFrame):\n fcols = df.select_dtypes('float').columns\n \n icols = df.select_dtypes('integer').columns\n\n df[fcols] = df[fc...
[ "0.68702966", "0.6694755", "0.66763884", "0.64964706", "0.64431477", "0.6339765", "0.6318618", "0.62212825", "0.6188818", "0.6180477", "0.6180477", "0.61722237", "0.6133824", "0.6118984", "0.61136556", "0.61007285", "0.60193545", "0.6014912", "0.59691006", "0.5872021", "0.575...
0.69502586
0
Adds a data object to the model. Returns ``True`` if the data is added, ``False`` if it already exists.
def add(self, data, check_exists=True): # pragma: no cover raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, data):\n if self._filter(data):\n id = self.db._generate_id(data)\n \n if not id == None:\n if self.db._store:\n self.db.append(id, str(data))\n print id, \"stored to\", self.db._generate_path(id)\n ...
[ "0.6855881", "0.64367086", "0.64271164", "0.6368598", "0.63621277", "0.632321", "0.6243308", "0.622728", "0.61799115", "0.6144527", "0.6129624", "0.61270493", "0.60899985", "0.60830754", "0.6047187", "0.6044599", "0.6043049", "0.6003577", "0.5997839", "0.5997839", "0.59928507...
0.7521084
0
Traverse the results and build a sunburst JSON graph in the direction indicated by source/target i.e. to build all outgoing edges, specify 's' and 'o', respectively otherwise, specify 'o' and 's'.
def traverse(uri, results, source='s', target='o', visited={}, depth=0, maxdepth=2): log.info("{} Traversing from {} to {}".format(" "*depth*10, source, target)) # log.debug(visited) if uri in visited.keys(): log.debug(u"{} Already visited {}".format(" "*depth*10, uri)) return visited[uri],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_graph(self):\n pass", "def build_graph(self):\n pass", "def generate(data, to_json=False, mode=\"freeform\"):\n labels, source, target, value, hovers = [], [], [], [], []\n indexes = {}\n indexes[json.dumps(None)] = 0\n labels.append(\"\")\n # data = find_json(data)\n ...
[ "0.55486494", "0.54975", "0.54811525", "0.53844243", "0.5366358", "0.53252655", "0.5289647", "0.52726734", "0.52513504", "0.51819783", "0.5175104", "0.5144242", "0.511471", "0.5108206", "0.50985456", "0.5093325", "0.50592774", "0.5034893", "0.5016158", "0.4995689", "0.4975789...
0.6025018
0
Renders message as an apology to user.
def apology(message, code=400): def escape(s): """ Escape special characters. https://github.com/jacebrowning/memegen#special-characters """ for old, new in [("-", "--"), (" ", "-"), ("_", "__"), ("?", "~q"), ("%", "~p"), ("#", "~h"), ("/", "~s"), ("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apology(message, code=400):\n return render_template(\"apology.html\", top=code, bottom=message), code", "def display_message():", "def display_message(self, message):\n\t\tself.render('message.html', {'message': message})", "def horde_message(self, message):", "def display_message(self, message):\n...
[ "0.7392153", "0.6561087", "0.64596355", "0.6361897", "0.630045", "0.6235551", "0.61294246", "0.5982203", "0.5945778", "0.5943644", "0.58861375", "0.58710206", "0.58434284", "0.5837634", "0.5753064", "0.5740654", "0.5738363", "0.5730195", "0.566454", "0.56373125", "0.56352663"...
0.7227377
6
List all CodeStand type_list (all = All CodeRequests / mylist = CodeRequests I've Created / mentoring = CodeRequests i'm mentoring)
def show_list(request, is_my_list="False", att=constants.ATT_CREATION_DATE, state="False", page=1): user = get_user(request) user_id = None if user: user_id = int(user.id) all_ids = None if state == "True" and constants.ALL_PROJECTS in request.session: all_projects = request.session...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list(self, req):\n list_type = None\n status_prefix = 'STATUS LIST '\n if req:\n list_type = req.pop(0)\n if list_type and list_type == SPECTATE:\n games = self.server.get_unfinished_games()\n status_prefix += SPECTATE + ' '\n else:\n ...
[ "0.63536584", "0.6269707", "0.61494476", "0.61117035", "0.60926104", "0.60872805", "0.60289395", "0.60289395", "0.5917053", "0.586454", "0.5820733", "0.57110536", "0.569691", "0.5654395", "0.5647826", "0.56365275", "0.56039286", "0.5602424", "0.5585967", "0.55736476", "0.5572...
0.5610738
16
Show individual Codestand Project and Add Implementation
def show(request, pk, ck): project_container = get_object_or_404(ProjectContainer, id=pk) coding = get_object_or_404(CodingProject, id=ck) user = get_user(request) coder = Person.objects.using('datatracker').get(id=coding.coder) if project_container.code_request is None: mentor = coder ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show():\n info(str(Project))", "def displaySummary(self):\r\n print('Project Name:' + self.project['name'])\r\n print('Project chip:' + self.project['chip'])\r\n print('Project includes: ' + ' '.join(self.project['incs']))\r\n print('Project defines: ' + ' '.join(self.project['...
[ "0.6878666", "0.6449986", "0.64111984", "0.64111984", "0.64111984", "0.5976959", "0.5946746", "0.5937944", "0.59315455", "0.5903919", "0.58518964", "0.5847654", "0.5842713", "0.58381397", "0.5818219", "0.5781239", "0.5764796", "0.57571226", "0.5754981", "0.57341766", "0.57209...
0.0
-1
Shows the list of CodeStand, filtering according to the selected checkboxes
def search(request, is_my_list="False"): search_type = request.GET.get("submit") if search_type: # get query field query = '' if request.GET.get(search_type): query = request.GET.get(search_type) proj_ids = [] cod_ids = [] valid_searches = [constan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filters():\n states = list(storage.all('State').values())\n states.sort(key=lambda state: state.name)\n cities = list(storage.all('City').values())\n cities.sort(key=lambda city: city.name)\n amenities = list(storage.all('Amenity').values())\n amenities.sort(key=lambda amenity: amenity.name)\...
[ "0.6295283", "0.6055959", "0.58220035", "0.5743757", "0.57072145", "0.56944096", "0.5693303", "0.5640104", "0.5601735", "0.55965394", "0.5520999", "0.5514905", "0.55066025", "0.54039", "0.53665644", "0.53299457", "0.53024447", "0.52882385", "0.52613115", "0.52571476", "0.5253...
0.0
-1
Used to create or update a CodeRequest. When project container is null then a new instance is created in the database
def save_code(request, template, pk, ck="", coding=None): # User must have permission to add new CodeRequest if not is_user_allowed(request.user, "canaddcode"): raise Http404 doc_form = DocNameForm() link_form = LinkImplementationForm() tag_form = modelform_factory(ProjectTag, form=TagForm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self, data):\n conn = pecan.request.db_conn\n try:\n project = db_models.Project(**data.as_dict())\n return conn.create_project(request.context, project)\n except Exception:\n LOG.exception('Fail to create project: %s' % data.as_dict())\n ra...
[ "0.5522651", "0.5492756", "0.5460612", "0.5429724", "0.5417926", "0.5395396", "0.5393321", "0.533603", "0.5313119", "0.53115845", "0.52807707", "0.52599657", "0.5236658", "0.51332843", "0.51265097", "0.5122707", "0.51193553", "0.5109384", "0.508615", "0.5071241", "0.5050269",...
0.5616324
0
New CodeStand Entry When user presses 'Associate new project' there is a Project Container associated, then you need reuse this information in the form
def new(request, pk=""): if request.path != request.session[constants.ACTUAL_TEMPLATE]: clear_session(request) request.session[constants.REM_LINKS] = [] request.session[constants.REM_TAGS] = [] request.session[constants.REM_DOCS] = [] request.session[constants.REM_CONTACTS] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_add_project_form():\n\n return render_template(\"project_add.html\")", "def get_project_add_form():\n\n return render_template(\"project_add.html\")", "def OnNew(self, e):\n self.mainparent.statusbar.SetStatusText(\"New Project\", 0)\n\n filename = \"__new_project__\"\n self....
[ "0.6817985", "0.6780683", "0.6740086", "0.6617793", "0.64625615", "0.6444909", "0.64395136", "0.6370462", "0.61937475", "0.6125256", "0.6123452", "0.6100076", "0.6080763", "0.6049719", "0.60282993", "0.6019261", "0.60046804", "0.5999283", "0.59867316", "0.59707147", "0.596656...
0.60473937
14
Adds the removal list, but will only be removed when saving changes ck (ck = 0 new CodeStand / ck > 0 edit CodeStand
def remove_link(request, ck, link_name): refresh_template = request.session[constants.ACTUAL_TEMPLATE] links = request.session[constants.ADD_LINKS] if '://' not in link_name: link_name = link_name.replace(':/', '://') link = next(el for el in links if el.link == link_name) if ck != "0": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_from_current_designs_callback(self, check_button_ckList):\n\n self.current_residueFull = self.current_residue.get().split(\":\")\n if len(self.current_residueFull) > 1:\n ResStart = int(self.current_residueFull[0]); ResEnd = int(self.current_residueFull[1])\n for i in...
[ "0.6307701", "0.5839487", "0.575174", "0.5742056", "0.5614422", "0.55769134", "0.55769134", "0.54905146", "0.54698485", "0.54572594", "0.54054046", "0.539731", "0.539731", "0.539731", "0.52697945", "0.5251685", "0.52371174", "0.521218", "0.5198979", "0.51685625", "0.51602167"...
0.0
-1
Adds the removal list, but will only be removed when saving changes pk (pk = 0 new ProjectContainer / pk > 0 edit ProjectContainer
def remove_contact(request, ck, contact_name): refresh_template = request.session[constants.ACTUAL_TEMPLATE] contacts = request.session[constants.ADD_CONTACTS] contact = next(el for el in contacts if el.contact == contact_name) if ck != "0": coding = get_object_or_404(CodingProject, id=ck) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onRemove(self):\n pass", "def onRemove(self):\n pass", "def _on_del_project(self):\n project = self.ddnCurProject.get()\n# if len(project) > 0:\n if project:\n if '.prj'!= project[-4:]:\n project += '.prj'\n if os.path.exists(self.BibT...
[ "0.5956774", "0.5956774", "0.57312095", "0.56841564", "0.5587434", "0.554424", "0.54593444", "0.5455142", "0.5428391", "0.5410329", "0.53905964", "0.5378729", "0.5378729", "0.5378729", "0.5376348", "0.53750026", "0.52773464", "0.5206134", "0.5206134", "0.5199947", "0.5198277"...
0.0
-1
Adds the removal list, but will only be removed when saving changes ck (ck = 0 new CodeStand / ck > 0 edit CodeStand
def remove_tag(request, ck, tag_name): refresh_template = request.session[constants.ACTUAL_TEMPLATE] tags = request.session[constants.ADD_TAGS] tag = next(el for el in tags if el.name == tag_name) if ck != "0": coding = get_object_or_404(CodingProject, id=ck) # TODO: Review this ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_from_current_designs_callback(self, check_button_ckList):\n\n self.current_residueFull = self.current_residue.get().split(\":\")\n if len(self.current_residueFull) > 1:\n ResStart = int(self.current_residueFull[0]); ResEnd = int(self.current_residueFull[1])\n for i in...
[ "0.63076097", "0.5840461", "0.57517207", "0.5741847", "0.5615831", "0.5576882", "0.5576882", "0.5490091", "0.54697216", "0.5456745", "0.54037637", "0.53965163", "0.53965163", "0.53965163", "0.52700907", "0.525226", "0.5235969", "0.5212025", "0.5198264", "0.5167575", "0.516037...
0.0
-1
Adds the removal list, but will only be removed when saving changes pk (pk = 0 new ProjectContainer / pk > 0 edit ProjectContainer
def remove_document(request, pk, doc_name): refresh_template = request.session[constants.ACTUAL_TEMPLATE] docs = request.session[constants.ADD_DOCS] document = next(el for el in docs if el.name == doc_name) if pk != "0": project_container = get_object_or_404(ProjectContainer, id=pk) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onRemove(self):\n pass", "def onRemove(self):\n pass", "def _on_del_project(self):\n project = self.ddnCurProject.get()\n# if len(project) > 0:\n if project:\n if '.prj'!= project[-4:]:\n project += '.prj'\n if os.path.exists(self.BibT...
[ "0.59563345", "0.59563345", "0.5730028", "0.56835395", "0.55868846", "0.55439687", "0.5459109", "0.54545784", "0.54284453", "0.5409711", "0.53918463", "0.5378136", "0.5378136", "0.5378136", "0.53762513", "0.53749716", "0.5278715", "0.52059627", "0.52059627", "0.5199824", "0.5...
0.49915513
35
Initializes Conway's Game of Life.
def __init__(self, board = np.random.randint(2, size=(5, 5), dtype = np.uint8)): # Check for valid filetype for board if not isinstance(board, np.ndarray): raise NotImplementedError("Board must be an numpy.array.") # Check for valid board size. if any(x < 2 for x in board.sh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, parent, life):\n self.parent = parent\n self.life = life\n self.board = Board(parent)\n self.state = self.board.init_cells()\n self.animate()", "def __init__(self):\r\n\t\tself.game_board = [['0','0','0'],['0','0','0'],['0','0','0']]\r\n\t\tself.count = 0\r\n...
[ "0.67524683", "0.66606927", "0.65495443", "0.6510292", "0.649037", "0.63796264", "0.6369015", "0.63610345", "0.63567483", "0.6351899", "0.6329346", "0.6321273", "0.6307408", "0.63018227", "0.62867403", "0.6285508", "0.6259106", "0.6246302", "0.62402946", "0.62281334", "0.6222...
0.0
-1
Returns next cell state depending on current cell state and number of alive neighbors.
def get_lookup(self, cell_status, num_neighbors): return self.lookup[cell_status,num_neighbors]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_state_of_cell(self, x_cell, y_cell):\n neighbours = self.get_number_neighbours_of_cell(x_cell, y_cell)\n if(self.board_state[x_cell][y_cell] == 1):\n # Any live cell with more than three live neighbours dies, \n # as if by overpopulation.\n if(neighbours > 3)...
[ "0.78863996", "0.7633017", "0.76074016", "0.7552659", "0.7054867", "0.6934011", "0.68837", "0.6869891", "0.6869891", "0.6667199", "0.6472177", "0.6424188", "0.6314878", "0.6268994", "0.6233133", "0.6218647", "0.6170793", "0.61515415", "0.6074687", "0.60372746", "0.59938014", ...
0.0
-1
Returns all 3x3 slices of the board corresponding to neighbors for all cells on the board.
def get_all_neighbors(self): m, n = self.board.shape return as_strided(self.expanded_board, shape = (m,n,3,3), strides = self.expanded_board.strides + self.expanded_board.strides)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(i: int, j: int) -> np.array:\n k, l = (i//3)*3, (j//3)*3 # noqa E741\n return np.array([\n np.r_[i:i:8j, 0:i, i + 1:9, np.repeat(np.r_[k:i, i + 1:k + 3], 2)],\n np.r_[0:j, j + 1:9, j:j:8j, np.tile(np.r_[l:j, j + 1:l + 3], 2)],\n ], dtype=np.uint8)", "def four_neighbors(self,...
[ "0.6740089", "0.66890025", "0.66793936", "0.6594341", "0.65792316", "0.6524311", "0.6460481", "0.63912827", "0.6384827", "0.6378845", "0.63124657", "0.6298454", "0.62896365", "0.62230825", "0.61602503", "0.6158862", "0.6150496", "0.6133123", "0.61103034", "0.6041652", "0.6035...
0.79104733
0
Runs the game for a specified (n) number of iterations.
def run_iterations(self, n, verbose = False): for i in range(n): # Calculate total number of neighbors for each cell all_neighbors = self.get_all_neighbors() all_num_neighbors = np.sum(all_neighbors, axis = (-2,-1)) - self.board # Determine new state for each cell...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_simulation(self, num_games=10):\n for _ in range(num_games):\n self.result.append(self.single_game())", "def play_simulation(self, n_iter=1000):\r\n final_wins = final_wins = {t: 0 for t in self.teams.dteams.keys()}\r\n season_teams_ranked, _ = get_playoffs(self.season_cal...
[ "0.70419717", "0.6931801", "0.69137526", "0.68271184", "0.6772729", "0.6684527", "0.6657945", "0.6657945", "0.6657945", "0.6657945", "0.6588333", "0.64944184", "0.6448962", "0.63891804", "0.63724905", "0.6364884", "0.63493186", "0.6312498", "0.6288337", "0.6247189", "0.623277...
0.6553275
11
Adds a css class to a given widget
def add_class_to_widget(widget, *css_classes): css_string = " ".join(css_classes) if 'class' in widget.attrs: widget.attrs['class'] += ' {} '.format(css_string) else: widget.attrs['class'] = css_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_css_class(kwargs, class_name):\n if \"className\" in kwargs:\n kwargs[\"className\"] += f\" {class_name}\"\n else:\n kwargs[\"className\"] = class_name", "def css_class(self):\n css_type = self.widget_type\n css_title = normalizer.normalize(self.data.title)\n r...
[ "0.6818847", "0.6212503", "0.6212503", "0.6199012", "0.59537244", "0.5752197", "0.56573015", "0.5592669", "0.5570389", "0.5429877", "0.5406586", "0.5379224", "0.537465", "0.5230199", "0.5168412", "0.5157973", "0.51225984", "0.5120061", "0.501813", "0.49978387", "0.4995106", ...
0.82613933
0
Sets the type and css class of basic form fields
def set_field_attributes(fields, errors): for field in fields: field_instance = fields[field] widget = field_instance.widget if isinstance(field_instance, forms.DateField) and isinstance(widget, forms.TextInput): field_instance.format = '%d/%m/%Y' add_class_to_widget(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n super(ProfileForm, self).__init__(*args, **kwargs) \n for field in self.fields:\n self.fields[field].widget.attrs.update(\n {\n 'class': 'form-control',\n }\n )", "def __init__(self,...
[ "0.6556525", "0.6397887", "0.62973934", "0.6274063", "0.6167857", "0.61553353", "0.6013343", "0.5908749", "0.5899894", "0.5880402", "0.5864337", "0.5855731", "0.5851525", "0.58142215", "0.5772183", "0.5752523", "0.57263505", "0.57251096", "0.57042205", "0.566185", "0.5655519"...
0.59868103
7
receive image, get emotion
def emotion(): if request.method == 'POST': # get image image = request.form['image'] number = request.form['number'] # save and recognize file_path = join('images', str(number) + '_' + str(time.time()) + '.jpg') # save image to image save_image(image, file_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_handler(self, bot, update):\n text = update.message.text\n if text.startswith('/recon'):\n bot.sendMessage(chat_id=update.message.chat_id, text='*Object recognition*\\nSend me an image',\n parse_mode=ParseMode.MARKDOWN)\n return 10\n e...
[ "0.6812863", "0.6745101", "0.6441059", "0.64172786", "0.63796186", "0.63081276", "0.6294757", "0.62844", "0.62346715", "0.62283665", "0.62075573", "0.62055445", "0.61972386", "0.6195789", "0.61943555", "0.6177658", "0.6170043", "0.60861194", "0.6079997", "0.6043401", "0.60154...
0.7119447
0
save binary base64 data to jpg
def save_image(data, file_path): with open(file_path, 'wb'): prefix = 'data:image/webp;base64,' data = data[len(prefix):] byte_data = base64.b64decode(data) image_data = BytesIO(byte_data) img = Image.open(image_data) img.save(file_path) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_image(image_base64: str, filepath: pathlib.Path):\n with open(filepath, \"wb\") as f:\n f.write(base64.b64decode(image_base64))", "def save_img_base64(_preds):\n img = Image.fromarray(_preds)\n buff = BytesIO()\n img.save(buff, format=\"JPEG\")\n return base64.b64encode(buff.getva...
[ "0.72845674", "0.72617203", "0.70148635", "0.66246814", "0.660669", "0.6605142", "0.6605142", "0.65970933", "0.65586734", "0.65237033", "0.6507136", "0.6453947", "0.6448506", "0.63817865", "0.63453406", "0.62678653", "0.62551504", "0.6238933", "0.62369317", "0.6222358", "0.62...
0.7008714
3
Include legend for lines with peaks at smallest x values.
def legend_min_lines(fg, n): find_max = lambda line: line.get_xdata()[np.argmax(line.get_ydata())] lines_sort = lambda ax: sorted(ax.lines, key=find_max) for ax in fg.axes.flat[:]: if ax.lines: lines = lines_sort(ax)[:n] ax.legend(lines, [line.get_label() for line in lines])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_min(self):\n colors = \"bgycmk\"\n with plt.style.context(MPLSTYLE):\n for i in range(np.shape(self.yf)[0]):\n plt.figure()\n label = \"\"\n for j in self.bestps[i]:\n label += str(\"{0:.2f}\".format(j)) + \", \"\n ...
[ "0.6858279", "0.5978236", "0.5806689", "0.57889366", "0.5775272", "0.57748306", "0.56940114", "0.56135684", "0.5593706", "0.5590681", "0.5581712", "0.5571524", "0.55093616", "0.5491891", "0.5491144", "0.5488706", "0.5459644", "0.54519004", "0.5437679", "0.543207", "0.5420253"...
0.65110964
1
Plots up to most `codes` abundant barcodes. Includes a perbase and cycle mean calculated over the full input data. Legend labels first `lines` density estimates, ordered by peak location.
def plot_base_cycle_distributions(df_, cycles=4, size=2.5, codes=24, lines=2): short_barcode = 'barcode_' cycle_col = 'cycle' base_col = 'first_base' value_col = 'first' grey_for_means = (0.4, 0.4, 0.4, 1) cycle_names = sorted(set(df_['cycle']))[:cycles] df_[short_barcode] = df_['b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_barcode_distribution(ax, barcodes, expected, barcode_map=barcode_map):\n colors = cm.rainbow(np.linspace(0, 1, len(barcodes)))\n\n #maximum barcodes at any one location\n max_count = max(barcodes.apply(max))\n filtered_barcodes = {barcode : name for barcode, name in barcode_map.items() if barc...
[ "0.70304686", "0.6543944", "0.6215505", "0.59607434", "0.5930003", "0.5833471", "0.57943875", "0.57301944", "0.56436056", "0.5634927", "0.5625236", "0.5556573", "0.547108", "0.54705006", "0.5356017", "0.5354114", "0.5318896", "0.52882516", "0.52709067", "0.5254348", "0.524471...
0.6880369
1
Calculate average values of metrics
def avg(realizations, results): avg_nmi, avg_snmi, avg_ari, avg_vi, avg_purity, avg_fmeasure = 0,0,0,0,0,0 for nmi, snmi, ari, vi, purity, f_measure in results: avg_nmi += nmi avg_snmi += snmi avg_purity += purity avg_fmeasure += f_measure avg_vi += vi avg_ari += ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_average_metrics(meters):\n metrics = {m: vs.avg for m, vs in meters.items()}\n metrics = {\n m: v if isinstance(v, float) else v.item()\n for m, v in metrics.items()\n }\n return metrics", "def compute_average_metrics(meters):\n metrics = {m: vs.avg for m, vs in meters.it...
[ "0.74242693", "0.7342951", "0.6997185", "0.6951211", "0.6874136", "0.68681633", "0.68398273", "0.6825758", "0.6825758", "0.6825083", "0.68211335", "0.6796899", "0.6785695", "0.67789793", "0.6734391", "0.6707466", "0.67017174", "0.66985774", "0.6684318", "0.6682522", "0.666072...
0.662958
26
Checks to see whether the gregorian year is a leap year or not
def _check_leap(year): return ((year % 4) == 0) and (not(((year % 100) == 0) and ((year % 400) != 0)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_leap_year():", "def is_leap_year(self):\n\n yr = self.year\n if not yr%4 == 0:\n return False\n elif not yr%100 == 0: #if divisible by 4 and not divisible by 100\n return True\n elif not yr%400 == 0: #if divisible by 4, divisible by 100 and not divisible 4...
[ "0.8997293", "0.86943525", "0.8649441", "0.86020476", "0.86020476", "0.8554422", "0.85501057", "0.85431385", "0.8532375", "0.85294396", "0.8521897", "0.85200065", "0.8519083", "0.8509531", "0.8501738", "0.85003936", "0.8499434", "0.84773076", "0.84652275", "0.8458736", "0.844...
0.8629167
3
Converts Gregorian Date to Julian Day
def _gregorian_to_julian_day(year, month, day): if month <= 2: val = 0 else: val = -1 if _check_leap(year) else -2 julian_day = (GREGORIAN_EPOCH - 1) + 365 * (year - 1) julian_day += math.floor((year - 1) / 4) julian_day += (-math.floor((year - 1) / 100)) + math.floor((year - 1) / 4...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def JulianDay(self):\n a = (14 - self._month) // 12\n y = self._year + 4800 - a\n m = self._month + (12 * a) - 3\n return (self._day + (153 * m + 2) // 5 + 365 * y +\n y // 4 - y // 100 + y // 400 - 32045)", "def date_to_julian_day(my_date):\n a = (14 - my_date.month...
[ "0.8149366", "0.7883695", "0.7861878", "0.78004646", "0.77878255", "0.77642244", "0.76791924", "0.7537485", "0.7537485", "0.75206345", "0.72884166", "0.72874254", "0.7244803", "0.7201342", "0.70295733", "0.6987624", "0.6918385", "0.6822204", "0.67515486", "0.67515486", "0.665...
0.8122727
1
Converts to Julian Day to Gregorian Date
def _julian_day_to_gregorian(jd): wjd = math.floor(jd - 0.5) + 0.5 depoch = wjd - GREGORIAN_EPOCH quadricent = math.floor(depoch / 146097) dqc = _mod(depoch, 146097) cent = math.floor(dqc / 36524) dcent = _mod(dqc, 36524) quad = math.floor(dcent / 1461) dquad = _mod(dcent, 1461) yind...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gregorian_date(year, julian_day):\n result = datetime.date(year, 1, 1)\n result += datetime.timedelta(days=julian_day - 1)\n return result", "def _gregorian_to_julian_day(year, month, day):\n if month <= 2:\n val = 0\n else:\n val = -1 if _check_leap(year) else -2\n\n julian_d...
[ "0.81905854", "0.80550563", "0.782452", "0.781413", "0.7801929", "0.752078", "0.752078", "0.74877125", "0.7468264", "0.73736537", "0.73700684", "0.7344756", "0.7330157", "0.7129804", "0.7113662", "0.69358957", "0.6897048", "0.678412", "0.678396", "0.6681008", "0.66408443", ...
0.797191
2
Converts Julian Day To Persian Date
def _julian_day_to_persian(jd): jd = math.floor(jd) + 0.5 depoch = jd - _persian_to_julian_day(475, 1, 1) cycle = math.floor(depoch / 1029983) cyear = _mod(depoch, 1029983) if cyear == 1029982 : ycycle = 2820 else: aux1 = math.floor(cyear / 366) aux2 = _mod(cyear, 366) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _persian_to_julian_day(year, month, day):\n if year >= 0:\n epbase = year - 474\n else:\n epbase = year - 473\n epyear = 474 + _mod(epbase, 2820)\n\n if month <= 7:\n tmp = (month - 1) * 31\n else:\n tmp = (month - 1) * 30 + 6\n\n\n return_value = day + tmp + math....
[ "0.778108", "0.70039576", "0.6986945", "0.689151", "0.689151", "0.6828967", "0.68120515", "0.6775218", "0.67513645", "0.6736337", "0.6687247", "0.66747767", "0.6517333", "0.63329804", "0.6303217", "0.60982215", "0.6093603", "0.595807", "0.58972424", "0.580301", "0.57856184", ...
0.7749067
1
Converts Persian Date to Julian Day
def _persian_to_julian_day(year, month, day): if year >= 0: epbase = year - 474 else: epbase = year - 473 epyear = 474 + _mod(epbase, 2820) if month <= 7: tmp = (month - 1) * 31 else: tmp = (month - 1) * 30 + 6 return_value = day + tmp + math.floor(((epyear * 6...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _julian_day_to_persian(jd):\n jd = math.floor(jd) + 0.5\n depoch = jd - _persian_to_julian_day(475, 1, 1)\n cycle = math.floor(depoch / 1029983)\n cyear = _mod(depoch, 1029983)\n if cyear == 1029982 :\n ycycle = 2820\n else:\n aux1 = math.floor(cyear / 366)\n aux2 = _mod(...
[ "0.7656499", "0.7473824", "0.73471373", "0.720493", "0.7184367", "0.69399893", "0.6917958", "0.6915787", "0.6915787", "0.68016946", "0.6757735", "0.64120007", "0.634268", "0.6329677", "0.6308081", "0.6292033", "0.62918746", "0.62019545", "0.6173216", "0.6173216", "0.6170946",...
0.7904213
0
Resets the cube to it's solved state
def reset(self): self.state = "YYYYRRRRGGGGOOOOBBBBWWWW"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.solver = None", "def restart(self):\n self.grid = np.zeros((3, 3), dtype=int)\n self.state = 0", "def reset(self):\n self._varstate = None\n self.frozen = False", "def reset(self):\r\n # reset Wheel encoders\r\n self.start_time = time.t...
[ "0.7340878", "0.6877558", "0.6798047", "0.67215616", "0.6713501", "0.67092115", "0.6681878", "0.66632855", "0.664809", "0.6643538", "0.66410244", "0.66283417", "0.6617618", "0.660482", "0.660482", "0.660482", "0.660482", "0.660482", "0.660482", "0.660482", "0.660482", "0.66...
0.0
-1
changes self.state to a new state to reflect the move
def move(self, move): out = '' for val in self.moves[move]: out += self.state[val] self.state = out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, state):\n raise NotImplementedError(\"Need to implement this method\")", "def change_move_state(self, new_state):\n\n if new_state != self.move_state:\n print(\"Changing move state from \", states[self.move_state],\n \" to \", states[new_state])\n ...
[ "0.7982249", "0.7722206", "0.737004", "0.7348828", "0.7347019", "0.73124987", "0.7232913", "0.7212082", "0.7191591", "0.70940953", "0.70351136", "0.7013791", "0.6994636", "0.69497657", "0.6938311", "0.6914219", "0.69104475", "0.6903565", "0.69022495", "0.68898356", "0.6862204...
0.6782269
25
Simulates a move without updating the actual cube Returns string of new state
def sim_move(self, state, move): out = '' for val in self.moves[move]: out += state[val] return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, move):\n out = ''\n for val in self.moves[move]:\n out += self.state[val]\n self.state = out", "def play_move(self,state):\n self.__engine.set_state(state)\n result = self.__engine.getNextState()\n time_elapsed = self.__engine.get_time_elapsed()...
[ "0.6921523", "0.6892486", "0.65637857", "0.63624007", "0.62392104", "0.6112367", "0.60789704", "0.6057439", "0.6018767", "0.60000694", "0.59861535", "0.59631836", "0.5946268", "0.5936835", "0.5936835", "0.5918231", "0.590612", "0.59025174", "0.58861065", "0.5870965", "0.58596...
0.6692327
2
Draws one face of the cube
def draw_face(self, face, window, xy, width): width = width / 2 - (width/2/20) if face == "U": face = self.state[0:4] elif face == "L": face = self.state[4:8] elif face == "F": face = self.state[8:12] elif face == "R": face = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_cube(self, vec):\n # TOP FACE\n gl.glBegin(gl.GL_QUADS)\n gl.glVertex3f(vec[0] + self.spacer, vec[1], vec[2] + self.spacer)\n gl.glVertex3f(vec[0], vec[1], vec[2] + self.spacer)\n gl.glVertex3f(vec[0], vec[1] + self.spacer, vec[2] + self.spacer)\n gl.glVertex3f(ve...
[ "0.78066784", "0.77423006", "0.7387939", "0.73804337", "0.7249903", "0.7220101", "0.7110212", "0.6906913", "0.67459834", "0.6581188", "0.64220697", "0.6389244", "0.6360217", "0.62606686", "0.6194847", "0.6170468", "0.61597985", "0.6133728", "0.60985386", "0.60883045", "0.6059...
0.71219224
6
Draws the current state of the cube
def draw_cube(self, window): size = pygame.display.get_surface().get_size() width = (size[0]/4) window.fill((000,000,000)) self.draw_face("U", window, (0 + (width*1), 0 + (width*0)), width) self.draw_face("L", window, (0 + (width*0), 0 + (width*1)), width) self.draw_fac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __drawCube(self):\n self.cubePos = [[[(160, 160), (200, 160), (240, 160)],\n [(160, 200), (200, 200), (240, 200)],\n [(160, 240), (200, 240), (240, 240)]],\n [[(400, 160), (440, 160), (480, 160)],\n [(400, 200...
[ "0.7443598", "0.72131336", "0.72006935", "0.7090346", "0.7041675", "0.69037914", "0.6844577", "0.6831325", "0.68266904", "0.6815212", "0.6765526", "0.67602086", "0.6747582", "0.67170113", "0.6653908", "0.66519344", "0.66422015", "0.6635882", "0.6626009", "0.6626009", "0.66260...
0.6704943
14
This function calculates and returns the CAGR (compound annual growth rate) for the time period.
def cagr_for_mutual_fund(start: dict, end: dict) -> float: if float(start['nav']) == 0.0: return 0 start_date = convert_to_datetime_format(start["date"]) start_value = float(start["nav"]) end_date = convert_to_datetime_format(end["date"]) end_value = float(end["nav"]) if start_value =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cagr_for_days(start_value: float, end_value: float, days: int):\n if start_value == end_value or start_value == 0:\n return 0.00\n\n years = float(days) / 365\n growth_rate: float = (((end_value / start_value) ** (1 / years)) - 1) * 100\n\n return round(growth_rate, 2)", "def annualize_ret...
[ "0.63266486", "0.6035581", "0.59583175", "0.5690206", "0.5639958", "0.56235296", "0.55166584", "0.5500198", "0.5369738", "0.5366105", "0.53402543", "0.5330149", "0.5266624", "0.5244037", "0.52425796", "0.5219255", "0.5211717", "0.52047306", "0.52046055", "0.52021915", "0.5192...
0.66032165
0
This function calculates and returns the CAGR (compound annual growth rate) for the time period in days.
def cagr_for_days(start_value: float, end_value: float, days: int): if start_value == end_value or start_value == 0: return 0.00 years = float(days) / 365 growth_rate: float = (((end_value / start_value) ** (1 / years)) - 1) * 100 return round(growth_rate, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cagr_for_mutual_fund(start: dict, end: dict) -> float:\n if float(start['nav']) == 0.0:\n return 0\n\n start_date = convert_to_datetime_format(start[\"date\"])\n start_value = float(start[\"nav\"])\n\n end_date = convert_to_datetime_format(end[\"date\"])\n end_value = float(end[\"nav\"])\...
[ "0.66585195", "0.6012151", "0.5915305", "0.58467585", "0.57078165", "0.5574578", "0.5569178", "0.5549666", "0.53952694", "0.53781515", "0.5357943", "0.5354434", "0.52893466", "0.5264744", "0.5225273", "0.51974696", "0.51880413", "0.5179483", "0.5178693", "0.51628333", "0.5124...
0.6935644
0
Calculates the CAGR (compound annual growth rate) for all the schemes provided from start_index to end_index in scheme data.
def cagrs_for_schemes(start_index: int, end_index: int, schemes: list) -> dict: cagrs = {} for scheme in schemes: with open(os.path.join(parameters.RAW_DATA_PATH, str(scheme['scheme_code']) + ".json")) as raw_data_file: scheme_data = json.load(raw_data_file) start = scheme_data['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cagr_for_mutual_fund(start: dict, end: dict) -> float:\n if float(start['nav']) == 0.0:\n return 0\n\n start_date = convert_to_datetime_format(start[\"date\"])\n start_value = float(start[\"nav\"])\n\n end_date = convert_to_datetime_format(end[\"date\"])\n end_value = float(end[\"nav\"])\...
[ "0.6145627", "0.60511035", "0.49853945", "0.49355876", "0.48968604", "0.4840281", "0.48249128", "0.48093522", "0.47987202", "0.47882715", "0.47356302", "0.47308907", "0.47280487", "0.46963185", "0.46888217", "0.46787497", "0.46685022", "0.46574417", "0.46570078", "0.46364397", ...
0.6982882
0
This is only to exercise code that relies on network errors to occur
def test_network_drops(self): self.mocking = False try: if conf.block_storage_driver.swift.testing.is_mocking: self.mocking = True except: self.mocking = False if self.mocking: vault_id = 'notmatter' block_id = 'notmatter'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SocketError(self) -> SocketError:", "def test_read_unexpected_error(self, data, requests_mock, capsys):\n requests_mock.get(data_url, exc=ConnectionError)\n with pytest.raises(ConnectionError):\n r = operations.read(data_url)\n assert 'Unexpected error when connecting to' in c...
[ "0.6452426", "0.6146648", "0.6054644", "0.6035812", "0.59640247", "0.593972", "0.5933273", "0.5887359", "0.584812", "0.584534", "0.58230704", "0.5814271", "0.58085036", "0.5797263", "0.57944185", "0.5776852", "0.57682645", "0.5760222", "0.5747974", "0.57094646", "0.5687389", ...
0.0
-1
Write a message to this player
def send(self, message): if self.connection: self.connection.send(message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeMessage(self,message):\n pass", "def send_message(self, message):\n \n msgPacket = serverbound.play.ChatPacket()\n msgPacket.message = message\n self.connection.write_packet(msgPacket)", "def sendChatMessage(self, msg):\n self.transport.write(msg)", "def wri...
[ "0.7655677", "0.7647407", "0.76238", "0.74160534", "0.7394611", "0.7328616", "0.7274181", "0.71903396", "0.7179744", "0.7135206", "0.7110217", "0.70350385", "0.6972327", "0.69231653", "0.6893939", "0.68482524", "0.68482524", "0.68482524", "0.6826785", "0.6812069", "0.68044263...
0.6240161
88
Validate details in the cli
def validate( *, validate_operation: colrev.operation.Operation, validation_details: dict, threshold: float, ) -> None: for key, details in validation_details.items(): if key == "prep": __validate_prep( validate_operation=validate_operation, valid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cli_validate(self, settings, remaining_argv):\n return None", "def validate(self):\r\n for opt in self.required:\r\n if not getattr(self, opt):\r\n print \"Error: %s is not specified.\" % opt\r\n self.optp.print_help()\r\n sys.exit(1)", ...
[ "0.692152", "0.67884237", "0.67662823", "0.6687997", "0.6668588", "0.65385044", "0.6493997", "0.62744355", "0.6264986", "0.62293696", "0.6207753", "0.6206387", "0.6129949", "0.61274326", "0.61183006", "0.61183006", "0.6111026", "0.6090679", "0.6084673", "0.6035743", "0.603574...
0.0
-1
Log an exception during execution. This method should be used whenever an user wants to log a generic exception that is not properly managed.
def exception(msg='', details={}, exc_info=True): logger = logging.getLogger(settings.LOGGER_EXCEPTION) logger.exception(msg=msg or sys.exc_info(), extra=details, exc_info=exc_info)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exception(self, *args, **kwargs):\n\n message = self.get_message(*args, **kwargs)\n self.logger.exception(message)", "def log_exception(*args, **kwds):\n import logging\n logging.exception('Exception in request:')", "def log_exception(e):\n logger.exception(e)\n raise", "def log_exc...
[ "0.7769382", "0.7681452", "0.76069033", "0.7560483", "0.73991156", "0.73967224", "0.73785627", "0.7192698", "0.71920174", "0.717697", "0.7152445", "0.7140749", "0.7038845", "0.7038845", "0.69647795", "0.69384027", "0.69237226", "0.6873566", "0.6830571", "0.6828358", "0.680499...
0.61943823
70
Log an error occurred during execution. This method should be used when an exception is properly managed but it shouldn't occur.
def error(message, details={}, status_code=400, exc_info=False): details['http_status_code'] = status_code logger = logging.getLogger(settings.LOGGER_ERROR) logger.exception(msg=message, extra=details, exc_info=exc_info)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _log_exception(self, exception, query, parameters):\n logging.error(\"Error on MySQL Server:\" + self.host)\n logging.error(\"Error query:\", query)\n logging.error(\"Error parameters:\", parameters)\n logging.error(\"Error Exception:\", str(exception))", "def log_error(self, erro...
[ "0.7315794", "0.7255244", "0.7241068", "0.7214894", "0.7206789", "0.710633", "0.71039206", "0.71039206", "0.7099114", "0.7085002", "0.70847625", "0.7081666", "0.7081666", "0.70623994", "0.7061329", "0.70591885", "0.69694114", "0.69626766", "0.69496167", "0.6930542", "0.690214...
0.0
-1
Log a warning message during execution. This method is recommended for cases when behaviour isn't the appropriate.
def warning(message, details={}, exc_info=False): logger = logging.getLogger(settings.LOGGER_WARNING) logger.warning(msg=message, extra=details, exc_info=exc_info)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warning(self, msg):\r\n self.logger.warning(msg)", "def warning(msg):\n log('WARNING', msg)", "def warning(self, msg, *args, **kwargs):\n self._log(\"WARNING\", msg, args, kwargs)", "def warning(self, msg):\n\n self.logger.warning(msg)", "def warning(self, msg: str):\n ...
[ "0.8278683", "0.8168544", "0.81555516", "0.8127975", "0.80952716", "0.8093806", "0.8034985", "0.8019739", "0.8012122", "0.79359764", "0.79303735", "0.7929197", "0.79023856", "0.78919226", "0.7875256", "0.78197044", "0.779272", "0.77786297", "0.77699286", "0.7735964", "0.77295...
0.6845167
98
Log a info message during execution. This method is recommended for cases when activity tracking is needed.
def info(message, details={}, exc_info=False): logger = logging.getLogger(settings.LOGGER_INFO) logger.info(msg=message, extra=details, exc_info=exc_info)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info(self, msg, *args, **kwargs):\n self._log(\"INFO\", msg, args, kwargs)", "def log_info(self, msg, *args, **kwargs):\n if self.action_logging_enabled and self._log is not None:\n self._log.info(msg, *args, **kwargs)\n return", "def info(self, *args, **kwargs):\n\n ...
[ "0.81290513", "0.80113953", "0.7990703", "0.7887532", "0.7873279", "0.7869518", "0.7856359", "0.78491783", "0.775716", "0.7752151", "0.7750347", "0.7730517", "0.7728159", "0.7708473", "0.7693509", "0.76575786", "0.76510715", "0.7646649", "0.7621743", "0.761515", "0.7586421", ...
0.6708142
63
Calculate the PageRank of bipartite networks directly.
def birank(W, u0=None, v0=None, alpha=0.85, beta=0.85, max_iter=200, tol=1.0e-4, verbose=False): # default initial vectors: 1/|U|, 1/|V| if u0 is None: u0=np.repeat(1 / W.shape[0], W.shape[0]) if v0 is None: v0=np.repeat(1 / W.shape[1], W.shape[1]) W = W.astype('float', copy=False)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_PageRank(outlinks):\n\n\t# Damping factor\n\td = 0.85\n\n\t# size of the matrix\n\tsize = outlinks.shape[0]\n\n\t# list to hold page ranks\n\tpage_ranks = [1 for i in range(size)]\n\n\t# Calculating the out degree of each node and storing in a list\n\tout_degrees = []\n\tfor i in range(size):\n\t\tsu...
[ "0.6948972", "0.6746317", "0.6257413", "0.6239518", "0.6153235", "0.6076943", "0.6060715", "0.6018301", "0.5935665", "0.5905552", "0.5900267", "0.58826864", "0.58024645", "0.57995945", "0.57869035", "0.5784187", "0.57418364", "0.5654542", "0.5638563", "0.5629704", "0.5624261"...
0.0
-1
This function generates sparse matrix represantation of bipartite graph for players and linups
def gen_W(users, items, ratings): # initiate graph user = users.tolist() item = items.tolist() rating = ratings.tolist() B = nx.Graph() B.add_nodes_from(user, bipartite=0) B.add_nodes_from(item, bipartite=1) # create edges for i in range(len(user)): B.add_edges_from([(user[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_adjacency_matrix_2(self):\n\n from scipy import sparse as sparse\n \n down_neighbour = np.empty(self.tri.npoints)\n down_neighbour1 = np.empty(self.tri.npoints)\n\n for node in range (0,self.tri.npoints):\n down_neighbour[node] = self.neighbour_array_lo_hi...
[ "0.5985892", "0.5932107", "0.59273183", "0.590966", "0.5900291", "0.58540547", "0.5808103", "0.57964116", "0.57642895", "0.57434833", "0.57035285", "0.566272", "0.5649829", "0.5572187", "0.5566339", "0.5548908", "0.5543541", "0.5539884", "0.55367184", "0.55244374", "0.5513614...
0.5368329
39
Busca no site do estado os dados do CNPJ provido
def get_cnpj_data(cnpj, state="ba"): valid = cpfcnpj.validate(cnpj) if (not valid): raise Exception("CNPJ inválido") state = load_state_class(state) return state().get_cnpj_data(cnpj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIntervenciones():", "def __get_data(self):\n ips = self.server.JUGADORES.keys()\n convida = list(ips)\n retorno = \"\"\n for ip in ips:\n nick = self.server.JUGADORES[ip]['nick']\n tanque = self.server.JUGADORES[ip]['path']\n energia = self.serv...
[ "0.5500876", "0.54185796", "0.5262664", "0.52500665", "0.52292633", "0.51622605", "0.51329434", "0.5129387", "0.5084935", "0.5080624", "0.50641894", "0.5059089", "0.5025863", "0.49883416", "0.4983073", "0.49709845", "0.4948901", "0.4944597", "0.494453", "0.49118268", "0.49041...
0.47824264
42
Creates new parameter in AWS SSM
def put_parameter(parameter_name, parameter_value, parameter_type, overwrite=False): ssm_client = boto3.client('ssm') try: result = ssm_client.put_parameter( Name=parameter_name, Value=parameter_value, Type=parameter_type, Overwrite=overwrite ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _put_ssm_param(self, parameter, parameter_name):\n self.ssm_client.put_parameter(\n Name=parameter_name,\n Type=\"String\",\n Value=json.dumps(parameter),\n Overwrite=True,\n Tier=\"Intelligent-Tiering\",\n )", "def create_parameter(self, n...
[ "0.705831", "0.6687121", "0.6472439", "0.64712715", "0.6410997", "0.6397169", "0.6185818", "0.6118751", "0.60742664", "0.6040256", "0.6012701", "0.59615684", "0.5958489", "0.5883877", "0.5881908", "0.58312005", "0.58145607", "0.57996505", "0.5771987", "0.5770561", "0.5722659"...
0.63364834
6
Creates new parameter in AWS SSM using contents of a file
def put_parameter_from_file(parameter_name, value_file, parameter_type, overwrite=False): ssm_client = boto3.client('ssm') try: with open(value_file, 'r') as file: parameter_value = file.read() logging.info("value_file: %s" % value_file) logging.info(parameter_value)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromfile(self,file):\n self.d.update(params_file(file))", "def create_parameter(self, name):\n result = SGParameter(name)\n result.file_line_details = self.file_line_details\n self.params.append(result)\n return result", "def __openParameterfile(self, filename):\n ...
[ "0.6122637", "0.6041775", "0.57899785", "0.57114273", "0.5706465", "0.5643073", "0.56284535", "0.562203", "0.5616292", "0.55719197", "0.55681545", "0.55505854", "0.55363524", "0.54725", "0.5444208", "0.5434256", "0.5395848", "0.539512", "0.53844494", "0.53457767", "0.5345514"...
0.710025
0
For a square matrix with shape (`dimension`, `dimension`), return a list of indices into a vector with `dimension dimension` elements that correspond to its upper triangular part after reshaping.
def upper_triangular_indices(dimension): assert dimension > 0, "tensor_utils.upper_triangular_indices: Dimension must be positive integer!" for row in range(dimension): for column in range(row + 1, dimension): element_index = dimension * row + column ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_indices(dimensions):\n\n level = len(dimensions)\n\n if level == 1:\n return range(dimensions[0])\n\n indices = [[]]\n\n while level:\n\n _indices = []\n\n for j in range(dimensions[level - 1]):\n\n _indices += [[j] + i for i in indices]\n\n indices = _in...
[ "0.61439174", "0.6052947", "0.6035017", "0.60090554", "0.5936174", "0.58033603", "0.57944226", "0.57944226", "0.5761883", "0.5708514", "0.56910044", "0.5668839", "0.5661304", "0.5629464", "0.5621799", "0.5600451", "0.5595236", "0.555132", "0.55404836", "0.55397177", "0.553816...
0.7299493
0
Dumps generated signatures to disk for comparision with other binaries
def write_json(data: Dict[str, Annotations], file: str): if not os.path.exists(file): with open(file, 'w', encoding='utf-8') as output_file: json_data = dict(map(lambda kv: (kv[0], kv[1].encode()), data.items())) json.dump(json_data, output_file, ensure_ascii=False, indent=4) els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_signature(self):\n self.db_file.write(b\"\\x4b\\x57\\x44\\x42\\x00\\x01\\x03\\x01\")", "def upgrade_savefile(fn):\n\n if signing_keys is None:\n return\n\n atime = os.path.getatime(fn)\n mtime = os.path.getmtime(fn)\n\n with zipfile.ZipFile(fn, \"a\") as zf:\n\n if \"si...
[ "0.66512656", "0.60045666", "0.5823386", "0.5745661", "0.56420565", "0.5641171", "0.56185573", "0.55467165", "0.55377454", "0.5524151", "0.54996216", "0.5489361", "0.5485318", "0.5471915", "0.5433557", "0.5410631", "0.54003936", "0.5399921", "0.53845143", "0.536774", "0.53463...
0.0
-1
Reads previously generated signature file into dictionary for analysis
def read_json(file: str) -> Dict[str, Dict[str, Dict[str, str]]]: if os.path.exists(file): with open(file, 'r') as input_file: return json.load(input_file) else: print('Invalid signature file.') sys.exit(-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self):\n results = {}\n\n # get the signature info via the codesign utility\n args = [\"codesign\",\"-dvvvv\", self.file_name]\n proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n output, error_output = proc.communicate()\n if proc.re...
[ "0.68445754", "0.6574761", "0.6339301", "0.6332346", "0.6218923", "0.61564606", "0.6098373", "0.60636353", "0.6063397", "0.6051316", "0.6024441", "0.5897094", "0.5871888", "0.5809733", "0.5801732", "0.57258075", "0.56929916", "0.56882375", "0.56847006", "0.568351", "0.5663017...
0.614064
6
Perform selection and return the subset of the data set. This method will take in a full data set and return the selected subset according to the saturated coverage function. The data will be returned in the order that it was selected, with the first row corresponding to the best first selection, the second row corresp...
def fit(self, X, y=None): self.max_values = numpy.zeros(X.shape[0], dtype='float64') return super(SaturatedCoverageSelection, self).fit(X_pairwise, y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_fits_subset(self, pre_processing=None, binning=None,\n exposure=(None, 'max'), reduction=None,\n observatory=None, jd=(None, 'exact')):\n self.data_subset = self.all_data.copy()\n\n # Select on pre-processing if provided.\n if pre_...
[ "0.62870026", "0.6039137", "0.5881284", "0.58465046", "0.5695739", "0.56624246", "0.5628096", "0.55312836", "0.55270106", "0.5526708", "0.54940915", "0.5472937", "0.5470998", "0.54655784", "0.5464898", "0.54618347", "0.54524523", "0.54440403", "0.54308194", "0.54274946", "0.5...
0.50134706
65
This function will add the given item to the selected set.
def _select_next(self, X_pairwise, gain, idx): if self.cupy: self.current_values = cupy.sum(X_pairwise, self.current_values) elif self.sparse: self.current_values = numpy.sum( X_pairwise.toarray()[0], self.current_values) else: self.current_values = numpy.sum(X_pairwise, self.current_values) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, item):\n self.update(set([item]))", "def add(self, item):\n item = self._prepare_item(len(self), item)\n if item not in self._data:\n self._data.append(item)\n self.__log__.append(SetAdd(value=item))", "def add(self, item):", "def add_to_set(self, item...
[ "0.73516047", "0.7013469", "0.68363553", "0.67736554", "0.6619586", "0.64546084", "0.64355004", "0.6322977", "0.6270735", "0.626274", "0.6257609", "0.6250345", "0.6219014", "0.6200317", "0.6189502", "0.6179191", "0.6178842", "0.6126808", "0.6108215", "0.6097255", "0.6080352",...
0.0
-1
original dataframe that contains (x, y, z, intensity) Number of sampling point dataframe
def uniform_subsampling(dataframe, num_point, random_seed=0): if not isinstance(dataframe, pd.core.frame.DataFrame): raise NotImplementedError() df = dataframe.sample(n=num_point, random_state=random_seed).reset_index(drop=True) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_rows(df, nrows):", "def n_points(self) -> int:\n return len(self.df)", "def num_df(df):\n float_mask = np.array(df.dtypes == 'float')\n int_mask = np.array(df.dtypes == 'int')\n mask = float_mask | int_mask\n df_obj = df.iloc[:, mask]\n return df_obj", "def data_count(self):\...
[ "0.57061243", "0.5563727", "0.5552614", "0.5467287", "0.54224366", "0.5401177", "0.5401177", "0.53765994", "0.53242224", "0.5319679", "0.52940494", "0.5237119", "0.5227982", "0.5217082", "0.52069044", "0.5191094", "0.5178655", "0.5156516", "0.5152208", "0.5087616", "0.506524"...
0.51861346
16
Test expected output of evaluate functions.
def test_distr_evaluate(normal, metric, multivariate): y_pred = normal.create_test_instance() y_true = y_pred.sample() m = metric(multivariate=multivariate) if not multivariate: expected_cols = y_true.columns else: expected_cols = ["score"] res = m.evaluate_by_index(y_true, y_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_result(self):\n result = compute()\n self.assertEqual(result, '4782')\n print(\"eulpy25Test passed\")", "def test_evaluate():\n X_train, X_test, y_train, y_test = src.load()\n clf, score = src.train(X_train, y_train)\n test_score = src.evaluate(clf, X_test, y_test)\n ass...
[ "0.7271385", "0.69315785", "0.6929785", "0.68927145", "0.6861251", "0.68174237", "0.67993474", "0.6767927", "0.6757796", "0.6729893", "0.6729893", "0.6680893", "0.66804725", "0.6659945", "0.65986425", "0.6598142", "0.6580862", "0.65679246", "0.6551243", "0.65447843", "0.65268...
0.0
-1
Upload to S3 and set property to an dict representing the S3 url of the uploaded object
def do_export(self, resource_id, resource_dict, parent_dir): local_path = resource_dict.get(self.PROPERTY_NAME, None) local_path = make_abs_path(parent_dir, local_path) with open(local_path, 'r') as fp: data = fp.read() resource_dict[self.PROPERTY_NAME] = data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _upload_s3(self, filename, bucket, objectKey):\n return s3_client.upload_file(filename, bucket, objectKey)", "def upload_object(self, file_path, s3_path):\n logging.info(\"Uploading file to \\\"{}\\\" to S3\".format(s3_path))\n bucket_name, key = S3Util.get_bucket_and_key(s3_path)\n ...
[ "0.7289795", "0.6838148", "0.6684041", "0.66027933", "0.65164405", "0.64855313", "0.6465686", "0.6434873", "0.64075977", "0.6398085", "0.6393706", "0.63678676", "0.6359892", "0.6333856", "0.6299015", "0.61777157", "0.61774784", "0.61772126", "0.617703", "0.6172503", "0.614531...
0.0
-1
Return a single user from the given list of users.
def select_user(users): # Construct the model. model = [_User(name=name, description=description) for name, description in users] # Construct the view. view = _UsersView(model=model) if view.configure_traits() and view.selection is not None: user = view.selection.name, view.se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(school, users_list):\n\n possible_ids = [str(user.id_) for user in users_list]\n manager_view.list_users(users_list)\n chosen_user_id = manager_view.get_id()\n\n if chosen_user_id in possible_ids:\n chosen_user_id = int(chosen_user_id)\n\n for user in users_list:\n ...
[ "0.7835463", "0.76739216", "0.73893255", "0.69394517", "0.67062837", "0.66985226", "0.66946673", "0.66292024", "0.6526007", "0.64843255", "0.6482442", "0.64354146", "0.6417425", "0.6406786", "0.63997686", "0.6369976", "0.6369135", "0.6331308", "0.6329324", "0.62496525", "0.62...
0.6811358
4
Send a message to a channel.
def msg(self, chan, msg): self._msg(chan, msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def send_message(self, channel : str, message : str):\n await self._connection.send_message(channel, message)", "def sendMsg(self, channel, message, length=None):\n self.logger.info(\"Sending in %s: %s\" % (channel, message))\n self.msg(channel, message, length)", "def send_message(s...
[ "0.83642954", "0.79701066", "0.7774575", "0.7733594", "0.77235144", "0.7678045", "0.7464294", "0.7339515", "0.7268766", "0.7233262", "0.72009623", "0.71932656", "0.71572554", "0.7106774", "0.708186", "0.70479006", "0.70242006", "0.6979018", "0.694971", "0.6916051", "0.6906087...
0.67452574
29
Deletes the file train that is associated with the dialog
def close(self): del self.__train self.__train = None del self.__parent self.__parent = None self.__sync_selector.close() self.__isoline_selector.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predio_delete(sender, instance, **kwargs):\n instance.dataFile.delete(False)", "def delete_file(self):\n os.remove(self.id+\"-input.txt\")\n if(self.lang == \"PYTHON\"):\n os.remove(self.id+\".py\")\n elif(self.lang == \"C\"):\n os.remove(self.id+\".c\")\n ...
[ "0.70128113", "0.69167584", "0.6887576", "0.68579847", "0.6735819", "0.6732968", "0.66820323", "0.66194177", "0.65809846", "0.6564491", "0.6551412", "0.6545252", "0.65099853", "0.64944327", "0.6493921", "0.6470264", "0.63957036", "0.6383352", "0.63558215", "0.63507026", "0.63...
0.0
-1
Returns a threeitem tuple containing the reader, the isoline and the synchronization
def create_reader(self): if len(self.get_pixel_list()) > 2000: raise RuntimeError("ROI with area higher than 2000 px can't be processed without autoaverage\n" "Please, set the autoaverage or select smaller ROI") reader = TraceReader(self.__train) sync =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, readerFunction):\n self.beginRead()\n # Enter the reader's critical section\n result = readerFunction(self.data)\n # Exit the reader's critical section\n self.endRead()\n return result", "def reader(client: socket.socket, reader_id: int) -> tuple:\n\n l...
[ "0.53536654", "0.53221244", "0.52414733", "0.51606363", "0.5156472", "0.51358867", "0.5020214", "0.5008562", "0.4986361", "0.4920189", "0.49160677", "0.488695", "0.4885702", "0.48793247", "0.4875339", "0.48653385", "0.4858211", "0.48561522", "0.48519036", "0.48374346", "0.482...
0.5402046
0
Given an x, y, see if we need to register any button clicks.
def check_mouse_press_for_buttons(x, y, button_list): for button in button_list: if x > button.center_x + button.width / 2: continue if x < button.center_x - button.width / 2: continue if y > button.center_y + button.height / 2: continue if y < but...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(self, x: float, y: float) -> bool:\n\n if self.x <= x <= self.x + self.width and self.y <= y < self.y + self.height:\n return True\n\n return False", "def check_mouse_press_for_buttons(x: float, y: float, button_list: list):\n for button in button_list:\n if x > butto...
[ "0.7199686", "0.7138824", "0.7082071", "0.69957554", "0.6930157", "0.6891789", "0.6877496", "0.66716933", "0.6657784", "0.66270465", "0.655502", "0.654256", "0.65188766", "0.6495332", "0.64738446", "0.64694965", "0.6412789", "0.6356476", "0.62814677", "0.6225734", "0.61532915...
0.72287434
1
Given an x, y, see if we need to register any button clicks.
def check_mouse_release_for_buttons(x, y, button_list): for button in button_list: if x > button.center_x + button.width / 2: continue if x < button.center_x - button.width / 2: continue if y > button.center_y + button.height / 2: continue if y < b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_mouse_press_for_buttons(x, y, button_list):\n for button in button_list:\n if x > button.center_x + button.width / 2:\n continue\n if x < button.center_x - button.width / 2:\n continue\n if y > button.center_y + button.height / 2:\n continue\n ...
[ "0.72287434", "0.72287434", "0.7199686", "0.7138824", "0.7082071", "0.69957554", "0.6930157", "0.6877496", "0.66716933", "0.6657784", "0.66270465", "0.655502", "0.654256", "0.65188766", "0.6495332", "0.64738446", "0.64694965", "0.6412789", "0.6356476", "0.62814677", "0.622573...
0.6891789
7
Subclasses should implement this instead of overriding on_update()
def game_play(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onUpdated(self):", "def on_update(self):\n raise NotImplemented(\"on_update method should be implemented.\")", "def beforeUpdate(self):", "def _update(self):\n pass", "def on_update(self, delta_time):\n pass", "def on_update(self, delta_time):\n pass", "def after_update(...
[ "0.84690547", "0.8463682", "0.79468524", "0.79307497", "0.78548336", "0.78548336", "0.76638794", "0.7659666", "0.7569804", "0.7569804", "0.7569804", "0.75543875", "0.75222874", "0.75222874", "0.75222874", "0.75222874", "0.75222874", "0.75222874", "0.75222874", "0.75222874", "...
0.0
-1
Subclasses should implement this instead of overriding on_draw() to ensure that main window components are displayed on top.
def game_draw(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_draw(self):\n # draw everything", "def draw(self): \n pygame.event.clear()\n self.window = ocempgui.widgets.Box(GG.utils.SCREEN_SZ[0], GG.utils.SCREEN_SZ[1])\n self.paintScreen()\n self.paintAvatar()\n self.paintTags()\n self.paintCustomizeZone()\n self.paintButtons()\n sel...
[ "0.70353925", "0.69686145", "0.6908189", "0.6872484", "0.6870745", "0.68200177", "0.68200177", "0.6764793", "0.6733085", "0.6721151", "0.6703409", "0.66745687", "0.66565627", "0.6647657", "0.66004145", "0.65339154", "0.6532389", "0.64720786", "0.6464197", "0.6443458", "0.6443...
0.60208833
86
Show exit screen and return to the main menu
def game_exit(self): self.set_state(GameState.EXITING) self.game_stop() self.game_log_statistics()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_main_menu(self, event):\n self.Destroy()", "def close(self):\n self.dismiss()\n screenmanager.change_to('main_menu')", "def click_Exit(self, event):\n exit()", "def _exit(self):\n self.reset_entry(self.buttons.BARCODE)\n self.reset_entry(self.buttons.PRICE...
[ "0.79366434", "0.7725204", "0.7364473", "0.7355074", "0.7314603", "0.7314603", "0.7314603", "0.7314603", "0.728253", "0.72364044", "0.72231", "0.7187005", "0.71281374", "0.69619054", "0.6949236", "0.69278073", "0.6916967", "0.69163436", "0.68140167", "0.6805971", "0.67985916"...
0.0
-1
Prints a standard message on the center of the screen.
def print_message(self, message, color): xpos = 20 ypos = self.height size = common.FONT_SIZE arcade.draw_text( text=message, start_x=xpos, start_y=ypos, anchor_x="left", anchor_y="top", width=size*len(message), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_message_center(self, message, color, size = common.FONT_SIZE):\n\n xpos = self.width / 2\n ypos = self.height / 2\n\n arcade.draw_text(\n text=message,\n start_x=xpos,\n start_y=ypos,\n anchor_x=\"center\",\n anchor_y=\"center\",...
[ "0.7416257", "0.69976014", "0.6957182", "0.6853732", "0.6829709", "0.6802697", "0.6800137", "0.67832273", "0.6777272", "0.67504114", "0.6736794", "0.6713273", "0.66919696", "0.6580516", "0.65599275", "0.65127635", "0.6510409", "0.6465604", "0.6438674", "0.64155304", "0.639979...
0.66815066
13
Prints a standard message on the center of the screen.
def print_message_center(self, message, color, size = common.FONT_SIZE): xpos = self.width / 2 ypos = self.height / 2 arcade.draw_text( text=message, start_x=xpos, start_y=ypos, anchor_x="center", anchor_y="center", align=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disp_msg(msg):\n from x84.bbs import getterminal, echo\n term = getterminal()\n echo(u''.join((u'\\r\\n\\r\\n',\n term.bold_yellow('%s ' % (msg,),),\n term.yellow_reverse_bold(u'...'),)))", "def display(self,message):\r\n \r\n print(message)", "def...
[ "0.69976014", "0.6957182", "0.6853732", "0.6829709", "0.6802697", "0.6800137", "0.67832273", "0.6777272", "0.67504114", "0.6736794", "0.6713273", "0.66919696", "0.66815066", "0.6580516", "0.65599275", "0.65127635", "0.6510409", "0.6465604", "0.6438674", "0.64155304", "0.63997...
0.7416257
0
calculate sum of an arithmetic series
def sumArithmeticSeries(a: float, d: float, n: int) -> float: return (a + d * (n + 1) / 2) * n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summation(self):\n return sum(self.read_ints())", "def lucas():\n return sum_series(a=2, b=1)", "def sum_series(input,input1=0,input2=1):\n\n if input == 0:\n\n return input1\n\n elif input == 1:\n\n return input2\n\n else:\n return sum_series(input-1,input1,input2...
[ "0.6993034", "0.69815", "0.688283", "0.68464094", "0.6801101", "0.68005526", "0.67945546", "0.67872226", "0.67829263", "0.6753748", "0.6735629", "0.671269", "0.6706957", "0.66613215", "0.66165483", "0.6597227", "0.65913415", "0.653591", "0.65300167", "0.6501468", "0.6495113",...
0.7754164
0
generator of palindrome numbers
def palindrome(length: int, base=10, ascending=False) -> [int_base_n]: assert isinstance(length, (int, int_base_n)) and \ length > 0 and \ isinstance(base, (int, int_base_n)) and \ base > 0 and \ isinstance(ascending, bool) if ascending: base_nums = tuple(x f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def palindromes():\n for n in count(1):\n if str(n) == str(n)[::-1]:\n yield n", "def palindromes(n: int) -> int:\n # 1 -> 2 -> 3 ... 9 -> 11 -> 22 -> 33 -> 44 .. 99 -> 101\n # 101 -> 111 -> 121 -> 131 -> ... -> 191 -> 202 -> 212\n # 989 -> 999 -> 1001 -> 1111 -> 1221\n # 9889 ->...
[ "0.8348429", "0.7954602", "0.7189286", "0.7171752", "0.7152799", "0.7046583", "0.7000723", "0.6965407", "0.6919311", "0.6829531", "0.6783352", "0.6776503", "0.6723488", "0.6710112", "0.6606414", "0.65061474", "0.6494381", "0.6444735", "0.6420949", "0.63765216", "0.6366962", ...
0.64733183
17
Get download link for 'fullsize image' from post page.
def getBestImageFromPostPage(self, url_post_page: str) -> str: self.logger.info(f'Processing post link: {url_post_page}') url_post_page_response: requests.Response = requests.get(url_post_page) url_post_page_soup = bs4.BeautifulSoup(url_post_page_response.text, 'html.parser') link_tag = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_url():", "def image(self, size):\n\n xpath = (\n f\"guidle:offerDetail/\"\n f\"guidle:images/\"\n f\"guidle:image/\"\n f\"guidle:size[@label='{size}']\"\n )\n\n images = self.find(f\"({xpath})[1]\")\n\n if not len(images):\n ...
[ "0.6327008", "0.6269483", "0.6113878", "0.61102796", "0.60789585", "0.6007917", "0.5953354", "0.59378636", "0.58799964", "0.5879115", "0.5879115", "0.5879115", "0.5847613", "0.5810503", "0.57894164", "0.5771869", "0.57622063", "0.57607496", "0.57490635", "0.5732653", "0.57279...
0.7284441
0
Download the required plugins. This could be further optimized to not download plugins from hashicorp, but rather have them in a local repository or host them in s3, and get them from an internal s3 endpoint so no transit charges are incurred. Ideally these would be stored between runs, and only downloaded if the versi...
def download(self): opsys, machine = get_platform() _platform = f"{opsys}_{machine}" plugin_dir = f"{self._temp_dir}/terraform-plugins" if not os.path.isdir(plugin_dir): os.mkdir(plugin_dir) for name, details in self._plugins.items(): uri = get_url(name,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_plugin(name):\n uri = 'https://github.com/drupdates/' + name + '.git'\n plugins_dir = Utils.check_dir(os.path.join('~', '.drupdates', 'plugins'))\n if not bool(urlparse(uri).netloc):\n msg = (\"Error: {0} url, {1}, is not a valid url\").format(name, uri)\n ra...
[ "0.6225477", "0.59348255", "0.5842934", "0.57953465", "0.56163293", "0.5611161", "0.56031275", "0.55901814", "0.5579805", "0.5489152", "0.54172784", "0.53859395", "0.534883", "0.53290915", "0.5310142", "0.5280209", "0.5275105", "0.5265479", "0.52341837", "0.5219002", "0.52128...
0.7384177
0
Determine the URL for the plugin get URL returns a fully qualifed URL, including the file name. In order to support third party terraform plugins we can not assume the hashicorp repository. It will function as a default, but if baseURL is provided in the plugin settings it will be used instead. The logic to determine t...
def get_url(name, details): opsys, machine = get_platform() _platform = f"{opsys}_{machine}" try: version = details["version"] except KeyError: raise KeyError(f"version must be specified for plugin {name}") # set the file name, allow it to be overridden with key "filename" defa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lookup_url(self, endpoint, values):\r\n try:\r\n cont = self.get_container(values['container'])\r\n if cont.cdn_enabled:\r\n return \"%s/%s\" % (cont.cdn_uri, values['filename'])\r\n else:\r\n return None\r\n except: # pragma: no cov...
[ "0.63869417", "0.6342273", "0.6285669", "0.6284974", "0.6251849", "0.6093768", "0.60814553", "0.60057205", "0.59900135", "0.5964348", "0.5945991", "0.5882117", "0.58723116", "0.5864827", "0.58446056", "0.57898134", "0.57750696", "0.57712436", "0.57586366", "0.5744491", "0.574...
0.67948735
0
create a barcode for a single song rendition
def song_barcode( start_times, stop_times, labels, label_dict, label_pal_dict, resolution=0.01 ): begin = np.min(start_times) end = np.max(stop_times) trans_list = ( np.zeros(int((end - begin) / resolution)).astype("str").astype("object") ) # print(end, begin, end-begin, resolution, len(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def barcode(self, uuid):\n\n barcode = code128.Code128(str(uuid), barWidth=1, barHeight=20)\n barcode.drawOn(self.canvas, self.lastx, self.lasty)\n self.lasty = self.lasty - 20\n self.y = self.lasty", "def indv_barcode(indv_df, time_resolution=0.02, label=\"labels\", pal=\"tab20\"):\n...
[ "0.68676907", "0.630903", "0.6261808", "0.6133752", "0.6093614", "0.60600394", "0.5905044", "0.58722", "0.57184905", "0.5687137", "0.5635782", "0.563578", "0.5634711", "0.5564497", "0.5413295", "0.5392579", "0.5379706", "0.5376381", "0.53568125", "0.53502846", "0.53476876", ...
0.62017655
3
Create a barcode list for an individual
def indv_barcode(indv_df, time_resolution=0.02, label="labels", pal="tab20"): unique_labels = indv_df[label].unique() # song palette label_pal = np.random.permutation(sns.color_palette(pal, len(unique_labels))) label_dict = {lab: str(int(i)).zfill(3) for i, lab in enumerate(unique_labels)} label_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def barcodeGenerator(startcode, nos):\r\n barcodelist = []\r\n twelvedigitbarcode = startcode\r\n for i in range(nos):\r\n fullbarcode = checkBarcode(str(twelvedigitbarcode))\r\n delimitedbarcode = formatBarcode(fullbarcode)\r\n barcodelist.append(delimitedbarcode)\r\n twelvedi...
[ "0.7306183", "0.6281274", "0.5986188", "0.57828575", "0.5732538", "0.5687415", "0.55903304", "0.5537818", "0.5532379", "0.55294156", "0.53707147", "0.53618526", "0.5361751", "0.5361216", "0.53243667", "0.5322484", "0.53220266", "0.5312362", "0.53032684", "0.52984077", "0.5243...
0.530285
19
cluster and plot barcodes sorted max_list_len = 600 maximum length to visualize seq_len = 100 maximumim length to compute lev distance nex = 50 only show up to NEX examples
def plot_sorted_barcodes( color_lists, trans_lists, max_list_len=600, seq_len=100, nex=50, n_jobs=-1, figsize=(25, 6), ax=None, ): # subset dataset color_lists = color_lists[:nex] trans_lists = trans_lists[:nex] # get length of lists list_lens = [len(i) for i in tran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_closeness_barplot(seqidss,alis,legend,colors=None,limsy=[0,1],out=None,clusterings=None,annot=True):\n newpats = seqidss.keys()\n fig, ax = plt.subplots()\n rects= [None] * len(alis)\n labels=[]\n total_width=0.8\n single_width=1.\n n_bars = len(alis)\n bar_width = total_width / n_...
[ "0.63014865", "0.622572", "0.6131941", "0.610015", "0.6085125", "0.60024273", "0.58642226", "0.58315736", "0.58116525", "0.5795409", "0.5707317", "0.5677819", "0.5658275", "0.5657415", "0.5653653", "0.5599543", "0.55906355", "0.5577528", "0.5559556", "0.55501115", "0.55470383...
0.7542305
0
Convert a datetime to a different format so it can be accessible in Jinja.
def datetimefilter(value, format='%b %d'): return value.strftime(format)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_datetime(value, format=\"datetime\"):\n if format == \"datetime\":\n render_as = value.strftime(\"%d/%m/%Y %H:%M\")\n elif format == \"date\":\n render_as = value.strftime(\"%d/%m/%Y\")\n elif format == \"time\":\n render_as =...
[ "0.73895514", "0.7053604", "0.69976836", "0.6970745", "0.69488513", "0.68443584", "0.6805817", "0.6787198", "0.676419", "0.6692726", "0.66346955", "0.6610277", "0.6608763", "0.6596385", "0.65597314", "0.6558347", "0.6536109", "0.65202", "0.6515687", "0.65024954", "0.64961064"...
0.6137935
47
Show list of users.
def user_list(): users = User.query.all() return render_template("user_list.html", users=users)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show():\n return render_template(\n 'listUsers.html',\n title='List Users',\n message='These are the users in our system'\n )", "def show_users():\n\n user = User(connection=connection, cursor=cursor)\n\n all_users = user.get_all_users()\n\n context = {\n 'all_users...
[ "0.85589206", "0.8499164", "0.8494431", "0.8487274", "0.8487274", "0.8487274", "0.8487274", "0.8487274", "0.8487274", "0.84778", "0.8453244", "0.83147424", "0.8297733", "0.82169145", "0.81915414", "0.814934", "0.8144295", "0.80760515", "0.7961692", "0.78960663", "0.78506345",...
0.85248625
1
Show signup and login forms.
def show_forms(): return render_template("signup_login.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_loginpage():\n login_form = LoginForm()\n register_new_user_form = RegisterForm()\n\n return render_template('loginpage.html',\n register_new_user_form = register_new_user_form,\n login_form = login_form)", "def show_home_page():\n\n l...
[ "0.7689611", "0.7283937", "0.71204764", "0.7066128", "0.7028701", "0.6924456", "0.69143254", "0.6910931", "0.68288296", "0.6817515", "0.6806173", "0.68048626", "0.6789656", "0.6769239", "0.6722788", "0.6701515", "0.665919", "0.6642516", "0.6638974", "0.6620808", "0.6572773", ...
0.8373746
0
Check if user exists in database, otherwise add user to database.
def signup(): # Get values from signup form signup_email = request.form.get("signup_email") signup_password = request.form.get("signup_password") # If user exists, ask them to log in # Otherwise, add user into database and log them in, redirecting to homepage if db.session.query(User).filter(U...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_user_in_database():\n if 'email' in login_session:\n user_exists = session.query(exists().where(User.email == login_session['email'])).scalar()\n if not user_exists:\n user = User(\n id=login_session['userid'],\n picture=login_session['picture'],...
[ "0.7747196", "0.7268726", "0.7188287", "0.7133543", "0.70959985", "0.696378", "0.695143", "0.69329673", "0.69168264", "0.6895907", "0.68705595", "0.6847138", "0.68230367", "0.681129", "0.6755071", "0.6740991", "0.6705746", "0.6677609", "0.6666903", "0.66574514", "0.6639832", ...
0.0
-1
Check if user's email matches password, otherwise ask user to try again.
def login(): # Get values from login form login_email = request.form.get("login_email") login_password = request.form.get("login_password") # If user's email and password matches, log them in, redirecting them to homepage # Otherwise, ask them to log in with the correct password if db.sess...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_auth(email, password):\n try:\n user = User.get(User.email == email)\n except User.DoesNotExist:\n return False\n return encrypted_password(email, password) == user.password", "def login_existing_user(email):\n pword = input(\"Password: \")\n menu.option_to_exit(pword)\n ...
[ "0.73173356", "0.7232042", "0.71635646", "0.7114566", "0.6984003", "0.6955871", "0.6948102", "0.6915943", "0.6872946", "0.686995", "0.6838808", "0.67787164", "0.6772176", "0.6749836", "0.6658859", "0.6643402", "0.6631053", "0.65503585", "0.654906", "0.65341157", "0.65011936",...
0.0
-1
Show list of movies.
def movie_list(): # sort movie titles alphbetically movies = Movie.query.order_by(Movie.title).all() return render_template("movie_list.html", movies=movies)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def movie_list():\n\n movies = Movie.query.order_by(\"title asc\").all()\n return render_template(\"/movie_list.html\", movies=movies)", "def movie_list():\n\n movies = Movie.query.order_by(Movie.title).all()\n\n return render_template(\"movie_list.html\", movies=movies)", "def movie_list():\n\n ...
[ "0.77884346", "0.77881587", "0.7738609", "0.7738429", "0.7459214", "0.7193967", "0.7042107", "0.69520515", "0.68291026", "0.6809898", "0.6801339", "0.6761189", "0.6752064", "0.6726022", "0.66703576", "0.6598783", "0.65832853", "0.6565718", "0.6530468", "0.6495098", "0.6466756...
0.7603819
4
Show movie information. If a user is logged in, let them add/edit a rating.
def movie_profile(movie_id): if not session.get('logged_in_user_email'): flash("Please login or signup to see the movie details and rate the movie!", "danger") return redirect("/signup-login") else: # import pdb; pdb.set_trace(); # Query by movie id to return that record in database ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_movie_profile(movie_id):\n\n # movie object given a movie_id\n movie = Movie.query.filter_by(movie_id=movie_id).first()\n\n # list of all rating objects for a given movie_id ordered by user_id\n sorted_ratings = Rating.query.filter_by(movie_id=movie_id).order_by('user_id').all()\n\n return ...
[ "0.7425339", "0.70597625", "0.67604744", "0.6752828", "0.65363955", "0.6489415", "0.63949174", "0.63493246", "0.63240063", "0.62140155", "0.62104696", "0.6161784", "0.6048151", "0.60399383", "0.5976016", "0.5972641", "0.59487784", "0.5897635", "0.576891", "0.5757265", "0.5733...
0.6689333
4
Get user rating score for movie
def rate_movie(movie_id): user_rating = request.args.get("user_rating") # get user id from log in email address user_email = session["logged_in_user_email"] user = User.query.filter(User.email == user_email).one() user_id = user.user_id # Check if user rating exists in database # If user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_user_movie_rating(self, user_id, movie_id):\n rating = self.ratings[(self.ratings['user_id'] == user_id) &\n (self.ratings['movie_id'] == movie_id)]['rating'].iloc[0]\n user_mean = self.get_mean_user_rating(user_id)\n return rating - user_mean", "def _im...
[ "0.77090836", "0.71592355", "0.7027903", "0.7013615", "0.695972", "0.6877569", "0.68583083", "0.68279237", "0.6810187", "0.6798399", "0.6797215", "0.6778644", "0.67558587", "0.6726565", "0.6719133", "0.66899735", "0.66174775", "0.6602134", "0.65898967", "0.65773505", "0.65695...
0.724304
1
Verifies note relates to plugin
def is_plugin_note(self, note): return bool(self.regex.match(note))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_plugin_note(self, note):\n return False", "def do_verify(self, args):\n\n pn = \\\n self._get_choice_(\"pn\", self.promissory_notes, \"Which promissory note needs to be verified?\")\n\n try:\n verify_promissory_note(pn)\n except Exception as e:\n ...
[ "0.7556671", "0.6580029", "0.6136503", "0.6118982", "0.5944517", "0.5837426", "0.5812538", "0.57490134", "0.56331164", "0.5561102", "0.54762745", "0.54538786", "0.54308194", "0.5426283", "0.5417236", "0.5407975", "0.53728557", "0.5362797", "0.5331794", "0.532545", "0.53213567...
0.7009839
1
Constructor for user object
def __init__(self, username, email, password): self.username = username self.email = email self.password = password self.shopping_lists = [] self.details = { 'username': self.username, 'email': self.email, 'password': self.password, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, user):\n\n if isinstance(user, dict):\n # Every user must have these values\n self.id = user['id']\n self.name = user['first_name']\n\n # These are optional\n self.username = user.get('username', None)\n self.last_name = us...
[ "0.8304543", "0.81596994", "0.8035067", "0.771955", "0.76616305", "0.7616874", "0.7480621", "0.7471673", "0.7441283", "0.7434855", "0.735118", "0.73392403", "0.7297928", "0.72951806", "0.72938484", "0.7272118", "0.7250003", "0.7245502", "0.7236811", "0.7202637", "0.7182056", ...
0.0
-1
method to eturn detais of a user
def get_details(self): return self.details
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user():", "def user(self):", "def delete_user():", "def getdat(user):\r\n profile = user.profile\r\n return [user.username, user.email] + [getattr(profile, xkey, '') for xkey in profkeys]", "def get_one_user():", "def user(self):\n pass", "def get_substitute_for(userid)...
[ "0.5763943", "0.57156515", "0.5403091", "0.540138", "0.53595936", "0.5317143", "0.53007597", "0.52571297", "0.51684153", "0.5136397", "0.5131427", "0.5111031", "0.51005715", "0.5090512", "0.5085597", "0.5060329", "0.50537497", "0.50509906", "0.49998719", "0.49847186", "0.4971...
0.0
-1
Method to return the shoppinglist details
def get_details(self): return self.details
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_details(self):", "def get_shopping_list(shopping_list_id):\n return ShoppingList.query.filter_by(id=shopping_list_id).first()", "def get_listing_information():\n\n #getting the guidebox_id variable from show_page.html\n guidebox_id = request.args.get(\"guidebox_id\")\n\n #get the show from ...
[ "0.67517954", "0.6617953", "0.6463465", "0.6456425", "0.6154193", "0.6107112", "0.6065685", "0.60076445", "0.5976875", "0.5967373", "0.5946771", "0.58839685", "0.5838681", "0.5831319", "0.5815296", "0.57997787", "0.57901776", "0.5783438", "0.57500154", "0.57390434", "0.573623...
0.59535605
12
Method to return the shoppingitems details
def get_details(self): return self.details
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item_info(self, item_id):\n request_name = \"get_shop_info\"\n\n items = self.make_request(request_name, url_id=item_id)\n try:\n item = items[0]\n item_dict = dict()\n item_dict[\"id\"] = item[\"@id\"].encode('utf-8')\n item_dict[\"name\"] =...
[ "0.70740557", "0.6787687", "0.6487726", "0.6465517", "0.6392381", "0.6378292", "0.6360094", "0.6354985", "0.63388884", "0.63163316", "0.6229787", "0.621592", "0.6208339", "0.6152231", "0.61246663", "0.60738504", "0.6065651", "0.60508513", "0.6032842", "0.6032336", "0.6027875"...
0.0
-1
Method to register users to the application
def add_user(self, username, email, password): new_user = User(username, email, password) new_user_details = new_user.get_details() for user in self.users: if new_user_details['email'] == user['email']: return 'User already exists' else: n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_user():\n pass", "def register_user(self):\n User.add_user(User(self.email.data, self.password.data))", "def user_register():\n \n data = user_obj.user_register(request.forms) \n return data", "def register(self):\r\n if self.fields_not_empty(request, [\"fi...
[ "0.8238461", "0.75054044", "0.73637265", "0.7316127", "0.73068404", "0.7301562", "0.7226007", "0.7165711", "0.711404", "0.7102481", "0.708382", "0.7040167", "0.7038837", "0.7032005", "0.7025324", "0.7017301", "0.7014402", "0.7011308", "0.6967189", "0.69352347", "0.68763584", ...
0.0
-1
Method to return a single user base on a given id
def get_single_user(self, id): for user in self.users: if user['id'] == id: return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(id):\n return User.query.filter_by(id=id).first()", "def get_user_by_id(self, id):\n\t\treturn self.users.get(id)", "def find_by_id(cls, _id):\n user = cls.query.filter_by(id=_id).first()\n return user", "def get_user(id):\n pass", "def find_user_by_id(id: str) -> User:\n\n ...
[ "0.87406313", "0.87194085", "0.86879575", "0.8629455", "0.8574395", "0.854622", "0.84706885", "0.84516245", "0.8389576", "0.8380215", "0.83528787", "0.8348613", "0.82819223", "0.8277447", "0.82162476", "0.82110035", "0.82092386", "0.81851685", "0.8184536", "0.8169312", "0.816...
0.8726376
1
Method to add shoppinglists to a user given the id of the user
def add_shoppinglist(self, user_id, name): new_shoppinglist = ShoppingList(name) new_shoppinglist_details = new_shoppinglist.get_details() user = self.get_single_user(user_id) new_shoppinglist_details['id'] = len(user['shopping_lists']) + 1 for item in user['shopping_lists']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_list(\n cls,\n name,\n user_id\n ):\n lists_collection = taskify['lists']\n new_list = {\n \"name\": name,\n \"user_id\": ObjectId(user_id)\n }\n list_id = lists_collection.insert_one(new_list).inserted_id\n return new_list, l...
[ "0.70197177", "0.6928091", "0.6893969", "0.6640007", "0.65025365", "0.63162696", "0.63162696", "0.6252361", "0.6190899", "0.61247694", "0.6122644", "0.61040664", "0.609208", "0.60793847", "0.6048757", "0.59860486", "0.5969656", "0.5946343", "0.5872412", "0.58569", "0.5841051"...
0.7700489
0