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
sm.switch_to_inventory_screen( Player ) > None Switch to the screen that shows the player's inventory.
def switch_to_inventory_screen(self, player): controls = InventoryControls(player) control_manager = ControlManager(controls) inventory_screen = InventoryScreen(control_manager, player) self.set_current_screen(inventory_screen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_to_main_screen(self, player):\n\t\tgame_controls = MainGameControls(player) \n\t\tcontrol_manager = ControlManager(game_controls)\n\t\tmain_screen = MainGameScreen(control_manager, player) \n\t\tself.set_current_screen(main_screen)\n\t\tlevel = player.current_level\n\t\tlevel.initialize_screen(self, mai...
[ "0.64634305", "0.6273676", "0.6271684", "0.6219078", "0.60013694", "0.59771556", "0.58469236", "0.58171755", "0.5801152", "0.570933", "0.56978893", "0.56751794", "0.56361794", "0.56335664", "0.5614384", "0.5570409", "0.5564861", "0.5547478", "0.551773", "0.54825133", "0.54740...
0.88683665
0
sm.switch_to_main_screen( Player ) > None Switch to the main screen and controls used to play the game.
def switch_to_main_screen(self, player): game_controls = MainGameControls(player) control_manager = ControlManager(game_controls) main_screen = MainGameScreen(control_manager, player) self.set_current_screen(main_screen) level = player.current_level level.initialize_screen(self, main_screen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_to_map_screen(self, player):\n\t\tcontrols = MapControls(player)\t\n\t\tcontrol_manager = ControlManager(controls)\n\t\tmap_screen = MapScreen(control_manager, player)\n\t\tself.set_current_screen(map_screen)", "def switch_to_controls_screen(self, player):\n\t\tcontrols = SelectControls(player) #it's ...
[ "0.7123995", "0.6914388", "0.6594872", "0.65694225", "0.6549772", "0.6537109", "0.6394545", "0.63805693", "0.63514936", "0.63447434", "0.62642086", "0.6261911", "0.6221808", "0.61514926", "0.6143725", "0.61304927", "0.6125064", "0.6125027", "0.608913", "0.60604423", "0.604862...
0.85429454
0
sm.switch_to_pause_screen( Player, int ) > None Switch to the pause screen.
def switch_to_pause_screen(self, player, option_index = 0): controls = SelectControls(player) control_manager = ControlManager(controls) pause_screen = PauseScreen(control_manager, player) pause_screen.option_index = option_index self.set_current_screen(pause_screen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _control_pause(self):\n self.player.pause()", "def pause(self):\n if self.status()['state'] == \"playing\":\n self.toggle_pause()", "def on_pause(self):\r\n store = get_store()\r\n store.put(\"pause\", value=self.sm.current)\r\n return True", "def pause(self):\n ...
[ "0.71362215", "0.69896823", "0.6802045", "0.67825705", "0.67774963", "0.6755518", "0.6729764", "0.6722736", "0.66689175", "0.6615195", "0.65942234", "0.6560229", "0.65601045", "0.6542824", "0.6514942", "0.6514942", "0.64799964", "0.6455462", "0.64503354", "0.64377046", "0.642...
0.7581528
0
sm.switch_to_options_screen( Player, int ) > None Switch to the options screen.
def switch_to_options_screen(self, player, option_index = 0): controls = SelectControls(player) control_manager = ControlManager(controls) options_screen = OptionsScreen(control_manager, player) options_screen.option_index = option_index self.set_current_screen(options_screen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_to_pause_screen(self, player, option_index = 0):\n\t\tcontrols = SelectControls(player)\n\t\tcontrol_manager = ControlManager(controls)\n\t\tpause_screen = PauseScreen(control_manager, player)\n\t\tpause_screen.option_index = option_index\n\t\tself.set_current_screen(pause_screen)", "def menuItem(*arg...
[ "0.6730214", "0.62495255", "0.61791104", "0.6058868", "0.6027978", "0.59457606", "0.5894651", "0.58364964", "0.58039665", "0.57862574", "0.57804334", "0.5777375", "0.57702494", "0.573896", "0.56453055", "0.5624709", "0.5621473", "0.5578143", "0.5562552", "0.5534204", "0.55331...
0.82930005
0
sm.switch_to_controls_screen( Player ) > None Switch to the controls screen.
def switch_to_controls_screen(self, player): controls = SelectControls(player) #it's possible these should be ControlsControls but I'm not sure control_manager = ControlManager(controls) controls_screen = ControlsScreen(control_manager, player) self.set_current_screen(controls_screen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_controls(self, controls):\n\t\tself.current_screen.control_manager.switch_controls(controls)", "def switch_to_main_screen(self, player):\n\t\tgame_controls = MainGameControls(player) \n\t\tcontrol_manager = ControlManager(game_controls)\n\t\tmain_screen = MainGameScreen(control_manager, player) \n\t\tsel...
[ "0.7564581", "0.68381226", "0.6703973", "0.6130569", "0.6116293", "0.6070453", "0.59564304", "0.59301823", "0.5872481", "0.5855667", "0.5775047", "0.57607913", "0.5758848", "0.5725688", "0.5711078", "0.57085264", "0.56852585", "0.5669835", "0.56557494", "0.565482", "0.5654238...
0.8537738
0
sm.switch_to_map_screen( Player ) > None Switch to the map screen, which shows the map of the dungeon.
def switch_to_map_screen(self, player): controls = MapControls(player) control_manager = ControlManager(controls) map_screen = MapScreen(control_manager, player) self.set_current_screen(map_screen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_to_main_screen(self, player):\n\t\tgame_controls = MainGameControls(player) \n\t\tcontrol_manager = ControlManager(game_controls)\n\t\tmain_screen = MainGameScreen(control_manager, player) \n\t\tself.set_current_screen(main_screen)\n\t\tlevel = player.current_level\n\t\tlevel.initialize_screen(self, mai...
[ "0.6935042", "0.6606174", "0.6344685", "0.61975795", "0.6185808", "0.60952806", "0.6039775", "0.5944378", "0.57905304", "0.57626915", "0.5759907", "0.5753077", "0.57385784", "0.5716662", "0.5705685", "0.5685458", "0.56769073", "0.5675624", "0.56681806", "0.56645626", "0.56607...
0.85616004
0
records the process' stdout, and mirrors it to printer() also sends notifications to expect() every time the process prints something
async def copier_recorder( self, ) -> None: if not self.process: raise Exception("missing process; was this called inside a with statement?") assert ( self.process.stdout is not None ), "process must be opened with stdout=PIPE and stderr=STDOUT" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def p(self):\n self.printstdout = True", "def stdout(self):\n pass", "def recordStdout(self, test, output):\n if output:\n test = proto_test(test)\n self.stdout_output[test] = output", "def test_capture_stdout():\n\n sys.stdout.write('Print to stdout')\n\n ass...
[ "0.69433224", "0.66237116", "0.6514507", "0.6475319", "0.639453", "0.63673043", "0.62972444", "0.6291127", "0.62444556", "0.6243675", "0.6204711", "0.6142155", "0.61351883", "0.61311245", "0.6110124", "0.6051763", "0.6048479", "0.6021171", "0.601853", "0.6017534", "0.60169894...
0.7195058
0
called inside Expect.open_process()'s with block to watch for, and respond to, the process' output
async def expect( self, watch_for: bytes, respond_with: bytes, ) -> None: if not self.process: raise Exception("missing process; was this called inside a with statement?") assert self.process.stdin is not None, "process must be opened with stdin=PIPE" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _watch(self):\n # self._popen.wait()\n lines_iterator = iter(self._popen.stdout.readline, b\"\")\n for line in lines_iterator:\n line = line.strip()\n # log.log(\"raw\",self.name.upper()+\" SAYS: \"+line)\n # cmd = line.split(' ')[0]\n # args = l...
[ "0.6893567", "0.635296", "0.6161517", "0.61614776", "0.6094712", "0.6090435", "0.6078294", "0.6044824", "0.59788316", "0.59758073", "0.5974508", "0.589139", "0.58566386", "0.58559567", "0.5841501", "0.58339465", "0.5828488", "0.58272123", "0.58119315", "0.5789253", "0.5786038...
0.66562706
1
entry point for using Expect() opens the process, opens a nursery, and starts the copier and printer this waits until the process is finished, so wrapping in a trio.move_on_after() is good to use as a timeout
async def open_process( cls, args: "Union[str, List[str]]", env_additions: Dict[str, str] = {} ) -> "AsyncIterator[Expect]": printer_channels: ( "Tuple[MemorySendChannel[bytes], MemoryReceiveChannel[bytes]]" ) = trio.open_memory_channel(1) printer_send_channel, prin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def copier_recorder(\r\n self,\r\n ) -> None:\r\n if not self.process:\r\n raise Exception(\"missing process; was this called inside a with statement?\")\r\n\r\n assert (\r\n self.process.stdout is not None\r\n ), \"process must be opened with stdout=PIPE ...
[ "0.64751184", "0.5897651", "0.5676574", "0.5508459", "0.545397", "0.5420132", "0.53737104", "0.53681916", "0.5293841", "0.52855873", "0.5258866", "0.5244162", "0.5243855", "0.51989394", "0.5178653", "0.51774675", "0.51618993", "0.5149624", "0.5136166", "0.5124906", "0.5112868...
0.6308156
1
Decode the MAC id into its secret key and dict of user data. This method determines the appropriate secrets to use for the given request, then passes them on to tokenlib to handle the given MAC id token. If the id is invalid then ValueError will be raised.
def decode_mac_id(self, request, id): # There might be multiple secrets in use, if we're in the # process of transitioning from one to another. Try each # until we find one that works. secrets = self._get_token_secrets(request) for secret in secrets: try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_mac_id(self, request, data):\n # There might be multiple secrets in use, if we're in the\n # process of transitioning from one to another. Always use\n # the last one aka the \"most recent\" secret.\n secret = self._get_token_secrets(request)[-1]\n id = tokenlib.make_...
[ "0.6306681", "0.59789425", "0.5404001", "0.5105666", "0.5096396", "0.49669686", "0.4946843", "0.49333444", "0.49108118", "0.48995563", "0.48961958", "0.48898953", "0.4865401", "0.48090643", "0.47976416", "0.4774524", "0.47649956", "0.47551236", "0.47547558", "0.47494033", "0....
0.86085194
0
Encode the given data into a MAC id and secret key. This method is essentially the reverse of decode_mac_id. It is not needed for consuming authentication tokens, but is very useful when building them for testing purposes.
def encode_mac_id(self, request, data): # There might be multiple secrets in use, if we're in the # process of transitioning from one to another. Always use # the last one aka the "most recent" secret. secret = self._get_token_secrets(request)[-1] id = tokenlib.make_token(data, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(data):\n return jwt.encode(data, app.config[\"JWT_SECRET\"], algorithm=\"HS256\")", "def encode_data( key, data ):\n text = json.to_json_string(data)\n text = base64.urlsafe_b64encode(text)\n digest = hmac.new(key, text).hexdigest()\n return text, digest", "def encode_data ( data ) :\...
[ "0.65729743", "0.6477474", "0.63190126", "0.6246156", "0.6077392", "0.6076765", "0.6068203", "0.60285556", "0.5998416", "0.59641296", "0.59568846", "0.59378546", "0.59241724", "0.5883068", "0.5849018", "0.5791341", "0.5779783", "0.57713497", "0.5768582", "0.5758279", "0.57444...
0.78949237
0
Configure default settings for authentication via repoze.who. This function takes a Configurator object using pyramid_whoauth and applies some default settings to authenticate against the configured
def configure_who_defaults(config): settings = config.registry.settings BACKENDAUTH_DEFAULTS = { "use": "mozsvc.user.whoauth:BackendAuthPlugin" } for key, value in BACKENDAUTH_DEFAULTS.iteritems(): settings.setdefault("who.plugin.backend." + key, value) BASICAUTH_DEFAULTS = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def override_config(self):\n super(AuthedConfigFixture, self).override_config()\n self.conf.register_opts(auth_token._OPTS, group='keystone_authtoken')\n self.conf.set_override('auth_uri', 'http://127.0.0.1:35357',\n group='keystone_authtoken')", "def configure(...
[ "0.611183", "0.5886548", "0.58626604", "0.58358026", "0.58212817", "0.57717496", "0.5766594", "0.5711159", "0.56514066", "0.5586578", "0.5513173", "0.55019933", "0.5489197", "0.5430259", "0.5411521", "0.5408786", "0.5388371", "0.5372472", "0.5330695", "0.53220963", "0.530182"...
0.783748
0
requires a base BeatifulSoup object(with url) quick and dirty function to find get the locations of all the table rows and their labels
def getLocations(soup): results = [] trows = soup('table')[1].find_all('th') if len(trows) < 2: return { 'error': 'RSID not found.' } for header in trows: cleanText = header.get_text().split('\n')[0].replace(u'\xa0', ' ') results.append(cleanText) return results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_table_data(url):\n html = requests.get(url).text\n soup = BeautifulSoup(html, 'html.parser')\n\n return soup.select('table.wikitable.sortable td')", "def _get_all_table_elements(self):\n for row in self.driver.find_elements_by_css_selector(\"table\"):\n cells = row.find_elem...
[ "0.58071375", "0.56885123", "0.56474054", "0.5632876", "0.56057495", "0.55565584", "0.55060476", "0.5494698", "0.5440666", "0.54327387", "0.5430285", "0.54298013", "0.54229677", "0.54215246", "0.536738", "0.5365535", "0.5326492", "0.5309481", "0.52792054", "0.5235529", "0.522...
0.6199615
0
requires the locations array from getLocations and a base BeatifulSoup object(with url) pull genotype info based on
def getData(locations, soup): chromeIndex = locations.index('On chromosome') positionIndex = locations.index('Chromosome position') if 'Summary' in locations: traitIndex = locations.index('Summary') else: traitIndex = locations.index('Trait') tvalues = soup('table')[1].find_all('td') chromosome = t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_locations(self):", "def scrape(self):\n locations = (\n 'Half Moon Bay, California',\n 'Huntington Beach, California',\n 'Providence, Rhode Island',\n 'Wrightsville Beach, North Carolina',\n )\n for location in locations:\n t...
[ "0.6033522", "0.58137316", "0.5806711", "0.5802426", "0.5778916", "0.5765181", "0.5692142", "0.5669948", "0.5635593", "0.5610937", "0.5575889", "0.5544411", "0.54968655", "0.54967827", "0.5461645", "0.5421026", "0.53909546", "0.53829795", "0.53754264", "0.5363434", "0.5351777...
0.62877864
0
requires an rsid string grabs information on an rsid, including location on the chromosome and general traits
def genotype(rsid): if rsid[0] == 'I' or rsid[0] == 'i': return { 'error': 'Cannot find indicators, must use rs #s'} soup = BeautifulSoup(urllib.urlopen('http://snpedia.com/index.php/Special:Browse/' + rsid).read()) trows = soup('table')[1].find_all('tr') if len(trows) < 2: return { 'error': 'That rsid ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snp(rsid, pair):\n if rsid[0] == 'I' or rsid[0] == 'i':\n return { 'error': 'Cannot find indicators, must use rs #s'}\n formatPair = '(' + pair[0].upper() + ';' + pair[1].upper() + ')'\n soup = BeautifulSoup(urllib.urlopen('http://snpedia.com/index.php/Special:Browse/' + rsid + formatPair).read())\n tro...
[ "0.6020312", "0.5729896", "0.5613583", "0.55200934", "0.544597", "0.54059535", "0.5400022", "0.53320444", "0.529975", "0.52912897", "0.5228526", "0.5212718", "0.51964265", "0.51533043", "0.5118733", "0.51020473", "0.51014686", "0.50771385", "0.5062394", "0.5050685", "0.501409...
0.6361565
0
requires rsid and pair string grabs specific information for an snp with the supplied base pair
def snp(rsid, pair): if rsid[0] == 'I' or rsid[0] == 'i': return { 'error': 'Cannot find indicators, must use rs #s'} formatPair = '(' + pair[0].upper() + ';' + pair[1].upper() + ')' soup = BeautifulSoup(urllib.urlopen('http://snpedia.com/index.php/Special:Browse/' + rsid + formatPair).read()) trows = soup(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_residues(residue_lines, num_base, unpaired_symbol):\n #create dictionary/list for sequence and structure\n seq_dict = {}\n pairs = Pairs()\n \n for line in residue_lines:\n try:\n pos, res, partner = line.strip().split()\n if partner == unpaired_symbol:\n ...
[ "0.58397174", "0.5677145", "0.56566423", "0.5590437", "0.54537094", "0.5338764", "0.5328346", "0.52056235", "0.51183796", "0.509115", "0.5073856", "0.50591356", "0.5035103", "0.50183314", "0.50072396", "0.49996942", "0.49929804", "0.49367175", "0.49339432", "0.49140477", "0.4...
0.77497166
0
Register a method as a commandline command.
def register_command(*parse_args, **options): def wrapper(function): function._is_command = True return function return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_command(self, func):\n self.commands[func.__name__] = func", "def register_command(func):\n supported_commands.append(func.__name__)\n return func", "def register_command(name):\n\n def register(cmd):\n Facade().register_command(name, cmd)\n return cmd\n\n return regis...
[ "0.7287412", "0.70827043", "0.6883873", "0.68048596", "0.6720443", "0.652147", "0.6434535", "0.6412081", "0.63525", "0.6343418", "0.6340304", "0.63335174", "0.63176996", "0.62776923", "0.6190015", "0.61876416", "0.60993254", "0.605289", "0.6041694", "0.60172635", "0.6003911",...
0.7089312
1
Combine mappings. Doesn't account for nested behavior
def _combine(mappings): return {k: v for d in mappings for k, v in d.items()}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_grouped_mappings(mappings):\n for mapping_group, mapping_value in mappings.items():\n yield mapping_group, mapping_value", "def applyMapping(self):\n pass", "def base_mappings():\n return {\n 'from_1': {\n 'to_1': {\n 'mol_1': ({}, {}, []),\n ...
[ "0.661181", "0.6328049", "0.6321509", "0.62318003", "0.61914116", "0.6159541", "0.60639894", "0.6036065", "0.6005682", "0.59298986", "0.5924181", "0.58300185", "0.57859355", "0.5776432", "0.5772229", "0.5718653", "0.56485593", "0.5647454", "0.56471425", "0.5627609", "0.561664...
0.7307693
0
this functions saves the given ner model to disk
def save_model(model): model.to_disk("../model/custom_ner_model")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model(self, filename):\r\n pass", "def save_model(model, model_filepath):", "def save(self, filename):\n # serialize model to JSON\n model_json = self._model.to_json()\n with open('models/' + filename + \".json\", \"w\") as json_file:\n json_file.write(model_json)\n\...
[ "0.80013174", "0.77971", "0.7643269", "0.7570532", "0.74596953", "0.745236", "0.7419486", "0.74149394", "0.7414421", "0.7382577", "0.7343501", "0.733634", "0.73324853", "0.7302704", "0.7291734", "0.7289856", "0.72730064", "0.7269464", "0.72602487", "0.72524583", "0.72361463",...
0.8151001
0
Its quick test for NER model
def test_model(): test_text = "what is the price of jug?" model = spacy.load("../model/custom_ner_model") doc = model(test_text) for ent in doc.ents: print(ent.text, ent.start_char, ent.end_char, ent.label_)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_text_classifier_tsne_post(self):\n pass", "def test_text_classifier_tsne_get(self):\n pass", "def test_training(self):\n\t\tpass", "def test_predictor():", "def testModel( self, classTest, classPred):", "def test_text_classifier_train(self):\n pass", "def test_text_classif...
[ "0.70061576", "0.6998748", "0.6836437", "0.66991", "0.6623562", "0.66213065", "0.6567299", "0.64865595", "0.6477052", "0.64654297", "0.64425236", "0.6432524", "0.64059114", "0.63982147", "0.63814056", "0.637357", "0.6368368", "0.62886184", "0.6278617", "0.62494415", "0.623303...
0.72427666
0
This function converts the raw training data into Spacy compatible format
def convert_data(data): training_data = [] for record in data: entities = record.get('entities') converted_entities = [] for entity in entities: converted_entities.append((entity.get('start_offset'), entity.get('end_offset'), entity.get(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_txt_to_data():\n pass", "def dataset_to_spacy(db, entity_label):\n\n train_data = []\n try:\n #anyone missing context ??\n for word in db[entity_label]:\n if not db[entity_label][word]['context']:\n continue\n\n for contexted_example in db[e...
[ "0.6425836", "0.6341156", "0.6311406", "0.6212256", "0.6147413", "0.59966147", "0.59514046", "0.58848405", "0.5819447", "0.57941335", "0.57581407", "0.5725047", "0.5709087", "0.5708217", "0.56957257", "0.56899726", "0.5668787", "0.5658668", "0.56583214", "0.56546795", "0.5646...
0.6854838
0
Process the raw extra analyzer arguments and get the configuration data ('config=' argument for Clang tidy) for the checkers. Clang tidy accepts YAML or JSON formatted config, right now parsing only the JSON format is supported. Return a list of tuples (checker_name, key, key_value) list {
def get_checker_configs(self): LOG.debug("Tidy extra args: %s", self.analyzer_extra_arguments) res = [] # Get config from the extra arguments if there is any. try: tidy_config_parser = argparse.ArgumentParser() tidy_config_parser.add_argument('-config', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_argparser_ctor_args():\n\n data_files_dir_path = analyzer_context.get_context().data_files_dir_path\n config_dir_path = os.path.join(data_files_dir_path, 'config')\n return {\n 'prog': 'CodeChecker checkers',\n 'formatter_class': arg.RawDescriptionDefaultHelpFormatter,\n\n # D...
[ "0.58510005", "0.5673094", "0.5584141", "0.54683214", "0.5343645", "0.53239715", "0.53210807", "0.531819", "0.53140235", "0.52520937", "0.52277946", "0.51565677", "0.5124926", "0.5072389", "0.50582355", "0.5057732", "0.50245965", "0.501419", "0.49949142", "0.4971109", "0.4954...
0.8230889
0
Enable checker, keep description if already set.
def set_checker_enabled(self, checker_name, enabled=True): if checker_name.startswith("Wno-") or checker_name.startswith("W"): self.add_checker(checker_name, enabled, None) return super(ClangTidyConfigHandler, self).set_checker_enabled(checker_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_manual_check_always(self):\n self.__manual_check = constants.ALWAYS\n return self", "def with_manual_check_never(self):\n self.__manual_check = constants.NEVER\n return self", "def enable(self) -> None:", "def enable(self):\n pass", "def with_manual_check_fallbac...
[ "0.6533409", "0.61744225", "0.5870878", "0.58587235", "0.58542645", "0.57536", "0.5728351", "0.5726762", "0.5693948", "0.56471753", "0.56385934", "0.56385934", "0.55807996", "0.55593354", "0.5540373", "0.5540373", "0.5540373", "0.5540373", "0.5540373", "0.5540373", "0.5540373...
0.65444237
0
checks answer against guess. Returns the number of turns remaining.
def check_answer(guess, answer, turns): if guess > answer: print("Too high.") return turns - 1 elif guess < answer: print("Too low.") return turns - 1 else: print(f"You got it! The answer was {answer}.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_answer(guess, answer, turns):\n if guess > answer:\n print(\"Too high.\")\n return turns - 1\n elif guess < answer:\n print(\"Too low\")\n return turns - 1\n elif guess == answer:\n print(f\"You win! The answer was {answer}\")", "def check_answer(challenge: int, answer: int) -> None:\...
[ "0.73730737", "0.6865509", "0.6764104", "0.6603427", "0.65597963", "0.65502167", "0.64586467", "0.6419408", "0.6350308", "0.6344561", "0.6225545", "0.6211757", "0.6199204", "0.61453587", "0.6120545", "0.61200005", "0.61174095", "0.6082552", "0.6057509", "0.60505146", "0.60237...
0.7439882
0
Overwrite this function to upgrade all installed modules from Trobz when upgrading the module "trobz_base"
def trobz_button_upgrade(self): _logger.info("Trobz_button_upgrade is processing.........") upgrade_ids = self.ids # check whether "trobz_base" is in the list check_trobz_base = self.search([('name', '=', 'trobz_base'), ('id', 'in', upgrade_ids)]) if check_trobz_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade(self):", "def upgrade(self):", "def __upgrade(self):", "def task_upgrade(self):\n with settings(user=self.serviceUser):\n self.update()\n run(\"~/virtualenv/bin/trac-admin {}/trac-env upgrade\".format(self.configDir))\n run(\"~/virtualenv/bin/trac-admin {}/...
[ "0.6977559", "0.6977559", "0.64064837", "0.63341933", "0.6207277", "0.59495425", "0.5895624", "0.5844718", "0.5808891", "0.5808891", "0.57749337", "0.5769647", "0.57433957", "0.5696804", "0.56626314", "0.5661794", "0.56070775", "0.55910814", "0.55653626", "0.55589175", "0.555...
0.70280623
0
GET /configservices/deployment/token Getting hdeploymentost token. UNDOCUMENTED
def get_deployment_token(self, *, fields=None, **kwargs): headers = kwargs.get('headers', {}).update({'Allow-Hidden': True}) function_endpoint = urljoin(self._baseurl, 'deployment/token') return self._call('GET', function_endpoint, headers=headers, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token():\n return os.environ.get('TOKEN', None)", "def get_mgnt_token():\n # Get the Environment variables from App Container.\n app_auth_token = os.getenv('APP_AUTHENTICATION_TOKEN')\n app_endpoint_ip = os.getenv('APPS_API_ENDPOINT_IP')\n app_endpoint_port = os.getenv('APPS_API_ENDPOINT_PORT'...
[ "0.6339434", "0.6256818", "0.6174605", "0.6160956", "0.6119337", "0.6119337", "0.6116115", "0.602007", "0.5967853", "0.59575117", "0.59099174", "0.5894355", "0.58617896", "0.58363885", "0.58152926", "0.5784539", "0.57801235", "0.5767977", "0.57344586", "0.5729474", "0.5719212...
0.73258734
0
POST /configservices/host_capabilities/report Host Capabilities report to Console. UNDOCUMENTED
def post_host_capabilities_report(self, *, hostcapabilities, fields=None, **kwargs): headers = kwargs.get('headers', {}).update({'Allow-Hidden': True}) function_endpoint = urljoin(self._baseurl, 'host_capabilities/report') return self._call('POST', function_endpoint, json=hostcapabilities, heade...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish_service_capabilities(self, context):\n self._report_driver_status(context)\n self._publish_service_capabilities(context)", "def host_report(args):\n config = Kconfig(client=args.client, debug=args.debug, region=args.region, zone=args.zone, namespace=args.namespace)\n k = config.k\...
[ "0.6167176", "0.57775915", "0.5696299", "0.5696141", "0.5691934", "0.55531347", "0.55301446", "0.5483164", "0.5462026", "0.5367697", "0.5363385", "0.53288716", "0.5315747", "0.52678", "0.5266042", "0.52219003", "0.52055794", "0.5202004", "0.52001816", "0.51478237", "0.5145936...
0.7173306
0
GET /configservices/host_capabilities/report/{task_id} Getting status of the Host Capabilities reporting task. UNDOCUMENTED
def get_host_capabilities_report_by_task_id(self, task_id, *, fields=None, **kwargs): headers = kwargs.get('headers', {}).update({'Allow-Hidden': True}) function_endpoint = urljoin(self._baseurl, 'host_capabilities/report/{task_id}'.format(task_id=task_id)) return self._call('GET', function_endp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_task_status(task_id: TaskId):", "def get_statistics(self, task):\n url = 'http://' + task['host'] + ':5051/monitor/statistics.json'\n for task_stats in requests.get(url).json():\n if task_stats['executor_id'] == task['id']:\n return task_stats['statistics']",...
[ "0.6191911", "0.60109603", "0.5790448", "0.5682539", "0.56159186", "0.56159186", "0.5606438", "0.55045754", "0.5298951", "0.5184924", "0.51757365", "0.5130478", "0.51300794", "0.51113516", "0.5064013", "0.50574356", "0.50402725", "0.5017853", "0.5017587", "0.5014052", "0.5010...
0.7242781
0
Smooths input nii file and saves the smoothed volume.
def smooth_nii(nii_file, out_file, smooth_filter='sinc', smooth_iter=40, relaxation=0.2): img = sitk.ReadImage(str(nii_file)) volume = sitk.GetArrayFromImage(img) result = smooth_img(volume, smooth_filter='sinc', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spectral_smooth(imagename, n_hanning=9):\n log_post(':: Smoothing spectral axis')\n infile = imagename + '.common'\n outfile = imagename + '.specsmooth'\n tmpfile = outfile + '.tmp'\n if_exists_remove(outfile)\n if_exists_remove(tmpfile)\n shutil.copytree(infile, tmpfile)\n for ii in ra...
[ "0.5452647", "0.5322397", "0.5283711", "0.52356684", "0.5202082", "0.5166792", "0.51259845", "0.51111835", "0.5109144", "0.5103233", "0.5074184", "0.49894753", "0.498343", "0.49134177", "0.49079514", "0.49040863", "0.48711696", "0.48482105", "0.48460883", "0.4833873", "0.4830...
0.7437305
0
Load genotype data from an IMPUTE format .gen and .smaple file. Will pick the most likely genotype call even if the probability is very low. Genotype qc should be implented elsewhere.
def load_gen_data(gen_file, sample_file): gen_data=open(gen_file, "r") sample_data=open(sample_file, "r") sample_names=[] # First two lines are headers sample_data.next() sample_data.next() for line in sample_data: sample_names.append(line.split(" ")[0]) snp_names=[]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genotype(args) :\n from genotyper import genotype_samples\n genotype_samples(args)", "def download_genotype_data():\n print(\"downloading genotype data\")\n download_from_url(PSAM_PATH, dst=f\"{GENOTYPE_DATA_PATH}/{MERGED_GENOTYPE_FILE}.psam\", desc=\"downloading psam\")\n download_from_url(PV...
[ "0.6666317", "0.6194513", "0.6170399", "0.60659444", "0.5919827", "0.56783706", "0.55997753", "0.55206794", "0.54945254", "0.5479907", "0.54732424", "0.5469204", "0.54290855", "0.54129696", "0.52782685", "0.52636784", "0.5240263", "0.52047306", "0.51788616", "0.5170012", "0.5...
0.6318814
1
Load gentotype data from a minimal test format just a matrix of 1's and 0's with postitions as row names and sample names as column names.
def load_minimal_data(test_file): genotype_data=[] test_data=None if(test_file[-3:]==".gz"): test_data=gzip.open(test_file, "r") else: test_data=open(test_file, "r") snp_pos=[] i=0 for line in test_data: if i==0: sample_names=line.split() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_test_data():\n\n # Load X_test\n with open('X_test.csv') as csvfile:\n reader = csv.DictReader(csvfile)\n feature_string_matrix = []\n for row in reader:\n feature_list = []\n for i in range(TEST_N):\n x_value = row['x' + str(i)]\n ...
[ "0.64529485", "0.6169881", "0.6116706", "0.60290146", "0.5977561", "0.5918974", "0.58822614", "0.5857118", "0.5822098", "0.57936406", "0.57836246", "0.5773886", "0.5749044", "0.5741873", "0.5728747", "0.5702308", "0.56978136", "0.5686282", "0.5677574", "0.56769615", "0.566093...
0.6657998
0
Load gentotype data from an [unpacked] eigenstrat file. file_root{.snp,.ind,.geno} Missing data coded as 9.
def load_eigenstrat_data(file_root): ind_file=open(file_root+".ind", "r") snp_file=open(file_root+".snp", "r") gen_file=open(file_root+".geno", "r") sample_names=ind_file.readlines() sample_names=[x.strip() for x in sample_names] sample_names=[x.split()[0] for x in sample_names] ind_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_grdfile(casename=None):\n \n data={} \n\n if casename==None:\n print('_load_grdfile requires a filename to load.')\n return\n try:\n fp=open(casename+'_grd.dat','r')\n except IOError:\n print('_load_grdfiles: invalid case name.')\n return data\n\n n...
[ "0.6266444", "0.61192226", "0.61024165", "0.58412886", "0.572098", "0.5643763", "0.5642764", "0.56333274", "0.56333274", "0.56300426", "0.5624132", "0.55934846", "0.55884033", "0.55812335", "0.55460817", "0.5516305", "0.54956365", "0.5438617", "0.5436836", "0.54341626", "0.54...
0.78580815
0
Load gentotype data from VCF We're not parsing the vcf properly, so can't guarantee it's not buggy. Missing data ("./.") coded as 3
def load_vcf_data(vcf_file): if(vcf_file[-3:]==".gz"): vcf_data=gzip.open(vcf_file, "r") else: vcf_data=open(vcf_file, "r") snp_names=[] snp_pos=[] genotype_data=[] missing=0 for line in vcf_data: if line[0:2] == '##': continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_vcf():\n file_content = b\"\"\"##fileformat=VCFv4.2\n##hailversion=0.2.100-2ea2615a797a\n##INFO=<ID=QUALapprox,Number=1,Type=Integer,Description=\"\">\n##INFO=<ID=SB,Number=.,Type=Integer,Description=\"\">\n##INFO=<ID=MQ,Number=1,Type=Float,Description=\"\">\n##INFO=<ID=MQRankSum,Number=1,Type=Float,...
[ "0.59556127", "0.5672099", "0.560571", "0.56024206", "0.554387", "0.5538577", "0.5538577", "0.55382437", "0.5532425", "0.546806", "0.54593027", "0.5428567", "0.5423501", "0.5422961", "0.53936416", "0.5388438", "0.53864163", "0.5382409", "0.5369776", "0.53679883", "0.536613", ...
0.68294597
0
Output phased data and quality scores.
def output_phased_data(phasing, sample_names, snp_names, options): things_to_output=[] things_to_output.append( ("la", "local_ancestry", parents_to_string)) if options.get("best_parents", None): things_to_output.append( ("bp", "best_parents", parents_to_string) ) # Output phased data for suffix,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatePhasingScore(options,phase,cycle):\n score,readcount,readseq=readDataForPhasingScoreComputation(options,phase)\n phased_loci_filename=options.output_directory_per_run+\"/\"+options.input_filename+\"_\"+str(phase)+\"_\"+str(cycle)+\".positive_phase_loci\"\n final_phase_loci=options.output_direc...
[ "0.60365117", "0.589035", "0.5888056", "0.58515924", "0.5849224", "0.5789644", "0.57057285", "0.56888366", "0.56798744", "0.5679015", "0.5673041", "0.56615686", "0.56208843", "0.5618334", "0.56133646", "0.55864084", "0.5562922", "0.5560449", "0.5515163", "0.55109346", "0.5492...
0.59698325
1
Construct a property from a ValueToken. The callable gets passed an instance of the schema class, which is ignored.
def build_property(value_token: ValueToken) -> property: def caller(_: Any) -> Any: return value_token.get_value() return property(caller)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _makeProperty( key, value ):\r\n property = PropertyValue()\r\n property.Name = key\r\n property.Value = value\r\n return property", "def set(self, identifier, value_token, *, preprocessor=None):\n try:\n value = ast.literal_eval(value_token)\n except (Syn...
[ "0.57635015", "0.5471465", "0.5451842", "0.5441951", "0.5250027", "0.51780295", "0.50807756", "0.5049718", "0.50241953", "0.5015379", "0.4997393", "0.4986425", "0.49638534", "0.49057296", "0.48959547", "0.48924682", "0.48456398", "0.48440182", "0.48053983", "0.47934765", "0.4...
0.7521704
0
Return an attributes dictionary with ValueTokens replaced by a property which returns the config value.
def build_attributes( cls, attributes: Dict[str, Any], namespace: ConfigNamespace ) -> Dict[str, Any]: config_path = attributes.get('config_path') tokens = {} def build_config_key(value_def: ValueTypeDefinition, config_key: str) -> str: key = value_def.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict(self) -> dict():\n\n dict_reg_hive = {}\n\n for _attribute in self.attributes.__dict__.items():\n if isinstance(_attribute[1], str):\n if not True in [_attribute[1].startswith(prefix) for prefix in ['<', 'providers.', 'None']]:\n ...
[ "0.5896174", "0.58638823", "0.5670991", "0.5616406", "0.5532134", "0.55320877", "0.5525463", "0.55171394", "0.54524547", "0.54442054", "0.53854984", "0.53397495", "0.5336039", "0.5264257", "0.524187", "0.52303684", "0.5176722", "0.5175959", "0.5173752", "0.51446366", "0.51283...
0.6092311
0
Load the lexical database from the specified root and language.
def __init__(self, celex_root, lang): if lang not in SUPPORTED_LANGS: raise ValueError("Language {!r} is not supported by CelexDB.".format(lang)) self.lang = lang # Language being read # Core data structures self.word_lemmas = defaultdict(set) # key: word, value: set of it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_celex(self, celex_root):\n # Form the filenames from the language\n pre = self.lang[0]\n mw_filename = os.path.join(celex_root, self.lang, pre + 'mw', pre + 'mw.cd')\n ml_filename = os.path.join(celex_root, self.lang, pre + 'ml', pre + 'ml.cd')\n\n # First pass for infl...
[ "0.5963648", "0.56420034", "0.5589397", "0.55813956", "0.54967237", "0.53983736", "0.5359596", "0.53545463", "0.5343735", "0.52360904", "0.5227337", "0.52267456", "0.5221531", "0.5197888", "0.51888394", "0.5187088", "0.51849735", "0.51790696", "0.514446", "0.51125604", "0.510...
0.6297461
0
Return a word and its analysis from a line of the MW data file
def _parse_mw(self, line): # Parse the line # pylint: disable=W0612 if self.lang == ENGLISH: # From the README: # The emw.cd file contains the following fields: # 1. IdNum # 2. Word # 3. Cob # 4. IdNumLemma ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_word(self,line):\r\n return line.split('.')", "def extract(self, line):\n\t\twords = self.tokenize(line.lower())\n\t\tcount = 0.0\n\t\tstemmer = PorterStemmer()\n\t\tbad_indices = [] \n\t\tyou_indices = [] \n\t\tfor i in range(len(words)):\n\t\t\tword = words[i] \n\t\t\tif word in self._youwords: ...
[ "0.6313585", "0.62640476", "0.61992407", "0.60100186", "0.5993294", "0.5984321", "0.59482765", "0.5903063", "0.57866055", "0.578315", "0.5778266", "0.57683325", "0.5746976", "0.56642354", "0.56642354", "0.56606746", "0.56509566", "0.5595391", "0.5593784", "0.55913246", "0.558...
0.72998255
0
Get the root from a representation of a derivation.
def _get_root(self, derivation): # Sample derivation: (((ab)[A|.A],((norm)[N],(al)[A|N.])[A])[A],(ity)[N|A.])[N] # First, remove the POS tags roots = ROOT_RE.findall(derivation) return roots
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_root(self) -> object:", "def root(tree):\n\n return tree[0]", "def get_root(self):\n return self._root", "def root(self) -> Root:\n root = self.open(Root.type).signed\n if not isinstance(root, Root):\n raise RuntimeError(\"Unexpected root type\")\n return root", ...
[ "0.64306724", "0.6170315", "0.6133247", "0.6086358", "0.60758954", "0.60679156", "0.6061395", "0.6061395", "0.59064764", "0.58677137", "0.58558124", "0.5848125", "0.5773987", "0.57573676", "0.5738989", "0.57268816", "0.5721571", "0.57182443", "0.57114804", "0.57114804", "0.57...
0.7172892
0
Verify topics_for() returns topics for passed products.
def test_topics_for_products(self): desktop_topics = topics_for(product=self.desktop) eq_(len(desktop_topics), 3) mobile_topics = topics_for(product=self.mobile) eq_(len(mobile_topics), 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_question_topics(self):\n p = ProductFactory()\n t1 = TopicFactory(slug='doesnotexist', product=p)\n t2 = TopicFactory(slug='cookies', product=p)\n t3 = TopicFactory(slug='sync', product=p)\n\n QuestionFactory(topic=t2)\n QuestionFactory(topic=t2)\n Question...
[ "0.718045", "0.6729908", "0.6481067", "0.6260218", "0.62033117", "0.6145213", "0.60260177", "0.5967279", "0.590904", "0.5870383", "0.5853882", "0.58067334", "0.58046603", "0.57973456", "0.5787146", "0.5766656", "0.57294405", "0.5719221", "0.57032686", "0.56625634", "0.5657163...
0.8327043
0
Verify documents_for() returns documents for passed topics.
def test_documents_for(self): # Test the default ES version self._test_documents_for(_documents_for) # Test the DB version self._test_documents_for(_db_documents_for)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documents_for_fallback(self):\n general_bookmarks_documents, fallback = documents_for(\n locale='es', topics=[self.general_d, self.bookmarks_d])\n eq_(len(general_bookmarks_documents), 0)\n eq_(len(fallback), 1)", "def test_wiki_topics(self):\n t1 = TopicFactory(sl...
[ "0.6390627", "0.6360706", "0.6154155", "0.6043614", "0.60426295", "0.5871299", "0.5832978", "0.57984513", "0.5739916", "0.5734823", "0.5715689", "0.5689601", "0.5639566", "0.5631076", "0.55934167", "0.5577192", "0.55703324", "0.55657196", "0.5558956", "0.5513183", "0.5495333"...
0.6539613
0
Verify the fallback in documents_for.
def test_documents_for_fallback(self): general_bookmarks_documents, fallback = documents_for( locale='es', topics=[self.general_d, self.bookmarks_d]) eq_(len(general_bookmarks_documents), 0) eq_(len(fallback), 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documents_for(self):\n # Test the default ES version\n self._test_documents_for(_documents_for)\n\n # Test the DB version\n self._test_documents_for(_db_documents_for)", "def is_doc_not_found(self):\n return self._tag == 'doc_not_found'", "def is_doc_not_found(self):...
[ "0.61576545", "0.59980637", "0.59980637", "0.5851939", "0.5811002", "0.57868826", "0.5761457", "0.5634284", "0.56219274", "0.55630016", "0.5561261", "0.5540229", "0.5540229", "0.55388665", "0.55049825", "0.5459796", "0.54474205", "0.54217774", "0.53975624", "0.53540254", "0.5...
0.81136227
0
Computes the relevance map from labels and initialize downsampled label image `ds_labels`. The relevance map assumes that the object boundary is more likely to be located somwhere between different label categories, i.e. two labels of the same category generate a low energy, where two labels of different categories gen...
def _compute_relevance_map(self, labels): ds_labels = np.zeros(self.ds_size) ds_relevance_map = 0 for i in np.unique(labels): if i != 0: # 2.1- Compute the coarse label image y, x, z = np.where(labels == i) ds_labels[np.int32(y * self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist_labels(labels):\n if not labels.any():\n return labels\n return cv2.distanceTransform(labels,\n distanceType=cv2.DIST_L1,\n maskSize=3,\n dstType=cv2.CV_8U)", "def update(self, labels, target_lab...
[ "0.663854", "0.6014765", "0.59344715", "0.57514477", "0.5737298", "0.57360005", "0.5694466", "0.56791794", "0.5676705", "0.56435037", "0.5636614", "0.5626605", "0.5608325", "0.5582595", "0.55646574", "0.55596125", "0.5549956", "0.5543124", "0.55354166", "0.5500123", "0.549422...
0.8393734
0
Performs a random walker segmentation over a small region `self.ds_maskROI` around the coarse contour on the full resolution image. Requires `target_label` and `labels` Returns
def _refinement_random_walker( self, ds_labels, ds_maskROI, ds_mask, target_label): ds_labels[(ds_maskROI == False) & ds_mask] = target_label ds_labels[(ds_maskROI == False) & (ds_mask == False)] = -1 labels = zoom( ds_lab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, labels, target_label=1, k=0.5):\n # 1- Checking if inputs are valide\n labels = np.atleast_3d(labels)\n _err = self._check_parameters(labels, target_label)\n if _err == -1:\n segm = labels == target_label\n return segm\n\n # 2- Create down-s...
[ "0.6743074", "0.6679306", "0.5777495", "0.5339536", "0.5286349", "0.52647865", "0.5244069", "0.51111907", "0.51049846", "0.5091389", "0.5087727", "0.5039687", "0.50113034", "0.500768", "0.4929721", "0.4925015", "0.49172392", "0.49156442", "0.4909851", "0.4907129", "0.4902747"...
0.68157285
0
Updates the segmentation according to `labels` using the FastDRaW algorithm. The segmentation is computed in two stages. (1) coputes a coarse segmentation on a downsampled version of the image, (2) refines the segmentation on the original image.
def update(self, labels, target_label=1, k=0.5): # 1- Checking if inputs are valide labels = np.atleast_3d(labels) _err = self._check_parameters(labels, target_label) if _err == -1: segm = labels == target_label return segm # 2- Create down-sampled (coars...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_labels(self, labels=None):\n self._resize_if_required()\n segmentation = self._select_labels(self.resized_segmentation, labels)\n # logger.debug(\"select labels in show_segmentation {} sum {}\".format(labels, np.sum(segmentation)))\n self.resized_binar_segmentation = segmenta...
[ "0.58971053", "0.5870803", "0.58529025", "0.55490065", "0.5482771", "0.54209477", "0.53774494", "0.53757375", "0.53735715", "0.53047323", "0.5298555", "0.5277217", "0.5257133", "0.52287406", "0.5199676", "0.5182595", "0.51718724", "0.51448536", "0.5142468", "0.51193357", "0.5...
0.61531776
0
Set initial active states of a container.
def set_initial_state(self, initial_states, userdata): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_state( self ):", "def set_active(self):\n self.active = True", "def update_active(self):\n self.set_active(0)\n self.state = INACTIVE", "def update_active(self):\n self.set_active(0)\n self.state = INACTIVE", "def update_active(self):\n self.set_active(0)\n...
[ "0.6079875", "0.5994574", "0.5939531", "0.5939531", "0.5939531", "0.5939531", "0.5939531", "0.5854961", "0.5748378", "0.5723366", "0.5700906", "0.5621542", "0.5609483", "0.5609483", "0.55926687", "0.5583314", "0.5580623", "0.5542542", "0.55264163", "0.5518962", "0.5496434", ...
0.65243745
0
Check consistency of this container.
def check_consistency(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_consistency(self):\n assert len(self.shape) == len(self.qhape) == len(self.dirs)\n # Qnums must be unique within a qim and correspond one-to-one with\n # dimensions in dim.\n assert all(\n (\n len(dim) == len(qim) == len(set(qim))\n for...
[ "0.7248199", "0.6847062", "0.6685786", "0.658378", "0.6548099", "0.65174603", "0.6482328", "0.64773244", "0.6468122", "0.6445586", "0.64441836", "0.64426875", "0.64420766", "0.643523", "0.643523", "0.643523", "0.643523", "0.6400667", "0.63531375", "0.6339943", "0.633833", "...
0.780795
0
Adds a start callback to this container.
def register_start_cb(self, start_cb, cb_args=[]): self._start_cbs.append((start_cb,cb_args))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_start(self):\n\n def decorator(coro):\n self._hooks.append((\"start\", coro))\n return coro\n\n return decorator", "def start(self, callback=None):\n self.logger.debug('Starting container {}'.format(self.image))\n response = self.client.start(container=sel...
[ "0.69322824", "0.6523569", "0.64971846", "0.6315814", "0.61437184", "0.58806676", "0.58686477", "0.5816788", "0.58015245", "0.57988137", "0.5718299", "0.5690169", "0.56765115", "0.5669569", "0.5657107", "0.5657107", "0.5657107", "0.5657107", "0.56525826", "0.5637158", "0.5637...
0.72246057
0
Adds a transition callback to this container.
def register_transition_cb(self, transition_cb, cb_args=[]): self._transition_cbs.append((transition_cb,cb_args))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setTransitionCallback(self, func):\n self._transitionCallbackFunc = func", "def add_callback(self, callback: Callback):\n self._callbacks.add(callback)\n self._stage.add_callback(callback)", "def add_callback(self, callback) -> None:\r\n self._callbacks.append(callback)", "def...
[ "0.74166185", "0.646907", "0.623218", "0.6145366", "0.6103842", "0.6075908", "0.6046531", "0.6035793", "0.5971588", "0.59517175", "0.5941256", "0.5913979", "0.58654004", "0.5802639", "0.5802639", "0.57734764", "0.5761012", "0.5710758", "0.5693225", "0.5638155", "0.5614872", ...
0.7468583
0
Adds a termination callback to this state machine.
def register_termination_cb(self, termination_cb, cb_args=[]): self._termination_cbs.append((termination_cb, cb_args))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_termination_cbs(self, terminal_states, outcome):\n try:\n for (cb,args) in self._termination_cbs:\n cb(self.userdata, terminal_states, outcome, *args)\n except:\n smach.logerr(\"Could not execute termination callback: \"+traceback.format_exc())", "def s...
[ "0.6423374", "0.63325185", "0.6204693", "0.6083515", "0.5853897", "0.5620301", "0.55329466", "0.55141413", "0.5512498", "0.5506689", "0.545818", "0.5424252", "0.5352889", "0.5341437", "0.5328109", "0.53196084", "0.5307774", "0.530368", "0.52971506", "0.528809", "0.5260564", ...
0.7679594
0
Calls the registered start callbacks. Callback functions are called with two arguments in addition to any
def call_start_cbs(self): try: for (cb,args) in self._start_cbs: cb(self.userdata, self.get_initial_states(), *args) except: smach.logerr("Could not execute start callback: "+traceback.format_exc())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start( *args, **kwargs ):", "def register_start_cb(self, start_cb, cb_args=[]):\n self._start_cbs.append((start_cb,cb_args))", "def start(self, **kwargs):\n pass", "def start(self, **kwargs):\n pass", "def setupStarted(self, *args, **kwargs): # real signature unknown\n pass"...
[ "0.77059436", "0.7182337", "0.69004446", "0.69004446", "0.67773116", "0.667316", "0.667316", "0.667316", "0.667316", "0.65613943", "0.65062475", "0.6432383", "0.6432383", "0.6366769", "0.63357776", "0.62961143", "0.62961143", "0.62961143", "0.62961143", "0.6239744", "0.623974...
0.7779947
0
Calls the registered transition callbacks. Callback functions are called with two arguments in addition to any
def call_transition_cbs(self): try: for (cb,args) in self._transition_cbs: cb(self.userdata, self.get_active_states(), *args) except: smach.logerr("Could not execute transition callback: "+traceback.format_exc())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_transition_cb(self, transition_cb, cb_args=[]):\n self._transition_cbs.append((transition_cb,cb_args))", "def _forward_cb(self, *args, **kwargs):\n for callback_function in self.changeCallbacks:\n callback_function(*args, **kwargs)", "def _transitionCallback(self):\n ...
[ "0.71513474", "0.64175236", "0.6415207", "0.63223267", "0.59200025", "0.584644", "0.5817936", "0.57662714", "0.56755745", "0.56654394", "0.5642841", "0.5632714", "0.56239283", "0.56233865", "0.56189084", "0.55352956", "0.5515645", "0.5482792", "0.5435641", "0.54255354", "0.54...
0.7806414
0
Calls the registered termination callbacks. Callback functions are called with three arguments in addition to any
def call_termination_cbs(self, terminal_states, outcome): try: for (cb,args) in self._termination_cbs: cb(self.userdata, terminal_states, outcome, *args) except: smach.logerr("Could not execute termination callback: "+traceback.format_exc())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _shutdown(self, *args):\n\t\tfor callback in self.onShutdown:\n\t\t\ttry:\n\t\t\t\tcallback()\n\t\t\texcept:\n\t\t\t\tpass\n\t\tsys.exit()", "def register_termination_cb(self, termination_cb, cb_args=[]):\n self._termination_cbs.append((termination_cb, cb_args))", "def shutdown_callback():\n pass...
[ "0.715724", "0.7001697", "0.68681985", "0.64056104", "0.6400526", "0.63544244", "0.6236649", "0.6169077", "0.61382604", "0.6033522", "0.59629", "0.59339947", "0.5872191", "0.5872191", "0.5810606", "0.5802539", "0.5790875", "0.57876277", "0.5764301", "0.5756712", "0.5755672", ...
0.76129204
0
Opens this container for modification. This appends the container to the construction stack and locks the reentrant lock if it is a valid container to open.
def open(self): # Push this container onto the construction stack Container._construction_stack.append(self) Container._construction_lock.acquire()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __enter__(self):\n self.open()\n return self", "def __enter__(self):\n self.open()\n return self", "def __enter__(self):\n self.open()\n return self", "def __enter__(self):\n self.open()\n return self", "def __enter__(self):\n self.open()\n...
[ "0.659532", "0.659532", "0.659532", "0.659532", "0.659532", "0.6283311", "0.61424255", "0.6133596", "0.61291236", "0.6086675", "0.5907924", "0.5889908", "0.5878733", "0.5878733", "0.5870119", "0.58535916", "0.5813042", "0.57965404", "0.5762494", "0.57458645", "0.57066065", ...
0.8209622
0
Returns True if this container is currently opened for construction.
def is_opened(self): return len(Container._construction_stack) > 0 and self == Container._construction_stack[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_opened(self):\n return True", "def is_opened(self):\n return True", "def is_open(self) -> bool:\n pass", "def is_opened(self):\n return self._is_opened", "def IsOpen(self):\n return self._is_open", "def is_open(self) -> bool:\n return self._connection is n...
[ "0.80928266", "0.80928266", "0.79113173", "0.7892713", "0.7876918", "0.78438205", "0.77811474", "0.77795714", "0.7768691", "0.770461", "0.7686237", "0.7615399", "0.7593189", "0.75556386", "0.7555296", "0.75391024", "0.75361013", "0.7519499", "0.74228984", "0.74210817", "0.741...
0.8413736
0
Returns True if any containers are opened.
def _any_containers_opened(): if len(Container._construction_stack) > 0: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def at_least_one_alive(self, containers):\n for container in self.get_standard_containers(containers):\n # Update container variables so that status is accurate.\n container.container.reload()\n if container.container.status != 'exited':\n return True\n ...
[ "0.705016", "0.6990182", "0.6983364", "0.6714087", "0.6714087", "0.66603917", "0.65982693", "0.6511649", "0.6470121", "0.6441682", "0.64091355", "0.64030933", "0.63917416", "0.63710463", "0.6355114", "0.63384503", "0.6301457", "0.6296268", "0.62918067", "0.627152", "0.6256164...
0.83661747
0
Get the currently opened container. This also asserts that the open container is of type cls.
def _currently_opened_container(cls): if Container._any_containers_opened(): opened_container = Container._construction_stack[-1] if not isinstance(opened_container, cls): raise smach.InvalidStateError('Attempting to call a %s construction method without having opened a %...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getContainerfromCls(cls, clsname):\n for i in range(len(clslist)):\n if clsname == clslist[i]:\n return clslist[i]().getcontainer()\n return None", "def get_container(self) -> CNT:\n raise NotImplementedError()", "def _get_container(self) -> Container:\n ...
[ "0.68409806", "0.6475336", "0.6310415", "0.6144636", "0.5919585", "0.5862622", "0.58009887", "0.5745475", "0.5593684", "0.5526137", "0.5475943", "0.5470521", "0.52665395", "0.5243956", "0.5216046", "0.5208015", "0.52062243", "0.5197528", "0.51957035", "0.51923203", "0.5192112...
0.8285782
0
Fetch all the drones in the database.
def list(self): cursor = self._conn.cursor() query = 'SELECT d.ID id, d.Name name, dt.Types type, rt.Types rescue, CONCAT(o.FirstName, " ", o.LastName) operator' query += ' FROM DroneStore d LEFT JOIN OperatorStore o ON d.Operators = o.ID' query += ' INNER JOIN DroneType dt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consultar_todos_DB(self):\n registros = db.session.query(ModelConcurso).all()\n for registro in registros:\n print(registro)", "def fetch_all(self):\n with self.__connection.cursor() as cursor:\n query = \"SELECT * FROM %s\" % self.__schema\n cursor.execu...
[ "0.64320177", "0.6069213", "0.6054357", "0.60369277", "0.59943855", "0.5945941", "0.589223", "0.58806515", "0.58737606", "0.58682764", "0.585589", "0.58471453", "0.5830681", "0.58176154", "0.578917", "0.57837176", "0.57645524", "0.57524306", "0.57236564", "0.56927276", "0.569...
0.62065035
1
Adds a new drone to the database.
def add(self, drone): cursor = self._conn.cursor() query = 'INSERT INTO DroneStore (Name, ClassType, Rescue) VALUES (%s, %s, %s)' cursor.execute(query, (drone.name, drone.class_type, drone.rescue)) cursor.close() self._conn.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addDrone(self, myDrone):\n self.drones.append(myDrone)", "def save(self, drone):\r\n \r\n cursor = self._conn.cursor()\r\n query = 'UPDATE DroneStore SET Name = %s, ClassType = %s, Rescue = %s WHERE ID = %s'\r\n cursor.execute(query, (drone.name, drone.class_type, drone.res...
[ "0.68994486", "0.6507213", "0.62292016", "0.62292016", "0.5986488", "0.5891639", "0.58677846", "0.58677846", "0.58677846", "0.57628495", "0.5743115", "0.5738136", "0.57156336", "0.57155824", "0.5699985", "0.5693556", "0.5666667", "0.56374216", "0.56265056", "0.56265056", "0.5...
0.82217884
0
Retrieves a drone from the Drone table by its ID.
def get(self, id): cursor = self._conn.cursor() query = 'SELECT d.ID id, d.Name name, d.ClassType type, d.Rescue rescue, CONCAT(o.FirstName, " ", o.LastName) operator ' query += 'FROM DroneStore d LEFT JOIN OperatorStore o ON d.Operators = o.ID WHERE d.ID = ' + str(id) curs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_by_id(cls, id):\n return cls.query().get(id)", "def get_by_id(cls, id):\n return db.session.query(cls).get(id)", "def get(cls, id):\n\n return cls.query.get(id)", "def get(cls, id):\n\n return cls.query.get(id)", "def get_datarun(self, datarun_id):\n return self.s...
[ "0.66628546", "0.66135144", "0.6606876", "0.6606876", "0.6501972", "0.6468298", "0.6464788", "0.6369291", "0.6344954", "0.6321643", "0.6321643", "0.6321643", "0.6256609", "0.6247582", "0.6193488", "0.6186059", "0.6169176", "0.6162612", "0.6158823", "0.615035", "0.6123896", ...
0.78553206
0
Load the framework definition listed in the framework file(s). Loads the definition(s) from the file(s),
def load_framework_definitions(frameworks_file: Union[str, List[str]], config: Namespace) -> Namespace: frameworks = _load_and_merge_framework_definitions(frameworks_file, config) for tag, defs in frameworks: _sanitize_and_add_defaults(defs, config) return frameworks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_and_merge_framework_definitions(frameworks_file: Union[str, List[str]], config) -> Namespace:\n log.info(\"Loading frameworks definitions from %s.\", frameworks_file)\n if not isinstance(frameworks_file, list):\n frameworks_file = [frameworks_file]\n\n definitions_by_tag = Namespace()\n ...
[ "0.6494705", "0.5995176", "0.5984381", "0.592015", "0.5787648", "0.5787648", "0.5639554", "0.5621231", "0.558969", "0.5567272", "0.5567272", "0.5567272", "0.5567272", "0.5555722", "0.5533373", "0.55186313", "0.551286", "0.5508046", "0.54859114", "0.5477839", "0.54717463", "...
0.67375517
0
Load and merge the framework file(s), does not allow duplicate definitions.
def _load_and_merge_framework_definitions(frameworks_file: Union[str, List[str]], config) -> Namespace: log.info("Loading frameworks definitions from %s.", frameworks_file) if not isinstance(frameworks_file, list): frameworks_file = [frameworks_file] definitions_by_tag = Namespace() for tag in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_framework_definitions(frameworks_file: Union[str, List[str]], config: Namespace) -> Namespace:\n frameworks = _load_and_merge_framework_definitions(frameworks_file, config)\n for tag, defs in frameworks:\n _sanitize_and_add_defaults(defs, config)\n return frameworks", "def import_framewo...
[ "0.65234756", "0.5894699", "0.5825441", "0.5754914", "0.5733251", "0.5670261", "0.5524601", "0.5474538", "0.5467215", "0.5457872", "0.54209006", "0.5405311", "0.5359976", "0.53315496", "0.53296673", "0.53262496", "0.53166986", "0.5288476", "0.5288081", "0.5281926", "0.5280962...
0.73854417
0
Adds a 'name' attribute to each framework.
def _add_framework_name(frameworks: Namespace): for name, framework in frameworks: framework.name = str_sanitize(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_name(self, name):\n self.name = name", "def name(self, name: str):\n self.inst['targetname'] = name", "def set_name(self,name):\r\n self._name = __name", "def add_name(self, name: str) -> None:\n self._names.append(name)", "def name(self, name):\n\n self.container...
[ "0.6712597", "0.64069784", "0.6327704", "0.6270251", "0.61903715", "0.61903715", "0.611542", "0.6107276", "0.6090913", "0.6069785", "0.6045", "0.6042298", "0.60162365", "0.60162365", "0.6006513", "0.6006513", "0.6006513", "0.6006513", "0.60048074", "0.6000319", "0.59806377", ...
0.73553735
0
Defines default setup_cmd and _setup_cmd, interpolate commands if necessary. The default values are `None`. In case a setup_cmd is defined, the original definition is saved to `_setup_cmd`. The new `setup_cmd` will be a list of commands, where each command has the directories, package manager and python binary interpol...
def _add_default_setup_cmd(framework, config): if "setup_cmd" not in framework: framework._setup_cmd = None framework.setup_cmd = None else: framework._setup_cmd = framework.setup_cmd if isinstance(framework.setup_cmd, str): framework.setup_cmd = [framework.setup_cmd]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_setup_script(self, **kwargs):\n all_args = kwargs.copy()\n all_args['azure_url'] = names.azure_url(all_args['dns_name'])\n return '\\n'.join([\n \"sudo apt-get update\",\n \"sudo apt-get install docker.io -y\",\n \"git clone {git_repo} repo\",\n ...
[ "0.61033416", "0.5882013", "0.5857597", "0.57104427", "0.55831915", "0.5513007", "0.5348999", "0.52859914", "0.5282869", "0.5260542", "0.52538466", "0.5225368", "0.51999825", "0.5160899", "0.5130437", "0.5130378", "0.5114348", "0.51114184", "0.50876135", "0.50642425", "0.5020...
0.73507
0
Return all definitions framework extends, from direct parent to furthest.
def _find_all_parents(framework, frameworks): parents = [] while "extends" in framework and framework.extends is not None: framework = frameworks[framework.extends] parents.append(framework) return parents
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n if self._parent is None:\n return iter(self._defs)\n else:\n return itertools.chain(iter(self._defs), iter(self._parent))", "def toplevel_defs(self, tree):\n visitor = DefinitionVisitor()\n visitor.visit(tree)\n return visitor.definit...
[ "0.6120688", "0.6067513", "0.6061232", "0.57952327", "0.5687855", "0.5656052", "0.5652391", "0.5638929", "0.5635463", "0.56231135", "0.5590144", "0.5581682", "0.5570484", "0.55586743", "0.5558392", "0.55396384", "0.551886", "0.5485335", "0.54427046", "0.5441525", "0.54403985"...
0.633213
0
Searches the tree at depth 'depth' By default, the state is the board, and curr_player is whomever called this search Returns the alpha value
def search(self, depth, board, current_player, opposite_player): legal_boards = [] for column in range(7): if board.get_hole(column, 0) is 0: temp = deepcopy(board) temp.set_column(column, current_player) legal_boards.append(temp) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(self, depth, state, curr_player):\n \n # enumerate all legal moves from this state\n legal_moves = []\n for i in range(7):\n # if column i is a legal move...\n if self.isLegalMove(i, state):\n # make the move in column i for curr_player\n ...
[ "0.7911019", "0.6928879", "0.6785364", "0.67642725", "0.6496682", "0.64647895", "0.64515615", "0.64444065", "0.6427662", "0.63906634", "0.6364818", "0.634097", "0.6227446", "0.6201174", "0.613218", "0.61315674", "0.60899585", "0.60775816", "0.6066851", "0.60499156", "0.604771...
0.74964654
1
Parses `words` Follows algorithm given in J&M, 2008
def parse(self, words): # Create a 2D array for the parse table x = len(words) table = [ [set()]*x for _ in xrange(x) ] # Fill the parse table for j in range(0, x): A = self.grammar.left_for_right([words[j]]) table[j][j] = table[j][j] | set([Component(a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wordize(lines):\n parser = Parser()\n tokenizer = Tokenizer()\n word_ctr = WordCounter()\n words = []\n for l in lines :\n if (l.rstrip()) :\n statement = parser.parseSentence(l, int(word_ctr))\n token_lists = tokenizer.tokenizeStatement(statement, int(word...
[ "0.6611678", "0.65845406", "0.6484444", "0.6341172", "0.63315123", "0.6318103", "0.6303549", "0.6293328", "0.6275445", "0.62166256", "0.62010545", "0.61809814", "0.6176078", "0.61485296", "0.61432076", "0.6138952", "0.6129514", "0.607612", "0.60342807", "0.6029591", "0.601795...
0.6751677
0
Create users with different permissions for a given model
def create_users_with_permissions(self, model): self.assertIsNotNone(model) model_name = model._meta.model_name User.objects.create_superuser('all', 'all@email.com', 'all') self.permission_users = { 'all': {'username': 'all', 'password': 'all'} } for permissi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users_create():", "def test_create_with_permissions(self):\n permissions = Permission.objects.filter(name__in=('Can add course mode', 'Can change course mode'))\n for permission in permissions:\n self.user.user_permissions.add(permission)\n\n self.assert_can_create_course()", ...
[ "0.6618372", "0.6576167", "0.657211", "0.6508932", "0.64116", "0.63508284", "0.6310455", "0.61938775", "0.6172542", "0.61078006", "0.60940695", "0.60703385", "0.60492766", "0.6040984", "0.6033156", "0.60062855", "0.60060173", "0.59953016", "0.5977416", "0.5954821", "0.5934203...
0.80662715
0
Check if substring matches at least one item in container
def assertSubstringIn(self, substring, container, msg=None): result = any(substring in item for item in container) if not result: msg = self._formatMessage( msg, f'{substring} is not substring in {safe_repr(container)}' ) self.fail(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_strings(text, strings):\n for string in strings:\n if text.find(string) >= 0:\n return True\n return False", "def is_substring(text: str, elements: set) -> bool:\n for element in elements:\n if text in element:\n return True\n\n return...
[ "0.68602955", "0.68235403", "0.67794037", "0.6623481", "0.6591515", "0.64294064", "0.63842154", "0.63588697", "0.63239616", "0.62904173", "0.62904173", "0.62904173", "0.619947", "0.6188527", "0.6169707", "0.6165231", "0.6147703", "0.61192757", "0.60907626", "0.60870326", "0.6...
0.71470916
0
Return all available GPUs, or [mx.gpu()] if there is no GPU
def try_all_gpus(): ctx_list = [] try: for i in range(16): ctx = mx.gpu(i) _ = nd.array([0], ctx=ctx) ctx_list.append(ctx) except: pass if not ctx_list: ctx_list = [mx.cpu()] return ctx_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def try_all_gpus(): #@save\n num_gpus = len(tf.config.experimental.list_physical_devices('GPU'))\n devices = [tf.device(f'/GPU:{i}') for i in range(num_gpus)]\n return devices if devices else [tf.device('/CPU:0')]", "def getGpus():\n nvmlInit()\n gpu_list = []\n for i in range(0, nvmlDeviceGet...
[ "0.7980352", "0.7837273", "0.759196", "0.75182045", "0.75086784", "0.75086784", "0.74847424", "0.74672884", "0.7454377", "0.7418479", "0.7378309", "0.7187818", "0.7165814", "0.70694816", "0.7062201", "0.7062201", "0.6972999", "0.6926733", "0.6901051", "0.6898842", "0.6892457"...
0.7998565
0
Gets the account_management_granular of this UserSettingsInformation.
def account_management_granular(self): return self._account_management_granular
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_management_granular(self, account_management_granular):\n\n self._account_management_granular = account_management_granular", "def management(self) -> Optional[str]:\n return pulumi.get(self, \"management\")", "def management_account_id(self) -> pulumi.Output[str]:\n return pul...
[ "0.6964268", "0.5341507", "0.53188133", "0.4995885", "0.49870467", "0.49371988", "0.4936494", "0.49289906", "0.4875965", "0.4875965", "0.48739758", "0.48694438", "0.48119494", "0.4785386", "0.47844255", "0.4748844", "0.47476625", "0.47401637", "0.47391534", "0.47332716", "0.4...
0.8756573
0
Sets the account_management_granular of this UserSettingsInformation.
def account_management_granular(self, account_management_granular): self._account_management_granular = account_management_granular
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_management_granular(self):\n return self._account_management_granular", "def set_gran(self, gran: Gran):\n if gran != self.gran:\n self.gran = gran\n self.load_candles()", "def hide_management_account(self, hide_management_account):\n\n self._hide_manageme...
[ "0.7027786", "0.5568789", "0.5480267", "0.5261804", "0.5261207", "0.5171458", "0.5153946", "0.4885261", "0.48847663", "0.48822746", "0.48339003", "0.47897685", "0.46222213", "0.45893964", "0.45688793", "0.45091784", "0.44225353", "0.43510196", "0.4344551", "0.43411723", "0.43...
0.86614376
0
Gets the sender_email_notifications of this UserSettingsInformation.
def sender_email_notifications(self): return self._sender_email_notifications
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signer_email_notifications(self):\n return self._signer_email_notifications", "def marketing_notification_emails(self):\n if \"marketingNotificationEmails\" in self._prop_dict:\n return self._prop_dict[\"marketingNotificationEmails\"]\n else:\n return None", "def ...
[ "0.6832463", "0.67659736", "0.67336607", "0.6700323", "0.6700323", "0.627102", "0.62563664", "0.6121179", "0.6058731", "0.59742504", "0.5962844", "0.59162265", "0.5873565", "0.56536144", "0.56495136", "0.55052745", "0.54777133", "0.5429334", "0.5402951", "0.52963686", "0.5276...
0.81408495
0
Sets the sender_email_notifications of this UserSettingsInformation.
def sender_email_notifications(self, sender_email_notifications): self._sender_email_notifications = sender_email_notifications
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signer_email_notifications(self, signer_email_notifications):\n\n self._signer_email_notifications = signer_email_notifications", "def sender_email_notifications(self):\n return self._sender_email_notifications", "def notification_sender_email(self) -> Optional[pulumi.Input[str]]:\n re...
[ "0.671219", "0.6476181", "0.56622165", "0.56622165", "0.54793113", "0.54165363", "0.54161817", "0.53970504", "0.53604704", "0.5306703", "0.51197654", "0.5117955", "0.50733805", "0.5058736", "0.49915284", "0.49727207", "0.49499515", "0.49282268", "0.48715928", "0.48428005", "0...
0.815505
0
Gets the signer_email_notifications of this UserSettingsInformation.
def signer_email_notifications(self): return self._signer_email_notifications
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sender_email_notifications(self):\n return self._sender_email_notifications", "def marketing_notification_emails(self):\n if \"marketingNotificationEmails\" in self._prop_dict:\n return self._prop_dict[\"marketingNotificationEmails\"]\n else:\n return None", "def ...
[ "0.754419", "0.6836531", "0.6414868", "0.63925785", "0.63284004", "0.625158", "0.61629725", "0.6036116", "0.5999742", "0.5845174", "0.5683313", "0.56740224", "0.56265", "0.56265", "0.5539977", "0.5528653", "0.5528143", "0.53676605", "0.5366533", "0.5311839", "0.525067", "0....
0.82737124
0
Sets the signer_email_notifications of this UserSettingsInformation.
def signer_email_notifications(self, signer_email_notifications): self._signer_email_notifications = signer_email_notifications
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sender_email_notifications(self, sender_email_notifications):\n\n self._sender_email_notifications = sender_email_notifications", "def signer_email_notifications(self):\n return self._signer_email_notifications", "def sender_email_notifications(self):\n return self._sender_email_notifi...
[ "0.7339705", "0.61653405", "0.56314135", "0.53665876", "0.52118367", "0.52087605", "0.5079516", "0.5038418", "0.5003543", "0.4860695", "0.4834135", "0.47473538", "0.47417656", "0.4722075", "0.47188148", "0.47122654", "0.47011545", "0.4698843", "0.46899965", "0.46479365", "0.4...
0.8156297
0
Gets the user_settings of this UserSettingsInformation.
def user_settings(self): return self._user_settings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def settings(self):\r\n url = '{0}/userSettings'.format(self.get_url())\r\n return http.Request('GET', url), parsers.parse_json", "def get_settings(self):\n return self.settings", "def user_account_settings(self) -> pulumi.Output[Optional['outputs.UserAccountSettingsResponse']]:\n r...
[ "0.7643714", "0.7230933", "0.7225433", "0.7143668", "0.7042038", "0.70372933", "0.70372933", "0.6985403", "0.69850475", "0.69450694", "0.69450694", "0.69345593", "0.66278815", "0.6530578", "0.64618087", "0.6450718", "0.6423493", "0.6423493", "0.64145523", "0.64145523", "0.637...
0.86103326
0
Sets the user_settings of this UserSettingsInformation.
def user_settings(self, user_settings): self._user_settings = user_settings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _onUserSettings(self, event):\n dialog = sc.UserSettingsDialog(self)\n if dialog.ShowModal() == wx.ID_OK:\n dialog.saveSettings()\n dialog.Destroy()\n \n sel = self.userbox.GetSelection()\n usernames = ['None'] + c.getUserNames()\n self.userbox.SetIte...
[ "0.6454543", "0.640949", "0.636302", "0.6237249", "0.6210749", "0.618439", "0.6138722", "0.6120867", "0.6091094", "0.60605264", "0.6031069", "0.60232025", "0.60015637", "0.58993393", "0.5800095", "0.5770993", "0.5748915", "0.57466954", "0.56918263", "0.5661085", "0.56385565",...
0.85957193
0
Convert header to list first then delete it in the numpy array and loop through header and if the index is in header then make tuple of the name of colmn and types <U30 else float 64 and append it to dtype_list then use loop to convert the numpy to tuple and then finally convert everything to updated type with dtype=dt...
def unstructured_to_structured(data, indexes): header = data[0].tolist() dtype_lst = [] for i in range(len(header)): if i in indexes: dtype_lst.append(tuple([header[i], "<U30"])) else: dtype_lst.append(tuple([header[i], "float64"])) updated = np.delete(dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_data_types(self):\n for col in self.all_columns:\n try:\n if float(self.train[col].iloc[-3]):\n self.train[col] = self.train[col].astype(np.float32)\n except:\n pass\n self.d_types = self.train.dtypes", "def _build_dt...
[ "0.6141456", "0.60948145", "0.59733003", "0.583599", "0.57885665", "0.57656264", "0.5709401", "0.56881225", "0.5647541", "0.5613356", "0.55838686", "0.55196273", "0.5513084", "0.55109113", "0.55047226", "0.54947895", "0.5460463", "0.544452", "0.5421149", "0.54059535", "0.5390...
0.69453984
0
Use percentile function to get the quartiles and then coun_nonzero which will count any true (which will be the outliers).
def number_of_outliers(sentiment, lower, upper): upper_quartile = np.percentile(sentiment, upper) lower_quartile = np.percentile(sentiment, lower) lower_outlier = np.count_nonzero(sentiment <= lower_quartile) higher_outlier = np.count_nonzero(sentiment >= upper_quartile) total_outlier = lower_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_profiled_quantiles(self):\n\n # this data has 4 bins, range of 3\n # with equal bin size, each bin has the width of 0.75\n\n data = [\"1.0\", \"2.0\", \"3.0\", \"4.0\"]\n df = pd.Series(data)\n profiler = FloatColumn(df.name)\n profiler.update(df)\n profile...
[ "0.6884751", "0.66199094", "0.64697343", "0.64096236", "0.63302094", "0.62790793", "0.61918354", "0.61767244", "0.61654735", "0.6159846", "0.6147165", "0.61292106", "0.6112503", "0.6103137", "0.60983473", "0.6078088", "0.6070936", "0.604553", "0.6038147", "0.6035924", "0.6005...
0.68655866
1
Uses .rename to change the column name to twwet_ID for df_tweets then change mertics colmn type to tweet_ID to float64 then to int64 and then merge two dataframe.
def merge_dataframes(df_metrics, df_tweets): df_tweets = df_tweets.rename(columns={'id': 'tweet_ID'}) df_tweets[['tweet_ID']] = df_tweets[['tweet_ID']].astype('int64') df_metrics[['tweet_ID']] = df_metrics[['tweet_ID']].astype( "float64").astype('int64') ans = df_tweets.join( df_me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join(tw_df, rtt_df):\n original_tw_id = []\n author_ids = []\n rtt_dates = []\n groups = rtt_df.groupby('original_tweet_id').groups\n for k in groups.keys():\n l_a = []\n l_r = []\n original_tw_id.append(k)\n for index in groups[k]:\n line = rtt_df.iloc[[in...
[ "0.5640073", "0.54037976", "0.53327024", "0.5244334", "0.519226", "0.51699823", "0.51566815", "0.51032263", "0.50798815", "0.5056191", "0.5010647", "0.49942192", "0.49934655", "0.4982016", "0.49750397", "0.4948915", "0.49344727", "0.49175215", "0.49153122", "0.485437", "0.483...
0.73033243
0
Make a snapshot with a single particle.
def one_particle_snapshot_factory(device): def make_snapshot(particle_types=['A'], dimensions=3, position=(0, 0, 0), orientation=(1, 0, 0, 0), L=20): """Make the snapshot. Args: particle_types: List...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_snapshot(particle_types=['A'], a=1, n=7, r=0):\n s = Snapshot(device.communicator)\n\n if s.communicator.rank == 0:\n # make one unit cell\n s.configuration.box = [a, a, a, 0, 0, 0]\n s.particles.N = 4\n s.particles.types = particle_types\n ...
[ "0.64172405", "0.6270478", "0.58086765", "0.5780967", "0.5780967", "0.57053214", "0.565574", "0.5592468", "0.5548041", "0.553507", "0.54737127", "0.5466505", "0.53480875", "0.5347661", "0.5337391", "0.5337014", "0.53256947", "0.52610826", "0.52525747", "0.52400464", "0.520917...
0.7097324
0
Make a snapshot with two particles.
def two_particle_snapshot_factory(device): def make_snapshot(particle_types=['A'], dimensions=3, d=1, L=20): """Make the snapshot. Args: particle_types: List of particle type names dimensions: Number of dimensions (2 or 3) d: Distance apart to place particles ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_particle_snapshot_factory(device):\n\n def make_snapshot(particle_types=['A'],\n dimensions=3,\n position=(0, 0, 0),\n orientation=(1, 0, 0, 0),\n L=20):\n \"\"\"Make the snapshot.\n\n Args:\n pa...
[ "0.65244836", "0.61522967", "0.5718647", "0.5699979", "0.5575916", "0.5574668", "0.5398807", "0.53816015", "0.52769786", "0.52349424", "0.51990205", "0.5196298", "0.51533556", "0.51402074", "0.51389456", "0.5114728", "0.507372", "0.5073409", "0.5056057", "0.5047263", "0.50392...
0.74935544
0
Make a snapshot with particles on a cubic/square lattice.
def lattice_snapshot_factory(device): def make_snapshot(particle_types=['A'], dimensions=3, a=1, n=7, r=0): """Make the snapshot. Args: particle_types: List of particle type names dimensions: Number of dimensions (2 or 3) a: Lattice constant n: Numbe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_snapshot(particle_types=['A'], a=1, n=7, r=0):\n s = Snapshot(device.communicator)\n\n if s.communicator.rank == 0:\n # make one unit cell\n s.configuration.box = [a, a, a, 0, 0, 0]\n s.particles.N = 4\n s.particles.types = particle_types\n ...
[ "0.6419626", "0.6203748", "0.61551493", "0.6121624", "0.6075522", "0.58779657", "0.5734647", "0.5653401", "0.56488776", "0.5546259", "0.5544825", "0.5434593", "0.54041517", "0.5398106", "0.539672", "0.5396138", "0.53735846", "0.5372328", "0.5367468", "0.5354797", "0.5305875",...
0.69288355
0
Make a snapshot with particles in a fcc structure.
def fcc_snapshot_factory(device): def make_snapshot(particle_types=['A'], a=1, n=7, r=0): """Make a snapshot with particles in a fcc structure. Args: particle_types: List of particle type names a: Lattice constant n: Number of unit cells along each box edge ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snapshot_gen(ICobj):\n \n # Constants\n G = SimArray(1.0,'G')\n kB = SimArray(1.0,'k')\n # ------------------------------------\n # Load in things from ICobj\n # ------------------------------------\n # snapshot file name\n snapshotName = ICobj.settings.filenames.snapshotName\n # ...
[ "0.65252393", "0.6297391", "0.619827", "0.58523786", "0.5621591", "0.5543521", "0.5502046", "0.54871523", "0.5383338", "0.5289711", "0.5287304", "0.52803946", "0.5276852", "0.5161241", "0.5094106", "0.50766104", "0.5072502", "0.5066861", "0.50660086", "0.5065551", "0.50616777...
0.76286894
0
Skip tests marked ``serial`` when running with MPI.
def skip_mpi(request): if request.node.get_closest_marker('serial'): if 'device' in request.fixturenames: if request.getfixturevalue('device').communicator.num_ranks > 1: pytest.skip('Test does not support MPI execution') else: raise ValueError('skip_mpi requi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mpi_code() -> None:\n print(\"MPI code checking is disabled\")", "def check_not_in_mpiexec(self):\n \n if 'HYDRA_CONTROL_FD' in os.environ or 'PMI_FD' in os.environ:\n self.skip('cannot run the socket tests under mpi process manager')", "def assert_blank_serial(tes...
[ "0.70574915", "0.6422686", "0.5987028", "0.588617", "0.573426", "0.5724937", "0.5628911", "0.5627437", "0.55371284", "0.5535277", "0.5508383", "0.54227334", "0.5396531", "0.536317", "0.5362754", "0.5343852", "0.5341649", "0.53068924", "0.5305238", "0.52897453", "0.52876925", ...
0.8384446
0
Skip CPU tests marked ``gpu``.
def only_gpu(request): if request.node.get_closest_marker('gpu'): if 'device' in request.fixturenames: if not isinstance(request.getfixturevalue('device'), hoomd.device.GPU): pytest.skip('Test is run only on GPU(s).') else: raise ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def only_cpu(request):\n if request.node.get_closest_marker('cpu'):\n if 'device' in request.fixturenames:\n if not isinstance(request.getfixturevalue('device'),\n hoomd.device.CPU):\n pytest.skip('Test is run only on CPU(s).')\n else:\n ...
[ "0.6961476", "0.6529377", "0.60723346", "0.59977555", "0.59160286", "0.5853473", "0.5801935", "0.57851595", "0.5718551", "0.56843525", "0.5675344", "0.5630731", "0.56091106", "0.5599707", "0.5595522", "0.55840254", "0.55829644", "0.5549115", "0.5547665", "0.55464286", "0.5546...
0.7304316
0
Skip GPU tests marked ``cpu``.
def only_cpu(request): if request.node.get_closest_marker('cpu'): if 'device' in request.fixturenames: if not isinstance(request.getfixturevalue('device'), hoomd.device.CPU): pytest.skip('Test is run only on CPU(s).') else: raise ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def only_gpu(request):\n if request.node.get_closest_marker('gpu'):\n if 'device' in request.fixturenames:\n if not isinstance(request.getfixturevalue('device'),\n hoomd.device.GPU):\n pytest.skip('Test is run only on GPU(s).')\n else:\n ...
[ "0.6920724", "0.60645443", "0.5983786", "0.5835879", "0.58217114", "0.57569665", "0.5747025", "0.5725719", "0.56741685", "0.564838", "0.56109315", "0.5532399", "0.55122787", "0.5489479", "0.5458149", "0.5449561", "0.5434493", "0.5395874", "0.5393649", "0.53916895", "0.5377316...
0.7644448
0
Return a NumPy random generator.
def rng(): return numpy.random.default_rng(564)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def np_random(self):\n\n if not hasattr(self, \"_np_random\"):\n self.seed()\n\n return self._np_random", "def rng():\n return np.random.default_rng()", "def get_rng(seed=None):\n return np.random.default_rng(seed)", "def rand(self):\n return np.random.rand(self.nx)", ...
[ "0.7335153", "0.7175199", "0.7081211", "0.6878682", "0.6854681", "0.6827795", "0.6559825", "0.6506896", "0.6469243", "0.6384253", "0.6374866", "0.6320191", "0.62269205", "0.616296", "0.61271566", "0.6121173", "0.6112939", "0.6092677", "0.6071187", "0.60412", "0.60241807", "...
0.7412338
0
Call MPI_Abort when pytest tests fail.
def abort(exitstatus): # get a default mpi communicator communicator = hoomd.communicator.Communicator() # abort the deadlocked ranks hoomd._hoomd.abort_mpi(communicator.cpp_mpi_conf, exitstatus)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pytest_sessionfinish(session, exitstatus):\n if exitstatus != 0 and hoomd.version.mpi_enabled:\n atexit.register(abort, exitstatus)", "def pytest_unconfigure() -> None: # pragma: no cover\n if PROC.exitcode is None:\n assert PROC.pid is not None # not sure if this can happen (mypy error...
[ "0.7214813", "0.65260816", "0.64877117", "0.6062213", "0.6030241", "0.5980128", "0.59467304", "0.59427327", "0.5930223", "0.59023166", "0.5855833", "0.5805682", "0.57997215", "0.5792512", "0.5753985", "0.573756", "0.57276237", "0.57185876", "0.57099324", "0.5690893", "0.56903...
0.6556023
1
Finalize pytest session. MPI tests may fail on one rank but not others. To prevent deadlocks in these situations, this code calls ``MPI_Abort`` when pytest is exiting with a nonzero exit code. pytest should be run with the ``x`` option so that it exits on the first error.
def pytest_sessionfinish(session, exitstatus): if exitstatus != 0 and hoomd.version.mpi_enabled: atexit.register(abort, exitstatus)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pytest_sessionfinish(session, exitstatus):\n os.killpg(os.getpgid(pytest.web2py_process.pid), signal.SIGTERM)\n sleep(5)\n web2pytest.close_test_environment(pytest.web2py_environment)\n if os.path.exists(TEST_DB_DIR):\n shutil.rmtree(TEST_DB_DIR)", "def pytest_unconfigure() -> None: # pra...
[ "0.66320634", "0.65486616", "0.6384594", "0.6308172", "0.6233311", "0.6098899", "0.60323346", "0.60110116", "0.5913059", "0.58990246", "0.5890358", "0.5767872", "0.57430464", "0.5695557", "0.5692524", "0.56702805", "0.56486255", "0.5631472", "0.56248546", "0.5593523", "0.5588...
0.7833933
0
Test that an instance can be pickled and unpickled.
def pickling_check(instance): pkled_instance = pickle.loads(pickle.dumps(instance)) equality_check(instance, pkled_instance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__pickle_unpickle(self):\n pass", "def is_picklable(obj):\n try:\n pickle.dumps(obj)\n\n except pickle.PicklingError:\n return False\n return True", "def can_be_pickled(x):\n try:\n s = BytesIO() \n pickle.dump(x, s) \n return True\n except:\n ...
[ "0.7429163", "0.7072534", "0.69969696", "0.685465", "0.6659258", "0.6656739", "0.6542364", "0.6518207", "0.6483278", "0.6425131", "0.641585", "0.6356798", "0.6301559", "0.6293373", "0.6292999", "0.6263342", "0.6234437", "0.6194201", "0.61913896", "0.6183407", "0.6128865", "...
0.7687804
0
Test that an operation can be pickled and unpickled.
def operation_pickling_check(instance, sim): pickling_check(instance) sim.operations += instance sim.run(0) pickling_check(instance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__pickle_unpickle(self):\n pass", "def can_be_pickled(x):\n try:\n s = BytesIO() \n pickle.dump(x, s) \n return True\n except:\n return False", "def is_picklable(obj):\n try:\n pickle.dumps(obj)\n\n except pickle.PicklingError:\n return False\n...
[ "0.67562985", "0.65570647", "0.6251611", "0.6131321", "0.6129491", "0.6034629", "0.5858671", "0.58544505", "0.5799441", "0.5774369", "0.56913203", "0.5652992", "0.56363773", "0.5631307", "0.56048506", "0.5525257", "0.5508814", "0.54943174", "0.5490417", "0.54564494", "0.54430...
0.72860813
0
Perform any final assert on the collection like object. For test that modify a collection this is called at the end to perform any specific tests relevant to the currently tested class. For instance, this can test that a synced list is kept up to date with modification.
def final_check(self, test_collection): assert True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_collection(self):\n pass", "def test_patch_collection(self):\n pass", "def test_empty_pop(self, populated_collection):\n test_list, plain_list = populated_collection\n item = test_list.pop()\n assert self.is_equal(self.to_base(item), plain_list[-1])\n p...
[ "0.6928552", "0.68368983", "0.65082264", "0.6342388", "0.63407105", "0.6190665", "0.6052456", "0.60462326", "0.59923744", "0.5989559", "0.59727466", "0.5965433", "0.5917941", "0.5876762", "0.5855284", "0.5848375", "0.5800228", "0.5793792", "0.57669514", "0.57159555", "0.56526...
0.76858795
0
Return an empty test class collection. This is required by `populated_collection`.
def empty_collection(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty(cls):\n x = cls(base_types=set(), template_types={}, refined_types={}, humannames={},\n type_aliases={}, cpp_types={}, numpy_types={}, from_pytypes={},\n cython_ctypes={}, cython_cytypes={}, cython_pytypes={},\n cython_cimports={}, cython_cyimports={}, ...
[ "0.643357", "0.6182936", "0.60887766", "0.59990853", "0.5987535", "0.5982811", "0.5928975", "0.5866669", "0.5866669", "0.58132756", "0.5812043", "0.5806781", "0.580228", "0.573697", "0.5733879", "0.57096374", "0.5701334", "0.5683386", "0.5664232", "0.566027", "0.5643665", "...
0.75241876
0
Pick a random existing key from mapping. Fails on an empty mapping.
def choose_random_key(self, mapping): return list(mapping)[self.generator.int(len(mapping))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_random_key_for_dict(self, data):\n existing_keys = data.keys()\n while True:\n new_key = self.generate_random_string(10)\n if new_key not in existing_keys:\n return new_key", "def get_random_key_from_dict(d: dict) -> [Union[str, int, tuple]]:\n r...
[ "0.66217095", "0.656554", "0.6257752", "0.61959845", "0.6137188", "0.6136768", "0.59524596", "0.59347886", "0.58957994", "0.5884121", "0.5871841", "0.5855393", "0.58350986", "0.5830418", "0.58295983", "0.58284336", "0.5827137", "0.580956", "0.5804053", "0.5776443", "0.5755847...
0.81298983
0
Get all quotes in an option chain. Greek and IV data is included courtesy of ORATS. Please check out their APIs for more indepth options data. Greeks/IV data is updated once per hour. This data is calculated using the ORATS APIs and is supplied directly from them.
def get_option_chains( self, symbol: str, expiration: date, greeks: bool = False ) -> List[Quote]: url = "/v1/markets/options/chains" params = { "symbol": symbol, "expiration": expiration, "greeks": greeks, } data = self.get(url, params) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_quotes() -> List[Dict]:\n return [quote for quote in quote_dict[\"quotes\"]]", "def get_quotes(self, symbols: str, greeks: bool = False) -> List[Quote]:\n url = \"/v1/markets/quotes\"\n params = {\"symbols\": symbols, \"greeks\": greeks}\n\n data = self.get(url, params)\n ...
[ "0.5991606", "0.5914791", "0.5910254", "0.57568616", "0.5647374", "0.5510134", "0.5482639", "0.5388385", "0.5345504", "0.5345504", "0.53271765", "0.5303638", "0.52982175", "0.52971387", "0.5292536", "0.5290681", "0.5284756", "0.5266558", "0.5251604", "0.52431995", "0.5236998"...
0.6696592
0
Get an options strike prices for a specified expiration date.
def get_option_strikes(self, symbol: str, expiration: date) -> List[float]: url = "/v1/markets/options/strikes" params = {"symbol": symbol, "expiration": expiration} data = self.get(url, params) res = MarketsAPIResponse(**data) return res.strikes.strike
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCloseStrikePrice(ib, qualityContracts, aStockSymbol, price, startDate, right, exchange = 'SMART' ):\n # print(qualityContracts.symbol)\n # [ticker] = ib.reqTickers(qualityContracts)\n\n chains = ib.reqSecDefOptParams(qualityContracts.symbol, '', qualityContracts.secType, qualityContracts.conId)\n ...
[ "0.63001585", "0.62316215", "0.62042123", "0.61992383", "0.6011985", "0.60024524", "0.59456027", "0.5930116", "0.5890517", "0.57507277", "0.56142944", "0.558516", "0.54723346", "0.5427447", "0.5427197", "0.54161394", "0.5341339", "0.53233933", "0.53233933", "0.5313956", "0.52...
0.69399756
0
Get expiration dates for a particular underlying. Note that some underlying securities use a different symbol for their weekly options (RUT/RUTW, SPX/SPXW). To make sure you see all expirations, make sure to send the includeAllRoots parameter. This will also ensure any unique options due to corporate actions (AAPL1) ar...
def get_option_expirations( self, symbol: str, include_all_roots: bool = None, strikes: str = None ) -> List[date]: url = "/v1/markets/options/expirations" params = { "symbol": symbol, "includeAllRoots": include_all_roots, "strikes": strikes, } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expiry_dates(self):\n try:\n return self._expiry_dates\n except AttributeError:\n # has to be a non-valid date, to trigger returning 'expirations'\n d = self._load_data(dt.datetime(2016, 1, 3))\n self._expiry_dates = [dt.date(x['y'], x['m'], x['d'])\n ...
[ "0.6089846", "0.5982812", "0.5950617", "0.5613301", "0.5442885", "0.5433153", "0.52674246", "0.5181539", "0.50485456", "0.5048336", "0.50454235", "0.49830306", "0.49817047", "0.49243703", "0.49070898", "0.486853", "0.4867026", "0.48651224", "0.48345017", "0.48170972", "0.4809...
0.6825142
0
Get all options symbols for the given underlying. This will include additional option roots (ex. SPXW, RUTW) if applicable.
def lookup_option_symbols(self, underlying: str) -> List[Symbol]: url = "/v1/markets/options/lookup" params = {"underlying": underlying} data = self.get(url, params) res = MarketsAPIResponse(**data) return res.symbols
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_options():\n return _OptionRegistry.values()", "def get_all_options(self): \n return self._options.items()", "def get_option_chains(\n self, symbol: str, expiration: date, greeks: bool = False\n ) -> List[Quote]:\n url = \"/v1/markets/options/chains\"\n params =...
[ "0.616908", "0.6115496", "0.5847602", "0.5825819", "0.5761465", "0.574611", "0.56633216", "0.56425214", "0.56267995", "0.56150347", "0.5591784", "0.55544174", "0.5550654", "0.55407465", "0.5510677", "0.5472057", "0.5437761", "0.54287964", "0.5418582", "0.5412854", "0.5407809"...
0.7733897
0