query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Constructor de la clase, que lee el archivo de texto "fname" a modificar.
def __init__(self,fname): try: self.handler = open(fname,'r') self.filename = fname except Exception: log.exception('Fallo al abrir ' + fname) return None self.content = self.handler.readlines() self.handler.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, fname):\n self.fname = os.path.abspath(fname)\n self.restore()", "def __init__(self, nombre):\n\n try:\n # Intentar abrir el archivo\n self.f = open(nombre, 'r')\n self.nombre = nombre\n except:\n # Si no se puede abrir el...
[ "0.7283871", "0.7172157", "0.6912619", "0.6812134", "0.6719622", "0.66636246", "0.6611331", "0.6509861", "0.65031904", "0.6496384", "0.64787287", "0.64747083", "0.64125896", "0.63539714", "0.63372934", "0.62784576", "0.6267829", "0.6260039", "0.62426263", "0.6211658", "0.6190...
0.67274874
4
Inserta una cadena delante en donde encuentre la cadena "tag"
def ins(self,tag,nstr,jumpline=True): tmp = [] strj = '\n' if jumpline else '' for line in self.content: tmp.append(line) if tag in line: tmp.append(nstr + strj) self.content = tmp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_tag_data(tag):\n\n add_tag = Tag(tag=tag)\n db.session.add(add_tag)\n try:\n db.session.commit()\n except (Exception, exc.SQLAlchemyError, exc.InvalidRequestError, exc.IntegrityError) as e:\n print(tag + '\\n' + str(e))", "def AddTag(self, tag):\n\n if not self.persistant:\n ...
[ "0.6976025", "0.6736013", "0.6654346", "0.62465644", "0.61812353", "0.61108446", "0.6020931", "0.60011894", "0.5945555", "0.5943481", "0.59106773", "0.5909345", "0.5869094", "0.5852946", "0.5828006", "0.5823748", "0.58234936", "0.5821268", "0.58135855", "0.57451326", "0.57308...
0.5345447
59
Reemplaza la(s) ocurrencia(s) de tag en el archivo por nstr
def rep(self,tag,nstr): tmp = [] for line in self.content: if tag in line: tmp.append(line.replace(tag,nstr)) else: tmp.append(line) self.content = tmp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ler_arquivo_xml(self, diretorio):\r\n with open(diretorio, 'r') as fxml:\r\n\t strfx = fxml.readlines()\r\n\t string = \"\".join(strfx).replace(\"&\",\" e \")\r\n return string", "def archivoXl(archivo):\r\n return ow(archivo)", "def SV_tag_length(tag_file, outPrefix):\r\n outdir...
[ "0.56019914", "0.55601597", "0.5558506", "0.55486673", "0.5365312", "0.5310506", "0.52868605", "0.5284282", "0.5265695", "0.5260303", "0.52433544", "0.523879", "0.52328277", "0.52186084", "0.52185684", "0.5216578", "0.51640344", "0.5162988", "0.51482356", "0.5122066", "0.5119...
0.56634676
0
Salva los cambios al archivo especificado en newfile, o hace una copia del archivo original (filename+'~') y salva el contenido en "filename"
def saveFile(self,newfile=None): if newfile == None: shutil.move(self.filename,self.filename+'~') self.handler = open(self.filename,'w') else: self.handler = open(newfile,'w') self.handler.writelines(self.content) self.handler.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newfile(filename):\n # Open the new file for writing\n with open(filename, \"w\") as file:\n pass", "def renewFile(filename):\n\n\tfileRepo = repertoire + filename + extension # Position du fichier\n\n\t# Ouvre en ecriture et l'ecrase\n\t# La methode with ferme le fichier automatiquement\n\twith...
[ "0.68023175", "0.6601903", "0.6470307", "0.6256966", "0.60828876", "0.60267633", "0.59504694", "0.5871682", "0.5786605", "0.5738598", "0.57240206", "0.5673847", "0.5622948", "0.5617441", "0.5615462", "0.55986905", "0.55614066", "0.55208856", "0.551383", "0.55105835", "0.55076...
0.68237215
0
``summary'' is a systemgenerated summary. ``references'' is a list of humanmade reference summaries
def score_summary(self, summary, references, summary_id='A'): try: self._write_config(references, Doc(summary_id, summary)) output = self._run_rouge() output = output.decode("utf-8") return self._parse_output(output) except CalledProcessError as e: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary(self, summary):\n\n self._summary = summary", "def summary(self, summary):\n\n self._summary = summary", "def summary(self, summary):\n\n self._summary = summary", "def summary(self, summary: str):\n return self.swag({\n 'summary': summary\n })", "d...
[ "0.58870405", "0.58870405", "0.58870405", "0.5803425", "0.5781204", "0.5522118", "0.5503257", "0.54215056", "0.53986794", "0.53744864", "0.53230405", "0.5302629", "0.52970827", "0.5282875", "0.5266578", "0.52372295", "0.5206945", "0.5153626", "0.5151684", "0.5148715", "0.5141...
0.6722548
0
Display unpublished Draft Entries
def drafts(): query = Entry.drafts().order_by(Entry.last_mod_date.desc()) return object_list('index.html', query)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drafts_view(self, request, object_id, extra_context=None):\n opts = self.model._meta\n action_list = [{\"revision\": version.revision,\n \"url\": reverse(\"admin:%s_%s_draft\" % (opts.app_label, opts.module_name), args=(version.object_id, version.revision.id))}\n ...
[ "0.7508209", "0.6815543", "0.6162445", "0.6106849", "0.60844666", "0.6059696", "0.60429025", "0.60228574", "0.6012785", "0.59416395", "0.5828027", "0.5751404", "0.5730366", "0.57115114", "0.5708828", "0.5697832", "0.5697832", "0.5679159", "0.5660224", "0.5650022", "0.56475645...
0.73618597
1
Create new blog Entry
def create(): if request.method == 'POST': if request.form.get('title') and request.form.get('content'): entry = Entry.create( title = request.form.get('title'), content = request.form.get('content'), published = request.form.get('published') or Fa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createNewBlogEntry(self): #$NON-NLS-1$\r\n atomdoc = self._createNewEntryDocument()\r\n self._initNewEntryDocument(atomdoc)\r\n return ZAtomNewBlogEntry(atomdoc)", "def blog_create(request):\n entry = BlogRecord()\n form = BlogCreateForm(request.POST)\n if request.method == 'POS...
[ "0.8232406", "0.7668556", "0.7641279", "0.7607913", "0.73694056", "0.7322824", "0.73227113", "0.7250803", "0.7247709", "0.72167945", "0.7215931", "0.6994082", "0.69597936", "0.69173276", "0.68832356", "0.6816936", "0.68142015", "0.67737234", "0.6718318", "0.670351", "0.669757...
0.77166563
1
Edit existing blog Entry
def edit(slug): entry = get_object_or_404(Entry, Entry.slug == slug) if request.method == 'POST': if request.form.get('title'): entry.title = request.form.get('title') if request.form.get('content'): entry.content = request.form.get('content') entry.published = re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updatePost(self, editLink, entryId, zserverBlogEntry): #$NON-NLS-1$\r\n atomEntry = self.createEditBlogEntry()\r\n atomEntry.setId(entryId)\r\n atomEntry.setEditLink(editLink)\r\n self._populateAtomEntry(atomEntry, zserverBlogEntry)\r\n # update entry\r\n atomRespEntry...
[ "0.7704336", "0.76225203", "0.7564468", "0.7443002", "0.73097694", "0.72731054", "0.7030135", "0.7011261", "0.6999224", "0.6944325", "0.6901991", "0.6855571", "0.68527025", "0.6852159", "0.68337286", "0.67222476", "0.6703577", "0.66673446", "0.6648436", "0.66032463", "0.65913...
0.72877353
5
Context manager to temporarily change to a new directory.
def chdir(new_dir): cur_dir = os.getcwd() os.chdir(new_dir) try: yield finally: os.chdir(cur_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_dir(new_dir):\n owd = os.getcwd()\n os.chdir(new_dir)\n\n try:\n yield\n finally:\n os.chdir(owd)", "def cd_manager(self, new_wd):\n old_wd = self.cwd\n self.cd(new_wd)\n yield self.cwd\n self.cd(old_wd)", "def __enter__(self):\n self.savedPa...
[ "0.7734695", "0.75994277", "0.7524285", "0.74483794", "0.7443039", "0.7389849", "0.7278982", "0.71953887", "0.7141239", "0.7134059", "0.7131782", "0.70410705", "0.70233524", "0.7012039", "0.69601715", "0.695928", "0.69448084", "0.6925167", "0.6922496", "0.69155693", "0.690279...
0.74489474
4
Ensure that a folder exists and create it if it doesn't, including any parent folders, as necessary.
def create_folder(target_folder): try: os.makedirs(target_folder) except OSError as e: pass return os.path.exists(target_folder)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_folder(*arg):\n if len(arg) == 0:\n raise Exception(\"No input to ensure_folder\")\n path = get_dir(Path(*arg))\n path.mkdir(parents=True, exist_ok=True)", "def create_folder_if_needed(path):\n if os.path.exists(path):\n print(\"{} dir exists\".format(path))\n else:\n ...
[ "0.82459253", "0.8094383", "0.8059282", "0.788112", "0.7779735", "0.7752992", "0.77248335", "0.77168036", "0.77027094", "0.76686084", "0.7639529", "0.76316696", "0.76276046", "0.7627525", "0.7594649", "0.7567482", "0.7552197", "0.75503033", "0.7529557", "0.7526078", "0.75254"...
0.7339701
36
a function converting csv output files from operational_sep_quantities to json files for observations
def obs_csv2json(input_file,output_file,example_path,instrument): obs_path = Path(cfg.obs_path) with open(example_path,'r') as e: example = js.load(e) #deleting unused categories del(example['sep_forecast_submission']['forecasts']) del(example['sep_forecast_submission']['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataset(input_file_path, output_file_path):\n col_index_map = {'user_id': 0, 'session_id': 1, 'timestamp': 2, 'step': 3, 'action_type': 4, 'reference': 5,\n 'platform': 6, 'city': 7, 'device': 8,\n 'current_filters': 9, 'impressions': 10, 'prices': 11}\n fla...
[ "0.60670656", "0.5917598", "0.5867013", "0.577265", "0.5737042", "0.5713435", "0.56811106", "0.56413877", "0.56257904", "0.5622406", "0.5606425", "0.5585183", "0.55736536", "0.55720776", "0.5546977", "0.554406", "0.55393744", "0.5519248", "0.5511894", "0.5495278", "0.5494552"...
0.7022942
0
choose the correct instrument to use for observations for a given date range. inputs must be date objects from the datetime module. used if there is no information about which instrument was primary.
def choose_inst(given_start_date,given_end_date): #INPUTS MUST BE DATE OBJECTS inst_start_dates=[] inst_end_dates=[] good_instruments = [] good_end_dates = [] bad_inst = [] #extracting dates where instruments are active from csv file inst_dates = pd.read_csv(ref_path / 'instrument...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_prime_inst(given_start_date,given_end_date):\r\n\r\n #extracting primary dates where instruments are active from csv file\r\n inst_prime_dates = pd.read_csv(ref_path / 'GOES_primary_assignments.csv', header=3)\r\n\r\n #figuring out which instrument is primary for given start date\r\n for d i...
[ "0.6696412", "0.5244132", "0.5244106", "0.5234904", "0.523354", "0.5202343", "0.50902385", "0.49597186", "0.4926985", "0.49259138", "0.4911848", "0.48814812", "0.4860115", "0.48596224", "0.48520213", "0.48501316", "0.4843819", "0.4843819", "0.48264506", "0.48252285", "0.48125...
0.707812
0
choose the correct instrument to use for observations for a given date range based on the primary instrument for that time period. inputs must be date objects from the datetime module.
def choose_prime_inst(given_start_date,given_end_date): #extracting primary dates where instruments are active from csv file inst_prime_dates = pd.read_csv(ref_path / 'GOES_primary_assignments.csv', header=3) #figuring out which instrument is primary for given start date for d in range(len(inst_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_inst(given_start_date,given_end_date): #INPUTS MUST BE DATE OBJECTS\r\n\r\n inst_start_dates=[]\r\n inst_end_dates=[]\r\n good_instruments = []\r\n good_end_dates = []\r\n bad_inst = []\r\n\r\n #extracting dates where instruments are active from csv file\r\n inst_dates = pd.read_csv...
[ "0.7161972", "0.5350023", "0.5343824", "0.52754986", "0.52716273", "0.5243731", "0.5240982", "0.5149819", "0.5139513", "0.50795436", "0.50315154", "0.5018969", "0.5007179", "0.50046945", "0.49793446", "0.4966744", "0.49542493", "0.4934821", "0.4922149", "0.49216446", "0.48913...
0.68636316
1
a function that creates observational json output files given start and end dates by extracting data from the GOES database. Only works with GOES instruments.
def database_extraction(mod_start_time,mod_end_time,instrument_chosen,subevent_bool, detect_previous_event = False,thresholds='100,1', one_thresh = False): obs_file_created = False #extending time window window_end_time = (mod_end_time + timedelta(days=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n parser = argparse.ArgumentParser(description='Process input file and save to output file.')\n\n parser.add_argument('-i',\n '--input',\n help='Trip report file (txt file) to process.',\n action='store')\n\n parser.add_argum...
[ "0.6041613", "0.58948135", "0.58275783", "0.5822768", "0.5751428", "0.5720737", "0.5717822", "0.570631", "0.57046837", "0.5676997", "0.5632432", "0.56253904", "0.5612947", "0.5587226", "0.55808955", "0.5580337", "0.5570761", "0.55477357", "0.5539858", "0.5537866", "0.5495238"...
0.5659217
10
will create JSON output files if there are two events (for each threshold) in one time window. Ie, if there are two >10MeV >10pfu events as well as two >100MeV >1pfu events, will create files for all four events, but if there are three >100MeV >1pfu events, will only generate JSON files for the first two. Second events...
def two_in_one(obs_file,et,subevent): #in this function, the "original time window" talked about in the comments #refers to the start and end times that were input to create the file obs_file, #which will likely have been created using the database_extraction function #opening first outp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multi_event(st,et,instrument_chosen,subevent):\r\n print('checking for multiple events within given time window')\r\n \r\n #creating file for time window with first events for all thresholds\r\n out_name = Path(cfg.obs_path) / database_extraction(st,et,instrument_chosen,subevent)\r\n\r\n #creati...
[ "0.67087024", "0.5573654", "0.5543615", "0.5325832", "0.5257581", "0.523323", "0.5181749", "0.5180666", "0.51276666", "0.5114678", "0.51098496", "0.5098101", "0.5082852", "0.5076031", "0.50719666", "0.5061145", "0.50575876", "0.5052095", "0.5037945", "0.5035007", "0.5021967",...
0.62420124
1
all events in one time window (not just two) used if there is more than one event occurring within a short time period. will generate an output file for every event that occurs within a given time window not to be confused with many_events, which generates output given multiple time windows. Can create files for up to ...
def multi_event(st,et,instrument_chosen,subevent): print('checking for multiple events within given time window') #creating file for time window with first events for all thresholds out_name = Path(cfg.obs_path) / database_extraction(st,et,instrument_chosen,subevent) #creating files for all ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def INPUT_Periods_file(input):\n \n global events\n \n tb = 3600\n ta = 3600\n \n Period = input['min_date'].split('T')[0] + '_' + \\\n input['max_date'].split('T')[0] + '_' + \\\n str(input['min_mag']) + '_' + str(input['max_mag'])\n eventpath = os.path.join(i...
[ "0.6087541", "0.59404063", "0.58714825", "0.5870363", "0.58608985", "0.57862127", "0.57703376", "0.5700037", "0.5650298", "0.56280893", "0.5617199", "0.56035525", "0.5598488", "0.5553481", "0.55442035", "0.5541307", "0.5524684", "0.55119693", "0.5496372", "0.5496372", "0.5493...
0.6893672
0
given lists of peak fluxes for protons >10 MeV and >100 MeV, creates a boolean for whether or not each event is a subevent (doesn't cross a threshold)
def gen_subevent_bools(p_10,p_100): #list of subevent booleans subevent_bools = [] #extracting 10 MeV peak flux if it exists for j in range(len(p_10)): try: p10 = float(p_10[j]) except ValueError: p10 = 'nan' #extracting 100 MeV pe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec_to_peaks(data, value, fp = iterate_structure(generate_binary_structure(rank = 2, connectivity=2), 10)):\n\n max_arr = maximum_filter(data, footprint = fp)\n return (data == max_arr) & (data > value)", "def check_overlaps(self, verbose = False):\n if hasattr(self.phot, \"data\") and hasattr(...
[ "0.6195646", "0.607271", "0.5963362", "0.5910339", "0.5904927", "0.5832219", "0.57945627", "0.5773653", "0.563543", "0.5589451", "0.5549814", "0.553361", "0.55285126", "0.5508843", "0.5495379", "0.54413253", "0.54157656", "0.5363649", "0.532954", "0.5318515", "0.53176546", ...
0.82217896
0
takes in lists of start times and end times to create a list of time windows, and a list of whether or not an event is a subevent, and uses those lists to run functions that extract data from the GOES database. Each list must have the same length, and indices of lists must correspond (ie start_time[j] has an end time o...
def many_events(start_time,end_time,subevent_bools): #running through for each event for j in range(len(start_time)): #start, end, and subevent bool for this event st = start_time[j] et = end_time[j] subevent = bool(subevent_bools[j]) #che...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multi_event(st,et,instrument_chosen,subevent):\r\n print('checking for multiple events within given time window')\r\n \r\n #creating file for time window with first events for all thresholds\r\n out_name = Path(cfg.obs_path) / database_extraction(st,et,instrument_chosen,subevent)\r\n\r\n #creati...
[ "0.65961754", "0.6502333", "0.6414507", "0.6089023", "0.5852518", "0.5768563", "0.57619506", "0.57517695", "0.5713987", "0.56655604", "0.56637067", "0.56566614", "0.56286615", "0.55703324", "0.5542513", "0.5491681", "0.5479628", "0.54761803", "0.5450979", "0.54409343", "0.543...
0.8048312
0
Returning the sync mode
def get_sync_mode(): return sync_mode
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def synchronize_system_mode(self):\n\n return self._synchronize_system_mode", "def sync(self):\n return self._sync", "def isSync(self):\n return False", "def getMode(self):\n with self.lock:\n mode = self.mode\n return mode", "def syncheck(self) :\n\t\ttry :\n\...
[ "0.72940135", "0.7088847", "0.7082289", "0.7017716", "0.6868106", "0.68618685", "0.68516916", "0.6798914", "0.6798914", "0.6657855", "0.64055157", "0.6349925", "0.63405436", "0.6327484", "0.63198066", "0.63171744", "0.631424", "0.63071305", "0.63044363", "0.62617934", "0.6251...
0.91350996
0
Checking the sync_mode based on the given configuration
def check_sync_mode(): global sync_mode _description = '' _modes = { SyncMode.RECEIVER: '(REMOTE ➔ LOCAL)', SyncMode.SENDER: '(LOCAL ➔ REMOTE)', SyncMode.PROXY: '(REMOTE ➔ LOCAL ➔ REMOTE)', SyncMode.DUMP_LOCAL: '(LOCAL, ONLY EXPORT)', SyncMode.DUMP_REMOTE: '(REMOTE, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sync_mode():\n return sync_mode", "def __check_mode(self):\n self.mode[\"auto_mode\"] = self.communications.get_mode()", "def check_config_mode(self):\n return False", "def __check_mode_change(self):\n if self.mode[\"auto_mode\"] != self.mode[\"last_mode\"]:\n self....
[ "0.72925556", "0.692381", "0.6704957", "0.63555396", "0.63372236", "0.61973035", "0.61619157", "0.6108568", "0.6087788", "0.6085571", "0.6059644", "0.60411906", "0.60293037", "0.60175145", "0.594344", "0.59315693", "0.588756", "0.58717567", "0.58026725", "0.580076", "0.580005...
0.78860736
0
Check if given client is remote client
def is_remote(client): if client == Client.ORIGIN: return is_origin_remote() elif client == Client.TARGET: return is_target_remote() elif client == Client.LOCAL: return False else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_remote(self): # -> Any | bool:\n ...", "def is_remote(self):\n if socket.gethostbyname(socket.gethostname()).startswith('10.7'):\n return False\n else:\n return True", "def is_local_client(self):\n return self.msg.is_local_client", "def is_remote(self...
[ "0.7279024", "0.7175781", "0.70540047", "0.6942053", "0.6814598", "0.6683476", "0.66315174", "0.66083586", "0.6517704", "0.6482558", "0.6460855", "0.6398728", "0.63722503", "0.6251613", "0.62041306", "0.62041306", "0.61882174", "0.615462", "0.61380357", "0.6073914", "0.602614...
0.83206755
0
Check if target is remote client
def is_target_remote(): return sync_mode in (SyncMode.SENDER, SyncMode.PROXY, SyncMode.DUMP_REMOTE, SyncMode.IMPORT_REMOTE, SyncMode.SYNC_REMOTE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_remote(client):\n if client == Client.ORIGIN:\n return is_origin_remote()\n elif client == Client.TARGET:\n return is_target_remote()\n elif client == Client.LOCAL:\n return False\n else:\n return False", "def is_remote(self): # -> Any | bool:\n ...", "def...
[ "0.7902426", "0.7443142", "0.7258655", "0.7257651", "0.7235301", "0.6850371", "0.6576049", "0.645614", "0.6447849", "0.640186", "0.6281278", "0.61393785", "0.60623175", "0.60600775", "0.600218", "0.59922236", "0.59744495", "0.59468746", "0.593498", "0.5931949", "0.59191805", ...
0.7590158
1
Check if origin is remote client
def is_origin_remote(): return sync_mode in (SyncMode.RECEIVER, SyncMode.PROXY, SyncMode.DUMP_REMOTE, SyncMode.IMPORT_REMOTE, SyncMode.SYNC_REMOTE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_remote(client):\n if client == Client.ORIGIN:\n return is_origin_remote()\n elif client == Client.TARGET:\n return is_target_remote()\n elif client == Client.LOCAL:\n return False\n else:\n return False", "def is_remote(self):\n return False", "def is_remot...
[ "0.79242504", "0.7800007", "0.7686724", "0.75528294", "0.747566", "0.7285064", "0.70139563", "0.6977031", "0.6942172", "0.6772315", "0.6772315", "0.6772315", "0.6772315", "0.67488825", "0.6476083", "0.6462293", "0.64356977", "0.63294023", "0.6260433", "0.6211482", "0.62091947...
0.8189138
0
Check if sync mode is import
def is_import(): return sync_mode in (SyncMode.IMPORT_LOCAL, SyncMode.IMPORT_REMOTE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_sync_mode():\n global sync_mode\n _description = ''\n\n _modes = {\n SyncMode.RECEIVER: '(REMOTE ➔ LOCAL)',\n SyncMode.SENDER: '(LOCAL ➔ REMOTE)',\n SyncMode.PROXY: '(REMOTE ➔ LOCAL ➔ REMOTE)',\n SyncMode.DUMP_LOCAL: '(LOCAL, ONLY EXPORT)',\n SyncMode.DUMP_REMO...
[ "0.75585586", "0.69149435", "0.665945", "0.64593935", "0.6442651", "0.63151574", "0.63039666", "0.6274873", "0.6236776", "0.6194281", "0.6192882", "0.6032196", "0.59927666", "0.59285295", "0.59285295", "0.59168273", "0.5914921", "0.58185005", "0.57003963", "0.5684882", "0.567...
0.9084145
0
Check if sync mode is import
def is_dump(): return sync_mode in (SyncMode.DUMP_LOCAL, SyncMode.DUMP_REMOTE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_import():\n return sync_mode in (SyncMode.IMPORT_LOCAL, SyncMode.IMPORT_REMOTE)", "def check_sync_mode():\n global sync_mode\n _description = ''\n\n _modes = {\n SyncMode.RECEIVER: '(REMOTE ➔ LOCAL)',\n SyncMode.SENDER: '(LOCAL ➔ REMOTE)',\n SyncMode.PROXY: '(REMOTE ➔ LOCA...
[ "0.9084145", "0.75585586", "0.69149435", "0.665945", "0.64593935", "0.6442651", "0.63039666", "0.6274873", "0.6236776", "0.6194281", "0.6192882", "0.6032196", "0.59927666", "0.59285295", "0.59285295", "0.59168273", "0.5914921", "0.58185005", "0.57003963", "0.5684882", "0.5679...
0.63151574
6
Run command depending on the given client
def run_command(command, client, force_output=False, allow_fail=False, skip_dry_run=False): if system.config['verbose']: output.message( output.host_to_subject(client), output.CliFormat.BLACK + command + output.CliFormat.ENDC, debug=True ) if system.config['d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _client_cmd(self, cmd):\n logging.info('Client cmd: [%s]', cmd)\n return self._client.run(cmd)", "def run_cmd(server, client):\n msg = [client.get_command()]\n client.input_list += msg\n server.logger.info(\"RECEIVED INPUT {} : {}\".format(client.ip, msg[0]))\n if no...
[ "0.7197345", "0.7119318", "0.6828006", "0.66738003", "0.64791876", "0.64679384", "0.64308935", "0.6380497", "0.62591547", "0.6222036", "0.60982287", "0.60168076", "0.6011429", "0.58656096", "0.5851736", "0.5816941", "0.58131343", "0.57894695", "0.57740134", "0.5730364", "0.56...
0.5610078
26
Assert valid court order.
def test_court_orders(session, test_status, expected_code, expected_msg): business = factory_business('BC1234567') filing = copy.deepcopy(COURT_ORDER_FILING_TEMPLATE) del filing['filing']['courtOrder']['fileKey'] if test_status == 'FAIL': del filing['filing']['courtOrder']['orderDetails'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_case_customer_complete_courseevent_order(self):", "def test_order_constraint(self):\n orders_placed = [25, 25, 25]\n with self.assertRaises(Exception):\n analyse_uncertain_demand.UncertainDemand(\n orders=orders_placed,\n sku='Rx493-90',\n ...
[ "0.6418377", "0.6131915", "0.5973272", "0.59159654", "0.5835521", "0.5678925", "0.56525654", "0.5622847", "0.55975693", "0.55640495", "0.55434185", "0.5528798", "0.55012167", "0.54883766", "0.54165864", "0.539526", "0.53826475", "0.5382484", "0.5381499", "0.5373344", "0.53692...
0.67318577
0
Assert valid court order.
def test_court_order_file(session, minio_server, test_name, expected_code, expected_msg): business = factory_business('BC1234567') filing = copy.deepcopy(COURT_ORDER_FILING_TEMPLATE) if test_name == 'SUCCESS': filing['filing']['courtOrder']['fileKey'] = _upload_file(letter, invalid=False) elif ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_court_orders(session, test_status, expected_code, expected_msg):\n business = factory_business('BC1234567')\n filing = copy.deepcopy(COURT_ORDER_FILING_TEMPLATE)\n del filing['filing']['courtOrder']['fileKey']\n if test_status == 'FAIL':\n del filing['filing']['courtOrder']['orderDetail...
[ "0.67318577", "0.6418377", "0.6131915", "0.5973272", "0.59159654", "0.5835521", "0.5678925", "0.56525654", "0.5622847", "0.55975693", "0.55640495", "0.55434185", "0.5528798", "0.55012167", "0.54883766", "0.54165864", "0.539526", "0.53826475", "0.5382484", "0.5381499", "0.5373...
0.51499826
53
Find a text label for an axis describing a provided CSV column.
def get_label(column): for key, label in column_to_label.items(): if key in column: return label
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _label(self, column):\n # XXX\n return column", "def _get_label ( self ):\n if self._label is not None:\n return self._label\n return 'Column %d' % (self.index + 1)", "def GetColLabelValue(self, col):\n label = self.column_label(self.colsel[col])\n \n ...
[ "0.70492536", "0.65161985", "0.6515418", "0.63260293", "0.60894614", "0.6023913", "0.59223855", "0.5880934", "0.5865998", "0.57208353", "0.5644971", "0.56144625", "0.55985284", "0.55886084", "0.5540931", "0.5496037", "0.5494928", "0.5494829", "0.5493561", "0.5486655", "0.5454...
0.7068317
0
Filter out all pandas.DataFrame without required columns
def dfs_filter(dfs, df_names, column_list): dfs_out = [] df_names_out = [] # loop over all (pandas.DataFrame, str) pairs for df, df_name in zip(dfs, df_names): has_all = True for column in column_list: if column not in df.columns: has_all = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_df(adjmat, df, verbose=3):\n remcols = df.columns[~np.isin(df.columns.values, adjmat.columns.values)].values\n if len(remcols)>0:\n if verbose>=3: print('[bnlearn] >Removing columns from dataframe to make consistent with DAG [%s]' %(remcols))\n df.drop(labels=remcols, axis=1, inplac...
[ "0.7230408", "0.7230408", "0.7211834", "0.7153902", "0.7082774", "0.70773596", "0.69314176", "0.6903499", "0.6895523", "0.66686505", "0.6667085", "0.66075593", "0.6605839", "0.658763", "0.6533146", "0.6488316", "0.6451615", "0.64211375", "0.64115214", "0.64103115", "0.6402743...
0.5810948
56
Find all possible values of a column in the pandas.DataFram list
def dfs_all_values(dfs, column): values = [] # loop over all (pandas.DataFrame, str) pairs for df in dfs: values.extend(df[column].tolist()) # set() removes duplicates # sorted() converts Set to List and sort the elements return sorted(set(values))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getValuesForColumn(self, columnname):\n return list(self.abundance_df[columnname].unique())", "def get_values(df):\n return df.columns.values.tolist()", "def get_binary_values(data_frame):\n all_columns = pandas.DataFrame( index = data_frame.index)\n for col in data_frame.columns:\n dat...
[ "0.6171805", "0.6113757", "0.5891988", "0.5879397", "0.58606875", "0.5812586", "0.57938266", "0.5787178", "0.57815653", "0.5762439", "0.5762439", "0.56766194", "0.56144273", "0.5601676", "0.5587507", "0.5523211", "0.55008084", "0.5450795", "0.5401311", "0.5399768", "0.5390941...
0.6156369
1
Draw multiple lines y(x) using data from the dfs list on the ax subplot.
def draw_plot(ax, dfs, legend, x, y, xscale, yaxis_max): xticks = dfs_all_values(dfs, x) # loop over all pandas.DataFrame objects for df in dfs: # setting the x-column as an index is required to draw the y-column # as a function of x argument df = df.set_index(x) # plot line ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(x, y, *dfs):\n ax = None\n for df in dfs:\n ax = df[[x, y]].set_index(x).plot(kind='line', ylim=(0, None), xlim=(0, None), ax=ax)", "def update_plot(self,ax):\n for i,line in enumerate(self.lines):\n line.set_ydata(self.data[i].f)\n for line in self.lines: \n ...
[ "0.75955755", "0.6639895", "0.63147664", "0.6244438", "0.6018296", "0.5990527", "0.59632486", "0.5877029", "0.58101994", "0.58101994", "0.5800447", "0.5794655", "0.5775401", "0.57584023", "0.5737174", "0.5724625", "0.5724219", "0.57178116", "0.56640327", "0.56584495", "0.5646...
0.7199761
1
Draw a table of all data used to chart y(x)
def draw_table(ax, dfs, legend, x, y): col_labels = dfs_all_values(dfs, x) column_legend = [] cell_text = [] # loop over all pandas.DataFrame objects for df in dfs: # to allow query y(x) easily df = df.set_index(x) df_row = df[y] # build a row with filled blanks '-' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table(self):\n\n param=self.x_param\n\n device=self.device\n\n base_params=device.get_params()\n\n data_tot=DataFrame()\n\n for i in range(len(param)):\n\n print_index=1\n\n for name in param.names:\n\n device._set_params(param(i))\n\n ...
[ "0.64481795", "0.6369142", "0.61868083", "0.615285", "0.60729265", "0.60604787", "0.59911245", "0.5980409", "0.59740573", "0.5895259", "0.5869834", "0.5847987", "0.5836506", "0.5818547", "0.58129287", "0.5809058", "0.57461077", "0.57257223", "0.5720079", "0.5665956", "0.56587...
0.67767966
0
Load all of the ovarian dataframes as values in the self._data dict variable, with names as keys, and format them properly.
def __init__(self, version="latest", no_internet=False): # Set some needed variables, and pass them to the parent Dataset class __init__ function valid_versions = ["0.0", "0.0.1"] # This keeps a record of all versions that the code is equipped to handle. That way, if there's a new data release but the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dataframe(self):\n logging.info('*** Creating the dataframes from the source files ' )\n \n for k in self.datasets_keys:\n #for k in ['igra2' , 'ncar']:\n \n logging.info('*** Creating the dataframe for the dataset: %s ' , k ) ...
[ "0.6741529", "0.63294286", "0.619855", "0.60682344", "0.60343254", "0.5896149", "0.5864683", "0.5835448", "0.58048934", "0.5794775", "0.57485104", "0.574704", "0.5740164", "0.5707918", "0.5695425", "0.5673318", "0.5653236", "0.5649809", "0.56193334", "0.55798227", "0.5578606"...
0.5710556
13
Initialize the linked list.
def __init__(self): self.head = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, lst=[]):\n self.__length = 0 # current length of the linked list\n self.__head = None # pointer to the first node in the list\n for e in lst: # initialize the list,\n self.add(e) # by adding elements one by one", "def __init__(self):\n node = ListNode...
[ "0.793523", "0.7746552", "0.7618733", "0.76008236", "0.7564557", "0.7530009", "0.74541533", "0.74384236", "0.7436091", "0.74262166", "0.74253154", "0.74253154", "0.73937964", "0.7374561", "0.7347711", "0.7333443", "0.7332118", "0.7326369", "0.7326369", "0.7326369", "0.731081"...
0.7175879
63
Add a node to the linked list.
def push(self, val): self.head = Node(val, self.head)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_node(self, node):\n self.nodes.append(node)", "def add_node(self, node):\n self.nodes.add(node)", "def addNode (self, node):\n self.__nodes.add(node)", "def add_node(self, node):\n self._nodes.add(node)", "def add_node(self, node):\n self._nodes.add(node)", "def...
[ "0.8397831", "0.83893156", "0.82865614", "0.8239832", "0.8239832", "0.81677186", "0.8124044", "0.80292726", "0.8016808", "0.79811966", "0.7921723", "0.7920711", "0.7804295", "0.7771042", "0.7770391", "0.7748963", "0.7730202", "0.7698047", "0.7654877", "0.7544322", "0.7534985"...
0.0
-1
Pop a value off of the end of the list.
def pop(self): if not self.head: raise IndexError('Cannot pop from empty linked list.') popped_value = self.head.val self.head = self.head.next return popped_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop(self): ##################### <-\n value = self.lst[-1]\n self.lst = self.lst[:-1]\n return value", "def pop(self):\n\n value = self.values[0]\n if len(self.values) == 1:\n self.values = []\n else:\n self.populate(self.values[1:])\n re...
[ "0.84853077", "0.79199415", "0.7871684", "0.77542204", "0.7659789", "0.76190156", "0.7606379", "0.7602611", "0.75503474", "0.75462514", "0.7535589", "0.7535589", "0.7535589", "0.75355107", "0.74785006", "0.74628246", "0.7460463", "0.744531", "0.7444407", "0.7429238", "0.74292...
0.7111202
43
Search through the linked list.
def search(self, val): if not self.head: raise IndexError('Cannot search empty list.') current_node = self.head while current_node: if current_node.val == val: return current_node current_node = current_node.next
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(self, ele):\n if self.head:\n current = self.head\n while True:\n\tif current.data == ele:\n\t return True\n\tcurrent = current.next\n\tif current == self.head:\n\t break\n return False", "def search(self, data):\r\n if self.head is None:\r\n pass\r\n current...
[ "0.7565156", "0.751804", "0.74692243", "0.7460926", "0.7455549", "0.7395807", "0.7327136", "0.73222226", "0.72867405", "0.7258646", "0.7242936", "0.72091985", "0.7195228", "0.7178875", "0.70211923", "0.6858696", "0.6825057", "0.68024164", "0.6769936", "0.6705504", "0.67019075...
0.7163797
14
Remove a value from the linked list.
def remove(self, val): current_node = self.head previous_node = None while current_node: if current_node.val == val: if previous_node: previous_node.next = current_node.next else: self.head = current_node.next ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, value):\r\n if self.head is None:\r\n return\r\n\r\n if self.head.value == value:\r\n self.head = self.head.next\r\n return\r\n\r\n node = self.head\r\n while node.next:\r\n if node.next.value == value:\r\n node...
[ "0.85559684", "0.8450625", "0.84335315", "0.828074", "0.819369", "0.8189939", "0.81423485", "0.80990094", "0.8078319", "0.7913155", "0.79033136", "0.7874182", "0.78658223", "0.78636545", "0.78086895", "0.7679407", "0.7675178", "0.7667091", "0.7643101", "0.75630695", "0.754978...
0.8185222
6
Just check that the `_data_changed` parameter is added the response.
def test_returned_data_changed(self): request = RequestFactory().get('/') admin_instance = get_modeladmin(Iframe) response_302 = HttpResponseRedirect(redirect_to='/admin_mountpoint/') new_response = admin_instance.maybe_fix_redirection( request=request, response=response_302)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_data(self, data):\n self.logger.debug(\"handle_data()\")\n self.response_data.append(data)", "def data_changed(self):\n return", "def check_for_new_data(self):\n return", "def data_changed(self):\n self.data_changed_signal.emit(self)", "def on_new_data(self, da...
[ "0.7027461", "0.66865385", "0.65378416", "0.6361653", "0.63519835", "0.6307863", "0.6246295", "0.6245001", "0.6158304", "0.61403364", "0.61214167", "0.61103153", "0.6078733", "0.6078601", "0.59536886", "0.59317225", "0.5920005", "0.5906738", "0.5872005", "0.5840075", "0.58380...
0.5979023
14
Going to a nonchunkadmin URL should be ok, and should also put the `_data_changed` parameter onto the URL.
def test_to_other_url(self): user = User(username='test', is_staff=True, is_superuser=True, is_active=True) user.set_password('test') user.full_clean() user.save() request = RequestFactory().get('/') response_302 = HttpResponseRedirect(redirect_to='/ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_returned_data_changed(self):\n request = RequestFactory().get('/')\n admin_instance = get_modeladmin(Iframe)\n response_302 = HttpResponseRedirect(redirect_to='/admin_mountpoint/')\n new_response = admin_instance.maybe_fix_redirection(\n request=request, response=res...
[ "0.6304963", "0.60231835", "0.5975458", "0.59199995", "0.57574075", "0.5661228", "0.56567496", "0.5646688", "0.56410176", "0.5619408", "0.5619408", "0.5565735", "0.5562113", "0.5547753", "0.5510401", "0.55066466", "0.54986465", "0.54867476", "0.54704493", "0.54627734", "0.544...
0.6291411
1
If `_autoclose` is in the URL, that + `_data_changed` should propagate to the next redirect URL for the purposes of our adminlinks JS.
def test_autoclose_chunkadmin(self): user = User(username='test', is_staff=True, is_superuser=True, is_active=True) user.set_password('test') user.full_clean() user.save() admin_instance = get_modeladmin(Iframe) self.assertIsInstance(admin_instance, Re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_post_save_change(self, request, obj):\n opts = self.model._meta\n\n if \"next\" in request.GET:\n return HttpResponseRedirect(request.GET['next'])\n\n if self.has_change_permission(request, None):\n post_url = reverse('admin:%s_%s_changelist' %\n ...
[ "0.5717953", "0.56154025", "0.5552884", "0.5355236", "0.5205197", "0.5178103", "0.49210623", "0.48757377", "0.48716828", "0.48654342", "0.48438132", "0.48274982", "0.48240012", "0.48213187", "0.47654843", "0.47389874", "0.46854186", "0.46743634", "0.46646327", "0.463678", "0....
0.5659059
1
if continue editing is hit, it should go back to the parent URL, I think?
def test_continue_editing_parent_object(self): user = User(username='test', is_staff=True, is_superuser=True, is_active=True) user.set_password('test') user.full_clean() user.save() admin_instance = get_modeladmin(Iframe) self.assertIsInstance(admin_in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit_and_back(self):\n self.submit(skip_confirm=True)\n self.parent().do_detail()", "def submit_and_back(self):\n self.submit(skip_confirm=True)\n self.parent().do_detail()", "def response_change(self, request, obj):\r\n \r\n # in these cases, the redirect is goo...
[ "0.6385778", "0.6385778", "0.6379418", "0.62234807", "0.6166165", "0.61428994", "0.6119325", "0.6115395", "0.61025864", "0.60791975", "0.6070473", "0.6042546", "0.60110354", "0.60064095", "0.600623", "0.5988462", "0.59622556", "0.59316474", "0.590217", "0.58978534", "0.589691...
0.65077806
0
Generate immediate (different by one mismatch) neighbours of the given genome pattern
def _generate_immediate_neighbours(pattern: str) -> list: generated = [] for i in range(len(pattern)): if pattern[i] == 'A': generated.extend([pattern[:i] + c + pattern[i + 1:] for c in LIST_A]) elif pattern[i] == 'C': generated.extend([pattern[:i] + c + pattern[i + 1:] f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_neighbours(pattern: str, mismatches: int) -> set:\n neighbourhood = set()\n neighbourhood.add(pattern)\n\n curr_patterns = [pattern]\n next_patterns = []\n\n for curr_mismatches in range(mismatches):\n for curr_pattern in curr_patterns:\n for neighbour in _generate_imm...
[ "0.6630292", "0.6147133", "0.61121386", "0.6109716", "0.6099266", "0.60585225", "0.60353184", "0.5980777", "0.59600437", "0.5955379", "0.58933324", "0.5820584", "0.5806383", "0.5797996", "0.5792484", "0.5790195", "0.57679236", "0.5754327", "0.5728205", "0.5717146", "0.5706085...
0.7541577
0
Generate neighbours for the given pattern (genome string)
def generate_neighbours(pattern: str, mismatches: int) -> set: neighbourhood = set() neighbourhood.add(pattern) curr_patterns = [pattern] next_patterns = [] for curr_mismatches in range(mismatches): for curr_pattern in curr_patterns: for neighbour in _generate_immediate_neighbo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_immediate_neighbours(pattern: str) -> list:\n generated = []\n for i in range(len(pattern)):\n if pattern[i] == 'A':\n generated.extend([pattern[:i] + c + pattern[i + 1:] for c in LIST_A])\n elif pattern[i] == 'C':\n generated.extend([pattern[:i] + c + patter...
[ "0.7232133", "0.674774", "0.6449919", "0.6243702", "0.6238935", "0.6133001", "0.612903", "0.5946089", "0.5851762", "0.5826999", "0.5814815", "0.5778444", "0.5769048", "0.5745069", "0.55670846", "0.5559852", "0.5557054", "0.5541717", "0.55216914", "0.55193025", "0.54643875", ...
0.64392906
3
Whether the given card matches this card
def is_match(self, card): return self.suit == card.suit or self.value == card.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_card_match(self, chosen_card, active_card, active_suit):\n\t\treturn chosen_card.is_match(active_card) or chosen_card.suit == active_suit", "def __eq__(self, other_card):\n if self.rank == other_card.rank or self.suit == other_card.suit:\n return True\n else:\n r...
[ "0.78050846", "0.7451856", "0.727455", "0.7232319", "0.718153", "0.7173871", "0.713753", "0.7100822", "0.67850065", "0.6778596", "0.6773867", "0.674615", "0.6730441", "0.66842115", "0.6663965", "0.6543529", "0.6535424", "0.6506496", "0.648398", "0.64583373", "0.6433088", "0...
0.8583878
0
Ensures that chosen_card is an acceptable match, given the active_card and active_suit
def _validate_card_match(self, chosen_card, active_card, active_suit): return chosen_card.is_match(active_card) or chosen_card.suit == active_suit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_chosen_card(self, allowed_cards, chosen_card):\n if self.action is not None:\n if self.action in allowed_cards:\n logger.info(f\"Successfully chose the card: {self.action}\")\n chosen_card = self.action\n else:\n logger.error(f\"{sel...
[ "0.70289963", "0.70051605", "0.6518905", "0.6450109", "0.63630843", "0.630566", "0.62759304", "0.62171423", "0.61978257", "0.61198056", "0.60976046", "0.60950667", "0.6085195", "0.6076674", "0.60443", "0.60375905", "0.60289156", "0.59881556", "0.59762114", "0.59721756", "0.59...
0.82993805
0
If test_mode is True, an image of `screen` is saved
def save_screen(screen): if not video_mode: # Don't record video return False # Make global variables writeable global current_frame global path_checked frames_directory = os.path.dirname( os.path.dirname( os.path.realpath(__file__))) + "\\frames\\" if not path_check...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveScreenPNG(self, filename):\n return nes_lib.saveScreenPNG(self.obj, filename)", "def screen_shot(self):\n screen_size = '{}x{}@{}x{}/0'.format(self.screen[0], self.screen[1], self.screen[0], self.screen[1])\n subprocess.check_call([\n ADB_EXECUTOR, '-s', self.device_id, 's...
[ "0.65687513", "0.64645797", "0.62103873", "0.6199405", "0.6150051", "0.6116136", "0.6103849", "0.6095868", "0.60331243", "0.6008139", "0.5992217", "0.5990289", "0.59354466", "0.5926195", "0.58971107", "0.5877742", "0.58629024", "0.5829966", "0.58243024", "0.57998353", "0.5798...
0.7221238
0
Check 'frames' folder exists. If not, create it
def check_folder(directory): global path_checked if not os.path.exists(directory): os.makedirs(directory) else: path_checked = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_keyframes_from_frames(frames_dir, keyframes, name_dir=\"keyframes\", remove_frames_dir=True):\n # Create new directory if it doesn't already exist\n keyframes_dir = make_dir(name_dir, Path(frames_dir).parent)\n\n # Copy keyframes from frames directory, only if destiny directory is empty\n if l...
[ "0.5819628", "0.58033806", "0.57717586", "0.5712013", "0.5633541", "0.5623171", "0.5622375", "0.56030816", "0.56009656", "0.557692", "0.5512916", "0.55081576", "0.55065334", "0.549381", "0.5465493", "0.5456761", "0.54223925", "0.54223925", "0.54124236", "0.5407644", "0.535819...
0.0
-1
Return the FPS, or if video_mode is true, return the video FPS
def get_fps(clock): if video_mode: return "30" # Video FPS will be 30 else: return str(int(round(clock.get_fps(), 0)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_video_fps(self):\n fps = self.video.get(cv2.CAP_PROP_FPS)\n logging.info('Video FPS: {}'.format(fps))\n return fps", "def get_fps(video, use_opencv=False):\n\n if use_opencv:\n video_cap = cv2.VideoCapture(video)\n fps = video_cap.get(cv2.CAP_PROP_FPS)\n video...
[ "0.7892058", "0.7523606", "0.7171496", "0.7074355", "0.705509", "0.7029802", "0.69614834", "0.69196635", "0.69127625", "0.6722967", "0.66790813", "0.66567814", "0.6546592", "0.6546592", "0.653519", "0.65346336", "0.6509575", "0.64402926", "0.6350182", "0.6329676", "0.6317738"...
0.74950314
2
Creates an ordered puzzle of dimension lengthXlength with length > 1
def __init__(self, length): if (length <= 1 or length.__class__ != int): try: raise ValueError('length must be an integer greater than 1') except: print('something went wrong!') raise self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_board(size) -> list:\n return list(itertools.product([i for i in range(size)], repeat=2))", "def buildpuzzle(self):\r\n self.puzzle = copy.deepcopy(self.rows)\r\n if self.difficulty == 1:\r\n self.removedigits(1)\r\n if self.difficulty == 2:\r\n self.remov...
[ "0.64792323", "0.62767714", "0.61650395", "0.6140122", "0.6096842", "0.60461116", "0.58814245", "0.5815948", "0.5800065", "0.57949734", "0.5787429", "0.5744311", "0.57322896", "0.56909317", "0.5681817", "0.56767344", "0.5667736", "0.56485003", "0.5632847", "0.56253445", "0.56...
0.5530513
28
Gets the item at the exact coordinate in the board
def __get_box(self, position): return self.__board[position//self.__length][position%self.__length]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, args):\n x, y = args\n xpos, ypos = self.move(x, y)\n return self.board[xpos][ypos]", "def get_item(self, items, y, x):\n if self.maze[y][x] != \" \" and self.maze[y][x] in items:\n return self.maze[y][x]\n else:\n return None", "de...
[ "0.7532374", "0.73557675", "0.7260173", "0.72259563", "0.7206686", "0.7199228", "0.7171327", "0.7140547", "0.7119871", "0.71094227", "0.7099475", "0.7034289", "0.7034289", "0.7010607", "0.7004049", "0.7004049", "0.7004049", "0.69689083", "0.6966279", "0.6965098", "0.69650495"...
0.0
-1
Changes the position of the blank box
def swap(self, direction): directions = {'up': (-1, 0), 'down': (1, 0), 'left': (0, -1), 'right': (0, 1),} new_row = self.__blank_box[0] + directions[direction][0] new_col = self.__blank_box[1] + directions[direction][1] new_position = self.__get_box((new_row*self.__length)+new_col) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_position(self):\n self.rect.left, self.rect.top = self.start_pos", "def setBlank(self, pos):\n self.tiles[-1] = pos", "def reset_position(self, x, y):\n\t\tself.grid[x][y] = self.terminal", "def positioning(self):\n pass", "def reset(self):\n self.x_pos = 10\n s...
[ "0.6971761", "0.67601514", "0.6497059", "0.6478759", "0.64567703", "0.6452853", "0.6386973", "0.63737553", "0.63284373", "0.63279796", "0.6298735", "0.62748224", "0.6256663", "0.62447906", "0.6181412", "0.61722535", "0.61675096", "0.61479", "0.61474043", "0.6145806", "0.61259...
0.0
-1
Return the content of a file as a string without newlines.
def read_file(file_path): file_string = '' with open(file_path, 'r', newline='') as file: for line in file: file_string = file_string + line.rstrip('\n') return file_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_content(filename):\n file_contents = ''\n with open(filename) as f:\n file_contents = f.read()\n return file_contents", "def get_file_content(self, file_name: str):\n file_name = Path(__file__).absolute().parents[1].joinpath(file_name)\n try:\n with file_name...
[ "0.7609623", "0.75446004", "0.7528579", "0.7510224", "0.7494273", "0.7474576", "0.74162525", "0.7388739", "0.7182413", "0.71716714", "0.71541095", "0.7126843", "0.7116395", "0.7087866", "0.704822", "0.69866985", "0.6974244", "0.69514704", "0.69032836", "0.68963784", "0.687757...
0.7359542
8
plot the timestamped data for the temperature
def find_records(): print("begin find records") study_list = retrieve_ref('study_list') sensor_list = retrieve_ref('sensor_list') # sensor_unit_list = retrieve_ref('sensor_unit_list') for study in study_list: # print('study = ' + str(study)) source_path = os.path.join(st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_temp():\r\n work_book = xlrd.open_workbook(\"Temp.xls\")\r\n sheet1 = work_book.sheet_by_name(\"Temperature\")\r\n time_x = sheet1.col_values(1)\r\n temp_y = sheet1.col_values(0)\r\n plt.title(\"Time\")\r\n plt.xlabel(\"Time\")\r\n plt.ylabel(\"Temperature\")\r\n plt.plot(time_x, t...
[ "0.77332544", "0.7619313", "0.7040905", "0.6752579", "0.6656995", "0.6611152", "0.6522687", "0.6483575", "0.63331616", "0.6321086", "0.6280439", "0.6280298", "0.6186041", "0.61790603", "0.61554503", "0.61331767", "0.6095322", "0.6091136", "0.6080695", "0.6079412", "0.6053336"...
0.0
-1
The providerassigned unique ID for this managed resource.
def id(self) -> str: return pulumi.get(self, "id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def provider_id(self):\n return self.get('_id')", "def provider_id(self):\n raise NotImplementedError", "def id(self):\n return self.raw_resource.uuid", "def healthcare_provider_id(self):\n return self._healthcare_provider_id", "def unique_identifier(self) -> str:\n retur...
[ "0.8193402", "0.7851373", "0.77124894", "0.7604287", "0.7477648", "0.7476093", "0.7476093", "0.7476093", "0.7425807", "0.7380237", "0.7371964", "0.7371964", "0.7371964", "0.7371964", "0.7371964", "0.7371964", "0.7371964", "0.7371964", "0.735787", "0.735787", "0.73477197", "...
0.0
-1
Use this data source to retrieve basic information about all standalone VPCs available for an account. Uses the included apikey in provider configuration to determine which account to read from. Example Usage Can be used in other resources/data sources when the VPC identifier is unknown, while other attributes are know...
def get_account_vpcs(opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetAccountVpcsResult: __args__ = dict() opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts) __ret__ = pulumi.runtime.invoke('cloudamqp:index/getAccountVpcs:getAccountVpcs', __args__, opts=opts, typ=GetAc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vpc ( vpc_conn, vpc_name ) :\n vpcs = vpc_conn.get_all_vpcs( filters = { \"tag:Name\": [ vpc_name ] } )\n for v in vpcs :\n return v", "def get_vpc_data(self, vpc_id, region):\n if not vpc_id:\n return None\n tmp_vpc_client = ibm.client(region=region)\n try:\n ...
[ "0.6153667", "0.595063", "0.57215375", "0.5484518", "0.5472075", "0.54143125", "0.53245234", "0.5313841", "0.5285683", "0.52541167", "0.52541167", "0.52541167", "0.52541167", "0.52541167", "0.52541167", "0.5244572", "0.5241493", "0.5241493", "0.5241493", "0.5241493", "0.52414...
0.56605554
3
>>> find_good_recipes(9, 10) '5158916779' >>> find_good_recipes(5, 10) '0124515891' >>> find_good_recipes(18, 10) '9251071085' >>> find_good_recipes(2018, 10) '5941429882'
def find_good_recipes(improvement_num, count): recipes = [3, 7] elf1 = 0 elf2 = 1 while len(recipes) <= improvement_num + count: elf1_value = recipes[elf1] elf2_value = recipes[elf2] recipe_sum = elf1_value + elf2_value if recipe_sum > 9: recipe_string = f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_similar_recipes(self):\n pass", "def test_get_random_recipes(self):\n pass", "def measure_the_work(pattern_to_find):\n recipes = [3, 7]\n keys = [int(key) for key in pattern_to_find]\n elf1 = 0\n elf2 = 1\n not_found = True\n\n while not_found:\n elf1_value =...
[ "0.62732804", "0.61937374", "0.6106467", "0.59431934", "0.59081733", "0.5582103", "0.5502457", "0.5500289", "0.5376491", "0.53712493", "0.53555405", "0.53383607", "0.52812743", "0.52651393", "0.5197361", "0.5169107", "0.516706", "0.51159555", "0.5107954", "0.51040334", "0.509...
0.7260232
0
>>> measure_the_work('51589') 9 >>> measure_the_work('01245') 5 >>> measure_the_work('92510') 18 >>> measure_the_work('59414') 2018
def measure_the_work(pattern_to_find): recipes = [3, 7] keys = [int(key) for key in pattern_to_find] elf1 = 0 elf2 = 1 not_found = True while not_found: elf1_value = recipes[elf1] elf2_value = recipes[elf2] recipe_sum = elf1_value + elf2_value if recipe_sum > 9...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def micros() -> int:", "def getMeasure(unique_name):", "def getMeasure(unique_name):", "def compute(data):\n spoken = collections.defaultdict(lambda: collections.deque(maxlen=2))\n\n starting = map(int, data.split(\",\"))\n last_number = None\n i = 0\n\n for i, last_number in enumerate(startin...
[ "0.57274574", "0.5691518", "0.5691518", "0.5494114", "0.5486369", "0.5464641", "0.54049367", "0.53898066", "0.5387856", "0.53810817", "0.5366881", "0.5366617", "0.5352287", "0.53466666", "0.53197426", "0.52943444", "0.5284739", "0.5271887", "0.5271256", "0.5255226", "0.524284...
0.50360847
53
Initialization of the mpc controller. Most of the parameters are fixed as this depends on the arm we have.
def __init__(self, ACTION_DIM = 4): # TODO: There is probably a more elegant way of doing this # load neural network params self.start = 0. if ACTION_DIM == 4: self.ACTION_DIM = ACTION_DIM else: print('you are doing something wrong') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_controller(self, mode, p=None, d=None, torque=None):\n self.set_mode(Mode[mode])\n\n if p is not None:\n self.kp = p\n elif Mode[mode] == Mode.JOINT_IMP_CTRL:\n self.kp = [32000, 32000, 32000, 32000, 32000, 32000, 32000]\n elif Mode[mode] == Mode.CART_IMP_...
[ "0.6525128", "0.6433289", "0.63405937", "0.6292362", "0.6253625", "0.622259", "0.6191588", "0.6181524", "0.6158765", "0.61208683", "0.61065567", "0.6085143", "0.60849625", "0.60765624", "0.60523504", "0.6051844", "0.6037136", "0.60301024", "0.60288566", "0.6012272", "0.600002...
0.0
-1
velocity callback for the arm
def get_velocity(self, message): #print('**************** vel ') self.velocity = message.data self.state[0:self.ndegres] = self.velocity[0:self.ndegres]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rover_velocity_callback(self, msg):\n\t\t# print(\"Rover velocity callback message: {}\".format(msg))\n\t\tpass", "def cmd_vel_callback(self, msg):\n # Just store the desired velocity. The actual control runs on odometry callbacks\n v_l = msg.linear\n v_a = msg.angular\n self.v_li...
[ "0.79091567", "0.76079005", "0.7603583", "0.74135023", "0.72956824", "0.7251918", "0.72338396", "0.7038976", "0.7038976", "0.6989811", "0.69450855", "0.693247", "0.68990725", "0.68878675", "0.6857321", "0.68244934", "0.68088895", "0.67901736", "0.6790032", "0.6769608", "0.676...
0.65173507
31
position callback for the arm
def get_position(self, message): #print('**************** pos ') self.position = message.data self.state[self.ndegres:] = self.position[0:self.ndegres]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _onmove(self, event):", "def xyzArmCallback(msg):\n global robot\n # extract message components and normalize - joystick provides [-100,100] and \n # we will scale to [-0.1,0.1]\n arm_x = msg.data[0]/ARM_DATA_SCALING\n arm_y = msg.data[1]/ARM_DATA_SCALING\n arm_z = msg.data[2]\n\n # cond...
[ "0.7052078", "0.70264876", "0.688068", "0.67120135", "0.6546346", "0.65419245", "0.65237623", "0.6485038", "0.64839834", "0.6448002", "0.6438029", "0.64271504", "0.6418365", "0.63853776", "0.63853776", "0.63853776", "0.63853776", "0.63853776", "0.63853776", "0.63853776", "0.6...
0.0
-1
Reset in case it is needed in the future
def reset(self): self.position = np.zeros(self.ndegres) self.velocity = np.zeros(self.ndegres) self.state = np.zeros(2*self.ndegres) self.flag = 0 self.h_ref = np.array([self.ref for _ in range(self.horizon)]) self.action = np.zeros(self.ACTION_DIM) self.h_action...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reset(self) -> None:", "def _reset(self) -> None:", "def _reset(self):\n pass", "def reset():", "def reset():", "def reset():", "def reset():\r\n pass", "def reset(self) -> None:", "def reset(self) -> None:", "def reset(self) -> None:", "def _reset(self):", "def reset(self)...
[ "0.90287495", "0.90287495", "0.8958957", "0.89266604", "0.89266604", "0.89266604", "0.89041", "0.88952583", "0.88952583", "0.88952583", "0.8890957", "0.8875916", "0.8809804", "0.8809804", "0.88026774", "0.88026774", "0.88026774", "0.88026774", "0.88026774", "0.88026774", "0.8...
0.0
-1
Set next handler of the chain
def set_next(self, handler): self.next = handler return handler
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_handler(self, handler):\n self.next_handler = handler", "def _handler_changed(self, handler):\n if self.next is not None:\n self.next.handler = handler", "def setNext(self, next):\n\t\t\tself.next = next", "def next(self, next):\n\n self._next = next", "def next(self...
[ "0.7661297", "0.6707803", "0.6030326", "0.59693336", "0.59693336", "0.5968152", "0.5833051", "0.5818501", "0.57607543", "0.57461786", "0.5692767", "0.566452", "0.5590942", "0.5582867", "0.557292", "0.55651385", "0.55508965", "0.5547468", "0.55370283", "0.55218494", "0.5515645...
0.80296415
0
This method must be implemented by child
def handle(self, context: Context): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\r\n raise NotImplementedError('override me')", "def __call__(self):\n raise NotImplementedError", "def override(self):\n return None", "def __call__(self):\n raise NotImplementedError()", "def __call__(self):\n\t\treturn", "def __call__( self ):\n pa...
[ "0.7916674", "0.79126203", "0.7673766", "0.7651007", "0.7559392", "0.74367213", "0.73910874", "0.7356369", "0.7356369", "0.7195709", "0.7069751", "0.7009408", "0.68268293", "0.6821625", "0.68035114", "0.67765045", "0.67765045", "0.67765045", "0.6763297", "0.6763297", "0.67564...
0.0
-1
Check whether a given seed is still unexplored.
def check_seed(self, seed): out = self.complement(seed) return self.solver.solve([(i + 1) for i in seed] + [-(i + 1) for i in out])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_seed_valid(seed):\n for ch in seed:\n if not ch in all_chars_set:\n return False\n return True", "def is_seed_valid(seed):\n for ch in seed:\n if not ch in all_chars_set:\n return False\n return True", "def is_seed_valid(seed):\n if seed == \"0\":\n ...
[ "0.6756834", "0.6756834", "0.6691525", "0.6599388", "0.61974424", "0.6161359", "0.5891919", "0.5860734", "0.58116674", "0.5756278", "0.572533", "0.5714277", "0.57110393", "0.5691943", "0.5688913", "0.56780785", "0.5637771", "0.559989", "0.556628", "0.5554336", "0.55459327", ...
0.62459785
4
Look for and return any unexplored point including the given seed. Calling map.find_above(MSS) after map.block_down(MSS) will thus find strict supersets of the MSS, as the MSS itself has been blocked.
def find_above(self, seed): superset_exists = self.solver.solve((i + 1) for i in seed) if superset_exists: return self.get_seed() else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_seed(self, seed):\n out = self.complement(seed)\n return self.solver.solve([(i + 1) for i in seed] + [-(i + 1) for i in out])", "def choose_pos(self):\n s = self\n\n availablepos = []\n for dblock in s.pjs.dblocks:\n is_available = True\n\n for p...
[ "0.59967655", "0.55694646", "0.5480614", "0.5397099", "0.5393073", "0.5385499", "0.5333922", "0.52977884", "0.52768016", "0.5189014", "0.51889", "0.518867", "0.5116351", "0.5088275", "0.5082775", "0.5077057", "0.50351775", "0.50136656", "0.5006063", "0.49916822", "0.49692985"...
0.7450136
0
Get the seed from the current model. (Depends on work in next_seed to be valid.)
def get_seed(self): return self.solver.get_model_trues(start=0, end=self.n) # slower: # model = self.solver.get_model() # return [i for i in range(self.n) if model[i]] # slowest: # seed = [] # for i in range(self.n): # if self.solver.model_value(i+1):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seed(self):\n return self._seed", "def seed(self):\n return self._seed", "def seed(self):\n return self._seed", "def seed(self) -> int:\n return self._seed # type: ignore", "def next_seed(self):\r\n self._cur_seed += 1\r\n return self._cur_seed - 1", "def ru...
[ "0.72466826", "0.72466826", "0.72466826", "0.6889038", "0.6776114", "0.67040414", "0.66961634", "0.63759416", "0.63759416", "0.6318605", "0.62863636", "0.62448657", "0.6167233", "0.6144767", "0.61321104", "0.61201894", "0.6057582", "0.603661", "0.59608483", "0.595875", "0.585...
0.68926764
3
Maximize a given seed within the current set of constraints. The Boolean direction parameter specifies up (True) or down (False)
def maximize_seed(self, seed, direction): while True: comp = self.complement(seed) x = self.solver.new_var() + 1 if direction: # search for a solution w/ all of the current seed plus at # least one from the current complement. s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maximize(self):\n raise NotImplementedError", "def solve(num_wizards, num_constraints, wizards, constraints):\n\n # print(num_wizards)\n # print(num_constraints)\n # print(wizards)\n # print(constraints)\n # node_set = set(wizards)\n \n\n\n def cost(sol,num_constraints,constraints...
[ "0.5255628", "0.51518804", "0.50815153", "0.5040505", "0.50042754", "0.49726215", "0.48932496", "0.4887833", "0.486175", "0.48460725", "0.4834822", "0.4807731", "0.48042133", "0.47982746", "0.47937402", "0.4761865", "0.4752347", "0.4741787", "0.47137696", "0.46898678", "0.466...
0.7806484
0
Return the complement of a given set w.r.t. the set of mapped constraints.
def complement(self, aset): return self.all_n.difference(aset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complement(self) -> 'RangeSet':\n return RangeSet(Range()) - self", "def get_complement(seta):\n\n complement_set = set()\n\n for elem in seta:\n new_elem_tuple = (elem[0], float(D('1.0') - D(str(elem[1]))))\n complement_set.add(new_elem_tuple)\n\n return complement_set", "def...
[ "0.6654452", "0.6576406", "0.63831866", "0.62827057", "0.58516365", "0.5725783", "0.56848663", "0.5537928", "0.5518822", "0.54672354", "0.5461112", "0.5455276", "0.5429003", "0.5420453", "0.5417606", "0.54041857", "0.5387203", "0.5379959", "0.53690493", "0.5363554", "0.535995...
0.76911646
0
Add a given clause to the Map solver.
def add_clause(self, clause): self.solver.add_clause(clause) if self.dump is not None: self.dump.write(" ".join(map(str, clause)) + " 0\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_clause(self, clause):\n self.abstract_clauses.append(clause)", "def tell (self, clause):\n self.clauses.add(clause)", "def add_clause(self, clause, soft=False):\n\n # first, map external literals to internal literals\n # introduce new variables if necessary\n cl = lis...
[ "0.7232271", "0.68253154", "0.64435804", "0.64024657", "0.6194685", "0.589618", "0.55395997", "0.549732", "0.5440252", "0.5343942", "0.5326947", "0.5320732", "0.52594405", "0.5190137", "0.5155156", "0.50672406", "0.49388227", "0.48930344", "0.48519868", "0.48471695", "0.48246...
0.75571716
0
Block down from a given set.
def block_down(self, frompoint): comp = self.complement(frompoint) clause = [(i + 1) for i in comp] self.add_clause(clause)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lift_down(self):\n\n # Can't reuse set_lift_pos due to bug above\n bottom_limit = self.get_lift_limit()\n self.send(self.cmd.SET_LIFT_SET, bottom_limit)", "def down(self, i):\n pass", "def bring_down(self):\n\n self.move(self.__min_step__)", "def difference_update(s...
[ "0.591464", "0.56556416", "0.5639226", "0.55734926", "0.5487892", "0.5392101", "0.5380977", "0.53320444", "0.53086597", "0.51837474", "0.5178055", "0.51443833", "0.5077661", "0.5057524", "0.5054124", "0.50266695", "0.49867174", "0.4948253", "0.49368462", "0.49265483", "0.4926...
0.56132346
3
Block up from a given set.
def block_up(self, frompoint): clause = [-(i + 1) for i in frompoint] self.add_clause(clause)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lift_up(self):\n\n # Can't reuse set_lift_pos due to bug above\n self.send(self.cmd.SET_LIFT_SET, self.cmd.SET_LIFT_SET[\"check\"][\"min\"])", "def bottom_up(self, safe=False):\n if safe:\n assert not self.cycle()\n discard = set()\n queue = deque(self.leaves())\...
[ "0.5980374", "0.5502509", "0.54139936", "0.5321069", "0.519504", "0.51196235", "0.5108691", "0.51076066", "0.5094848", "0.5038757", "0.4986755", "0.49557516", "0.49549985", "0.49490726", "0.49489588", "0.4919223", "0.49130073", "0.49110323", "0.48967567", "0.48951796", "0.489...
0.5053529
9
Settings for a step sequence
def __init__(self, step_time, step=None): self.step_vector = step self.step_time = step_time self.ref_timer = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_step(self):\n pass", "def configure_step(self):\n\n pass", "def _setVals(self, step=0):\n self.step = step", "def step(self, step=None):\n pass", "def step(self, **kwargs):\n pass", "def setValuesInStep(\n self, stepName: str, interactionProperty: s...
[ "0.69822484", "0.69781184", "0.6863541", "0.65149957", "0.65120053", "0.6452456", "0.6452456", "0.64299405", "0.63822", "0.63449067", "0.6200995", "0.6192105", "0.6170368", "0.61481583", "0.6145377", "0.6126502", "0.60600954", "0.60401684", "0.60263544", "0.60128444", "0.5988...
0.0
-1
Generate a step signal sequence
def out(self, t: any, dim=(None, None)) -> any: u = np.zeros(shape=dim) j = 0 for i in range(len(t)): if t[i] % self.step_time == 0 and t[i] != 0 and j + 1 != len(self.step_vector): j += 1 u[i, :] = self.step_vector[j] return u
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_step(self):\n self.step_vals = np.cumsum(self.vals)", "def sawtooth_factory(motor, start, stop, step_size):\n if stop < start:\n start, stop = stop, start\n\n num_pos = int((stop - start) // step_size)\n j = itertools.count()\n last_group = None\n\n def x_motion_per_step(det...
[ "0.65995204", "0.63594466", "0.6249169", "0.61852676", "0.6093541", "0.6077157", "0.6051659", "0.6038631", "0.60360247", "0.59713215", "0.59579283", "0.59446794", "0.5920504", "0.59188426", "0.59027636", "0.589569", "0.58939064", "0.5887116", "0.5883278", "0.5864464", "0.5859...
0.0
-1
Settings for a random step sequence
def __init__(self, step_time, step_interval=None, n_step=None, ss=None): self.ss = ss self.n_step = n_step self.interval = step_interval self.step_time = step_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_step(self):\n pos = [i for i in range(9) if self.grid[i] == 0]\n move = random.choice(pos)\n return self.step(move)", "def random_step(self):\n pos = [i for i in range(9) if self.grid[i] == 0]\n move = random.choice(pos)\n return self.step(move)", "def gener...
[ "0.6600735", "0.6600735", "0.6426488", "0.63580966", "0.63181347", "0.6233752", "0.6195526", "0.61665463", "0.6133349", "0.6077554", "0.60269153", "0.5976023", "0.595699", "0.59379584", "0.59343755", "0.59263146", "0.5924577", "0.59218735", "0.5883561", "0.5867385", "0.582699...
0.0
-1
Generate a random sequence
def out(self, t: any, dim=(None, None)) -> any: lB = self.interval[0] # Lower Boundary uB = self.interval[1] # Upper Boundary # Initialize random step vector each sampling period using comprehensive list. step_vector = [round(uniform(lB, uB), 1) for _ in range(self.n_step)] u =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_random_sequence():\n\n seq = []\n [seq.append(np.random.choice(cs.DNA_BASES)) for _ in range(cs.LENGTH)]\n\n return seq", "def generate_random(self: object) -> None:\n self.random.set(Sequence.generate(length=50))", "def start_random_sequence(self) -> int:\n return random.ra...
[ "0.7697955", "0.7600561", "0.7551118", "0.75248724", "0.7125383", "0.7092031", "0.69861037", "0.69277364", "0.6886229", "0.6868949", "0.6833825", "0.6803206", "0.67367864", "0.67331696", "0.6730156", "0.6715812", "0.6699407", "0.66590357", "0.66281706", "0.66149676", "0.65995...
0.0
-1
Settings for a Gauss step sequence
def __init__(self, step_time, mu=None, sigma=None, n_step=None, ss=None): self.ss = ss self.n_step = n_step self.mu = mu self.sigma = sigma self.step_time = step_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setVals(self, step=0):\n self.step = step", "def gauss_seidel(self):\n for i in range(1,self.size[0]-1):\n for j in range(1,self.size[1]-1):\n for k in range(1,self.size[2]-1):\n self.A[(i,j,k)] = ((1/6)*(self.A[(i+1,j,k)] + self.A[(i-1,j,k)] + self...
[ "0.6018765", "0.57911164", "0.5601025", "0.55696154", "0.5559649", "0.55246335", "0.55087584", "0.55051965", "0.5472542", "0.5460051", "0.5456584", "0.5456021", "0.5453433", "0.54386294", "0.5438098", "0.541166", "0.53872263", "0.5383193", "0.53732735", "0.5372562", "0.536454...
0.5731074
2
Generate a Gauss sequence
def out(self, t: any, dim=(None, None)) -> any: step_vector = np.abs([round(gauss(self.mu, self.sigma), 1) for _ in range(self.n_step)]) u = np.zeros(shape=dim) j = 0 for i in range(len(t)): # Excluding the last point if t[i] % self.step_time == 0 and t[i] != 0 and j+1 != ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gauss(x, x0, gamma):\n sigma = gamma / sqrt(2.0)\n \n A = 1/ (sigma * sqrt(2*pi))\n return (A * exp (-0.5 * (x-x0)**2/sigma**2))", "def gauss(x, gamma):\n return 1 / np.sqrt(2*np.pi) / gamma * np.exp(-(x/gamma)**2 / 2)", "def phi_gauss(self,x,i):\n s = 0.1\n return np.exp(-(x-s...
[ "0.6865911", "0.6794377", "0.6759611", "0.6687887", "0.6683238", "0.6680485", "0.66098064", "0.65058136", "0.6487504", "0.6293768", "0.62710446", "0.62198", "0.62048715", "0.6181345", "0.61764723", "0.6148736", "0.6144734", "0.6125924", "0.60800266", "0.607092", "0.606629", ...
0.0
-1
Settings for a random step sequence
def __init__(self, step_time, saw_time, step_interval=None, n_step=None, ss=None): self.ss = ss self.n_step = n_step self.interval = step_interval self.step_time = step_time self.saw_time = saw_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_step(self):\n pos = [i for i in range(9) if self.grid[i] == 0]\n move = random.choice(pos)\n return self.step(move)", "def random_step(self):\n pos = [i for i in range(9) if self.grid[i] == 0]\n move = random.choice(pos)\n return self.step(move)", "def gener...
[ "0.6600735", "0.6600735", "0.6426488", "0.63580966", "0.63181347", "0.6233752", "0.6195526", "0.61665463", "0.6133349", "0.6077554", "0.60269153", "0.5976023", "0.595699", "0.59379584", "0.59343755", "0.59263146", "0.5924577", "0.59218735", "0.5883561", "0.5867385", "0.582699...
0.0
-1
Generate a random sequence
def out(self, t: any, dim=(None, None)) -> any: lB = self.interval[0] # Lower Boundary uB = self.interval[1] # Upper Boundary # Initialize random step vector each sampling period using comprehensive list. step_vector = [round(uniform(lB, uB), 1) for _ in range(self.n_step)] ste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_random_sequence():\n\n seq = []\n [seq.append(np.random.choice(cs.DNA_BASES)) for _ in range(cs.LENGTH)]\n\n return seq", "def generate_random(self: object) -> None:\n self.random.set(Sequence.generate(length=50))", "def start_random_sequence(self) -> int:\n return random.ra...
[ "0.7697955", "0.7600561", "0.7551118", "0.75248724", "0.7125383", "0.7092031", "0.69861037", "0.69277364", "0.6886229", "0.6868949", "0.6833825", "0.6803206", "0.67367864", "0.67331696", "0.6730156", "0.6715812", "0.6699407", "0.66590357", "0.66281706", "0.66149676", "0.65995...
0.0
-1
Settings for a random step sequence
def __init__(self, step_time, saw_time, delta_t, mu=None, sigma=None, n_step=None, ss=None): self.ss = ss self.n_step = n_step self.mu = mu self.sigma = sigma self.step_time = step_time self.saw_time = saw_time / delta_t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_step(self):\n pos = [i for i in range(9) if self.grid[i] == 0]\n move = random.choice(pos)\n return self.step(move)", "def random_step(self):\n pos = [i for i in range(9) if self.grid[i] == 0]\n move = random.choice(pos)\n return self.step(move)", "def gener...
[ "0.6600735", "0.6600735", "0.6426488", "0.63580966", "0.63181347", "0.6233752", "0.6195526", "0.61665463", "0.6133349", "0.6077554", "0.60269153", "0.5976023", "0.595699", "0.59379584", "0.59343755", "0.59263146", "0.5924577", "0.59218735", "0.5883561", "0.5867385", "0.582699...
0.0
-1
Generate a random sequence
def out(self, t: any, dim=(None, None)) -> any: # Initialize random step vector each sampling period using comprehensive list. step_vector = np.abs([round(gauss(self.mu, self.sigma), 1) for _ in range(self.n_step)]) step_vector[0] = self.ss # keep the steady state value as first u = np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_random_sequence():\n\n seq = []\n [seq.append(np.random.choice(cs.DNA_BASES)) for _ in range(cs.LENGTH)]\n\n return seq", "def generate_random(self: object) -> None:\n self.random.set(Sequence.generate(length=50))", "def start_random_sequence(self) -> int:\n return random.ra...
[ "0.7697955", "0.7600561", "0.7551118", "0.75248724", "0.7125383", "0.7092031", "0.69861037", "0.69277364", "0.6886229", "0.6868949", "0.6833825", "0.6803206", "0.67367864", "0.67331696", "0.6730156", "0.6715812", "0.6699407", "0.66590357", "0.66281706", "0.66149676", "0.65995...
0.0
-1
Retry calling the decorated function using an exponential backoff.
def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None): def deco_retry(f): @wraps(f) def f_retry(*args, **kwargs): mtries, mdelay = tries, delay while mtries > 1: try: return f(*args, **kwargs) except Excepti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retry(tries, delay=3, backoff=2, except_on=(Exception, )):\n\n tries = math.floor(tries)\n\n def decorator(f):\n def f_retry(*args, **kwargs):\n return function_retry(\n tries, delay, backoff, except_on, f, *args, **kwargs)\n return f_retry # true decorator -> dec...
[ "0.78645414", "0.7704353", "0.7669671", "0.75984997", "0.7546372", "0.7504667", "0.7501432", "0.7480629", "0.7442303", "0.7435825", "0.7430782", "0.7420958", "0.7402073", "0.73976827", "0.73973614", "0.73926425", "0.7340207", "0.7321245", "0.73147404", "0.7286289", "0.7165921...
0.6971506
33
Repeat calls to func with specified arguments.
def repeatfunc(func, times=None, *args): if times is None: return starmap(func, repeat(args)) return starmap(func, repeat(args, times))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeat_func(func, *args, **kwargs):\n if kwargs:\n return starmap(lambda args, kwargs: func(*args, **kwargs),\n repeat((args, kwargs))\n )\n else:\n return starmap(func, repeat(args))", "def repeatfunc(cls, func, times=None, *args):\n if ...
[ "0.8054019", "0.79899377", "0.77091944", "0.71153104", "0.6889798", "0.68692523", "0.6769637", "0.6652528", "0.65822107", "0.6471077", "0.63860214", "0.6347482", "0.6298246", "0.6255725", "0.6221301", "0.60740733", "0.60466105", "0.6042478", "0.5945209", "0.5926972", "0.59132...
0.80109245
2
Sends a POST request containing `data` to url. `auth` should be a tuple containing (username, password).
def post(url, data, auth=None, retries=10): if not url.startswith('http://'): url = 'http://' + url request = urllib2.Request(url) if auth: request.add_header('Authorization', 'Basic %s' % b64encode('%s:%s' % auth)) params = urllib.urlencode(data) response = urllib2.urlopen(request...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_post_request(self, url, data):\n auth = (self.AUTH_ID, self.AUTH_TOKEN)\n headers = {'content-type': 'application/json'}\n return requests.post(url, data=data, auth=auth, headers=headers)", "def _post(self, url, data=None):\n if data is not None:\n data = urllib.ur...
[ "0.6842728", "0.6454791", "0.63290054", "0.6314501", "0.62772477", "0.6190568", "0.61195064", "0.6063945", "0.60278213", "0.5984815", "0.5982844", "0.5974754", "0.59532285", "0.5944688", "0.5935827", "0.59314847", "0.5888572", "0.58549273", "0.5854561", "0.58424336", "0.57753...
0.7495922
0
Sends a POST request every second to the monitoring server indicating that the process is still running.
def post_heartbeat(host, name, auth=None): data = {'name': name, 'status': 'ok'} try: response = post('{host}/monitoring/heartbeat'.format(host=host), data, auth) except urllib2.URLError: print("Failed to send heartbeat.", file=sys.stderr) else: if response.strip() != 'ok': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def periodic_timer(self):\n while self.running:\n self.sendStatusQuery()\n time.sleep(REPORT_INTERVAL)", "def keep_alive():\r\n app = Flask(\"\")\r\n @app.route(\"/\")\r\n def home():\r\n return \"Your bot is now alive!\"\r\n\r\n def run():\r\n app.run(host=\"0....
[ "0.6335293", "0.6263304", "0.6176471", "0.61680967", "0.6098956", "0.6098956", "0.6098956", "0.6034498", "0.5934776", "0.5786157", "0.5784672", "0.5767236", "0.57396203", "0.57379746", "0.5700311", "0.5679326", "0.5662139", "0.56477326", "0.5647195", "0.56367123", "0.5632368"...
0.57290554
14
Sets up the root logger to send log messages to the monitoring server.
def set_up_root_logger(host, name, auth=None): root_logger = logging.getLogger() root_logger.addHandler(HTTPHandler(name, host, auth)) root_logger.setLevel(logging.DEBUG)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _begin_logging(self):\n logconf.set_up_root_logger(self.opts.logfile)", "def setup_logger():\n root = logging.getLogger()\n root.setLevel(LOGGING_LEVEL)\n formatter = logging.Formatter('%(asctime)s - %(message)s')\n ch = logging.StreamHandler(sys.stdout)\n ch.setLevel(LOGGING_LEVEL)\n ...
[ "0.75551504", "0.72284514", "0.7111983", "0.709306", "0.70296115", "0.7023245", "0.6968554", "0.6962373", "0.69305164", "0.69274163", "0.69044024", "0.68876123", "0.68429", "0.68380857", "0.6832595", "0.68176967", "0.67931634", "0.6735474", "0.67295617", "0.672686", "0.671451...
0.66258967
33
Returns all users from test_data in a json format that's compatible with jqGrid.
def users_json(self, rows=None, sidx=None, _search=None, searchField=None, searchOper=None, searchString=None, page=None, sord=None, nd=None): # 1 line # 2 lines t1 = time.clock() header = ["value", "flags", "source", "evidence_type", "creation_time", "time", "useby", "owner", "comment"] # 3 lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUsersData(self):\n users_data = self.get_api_results(\n \"/api/user/list?fields=id,username,name,phone,email,url,about,role,joined,lastactive,avatar,company,position,location&api_key={0}&format=json\")\n for user in users_data:\n if user[\"name\"] not in self.users:\n ...
[ "0.7094494", "0.69843435", "0.69711816", "0.6943046", "0.6916682", "0.68569654", "0.6854189", "0.68422705", "0.68375057", "0.6822268", "0.6778825", "0.67571205", "0.67559546", "0.67233765", "0.67228365", "0.6666873", "0.66579914", "0.664822", "0.6617304", "0.6607768", "0.6572...
0.6233058
57
Main driver, parse the feed and output the JSON list of sources
def main(): handler = PlanetSourceHandler() parser = xml.sax.make_parser() parser.setFeature(xml.sax.handler.feature_namespaces, 1) parser.setContentHandler(handler) parser.parse(sys.stdin) print simplejson.JSONEncoder(indent=True).encode(handler.sources)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_sources_all():\n response = requests.get(SOURCE_URL)\n json = response.json()\n for source in json['sources']:\n print(u\"{0}: <{1}> {2}\".format(\"News Code\", source['id'], source['name']))", "def listsources():\n\tmain_url = \" https://newsapi.org/v2/sources?apiKey=5f81b593f35d42a8980...
[ "0.67541414", "0.6721273", "0.66271365", "0.639896", "0.6346963", "0.6091228", "0.60303104", "0.5948088", "0.594113", "0.58209115", "0.5778367", "0.5776951", "0.5746344", "0.5687336", "0.56842184", "0.56672835", "0.5662965", "0.5631256", "0.5610598", "0.5607907", "0.5564241",...
0.6417497
3
Collect characters while within a source record
def characters(self, content): if self.in_source: self.chars += content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def characters(self, data):\n pass", "def cleanup_raw_data(buf):\n raw = str(buf, encoding='iso-8859-1').strip()\n records = raw.splitlines()\n return records", "def extractCharacters(self):\n \n length, high=self.getSize() ##geting size of LineFrame object - high and length\n ...
[ "0.63615435", "0.5877636", "0.564212", "0.5450437", "0.53484285", "0.5325434", "0.5275199", "0.52268296", "0.51683784", "0.51639074", "0.5162519", "0.5138824", "0.5114489", "0.51047087", "0.50685495", "0.50610465", "0.5054689", "0.5049034", "0.50311816", "0.50303805", "0.5023...
0.63518363
1
Restrict a value between a min and max.
def clamp(value, min_value, max_value): return max(min_value, min(value, max_value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _limit(value, min_value, max_value):\n\n if value < min_value:\n return min_value\n if value > max_value:\n return max_value\n return value", "def range_limit(val, minv, maxv):\n\tif (val < minv):\n\t\tval = minv\n\telif (val > maxv):\n\t\tval = maxv\n\treturn val", "def clamp(num, m...
[ "0.8242318", "0.82057476", "0.77939916", "0.7717922", "0.7658431", "0.76336455", "0.75694007", "0.7560079", "0.75334716", "0.7511125", "0.7503323", "0.7490816", "0.7443682", "0.7372782", "0.73508364", "0.7305762", "0.7283909", "0.7263027", "0.72585297", "0.72390145", "0.71898...
0.78470093
2
Create connection line constraint between item's handle and the port.
def constraint(self, item, handle, glue_item): start = MatrixProjection(self.start, glue_item.matrix_i2c) end = MatrixProjection(self.end, glue_item.matrix_i2c) point = MatrixProjection(handle.pos, item.matrix_i2c) cx = EqualsConstraint(point.x, start.x) cy = BetweenConstraint(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_fixed_distance_to_line_constraint():\n return FixedDistanceToLineConstraint()", "def test_connect(self):\n line, head = self._get_line()\n self.tool.connect(line, head, (120, 50))\n cinfo = self.canvas.get_connection(head)\n self.assertTrue(cinfo is not None)\n ...
[ "0.5818294", "0.5687332", "0.5500008", "0.52568966", "0.5220818", "0.5207515", "0.52057487", "0.505119", "0.5035412", "0.5020907", "0.49766943", "0.4966835", "0.49285123", "0.492827", "0.492827", "0.49215764", "0.49072984", "0.49011382", "0.4897819", "0.48977235", "0.4889161"...
0.6178213
0
Set lifeline's lifetime length.
def _set_length(self, length): self.bottom.pos.y = self.top.pos.y + length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_tail_length(self, value):\n self.layer.tail_length = value", "def setLength(self, new_length):\n\n self.length = new_length", "def set_lifetime(self, lifetime):\n self.__lifetime = lifetime", "def length(self, length):\n\n self._length = length", "def set_last_segment...
[ "0.6628996", "0.6548008", "0.6527316", "0.6292543", "0.61618847", "0.60966504", "0.605155", "0.59509474", "0.59412754", "0.59316313", "0.59247273", "0.5702406", "0.56750685", "0.5643853", "0.5622231", "0.55569696", "0.55228", "0.5480967", "0.54594636", "0.5426649", "0.5416591...
0.5764367
11
Draw lifeline. We always draw the lifeline's head. We only draw the lifeline's lifetime when the lifetime is visible.
def draw_lifeline(self, box, context, bounding_box): cr = context.cairo cr.rectangle(0, 0, self.width, self.height) stroke(context) if ( context.hovered or context.focused or context.dropzone or self._lifetime.visible ): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_line():\n\n # Small Size Line\n glLineWidth(0.1)\n glColor3f(0.5, 1.0, 0.9)\n wid = 0\n while wid <= width:\n length = 0\n while length <= height:\n glBegin(GL_LINES)\n glVertex3f(0.0, length, 0.0)\n glVertex3f(wid, length, 0)\n glEn...
[ "0.6687818", "0.6577214", "0.65438086", "0.64897895", "0.63934726", "0.63052434", "0.6266094", "0.6217813", "0.61868715", "0.61665386", "0.6159552", "0.6142421", "0.6132305", "0.60893184", "0.60786086", "0.60565233", "0.60377926", "0.60295296", "0.6012153", "0.59879833", "0.5...
0.6821605
0
Find distance to lifeline item. We calculate the distance to the lifeline's head, and then we calculate the lifetime. We return the minimum.
def point(self, x, y): d1 = super().point(x, y) top = self._lifetime.top bottom = self._lifetime.bottom d2 = distance_line_point(top.pos, bottom.pos, (x, y))[0] return min(d1, d2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calc_min_distance(self, walker):\n\n cell_lengths, cell_angles = box_vectors_to_lengths_angles(walker.state['box_vectors'])\n\n t2 = time.time()\n # make a traj out of it so we can calculate distances through\n # the periodic boundary conditions\n walker_traj = mdj.Trajector...
[ "0.64288473", "0.6343981", "0.629061", "0.6034535", "0.602224", "0.6003383", "0.5981095", "0.593175", "0.5914017", "0.5857995", "0.5832663", "0.5826591", "0.5805714", "0.5800851", "0.57828003", "0.5737947", "0.5734673", "0.56870914", "0.56647193", "0.56186366", "0.55836093", ...
0.5248442
77
Load data from CSV files and return them as numpy arrays The use_labels parameter indicates whether one should read the first column (containing class labels). If false, return all 0s.
def load_data(filename, use_labels=True): # load column 1 to 8 (ignore last one) data = np.loadtxt(open( filename), delimiter=',', usecols=range(1, 9), skiprows=1) if use_labels: labels = np.loadtxt(open( filename), delimiter=',', usecols=[0], skipro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, path=\"../data_set/final-train-dataset.csv\", shuffle=False,\n onlyLabelToUse=None, useOnlyBestIndicators=False, binary=False):\n data = []\n labels = []\n\n with open(path) as csvfile:\n reader = csv.reader(csvfile, delimiter=',')\n skip = True...
[ "0.706477", "0.68677425", "0.6859685", "0.6782772", "0.67529887", "0.6746655", "0.67292655", "0.66810787", "0.66234106", "0.65906125", "0.6552061", "0.65014195", "0.64909846", "0.646308", "0.6431648", "0.6414293", "0.6412473", "0.6407337", "0.63972247", "0.6389596", "0.635698...
0.7765821
0
Given a vector of predictions, save results in CSV format.
def save_results(predictions, filename): with open(filename, 'w') as f: f.write("id,ACTION\n") for i, pred in enumerate(predictions): f.write("%d,%f\n" % (i + 1, pred))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_results(file_path, predictions):\n with open(file_path, \"w\") as csv_file:\n writer = csv.writer(csv_file, delimiter=\",\")\n writer.writerow([\"Id\", \"Bound\"])\n for id, bound in enumerate(predictions):\n writer.writerow([id, bound])", "def write_predictions(y_pre...
[ "0.7925112", "0.75827205", "0.75710183", "0.75710183", "0.7489846", "0.74501824", "0.73730016", "0.7322112", "0.70706344", "0.6982982", "0.69460446", "0.6911982", "0.6833308", "0.6815102", "0.67553407", "0.6745336", "0.6745336", "0.6745336", "0.6745336", "0.6745336", "0.67453...
0.78001994
1
initialization routine for Chiplot, sets class variables
def __init__(self, xdata = list(), ydata = list(), filename = None, projection = ''): dlog('in chiplot initialization') self.xdata = xdata self.ydata = ydata self.xmax = None self.ymax = None self.xmin = None self.ymin = None self.increment = 0 self.filename = filename self.smv = '' self.points = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(cls):", "def initialise(self):", "def _init(self):\n pass", "def init(self) -> None:", "def __init_accessors (self):\n self.colors = ay.utils.Colors\n self.layout = Layout(self.seed)\n self.shapes = Shapes", "def init(self):", "def init(self):", "def init(se...
[ "0.705675", "0.69822073", "0.69724643", "0.69628584", "0.6953671", "0.6945866", "0.6945866", "0.69433916", "0.69258225", "0.69258225", "0.69258225", "0.69258225", "0.69258225", "0.69258225", "0.69258225", "0.69258225", "0.6895559", "0.68572617", "0.6853776", "0.6848816", "0.6...
0.64347374
77
This functions check's whether a text contains contractions or not. In case a contraction is found, the corrected value from the dictionary is returned.
def replace_contractions(self, text, lower=False): # replace words with contraction according to the contraction_dict if lower: contraction_dict = self.contraction_dict_lower else: contraction_dict = self.contraction_dict if text.strip() in contraction_dict.keys...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_contractions(text):\r\n return contractions.fix(text)", "def _replace_contractions(text):\n return contractions.fix(text)", "def replace_contractions(text):\n return contractions.fix(text)", "def replace_contractions(text):\n return contractions.fix(text)", "def expand_contractions(...
[ "0.68868476", "0.6857023", "0.68527967", "0.68527967", "0.66898316", "0.6347374", "0.5993866", "0.5918088", "0.5882449", "0.5777897", "0.57183623", "0.5687876", "0.5641633", "0.5621483", "0.5601896", "0.5554486", "0.5458176", "0.5382929", "0.5322964", "0.5307496", "0.5253449"...
0.67498755
4