query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Given a RandomNode returns a DecisionNode
def select_outcome(self, env, random_node): new_state_index, r, done, _ = env.step(random_node.action) return DecisionNode(state=new_state_index, father=random_node, is_final=done), r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_node(self):\n if random.randint(0, 100) > self.goal_sample_rate:\n random_node = self.Node(\n random.uniform(self.min_rand, self.max_rand),\n random.uniform(self.min_rand, self.max_rand),\n )\n else: # goal point sampling\n ...
[ "0.6875797", "0.6506942", "0.636228", "0.632881", "0.6185813", "0.6153899", "0.6089393", "0.6014047", "0.5892125", "0.5744766", "0.5736307", "0.56658673", "0.56345004", "0.562233", "0.5617714", "0.56049466", "0.5597951", "0.5591621", "0.5579573", "0.5573688", "0.557171", "0...
0.7110679
0
At the end of the simulations returns the most visited action
def best_action(self): number_of_visits_children = [node.visits for node in self.root.children.values()] index_best_action = np.argmax(number_of_visits_children) a = list(self.root.children.values())[index_best_action].action return a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_action(self) -> int:\n # simulation loop\n for i in range(self.iterations):\n self.__simulate(self.root, self.iterations)\n\n # action choice\n max_q = 0\n best_action = 0\n for action in actions:\n new_node = self.root.children[action]\n ...
[ "0.70127183", "0.687149", "0.6863603", "0.67862076", "0.6771671", "0.6724781", "0.670188", "0.66465", "0.66390723", "0.66019285", "0.6597186", "0.6585305", "0.6570425", "0.6556634", "0.65416694", "0.65311867", "0.6512796", "0.6509938", "0.6498248", "0.64976394", "0.6495535", ...
0.7107038
0
Builds a DAG of Steps from a SQL expression so that it's easier to execute in an engine.
def from_expression( cls, expression: exp.Expression, ctes: t.Optional[t.Dict[str, Step]] = None ) -> Step: ctes = ctes or {} expression = expression.unnest() with_ = expression.args.get("with") # CTEs break the mold of scope and introduce themselves to all in the context. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plan_step_to_expr(atom: clingo.Symbol) -> str:\n # The predicate and its arguments are double-quoted. Simply extract them\n matches = re.findall(r'\\\"(.+?)\\\"', str(atom))\n predicate = matches[0]\n args = f'({\",\".join(matches[1:])})' if matches[1:] else ''\n return predicate + args", "def...
[ "0.5711968", "0.5664347", "0.538123", "0.52660775", "0.52169806", "0.51955956", "0.51791394", "0.5158939", "0.51581794", "0.51150316", "0.51042306", "0.5073506", "0.50646734", "0.505281", "0.5020296", "0.49805304", "0.49764872", "0.4972279", "0.49443945", "0.49404278", "0.493...
0.6603545
0
This will continue splitting the tree until every leaf node is pure and the training data is perfectly characterized by the decision tree
def train(self): max_tuple = self.max_gain() # If that gain is 0 then every node should be a pure leaf (hopefully) and you can stop while max_tuple.gain != 0: max_tuple.node.split(max_tuple.attribute) max_tuple = self.max_gain()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decision_tree(original_training_data,call_depth):\n\n ''' Checking the stopping criterion. If yes then it returns the majority class (Muffin or CupCake) '''\n if check_if_stopping_criterion_is_met(original_training_data.values) or call_depth > 10:\n majority = classification(original_training_data...
[ "0.736419", "0.6879376", "0.68064624", "0.66134644", "0.65553546", "0.6515525", "0.6498684", "0.6492946", "0.6436828", "0.6393142", "0.6376377", "0.6344093", "0.63422775", "0.62961286", "0.62934136", "0.62801987", "0.62608254", "0.6223276", "0.61976653", "0.6194716", "0.61382...
0.7007727
1
If the node has children it will return the (node, attribute, gain) tuple of the child with the highest gain If the node does not have children and is not pure it will return the (node, attribute, gain) tuple with itself as the node and the highest heuristic score of splitting on any of its attributes as the gain If th...
def max_gain(self): if self.val1: val1_gain_tuple, val0_gain_tuple = self.val1.max_gain(), self.val0.max_gain() if val1_gain_tuple.gain > val0_gain_tuple.gain: return val1_gain_tuple else: return val0_gain_tuple elif self.attributes: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_child(self, node):\n ucb_values = []\n for action, child in node.children.items():\n if node.state.player_turn == 1:\n if child.n_visits == 0:\n ucb_max = float('inf')\n else:\n ucb_max = self.calculate_ucb_max...
[ "0.64669144", "0.63168865", "0.6179859", "0.6137272", "0.6127355", "0.6071936", "0.6051509", "0.6038578", "0.60306424", "0.5946005", "0.59143674", "0.5897368", "0.5833015", "0.5821131", "0.5816206", "0.58110994", "0.5801434", "0.57993925", "0.57883", "0.5769697", "0.57651377"...
0.6359626
1
This splits a node on the attribute "attribute"
def split(self, attribute): if attribute not in self.attributes: raise KeyError('Attribute not present in node') self.split_attr = attribute # list() is used to make a copy of the list instead of pointing to the same list child_attributes = list(self.attribu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitAttribute(self, atr, divider=0.5):\n big, lit = DecisionTree(None, self.atr), DecisionTree(None, self.atr)\n for d in self:\n if d[atr] > divider: big.append(d)\n else: lit.append(d)\n return lit, big", "def split_by_attribute(dbsession, group, attr):\n valu...
[ "0.5715175", "0.5710266", "0.5545711", "0.55031914", "0.55031914", "0.5446711", "0.5446711", "0.54354566", "0.5370533", "0.53344154", "0.5330768", "0.5245361", "0.52420187", "0.5240586", "0.5158735", "0.5151447", "0.5148021", "0.5079045", "0.50706065", "0.50669575", "0.506043...
0.77221286
0
sort and retrieve top rows of df
def get_top_recipes(df, sort_params=None, count=10): if not sort_params: logging.warning("Column names to soty by are not defined.") return df return df.sort_values(sort_params["names"], ascending=sort_params["order"]).head(count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_topn(df, top_n=25):\n assert df.columns.str.contains(\"ranking\").any(), \"select_topn failed. Missing 'ranking' column.\"\n \n # top-n by ranking\n topn_idx = df.groupby(\"ranking\").value_normalized.nlargest(top_n).droplevel(0).index\n \n return df.loc[topn_idx, : ]", "def analyse_...
[ "0.68262124", "0.6588031", "0.6443308", "0.6321405", "0.6281697", "0.62319", "0.6184617", "0.6135005", "0.6129716", "0.6061375", "0.6024057", "0.60073507", "0.59771293", "0.59485084", "0.5929012", "0.5920936", "0.5898448", "0.5891113", "0.5877641", "0.5877335", "0.5831138", ...
0.6937662
0
1. parse the json object and extract name, headline, prepTime, ratingsCount, favoritesCount, nutrition and export to a csv file 2. retrieve top 10 recipes based on ratingsCount, favoritesCount and export to a csv file
def read_recipes(year, week): # read config file cp = ConfigParser() cp.read("config.ini") # load menu data fname_json = cp["other"]["json_out_fname"] if not os.path.exists(fname_json): logging.error("JSON file not found.") return with open(fname_json) as f: m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTopMovies(endpoint, date, count=10):\n\n try:\n response = urlreq.urlopen(endpoint.format(date))\n soup = BeautifulSoup(response.read(), \"html.parser\")\n table = soup.find('table', border=\"0\", cellpadding=\"5\", cellspacing=\"1\")\n tdata = []\n\n for i, r...
[ "0.5909842", "0.57680744", "0.5694507", "0.56098086", "0.5597891", "0.556882", "0.551984", "0.5511607", "0.550861", "0.547752", "0.54691005", "0.5456482", "0.54545885", "0.54326177", "0.54270613", "0.54165226", "0.54148346", "0.5412836", "0.5410096", "0.53659177", "0.5352422"...
0.6317173
0
Check whether the test has passed by comparing its stdout to what is expected.
def check_test(self, test): (stdout, stderr) = (out.decode('ascii').strip() for out in test.process.communicate()) self.assertEqual(stderr, "") self.assertEqual(stdout, EXPCT_RESULTS[test.number], "Test {} failed".format(test.number)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_stdout(self, expected: str):\n assert self._std_out is not None, f\"You first need to `execute` the program before checking stdout!\"\n self._test.assertEqual(self._std_out.strip(), expected.strip())", "def testStdoutAndStderr(self):\n with self.OutputCapturer():\n print('foo')\n ...
[ "0.80546683", "0.7428795", "0.7355473", "0.717167", "0.7111023", "0.7000859", "0.6972296", "0.6900554", "0.682078", "0.6813413", "0.67746073", "0.67362183", "0.67312825", "0.6682966", "0.6635578", "0.66335154", "0.66038454", "0.6588386", "0.65542763", "0.65454364", "0.6543559...
0.78012776
1
Start the next test.
def start_next_test(self): next_test_num = self.test_numbers.popleft() self.tests.append( self.TEST( process=Popen(COMMANDS[next_test_num], stdout=PIPE, stderr=PIPE), number=next_test_num))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startTestRun(self):", "def startTest(self, test):\n self._timer = time()", "def test_run_started(self):", "def startTestRun(self, test):\n self.runTime= time.time()\n self.logger.debug(\"\\nBeginning ForceBalance test suite at %s\\n\" % time.strftime('%x %X %Z'))", "def startTest(a...
[ "0.7740946", "0.71101433", "0.7070812", "0.70663023", "0.7035438", "0.6931316", "0.6830204", "0.6806938", "0.6774849", "0.6727763", "0.669437", "0.66846573", "0.6676877", "0.6663228", "0.66558033", "0.6652603", "0.6652206", "0.66263163", "0.6597661", "0.6591751", "0.6574502",...
0.8345263
0
Poll tests for completion. When one finishes, start another one if there are more to run. Stop when all are finished.
def poll_tests(self): for i, test in enumerate(self.tests): if test.process.poll() is not None: self.check_test(test) self.tests.pop(i) if self.test_numbers: self.start_next_test()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wait_for_all_operations_done(self):\n while self._test_names_to_processes:\n time.sleep(10)\n running_test_names = list(self._test_names_to_processes.keys())\n for test_name in running_test_names:\n running_proc = self._test_names_to_processes.get(test_name)\n return_code = run...
[ "0.73554826", "0.674941", "0.65526724", "0.6549344", "0.6529588", "0.64772254", "0.64764065", "0.6411808", "0.6316884", "0.62365717", "0.6232344", "0.6232344", "0.6232344", "0.6232344", "0.6192078", "0.6168625", "0.6148079", "0.6129336", "0.60931456", "0.609054", "0.6083866",...
0.7962783
0
Parse the tests to be run. These may be given as a single number, a commaseperated list or two numbers seperated by a dash.
def parse_tests(tests_input): if '-' in tests_input: limits = tests_input.partition('-') tests = list(range(int(limits[0]), int(limits[2]) + 1)) else: tests = [int(t) for t in tests_input.split(',')] return tests
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parser():\n return parser(\"Testing\", \"Use this from a test\", \"\")", "def test_multiple_series(self):\n assert parse_command('test{{A,B}}{{1,2}}') == [\n ('testA1', {}), ('testA2', {}), ('testB1', {}), ('testB2', {})]", "def parse(lines):\n num_tests = int(lines.next())\n ...
[ "0.64865124", "0.64598006", "0.64436996", "0.624886", "0.62173283", "0.61449796", "0.61414963", "0.61308944", "0.6120973", "0.6089176", "0.6052001", "0.60171705", "0.59748244", "0.5970603", "0.59605867", "0.59500784", "0.5947035", "0.59386694", "0.5920873", "0.59173906", "0.5...
0.7508628
0
Find which aggregator will be use, accordly cli args
def setup(self, args): for key, ags in self._mapp.items(): arg = args.get(key) if arg: #if exist, turn aggregator actived and create a new instance a new aggregator class self.active = True return ags(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregator_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"aggregator_name\")", "def aggregator_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"aggregator_name\")", "def main():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--process_qu...
[ "0.623255", "0.60802627", "0.5820678", "0.5737905", "0.57234126", "0.57187593", "0.5651868", "0.55634636", "0.5494111", "0.5488788", "0.54820406", "0.53977966", "0.5384751", "0.5330864", "0.5323734", "0.5302474", "0.52866167", "0.5259916", "0.52444696", "0.52374387", "0.52364...
0.6193614
1
Used by Crawler class, append a line on instance of aggregator setuped.
def append(self, line): self.ag.append(line)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_add_node(self, line=''):\n self.fibbing.add_node()", "def add(self, line):\n self.body.append(line)", "def connectionMade(self):\n self.output = DelayedStartupLineLogger()\n self.output.makeConnection(self.transport)\n self.output.tag = self.name", "def _augment_pipe...
[ "0.56161034", "0.5413999", "0.5366023", "0.5317709", "0.531319", "0.52674985", "0.52674633", "0.52596486", "0.52380824", "0.5237493", "0.52317125", "0.5214208", "0.5210514", "0.51949674", "0.51943386", "0.51818913", "0.5181332", "0.5165727", "0.51442534", "0.5141288", "0.5126...
0.6032251
0
Release module to pypi
def release_pypi(): local('python setup.py clean sdist register upload')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish():\n fab.local(\"env/bin/python setup.py sdist\")\n tar_filename = fab.local(\n \"env/bin/python setup.py --fullname\", capture=True\n )\n dist_filename = \"dist/{}.tar.gz\".format(tar_filename)\n fab.put(dist_filename, PYREPO_DIR)", "def upload():\n sh('python setup.py regis...
[ "0.67773676", "0.6478244", "0.63994586", "0.6243652", "0.62267685", "0.62066156", "0.6148887", "0.60896164", "0.60631406", "0.6047037", "0.60178316", "0.5989916", "0.59694237", "0.5946053", "0.58958906", "0.5860913", "0.5859919", "0.58371365", "0.58328044", "0.5812867", "0.57...
0.77637976
0
Pylint and PEP8 QA report generator We use subprocess instead local because pylint and pep8 don't return a zero exit code. This behaviour is incompatible with fabric...
def release_qa(): lines = StringIO.StringIO(local('find . -name "*.py"', capture=True)) for line in lines.readlines(): print "PYLINT CHECK" print "-----------------------" pyfile = os.path.normpath(line).replace("\n","").replace("\r","") reportfilename = pyfile.replace("....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lint(to_lint):\n exit_code = 0\n for linter, options in (('pyflakes', []), ('pep8', pep8_options)):\n try:\n output = local[linter](*(options + to_lint))\n except commands.ProcessExecutionError as e:\n output = e.stdout\n\n if output:\n exit_code = 1\...
[ "0.65316886", "0.64339733", "0.62938845", "0.6269195", "0.6211118", "0.61833465", "0.61646247", "0.61259955", "0.6116404", "0.6100978", "0.6065386", "0.60457647", "0.60411966", "0.6017067", "0.5966548", "0.5959962", "0.5957931", "0.5918821", "0.5904913", "0.5893862", "0.58845...
0.7032081
0
installs and configures a fresh DIRAC UI (VO specific)
def install_ui(): # pick which VO I want to test, default gridpp print "Which VO do you want to test (default: gridpp) ?" user_VO = raw_input("Your choices are: gridpp, lz, lsst, solidexperiment.org, skatelescope.eu: ") \ or "gridpp" if user_VO not in ["gridpp", "lz", "lsst", "solidexperiment.org", "skate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap():\n validate_configurator_version()\n\n # put new mkinitcpio.conf in place\n run(\"mv /etc/mkinitcpio.conf.pacnew /etc/mkinitcpio.conf\")\n sed(\"/etc/mkinitcpio.conf\",\n 'MODULES=\"\"',\n 'MODULES=\"xen-blkfront xen-fbfront xen-kbdfront xen-netfront xen-pcifront xenbus_pr...
[ "0.603138", "0.58798337", "0.5784808", "0.5766571", "0.57437", "0.5734021", "0.5714146", "0.56864846", "0.5641124", "0.5625011", "0.56127167", "0.56086886", "0.5601726", "0.55902636", "0.55759335", "0.55585897", "0.55564934", "0.55510265", "0.5542947", "0.5528047", "0.5500627...
0.7038603
0
Called before anything else, i.e. just after installer controller creation. Return value is ignored.
def pre_installation(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepareController(self):\n pass", "def preRunSetup(self):\n self.logDesc(\"Pre Run Setup\") \n self.verifyCurrentUser(userRole='Administrator', loginAsUser=True)", "def preRunSetup(self):\n self.logDesc(\"Pre Run Setup\") \n self.verifyCurrentUser(userRole='Ad...
[ "0.69888854", "0.6657627", "0.6657627", "0.65865713", "0.64082533", "0.6388744", "0.6384215", "0.6347374", "0.63209623", "0.6310592", "0.6240077", "0.62371147", "0.62121433", "0.6202042", "0.619813", "0.61480397", "0.61330086", "0.6025088", "0.6025088", "0.60231227", "0.60074...
0.71761113
0
Called before any files have downloaded.
def pre_download(self, remote_files): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_and_prepare(self):\n self._download_and_prepare()", "def download_files(self):", "def pre_download(self):\n while not os.path.exists(self.file_path):\n time.sleep(1)\n\n if self.downloader.file_size != 0:\n # Waits %1 of the total download\n percen...
[ "0.72078025", "0.6953876", "0.6938813", "0.6892764", "0.6278536", "0.60983944", "0.60776293", "0.59928954", "0.59894645", "0.59894645", "0.59813267", "0.5980656", "0.5966963", "0.59472805", "0.5930741", "0.59225214", "0.58397645", "0.58169204", "0.57641727", "0.57575905", "0....
0.80088097
0
Called after every files have been downloaded.
def post_download(self, remote_files): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_finish(self, cloud_file):", "def pre_download(self, remote_files):\n pass", "def download_files(self):", "def _finalize(self):\n if self.url and self.url.startswith('file://'):\n self.parse_external_files(self.url[7:])\n Media._finalize(self)", "def download_fil...
[ "0.6957989", "0.6865277", "0.68242747", "0.64642113", "0.64255536", "0.64033055", "0.62918645", "0.62449217", "0.62424684", "0.62129873", "0.62109494", "0.62088096", "0.6166017", "0.616356", "0.6145047", "0.6114954", "0.6033107", "0.6015093", "0.59706825", "0.5961392", "0.594...
0.7216123
0
Called before the installation of any pkg.
def pre_install(self, installable_pkgs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_install_pkg(self, installable_pkg):\n pass", "def pre_installation(self):\n pass", "def post_install(self, installable_pkgs):\n pass", "def post_install_pkg(self, installable_pkg):\n pass", "def _install(self):\n\n pass", "def do_post_install(self, context):\n ...
[ "0.87274486", "0.8490351", "0.78138494", "0.76809055", "0.7401921", "0.7185641", "0.7014699", "0.7007921", "0.68065137", "0.6684582", "0.6648925", "0.6547911", "0.6547911", "0.6547911", "0.6547911", "0.6547911", "0.6534111", "0.65294236", "0.6491212", "0.6484541", "0.64816105...
0.86834514
1
Called before the installation of the given installable pkg.
def pre_install_pkg(self, installable_pkg): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_install(self, installable_pkgs):\n pass", "def post_install_pkg(self, installable_pkg):\n pass", "def post_install(self, installable_pkgs):\n pass", "def pre_installation(self):\n pass", "def setPkgRequired(self, *args):\n return _libsbml.SBMLDocument_setPkgRequir...
[ "0.803951", "0.79661417", "0.72544426", "0.7061348", "0.6615395", "0.645456", "0.63259906", "0.62912256", "0.6285924", "0.62740517", "0.625301", "0.62484384", "0.6227197", "0.6225595", "0.6215587", "0.6126311", "0.6083534", "0.60764074", "0.5963906", "0.59445024", "0.5924112"...
0.89542097
0
Called after the successful installation of the given installable pkg.
def post_install_pkg(self, installable_pkg): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_install(self, installable_pkgs):\n pass", "def pre_install_pkg(self, installable_pkg):\n pass", "def do_post_install(self, context):\n pass", "def notify_add_package(self, pkg):\n ver_key = (pkg.category, pkg.package)\n s = set(self.versions.get(ver_key, ()))\n ...
[ "0.7332126", "0.69622064", "0.6393076", "0.60962796", "0.5933556", "0.58876604", "0.58322257", "0.58148694", "0.5752", "0.554155", "0.5408007", "0.5398204", "0.53647107", "0.5351951", "0.5319673", "0.52867943", "0.5283457", "0.52370936", "0.5234688", "0.5212532", "0.52116287"...
0.8569286
0
Called after the successful installation of all pkg.
def post_install(self, installable_pkgs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_install_pkg(self, installable_pkg):\n pass", "def do_post_install(self, context):\n pass", "def post_installation(self, exc_value):\n pass", "def pre_install(self, installable_pkgs):\n pass", "def pre_install_pkg(self, installable_pkg):\n pass", "def _install(s...
[ "0.83991206", "0.7399972", "0.7169786", "0.69973654", "0.6994343", "0.6681931", "0.657458", "0.6570379", "0.65510577", "0.64301735", "0.6408434", "0.63056946", "0.6250174", "0.6222582", "0.61908776", "0.61649483", "0.6062687", "0.6025747", "0.6022049", "0.599792", "0.5966197"...
0.8408907
0
Called after anything else (will be called if pre_installation returned successfully) exc_value is None if no error, else the exception value
def post_installation(self, exc_value): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exc_handler(self, exc_type, exc, *args) -> None:\n self.exception = exc\n self.exit_code = 1", "def on_failure(self, exc: BaseException) -> None:", "def postcondition(self, result, exc_info, *args, **kwargs):\n pass", "def pre_setup(self) -> None:\n if self.__setup_done:\n ...
[ "0.62841517", "0.62787837", "0.6137501", "0.5973818", "0.5940887", "0.58668447", "0.58472353", "0.5836734", "0.5826562", "0.5807436", "0.5798474", "0.57931894", "0.57608753", "0.5755618", "0.5744285", "0.57340395", "0.57157147", "0.5701963", "0.5669499", "0.566829", "0.564802...
0.8339836
0
From the list of known to be upgraded pkgs, return a list of tuple (installed_pkg, [], [])) such that both list doesn't contains the pkg of the installed pkg. Also, if a new package to install is found in more than in one list, it will be discard in the later list.
def preprocess_upgrade_list(self, upgrade_list): return [(ed_pkg, able_pkg, [], []) for (ed_pkg, able_pkg) in upgrade_list]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_installed_packages() -> List['Package']:\n repo_packages_names = set(expac(\"-S\", ['n'], []))\n\n # packages the user wants to install from aur\n aur_names = packages_from_other_sources()[0]\n repo_packages_names -= aur_names\n\n installed_packages_names = set(expac(\"-Q...
[ "0.68577033", "0.66643363", "0.63001037", "0.6242023", "0.6221818", "0.61724806", "0.611967", "0.6084042", "0.608403", "0.60733235", "0.60682243", "0.6050123", "0.6046999", "0.60445344", "0.60400933", "0.599542", "0.59662074", "0.5938913", "0.5904515", "0.5884107", "0.5870722...
0.7349749
0
Copies the model parameters of one estimator to another.
def copy_model_parameters(sess, estimator1, estimator2): e1_params = [t for t in tf.trainable_variables() if t.name.startswith(estimator1.scope)] e1_params = sorted(e1_params, key=lambda v: v.name) e2_params = [t for t in tf.trainable_variables() if t.name.startswith(estimator2.scope)] e2_params = sorte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_para(from_model, to_model):\n for i, j in zip(from_model.trainable_weights, to_model.trainable_weights):\n j.assign(i)", "def sync_parameters(self, model: nn.Module) -> None:\n # before ema, copy weights from orig\n avg_param = (\n itertools.chain(self....
[ "0.6655023", "0.6186064", "0.6186064", "0.61854655", "0.6052574", "0.60511726", "0.60407877", "0.5963009", "0.5963009", "0.59216297", "0.59045017", "0.58989644", "0.589293", "0.58706653", "0.5860739", "0.58496034", "0.58299047", "0.58268255", "0.5764856", "0.57535136", "0.574...
0.7852629
1
LSTM input Generates a tensor that corresponds an LSTM input sequence from a two dimensional table (rows = samples, columns = variables)
def generate_lstm_input_sequence( input_tensor: Tensor, seq_len: int, window_shift_step_size: int ): num_iterations = (seq_len // window_shift_step_size) num_vars = input_tensor.shape[1] tensor_list = [] for i in range(num_iterations): # calculate how much the window has to be shifte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LSTM(inputs, dim, seq_len, name):\r\n with tf.name_scope(name) as scope:\r\n cell = tf.contrib.rnn.LSTMCell(num_units=dim)\r\n hidden_states, cell_states = tf.nn.dynamic_rnn(cell, inputs=inputs, sequence_length=seq_len, dtype=tf.float32, scope=name)\r\n\r\n return hidden_states, cell_states...
[ "0.671775", "0.6443419", "0.63130444", "0.6284584", "0.62595385", "0.6248711", "0.61987054", "0.61636215", "0.6117673", "0.6102052", "0.6073893", "0.6053332", "0.60326666", "0.5990912", "0.5978899", "0.59719133", "0.5913929", "0.58949786", "0.58881134", "0.5882032", "0.587783...
0.66498864
1
Gets the maximum sequence bounds of non idle time Machines shows default values at the beginning and end of the operations; this functions returns the ids of the longest sequence that is not operating with the default values. Note that you cannot just remove all default values, essentially because order matters and the...
def get_id_bounds( values: Tensor, default_value: float ): # get all values that are not default ones default_value_idx = (values == default_value).nonzero()[:, 0] # get the longest sequence without interruption # to do this, get the difference of the above ids diff = default_value_idx[1:] -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_loose_bounds(maxlum=None):\n return[(None,None), (10**-6, None), (2., 350),\n (None, -10**-6), (None, None)]", "def longest_sequence(start=1, end=1000000):\n\n max_length = 0\n max_start_value = 0\n\n # generate sequence for each value\n for i in range(start, end):\n cu...
[ "0.5749199", "0.5637835", "0.5553669", "0.5540054", "0.5517348", "0.54871017", "0.547557", "0.5464125", "0.54230356", "0.53948283", "0.53876203", "0.53298086", "0.5300341", "0.52418303", "0.5241372", "0.52193195", "0.5216842", "0.52015424", "0.520039", "0.51883274", "0.516819...
0.7332722
0
Creates a list of strings indicating available devices to test on. Checks for CUDA devices, primarily. Assumes CPU is always available.
def get_test_devices(): # Assumption: CPU is always available devices = ['cpu'] if torch.cuda.is_available(): devices.append('cuda') return devices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_test_devices():\n devices = [\"cpu\"]\n if torch.cuda.is_available():\n devices.append(\"cuda\")\n return devices", "def get_available_devices():\n executable_path = os.path.join(os.path.dirname(__file__), 'build')\n try:\n num_devices = int(subprocess.check_output(\n ...
[ "0.79648924", "0.779924", "0.74314016", "0.742399", "0.72089636", "0.7203299", "0.7203299", "0.71994233", "0.71461236", "0.71363676", "0.7131888", "0.7081655", "0.69478077", "0.6909545", "0.6909545", "0.68895745", "0.6862883", "0.6847569", "0.6778976", "0.67201084", "0.671292...
0.8175212
0
Read the pickled spacy objects
def read_spacy_pickle(self, file_path): vocab = self.nlp.vocab try: file = open(file_path, "rb") # putting the spacy doc in a single-item list to avoid pandas splitting it up spacy_objects = [[Doc(vocab).from_bytes(x)] for x in pickle.load(file)] file.cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_dictionary():\n # model = 'en_core_web_sm'\n # model = 'en_core_web_md'\n # model = 'en_core_web_lg'\n model = 'en' # Using 'en' instead of 'en_core_web_md', as the latter has many words without vector data. Check!\n print(\"Starting to read the model:\", model)\n # nlp = spacy.cli.down...
[ "0.60844487", "0.60844284", "0.59511757", "0.59002733", "0.587763", "0.5824237", "0.5801722", "0.5801091", "0.57834816", "0.57699907", "0.5766996", "0.57638127", "0.57596767", "0.57547075", "0.5739896", "0.5739467", "0.57228065", "0.57223886", "0.57158464", "0.5714373", "0.57...
0.67977774
0
Creates an Experiment with totaly artificial data. Experiment has one setup with two modalities, EMG and kin. EMG has four channels, KIN has three channels. Two sessions are "recorded" for two different subjects. All EMG recordings have sampling rate of 20Hz, all KIN recordings sampling rate of 5Hz.
def setup(cls): cls.logger = logging.getLogger('ModelTestLogger') cls.logger.setLevel(logging.DEBUG) s1 = model.Subject('subject1') s2 = model.Subject('subject2') cls.experiment = model.Experiment() cls.experiment.put_subject(s1) cls.experiment.put_subject(s2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_exp2(args):\n\n # load data.\n SC = np.load(args.SC)\n sc_lbls = np.load(args.sc_lbls)\n c_lbls = np.load(args.c_lbls)\n b_lbls = np.load(args.b_lbls)\n\n # compute dimensions.\n n = args.n\n m = SC.shape[0]\n k = c_lbls.shape[0]\n l = SC.shape[1]\n t = args.t\n q = a...
[ "0.62235945", "0.6049082", "0.6045395", "0.5995295", "0.5993515", "0.5865029", "0.5863797", "0.579151", "0.5732537", "0.57056975", "0.56597024", "0.56380254", "0.56178087", "0.56018513", "0.55858195", "0.5584628", "0.5583475", "0.55769795", "0.5555405", "0.55462915", "0.55410...
0.7082174
0
provides a number to sort related in ascending length of description
def sorter(r): ans = len(r.description) if additional: for rr in r.monkey_additional: ans += len(rr) return ans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort():\n return -1", "def Order(self) -> int:", "def _natural_sort_worksheet(x):\n l = re.findall(r\"\\d+$\", x.title)\n if l:\n return int(l[0])\n\n return -1", "def _wiki_sort_key(doc):\n url = doc['url']\n return 1 if url.startswith('https://en.wikipedia') else -1...
[ "0.6401724", "0.62728316", "0.60654205", "0.60012025", "0.59754735", "0.59544206", "0.59370434", "0.59157306", "0.58810264", "0.58680815", "0.58301955", "0.5825593", "0.57766974", "0.5709983", "0.5653453", "0.560097", "0.5593121", "0.555219", "0.5539747", "0.5538889", "0.5534...
0.6969995
0
Initialise with a MIP document
def __init__(self, document): self._settemplates(self.onecol, self.twocol) assert document.type_key == 'cim.2.designing.Project' self.doc = document # We will populate the "mip" variable with the mip era self.mips = 'CMIP6' self.related = [] for r in self.doc.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, doc):\n\n self.doc = doc\n if self.doc.doi:\n self._populate()\n self.populated = True\n else:\n self.populated = False", "def __init__(self, document):\n self._settemplates(self.onecol, self.twocol)\n assert document.type_key...
[ "0.6678455", "0.6528227", "0.61595803", "0.6156851", "0.6055568", "0.5943074", "0.5899902", "0.58804005", "0.5799892", "0.5787662", "0.5785426", "0.57476616", "0.5745662", "0.5730278", "0.5711061", "0.57024944", "0.57002866", "0.56933963", "0.56916255", "0.5650309", "0.564237...
0.7006556
0
make sure the html output works
def testHTML(self): html = self.E.html()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_html_output(self):\n pass", "def test_error_html_using_patch(self):\n pass", "def test_prep_fields_called_html_output(self):\n pass", "def get_html(self):\r\n pass", "def rawHTMLrendered(self):", "def __html__(self):\n return self.html", "def test_error_html_...
[ "0.84040964", "0.69680446", "0.6919716", "0.687463", "0.6762656", "0.67169726", "0.66983867", "0.65646785", "0.6555906", "0.6548506", "0.6533556", "0.65294725", "0.6498341", "0.6488538", "0.6470183", "0.64627945", "0.6459197", "0.64506996", "0.64353263", "0.64152896", "0.6384...
0.7505332
1
For example purposes, we do not remove the outputs, which is why this is NOtearDown. If you really want to use this for unit tests, rename to tearDown.
def NOtearDown(self): for f in self.testoutput: if os.path.exists(f): os.remove(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n print('Calling \\'tearDown\\'')", "def tearDown(self):\n self.logger.info(\"tearDown begin\")\n self.logger.info(\"tearDown end\\n\")", "def tearDown(self):\n pass\n # teardown called after each test\n # e.g. maybe write test results to some text ...
[ "0.80834854", "0.7997705", "0.7978577", "0.7940476", "0.7940476", "0.7940476", "0.78952134", "0.78137136", "0.77655464", "0.77655464", "0.77423745", "0.7723258", "0.7723258", "0.7723258", "0.7717584", "0.7717088", "0.77133566", "0.7675167", "0.76713866", "0.76457465", "0.7645...
0.80674917
1
Generate bootstrap replicate of 1D data.
def bootstrap_replicate_1d(data, func): bs_sample = np.random.choice(data, len(data)) return func(bs_sample)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap_replicate_1d(data, func):\n bs_sample = np.random.choice(data, len(data))\n return func(bs_sample)", "def bootstrap_replicate_1d(data, func):\n bs_sample = np.random.choice(data, len(data))\n\n return func(bs_sample)", "def bootstrap(X):\n return X[np.random.choice(list(range(X.sha...
[ "0.7789665", "0.77793765", "0.740078", "0.7145126", "0.6915617", "0.676676", "0.65354204", "0.6499645", "0.6398692", "0.62889034", "0.62032557", "0.6193025", "0.6095193", "0.601948", "0.5998936", "0.58984625", "0.5879488", "0.58694214", "0.5786773", "0.5758723", "0.5742155", ...
0.78276443
0
Actualiza los canvas, los pinta en esta ventana, y lleva a cabo el flip para mostrar los cambios
def display(self): for c in self.canvas.values(): c.update() self.superficie.blit(c.superficie, c.origen) pygame.display.flip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loop(self, frame):\n self.root = frame\n self.drawUI()\n cv2.imshow('Fotopasca', self.root)", "def renderizar(self):\n\t\t# Limpiar la pantalla\n\t\tglClear(GL_COLOR_BUFFER_BIT)\n\t\t# Renderizar la escena\n\t\tself.escena.renderizar()\n\t\t# Renderizar los buffers a la pantalla\n\t\tpyg...
[ "0.6508464", "0.6444371", "0.6252179", "0.62192374", "0.6206115", "0.6204564", "0.6166355", "0.61551905", "0.6130094", "0.60961246", "0.6088001", "0.60873604", "0.6068308", "0.6057062", "0.60507476", "0.6043697", "0.60300726", "0.60265714", "0.60210216", "0.6011016", "0.60062...
0.71416545
0
Setup injections Note that the actual injected current is proportional to dt of the clock So, you need to use the same dt for stimulation as for the model Strangely, the pulse gen in compartment_net refers to firstdelay, etc.
def setupinj(model, delay,width,neuron_pop): pg = moose.PulseGen('pulse') pg.firstDelay = delay pg.firstWidth = width pg.secondDelay = 1e9 for ntype in neuron_pop.keys(): for num, name in enumerate(neuron_pop[ntype]): injectcomp=moose.element(name +'/'+model.param_cond.NAME_SOMA)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(timestep=None, min_delay=None, max_delay=None, **kwargs):\n global controller\n\n logger.info(\"PACMAN103 (c) 2014 APT Group, University of Manchester\")\n logger.info(\" Release version 2014.4.1 - April 2014\")\n # Raise an exception if no SpiNNaker machine is specified\n ...
[ "0.60317343", "0.5933767", "0.59041595", "0.5831756", "0.57520694", "0.57439333", "0.5739036", "0.57341063", "0.5705485", "0.5683423", "0.5623893", "0.5612428", "0.5607956", "0.5603607", "0.5600375", "0.5599384", "0.55948526", "0.55602384", "0.5559706", "0.55517477", "0.55408...
0.611647
0
Wrap a collection to print iteration progress as a percentage.
def progress_iterator(collection: Collection, message: str) -> Iterable: num_items = len(collection) last_percentage = -1 for i, item in enumerate(collection): percentage = 100 * i // num_items if percentage > last_percentage: last_percentage = percentage print(f"{mes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def progress(items, desc='', total=None, min_delay=0.1):\n total = total or len(items)\n t_start = time.time()\n t_last = 0\n for n, item in enumerate(items):\n t_now = time.time()\n if t_now - t_last > min_delay:\n print('\\r%s%d/%d (%6.2f%%)' % (desc, n+1, total, n / float(to...
[ "0.59742546", "0.59003246", "0.5892191", "0.58499545", "0.5846175", "0.5842051", "0.58191466", "0.58191466", "0.57947624", "0.5790346", "0.57512665", "0.5720828", "0.57070386", "0.57001543", "0.5694676", "0.5692206", "0.56794834", "0.5662845", "0.5627087", "0.561779", "0.5617...
0.78705937
0
Linearly mix two colors. A mix_amount of 0.0 gives color1, and 1.0 gives color2.
def mix_colors(color1: Color, color2: Color, mix_amount: float) -> Color: return [(1-mix_amount)*v1 + mix_amount*v2 for v1, v2 in zip(color1, color2)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mix(a, b, amount):\n return ((1.0 - amount) * a) + (amount * b)", "def mix(self, other, coef=0.5):\n def m(a, b):\n return a * (1 - coef) + b * coef\n\n return Color(from_rgba=(c(m(self.r, other.r)),\n c(m(self.g, other.g)),\n ...
[ "0.6814503", "0.66157776", "0.65710086", "0.65704286", "0.6514247", "0.6078982", "0.60165936", "0.60012364", "0.5994862", "0.5946861", "0.5756687", "0.5738199", "0.57059467", "0.56846344", "0.56739783", "0.5672902", "0.55314547", "0.54851085", "0.5474063", "0.54560703", "0.54...
0.80415565
0
Multiply two vectors elementwise.
def multiply_vectors(vec1: Iterable[float], vec2: Iterable[float]) -> Iterable[float]: return [v1*v2 for v1, v2 in zip(vec1, vec2)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mulVectors(X1,X2):\n _checkSize(X1,X2)\n return sum([ X1[i] * X2[i] for i in range(len(X1))])", "def dot_product(vector1, vector2):\n return [reduce_by_multiplication(pair) for pair in zip(vector1, vector2)]", "def vec_dot(x, y):\r\n return sum(a * b for a, b in zip(x, y))", "def __mul__(self,...
[ "0.8108592", "0.758668", "0.7563538", "0.75536615", "0.7483179", "0.7424614", "0.739436", "0.73315334", "0.73269993", "0.7323699", "0.7294078", "0.72823274", "0.72690797", "0.72641194", "0.72641194", "0.72514796", "0.72514236", "0.724465", "0.72237176", "0.7200534", "0.714153...
0.8106799
1
Create a directional light given its direction and color. The dot_clip parameter adjusts the value of the dot product used in the lighting calculation; a lower value compresses the range of brightnesses produced by the light.
def __init__(self, direction: Point3D, color: Color, dot_clip: float = 0.0): self._direction = normalize(*direction) self._color = color self._dot_clip = dot_clip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directionalLight(*args, decayRate: int=0, discRadius: Union[float, bool]=0.0, exclusive:\n bool=True, intensity: Union[float, bool]=0.0, name: Union[AnyStr, bool]=\"\",\n position: Union[List[float, float, float], bool]=None, rgb:\n Union[List[float, ...
[ "0.5512884", "0.5359985", "0.5224884", "0.51298463", "0.49652985", "0.49155885", "0.49088266", "0.48779944", "0.4798884", "0.47342348", "0.47193816", "0.47108945", "0.46938923", "0.46933818", "0.46920228", "0.4672632", "0.46464553", "0.46086583", "0.46074972", "0.4583746", "0...
0.63035196
0
Return the maximum color value that this light can produce.
def get_max_brightness(self) -> float: return max(self._color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color_max(image, color):\n boundaries = find_color_boundaries(image, color)\n if boundaries:\n return (0, image[boundaries[0] : boundaries[1] + 1, boundaries[2] : boundaries[3] + 1])\n else:\n return 1, None", "def maximal_color(graph, node):\n return max(get_node_colors(graph, ...
[ "0.7567657", "0.7444326", "0.69971585", "0.68010145", "0.67860895", "0.66241765", "0.6564625", "0.6542855", "0.65393096", "0.65304965", "0.6511511", "0.6487539", "0.64411324", "0.6435717", "0.64141905", "0.6350198", "0.6333665", "0.63173854", "0.62954146", "0.6288576", "0.625...
0.8303178
0
Return the color contributed by this light on a surface given its (unit) normal vector and material color.
def compute_shaded_color(self, normal: Point3D, material_color: Color) -> Color: dot_product = sum(multiply_vectors(self._direction, normal)) light_amount = max(dot_product, self._dot_clip) light_amount = (light_amount - self._dot_clip) / (1.0 - self._dot_clip) return [vm*vl*light_amount...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_shaded_color(self, p1: Point3D, p2: Point3D, p3: Point3D, material_color: Color) -> Color:\n # compute the normal vector\n ax, ay, az = p1[0]-p2[0], p1[1]-p2[1], p1[2]-p2[2]\n bx, by, bz = p1[0]-p3[0], p1[1]-p3[1], p1[2]-p3[2]\n nx = ay*bz - az*by\n ny = az*bx - ax*bz...
[ "0.66830057", "0.64685374", "0.63342154", "0.6113619", "0.61106956", "0.60924566", "0.6054413", "0.6053781", "0.6053781", "0.6053781", "0.60509187", "0.6034845", "0.59819704", "0.59732807", "0.59732807", "0.5946499", "0.5937387", "0.59219927", "0.5917848", "0.5914473", "0.591...
0.7437899
0
Project a point in 3D world space into 2D screen space.
def project_point(self, point: Point3D) -> Point3D: x, y, z = point cam_x, cam_y, cam_z = self._pos x -= cam_x y -= cam_y z -= cam_z dx = self._cy*(self._sz*y + self._cz*x) - self._sy*z dy = self._sx*(self._sy*(self._sz*y + self._cz*x) + self._cy*z) + self._cx*(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _world_point(self, point_3d):\n return self.obj.matrix_world @ point_3d", "def screenToCamera(self,x,y):\n #self.x = x\n #self.y = y\n new_x = x / (self.surf.get_width() - 1) - 0.5\n #-(new_x)\n new_y = y / (self.surf.get_height() - 1)\n new_y = (1.0 - cy) - 0...
[ "0.74053556", "0.6547067", "0.64282596", "0.64282596", "0.64282596", "0.6392517", "0.63821685", "0.63705236", "0.6332853", "0.63261366", "0.63232213", "0.6312432", "0.6261391", "0.62242615", "0.6203859", "0.61349493", "0.6087345", "0.6072686", "0.60687876", "0.6006095", "0.59...
0.72277606
1
Fade a color depending on how far from the camera it is.
def compute_fog_faded_color(self, color: Color, dz: float) -> Color: fade_amount = math.exp(-(dz * self._fog_factor)**2) return mix_colors(UPPER_SKY_COLOR, color, fade_amount)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def colorEyes(self, color, fade_duration = 0.2):\n\n\t\tif color in self.colors:\n\t\t\tcolor = self.colors[color]\n\n\t\tself.leds.fadeRGB(\"FaceLeds\", color, fade_duration)", "def do_fade_colour(l, leds, r, g, b, duration):\n l._do_multi_led_command(\n create_fade_colour_command, leds, r, g,...
[ "0.6437271", "0.64267206", "0.6367479", "0.62626547", "0.6219544", "0.61913073", "0.5968006", "0.57155895", "0.5697734", "0.5643331", "0.5637951", "0.5629955", "0.5598446", "0.558756", "0.5551077", "0.5531995", "0.5469604", "0.54235256", "0.53964067", "0.5386732", "0.53677034...
0.6534394
0
Shade, project, and draw a list of triangles in 3D.
def draw_triangles(self, triangles: Collection): # project the points into 2D and compute each shaded/faded color processed_triangles = [] for p1, p2, p3, color in progress_iterator(triangles, "Processing triangles..."): shaded_color = self.compute_shaded_color(p1, p2, p3, color) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_wireframe_3d(self, **kwds):\n wireframe = [];\n for l in self.lines:\n l_coords = self.coordinates_of(l)\n wireframe.append( line3d(l_coords, **kwds))\n for a in self.arrows:\n a_coords = self.coordinates_of(a)\n wireframe.append(arrow3d(a...
[ "0.6908125", "0.6733296", "0.6631174", "0.654832", "0.65126437", "0.6491568", "0.64820564", "0.6396006", "0.6345809", "0.6259672", "0.624029", "0.6208812", "0.6182865", "0.6181145", "0.610569", "0.6074357", "0.60483927", "0.60355747", "0.5983546", "0.5922067", "0.5917617", ...
0.7079494
0
Return the key in the _heightmap dict for the given triangle.
def _get_heightmap_key(self, p1: Point3D, p2: Point3D, p3: Point3D) -> Hashable: return p1[0]+p2[0]+p3[0], p1[2]+p2[2]+p3[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getblockhash(self, blockheight):\n for block in self.blocks:\n if block[\"height\"] == int(blockheight):\n return block[\"hash\"]", "def height_at(self, x, z):\n\n return self.heightmap[x * 16 + z]", "def hkl(self, i):\n return self.get_hkl(self.xp[i], self.yp...
[ "0.5575947", "0.549903", "0.5401808", "0.53665644", "0.53405434", "0.5322528", "0.52560556", "0.5242165", "0.5181723", "0.51672906", "0.51612586", "0.5136122", "0.5113682", "0.50287825", "0.5016688", "0.50130314", "0.5011915", "0.49585357", "0.49564213", "0.49434075", "0.4912...
0.68827283
0
Fill the background sky gradient. Uses num_steps rectangles to approximate a linear gradient that goes from the top of the screen to start_y of the way down the screen (between 0.0 and 1.0).
def fill_sky_gradient(num_steps: int, start_y: float): # compute some helper values min_x = -turtle.window_width() / 2 max_x = +turtle.window_width() / 2 y_step = turtle.window_height()*start_y / num_steps min_y = turtle.window_height() / 2 - turtle.window_height()*start_y # fill the sectio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_bg (self):\n self.health = max(0.0, min(1.0, (self.healthsteps + self.mud.value) / self.healthsteps))\n healthycolor = (0x11, 0x22, 0x44)\n pollutedcolor = (0x66, 0x66, 0)\n self.watercolor = [int((a - b) * self.health + b)\n for a,b in zip(healthycolo...
[ "0.5875574", "0.5867943", "0.567791", "0.565743", "0.56277025", "0.56065214", "0.54429275", "0.54425997", "0.5415052", "0.54125994", "0.5393641", "0.5389858", "0.5376464", "0.532522", "0.52964115", "0.52853453", "0.52220666", "0.5220336", "0.5219927", "0.52009046", "0.5150408...
0.82996637
0
Partition all the ELM events into training, validation and test indices. Training and validation sets are created based on simple splitting with validation set being `fraction_validate` of the training set or by Kfold crossvalidation.
def _partition_elms( self, max_elms: int = None, fold: int = None ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: # get ELM indices from datafile elm_index, _ = self._read_file() # limit the data according to the max number of events passed if max_elms is not None and max_el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_validation_split(self, threshold=None):\n for train, validation in self._get_k_folds(5, threshold):\n train_provider = train\n validation_provider = validation\n break\n return train_provider, validation_provider", "def split_data(self):\n self.trai...
[ "0.64495283", "0.6436599", "0.64065903", "0.62911177", "0.6255103", "0.62455463", "0.62217116", "0.6184939", "0.61742663", "0.61742663", "0.61652815", "0.6137683", "0.61352956", "0.61342204", "0.61287206", "0.6107777", "0.60363936", "0.6032738", "0.60128796", "0.59902066", "0...
0.7032567
0
PyTorch dataset class to get the ELM data and corresponding labels according to the sample_indices. The signals are grouped by `signal_window_size`
def __init__( self, signals: np.ndarray, labels: np.ndarray, sample_indices: np.ndarray, window_start: np.ndarray, signal_window_size: int, label_look_ahead: int, stack_elm_events: bool = False, transform=None, ): self.signals = signals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_data(nb_samples):\n inputs = torch.empty(nb_samples, 2).uniform_(0, 1)\n center = Tensor([0.5, 0.5]).view(1, -1)\n distances = torch.norm((inputs - center).abs(), 2, 1)\n labels = (distances < 1 / math.sqrt(2 * math.pi)).type(LongTensor)\n return inputs.t(), labels", "def sample(self,...
[ "0.5600111", "0.54804593", "0.5479767", "0.5365365", "0.530453", "0.5254754", "0.52142054", "0.51725596", "0.5127227", "0.51050186", "0.50939244", "0.50804824", "0.5077783", "0.5063263", "0.50388134", "0.5032259", "0.50208396", "0.5009674", "0.5003568", "0.49945354", "0.49891...
0.57378817
0
Given a Stormpath resource, we'll extract the custom data in a JSON compatible format.
def get_custom_data(self, resource): try: custom_data = dict(resource.custom_data) except AttributeError: custom_data = dict(resource['custom_data']) custom_data['createdAt'] = custom_data['created_at'].isoformat() custom_data['modifiedAt'] = custom_data['modifie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meta_data(self):\r\n return simplejson.dumps(self.__resource_meta)", "def fetch_extra_data(resource):\n person_id = resource.get(\"cern_person_id\")\n return dict(person_id=person_id)", "def get_resource_data(self, resource):\n url = self.api_url + resource\n return self.get_url_...
[ "0.7061312", "0.6757691", "0.61228764", "0.6066298", "0.5922103", "0.5876381", "0.5807942", "0.5787658", "0.57215774", "0.571815", "0.5709122", "0.56961465", "0.56823915", "0.5677301", "0.5654893", "0.5653712", "0.5647304", "0.56388575", "0.55996674", "0.55707127", "0.5553939...
0.69236267
1
Given a Stormpath Resource, we'll extract the resource ID.
def get_id(self, resource): try: return resource.href.split('/')[-1] except AttributeError: return resource['href'].split('/')[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resourceDocumentId(self, resource: Resource) -> str:", "def resource_id(self) -> str:\n return pulumi.get(self, \"resource_id\")", "def resource_id(self) -> str:\n return pulumi.get(self, \"resource_id\")", "def resource_id(self) -> str:\n return pulumi.get(self, \"resource_id\")", ...
[ "0.77710336", "0.7645945", "0.7645945", "0.7645945", "0.76283467", "0.76112777", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.7460142", "0.7449439", "0.7448532", "0.74260885", "0...
0.7842492
0
Export all tenant data for this Stormpath account.
def export_tenants(self): print('\n=== Exporting all tenant data...') tenant = dict(self.client.tenant) print('- Exporting tenant:', tenant['name']) json = { 'id': self.get_id(tenant), 'href': tenant['href'], 'name': tenant['name'], 'key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_accounts(self):\n print('=== Exporting all account data...')\n\n for account in self.client.tenant.accounts:\n print('- Exporting account:', account.email)\n\n json = {\n 'id': self.get_id(account),\n 'href': account.href,\n ...
[ "0.7993855", "0.64110136", "0.6349004", "0.6227858", "0.61415046", "0.5991233", "0.5866704", "0.5837029", "0.5750611", "0.56921303", "0.56606555", "0.56530935", "0.56111664", "0.5586277", "0.55795664", "0.5577892", "0.55623376", "0.5542531", "0.55090034", "0.5446627", "0.5430...
0.8416211
0
Export all application data for this Stormpath account.
def export_applications(self): print('\n=== Exporting all application data...') for application in self.client.applications: print('- Exporting application:', application.name) json = { 'id': self.get_id(application), 'href': application.href, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_data(self):\n return self.export_all_data()", "def export_accounts(self):\n print('=== Exporting all account data...')\n\n for account in self.client.tenant.accounts:\n print('- Exporting account:', account.email)\n\n json = {\n 'id': self.get_...
[ "0.66612107", "0.6570566", "0.62946093", "0.59756947", "0.59498", "0.59372663", "0.5811485", "0.5728861", "0.55750054", "0.55355513", "0.5454583", "0.5442122", "0.5434154", "0.54202384", "0.54049903", "0.5402838", "0.5373483", "0.53653264", "0.5299492", "0.52917093", "0.52849...
0.7371662
0
Export all directory data for this Stormpath account.
def export_directories(self): print('=== Exporting all directory data...') for directory in self.client.directories: print('- Exporting directory:', directory.name) json = { 'id': self.get_id(directory), 'href': directory.href, 'n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_accounts(self):\n print('=== Exporting all account data...')\n\n for account in self.client.tenant.accounts:\n print('- Exporting account:', account.email)\n\n json = {\n 'id': self.get_id(account),\n 'href': account.href,\n ...
[ "0.6736293", "0.63576007", "0.62175053", "0.60875624", "0.58454275", "0.5837468", "0.57908094", "0.570937", "0.5686852", "0.56343424", "0.55987227", "0.55606085", "0.55584383", "0.5548896", "0.5548611", "0.55001694", "0.5499001", "0.547543", "0.54266113", "0.5383986", "0.5332...
0.73455876
0
Export all organization data for this Stormpath account.
def export_organizations(self): print('\n=== Exporting all organization data...') for organization in self.client.organizations: print('- Exporting organizations:', organization.name) json = { 'id': self.get_id(organization), 'href': organization...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_accounts(self):\n print('=== Exporting all account data...')\n\n for account in self.client.tenant.accounts:\n print('- Exporting account:', account.email)\n\n json = {\n 'id': self.get_id(account),\n 'href': account.href,\n ...
[ "0.7005029", "0.6404232", "0.6374312", "0.6110875", "0.59876496", "0.5962026", "0.5902772", "0.5896829", "0.5857048", "0.5806698", "0.5772332", "0.5749651", "0.5704955", "0.56713694", "0.5623573", "0.56124943", "0.56087846", "0.55982965", "0.5550646", "0.553527", "0.5504203",...
0.80846584
0
Export all group data for this Stormpath account.
def export_groups(self): print('=== Exporting all group data...') for group in self.client.tenant.groups: print('- Exporting group:', group.name) json = { 'id': self.get_id(group), 'href': group.href, 'name': group.name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_accounts(self):\n print('=== Exporting all account data...')\n\n for account in self.client.tenant.accounts:\n print('- Exporting account:', account.email)\n\n json = {\n 'id': self.get_id(account),\n 'href': account.href,\n ...
[ "0.6567801", "0.64058274", "0.6267897", "0.61082447", "0.60897505", "0.6071893", "0.59926325", "0.5926644", "0.58263636", "0.58187973", "0.5750844", "0.5742057", "0.57241446", "0.5646611", "0.56150687", "0.56112945", "0.55956185", "0.55901736", "0.556596", "0.55508196", "0.55...
0.81396973
0
Export all account data for this Stormpath account.
def export_accounts(self): print('=== Exporting all account data...') for account in self.client.tenant.accounts: print('- Exporting account:', account.email) json = { 'id': self.get_id(account), 'href': account.href, 'username': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_data(self):\n return self.export_all_data()", "def fetch_accounts(self):\n return self.fetch('/accounts')", "def accounts():", "def get_all_accounts_information(self):\n\t\treturn self._send_command_to_entity_server(us.SERVER_COMMAND_ENTITY_OWNER_SUDO_OPERATION, us.SERVER_COMMAND_GET...
[ "0.66904116", "0.66201806", "0.65058035", "0.6460658", "0.6426826", "0.63867044", "0.63663775", "0.62696487", "0.62393665", "0.62054133", "0.6188278", "0.6173564", "0.61213315", "0.6097949", "0.6078857", "0.6077221", "0.6065543", "0.6044305", "0.60366124", "0.6018987", "0.599...
0.7974274
0
Log error, then raise if is is set.
def log_error(self, error: Exception) -> None: logging.error(error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _log_error(self, err_msg):\n if self._on_error_action == \"raise\":\n raise InvalidDatasetError(err_msg)\n else:\n logger.warning(err_msg)", "def error(self, tag, message, exc_info=False):\n \n self.log(logging.error,tag, message, exc_info)", "def error ( ...
[ "0.7021225", "0.6831562", "0.6772998", "0.67632544", "0.6753129", "0.67513996", "0.6689103", "0.66439587", "0.6643325", "0.66173506", "0.6590305", "0.65843606", "0.6580504", "0.6578764", "0.6578764", "0.6573797", "0.6555744", "0.6552961", "0.654769", "0.65416425", "0.6523136"...
0.68669385
1
Get replacement file when original missing.
def get_replacement_file(self, path) -> Optional[bytes]: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getOriginalFile(url):\n # does url exist?\n if url is None or url is \"\":\n return", "def get_pristine(self):\n for path in self.get_all_files():\n if path.endswith('.orig.tar.gz'):\n return path\n return None", "def get_original_path(self) -> Optional[...
[ "0.64597625", "0.6178859", "0.61031616", "0.5966035", "0.5832142", "0.582151", "0.58184856", "0.5694266", "0.56546396", "0.5616646", "0.55166143", "0.5515076", "0.5506135", "0.5455651", "0.5425946", "0.5390687", "0.5366639", "0.53574777", "0.53303367", "0.53286433", "0.532718...
0.7418505
0
Get next CID for related content.
def get_next_cid(self) -> str: self.position += 1 return "img{}".format(self.position)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_id(self):\n self.id_counter += 1\n return self.id_counter - 1", "def next_collapsed_id(self):\n to_return = self.collapsed_id_counter\n self.collapsed_id_counter += 1\n return to_return", "def get_next_id(self):\n con = self.c._connect()\n last_id = sel...
[ "0.61992425", "0.61363083", "0.6128795", "0.5966513", "0.59172714", "0.5896527", "0.58824", "0.58359903", "0.58097434", "0.5796506", "0.5771497", "0.5724505", "0.5684626", "0.56635547", "0.56191045", "0.55953336", "0.5580772", "0.55750984", "0.5575075", "0.55578667", "0.55578...
0.7154687
0
Collect images from html code. Return html with iamge src=cid and list of tuple with (maintype, subtype, cid, imagebytes).
def collect_images(self, html_body: str, encoding: str = "UTF-8") -> Tuple[str, List[Tuple[str, str, str, bytes]]]: images = [] reader = etree.HTMLParser(recover=True, encoding=encoding) root = etree.fromstring(html_body, reader) self.init_cid() same_content = {} # type: Dict[by...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed_images(self):\n for img in self.book.xpath(\"//img[ not(starts-with(@src, 'data:')) and @src!= '']\"):\n img_src = img.attrib[\"src\"]\n img_raw = self.get_remote_content(img_src)\n if img_raw != None:\n img_64 = base64.b64encode(img_raw)\n ...
[ "0.6578264", "0.6405035", "0.636044", "0.6353167", "0.625685", "0.61547244", "0.61008567", "0.60811025", "0.6048114", "0.5902244", "0.5867286", "0.5780136", "0.5753646", "0.57383347", "0.57188696", "0.56709164", "0.5641198", "0.5579539", "0.55609024", "0.55588067", "0.5557961...
0.76466244
0
Collect attachment contents from paths or urls.
def collect_attachments(self, paths_or_urls: Iterable[str]) -> List[Tuple[str, str, str, bytes]]: attachments = [] same_content = [] # type: List[bytes] for src in paths_or_urls: try: content = self.load_file(src) except ImageNotFound as err: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_attachments(request):\n attachments = []\n for attachment in request.files.getlist('attachment'):\n attachments.append(Attachment(attachment.filename, attachment))\n return attachments", "def attachments(self):\n for part in self.email.walk():\n filename = part.get_fil...
[ "0.6221126", "0.6146354", "0.60774887", "0.5915002", "0.5801748", "0.5782203", "0.57530725", "0.57097447", "0.56753266", "0.5673091", "0.56211513", "0.5555098", "0.5532392", "0.5503337", "0.54877687", "0.5478201", "0.5437538", "0.5432417", "0.5394351", "0.53382355", "0.533160...
0.7265279
0
Get C statistics numpy record list, or return None if the file does not exist.
def load_csv_cached(filename='../apps/naive_c_stats.csv', cache={}): if filename in cache: return cache[filename] if not os.path.exists(filename): ans = None else: ans = numpy.recfromcsv(filename) cache[filename] = ans return ans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MainStats(path, filetype, NrExp, col, start, stop):\n# path= path.split('/') # here is better to google and see what is going on. Or experiment alone\n# path= \"/\".join(path[:-1]) \n dato=ExtractData_raw_files(path, filetype)\n dBase=dato.createDictBase()\n stats = Stats(dBase, NrExp, col, ...
[ "0.55165815", "0.54774755", "0.54651594", "0.53451926", "0.5323847", "0.524924", "0.51764786", "0.514426", "0.51365834", "0.5109591", "0.5106836", "0.50748354", "0.50632674", "0.50623465", "0.5045517", "0.5033683", "0.5028954", "0.5026244", "0.502574", "0.5021514", "0.5018565...
0.5491351
1
Get the lines of main program logic, excluding various less important information such as imports/comments/tests, and globals (typically used for tests).
def lines(filename, exclude_imports=True, exclude_comments=True, exclude_tests=True, exclude_globals=True, exclude_blank=True, verbose=False, is_c=False, s=None): if s is None: s = open(filename, 'rt').read() L = s.split('\n') # Hack to strip out triple and single quote string lines in a heuri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lines_without_stdlib(self):\n prev_line = None\n current_module_path = inspect.getabsfile(inspect.currentframe())\n for module_path, lineno, runtime in self.lines:\n module_abspath = os.path.abspath(module_path)\n if not prev_line:\n prev_line = [module...
[ "0.67089903", "0.58544457", "0.5778849", "0.5775647", "0.57722783", "0.56521636", "0.563037", "0.5536816", "0.551413", "0.5475512", "0.54629", "0.54422885", "0.54418725", "0.5426173", "0.5407686", "0.53450173", "0.53443503", "0.5323852", "0.5322268", "0.5320133", "0.5281814",...
0.6400236
1
stimate distance given estimated sensor locations.
def compute_distance_with_sensor_and_obj_loc(sensor_loc, obj_loc): estimated_distance = scipy.spatial.distance.cdist(obj_loc, sensor_loc, metric='euclidean') return estimated_distance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure_distance(self):\n # set Trigger to HIGH\n GPIO.output(self.GPIO_TRIGGER, True)\n\n # set Trigger after 0.01ms to LOW\n time.sleep(0.00001)\n GPIO.output(self.GPIO_TRIGGER, False)\n\n start_time = time.time()\n stop_time = time.time()\n\n # save St...
[ "0.62089807", "0.597473", "0.59654075", "0.5948641", "0.589891", "0.58918214", "0.58761024", "0.5871087", "0.5824022", "0.5823167", "0.5822607", "0.5809026", "0.57345897", "0.57335913", "0.5690579", "0.56877965", "0.5680121", "0.56717455", "0.56000197", "0.5594889", "0.558374...
0.6066834
1
Find and read the observing log file.
def load_obslog(pattern, fmt='obslog', verbose=True): # find observing log in the current workin gdirectory logname_lst = [fname for fname in os.listdir(os.curdir) if re.match(pattern, fname)] if len(logname_lst)==0: print('No observation log found') return None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_linelog():", "def _read_log(self):\n\n line_regex = compile(r\"\\[I\\]\\s*\\(\\d+ms\\)[^\\d]+(?P<counter>\\d+)\"\n r\"[^\\d]+(?P<timestamp>\\d+(\\.\\d+)?)[^\\d]+\"\n r\"(?P<acceleration>\\d+);\")\n values = []\n with open(self....
[ "0.60699195", "0.5945723", "0.5875873", "0.5854158", "0.57434773", "0.57226753", "0.57217354", "0.57209086", "0.5714799", "0.5700735", "0.56245184", "0.5595432", "0.55869824", "0.557967", "0.5578444", "0.5529408", "0.5524706", "0.55045867", "0.54335624", "0.5433416", "0.53890...
0.64161575
0
Save frames to a single row or as a gif.
def save_frames(frames, out_dir, as_row=True, as_gif=False): os.makedirs(out_dir, exist_ok=True) if frames.dtype == torch.uint8: # save_image needs float value in [0, 1] frames = frames.float() frames = frames / 255. if as_gif: gif_dir = 'gif_images' os.makedirs(os.path.join(out_dir, gif_dir), ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_gif(frames):\n print(\"Saving gif images!\")\n for i in range(len(frames)):\n im_out_path = \"gif/gif_emilie_will_\" + str(i) + \".png\"\n plt.imsave(im_out_path, frames[i])", "def saveFrames(filepath, frames):\n\n for i, frame in enumerate(frames):\n image = Image.fromarra...
[ "0.73017335", "0.72355133", "0.6915706", "0.68751323", "0.6866969", "0.6702963", "0.64925975", "0.6485176", "0.6412501", "0.6385749", "0.6311999", "0.6305541", "0.6288399", "0.6262558", "0.6237853", "0.62274206", "0.61932164", "0.6116848", "0.60730493", "0.5990745", "0.598803...
0.7977077
0
mcxPyBot constructor initialises mcxDatabase connection and adds command handlers.
def __init__(self, channel, nickname, password, server, port = 6667, dbcon = False): # IRC connection SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) # register event handler for all events self.ircobj.add_global_handler('all_events', getattr(self, 'on_event'), -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, user, password, database='mesomat', host='localhost'): \n \n \n self.config = {\n 'user' : user,\n 'password' : password,\n 'host' : host,\n 'database' : database,\n 'raise_on_warnings' : True,\n 'auth_...
[ "0.61448985", "0.5992468", "0.59882843", "0.5959786", "0.5893138", "0.5862879", "0.58266366", "0.57569146", "0.575443", "0.57380295", "0.5736009", "0.56736994", "0.5635677", "0.56265783", "0.5626573", "0.5624763", "0.5621554", "0.5619871", "0.56172127", "0.5610549", "0.560741...
0.69860715
0
initialize some quit message and save them into a list by filling self.__quitmsgs
def __initQuitMsgPool(self): self.__quitmsgs.append("Infektion festgestellt... leite Quarantaenemassnahmen ein... trenne aktive Verbindung")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_quit(self, raw_msg, source, **kwargs):", "def __init__(self):\n\n\t\tself.count = 0\n\t\tself.messages = []", "def __init__(self, msg):\n super(QuitMessageException, self).__init__(msg)", "def getRandomQuitMsg(self):\n return self.__quitmsgs[randint(0, len(self.__quitmsgs)-1)]", "def _...
[ "0.5805985", "0.569918", "0.5597306", "0.55945224", "0.5488201", "0.5455527", "0.5361667", "0.5361548", "0.5293691", "0.52259815", "0.5221136", "0.52198446", "0.52198446", "0.52172184", "0.5200485", "0.51755583", "0.5162636", "0.51529586", "0.5147324", "0.5142985", "0.5137079...
0.79404175
0
get any random quit message that was initialized by __initQuitMsgPool()
def getRandomQuitMsg(self): return self.__quitmsgs[randint(0, len(self.__quitmsgs)-1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __initQuitMsgPool(self):\n self.__quitmsgs.append(\"Infektion festgestellt... leite Quarantaenemassnahmen ein... trenne aktive Verbindung\")", "def get_msg_quit(self, username):\n return self.user_table[username]['msg_quit']", "def get_msg_quit(self, username):\n return \"Bye bye\"", ...
[ "0.7058567", "0.637686", "0.6002327", "0.5931621", "0.58883643", "0.5877688", "0.5856501", "0.5820552", "0.579374", "0.5449078", "0.54188406", "0.538813", "0.5298811", "0.5292298", "0.5277682", "0.52572966", "0.51838183", "0.51838183", "0.51838183", "0.51563007", "0.51104975"...
0.82633847
0
commands executed after connected to the server triggered if the chosen nickname on construction is already in use
def on_nicknameinuse(self, c, e): c.nick(c.get_nickname() + "_")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_nicknameinuse(self, raw_msg, busy_nickname, **kwargs):", "def on_nicknameinuse(self, conn, event) -> None:\n self._nickname += '_'\n conn.nick(self._nickname)", "def on_nick(self, raw_msg, source, old_nickname, new_nickname, **kwargs):", "def on_welcome(self, raw_msg, server, port, nickn...
[ "0.694035", "0.6767303", "0.66506344", "0.65627545", "0.6395496", "0.62655073", "0.61659", "0.6128941", "0.61008", "0.6065453", "0.6005221", "0.5998594", "0.599429", "0.597298", "0.5958442", "0.59406614", "0.5906776", "0.58808583", "0.5872089", "0.5869215", "0.58509284", "0...
0.6800195
1
commands executed when the bot received a private message forwards the command and the event to self.do_command()
def on_privmsg(self, c, e): self.do_command(e.arguments()[0], c, e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_private_message(self, private_message):\n pass", "def privmsg(self, user, channel, message):\n # Only actually private messages\n user = user.split('!', 1)[0]\n if (channel != self.help_channel\n or user in self.ignore\n or not user.strip()):\n ...
[ "0.6949553", "0.6780412", "0.6731864", "0.6605808", "0.6591112", "0.6566711", "0.65491927", "0.6518306", "0.65104854", "0.64871526", "0.6435231", "0.6421582", "0.6418484", "0.6351781", "0.6327283", "0.63123596", "0.6310017", "0.6302293", "0.62811166", "0.62644047", "0.6242353...
0.7241555
0
commands executed when the bot received a dcc message currently does nothing
def on_dccmsg(self, c, e): args = e.arguments()[0].split(" ", 1) if len(args) > 0: self.do_command(args[0], c, e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self, irc_c, msg, cmd):", "async def on_message(message):\n\n # This line prevent the bot to answer itself\n if message.author == client.user:\n return\n\n if message.content.startswith(config.COMMAND_KEY):\n \"\"\"\n We dont want the bot to be scanning other messages th...
[ "0.6557355", "0.64251477", "0.62862307", "0.60895944", "0.60687983", "0.6026806", "0.5992381", "0.5973637", "0.59235543", "0.5915687", "0.5910744", "0.59014237", "0.585649", "0.5838838", "0.579819", "0.57697064", "0.575427", "0.574659", "0.5727791", "0.567641", "0.5660974", ...
0.69047314
0
returns the userid of the connected user on a DCCConnection
def __getUserIdByDCCConnection(self, c): try: UserId = self.__IpToUser[self.getIpStringByDCCConnection(c)]['userid'] if UserId > 0: return UserId else: return NOT_AUTHED except KeyError: return NOT_AUTHED
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUserID(self):\n\t\treturn self.UserID", "def _getLoggedinUserId(self):\n securityManager = getSecurityManager()\n return securityManager.getUser()._login", "def get_user_id():\n csc_name = get_user_csc_name()\n if csc_name:\n return csc_name\n haka_id = get_user_haka_identi...
[ "0.6915114", "0.66406924", "0.6616438", "0.65946686", "0.6594121", "0.659404", "0.65924335", "0.6588098", "0.6537157", "0.64954484", "0.64458466", "0.6439603", "0.6431099", "0.6419845", "0.63970035", "0.6389727", "0.637988", "0.637988", "0.637988", "0.637988", "0.637988", "...
0.80359054
0
execute the command given by an event
def do_command(self, command, c, e): # get command type cmdtype = self.__resolveCommandType(command, e) # ensure the cmd is valid if self.__commandExists(command, cmdtype): try: # only if command is registered if self.__commandHandlers[cmdtype...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _command(self, *cmd, handler=None):", "def execute(self, command_name, *args):\n if command_name in self._commands.keys():\n self._history_position += 1\n self._commands[command_name].execute(args)\n if len(self._history) == self._history_position:\n # T...
[ "0.671452", "0.6637844", "0.6502819", "0.6483133", "0.6397224", "0.63965106", "0.6337618", "0.63246924", "0.6317841", "0.6308281", "0.62820333", "0.62799823", "0.62768865", "0.62648654", "0.6263708", "0.62426805", "0.6224748", "0.6214349", "0.62103915", "0.6210015", "0.620175...
0.6656607
1
checks whether a given command is registered on the given type
def __commandExists(self, command, cmdtype): try: # method exists if hasattr(self, self.__getFullCommandName(command, cmdtype)): # command handler type exists if self.__commandHandlerTypeExists(cmdtype): return True else...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __commandHandlerTypeExists(self, type):\n return self.__commandHandlers.has_key(type)", "def is_of_type(cmd):\r\n raise NotImplementedError()", "def _is_command(self, ext):\n try:\n return issubclass(ext, CommandExtension)\n except TypeError:\n return False...
[ "0.75897187", "0.7336485", "0.73289627", "0.72346324", "0.70128125", "0.6790929", "0.66802984", "0.66593987", "0.665149", "0.6643384", "0.66387373", "0.6612062", "0.65696615", "0.6531041", "0.64635706", "0.64447665", "0.64256", "0.64225155", "0.63799554", "0.6340413", "0.6335...
0.77672505
0
resolves the command type by an event and a command
def __resolveCommandType(self, command, e): # check for existing DCC Connection try: if self.__IpToUser[e.source()]['auth'] == NOT_AUTHED: return 'not_authed_dcc' else: return 'authed_dcc' # DCC Connection does not exist except KeyE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_command(command, event, bot):\n print('slack::cmd::{}'.format(command))\n\n cmd_list = command.split(' ')\n cmd = cmd_list[0].lower()\n args = cmd_list[1:] if len(cmd_list) else 0\n\n if cmd == 'help':\n response, success = handle_command_help()\n\n elif cmd == 'accounts':\n ...
[ "0.6290656", "0.62902445", "0.62281656", "0.6176488", "0.615144", "0.6104532", "0.6022825", "0.5793602", "0.57491267", "0.5735428", "0.5729035", "0.57039285", "0.5692468", "0.565963", "0.5639507", "0.5625254", "0.56236553", "0.562066", "0.56075734", "0.56060076", "0.56032777"...
0.62959677
0
resolve the function to call by an event and a command
def __resolveCommandFunction(self, command, e): return self.__getFullCommandName(command, self.__resolveCommandType(command, e))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __exec_function_by_code(self,command,*args):\n\t\tself.__printer(\"Preparing to execute function: {0}\".format(command),level=LL_DEBUG)\n\t\t\n\t\tif command is None:\n\t\t\treturn\n\t\t\t\n\t\tcmd_exec = Commands()\n\t\tif command not in cmd_exec.command_list:\n\t\t\treturn\n\t\t\n\t\tif args:\n\t\t\tvalid_pa...
[ "0.581403", "0.5763023", "0.5742588", "0.56628585", "0.5634916", "0.56182754", "0.5588224", "0.5545319", "0.5525151", "0.5498268", "0.5489367", "0.5486277", "0.5469649", "0.5465293", "0.5461583", "0.54580754", "0.54303193", "0.5419406", "0.5382144", "0.53759444", "0.53471094"...
0.691852
0
returns the method name of this object for the given command and command type
def __getFullCommandName(self, command, type): return 'cmd_%s_%s' % (type, command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_name(self):\n return None", "def name(self):\n module_filepath = inspect.getfile(type(self))\n module_filename = os.path.basename(module_filepath)\n command_name, _ = os.path.splitext(module_filename)\n return command_name", "def command_type(self):\n retur...
[ "0.7045542", "0.7001352", "0.6930984", "0.6901749", "0.68966097", "0.6881658", "0.6783473", "0.6668294", "0.66286486", "0.66184616", "0.654716", "0.6532719", "0.6515743", "0.64767367", "0.6460036", "0.64187056", "0.6412228", "0.640943", "0.63901263", "0.6382807", "0.6377871",...
0.80738705
0
adds a new command handler to the system
def __addCommandHandler(self, command, type = 'channel', requiresdb = False): try: # ensure we are dealing with booleans if not requiresdb: requiresdb = False else: requiresdb = True # add the handler # check for existi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _addCommand(self, command):\n self.updater.dispatcher.add_handler(command)", "def add_handler(self, handler):\n pass", "def register(self, command: str, handler: Any):\n\n if not command.startswith(\"/\"):\n command = f\"/{command}\"\n\n LOG.info(\"Registering %s to %...
[ "0.76060593", "0.7179329", "0.71357757", "0.7014966", "0.6918433", "0.6892781", "0.68578625", "0.67891854", "0.67860955", "0.67845434", "0.6774669", "0.672538", "0.671378", "0.6682264", "0.6660707", "0.66473126", "0.66458935", "0.66225463", "0.66026723", "0.658991", "0.658424...
0.7319573
1
function that registered all handled command types
def __setupCommandHandlerTypes(self): # dict saving all command handler types self.__commandHandlers = {'channel': {}, 'query': {}, 'not_authed_dcc': {}, 'authed_dcc': {}}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _command(self, *cmd, handler=None):", "def _commands(self) -> Dict[str, List[str]]:\r\n pass", "def commands():", "def _register_commands(self):\n cmds = []\n cmd_help = CommandParser(\"help\", \"Show help for a command.\")\n cmd_help.add_argument(\n \"command\",\n ...
[ "0.6938134", "0.6763681", "0.67493486", "0.67387176", "0.66848844", "0.66441447", "0.6633142", "0.6633142", "0.6633142", "0.6633142", "0.65997595", "0.65389496", "0.65150225", "0.64862967", "0.6465988", "0.64483017", "0.6414662", "0.6412694", "0.638031", "0.6344845", "0.63174...
0.7765803
0
checks whether the given command type exists
def __commandHandlerTypeExists(self, type): return self.__commandHandlers.has_key(type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __commandExists(self, command, cmdtype):\n try:\n # method exists\n if hasattr(self, self.__getFullCommandName(command, cmdtype)):\n # command handler type exists\n if self.__commandHandlerTypeExists(cmdtype):\n return True\n ...
[ "0.79482687", "0.7405757", "0.73042387", "0.71309036", "0.70830023", "0.69709074", "0.6903397", "0.68951637", "0.6782659", "0.6747694", "0.6743214", "0.6715056", "0.6692837", "0.6678598", "0.65998846", "0.6545335", "0.6541338", "0.6527914", "0.6507906", "0.65017587", "0.64816...
0.76852494
1
Solves the power flow using a fast decoupled method. Solves for bus voltages given the full system admittance matrix (for all buses), the complex bus power injection vector (for all buses), the initial vector of complex bus voltages, the FDPF matrices B prime and B double prime, and column vectors with the lists of bus...
def decoupledpf(Ybus, Sbus, V0, pv, pq, ppci, options): # old algortihm options to the new ones pp2pypower_algo = {'fdbx': 2, 'fdxb': 3} # options tol = options["tolerance_mva"] max_it = options["max_iteration"] # No use currently for numba. TODO: Check if can be applied in Bp and Bpp # num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc(nbus, bus_type, V, ang, Y, Pg, Qg, Pl, Ql, tol):\n\n SWING_BUS, GEN_BUS, LOAD_BUS = 1, 2, 3\n\n V = V.flatten()\n # voltage in rectangular co-ordinates.\n V_rect = [V[i] * complex(cos(ang[i]), sin(ang[i])) for i in range(len(ang))] \n V_rect = array(V_rect)\n\n # bus current injection...
[ "0.60630625", "0.5577446", "0.5546294", "0.54922825", "0.54431385", "0.5392691", "0.53446376", "0.53008276", "0.52739555", "0.52732044", "0.52537686", "0.51653886", "0.5158268", "0.5113869", "0.5086314", "0.50845", "0.50803244", "0.50725675", "0.50536424", "0.5046146", "0.502...
0.71842694
0
Rebuild the parameter vector. Note that this can potentially alter the parameter order if the strings are given in a different order. It mutates the parameter vector to contain the elements as specified in "parameters" with the defaults as specified in defaults. If the parameter already exists in the vector nothing hap...
def _set_params(self, params, defaults): new_params = OrderedDict( zip(params, [x if isinstance(x, Parameter) else Parameter() for x in defaults]) ) for key, value in self._src.items(): if key in new_params: new_params[key] = value self._src = new...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebuild_param(self,vec,**kwargs):\n from collections import OrderedDict\n tmp = OrderedDict([('lengthscale',None),( 'variance',None),( 'gstds',None)])\n for key,val in kwargs.items():\n assert val!=None, \"Can't have None as fixed values\"\n tmp[key]=val\n for ...
[ "0.63915217", "0.62324", "0.5815009", "0.5782338", "0.56467503", "0.5494379", "0.5489028", "0.546808", "0.5458663", "0.5448343", "0.53930414", "0.5371881", "0.5368795", "0.53453875", "0.53266186", "0.5283019", "0.5277188", "0.5276958", "0.5272733", "0.5256184", "0.52495134", ...
0.6548692
0
Chains a Future instance directly to another Future instance Used for recursive Promise Resolution Procedure (section 2.3.2) specified in Promise/A+ that allows .then() to piggy back on a Promise returned by success handler
def _chain_to_another_future(self, base_future): if base_future in self._chained_futures_log: raise CircularFuturesChainException( 'Circular Futures chain detected. Future {} is already in the resolved chain {}'.format( base_future, set(self._chained_futures_log)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chain_future(a, b):\n def copy(future):\n assert future is a\n if b.done():\n return\n if (isinstance(a, TracebackFuture) and\n isinstance(b, TracebackFuture) and\n a.exc_info() is not None):\n b.set_exc_info(a.exc_info())\n eli...
[ "0.78678876", "0.6660304", "0.6277418", "0.6258491", "0.61489964", "0.59651977", "0.5930862", "0.5908173", "0.58968514", "0.58914006", "0.5653376", "0.5583116", "0.5559329", "0.54988134", "0.54841375", "0.5467413", "0.53980947", "0.5350944", "0.532589", "0.5256295", "0.524431...
0.7341593
1
Creates the himesis graph representing the Simulink model HFlatten2.
def __init__(self): # Flag this instance as compiled now self.is_compiled = True super(HFlatten2, self).__init__(name='HFlatten2', num_nodes=117, edges=[]) # Add the edges self.add_edges([(5, 66), (66, 50), (5, 67), (67, 51), (5, 35), (35, 20), (5, 36), (36, 21)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_graph(self):\n edge_data_by_type, all_edges, all_nodes = self.load_training_data(\n self.train_edges_file,\n slf_loop=self.config['slf_loop'],\n symmetry_edge=self.config['symmetry_edge'])\n\n num_nodes = len(all_nodes)\n node_features = {\n ...
[ "0.6022183", "0.58268195", "0.56974345", "0.5671017", "0.5617992", "0.5606539", "0.5554137", "0.5550622", "0.5527271", "0.5515618", "0.54920125", "0.5475375", "0.5474933", "0.5449014", "0.54002106", "0.5384529", "0.5359415", "0.5316242", "0.5313028", "0.53064716", "0.5270311"...
0.66377443
0
Runs parameter checks This includes a determination that the value is equal to or greater than zero, and a check that all required keywords for a given
def _check_parameters(self, target_function, **kwargs): # Ensure all arguments are =< 0 where relevant for keyword, value in kwargs.items(): # Two conditions value_is_less_than_zero = value < 0 keyword_is_relevant = keyword in ['mean', 'constant', 'low', 'mode', 'high...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Check(self, parameters):", "def test_checkParameters(self):\n self.failUnlessEqual(self.nice.opts['long'], \"Alpha\")\n self.failUnlessEqual(self.nice.opts['another'], \"Beta\")\n self.failUnlessEqual(self.nice.opts['longonly'], \"noshort\")\n self.failUnlessEqual(self.nice.opts['...
[ "0.7083333", "0.6897127", "0.6845546", "0.6732831", "0.65487105", "0.6494509", "0.6490343", "0.6471558", "0.6422716", "0.64224803", "0.64110047", "0.63605785", "0.63543475", "0.6344284", "0.6249611", "0.62482", "0.6248133", "0.6237131", "0.6220662", "0.62176985", "0.62074405"...
0.74509966
0
Supply raw data to the model This takes an arbitrary array, runs some quick checks, and returns the array if appropriate.
def supply_raw(self, target, array): # Ensure numeric clean_array = pd.to_numeric(array) # Coerce to series if type(array) == pd.Series: s = pd.Series(clean_array.values) else: s = pd.Series(clean_array) # Check numeric and not null if s.is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _raw_data(self):\n data = self.datasource.as_array()\n if not isinstance(data, np.ndarray):\n raise TypeError(\"The data you try to load is no numpy array!\")\n if data.ndim != 2:\n raise ValueError(\"The data array you try to load does not have 2 \"\n ...
[ "0.60833967", "0.5892189", "0.5854844", "0.5854844", "0.57446194", "0.5713086", "0.5632602", "0.5599413", "0.5592324", "0.5489122", "0.54690903", "0.54367536", "0.54291075", "0.53866744", "0.53799325", "0.53581697", "0.5353129", "0.5336951", "0.53313243", "0.5308267", "0.5290...
0.6199926
0
Checks keywords and returns the appropriate function object.
def _determine_func(self, **kwargs): # Check whether keys are recognized for key in kwargs.keys(): if key not in self._parameter_map.keys(): raise FairException('"{}"" is not a recognized keyword'.format(key)) # Check whether all keys go to same function via set compr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func(input, keyword=None):\r\n pass", "def execute_function_for_keyword(self):\n kwargs, kw_status = self.get_argument_as_keywords()\n\n print_info(\"The Arguments passed for the current Step is: '{0}'\".format(kwargs))\n if kw_status:\n # Execute the corresponding function...
[ "0.5854664", "0.56806916", "0.5641", "0.5623809", "0.55649495", "0.5476309", "0.54629546", "0.5438626", "0.541577", "0.5365577", "0.5363465", "0.5266843", "0.5264946", "0.5263023", "0.52230936", "0.5172818", "0.51589596", "0.51542425", "0.5113567", "0.5110534", "0.51024556", ...
0.6410414
0
Generates constant array of size `count`
def _gen_constant(self, count, **kwargs): return np.full(count, kwargs['constant'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_array( n ):", "def default_array(self, count: int) -> List[Any]:\n return [self.default() for _ in range(count)]", "def create_array(n, bound):\n array = [np.random.randint(0, bound) for x in range(n)]\n return array", "def init_naive_array(n):\n result = list()\n for i in range...
[ "0.69629025", "0.6237902", "0.59859437", "0.5976607", "0.590662", "0.5860379", "0.5796555", "0.5791605", "0.57907313", "0.5790046", "0.57897764", "0.57081926", "0.56950295", "0.56916034", "0.5662179", "0.56293595", "0.5592688", "0.55898625", "0.5583231", "0.5581325", "0.55608...
0.7421939
0
Checks parameters, creates BetaPert, returns random values
def _gen_pert(self, count, **kwargs): self._check_pert(**kwargs) pert = FairBetaPert(**kwargs) rvs = pert.random_variates(count) return rvs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_beta_priors(df):\n df['alpha'] = np.minimum(np.maximum((1 - df.expected) * np.power(df.expected, 2) / df.variance - df.expected, 0.1), 15)\n df['beta'] = df.alpha / df.expected - df.alpha\n return df", "def generate_data(sample_size, noise_variance):\n \n # generate true beta\n A = n...
[ "0.5960632", "0.5894815", "0.58648175", "0.58480936", "0.5828943", "0.57892954", "0.57710135", "0.5668323", "0.56302905", "0.5577978", "0.55545354", "0.5546763", "0.5536753", "0.55121404", "0.55006164", "0.5491941", "0.5485144", "0.54799646", "0.54481506", "0.54462004", "0.54...
0.6816109
0
Uses pandas to load an edgelist file and returns it as a list of tuples with pairs of connected nodes.
def load_edgl(fname): # Reads edges df = pd.read_csv(fname, sep=" ", header=None, usecols=[0, 1]) # Convert to list of tuples return list(df.itertuples(index=False, name=None))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_graph():\n return nx.read_edgelist('edges.txt.gz', delimiter='\\t')", "def read_graph():\n return nx.read_edgelist('edges_new.txt', delimiter='\\t')", "def read_graph(filename):\n return nx.read_edgelist(filename, create_using=nx.DiGraph(), nodetype=str)", "def _read_data(filename):\n ...
[ "0.6817114", "0.67747307", "0.65344524", "0.6419645", "0.6242016", "0.6231345", "0.6211329", "0.61715627", "0.6137391", "0.6045606", "0.6036997", "0.60356927", "0.6027112", "0.59217256", "0.5908259", "0.5896088", "0.5891709", "0.58771986", "0.5860478", "0.5830904", "0.5827634...
0.69430107
0
Returns whether or not a user can modify settings in a LocalSite. This checks that the user is either staff with the proper permissions, or that they're listed in the 'admins' field. By default, this is checking whether the LocalSite itself can be modified, but a different permission can be passed to check for another ...
def is_mutable_by(self, user, perm='site.change_localsite'): return user.has_perm(perm) or self.admins.filter(pk=user.pk).exists()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_modify_permissions(self, request, obj, local_site=None, *args,\n **kwargs):\n return obj.is_mutable_by(request.user, local_site=local_site)", "def is_local_administrator(self):\n\t\treturn bool(call_sdk_function('PrlUsrCfg_IsLocalAdministrator', self.handle))", "def...
[ "0.69915265", "0.6767986", "0.6745964", "0.66542995", "0.6571868", "0.6538805", "0.65115726", "0.64365876", "0.64365876", "0.6423288", "0.6423288", "0.6423288", "0.6416041", "0.64117044", "0.6377946", "0.63580614", "0.6347583", "0.63408816", "0.6334341", "0.6306698", "0.63005...
0.7325419
0
Test user_id starts from one and increments by one
def test_user_id(self): new_user = self.app self.assertTrue(new_user.user_id, 0) new_user.create_user() self.assertTrue(new_user.user_id, 1) for key in new_user.users: self.assertEqual(new_user.user_id, key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_identity(self) -> UserId:\n ...", "def increaseTimes(self, userId):\n for user in self.requestLog:\n if str(userId) == user[0]:\n user[1] += 1\n break", "def new_id(users):\n\n #nonlocal index\n if len(users) > 1:\n new_in...
[ "0.68791264", "0.6670912", "0.6601971", "0.6345259", "0.623204", "0.61628485", "0.6151919", "0.6070988", "0.59979314", "0.5988349", "0.59776485", "0.59571034", "0.59226906", "0.5910287", "0.5886617", "0.58862144", "0.58774656", "0.58749765", "0.5874914", "0.58122075", "0.5801...
0.68441284
1
Test Shoppinglist's dict is empty at first
def test_shoplists_dictionary(self): new_shoplist = self.app self.assertEqual(len(new_shoplist.shoplists), 0) new_shoplist.create_shoplist() self.assertIsInstance(new_shoplist, Shoppinglist) self.assertEqual(len(new_shoplist.shoplists), 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_new_shopping_list(create_shopping_list):\n shopping_list = create_shopping_list\n assert shopping_list.items.values_list().count() == 0\n assert shopping_list.budget == 0", "def test_shopping_cart_is_empty(self):\n response = self.client.get(self.SHOP_CART_URL)\n self.asser...
[ "0.6769545", "0.67441076", "0.66115814", "0.65915734", "0.6533823", "0.6522", "0.6508257", "0.6508257", "0.6508257", "0.6459706", "0.6428222", "0.6398528", "0.6377994", "0.62983876", "0.6295201", "0.6289959", "0.6289575", "0.6281986", "0.6245945", "0.6245707", "0.62340784", ...
0.70351964
0
Test shoplist_id starts from one and increments by one
def test_shoplist_id(self): new_shoplist = self.app self.assertTrue(new_shoplist.shop_id, 0) new_shoplist.create_shoplist() self.assertTrue(new_shoplist.shop_id, 1) for key in new_shoplist.shoplists: self.assertEqual(new_shoplist.shop_id, key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_id_in_shoplist(self):\n new_shoplist = self.app\n new_shoplist.create_shoplist()\n for value in Shoppinglist.shoplists.values():\n for key in User.users:\n self.assertEqual(value['user_id']+1, key)\n new_shoplist.create_shoplist()\n for val...
[ "0.71740144", "0.6463204", "0.60883856", "0.56410897", "0.56002337", "0.55714893", "0.54950434", "0.5471539", "0.54486376", "0.53863215", "0.53844637", "0.53601474", "0.535629", "0.52940756", "0.5292217", "0.52636516", "0.5251364", "0.5215265", "0.52150106", "0.52086705", "0....
0.74459314
0
Test shoplist can be created
def test_create_shoplist(self): new_shoplist = self.app new_shoplist.create_shoplist() self.assertEqual(len(new_shoplist.shoplists), 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_successful_shoplist_creation(self):\n result = self.app.create_shoplist()\n expected = {5: {'user_id': 0, 'name': 'apples', 'description': 'Fresh Green Apples'}}\n self.assertEqual(expected, result)", "def test_app_can_add_list(self):\n add_list=self.client.post('/addshopping...
[ "0.8193725", "0.7992437", "0.790068", "0.780376", "0.76251024", "0.7561878", "0.7440926", "0.7405313", "0.73396647", "0.69817495", "0.6914466", "0.68958485", "0.68450737", "0.6805334", "0.6804944", "0.6802431", "0.6802431", "0.676612", "0.6746457", "0.67143774", "0.66929317",...
0.84382606
0