query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Rotate points by quaternions.
def quat_rotate(X, q): # repeat q along 2nd dim ones_x = X[[0], :, :][:, :, [0]] * 0 + 1 q = torch.unsqueeze(q, 1) * ones_x q_conj = torch.cat([q[:, :, [0]], -1 * q[:, :, 1:4]], dim=-1) X = torch.cat([X[:, :, [0]] * 0, X], dim=-1) X_rot = hamilton_product(q, hamilton_product(X, q_conj)) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qrotate(points, axis, theta):\n q = Quaternion.rotator(axis, theta)\n return q.rotate(points)", "def rotate_points(points,quaternions):\n \n res = np.zeros((quaternions.shape[0],points.shape[0],4)) \n res[:,:,1:] = points \n conjugates = conjugate(quaternions) \n \n f...
[ "0.7982522", "0.7720816", "0.76980317", "0.7503948", "0.71261555", "0.67684865", "0.66305953", "0.66130453", "0.65267867", "0.6443186", "0.64176416", "0.64084005", "0.63606745", "0.633426", "0.6299331", "0.62791884", "0.6247232", "0.6116867", "0.61149526", "0.608029", "0.6071...
0.6787191
6
Multiply qa by qb.
def hamilton_product(qa, qb): qa_0 = qa[:, :, 0] qa_1 = qa[:, :, 1] qa_2 = qa[:, :, 2] qa_3 = qa[:, :, 3] qb_0 = qb[:, :, 0] qb_1 = qb[:, :, 1] qb_2 = qb[:, :, 2] qb_3 = qb[:, :, 3] # See https://en.wikipedia.org/wiki/Quaternion#Hamilton_product q_mult_0 = qa_0 * qb_0 - qa_1 * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quatMultiply(q1, q2):\n\tq1 = q1.flatten()\n\tq2 = q2.flatten()\n\tq3 = np.zeros(4)\n\tq3[0] = q1[0] * q2[0] - np.dot(q1[1:], q2[1:])\n\tq3[1:] = (q1[0] * q2[1:] + q2[0] * q1[1:] + np.cross(q1[1:], q2[1:]))\n\treturn (q3 / np.linalg.norm(q3)).reshape(-1, 1)", "def multiply_quaternions( qa, qb ):\n combine...
[ "0.6547377", "0.6411355", "0.64028084", "0.62495494", "0.62204504", "0.6107999", "0.606811", "0.605762", "0.6046647", "0.60203433", "0.5900787", "0.58968675", "0.5880514", "0.5878625", "0.58512473", "0.5835514", "0.57973033", "0.57964456", "0.5778016", "0.57761025", "0.571253...
0.6089931
7
Check that matrix type is preserved.
def test_matrix_b_only(self): a = array([[1., 2.], [3., 4.]]) b = matrix([2., 1.]).T self.do(a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _type_check(data):\n if data.__class__.__name__ != \"Matrix3\":\n return False\n return True", "def verify_numpy_type(self, matrix):\n if type(matrix) != np.ndarray and matrix != None:\n return np.asfarray(matrix)\n elif type(matrix) == np.ndarray and matrix ...
[ "0.75150174", "0.67877185", "0.6370516", "0.62093437", "0.61971074", "0.61142915", "0.6034021", "0.60186875", "0.59572864", "0.5932115", "0.5802232", "0.57511467", "0.57066", "0.5695186", "0.5665314", "0.56607133", "0.5646371", "0.56367624", "0.5622803", "0.5620641", "0.55930...
0.0
-1
Check that matrix type is preserved.
def test_matrix_a_and_b(self): a = matrix([[1., 2.], [3., 4.]]) b = matrix([2., 1.]).T self.do(a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _type_check(data):\n if data.__class__.__name__ != \"Matrix3\":\n return False\n return True", "def verify_numpy_type(self, matrix):\n if type(matrix) != np.ndarray and matrix != None:\n return np.asfarray(matrix)\n elif type(matrix) == np.ndarray and matrix ...
[ "0.7511979", "0.6786339", "0.6370353", "0.6207709", "0.6195359", "0.6113633", "0.60332847", "0.60168874", "0.5954919", "0.593091", "0.5800703", "0.5748301", "0.57073087", "0.56955373", "0.5663681", "0.5658096", "0.5645039", "0.56355584", "0.56208754", "0.5619118", "0.55896413...
0.0
-1
Check that matrix type is preserved.
def test_matrix_b_only(self): a = array([[1., 2.], [2., 1.]]) self.do(a, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _type_check(data):\n if data.__class__.__name__ != \"Matrix3\":\n return False\n return True", "def verify_numpy_type(self, matrix):\n if type(matrix) != np.ndarray and matrix != None:\n return np.asfarray(matrix)\n elif type(matrix) == np.ndarray and matrix ...
[ "0.7511979", "0.6786339", "0.6370353", "0.6207709", "0.6195359", "0.6113633", "0.60332847", "0.60168874", "0.5954919", "0.593091", "0.5800703", "0.5748301", "0.57073087", "0.56955373", "0.5663681", "0.5658096", "0.5645039", "0.56355584", "0.56208754", "0.5619118", "0.55896413...
0.0
-1
Check that matrix type is preserved.
def test_matrix_a_and_b(self): a = matrix([[1., 2.], [2., 1.]]) self.do(a, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _type_check(data):\n if data.__class__.__name__ != \"Matrix3\":\n return False\n return True", "def verify_numpy_type(self, matrix):\n if type(matrix) != np.ndarray and matrix != None:\n return np.asfarray(matrix)\n elif type(matrix) == np.ndarray and matrix ...
[ "0.7513969", "0.6788523", "0.6372158", "0.6208938", "0.6196592", "0.6115402", "0.60343564", "0.6018366", "0.5956586", "0.5932612", "0.58029556", "0.57486594", "0.570607", "0.5696255", "0.5663594", "0.56593513", "0.564664", "0.5636785", "0.5621079", "0.5619576", "0.5590659", ...
0.0
-1
Loops through each page within a single PDB and sums up the stats of each page to arrive at the overall total
def analyze(directory, pdf_file, doc_type): total_redaction_count = 0 total_redacted_text_area = 0 total_estimated_text_area = 0 total_estimated_num_words_redacted = 0 # Split the pdb (which is a pdf file) into individual jpgs. redaction_module.pdf_to_jpg(directory, pdf_file) os.chdir(dir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loop_example():\n\n totals = []\n\n for row in poke_stats:\n totals.append(sum(row))\n \n return(totals)", "def stats_page():\n import alltheitems.stats\n return alltheitems.stats.index()", "def calculate_agrigate(self):\n self.total = 0.0\n for rec in self.data:\n ...
[ "0.5614058", "0.5522709", "0.5506824", "0.5450965", "0.5391519", "0.5355411", "0.531937", "0.5312551", "0.5290875", "0.5287495", "0.52719283", "0.5268888", "0.5259223", "0.5246753", "0.5223558", "0.52189976", "0.5212078", "0.51717114", "0.5152129", "0.5145579", "0.51427794", ...
0.56087923
1
Iterates through all the PDBS (pdf files) in the given from directory, and moves them to the to directory when they are finished.
def test_batch(from_dir, to_dir, doc_type): if from_dir[-1] != "/": from_dir = from_dir + "/" if to_dir[-1] != "/": to_dir = to_dir + "/" os.chdir(from_dir) for pdf_file in os.listdir(from_dir): if pdf_file.endswith(".pdf"): # Appends a row to the csv file "output.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_dir(self, src_dir, dst_dir):\n self.logger.tree(src_dir)\n for srcpath in self.list_all_files(src_dir):\n dstpath = srcpath.replace(src_dir, dst_dir)\n # TODO: Can we clean up the way we handle relative_path?\n # Relative path is here so that when we print...
[ "0.565745", "0.5612268", "0.559464", "0.54912335", "0.54782933", "0.5257978", "0.5249441", "0.5214788", "0.5211769", "0.51883787", "0.51731247", "0.5166325", "0.51459086", "0.5122646", "0.51139665", "0.51016736", "0.5081973", "0.50667685", "0.5055424", "0.5041548", "0.5037065...
0.5560684
3
Create a new text input instance. colorNames a sequence of strings (each color must start with a different letter)
def __init__(self, colorNames): self._lengthOfPattern = 0 # will later be queried from the user self._palette = '' # initials for color choices, e.g., R for red for color in colorNames: self._palette += color[0].upper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, colorNames):\n self._colorOptions = '' # initials for color choices\n for color in colorNames:\n self._colorOptions += color[0].upper()\n # following will be reset when startGame is called\n self._currentTurnNum = self._lengthOfPattern = self._maxNu...
[ "0.6373945", "0.61426556", "0.6063771", "0.60201144", "0.5951335", "0.5880087", "0.58047354", "0.5626059", "0.56203663", "0.55802214", "0.55743384", "0.556991", "0.5532483", "0.5503226", "0.5380365", "0.5372865", "0.53544044", "0.53481925", "0.5348108", "0.5277353", "0.523506...
0.7074272
0
Robustly prompt the user for an integer from small to large.
def _readInt(self, prompt, small, large): prompt = prompt + ' (from ' + str(small) + ' to ' + str(large) + ')? ' answer = small - 1 # intentionally invalid while not small <= answer <= large: try: answer = int(raw_input(prompt)) if not small <= answer <= large: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prompt_int(prompt):\n while True:\n try:\n return int(input(prompt))\n except ValueError as e:\n print('Provide an integer')", "def input_int(question):\n while True:\n try:\n value = int(input(question))\n except (SyntaxError, NameError) as ...
[ "0.7585431", "0.74412924", "0.7407625", "0.7393844", "0.7116075", "0.7100335", "0.7029069", "0.7021394", "0.69807756", "0.69662374", "0.69629014", "0.69590944", "0.6943949", "0.69393766", "0.69393766", "0.690722", "0.68896306", "0.6840757", "0.6829219", "0.6797315", "0.674995...
0.77045965
0
Ask the user how many pegs in the secret pattern.
def queryLengthOfPattern(self): self._lengthOfPattern = \ self._readInt('How many pegs are in the secret', 1, 10) return self._lengthOfPattern
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guessTheSecret():\n\tguess = int(input('Guess the number > '))\n\tglobal attempts\n\tcheck = False\n\twhile guess != secret_num:\n\t\tif guess < secret_num:\n\t\t\tprint('Your guess is too low')\n\t\telif guess > secret_num:\n\t\t\tprint('You guess to too high')\n\t\tguess = int(input('Guess again > '))\n\t\t...
[ "0.6076266", "0.60246533", "0.6022768", "0.5874914", "0.57561094", "0.5753638", "0.57490975", "0.5721011", "0.5687204", "0.56637275", "0.5620408", "0.56060576", "0.559462", "0.5586774", "0.5576528", "0.5574137", "0.5513518", "0.5511759", "0.5488277", "0.54585576", "0.5408952"...
0.661876
0
Ask the user how many colors to use for secret pattern.
def queryNumberOfColors(self): self._numColorsInUse = \ self._readInt('How many colors are available', 2, len(self._palette)) return self._numColorsInUse
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_color(n=1):\n \n if n == 1:\n c='xkcd:red'\n elif n== 2:\n c='xkcd:green'\n elif n== 3:\n c='xkcd:yellow'\n elif n== 4:\n c='xkcd:blue'\n elif n== 5:\n c='xkcd:orange'\n elif n== 6:\n c='xkcd:purple'\n elif n== 7:\n c='xkcd:cyan'\n ...
[ "0.63058114", "0.6133298", "0.6033995", "0.5919279", "0.589637", "0.58485484", "0.5842015", "0.5833451", "0.58159053", "0.57597435", "0.57432437", "0.5722553", "0.5701675", "0.5683642", "0.5675337", "0.56218904", "0.5573346", "0.5539116", "0.5536698", "0.55081004", "0.5491249...
0.6033873
3
Ask the user maximum number of guesses to be allowed.
def queryNumberOfTurns(self): return self._readInt('How many turns are allowed', 1, 20)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_max_guesses():\n print(\"You'll get 5 guesses per problem!\")\n return 5", "def max_guesses():\n\tprint \"\\n\" + \"How many guesses would you like per problem?\" + \"\\n\"\n\tmax_guesses = None\n\twhile max_guesses is None:\n\t\ttry:\n\t\t\tmax_input = int(raw_input('Please enter a positive integ...
[ "0.77235156", "0.7366993", "0.7222083", "0.6790302", "0.65760106", "0.65610594", "0.65526646", "0.6540081", "0.6443365", "0.62116224", "0.6182453", "0.61225075", "0.6075408", "0.6065941", "0.60258347", "0.6022477", "0.5970776", "0.5969266", "0.5950388", "0.59448254", "0.58985...
0.56145835
41
Offer the user a new game. Return True if accepted, False otherwise.
def queryNewGame(self): print response = raw_input('Would you like to play again? ') return response.lower() in ('y', 'yes')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def new_game():\n if enough_players():\n GAME.new_game()\n await update_players()", "def start_game_check(self):\n if len(self.pending_players) > 0:\n return False\n else:\n return True", "def add_game(self, game: OverwatchGameSummary) -> bool:\n ...
[ "0.6719708", "0.6387805", "0.6320438", "0.627329", "0.623334", "0.6186488", "0.6180574", "0.6068623", "0.6004475", "0.59953415", "0.5935983", "0.59331787", "0.5884073", "0.5848409", "0.5813085", "0.5809577", "0.5796485", "0.5780554", "0.5772659", "0.57724905", "0.5761467", ...
0.61691105
7
Get a guess from the user and return it as a Pattern instance.
def enterGuess(self): validPattern = False while not validPattern: print # intentional blank line prompt = 'Enter a guess (colors are ' prompt += self._palette[:self._numColorsInUse] + '): ' patternString = raw_input(prompt) validPattern = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_guess(self):\n return self._guess", "def get_guess(self):\n new_guess = \"\"\n try:\n new_guess = input(\"Enter a letter: \").lower()\n if len(new_guess) > 1:\n new_guess = \"INVALID\"\n raise ValueError(\"The guess you entered was ...
[ "0.55911654", "0.55187875", "0.5507677", "0.5500603", "0.5459489", "0.54325235", "0.53727347", "0.52810353", "0.52759", "0.51961994", "0.5180741", "0.5148151", "0.5114034", "0.50629675", "0.5012794", "0.5007291", "0.49607527", "0.4953114", "0.4934326", "0.4934326", "0.4837743...
0.7146551
0
Return welcome page for nonlogin user
def login(): user_type = get_admin_type_in_session() login_form = LoginForm(request.form) current_app.logger.info(f'user_type{user_type}') if user_type != UserTypeEnum.NOT_LOGIN: return redirect(url_for('admin.admin')) if 'login' in request.form: # read form data username = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n is_admin = dbhandler.is_admin(current_user())\n return render_template('./welcome.html', username=current_user(), is_admin=is_admin)", "def welcome(self):\n if self.user:\n return self.render('welcome.html')\n self.redirect('/register')", "def get(self):\n i...
[ "0.77734786", "0.76969486", "0.74549574", "0.73873097", "0.7311019", "0.72966236", "0.728712", "0.72041076", "0.7171604", "0.71527934", "0.7149935", "0.71144354", "0.71122956", "0.7080843", "0.705263", "0.6983225", "0.69771266", "0.6955535", "0.6934617", "0.69343626", "0.6916...
0.0
-1
Creates a progress bar for lengthy processes, depending on the time spent iterating over the generator.
def optional_progressbar(iter: Generator[T, None, None], title: Optional[str] = None, n: Optional[int] = None, progress: Optional[bool] = None, time_threshold: float = 5.0) -> Generator[T, None, None]: # tqdm is unav...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def progressbar(iterator, verbosity, length=None):\n\n if verbosity == logging.INFO:\n if not length:\n length = len(iterator)\n\n with click.progressbar(iterator, length=length) as _iterator:\n yield _iterator\n else:\n yield iterator", "def make_progress_bar():\...
[ "0.711327", "0.6973596", "0.68691814", "0.67567205", "0.6627047", "0.658841", "0.65598375", "0.6529973", "0.6528152", "0.65117425", "0.65101254", "0.6501197", "0.64991385", "0.64991385", "0.64561707", "0.64438474", "0.6441481", "0.6441481", "0.6441481", "0.6438204", "0.643658...
0.6471772
14
Restarts the timer and closes any existing progress bar.
def restart(self): self.done() self.counter = 0 self.start_time = time.time()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart_timer(self):\n self.log.info(\"{} timer restarted ({} seconds)\".format(self.name, self.interval))\n self.count = self.interval / self.sleep_chunk\n if not self.defer and self.interval > 0:\n self._callback()\n if self.start_event.is_set():\n self.reset...
[ "0.66411126", "0.6284358", "0.62715745", "0.62477195", "0.62477195", "0.6240947", "0.62338436", "0.62116516", "0.6179327", "0.6083561", "0.6083475", "0.60694265", "0.59795976", "0.5975325", "0.59243655", "0.58290434", "0.5823037", "0.57699066", "0.5765696", "0.5754959", "0.57...
0.6867762
0
Advances the progress bar. If visible, shows progress, otherwise updates in the background. If the time threshold has passed and the progress bar should appear, this method creates it.
def next(self): if self.skip: return self.counter += 1 if self.pbar is None and (time.time() - self.start_time) > self.threshold: self.pbar = tqdm(total=self.n, desc=self.title, initial=self.counter) elif self.pbar is not None: self.pbar.update(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_progress_bar(self):\r\n self.progress[\"value\"] = self.progress_step", "def notify_progress(self, ratio):\n self._progress_bar += ratio\n while self._progress_bar > self._offset_bar:\n self._offset_bar += 0.01\n self._progress_window.progress(100 * self._prog...
[ "0.6722962", "0.6673535", "0.6486935", "0.6408159", "0.6408159", "0.6382689", "0.63463795", "0.6336971", "0.6323932", "0.63100183", "0.6251043", "0.6093328", "0.60822016", "0.6081106", "0.6039662", "0.59908193", "0.5933977", "0.59072167", "0.5903473", "0.5895819", "0.5878664"...
0.6813362
0
Closes the progress bar, if it was opened.
def done(self): if self.pbar is not None: self.pbar.close() self.pbar = None self.counter = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_progress(self):\r\n\r\n pass", "def _close_if_complete(self):\n if self.progress_var.get()>=100:\n # delete the variable trace (necessary?)\n #self.progress_var.trace_vdelete('w',self.progress_trace_name)\n\n self._close(final_message=\"Time %s: Finished %...
[ "0.81975293", "0.75678986", "0.74818844", "0.729322", "0.7214553", "0.6678668", "0.66652167", "0.6659462", "0.66420907", "0.66245186", "0.6562891", "0.6544766", "0.65217733", "0.65041906", "0.6473157", "0.6471343", "0.6361349", "0.6353468", "0.6337863", "0.6337843", "0.633488...
0.7161358
5
Returns the state of the engine
def state(self): return self._state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state(self):\n return self._env.get_state()", "def get_state(self):\n return self.env.sim.get_state()", "def get_state(self):\n pass", "def state(self) :\n\t\ttry :\n\t\t\treturn self._state\n\t\texcept Exception as e:\n\t\t\traise e", "def get_state(self) -> Any:\n raise No...
[ "0.7835089", "0.7828732", "0.7622395", "0.75098014", "0.7504023", "0.74837524", "0.74837524", "0.747881", "0.74513674", "0.7436323", "0.74217993", "0.7401581", "0.7358345", "0.73560464", "0.73560464", "0.73396134", "0.733", "0.7290264", "0.7290264", "0.7290264", "0.7290264", ...
0.0
-1
starts the engine, and will prepare any special function retquired This is the only method that Peregrin will need for it to work with this object.
def start(self): self._state = 'Started'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Start(self) :\n\t\t...", "def _initialise_run(self) -> None:", "def _start(self):", "def startup_run(self):\n raise NotImplementedError # implement in subclass", "def start(self):\n ...", "def start(self):\n self.__init__()\n self.set_n_players()\n self.init_player...
[ "0.6717045", "0.66311574", "0.65825856", "0.644477", "0.6419866", "0.6397608", "0.6393187", "0.63627625", "0.63627625", "0.63627625", "0.63627625", "0.636224", "0.632943", "0.632943", "0.6321839", "0.6320396", "0.6315927", "0.6269407", "0.6243949", "0.6243949", "0.6243949", ...
0.0
-1
will process the class and auto run the relevant actions
def run(self, *args, **kwargs): self.actions() for funcName, action in self._actions.items(): actionName, actionParams = action if actionParams == None: func = getattr(self, funcName) print('Running %s.%s' % (self._title, funcName)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self.class_inst_obj.processor(self.msg)", "def process(self):\n pass", "def process_class_list(self, module, classes):", "def process(self):", "def process(self):", "def process(self):", "def processing(self):\n pass", "def process(self):\n raise NotImplem...
[ "0.733801", "0.6919119", "0.68216944", "0.6646222", "0.6646222", "0.6646222", "0.6335444", "0.6312122", "0.6258709", "0.61450005", "0.6139092", "0.6109335", "0.6109335", "0.6109335", "0.6109335", "0.6109335", "0.6109335", "0.6109335", "0.6109335", "0.6109335", "0.6109335", ...
0.0
-1
will run the action specifiec in the action name
def runAction(self, actionName, funcName): itemDataList = self._db.getItemDataList(self._engine_id, actionName) actionId = self._db.addAction(actionName) func = getattr(self, funcName) i = 0 total = len(itemDataList) startTime = timeit.default_timer() print('%s.%...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_action(self, action):\n method_name = action.text().lower()\n method_name = method_name + \"_action\"\n action_method = getattr(self, method_name)\n action_method()", "def call_action(self, action):\n pass", "def action_run(self):\n pass", "def perform_ac...
[ "0.7718024", "0.74983245", "0.72574073", "0.7193699", "0.71931565", "0.6973566", "0.6973558", "0.69627744", "0.6923847", "0.6882539", "0.68605995", "0.6821797", "0.6815239", "0.6786962", "0.67747885", "0.67588645", "0.6750203", "0.67334545", "0.67019147", "0.67019147", "0.670...
0.60786176
84
returns the objects information
def info(self): return (self._title, self._version, self._descr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_objects_data(self):\n pass", "def objects(self):", "def getInfo():", "def objects(self):\n\t\treturn self._objects", "def get_objects_data(self):\n return dict(result=self.objects)", "def GetObjects(self): \r\n return self.model.GetObjects()", "def get_objects_data(s...
[ "0.77862304", "0.7456217", "0.7124919", "0.7075904", "0.7070359", "0.68811506", "0.68797517", "0.68526816", "0.6834337", "0.6834337", "0.68310577", "0.6820976", "0.68096256", "0.6797335", "0.6773765", "0.67031676", "0.6696353", "0.6682475", "0.6682475", "0.66812974", "0.66787...
0.59778154
69
pass in the configuration file
def config(self, config): self._config = config self._haystackPath = self._config.get('Paths', 'Haystack')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configuration():", "def config():", "def config():", "def __init__(self, path_to_config_file):\n self.file_path = path_to_config_file", "def read_config(self, config_filename):", "def use_config_file(self):\n self.config_file = self.find_config_file()\n if self.config_file:\n ...
[ "0.76724064", "0.7665119", "0.7665119", "0.7316571", "0.72797155", "0.7215086", "0.71913195", "0.71776897", "0.7046851", "0.69839555", "0.69839555", "0.69595927", "0.69369966", "0.69369495", "0.6893396", "0.6797057", "0.67788506", "0.6771583", "0.6738065", "0.673592", "0.6733...
0.0
-1
if this is declared the calling program will pass in the cursor from the exisiting db
def acceptDB(self, db): self._db = db
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cursor():\n dbh = handle()\n return dbh.cursor()", "def get_cursor(self, *args, **kwargs):", "def __cursor(cls):\n print('|-- Richiesta cursore da:'+str(cls.__dbCon))\n return cls.__dbCon.cursor( cursor_factory = psycopg2.extras.DictCursor )", "def __enter__(self) -> 'cursor':\n ...
[ "0.75196695", "0.7447285", "0.6916227", "0.68934", "0.6793164", "0.6761797", "0.67598337", "0.6744899", "0.67059517", "0.66798764", "0.66659814", "0.66617465", "0.6598716", "0.6572655", "0.656831", "0.6523354", "0.6523354", "0.64487654", "0.64415014", "0.64395714", "0.6431035...
0.0
-1
Returns a list of action and state this object can perform... These are in a form that Peregrin can handle, and are use by the class to limit what it allows Peregrin to call.
def actions(self): self._actions = {} self._actions['getItems'] = ('FileCrawler', None) #self._actions['getContents'] = ('ParseContents', ('path')) return self._actions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getActions(self, state): \n util.raiseNotDefined()", "def get_available_actions(self, state):\n pass", "def actions(self, state):\n myActionList= (1,2);\n return myActionList", "def actions(self, state):\n\t\traise NotImplementedError", "def actions(self) -> list:\n ...
[ "0.79093474", "0.7743691", "0.7566298", "0.7564206", "0.75434977", "0.73026574", "0.72860223", "0.72488976", "0.7185109", "0.71836317", "0.7171607", "0.71485937", "0.71485937", "0.71485937", "0.7132329", "0.71137536", "0.70944935", "0.7048736", "0.7040828", "0.69925964", "0.6...
0.6020623
97
Will search the path provided and apply the tags given
def getItems(self): fname = 'getItems' actionId = self._db.addAction('WebCrawler') actionId_ex = self._db.addAction('extractor') if not os.path.exists(self._haystackPath): self._haystackPath = os.path.expanduser(self._haystackPath) if not os.path.exists(self._haysta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_dir(self, path, accepted_exts):\n for root, dirs, files in os.walk(path):\n for f in files:\n name, ext = splitext(f)\n if ext.lower() in accepted_exts:\n try:\n self.tag(join(root, f))\n except Exc...
[ "0.6427988", "0.6152635", "0.59591275", "0.5777887", "0.5693095", "0.5677073", "0.5635031", "0.5607307", "0.55902433", "0.5455293", "0.5320511", "0.5300698", "0.527677", "0.52514946", "0.52197546", "0.5191613", "0.51899403", "0.51578", "0.515451", "0.5131709", "0.51221174", ...
0.0
-1
Will process the file, expected files are text and URL bookmarks...
def getContents(self, itemId, itemURI, *args): if args: actionId = self._db.addAction(args[0]) else: actionId = -1 print('\t\t[%s] %s\t(%s)' % (itemId, itemURI, actionId)) # dissect the file patURL = re.compile(r'URL=(?P<url>.*$)', re....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_file(file_name):\n pass # delete this line and replace with your code here", "def process_file(self, file, target_dir):\n raise NotImplementedError(\"Process file method not implemented\")", "def process_file(filename):\n if cpp_style.can_handle(filename) or filename == '-':\n ...
[ "0.6773457", "0.6624344", "0.6464674", "0.64460856", "0.64447", "0.64102936", "0.6183915", "0.61486447", "0.61235183", "0.609597", "0.6086695", "0.60528666", "0.60464036", "0.6021481", "0.60116667", "0.6004422", "0.6004236", "0.6000104", "0.59662986", "0.5915058", "0.5889009"...
0.0
-1
A naive factorization method. Take integer 'n', return list of factors.
def factorize_naive(n): if n < 2: return [] factors = [] p = 2 while True: if n == 1: return factors r = n % p if r == 0: factors.append(p) n = n / p elif p * p >= n: factors.append(n) return factors ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factor_naive(n):\n factors = []\n\n for factor in range(2, n // 2):\n q, r = divmod(n, factor)\n power = 0\n while r == 0:\n power += 1\n n = q\n q, r = divmod(q, factor)\n if power != 0:\n factors.append((factor, power))\n\n if f...
[ "0.8692814", "0.8681032", "0.85969007", "0.8498952", "0.8478241", "0.84262383", "0.8397108", "0.83875006", "0.83585554", "0.8355778", "0.83539885", "0.8348885", "0.83466655", "0.8333865", "0.83293575", "0.83183795", "0.8317767", "0.83094484", "0.8283076", "0.82130885", "0.821...
0.818808
21
The worker function, invoked in a thread. 'nums' is a list of numbers to factor. The results are placed in outdict.
def worker(nums, outdict): print(threading.current_thread().name) print ("pid:", os.getpid()) for n in nums: outdict[n] = factorize_naive(n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worker(nums, out_q):\n outdict = {}\n print(threading.current_thread().name)\n print (\"pid:\", os.getpid())\n print (\"data size:\", nums)\n for n in nums:\n outdict[n] = factorize_naive(n)\n out_q.put(outdict)", "def worker(nums, outdict):\n for n...
[ "0.79976565", "0.7521205", "0.56689334", "0.56155014", "0.5509319", "0.5476741", "0.53603804", "0.53469855", "0.53294677", "0.53245115", "0.53092897", "0.53065777", "0.53054893", "0.5302376", "0.5263724", "0.5257976", "0.51859593", "0.5184734", "0.5166715", "0.51412565", "0.5...
0.8538493
0
The worker function, invoked in a process. 'nums' is a list of numbers to factor. The results are placed in a dictionary that's pushed to a queue.
def worker(nums, out_q): outdict = {} print(threading.current_thread().name) print ("pid:", os.getpid()) print ("data size:", nums) for n in nums: outdict[n] = factorize_naive(n) out_q.put(outdict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worker(nums, outdict):\n print(threading.current_thread().name)\n print (\"pid:\", os.getpid())\n for n in nums:\n outdict[n] = factorize_naive(n)", "def worker(nums, outdict):\n for n in nums:\n outdict[n] = primes2(n)", "def worker(file_paths, out_queue):...
[ "0.7811158", "0.7189279", "0.5911946", "0.58161217", "0.5799994", "0.5654354", "0.56341344", "0.5627689", "0.55830336", "0.55784506", "0.5456631", "0.54565054", "0.5428179", "0.53641945", "0.5327899", "0.53268", "0.53215057", "0.5303377", "0.527345", "0.5256457", "0.52415097"...
0.7874289
0
Convert DottedRef expressions contained inside statemod variables.
def rewrite_statemods(statemods, from_args, base_offsets): assert all(isinstance(sm, StateVar) for sm in statemods) return [StateVar(name, init, rewrite_refs(update, from_args, base_offsets)) for name, init, update in statemods]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rewrite_refs(sexpr, from_args, base_offsets):\n\n def rewrite_node(sexpr):\n # Push unboxing into the state variables of distributed aggregates\n if isinstance(sexpr, expression.AggregateExpression):\n if sexpr.is_decomposable():\n ds = sexpr.get_decomposable_state()\...
[ "0.5741872", "0.5383682", "0.5184983", "0.5023414", "0.5015211", "0.49590716", "0.4947012", "0.49084386", "0.48703378", "0.4868576", "0.48671764", "0.4807401", "0.4786829", "0.47578138", "0.47443202", "0.471549", "0.4715061", "0.47128236", "0.47061858", "0.4674625", "0.467445...
0.5378944
2
Convert all DottedRef expressions into raw indexes.
def rewrite_refs(sexpr, from_args, base_offsets): def rewrite_node(sexpr): # Push unboxing into the state variables of distributed aggregates if isinstance(sexpr, expression.AggregateExpression): if sexpr.is_decomposable(): ds = sexpr.get_decomposable_state() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_indices(self):\n\n def query(rel): \n return \"\"\"SELECT pg_class.relname, pg_index.indkey\n FROM pg_class, pg_index\n WHERE (pg_index.indexrelid = pg_class.oid)\n AND (pg_index.indrelid = (SELECT pg_class.oid FROM pg_class WHERE p...
[ "0.54138833", "0.5409497", "0.5210687", "0.5174154", "0.51426494", "0.51243144", "0.50065845", "0.49686384", "0.4958775", "0.49344054", "0.4921746", "0.48844215", "0.48784012", "0.48583516", "0.48501158", "0.48439074", "0.4833522", "0.48223832", "0.48090807", "0.4801545", "0....
0.5068832
6
Rewrite a node and all its descendents
def recursive_eval(sexpr): newexpr = rewrite_node(sexpr) newexpr.apply(recursive_eval) return newexpr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def traverse(self, node):\n self.find_replace(node)\n\n for c in node.children:\n self.traverse(c)", "def alter_tree(node):\n if not node.input:\n return _alter_node(node)\n\n converted_children = []\n for input_op in node.input:\n converted_children.append(alter_t...
[ "0.69255537", "0.6654335", "0.6639701", "0.6633387", "0.63784707", "0.63784707", "0.6252041", "0.62423354", "0.6227609", "0.61130893", "0.61077225", "0.6052538", "0.59229606", "0.59091115", "0.59052867", "0.58922935", "0.5864748", "0.5787195", "0.57765543", "0.57686204", "0.5...
0.0
-1
Calculate the first column of each relation in the rollup schema.
def __calculate_offsets(from_args): index = 0 offsets = {} for _id in from_args.iterkeys(): offsets[_id] = index index += len(from_args[_id].scheme()) return offsets
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _columns(cls, schema: dsl.Source.Schema) -> typing.Sequence[str]:\n return tuple(f.name for f in schema)", "def get_schema(self):\n return ', '.join('%s:%s' % (col, self.schema[col]) for col in self.schema)", "def get_schema(self):\n return ', '.join(\n '%s:%s' % (col, self.schema[c...
[ "0.5502951", "0.5398246", "0.52835834", "0.51542795", "0.4965693", "0.4851191", "0.483501", "0.47420785", "0.47310165", "0.47011814", "0.46979633", "0.46741876", "0.46594706", "0.46257573", "0.45953274", "0.45745704", "0.45718452", "0.45652014", "0.4507311", "0.44981587", "0....
0.0
-1
Merge a sequence of operations into a crossproduct tree.
def merge(from_args): assert len(from_args) > 0 def cross(x, y): return algebra.CrossProduct(x, y) from_ops = from_args.values() op = reduce(cross, from_ops) return (op, __calculate_offsets(from_args))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compose(*ops):\n if len(ops) == 0:\n return [0, 1, 2, 3, 4, 5, 6, 7]\n if len(ops) == 1:\n return ops[0]\n if len(ops) == 2:\n op1, op2 = ops\n return [op2[op1[v]] for v in range(8)]\n op1 = ops[0]\n rest = ops[1:]\n return compose(op1, compose(*rest))", "def car...
[ "0.5873993", "0.5623249", "0.5586423", "0.55603653", "0.53981346", "0.5373104", "0.5341948", "0.533148", "0.5324388", "0.5261074", "0.5190329", "0.5190329", "0.51866263", "0.5185752", "0.51829857", "0.517488", "0.51386654", "0.5113341", "0.51113427", "0.50928247", "0.50926036...
0.605311
0
Set the test up.
def setup_class(cls): cls.cwd = os.getcwd() cls.t = tempfile.mkdtemp() dir_path = Path("packages") tmp_dir = cls.t / dir_path src_dir = cls.cwd / Path(ROOT_DIR, dir_path) shutil.copytree(str(src_dir), str(tmp_dir)) shutil.copytree(Path(CUR_PATH, "data", "dummy_aea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n\n self._set_up()", "def setUp(self):\n MainTests.setUp(self)", "def setUp(self):\n \n pass", "def setUp(self):\n\n # setup init variables...
[ "0.82482773", "0.82482773", "0.81176686", "0.800283", "0.7907327", "0.78918254", "0.7887326", "0.7848355", "0.7842833", "0.7832785", "0.7832785", "0.781454", "0.78136706", "0.7806924", "0.78026885", "0.78026885", "0.77940094", "0.7776961", "0.7776961", "0.7776961", "0.7776961...
0.0
-1
Test getting the agent name.
def test_get_agent_name(self): result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "get", "agent.agent_name"], standalone_mode=False, catch_exceptions=False, ) assert result.exit_code == 0 assert result.output == "Agent0\n"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_name(self):\n result = self.test_client.name\n\n assert result == \"Evgenii Kryuchkov\"", "def test_get_name(self):\n self.assertEqual(self.testcommand.get_name(), \"team\")", "def server_agent_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"server_agent_name\...
[ "0.6913163", "0.69033694", "0.6782439", "0.6780959", "0.6780959", "0.6644797", "0.6546011", "0.63555205", "0.6076936", "0.6031", "0.59842354", "0.59433043", "0.5923481", "0.58773845", "0.5849658", "0.58205575", "0.5818908", "0.5801076", "0.5792172", "0.578954", "0.575222", ...
0.8780365
0
Test getting the agent name.
def test_get_agent_default_routing(self): result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "get", "agent.default_routing"], standalone_mode=False, catch_exceptions=False, ) assert result.exit_code == 0 assert result.output == "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_agent_name(self):\n result = self.runner.invoke(\n cli,\n [*CLI_LOG_OPTION, \"config\", \"get\", \"agent.agent_name\"],\n standalone_mode=False,\n catch_exceptions=False,\n )\n assert result.exit_code == 0\n assert result.output =...
[ "0.8780365", "0.6913163", "0.69033694", "0.6782439", "0.6780959", "0.6780959", "0.6644797", "0.6546011", "0.63555205", "0.6076936", "0.6031", "0.59842354", "0.59433043", "0.5923481", "0.58773845", "0.5849658", "0.58205575", "0.5818908", "0.5801076", "0.5792172", "0.578954", ...
0.0
-1
Test getting the 'dummy' skill name.
def test_get_skill_name(self): result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "get", "skills.dummy.name"], standalone_mode=False, ) assert result.exit_code == 0 assert result.output == "dummy\n"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_skill_name_should_fail(self):\n result = self.runner.invoke(\n cli,\n [*CLI_LOG_OPTION, \"config\", \"set\", \"skills.dummy.name\", \"new_dummy_name\"],\n standalone_mode=False,\n )\n assert result.exit_code == 1", "def fixture_microbial_sample_n...
[ "0.73746306", "0.6601982", "0.6425845", "0.62760645", "0.6175571", "0.6128249", "0.61196023", "0.6061607", "0.60439354", "0.60229063", "0.5997637", "0.5944493", "0.59063286", "0.58992296", "0.5851394", "0.58460176", "0.58350754", "0.5834596", "0.58218324", "0.5789334", "0.578...
0.864754
0
Test getting the 'dummy' skill name.
def test_get_nested_attribute(self): result = self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", "get", "skills.dummy.behaviours.dummy.class_name", ], standalone_mode=False, ) asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_skill_name(self):\n result = self.runner.invoke(\n cli,\n [*CLI_LOG_OPTION, \"config\", \"get\", \"skills.dummy.name\"],\n standalone_mode=False,\n )\n assert result.exit_code == 0\n assert result.output == \"dummy\\n\"", "def test_set_ski...
[ "0.864754", "0.73746306", "0.6601982", "0.6425845", "0.62760645", "0.6175571", "0.6128249", "0.61196023", "0.6061607", "0.60439354", "0.60229063", "0.5997637", "0.5944493", "0.59063286", "0.58992296", "0.5851394", "0.58460176", "0.58350754", "0.5834596", "0.58218324", "0.5789...
0.0
-1
Test that the 'get' fails because the root is not recognized.
def test_no_recognized_root(self): result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "get", "wrong_root.agent_name"], standalone_mode=False, ) assert result.exit_code == 1 assert ( result.exception.message == "The ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_root_get(self):\n pass", "def test_root_get(self):\n pass", "def test_root(self):\n self.skipTest(\"\")\n response = self.fetch('/')\n self.assertEqual(response.code, 404)", "def test_get_fail(self):\n with self.assertRaises(AssertionError):\n sel...
[ "0.81144464", "0.81144464", "0.70011485", "0.68381655", "0.68031454", "0.667773", "0.6674683", "0.6666335", "0.6611255", "0.65303046", "0.6396875", "0.6372637", "0.6341329", "0.634079", "0.63209414", "0.6298034", "0.6295935", "0.6282365", "0.62819725", "0.6272043", "0.6221722...
0.65112627
10
Test that the 'get' fails because the path is too short but the root is correct.
def test_too_short_path_but_root_correct(self): result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "get", "agent"], standalone_mode=False ) assert result.exit_code == 1 assert ( result.exception.message == "The path is too short. Please spec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_root_get(self):\n pass", "def test_root_get(self):\n pass", "def testInvalidPath(self):\n status, _ = self._http_get(\"invalid_path\")\n self.assertEqual(status, 404)", "def test_too_short_path_but_root_correct(self):\n result = self.runner.invoke(\n cli...
[ "0.6826721", "0.6826721", "0.6796174", "0.6690637", "0.6464489", "0.63691777", "0.6339634", "0.631256", "0.6309888", "0.6286524", "0.6273844", "0.6235973", "0.62328714", "0.61507434", "0.6129715", "0.61153513", "0.6104261", "0.6071585", "0.60438406", "0.60402846", "0.60037696...
0.68506765
0
Test that the 'get' fails because the resource does not exist.
def test_resource_not_existing(self): result = self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", "get", "connections.non_existing_connection.name", ], standalone_mode=False, ) asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_not_exist(self):\n attempt_id = 9999\n _, err = self.resource.get(attempt_id)\n self.assertEqual(404, err)", "def test_get_non_existing(self):\n\n response = self.client.get('/auth/non-existing-resource')\n\n self.assert404(response)\n self.assertEqual('not ...
[ "0.8803426", "0.87292", "0.8429405", "0.797745", "0.797067", "0.7951216", "0.77274334", "0.76254976", "0.75959903", "0.7590098", "0.7587531", "0.75486064", "0.75073713", "0.75045615", "0.7498573", "0.7495179", "0.74433476", "0.74420184", "0.741603", "0.74085885", "0.7400039",...
0.6998007
81
Test that the 'get' fails because the attribute is not found.
def test_attribute_not_found(self): with pytest.raises( ClickException, match=r"Attribute `.* for .* config does not exist" ): self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", "get", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bad_get_property(self):\n s = State(substance=\"water\", T=Q_(400.0, \"K\"), p=Q_(101325.0, \"Pa\"))\n with pytest.raises(AttributeError):\n s.bad_get", "def test_attribute_not_found(self):\n with pytest.raises(\n ClickException,\n match=\"Attribute ...
[ "0.78341216", "0.76988006", "0.76461685", "0.7441677", "0.7264206", "0.7244423", "0.71043795", "0.7093183", "0.70701784", "0.70177764", "0.6991154", "0.69798416", "0.69683987", "0.69441843", "0.6912952", "0.6902508", "0.68767726", "0.6857589", "0.6852551", "0.6847994", "0.683...
0.7648934
2
Test that getting the 'dummy' skill behaviours works.
def test_get_whole_dict(self): result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "get", "skills.dummy.behaviours"], standalone_mode=False, ) assert result.exit_code == 0 actual_object = json.loads(result.output) expected_object = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_skill_name(self):\n result = self.runner.invoke(\n cli,\n [*CLI_LOG_OPTION, \"config\", \"get\", \"skills.dummy.name\"],\n standalone_mode=False,\n )\n assert result.exit_code == 0\n assert result.output == \"dummy\\n\"", "def test_skills(...
[ "0.66428226", "0.65308845", "0.63746595", "0.62595034", "0.62110424", "0.6191015", "0.61859745", "0.6046809", "0.6027827", "0.60012347", "0.5986034", "0.59540683", "0.59339106", "0.5929021", "0.5864972", "0.5860361", "0.5837059", "0.5821178", "0.5818226", "0.5801682", "0.5796...
0.0
-1
Test that getting the 'dummy' skill behaviours works.
def test_get_list(self): result = self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", "get", "vendor.fetchai.connections.p2p_libp2p.config.entry_peers", ], standalone_mode=False, ) a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_skill_name(self):\n result = self.runner.invoke(\n cli,\n [*CLI_LOG_OPTION, \"config\", \"get\", \"skills.dummy.name\"],\n standalone_mode=False,\n )\n assert result.exit_code == 0\n assert result.output == \"dummy\\n\"", "def test_skills(...
[ "0.6645116", "0.65316606", "0.6374316", "0.62608534", "0.62119484", "0.6192046", "0.6187593", "0.6046467", "0.60248756", "0.6003139", "0.598586", "0.5953502", "0.5934477", "0.5929376", "0.58642447", "0.5859839", "0.583532", "0.5821343", "0.58196056", "0.5803544", "0.5798271",...
0.0
-1
Test that getting a nested object in 'dummy' skill fails because path is not valid.
def test_get_fails_when_getting_nested_object(self): with pytest.raises( ClickException, match=r"Attribute `.* for .* config does not exist" ): self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_fails_when_setting_nested_object(self):\n with pytest.raises(\n ClickException,\n match=r\"Attribute `non_existing_attribute.dummy` is not allowed to be updated!\",\n ):\n self.runner.invoke(\n cli,\n [\n *...
[ "0.608936", "0.6087938", "0.60613996", "0.59348756", "0.59342015", "0.59085965", "0.5834793", "0.58287233", "0.5761605", "0.57341295", "0.5677793", "0.56325066", "0.5624134", "0.558056", "0.55728745", "0.5569612", "0.55691016", "0.5559063", "0.5552797", "0.5551889", "0.554345...
0.6654142
0
Test that the get fails because the path point to a nondict object.
def test_get_fails_when_getting_non_dict_attribute(self): attribute = "protocols" result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "get", f"skills.dummy.{attribute}.protocol"], standalone_mode=False, ) assert result.exit_code == 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_utils_get_dict_value_from_path_should_return_none_when_value_does_not_exists(\n path,\n):\n dictionary = {\"foo\": {\"bar\": \"bar_value\"}}\n assert ralph_utils.get_dict_value_from_path(dictionary, path) is None", "def test_no_path():\n test = [{'key': 'val'}, []]\n t_result = fetch_data...
[ "0.7242658", "0.69208175", "0.6540039", "0.6447734", "0.64288974", "0.63505775", "0.63080657", "0.6304861", "0.6304807", "0.6277467", "0.62695235", "0.6268575", "0.62654454", "0.6243012", "0.62048596", "0.6178751", "0.6153575", "0.61444944", "0.6129947", "0.60959595", "0.6073...
0.5976294
30
Test that the get fails because an object in between is not a dictionary.
def test_get_fails_when_getting_non_dict_attribute_in_between(self): result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "get", "agent.skills.some_attribute"], standalone_mode=False, ) assert result.exit_code == 1 s = "Attribute 'skills' is n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_badyvaluewithdicts(self):\n Rectangle.reset_objects()\n with self.assertRaises(TypeError) as e:\n r1 = Square(1, 2, {\"foo\": 1}, 3)\n self.assertEqual(str(e.exception), 'y must be an integer')", "def test_dictionary(self):\n self.assertIsInstance(self.test1json, d...
[ "0.67920804", "0.6693874", "0.6692907", "0.65984184", "0.65272987", "0.6486978", "0.6475015", "0.6475015", "0.6454139", "0.642352", "0.6370944", "0.6345449", "0.63148177", "0.6294746", "0.62850076", "0.6246014", "0.62105167", "0.61512166", "0.6147409", "0.6141971", "0.6139562...
0.64717823
8
Test that getting a vendor component with wrong component type raises error.
def test_get_fails_when_getting_vendor_dependency_with_wrong_component_type(self): result = self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", "get", "vendor.fetchai.component_type_not_correct.error.non_existing_attribute...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_component_with_invalid_name():\n\n with pytest.raises(ComponentAttributeError):\n application_services.get_component('missing_component')", "def test_register_component_with_invalid_type():\n\n with pytest.raises(InvalidComponentTypeError):\n component = CoreObject()\n app...
[ "0.7484369", "0.70648474", "0.6751108", "0.6693934", "0.65564436", "0.6499122", "0.6351091", "0.6348619", "0.62459064", "0.61908615", "0.61505693", "0.6141869", "0.6136945", "0.6136352", "0.61140954", "0.608789", "0.60551083", "0.60050845", "0.59680504", "0.59571373", "0.5918...
0.7972388
0
Set the test up.
def setup_class(cls): cls.cwd = os.getcwd() cls.t = tempfile.mkdtemp() dir_path = Path("packages") tmp_dir = cls.t / dir_path src_dir = cls.cwd / Path(ROOT_DIR, dir_path) shutil.copytree(str(src_dir), str(tmp_dir)) shutil.copytree(Path(CUR_PATH, "data", "dummy_aea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n\n self._set_up()", "def setUp(self):\n MainTests.setUp(self)", "def setUp(self):\n \n pass", "def setUp(self):\n\n # setup init variables...
[ "0.82482773", "0.82482773", "0.81176686", "0.800283", "0.7907327", "0.78918254", "0.7887326", "0.7848355", "0.7842833", "0.7832785", "0.7832785", "0.781454", "0.78136706", "0.7806924", "0.78026885", "0.78026885", "0.77940094", "0.7776961", "0.7776961", "0.7776961", "0.7776961...
0.0
-1
Test setting the agent name.
def test_set_agent_logging_options(self): result = self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", "set", "agent.logging_config.disable_existing_loggers", "True", "--type=bool", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_agent_name(self):\n result = self.runner.invoke(\n cli,\n [*CLI_LOG_OPTION, \"config\", \"get\", \"agent.agent_name\"],\n standalone_mode=False,\n catch_exceptions=False,\n )\n assert result.exit_code == 0\n assert result.output =...
[ "0.72085243", "0.7100356", "0.6366684", "0.62835133", "0.6257389", "0.6257389", "0.62132823", "0.6131713", "0.60440767", "0.60348433", "0.5927437", "0.5916145", "0.58946425", "0.5865132", "0.5844421", "0.57391584", "0.5722152", "0.57040644", "0.5700256", "0.56795913", "0.5665...
0.0
-1
Test setting the agent name.
def test_set_agent_incorrect_value(self): with pytest.raises( ClickException, match="Attribute `not_agent_name` is not allowed to be updated!", ): self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "set", "agent.not_agent_name", "new_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_agent_name(self):\n result = self.runner.invoke(\n cli,\n [*CLI_LOG_OPTION, \"config\", \"get\", \"agent.agent_name\"],\n standalone_mode=False,\n catch_exceptions=False,\n )\n assert result.exit_code == 0\n assert result.output =...
[ "0.72085243", "0.6366684", "0.62835133", "0.6257389", "0.6257389", "0.62132823", "0.6131713", "0.60440767", "0.60348433", "0.5927437", "0.5916145", "0.58946425", "0.5865132", "0.5844421", "0.57391584", "0.5722152", "0.57040644", "0.5700256", "0.56795913", "0.5665505", "0.5655...
0.7100356
1
Test setting the agent name.
def test_set_type_bool(self): result = self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", "set", "agent.logging_config.disable_existing_loggers", "true", "--type=bool", ], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_agent_name(self):\n result = self.runner.invoke(\n cli,\n [*CLI_LOG_OPTION, \"config\", \"get\", \"agent.agent_name\"],\n standalone_mode=False,\n catch_exceptions=False,\n )\n assert result.exit_code == 0\n assert result.output =...
[ "0.72085243", "0.7100356", "0.6366684", "0.62835133", "0.6257389", "0.6257389", "0.62132823", "0.6131713", "0.60440767", "0.60348433", "0.5927437", "0.5916145", "0.58946425", "0.5865132", "0.5844421", "0.57391584", "0.5722152", "0.57040644", "0.5700256", "0.56795913", "0.5665...
0.0
-1
Test setting the agent name.
def test_set_type_none(self): result = self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", "set", "agent.logging_config.some_value", "", "--type=none", ], standalone_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_agent_name(self):\n result = self.runner.invoke(\n cli,\n [*CLI_LOG_OPTION, \"config\", \"get\", \"agent.agent_name\"],\n standalone_mode=False,\n catch_exceptions=False,\n )\n assert result.exit_code == 0\n assert result.output =...
[ "0.72085243", "0.7100356", "0.6366684", "0.62835133", "0.6257389", "0.6257389", "0.62132823", "0.6131713", "0.60440767", "0.60348433", "0.5927437", "0.5916145", "0.58946425", "0.5865132", "0.5844421", "0.57391584", "0.5722152", "0.57040644", "0.5700256", "0.56795913", "0.5665...
0.0
-1
Test setting the default routing.
def test_set_type_dict(self): result = self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", "set", "agent.default_routing", '{"fetchai/contract_api:any": "fetchai/ledger:any"}', "--type=dict"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_router(self):\n assert self.rc_conf.has_key('defaultrouter')\n assert self.rc_conf['defaultrouter'] == '\"10.137.1.7\"'", "def test_default_routing_updated(self):\n assert self.agent_config.default_routing == {\n self.new_protocol_id: self.new_connection_id\n ...
[ "0.7380499", "0.71554756", "0.706406", "0.6946817", "0.6943349", "0.67906195", "0.66364366", "0.6569018", "0.6359504", "0.6266595", "0.619172", "0.6175089", "0.61632776", "0.60943156", "0.6091761", "0.60507745", "0.60375005", "0.6034048", "0.59746397", "0.59736043", "0.597312...
0.0
-1
Test setting the default routing.
def test_set_type_list(self): result = self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", "set", "vendor.fetchai.connections.p2p_libp2p.config.entry_peers", '["peer1", "peer2"]', "--type=li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_router(self):\n assert self.rc_conf.has_key('defaultrouter')\n assert self.rc_conf['defaultrouter'] == '\"10.137.1.7\"'", "def test_default_routing_updated(self):\n assert self.agent_config.default_routing == {\n self.new_protocol_id: self.new_connection_id\n ...
[ "0.7380499", "0.71554756", "0.706406", "0.6946817", "0.6943349", "0.67906195", "0.66364366", "0.6569018", "0.6359504", "0.6266595", "0.619172", "0.6175089", "0.61632776", "0.60943156", "0.6091761", "0.60507745", "0.60375005", "0.6034048", "0.59746397", "0.59736043", "0.597312...
0.0
-1
Test setting the agent name.
def test_set_invalid_value(self): result = self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", "set", "agent.agent_name", "true", "--type=bool", ], standalone_mode=Fa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_agent_name(self):\n result = self.runner.invoke(\n cli,\n [*CLI_LOG_OPTION, \"config\", \"get\", \"agent.agent_name\"],\n standalone_mode=False,\n catch_exceptions=False,\n )\n assert result.exit_code == 0\n assert result.output =...
[ "0.72085243", "0.7100356", "0.6366684", "0.6257389", "0.6257389", "0.62132823", "0.6131713", "0.60440767", "0.60348433", "0.5927437", "0.5916145", "0.58946425", "0.5865132", "0.5844421", "0.57391584", "0.5722152", "0.57040644", "0.5700256", "0.56795913", "0.5665505", "0.56559...
0.62835133
3
Test setting the 'dummy' skill name.
def test_set_skill_name_should_fail(self): result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "set", "skills.dummy.name", "new_dummy_name"], standalone_mode=False, ) assert result.exit_code == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_skill_name(self):\n result = self.runner.invoke(\n cli,\n [*CLI_LOG_OPTION, \"config\", \"get\", \"skills.dummy.name\"],\n standalone_mode=False,\n )\n assert result.exit_code == 0\n assert result.output == \"dummy\\n\"", "def test_name_em...
[ "0.7661072", "0.6244207", "0.61193323", "0.6040593", "0.59651697", "0.5919205", "0.5802785", "0.5780799", "0.5780309", "0.5751823", "0.57467544", "0.5730054", "0.57029426", "0.5673183", "0.5667184", "0.56606334", "0.5655326", "0.56511235", "0.5628001", "0.5626317", "0.5626150...
0.8387392
0
Test setting a nested attribute.
def test_set_nested_attribute(self): path = "skills.dummy.behaviours.dummy.args.behaviour_arg_1" new_value = "10" # cause old value is int result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "set", path, new_value], standalone_mode=False, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_fails_when_setting_nested_object(self):\n with pytest.raises(\n ClickException,\n match=r\"Attribute `non_existing_attribute.dummy` is not allowed to be updated!\",\n ):\n self.runner.invoke(\n cli,\n [\n *...
[ "0.7471137", "0.6970188", "0.656537", "0.6477467", "0.63603884", "0.61522514", "0.6127132", "0.6091757", "0.6082865", "0.6073286", "0.60494506", "0.59865016", "0.59510404", "0.59033054", "0.59033054", "0.5884618", "0.5871959", "0.58645827", "0.58420926", "0.5816876", "0.58163...
0.7355271
1
Test setting a nested attribute.
def test_set_nested_attribute_not_allowed(self): path = "skills.dummy.behaviours.dummy.config.behaviour_arg_1" new_value = "new_dummy_name" result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "set", path, new_value], standalone_mode=False, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_fails_when_setting_nested_object(self):\n with pytest.raises(\n ClickException,\n match=r\"Attribute `non_existing_attribute.dummy` is not allowed to be updated!\",\n ):\n self.runner.invoke(\n cli,\n [\n *...
[ "0.7471137", "0.7355271", "0.656537", "0.6477467", "0.63603884", "0.61522514", "0.6127132", "0.6091757", "0.6082865", "0.6073286", "0.60494506", "0.59865016", "0.59510404", "0.59033054", "0.59033054", "0.5884618", "0.5871959", "0.58645827", "0.58420926", "0.5816876", "0.58163...
0.6970188
2
Test that the 'get' fails because the root is not recognized.
def test_no_recognized_root(self): result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "set", "wrong_root.agent_name", "value"], standalone_mode=False, ) assert result.exit_code == 1 assert ( result.exception.message =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_root_get(self):\n pass", "def test_root_get(self):\n pass", "def test_root(self):\n self.skipTest(\"\")\n response = self.fetch('/')\n self.assertEqual(response.code, 404)", "def test_get_fail(self):\n with self.assertRaises(AssertionError):\n sel...
[ "0.81131697", "0.81131697", "0.6998153", "0.68379533", "0.680399", "0.6676301", "0.6673244", "0.66658753", "0.66128844", "0.65304714", "0.6508784", "0.6396497", "0.6373404", "0.63408643", "0.6340362", "0.6320993", "0.6299329", "0.62931", "0.62797034", "0.6279614", "0.62703735...
0.618814
23
Test that the 'get' fails because the path is too short but the root is correct.
def test_too_short_path_but_root_correct(self): result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "set", "agent", "data"], standalone_mode=False, ) assert result.exit_code == 1 assert ( result.exception.message == "T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_too_short_path_but_root_correct(self):\n result = self.runner.invoke(\n cli, [*CLI_LOG_OPTION, \"config\", \"get\", \"agent\"], standalone_mode=False\n )\n assert result.exit_code == 1\n assert (\n result.exception.message\n == \"The path is too...
[ "0.68525183", "0.682792", "0.682792", "0.67941284", "0.6463298", "0.6370032", "0.6338329", "0.6308827", "0.63069284", "0.6288383", "0.62703323", "0.62336504", "0.6228994", "0.61508656", "0.6129853", "0.61171794", "0.6103337", "0.60726905", "0.6042274", "0.6037921", "0.6000716...
0.6692549
4
Test that the 'get' fails because the resource does not exist.
def test_resource_not_existing(self): result = self.runner.invoke( cli, [ *CLI_LOG_OPTION, "config", "set", "connections.non_existing_connection.name", "value", ], standalone_mode=Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_not_exist(self):\n attempt_id = 9999\n _, err = self.resource.get(attempt_id)\n self.assertEqual(404, err)", "def test_get_non_existing(self):\n\n response = self.client.get('/auth/non-existing-resource')\n\n self.assert404(response)\n self.assertEqual('not ...
[ "0.88033277", "0.8728782", "0.8429543", "0.79759574", "0.7970379", "0.7949762", "0.7726153", "0.76256686", "0.7595202", "0.7590344", "0.7586807", "0.7548084", "0.75071794", "0.75046843", "0.7499026", "0.74956346", "0.7443056", "0.7441133", "0.7414929", "0.74075717", "0.739820...
0.0
-1
Test that the 'set' fails because the attribute is not found.
def test_attribute_not_found(self): with pytest.raises( ClickException, match="Attribute `non_existing_attribute` is not allowed to be updated!", ): self.runner.invoke( cli, [ *CLI_LOG_OPTION, "co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_invalid_attribute(test_file):\n md = OSXMetaData(test_file.name)\n with pytest.raises(AttributeError):\n md.invalid_attribute = \"value\"", "def test_property_invalid(self):\n\n self.assertRaises(DataObjectError,\n setattr(self, \"foobar\", \"some value\")\n )",...
[ "0.78650194", "0.7669831", "0.7593095", "0.7491456", "0.7206654", "0.70923287", "0.70798254", "0.70552427", "0.6949441", "0.69461375", "0.6840308", "0.6822182", "0.6748613", "0.6726124", "0.6721214", "0.6721214", "0.6691278", "0.66883737", "0.6682688", "0.66346335", "0.663439...
0.75652254
3
Test that setting the 'dummy' skill behaviours fails because not a primitive type.
def test_set_fails_when_setting_non_primitive_type(self): with pytest.raises( ClickException, match="Attribute `behaviours` is not allowed to be updated!" ): self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "set", "skills.dummy.behaviours", "va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dummy(self):\n pass", "def test_handler_no_type_hints(self):\n with self.assertRaises(ValueError):\n\n @intent_handler\n def decorated_test(context, param):\n return None", "def test_dispatch_missing(self):\n self.skill.logic = {}\n self.asse...
[ "0.611732", "0.5922523", "0.5780935", "0.577883", "0.57609355", "0.57075256", "0.56813645", "0.56792086", "0.55930203", "0.5585353", "0.5578745", "0.55738044", "0.55481416", "0.5526285", "0.5522617", "0.55186546", "0.55089563", "0.54697376", "0.54681265", "0.5462291", "0.5453...
0.7457731
0
Test that setting a nested object in 'dummy' skill fails because path is not valid.
def test_get_fails_when_setting_nested_object(self): with pytest.raises( ClickException, match=r"Attribute `non_existing_attribute.dummy` is not allowed to be updated!", ): self.runner.invoke( cli, [ *CLI_LOG_OPTION,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_utils_set_dict_value_from_path_creating_new_fields():\n dictionary = {}\n ralph_utils.set_dict_value_from_path(dictionary, [\"foo\", \"bar\"], \"baz\")\n assert dictionary == {\"foo\": {\"bar\": \"baz\"}}", "def test_set_nested_attribute_not_allowed(self):\n path = \"skills.dummy.behavio...
[ "0.65963215", "0.6569621", "0.64509624", "0.6348378", "0.61588395", "0.5966255", "0.5864911", "0.5818894", "0.57906985", "0.57551765", "0.57298034", "0.5715899", "0.570213", "0.5672622", "0.5666781", "0.566096", "0.56185013", "0.56091845", "0.55812943", "0.55795157", "0.55630...
0.6992566
0
Test that the set fails because the path point to a nondict object.
def test_get_fails_when_setting_non_dict_attribute(self): behaviour_arg_1 = "behaviour_arg_1" path = f"skills.dummy.behaviours.dummy.args.{behaviour_arg_1}.over_the_string" result = self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "set", path, "new_value"], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_hashable1(self):\n xpb = XPathBuilder()\n xp = xpb.foo.bar\n d = {}\n self.assertRaises(TypeError, hash, xp)\n self.assertRaises(TypeError, d.setdefault, xp, 'key')", "def testNotExistingPath(self):\n with h5py.File(self.h5_fname, 'a') as f:\n f['...
[ "0.6538133", "0.6399158", "0.6360518", "0.6323283", "0.6202455", "0.614464", "0.612193", "0.6104999", "0.60922164", "0.5989702", "0.5986565", "0.5978894", "0.59288955", "0.59278184", "0.59278184", "0.59171736", "0.5916863", "0.5883562", "0.58797073", "0.58732975", "0.5871565"...
0.54350406
96
Set the test up.
def setup(self): self.cwd = os.getcwd() self.t = tempfile.mkdtemp() dir_path = Path("packages") tmp_dir = self.t / dir_path src_dir = self.cwd / Path(ROOT_DIR, dir_path) shutil.copytree(str(src_dir), str(tmp_dir)) shutil.copytree(Path(CUR_PATH, "data", "dummy_aea"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n\n self._set_up()", "def setUp(self):\n MainTests.setUp(self)", "def setUp(self):\n \n pass", "def setUp(self):\n\n # setup init variables...
[ "0.82482773", "0.82482773", "0.81176686", "0.800283", "0.7907327", "0.78918254", "0.7887326", "0.7848355", "0.7842833", "0.7832785", "0.7832785", "0.781454", "0.78136706", "0.7806924", "0.78026885", "0.78026885", "0.77940094", "0.7776961", "0.7776961", "0.7776961", "0.7776961...
0.0
-1
Tear dowm the test.
def teardown(self): os.chdir(self.cwd) try: shutil.rmtree(self.t) except (OSError, IOError): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stopTestRun(self):", "def tearDown(self):\n logging.debug('tearing down')", "def tearDown(self):\n logging.debug('tearing down')", "def stopTest(self, test):", "def tearDown(self):\n self.teardown_beets()", "def test_run_ended(self):", "def tearDown(self):\n self.testbed...
[ "0.7069817", "0.69193774", "0.69193774", "0.6745571", "0.672614", "0.66953135", "0.66407", "0.66407", "0.6625474", "0.65923214", "0.6536559", "0.6518057", "0.64930147", "0.64839315", "0.6469215", "0.6450778", "0.6431649", "0.6419006", "0.6385628", "0.6330049", "0.6329882", ...
0.0
-1
Fail on incorrect attribute tryed to be updated.
def test_set_get_incorrect_path(self): with pytest.raises( ClickException, match="Attribute `.*` for .* config does not exist" ): self.runner.invoke( cli, [*CLI_LOG_OPTION, "config", "get", self.INCORRECT_PATH], standalone_mode=Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_attribute_method8(self):\n with self.assertRaises(ValueError):\n r1 = Rectangle(10, 10, 10, 10)\n r1.update(2, -3)", "def test_update_attribute_data(self):\n pass", "def test_update_attribute_method9(self):\n with self.assertRaises(TypeError):\n ...
[ "0.75063664", "0.7077898", "0.7065358", "0.68179995", "0.67873245", "0.6754584", "0.673527", "0.6715411", "0.6590745", "0.658792", "0.6587453", "0.655349", "0.6550303", "0.65469915", "0.6511253", "0.64953804", "0.6487863", "0.64297426", "0.6420575", "0.6412844", "0.63404197",...
0.5876722
64
Load agent config for current dir.
def load_agent_config(self) -> AgentConfig: agent_loader = ConfigLoader.from_configuration_type(PackageType.AGENT) with open(DEFAULT_AEA_CONFIG_FILE, "r") as fp: agent_config = agent_loader.load(fp) return agent_config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self) -> AgentConfig:\n with cd(self._get_cwd()):\n agent_loader = self.loader()\n path = Path(DEFAULT_AEA_CONFIG_FILE)\n with path.open(mode=\"r\", encoding=\"utf-8\") as fp:\n agent_config = agent_loader.load(fp)\n return agent_con...
[ "0.77170765", "0.7356012", "0.64128786", "0.6412161", "0.6184576", "0.609155", "0.6082478", "0.6059316", "0.6059316", "0.60558116", "0.60297316", "0.59903866", "0.5989058", "0.5963897", "0.5926974", "0.59229696", "0.58908015", "0.5871731", "0.5866416", "0.5855968", "0.5802609...
0.7280268
2
Get component variable value.
def get_component_config_value(self) -> dict: package_type, package_name, *path = self.PATH.split(".") file_path = Path(f"{package_type}") / package_name / f"{package_type[:-1]}.yaml" with open(file_path, "r") as fp: data = yaml_load(fp) value = data for i in path: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_variable(self, request, context):\n response = GetVariableResponse()\n value = self._delegator.get_variable(request.component, request.variable)\n response.value = encode(value)\n return response", "def get_variable(self, svc, var):\n action = \"variableget\"\n p...
[ "0.71437204", "0.70724845", "0.70511836", "0.69538087", "0.69123816", "0.690659", "0.69018465", "0.68676025", "0.6828851", "0.6796717", "0.67753345", "0.6770774", "0.6696874", "0.6677195", "0.6672275", "0.6672275", "0.6672275", "0.66238886", "0.6623324", "0.66175497", "0.6617...
0.0
-1
Test component value updated in agent config not in component config.
def test_set_get_correct_path(self): agent_config = self.load_agent_config() assert not agent_config.component_configurations config_value = self.get_component_config_value() assert config_value == self.INITIAL_VALUE result = self.runner.invoke( cli, [*C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_custom_configuration_updated(self):\n component_protocol_id = ComponentId(\n ComponentType.PROTOCOL, self.new_protocol_id\n )\n component_contract_id = ComponentId(\n ComponentType.CONTRACT, self.new_contract_id\n )\n component_connection_id = Compo...
[ "0.6883115", "0.6502125", "0.64594984", "0.6202278", "0.6129778", "0.61204875", "0.6075345", "0.6033572", "0.5983752", "0.5950724", "0.5938686", "0.59221786", "0.5911883", "0.59022325", "0.5892399", "0.58266765", "0.57814544", "0.57743114", "0.5774052", "0.5764389", "0.574798...
0.6550141
1
Test agent config manager get_overridables.
def test_AgentConfigManager_get_overridables(): path = Path(CUR_PATH, "data", "dummy_aea") agent_config = AEABuilder.try_to_load_agent_configuration_file(path) config_manager = AgentConfigManager(agent_config, path) agent_overridables, component_overridables = config_manager.get_overridables() asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ini_get_all():\n raise NotImplementedError()", "def antenny_list_configs(self):\n return self.antenny_config.list_configs()", "def getConfigAll(self):\n return self.configAll(False)", "def getConfigs(self, host):\n raise \"not implemented\"", "def test_get_list(self):\n resul...
[ "0.5522886", "0.533993", "0.5265402", "0.52284235", "0.5223923", "0.5155312", "0.5122521", "0.5122521", "0.5117879", "0.50871843", "0.5086171", "0.505273", "0.5049074", "0.5049074", "0.5049074", "0.49887353", "0.49772704", "0.497659", "0.49645105", "0.494614", "0.49298245", ...
0.8485979
0
Iterate prior to posterior distribution using input data.
def iterate(self, data): # Append data to self.data self.data = np.append(self.data, data) for i, d in enumerate(data): update = self.current*self.likelihood(d) self.current = self._normalize(update) self.posterior = np.concatenate((self.post...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process(self, data: np.ndarray) -> np.ndarray:\n probabilities = np.empty(data.size, dtype=object)\n\n for idx, counts_dict in enumerate(data):\n shots = sum(counts_dict.values())\n freq = counts_dict.get(self._outcome, 0)\n alpha_posterior = [freq + self._alpha_...
[ "0.6235733", "0.6220724", "0.59709436", "0.5916188", "0.5812615", "0.5801119", "0.57054955", "0.5677082", "0.56668025", "0.5654472", "0.5648874", "0.56254435", "0.55976546", "0.5591801", "0.5586015", "0.55826384", "0.5580829", "0.55756706", "0.5572443", "0.55515474", "0.55488...
0.69863427
0
Plots cumulative distribution function of input probability distribution.
def cumulative_distribution(self, dist='current'): dictDist = {'current': np.cumsum(self.current), 'prior': np.cumsum(self.prior), 'posterior': np.cumsum(self.posterior, axis=1) } cdf = dictDist[dist] return cd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_cdf(self, **options):\n plt.plot(self.xs, self.ps, **options)", "def cumulative_plot(self, with_powerlaw=False, **kwargs):\n x,y = split(self.cumulative_distribution())\n if \"label\" not in kwargs:\n kwargs[\"label\"] = \"$P(k%s)$\" % self.texindex\n p = pylab.log...
[ "0.6518769", "0.65124094", "0.6493381", "0.64194536", "0.60567564", "0.6054903", "0.6053019", "0.6044755", "0.6002551", "0.59260064", "0.5922537", "0.5888744", "0.58834714", "0.5870317", "0.58622444", "0.58605176", "0.5819715", "0.58051467", "0.5775122", "0.5729377", "0.57234...
0.54887307
33
Calculates credible interval for any probability distribution given input interval for cdf.
def credible_interval(self, distType='current', interval=(0.025, 0.975)): # Calculate cdf to use for credible interval distCred = self.cumulative_distribution(dist=distType) # Prior and Current credible intervals if (distType=='current' or distType=='prior'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_credible_interval(vals, weights, confidence: float = 0.95):\n if confidence <= 0.0 or confidence >= 1.0:\n raise ValueError(\n f\"Confidence {confidence} must be in the interval (0.0, 1.0).\"\n )\n alpha_lb = 0.5 * (1.0 - confidence)\n alpha_ub = confidence + alpha_lb\...
[ "0.6312664", "0.60228646", "0.5892485", "0.58310425", "0.56982505", "0.5682813", "0.5677748", "0.5657644", "0.5619041", "0.5616922", "0.55988735", "0.5576793", "0.5562751", "0.55557513", "0.5543005", "0.5532123", "0.55102867", "0.55094415", "0.55092555", "0.5476659", "0.54524...
0.7396832
0
Plots cumulative distribution for various inputs.
def plot_cdf(self, distType='posterior', plotType='line', figSize=(5,4)): # Calculate cdf to plot distToPlot = self.cumulative_distribution(dist=distType) # Create figure fig = plt.figure(figsize=figSize) # Create colormap colors = cm.rainbow(np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_cumulative_distr_plot(data):\n x = data.index\n y = data[\"cumprop\"]\n plot = go.Bar(x=x, y=y, showlegend=False)\n\n return plot", "def plot_cdf(self, **options):\n plt.plot(self.xs, self.ps, **options)", "def plot_cumulative_distribution(data, fig_title, ax_labels=None, resolution...
[ "0.67289984", "0.64278775", "0.64250666", "0.6319937", "0.6233318", "0.6181403", "0.6145437", "0.6055146", "0.6021088", "0.59941614", "0.5906233", "0.58567", "0.5850428", "0.577539", "0.5723072", "0.57081443", "0.5707813", "0.5703675", "0.57034284", "0.56929755", "0.5645915",...
0.5508781
36
Plots all posterior iterations using matplotlib.
def plot_posteriors(self, plotType='line', plotEvery=1, figSize=(5,4)): # Create figure fig = plt.figure(figsize=figSize) # Create colormap colors = cm.rainbow(np.linspace(0, 1, len(self.posterior))) # Determine plot type if plot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_iterations(iters):\n axes = [plt.plot(lin.X, lin.Y, color='k', alpha=.15) for lin in iters]\n return axes", "def plotPosteriors(posteriors):\n for i,p in enumerate(posteriors):\n plt.hist(p,bins=20,histtype='stepfilled',alpha=0.5,\n density=True,label='Bin {0}'.format(i))...
[ "0.7567773", "0.71228373", "0.6709755", "0.65574926", "0.65548545", "0.6547027", "0.65101844", "0.6499985", "0.6397951", "0.6385926", "0.6382974", "0.63662165", "0.63592637", "0.6354584", "0.6353605", "0.6352886", "0.6328921", "0.63259894", "0.63183016", "0.63164365", "0.6308...
0.65124786
6
Normalize the product of likelihood and prior.
def _normalize(self, inp): return inp/inp.sum()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(X, mu, sigma):\n return (X - mu) / sigma", "def _normalise(self):\n if not self.is_unit():\n n = self.norm\n if n > 0:\n self.q = self.q / n", "def normalize(init_probs):\n total_prob = sum(init_probs)\n if total_prob > 0. + InferenceUt...
[ "0.68239534", "0.67643946", "0.6680338", "0.66775995", "0.66477513", "0.66317827", "0.6610939", "0.65681386", "0.6563714", "0.65164256", "0.6468991", "0.6431344", "0.6422754", "0.6422754", "0.6386382", "0.63844436", "0.63793725", "0.6371887", "0.63595843", "0.63073415", "0.63...
0.680125
1
Likelihood function for Bernoulli process. Assumes that
def likelihood(self, inData): lh = np.zeros(len(self.hypotheses)) if inData==1: lh = self.hypotheses/100.0 else: lh = (100 - self.hypotheses)/100.0 return lh
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_prob_mle(X: np.ndarray, n: int) -> float:\n\n assert n > 1, \"for n = 1 use Bernoulli distribution.\"\n Binomial._check_input_data(X=X)\n Binomial._check_support(X=X, n=n)\n\n prob = X.mean() / n\n return prob", "def bernoulli(p):\n bern = rn.binomial(1,p)\n r...
[ "0.7083514", "0.7078356", "0.6964173", "0.6953273", "0.68988603", "0.68163997", "0.6747757", "0.6741851", "0.6740194", "0.66882396", "0.66816545", "0.66319585", "0.6620972", "0.6600291", "0.65937495", "0.65915376", "0.6562052", "0.6561633", "0.65579647", "0.6542335", "0.65386...
0.0
-1
Likelihood function for 2D paintball process. Assumes that
def likelihood(self, inData): lh = np.zeros(len(self.hypotheses)) # Calculation possible locations (xs) from hypotheses locs = list(set(self.hypotheses[:,0])) # Loop through all hypotheses for i, row in enumerate(self.hypotheses): # Define a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scattering_efficiency(self):\r\n n = np.arange(1, self.n + 1)\r\n return 2*(np.linalg.norm(np.sqrt(2*n+1)*self.a)\r\n + np.linalg.norm(self.b))/self.x**2", "def preceptron(X,Y,g,epochs=1000):\n w = g\n for epoch in range(epochs):\n H = np.sign(X.dot(w))\n mi...
[ "0.5982309", "0.57880336", "0.57070684", "0.56869805", "0.5685148", "0.56721294", "0.563048", "0.5612882", "0.5603829", "0.5589663", "0.5569503", "0.55325603", "0.5488627", "0.54650915", "0.54553336", "0.54523873", "0.5445402", "0.54440176", "0.544028", "0.54351896", "0.54313...
0.0
-1
Midpoint between two points
def mid(p1, p2): return [(p1[0]+p2[0])/2., (p1[1]+p2[1])/2.]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mid_point(a: Point, b: Point) -> Point:\n return Point((a.x + b.x) / 2, (a.y + b.y) / 2)", "def midpoint(point1, point2):\n\n x, y = (int((point1[0] + point2[0]) / 2), int((point1[1] + point2[1]) / 2))\n return (x, y)", "def midpoint(ptA, ptB):\n return( (ptA[0] + ptB[0]) * 0.5, (ptA[1]+ ptB[1]...
[ "0.8457866", "0.8228469", "0.8115049", "0.78480625", "0.7818327", "0.7814459", "0.77966034", "0.7770699", "0.75567853", "0.7517811", "0.7410664", "0.7348551", "0.7298461", "0.7200335", "0.7175701", "0.70480204", "0.7011095", "0.6999809", "0.6845968", "0.6803912", "0.6802132",...
0.68873215
18
Distance between two points
def distance(p1, p2): return sqrt((p1[1]-p2[1])**2 + (p1[0]-p2[0])**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_between_points(p1,p2):\n return math.sqrt((p2.x-p1.x)**2+(p2.y-p1.y)**2)", "def distance(a: Point, b: Point) -> float:\n return math.sqrt(math.pow(b.x - a.x, 2) + math.pow(b.y - a.y, 2))", "def distance_between_points(a: Point, b: Point) -> float:\n return math.sqrt((a.x - b.x)**2 + (a.y ...
[ "0.841957", "0.8382808", "0.83652633", "0.8354172", "0.83238786", "0.83209145", "0.8289851", "0.82782465", "0.8273264", "0.82517046", "0.82215977", "0.8218881", "0.8194025", "0.81917197", "0.818483", "0.8160363", "0.81530356", "0.8152897", "0.8151394", "0.81368905", "0.812522...
0.7940824
38
Angle between two points, radians
def getangle(p1, p2): return atan2( p2[1]-p1[1], p2[0]-p1[0] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle(p1, p2):\n x_dist = p2[0] - p1[0]\n y_dist = p2[1] - p1[1]\n return math.atan2(-y_dist, x_dist) % (2 * math.pi)", "def angle(point1, point2):\n return atan2(point2.y() - point1.y(), point2.x() - point1.x())", "def angle(p1, p2):\n return dot(p1, p2)", "def angle(a: Point, b: Poin...
[ "0.8326875", "0.82458794", "0.82118714", "0.817075", "0.81550974", "0.8051775", "0.7991552", "0.7988766", "0.79600656", "0.7946205", "0.7899237", "0.7889753", "0.7851867", "0.78455144", "0.7784987", "0.77833635", "0.77058", "0.7688795", "0.7670997", "0.7608207", "0.75978124",...
0.78615785
12
Given a point, travel "length" in the "theta" direction. Like turtle graphics.
def extendpt(p, theta, length): return [ p[0]+cos(theta)*length, p[1]+sin(theta)*length]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_triangle(x, y, length=10):\n radius = length/math.sqrt(3)\n my_turtle.penup()\n my_turtle.goto(x, y+radius)\n my_turtle.pendown()\n my_turtle.right(60)\n for i in range(3):\n my_turtle.forward(length)\n my_turtle.right(120)\n\n my_turtle.left(60)\n my_turtle.penup()",...
[ "0.65688515", "0.6350407", "0.61780405", "0.6157889", "0.5804359", "0.5804359", "0.5796193", "0.5728867", "0.5686247", "0.5668157", "0.56574714", "0.5640281", "0.5588495", "0.55151546", "0.5508654", "0.5429575", "0.54282206", "0.54211295", "0.54015946", "0.5380861", "0.535740...
0.5763283
7
Parse points from a string
def makepts(str): astr = str.replace(' ','').split('-') def fromstring(strCoords): coords = strCoords.split(',') return [float(coords[0]), float(coords[1])] return [ fromstring(strCoords) for strCoords in astr]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_point(K, s):\n return [K([QQ(c) for c in coord.split(\",\")]) for coord in s[2:-2].split('],[')]", "def parse(text):\n parts = [int(part) for part in text.strip().split(',')]\n point = Point(*parts)\n actual = \"{},{},{},{}\".format(point.x, point.y, point.z, point.t)\n a...
[ "0.7486971", "0.73367745", "0.7277568", "0.72427535", "0.70839274", "0.6653839", "0.66499704", "0.65557563", "0.6511648", "0.6503271", "0.6497287", "0.6403335", "0.63999814", "0.63896656", "0.6360118", "0.631891", "0.62946934", "0.6294317", "0.6215328", "0.6208789", "0.620541...
0.70314664
5
Create the points of a regular polygon
def polygonpts(nSides, radius=1.0): return [[cos(theta)*radius, sin(theta)*radius] for theta in frange(0, twopi, nSides+1)[:-1] ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RegularPolygonPoints(n,c):\n coord = []\n for i in range(n):\n x = m.cos(2*m.pi*i/n)+c[0]\n y = m.sin(2*m.pi*i/n)+c[1]\n coord.append([x,y])\n return(coord)", "def give_polygon(vertices, points):\n polygon = np.zeros((len(vertices), 2))\n for i, vertex in enumerate...
[ "0.719469", "0.7190829", "0.7045325", "0.70451605", "0.6851909", "0.67886734", "0.67724663", "0.6691914", "0.66057116", "0.6592724", "0.6576254", "0.64651835", "0.6458977", "0.6458977", "0.6396571", "0.6344055", "0.62720823", "0.62539804", "0.6227694", "0.6226541", "0.6224374...
0.62863386
16
Longest run testcases with more than one target
def test_longest_run_mult(self): self.assertTrue(geneutil.longestRun('QQQQN','QN')==5) self.assertTrue(geneutil.longestRun('QQANNQ','QN',1)==6) self.assertTrue(geneutil.longestRun('QQNPPQ','QN',1)==3) self.assertTrue(geneutil.longestRun('QQQAANN','QN',2)==7) self.assertTrue(geneutil.longestRun('ANQNQAN','QN',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getResult(targets, i=None):", "def test_which_targets():\n num_multi_targets = 0\n for which_targets_day in which_targets:\n # All inputs have a label\n assert np.all(which_targets_day.sum(axis=1) > 0)\n # No inputs have more than 3 targets\n assert np.all(which_targets_day....
[ "0.5934326", "0.5803281", "0.57657754", "0.57657754", "0.57301104", "0.56978285", "0.55573726", "0.5550279", "0.55331385", "0.5475259", "0.546607", "0.54098874", "0.5349436", "0.53450775", "0.53050417", "0.5281973", "0.5245072", "0.5236958", "0.523272", "0.51985705", "0.51941...
0.6047128
0
Max Sliding Count testcases
def test_max_sliding_count(self): self.assertTrue(geneutil.maxSlidingCount('AAAAA','A')==5) self.assertTrue(geneutil.maxSlidingCount('AAAAA','Q')==0) self.assertTrue(geneutil.maxSlidingCount('AAATAA','A')==4) self.assertTrue(geneutil.maxSlidingCount('AAATTAA','A')==3) self.assertTrue(geneutil.maxSlidingCount(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_scoring_num_rolls(dice=six_sided, num_samples=1000):\n # BEGIN PROBLEM 8\n\n \"\"\"maxi, number_of_dice, ret = 0, 10, 0\n while number_of_dice > 0:\n avg = make_averaged(roll_dice)(number_of_dice, dice)\n maxi = max(maxi, avg)\n if avg >= maxi:\n ret = number_of_dic...
[ "0.62596506", "0.6250178", "0.5989606", "0.59886724", "0.59800094", "0.5964477", "0.5924157", "0.59153247", "0.587332", "0.58163136", "0.58109987", "0.5752196", "0.57395124", "0.5706765", "0.5683033", "0.5675851", "0.5669799", "0.5661942", "0.56422496", "0.56366104", "0.56272...
0.7155858
0
Entropy of a homopolymer
def test_entropy(self): seq1 = 'AAAA' res = geneutil.sequenceEntropy(seq1) self.assertAlmostEqual(res.entropy,0.0) self.assertTrue(res.counts['A']==4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(message):\n n = len(message)\n message = letter_freq(message)\n h = 0\n for n_i in message.values():\n p_i = n_i/n\n h += -p_i*(log2(p_i))\n return h", "def entropy(self):\n Z = self.sum()\n assert (Z > 0), 'Non-normalizable factor (perhaps log factor?)' # also chec...
[ "0.76097333", "0.7541695", "0.7539285", "0.7420453", "0.74041563", "0.73959124", "0.73686385", "0.73681575", "0.73568857", "0.72097194", "0.7157526", "0.7145899", "0.71405953", "0.7108745", "0.7095906", "0.7078543", "0.7067588", "0.70662063", "0.7055253", "0.7043006", "0.6998...
0.0
-1
Determine what moves are safe for a player to make. Returns a list of valid actions that player p can make in the given state.
def safe_moves(p, state): x, y = state['players'][p]['x'], state['players'][p]['y'] moves = [] actions = [(1, 0, 'east'), (-1, 0, 'west'), (0, -1, 'north'), (0, 1, 'south')] for dx, dy, move in actions: tx, ty = str(x + dx), str(y + dy) if tx not in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actions(self, state):\r\n\r\n valid_actions = []\r\n # What kind of an action it will be\r\n # 1. Add a new piece to the game.\r\n # 2. Move and existing piece.\r\n new_piece, player = self.new_or_old_piece(state)\r\n\r\n # If we want to place a new piece in the game\r...
[ "0.7829784", "0.7794976", "0.72625947", "0.7095838", "0.7046285", "0.70153415", "0.70093673", "0.69802105", "0.6962673", "0.6890715", "0.6863222", "0.6827296", "0.66367495", "0.66215557", "0.66136307", "0.66089207", "0.65999246", "0.6596026", "0.65576553", "0.6540269", "0.653...
0.79888695
0
Start the client listening to the game. Pass in a function that accepts the available actions and the current state of the game, and returns the action to take. The SDK will handle the rest. Checks if any commandline arguments are passed when running, if there are any, they are assumed to be client keys that are sent t...
def start(turn_handler): if os.environ.get('BOTBOX_SECRET'): print('Using env secret:', os.environ['BOTBOX_SECRET']) headers = {'Authorization': os.environ['BOTBOX_SECRET']} elif len(sys.argv) > 1: print('Using cli secret:', sys.argv[1]) headers = {'Authorization': sys.argv[1]} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n if self._callable:\n self._is_running = True\n self._run_client()", "async def run():\n # Get the arguments from the parser\n args = client.arguments\n\n # If the help argument was used, return\n if hasattr(args, \"help\"):\n return\n # Otherw...
[ "0.61051023", "0.597413", "0.59535104", "0.5894354", "0.58022404", "0.5720852", "0.56565666", "0.56241596", "0.56227505", "0.5545233", "0.5524626", "0.54708153", "0.54685193", "0.54664093", "0.5453326", "0.5451305", "0.54465693", "0.5406699", "0.5384227", "0.53778505", "0.537...
0.6006053
1
This is a private method that handles incoming messages from the websocket, passes the turn information to an agent's turn handler, and then passes the result back to the server.
def _on_message(ws, msg, turn_handler): def x(): parsed = json.loads(msg) player = parsed['player'] actions = parsed['actions'] state = parsed['state'] action = turn_handler(player, actions, state) response = {"action":action} ws.send(json.dumps(response)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_message(self, wsobj, message):\n\n message = json.loads(message)\n\n # If needed, complete the websocket handshake\n if message[\"op\"] == \"C\":\n self.on_open(wsobj, message=message)\n\n # The next few lines ensure only gameplay related event for the\n # speci...
[ "0.62253714", "0.6034103", "0.6009861", "0.60036653", "0.6001996", "0.59676135", "0.5915021", "0.58753765", "0.58735913", "0.5867791", "0.5857927", "0.5834144", "0.5820389", "0.58074945", "0.5798301", "0.5788626", "0.5782153", "0.5777276", "0.5736334", "0.5656241", "0.5642342...
0.72230154
0
Do not return anything, modify matrix inplace instead.
def rotate(self, matrix: List[List[int]]) -> None: flip(transpose(matrix))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __update_matrix(self, old_matrix_view):\n # if we've cleaned dirt - we will see it on our next move, so we substitute only unseen cells\n # which are marked with \"o\"\n new_matrix_view = []\n for row in range(self.matrix_rows):\n new_matrix_view.append([char for char in ...
[ "0.70664227", "0.684492", "0.6359314", "0.6214309", "0.61908424", "0.6126168", "0.6038709", "0.5992883", "0.5966755", "0.5938156", "0.5928229", "0.5917942", "0.5897078", "0.5853082", "0.58382195", "0.580802", "0.5800106", "0.57914895", "0.57380044", "0.57230836", "0.57099885"...
0.0
-1
Tile an image to a given width and height.
def tile_image( im: Image.Image, width: int, height: int, mode: Optional[str] = "RGB", **kwargs: Any ) -> Image.Image: im_out = Image.new(mode, (width, height), **kwargs) h_tiles = ceil(width / im.width) v_tiles = ceil(height / im.height) for i in range(v_tiles): y = im.height * i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_image(self, image_location, width, height):\n tile_image = pygame.image.load(image_location).convert_alpha()\n # The tile is a square and the height is expected to be smaller than the width\n tile_width = width\n tile_height = height\n tile_image = pygame.transform.sca...
[ "0.69168466", "0.65878046", "0.6285758", "0.6285758", "0.626664", "0.62628806", "0.619035", "0.6130948", "0.61250263", "0.61242956", "0.61224717", "0.60801274", "0.60514724", "0.60491633", "0.60491633", "0.60491633", "0.6043619", "0.60361886", "0.60337836", "0.6016151", "0.60...
0.78441113
0