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
Finds all complete figurate cycles for given svalues.
def figurate_cycles(*s_vals): assert len(s_vals) > 1 #incomplete sanity check # Since a DFS has to start SOMEWHERE and we're looking for cycles, we # arbitrarily take the first list of figurates and use them as the # roots of our search. roots = figurate_list(s_vals[0]) # Make a big list of all ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all_cycles(s,graph):\n\n grph = u.edge_to_list_dict(graph)\n node_cnt = len(grph)\n k = z.Int(\"k\")\n syms = [z.Int('node%s'%i) for i in range(node_cnt)]\n\n # s.add(syms[0] == 0) # start node is a 0\n s.add(k < node_cnt)\n s.add(k > 1)\n\n o = z.Optimize()\n\n #...
[ "0.6175425", "0.57670933", "0.5475402", "0.53936297", "0.5329402", "0.522589", "0.52258706", "0.5211429", "0.51233554", "0.5099929", "0.5068521", "0.5063437", "0.5032627", "0.5028338", "0.49907324", "0.4966183", "0.49148342", "0.49041694", "0.48915786", "0.4890928", "0.488326...
0.7913429
0
Depthfirst search for cycle finding
def find_all_cycles(candidates, new_elem, path=[]): def have_cycle(candidates, path): """ Checks that when we have no more candidates, that our path 'endpoints' are cyclical. """ return (not candidates and path[0].prefix == path[-1].suffix) def have_dead_end(candidates, new_ele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depthFirstSearch(problem):\r\n \"*** YOUR CODE HERE ***\"\r\n node = problem.getStartState()\r\n if (problem.isGoalState(node)):\r\n return [] # no need to make any moves of the start state is goal\r\n start = (node, 'NoDirection',0)\r\n\r\n frontier_queue = Stack() # queue for frontier\r\n frontier_q...
[ "0.72399324", "0.7194816", "0.7168289", "0.71484697", "0.7130135", "0.70507145", "0.7048199", "0.7036242", "0.70055723", "0.7004626", "0.69954205", "0.69783103", "0.69622517", "0.6950441", "0.6899392", "0.68852323", "0.6877258", "0.68730253", "0.6850732", "0.68145895", "0.679...
0.0
-1
Checks that when we have no more candidates, that our path 'endpoints' are cyclical.
def have_cycle(candidates, path): return (not candidates and path[0].prefix == path[-1].suffix)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_paths(self):\n for path in self.paths:\n # check that arc starts at s\n arc = path[0]\n arc_start = self.arc_info[arc][\"start\"]\n assert(arc_start == self.source()), \"Path does not start at s\"\n # check that internal arcs are valid\n ...
[ "0.64591026", "0.64028496", "0.62922645", "0.6263719", "0.62504596", "0.6250248", "0.62022024", "0.6092906", "0.60610884", "0.6022989", "0.6006082", "0.5956604", "0.595369", "0.5885716", "0.58702284", "0.58571595", "0.5837033", "0.5828162", "0.5810018", "0.5783266", "0.576298...
0.6560611
0
Checks that we have at least one candidate whose prefix is cyclical with the new element's suffix.
def have_dead_end(candidates, new_elem): return new_elem.suffix not in map(lambda x: x.prefix, candidates)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def have_cycle(candidates, path):\n return (not candidates and path[0].prefix == path[-1].suffix)", "def find_all_cycles(candidates, new_elem, path=[]):\n \n def have_cycle(candidates, path):\n \"\"\" Checks that when we have no more candidates, that our path\n 'endpoints' are cyclical...
[ "0.688956", "0.67497593", "0.6492469", "0.58144426", "0.57607526", "0.57607526", "0.57380426", "0.5663673", "0.56448567", "0.55977595", "0.5587944", "0.55387944", "0.55290985", "0.54872364", "0.5447168", "0.5441908", "0.5441635", "0.5411554", "0.5400539", "0.53535", "0.532922...
0.69614404
0
Returns a new list where all sgonal candidates have been removed.
def remove_sgons(s_value, candidates): return list(filter(lambda x: x.s != s_value, candidates))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup():\n for s in [missiles, explosions, bonus]:\n\n set_to_remove = set([])\n for m in s:\n if m.isDead:\n set_to_remove.add(m)\n\n s.difference_update(set_to_remove)", "def rm(x, l):\n return [y for y in l if x != y]", "def removed_vms(self) -> Lis...
[ "0.62687725", "0.6201206", "0.61726826", "0.6111378", "0.60760725", "0.6075531", "0.6048856", "0.59979814", "0.59737307", "0.59074605", "0.59073585", "0.5861006", "0.58275676", "0.58228827", "0.5821122", "0.58096284", "0.57756793", "0.577101", "0.5767358", "0.57616895", "0.57...
0.718452
0
Grows and then returns a binary decision tree.
def growDecisionTreeFrom(rows, evaluationFunction=entropy): if len(rows) == 0: return DecisionTree() currentScore = evaluationFunction(rows) bestGain = 0.0 bestAttribute = None bestSets = None columnCount = len(rows[0]) - 1 # last column is the result/target column for col in range(0, co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_tree(rows: list) -> DecisionNode or Leaf:\n info_gain, question = get_best_split(rows)\n\n # If no info is gained just return a leaf node with remaining rows\n if info_gain == 0:\n return Leaf(rows)\n\n true_rows, false_rows = partition(rows, question)\n false_branch = build_tree(fa...
[ "0.73607105", "0.7327917", "0.72056544", "0.69596493", "0.69034684", "0.68098634", "0.6802638", "0.6777719", "0.6634053", "0.65713704", "0.64563805", "0.64558756", "0.64070386", "0.63814086", "0.63564616", "0.62751037", "0.6235292", "0.620463", "0.61548716", "0.6144888", "0.6...
0.6963232
3
Prunes the obtained tree according to the minimal gain (entropy or Gini).
def prune(tree, minGain, evaluationFunction=entropy, notify=False): # recursive call for each branch if tree.trueBranch.results == None: prune(tree.trueBranch, minGain, evaluationFunction, notify) if tree.falseBranch.results == None: prune(tree.falseBranch, minGain, evaluationFunction, notify) # merge ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prune( tree, impurity_crit, dataSet, treeSeq ):\n\n\t\tsaved = {}\n\n\t\ttotal_leaf_impurity, num_leaves = DecisionTree._fetch(tree, impurity_crit, dataSet, saved)\n\n\t\tnodes, sets, G = saved['node'], saved['set'], saved['G']\n\n\t\t# choose TreeNode such that g is minimum to prune\n\t\tmin_g_ind = np.argmi...
[ "0.71780753", "0.6755928", "0.6264333", "0.6245853", "0.61987823", "0.61671454", "0.6129602", "0.6123983", "0.6105711", "0.60467637", "0.603748", "0.599225", "0.5975164", "0.5917185", "0.5786919", "0.5713195", "0.5691192", "0.5679927", "0.56610376", "0.5647163", "0.56247056",...
0.7445959
0
Classifies the observationss according to the tree.
def classify(observations, tree, dataMissing=False): def classifyWithoutMissingData(observations, tree): if tree.results != None: # leaf return tree.results else: v = observations[tree.col] branch = None #if isinstance(v, int) or isinstance(v, float)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify(observation,tree):\n if tree.results!=None:\n return tree.results\n else:\n v=observation[tree.col]\n branch=None\n if isinstance(v, int) or isinstance(v, float):\n if v>=tree.value:\n branch=tree.tb\n else: \n branc...
[ "0.64260566", "0.628646", "0.6179566", "0.61025393", "0.6020093", "0.5886732", "0.58653593", "0.58054006", "0.5720676", "0.5713302", "0.5651006", "0.553406", "0.5490271", "0.5489133", "0.5437679", "0.5431709", "0.53708494", "0.52685785", "0.5266328", "0.5201875", "0.51812655"...
0.60514915
4
Plots the obtained decision tree.
def plot(decisionTree): def toString(decisionTree, indent=''): if decisionTree.results != None: # leaf node return str(decisionTree.results) else: if isinstance(decisionTree.value, int) or isinstance(decisionTree.value, float): decision = 'Column %s: x >= %s?...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_decision_tree(classifier, feature_names=None, class_names=None):\n fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(4, 4))\n tree.plot_tree(\n classifier,\n feature_names=feature_names,\n class_names=class_names,\n rounded=True,\n filled=True,\n )\n fig.sh...
[ "0.7786561", "0.7618409", "0.7559046", "0.73626286", "0.7209401", "0.70228016", "0.6984339", "0.67858964", "0.6662463", "0.66269195", "0.6623892", "0.6618223", "0.65958834", "0.65787435", "0.65618527", "0.6497789", "0.64806896", "0.6466314", "0.6460015", "0.6435375", "0.63971...
0.7129504
5
Loads a CSV file and converts all floats and ints into basic datatypes.
def loadCSV(file): def convertTypes(s): s = s.strip() try: return float(s) if '.' in s else int(s) except ValueError: return s reader = csv.reader(open(file, 'rt')) return [[convertTypes(item) for item in row] for row in reader]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadCSV(input_file):", "def load_csv():\n df = pd.read_csv(datafolder+filename, decimal=decimal).astype(\n {'min': 'float', 'max': 'float'})\n return df", "def place_types_read_csv(self, csv_input):\n csv_data = pd.read_csv(csv_input, encoding='UTF-8', sep=',', na_values=[''])\n ...
[ "0.7278124", "0.7128511", "0.7073164", "0.6921024", "0.69140124", "0.6835938", "0.6834292", "0.68103707", "0.6777402", "0.6776886", "0.674985", "0.67280674", "0.6687896", "0.6687714", "0.66312677", "0.6607438", "0.65860206", "0.6575137", "0.65615463", "0.6559472", "0.6544173"...
0.7568201
0
Ban an ip from all DDNet servers. Minutes need to be greater than 0.
async def global_ban(self, ctx: commands.Context, ip: str, name: str, minutes: int, *, reason: clean_content): await self._global_ban(ctx, ip, name, minutes, reason)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ban_host(self, host, hard=False, duration=None):\n # TODO: Timed bans?\n logger.verbose(\"Banning IP {0}\".format(host))\n self.ip_bans.add(host, hard)", "def ban_all():\n sudo(\"varnishadm 'ban req.url ~ .'\")", "def test_exclude_ip_ban(self):\n pass", "def ban_ip(self, ip...
[ "0.7068072", "0.68500394", "0.61785233", "0.6124741", "0.60522395", "0.5987351", "0.5956545", "0.581452", "0.5770357", "0.5694431", "0.55829155", "0.5578588", "0.55710304", "0.5567556", "0.5565699", "0.5553093", "0.5491359", "0.5439812", "0.5364005", "0.5349952", "0.533009", ...
0.5913455
7
Ban an ip from all DDNet servers in given region. Minutes need to be greater than 0. Region needs to be the 3 char server code.
async def global_ban_region(self, ctx: commands.Context, region: str, ip: str, name: str, minutes: int, *, reason: clean_content): await self._global_ban(ctx, ip, name, minutes, reason, region)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exclude_ip_ban(self):\n pass", "def ban_host(self, host, hard=False, duration=None):\n # TODO: Timed bans?\n logger.verbose(\"Banning IP {0}\".format(host))\n self.ip_bans.add(host, hard)", "async def global_unban(self, ctx: commands.Context, *, name: str):\n if re.m...
[ "0.5752577", "0.5619576", "0.5450576", "0.54234755", "0.5233336", "0.5208012", "0.51359165", "0.51315814", "0.5063948", "0.4974001", "0.4927776", "0.48956954", "0.48733237", "0.48646176", "0.4827561", "0.48271024", "0.48046353", "0.4773166", "0.47669205", "0.47156936", "0.471...
0.6312553
0
Unban an ip from all DDNet servers. If you pass a name, all currently globally banned ips associated with that name will be unbanned.
async def global_unban(self, ctx: commands.Context, *, name: str): if re.match(r'^[\d\.-]*$', name) is None: query = 'SELECT ip FROM ddnet_bans WHERE name = $1;' ips = [r['ip'] for r in await self.bot.pool.fetch(query, name)] if not ips: return await ctx.send(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def unban(self, ctx, name: str):\n try:\n bans = await self.bot.get_bans(ctx.message.server)\n user = discord.utils.get(bans, name=name)\n if user is not None:\n await self.bot.unban(ctx.message.server, user)\n except discord.Forbidden:\n ...
[ "0.69601077", "0.62606454", "0.62166715", "0.5990166", "0.5937297", "0.59223866", "0.5848375", "0.5733963", "0.5713095", "0.5705937", "0.57039034", "0.5630587", "0.56287026", "0.5598197", "0.55778", "0.5549266", "0.55139863", "0.547942", "0.54626197", "0.5460259", "0.5442353"...
0.8504455
0
Show all currently globally banned ips
async def global_bans(self, ctx: commands.Context): admin_cog = self.bot.get_cog('Admin') query = """SELECT ip, name, to_char(expires, \'YYYY-MM-DD HH24:MI\') AS expires, reason, mod, region FROM ddnet_bans ORDER BY expires; """ await admin_cog.sql(ctx, query=q...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBanIps(self):\n banned = []\n q = \"\"\"SELECT clients.ip as target_ip FROM penalties INNER JOIN clients ON penalties.client_id = clients.id\n WHERE penalties.type = 'Ban' AND penalties.inactive = 0 AND penalties.time_expire = -1\n GROUP BY clients.ip\"\"\"\n ...
[ "0.72004414", "0.6599594", "0.657093", "0.6570719", "0.6473562", "0.6393452", "0.63146794", "0.60255736", "0.59439915", "0.58867484", "0.58601767", "0.58601767", "0.5859019", "0.58225703", "0.58142954", "0.5804886", "0.5790678", "0.57876307", "0.5770729", "0.5734063", "0.5714...
0.63579273
6
Returns the internal identifier of the managed folder, which is a 8character random string, not to be confused with the managed folder's name.
def id(self): return self.odb_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_id(self):\r\n buildfile_relpath = os.path.dirname(self.address.buildfile.relpath)\r\n if buildfile_relpath in ('.', ''):\r\n return self.name\r\n else:\r\n return \"%s.%s\" % (buildfile_relpath.replace(os.sep, '.'), self.name)", "def directory_id(self) -> pulumi.Output[str]:\n ...
[ "0.65704453", "0.646924", "0.642653", "0.63661224", "0.6347965", "0.6327185", "0.63253933", "0.62791514", "0.62302345", "0.6227704", "0.6227704", "0.62033147", "0.61708695", "0.6147371", "0.6134929", "0.6116909", "0.6108815", "0.6105652", "0.6101452", "0.607058", "0.607058", ...
0.0
-1
Delete the managed folder from the flow, and objects using it (recipes or labeling tasks)
def delete(self): return self.client._perform_empty( "DELETE", "/projects/%s/managedfolders/%s" % (self.project_key, self.odb_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, flow):\n for parent in self.parents:\n parent.children.remove(self)\n for child in self.children:\n child.parents.remove(self)\n\n flow.blocks.remove(self)", "def delete(self):\n\n del self.parent_mirror_dir[self.cvs_path]", "def delete(self):\n ...
[ "0.63252056", "0.62532264", "0.62450886", "0.61435694", "0.6130529", "0.60856485", "0.607105", "0.6004742", "0.5986059", "0.5971468", "0.59638786", "0.5947553", "0.5935784", "0.590764", "0.58886117", "0.58870596", "0.58690304", "0.5862892", "0.5856957", "0.58366543", "0.58277...
0.5729521
32
Get the definition of this managed folder. The definition contains name, description checklists, tags, connection and path parameters, metrics and checks setup.
def get_definition(self): return self.client._perform_json( "GET", "/projects/%s/managedfolders/%s" % (self.project_key, self.odb_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_definition(self):\n return self.definition", "def get_definition(self):\n return self.client._perform_json(\n \"GET\", \"/admin/groups/%s\" % self.name)", "def definition(self):\n\n return self._definition", "def definition(self):\n\n return self._definition", ...
[ "0.5817693", "0.57296735", "0.5583368", "0.5583368", "0.5496289", "0.5493704", "0.5425934", "0.5191441", "0.51887023", "0.51887023", "0.51505697", "0.5133599", "0.5114542", "0.511077", "0.510388", "0.50844294", "0.5081377", "0.5072677", "0.5038703", "0.5038015", "0.50089884",...
0.65869796
0
Set the definition of this managed folder.
def set_definition(self, definition): return self.client._perform_json( "PUT", "/projects/%s/managedfolders/%s" % (self.project_key, self.odb_id), body=definition)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def definition(self, definition):\n\n self._definition = definition", "def set_definition(self, definition):\n return self.client._perform_json(\n \"PUT\", \"/admin/groups/%s\" % self.name,\n body = definition)", "def _set_definition(self, definition: Dict[str, Any]):\n ...
[ "0.6675459", "0.6660227", "0.63897157", "0.6099818", "0.60483444", "0.5964043", "0.58501714", "0.5540315", "0.55372936", "0.5477834", "0.5394551", "0.5355961", "0.5321546", "0.53073615", "0.5296438", "0.5226685", "0.52230346", "0.52160645", "0.5206463", "0.5166973", "0.515407...
0.7764521
0
Get the list of files in the managed folder
def list_contents(self): return self.client._perform_json( "GET", "/projects/%s/managedfolders/%s/contents" % (self.project_key, self.odb_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFiles(self):\n\t\treturn os.listdir(self.getPath())", "def listFiles(self):\n pass", "def list_dir(self, path):", "def get_files(self):\r\n return self._filelist", "def list_files():\n try:\n return jsonify(os.listdir(env(\"FILES_DIRECTORY\"))), 200\n except:\n return {...
[ "0.7972349", "0.7716443", "0.7584789", "0.7555709", "0.73637474", "0.7340221", "0.73126596", "0.7310499", "0.72796893", "0.7199038", "0.71473455", "0.7116592", "0.7082018", "0.7078788", "0.7074433", "0.7053219", "0.70311123", "0.6994967", "0.6977119", "0.6969476", "0.6964744"...
0.0
-1
Get a file from the managed folder
def get_file(self, path): return self.client._perform_raw( "GET", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, utils.quote(path)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fs_get_file(url, working_dir):\n if not os.path.isabs(url) and working_dir:\n url = os.path.join(working_dir, url)\n\n try:\n with codecs.open(url, 'r', encoding='utf-8') as f:\n return f.read()\n except Exception as e:\n raise ScrBaseExcept...
[ "0.6983217", "0.6982181", "0.67835194", "0.67477846", "0.6745828", "0.6731098", "0.66658807", "0.6599749", "0.6590214", "0.654747", "0.65451306", "0.65048134", "0.6465553", "0.64533436", "0.64236987", "0.6402294", "0.6359911", "0.6332184", "0.6332184", "0.63053685", "0.629940...
0.75442284
0
Delete a file from the managed folder
def delete_file(self, path): return self.client._perform_empty( "DELETE", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, utils.quote(path)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, filename):\n pass", "def delete_file(file_id):\n file_obj = Data.objects.get(id=file_id)\n print(\"Removing file: \", file_obj.name)\n print(file_obj.file.path)\n file_dir = file_obj.file.path\n os.remove(file_dir)\n print(\"Done.\")", "def delete(self, filename, **kw)...
[ "0.77171427", "0.7711893", "0.7555799", "0.7529862", "0.7435636", "0.7412828", "0.7405208", "0.7381543", "0.7283083", "0.72761863", "0.72573847", "0.7255518", "0.7244785", "0.7224803", "0.721601", "0.7209082", "0.718607", "0.7183738", "0.7181639", "0.7163021", "0.7153897", ...
0.7846849
0
Upload the file to the managed folder. If the file already exists in the folder, it is overwritten.
def put_file(self, path, f): return self.client._perform_json_upload( "POST", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, utils.quote(path)), "", f).json()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_upload(self):\n # print \"starting upload...\", self.current_upload['filepath']\n self.touch()\n self.log(\"STARTING_UPLOAD\", level=INFO)\n try:\n Backend.put_file(self.fileobj, self.current_upload[\"gcs_url\"])\n except exceptions.FilePutError as err:\n ...
[ "0.74072707", "0.7129274", "0.70463955", "0.6660341", "0.65970427", "0.6557907", "0.6512261", "0.65012866", "0.64963216", "0.6455349", "0.64418864", "0.64405924", "0.64309657", "0.6395738", "0.63393605", "0.6332386", "0.63101023", "0.62682", "0.62641364", "0.6259874", "0.6209...
0.63176036
16
Upload the content of a folder to a managed folder.
def upload_folder(self, path, folder): for root, _, files in os.walk(folder): for file in files: filename = os.path.join(root, file) with open(filename, "rb") as f: rel_posix_path = "/".join(os.path.relpath(filename, folder).split(os.sep)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(self, folder, recursive=True, test=False):\n return self._gphotocli_image_tasks.upload(folder, recursive, test)", "def UploadFolderToGD(token_path, source_path, gd_folder): \n google_drive = ConnectGoogleDrive(token_path)\n file_cmd = spike.FileCMD()\n file_list = file_cmd.ListFiles(so...
[ "0.6675317", "0.65023863", "0.65004486", "0.63931644", "0.6374531", "0.6330987", "0.62475437", "0.6244524", "0.61936384", "0.6177249", "0.61518073", "0.6149765", "0.6138441", "0.6122861", "0.6103507", "0.60236096", "0.6016508", "0.60020953", "0.59947294", "0.5948904", "0.5944...
0.7008945
0
Compute metrics on this managed folder.
def compute_metrics(self, metric_ids=None, probes=None): url = "/projects/%s/managedfolders/%s/actions" % (self.project_key, self.odb_id) if metric_ids is not None: return self.client._perform_json( "POST" , "%s/computeMetricsFromIds" % url, body={"me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_metrics(self):\n pass", "def compute_statistics(self):", "def collect_metrics():\n p = os.path.join(os.sep, \"mnt\", \"glusterfs\")\n mount_stats = os.statvfs(p)\n # block size * total blocks\n total_space = mount_stats.f_blocks * mount_stats.f_bsize\n free_space = mount_stats...
[ "0.7508439", "0.6544122", "0.6464246", "0.6412694", "0.6407469", "0.6334957", "0.6284569", "0.62502366", "0.62502366", "0.6228933", "0.6222924", "0.6189192", "0.6135421", "0.60870016", "0.6076569", "0.6038834", "0.60206956", "0.601785", "0.5966371", "0.59614676", "0.59115523"...
0.607636
15
Get the last values of the metrics on this managed folder.
def get_last_metric_values(self): return ComputedMetrics(self.client._perform_json( "GET", "/projects/%s/managedfolders/%s/metrics/last" % (self.project_key, self.odb_id)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last(self):\n data = self._http_get(\"last\")\n return data.json()", "def getLatestSpectrumMeasurements(self): \n return self.spectrum[len(self.spectrum)-1]", "def getLatestMeasurement(self): \n return self.measurement[len(self.measurement)-1]", "def last_value(s...
[ "0.64085966", "0.63444847", "0.63409215", "0.62631094", "0.62495613", "0.62179077", "0.61889714", "0.61730325", "0.6146713", "0.61448973", "0.6101925", "0.6096707", "0.6094985", "0.6079614", "0.60533327", "0.60533327", "0.6048", "0.6036222", "0.6022216", "0.594147", "0.593541...
0.80391484
0
Get the history of the values of a metric on this managed folder.
def get_metric_history(self, metric): return self.client._perform_json( "GET", "/projects/%s/managedfolders/%s/metrics/history" % (self.project_key, self.odb_id), params={'metricLookup' : metric if isinstance(metric, str) or isinstance(metric, unicode) else json.dumps(metric)})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value_history(self):\n return self.value_history", "def get_history(self):\n return self.history", "def history(self):\n return self.info['history']", "def get_history(self):\n return self.__history[:]", "def get_history(self):\r\n\r\n return self.board_history", "d...
[ "0.7165081", "0.7030458", "0.6927986", "0.68705124", "0.6810044", "0.6718102", "0.6691567", "0.6691567", "0.6686829", "0.6673763", "0.6653554", "0.6653554", "0.65635055", "0.65367013", "0.65315855", "0.6509732", "0.64998275", "0.6481372", "0.64430577", "0.6438002", "0.6354089...
0.77961314
0
Get the flow zone of this managed folder.
def get_zone(self): return self.project.get_flow().get_zone_of_object(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zone(self):\n return self._zone", "def access_zone(self):\n return self._access_zone", "def zone(self) -> str:\n return self._zone", "def zone(self) -> str:\n return pulumi.get(self, \"zone\")", "def zone(self) -> str:\n return pulumi.get(self, \"zone\")", "def loca...
[ "0.64082503", "0.6311886", "0.6157333", "0.6036838", "0.6036838", "0.59640765", "0.59602046", "0.5879423", "0.58616424", "0.58191", "0.5772731", "0.5772731", "0.5696067", "0.56114745", "0.55910367", "0.55511653", "0.55193275", "0.54935896", "0.5492465", "0.54857844", "0.54575...
0.75278246
0
Move this object to a flow zone.
def move_to_zone(self, zone): if isinstance(zone, basestring): zone = self.project.get_flow().get_zone(zone) zone.add_item(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_stage_to_z(self, z):\n raise NotImplementedError", "def move(self):\n pass", "def move(self):\n raise NotImplementedError", "def move_to(self, mobject_or_point):\n layer_center = self.surrounding_rectangle.get_center()\n if isinstance(mobject_or_point, Mobject):\n ...
[ "0.6282164", "0.6204604", "0.5991178", "0.5983192", "0.59183925", "0.5749237", "0.5678627", "0.5613564", "0.557024", "0.5564908", "0.55558306", "0.5479993", "0.5476635", "0.54687375", "0.545523", "0.54463863", "0.54068005", "0.53963697", "0.53693956", "0.53560627", "0.5351554...
0.72328943
0
Share this object to a flow zone.
def share_to_zone(self, zone): if isinstance(zone, basestring): zone = self.project.get_flow().get_zone(zone) zone.add_shared(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to_zone(self, zone):\n if isinstance(zone, basestring):\n zone = self.project.get_flow().get_zone(zone)\n zone.add_item(self)", "def flow(self, flow):\n\n self._flow = flow", "def update_flow(self, flow):\r\n self.flow = flow", "def transfer(self):\n pass...
[ "0.5932415", "0.59072703", "0.5562259", "0.55534965", "0.54047054", "0.53833073", "0.536776", "0.5333624", "0.5330987", "0.5305724", "0.52923506", "0.5281795", "0.5245011", "0.52386606", "0.52386606", "0.52386606", "0.5230287", "0.5215504", "0.516134", "0.5156009", "0.5132243...
0.7893951
0
Unshare this object from a flow zone.
def unshare_from_zone(self, zone): if isinstance(zone, basestring): zone = self.project.get_flow().get_zone(zone) zone.remove_shared(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpossessed(self):\r\n self.owner = None", "def unblock(self, source):\n raise NotImplementedError", "def unShare(sharedItem):\n sharedItem.store.query(Share, Share.sharedItem == sharedItem).deleteFromStore()", "def unassign_instance(InstanceId=None):\n pass", "def __del__(self):\n ...
[ "0.601934", "0.59649634", "0.59522724", "0.57343334", "0.5674939", "0.56622416", "0.5578648", "0.55039036", "0.5499391", "0.54815376", "0.5437976", "0.5432895", "0.54314196", "0.542576", "0.53983927", "0.5378879", "0.5366127", "0.53503096", "0.53274274", "0.5304955", "0.52901...
0.8114609
0
Get the recipes referencing this folder.
def get_usages(self): return self.client._perform_json("GET", "/projects/%s/managedfolders/%s/usages" % (self.project_key, self.odb_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Recipe]:\n pass", "def recipe(self):\n return self.__recipe", "def used_in_recipes(self):\n Recipe = apps.get_model('recipes','Recipe')\n values = {}\n rqset = Recipe.objects.filter(co...
[ "0.6679568", "0.6539516", "0.65215296", "0.62811166", "0.60671085", "0.6007505", "0.6002195", "0.59581256", "0.5914185", "0.58589774", "0.5787091", "0.5786681", "0.5779459", "0.5712589", "0.55811965", "0.5561164", "0.55499417", "0.5543476", "0.55397946", "0.5537948", "0.55229...
0.0
-1
Get a handle to manage discussions on the managed folder.
def get_object_discussions(self): return DSSObjectDiscussions(self.client, self.project_key, "MANAGED_FOLDER", self.odb_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_object_discussions(self):\n return DSSObjectDiscussions(self.client, self.project_key, \"RECIPE\", self.recipe_name)", "def discussion(cls, user, discussion):\n pass", "def discussion(cls, user, discussion):\r\n pass", "def get_discussion(course):\r\n\r\n # the discussion_...
[ "0.54230756", "0.5351559", "0.53328663", "0.5113142", "0.5088055", "0.5067406", "0.48653966", "0.4814929", "0.47993654", "0.47993654", "0.4738103", "0.47297895", "0.4671899", "0.4656283", "0.4654367", "0.46461034", "0.46381405", "0.46381405", "0.46381405", "0.46081758", "0.45...
0.61799204
0
Copy the data of this folder to another folder.
def copy_to(self, target, write_mode="OVERWRITE"): dqr = { "targetProjectKey" : target.project_key, "targetFolderId": target.odb_id, "writeMode" : write_mode } future_resp = self.client._perform_json("POST", "/projects/%s/managedfolders/%s/actions/copyTo" %...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_structure(self, other_directory):\n pass", "def copydir(self):\n pass", "def test_6b_copy_data_btw_folders(self):\n if (not GST.logged_in) or (not GST.data_testing_swift_mounted):\n raise unittest.SkipTest(\"Skipped for failed login or failed mounting container.\")\n ...
[ "0.7160782", "0.7094813", "0.6949282", "0.6827731", "0.6825672", "0.66936094", "0.6676309", "0.65898836", "0.6577749", "0.64167154", "0.64112085", "0.64013064", "0.6340882", "0.63154685", "0.631338", "0.6297351", "0.62772167", "0.6256891", "0.624406", "0.62394696", "0.6226650...
0.0
-1
Get the managef folder settings as a dict
def get_raw(self): return self.settings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_settings():\n settings = {}\n for setting in cfg.displayable_setting:\n settings[setting] = getattr(cfg, setting)\n return settings", "def get_settings():\n settings = {}\n for setting in cfg.displayable_setting:\n settings[setting] = getattr(cfg, setting)\n return setting...
[ "0.7012647", "0.7012647", "0.69287425", "0.67896175", "0.6693999", "0.66781723", "0.66173553", "0.6590877", "0.65876055", "0.6529215", "0.64393365", "0.6418583", "0.64123183", "0.6404648", "0.63814056", "0.63528734", "0.6349637", "0.63409376", "0.63409376", "0.63320076", "0.6...
0.5839828
55
Get the typespecific (S3/ filesystem/ HDFS/ ...) params as a dict.
def get_raw_params(self): return self.settings["params"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameter_type_dict():\n return {'filter' : filters.filter_parameters,\n 'global_options' : global_options.global_options_parameters,\n 'input_device' : input_devices.input_device_parameters,\n 'input_stream' : input_streams.input_stream_parameters,\n 'output_devi...
[ "0.69671685", "0.66325504", "0.6175945", "0.6123394", "0.6078928", "0.6034637", "0.5959918", "0.5933721", "0.58757627", "0.5868727", "0.5856003", "0.5853152", "0.58497125", "0.5848143", "0.58415884", "0.57942", "0.57708806", "0.5767855", "0.57385707", "0.573573", "0.57297975"...
0.5240058
82
Get the type of filesystem that the managed folder uses.
def type(self): return self.settings["type"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fs_type(self):\n\t\treturn call_sdk_function('PrlFsInfo_GetFsType', self.handle)", "def get_type(self):\n return self.get_udev_property('ID_FS_TYPE')", "def get_fs_type(mypath):\n\n root_type = ''\n for part in psutil.disk_partitions():\n if part.mountpoint == os.path.sep:\n ...
[ "0.76543826", "0.7496883", "0.7057454", "0.67794114", "0.676383", "0.6749858", "0.6724022", "0.6706382", "0.6657982", "0.6648063", "0.66008204", "0.6565318", "0.6494314", "0.64438534", "0.64036804", "0.63732034", "0.63719696", "0.6364353", "0.6363546", "0.63634443", "0.636344...
0.0
-1
Save the changes to the settings on the managed folder.
def save(self): self.folder.client._perform_empty( "PUT", "/projects/%s/managedfolders/%s" % (self.folder.project_key, self.folder.odb_id), body=self.settings)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n self.client._perform_empty(\"PUT\", \"/project-folders/%s/settings\" % (self.project_folder_id), body = self.settings)", "def saveSettings(self):\n self.userFiles.applyData()\n self.userPersonal.applyData()", "def save(self):\n return self.client._perform_empty(\"P...
[ "0.76129395", "0.72382766", "0.7231987", "0.7208549", "0.7072421", "0.70549095", "0.69852805", "0.6924624", "0.6886411", "0.68704027", "0.684195", "0.6815835", "0.6777165", "0.67606515", "0.6706621", "0.6703455", "0.66838694", "0.66620696", "0.66322386", "0.6589611", "0.65859...
0.7415783
1
Make the managed folder nonpartitioned.
def remove_partitioning(self): self.settings["partitioning"] = {"dimensions" : []}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createFolder(self):\n raise NotImplementedError", "def mk_filesystem(self, folder_name):\n try:\n print \"%s FOLDER\" % folder_name\n c_m.mk_directory(self.main_path, self.domain_folder_name, folder_name)\n except WindowsError:\n print \"'%s' FOLDER ALREA...
[ "0.56322306", "0.5550962", "0.5330932", "0.5274259", "0.5269054", "0.525035", "0.5235328", "0.5220792", "0.520276", "0.51945955", "0.5191268", "0.5187746", "0.5164273", "0.5148986", "0.51358706", "0.51303196", "0.51252735", "0.51183814", "0.51160645", "0.5096503", "0.5077649"...
0.5433089
2
Add a discrete partitioning dimension.
def add_discrete_partitioning_dimension(self, dim_name): self.settings["partitioning"]["dimensions"].append({"name": dim_name, "type": "value"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_partition(self):\n\t\treturn handle_to_object(call_sdk_function('PrlVmDevHd_AddPartition', self.handle))", "def add_time_partitioning_dimension(self, dim_name, period=\"DAY\"):\n self.settings[\"partitioning\"][\"dimensions\"].append({\"name\": dim_name, \"type\": \"time\", \"params\":{\"period\":...
[ "0.5996331", "0.59021497", "0.5741625", "0.563048", "0.563048", "0.55876046", "0.5564135", "0.55327845", "0.54887104", "0.5450582", "0.5427648", "0.54159683", "0.5277757", "0.5268855", "0.5246866", "0.5199661", "0.513178", "0.50552285", "0.5037322", "0.5004306", "0.49957278",...
0.8221045
0
Add a time partitioning dimension.
def add_time_partitioning_dimension(self, dim_name, period="DAY"): self.settings["partitioning"]["dimensions"].append({"name": dim_name, "type": "time", "params":{"period": period}})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_discrete_partitioning_dimension(self, dim_name):\n self.settings[\"partitioning\"][\"dimensions\"].append({\"name\": dim_name, \"type\": \"value\"})", "def add_timedim(data, date=\"1970-01-01\"):\n if isinstance(data, xr.DataArray):\n if \"time\" in data.dims:\n raise ValueErr...
[ "0.63332134", "0.6205126", "0.56875503", "0.5681772", "0.5438656", "0.5215479", "0.52103144", "0.52042055", "0.5199717", "0.5189618", "0.5118998", "0.5118998", "0.511268", "0.5108713", "0.50541395", "0.5043726", "0.50367475", "0.5027835", "0.5004906", "0.49656916", "0.4962021...
0.8382509
0
Set the partitioning pattern of the folder. The pattern indicates which paths inside the folder belong to
def set_partitioning_file_pattern(self, pattern): self.settings["partitioning"]["filePathPattern"] = pattern
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setSplitPattern(self, value):\n return self._set(splitPattern=value)", "def setSplitPattern(self, value):\n return self._set(splitPattern=value)", "def pattern(self, pattern):\n if pattern is None:\n raise ValueError(\"Invalid value for `pattern`, must not be `None`\") # no...
[ "0.6177902", "0.6177902", "0.5773725", "0.57375664", "0.5704174", "0.558471", "0.54004574", "0.522178", "0.522178", "0.5215508", "0.5176763", "0.51129144", "0.51109886", "0.5100194", "0.5096467", "0.5093923", "0.5066452", "0.5036985", "0.49579346", "0.4954718", "0.4954279", ...
0.83221745
0
Change the managed folder connection and/or path.
def set_connection_and_path(self, connection, path): if connection is not None: if connection != self.settings["params"]["connection"]: # get the actual connection type (and check that it exists) connection_info = self.folder.client.get_connection(connection).get_info...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_path_service(self, new_path):\n self.__repo.set_path_repo(new_path)", "def syncfolder():", "def ChangeDir(self, path: str) -> None:\n ...", "def set_basedir(self, host, path):", "def set_local_path(self):\n return HERE", "def chdir(self, path):\n if not path:\n ...
[ "0.62669915", "0.59281373", "0.58305687", "0.5652025", "0.5542018", "0.552122", "0.5518593", "0.5472491", "0.54537106", "0.54523546", "0.5446311", "0.544534", "0.5391472", "0.53361374", "0.5331498", "0.53221756", "0.53136843", "0.52869874", "0.52862704", "0.5274655", "0.52733...
0.56019104
4
Get the predicted cost for each of the actions given the provided context.
def get_costs_per_action(self, context: np.ndarray) -> Dict[Action, Cost]: costs_per_action = {} for action in self._get_actions(): if self.categorize_actions: action_one_hot = self._get_actions_one_hot(action) x = np.append(action_one_hot, context) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, context: np.ndarray) -> np.ndarray:\n n_rounds_of_new_data = context.shape[0]\n ones_n_rounds_arr = np.ones(n_rounds_of_new_data, int)\n estimated_rewards_by_reg_model = np.zeros(\n (n_rounds_of_new_data, self.n_actions, self.len_list)\n )\n for actio...
[ "0.6950889", "0.6194891", "0.6161221", "0.5940927", "0.5893304", "0.5862886", "0.5833096", "0.57626337", "0.57062304", "0.56541", "0.5639965", "0.5606558", "0.5593295", "0.5560387", "0.5553072", "0.55465263", "0.5540782", "0.55235296", "0.55216396", "0.54918563", "0.54878634"...
0.748326
0
Predict an action given a context.
def predict( self, context: np.ndarray, epsilon: Prob = 0.05, exploration_width: int = 1, exploration_strategy: str = "smart", ) -> Tuple[Action, Prob]: def _get_direction(action_change: Action) -> Optional[str]: if action_change < 0: retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_fn(future_action, state):\n model = get_model()\n rewards = model((state, future_action))\n return {\"reward\": rewards}", "def fit_predict(\n self,\n context: np.ndarray,\n action: np.ndarray,\n reward: np.ndarray,\n pscore: Optional[np.ndarray] = None,\n ...
[ "0.68578327", "0.66418797", "0.66278553", "0.6600217", "0.6558365", "0.6513659", "0.6338011", "0.6164591", "0.6121328", "0.61089677", "0.61044675", "0.6058313", "0.6042822", "0.601579", "0.59879005", "0.59817743", "0.5955881", "0.5951787", "0.5791318", "0.5769036", "0.5753873...
0.6694794
1
Write a new training example in the logged data and retrain the regression model using the accumulated training data.
def learn(self, context: np.ndarray, action: Action, cost: Cost, prob: Prob): if self.reg is None: self._init_regressor(context) self._log_example(context, action, cost, prob) data = self.logged_data probs = data[:, 0] ips = 1 / probs weights = ips * (np.linsp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrain_dl(self):\n if self.print_sequential:\n print(\"Opening files...\")\n data=self.open_files()\n if self.print_sequential:\n print(\"Generating training data and labels...\")\n train_data, label_data=self.transpose_load_concat(**data)\n if self.pri...
[ "0.6452068", "0.64388776", "0.6377261", "0.6311379", "0.62070644", "0.61556226", "0.6120951", "0.60367054", "0.6029556", "0.60158366", "0.5984059", "0.59618765", "0.59618765", "0.59563255", "0.5943222", "0.5938815", "0.59098", "0.5908029", "0.59024644", "0.586966", "0.5855478...
0.0
-1
Create a new parser for the nstl microlanguage.
def __init__(self, lexoptimize=True, lextab='_lextab', yaccoptimize=True, yacctab='_yacctab', yaccdebug=False): self.lexer = lex.NstlLexer() self.lexer.build(optimize=lexoptimize, lextab=lextab) self.tokens = self.lexer.tokens self.parser = yacc.yacc(module=self, debug=yaccdebug, optimize=yaccopti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_minilang_parser():\n gramm = Grammar.from_string(GRAMMAR)\n return parser_from_grammar(gramm, 'program')", "def create_parser():\n pass", "def buildParser( declaration = grammar ):\n return VRMLParser( declaration, \"vrmlFile\" )", "def make_parser(language):\n parser = Parser()\n ...
[ "0.63348037", "0.6227513", "0.6044293", "0.5954293", "0.5915", "0.5759258", "0.557413", "0.55248976", "0.545088", "0.5433322", "0.5407149", "0.53752893", "0.5319015", "0.53167206", "0.5292922", "0.52856356", "0.5277806", "0.52564335", "0.5242387", "0.5236219", "0.52134985", ...
0.5117509
29
This function accumulates tokens in a sequence or list. This is useful for all non terminals with the following pattern.
def accumulate(self, p, skip=0): return [p[1]] if len(p) == 2 else p[1] + [p[2+skip]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_tokens(self, tokens):\n self.result.extend([d for d in tokens])", "def add_tokens(self, tokens):\n if self.pad:\n tokens = [START_OF_SEQ] * self.order + tokens + [END_OF_SEQ]\n\n for i in range(len(tokens) - self.order):\n current_state = tuple(tokens[i:i + self...
[ "0.6333529", "0.6308854", "0.6282478", "0.6102212", "0.60056746", "0.5859196", "0.5844713", "0.5804765", "0.5756415", "0.5645834", "0.5570865", "0.5556612", "0.55548114", "0.55465573", "0.5507698", "0.54293084", "0.54293084", "0.54293084", "0.5410935", "0.536951", "0.5361517"...
0.50384396
43
Tests if dict gets properly converted to NaElements.
def test_translate_struct_dict_unique_key(self): root = netapp_api.NaElement('root') child = {'e1': 'v1', 'e2': 'v2', 'e3': 'v3'} root.translate_struct(child) self.assertEqual(len(root.get_children()), 3) self.assertEqual(root.get_child_content('e1'), 'v1') self.assertEqu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_translate_struct_dict_nonunique_key(self):\n root = netapp_api.NaElement('root')\n child = [{'e1': 'v1', 'e2': 'v2'}, {'e1': 'v3'}]\n root.translate_struct(child)\n self.assertEqual(len(root.get_children()), 3)\n children = root.get_children()\n for c in children:...
[ "0.623892", "0.6218801", "0.5750569", "0.5704162", "0.5685371", "0.56784874", "0.5639726", "0.5624354", "0.5584869", "0.5556947", "0.5548787", "0.553519", "0.54804677", "0.54760355", "0.5473484", "0.54730076", "0.5444948", "0.5435633", "0.5421339", "0.5413401", "0.53997535", ...
0.5133013
44
Tests if list/dict gets properly converted to NaElements.
def test_translate_struct_dict_nonunique_key(self): root = netapp_api.NaElement('root') child = [{'e1': 'v1', 'e2': 'v2'}, {'e1': 'v3'}] root.translate_struct(child) self.assertEqual(len(root.get_children()), 3) children = root.get_children() for c in children: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list_like(self, value):\n return (not hasattr(value, \"strip\") and\n (hasattr(value, \"__getitem__\") or\n hasattr(value, \"__iter__\")))\n # return is_sequence(value) # use from pandas.core.common import is_sequence", "def isnondet(r):\n return isinstance(r, list...
[ "0.60055685", "0.58362675", "0.55918443", "0.55426055", "0.54347575", "0.53278166", "0.53273875", "0.53242916", "0.53021944", "0.529288", "0.52613616", "0.5240428", "0.52191174", "0.52089655", "0.51931584", "0.51931584", "0.51650697", "0.5162607", "0.5159848", "0.5155062", "0...
0.50057566
40
Tests if list gets properly converted to NaElements.
def test_translate_struct_list(self): root = netapp_api.NaElement('root') child = ['e1', 'e2'] root.translate_struct(child) self.assertEqual(len(root.get_children()), 2) self.assertIsNone(root.get_child_content('e1')) self.assertIsNone(root.get_child_content('e2'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonull(inputlist):\n return clean(inputlist, isnull, True)", "def _list_like(self, value):\n return (not hasattr(value, \"strip\") and\n (hasattr(value, \"__getitem__\") or\n hasattr(value, \"__iter__\")))\n # return is_sequence(value) # use from pandas.core.common impo...
[ "0.6358113", "0.60206056", "0.5883476", "0.58625174", "0.58625174", "0.5800553", "0.57959276", "0.5734356", "0.5712273", "0.5690614", "0.563991", "0.5604465", "0.55697477", "0.55463994", "0.55229896", "0.54853135", "0.54730946", "0.54585755", "0.54563", "0.5433329", "0.541858...
0.5204703
41
Tests if tuple gets properly converted to NaElements.
def test_translate_struct_tuple(self): root = netapp_api.NaElement('root') child = ('e1', 'e2') root.translate_struct(child) self.assertEqual(len(root.get_children()), 2) self.assertIsNone(root.get_child_content('e1')) self.assertIsNone(root.get_child_content('e2'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tuples():\n\n @type_checked\n def _run_test(something:(str, int, bool)):\n assert isinstance(something[0], str)\n assert isinstance(something[1], int)\n assert isinstance(something[2], bool)\n\n _run_test(something=(None, \"12\", 1))", "def _is_positive_int_tuple(item):\n ...
[ "0.6304577", "0.62479115", "0.6131925", "0.6101338", "0.60980195", "0.59517014", "0.59246325", "0.587698", "0.5869051", "0.58413464", "0.578344", "0.5762512", "0.5754428", "0.5734058", "0.569836", "0.5663851", "0.56290215", "0.56237906", "0.5618846", "0.56172585", "0.56099147...
0.600591
5
Tests if invalid data structure raises exception.
def test_translate_invalid_struct(self): root = netapp_api.NaElement('root') child = 'random child element' self.assertRaises(ValueError, root.translate_struct, child)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_with_invalid_input(self):\n for dataset_type in ['ruler', 'pencil', 'cheese']:\n with self.assertRaises(ValueError) as exc:\n check_dataset_type(dataset_type)\n self.assertEqual(\"Dataset type not 'regular' or 'raw' is %s\" % dataset_type,\n ...
[ "0.69549423", "0.6800185", "0.67051315", "0.66807365", "0.6600718", "0.65539765", "0.6551458", "0.65252626", "0.6507101", "0.65033543", "0.650226", "0.6499803", "0.6486112", "0.6415248", "0.6384", "0.6347746", "0.6316549", "0.6275802", "0.6264271", "0.62269646", "0.62124825",...
0.59542996
71
Tests str, int, float get converted to NaElement.
def test_setter_builtin_types(self): root = netapp_api.NaElement('root') root['e1'] = 'v1' root['e2'] = 1 root['e3'] = 2.0 root['e4'] = 8l self.assertEqual(len(root.get_children()), 4) self.assertEqual(root.get_child_content('e1'), 'v1') self.assertEqual(r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_string_or_number():\n assert is_string_or_number(None) is None\n assert is_string_or_number(1) is None\n assert is_string_or_number(1.1) is None\n assert is_string_or_number('1.1') is None\n assert is_string_or_number([])", "def ele2nb(element):\n if isinstance(element, str):\n return flo...
[ "0.60229194", "0.5978814", "0.58429635", "0.57734835", "0.5629192", "0.5614145", "0.55944276", "0.5573304", "0.5557818", "0.55009377", "0.55009377", "0.54978293", "0.5463476", "0.54627395", "0.5459325", "0.54479104", "0.5445536", "0.541506", "0.5411362", "0.5389325", "0.53625...
0.51746476
40
Tests na_element gets appended as child.
def test_setter_na_element(self): root = netapp_api.NaElement('root') root['e1'] = netapp_api.NaElement('nested') self.assertEqual(len(root.get_children()), 1) e1 = root.get_child_by_name('e1') self.assertIsInstance(e1, netapp_api.NaElement) self.assertIsInstance(e1.get_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_setter_na_element(self):\n root = netapp_api.NaElement('root')\n root['e1'] = netapp_api.NaElement('nested')\n self.assertEqual(1, len(root.get_children()))\n e1 = root.get_child_by_name('e1')\n self.assertIsInstance(e1, netapp_api.NaElement)\n self.assertIsInstan...
[ "0.67987376", "0.63512254", "0.6176601", "0.6144186", "0.60023457", "0.5950926", "0.59426093", "0.5894436", "0.5872535", "0.58458453", "0.58127284", "0.58080167", "0.5802401", "0.5756666", "0.57045996", "0.5687755", "0.5677121", "0.5653698", "0.5644743", "0.56394815", "0.5633...
0.67678875
1
Tests dict is appended as child to root.
def test_setter_child_dict(self): root = netapp_api.NaElement('root') root['d'] = {'e1': 'v1', 'e2': 'v2'} e1 = root.get_child_by_name('d') self.assertIsInstance(e1, netapp_api.NaElement) sub_ch = e1.get_children() self.assertEqual(len(sub_ch), 2) for c in sub_ch:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_setter_child_dict(self):\n root = netapp_api.NaElement('root')\n root['d'] = {'e1': 'v1', 'e2': 'v2'}\n e1 = root.get_child_by_name('d')\n self.assertIsInstance(e1, netapp_api.NaElement)\n sub_ch = e1.get_children()\n self.assertEqual(2, len(sub_ch))\n for ...
[ "0.692969", "0.62596947", "0.6051907", "0.6033617", "0.6024387", "0.6024387", "0.6024387", "0.6024387", "0.6024387", "0.5993601", "0.5961713", "0.5925168", "0.5859408", "0.58378726", "0.58262926", "0.58179736", "0.58094585", "0.5797076", "0.575363", "0.57313854", "0.57068044"...
0.6954826
0
Tests list/tuple are appended as child to root.
def test_setter_child_list_tuple(self): root = netapp_api.NaElement('root') root['l'] = ['l1', 'l2'] root['t'] = ('t1', 't2') l = root.get_child_by_name('l') self.assertIsInstance(l, netapp_api.NaElement) t = root.get_child_by_name('t') self.assertIsInstance(t, ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_setter_child_list_tuple(self):\n root = netapp_api.NaElement('root')\n root['l'] = ['l1', 'l2']\n root['t'] = ('t1', 't2')\n l_element = root.get_child_by_name('l')\n self.assertIsInstance(l_element, netapp_api.NaElement)\n t = root.get_child_by_name('t')\n ...
[ "0.70010734", "0.65542954", "0.63257587", "0.6279599", "0.62566125", "0.6221631", "0.6212001", "0.6183939", "0.6152893", "0.61014795", "0.60733724", "0.60378975", "0.59894735", "0.5981031", "0.5951861", "0.5948126", "0.5942114", "0.59398097", "0.5915376", "0.5901368", "0.5882...
0.70634353
0
Tests key with None value.
def test_setter_no_value(self): root = netapp_api.NaElement('root') root['k'] = None self.assertIsNone(root.get_child_content('k'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func3(key):\n value = my_test_dict.get(key)\n if value is None:\n return False\n else:\n return True", "def test_key_no_data(self):\n key = Key({})\n\n assert key.warning is None\n assert key.in_car is None", "def compare_with_none():\n value = {};\n if val...
[ "0.7376511", "0.7210644", "0.7156653", "0.7106254", "0.7106254", "0.70963234", "0.70963234", "0.68859714", "0.67631936", "0.67631936", "0.6726326", "0.6660834", "0.65424436", "0.65263426", "0.6464883", "0.6434181", "0.6414277", "0.63221276", "0.6299831", "0.6287927", "0.62784...
0.5739828
78
Tests invalid value raises exception.
def test_setter_invalid_value(self): root = netapp_api.NaElement('root') try: root['k'] = netapp_api.NaServer('localhost') except Exception as e: if not isinstance(e, TypeError): self.fail(_('Error not a TypeError.'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_value_error(self):\n self._error_test(ValueError)", "def test_task_with_one_int_validation_parameter_validate_exceptions(number, expected_value):\r\n\r\n with pytest.raises(expected_value):\r\n algo.TaskWithOneIntValidationParameter.validate_data(number)", "def test_bad_values(self):\...
[ "0.8108551", "0.75570345", "0.7404357", "0.73849297", "0.72685856", "0.72426933", "0.72107214", "0.72030556", "0.715305", "0.7153031", "0.71462476", "0.7118535", "0.7113288", "0.71109194", "0.7099144", "0.7038161", "0.7006992", "0.69981664", "0.6976003", "0.6958428", "0.69519...
0.0
-1
Tests invalid value raises exception.
def test_setter_invalid_key(self): root = netapp_api.NaElement('root') try: root[None] = 'value' except Exception as e: if not isinstance(e, KeyError): self.fail(_('Error not a KeyError.'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_value_error(self):\n self._error_test(ValueError)", "def test_task_with_one_int_validation_parameter_validate_exceptions(number, expected_value):\r\n\r\n with pytest.raises(expected_value):\r\n algo.TaskWithOneIntValidationParameter.validate_data(number)", "def test_bad_values(self):\...
[ "0.8108551", "0.75570345", "0.7404357", "0.73849297", "0.72685856", "0.72426933", "0.72107214", "0.72030556", "0.715305", "0.7153031", "0.71462476", "0.7118535", "0.7113288", "0.71109194", "0.7099144", "0.7038161", "0.7006992", "0.69981664", "0.6976003", "0.6958428", "0.69519...
0.0
-1
Get sentiment analysis immediately on document save
def get_sentiment_analysis(sender, instance, **kwargs): text_analysis = TextAnalysis(instance.text) # Prevent sentiment_analysis API call every time the document is saved if instance.sentiment_analysis is None: instance.get_sentiment_analysis()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_analytics(self):\n\n headers = {\n # Request headers\n 'Content-Type': 'application/json',\n 'Ocp-Apim-Subscription-Key': self.keys['text_analytics'],\n }\n \n sentiment_url = 'https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/senti...
[ "0.66183805", "0.63964885", "0.63705045", "0.63385326", "0.63300335", "0.6323211", "0.62792253", "0.61452967", "0.61425865", "0.6107899", "0.608918", "0.60816747", "0.60478175", "0.6037236", "0.59819293", "0.59520787", "0.5950468", "0.5949469", "0.5940747", "0.5906748", "0.59...
0.69361526
0
This class takes care of putting the text preprocessing, label encoding and model into a classification pipeline. Labels are onehot encoded with sklearn's LabelBinarizer, text is tokenized with the TextFormatting class in preprocessing, and the model is the TextClassifier in model.
def __init__(self, sequence_length: int, embeddings_dim: int, embeddings_path: str = None): self.label_encoder = LabelBinarizer() self.text_formatter = TextFormatting(max_len=sequence_length) self.sequence_length = sequence_length self.v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify(text):\n # TODO Wonder if there's a better way of doing this so the model persists across fucn calls. Will see once I get\n # Heroku running\n\n sentences = sent_tokenize(text)\n clean_sentences = list(map(clean_text, sentences))\n word_tokenizer = BertTokenizerFast.from_pretrained('be...
[ "0.68297", "0.65293926", "0.65250844", "0.6384357", "0.63417363", "0.6297352", "0.62855387", "0.6263438", "0.62505645", "0.6246545", "0.62384707", "0.6237421", "0.6180101", "0.61683106", "0.61633414", "0.615634", "0.61422986", "0.6137567", "0.6129089", "0.6121658", "0.6110423...
0.0
-1
Fits the model to the training data x and its associated labels y. The model will be recorded in self.model.
def fit(self, x: pd.Series, y: pd.Series, **fit_kwargs): x = self.text_formatter.fit_transform(x) y_one_hot = self.label_encoder.fit_transform(y) if y_one_hot.shape[1] == 1: y_one_hot = np.hstack((y_one_hot, 1 - y_one_hot)) self._fit(x, y_one_hot, **fit_kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, X, y):\n self.model_x = X\n self.model_y = y", "def train(self, X, y):\n self.model.fit(X, y)", "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def training(self):\n self.model.fit(self.train_x, self.train_y)", "def train(self, X_...
[ "0.7848193", "0.78104174", "0.77299017", "0.7567453", "0.75329787", "0.7435346", "0.7343392", "0.7276514", "0.7276514", "0.72682047", "0.71949565", "0.71926683", "0.7164424", "0.71145386", "0.7070291", "0.7055931", "0.7043422", "0.7040537", "0.69801044", "0.69582874", "0.6927...
0.0
-1
Performs cross validation and returns the scores.
def cv(self, x: pd.Series, y: pd.Series, n_splits: int, refit: bool = True, **fit_kwargs) -> List[list]: x = self.text_formatter.fit_transform(x) y_one_hot = self.label_encoder.fit_transform(y) if y_one_hot.shape[1] == 1: y_one_hot = np.hstack((y_one_hot, 1 - y_one_hot)) skf ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_validate_model(self, X_train, y_train):\n\n\t\t# Build a stratified k-fold cross-validator object\n\t\tskf = StratifiedKFold(n_splits=10, shuffle=True, random_state=42)\n\n\t\t'''\n\t\tEvaluate the score by cross-validation\n\t\tThis fits the classification model on the training data, according to the cr...
[ "0.75626475", "0.7517389", "0.74758613", "0.73620546", "0.7360652", "0.73598105", "0.7357008", "0.7326522", "0.7309351", "0.7306647", "0.7275394", "0.72500217", "0.72362286", "0.71839345", "0.7173292", "0.71140176", "0.7035299", "0.7027727", "0.7023638", "0.7022257", "0.70222...
0.0
-1
Generates predictions using the trained model and preprocessing.
def predict(self, x: Union[List[str], pd.Series]) -> np.array: predictions = self._predict(x) return self.label_encoder.inverse_transform(predictions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_predictions(fitted_model_filename):\n click.echo(\"Mode: predicting probabilities.\\n\")\n defaults = get_defaults()\n\n fitted_model_filename = add_extension(fitted_model_filename)\n fitted_model_path = os.path.join(defaults.OUTPUT.FITTED_MODELS_PATH, fitted_model_filename)\n new_options = ...
[ "0.7347879", "0.70187277", "0.70089066", "0.69615614", "0.69180834", "0.6915808", "0.6898056", "0.6853602", "0.6763513", "0.6751476", "0.6718363", "0.6702563", "0.6698698", "0.66934955", "0.66716003", "0.6671341", "0.66694397", "0.66694397", "0.6665388", "0.66317606", "0.6616...
0.0
-1
Returns the raw prediction (all probabilities for all classes)
def predict_proba(self, x): return self._predict(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predictions(self):\n return self._pred", "def get_prediction(self):\n return self.prediction", "def get_classification_predictions(self):\n predictions = []\n for i, test_batch in enumerate(tqdm.tqdm(self.loader)):\n if self.tta_fn is not None:\n pred_o...
[ "0.7318895", "0.72432023", "0.7131954", "0.70452535", "0.7043757", "0.7003312", "0.69766957", "0.6888829", "0.6861435", "0.6841351", "0.6831913", "0.68016833", "0.6754687", "0.6747136", "0.67463976", "0.6743526", "0.6729051", "0.6728815", "0.6722753", "0.67097694", "0.6700957...
0.0
-1
This function is used in the property self.embeddings.
def set_embeddings(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_movie_embedding(self):\n raise NotImplementedError(\"has to be overwritten\")", "def add_embedding(self):\n ### YOUR CODE HERE (~4-6 lines)\n embeddingTensor = tf.Variable(self.pretrained_embeddings)\n embeddings = tf.nn.embedding_lookup(embeddingTensor, self.input_placeholder...
[ "0.74282503", "0.702405", "0.68440545", "0.6790293", "0.6766997", "0.6700022", "0.6659412", "0.6578466", "0.6472033", "0.6452144", "0.6434908", "0.6428523", "0.6398044", "0.6394544", "0.6383916", "0.6372758", "0.63573927", "0.63538617", "0.63432187", "0.633421", "0.6262197", ...
0.8120444
0
For each string, output 1 if the DFA accepts it, 0 otherwise. The input is guaranteed to be a DFA.
def task_4(parser): dfa = parser.parse_fa() test_strings = parser.parse_test_strings() # calculate and print acceptance for each string for string in test_strings: if follow_dfa(dfa["graph"][dfa["start"]], string): print("1") else: print("0") print("end")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, s):\n state = self._initial\n try:\n for sym in s:\n state = self._trans_matrix[state][self._syms_to_indices[sym]]\n except KeyError:\n raise NotInAlphabetError(sym) from None\n return state in self._accepting", "def isogram():\n...
[ "0.6033226", "0.5742265", "0.5733216", "0.56888366", "0.56711626", "0.56197566", "0.5588654", "0.5418547", "0.5407468", "0.5398522", "0.5388671", "0.5385906", "0.5385906", "0.5385906", "0.5385906", "0.53602785", "0.53272057", "0.52750105", "0.5264539", "0.5249218", "0.5243929...
0.63068765
0
Recursively follows states until string is empty. Returns whether state is terminal.
def follow_dfa(state, string): if string == "": return state["final"] # get first edge using symbol at beginning of string # next is a cool function ive just learned i hope this counts as readable code 🥺👉👈 next_state = next( s["node"] for s in state["edges"] if s["symbol"] ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_terminal(self, state):\n return len(self.get_possible_actions(state)) == 0", "def is_terminal(self, state):\n x, y = self.__state_to_xy(state)\n if MAP[y][x] in ['G', 'H']:\n return True\n return False", "def is_terminal(state):\n\n # Horizontal check\n for i...
[ "0.6522898", "0.6326616", "0.6221845", "0.6193005", "0.6183206", "0.61662275", "0.61294013", "0.6114354", "0.59763944", "0.5969359", "0.59522396", "0.59356666", "0.5826155", "0.57757306", "0.5694262", "0.56490445", "0.5636367", "0.55809706", "0.55656576", "0.55133486", "0.550...
0.55716324
18
access remote with under wechat'api's interface just a simple wrapper on `get_remote` raise error on response error
def _access_wxapi_or_raise(self, *args, **kwargs): r = json.loads(get_remote(*args, **kwargs)) if "errcode" in r: raise Exception("errcode: " + str(r["errcode"]) + ", errmsg: " + r["errmsg"]) return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remote():\n pass", "def remote(self, *args, **kwargs):\n return self.api.remote(*args, **kwargs)", "def getRemoteHost():", "def remote(self, *arguments, **kwargs):\n return self.get_output('remote', *arguments, **kwargs)", "def do_remote(self, *args):\n return self.do_scpi(':com...
[ "0.67932016", "0.6746072", "0.6663715", "0.66510284", "0.6398095", "0.6062869", "0.59665376", "0.5951629", "0.57943213", "0.5788961", "0.5787939", "0.57730424", "0.5729481", "0.5727869", "0.5727869", "0.5682217", "0.56431633", "0.56091577", "0.5571601", "0.55352926", "0.55278...
0.62832904
5
get access token from wxapi this is the second step to login with wechat after the client get the code
def get_access_token(self, code): url = get_config("login.wechat.access_token_url") % code r = self._access_wxapi_or_raise(url) return (r["access_token"], r["openid"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_token(self, code):\n\n # live need post a form to get token\n headers = {'Content-type': 'application/x-www-form-urlencoded'}\n data = {\n 'client_id': get_config('login.live.client_id'),\n 'client_secret': get_config('login.live.client_secret'),\n 'red...
[ "0.6793707", "0.67241335", "0.6619643", "0.6482753", "0.64813423", "0.6452798", "0.6423836", "0.64193034", "0.64193034", "0.63922495", "0.63754576", "0.6291259", "0.6257184", "0.62232846", "0.6198705", "0.6198705", "0.6197053", "0.61913085", "0.6176826", "0.61711794", "0.6151...
0.7249641
0
get user info from wxapi this is the final step to login with wechat
def get_user_info(self, access_token, openid): url = get_config("login.wechat.user_info_url") % (access_token, openid) return self._access_wxapi_or_raise(url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_login():\n \n data = user_obj.user_login()\n return data", "def login(self):", "def login():", "def login():", "def log_in(self, ctx: Context):\n email = json.loads(ctx.users)['username']\n password = json.loads(ctx.users)['password']\n InputFunctions.send_keys_to_ele...
[ "0.6570302", "0.6333091", "0.62763906", "0.62763906", "0.6231804", "0.6212389", "0.620589", "0.6194151", "0.612593", "0.6112595", "0.61102265", "0.6109876", "0.60988086", "0.6087747", "0.6087747", "0.606966", "0.6067771", "0.6058907", "0.60572743", "0.6048634", "0.60352176", ...
0.65810204
0
Get qq access token
def get_token(self, code, redirect_uri): token_resp = get_remote(get_config("login.qq.access_token_url") % (redirect_uri, code)) if token_resp.find('callback') == 0: error = json.loads(token_resp[10:-4]) raise Exception(error) query = qs_dict(token_resp) return q...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_access_token(self, request) -> str or Exception:\n pass", "def access_token(self):\n return self.access_token_str", "def getAccessToken(self):\r\n\r\n #lets see if we have an oauth code\r\n if self.oauthToken is None:\r\n self.oauthToken = self.createAccessToken\r\n\r...
[ "0.7010284", "0.6989711", "0.6904486", "0.68345237", "0.6801059", "0.67715067", "0.6744162", "0.67331374", "0.67299163", "0.66792107", "0.6677348", "0.66704553", "0.66563576", "0.6632723", "0.66103107", "0.66000867", "0.65999943", "0.65748245", "0.6555147", "0.6550575", "0.65...
0.7126429
0
Get qq open id
def get_info(self, token): openid_resp = get_remote(get_config("login.qq.openid_url") + token) self.log.debug("get access_token from qq:" + token) info = json.loads(openid_resp[10:-4]) if info.get("error") is not None: raise Exception(info) return info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qid(self) -> str:\n return self._itempage.title()", "def get_stream_id(self) -> str:", "def __str__(self):\n return self.qseqid", "def get_id(self): # real signature unknown; restored from __doc__\n return \"\"", "def find_issue_id(self):", "def getID():", "def reqid(self) -> s...
[ "0.619482", "0.61881024", "0.59014285", "0.5895853", "0.5848636", "0.5827127", "0.57593566", "0.57593566", "0.567928", "0.56763285", "0.5628064", "0.55315685", "0.5506051", "0.55008554", "0.54917115", "0.5425531", "0.5415797", "0.5415797", "0.5415797", "0.5415797", "0.5415797...
0.0
-1
Get qq user info
def get_user_info(self, token, openid, client_id): url = get_config("login.qq.user_info_url") % (token, client_id, openid) user_info_resp = get_remote(url) user_info = convert(json.loads(user_info_resp)) if user_info.get("ret") != 0: raise Exception(user_info) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_info(self):\n response = self.query('user_info')\n return response", "def get_user_info(self) -> str:\n return self._searcher.get_user_info()", "def user_info(self):\n return self.auth.get_user_by_session()", "def user_info(self):\r\n param = {}\r\n param['appid'] =...
[ "0.7060283", "0.6837285", "0.6771517", "0.67457294", "0.66713727", "0.6424139", "0.6392767", "0.6378538", "0.63607556", "0.63139594", "0.6248579", "0.6244239", "0.62231886", "0.6194135", "0.6159332", "0.615596", "0.61555964", "0.6150874", "0.6143393", "0.61389005", "0.6111682...
0.6423132
6
Get github access token
def get_token(self, code): token_url = get_config('login.github.access_token_url') data_to_post = { "client_id": get_config("login.github.client_id"), "client_secret": get_config("login.github.client_secret"), "code": str(code) } headers = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_github_credendial(cls) -> 'ApiCredential':\n return cls.select_token_for_api(GITHUB_API_NAME)", "def get_github_credentials():\n\n p = subprocess.Popen(\"git config github.accesstoken\",\n shell=True,\n stdout=subprocess.PIPE,\n ...
[ "0.7889109", "0.7756136", "0.77456725", "0.767006", "0.7652787", "0.74576634", "0.7299358", "0.7048512", "0.7019856", "0.6951362", "0.6916727", "0.68040997", "0.67905265", "0.67753285", "0.67421544", "0.6734485", "0.6664523", "0.6646364", "0.6640968", "0.66376317", "0.6619797...
0.71718204
7
Get user primary email
def get_emails(self, token): user_email_url = get_config('login.github.emails_info_url') headers = { "Authorization": "token %s" % token } email_info_resp = get_remote(user_email_url, headers) email_list = json.loads(email_info_resp) return email_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email(self):\n # Look for a primary address\n useremail = UserEmail.query.filter_by(user_id=self.id, primary=True).first()\n if useremail:\n return useremail\n # No primary? Maybe there's one that's not set as primary?\n useremail = UserEmail.query.filter_by(user_i...
[ "0.80477", "0.80093074", "0.7920181", "0.7907315", "0.77828515", "0.7753013", "0.77459264", "0.7690467", "0.7659735", "0.75809807", "0.7466649", "0.7466649", "0.7378308", "0.7369187", "0.7355905", "0.73503345", "0.7347515", "0.73376715", "0.7324323", "0.72827196", "0.72159886...
0.0
-1
Get qq user info
def get_user_info(self, token): user_info_url = get_config('login.github.user_info_url') headers = { "Authorization": "token %s" % token, "Accept": "application/json" } user_info_resp = get_remote(user_info_url, headers) user_info = json.loads(user_info_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_info(self):\n response = self.query('user_info')\n return response", "def get_user_info(self) -> str:\n return self._searcher.get_user_info()", "def user_info(self):\n return self.auth.get_user_by_session()", "def user_info(self):\r\n param = {}\r\n param['appid'] =...
[ "0.7060283", "0.6837285", "0.6771517", "0.67457294", "0.66713727", "0.6424139", "0.6423132", "0.6392767", "0.6378538", "0.63607556", "0.63139594", "0.6248579", "0.6244239", "0.62231886", "0.6194135", "0.6159332", "0.615596", "0.61555964", "0.6150874", "0.6143393", "0.61389005...
0.0
-1
Get weibo access token
def get_token(self, code, redirect_uri): token_resp = post_to_remote(get_config('login.weibo.access_token_url') % (redirect_uri, code), {}) if token_resp.get("error") is not None: raise Exception(token_resp) return token_resp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_token(request):\n capability = TwilioCapability(\n settings.TWILIO_ACCOUNT_SID,\n settings.TWILIO_AUTH_TOKEN)\n \"\"\"Allow our users to make outgoing calls with Twilio Client\"\"\"\n capability.allow_client_outgoing(settings.TWIML_APPLICATION_SID)\n\n \"\"\"Allow our users to acc...
[ "0.70288146", "0.7001885", "0.6894617", "0.6847831", "0.6780489", "0.67765784", "0.6754007", "0.6753824", "0.6739081", "0.6731335", "0.67164814", "0.66781205", "0.66739684", "0.6635992", "0.6626884", "0.6626884", "0.6622913", "0.6604508", "0.65591806", "0.6532953", "0.6530821...
0.6161044
77
Get weibo user info
def get_user_info(self, token, uid): # https://api.weibo.com/2/users/show.json?access_token=2.005RDjXC0rYD8d39ca83156aLZWgZE&uid=1404376560 user_info_resp = get_remote(get_config('login.weibo.user_info_url') + token + "&uid=" + uid) user_info = json.loads(user_info_resp) if user_info....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_info(self):\r\n param = {}\r\n param['appid'] = self.apiKey\r\n param['nonce'] = int(time.time()*1000)\r\n param['timestamp'] = int(time.time())\r\n return self.__signed_GET('/api/v1/users/me', param, self.timeout)", "def getBasicInfo(self):\n homepage_url = 'ht...
[ "0.71305436", "0.7084169", "0.7075696", "0.6976193", "0.6964103", "0.6913651", "0.6893832", "0.68115276", "0.68086296", "0.67903674", "0.6736626", "0.67143106", "0.6713513", "0.66546255", "0.664701", "0.66461414", "0.66090995", "0.66029125", "0.65716374", "0.65706587", "0.654...
0.6753262
10
Get weibo user info
def get_email(self, token, uid): email_info_resp = get_remote(get_config('login.weibo.email_info_url') + token) email_info_resp_json = json.loads(email_info_resp) if email_info_resp_json.get("error") is not None: raise Exception(email_info_resp_json) return email_info_resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_info(self):\r\n param = {}\r\n param['appid'] = self.apiKey\r\n param['nonce'] = int(time.time()*1000)\r\n param['timestamp'] = int(time.time())\r\n return self.__signed_GET('/api/v1/users/me', param, self.timeout)", "def getBasicInfo(self):\n homepage_url = 'ht...
[ "0.71305436", "0.7084169", "0.7075696", "0.6976193", "0.6964103", "0.6913651", "0.6893832", "0.68115276", "0.68086296", "0.67903674", "0.6753262", "0.6736626", "0.67143106", "0.6713513", "0.66546255", "0.664701", "0.66461414", "0.66090995", "0.66029125", "0.65716374", "0.6570...
0.0
-1
Get live access token
def get_token(self, code): # live need post a form to get token headers = {'Content-type': 'application/x-www-form-urlencoded'} data = { 'client_id': get_config('login.live.client_id'), 'client_secret': get_config('login.live.client_secret'), 'redirect_uri': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_token(self):\n if self._access_token is None or self._is_expired():\n self._refresh_token()\n return self._access_token", "def access_token(self):\n if self.has_expired():\n self.update()\n\n return self.token['access_token']", "def getAccessToken(self...
[ "0.78363293", "0.7810096", "0.758454", "0.7580243", "0.7556684", "0.7460324", "0.7452582", "0.744574", "0.73868954", "0.736419", "0.7318679", "0.73036116", "0.72809124", "0.72522765", "0.7224583", "0.72144043", "0.72129726", "0.7202701", "0.7202701", "0.7200073", "0.7200073",...
0.7708082
2
Get live user info
def get_user_info(self, token): user_info_resp = get_remote(get_config('login.live.user_info_url') + token) user_info = json.loads(user_info_resp) if user_info.get("error") is not None: raise Exception(user_info) return user_info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_info(self):\r\n param = {}\r\n param['appid'] = self.apiKey\r\n param['nonce'] = int(time.time()*1000)\r\n param['timestamp'] = int(time.time())\r\n return self.__signed_GET('/api/v1/users/me', param, self.timeout)", "def user_info(self):\n response = self.query...
[ "0.7842169", "0.7835051", "0.76801395", "0.7642541", "0.739176", "0.7339232", "0.72461045", "0.7243062", "0.72167087", "0.7173714", "0.7156141", "0.7093393", "0.7086855", "0.70710695", "0.70611405", "0.7042548", "0.70099187", "0.7007318", "0.70027375", "0.7001805", "0.6997621...
0.73311967
6
generate 2 random numbers to add get input as addition answer check if correct, if right countdown to get 3 in a row right to end program if wrong lets keep adding and restart the 3 in a row count down
def main(): min_random = 10 #keeping constant for the min random number range max_random = 99 #keeping constant for the max random number range count = 0 #creating a counter variable to keep track of user's answers in a row while count != 3: #this loop will keep goin until user get 3 answers correct i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n correct = 0\n\n while correct < GOAL:\n #random.seed(1)\n ##set up addition problem:\n num1 = random.randint(RAND_MIN, RAND_MAX)\n num2 = random.randint(RAND_MIN, RAND_MAX)\n ans = num1 + num2\n\n ##print and solve addition problem:\n print(\"Wha...
[ "0.73614657", "0.70625", "0.6931597", "0.67691684", "0.65652305", "0.6021567", "0.5964148", "0.5895458", "0.58120376", "0.5797901", "0.5791938", "0.5759847", "0.57452613", "0.57439905", "0.573757", "0.56791544", "0.5662617", "0.56588566", "0.5658514", "0.5648855", "0.5645049"...
0.75160843
0
split a list into two lists
def split_array(a): n = len(a) if n == 1: return a index = n // 2 b = a[:index] c = a[index:] return b, c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_list(a_list):\n half = len(a_list)/2\n return a_list[:half], a_list[half:]", "def split(list):\r\n \r\n mid = len(list)//2\r\n left = list[:mid]\r\n right = list[mid:]\r\n \r\n return left, right", "def split_list(input_list):\n if len(input_list) % 2 == 0:\n half = ...
[ "0.8012361", "0.78058696", "0.77976507", "0.7795386", "0.7776519", "0.76878697", "0.7570118", "0.74386173", "0.73480934", "0.73293114", "0.70478654", "0.689611", "0.6859675", "0.68518037", "0.6849828", "0.6820981", "0.68165535", "0.67306584", "0.67293876", "0.6690479", "0.663...
0.6365236
33
count the number of inversions
def countArrary(input_a): if len(input_a) == 1: return 0 else: # split the input array split_a = [input_a] while len(split_a) != len(input_a): new_split_a = [] for sub_a in split_a: if len(sub_a) > 1: b, c = split_array(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __count_inversions(puzzle):\n puzzleLength = len(puzzle)\n count = 0\n for i in range(puzzleLength):\n for j in range(i + 1, puzzleLength):\n if(puzzle[i] > puzzle[j]):\n count += 1\n return count", "def inversions(state):\r\n state_copy = state.copy()\r\n s...
[ "0.7918705", "0.7557642", "0.7374657", "0.73435336", "0.72812754", "0.7223587", "0.7174155", "0.71684355", "0.6687496", "0.66617197", "0.6377674", "0.63157755", "0.6259199", "0.6219069", "0.614649", "0.613124", "0.6001056", "0.5896113", "0.5847523", "0.58374596", "0.5817897",...
0.0
-1
Internal setattr method to set new parameters, only used to fill the parameters that need to be computed right after initialization
def _set_param(self, name, value): self._frozenjson._data[name] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setattr__(self, name, value):\n if name in ['parameters', 'program_name']: # Allowed attributes\n self.__dict__[name] = value\n else:\n self.set_parameter(name, value) # treat as a parameter", "def __setattr__(self,name,val):\n # use dir() not hasattr() because h...
[ "0.7481355", "0.7261963", "0.72144943", "0.71701014", "0.70615095", "0.70615095", "0.70615095", "0.70615095", "0.70615095", "0.70615095", "0.70615095", "0.70615095", "0.70615095", "0.70615095", "0.70615095", "0.70615095", "0.70615095", "0.70615095", "0.70615095", "0.70615095", ...
0.0
-1
Upcoming system to show deaths that level, time taken, etc.
def loadingScreen(self): self.continueButton = pygame.image.load(Directory().get_directory() + '/images/intro/play.png') self.continueButton2 = pygame.image.load(Directory().get_directory() + '/images/intro/play2.png') # pygame.display.set_caption("Master of Thieves") self.background_im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_deaths(self, db_session):\n deaths = self._get_current_deaths(db_session)\n total_deaths = self._get_total_deaths(db_session)\n self._add_to_chat_queue(\"Current Boss Deaths: {}, Total Deaths: {}\".format(deaths, total_deaths))", "def death(self):\n print \"{0} has died, like...
[ "0.679813", "0.67267483", "0.6689272", "0.66167647", "0.62606406", "0.6160424", "0.61004", "0.6084413", "0.6072137", "0.5954452", "0.59115213", "0.5863395", "0.5815567", "0.5803057", "0.5776313", "0.57433033", "0.5698685", "0.563933", "0.5636597", "0.5630961", "0.5609592", ...
0.0
-1
Checks if a path is an actual directory
def is_dir(dirname): if not os.path.isdir(dirname): msg = "{0} is not a directory".format(dirname) raise argparse.ArgumentTypeError(msg) else: return dirname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dir(self, path: PathLike):", "def is_dir(self, path):", "def isdir(path):\n system = get_instance(path)\n\n # User may use directory path without trailing '/'\n # like on standard file systems\n return system.isdir(system.ensure_dir_path(path))", "def is_directory(path: str) -> bool:\n ...
[ "0.8388225", "0.8251169", "0.81738156", "0.8151933", "0.81462157", "0.8120222", "0.8118569", "0.80518216", "0.80454", "0.78701305", "0.77093875", "0.7688265", "0.7653269", "0.76149786", "0.7586614", "0.7580526", "0.75637823", "0.75249004", "0.7503654", "0.7503654", "0.7503189...
0.6668291
68
Set up test fixtures, if any.
def setUp(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fixture_setup(self):\n pass", "def setUp(self):\n self.app = load_app(self.application_under_test)\n\n try:\n teardown_db()\n except Exception as e:\n print('-> err ({})'.format(e.__str__()))\n\n setup_app(section_name=self.application_under_test)\n ...
[ "0.8249083", "0.8189046", "0.7988954", "0.7984824", "0.76216614", "0.75593793", "0.75358236", "0.7493183", "0.74836344", "0.74836344", "0.7477272", "0.744775", "0.744392", "0.7414002", "0.74075687", "0.7363016", "0.7358137", "0.73313785", "0.73291314", "0.73162884", "0.730626...
0.0
-1
Tear down test fixtures, if any.
def tearDown(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n super(TestSelectAPI, self).tearDown()\n self.destroy_fixtures()", "def tearDown(self):\n try:\n os.remove(self.fixture_file)\n except OSError:\n pass", "def tearDown(self):\n try:\n os.remove(self.fixtureFile)\n ex...
[ "0.7995231", "0.77208245", "0.7695707", "0.7695625", "0.7575251", "0.7575251", "0.75296205", "0.7503916", "0.74814683", "0.74688035", "0.7423698", "0.74077475", "0.74077475", "0.74077475", "0.7386357", "0.73848885", "0.73664594", "0.73431826", "0.73431826", "0.73431826", "0.7...
0.0
-1
Loads performance data Returns PD DataFrame
def pd_load_performance_csv(performance_path, **kwargs): cols = [ "loan_id", "monthly_reporting_period", "servicer", "interest_rate", "current_actual_upb", "loan_age", "remaining_months_to_legal_maturity", "adj_remaining_months_to_maturity", "maturity_date", "msa", "current_loan_delinquency...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_pandas():\n data = _get_data()\n return du.process_pandas(data, endog_idx=0)", "def load_pandas():\n data = _get_data()\n return du.process_pandas(data, endog_idx=0)", "def load():\n return load_pandas()", "def load_pandas():\n data = _get_data()\n return du.process_pandas(data,...
[ "0.7106588", "0.7106588", "0.69746447", "0.6966801", "0.66129994", "0.6610344", "0.6602571", "0.64439434", "0.6350712", "0.63452655", "0.63425106", "0.6312122", "0.629684", "0.62943643", "0.62704605", "0.6257573", "0.6243574", "0.6237409", "0.6233404", "0.62208784", "0.622038...
0.64653116
7
Loads acquisition data Returns PD DataFrame
def pd_load_acquisition_csv(acquisition_path, **kwargs): columns = [ 'loan_id', 'orig_channel', 'seller_name', 'orig_interest_rate', 'orig_upb', 'orig_loan_term', 'orig_date', 'first_pay_date', 'orig_ltv', 'orig_cltv', 'num_borrowers', 'dti', 'borrower_credit_score', 'first_home_buyer', 'lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pd_load_acquisition_csv(acquisition_path, **kwargs):\n\n cols = [\n 'loan_id', 'orig_channel', 'seller_name', 'orig_interest_rate', 'orig_upb', 'orig_loan_term',\n 'orig_date', 'first_pay_date', 'orig_ltv', 'orig_cltv', 'num_borrowers', 'dti', 'borrower_credit_score',\n 'first_home_buye...
[ "0.6419686", "0.6402017", "0.63575786", "0.62864983", "0.6271366", "0.62537175", "0.6238884", "0.62184477", "0.61879724", "0.6175933", "0.6175492", "0.61639774", "0.61547565", "0.6142899", "0.6125022", "0.60660636", "0.60647833", "0.60528654", "0.6033451", "0.60246754", "0.60...
0.6446527
0
Loads names used for renaming the banks Returns PD DataFrame
def pd_load_names(**kwargs): cols = [ 'seller_name', 'new' ] dtypes = {'seller_name':str, 'new':str} return pd.read_csv(os.path.join(data_directory, "names.csv"), names=cols, delimiter='|', dtype=dtypes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simpleColumnNames():\n global masterdf\n\n df = masterdf.copy()\n #df = df[:int(len(df)*percentdata*0.01)]\n # new collumn names otherwise create_indicators break\n # [OPEN-HIGH-LOW-CLOSE-TICKVOL-VOL]\n # O-H-L-C-T-V-S colum suffixes\n newnames = [ symbols[i]+'_'+masterdf.columns[j][0]\n ...
[ "0.5787951", "0.56984186", "0.5362771", "0.5320787", "0.52894", "0.5230477", "0.5216697", "0.5202509", "0.52011865", "0.5184204", "0.5181308", "0.5171009", "0.5170913", "0.5133046", "0.51167834", "0.5063004", "0.5050153", "0.50478053", "0.5040606", "0.5038574", "0.50367355", ...
0.5691099
2
Simple permission fix for read only files.
def __shutil_fix(func, path, exc): # If the function is rmdir, remove or unlink and is an access error if func in (os.rmdir, os.remove, os.unlink) and exc[1].errno == errno.EACCES: # Set 777 as the permissions and call the function again os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_file_perms():\n yield\n os.chmod('tackle.yaml', int('0o644', 8))", "def edit_file_permission(request, app=None, priv=None):\n pass", "def chmod_file ( self, fspath ):\n return", "def _ensure_read_write_access(tarfileobj):\n dir_perm = tarfile.TUREAD | tarfile.TUWRITE | tarfile.TUEXEC\n...
[ "0.75999486", "0.70999444", "0.7047277", "0.7023621", "0.69472337", "0.6907189", "0.6885115", "0.68610114", "0.68281835", "0.6725736", "0.66714793", "0.6639541", "0.66357964", "0.6629603", "0.65960824", "0.6583971", "0.65828264", "0.6509163", "0.6497966", "0.6458645", "0.6458...
0.63029516
24
Alternative version of rmtree with support for removing read only files.
def rmtree(path, ignore_errors=False): shutil.rmtree(path, ignore_errors, __shutil_fix)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rmtree(path: str) -> None:\n def handle_remove_readonly(\n func: Callable[..., Any],\n path: str,\n exc: tuple[type[OSError], OSError, TracebackType],\n ) -> None:\n excvalue = exc[1]\n if (\n func in (os.rmdir, os.remove, os.unlink) and\n ...
[ "0.80030376", "0.7450629", "0.721649", "0.7020184", "0.68477285", "0.68477285", "0.6693467", "0.6554252", "0.65185106", "0.6416231", "0.6387251", "0.63817346", "0.6379617", "0.6351209", "0.63437504", "0.6283398", "0.62554175", "0.61940765", "0.6185127", "0.6165985", "0.615647...
0.6368275
13
Reads Intan Technologies RHD2000 data file generated by evaluation board GUI. Data are returned in a dictionary, for future extensibility.
def read_data(filename): from intanutil.read_header import read_header from intanutil.get_bytes_per_data_block import get_bytes_per_data_block from intanutil.read_one_data_block import read_one_data_block from intanutil.notch_filter import notch_filter from intanutil.data_to_result import data_to_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_header(fid):\r\n\r\n # Check 'magic number' at beginning of file to make sure this is an Intan\r\n # Technologies RHD2000 data file.\r\n magic_number, = struct.unpack('<I', fid.read(4)) \r\n if magic_number != int('c6912702', 16): raise Exception('Unrecognized file type.')\r\n\r\n header = ...
[ "0.6393038", "0.6149901", "0.5831465", "0.5748882", "0.57278347", "0.57030857", "0.5688642", "0.5681411", "0.56662315", "0.56551236", "0.5647856", "0.5566591", "0.55629826", "0.55400455", "0.5536587", "0.5534342", "0.5492185", "0.54791164", "0.5452682", "0.54502016", "0.54300...
0.5347599
30
Utility function to optionally pluralize words based on the value of n.
def plural(n): if n == 1: return '' else: return 's'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pluralize(n, s):\n if n == 1:\n return f'1 {s}'\n else:\n return f'{n} {s}s'", "def plural(n):\n if n != 1:\n return \"s\"\n else:\n return \"\"", "def plural(num, one, many):\n\n return \"%i %s\" % (num, one if num == 1 else many)", "def pluralize(word, num):\n...
[ "0.74885666", "0.7429422", "0.7037012", "0.6609908", "0.6518552", "0.64686424", "0.6346233", "0.63218504", "0.6162843", "0.6089325", "0.6033861", "0.60118306", "0.59906334", "0.5960944", "0.59445107", "0.5938011", "0.5879026", "0.5834877", "0.5833", "0.58170116", "0.58166254"...
0.7405934
2
quote the elements of a dotted name
def quote_dotted( name: Union["quoted_name", str], quote: functools.partial ) -> Union["quoted_name", str]: if isinstance(name, quoted_name): return quote(name) result = ".".join([quote(x) for x in name.split(".")]) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dotted_name(s):\n forbidden = forbidden_chars.intersection(s)\n if forbidden:\n raise ValueError('%(s)s contains forbidden characters'\n ' (%(forbidden)s)'\n % locals())\n if not s:\n return ''\n elif s in reserved_names:\n raise ValueError('The na...
[ "0.6540108", "0.64451617", "0.6417363", "0.6304107", "0.58152014", "0.5777598", "0.5726563", "0.57090414", "0.5696863", "0.5691718", "0.56322443", "0.550168", "0.5483858", "0.5444921", "0.54370934", "0.5433207", "0.53710306", "0.53705055", "0.5365929", "0.5365884", "0.5363487...
0.745443
0
Convert text to float or 0.0 if invalid.
def convert_to_number(text): try: value = float(text) return value except ValueError: return 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ffloat(string):\n try:\n return float(string.strip())\n except:\n return 0", "def _convert_to_float(s):\n try:\n return float(s)\n except:\n return s", "def safe_float(str):\n if not str:\n return None\n try:\n return float(str)\n ...
[ "0.7549978", "0.7463989", "0.73810375", "0.73316866", "0.7268213", "0.7146606", "0.7116986", "0.7115148", "0.7079289", "0.7048062", "0.69954073", "0.6994393", "0.69855756", "0.69264966", "0.6895625", "0.68766963", "0.68540186", "0.68069357", "0.679633", "0.6766438", "0.674790...
0.7922715
0
Implements the kNN classifer to classify the testing dataset based on the training dataset
def predictTest(k, train, test): pred_labels = [] # for each instance in the testing dataset, calculate all L2 distance from all training instances for te in range(len(test)): all_D = np.zeros((len(train), 1)) # calculate the L2 distance of the testing instance from each training ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_knn(training_data):\n return knnclassifier(training_data, keys, 3)", "def KNN(x_train, x_test, y_train, k=3):\n knn = KNeighborsClassifier(n_neighbors=k)\n knn.fit(x_train, y_train)\n y_pred = knn.predict(x_test)\n return y_pred", "def knn(train_data, train_labels, test_data, test_labe...
[ "0.81317216", "0.8076582", "0.79367137", "0.7887092", "0.76906496", "0.76182103", "0.7588983", "0.7570624", "0.74730897", "0.74619097", "0.7450934", "0.7319036", "0.72715604", "0.72668743", "0.7201178", "0.7107569", "0.7090845", "0.70277756", "0.70149493", "0.6955066", "0.692...
0.7077485
17