query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Test user's if favourite restaurant is added to DB
def test_add_to_fav_(self): result = self.client.post("/add_to_fav", data={"yelp_biz_id":"JA_V9TqDCrkgknqrcUndIQ", "yelp_rest_name":"Siam", "yelp_rating":"4", "yelp_category":"Thai", "yelp_price":"$$", "yelp_image_url":"https://s3-media2.fl.yelpcdn.com/bphoto/1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Favourite(self):\n self.assertEquals(self.fav_1.pk, 1)\n self.assertEquals(self.fav_1.date_added, '2019-12-20 09:00:00')\n self.assertEquals(self.fav_1.user.pk, 1)\n self.assertEquals(self.fav_1.product.pk, 1)", "async def create(self, favorite: Favorite) -> Favorite:", "de...
[ "0.72114295", "0.6636154", "0.6632463", "0.65658706", "0.64831656", "0.6482696", "0.6476188", "0.64745235", "0.6445702", "0.6381491", "0.6374218", "0.6319528", "0.6261317", "0.6236881", "0.6179164", "0.6172634", "0.6163744", "0.6161769", "0.6146276", "0.6124457", "0.60840327"...
0.78729564
0
Get the eol mode map
def EOLModeMap(): # Maintenance Note: ints must be kept in sync with EDSTC_EOL_* in edstc return { EOL_MODE_CR : _("Old Machintosh (\\r)"), EOL_MODE_LF : _("Unix (\\n)"), EOL_MODE_CRLF : _("Windows (\\r\\n)")}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_eol_for_open(self) -> str:\n map = {\n EOLTypes.CRLF: WINDOWS_EOL,\n EOLTypes.LF: UNIX_EOL,\n EOLTypes.NATIVE: linesep,\n }\n\n return map[self]", "def get_modes(self):\n return [i for i, j in enumerate(self._modemap._map) if j is not None]", ...
[ "0.63044417", "0.6147848", "0.5959693", "0.5748074", "0.57146144", "0.5593236", "0.54169565", "0.54102844", "0.53679585", "0.5359293", "0.5346539", "0.5331634", "0.53012353", "0.5280056", "0.52593654", "0.52485204", "0.51640564", "0.5128611", "0.51207393", "0.51181734", "0.50...
0.808408
0
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
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
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
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
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
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
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 '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 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 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 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
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 '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 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 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
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
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
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
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
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
Fetch an image from a given URL.
def fetch_image(url: str) -> Image.Image: r = httpx.get(url) if not r.status_code == httpx.codes.OK: raise HTTPException(r.status_code, detail=r.reason_phrase) f = BytesIO(r.content) im = handle_image_file(f) return im
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_image(img_url):\n\n r = requests.get(img_url)\n return r.content", "def _download_img_from_url(self, img_url):\r\n response = requests.get(img_url)\r\n img = Image.open(BytesIO(response.content))\r\n print(\"Downloaded image from url\")\r\n return img", "def getImage...
[ "0.8507021", "0.80610484", "0.79975206", "0.7953096", "0.79118997", "0.7878863", "0.7840954", "0.7823508", "0.77485085", "0.77150685", "0.7658794", "0.76583415", "0.7470759", "0.7440883", "0.7416042", "0.74151766", "0.73907363", "0.73734015", "0.7324511", "0.7323661", "0.7306...
0.8826489
0
Test case for command_trigger_webhook_post Launch a command via a Trigger
def test_command_trigger_webhook_post(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_webhook_endpoint_generates_telegram_command_event(\n hass: HomeAssistant,\n webhook_platform,\n hass_client: ClientSessionGenerator,\n update_message_command,\n) -> None:\n client = await hass_client()\n events = async_capture_events(hass, \"telegram_command\")\n\n response = aw...
[ "0.6756358", "0.63620687", "0.6353586", "0.6080397", "0.60362595", "0.5910809", "0.59053904", "0.58640003", "0.58217233", "0.57251173", "0.5721428", "0.5700421", "0.5697234", "0.5693077", "0.56879246", "0.5658715", "0.5656193", "0.5644521", "0.5596793", "0.5591541", "0.554928...
0.88001287
0
Checks if specified operation is allowed on the resource.
def _operation_allowed(self, headers_dict, operation): if 'allow' in headers_dict: if operation in headers_dict['allow']: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_allowed(self, role, operation, resource):\r\n assert not role or role in self._roles\r\n assert not resource or resource in self._resources\r\n\r\n roles = set(get_family(self._roles, role))\r\n operations = set([None, operation])\r\n resources = set(get_family(self._resou...
[ "0.735948", "0.72206527", "0.68997526", "0.6572741", "0.64294475", "0.63755685", "0.63672787", "0.6200207", "0.61940044", "0.61875075", "0.6171609", "0.61679983", "0.60811335", "0.607854", "0.604403", "0.60305333", "0.60210794", "0.60210794", "0.60156304", "0.6002486", "0.599...
0.77897847
0
Parse the ExtendedError object and retruns the message. Build a list of decoded messages from the extended_error using the message registries. An ExtendedError JSON object is a response from the with its own schema. This function knows how to parse the ExtendedError object and, using any loaded message registries, rend...
def _render_extended_error_message_list(self, extended_error): messages = [] if isinstance(extended_error, dict): if ('Type' in extended_error and extended_error['Type'].startswith('ExtendedError.')): for msg in extended_error['Messages']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_extended_error(self, extended_error):\n return self._render_extended_error_message_list(extended_error)", "def _get_resp_body_errors(self):\n\n if self._resp_body_errors and len(self._resp_body_errors) > 0:\n return self._resp_body_errors\n\n errors = []\n warnings...
[ "0.6861036", "0.57295793", "0.5393745", "0.52291447", "0.51675904", "0.50977695", "0.50927067", "0.50382864", "0.499844", "0.49484342", "0.48670247", "0.4862164", "0.48498005", "0.48152092", "0.479743", "0.4794128", "0.4794128", "0.4792617", "0.47888657", "0.4763331", "0.4752...
0.8262206
0
Gets the list of decoded messages from the extended_error.
def _get_extended_error(self, extended_error): return self._render_extended_error_message_list(extended_error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _render_extended_error_message_list(self, extended_error):\n messages = []\n if isinstance(extended_error, dict):\n if ('Type' in extended_error and\n extended_error['Type'].startswith('ExtendedError.')):\n for msg in extended_error['Messages']:\n ...
[ "0.780336", "0.66833067", "0.6297517", "0.62860835", "0.62860835", "0.60984194", "0.6095849", "0.60497504", "0.60270995", "0.59741163", "0.59682614", "0.59034014", "0.58919424", "0.58919424", "0.58919424", "0.58700424", "0.5852855", "0.57940054", "0.5786559", "0.57755375", "0...
0.7126763
1
Gets the PCI devices.
def _get_pci_devices(self): system = self._get_host_details() if ('links' in system['Oem']['Hp'] and 'PCIDevices' in system['Oem']['Hp']['links']): # Get the PCI URI and Settings pci_uri = system['Oem']['Hp']['links']['PCIDevices']['href'] status, hea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_pci_device_list(self):\n pass", "def _get_gpu_pci_devices(self):\n pci_device_list = self._get_pci_devices()\n\n gpu_list = []\n items = pci_device_list['Items']\n for item in items:\n if item['ClassCode'] in CLASSCODE_FOR_GPU_DEVICES:\n i...
[ "0.74077874", "0.7218372", "0.72180504", "0.72177297", "0.7194209", "0.7167658", "0.70619637", "0.69890875", "0.698407", "0.69460297", "0.6933677", "0.6915167", "0.688954", "0.68429095", "0.6825503", "0.68069667", "0.68069667", "0.68069667", "0.68069667", "0.67960405", "0.679...
0.8361106
0
Get the BIOS settings resource.
def _get_bios_settings_resource(self, data): try: bios_settings_uri = data['links']['Settings']['href'] except KeyError: msg = ('BIOS Settings resource not found.') raise exception.IloError(msg) status, headers, bios_settings = self._rest_get(bios_settings_ur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_bios_setting(self, bios_property):\n headers, bios_uri, bios_settings = self._check_bios_resource([\n bios_property])\n return bios_settings[bios_property]", "def get_current_bios_settings(self, only_allowed_settings=True):\n\n sushy_system = self._get_sushy_system()\n ...
[ "0.6687052", "0.66053444", "0.6305347", "0.62781394", "0.6151722", "0.6145869", "0.5832804", "0.56546223", "0.5652844", "0.5579022", "0.5577148", "0.55607617", "0.5531982", "0.5527874", "0.54689676", "0.5428091", "0.5396962", "0.53963387", "0.53295165", "0.53211266", "0.52970...
0.7173748
0
Check if the PATCH Operation is allowed on the resource.
def _validate_if_patch_supported(self, headers, uri): if not self._operation_allowed(headers, 'PATCH'): msg = ('PATCH Operation not supported on the resource ' '"%s"' % uri) raise exception.IloError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_PATCH(self):\n if not self.url:\n return\n response = self.client.patch(self.url, {}, format='json')\n self.assertIn(response.status_code, [status.HTTP_405_METHOD_NOT_ALLOWED,\n status.HTTP_401_UNAUTHORIZED])", "def test_partial...
[ "0.69640553", "0.6944961", "0.6830189", "0.6657633", "0.65127224", "0.63872164", "0.6329733", "0.62977004", "0.61410993", "0.6072097", "0.5949872", "0.5900068", "0.58420664", "0.58221006", "0.5762764", "0.57505614", "0.5717169", "0.571581", "0.56980234", "0.5684516", "0.56841...
0.803524
0
Retrieves bios settings of the server.
def _get_bios_setting(self, bios_property): headers, bios_uri, bios_settings = self._check_bios_resource([ bios_property]) return bios_settings[bios_property]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_bios_settings_resource(self, data):\n try:\n bios_settings_uri = data['links']['Settings']['href']\n except KeyError:\n msg = ('BIOS Settings resource not found.')\n raise exception.IloError(msg)\n\n status, headers, bios_settings = self._rest_get(bios...
[ "0.70597833", "0.67072386", "0.66295433", "0.63893646", "0.6140606", "0.59224844", "0.58876735", "0.57552373", "0.57381696", "0.5689282", "0.5650241", "0.55698514", "0.5555418", "0.55383116", "0.54772294", "0.5444395", "0.5402679", "0.5402679", "0.53762496", "0.5365478", "0.5...
0.6843512
1
Get the iscsi settings resoure.
def _get_iscsi_settings_resource(self, data): try: iscsi_settings_uri = data['links']['Settings']['href'] except KeyError: msg = ('iscsi settings resource not found.') raise exception.IloCommandNotSupportedError(msg) status, headers, iscsi_settings = self._re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_settings(self):\n return self.request({\n \"path\": \"/\" + UUID + \"/setting\"\n })", "def get_settings(self):\n return self.settings", "def get_settings(self):\n url = \"https://api.imgur.com/3/account/{0}/settings\".format(self.name)\n return self._imgur...
[ "0.6224379", "0.5955814", "0.59340453", "0.5871603", "0.5869005", "0.5833151", "0.57728857", "0.57651824", "0.57078904", "0.57052916", "0.5703846", "0.5703846", "0.5703846", "0.5703846", "0.56948245", "0.5670498", "0.5628336", "0.56175953", "0.56175953", "0.5589727", "0.55740...
0.7113912
0
Get the Boot resource like BootSources.
def _get_bios_boot_resource(self, data): try: boot_uri = data['links']['Boot']['href'] except KeyError: msg = ('Boot resource not found.') raise exception.IloCommandNotSupportedError(msg) status, headers, boot_settings = self._rest_get(boot_uri) if s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_persistent_boot_devices(self):\n # Check if the BIOS resource if exists.\n headers_bios, bios_uri, bios_settings = self._check_bios_resource()\n\n # Get the Boot resource.\n boot_settings = self._get_bios_boot_resource(bios_settings)\n\n # Get the BootSources resource\n ...
[ "0.5812557", "0.5714252", "0.5702293", "0.5645948", "0.5568216", "0.5541851", "0.5470517", "0.5470517", "0.5470517", "0.54481995", "0.54481995", "0.54481995", "0.54442555", "0.54271823", "0.5424539", "0.53723615", "0.5370766", "0.5336021", "0.530553", "0.5278246", "0.5265546"...
0.5864545
0
Get the Mappings resource.
def _get_bios_mappings_resource(self, data): try: map_uri = data['links']['Mappings']['href'] except KeyError: msg = ('Mappings resource not found.') raise exception.IloCommandNotSupportedError(msg) status, headers, map_settings = self._rest_get(map_uri) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapping(self):\n return self._mapping", "def get_mapping(self, ksf: str) -> InfoResMapping:\n irm = self.InfoResMapping(self, ksf)\n return irm", "def getMapping(self):\n self._process()\n return self._mapping", "def mapping(self):\n return self.request('_mapping...
[ "0.673186", "0.6723476", "0.67003196", "0.6668532", "0.6564718", "0.6539853", "0.6527213", "0.6339044", "0.63287383", "0.6280277", "0.62163085", "0.60885906", "0.607769", "0.6042368", "0.6038287", "0.60309374", "0.60278445", "0.5881427", "0.585224", "0.5841346", "0.58215725",...
0.6955971
0
Checks if patch is supported on iscsi.
def _check_iscsi_rest_patch_allowed(self): headers, bios_uri, bios_settings = self._check_bios_resource() # Check if the bios resource exists. if('links' in bios_settings and 'iScsi' in bios_settings['links']): iscsi_uri = bios_settings['links']['iScsi']['href'] status,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_if_patch_supported(self, headers, uri):\n if not self._operation_allowed(headers, 'PATCH'):\n msg = ('PATCH Operation not supported on the resource '\n '\"%s\"' % uri)\n raise exception.IloError(msg)", "def check_supported_features(self):",...
[ "0.6394003", "0.6082379", "0.5752724", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.57124674", "0.5584858", ...
0.7114112
0
Change secure boot settings on the server.
def _change_secure_boot_settings(self, property, value): system = self._get_host_details() # find the BIOS URI if ('links' not in system['Oem']['Hp'] or 'SecureBoot' not in system['Oem']['Hp']['links']): msg = (' "SecureBoot" resource or feature is not ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_secure_boot_mode(self, secure_boot_enable):\n sushy_system = self._get_sushy_system()\n try:\n sushy_system.secure_boot.enable_secure_boot(secure_boot_enable)\n except exception.InvalidInputError as e:\n msg = (self._('Invalid input. Error %(error)s')\n ...
[ "0.7178006", "0.69563264", "0.6825512", "0.68102604", "0.6628108", "0.61587363", "0.59844947", "0.58227813", "0.57520616", "0.5736573", "0.5724402", "0.5678746", "0.56520265", "0.56394017", "0.5624491", "0.5624137", "0.56189376", "0.5582487", "0.55506265", "0.5549751", "0.552...
0.72850573
0
Checks if the system is in uefi boot mode.
def _is_boot_mode_uefi(self): boot_mode = self.get_current_boot_mode() if boot_mode == 'UEFI': return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_bootable(self):\n return self.bootable_flag == 0x80", "def has_efi():\n return os.path.exists(\"/sys/firmware/efi\")", "def get_boot_mode():\n boot_mode = 'Legacy'\n try:\n reg_key = winreg.OpenKey(\n winreg.HKEY_LOCAL_MACHINE, r'System\\CurrentControlSet\\Control')\n reg_value = ...
[ "0.7057053", "0.69969964", "0.6908815", "0.6746094", "0.67178434", "0.6590464", "0.6447706", "0.64065146", "0.6263757", "0.6129953", "0.61029017", "0.6102866", "0.6059007", "0.6056331", "0.6024979", "0.5940045", "0.5927244", "0.590934", "0.585367", "0.5818194", "0.58100754", ...
0.8531207
0
Get the status of secure boot.
def get_secure_boot_mode(self): system = self._get_host_details() if ('links' not in system['Oem']['Hp'] or 'SecureBoot' not in system['Oem']['Hp']['links']): msg = ('"SecureBoot" resource or feature is not supported' ' on this system') raise except...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_secure_boot_mode(self):\n sushy_system = self._get_sushy_system()\n try:\n secure_boot_enabled = GET_SECUREBOOT_CURRENT_BOOT_MAP.get(\n sushy_system.secure_boot.current_boot)\n except sushy.exceptions.SushyError as e:\n msg = (self._('The Redfish co...
[ "0.7545377", "0.73338354", "0.68596", "0.6580167", "0.6284584", "0.627462", "0.62408715", "0.6210762", "0.6183254", "0.61830187", "0.61508465", "0.61405003", "0.61379737", "0.6085388", "0.6051852", "0.6020663", "0.6020096", "0.6004745", "0.59862554", "0.5939429", "0.58935285"...
0.7864809
0
Reset secure boot keys to manufacturing defaults.
def reset_secure_boot_keys(self): if self._is_boot_mode_uefi(): self._change_secure_boot_settings('ResetToDefaultKeys', True) else: msg = ('System is not in UEFI boot mode. "SecureBoot" related ' 'resources cannot be changed.') raise exception.IloCo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(ctx):\n\n controller = ctx.obj['controller']\n click.echo('Resetting OATH data...')\n old_id = controller.id\n controller.reset()\n\n settings = ctx.obj['settings']\n keys = settings.setdefault('keys', {})\n if old_id in keys:\n del keys[old_id]\n settings.write()\n\n ...
[ "0.64598894", "0.61968", "0.61686015", "0.6030497", "0.6030497", "0.58504564", "0.5713005", "0.5710499", "0.5703248", "0.56868505", "0.5620701", "0.5609751", "0.5601407", "0.5587413", "0.5550478", "0.55427927", "0.55306214", "0.55234766", "0.55176026", "0.5505577", "0.5487669...
0.84218895
0
Perform requested power operation.
def _perform_power_op(self, oper): power_settings = {"Action": "Reset", "ResetType": oper} systems_uri = "/rest/v1/Systems/1" status, headers, response = self._rest_post(systems_uri, None, power_settings) if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power():\n request_command(tv_command=TVCommand.power)", "def power_on(self):\n raise NotImplementedError", "def pow(self, power):\n daskD.wait(self.client.map(_call_pow, self.vecDask, power=power, pure=False))\n return self", "def power_on(self):\n pass", "def power(self...
[ "0.71487105", "0.7076449", "0.70716", "0.6828888", "0.6828583", "0.670036", "0.6691989", "0.66501945", "0.6643156", "0.6614282", "0.6602157", "0.6598427", "0.6593769", "0.6579953", "0.6551106", "0.6543305", "0.6498859", "0.6488113", "0.6479012", "0.646967", "0.6468145", "0....
0.7263758
0
Simulates a physical press of the server power button.
def press_pwr_btn(self): self._press_pwr_btn()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power():\n request_command(tv_command=TVCommand.power)", "def _press_pwr_btn(self, pushType=\"Press\"):\n power_settings = {\"Action\": \"PowerButton\",\n \"Target\": \"/Oem/Hp\",\n \"PushType\": pushType}\n\n systems_uri = \"/rest/v1/Systems...
[ "0.74329734", "0.7021857", "0.678499", "0.6608517", "0.65348643", "0.64914054", "0.6230932", "0.62221473", "0.62064654", "0.6177791", "0.61654186", "0.61310524", "0.60974616", "0.608872", "0.6059632", "0.6059632", "0.5930312", "0.58865917", "0.5870763", "0.5838959", "0.582892...
0.7256616
1
Request the http boot url from system in uefi boot mode.
def get_http_boot_url(self): if(self._is_boot_mode_uefi() is True): return self._get_bios_setting('UefiShellStartupUrl') else: msg = 'get_http_boot_url is not supported in the BIOS boot mode' raise exception.IloCommandNotSupportedInBiosError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_http_boot_url(self, url):\n if(self._is_boot_mode_uefi() is True):\n self._change_bios_setting({'UefiShellStartupUrl': url})\n else:\n msg = 'set_http_boot_url is not supported in the BIOS boot mode'\n raise exception.IloCommandNotSupportedInBiosError(msg)", ...
[ "0.77584946", "0.7341055", "0.71151394", "0.65061367", "0.5847443", "0.58197343", "0.5644982", "0.5516919", "0.54772717", "0.54441345", "0.54027355", "0.53707486", "0.53131366", "0.52545315", "0.5227558", "0.5223011", "0.5216488", "0.5198572", "0.51643014", "0.5142962", "0.51...
0.81860113
0
Set url to the UefiShellStartupUrl to the system in uefi boot mode.
def set_http_boot_url(self, url): if(self._is_boot_mode_uefi() is True): self._change_bios_setting({'UefiShellStartupUrl': url}) else: msg = 'set_http_boot_url is not supported in the BIOS boot mode' raise exception.IloCommandNotSupportedInBiosError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_http_boot_uri(self, url):\n try:\n sushy_system = self._get_sushy_system()\n sushy_system.http_boot_uri.set_http_boot_uri(url)\n except sushy.exceptions.SushyError as e:\n msg = (self._('Unable to set HTTP Boot URI. Error '\n '%(error)...
[ "0.72488326", "0.7194045", "0.5525388", "0.55191153", "0.5504752", "0.5186038", "0.51711583", "0.5048918", "0.50152254", "0.49929443", "0.49760246", "0.49735522", "0.49065635", "0.48945484", "0.48868546", "0.48841438", "0.483911", "0.48351452", "0.4814122", "0.48077625", "0.4...
0.8233862
0
Set iscsi details of the system in uefi boot mode. The iSCSI initiator is identified by the MAC provided. The initiator system is set with the target details like IQN, LUN, IP, Port etc.
def set_iscsi_boot_info(self, mac, target_name, lun, ip_address, port='3260', auth_method=None, username=None, password=None): if(self._is_boot_mode_uefi() is True): iscsi_info = {} iscsi_info['iSCSITargetName'] = target_name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unset_iscsi_boot_info(self, mac):\n if(self._is_boot_mode_uefi() is True):\n iscsi_info = {'iSCSIBootEnable': 'Disabled'}\n self._change_iscsi_settings(mac.upper(), iscsi_info)\n else:\n msg = 'iscsi boot is not supported in the BIOS boot mode'\n raise ...
[ "0.6869196", "0.6160965", "0.5724841", "0.56476253", "0.5574767", "0.5545499", "0.54519165", "0.5236378", "0.51754254", "0.5034209", "0.5028963", "0.49785176", "0.49782223", "0.49486035", "0.49466297", "0.49353293", "0.4927631", "0.49271697", "0.4922526", "0.49185145", "0.489...
0.79104954
0
Disable iscsi boot option in uefi boot mode.
def unset_iscsi_boot_info(self, mac): if(self._is_boot_mode_uefi() is True): iscsi_info = {'iSCSIBootEnable': 'Disabled'} self._change_iscsi_settings(mac.upper(), iscsi_info) else: msg = 'iscsi boot is not supported in the BIOS boot mode' raise exception.I...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_secure_boot_keys(self):\n if self._is_boot_mode_uefi():\n self._change_secure_boot_settings('ResetToDefaultKeys', True)\n else:\n msg = ('System is not in UEFI boot mode. \"SecureBoot\" related '\n 'resources cannot be changed.')\n raise ex...
[ "0.608217", "0.60647833", "0.60542953", "0.60381645", "0.6015318", "0.59813994", "0.5816549", "0.57793945", "0.5776712", "0.5750608", "0.5560355", "0.5523266", "0.55037075", "0.5491119", "0.5489613", "0.54749763", "0.54649585", "0.5449469", "0.54409015", "0.539503", "0.53881"...
0.77110964
0
Retrieves the current boot mode of the server.
def get_current_boot_mode(self): boot_mode = self._get_bios_setting('BootMode') if boot_mode == 'LegacyBios': boot_mode = 'legacy' return boot_mode.upper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_boot_mode():\n boot_mode = 'Legacy'\n try:\n reg_key = winreg.OpenKey(\n winreg.HKEY_LOCAL_MACHINE, r'System\\CurrentControlSet\\Control')\n reg_value = winreg.QueryValueEx(reg_key, 'PEFirmwareType')[0]\n if reg_value == 2:\n boot_mode = 'UEFI'\n except:\n boot_mode = 'Unknown'\n\n...
[ "0.77743053", "0.75218076", "0.7441925", "0.7247707", "0.7066327", "0.6706312", "0.6605948", "0.6499532", "0.64143753", "0.6414196", "0.64062566", "0.6375331", "0.6338292", "0.63119465", "0.6295608", "0.6240478", "0.6215727", "0.61063474", "0.60902596", "0.60828465", "0.60800...
0.78080875
0
Retrieves the pending boot mode of the server. Gets the boot mode to be set on next reset.
def get_pending_boot_mode(self): headers, uri, bios_settings = self._check_bios_resource(['BootMode']) _, _, settings = self._get_bios_settings_resource(bios_settings) boot_mode = settings.get('BootMode') if boot_mode == 'LegacyBios': boot_mode = 'legacy' return boot_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_boot_mode():\n boot_mode = 'Legacy'\n try:\n reg_key = winreg.OpenKey(\n winreg.HKEY_LOCAL_MACHINE, r'System\\CurrentControlSet\\Control')\n reg_value = winreg.QueryValueEx(reg_key, 'PEFirmwareType')[0]\n if reg_value == 2:\n boot_mode = 'UEFI'\n except:\n boot_mode = 'Unknown'\n\n...
[ "0.70903546", "0.69976276", "0.6860447", "0.6815118", "0.66070074", "0.62555677", "0.6129522", "0.6030498", "0.6028887", "0.6026956", "0.6023533", "0.5965988", "0.58770573", "0.5847371", "0.5799201", "0.5777145", "0.5753953", "0.57251155", "0.5688327", "0.56876516", "0.564913...
0.8131488
0
Sets the boot mode of the system for next boot.
def set_pending_boot_mode(self, boot_mode): boot_mode = boot_mode.lower() if boot_mode not in ['uefi', 'legacy']: msg = 'Invalid Boot mode specified' raise exception.IloInvalidInputError(msg) boot_properties = {'BootMode': boot_mode} if boot_mode == 'legacy': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_boot_mode(self, task, mode):\n raise exception.UnsupportedDriverExtension(\n driver=task.node.driver, extension='set_boot_mode')", "def set_bootloader_mode(self, mode):\n self.check_validity()\n\n mode = int(mode)\n\n return self.ipcon.send_request(self, BrickletInd...
[ "0.7535342", "0.7406527", "0.7319358", "0.6997932", "0.66406643", "0.6565158", "0.6410105", "0.6125415", "0.6046522", "0.60436237", "0.6038874", "0.6014684", "0.6005457", "0.6002688", "0.59916985", "0.59749866", "0.5971754", "0.59534365", "0.5944353", "0.5900143", "0.58888465...
0.7734424
0
Resets the iLO password.
def reset_ilo_credential(self, password): acc_uri = '/rest/v1/AccountService/Accounts' for status, hds, account, memberuri in self._get_collection(acc_uri): if account['UserName'] == self.login: mod_user = {} mod_user['Password'] = password st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(ctx):\n\n controller = ctx.obj['controller']\n click.echo('Resetting OATH data...')\n old_id = controller.id\n controller.reset()\n\n settings = ctx.obj['settings']\n keys = settings.setdefault('keys', {})\n if old_id in keys:\n del keys[old_id]\n settings.write()\n\n ...
[ "0.71026045", "0.7095906", "0.65982336", "0.6317689", "0.626955", "0.622285", "0.62090886", "0.619031", "0.6150298", "0.6150298", "0.6132683", "0.6118869", "0.60761297", "0.6064993", "0.605403", "0.60505545", "0.60464615", "0.60406226", "0.601135", "0.59997255", "0.5995621", ...
0.72471446
0
Resets the BIOS settings to default values.
def reset_bios_to_default(self): # Check if the BIOS resource if exists. headers_bios, bios_uri, bios_settings = self._check_bios_resource() # Get the BaseConfig resource. try: base_config_uri = bios_settings['links']['BaseConfigs']['href'] except KeyError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\r\n # TODO: have reset flag such that it forces all the bottom changes\r\n self.pwm_freq = self._default[\"pwm_freq\"]\r\n self.gate_logic = self._default[\"gate_logic\"]\r\n self.max_pwm = self._default[\"max_pwm\"]\r\n self.lase_on_power_up = self._default[\"la...
[ "0.68796086", "0.66056365", "0.65619004", "0.65489376", "0.6536054", "0.6508475", "0.64923877", "0.6490318", "0.6390865", "0.6369686", "0.63630855", "0.6360946", "0.6344241", "0.6342181", "0.6341036", "0.63164306", "0.6314139", "0.62830174", "0.62667483", "0.62354726", "0.620...
0.68314517
1
Gets the ilo firmware version for server capabilities
def _get_ilo_firmware_version(self): manager, reset_uri = self._get_ilo_details() ilo_firmware_version = manager['Firmware']['Current']['VersionString'] return {'ilo_firmware_version': ilo_firmware_version}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def firmware_version(self):\n return self._get_system_status()[\"firmware\"]", "def get_ilo_firmware_version_as_major_minor(self):\n try:\n manager, reset_uri = self._get_ilo_details()\n ilo_fw_ver_str = (\n manager['Oem']['Hp']['Firmware']['Current']['VersionString...
[ "0.76318765", "0.74084985", "0.73684555", "0.7351483", "0.7309879", "0.71681994", "0.7141852", "0.696607", "0.6915562", "0.690672", "0.68797165", "0.6854152", "0.67555326", "0.6753871", "0.67471206", "0.67280734", "0.6711157", "0.6674547", "0.66333795", "0.6591106", "0.655982...
0.7568138
1
Return sriov enabled or not
def _is_sriov_enabled(self): return (self._get_bios_setting('Sriov') == 'Enabled')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_enabled(self):", "def swo_enabled(self):\n return self._swo_enabled", "def ms_get_rstp_enabled(self):\n self.open_route('/configure/switch_settings', \"Switch\")\n dropdown_value = page_utils.get_dropdown_value(\n self.get_page(),\n var_id='node_group_use_stp')\n return dro...
[ "0.644866", "0.63986534", "0.62832564", "0.6205629", "0.6096058", "0.6000314", "0.5948032", "0.5870357", "0.5815211", "0.5815211", "0.5815211", "0.5815211", "0.5815211", "0.5815211", "0.57979065", "0.5792855", "0.5792855", "0.5763365", "0.57592833", "0.5725535", "0.5724957", ...
0.78212315
0
Returns the given virtual media device status and device URI
def _get_vm_device_status(self, device='FLOPPY'): valid_devices = {'FLOPPY': 'floppy', 'CDROM': 'cd'} # Check if the input is valid if device not in valid_devices: raise exception.IloInvalidInputError( "Invalid device. Valid devices:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vmedia_device_uri(self, device):\n\n try:\n sushy_system = self._get_sushy_system()\n uri = utils.get_subresource_path_by(sushy_system, 'VirtualMedia')\n resp = sushy_system._conn.get(uri)\n vmedia_resp = json.loads(resp.text)\n for val in vmedi...
[ "0.7345246", "0.65547144", "0.652944", "0.60734904", "0.5523844", "0.5463692", "0.5434447", "0.5412849", "0.5385215", "0.5331038", "0.5283186", "0.5263492", "0.52565235", "0.5243921", "0.5218811", "0.5213309", "0.5212679", "0.51299715", "0.50834125", "0.5077698", "0.5065594",...
0.70259494
1
Sets the Virtual Media drive status It sets the boot option for virtual media device.
def set_vm_status(self, device='FLOPPY', boot_option='BOOT_ONCE', write_protect='YES'): # CONNECT is a RIBCL call. There is no such property to set in RIS. if boot_option == 'CONNECT': return boot_option_map = {'BOOT_ONCE': True, 'BOO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_vmedia(self, set_vmedia_state):\n\n if not isinstance(set_vmedia_state, bool):\n msg = ('The parameter \"%(parameter)s\" value \"%(value)s\" for '\n 'vmedia is invalid. Valid values are: True/False.' %\n {'parameter': 'ServiceEnabled',\n ...
[ "0.6145363", "0.60608554", "0.604248", "0.58181196", "0.5729332", "0.56799835", "0.56557316", "0.5576355", "0.5562009", "0.5548635", "0.5530569", "0.5530569", "0.5530569", "0.54632413", "0.54603094", "0.54399", "0.5374403", "0.53504235", "0.52688646", "0.5256338", "0.5245759"...
0.6670368
0
Notifies iLO of the location of a virtual media diskette image.
def insert_virtual_media(self, url, device='FLOPPY'): response, vm_device_uri = self._get_vm_device_status(device) # Eject media if there is one. RIBCL was tolerant enough to overwrite # existing media, RIS is not. This check is to take care of that # assumption. if response.get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_volume_after_attached_to_vm(self, info, vms):\n path = info[0]['path']\n path_list = path.split(sep='/')\n machine_path_list = [\"~\", \"Home\"]\n machine_path_list.extend(path_list[3:])\n info[0]['machine_path'] = \"/\".join(machine_path_list)\n info[0]['Attach...
[ "0.53416073", "0.50306785", "0.49840182", "0.49023584", "0.48749703", "0.48598105", "0.48007807", "0.4782172", "0.47274348", "0.46836528", "0.46513668", "0.46505046", "0.4647543", "0.46356696", "0.4622129", "0.46161428", "0.46150172", "0.46038243", "0.4593726", "0.4592042", "...
0.52932024
1
Ejects the Virtual Media image if one is inserted.
def eject_virtual_media(self, device='FLOPPY'): response, vm_device_uri = self._get_vm_device_status(device) # Check if virtual media is connected. if response.get('Inserted') is False: return # Update required property vm_settings = {} vm_settings['Image'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_removed_media(self):\r\n if self.has_media():\r\n try:\r\n image = str(self.image)\r\n os.remove(image)\r\n except OSError:\r\n raise('Failure trying to remove image from filesystem.')\r\n return True", "def eject_image(...
[ "0.685616", "0.6767739", "0.6732249", "0.66243017", "0.66243017", "0.6524107", "0.63902587", "0.6269782", "0.61779577", "0.60977596", "0.60840386", "0.6020783", "0.5993817", "0.5987346", "0.5948459", "0.59088904", "0.5899906", "0.5896522", "0.5884364", "0.58657366", "0.586572...
0.7177198
0
Get details of persistent boot devices, its order
def _get_persistent_boot_devices(self): # Check if the BIOS resource if exists. headers_bios, bios_uri, bios_settings = self._check_bios_resource() # Get the Boot resource. boot_settings = self._get_bios_boot_resource(bios_settings) # Get the BootSources resource try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_devices(self):\n return [x for x in self.devices.keys()]", "def getbootinfo(self):\n self.mount()\n kernel = None\n inits = []\n for line in self.xlist(\"get-bootinfo\", IBASE)[1]:\n if line.startswith('+++'):\n kernel = line.split()[1]\n ...
[ "0.65933275", "0.64047486", "0.63290364", "0.62824804", "0.627704", "0.6253434", "0.6251941", "0.62083673", "0.62029696", "0.6141751", "0.61345845", "0.6098163", "0.60664326", "0.60396963", "0.6038037", "0.6015366", "0.6013724", "0.6004768", "0.6000633", "0.5989116", "0.59565...
0.78109515
0
Retrieves the current setting for the one time boot.
def get_one_time_boot(self): system = self._get_host_details() try: if system['Boot']['BootSourceOverrideEnabled'] == 'Once': device = system['Boot']['BootSourceOverrideTarget'] if device in DEVICE_RIS_TO_COMMON: return DEVICE_RIS_TO_COMMON...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCurrentSetting(self):\n return {}", "def get_bootvar(self):\n module = 'bootimage/oper'\n method = 'GET'\n response = self.axapi_call(module, method)\n bootdefault = response.json()['bootimage']['oper']['hd-default']\n print(self.device + ' The device is set to boot f...
[ "0.69801486", "0.68082726", "0.6772974", "0.67710704", "0.6631858", "0.6596899", "0.65748394", "0.63340545", "0.6281833", "0.6263905", "0.6256233", "0.6233154", "0.6194374", "0.614808", "0.61427236", "0.6128543", "0.61068916", "0.6082622", "0.60769004", "0.6052895", "0.604562...
0.6882444
1
Gets the firmware update service uri.
def _get_firmware_update_service_resource(self): manager, uri = self._get_ilo_details() try: fw_uri = manager['Oem']['Hp']['links']['UpdateService']['href'] except KeyError: msg = ("Firmware Update Service resource not found.") raise exception.IloCommandNotSup...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_service_url():\n return get_config_handler().get_service_url()", "def _get_uri(plex_server):\n return plex_server.url(\n \"/:/websockets/notifications\", includeToken=True\n ).replace(\"http\", \"ws\")", "def get_http_boot_uri(self):\n try:\n sushy_system =...
[ "0.65430695", "0.64294636", "0.64230037", "0.62257314", "0.6150541", "0.60008526", "0.598782", "0.59735656", "0.593328", "0.59007615", "0.5866994", "0.58536565", "0.5798969", "0.57935137", "0.57414603", "0.5725773", "0.57218593", "0.5717393", "0.569106", "0.5676379", "0.56464...
0.80128765
0
Get the progress of the firmware update.
def get_firmware_update_progress(self): try: fw_update_uri = self._get_firmware_update_service_resource() except exception.IloError as e: LOG.debug(self._('Progress of firmware update not known: %s'), str(e)) return "UNKNOWN", "UNKNOWN" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_firmware_update_status(self):\n\n response = self.execute_command(CMD_GET_FIRMWARE_UPDATE_STATUS)[0]\n inprogress = (response & 0x80) == 0x80\n return {\n \"inprogress\": inprogress,\n \"error\": response & 0x7f,\n }", "def GetProgress(self):\n return ...
[ "0.71777356", "0.7156413", "0.69528806", "0.69204676", "0.6803651", "0.6803651", "0.6798143", "0.67429936", "0.67102855", "0.67044973", "0.67044973", "0.67044973", "0.67044973", "0.66923326", "0.6637259", "0.6631922", "0.662532", "0.6559995", "0.65389353", "0.6411595", "0.633...
0.8577004
0
Retrieves if server is TPM capable or not.
def _get_tpm_capability(self): tpm_values = {"NotPresent": False, "PresentDisabled": True, "PresentEnabled": True} try: tpm_state = self._get_bios_setting('TpmState') except exception.IloCommandNotSupportedError: tpm_state = "No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_available():", "def is_vtd_supported(self):\n\t\treturn bool(call_sdk_function('PrlSrvCfg_IsVtdSupported', self.handle))", "def evaluate_hardware_support(self):\n return hardware.HardwareSupport.SERVICE_PROVIDER", "def is_available(self) -> bool:\n return (\n len(self._gpu_ids...
[ "0.63089687", "0.6192992", "0.6138347", "0.5952284", "0.59215266", "0.58764535", "0.58491164", "0.58059984", "0.5796468", "0.5784329", "0.57265705", "0.56829214", "0.5666347", "0.56659436", "0.56633973", "0.5661813", "0.56546235", "0.56484747", "0.5633898", "0.55766743", "0.5...
0.7238231
0
get cpu virtualization status.
def _get_cpu_virtualization(self): try: cpu_vt = self._get_bios_setting('ProcVirtualization') except exception.IloCommandNotSupportedError: return False if cpu_vt == 'Enabled': vt_status = True else: vt_status = False return vt_stat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self):\n if self.qemu.is_running():\n status = 0\n self.log.info(\"vm-status\", result=\"online\")\n for device in list(self.qemu.block_info().values()):\n self.log.info(\n \"disk-throttle\",\n device=device[\"d...
[ "0.7207931", "0.71718997", "0.70512587", "0.7005931", "0.696061", "0.67730594", "0.66261756", "0.66120964", "0.6603125", "0.65707415", "0.655431", "0.655431", "0.65318954", "0.6502956", "0.6492939", "0.647564", "0.64564735", "0.630386", "0.62673694", "0.62613034", "0.6251442"...
0.8119382
0
Get status of NVDIMM_N.
def _get_nvdimm_n_status(self): try: nvdimm_n_status = self._get_bios_setting('NvDimmNMemFunctionality') if nvdimm_n_status == 'Enabled': nvn_status = True else: nvn_status = False except exception.IloCommandNotSupportedError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getnumbarvar(self):\n numbarvar_ = ctypes.c_int32()\n res = __library__.MSK_XX_getnumbarvar(self.__nativep,ctypes.byref(numbarvar_))\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n numbarvar_ = numbarvar_.value\n _numbarvar_return_value = numbarvar_\...
[ "0.5753764", "0.57007307", "0.5678485", "0.56483656", "0.5635664", "0.5618904", "0.559551", "0.5575454", "0.5551961", "0.5545708", "0.5526919", "0.55176646", "0.54776466", "0.54100347", "0.54067737", "0.5321118", "0.5198335", "0.51954293", "0.51463753", "0.512988", "0.5129837...
0.81031567
0
Determina numere divizibile cu k dintro lista
def get_longest_div_k(lst, k): rezultat = [] for x in lst: if x % k == 0: rezultat.append(x) return rezultat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDivisors(n):", "def divisor(k, num):\n\n if k < 0:\n raise Exception('k must be >= 0: {}'.format(k))\n\n factors = prime_factorization(num)\n result = 1\n if k == 0:\n for prime in factors:\n result *= prime + 1\n\n for prime in factors:\n result *= ((pow(pri...
[ "0.68305314", "0.66830385", "0.64528286", "0.6440956", "0.64300156", "0.6414138", "0.640048", "0.63713896", "0.6357683", "0.63318574", "0.63268465", "0.6303533", "0.62746555", "0.6266593", "0.62309676", "0.62309676", "0.61922175", "0.61922175", "0.61577624", "0.61330014", "0....
0.70152783
0
Linac phasing Note that these overlays override individual klystron phases.
def bmad_linac_phasing_lines(epics): lines = [ '! Linac overall phasing', 'O_L1[phase_deg] = 0 ! K21_1 sets this directly. This is a delta on top of that.', 'O_L2[phase_deg] = '+str(epics.caget('SIOC:SYS0:ML00:CALC204')), 'O_L3[phase_deg] = '+str(epics.caget('SIOC:SYS0:ML00:AO499'))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_display_from_lines(self):\n y = 1\n maxlin = CA_World.ca_display_size - 1\n limy = len(self.ca_lines) + maxlin\n for i in self.ca_lines:\n x = 1\n if limy >= maxlin:\n if SimEngine.gui_get('init') == \"Right\": # Right\n l...
[ "0.59270585", "0.58033264", "0.5608836", "0.55544627", "0.5367089", "0.53572994", "0.53372705", "0.5273966", "0.52700067", "0.5266239", "0.52600336", "0.5244795", "0.51854324", "0.5150837", "0.5133585", "0.51236475", "0.51020104", "0.50978017", "0.5095993", "0.5059783", "0.50...
0.6246182
0
Writes linac phasing lines to a Bmad file. Requires epics (or proxy object).
def write_bmad_linac_phasing_lines(filePath='linac_settings.bmad', epics=None, verbose=False): lines = bmad_linac_phasing_lines(epics) with open(filePath, 'w') as f: for l in lines: f.write(l+'\n') if verbose: print('Written:', filePath)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_tao_BC_and_LEM_lines(filePath='LEM_settings.tao', epics=None, verbose=False):\n lines = tao_BC_and_LEM_lines(epics)\n with open(filePath, 'w') as f:\n for l in lines:\n f.write(l+'\\n')\n if verbose:\n print('Written:', filePath)\n\n \n \n return lines",...
[ "0.6657263", "0.6484899", "0.5828503", "0.5651945", "0.5593861", "0.5564902", "0.54197687", "0.5337634", "0.5288988", "0.5269306", "0.52646947", "0.52209884", "0.5204748", "0.51610637", "0.5106298", "0.5046272", "0.5036513", "0.5005771", "0.49783012", "0.49764898", "0.4970320...
0.7545118
0
Writes tao LEM lines to a .tao file. Requires epics (or proxy object).
def write_tao_BC_and_LEM_lines(filePath='LEM_settings.tao', epics=None, verbose=False): lines = tao_BC_and_LEM_lines(epics) with open(filePath, 'w') as f: for l in lines: f.write(l+'\n') if verbose: print('Written:', filePath) return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_tep_file_lines(otu_table_data, mapping_lines, tree_lines,\r\n prefs_dict):\r\n\r\n # write tree file lines\r\n lines = ['>>tre\\n']\r\n lines += [tree_lines.read()]\r\n lines += '\\n'\r\n\r\n # get otu table data\r\n if(otu_table_data.ObservationMetadata):\r\n ...
[ "0.5752286", "0.5749262", "0.5700694", "0.5613532", "0.5605334", "0.556102", "0.54216707", "0.5421532", "0.5405027", "0.53978723", "0.53960645", "0.53954494", "0.5390986", "0.5312852", "0.5277949", "0.5253673", "0.5245013", "0.5244172", "0.52176124", "0.5176581", "0.5172888",...
0.7485731
0
Method to get the credentials from ~/.mofplusrc
def credentials_from_rc(self): mprc_filename = os.environ["HOME"]+'/.mofplusrc' with open(mprc_filename, 'r') as mprc: username = mprc.readline().split()[0] pw = mprc.readline().split()[0] return username, pw
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_credentials():\n #home_dir = os.path.expanduser('~')\n home_dir = os.path.expanduser('/home/pi/')\n credential_dir = os.path.join(home_dir, '.credentials')\n if not os.path.exists(credential_dir):\n os.makedirs(credential_dir)\n credential_path = os.path.join(credential_dir, 'gmail-py...
[ "0.739547", "0.7365536", "0.73126113", "0.73126113", "0.7311609", "0.7309989", "0.7300369", "0.7288538", "0.72769576", "0.72184205", "0.71966267", "0.71909285", "0.71909285", "0.71909285", "0.71909285", "0.71909285", "0.7185963", "0.71790165", "0.71647274", "0.71396244", "0.7...
0.857187
0
Method to get the credentials from the command line
def credentials_from_cmd(self): username = raw_input("Email:") pw = getpass.getpass() return username, pw
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _config_credentials_get():\n user = input(\"username:\")\n password = getpass.getpass()\n url = input(\"url:\")\n return user, password, url", "def get_credentials(options, environment):\n if options[\"--username\"] or options[\"--auth\"]:\n if not options[\"--username\"]:\n ...
[ "0.7299473", "0.7106037", "0.6985046", "0.6973925", "0.6960516", "0.6940761", "0.6813968", "0.67990017", "0.6796827", "0.6795659", "0.6782839", "0.67600983", "0.6745715", "0.6667258", "0.6666305", "0.66566455", "0.662464", "0.66160524", "0.65844256", "0.6557866", "0.65372974"...
0.74783903
0
Prints the MFP banner
def print_banner(self): print ":##::::'##::'#######::'########:::::::::::::::'###::::'########::'####:\n\ :###::'###:'##.... ##: ##.....::::'##::::::::'## ##::: ##.... ##:. ##::\n\ :####'####: ##:::: ##: ##::::::::: ##:::::::'##:. ##:: ##:::: ##:: ##::\n\ :## ### ##: ##:::: ##: ######:::'######::::'##:::. ##: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_banner(message):\n\n print(\"#############################################################################\")\n print(message)", "def banner():\n print \"\"\" \n _____ __ \n |_ _|_ _ ___ / _| __ _ \n | |/ _` / __| |_ / _` |\n | | (_| \\__ \\ _| (_| |\n |...
[ "0.7396634", "0.73954254", "0.727118", "0.72663784", "0.7056715", "0.7042273", "0.70386666", "0.700003", "0.675228", "0.6678629", "0.651769", "0.6499614", "0.6490508", "0.6374026", "0.63351125", "0.62801325", "0.62523764", "0.623986", "0.61925286", "0.61004984", "0.59268594",...
0.76449466
0
Returns a list of all BBS in the db
def get_list_of_bbs(self): return self.mfp.get_list_of_bbs()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_bt(self):\n return list(self.collection.find({\"sensor_type\": \"bt\"}, {\"_id\": False})) # Return a list", "def get_blists(self):\n return self.blists[:]", "def get_bus_list():\n\n\tbuses = db.session.query(Bus.bus_name).all()\n\n \n\treturn buses", "def list(cls, context, filt...
[ "0.69727236", "0.67828137", "0.6740348", "0.65534073", "0.6521765", "0.63936526", "0.6312505", "0.6268653", "0.62648267", "0.62623644", "0.6186435", "0.61633617", "0.61626595", "0.6158413", "0.6122159", "0.611637", "0.610624", "0.5955863", "0.5916003", "0.58861715", "0.588525...
0.70204824
0
Gets the scaled topo file for a given id supercell id.
def get_scaledtopo(self,id): lines = self.mfp.get_scaledtopo(id) return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_to_base_id(self, id):\n if self.xy_tiling is None and self.pc_tiling is None:\n return id\n return self.get_tile_from_path(id)[1]", "def _get_feat_geo_from_file(self, id):\n path_feature, path_mask, path_geo = self._get_name_save(id)\n feature_filt_padded = torch.loa...
[ "0.5464149", "0.50709033", "0.50375205", "0.5031053", "0.48634726", "0.48348683", "0.4817579", "0.4804395", "0.47939923", "0.47609693", "0.46538952", "0.4650901", "0.46247876", "0.46213096", "0.45644408", "0.45580676", "0.4558013", "0.4542269", "0.45237747", "0.45166185", "0....
0.7465723
0
Gets the orients file for a given id supercell id.
def get_orients(self,id): lines = self.mfp.get_orients(id) return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_orientations(self):\n for atom in self.invarioms:\n atom.get_orientation()", "def orient(self):\n self._read(False)\n return self._readings.orient", "def get_orientations(self, int32 dim, codim=None):\n if codim is not None:\n dim = self.tdim - codim\n...
[ "0.5392666", "0.5238473", "0.50075924", "0.47091204", "0.46686122", "0.46168557", "0.4579395", "0.45001397", "0.44533232", "0.44359028", "0.44122255", "0.44016522", "0.439454", "0.4392099", "0.43870813", "0.43759003", "0.4370313", "0.43686095", "0.43557945", "0.43431535", "0....
0.65023
0
Retrieve the list of films in which a character appears
def getFilms(character): ret = [] for film in character.get('films'): number = int(film.rstrip('/').rpartition('/')[2]) if number not in cache: response = requests.get(film) response = response.json() title = response.get('title') cache[number] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def castFilmography (movies, minAppearances):\n actors = {}\n for (k,v) in movies.items():\n for a in v[2:7]:\n actors[a] = actors.get(a, []) + [k]\n return sorted([ [k] + v for (k,v) in actors.items() if len(v) >= minAppearances ])", "def get_cards(self):\n return [Flashcard.fr...
[ "0.59737927", "0.55234385", "0.545212", "0.54288036", "0.5389295", "0.5367945", "0.5315806", "0.53116363", "0.53098303", "0.52998656", "0.52903426", "0.5223463", "0.521527", "0.5212591", "0.5199618", "0.5162614", "0.5160674", "0.51528895", "0.5130299", "0.5123009", "0.5109176...
0.6638027
0
Registers a backward hook on the used to save the gradients of the embeddings for use in get_gradients() when there are multiple inputs (e.g., a passage and question), the hook will be called multiple times. We append all the embeddings gradients to a list.
def _register_embedding_gradient_hooks(self, embedding_gradients): def hook_layers(module, grad_in, grad_out): embedding_gradients.append(grad_out[0]) backward_hooks = [] embedding_layer = self.get_embeddings_layer() backward_hooks.append(embedding_layer.register_backward_h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _register_post_backward_hooks(self) -> None:\n if not torch.is_grad_enabled():\n return # don't register grad hooks if grad isn't enabled\n for p in self.full_params:\n if p.requires_grad:\n if hasattr(p, \"_shard_bwd_hook\"):\n continue\n # Register a hook on the first ...
[ "0.744036", "0.7207515", "0.68466437", "0.6619593", "0.6545222", "0.65270805", "0.6505459", "0.64318466", "0.6385007", "0.63628876", "0.63604456", "0.63604456", "0.62412906", "0.6231469", "0.62253386", "0.61755383", "0.609307", "0.60908824", "0.60908824", "0.60785884", "0.603...
0.8470942
0
some tokenizers don't have 'eos_token' and 'bos_token' attributes. Thus, we need some trick to get them.
def special_tokens(self, ): if self.tokenizer.bos_token is None or self.tokenizer.eos_token is None: special_tokens = self.tokenizer.build_inputs_with_special_tokens([]) special_tokens_ids = self.tokenizer.convert_ids_to_tokens(special_tokens) self.tokenizer.bos_token, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def synth_tokens(self):\n if self.lliagraph:\n return self.lliagraph.synth_tokens.items()\n else:\n return []", "def parse(self, tokenizer):\n pass", "def tokens():\n pass", "def get_tokens(self, document):\n raise NotImplementedError()", "def get_tokens...
[ "0.6021182", "0.5951054", "0.58588576", "0.5789484", "0.5745784", "0.56824887", "0.5654901", "0.5648043", "0.5638188", "0.5631488", "0.5630968", "0.56133425", "0.5593994", "0.5592292", "0.5575906", "0.55579054", "0.5544896", "0.549606", "0.54886556", "0.54866934", "0.5471206"...
0.62158376
0
Compute the euclidean distance between each word in the vocab and each word in the source.
def _pairwise_distance(self, src_embeds, vocab_embeds, squared=False): # compute square norm to avoid compute all the directions vocab_sq_norm = vocab_embeds.norm(p=2, dim=-1) ** 2 src_sq_norm = src_embeds.norm(p=2, dim=-1) ** 2 # dot product dot_product = self._pairwise_dot_pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cal_distances(embeddings):\n # calculate\n dist = np.zeros([len(embeddings), len(embeddings)], dtype=float)\n for ii in xrange(len(embeddings)):\n for jj in xrange(ii + 1, len(embeddings)):\n dist[ii, jj] = np.linalg.norm(embeddings[ii] - embeddings[jj])\n dist[jj, ii] = d...
[ "0.7123041", "0.6798625", "0.6672034", "0.64250857", "0.6401553", "0.6378859", "0.63724816", "0.6371111", "0.6301999", "0.6265582", "0.6255312", "0.62346095", "0.62243164", "0.62200135", "0.62105745", "0.6194787", "0.6186329", "0.6180648", "0.6174867", "0.61723065", "0.617060...
0.747233
0
If TASK_USE_PATH is set rely on PATH to look for task binaries. Otherwise ../src/ is used by default.
def task_binary_location(cmd="task"): return binary_location(cmd, TASK_USE_PATH)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_task_dir(self):\n return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tasks')", "def test_taskmod_no_taskfile(modpath):\n sys.meta_path.append(TaskImporter())\n task = import_module(modpath)\n assert modpath in sys.modules\n assert sys.modules[modpath] is task\n assert...
[ "0.6477157", "0.57612556", "0.5689633", "0.56765836", "0.55889344", "0.55805033", "0.55210114", "0.5507863", "0.5440326", "0.5436243", "0.54087734", "0.5403501", "0.5345792", "0.5335856", "0.53229564", "0.5279437", "0.5270501", "0.5263024", "0.5223266", "0.52160585", "0.51700...
0.71928936
0
If USE_PATH is True rely on PATH to look for binaries. Otherwise ../src/ is used by default.
def binary_location(cmd, USE_PATH=False): if USE_PATH: return cmd else: return os.path.join(BIN_PREFIX, cmd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linkpath(srcdir, pkg):\n home = os.getenv('HOME')\n if srcdir:\n rval = '{}/{}'.format(srcdir, pkg)\n else:\n rval = '{}/bin/{}'.format(home, pkg)\n return rval", "def binary_location(cmd, USE_PATH=False):\n return os.path.join(BIN_PREFIX, cmd)", "def set_path():\n impor...
[ "0.64583826", "0.6119704", "0.60500836", "0.5732794", "0.5658576", "0.56554246", "0.5512849", "0.5505444", "0.54935056", "0.5483672", "0.5481498", "0.5455168", "0.5439266", "0.5433778", "0.54287785", "0.5424196", "0.5423426", "0.5394256", "0.53781176", "0.5329684", "0.5325822...
0.6302872
1
Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path.
def which(cmd, mode=os.F_OK | os.X_OK, path=None): # Check that a given file can be accessed with the correct mode. # Additionally check that `file` is not a directory, as on Windows # directories pass the os.access check. def _access_check(fn, mode): return (os.path.exists(f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def which(cmd, mode=os.F_OK | os.X_OK, path=None):\n # Check that a given file can be accessed with the correct mode.\n # Additionally check that `file` is not a directory, as on Windows\n # directories pass the os.access check.\n def _access_check(fn, mode):\n ...
[ "0.77106726", "0.7453694", "0.727641", "0.6943331", "0.6540709", "0.639578", "0.60801244", "0.59047854", "0.5880955", "0.5878199", "0.57527226", "0.5732597", "0.5709009", "0.5672643", "0.5576627", "0.5575957", "0.55535084", "0.5497285", "0.5452454", "0.5445605", "0.5425212", ...
0.7460819
1
Helper function to compute value for fields debit/credit/amount_currency based on an amount and the currencies given in parameter
def compute_amount_fields(self, amount, src_currency, company_currency, invoice_currency=False): amount_currency = False currency_id = False if src_currency and src_currency != company_currency: amount_currency = amount amount = src_currency.with_context(self._context).co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_amount_fields(self, amount, src_currency, company_currency):\n amount_currency = False\n currency_id = False\n date = self.env.context.get('date') or fields.Date.today()\n company = self.env.context.get('company_id')\n company = self.env['res.company'].browse(company...
[ "0.76655096", "0.6802662", "0.67237234", "0.6577972", "0.65410954", "0.6217159", "0.620707", "0.61840576", "0.59770834", "0.59099656", "0.5873708", "0.5872332", "0.58294046", "0.58154744", "0.578612", "0.57646793", "0.5753153", "0.57461447", "0.57427317", "0.57381535", "0.572...
0.71101564
1
1. Create a bucket with no max_ttl 2. Upload 1000 docs with exp = 100s 3. Set maxTTL on bucket as 60s 4. After 60s, run expiry pager, get item count, must be 1000 5. After 40s, run expiry pager again and get item count, must be 0 6. Now load another set of docs with exp = 100s 7. Run expiry pager after 60s and get item...
def test_set_maxttl_on_existing_bucket(self): for bucket in self.buckets: self._load_json(bucket, self.num_items, exp=100) self._update_bucket_maxTTL(maxttl=60) self.sleep(60, "waiting before running expiry pager...") self.expire_pager(self.servers) self.sleep(20, "w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_maxttl_lesser_doc_expiry(self):\n for bucket in self.buckets:\n self._load_json(bucket, self.num_items, exp=int(self.maxttl)+500)\n self.sleep(int(self.maxttl), \"waiting for all docs to expire per maxTTL rule...\")\n self.expire_pager(self.servers)\n self.sleep(20, ...
[ "0.74554807", "0.73381984", "0.73129797", "0.7263034", "0.69875336", "0.6090414", "0.56455797", "0.5475571", "0.5398008", "0.53416365", "0.53413856", "0.5322587", "0.53129023", "0.5301066", "0.5245236", "0.522405", "0.52154046", "0.5207431", "0.5185581", "0.5156831", "0.51409...
0.7790331
0
1. Create a bucket with ttl = 60s 2. Upload 1000 docs with exp = 40s 3. After 20s, Update docs with exp = 60s 4. After 40s, run expiry pager again and get item count, must be 1000 5. After 20s, run expiry pager again and get item count, must be 0
def test_maxttl_with_doc_updates(self): rest = RestConnection(self.master) for bucket in self.buckets: self._load_json(bucket, self.num_items, exp=40) self.sleep(20, "waiting to update docs with exp=60s...") for bucket in self.buckets: self._load_json(bucket, se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_maxttl_on_existing_bucket(self):\n for bucket in self.buckets:\n self._load_json(bucket, self.num_items, exp=100)\n self._update_bucket_maxTTL(maxttl=60)\n\n self.sleep(60, \"waiting before running expiry pager...\")\n self.expire_pager(self.servers)\n sel...
[ "0.70659494", "0.6699331", "0.6606719", "0.65539116", "0.58606344", "0.5722448", "0.5579716", "0.5559856", "0.5538106", "0.5445731", "0.5444631", "0.54434264", "0.54030365", "0.5382592", "0.53746575", "0.53511035", "0.53469026", "0.53101665", "0.5309392", "0.5298697", "0.5277...
0.71103334
0
Use active_ids from the context to fetch the leads
def default_get(self, cr, uid, fields, context=None): if context is None: context = {} record_ids = context.get('active_ids', False) res = super(crm_lead_stage, self).default_get(cr, uid, fields, context=context) if record_ids: opp_ids = [] opps = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queryset(self, request):\n qs = super(AdRepLeadAdmin, self).queryset(request)\n qs = AdRepLead.objects.select_related().filter(id__in=qs\n ).defer('site__envelope',\n 'site__geom',\n 'site__point')\n return qs", "def get_locations_by_ids(self, id_...
[ "0.6057764", "0.52192557", "0.5219104", "0.50897825", "0.5034502", "0.5022137", "0.4999737", "0.49886566", "0.49597502", "0.4957497", "0.49499336", "0.49414816", "0.49347013", "0.489892", "0.4863161", "0.48234197", "0.4823024", "0.48136124", "0.481186", "0.47834936", "0.47805...
0.69877815
0
Use lead_ids from the wizard and set to new stage
def action_multi_lead_stage(self, cr, uid, ids, context=None): if context is None: context = {} wizard = self.browse(cr, uid, ids[0], context=context) lead_ids = wizard.lead_ids if lead_ids: for lead in lead_ids: self.pool.get('crm.lead').write(cr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _onchange_stage_id_values(self, stage_id):\n if not stage_id:\n return {}\n print('1111')\n\n call_attempt = len(self.env['call.attempt'].browse(self.call_attempt_ids))\n call_pitch = len(self.env['call.pitch'].browse(self.call_pitch_ids))\n contact_meeting = len(...
[ "0.58470714", "0.55518115", "0.5546699", "0.5379987", "0.53570205", "0.5289893", "0.5229131", "0.5181128", "0.5130612", "0.5128466", "0.50979745", "0.5055515", "0.505321", "0.50443345", "0.50421935", "0.50367343", "0.503288", "0.49982783", "0.497238", "0.49644795", "0.4961761...
0.64389664
0
A view to add a new portfolio project
def add_project(request): if not request.user.is_superuser: messages.error(request, 'Sorry, only store owners can do that.') return redirect(reverse('home')) if request.method == 'POST': form = ProjectForm(request.POST, request.FILES) if form.is_valid(): project = fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_project():\n if request.method == \"POST\":\n result = add_project_to_db(\n request.form[\"title\"],\n request.form[\"link\"],\n request.form[\"description\"]\n )\n flash(result)\n return redirect(url_for(\"portfolio\"))\n else:\n re...
[ "0.7893704", "0.7302018", "0.7279046", "0.7119255", "0.70725876", "0.7025085", "0.6988927", "0.6972085", "0.6608903", "0.65972", "0.659065", "0.6497519", "0.64028376", "0.6389602", "0.6371995", "0.63446647", "0.6344435", "0.6330495", "0.63034815", "0.6294346", "0.6290368", ...
0.7959094
0
A view to edit a portfolio project
def edit_project(request, project_id): if not request.user.is_superuser: messages.error(request, 'Sorry, only store owners can do that.') return redirect(reverse('home')) project = get_object_or_404(Project, pk=project_id) if request.method == 'POST': form = ProjectForm(request.POST...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_project(project_id):\n \n if 'username' in session: \n project = mongo.db.projects.find_one_or_404(\n {'_id': ObjectId(project_id)})\n form=ProjectForm()\n form.title.data = project['title']\n form.status.data = project['status']\n form.deadline.data = p...
[ "0.7728187", "0.73595434", "0.7352115", "0.7184356", "0.703075", "0.67557067", "0.6421052", "0.6396073", "0.6380097", "0.6355604", "0.6334676", "0.63148147", "0.62868273", "0.6275144", "0.6263248", "0.62387496", "0.61801016", "0.6175357", "0.61719286", "0.61687547", "0.616029...
0.7640755
1
A view to delete a project from the portfolio
def delete_project(request, project_id): if not request.user.is_superuser: messages.error(request, 'Sorry, only store owners can do that.') return redirect(reverse('home')) project = get_object_or_404(Project, pk=project_id) project.delete() messages.success(request, 'Project deleted!')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_project(id):\n result = delete_project_to_db(id)\n flash(result)\n return redirect(url_for(\"portfolio\"))", "def delete_project_view(request, id):\n\n # retrieve the project to be deleted through his id. Raise an error if the project does not exist\n project = get_object_or_404(Projet,...
[ "0.78291446", "0.77674896", "0.7705836", "0.7590049", "0.757986", "0.7458269", "0.7449735", "0.7428579", "0.7415701", "0.725367", "0.72272354", "0.71767354", "0.7172579", "0.6984525", "0.69331306", "0.69194317", "0.6911854", "0.6911854", "0.6897094", "0.6887393", "0.68611", ...
0.8196082
0
Find a single database
def find_database(self, name_or_id, instance, ignore_missing=True): instance = self._get_resource(_instance.Instance, instance) return self._find( _database.Database, name_or_id, instance_id=instance.id, ignore_missing=ignore_missing, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_database(self, name):\n try:\n return [db for db in self.list_databases()\n if db.name == name][0]\n except IndexError:\n raise exc.NoSuchDatabase(\"No database by the name '%s' exists.\" %\n name)", "def searchDatabase(self, name:...
[ "0.7311903", "0.6849391", "0.6839373", "0.6820903", "0.6808621", "0.67496127", "0.67408377", "0.6706965", "0.6702317", "0.6701318", "0.66828966", "0.6620947", "0.65982574", "0.6543755", "0.6513072", "0.6468301", "0.64516336", "0.6444562", "0.640927", "0.6397873", "0.63197", ...
0.7636754
0