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
Input method for player ELO that checks if ELO exists.
def input_player_elo(self): try: elo = input('Entrez le classement ELO du joueur: ') if int(elo): try: if int(elo) < 1000 or int(elo) > 2900: raise ValueError else: return int(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findHumanOpponentExists(player):\n\n opponent_teamname = input(\"Choose your opponent team by name: \")\n try:\n if player == opponent_teamname:\n raise Exception(\"Playing against yourself is strictly prohibited.\")\n teamfilename = \"teams/team\" + opponent_teamname + \".json\"...
[ "0.5732937", "0.57131433", "0.5703937", "0.5684848", "0.5595761", "0.5575252", "0.55213034", "0.5482472", "0.5482472", "0.5475689", "0.5394838", "0.53586984", "0.53216845", "0.5319151", "0.5287416", "0.52535087", "0.5253348", "0.52341896", "0.52180123", "0.5212996", "0.519977...
0.57860374
0
Checks if the sum of players scores is equal to 1.
def input_player_scores_checked(self): score_white = self.input_player_score_white() score_black = self.input_player_score_black() try: if score_white + score_black == 1: return score_white, score_black else: raise ValueError ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_score(self) -> None:\n self.player_1, self.player_2 = 0, 0\n for cell in self.cells:\n if cell.player == 1:\n self.player_1 += 1\n elif cell.player == 2:\n self.player_2 += 1", "def is_winner(self, player: str) -> bool:\n total_re...
[ "0.7236769", "0.66516745", "0.6396457", "0.63511825", "0.6332408", "0.6269465", "0.6179465", "0.6173967", "0.61622745", "0.6159084", "0.615133", "0.6092378", "0.60807776", "0.6077562", "0.6075122", "0.6073654", "0.6048365", "0.6047523", "0.60185176", "0.6015666", "0.6012005",...
0.7254679
0
Input method for white player's score.
def input_player_score_white(self): accepted_scores = ['0', '0.5', '1'] try: score_w = input("Entrez le score du joueur BLANCS ('0', '0.5' ou '1'): ") if score_w in accepted_scores: return float(score_w) raise ValueError except ValueErro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_player_score_black(self):\r\n accepted_scores = ['0', '0.5', '1']\r\n try:\r\n score_b = input(\"Entrez le score du joueur NOIRS ('0', '0.5' ou '1'): \")\r\n if score_b in accepted_scores:\r\n return float(score_b)\r\n else:\r\n ...
[ "0.6929644", "0.66643995", "0.6654614", "0.6278269", "0.62385225", "0.6229511", "0.6174865", "0.6145234", "0.61156523", "0.60772306", "0.60403574", "0.60369956", "0.6035315", "0.60090554", "0.59959227", "0.59695756", "0.5951018", "0.59504974", "0.59492856", "0.59418064", "0.5...
0.751157
0
Input method for black player's score.
def input_player_score_black(self): accepted_scores = ['0', '0.5', '1'] try: score_b = input("Entrez le score du joueur NOIRS ('0', '0.5' ou '1'): ") if score_b in accepted_scores: return float(score_b) else: raise ValueError ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_player_score_white(self):\r\n accepted_scores = ['0', '0.5', '1']\r\n try:\r\n score_w = input(\"Entrez le score du joueur BLANCS ('0', '0.5' ou '1'): \")\r\n if score_w in accepted_scores:\r\n return float(score_w)\r\n raise ValueError\r\n ...
[ "0.72624844", "0.65987897", "0.621455", "0.61852914", "0.61256635", "0.6026818", "0.60259914", "0.59976965", "0.59965116", "0.5985526", "0.59605473", "0.5958671", "0.59139794", "0.5893769", "0.5892508", "0.5891051", "0.5833458", "0.58231443", "0.58112615", "0.57970256", "0.57...
0.74973434
0
Divide list_length elements of my_list_1 by corresponding element of my_list_2.
def list_division(my_list_1, my_list_2, list_length): res_1 = [] res = 0 for n in range(0, list_length): try: res = my_list_1[n] / my_list_2[n] res_1.append(res) except ZeroDivisionError: print("division by 0") res_1.append(0) except T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def divideList(L):\n for x in range(len(L)):\n L[x] = L[x]/100.0\n return L", "def splitList(l, i1, i2):\n n = len(l)\n L1 = []\n L2 = []\n j = 0\n # Creating list 1\n while (i1 + j) % n != i2:\n L1.append(l[(i1 + j) % n])\n j += 1\n L1.append(l[i2])\n # Creatin...
[ "0.625754", "0.6028035", "0.59662575", "0.59614384", "0.5945916", "0.5877448", "0.58332175", "0.5829548", "0.5827354", "0.58103305", "0.58067125", "0.58055735", "0.5795844", "0.5787347", "0.57713", "0.5660114", "0.5652409", "0.5585388", "0.5558709", "0.55453026", "0.55437076"...
0.6972134
0
Loads a data file or `~specutils.Spectrum1D` object into Specviz.
def specviz_spectrum1d_parser(app, data, data_label=None, format=None, show_in_viewer=True): # If no data label is assigned, give it a unique identifier if not data_label: data_label = "specviz_data|" + str( base64.b85encode(uuid.uuid4().bytes), "utf-8" ) if isinstance(data, Sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deimos_spectrum1D_reader(file_name):\n\n hdulist = fits.open(file_name)\n data = Data(label='1D Spectrum')\n data.header = hdulist[1].header\n\n full_wl = np.append(hdulist[1].data['LAMBDA'][0], hdulist[2].data['LAMBDA'][0])\n full_spec = np.append(hdulist[1].data['SPEC'][0], hdulist[2].data['SP...
[ "0.6218304", "0.610695", "0.6052118", "0.6036967", "0.59082484", "0.58769786", "0.58588415", "0.58355707", "0.58281875", "0.5824038", "0.5813986", "0.577393", "0.5771036", "0.57521075", "0.5726429", "0.5695623", "0.5671267", "0.5666551", "0.5653034", "0.5624165", "0.5597508",...
0.68642944
0
This function prints captain list which is a unique room that appears once in a list
def captain_room(room_list): captain_room = '' #store the list in total_rooms total_rooms = room_list #get the unique rooms without repetition of any room unique_rooms_num = set(total_rooms) #Remove the unique room from the list of total rooms for n in unique_rooms_num: total_room...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_not_uniq(list, mesg=\"{multiplicity} times: {item}\"):\n\n not_uniq = search_not_uniq(list)\n for item, multiplicity in not_uniq.items():\n print(mesg.format(**locals()))\n return len(not_uniq)", "def map_room_list():\n for room in map_rooms:\n print(f\"{room}: \")\n fo...
[ "0.6323657", "0.6076399", "0.59591687", "0.590635", "0.58074695", "0.56810343", "0.56456846", "0.5641877", "0.56040835", "0.5472337", "0.54430157", "0.54220444", "0.54105526", "0.5403889", "0.5386968", "0.5358882", "0.53560424", "0.5319596", "0.5314852", "0.5287625", "0.52862...
0.7524925
0
Calculate the average synthesis rate of a species over a cell cycle
def calc_avg_syn_rate(mean_concentration, half_life, mean_doubling_time): ave_synthesis_rate = math.log(2) * (1. / mean_doubling_time + 1. / half_life) * mean_concentration return ave_synthesis_rate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supernovae_rate(self, time, timestep, metallicity):\n # get the mass limits of the timesteps the user passed in. The\n # lower time corresponds to the higher stellar mass\n m_low = self.lifetimes.turnoff_mass(time + timestep, metallicity)\n m_high = self.lifetimes.turnoff_mass(time,...
[ "0.6086214", "0.60744035", "0.5925291", "0.5893581", "0.586322", "0.5856601", "0.58497596", "0.57867056", "0.5776609", "0.5764255", "0.5764255", "0.5764255", "0.57195646", "0.5676457", "0.56463623", "0.5626754", "0.5608253", "0.5581434", "0.5579572", "0.5562513", "0.5562513",...
0.6159641
0
Calculate the average degradation rate of a species over a cell cycle
def calc_avg_deg_rate(mean_concentration, half_life): ave_degradation_rate = math.log(2) / half_life * mean_concentration return ave_degradation_rate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dishlist_avg_cal(n:list)->float:\r\n all_cal = dishlist_cal(n)\r\n return sum(all_cal)/len(all_cal)", "def spread_dye(self, dt=0.1):\n #advection operator\n #This moves quite well now\n du_dt = -np.add.reduce(self.u*np.array(np.gradient(self.dye)))\n #diffusion \n du_dt += nd...
[ "0.59662724", "0.5930904", "0.58926266", "0.58236223", "0.57968307", "0.5790589", "0.5787646", "0.57773817", "0.57631093", "0.57520914", "0.5660849", "0.5632732", "0.56172967", "0.5608329", "0.5584075", "0.5556569", "0.5541165", "0.55010223", "0.5499737", "0.54758626", "0.544...
0.5984925
0
Test that an FBA metabolism submodel can produce each reactant component (producible) and recycle each product component (recyclable) in each reaction in the objective function individually. First, a source (sink) reaction is added for each reactant (product) component. Each source (sink) reaction is then set as the ob...
def test_metabolite_production(submodel, reaction_bounds, pseudo_reactions=None, test_producibles=None, test_recyclables=None): if test_producibles: reactants = test_producibles else: reactants = [] for reaction in submodel.dfba_obj.expression.reactions: for reactant...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maximize_reaction(model, problem, rxn, use_cache=True, perf_log=None):\n \n if perf_log is not None:\n start_time = timeit.default_timer() #time.perf_counter() #Not in python2.7\n perf_log['order'][rxn] = len(perf_log['order'])\n\n # Load from cache if it exists and return\n if use_ca...
[ "0.5827976", "0.5761763", "0.5731754", "0.5726136", "0.5580553", "0.5553299", "0.544844", "0.53767526", "0.5330983", "0.5298788", "0.52887225", "0.5279131", "0.52772737", "0.52629393", "0.5258853", "0.52525383", "0.52230024", "0.52126104", "0.51890814", "0.5183393", "0.515961...
0.68660337
0
Generate a MichaelisMentenlike rate law. For a multisubstrate reaction, the substrate term is formulated as the multiplication of a Hill equation with a coefficient of 1 for each substrate. For multisteps reaction where each step is catalyzed by a different enzyme, the enzyme term is formulated as the multiplication of...
def gen_michaelis_menten_like_rate_law(model, reaction, modifiers=None, modifier_reactants=None, exclude_substrates=None): modifier_species = [] all_species = {} all_volumes = {} all_observables = {} all_parameters = {} if modifiers: for modifier in modifiers: if type(modifie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_mass_action_rate_law(model, reaction, model_k, modifiers=None, modifier_reactants=None):\n \n if modifiers is None:\n modifier_species = []\n modifier_product = ''\n modifier_ids = None\n else:\n modifier_species = [i for modifier in modifiers for i in modifier.expressi...
[ "0.6782911", "0.64093083", "0.5955413", "0.55909353", "0.54852664", "0.5475418", "0.53828067", "0.53828", "0.53317857", "0.5300439", "0.5247621", "0.5220472", "0.52139676", "0.5206363", "0.5206155", "0.5192668", "0.5189913", "0.51878273", "0.5162402", "0.5146978", "0.51350915...
0.74347633
0
Generate a MichaelisMentenlike propensity function. For species that are considered 'substrates', the substrate term is formulated as the multiplication of a Hill equation with a coefficient of 1 for each 'substrate'. For species that are considered 'modifiers', the modifier term is formulated as the multiplication of ...
def gen_michaelis_menten_like_propensity_function(model, reaction, substrates_as_modifiers=None, exclude_substrates=None): if substrates_as_modifiers is None: raise ValueError('No list has been provided for the input argument substrates_as_modifiers') if exclude_substrates: excluded_reactants =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def massF(S,T,kappa,d):\n #Equation of Mass in solar masses, per pixel\n if T == 0:\n M = 0\n else:\n M = 1.55*S*(np.exp(17.0/T)-1.0)*((kappa/0.012)**(-1.0))*((d/500.0)**2.0)\n return M", "def gen_michaelis_menten_like_rate_law(model, reaction, modifiers=None, modifier_reactants=None, e...
[ "0.6287788", "0.6014177", "0.5828006", "0.581654", "0.57426035", "0.56839424", "0.5584756", "0.5534437", "0.55172247", "0.5506014", "0.5463826", "0.5462745", "0.5443701", "0.54029065", "0.5386619", "0.5363709", "0.53409606", "0.5324588", "0.5312518", "0.52996457", "0.5295975"...
0.77052456
0
Generate a list of response function expression string for each factor or
def gen_response_functions(model, beta, reaction_id, reaction_class, compartment, reaction_factors): all_species = {} all_parameters = {} all_volumes = {} all_observables = {} Avogadro = model.parameters.get_or_create( id='Avogadro', type=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n value = []\n for term in self.terms:\n value += [term.termname]\n return '<formula: %s>' % ' + '.join(value)", "def __str__(self):\n value = []\n for term in self.terms:\n value += [term.termname]\n return '<formula: %s>' % ' + ...
[ "0.58089125", "0.58089125", "0.55462015", "0.5503007", "0.54833835", "0.5481783", "0.5432828", "0.5411091", "0.53836125", "0.5354945", "0.53481805", "0.5292714", "0.52926564", "0.5233992", "0.5211005", "0.52106524", "0.51543814", "0.51541847", "0.51469135", "0.51277536", "0.5...
0.5859439
0
Generate a mass action rate law.
def gen_mass_action_rate_law(model, reaction, model_k, modifiers=None, modifier_reactants=None): if modifiers is None: modifier_species = [] modifier_product = '' modifier_ids = None else: modifier_species = [i for modifier in modifiers for i in modifier.expression.species] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, action):\n\n # handling error\n \n assert (action < self.NumofBandits)#, \"[ERROR] un-identified arm\"\n\n # return reward via sampling from normal distribution\n return np.random.normal(self.MeanList[action], self.sigma, 1)[0]", "def gen_michaelis_menten_like_rate_...
[ "0.56047213", "0.54291713", "0.542031", "0.5357383", "0.53155065", "0.5277161", "0.5276563", "0.5270473", "0.5256443", "0.5238966", "0.5236469", "0.51705104", "0.51416", "0.51164365", "0.508523", "0.5071778", "0.50373554", "0.5024558", "0.50096476", "0.5000236", "0.49968374",...
0.6918789
0
Retrieves and structures data, then returns it as a JSON object. Returns a JSON object containing data on given content type. If content_id is provided, data on the details of the content_type object associated with that id will be returned. The data is filtered by GET parameters in the request.
def get_data(request, content_type, content_id=None, detail_type=None): if not content_type in reports.all: raise ValueError("Invalid content type '%s'." % content_type) report = reports.all[content_type] params = {} for k, v in request.GET.iteritems(): params[str(k)] = v params['sin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_content(self, content_type):\n\n is_article, is_podcast, is_video = self.get_content_type(content_type)\n try:\n response = {\"status\": \"ok\"}\n if is_article:\n db_articles = self.db_connector.connect_to_collection(self.db_config[MONGODB][COLLECTION_ART...
[ "0.6068054", "0.5643524", "0.5611303", "0.55630034", "0.5533006", "0.5423254", "0.5415066", "0.53815", "0.5380223", "0.5372905", "0.5301533", "0.52925396", "0.5271781", "0.52477896", "0.52225494", "0.521501", "0.52142525", "0.51801217", "0.51786405", "0.51703274", "0.5169851"...
0.67843527
0
Testing navigation from the home page to the register page
def test_navigate_to_register_page(self): header_text = "Rejestracja" hp = HomePage(self.driver) # hp.close_covid_popup() # popup showed at the beginning of the project #hp.close_danger_alert_btn() hp.click_sign_in_btn() hp.click_manager_paczek_btn() hp.sw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_register_link_in_sign_in_page_redirects_to_register_page(self):\n self.browser.get(self.warno_url)\n self.browser.find_element_by_link_text(\"Sign In\").click()\n contents = self.browser.find_element_by_class_name(\"sub-title\")\n self.assertTrue(\"Sign In\" in contents.text, \...
[ "0.78052366", "0.7801648", "0.7790828", "0.7748568", "0.7650263", "0.7617399", "0.752229", "0.74573576", "0.74016523", "0.7319089", "0.7262614", "0.7243488", "0.72205514", "0.71841687", "0.7163706", "0.7119749", "0.71079457", "0.7102286", "0.7080773", "0.6997657", "0.69871354...
0.81974393
0
Logs a string as a notice message
def notice(self, message): return self.log("NOTICE", message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notice(self, message=''):\n print(message)", "def _notice(message):\n\n line = ''.join(['=' for _ in range(len(message))])\n return '%s\\n%s\\n%s' % (line, message, line)", "def logger_notice(self, msg, *args, **kwargs):\n if self.isEnabledFor(logging.NOTICE):\n self....
[ "0.72408473", "0.70507395", "0.6960173", "0.69343084", "0.6888592", "0.687398", "0.68280476", "0.67977995", "0.67710483", "0.6651304", "0.6558616", "0.65106034", "0.65093106", "0.6465615", "0.6437021", "0.64366806", "0.6435218", "0.6363992", "0.63604873", "0.6348215", "0.6332...
0.7259126
0
Creates ordinal label from number.
def ordinal_label(n): n = int(n) return "%d%s" % (n,"tsnrhtdd"[(n/10%10!=1)*(n%10<4)*n%10::4])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ordinal(number):\n _ordinal = lambda n: \"%d%s\" % (n,\"tsnrhtdd\"[(n/10%10!=1)*(n%10<4)*n%10::4]) # some black magic.\n return _ordinal(number)", "def ordinal(n):\n ord_dict = {1: \"st\", 2: \"nd\", 3: \"rd\"}\n return str(n + 1) + ord_dict.get((n + 1) if (n + 1) < 20 else (n + 1) % 10,...
[ "0.73869485", "0.7134777", "0.7044313", "0.7035709", "0.68190175", "0.67567396", "0.67338425", "0.6711969", "0.6689367", "0.66347045", "0.6615274", "0.6574517", "0.6574517", "0.6543084", "0.6472701", "0.6471276", "0.6316933", "0.61950207", "0.6108157", "0.6056941", "0.6015892...
0.783446
0
Produces a DataFrame as a Cartesian product of dictionary keys and values.
def cartesian_product(d): index = pd.MultiIndex.from_product(d.values(), names=d.keys()) return pd.DataFrame(index=index).reset_index()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_grid(data_dict: Dict[str, Union[int, float, np.ndarray]]) -> pd.DataFrame:\n rows = it.product(*data_dict.values())\n return pd.DataFrame.from_records(rows, columns=data_dict.keys())", "def combine_categories(cat_dict:Dict[str, List[Any]]) -> DataFrame: \n\n return DataFrame(list(it.produc...
[ "0.73459375", "0.7168081", "0.7023469", "0.67691296", "0.67455286", "0.67433184", "0.6350584", "0.63128096", "0.6089915", "0.607942", "0.607145", "0.607145", "0.59566784", "0.5938019", "0.5922559", "0.59186465", "0.5908222", "0.588256", "0.5875265", "0.5834932", "0.5801301", ...
0.7937145
0
Fix LyX formatting in included subfiles
def fix_subfiles(ln): m = input_re.search(ln) if m: fn = m.group(1) fI = file(fn,"r") fO = file(fn + ".tmp","w") for ln in fI: ln = sqb2_re.sub("[",ln) fO.write(unescape_sqb(ln)) fI.close() fO.close() fI = file(fn,"w") fO = file(fn + ".tmp","r") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeUnimacroVchLineInVocolaFiles(self, subDirectory=None):\n uscFile = 'Unimacro.vch'\n oldUscFile = 'usc.vch'\n## reInclude = re.compile(r'^include\\s+.*unimacro.vch;$', re.MULTILINE)\n## reOldInclude = re.compile(r'^include\\s+.*usc.vch;$', re.MULTILINE)\n\n # also remove...
[ "0.5320353", "0.5295681", "0.52692676", "0.52336377", "0.51420474", "0.510494", "0.50934607", "0.5066666", "0.5064372", "0.50365895", "0.50024724", "0.5001046", "0.4975817", "0.49606284", "0.49428836", "0.49105868", "0.49038255", "0.49023068", "0.4900259", "0.48850402", "0.48...
0.61806
0
Fix include filename mangling that LyX does for no good reason. LyX mangles "file_name" => "filename". Search through containing dir to find the correct version.
def fix_mangled_includes(ln): m = proginput_re.search(ln) if m: fn = m.group(1) dName = os.path.dirname(fn) fName = os.path.basename(fn) for fn2 in os.listdir(dName): if fn2.replace("_","") == fName: ln = "\\programinput{" + os.path.join(dName,fn2) + "}\n" bre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixupFileNames(process):\n if not hasattr(process.source, \"fileNames\"):\n process.source.fileNames = cms.untracked.vstring()\n return", "def fix_filename(self):\n if not self.remove_path:\n return\n self.filename = re.sub(\".+\\/\", \".../\", self.filename)", "def fi...
[ "0.66436046", "0.6448468", "0.5981756", "0.59196293", "0.59015834", "0.5827273", "0.5826741", "0.5817726", "0.5708837", "0.56985724", "0.5690983", "0.5678881", "0.56651527", "0.56329024", "0.5624595", "0.55954534", "0.55808103", "0.5569674", "0.5564362", "0.5563584", "0.54859...
0.71810347
0
Tests that nothing is output by the null output module.
def testNoOutput(self): output_mediator = self._CreateOutputMediator() output_writer = cli_test_lib.TestOutputWriter() output_module = null.NullOutputModule(output_mediator) output_module.WriteHeader() event, event_data, event_data_stream = ( containers_test_lib.CreateEventFromValues(self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_none_input(self):\n eq_(None, output())", "def test_void_msg(self):\n assert output(None) is None\n assert output() is None", "def test_nooutput(nb_path):\n nb = load_notebook(nb_path)\n\n for ws in nb.worksheets:\n for cell in ws.cells:\n if cell.cell_type...
[ "0.8111121", "0.76955336", "0.70533454", "0.694179", "0.68639696", "0.6833746", "0.68290937", "0.6795641", "0.6758593", "0.6741953", "0.6691472", "0.6664452", "0.66435593", "0.6643503", "0.65925795", "0.6579869", "0.65603685", "0.6512958", "0.6490352", "0.6469057", "0.6446879...
0.8273881
0
Test only once that command line scripts are installed correctly.
def test_scripts_are_installed(self): fits_file = os.path.join(self.datadir, 'monol_testA.evt') command = 'HENreadfile {0}'.format(fits_file) sp.check_call(command.split())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_installed(self):\n # OSA script should have been installed in setUp function\n self.assertTrue(self.run_function(\"assistive.installed\", [OSA_SCRIPT]))\n # Clean up install\n self.run_function(\"assistive.remove\", [OSA_SCRIPT])\n # Installed should now return False\n ...
[ "0.6974617", "0.67897546", "0.6693043", "0.666551", "0.66470766", "0.6633764", "0.6583654", "0.65805525", "0.65706635", "0.6552767", "0.65487355", "0.6525911", "0.65205854", "0.648944", "0.6480113", "0.6443173", "0.63999575", "0.63863325", "0.63630253", "0.63592577", "0.63308...
0.68897045
1
Test produce a fake event file.
def test_fake_file(self): fits_file = os.path.join(self.datadir, 'monol_test_fake.evt') hen.fake.main(['-o', fits_file, '--instrument', 'FPMB']) info = hen.io.print_fits_info(fits_file, hdu=1) assert info['Instrument'] == 'FPMB'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_events_split(self):\n command = \\\n '{0} -g --min-length 0'.format(\n os.path.join(self.datadir, 'monol_testB.evt'))\n hen.read_events.main(command.split())\n new_filename = os.path.join(self.datadir,\n 'monol_testB_nu...
[ "0.64153403", "0.6339303", "0.63201517", "0.6305741", "0.62906855", "0.62769383", "0.62340873", "0.6218417", "0.6212402", "0.6133925", "0.6131452", "0.61069983", "0.6103589", "0.60613674", "0.602289", "0.6005359", "0.5976452", "0.59519935", "0.5946153", "0.5937429", "0.593332...
0.6963458
0
Test produce a fake event file from input light curve.
def test_fake_file_from_input_lc(self): lcurve_in = os.path.join(self.datadir, 'lcurveA.fits') fits_file = os.path.join(self.datadir, 'monol_test_fake_lc.evt') hen.fake.main(['--lc', lcurve_in, '-o', fits_file])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exposure(self):\n lcname = os.path.join(self.datadir,\n 'monol_testA_E3-50_lc' + HEN_FILE_EXTENSION)\n ufname = os.path.join(self.datadir, 'monol_testA_uf.evt')\n command = \"{0} {1}\".format(lcname, ufname)\n\n hen.exposure.main(command.split())\n ...
[ "0.6769347", "0.6730466", "0.6281644", "0.6268562", "0.61029303", "0.60985297", "0.60939366", "0.60887676", "0.6070051", "0.5972137", "0.5969055", "0.59108436", "0.5861858", "0.581648", "0.5795873", "0.5783602", "0.5776611", "0.5694053", "0.5672556", "0.56640023", "0.5626866"...
0.69957054
0
Test produce a fake event file and apply deadtime.
def test_fake_file_with_deadtime(self): fits_file = os.path.join(self.datadir, 'monol_test_fake_lc.evt') hen.fake.main(['--deadtime', '2.5e-3', '--ctrate', '2000', '-o', fits_file])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_events_split(self):\n command = \\\n '{0} -g --min-length 0'.format(\n os.path.join(self.datadir, 'monol_testB.evt'))\n hen.read_events.main(command.split())\n new_filename = os.path.join(self.datadir,\n 'monol_testB_nu...
[ "0.63887835", "0.62179023", "0.61110246", "0.60072523", "0.5978976", "0.58581614", "0.58516926", "0.5829617", "0.5808853", "0.5778332", "0.5762695", "0.5742283", "0.5739026", "0.5724766", "0.57007337", "0.56739664", "0.56659937", "0.5628896", "0.56286407", "0.5623167", "0.560...
0.7954288
0
Test event file reading.
def test_load_events(self): command = '{0}'.format( os.path.join(self.datadir, 'monol_testA.evt')) hen.read_events.main(command.split()) new_filename = self.first_event_file ev = hen.io.load_events(new_filename) assert hasattr(ev, 'header') assert hasattr(ev, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_handle_events_reading():\n # We can use any `raw` for this\n raw = _read_raw_fif(raw_fname)\n\n # Create an arbitrary events.tsv file, to test we can deal with 'n/a'\n # make sure we can deal w/ \"#\" characters\n events = {'onset': [11, 12, 'n/a'],\n 'duration': ['n/a', 'n/a',...
[ "0.78725404", "0.7057562", "0.69388264", "0.66717094", "0.66127527", "0.65376514", "0.6465851", "0.6334417", "0.63236123", "0.631068", "0.6237863", "0.62288815", "0.6201836", "0.61862516", "0.6170473", "0.6125935", "0.61214274", "0.61196", "0.60524106", "0.60460144", "0.60427...
0.7717368
1
Test event file splitting.
def test_load_events_split(self): command = \ '{0} -g --min-length 0'.format( os.path.join(self.datadir, 'monol_testB.evt')) hen.read_events.main(command.split()) new_filename = os.path.join(self.datadir, 'monol_testB_nustar_fpmb_gt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testMoreEvents(self):\n splitter = SplitterFactory()\n jobFactory = splitter(self.singleFileSubscription)\n\n jobGroups = jobFactory(events_per_job=1000,\n performance=self.performanceParams)\n\n self.assertEqual(len(jobGroups), 1)\n\n self.asser...
[ "0.7314568", "0.7163128", "0.69942826", "0.6982227", "0.6975588", "0.693897", "0.6906183", "0.6818625", "0.67471594", "0.66763854", "0.6414649", "0.64054245", "0.630198", "0.6272611", "0.6271086", "0.62079275", "0.6154727", "0.61451495", "0.6134416", "0.6100774", "0.6088197",...
0.7863148
0
Test loading of GTIs from FITS files.
def test_load_gtis(self): fits_file = os.path.join(self.datadir, 'monol_testA.evt') hen.io.load_gtis(fits_file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_gtis(self):\n fname = os.path.join(datadir, 'monol_testA.evt')\n load_gtis(fname, gtistring=\"GTI\")", "def load_gtis(fits_file, gtistring=None):\n\n gtistring = assign_value_if_none(gtistring, \"GTI\")\n logging.info(\"Loading GTIS from file %s\" % fits_file)\n lchdulist = f...
[ "0.73460406", "0.67188", "0.62345934", "0.62014383", "0.6162042", "0.6150643", "0.6099147", "0.6081148", "0.598014", "0.59351677", "0.59318435", "0.58310604", "0.5820864", "0.58163166", "0.5808014", "0.5791047", "0.57879263", "0.577961", "0.5760511", "0.5753291", "0.57127666"...
0.72617346
1
Test event file reading w. noclobber option.
def test_load_events_noclobber(self): with catch_warnings() as w: command = \ '{0} --noclobber'.format( os.path.join(self.datadir, 'monol_testB.evt')) hen.read_events.main(command.split()) assert str(w[0].message).strip().endswith( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_events_split(self):\n command = \\\n '{0} -g --min-length 0'.format(\n os.path.join(self.datadir, 'monol_testB.evt'))\n hen.read_events.main(command.split())\n new_filename = os.path.join(self.datadir,\n 'monol_testB_nu...
[ "0.6376009", "0.60791147", "0.58381367", "0.57389647", "0.57356375", "0.56528574", "0.5562758", "0.54229695", "0.54170734", "0.5383536", "0.53549117", "0.53361964", "0.52833545", "0.5282208", "0.52574253", "0.5246699", "0.5231599", "0.5195471", "0.5193903", "0.514045", "0.513...
0.71811295
0
Test event file calibration.
def test_calibrate(self): from astropy.io.fits import Header command = '{0} -r {1}'.format( os.path.join(self.datadir, 'monol_testA_nustar_fpma_ev' + HEN_FILE_EXTENSION), os.path.join(self.datadir, 'test.rmf')) hen.calibrate.main(command.split()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_readfile_fits(self):\n fitsname = os.path.join(self.datadir, 'monol_testA.evt')\n command = \"{0}\".format(fitsname)\n\n hen.io.main(command.split())", "def test_load_events(self):\n command = '{0}'.format(\n os.path.join(self.datadir, 'monol_testA.evt'))\n ...
[ "0.67325795", "0.6651512", "0.63931286", "0.63710934", "0.63201684", "0.6311715", "0.60984355", "0.606237", "0.589776", "0.58932596", "0.58625025", "0.5819384", "0.5815674", "0.5760806", "0.57554466", "0.57474864", "0.57405794", "0.57050556", "0.5685277", "0.56803167", "0.567...
0.720863
0
Test lc reading of split event file.
def test_lcurve_from_split_event(self): command = '{0}'.format( os.path.join(self.datadir, 'monol_testB_nustar_fpmb_gti000_ev' + HEN_FILE_EXTENSION)) hen.lcurve.main(command.split()) new_filename = os.path.join(self.datadir, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_events_split(self):\n command = \\\n '{0} -g --min-length 0'.format(\n os.path.join(self.datadir, 'monol_testB.evt'))\n hen.read_events.main(command.split())\n new_filename = os.path.join(self.datadir,\n 'monol_testB_nu...
[ "0.72642326", "0.6814929", "0.6261977", "0.6147328", "0.6099665", "0.60870576", "0.5996949", "0.59344697", "0.5877596", "0.58591545", "0.58400553", "0.58256274", "0.5816509", "0.5804221", "0.5793906", "0.5787376", "0.57608455", "0.5732434", "0.5727536", "0.57187974", "0.57167...
0.68756384
1
Test light curves from txt.
def test_txt_lcurve(self): lcurve_mp = os.path.join(self.datadir, 'lcurve_lc' + HEN_FILE_EXTENSION) lcdata_mp = hen.io.load_data(lcurve_mp) lc_mp = lcdata_mp['counts'] time_mp = lcdata_mp['time'] lcurve_txt_orig =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_rbn_lightcurve(lc_file,log):\n\n if path.isfile(lc_file):\n\n lines = open(lc_file, 'r').readlines()\n\n imnames = []\n hjd = []\n cal_mag = []\n cal_mag_err = []\n\n for l in lines:\n\n if l[0:1] != '#':\n\n entries = l.replace('\\n',...
[ "0.569566", "0.5680329", "0.5670007", "0.55977255", "0.5583962", "0.55354595", "0.54946536", "0.5486569", "0.5473411", "0.53503877", "0.5306506", "0.5292664", "0.5287089", "0.52713996", "0.5246861", "0.52457684", "0.5229659", "0.52288675", "0.51897776", "0.5181772", "0.516255...
0.61316156
0
Test light curve error from uncalibrated file.
def test_lcurve_error_uncalibrated(self): command = ('{0} -e {1} {2}').format( os.path.join(self.datadir, 'monol_testA_nustar_fpma_ev' + HEN_FILE_EXTENSION), 3, 50) with pytest.raises(ValueError) as excinfo: hen.lcurve.main(command.split()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exposure(self):\n lcname = os.path.join(self.datadir,\n 'monol_testA_E3-50_lc' + HEN_FILE_EXTENSION)\n ufname = os.path.join(self.datadir, 'monol_testA_uf.evt')\n command = \"{0} {1}\".format(lcname, ufname)\n\n hen.exposure.main(command.split())\n ...
[ "0.59143955", "0.5874847", "0.5690411", "0.56704605", "0.5661254", "0.5647784", "0.55978703", "0.55567527", "0.5556649", "0.5556532", "0.55512697", "0.5520491", "0.54843724", "0.5477827", "0.54773617", "0.54435277", "0.5443175", "0.5423331", "0.54143107", "0.539867", "0.53848...
0.67324406
0
Test light curve using PI filtering.
def test_lcurve_pi_filtering(self): command = ('{0} --pi-interval {1} {2}').format( os.path.join(self.datadir, 'monol_testA_nustar_fpma_ev' + HEN_FILE_EXTENSION), 10, 300) hen.lcurve.main(command.split())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def estimate_pi(n_samples):\n return ##", "def test_figure34(self):\n star = 0.1\n current = 1.37\n func = lambda x: x**6 + 3 * x - 4\n\n logging.info(\"\\nCONFIRMING FIGURE 3.4\")\n rf_results = undertest.regula_falsi(func, star, current, 100)", "def test_filter_image():\...
[ "0.5803924", "0.5782736", "0.57526773", "0.5711505", "0.565193", "0.5546945", "0.5539864", "0.53791374", "0.5375738", "0.53449756", "0.5342094", "0.52266186", "0.5203243", "0.5192747", "0.51769245", "0.51610726", "0.51525754", "0.51495785", "0.51495785", "0.51338094", "0.5116...
0.7346066
0
Test PDS production with light curves obtained from FITS files.
def test_pds_fits(self): lcurve_ftools = os.path.join(self.datadir, 'lcurve_ftools_lc' + HEN_FILE_EXTENSION) command = '{0} -f 128'.format(lcurve_ftools) hen.fspec.main(command.split())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exposure(self):\n lcname = os.path.join(self.datadir,\n 'monol_testA_E3-50_lc' + HEN_FILE_EXTENSION)\n ufname = os.path.join(self.datadir, 'monol_testA_uf.evt')\n command = \"{0} {1}\".format(lcname, ufname)\n\n hen.exposure.main(command.split())\n ...
[ "0.6251466", "0.6124106", "0.6096896", "0.6039733", "0.5942623", "0.5892023", "0.58829653", "0.58586764", "0.57965785", "0.5752457", "0.574992", "0.57489634", "0.5670348", "0.5650329", "0.5618153", "0.5616383", "0.5584145", "0.55779684", "0.5567005", "0.5555035", "0.55283993"...
0.66344583
0
Test PDS production with light curves obtained from txt files.
def test_pds_txt(self): lcurve_txt = os.path.join(self.datadir, 'lcurve_txt_lc' + HEN_FILE_EXTENSION) command = '{0} -f 128'.format(lcurve_txt) hen.fspec.main(command.split())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_learning_curves():\n\n p = pipeline.Pipeline(\n FX_TRAIN,\n FX_TEST,\n FX_LOOKUP,\n RESULTS_DIR\n )\n\n data = p.learning_curves()", "def Test(self):\n\t\tself.filename = \"NC-Xy_norm_bgsub.txt\"\n\t\tself.dirname = \"data\"\n\t\tself.FileText.SetLabel(\"File: \"+sel...
[ "0.60249114", "0.5936213", "0.5783816", "0.57325065", "0.5712521", "0.57061243", "0.56904006", "0.56792295", "0.5664974", "0.5652633", "0.5507149", "0.5503477", "0.5496847", "0.5476406", "0.5472243", "0.54595065", "0.54483986", "0.5445709", "0.54399174", "0.54397976", "0.5438...
0.6278704
0
Test PDS rebinning 1.
def test_rebinpds(self): command = '{0} -r 2'.format( os.path.join(self.datadir, 'monol_testA_E3-50_pds') + HEN_FILE_EXTENSION) hen.rebin.main(command.split()) os.path.exists(os.path.join(self.datadir, 'monol_testA_E3-50_pds_rebin2' + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_binops(self):", "def test_rebinpds_geom(self):\n command = '{0} {1} -r 1.03'.format(\n os.path.join(self.datadir, 'monol_testA_E3-50_pds') +\n HEN_FILE_EXTENSION,\n os.path.join(self.datadir, 'monol_testB_E3-50_pds') +\n HEN_FILE_EXTENSION\n ...
[ "0.5917071", "0.5863595", "0.557819", "0.5504155", "0.5500331", "0.5469541", "0.54315436", "0.5407698", "0.53852385", "0.53775984", "0.5354975", "0.53355914", "0.53105575", "0.5309412", "0.53044146", "0.5296392", "0.52663785", "0.52662915", "0.5217162", "0.5208845", "0.520859...
0.68580997
0
Test geometrical PDS rebinning.
def test_rebinpds_geom(self): command = '{0} {1} -r 1.03'.format( os.path.join(self.datadir, 'monol_testA_E3-50_pds') + HEN_FILE_EXTENSION, os.path.join(self.datadir, 'monol_testB_E3-50_pds') + HEN_FILE_EXTENSION ) hen.rebin.main(command.split(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rebinpds(self):\n command = '{0} -r 2'.format(\n os.path.join(self.datadir, 'monol_testA_E3-50_pds') +\n HEN_FILE_EXTENSION)\n hen.rebin.main(command.split())\n os.path.exists(os.path.join(self.datadir,\n 'monol_testA_E3-50_pds_...
[ "0.68998414", "0.6782672", "0.5927923", "0.58226484", "0.58135587", "0.57595927", "0.5640907", "0.5584799", "0.55788314", "0.55616194", "0.55351686", "0.55208755", "0.5422113", "0.5415267", "0.53913563", "0.5384141", "0.53811336", "0.53540754", "0.5332196", "0.5330341", "0.53...
0.7192734
0
Test CPDS geometrical rebinning.
def test_rebincpds_geom(self): command = '{0} -r 1.03'.format( os.path.join(self.datadir, 'monol_test_E3-50_cpds') + HEN_FILE_EXTENSION) hen.rebin.main(command.split()) os.path.exists(os.path.join(self.datadir, 'monol_test_E3-50_cpds_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rebinpds_geom(self):\n command = '{0} {1} -r 1.03'.format(\n os.path.join(self.datadir, 'monol_testA_E3-50_pds') +\n HEN_FILE_EXTENSION,\n os.path.join(self.datadir, 'monol_testB_E3-50_pds') +\n HEN_FILE_EXTENSION\n )\n hen.rebin.main(co...
[ "0.71494734", "0.62433624", "0.6172712", "0.6141478", "0.6083189", "0.59623307", "0.5951547", "0.5936138", "0.5809836", "0.580893", "0.57427347", "0.5690872", "0.5679986", "0.5669417", "0.56561536", "0.5626698", "0.5623851", "0.56144714", "0.5598728", "0.5585624", "0.5585264"...
0.7188367
0
Test creating a GTI file.
def test_create_gti(self): fname = os.path.join(self.datadir, 'monol_testA_E3-50_lc_rebin4') + \ HEN_FILE_EXTENSION command = "{0} -f counts>0 -c --debug".format(fname) hen.create_gti.main(command.split())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_GFD_export_create_file(self):\n filepath = '1.txt'\n gfd = flow_processing_input.GroundFlowData()\n gfd.detector_flow_data = createGFDDataset(1).dataset\n gfd.export_to_file(filepath)\n # Check if file was created at filepath\n self.assertTrue(os.path.exists(filep...
[ "0.7093418", "0.6752971", "0.6716273", "0.671094", "0.65978765", "0.64993507", "0.6397478", "0.63674074", "0.63462603", "0.6325767", "0.6269832", "0.6250087", "0.6235167", "0.6181781", "0.61637694", "0.6146977", "0.61391836", "0.61083645", "0.610165", "0.6092029", "0.6085789"...
0.7189019
0
Test applying a GTI file.
def test_apply_gti(self): fname = os.path.join(self.datadir, 'monol_testA_E3-50_rebin4_gti') + \ HEN_FILE_EXTENSION lcfname = os.path.join(self.datadir, 'monol_testA_E3-50_lc') + \ HEN_FILE_EXTENSION lcoutname = os.path.join(self.datadir, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_gti_and_apply(self):\n fname = os.path.join(self.datadir, 'monol_testA_E3-50_rebin4_gti') + \\\n HEN_FILE_EXTENSION\n lcfname = os.path.join(self.datadir, 'monol_testA_E3-50_lc') + \\\n HEN_FILE_EXTENSION\n command = \"{0} -a {1} -l 10 --debug\".format(lcf...
[ "0.6586221", "0.6527309", "0.65199673", "0.62979263", "0.62007684", "0.617841", "0.59975123", "0.59579366", "0.595273", "0.5926203", "0.59051687", "0.5845877", "0.58215946", "0.58088547", "0.5700836", "0.5698795", "0.56917137", "0.5680694", "0.5675855", "0.5674958", "0.566408...
0.6987641
0
Test creating a GTI file and apply minimum length.
def test_create_gti_and_minlen(self): fname = os.path.join(self.datadir, 'monol_testA_E3-50_lc_rebin4') + \ HEN_FILE_EXTENSION command = "{0} -f counts>0 -c -l 10 --debug".format(fname) hen.create_gti.main(command.split())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_test_file(self):\n self.test_file = os.path.join(os.path.dirname(self.server_path), \"data\")\n with open(self.test_file, \"ab+\") as f:\n n_blocks = int(self.args.size) // self.max_block_size\n for i in range(n_blocks):\n f.write(bytearray(os.urandom...
[ "0.63537604", "0.62264436", "0.6143152", "0.60380083", "0.59936726", "0.5952793", "0.5916604", "0.59126633", "0.5896254", "0.5841531", "0.5829041", "0.5724365", "0.56868017", "0.5675968", "0.5658342", "0.5623648", "0.56201065", "0.56160897", "0.56160897", "0.56160897", "0.561...
0.73614866
0
Test reading and dumping a HENDRICS file.
def test_readfile(self): fname = os.path.join(self.datadir, 'monol_testA_E3-50_rebin4_gti') + \ HEN_FILE_EXTENSION command = "{0}".format(fname) hen.io.main(command.split())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_infile(self):\r\n pass # not practically testable, but obvious file I/O\r", "def test_readfile_fits(self):\n fitsname = os.path.join(self.datadir, 'monol_testA.evt')\n command = \"{0}\".format(fitsname)\n\n hen.io.main(command.split())", "def test_h5file(dl2_shower_geo...
[ "0.632977", "0.61222935", "0.610227", "0.6049381", "0.6046127", "0.6011443", "0.59203285", "0.5869138", "0.58631635", "0.58628577", "0.5846624", "0.58327186", "0.5827141", "0.5826123", "0.58182776", "0.5761457", "0.57446647", "0.5706779", "0.56861", "0.56510913", "0.5640794",...
0.66671103
0
Test reading and dumping a FITS file.
def test_readfile_fits(self): fitsname = os.path.join(self.datadir, 'monol_testA.evt') command = "{0}".format(fitsname) hen.io.main(command.split())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fileobj_not_closed(self):\n\n f = open(self.data('test0.fits'), 'rb')\n data = fits.getdata(f)\n assert not f.closed\n\n f.seek(0)\n header = fits.getheader(f)\n assert not f.closed", "def test_fileobj_not_closed(self):\n\n f = open(self.data(\"test0.fits...
[ "0.6848094", "0.682362", "0.67414623", "0.6560636", "0.6093442", "0.60286057", "0.60234857", "0.6014833", "0.59855384", "0.5969272", "0.59645146", "0.5910483", "0.5897435", "0.5867881", "0.5864357", "0.5754397", "0.57534695", "0.5721017", "0.5707128", "0.56546456", "0.5599596...
0.6885061
0
Test saving arrays in a qdp file.
def test_save_as_qdp(self): arrays = [np.array([0, 1, 3]), np.array([1, 4, 5])] errors = [np.array([1, 1, 1]), np.array([[1, 0.5], [1, 0.5], [1, 1]])] hen.io.save_as_qdp(arrays, errors, filename=os.path.join(self.datadir, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self,path=\"qtable.npy\"):\n np.save(path, self.Q)", "def test_save_npy(temp_dir):\n data = np.array([[1, 2, 3], [4, 5, 6]])\n save_npy(temp_dir, data, step=1)\n\n assert os.path.exists(os.path.join(temp_dir, \"npy\", \"1.npy\"))", "def test_write_element(setup_teardown_file):\n f =...
[ "0.66132224", "0.66071993", "0.6551961", "0.6438377", "0.6435944", "0.6241034", "0.6229039", "0.61717445", "0.60413206", "0.6013935", "0.5970965", "0.5943756", "0.5933532", "0.59310764", "0.589113", "0.58675534", "0.5862705", "0.58573425", "0.5813297", "0.579554", "0.57925117...
0.7908789
0
Test saving arrays in a ascii file.
def test_save_as_ascii(self): array = np.array([0, 1, 3]) errors = np.array([1, 1, 1]) hen.io.save_as_ascii( [array, errors], filename=os.path.join(self.datadir, "monol_test.txt"), colnames=["array", "err"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_file_ascii_readwrite_append(self):\n FileWriter(self.ascii_path).append(self.ascii_string) #append a second string of the ascii text\n ascii_text = FileReader(self.ascii_path).read()\n self.assertEqual(ascii_text, (self.ascii_string)*2) #confirm that it equals two of the ascii strings...
[ "0.6797589", "0.6673825", "0.6630659", "0.6209932", "0.61529315", "0.6104469", "0.609755", "0.60560244", "0.6035431", "0.6005507", "0.59638107", "0.59621936", "0.58845955", "0.58538973", "0.58291656", "0.58197", "0.58167315", "0.5811338", "0.57886434", "0.57754457", "0.573186...
0.8115425
0
Test getting file type.
def test_get_file_type(self): file_list = {'events': 'monol_testA_nustar_fpma_ev', 'lc': 'monol_testA_E3-50_lc', 'pds': 'monol_testA_E3-50_pds', 'gti': 'monol_testA_E3-50_rebin4_gti', 'cpds': 'monol_test_E3-50_cpds'} for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_type(self):\n x = h5i.get_type(self.fid)\n self.assertEqual(x, h5i.FILE)", "def file_type(self):\n return self.__file_type", "def file_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"file_type\")", "def file_type(self) -> Optional[pulumi.Input[str]]...
[ "0.7778744", "0.73670936", "0.7324654", "0.7324654", "0.72500575", "0.7227385", "0.719856", "0.7110117", "0.70442784", "0.7006565", "0.7004782", "0.6994606", "0.69025415", "0.6900305", "0.6894119", "0.68896765", "0.68829775", "0.6875616", "0.6867143", "0.68610924", "0.685226"...
0.79173285
0
Test exposure calculations from unfiltered files.
def test_exposure(self): lcname = os.path.join(self.datadir, 'monol_testA_E3-50_lc' + HEN_FILE_EXTENSION) ufname = os.path.join(self.datadir, 'monol_testA_uf.evt') command = "{0} {1}".format(lcname, ufname) hen.exposure.main(command.split()) fname =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basic_file_mean(self):\n index = pds.date_range(*self.bounds1)\n names = [''.join((date.strftime('%Y-%m-%d'), '.nofile'))\n for date in index]\n self.testInst.bounds = (names[0], names[-1])\n ans = avg.mean_by_file(self.testInst, 'dummy4')\n assert np.all...
[ "0.62009376", "0.6150743", "0.574039", "0.572225", "0.55350596", "0.55201584", "0.55170083", "0.5488506", "0.5420085", "0.53870773", "0.53762525", "0.53598815", "0.5341592", "0.5332976", "0.53094757", "0.5308426", "0.5308426", "0.52931494", "0.5274691", "0.52548724", "0.52055...
0.65452904
0
Test plotting with linear axes.
def test_plot_lin(self): pname = os.path.join(self.datadir, 'monol_testA_E3-50_pds_fit') + \ HEN_FILE_EXTENSION cname = os.path.join(self.datadir, 'monol_test_E3-50_cpds_fit') + \ HEN_FILE_EXTENSION lname = os.path.join(self.datadir, 'monol_testA_E3-50_lc') + \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_plot_lm(models, kwargs):\n idata = models.model_1\n if \"constant_data\" not in idata.groups():\n y = idata.observed_data[\"y\"]\n x1data = y.coords[y.dims[0]]\n idata.add_groups({\"constant_data\": {\"_\": x1data}})\n idata.constant_data[\"x1\"] = x1data\n idata.c...
[ "0.68947345", "0.6887523", "0.682431", "0.666872", "0.6560102", "0.6498744", "0.6496291", "0.64012283", "0.6333619", "0.62561834", "0.6133041", "0.60655403", "0.60533863", "0.6038129", "0.6028388", "0.6010345", "0.60041004", "0.5959134", "0.5875316", "0.58119386", "0.5802028"...
0.69099814
0
Test plotting with log axes.
def test_plot_log(self): pname = os.path.join( self.datadir, 'monol_testA_E3-50_pds_rebin1.03' + HEN_FILE_EXTENSION) cname = os.path.join( self.datadir, 'monol_test_E3-50_cpds_rebin1.03' + HEN_FILE_EXTENSION) hen.plot.main([pname, cname, '--noplot'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_plot_log(self):\n print(sys._getframe().f_code.co_name)\n try:\n x = np.arange(0,6)*300000\n y = np.arange(0,6)\n pp.make_plot(x,y,plot_type='d',y_axis_type='log',xticks=[0,1,2,3], yticks=[0,1,2,3])\n except Exception as e:\n raise\n ...
[ "0.78871995", "0.76733375", "0.7631006", "0.7516526", "0.7318652", "0.70414484", "0.6982234", "0.69752365", "0.6940545", "0.68439573", "0.6776018", "0.6752774", "0.6652542", "0.662009", "0.64057577", "0.6348398", "0.62645173", "0.62526333", "0.62495255", "0.62425894", "0.6208...
0.8012656
0
Test plotting and saving figure.
def test_plot_save_figure(self): pname = os.path.join( self.datadir, 'monol_testA_E3-50_pds_rebin1.03' + HEN_FILE_EXTENSION) hen.plot.main([pname, '--noplot', '--figname', os.path.join(self.datadir, 'monol_testA_E3-50_pds_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_plot_images(self):\n save_file(self.quart.plot_images)", "def test_screenshot_then_show():\n vpl.figure()\n vpl.quick_test_plot()\n vpl.screenshot_fig()\n vpl.show()", "def test_plotting():\n specs = _read_schrodinger('tests/test_data/{}.inp'.format(PROBLEM))\n xint, yint = _i...
[ "0.7563004", "0.75458574", "0.7324701", "0.71855116", "0.7142674", "0.7085758", "0.704778", "0.7046471", "0.70020914", "0.6958422", "0.6957083", "0.69198906", "0.6912543", "0.69013923", "0.68642294", "0.6802434", "0.6783772", "0.6756197", "0.67375517", "0.671344", "0.6709116"...
0.8245673
0
Gets the number of collisions at the coordinates. Ignores the ids in the ignored_paths
def get_cat(self, ignored_paths: List[int], coord: Coordinate, time: int) -> int: collision = 0 if self.active: for key, value in self.length.items(): if time > value: if (key, value) in self.cat[coord.y][coord.x]: collision += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_collisions(self) -> int:\n if len(self.obstacles) == 0:\n return 0\n collision_list = [ob.detect_collision(self.agent)\n for ob in self.obstacles]\n return sum(collision_list)", "def get_collisions(self) -> int:\n if len(self.obstacles) == 0...
[ "0.64619607", "0.6439374", "0.63236296", "0.6257144", "0.6211582", "0.62034947", "0.6110104", "0.6016271", "0.56328464", "0.5632539", "0.5608418", "0.5540329", "0.55401343", "0.5539567", "0.55292344", "0.55271816", "0.5511189", "0.55045944", "0.5460688", "0.5457461", "0.54477...
0.64779216
0
returns True if an HA config is used
def _is_ha_config(hdfs_site): name_services = hdfs_site.get('dfs.nameservices', None) if name_services: for ns in name_services.split(","): if hdfs_site.get('dfs.ha.namenodes.'+ns): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_shed_tool_conf(self):", "def is_config_exist(self) -> bool:\n return True", "def is_config_exist(self) -> bool:\n pass", "async def is_configured(hass: HomeAssistant) -> bool:\n manager = await async_get_manager(hass)\n if manager.data is None:\n return False\n return boo...
[ "0.71549714", "0.68583125", "0.6850335", "0.67358667", "0.6728617", "0.6647879", "0.6569314", "0.65010345", "0.649958", "0.6453439", "0.64328307", "0.64200795", "0.6259015", "0.6258465", "0.6241355", "0.6222266", "0.6219986", "0.61745864", "0.61591274", "0.60989064", "0.60897...
0.7377559
0
In nonha mode it will return list of hdfs_site[dfs.namenode.http[s]address] In hamode it will return list of hdfs_site[dfs.namenode.httpaddress.NS.Uid], where NS is the name of HA, and Uid is id of NameNode In federated mode it will return all namenodes for internal name services
def get_all_namenode_addresses(hdfs_site): nn_addresses = [] name_services = get_nameservices(hdfs_site) if not name_services: name_services = [None] #fall back to config handling without name services for ns in name_services: nn_addresses += _get_all_namenode_addresses_single_ns(hdfs_site, ns) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nameservices(hdfs_site):\n\n name_services_param = hdfs_site.get('dfs.internal.nameservices', None) #in Federated mode this can be a list\n if name_services_param:\n name_services = name_services_param.split(\",\")\n return name_services\n\n name_services_string = hdfs_site.get('dfs.nameservices',...
[ "0.6113978", "0.6058483", "0.5954218", "0.5744809", "0.57181233", "0.5688863", "0.56163675", "0.5579856", "0.5565461", "0.55562496", "0.55537", "0.553602", "0.5518998", "0.5503041", "0.5466331", "0.5448768", "0.54469824", "0.5413014", "0.53820455", "0.53659606", "0.53652817",...
0.70683736
0
Multiple nameservices can be configured for example to support seamless distcp between two HA clusters. The nameservices are defined as a comma separated list in hdfs_site['dfs.nameservices']. The parameter hdfs['dfs.internal.nameservices'] was introduced in Hadoop 2.6 to denote the nameservice for the current cluster ...
def get_nameservices(hdfs_site): name_services_param = hdfs_site.get('dfs.internal.nameservices', None) #in Federated mode this can be a list if name_services_param: name_services = name_services_param.split(",") return name_services name_services_string = hdfs_site.get('dfs.nameservices', None) if n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name_service_by_hostname(hdfs_site, host_name):\n #there has to be a name service - we are in HA at least\n name_services_string = hdfs_site['dfs.internal.nameservices']\n if is_empty(name_services_string):\n return None\n name_services = name_services_string.split(',')\n if len(name_services) == 1...
[ "0.6970038", "0.5972412", "0.59035283", "0.5691643", "0.53706396", "0.5335285", "0.52849275", "0.5227498", "0.5222573", "0.5204615", "0.5203605", "0.51690084", "0.5161942", "0.5013299", "0.50092745", "0.4986707", "0.49722385", "0.49545738", "0.49537697", "0.4948395", "0.49294...
0.8501559
0
Finds the name service which the name node belongs to in an HA or federated setup.
def get_name_service_by_hostname(hdfs_site, host_name): #there has to be a name service - we are in HA at least name_services_string = hdfs_site['dfs.internal.nameservices'] if is_empty(name_services_string): return None name_services = name_services_string.split(',') if len(name_services) == 1: retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_service(iface, context, name):", "def getServiceName(self) -> str:\n ...", "def get_service_name(service, rem):\n flavor = rem.os.package_type\n try:\n return _SERVICE_MAP[service][flavor]\n except KeyError:\n return None", "def service_name(self) -> Optional[pulumi.Inp...
[ "0.6780206", "0.6672571", "0.6459031", "0.64238244", "0.64238244", "0.64238244", "0.62999135", "0.6265655", "0.6265655", "0.61561054", "0.61518157", "0.6148467", "0.61408716", "0.6126721", "0.6126721", "0.6126721", "0.61181813", "0.60940146", "0.6060706", "0.6058986", "0.6058...
0.7437151
0
Selects an item according to the probability in weights
def select_item(items, weights, k): x = random.choices(items, weights=weights, k=k) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weighted_choice(items):\n weight_total = sum((item[1] for item in items))\n n = random.uniform(0, weight_total)\n for item, weight in items:\n if n < weight:\n return item\n n = n - weight\n return item", "def weighted_choice(items):\n weight_total = sum((item[1] for item in items))\n n ...
[ "0.7998629", "0.7930036", "0.7633903", "0.7618785", "0.76085746", "0.7482465", "0.7472831", "0.74280345", "0.73557615", "0.73277247", "0.731049", "0.7294871", "0.7204935", "0.71613276", "0.7143055", "0.712676", "0.7080121", "0.7069078", "0.70027006", "0.6983281", "0.6975877",...
0.81354934
0
reads all handlers from self._message_handlers and takes first whose filter returns True
def _apply_msg_filter(self,message): for h in self._message_handlers: if h.filter(message): h.handler(message) break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message_handlers(self):\n\t\treturn self.message_handlers", "def iter_message_handlers(self):\n for name in dir(self):\n attr = getattr(self, name)\n if isinstance(attr, MessageHandler):\n yield attr", "def filter_handler_results(self, handler_name):\n ...
[ "0.6820144", "0.6651281", "0.61039954", "0.5932053", "0.593016", "0.5848596", "0.58125204", "0.5779794", "0.5708292", "0.5672056", "0.55933034", "0.55838126", "0.5558838", "0.54958034", "0.54236835", "0.538808", "0.5385515", "0.5368192", "0.53667814", "0.53367543", "0.5335005...
0.77054274
0
reads all handlers from self._command_handlers and takes first whose filter returns True
def _apply_command_filter(self, message, command, params): for h in self._command_handlers: if h.command == command: if h.filter(message): h.handler(message,params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_command_handlers(self):\n\t\treturn self.command_handlers", "def __command_handler__(self, commands, handler):\n message_set = self.event.text.split(u' ')\n for command in commands:\n if command in message_set:\n handler(self.event, self.vk)\n break"...
[ "0.6630626", "0.62446153", "0.60342294", "0.5771479", "0.5743985", "0.5652927", "0.5627526", "0.5600914", "0.55745304", "0.547999", "0.54282", "0.54266644", "0.5402824", "0.53764397", "0.53585064", "0.5241036", "0.5238315", "0.5237464", "0.5233641", "0.52269495", "0.5224253",...
0.687063
0
returns chat title from TDLib based on TDLib.message or chat_id
def get_chat_title(self, message=None, chat_id = None): if message is not None: data = {'chat_id': message.get('sender',{}).get('chat_id',None)} elif chat_id is not None: data = {'chat_id': chat_id} else: raise Exception('[ TDLibUtils.get_chat_title ]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_title_song(mess_chat_id):\n connection = connection_to_db()\n cursor = connection.cursor()\n\n cursor.execute(\n \"SELECT title_song FROM song_data \"\n \"WHERE user_id = {0};\".format(mess_chat_id)\n )\n\n # obtain the first element of the set\n title_of_song = cursor.fetch...
[ "0.6734291", "0.6709079", "0.5865142", "0.58476245", "0.577964", "0.5660521", "0.55895996", "0.5543319", "0.5505326", "0.5479965", "0.54638195", "0.54455984", "0.5412279", "0.5404279", "0.5364507", "0.5364197", "0.53570586", "0.5334813", "0.52982455", "0.52832955", "0.5279526...
0.79200554
0
returns link to message based on TDLib.message
def get_message_link(self,message): data = {'chat_id': message.get('sender',{}).get('chat_id',None), 'message_id': message.get('id',None) } result = self._send_data('getMessageLink',data) if result.update: return result.update.get('link','')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_linked_message(message_reference_list):\n if not message_reference_list:\n return \"EMPTY\"\n else:\n return random.choice(\n [\"EMPTY\", random.choice(message_reference_list)])", "def message_link(channel, message_id):\n\n if not settings.SLACK_TOK...
[ "0.6406552", "0.62891084", "0.6039114", "0.6034101", "0.60305744", "0.60218537", "0.60218537", "0.6004093", "0.5990363", "0.5988025", "0.59061444", "0.58412844", "0.58135706", "0.5768817", "0.57607347", "0.5753421", "0.5740994", "0.5738146", "0.5730774", "0.5730774", "0.57173...
0.74991965
0
Sends text message to tg_user_id
def send_text(self, tg_user_id, text): return self.tg.send_message(tg_user_id, text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_text_to_user(user):", "def send_message(self, text):\n self.__telegram_info.message.reply_text(text)", "def send_to_telegram(text):\n\n bot = telegram.Bot(token='')\n # chat_id = -1001371737931\n chat_id = ''\n bot.send_message(chat_id=chat_id, text=text)\n time.sleep(5)", ...
[ "0.8221196", "0.7199986", "0.7128811", "0.7094859", "0.7059697", "0.7002241", "0.68553966", "0.6826223", "0.6783227", "0.67725646", "0.67282975", "0.6698132", "0.66953975", "0.6640003", "0.66223043", "0.6611703", "0.66095847", "0.66038346", "0.6564588", "0.65596914", "0.65487...
0.87969285
0
returns username of Telegram user by his TG user_id
def get_username(self, tg_user_id): data = { 'user_id': tg_user_id } result = self._send_data('getUser', data) if result.update: return result.update.get('username','')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username_from_user_id_gql(self, user_id: int) -> str:\n return self.user_short_gql(user_id).username", "def _get_username(user_id):\n username = select(u.username for u in UserInformationData if u.user_id == user_id).first()\n\n return username", "def username(user_id):\n return UserIndex.i...
[ "0.7529139", "0.7379333", "0.7346584", "0.7250476", "0.71055543", "0.7104555", "0.68398666", "0.678545", "0.67479384", "0.67479384", "0.67373234", "0.67144454", "0.66418314", "0.66418314", "0.65345734", "0.651864", "0.64866906", "0.63721824", "0.63487744", "0.63485396", "0.63...
0.84407043
0
takes Telegram joinchat link as arg and returns raw tg.result to be able to handle result.error
def check_chat_invite_link(self, tg_joinchat): data = { 'invite_link': tg_joinchat } return self._send_data('checkChatInviteLink',data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newJoin(user, channel):\n\n message = \"\"\"\nWelcome to the official Slack for ZenCash!\n\n\nThe official links are:\nhttps://github.com/ZenCashOfficial/\nhttps://zencashofficial.io/\n\nNOTICE:\nDue to the recent plague that is SlackBot spamming with `/remind`, please do not click any links sent to you in ...
[ "0.5673762", "0.5436438", "0.54104996", "0.5280661", "0.52710956", "0.52396274", "0.5205347", "0.5197328", "0.517049", "0.5165503", "0.5092653", "0.5091981", "0.5074619", "0.5068134", "0.50579304", "0.5052292", "0.5017482", "0.49924025", "0.49451408", "0.49099037", "0.4905123...
0.632835
0
Returns list of all chats of account. Used to download info about chats to TDLib to be able to get messages from chats etc
def get_all_chats_list(self): new_chats = True chats = self.get_chats(2**63-1,0) while new_chats: last_chat = self.get_chat(chats[-1]) last_order = last_chat['positions'][0]['order'] new_chats = self.get_chats(last_order,chats[-1]) chats = chats +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_chats():\n result = g.driver.get_all_chats()\n return jsonify(result)", "def update_chats(self):\n res = requests.get(self.info_url)\n messages = res.json()['result']\n chats = set(m['message']['chat']['id'] for m in messages)\n for c in chats:\n if c not in s...
[ "0.7762963", "0.71615356", "0.6984053", "0.6963628", "0.6754202", "0.67187905", "0.66560936", "0.6557935", "0.6417372", "0.62299436", "0.6211792", "0.6020808", "0.5969098", "0.5963949", "0.59581894", "0.58861476", "0.586769", "0.58569574", "0.5836994", "0.5807475", "0.5787644...
0.7516536
1
appends source link at the end of TDLib.sendMessage text or caption
def append_source_info_as_text_url(self, message,sourcename,source): m = message.copy() mcontent = m.get('input_message_content',{}) if 'text' in mcontent: textcaption = 'text' elif 'caption' in mcontent: textcaption = 'caption' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source(self, irc, msg, args):\n irc.reply('My source is at http://supybot.com/')", "def append_links(self, lines, lang):\n lines.append(\"verbatim &nbsp;\")\n lines.append(\"section Links\")\n lines.append(\"external http://polcasaglia.blogspot.com Blog\")\n lines.append(\"...
[ "0.6376704", "0.582124", "0.57896", "0.5785674", "0.56893504", "0.56322783", "0.5588169", "0.55305845", "0.55305845", "0.55192035", "0.5516157", "0.55141056", "0.54790294", "0.5424203", "0.53947437", "0.53938395", "0.5385273", "0.53841144", "0.5377666", "0.53492206", "0.53289...
0.675349
0
appends MOAR button to reply keyboard
def append_moar_button(self,message,user_id): data = self.app.bot.hash.hash_b64encode(f'COMMAND {user_id} send_new') button = { 'text': 'MOAR!', 'type': { '@type': 'inlineKeyboardButtonTypeCallback', 'data': str(data) } } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keyboard(buttons: str) -> 'Keyboard':\n current_keyboard = telebot.types.ReplyKeyboardMarkup(True)\n for button in buttons:\n current_keyboard.add(button)\n return current_keyboard", "def append_inline_keyboard(self, message, user_id, post_id):\n \n m = message.copy()\n r...
[ "0.6564333", "0.6545038", "0.6516329", "0.645461", "0.6189926", "0.61644095", "0.60765827", "0.6039003", "0.60091895", "0.59676516", "0.59370494", "0.5845954", "0.58195424", "0.58012635", "0.57949746", "0.5706664", "0.5702017", "0.5684775", "0.5684775", "0.56728595", "0.56304...
0.77964014
0
hashes string with salt and returns string with truncated salt appended
def hash_with_salt(self, s): data = f'{s} {self.salt}'.encode('ascii') # encode string to raw bytes object hash_obj = hashlib.md5(data) # hash it if self.trunc > 0: hash_txt = hash_obj.hexdigest()[0:self.trunc] # get truncated hash symbols else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_hashed_password(cleartext,salt=None):\n \n if not salt:\n salt = make_salt(5)\n return \"%s|%s\" % (salt,hashlib.sha256(salt + cleartext).hexdigest())", "def apply_hash (self, s):\r\n m = md5()\r\n m.update (s)\r\n d = m.digest()\r\n # base64.encodestring tack...
[ "0.7323806", "0.72268057", "0.72120243", "0.718012", "0.71337366", "0.707762", "0.7076287", "0.7068321", "0.7064799", "0.70572364", "0.7040667", "0.70399886", "0.70274276", "0.70208615", "0.6993306", "0.69835466", "0.6980138", "0.6939247", "0.6939247", "0.6921311", "0.6884623...
0.8599195
0
Decodes s from base64 string to string, tests string for been properly hashed with salt, and returns it if yes. Returns empty string if not.
def hash_b64decode(self,s): payload = s.encode('ascii') # get base64 bytes payload = base64.b64decode(payload) # get raw bytes payload = payload.decode('ascii') # get string from bytes if self.test_string(payload): retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_base64(self, s):\n return self.transcode(struct.unpack('!L', base64.b64decode(s + '==', self.extra_chars))[0])", "def b64decode(s: str) -> str:\n return base64.b64decode(s.encode()).decode()", "def base64_decode(s):\n log = logging.getLogger()\n s = str(s).strip()\n try:\n ...
[ "0.7530749", "0.7043476", "0.6929475", "0.68062407", "0.68062407", "0.64625823", "0.6449642", "0.6429696", "0.6429696", "0.6364983", "0.6328801", "0.6222905", "0.61383647", "0.6115049", "0.6046358", "0.60302067", "0.60003024", "0.59924877", "0.5967654", "0.59607744", "0.59102...
0.7838323
0
return tangent angle to a circle placed at (dist, 0.0) with radius=radius For nonexisting tangent use 100 degrees and too far (2 times radius) circle return None
def tangent_circle(dist, radius): if dist < 3 * radius: if dist >= radius: return math.asin(radius/float(dist)) return math.radians(100) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_allowable_angle(self, dist: float) -> float:\n angle = math.atan(self.TRUE_TARGET_RADIUS / dist)\n # print(f\"angle tolerance +- {angle} true target radius{self.TRUE_TARGET_RADIUS}\")\n return angle", "def distance_to(self, circle):\n diff = tuple(map(sub, self.pos, circle.po...
[ "0.6546972", "0.6223502", "0.6056518", "0.599725", "0.5958573", "0.59585696", "0.588909", "0.58879834", "0.5874164", "0.5802152", "0.57763994", "0.57763994", "0.57113194", "0.56971276", "0.5663912", "0.5660724", "0.5652065", "0.5644036", "0.56128615", "0.5568074", "0.556712",...
0.9004636
0
Find the angle to the closest point in laser scan (either on the left or right side). Then calculate an angle to a free space as tangent to circle of given radius. This angle is returned and can be used for steering command.
def follow_wall_angle(laser_data, radius, right_wall=False): data = np.array(laser_data) size = len(laser_data) deg_resolution = 270 / (size - 1) # SICK uses extra the first and the last, i.e. 271 rays for 1 degree resolution mask = (data <= 300) # ignore internal reflections data[mask] = 20000 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tangent_circle(dist, radius):\n if dist < 3 * radius:\n if dist >= radius:\n return math.asin(radius/float(dist))\n return math.radians(100)\n return None", "def circle_leads(center_theta, width_theta, radius):\n\ta1 = np.deg2rad(center_theta + width_theta/2)\n\ta2 = np.deg2rad...
[ "0.63354754", "0.63099784", "0.6210691", "0.6177447", "0.6077574", "0.6068027", "0.60679686", "0.60490644", "0.6049009", "0.59989727", "0.5972049", "0.59402174", "0.58911425", "0.5888541", "0.58386874", "0.5757087", "0.57192516", "0.567757", "0.5664224", "0.56368583", "0.5629...
0.6482886
0
Add a slot definition per slot
def visit_slot(self, slot_name: str, slot: SlotDefinition) -> None: sn = underscore(slot_name) self.emit('slot', sn) if slot.domain: self.emit('domain', sn, underscore(slot.domain)) if slot.range: self.emit('range', sn, underscore(slot.range)) for p in slo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_slot(self, slot):\n slot.set_location(len(self.slots)+1)\n self.slots.append(slot)", "def generate_slot(slot_name, slot_description, slot_raw_filename):\n slot = {\n 'enumerationValues': [],\n \"name\": slot_name,\n \"description\": slot_description\n }\n slot_raw_vals...
[ "0.75432765", "0.6490032", "0.6378425", "0.6376091", "0.6311144", "0.6311144", "0.63060176", "0.62830687", "0.5973703", "0.5939033", "0.589582", "0.58927363", "0.58787894", "0.58157784", "0.58157784", "0.58064824", "0.5751183", "0.5740283", "0.5707519", "0.5650989", "0.561286...
0.70383203
1
Generate logic program representation of a biolink model
def cli(yamlfile, **args): print(LogicProgramGenerator(yamlfile, **args).serialize(**args))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_program(metabolic_model, name, gene_activity):\n\tname = name.replace('\"', '')\n \n r = get_reaction_list_irr(metabolic_model)\n\tv_dict_irr = get_v_dict_irr(metabolic_model)\n\tbounds = get_vs_irr(metabolic_model)\n\tactivity_dict = istrue(metabolic_model, name, gene_activity)\n\trules = ...
[ "0.63422257", "0.6322871", "0.623407", "0.6233035", "0.6198252", "0.6172688", "0.6143442", "0.61414117", "0.6100852", "0.5886134", "0.5877408", "0.5858243", "0.5850551", "0.58189046", "0.5777198", "0.5765096", "0.57627463", "0.57551616", "0.5749789", "0.5746674", "0.57409", ...
0.67327976
0
r""" Computes the log marginal likelihood.
def log_marginal_likelihood(self) -> tf.Tensor: L = tf.linalg.cholesky(self.likelihood.add_to(self.KXX)) return tf.reduce_sum(multivariate_normal(self._Y, self._mean, L))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_marginal_likelihood(self) -> tf.Tensor:\n X, Y = self.data\n Y = Y[..., :-1]\n K = self.kernel(X)\n ks = self._add_noise_cov(K)\n L = tf.linalg.cholesky(ks)\n m = self.mean_function(X)\n\n # [R,] log-likelihoods for each independent dimension of Y\n l...
[ "0.8163399", "0.7998426", "0.7895848", "0.78862935", "0.7815355", "0.7649939", "0.758997", "0.74323887", "0.7408415", "0.73514354", "0.7318802", "0.7192678", "0.71886975", "0.71821815", "0.71618444", "0.71607155", "0.7136076", "0.71354836", "0.7090275", "0.7080594", "0.707207...
0.80175203
1
Read one integer from stdin.
def read_int(): return int(sys.stdin.readline())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_int() -> int:\n line = input().strip()\n return int(line)", "def read_int(fd):\n\n string = ''\n while True:\n ch = fd.read(1)\n if ch not in '0123456789':\n break\n string += ch\n return int(string)", "def get_int():\n\twhile T...
[ "0.7389567", "0.71798307", "0.70334816", "0.67447627", "0.6426503", "0.6404526", "0.6404526", "0.6348546", "0.6337894", "0.6320069", "0.63194466", "0.6313478", "0.6269574", "0.62621444", "0.6176542", "0.6166532", "0.60947067", "0.60910803", "0.6066391", "0.60496956", "0.60069...
0.8919737
0
Read any number of integers from stdin.
def read_ints(sep=" "): return [int(s) for s in sys.stdin.readline().split(sep)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readValues(n):\n for i in xrange(n):\n yield int(raw_input().strip())", "def readValues(n):\n for i in xrange(n):\n yield int(raw_input().strip())", "def read_int():\n return int(sys.stdin.readline())", "def r(lines=1, prompt=None):\n lista = []\n for i in range(lines):\n...
[ "0.6916912", "0.6916912", "0.6592026", "0.6525227", "0.61684036", "0.6141098", "0.6110394", "0.596095", "0.59475076", "0.5881335", "0.5878071", "0.58104527", "0.5738368", "0.57240754", "0.5717182", "0.56064", "0.5579304", "0.5541121", "0.55215263", "0.5508177", "0.55011034", ...
0.7491434
0
Constructor to create CentralizedCli managed object vsm object on which application object has to be configured
def __init__(self, vsm=None, **kwargs): super(CentralizedCli, self).__init__() if vsm is not None: self.set_connection(vsm.get_connection()) self.id = None self.username = None self.password = None self.expect_connection = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n super(aero_csm_component,self).__init__()", "def __init__(\n self, cmd: AzCliCommand, client: ContainerServiceClient, raw_parameters: Dict, resource_type: ResourceType\n ):\n super().__init__(cmd, client)\n self.__raw_parameters = raw_parameters\n sel...
[ "0.6638414", "0.63236", "0.63236", "0.6215188", "0.62023234", "0.61675584", "0.6161515", "0.6152131", "0.61492205", "0.61456144", "0.61236745", "0.61010575", "0.6090802", "0.60787266", "0.60423017", "0.60415477", "0.6036368", "0.6029328", "0.60228485", "0.60091865", "0.598892...
0.7273682
0
Suggesting the words which are one edit distance.
def getSuggestions(self, query): # a suggestions method for all the suggestions suggestions =[] # a new list to add all the suggested words j = len(query) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_distanceN(self, word: str) -> set:\n #FIXME\n ret_val = set(word)\n\n for _ in range(self.max_edit_distance):\n for val in ret_val:\n ret_val = ret_val | self.edit_distance1(val)\n\n return list(ret_val)", "def min_dictionary_edit_distance(terms, dic...
[ "0.67486846", "0.6632522", "0.6560633", "0.6428916", "0.6370597", "0.6355999", "0.63100404", "0.63100404", "0.62718993", "0.62291974", "0.6212179", "0.6188331", "0.6168576", "0.6154437", "0.6141545", "0.6094351", "0.6089273", "0.6085408", "0.607988", "0.60547817", "0.6049563"...
0.66584927
1
create the request handler config the VAOLogin configuration dictionary queryargs a dictionary containing the query data encoded as name=value pairs after the ? in the URL. If None, these will be extracted from the CGI environment. sessionId a session Id as obtained by the web service framework. If None (usually), an a...
def __init__(self, config, queryargs=None, sessionId=None, asServer=False, ostrm=sys.stdout, estrm=sys.stderr, reqhandler=None, execScripts=True): self.config = config self.asServer = asServer self.ostrm = ostrm self.estrm = estrm self.instream ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, request):\n self.arguments = {}\n for k, v in request.GET.items():\n self.arguments.setdefault(k, []).append(v)\n\n self.full_url = lambda: request.url\n self.host = request.host\n self.path = request.path", "def getCGIEnv(self, sess):\n env...
[ "0.5132432", "0.51174486", "0.5056762", "0.4939389", "0.48981893", "0.48828095", "0.48592058", "0.48464763", "0.48360437", "0.47765502", "0.477054", "0.47547284", "0.47497994", "0.47410518", "0.4727825", "0.46880233", "0.46360782", "0.46356282", "0.46267733", "0.46114165", "0...
0.71619976
0
return a configuration parameter assuming a prefix of vaologin.portal
def _getConfigParam(self, name, default=None): return self.config.get(self._configPrefix + name.lower(), default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parameter(par_name):\r\n config_file = open('./config.txt', 'r')\r\n lines = config_file.readlines()\r\n for line in lines:\r\n line = line.rstrip('\\n\\r')\r\n if line.startswith(par_name):\r\n return line.split('=')[1]", "def access_configuration_name(self) -> pulumi.I...
[ "0.58286947", "0.5668497", "0.56600803", "0.56140643", "0.55685836", "0.5473099", "0.546332", "0.54347986", "0.54111886", "0.54093385", "0.53993905", "0.53954625", "0.5381404", "0.53266907", "0.5317851", "0.5262234", "0.5255981", "0.52496564", "0.52439445", "0.5241279", "0.52...
0.6046429
0
forward the user to an arbitrary postlogin page. Note that calling this function assumes that the user is already authenticated. forwardUrl the URL to redirect to. This can either be an an absolute URL or a relative one. If it starts with a '/', it is taken as a relative URL with respect to the server root. setcookie i...
def login(self, forwardUrl=None, setcookie=True): if not forwardUrl: forwardUrl = self.loginForwardUrl if not forwardUrl: forwardUrl = "/"; if re.match(r'^\w+:/', forwardUrl): self.redirect(forwardUrl, setcookie) else: self.localRedirect(fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _safe_postlogin_redirect(redirect_to, safehost, default_redirect='/'):\r\n if is_safe_url(url=redirect_to, host=safehost):\r\n return redirect(redirect_to)\r\n return redirect(default_redirect)", "def post(self):\n # original code\n self.set_secure_cookie(\"user\", self.get_argumen...
[ "0.5698479", "0.5386658", "0.5376516", "0.49611086", "0.4845205", "0.4685047", "0.4682009", "0.46802312", "0.46518132", "0.4637032", "0.46083516", "0.45874298", "0.4567777", "0.45630538", "0.45068938", "0.45008716", "0.44687706", "0.44511354", "0.44401994", "0.44352442", "0.4...
0.7252503
0
log the user out of this portal and forward the user to an arbitrary postlogin page. This does not end the user's overall VO session. Note that calling this function assumes that the user is already authenticated. forwardUrl the URL to redirect to. This can either be an an absolute URL or a relative one. If it starts w...
def logout(self, forwardUrl=None): if not forwardUrl: forwardUrl = self.logoutForwardUrl if not forwardUrl: forwardUrl = "/" # end the session sess = self.getSession() if sess: print >> self.estrm, \ "Ending session for username=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login(self, forwardUrl=None, setcookie=True):\n if not forwardUrl:\n forwardUrl = self.loginForwardUrl\n if not forwardUrl:\n forwardUrl = \"/\";\n if re.match(r'^\\w+:/', forwardUrl):\n self.redirect(forwardUrl, setcookie)\n else:\n self....
[ "0.6231437", "0.5676661", "0.564918", "0.56246156", "0.562301", "0.55940056", "0.5580561", "0.5566367", "0.55401474", "0.5532345", "0.5508189", "0.5478468", "0.54725415", "0.5466533", "0.5452446", "0.5436969", "0.54369444", "0.54369444", "0.5430287", "0.54020363", "0.5344198"...
0.6826319
0
return true if an authenticated (validated) session has been established and has not expired.
def sessionValid(self): return self.request.getSession().isValid()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isExpired(self):\n return self.sess is not None and not self.sess.isValid()", "def is_session_valid(self, logonTimestamp):\n time_diff = time.time() - logonTimestamp\n return (time_diff / 60) < self.session_time_limit", "def any_active(self):\n for session_id in self.get_session...
[ "0.79456645", "0.74243605", "0.7388761", "0.7224467", "0.7215239", "0.7206501", "0.7187858", "0.71670157", "0.7165557", "0.71546113", "0.7147789", "0.7086114", "0.7075168", "0.7067662", "0.70583296", "0.70458853", "0.7038191", "0.7036178", "0.702764", "0.7019293", "0.7019244"...
0.7795629
1
return True if it appears that the user session is new, meaning that either the user has not or never logged in. False means that the user has either logged in or that the session has recently expired.
def sessionNew(self): return self.request.getSession().isNew();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isLoggedOut(self):\n return self.sess is None or self.sess.isNew()", "def validUser(self):\n if self.state == SessionStates.LOGGED_OUT:\n return False\n\n # if self.user == None:\n # return False\n return True", "def isLoggedIn(self):\n session = sel...
[ "0.7538963", "0.7391871", "0.73093146", "0.706602", "0.7054157", "0.7000122", "0.6970512", "0.69608283", "0.6897448", "0.68822265", "0.6850178", "0.68153775", "0.6785952", "0.6745875", "0.6680256", "0.6653168", "0.6630136", "0.66185266", "0.65697956", "0.6569035", "0.6565668"...
0.77059174
0
complete the authentication process by validating the user via the CGI arguments. lifehours the desired time limit for the session in hours. If negative, then there is no limit to the session lifetime. If None (default), the limit will be taken from the configuration file.
def validate(self, lifehours=None): return_url = self._formURLbase() path = self._getInternalPath() return_url += path if lifehours is None: lifehours = self._getConfigParam("sessionlifehours", None) if isinstance(lifehours, str): try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_hour(self):\n\t\tlogin_before = int(webnotes.conn.get_value('Profile', self.user, 'login_before', ignore=True) or 0)\n\t\tlogin_after = int(webnotes.conn.get_value('Profile', self.user, 'login_after', ignore=True) or 0)\n\t\t\n\t\tif not (login_before or login_after):\n\t\t\treturn\n\t\t\t\n\t\tfrom w...
[ "0.6142418", "0.56862426", "0.5650223", "0.5561794", "0.5492749", "0.5446939", "0.5446939", "0.54013306", "0.53595096", "0.5326927", "0.5302254", "0.5299219", "0.5283686", "0.52661294", "0.5230145", "0.5222438", "0.5211591", "0.5183191", "0.5174619", "0.5140813", "0.51374656"...
0.6314455
0
deliver the requested path, either as a static file or via a CGI script. Which of these the path is interpreted as depends on the values of the docAlias and scriptAlias configuration parameters. If an alias is set, either docAlias and scriptAlias, and the path begins with the path begins with the path given as the alia...
def deliver(self, path=None, asexec=True): urlpath = path if not urlpath: urlpath = self._getInternalPath() if urlpath == "/": urlpath = self._getConfigParam("defaultDocument","/index.html"); path = urlpath if path.startswith('/'): path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alias(aliasPath, sourcePath):\n sourcePath = sourcePath.split(\"/\")\n aliasPath = aliasPath.split(\"/\")\n\n def rewriter(request):\n if request.postpath[: len(aliasPath)] == aliasPath:\n after = request.postpath[len(aliasPath) :]\n request.postpath = sourcePath + after\n...
[ "0.5506353", "0.5328749", "0.52467066", "0.50505674", "0.5028496", "0.50134283", "0.4867732", "0.48259094", "0.47703508", "0.47697312", "0.4766314", "0.47639385", "0.4758224", "0.47320065", "0.47299656", "0.47051135", "0.47049472", "0.46938652", "0.46612558", "0.4650486", "0....
0.68415755
0
execute the script given by the script filename. If the file is not found relative to the script script the path to the script relative to the directory containing protected scripts scriptroot the directory containing protected scripts. If None (default), the configured directory will used asexec if True (default), "ex...
def executeScript(self, script, scriptroot=None, asexec=True): if self.instream: asexec = False if not scriptroot: scriptroot = self.scriptroot if not scriptroot or not os.path.isdir(scriptroot): return self.sendNotFound(script) script = script.strip(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exec_script(self, script):\n filename = os.path.join(self.script_dir, script + \".sh\")\n # http://docs.python.org/library/os.html#os.X_OK\n if os.access(filename, os.X_OK):\n with open(filename):\n subprocess.call(filename)\n self.vibrate(0.1)", ...
[ "0.6713599", "0.65011567", "0.64715886", "0.64103216", "0.63944554", "0.6393679", "0.6315452", "0.61815506", "0.6180344", "0.61626756", "0.61406296", "0.6119485", "0.61165386", "0.61053765", "0.6014089", "0.6009956", "0.5990412", "0.5957026", "0.595513", "0.59530497", "0.5945...
0.7394408
0
return a dictionary containing modifications that should be made to the CGI environment for a given authenticated session.
def getCGIEnv(self, sess): env = {} env["VAOLOGIN_SESSION_ID"] = sess.getId() if sess.data.has_key('validLifetime'): env["OPENID_IDENTITY"] = sess.data.get('openid.identity','') env["OPENID_CLAIMED_ID"] = sess.data.get('openid.claimed_id','') env["VAOLOGIN_VAL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inject_dict_for_all_templates():\n global_vars = {\"settings\": settings}\n\n if is_authenticated():\n global_vars[\"user\"] = get_authenticated_user()\n\n return global_vars", "def globals_edit(self, keys: str, values: Union[bool, float, str]) -> dict:\n self.__logger.debug('Eva.globa...
[ "0.55818576", "0.557571", "0.5561591", "0.5500383", "0.5500383", "0.5415804", "0.5415804", "0.5415804", "0.53788686", "0.5279684", "0.51975554", "0.51908314", "0.5107192", "0.50949717", "0.5086402", "0.505936", "0.50417924", "0.5017422", "0.49252236", "0.48929858", "0.4868441...
0.5930315
0
deliver a static file to the user. Note that this will not list directories. Mime types for static files are handled by file extension only. filename the path relative to the document root of the desired file. If empty or not provided, index.html will be returned. docRoot the full path to the document root directory wh...
def deliverFile(self, filename=None, docroot=None): if not docroot: docroot = self.docroot if not docroot or not os.path.isdir(docroot): if not filename: filename = "index.html" return self.sendNotFound(filename) if not filename: filename = "inde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def static(self, filename):\n return send_from_directory(self.static_path, filename)", "def send_from_static(filename, **kwargs):\n return send_from_directory(app.static_folder, filename, **kwargs)", "def static_files(filename):\n static_path = os.path.join(frontend.root_path, 'templates', current...
[ "0.6984105", "0.6523909", "0.6193394", "0.61722606", "0.6166972", "0.61307305", "0.5945597", "0.59104085", "0.59104085", "0.59104085", "0.59104085", "0.59104085", "0.59104085", "0.59104085", "0.59104085", "0.59104085", "0.59104085", "0.59104085", "0.59104085", "0.59104085", "...
0.73285466
0
redirect in a way that tells the user that the request cannot be found. path the path to the file (or script) requested
def sendNotFound(self, path): prefix = self._getConfigParam("usenotfoundpath", "notfound").strip('/') if not path.startswith("/"): path = "/%s" % path notfound = "/%s%s" % (prefix, path) self.localRedirect(notfound)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_notfound(cls,path):\n if os.path.exists(path):\n raise exceptions.PathFoundError(path)", "def send404(self):\n\t\tself.send_error(404, \"File not found\")", "def page_not_found(e):\n flash(\"Error: Try Something Different This Time\")\n return redirect(url_for('login'))", ...
[ "0.6353808", "0.63400424", "0.6337718", "0.6182226", "0.61453295", "0.6110441", "0.6106647", "0.60854834", "0.60482776", "0.60009927", "0.59990263", "0.5974795", "0.5919457", "0.59131736", "0.59099114", "0.5897021", "0.58252186", "0.5824025", "0.58139837", "0.5813834", "0.580...
0.73225737
0
redirect the user's browser to a new URL on this server. No explicit authentication is done (as this path may point to a public URL) apart from any that is done after the redirect. path the URL path to append to the base URL.
def localRedirect(self, path, setcookie=False): server = os.environ['SERVER_NAME'] if os.environ.has_key('SERVER_PORT') and \ os.environ['SERVER_PORT'] is not None and \ os.environ['SERVER_PORT'] != '80': server += ":%s" % os.environ['SERVER_PORT'] if not p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect(self, path):\n self.get_controller().redirect(path)", "def update_url(self, path):\n self._url += \"/%s\" % path.lstrip(\"/\")\n return self", "def intermediate_redirect(cls, form_path):\r\n from r2.lib.template_helpers import add_sr\r\n dest = cls.format_output_...
[ "0.7390927", "0.6175967", "0.6005941", "0.5896355", "0.572897", "0.56789136", "0.5648867", "0.5592457", "0.5558119", "0.5515892", "0.5482851", "0.5480467", "0.54471934", "0.5443647", "0.543616", "0.5425444", "0.5421414", "0.54172575", "0.54077864", "0.53961474", "0.5373562", ...
0.6985222
1
set a session cookie that marks the start of a user session sessionid a unique session identifier user the login name of the user. Default is an empty string. realmPath the URL path that this cookie should be restricted to. if None (default) or empty, this realm will not be set in the cookie. str a stirng containing th...
def createCookie(self, sessionid, realmPath=None): cookie = Cookie.SimpleCookie() cookie["session"] = sessionid if realmPath: cookie["session"]["Path"] = realmPath return str(cookie)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cookie( name, value, **kwargs ) :", "def setSession( self, name, value, REQUEST=None, cookie=None ):\n SetSessionValue( self, name, value, REQUEST, cookie )", "def store_userid(request_handler, userid):\n session = sessions.LilCookies(request_handler, SESSION_SECRET)\n session.set_secure_cooki...
[ "0.55561846", "0.55209357", "0.5509962", "0.54344326", "0.5407972", "0.540687", "0.5384445", "0.5374844", "0.53168637", "0.5220649", "0.520434", "0.5192553", "0.51886994", "0.51886994", "0.5176048", "0.5166246", "0.51619077", "0.5161596", "0.51539165", "0.5140336", "0.5117131...
0.7144837
0
return the username associated with the session, or None, if it is not known (because there is no session).
def getUsername(self): if self.sess is None: return None return self.sess.data.get('username')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUsername(session, req):\n\tif config.AUTH_TYPE=='NONE':\n\t\treturn None\n\telif config.AUTH_TYPE=='HTTP':\n\t\treturn req.user.lower() #(may be None)\n\telif config.AUTH_TYPE=='FORM':\n\t\ttry:\n\t\t\treturn session['username']\n\t\texcept KeyError:\n\t\t\treturn None\n\telse:\n\t\traise Exception(\"sanit...
[ "0.8091494", "0.8014805", "0.79780746", "0.7604997", "0.75876975", "0.75800467", "0.75800467", "0.75635725", "0.75163877", "0.7481386", "0.7449817", "0.7358574", "0.7347618", "0.7331124", "0.7269917", "0.72232765", "0.72221243", "0.71736735", "0.71736735", "0.71736735", "0.71...
0.83083916
0
return the OpenID for the logged in user or None, if there is no active session.
def getOpenId(self): if self.sess is None: return None return self.sess.data.get('openid.identity')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def openid(self) -> Optional[pulumi.Input['OpenSearchOpensearchUserConfigOpenidArgs']]:\n return pulumi.get(self, \"openid\")", "def get_by_openid(self, openid=None):\n try:\n if openid:\n return WepyUser.query.filter_by(openid=openid).one_or_none()\n except Multipl...
[ "0.7339117", "0.69466823", "0.689211", "0.6652734", "0.64895135", "0.64696044", "0.64636403", "0.6461804", "0.64161676", "0.6412825", "0.6263408", "0.6243561", "0.62279534", "0.6162236", "0.61604923", "0.6143803", "0.6132554", "0.6122974", "0.6122422", "0.61024797", "0.609328...
0.83612984
0
return True if the session does not exist, indicating that the user logged out or otherwise has never logged in.
def isLoggedOut(self): return self.sess is None or self.sess.isNew()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isLoggedIn(self):\n session = self.getSession()\n if session is not None:\n return True\n return False", "def validUser(self):\n if self.state == SessionStates.LOGGED_OUT:\n return False\n\n # if self.user == None:\n # return False\n ...
[ "0.7960414", "0.7560247", "0.7528694", "0.7464559", "0.7439468", "0.7414775", "0.7391465", "0.73498595", "0.7270838", "0.72499835", "0.7211819", "0.69925684", "0.69776183", "0.69462925", "0.6839284", "0.677237", "0.6768205", "0.6759924", "0.67335975", "0.6708057", "0.67079705...
0.8131906
0
return true if the session has expired. False will be returned if the user explicitly logged out.
def isExpired(self): return self.sess is not None and not self.sess.isValid()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isExpired(self):\n return True/False", "def _is_expired(self):\n current_time = datetime.now()\n if (current_time > self._expires_at):\n logging.debug('token expired')\n return True\n else:\n return False", "def is_expired(self) -> bool:\n ...
[ "0.80426556", "0.80100656", "0.787694", "0.7859534", "0.78314453", "0.7824413", "0.7777597", "0.77762747", "0.77657384", "0.7760325", "0.76283723", "0.75923467", "0.7575537", "0.75433207", "0.7540607", "0.75316375", "0.75247127", "0.75213414", "0.7512129", "0.7495577", "0.738...
0.8372811
0
return the time left in the session in whole seconds
def getTimeLeftSec(self): if self.sess is None: return 0 since = self.sess.data.get('validSince') if not since: return 0 sofar = time.time() - since if sofar < 0: return 0 out = self.sess.data.get('validLifetime', 0) - sofar if out < 0: out = 0 return ou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secondsPassed(self)->int:\n return self._lic.params['sessionTimeUsed'].value", "def time_left(self):\n return self.timeout - self.current_milli_time()", "def time_left(self):\r\n return 10 - (int(time.time()) - self.start_time)", "def duration(self):\n\t\tif self.status():\n\t\t\t# C...
[ "0.8051637", "0.77303904", "0.7679944", "0.75341016", "0.73189545", "0.72949284", "0.7255891", "0.72133994", "0.71878564", "0.71481335", "0.7130195", "0.7080326", "0.70767003", "0.704992", "0.7045035", "0.7018585", "0.70069593", "0.69839597", "0.696485", "0.6951986", "0.69423...
0.8026529
1
Parse dbconfig xml to fill in self.__registry
def parsedbconfig(self): p = xml.parsers.expat.ParserCreate() p.StartElementHandler = start_element f=open(self.__dbconfig,'r') p.ParseFile(f) self.fillregistry()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getdbconfigxml(runmode, dbmodelname):\r\n try:\r\n path = os.path.split(os.path.realpath(__file__))[0]\r\n #print 'db.xml path: ' + path + \"/config/db.xml\"\r\n if (runmode != \"test\"):\r\n dom = xml.dom.minidom.parse(path + '/config/' + runmode + '/db.xml')\r\n ...
[ "0.6454074", "0.6329203", "0.6204412", "0.62043935", "0.6201509", "0.5841213", "0.5758694", "0.5751699", "0.5682946", "0.5663137", "0.55831486", "0.5534067", "0.5510683", "0.54468256", "0.5417761", "0.53815705", "0.5372633", "0.5354441", "0.5312095", "0.5306707", "0.5298916",...
0.85818243
0
tree_idx(treeG,j1,J1,J2) finds the index in level J2 of the j1th node in level J1 for the tree treeG, where J1<J2<numel(treeG). INPUTS j1,J1 index of the j1th node in level J1 J2 higer level OUTPUT j2 index of the node in level J2
def tree_idx(tree,j1,J1,J2): j = j1 for k in np.arange(J1+1,J2+1,1): j = tree[k]['IDX'][j] j2 = j return j2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree_idx2(treeG,k1,J1,J2):\n g = treeG[J1]['clusters'][k1]\n if(J1>J2+1):\n for j in np.arange(J2+1, J1)[::-1]:\n g1 = []\n for i in np.arange(0,len(g),1):\n g1 = np.array(np.append(g1,treeG[j]['clusters'][g[i]]), dtype = int)\n g = g1\n y = g\n ...
[ "0.7984112", "0.6006166", "0.5979973", "0.5818892", "0.58163947", "0.5762999", "0.57466674", "0.5739031", "0.56929415", "0.5691535", "0.5678411", "0.5661697", "0.560737", "0.5581369", "0.55567586", "0.555353", "0.55473214", "0.55345505", "0.5502612", "0.5451305", "0.54327196"...
0.8738397
0