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
filters data of a country based on region and prints the information
def filter_region_graph(data, region): MetaDct = data[1] f_MetaDct = {} for idx in MetaDct: if idx != ',': if MetaDct[idx].region == region: f_MetaDct[idx] = MetaDct[idx].country return f_MetaDct
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_plants_by_region_id(region_id, year, host='localhost', area=0.5):\n\n state_dict = {\n 'Alabama':'AL',\n 'Alaska':'AK',\n 'Arizona':'AZ',\n 'Arkansas':'AR',\n 'California':'CA',\n 'Colorado':'CO',\n 'Connecticut':'CT',\n 'Delaware':'DE',\n ...
[ "0.6658499", "0.6410955", "0.6067802", "0.60592765", "0.59279484", "0.58684576", "0.5755931", "0.5714607", "0.5701636", "0.5700606", "0.5656649", "0.56488043", "0.5646425", "0.56458735", "0.56219095", "0.5610873", "0.55914587", "0.5582464", "0.55497396", "0.55327725", "0.5530...
0.7006411
0
returns life expectancy for a particular country
def life_expectancy_graph(country_name): dat = read_data(pre_file_name()) MainDct = dat[0] # MetaDct = dat[1] f_life_expectancy = {} for idx in MainDct: if idx == country_name or MainDct[idx].country_code == country_name: for idx1 in MainDct[idx].values: i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country(name):\n return location_db().find(name=name)[\"country\"]", "def get_country(self, country):\n if country == \"United Kingdom\": return \"en\"\n if country == \"Portugal\": return \"pt\"\n\n result = self.session.get(\"https://en.ogame.gameforge.com\")\n soup = Beautif...
[ "0.63355774", "0.6262677", "0.62415963", "0.6105801", "0.61056256", "0.5965774", "0.5924412", "0.588456", "0.5835843", "0.58215404", "0.5820278", "0.5803385", "0.5791575", "0.57809955", "0.57630855", "0.57585454", "0.5653031", "0.56394273", "0.5637285", "0.5637285", "0.561691...
0.6759451
0
returns list of medians of life expectancies of all the years from 1960 to 2015 of high income category of countries
def high_income_countries(): high_countries_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in high_countries: high_countries_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in high_countries_data: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def low_income_countries():\r\n low_countries_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in low_countries:\r\n low_countries_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in low...
[ "0.8232228", "0.79833865", "0.7896011", "0.75432706", "0.7347628", "0.7279632", "0.7237976", "0.7189825", "0.69867724", "0.68406177", "0.6005981", "0.55256027", "0.54909545", "0.5362033", "0.52243906", "0.51795703", "0.5162693", "0.5161273", "0.5135138", "0.5107014", "0.51000...
0.8440245
0
returns list of medians of life expectancies all the years from 1960 to 2015 of low income category of countries
def low_income_countries(): low_countries_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in low_countries: low_countries_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in low_countries_data: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def high_income_countries():\r\n high_countries_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in high_countries:\r\n high_countries_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in...
[ "0.8163041", "0.79932195", "0.7629565", "0.7366575", "0.7085949", "0.7013312", "0.6857983", "0.67728174", "0.66159344", "0.6608726", "0.5927459", "0.56531584", "0.55937845", "0.5528759", "0.52845293", "0.5237982", "0.52361083", "0.5064734", "0.5063792", "0.5045841", "0.501769...
0.84986115
0
returns list of medians of life expectancies all the years from 1960 to 2015 of lower middle income category of countries
def lower_middle_income_countries(): lower_middle_countries_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in lower_middle_countries: lower_middle_countries_data.append(life_expectancy_graph(idx)) y_idx = 0 for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def low_income_countries():\r\n low_countries_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in low_countries:\r\n low_countries_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in low...
[ "0.82594836", "0.81239355", "0.8027209", "0.76326436", "0.7560238", "0.72878283", "0.7192892", "0.703807", "0.68495995", "0.6803364", "0.6067006", "0.55328685", "0.5489229", "0.54189485", "0.5258152", "0.52244323", "0.51967055", "0.5187414", "0.51295394", "0.51035774", "0.507...
0.8407358
0
returns list of medians of life expectancies all the years from 1960 to 2015 of upper middle income category of countries
def upper_middle_income_countries(): upper_middle_countries_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in upper_middle_countries: upper_middle_countries_data.append(life_expectancy_graph(idx)) y_idx = 0 for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lower_middle_income_countries():\r\n lower_middle_countries_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in lower_middle_countries:\r\n lower_middle_countries_data.append(life_expectancy_graph(idx))\r\...
[ "0.8276846", "0.8132003", "0.8073348", "0.77521634", "0.7707552", "0.7392722", "0.7356976", "0.7288535", "0.7103225", "0.69387406", "0.6100426", "0.55157006", "0.54712534", "0.5457827", "0.53506804", "0.52389526", "0.519282", "0.5162494", "0.51319134", "0.50984526", "0.508291...
0.8340939
0
draws index for different regions
def drawIndex_region(t0, t1, t2, t3): get_pos0(t0) t0.fd(50) t0.pd() t0.pencolor("blue") t0.write("Sub-Saharan Africa", font=("Arial", 10, "bold")) t1.rt(90) get_pos1(t1) t1.fd(50) t1.pd() t1.pencolor("red") t1.write("South Asia", font=("Arial", 10, "bold")) g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawIndexLines_region(t0, t1, t2, t3):\r\n t0.pu()\r\n t1.pu()\r\n t2.pu()\r\n t3.pu()\r\n\r\n t0.rt(90)\r\n t0.fd(240)\r\n t0.left(90)\r\n t0.fd(640)\r\n\r\n t1.rt(90)\r\n t1.fd(240)\r\n t1.left(90)\r\n t1.fd(620)\r\n\r\n t2.rt(90)\r\n t2.fd(240)\r\n t2.left(90)\r\...
[ "0.7278132", "0.65021855", "0.6314981", "0.63081306", "0.6208257", "0.6096945", "0.5833721", "0.5821732", "0.58176714", "0.5713605", "0.57063395", "0.5675881", "0.5673361", "0.55971086", "0.55971086", "0.55394804", "0.5516584", "0.5502051", "0.5487764", "0.5471065", "0.546945...
0.78799367
0
returns a list of medians of life expectancies of a list of countries under Sub Saharan Africa region from 1960 to 2015
def sub_saharan_africa_countries(): sub_saharan_africa_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in sub_saharan_africa: sub_saharan_africa_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in sub_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def north_america_countries():\r\n north_america_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in north_america:\r\n north_america_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in...
[ "0.76881295", "0.7627402", "0.7583476", "0.74692076", "0.7437016", "0.70819294", "0.7006813", "0.69099957", "0.6874187", "0.67247957", "0.55833876", "0.54977113", "0.53604025", "0.53602636", "0.53228164", "0.5301231", "0.5279429", "0.5211209", "0.5171082", "0.5142252", "0.511...
0.7650562
1
returns a list of medians of life expectancies of a list of countries under South Asia region from 1960 to 2015
def south_asia_countries(): south_asia_countries_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in south_asia: south_asia_countries_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in south_asia_countr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def north_america_countries():\r\n north_america_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in north_america:\r\n north_america_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in...
[ "0.78435636", "0.77569723", "0.7716137", "0.73004186", "0.7292699", "0.71673214", "0.71292865", "0.7065693", "0.69835836", "0.6960264", "0.54727006", "0.5262739", "0.5241673", "0.52223796", "0.52219015", "0.52006936", "0.51881665", "0.5175976", "0.51192135", "0.50188416", "0....
0.7985845
0
returns a list of medians of life expectancies of a list of countries under Europe and Central Asia region from 1960 to 2015
def europe_central_asia_countries(): europe_central_asia_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in europe_central_asia: europe_central_asia_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def east_asia_pacific_countries():\r\n east_asia_pacific_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in east_asia_pacific:\r\n east_asia_pacific_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\...
[ "0.77198267", "0.75744975", "0.74780154", "0.71805763", "0.7176427", "0.7105141", "0.6993841", "0.6901811", "0.6830706", "0.66818535", "0.54685944", "0.54521793", "0.5327367", "0.53260374", "0.52117366", "0.5190211", "0.5170156", "0.5153415", "0.5144954", "0.51005596", "0.509...
0.7873929
0
returns a list of medians of life expectancies of a list of countries under North America region from 1960 to 2015
def north_america_countries(): north_america_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in north_america: north_america_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in north_america_data: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def east_asia_pacific_countries():\r\n east_asia_pacific_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in east_asia_pacific:\r\n east_asia_pacific_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\...
[ "0.76958174", "0.7619637", "0.7474777", "0.7396712", "0.72314185", "0.72068703", "0.71775454", "0.71580356", "0.7121208", "0.6816649", "0.5631868", "0.5515316", "0.54731774", "0.52937293", "0.5210382", "0.5188534", "0.51719624", "0.517113", "0.51578605", "0.515636", "0.515161...
0.78965974
0
returns a list of medians of life expectancies of a list of countries under East Pacific region from 1960 to 2015
def east_asia_pacific_countries(): east_asia_pacific_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in east_asia_pacific: east_asia_pacific_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in east_asia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def north_america_countries():\r\n north_america_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in north_america:\r\n north_america_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in...
[ "0.7664074", "0.76425236", "0.7421062", "0.7399349", "0.7230995", "0.722657", "0.7191443", "0.7057813", "0.7056686", "0.6702355", "0.5623167", "0.54896224", "0.5303246", "0.52805936", "0.52179736", "0.51864105", "0.5120541", "0.50935054", "0.50814116", "0.50631076", "0.505381...
0.80362725
0
asks the user to select which graph they want to plot
def main(): inp = input("Hit enter to draw first graph(or type 1 to draw second):") if inp == "": drawCoordinatePlane_income() drawIndexLines_income(t0, t1, t2, t3) income_graph(t0, t1, t2, t3) t.done() elif inp == '1': drawCoordinatePlane_region() dr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graphs_change():\n d = curdoc()\n _remove_fig(d)\n _remove_selection(d)\n graph_val = d.get_model_by_name(GRAPH_SELECTION).value\n model_id, message_name, model_type = run_handlers.get_modelid_messagename_type(d)\n props = run_handlers.get_model_properties(model_id, message_name, model_type)\...
[ "0.639732", "0.6286357", "0.6126755", "0.61089015", "0.6107879", "0.6055158", "0.60493314", "0.60363376", "0.5990013", "0.5972623", "0.58906865", "0.58519304", "0.5802852", "0.57793033", "0.57744956", "0.576418", "0.56951857", "0.5676766", "0.563152", "0.5610704", "0.5598076"...
0.6548505
0
Calculate top level of navigation menu to take care of 4th level menu
def calculateTopLevel(context, portlet, request=None): if portlet.topLevel != 3 or not HAS_MENU: return portlet.topLevel portal = api.portal.get() contextPhyPath = context.getPhysicalPath() portalPhyPath = portal.getPhysicalPath() path = [elem for elem in list(contextPhyPath) if elem not in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateTopLevel(context, portlet):\n if portlet.topLevel != 3 or not HAS_MENU:\n return portlet.topLevel\n portal = api.portal.get()\n contextPhyPath = context.getPhysicalPath()\n portalPhyPath = portal.getPhysicalPath()\n path = [elem for elem in list(contextPhyPath) if elem not in lis...
[ "0.71321285", "0.57847756", "0.5641548", "0.55163324", "0.550595", "0.54956126", "0.5414998", "0.539189", "0.53853977", "0.53552043", "0.5354511", "0.53424156", "0.53370595", "0.5336853", "0.5309493", "0.5305363", "0.53029245", "0.5302912", "0.5299191", "0.5290584", "0.528587...
0.6778316
1
Checks if the user has money.
def has_money(self) -> bool: return self.money > 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_user_has_enough_money(session, user_id, amount):\n user_funds = get_user_balance(session, user_id)\n if user_funds + amount < 0:\n raise NotEnoughMoneyException(\"Not enough money in your wallet!\")", "def balance_money_check():\r\n print(balance_money)", "def positive_balance_check(u...
[ "0.72290194", "0.70000076", "0.6976345", "0.67223203", "0.6660722", "0.6602281", "0.6554564", "0.65110725", "0.6492368", "0.6469948", "0.64189357", "0.6256046", "0.6249659", "0.62413937", "0.62168956", "0.6193624", "0.6191508", "0.6180676", "0.615271", "0.6132183", "0.6107606...
0.784849
0
Updates the database with the current information. This function is currently a simulation.
def update_database(self) -> None: # Simulate that we update a database time.sleep(10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.getDbRecord().update()", "def update(self):\n\n if not self.db: self.validate()\n\n self.logging.debug( \"update(%s)\" % (self.db) )\n\n for name in self.tables:\n self.dbs_tables[name]['md5'] = get_md5( self.dbs_tables[name]['path'] )\n\n se...
[ "0.76159406", "0.7392184", "0.7367425", "0.7291767", "0.7247658", "0.7247658", "0.69999254", "0.6939565", "0.68994844", "0.68132865", "0.6747768", "0.6690826", "0.6690826", "0.6690826", "0.6620711", "0.66156876", "0.6606088", "0.6606088", "0.6568157", "0.6534905", "0.65212244...
0.7799866
0
Get the location of the image in the local file system.
def _image_location(image_info): return os.path.join(tempfile.gettempdir(), image_info['id'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_location(self, imageDest, imgName) :\n return os.path.normpath(imageDest + imgName)", "def get_pathname(self):\n return self.image_data.path", "def get_image_path(self) -> Optional[str]:\n try:\n return self.localised_faces.all()[0].get_image_path()\n except...
[ "0.7270025", "0.71111804", "0.69871145", "0.6943286", "0.6910744", "0.6907894", "0.689165", "0.6874285", "0.6739917", "0.67269015", "0.67117935", "0.6685618", "0.65890384", "0.65889764", "0.65679765", "0.65447944", "0.64883924", "0.64872074", "0.64596", "0.6436543", "0.641509...
0.75856805
0
Identify if checksum is not a url
def _is_checksum_url(checksum): if (checksum.startswith('http://') or checksum.startswith('https://')): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_url(self):\n\n url = \"https://shadowrun.needs.management\"\n self.assertTrue(run(verification.is_url(url)))\n\n url = \"https:// www.google.com\"\n self.assertFalse(run(verification.is_url(url)))", "def is_url(url):\n return re.search(r\"^[a-zA-Z][-+\\.\\w]*://[^\\s]+$...
[ "0.67955256", "0.6711128", "0.6629706", "0.6590174", "0.65432364", "0.64278924", "0.64265555", "0.6420125", "0.64089924", "0.6365152", "0.6355471", "0.633363", "0.62696356", "0.62568754", "0.62489027", "0.6203447", "0.61695457", "0.6169127", "0.61661506", "0.61625254", "0.616...
0.854597
0
Fetch checksum from remote location, if needed.
def _fetch_checksum(checksum, image_info): if not _is_checksum_url(checksum): # Not a remote checksum, return as it is. return checksum LOG.debug('Downloading checksums file from %s', checksum) resp = _download_with_proxy(image_info, checksum, checksum).text lines = [line.strip() for li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_remote_hashcode(self, path):\n\t\treturn self.fetch_repo_file(\"/hash/\" + path.replace(\"packages/\", \"\")).decode('utf-8').strip()", "def _get_checksum_value(self, path, replacement):\n url = self._url.replace(path, replacement)\n r = adapter_utilities.requests_get_url_wrapper(url=url)...
[ "0.6621548", "0.62670505", "0.6246209", "0.61276025", "0.6006019", "0.5998622", "0.5937732", "0.58940667", "0.58716685", "0.5833767", "0.5813088", "0.57937276", "0.5782618", "0.5782055", "0.5768444", "0.5738386", "0.5712875", "0.5701004", "0.56596315", "0.56450033", "0.564396...
0.74518305
0
Writes a whole disk image to the specified device.
def _write_whole_disk_image(image, image_info, device): # FIXME(dtantsur): pass the real node UUID for logging disk_utils.destroy_disk_metadata(device, '') disk_utils.udev_settle() command = ['qemu-img', 'convert', '-t', 'directsync', '-S', '0', '-O', 'host_device', '-W', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_image(image_info, device, configdrive=None):\n starttime = time.time()\n image = _image_location(image_info)\n uuids = {}\n if image_info.get('image_type') == 'partition':\n uuids = _write_partition_image(image, image_info, device, configdrive)\n else:\n _write_whole_disk_im...
[ "0.6323444", "0.60408735", "0.59747845", "0.59708077", "0.5736613", "0.5731183", "0.5729069", "0.5661791", "0.5656663", "0.5638294", "0.5626332", "0.5575175", "0.5546914", "0.55326694", "0.5532495", "0.5479675", "0.54623824", "0.54249805", "0.5423954", "0.5403864", "0.5357074...
0.7741589
0
Determine the SHA2 algorithm by checksum length.
def _get_algorithm_by_length(checksum): # NOTE(TheJulia): This is all based on SHA-2 lengths. # SHA-3 would require a hint, thus ValueError because # it may not be a fixed length. That said, SHA-2 is not # as of this not being added, being withdrawn standards wise. checksum_len = len(checksum) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def HashAlgorithm(self) -> _n_7_t_0:", "def _resolve_hasher(algorithm, file_hash=None):\n if algorithm == 'sha256':\n return hashlib.sha256()\n\n if algorithm == 'auto' and file_hash is not None and len(file_hash) == 64:\n return hashlib.sha256()\n\n # This is used only for legacy purposes.\n return ha...
[ "0.63673866", "0.60331875", "0.59180725", "0.5894623", "0.57694453", "0.5698704", "0.565829", "0.55929166", "0.55559", "0.5546999", "0.5538493", "0.55226487", "0.550057", "0.5471561", "0.5461795", "0.5451725", "0.54435396", "0.53990275", "0.53709245", "0.53452957", "0.5344683...
0.77344
0
Checks if md5 is permitted, otherwise raises ValueError.
def check_md5_enabled(): if not CONF.md5_enabled: raise ValueError('MD5 support is disabled, and support ' 'will be removed in a 2024 version of ' 'Ironic.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_md5(self):\n\n self.log.info('-' * 80)\n self.log.info('Check md5 sum')\n\n self.log.info(self._ref_value)\n self.log.info(self._output_file)\n\n code, out = cmd_exec(['md5sum', self._output_file], shell=False, log=self.log)\n if code:\n self.log.erro...
[ "0.670779", "0.66090995", "0.6538745", "0.6527264", "0.63977784", "0.63788414", "0.6294754", "0.6282655", "0.6177657", "0.6153426", "0.6127971", "0.6074809", "0.6043532", "0.60397506", "0.59920514", "0.5977418", "0.597439", "0.59529215", "0.59529215", "0.59297997", "0.5926426...
0.73328245
0
Verifies the checksum of the local images matches expectations. If this function does not raise ImageChecksumError then it is very likely that the local copy of the image was transmitted and stored correctly.
def verify_image(self, image_location): checksum = self._hash_algo.hexdigest() LOG.debug('Verifying image at %(image_location)s against ' '%(algo_name)s checksum %(checksum)s', {'image_location': image_location, 'algo_name': self._hash_algo.name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testChecksumCondition(self):\n file_defs = [\n {'name': 'file_0_byte.txt', 'path': '', 'size': 0},\n {'name': 'file_1_byte.txt', 'path': '', 'size': 1},\n {'name': 'file_320k_minus 1_byte.txt', 'path': 'folder1', 'size': 320 * 1024 - 1, 'mod_inc': -1},\n ...
[ "0.64813644", "0.5933218", "0.5920034", "0.5915917", "0.5913081", "0.59013367", "0.5858877", "0.58465624", "0.5839293", "0.5838658", "0.5833695", "0.58166033", "0.5802921", "0.57959175", "0.57829624", "0.5775084", "0.5745312", "0.57087827", "0.5661978", "0.5660748", "0.565807...
0.7228067
0
Property value to return the number of bytes transferred.
def bytes_transferred(self): return self._bytes_transferred
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BytesTransferred(self) -> int:", "def num_bytes(self) -> str:\n return pulumi.get(self, \"num_bytes\")", "def __len__(self):\n return len(self.bytes)", "def num_bytes(self):\n if self._num_bytes is None:\n status, info = self._resource._file.stat(\n timeout=...
[ "0.7957637", "0.72188973", "0.72182286", "0.7116724", "0.7116724", "0.70890856", "0.7017371", "0.7000203", "0.69469666", "0.692903", "0.6909466", "0.6889679", "0.6888642", "0.6877114", "0.6858719", "0.6853", "0.6848012", "0.6818101", "0.68149185", "0.6809503", "0.67906845", ...
0.8315916
0
Validates the image_info dictionary has all required information.
def _validate_image_info(ext, image_info=None, **kwargs): image_info = image_info or {} checksum_avail = False md5sum_avail = False os_hash_checksum_avail = False for field in ['id', 'urls']: if field not in image_info: msg = 'Image is missing \'{}\' field.'.format(field) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_missing_info(self):\r\n self.validate(None, None,\r\n N_image_shape=(3, 2, 8, 8),\r\n N_filter_shape=(4, 2, 5, 5))\r\n self.validate((3, 2, None, None), None,\r\n N_image_shape=(3, 2, 8, 8),\r\n N_filter_shap...
[ "0.6829416", "0.64101285", "0.6372421", "0.6283547", "0.62626284", "0.623681", "0.61904836", "0.6102994", "0.6038631", "0.6016138", "0.5986248", "0.59705144", "0.59603906", "0.59208983", "0.589194", "0.5877769", "0.5828762", "0.5828762", "0.58162236", "0.5749991", "0.56880915...
0.74150187
0
Validate the final partition table. Check if after writing the image to disk we have a valid partition table by trying to read it. This will fail if the disk is junk.
def _validate_partitioning(device): try: # Ensure we re-read the partition table before we try to list # partitions utils.execute('partprobe', device, run_as_root=True, attempts=CONF.disk_utils.partprobe_attempts) except (processutils.UnknownArgumentError, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_disk_size(self):\n if self.skip_disk_space_check:\n return True\n\n self.table_size = int(self.get_table_size(self.table_name))\n dump_size = int(self.get_expected_dump_size(self.table_name))\n disk_space = int(util.disk_partition_free(self.outfile_dir))\n # ...
[ "0.63102293", "0.62371194", "0.6020164", "0.59953326", "0.57650995", "0.5762729", "0.57039857", "0.57000345", "0.56442827", "0.55840147", "0.5523122", "0.5465158", "0.54439074", "0.538946", "0.5389009", "0.53505623", "0.5338153", "0.5333453", "0.53331393", "0.5261127", "0.525...
0.75619286
0
Cache an image and write it to a local device.
def _cache_and_write_image(self, image_info, device, configdrive=None): _download_image(image_info) self.partition_uuids = _write_image(image_info, device, configdrive) self.cached_image_id = image_info['id']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cache_image(self, event: str, image):\n image_path = self.history_image_path(event)\n tmp_filename = \"\"\n image_dir = os.path.split(image_path)[0]\n _LOGGER.debug(\"Save camera photo to %s\", image_path)\n if not os.path.exists(image_dir):\n os.makedirs(image_di...
[ "0.7174358", "0.7164342", "0.70680064", "0.7064031", "0.70357573", "0.69947386", "0.6844347", "0.67205036", "0.6550955", "0.6152098", "0.61229587", "0.6080348", "0.60026", "0.5944168", "0.5906471", "0.58985215", "0.5875219", "0.58504903", "0.58280385", "0.57820386", "0.577248...
0.7460007
0
Streams raw image data to specified local device.
def _stream_raw_image_onto_device(self, image_info, device): starttime = time.time() total_retries = CONF.image_download_connection_retries for attempt in range(total_retries + 1): try: image_download = ImageDownload(image_info, time_obj=starttime) wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_image(self, device_id, image):\n self.logger.debug(f\"{device_id}: sending processed image!\")\n base64_img = base64.b64encode(\n cv2.imencode('.jpg', image)[1].tostring())\n self.socketio.emit(\n \"image\", {\"message\": base64_img}, room=f\"device-{device_id}\"...
[ "0.5345032", "0.5286425", "0.5225742", "0.51191074", "0.50935507", "0.5064945", "0.50522405", "0.49928376", "0.49729043", "0.49509344", "0.49202582", "0.4889088", "0.4863438", "0.4853132", "0.4849005", "0.48228058", "0.48110718", "0.47815132", "0.47463894", "0.47404286", "0.4...
0.6818737
0
Asynchronously prepares specified image on local OS install device. In this case, 'prepare' means make local machine completely ready to reboot to the image specified by image_info. Downloads and writes an image to disk if necessary. Also writes a configdrive to disk if the configdrive parameter is specified.
def prepare_image(self, image_info, configdrive=None): LOG.debug('Preparing image %s', image_info['id']) # NOTE(dtantsur): backward compatibility if configdrive is None: configdrive = image_info.pop('configdrive', None) device = hardware.dispatch_to_managers('get_os_install_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cache_and_write_image(self, image_info, device, configdrive=None):\n _download_image(image_info)\n self.partition_uuids = _write_image(image_info, device, configdrive)\n self.cached_image_id = image_info['id']", "def cache_image(self, image_info, force=False, configdrive=None):\n ...
[ "0.61373055", "0.5932022", "0.58297837", "0.5641948", "0.5422074", "0.53789437", "0.5355548", "0.5333866", "0.5305039", "0.5210984", "0.5166904", "0.5160415", "0.51545095", "0.5135883", "0.51172787", "0.5077922", "0.5063657", "0.50623053", "0.5020906", "0.5016245", "0.5012629...
0.78571266
0
Run the shutdown or reboot command
def _run_shutdown_command(self, command): # TODO(TheJulia): When we have deploy/clean steps, we should remove # this upon shutdown. The clock sync deploy step can run before # completing other operations. self._sync_clock(ignore_errors=True) if command not in ('reboot', 'powerof...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown():\n os.system(\"sudo shutdown now\")", "def reboot():\n if not required():\n return \"Kernel reboot not required\"\n cmd_str = 'shutdown -r +1 \"Server is going down for kernel upgrade\"'\n Popen([cmd_str], shell=True, stdin=None,\n stdout=None, stderr=None, close_fd...
[ "0.7731829", "0.7347262", "0.7337728", "0.7152013", "0.7128588", "0.70234734", "0.70224255", "0.6965964", "0.6880892", "0.6878727", "0.68633", "0.68391895", "0.68310267", "0.6743067", "0.6679534", "0.66542256", "0.6654123", "0.6637868", "0.6637379", "0.66303295", "0.66051185"...
0.7438582
1
Runs image on agent's system via reboot.
def run_image(self): LOG.info('Rebooting system') self._run_shutdown_command('reboot')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reboot(self):\n raise NotImplementedError", "def external_reboot(info):\n\n text, reason = info\n SysTools.reboot(reason)", "def reboot(self, *args, **kwargs):\n log_tag = self.get_log_tag()\n self.logger.info(\"{} Attempting to reset the Treerunner board\"\n ...
[ "0.69385177", "0.68277025", "0.6792417", "0.66663486", "0.66571987", "0.66274637", "0.6605065", "0.652732", "0.6526463", "0.64705724", "0.6427431", "0.63956904", "0.63891965", "0.6374544", "0.63547057", "0.6338393", "0.63373744", "0.63192075", "0.63185483", "0.6287356", "0.62...
0.8678054
0
Powers off the agent's system.
def power_off(self): LOG.info('Powering off system') self._run_shutdown_command('poweroff')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def powerOff(self):\n self._sendCommand(self.SONY_CMD_ExtBackupCommunicator_ForcePowerOff, bufferSize=0)", "async def power_off(self):\n ...", "def systemOff():\n # Updated 11/19/16\n I2C.write_byte_data(Valve_bus, pinOut_O, 0x00 )\n I2C.write_byte_data(Pump_Mag_bus, pinOut_O, 0x00)", "async...
[ "0.7070646", "0.6922541", "0.662973", "0.6623043", "0.6576769", "0.6501467", "0.6488038", "0.6456454", "0.64498055", "0.6436767", "0.6434931", "0.6412994", "0.64061755", "0.6384542", "0.6366528", "0.63192016", "0.6312006", "0.63031405", "0.6302914", "0.62978655", "0.6295983",...
0.74974024
0
Flush file system buffers forcing changed blocks to disk.
def sync(self): LOG.debug('Flushing file system buffers') try: utils.execute('sync') except processutils.ProcessExecutionError as e: error_msg = 'Flushing file system buffers failed. Error: %s' % e LOG.error(error_msg) raise errors.CommandExecution...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _flush(self):\r\n\r\n fh = open(self.filename, \"a\")\r\n fh.write(\"\".join(self.buffer))\r\n fh.close()\r\n\r\n self.buffer = []", "def flush_buffers(self):\n\n for file_dictionary in [self.infiles, self.outfiles]:\n for name, fi in file_dictionary.items():\n ...
[ "0.75430226", "0.7511212", "0.7423708", "0.7305217", "0.72343165", "0.7155582", "0.712694", "0.710647", "0.70842326", "0.7073423", "0.7058113", "0.69757587", "0.6940303", "0.6929731", "0.69257444", "0.6846642", "0.6831325", "0.68252045", "0.68020684", "0.6722753", "0.6722753"...
0.7694749
0
Get loader class for a dataset.
def get_loader(dataset_name, **kwargs): if dataset_name == "rostd": loader = partial_class(ROSTDLoader, data_root_dir="data/rostd", use_coarse_labels=False) elif dataset_name == "rostd_coarse": loader = partial_class(ROSTDLoader, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loader(self):\n return self.loader_class()", "def get_cls(dataset_name):\n return find_dataset_using_name(dataset_name)", "def init_loader(dataset):\n if dataset == 'chaos':\n return ChaosLoader()\n return None", "def get_data_loader(\n name: str, **kwargs) -> data_loader.DataLo...
[ "0.746107", "0.6963209", "0.6959952", "0.68778324", "0.665751", "0.66192013", "0.6553479", "0.6545444", "0.65317357", "0.6488149", "0.6470945", "0.6427437", "0.63847756", "0.63402325", "0.6329773", "0.6324222", "0.63233507", "0.62848765", "0.6283929", "0.6254267", "0.625302",...
0.7470058
0
Return True if the timestamp is within the filtered range.
def is_within_range(self, timestamp): if self._no_filtering: return True ts = time.struct_time(( self._start.tm_year, self._start.tm_mon, self._start.tm_mday, timestamp.hour, timestamp.minute, timestamp.second, self._start.tm_wday, self._start.tm_yday, se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def within_threshold(self, other):\n if abs(other.ts - self.ts) < TIME_THRESHOLD:\n return True\n return False", "def within_time_interval(self, from_time, to_time, time):\n\t\tif from_time == None:\n\t\t\tif to_time == None:\n\t\t\t\treturn True\n\t\t\telse:\n\t\t\t\treturn bool(time <=...
[ "0.675669", "0.67546004", "0.66915435", "0.666187", "0.6656196", "0.6534372", "0.6418472", "0.6381407", "0.63664734", "0.6338443", "0.62505734", "0.62325436", "0.62271273", "0.62031996", "0.6198777", "0.61113006", "0.6110163", "0.6054065", "0.6018648", "0.60164005", "0.596743...
0.8684515
0
Return the simulation of the resolution
def get_simulation_resolution(settings: SimulationSettingsModel): return timedelta(seconds=settings.project.step_resolution_sec)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolution(self):\n return Prism.resolution(self,self.beam,self.wavelength)", "def make_simulation(self):\n if self.skip_reference:\n self.units = 'time steps per second'\n else:\n self.units = 'calls per second'\n\n self.reference_sim, self.compare_sim = sel...
[ "0.6900691", "0.6561556", "0.6413628", "0.63199735", "0.63027394", "0.62969726", "0.62730795", "0.6152061", "0.6115921", "0.5950889", "0.59448564", "0.5923001", "0.58970904", "0.5887493", "0.5887381", "0.58404", "0.5833304", "0.58197236", "0.5795295", "0.5785967", "0.57474697...
0.6709174
1
Return the start time, step time, and end time from the settings.
def create_time_range_from_settings(settings: SimulationSettingsModel): start_time = get_start_time(settings) end_time = start_time + timedelta(minutes=settings.project.simulation_duration_min) step_time = get_simulation_resolution(settings) return start_time, end_time, step_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_start_time(settings: SimulationSettingsModel):\n return settings.project.start_time", "def __get_times(self):\n data = self.simulate_file.readlines()\n data = list(map(str.strip, data))\n data = list(map(float, data))\n start = data[0]\n times = data[1:]\n ret...
[ "0.67618924", "0.6756509", "0.6688929", "0.64605314", "0.6407463", "0.6403378", "0.63651186", "0.63542116", "0.6330691", "0.63102907", "0.6257525", "0.6255249", "0.62505156", "0.62222517", "0.6194169", "0.61568725", "0.61469734", "0.6144589", "0.61044663", "0.6078161", "0.601...
0.74676275
0
Return time indices created from the simulation settings.
def create_datetime_index_from_settings(settings: SimulationSettingsModel): start_time, end_time, step_time = create_time_range_from_settings(settings) data = [] cur_time = start_time while cur_time < end_time: data.append(cur_time) cur_time += step_time return pd.DatetimeIndex(data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_indices(self, df):\r\n X = np.empty((df.shape[0], 3), dtype=np.float64)\r\n X[:, 0] = df.index.year\r\n X[:, 1] = df.index.month\r\n X[:, 2] = df.index.day\r\n return X", "def time_list(self):\n return (self.N_T * (np.arange(self.N_itr) + 1) /\n s...
[ "0.6130192", "0.600492", "0.5967918", "0.5965704", "0.59274644", "0.5879071", "0.5861965", "0.5861965", "0.5861965", "0.5844066", "0.5777731", "0.5748875", "0.56899023", "0.5667132", "0.5645093", "0.5626598", "0.56251013", "0.5620724", "0.5612228", "0.5569333", "0.5551456", ...
0.6180948
0
Return a loadshape dataframe representing all available data. This assumes that a loadshape has been selected in OpenDSS.
def create_loadshape_pmult_dataframe(settings: SimulationSettingsModel): start_time = settings.project.loadshape_start_time data = dss.LoadShape.PMult() interval = timedelta(seconds=dss.LoadShape.SInterval()) npts = dss.LoadShape.Npts() indices = [] cur_time = start_time for _ in range(npts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_to_lay(self) -> pd.DataFrame:\n if not self.data_is_loaded:\n self.load_data()\n\n return self._available_to_lay", "def dataframe(self):\n if not self.all_records:\n print('No rows cached.')\n return\n dict_list = [row.as_dict() for row i...
[ "0.6330568", "0.6241007", "0.623866", "0.62355924", "0.6206864", "0.6149052", "0.61322594", "0.6111406", "0.6104934", "0.6099539", "0.6048846", "0.5989554", "0.597556", "0.5946196", "0.59261596", "0.5890683", "0.5890246", "0.58660966", "0.5862521", "0.58139795", "0.5796813", ...
0.6537646
0
Return a loadshape pmult dataframe that only contains time points used by the simulation. This assumes that a loadshape has been selected in OpenDSS.
def create_loadshape_pmult_dataframe_for_simulation(settings: SimulationSettingsModel): df = create_loadshape_pmult_dataframe(settings) simulation_index = create_datetime_index_from_settings(settings) return df.loc[simulation_index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_loadshape_pmult_dataframe(settings: SimulationSettingsModel):\n start_time = settings.project.loadshape_start_time\n data = dss.LoadShape.PMult()\n interval = timedelta(seconds=dss.LoadShape.SInterval())\n npts = dss.LoadShape.Npts()\n\n indices = []\n cur_time = start_time\n for _ ...
[ "0.7490958", "0.5829951", "0.5621119", "0.53631383", "0.52734464", "0.51956564", "0.51909745", "0.51639205", "0.51525396", "0.51212883", "0.5091097", "0.5029446", "0.49741325", "0.49019918", "0.48935086", "0.48498857", "0.47839516", "0.47479317", "0.4738494", "0.47346386", "0...
0.69172424
1
Read filename into a pandas Dataframe and extract items in ids_df. It reads items (flights, positions or events) from filename into a pandas Dataframe and merges the items with ids_df on FLIGHT_ID as a UUID. It writes a copy of the Dataframe items WITHOUT mathing ids into a file called 'new_' + filename Returns a panda...
def extract_next_day_items(filename, ids_df, date_fields=[]): # An empty data frame to return new_items_df = pd.DataFrame() next_df = pd.DataFrame() try: if date_fields: next_df = pd.read_csv(filename, parse_dates=date_fields, converters={'FLIGHT_ID...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_dataframe_with_new_ids(filename, ids_df, *, date_fields=['TIME']):\n df = pd.read_csv(filename, parse_dates=date_fields, memory_map=True)\n return pd.merge(ids_df, df, left_index=True, right_on='FLIGHT_ID')", "def extract_overnight_data(filenames):\n day_ids_filename = filenames[0]\n\n fligh...
[ "0.7330701", "0.5534461", "0.54933244", "0.5378836", "0.52908814", "0.52467626", "0.5233091", "0.52184945", "0.5193366", "0.5172495", "0.51131463", "0.51092166", "0.50987095", "0.509562", "0.5085387", "0.50284123", "0.49850348", "0.4975146", "0.49732038", "0.49651432", "0.496...
0.71169
1
Extract flights, postions and events for the previosu day from the data. It writes items (flights, positions or events) WITHOUT ids in the ids file into files with 'new_' prepended to the filename. It writes positions and events with ids in the ids file into positions and files for the previus day, with the ids replace...
def extract_overnight_data(filenames): day_ids_filename = filenames[0] flights_filename = filenames[1] positions_filename = filenames[2] events_filename = filenames[3] # Extract date strings from the input filenames and validate them input_date_strings = [''] * len(input_filenames) for i i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_next_day_items(filename, ids_df, date_fields=[]):\n # An empty data frame to return\n new_items_df = pd.DataFrame()\n\n next_df = pd.DataFrame()\n try:\n if date_fields:\n next_df = pd.read_csv(filename, parse_dates=date_fields,\n converter...
[ "0.6062551", "0.5563013", "0.5444974", "0.54346234", "0.53789616", "0.535099", "0.52633065", "0.52605945", "0.5228094", "0.518463", "0.51673555", "0.50466776", "0.5044268", "0.50004363", "0.4950038", "0.4941842", "0.4930765", "0.4920016", "0.49200147", "0.4890476", "0.4878595...
0.65628237
0
Transfers radii data for the common points
def transferRadii(points_from, radii_from, points_to, radii_to): # assume points are sorted lists of indices match = ld.match(points_from, points_to); ids = ld.where(match >= 0); match = ld.take(match, ids); radii = ld.take(radii_from, ids); ld.setArray(radii_to, match, radii); return radii_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def radialCopy(self, bufr, x=0, y=0, z=0, startRadius=2.0, endRadius=2.0,\r\n startAngle=0.0, endAngle=360.0, step=12):\r\n st = (endAngle - startAngle) / step\r\n rst = (endRadius - startRadius) / int(st)\r\n rd = startRadius\r\n sta = startAngle\r\n\r\n blist = []\r\n for r in r...
[ "0.5525771", "0.5510386", "0.5225015", "0.51187915", "0.5077811", "0.5011259", "0.5009781", "0.49644858", "0.49623564", "0.4959181", "0.4942424", "0.49414128", "0.49405032", "0.49126655", "0.4907", "0.48982129", "0.48980373", "0.48855355", "0.48623767", "0.4856129", "0.485331...
0.6246936
0
Populate the controls values. Populate the controls values from the custom attributes of the component.
def populate_componentControls(self): # populate tab self.tabs.insertTab(1, self.settingsTab, "Component Settings") refArrayItems = self.root.attr("ikrefarray").get().split(",") for item in refArrayItems: self.settingsTab.refArray_listWidget.addItem(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_attr_list(self) -> None:\n old_flex_grid = self.flex_grid\n self.flex_grid = wx.FlexGridSizer(cols=3, vgap=5, hgap=10)\n wx_elements = []\n for attr_id in self.attr_ids:\n button = self.attr_buttons[attr_id]\n label_input = self.attr_labels[attr_id]\n ...
[ "0.6279057", "0.62399703", "0.60799664", "0.59515196", "0.5895168", "0.5884753", "0.5754655", "0.57229865", "0.5706931", "0.56097054", "0.5600419", "0.5594037", "0.5593972", "0.5583099", "0.5580033", "0.5559879", "0.5532323", "0.5515915", "0.55016774", "0.54932463", "0.549234...
0.62719935
1
Parse sudoku puzzle into lists of horizontal bars
def parse_puzzle(puzzle): puzzle = re.sub("\sGrid \d{2}","", sample) puzzle = puzzle.strip().split("\n") return puzzle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parsePuzzle(fileName):\n data = []\n f = open(fileName, 'r')\n for line in f:\n splitLine = line.split(sep=\" \")\n row = []\n if len(splitLine) >= 9:\n for i in range(9):\n row.append(int(splitLine[i]))\n data.append(row)\n f.close()\n retur...
[ "0.62196636", "0.6099618", "0.6039913", "0.60288465", "0.5915466", "0.58174556", "0.57508373", "0.57166475", "0.5710631", "0.57069427", "0.56989294", "0.56715757", "0.5657205", "0.55930203", "0.5587946", "0.5585172", "0.5571849", "0.5559757", "0.5553917", "0.5527363", "0.5512...
0.665639
0
Find DS9 window with ds9_name if it exists
def check_for_ds9(ds9_name): ds9 = False if platform.system().lower() == 'darwin': processes = os.popen('ps aux | grep {}'.format(ds9_name)).readlines() else: processes = os.popen('ps aux --cols 1024 | grep {}'.format(ds9_name)).readlines() for process in processes: if "ds9" in p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_window_by_name(self, name):\n for window in self.windows:\n if window.name == name:\n return window\n else:\n raise ValueError(\"No source with that name.\")", "def find_window(**kwargs):\r\n try:\r\n kwargs['backend'] = 'win32'\r\n elem...
[ "0.6427394", "0.6138715", "0.6070238", "0.6070238", "0.59566784", "0.59566784", "0.5802954", "0.5770843", "0.5705655", "0.5681872", "0.5494898", "0.547359", "0.53805435", "0.53779405", "0.5368971", "0.53643894", "0.53633446", "0.5353856", "0.5212151", "0.5200518", "0.51943207...
0.7949997
0
Start up a DS9 window. Doing it like this is much more robust than using pyds9.
def start_ds9(ds9_name): os.system('ds9 -title {} &'.format(ds9_name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init():\n if len(sys.argv) > 1:\n xid = sys.argv[1]\n else:\n xid = \"JS9\"\n j = pyjs9.JS9(id=xid)\n displayMessage(j, 'Start pyjs9.JS9(id={})'.format(xid))\n j.BlendDisplay(False)\n j.SetRGBMode(False)\n closeDisplay(j)\n return j", "def openCmdWindow(self): \n ...
[ "0.66212666", "0.62966526", "0.62417", "0.62284756", "0.6217704", "0.6153588", "0.6129243", "0.6115105", "0.6100095", "0.6047786", "0.6033856", "0.60008264", "0.5988808", "0.5970348", "0.59587115", "0.5958246", "0.5957658", "0.59339213", "0.5931745", "0.59217477", "0.59165937...
0.6965974
0
Read in ds9 regions from the ref image region file (if it exists) We assume that targets have proper named regions and that comparison stars have integer IDs (e.g. Comps = 1, 2, 3, 4 and Target = WASP148b)
def read_ds9_region_file(filename, fits_file_extension='.f', index_offset=1.0): filename = '{0:s}.reg'.format(filename.split(fits_file_extension)[0]) print('Looking for {0:s}'.format(filename)) try: f = pyregion.open(filename) except FileNotFoundError: print('File not found, do photometr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_new_region_mask():\n nreg = len(region_ind_new)\n# region_mask_file = '/home/ivan/Python/new_REGION_MASK_gx3v5.nc'\n region_mask_file = '/glade/home/emunoz/Python/mapping/model_grid/new_REGION_MASK_gx3v5.nc'\n fpreg = Nio.open_file(region_mask_file, 'r')\n region_mask ...
[ "0.5933103", "0.59109664", "0.5897308", "0.57201207", "0.56979305", "0.5669471", "0.5631514", "0.56129783", "0.56102836", "0.5565435", "0.54927933", "0.548975", "0.54692644", "0.5439447", "0.5394136", "0.5377214", "0.53687364", "0.53686196", "0.52797765", "0.52769166", "0.523...
0.70787835
0
Returns a tuple (key, data) for a the whose ID ends with the token 'suffix' eg. id_ends_with('chapterxii') > 'documenta/titlevii/chapterxii' (first match) (and should be only)
def id_ending_with(self, suffix): node = [(key, data) for key, data in self.traverse() if data['id'].endswith(suffix)] if node: return node[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_ends_with(self, id_ends_with):\n\n self._id_ends_with = id_ends_with", "def id_ends_with(self, id_ends_with):\n\n self._id_ends_with = id_ends_with", "def id_ends_with(self, id_ends_with):\n\n self._id_ends_with = id_ends_with", "def id_ends_with(self, id_ends_with):\n\n se...
[ "0.5396958", "0.5396958", "0.5396958", "0.5396958", "0.5396958", "0.53473395", "0.5153632", "0.5140553", "0.48913127", "0.48777017", "0.4877162", "0.485609", "0.48165828", "0.47987914", "0.47977215", "0.47852114", "0.47657573", "0.4761049", "0.473186", "0.47116792", "0.468389...
0.76647204
0
search for nodes whose 'meta' match a given pattern
def search(self, pattern): result = None for node, data in self.traverse(): if pattern in data['meta']: return node, data return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_by_pattern(self, pattern, key=lambda data: data['meta']):\n result = []\n for node, data in self.traverse():\n if re.search(pattern, key(data), flags=re.VERBOSE):\n result.append([node, data])\n return result", "def retrieve_meta(meta_text):\n\n with o...
[ "0.6359779", "0.6054582", "0.5847992", "0.5576674", "0.55236894", "0.5495992", "0.54890645", "0.54569626", "0.5273985", "0.5238845", "0.5232473", "0.5217748", "0.5207013", "0.5205651", "0.5182594", "0.5180747", "0.5167339", "0.51414347", "0.51159734", "0.5104405", "0.5090397"...
0.7677935
0
Searches for nodes whose 'meta' match a given pattern. Whitespaces in the pattern are ignored. To include whitespaces, use '\s'
def search_by_pattern(self, pattern, key=lambda data: data['meta']): result = [] for node, data in self.traverse(): if re.search(pattern, key(data), flags=re.VERBOSE): result.append([node, data]) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(self, pattern):\n result = None\n for node, data in self.traverse():\n if pattern in data['meta']:\n return node, data\n return result", "def retrieve_meta(meta_text):\n\n with open(meta_text) as f:\n meta = f.readlines()\n matchers = ['RADIANC...
[ "0.7267663", "0.5854621", "0.5834561", "0.5595308", "0.5595308", "0.54272485", "0.5408595", "0.53356975", "0.5223814", "0.521578", "0.5161457", "0.5109456", "0.50736016", "0.5072169", "0.50675434", "0.5061934", "0.5032716", "0.4989821", "0.4971602", "0.4934386", "0.49111143",...
0.59036064
1
Return all paragraphs of the graph These are the ones which have the depth equal to 'max_depth' as detected in the construction of the Doc
def paragraphs(self, data=True): return self.nodes(self.max_depth, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score_max_depths(graph, max_depths):\n ###TODO\n pass", "def max_depth(self):\r\n lvl = 1\r\n has_lvl_desc = True\r\n while has_lvl_desc:\r\n num_children = len(self.level_n_descendants(lvl))\r\n if num_children==0:\r\n has_lvl_desc = False\r\n ...
[ "0.5418392", "0.5390383", "0.53330386", "0.5256559", "0.5252129", "0.5224893", "0.5178781", "0.51128185", "0.5104857", "0.50362504", "0.5033652", "0.50065494", "0.49520886", "0.4951647", "0.49241233", "0.49088892", "0.4897008", "0.4875365", "0.48643565", "0.48632002", "0.4844...
0.61820894
0
returns the level of the document. returns None if the document does not have the level field
def get_level(self): try: return self.root_node()['document_level'] except KeyError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_level(self, level):\n return", "def getLevel(self):\n return self._level", "def getLevel(self):\n return self.level", "def level(self) -> pulumi.Input[Union[str, 'Level']]:\n return pulumi.get(self, \"level\")", "def level(self):\n return self._level", "def level(se...
[ "0.7229525", "0.7134172", "0.70112604", "0.69806916", "0.69539994", "0.69539994", "0.69539994", "0.69539994", "0.69499403", "0.6930254", "0.69154507", "0.69154507", "0.6851163", "0.6846561", "0.679262", "0.66974926", "0.6696177", "0.668854", "0.666606", "0.6616842", "0.661064...
0.8458222
0
adds to 'ref' to the list of 'level' from node with 'node_key'. if level is None, 'ref' is added to 'unknown' field
def append_references_for_level(self, node_key, level, ref, ref_key='references'): if level: level_key = "level_{}".format(level) self.node(node_key)[ref_key][level_key].append(ref) else: # unknown level references self.node(node_key)[ref_key]['unknown'].a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_level_node(self, level, node):\n self.levels[level].append(node)", "def __assign_level(vertex: \"Vertex\", level, already_assigned: \"List[Vertex]\"):\n vertex.level = level\n already_assigned.append(vertex)\n for neighbour in vertex.neighbours:\n if neighbour not in already_assign...
[ "0.6152145", "0.5897589", "0.57109284", "0.54680127", "0.5446417", "0.5319803", "0.5271993", "0.52598345", "0.5164526", "0.51364", "0.5130477", "0.50943375", "0.5052482", "0.50303316", "0.49876687", "0.49844113", "0.49324152", "0.4926889", "0.49159244", "0.4914638", "0.489826...
0.7866178
0
Reads data from buffer or fileas pandas.DataFrame. Gets the same arguments like pandas.read_csv and pandas.read_xlsx.Uses proper function depending on file extension.
def read_data(file_name: str, buffer=None, **kwargs) -> pd.DataFrame: file_name = file_name.strip() extension = file_name.split('.')[-1].lower() if extension in _read_methods.keys(): if not buffer: if os.path.exists(os.path.dirname(file_name)): data = _read_methods[ext...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read(**kwargs) -> DataFrame:\n Engine.subscribe(_update_engine)\n\n try:\n pd_obj = FactoryDispatcher.read_csv_glob(**kwargs)\n except AttributeError:\n raise AttributeError(\"read_csv_glob() is only implemented for pandas on Ray.\")\n\n # This happens when `read_csv` returns a TextF...
[ "0.68633926", "0.68517303", "0.67032105", "0.6589057", "0.6454073", "0.6440621", "0.6402511", "0.6398542", "0.6308621", "0.6294428", "0.62939626", "0.6235024", "0.62328905", "0.6164969", "0.61351067", "0.6109234", "0.6075392", "0.6034535", "0.60162234", "0.60016567", "0.59829...
0.8271098
0
Extracts numeric data from data frame.
def generate(data: pd.DataFrame) -> np.ndarray: # TODO tests return data.apply(pd.to_numeric, errors='coerce')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numerical(df):\r\n numerical_var=df.select_dtypes(include =['float64','int64']).columns.tolist()\r\n return numerical_var", "def to_numeric_and_downcast_data(df: pd.DataFrame):\n fcols = df.select_dtypes('float').columns\n \n icols = df.select_dtypes('integer').columns\n\n df[fcols] = df[fc...
[ "0.68702966", "0.6694755", "0.66763884", "0.64964706", "0.64431477", "0.6339765", "0.6318618", "0.62212825", "0.6188818", "0.6180477", "0.6180477", "0.61722237", "0.6133824", "0.6118984", "0.61136556", "0.61007285", "0.60193545", "0.6014912", "0.59691006", "0.5872021", "0.575...
0.69502586
0
Adds a data object to the model. Returns ``True`` if the data is added, ``False`` if it already exists.
def add(self, data, check_exists=True): # pragma: no cover raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, data):\n if self._filter(data):\n id = self.db._generate_id(data)\n \n if not id == None:\n if self.db._store:\n self.db.append(id, str(data))\n print id, \"stored to\", self.db._generate_path(id)\n ...
[ "0.6855881", "0.64367086", "0.64271164", "0.6368598", "0.63621277", "0.632321", "0.6243308", "0.622728", "0.61799115", "0.6144527", "0.6129624", "0.61270493", "0.60899985", "0.60830754", "0.6047187", "0.6044599", "0.6043049", "0.6003577", "0.5997839", "0.5997839", "0.59928507...
0.7521084
0
Traverse the results and build a sunburst JSON graph in the direction indicated by source/target i.e. to build all outgoing edges, specify 's' and 'o', respectively otherwise, specify 'o' and 's'.
def traverse(uri, results, source='s', target='o', visited={}, depth=0, maxdepth=2): log.info("{} Traversing from {} to {}".format(" "*depth*10, source, target)) # log.debug(visited) if uri in visited.keys(): log.debug(u"{} Already visited {}".format(" "*depth*10, uri)) return visited[uri],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_graph(self):\n pass", "def build_graph(self):\n pass", "def generate(data, to_json=False, mode=\"freeform\"):\n labels, source, target, value, hovers = [], [], [], [], []\n indexes = {}\n indexes[json.dumps(None)] = 0\n labels.append(\"\")\n # data = find_json(data)\n ...
[ "0.55486494", "0.54975", "0.54811525", "0.53844243", "0.5366358", "0.53252655", "0.5289647", "0.52726734", "0.52513504", "0.51819783", "0.5175104", "0.5144242", "0.511471", "0.5108206", "0.50985456", "0.5093325", "0.50592774", "0.5034893", "0.5016158", "0.4995689", "0.4975789...
0.6025018
0
Used to create or update a CodeRequest. When project container is null then a new instance is created in the database
def save_code(request, template, pk, ck="", coding=None): # User must have permission to add new CodeRequest if not is_user_allowed(request.user, "canaddcode"): raise Http404 doc_form = DocNameForm() link_form = LinkImplementationForm() tag_form = modelform_factory(ProjectTag, form=TagForm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self, data):\n conn = pecan.request.db_conn\n try:\n project = db_models.Project(**data.as_dict())\n return conn.create_project(request.context, project)\n except Exception:\n LOG.exception('Fail to create project: %s' % data.as_dict())\n ra...
[ "0.5522651", "0.5492756", "0.5460612", "0.5429724", "0.5417926", "0.5395396", "0.5393321", "0.533603", "0.5313119", "0.53115845", "0.52807707", "0.52599657", "0.5236658", "0.51332843", "0.51265097", "0.5122707", "0.51193553", "0.5109384", "0.508615", "0.5071241", "0.5050269",...
0.5616324
0
Returns all 3x3 slices of the board corresponding to neighbors for all cells on the board.
def get_all_neighbors(self): m, n = self.board.shape return as_strided(self.expanded_board, shape = (m,n,3,3), strides = self.expanded_board.strides + self.expanded_board.strides)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(i: int, j: int) -> np.array:\n k, l = (i//3)*3, (j//3)*3 # noqa E741\n return np.array([\n np.r_[i:i:8j, 0:i, i + 1:9, np.repeat(np.r_[k:i, i + 1:k + 3], 2)],\n np.r_[0:j, j + 1:9, j:j:8j, np.tile(np.r_[l:j, j + 1:l + 3], 2)],\n ], dtype=np.uint8)", "def four_neighbors(self,...
[ "0.6740089", "0.66890025", "0.66793936", "0.6594341", "0.65792316", "0.6524311", "0.6460481", "0.63912827", "0.6384827", "0.6378845", "0.63124657", "0.6298454", "0.62896365", "0.62230825", "0.61602503", "0.6158862", "0.6150496", "0.6133123", "0.61103034", "0.6041652", "0.6035...
0.79104733
0
Adds a css class to a given widget
def add_class_to_widget(widget, *css_classes): css_string = " ".join(css_classes) if 'class' in widget.attrs: widget.attrs['class'] += ' {} '.format(css_string) else: widget.attrs['class'] = css_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_css_class(kwargs, class_name):\n if \"className\" in kwargs:\n kwargs[\"className\"] += f\" {class_name}\"\n else:\n kwargs[\"className\"] = class_name", "def css_class(self):\n css_type = self.widget_type\n css_title = normalizer.normalize(self.data.title)\n r...
[ "0.6818847", "0.6212503", "0.6212503", "0.6199012", "0.59537244", "0.5752197", "0.56573015", "0.5592669", "0.5570389", "0.5429877", "0.5406586", "0.5379224", "0.537465", "0.5230199", "0.5168412", "0.5157973", "0.51225984", "0.5120061", "0.501813", "0.49978387", "0.4995106", ...
0.82613933
0
receive image, get emotion
def emotion(): if request.method == 'POST': # get image image = request.form['image'] number = request.form['number'] # save and recognize file_path = join('images', str(number) + '_' + str(time.time()) + '.jpg') # save image to image save_image(image, file_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_handler(self, bot, update):\n text = update.message.text\n if text.startswith('/recon'):\n bot.sendMessage(chat_id=update.message.chat_id, text='*Object recognition*\\nSend me an image',\n parse_mode=ParseMode.MARKDOWN)\n return 10\n e...
[ "0.6812863", "0.6745101", "0.6441059", "0.64172786", "0.63796186", "0.63081276", "0.6294757", "0.62844", "0.62346715", "0.62283665", "0.62075573", "0.62055445", "0.61972386", "0.6195789", "0.61943555", "0.6177658", "0.6170043", "0.60861194", "0.6079997", "0.6043401", "0.60154...
0.7119447
0
Include legend for lines with peaks at smallest x values.
def legend_min_lines(fg, n): find_max = lambda line: line.get_xdata()[np.argmax(line.get_ydata())] lines_sort = lambda ax: sorted(ax.lines, key=find_max) for ax in fg.axes.flat[:]: if ax.lines: lines = lines_sort(ax)[:n] ax.legend(lines, [line.get_label() for line in lines])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_min(self):\n colors = \"bgycmk\"\n with plt.style.context(MPLSTYLE):\n for i in range(np.shape(self.yf)[0]):\n plt.figure()\n label = \"\"\n for j in self.bestps[i]:\n label += str(\"{0:.2f}\".format(j)) + \", \"\n ...
[ "0.6858279", "0.5978236", "0.5806689", "0.57889366", "0.5775272", "0.57748306", "0.56940114", "0.56135684", "0.5593706", "0.5590681", "0.5581712", "0.5571524", "0.55093616", "0.5491891", "0.5491144", "0.5488706", "0.5459644", "0.54519004", "0.5437679", "0.543207", "0.5420253"...
0.65110964
1
Plots up to most `codes` abundant barcodes. Includes a perbase and cycle mean calculated over the full input data. Legend labels first `lines` density estimates, ordered by peak location.
def plot_base_cycle_distributions(df_, cycles=4, size=2.5, codes=24, lines=2): short_barcode = 'barcode_' cycle_col = 'cycle' base_col = 'first_base' value_col = 'first' grey_for_means = (0.4, 0.4, 0.4, 1) cycle_names = sorted(set(df_['cycle']))[:cycles] df_[short_barcode] = df_['b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_barcode_distribution(ax, barcodes, expected, barcode_map=barcode_map):\n colors = cm.rainbow(np.linspace(0, 1, len(barcodes)))\n\n #maximum barcodes at any one location\n max_count = max(barcodes.apply(max))\n filtered_barcodes = {barcode : name for barcode, name in barcode_map.items() if barc...
[ "0.70304686", "0.6543944", "0.6215505", "0.59607434", "0.5930003", "0.5833471", "0.57943875", "0.57301944", "0.56436056", "0.5634927", "0.5625236", "0.5556573", "0.547108", "0.54705006", "0.5356017", "0.5354114", "0.5318896", "0.52882516", "0.52709067", "0.5254348", "0.524471...
0.6880369
1
Converts Gregorian Date to Julian Day
def _gregorian_to_julian_day(year, month, day): if month <= 2: val = 0 else: val = -1 if _check_leap(year) else -2 julian_day = (GREGORIAN_EPOCH - 1) + 365 * (year - 1) julian_day += math.floor((year - 1) / 4) julian_day += (-math.floor((year - 1) / 100)) + math.floor((year - 1) / 4...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def JulianDay(self):\n a = (14 - self._month) // 12\n y = self._year + 4800 - a\n m = self._month + (12 * a) - 3\n return (self._day + (153 * m + 2) // 5 + 365 * y +\n y // 4 - y // 100 + y // 400 - 32045)", "def date_to_julian_day(my_date):\n a = (14 - my_date.month...
[ "0.8149366", "0.7883695", "0.7861878", "0.78004646", "0.77878255", "0.77642244", "0.76791924", "0.7537485", "0.7537485", "0.75206345", "0.72884166", "0.72874254", "0.7244803", "0.7201342", "0.70295733", "0.6987624", "0.6918385", "0.6822204", "0.67515486", "0.67515486", "0.665...
0.8122727
1
Converts Julian Day To Persian Date
def _julian_day_to_persian(jd): jd = math.floor(jd) + 0.5 depoch = jd - _persian_to_julian_day(475, 1, 1) cycle = math.floor(depoch / 1029983) cyear = _mod(depoch, 1029983) if cyear == 1029982 : ycycle = 2820 else: aux1 = math.floor(cyear / 366) aux2 = _mod(cyear, 366) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _persian_to_julian_day(year, month, day):\n if year >= 0:\n epbase = year - 474\n else:\n epbase = year - 473\n epyear = 474 + _mod(epbase, 2820)\n\n if month <= 7:\n tmp = (month - 1) * 31\n else:\n tmp = (month - 1) * 30 + 6\n\n\n return_value = day + tmp + math....
[ "0.778108", "0.70039576", "0.6986945", "0.689151", "0.689151", "0.6828967", "0.68120515", "0.6775218", "0.67513645", "0.6736337", "0.6687247", "0.66747767", "0.6517333", "0.63329804", "0.6303217", "0.60982215", "0.6093603", "0.595807", "0.58972424", "0.580301", "0.57856184", ...
0.7749067
1
Converts Persian Date to Julian Day
def _persian_to_julian_day(year, month, day): if year >= 0: epbase = year - 474 else: epbase = year - 473 epyear = 474 + _mod(epbase, 2820) if month <= 7: tmp = (month - 1) * 31 else: tmp = (month - 1) * 30 + 6 return_value = day + tmp + math.floor(((epyear * 6...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _julian_day_to_persian(jd):\n jd = math.floor(jd) + 0.5\n depoch = jd - _persian_to_julian_day(475, 1, 1)\n cycle = math.floor(depoch / 1029983)\n cyear = _mod(depoch, 1029983)\n if cyear == 1029982 :\n ycycle = 2820\n else:\n aux1 = math.floor(cyear / 366)\n aux2 = _mod(...
[ "0.7656499", "0.7473824", "0.73471373", "0.720493", "0.7184367", "0.69399893", "0.6917958", "0.6915787", "0.6915787", "0.68016946", "0.6757735", "0.64120007", "0.634268", "0.6329677", "0.6308081", "0.6292033", "0.62918746", "0.62019545", "0.6173216", "0.6173216", "0.6170946",...
0.7904213
0
This function calculates and returns the CAGR (compound annual growth rate) for the time period.
def cagr_for_mutual_fund(start: dict, end: dict) -> float: if float(start['nav']) == 0.0: return 0 start_date = convert_to_datetime_format(start["date"]) start_value = float(start["nav"]) end_date = convert_to_datetime_format(end["date"]) end_value = float(end["nav"]) if start_value =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cagr_for_days(start_value: float, end_value: float, days: int):\n if start_value == end_value or start_value == 0:\n return 0.00\n\n years = float(days) / 365\n growth_rate: float = (((end_value / start_value) ** (1 / years)) - 1) * 100\n\n return round(growth_rate, 2)", "def annualize_ret...
[ "0.63266486", "0.6035581", "0.59583175", "0.5690206", "0.5639958", "0.56235296", "0.55166584", "0.5500198", "0.5369738", "0.5366105", "0.53402543", "0.5330149", "0.5266624", "0.5244037", "0.52425796", "0.5219255", "0.5211717", "0.52047306", "0.52046055", "0.52021915", "0.5192...
0.66032165
0
This function calculates and returns the CAGR (compound annual growth rate) for the time period in days.
def cagr_for_days(start_value: float, end_value: float, days: int): if start_value == end_value or start_value == 0: return 0.00 years = float(days) / 365 growth_rate: float = (((end_value / start_value) ** (1 / years)) - 1) * 100 return round(growth_rate, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cagr_for_mutual_fund(start: dict, end: dict) -> float:\n if float(start['nav']) == 0.0:\n return 0\n\n start_date = convert_to_datetime_format(start[\"date\"])\n start_value = float(start[\"nav\"])\n\n end_date = convert_to_datetime_format(end[\"date\"])\n end_value = float(end[\"nav\"])\...
[ "0.66585195", "0.6012151", "0.5915305", "0.58467585", "0.57078165", "0.5574578", "0.5569178", "0.5549666", "0.53952694", "0.53781515", "0.5357943", "0.5354434", "0.52893466", "0.5264744", "0.5225273", "0.51974696", "0.51880413", "0.5179483", "0.5178693", "0.51628333", "0.5124...
0.6935644
0
Calculates the CAGR (compound annual growth rate) for all the schemes provided from start_index to end_index in scheme data.
def cagrs_for_schemes(start_index: int, end_index: int, schemes: list) -> dict: cagrs = {} for scheme in schemes: with open(os.path.join(parameters.RAW_DATA_PATH, str(scheme['scheme_code']) + ".json")) as raw_data_file: scheme_data = json.load(raw_data_file) start = scheme_data['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cagr_for_mutual_fund(start: dict, end: dict) -> float:\n if float(start['nav']) == 0.0:\n return 0\n\n start_date = convert_to_datetime_format(start[\"date\"])\n start_value = float(start[\"nav\"])\n\n end_date = convert_to_datetime_format(end[\"date\"])\n end_value = float(end[\"nav\"])\...
[ "0.6145627", "0.60511035", "0.49853945", "0.49355876", "0.48968604", "0.4840281", "0.48249128", "0.48093522", "0.47987202", "0.47882715", "0.47356302", "0.47308907", "0.47280487", "0.46963185", "0.46888217", "0.46787497", "0.46685022", "0.46574417", "0.46570078", "0.46364397", ...
0.6982882
0
Creates new parameter in AWS SSM using contents of a file
def put_parameter_from_file(parameter_name, value_file, parameter_type, overwrite=False): ssm_client = boto3.client('ssm') try: with open(value_file, 'r') as file: parameter_value = file.read() logging.info("value_file: %s" % value_file) logging.info(parameter_value)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromfile(self,file):\n self.d.update(params_file(file))", "def create_parameter(self, name):\n result = SGParameter(name)\n result.file_line_details = self.file_line_details\n self.params.append(result)\n return result", "def __openParameterfile(self, filename):\n ...
[ "0.6122637", "0.6041775", "0.57899785", "0.57114273", "0.5706465", "0.5643073", "0.56284535", "0.562203", "0.5616292", "0.55719197", "0.55681545", "0.55505854", "0.55363524", "0.54725", "0.5444208", "0.5434256", "0.5395848", "0.539512", "0.53844494", "0.53457767", "0.5345514"...
0.710025
0
For a square matrix with shape (`dimension`, `dimension`), return a list of indices into a vector with `dimension dimension` elements that correspond to its upper triangular part after reshaping.
def upper_triangular_indices(dimension): assert dimension > 0, "tensor_utils.upper_triangular_indices: Dimension must be positive integer!" for row in range(dimension): for column in range(row + 1, dimension): element_index = dimension * row + column ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_indices(dimensions):\n\n level = len(dimensions)\n\n if level == 1:\n return range(dimensions[0])\n\n indices = [[]]\n\n while level:\n\n _indices = []\n\n for j in range(dimensions[level - 1]):\n\n _indices += [[j] + i for i in indices]\n\n indices = _in...
[ "0.61439174", "0.6052947", "0.6035017", "0.60090554", "0.5936174", "0.58033603", "0.57944226", "0.57944226", "0.5761883", "0.5708514", "0.56910044", "0.5668839", "0.5661304", "0.5629464", "0.5621799", "0.5600451", "0.5595236", "0.555132", "0.55404836", "0.55397177", "0.553816...
0.7299493
0
Returns a threeitem tuple containing the reader, the isoline and the synchronization
def create_reader(self): if len(self.get_pixel_list()) > 2000: raise RuntimeError("ROI with area higher than 2000 px can't be processed without autoaverage\n" "Please, set the autoaverage or select smaller ROI") reader = TraceReader(self.__train) sync =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, readerFunction):\n self.beginRead()\n # Enter the reader's critical section\n result = readerFunction(self.data)\n # Exit the reader's critical section\n self.endRead()\n return result", "def reader(client: socket.socket, reader_id: int) -> tuple:\n\n l...
[ "0.53536654", "0.53221244", "0.52414733", "0.51606363", "0.5156472", "0.51358867", "0.5020214", "0.5008562", "0.4986361", "0.4920189", "0.49160677", "0.488695", "0.4885702", "0.48793247", "0.4875339", "0.48653385", "0.4858211", "0.48561522", "0.48519036", "0.48374346", "0.482...
0.5402046
0
Given an x, y, see if we need to register any button clicks.
def check_mouse_press_for_buttons(x, y, button_list): for button in button_list: if x > button.center_x + button.width / 2: continue if x < button.center_x - button.width / 2: continue if y > button.center_y + button.height / 2: continue if y < but...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(self, x: float, y: float) -> bool:\n\n if self.x <= x <= self.x + self.width and self.y <= y < self.y + self.height:\n return True\n\n return False", "def check_mouse_press_for_buttons(x: float, y: float, button_list: list):\n for button in button_list:\n if x > butto...
[ "0.7199686", "0.7138824", "0.7082071", "0.69957554", "0.6930157", "0.6891789", "0.6877496", "0.66716933", "0.6657784", "0.66270465", "0.655502", "0.654256", "0.65188766", "0.6495332", "0.64738446", "0.64694965", "0.6412789", "0.6356476", "0.62814677", "0.6225734", "0.61532915...
0.72287434
1
Prints a standard message on the center of the screen.
def print_message_center(self, message, color, size = common.FONT_SIZE): xpos = self.width / 2 ypos = self.height / 2 arcade.draw_text( text=message, start_x=xpos, start_y=ypos, anchor_x="center", anchor_y="center", align=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disp_msg(msg):\n from x84.bbs import getterminal, echo\n term = getterminal()\n echo(u''.join((u'\\r\\n\\r\\n',\n term.bold_yellow('%s ' % (msg,),),\n term.yellow_reverse_bold(u'...'),)))", "def display(self,message):\r\n \r\n print(message)", "def...
[ "0.69976014", "0.6957182", "0.6853732", "0.6829709", "0.6802697", "0.6800137", "0.67832273", "0.6777272", "0.67504114", "0.6736794", "0.6713273", "0.66919696", "0.66815066", "0.6580516", "0.65599275", "0.65127635", "0.6510409", "0.6465604", "0.6438674", "0.64155304", "0.63997...
0.7416257
0
calculate sum of an arithmetic series
def sumArithmeticSeries(a: float, d: float, n: int) -> float: return (a + d * (n + 1) / 2) * n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summation(self):\n return sum(self.read_ints())", "def lucas():\n return sum_series(a=2, b=1)", "def sum_series(input,input1=0,input2=1):\n\n if input == 0:\n\n return input1\n\n elif input == 1:\n\n return input2\n\n else:\n return sum_series(input-1,input1,input2...
[ "0.6993034", "0.69815", "0.688283", "0.68464094", "0.6801101", "0.68005526", "0.67945546", "0.67872226", "0.67829263", "0.6753748", "0.6735629", "0.671269", "0.6706957", "0.66613215", "0.66165483", "0.6597227", "0.65913415", "0.653591", "0.65300167", "0.6501468", "0.6495113",...
0.7754164
0
Get download link for 'fullsize image' from post page.
def getBestImageFromPostPage(self, url_post_page: str) -> str: self.logger.info(f'Processing post link: {url_post_page}') url_post_page_response: requests.Response = requests.get(url_post_page) url_post_page_soup = bs4.BeautifulSoup(url_post_page_response.text, 'html.parser') link_tag = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_url():", "def image(self, size):\n\n xpath = (\n f\"guidle:offerDetail/\"\n f\"guidle:images/\"\n f\"guidle:image/\"\n f\"guidle:size[@label='{size}']\"\n )\n\n images = self.find(f\"({xpath})[1]\")\n\n if not len(images):\n ...
[ "0.6327008", "0.6269483", "0.6113878", "0.61102796", "0.60789585", "0.6007917", "0.5953354", "0.59378636", "0.58799964", "0.5879115", "0.5879115", "0.5879115", "0.5847613", "0.5810503", "0.57894164", "0.5771869", "0.57622063", "0.57607496", "0.57490635", "0.5732653", "0.57279...
0.7284441
0
Download the required plugins. This could be further optimized to not download plugins from hashicorp, but rather have them in a local repository or host them in s3, and get them from an internal s3 endpoint so no transit charges are incurred. Ideally these would be stored between runs, and only downloaded if the versi...
def download(self): opsys, machine = get_platform() _platform = f"{opsys}_{machine}" plugin_dir = f"{self._temp_dir}/terraform-plugins" if not os.path.isdir(plugin_dir): os.mkdir(plugin_dir) for name, details in self._plugins.items(): uri = get_url(name,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_plugin(name):\n uri = 'https://github.com/drupdates/' + name + '.git'\n plugins_dir = Utils.check_dir(os.path.join('~', '.drupdates', 'plugins'))\n if not bool(urlparse(uri).netloc):\n msg = (\"Error: {0} url, {1}, is not a valid url\").format(name, uri)\n ra...
[ "0.6225477", "0.59348255", "0.5842934", "0.57953465", "0.56163293", "0.5611161", "0.56031275", "0.55901814", "0.5579805", "0.5489152", "0.54172784", "0.53859395", "0.534883", "0.53290915", "0.5310142", "0.5280209", "0.5275105", "0.5265479", "0.52341837", "0.5219002", "0.52128...
0.7384177
0
Determine the URL for the plugin get URL returns a fully qualifed URL, including the file name. In order to support third party terraform plugins we can not assume the hashicorp repository. It will function as a default, but if baseURL is provided in the plugin settings it will be used instead. The logic to determine t...
def get_url(name, details): opsys, machine = get_platform() _platform = f"{opsys}_{machine}" try: version = details["version"] except KeyError: raise KeyError(f"version must be specified for plugin {name}") # set the file name, allow it to be overridden with key "filename" defa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lookup_url(self, endpoint, values):\r\n try:\r\n cont = self.get_container(values['container'])\r\n if cont.cdn_enabled:\r\n return \"%s/%s\" % (cont.cdn_uri, values['filename'])\r\n else:\r\n return None\r\n except: # pragma: no cov...
[ "0.63869417", "0.6342273", "0.6285669", "0.6284974", "0.6251849", "0.6093768", "0.60814553", "0.60057205", "0.59900135", "0.5964348", "0.5945991", "0.5882117", "0.58723116", "0.5864827", "0.58446056", "0.57898134", "0.57750696", "0.57712436", "0.57586366", "0.5744491", "0.574...
0.67948735
0
cluster and plot barcodes sorted max_list_len = 600 maximum length to visualize seq_len = 100 maximumim length to compute lev distance nex = 50 only show up to NEX examples
def plot_sorted_barcodes( color_lists, trans_lists, max_list_len=600, seq_len=100, nex=50, n_jobs=-1, figsize=(25, 6), ax=None, ): # subset dataset color_lists = color_lists[:nex] trans_lists = trans_lists[:nex] # get length of lists list_lens = [len(i) for i in tran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_closeness_barplot(seqidss,alis,legend,colors=None,limsy=[0,1],out=None,clusterings=None,annot=True):\n newpats = seqidss.keys()\n fig, ax = plt.subplots()\n rects= [None] * len(alis)\n labels=[]\n total_width=0.8\n single_width=1.\n n_bars = len(alis)\n bar_width = total_width / n_...
[ "0.63014865", "0.622572", "0.6131941", "0.610015", "0.6085125", "0.60024273", "0.58642226", "0.58315736", "0.58116525", "0.5795409", "0.5707317", "0.5677819", "0.5658275", "0.5657415", "0.5653653", "0.5599543", "0.55906355", "0.5577528", "0.5559556", "0.55501115", "0.55470383...
0.7542305
0
Show list of users.
def user_list(): users = User.query.all() return render_template("user_list.html", users=users)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show():\n return render_template(\n 'listUsers.html',\n title='List Users',\n message='These are the users in our system'\n )", "def show_users():\n\n user = User(connection=connection, cursor=cursor)\n\n all_users = user.get_all_users()\n\n context = {\n 'all_users...
[ "0.85589206", "0.8499164", "0.8494431", "0.8487274", "0.8487274", "0.8487274", "0.8487274", "0.8487274", "0.8487274", "0.84778", "0.8453244", "0.83147424", "0.8297733", "0.82169145", "0.81915414", "0.814934", "0.8144295", "0.80760515", "0.7961692", "0.78960663", "0.78506345",...
0.85248625
1
Show signup and login forms.
def show_forms(): return render_template("signup_login.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_loginpage():\n login_form = LoginForm()\n register_new_user_form = RegisterForm()\n\n return render_template('loginpage.html',\n register_new_user_form = register_new_user_form,\n login_form = login_form)", "def show_home_page():\n\n l...
[ "0.7689611", "0.7283937", "0.71204764", "0.7066128", "0.7028701", "0.6924456", "0.69143254", "0.6910931", "0.68288296", "0.6817515", "0.6806173", "0.68048626", "0.6789656", "0.6769239", "0.6722788", "0.6701515", "0.665919", "0.6642516", "0.6638974", "0.6620808", "0.6572773", ...
0.8373746
0
Get user rating score for movie
def rate_movie(movie_id): user_rating = request.args.get("user_rating") # get user id from log in email address user_email = session["logged_in_user_email"] user = User.query.filter(User.email == user_email).one() user_id = user.user_id # Check if user rating exists in database # If user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_user_movie_rating(self, user_id, movie_id):\n rating = self.ratings[(self.ratings['user_id'] == user_id) &\n (self.ratings['movie_id'] == movie_id)]['rating'].iloc[0]\n user_mean = self.get_mean_user_rating(user_id)\n return rating - user_mean", "def _im...
[ "0.77090836", "0.71592355", "0.7027903", "0.7013615", "0.695972", "0.6877569", "0.68583083", "0.68279237", "0.6810187", "0.6798399", "0.6797215", "0.6778644", "0.67558587", "0.6726565", "0.6719133", "0.66899735", "0.66174775", "0.6602134", "0.65898967", "0.65773505", "0.65695...
0.724304
1
Verifies note relates to plugin
def is_plugin_note(self, note): return bool(self.regex.match(note))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_plugin_note(self, note):\n return False", "def do_verify(self, args):\n\n pn = \\\n self._get_choice_(\"pn\", self.promissory_notes, \"Which promissory note needs to be verified?\")\n\n try:\n verify_promissory_note(pn)\n except Exception as e:\n ...
[ "0.7556671", "0.6580029", "0.6136503", "0.6118982", "0.5944517", "0.5837426", "0.5812538", "0.57490134", "0.56331164", "0.5561102", "0.54762745", "0.54538786", "0.54308194", "0.5426283", "0.5417236", "0.5407975", "0.53728557", "0.5362797", "0.5331794", "0.532545", "0.53213567...
0.7009839
1
Method to return a single user base on a given id
def get_single_user(self, id): for user in self.users: if user['id'] == id: return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(id):\n return User.query.filter_by(id=id).first()", "def get_user_by_id(self, id):\n\t\treturn self.users.get(id)", "def find_by_id(cls, _id):\n user = cls.query.filter_by(id=_id).first()\n return user", "def get_user(id):\n pass", "def find_user_by_id(id: str) -> User:\n\n ...
[ "0.87406313", "0.87194085", "0.86879575", "0.8629455", "0.8574395", "0.854622", "0.84706885", "0.84516245", "0.8389576", "0.8380215", "0.83528787", "0.8348613", "0.82819223", "0.8277447", "0.82162476", "0.82110035", "0.82092386", "0.81851685", "0.8184536", "0.8169312", "0.816...
0.8726376
1
Method to add shoppinglists to a user given the id of the user
def add_shoppinglist(self, user_id, name): new_shoppinglist = ShoppingList(name) new_shoppinglist_details = new_shoppinglist.get_details() user = self.get_single_user(user_id) new_shoppinglist_details['id'] = len(user['shopping_lists']) + 1 for item in user['shopping_lists']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_list(\n cls,\n name,\n user_id\n ):\n lists_collection = taskify['lists']\n new_list = {\n \"name\": name,\n \"user_id\": ObjectId(user_id)\n }\n list_id = lists_collection.insert_one(new_list).inserted_id\n return new_list, l...
[ "0.70197177", "0.6928091", "0.6893969", "0.6640007", "0.65025365", "0.63162696", "0.63162696", "0.6252361", "0.6190899", "0.61247694", "0.6122644", "0.61040664", "0.609208", "0.60793847", "0.6048757", "0.59860486", "0.5969656", "0.5946343", "0.5872412", "0.58569", "0.5841051"...
0.7700489
0
Method to add shopping items to a shopping list
def add_shoppingitems(self, user_id, shoppinglist_id, name, quantity): new_shoppingitem = ShoppingItem(name, quantity) new_shoppingitem_details = new_shoppingitem.get_details() user = self.get_single_user(user_id) for shopinglist in user['shopping_lists']: if shopinglist['id'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item_to_shopping_list(shopping_list, item, quantity):\n shopping_list_items = ShoppingListItems.query.filter_by(shopping_list_id=shopping_list.id, item_id=item.id).first()\n if shopping_list_items is None:\n shopping_list_items = ShoppingListItems(shopping_list_id=shopping_list.id, item_id=ite...
[ "0.69891316", "0.6971309", "0.6909483", "0.6886743", "0.68709165", "0.6862786", "0.6772096", "0.67416227", "0.6698839", "0.66877407", "0.6674672", "0.66226494", "0.66226494", "0.66226494", "0.65921545", "0.65899134", "0.65749466", "0.6560956", "0.6547719", "0.65255886", "0.65...
0.72290874
0
Method to get a single item from the shopping list
def get_shoppingitem(self, user_id, shoppinglist_id, item_id): shoppinglist = self.get_shoppinglist(user_id, shoppinglist_id) for item in shoppinglist['items']: if item['id'] == item_id: return item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item(item_id):\n return Item.query.filter_by(id=item_id).first()", "def get_item(self, name: str) -> Optional[Item]:\n item = self.filter_items(name, limit=1)\n return item[0] if item else None", "def get_item(self, call_number):\n return self.item_list.get(call_number)", "def...
[ "0.72919077", "0.7291454", "0.7179455", "0.7159581", "0.715449", "0.7142205", "0.7142205", "0.70436245", "0.69442225", "0.69362116", "0.693477", "0.6910595", "0.6884364", "0.68688667", "0.67610484", "0.67220116", "0.67014426", "0.6701249", "0.66954094", "0.6669914", "0.660991...
0.75183713
0
Method to indicate bought items
def buy_shoppingitem(self, user_id, shoppinglist_id, item_id): item = self.get_shoppingitem(user_id, shoppinglist_id, item_id) if not item['bought']: item['bought'] = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purchase(self, item_type):", "def purchase_item(self):\r\n self.purchased_callback()\r\n self.status = 'purchased'\r\n self.fulfilled_time = datetime.now(pytz.utc)\r\n self.save()", "async def _vis_buy(self, ctx, *args):\n if has_post_permission(ctx.guild.id, ctx.channel....
[ "0.73451656", "0.67821705", "0.6600444", "0.65148836", "0.65054286", "0.6455387", "0.6421658", "0.63444376", "0.6324628", "0.6315627", "0.63023406", "0.6289282", "0.628285", "0.62249106", "0.6185769", "0.6153408", "0.6136711", "0.6134128", "0.60930735", "0.6054386", "0.605315...
0.75839543
0
Initialisation of a _Config instance.
def __init__(self, *args, **kwargs): super().__init__() self._cfg = ConfigDict() # current configuration self._default_config = ConfigDict() # default configuration self._temp_config = OrderedDict() # temporary configuration self._path = Path() # current configuration pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_config(self):\n pass", "def init_config() -> Config:\n ...", "def _init_config_(self):\n self._config= {}", "def initialize(self, **kwargs):\n\n # Defining the configuration object\n self.config = kwargs.get('config')", "def Init(self, config):\r\n pass", "def _...
[ "0.7909576", "0.7742302", "0.7696239", "0.7674185", "0.75723463", "0.7561906", "0.74977136", "0.7456496", "0.7397632", "0.7368958", "0.7259326", "0.7254477", "0.72241116", "0.72157997", "0.7205846", "0.7189471", "0.7189471", "0.7183831", "0.71579534", "0.71477437", "0.7131284...
0.7987772
0
Edit attributes of the configuration.
def edit(self, **kwargs): for attr in self.EDITABLE_ATTR: kwarg = kwargs.pop(attr, self._WILDCARD) if kwarg is not self._WILDCARD: setattr(self, attr, kwarg) logger.debug("Attribute '{}' changed to '{}'.".format(attr, kwarg)) for p_attr in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_attributes(self, attributes):\n self.attributes = dict(attributes) # overwrite the existing registry of attributes with the input attributes", "def set_attributes(self, attributes):\n self.attributes = dict(attributes) # overwrite the existing registry of attributes with the input attribu...
[ "0.6473589", "0.6473589", "0.6473589", "0.63702786", "0.63045835", "0.6293869", "0.6224746", "0.62141687", "0.61229956", "0.61122084", "0.61088306", "0.6079231", "0.60124195", "0.60124195", "0.60038865", "0.6000448", "0.59741896", "0.5974063", "0.5967706", "0.5967706", "0.596...
0.75753456
0
If the section doesn't exist and search_in_default_config, append the section from default config to current configuration
def _check_section(self, section: Union[str, list], search_in_default_config: bool = None): section = None if section is None else ConfigDict.TO_KEY_FUNC(section) search_in_default_config = self._search_in_default_config if search_in_default_config is None \ else search_in_default_config ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self, section=None):\r\n self.set_section(section, search_in_default_config=True)", "def overwrite(section: str, data: any) -> None:\n\toverwriteDict[section] = data\n\tlogger.debug(f'Overwritten config {section}!')", "def search_for_config(self, cfg_section, options):\n for key, ...
[ "0.68606806", "0.6550262", "0.65217954", "0.6469845", "0.6428516", "0.6379521", "0.6358503", "0.62302405", "0.6228921", "0.61324304", "0.6030926", "0.60255", "0.5983904", "0.59709", "0.59571606", "0.59264976", "0.5877952", "0.5862359", "0.5850703", "0.5835888", "0.5816391", ...
0.7271659
0
alias of set_section, with search_in_default_config argument True by default.
def load_config(self, section=None): self.set_section(section, search_in_default_config=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure(self, section):", "def search_for_config(self, cfg_section, options):\n for key, default in options.items():\n val = default\n if key in cfg_section:\n val = cfg_section[key]\n setattr(self, key, val)", "def _check_section(self, section: Unio...
[ "0.6789469", "0.66695064", "0.6498293", "0.6160742", "0.60437703", "0.6006598", "0.59721696", "0.59567016", "0.5919255", "0.5820273", "0.57651395", "0.57304776", "0.57055175", "0.569853", "0.56252676", "0.5622563", "0.5590487", "0.5496037", "0.5474919", "0.54692334", "0.54423...
0.6786406
1
Load configuration from file. If forceload, reload_default values on error..
def load(self, path=None, force_load=None, auto_cast=None, load_empty=None, merge_how='right'): path = self._path if path is None else Path(path) auto_cast = self._auto_cast if auto_cast is None else auto_cast force_load = self._force_load if force_load is None else force_load load_e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, cfgfile, force_reload=False, failonerror=True,\n replace_keys={}):\n realpath = None\n if os.path.exists(cfgfile):\n realpath = cfgfile\n else:\n new_p = self._findConfigPath(cfgfile)\n if new_p:\n realpath = new_p\n ...
[ "0.7139778", "0.6983545", "0.69751984", "0.6963302", "0.6923232", "0.6894999", "0.68552387", "0.68206865", "0.6814341", "0.6757191", "0.6630725", "0.66274244", "0.6623084", "0.6610858", "0.66084945", "0.6578569", "0.65465844", "0.64928377", "0.64717007", "0.6463129", "0.64572...
0.7279285
0
Set path and config to default values. If write is True, overwrite default file with default configuration.
def reload_default(self, write=True, backup=True, how='right', how_section=None, sections=None): # self._cfg = self.default_config.deepcopy() self._path = self._default_path.copy() dico = self.default_config.deepcopy() sections = {sections} if isinstance(sections, str) else sections ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_default_config(self, force=False):\n\t\t\n\t\tif self.configfilepath is not None:\n\t\t\tlogger.debug(\"You use the existing config file %s, I don't have to write one.\" % \\\n (self._get_config_filepath()))\n\t\t\treturn\n\t\t\n\t\tif force or not os.path.exists(...
[ "0.66851825", "0.6599315", "0.6573214", "0.63652515", "0.6331893", "0.62328666", "0.62254226", "0.62060577", "0.6150296", "0.6066432", "0.60447663", "0.5919648", "0.5907546", "0.58950347", "0.58055705", "0.576085", "0.5756444", "0.575341", "0.5591363", "0.5586188", "0.5564079...
0.6801692
0
Create a new Shop Profile
def create(self, validated_data): return ShopProfile.objects.create(**validated_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createProfile(self):\n if self.profile:\n return\n from soc.modules.gsoc.models.profile import GSoCProfile\n user = self.createUser()\n properties = {'link_id': user.link_id, 'student_info': None, 'user': user,\n 'parent': user, 'scope': self.program, 'status': 'active'}\n ...
[ "0.7333698", "0.7082951", "0.7064709", "0.6960642", "0.6960311", "0.69601357", "0.6950246", "0.68697006", "0.68697006", "0.68697006", "0.6861093", "0.6851095", "0.684921", "0.6847314", "0.6804711", "0.6803297", "0.6714414", "0.67008674", "0.6680203", "0.6668842", "0.6656584",...
0.79185814
0
Creates the default regression submodel. Args
def create_regression_submodels(input_shape, option, regression_feature_size=256, FC_num_of_nuerons=1024, name='regression_submodel'): if option == 1 or option == 0: inputs = keras.layers.Input(shape=(None, None, input_shape)) # All new conv layers are initialized # with bias b = 0 and a Gau...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_regression_model(num_values, num_anchors, pyramid_feature_size=256, regression_feature_size=256, name='regression_submodel'):\n # All new conv layers except the final one in the\n # RetinaNet (classification) subnets are initialized\n # with bias b = 0 and a Gaussian weight fill with stddev = ...
[ "0.6608687", "0.64323825", "0.6384243", "0.6340081", "0.63179123", "0.6266902", "0.6041894", "0.6030131", "0.60073376", "0.59656024", "0.5949215", "0.5946567", "0.5942358", "0.5942143", "0.5932648", "0.59324545", "0.5924777", "0.5908567", "0.5888867", "0.58777905", "0.5841634...
0.70448923
0
get system network disk mount points
def get_mount_points(): points = [] t = subprocess.check_output(['mount']) t = t.decode() for line in t.splitlines(): t = line.find('smbfs') if t < 0: continue b = line.find(' on ') points.append(line[b+4: t-2]) # //share@win10.shared/storage on /Volumes/storage...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mpt():\n lbl_drives = ['device','mountpoint','fstype']\n disks = [d[0:3] for d in psutil.disk_partitions()]\n drives = [dict(zip(lbl_drives,ds)) for ds in disks]\n return [d['mountpoint']for d in drives]", "def get_disks(self):\n result = {}\n\n exp = self.config['devices']\n ...
[ "0.68773633", "0.68158823", "0.67882913", "0.6774222", "0.66594845", "0.66355723", "0.6554326", "0.64806867", "0.6475302", "0.6474165", "0.64323974", "0.63421154", "0.62973434", "0.6283676", "0.625942", "0.62251365", "0.6212416", "0.6192075", "0.61354935", "0.613342", "0.6131...
0.78018576
0
Create a VOEvent receiver service. The receiver service accepts VOEvent messages submitted to the broker by authors.
def makeBroadcasterService(endpoint, local_ivo, test_interval, whitelist): factory = VOEventBroadcasterFactory(local_ivo, test_interval) if log.LEVEL >= log.Levels.INFO: factory.noisy = False whitelisting_factory = WhitelistingFactory(factory, whitelist, "subscription") if log.LEVEL >= log.Leve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_event(self):\n\t\treturn handle_to_object(call_sdk_function('PrlVm_CreateEvent', self.handle))", "def make_service_offer(self, incoming: Demand):\n rospy.loginfo(\"Making service offer...\")\n\n offer = Offer()\n offer.model = Multihash(rospy.get_param(\"~model\"))\n offer....
[ "0.5781585", "0.5657519", "0.56021494", "0.55497426", "0.55497426", "0.55497426", "0.54814553", "0.5467501", "0.5458404", "0.541941", "0.5413253", "0.5380272", "0.5364278", "0.53538424", "0.5344692", "0.53310215", "0.52988505", "0.5298473", "0.5285878", "0.5276575", "0.527268...
0.62264496
0
Parse a BibTeX string into an object
def parse(self, bibtex_str): self.bibtex_file_obj = self._bibtex_file_obj(bibtex_str) self._parse_records(customization=self.customization) return self.bib_database
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bibtex_to_dict(bibtex):\n global logger\n result = dict()\n if os.path.exists(bibtex):\n fd = open(bibtex, \"r\")\n logger.debug(\"Reading in file %s\" % bibtex)\n text = fd.read()\n else:\n text = bibtex\n logger.debug(\"Removing comments...\")\n text = re.sub(r\"...
[ "0.66628987", "0.6659649", "0.633736", "0.633628", "0.6253365", "0.6071626", "0.5941959", "0.59201235", "0.5868278", "0.5813296", "0.57727057", "0.57572824", "0.5704655", "0.5671336", "0.562297", "0.5534481", "0.5516728", "0.54690385", "0.5426646", "0.5413599", "0.5386806", ...
0.6913478
0