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
Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.
def compact(number): number = clean(number, ' ').upper().strip() if number.startswith('AL'): number = number[2:] if number.startswith('(AL)'): number = number[4:] return number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compact(number):\n return clean(number, ' -./,').strip()", "def compact(number):\n return clean(number, ' -').strip()", "def clean(number):\n digits = [c for c in number if c.isdigit()]\n if len(digits) == 11 and digits[0] == \"1\":\n return ''.join(digits[1:])\n elif ...
[ "0.72463715", "0.709187", "0.6563487", "0.6499", "0.64158046", "0.62294763", "0.6026322", "0.6008824", "0.5929912", "0.5874888", "0.5852339", "0.58281475", "0.58224", "0.581129", "0.5803371", "0.57996327", "0.5761249", "0.5750683", "0.56858546", "0.5674949", "0.5646302", "0...
0.6294834
5
Check if the number is a valid VAT number. This checks the length and formatting.
def validate(number): number = compact(number) if len(number) != 10: raise InvalidLength() if not _nipt_re.match(number): raise InvalidFormat() return number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_vat_ve(self, vat, context = None):\n\n if context is None:\n context={}\n if re.search(r'^[VJEGP][0-9]{9}$', vat):\n return True\n if re.search(r'^([VE][0-9]{1,8}|[D][0-9]{9})$', vat):\n return True\n return False", "def validate(number):\n ...
[ "0.6949753", "0.67524844", "0.67496866", "0.6709995", "0.6696541", "0.62437814", "0.6227043", "0.5945343", "0.59006417", "0.58555984", "0.583468", "0.5814034", "0.5813663", "0.5797779", "0.5777486", "0.57695127", "0.5740364", "0.5698625", "0.56931627", "0.5671905", "0.5632549...
0.66189814
5
Check if the number is a valid VAT number.
def is_valid(number): try: return bool(validate(number)) except ValidationError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_vat_ve(self, vat, context = None):\n\n if context is None:\n context={}\n if re.search(r'^[VJEGP][0-9]{9}$', vat):\n return True\n if re.search(r'^([VE][0-9]{1,8}|[D][0-9]{9})$', vat):\n return True\n return False", "def validate(number):\n ...
[ "0.7379781", "0.6621894", "0.6477692", "0.63953686", "0.63700813", "0.62227714", "0.61494124", "0.6116051", "0.6068463", "0.6062278", "0.59390646", "0.59321815", "0.59058887", "0.5884056", "0.5859397", "0.5822421", "0.57948935", "0.57851166", "0.57792175", "0.57780504", "0.57...
0.5905346
18
Given a ZEROindexed position `pos` on the contig, what is the relative ZEROindexed nucleotide position within this annotation's coding sequence?
def nt_pos(self, pos): seq_consumed = 0 if self.coding_blocks is None or len(self.coding_blocks) == 0: return int(self.end - pos - 1 if self.rev_strand else pos - self.start) for block in (reversed(self.coding_blocks) if self.rev_strand else self.coding_blocks): if pos >=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_offset_pos(seq, pos):\n \n nogap_seq = transform_seq(seq)\n assert(pos >= 0 and pos < len(nogap_seq))\n\n maps = dict()\n cnt = 0\n maxi = 0\n for i in range(len(seq)):\n if seq[i] not in msa_characters:\n maps[i-cnt] = i\n maxi = i\n else:\n ...
[ "0.71565324", "0.70421827", "0.6502028", "0.6497681", "0.64480406", "0.6386525", "0.6327573", "0.63075775", "0.6233408", "0.6213303", "0.62095505", "0.6183801", "0.6171228", "0.6140234", "0.6121173", "0.6088656", "0.60556525", "0.6051068", "0.6037078", "0.6037078", "0.6037078...
0.7121677
1
Same as above, but in amino acids.
def aa_pos(self, pos): return self.nt_pos(pos) // 3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aa(seq):\n global codontable\n seq = seq.upper()\n if codontable is None:\n # TODO: figure out the right place for the pre-computed information here\n bases = ['T', 'C', 'A', 'G']\n codons = [a+b+c for a in bases for b in bases for c in bases]\n codons = codons + list(map(l...
[ "0.7174292", "0.69984037", "0.6976098", "0.69597423", "0.6808233", "0.67471987", "0.67112327", "0.668642", "0.6574358", "0.6490589", "0.6490589", "0.64257437", "0.63779163", "0.63127327", "0.631245", "0.6291873", "0.6280526", "0.6236412", "0.6198647", "0.61519104", "0.6133608...
0.0
-1
Given an iterable `alts` of nucleotides to be substituted at contig position `pos`, return a list of the corresponding amino acid changes that would occur. `transl_table` is the NCBI genetic code to use when translating the coding sequence.
def aa_alts(self, alts, pos, transl_table=11): aa_alts = [] nt_pos = self.nt_pos(pos) aa_pos = self.aa_pos(pos) for i, allele in enumerate(alts): mut_seq = str(self.seq_record.seq) if self.rev_strand: allele = str(Seq(allele, generic_dna).reverse_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_AA_subs(s):\r\n test_seq = s.toseq()[70:217].translate() #Translate the mutated region\r\n substitutions = []\r\n \r\n for i in range(len(test_seq)):\r\n if test_seq[i] != align_temp[i]:\r\n substitutions.append(''.join([str(align_temp[i]),\r\n ...
[ "0.5816646", "0.5639811", "0.5312178", "0.52944434", "0.5252611", "0.5239229", "0.52306616", "0.5195211", "0.5128543", "0.5119812", "0.507834", "0.5040113", "0.5009105", "0.49986827", "0.49927104", "0.49352637", "0.49287802", "0.49183488", "0.4885356", "0.48789275", "0.486549...
0.73933816
0
Load all genes in the BED file as SeqRecords, fetching their sequence data from the reference. ref_contigs is a dictionary of ref contig sequences created with BioPython's SeqIO.to_dict().
def get_bed_annots(bed_path, ref_contigs, quiet=False): annots = defaultdict(list) with open(bed_path) as f: for line in f: line = line.strip().split("\t") # Note: BED coordinates are 0-indexed, right-open. chrom, start, end, name, strand = line[0], int(line[1]), int(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_gene_dict(reference_genbank_name=\"data/covid-19-genbank.gb\"):\n recs = [rec for rec in SeqIO.parse(reference_genbank_name, \"genbank\")]\n gene_dict = {}\n for rec in recs:\n feats = [feat for feat in rec.features if feat.type == \"CDS\"]\n for feat in feats:\n content ...
[ "0.67605436", "0.6540504", "0.6476846", "0.6414153", "0.6203886", "0.6145601", "0.61397177", "0.6064767", "0.58231187", "0.5773407", "0.575686", "0.57291776", "0.55980134", "0.5574859", "0.5554105", "0.55270934", "0.5468517", "0.54490787", "0.54445904", "0.5379438", "0.537297...
0.6616143
1
Load all genes in the Sequin table as SeqRecords, fetching their sequence data from the reference. ref_contigs is a dictionary of ref contig sequences created with BioPython's SeqIO.to_dict().
def get_sequin_annots(sequin_path, ref_contigs, quiet=False): annots = defaultdict(list) # We need a dummy class to hold the current state while parsing # (otherwise the below private functions can't modify it; there's no "nonlocal" in python 2.x) class _: in_contig = None in_featur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadReferenceContigs(referencePath, alignmentSet, windows=None):\n # FIXME we should get rid of this entirely, but I think it requires\n # fixing the inconsistency in how contigs are referenced here versus in\n # pbcore.io\n\n # Read contigs from FASTA file (or XML dataset)\n ...
[ "0.63969433", "0.6097736", "0.5661921", "0.56599265", "0.5587677", "0.5557396", "0.5501603", "0.5493998", "0.54772866", "0.5400377", "0.53919554", "0.53289264", "0.53228486", "0.52766865", "0.52260077", "0.5225814", "0.5206542", "0.5159658", "0.5155864", "0.5155864", "0.51552...
0.64372444
0
Render website's home page.
def home(): return render_template('home.html', form=None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_home():\r\n\treturn render_template(\"index.html\")", "def home():\n return render_template('homepage.html')", "def home():\n\n return render_template('home_page.html')", "def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")", "...
[ "0.8724249", "0.85791856", "0.850329", "0.84860355", "0.84612614", "0.84362435", "0.8429879", "0.8419578", "0.8396612", "0.8396612", "0.8374868", "0.8356488", "0.8350785", "0.8340763", "0.8340763", "0.83374727", "0.83374727", "0.83374727", "0.83374727", "0.83374727", "0.83374...
0.766131
100
Render the website's about page.
def about(): return render_template('about.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n\n\treturn render_template(\"about.html\")", "def about():\n return render_template(\n 'about.html',\n title='About',\n ...
[ "0.87910306", "0.8698105", "0.86404276", "0.86124563", "0.8490408", "0.84784615", "0.8467779", "0.84352976", "0.84289914", "0.8424242", "0.8424242", "0.8424242", "0.8424242", "0.8424242", "0.8424242", "0.8424242", "0.8424242", "0.8424242", "0.8424242", "0.8424242", "0.8424242...
0.8325753
34
Render the website's add page.
def view(): # retrieve child and dorm parents records from database children = Child.query.filter_by().all() parents = Parent.query.filter_by().all() return render_template('view.html', children=children, parents=parents)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n return render_template('add.html')", "def addCollection():\n return render_template(\"addCollection.html\")", "def on_main(self, request):\n return self.render_template('main.html', ads=self.get_adds())", "def student_add():\n\n html = render_template(\"student_add.html\"...
[ "0.7603527", "0.7050626", "0.6982201", "0.67651236", "0.66225064", "0.65720564", "0.65035236", "0.64491004", "0.6447836", "0.64401037", "0.643108", "0.63572586", "0.6329601", "0.6311499", "0.63102645", "0.62230897", "0.6216097", "0.6196056", "0.6154912", "0.6138475", "0.61089...
0.0
-1
Send your static text file.
def send_text_file(file_name): file_dot_text = file_name + '.txt' return app.send_static_file(file_dot_text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_text_file(file_name):\n file_dot_text = file_name + '.txt'\n return views.send_static_file(file_dot_text)", "def static_text_files():\n return send_from_directory(\"static/\", request.path[1:])", "def static(self, filename):\n return send_from_directory(self.static_path, filename)", ...
[ "0.82781917", "0.7703301", "0.7361873", "0.6798284", "0.67627686", "0.652277", "0.64430755", "0.6425952", "0.63950807", "0.6339617", "0.63301295", "0.63207895", "0.62736535", "0.62621844", "0.6210342", "0.6182346", "0.61681587", "0.6149127", "0.61488664", "0.6137473", "0.6113...
0.8364907
10
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes.
def add_header(response): response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1' response.headers['Cache-Control'] = 'public, max-age=0' return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response", "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m...
[ "0.82239413", "0.8223081", "0.8223081", "0.8223081", "0.8223081", "0.8196386", "0.8113264", "0.8087198", "0.7973406", "0.7866322", "0.76620805", "0.7237988", "0.71606845", "0.7153763", "0.7153763", "0.7151734", "0.7151734", "0.714256", "0.7137825", "0.71290123", "0.71290123",...
0.8163827
24
Convert/aggregate day level trains data into a single csv file corresponding to each train
def runDataExtraction(): config = CONFIG['steps']['DataExtraction'] ci = config['inputs'] co = config['outputs'] columns = ci['columns'] nrows = ci['nrows'] input_bucket = ci['bucket'] no_of_files = ci['no_of_files'] output_bucket = co['bucket'] csv_name_prefix = co['csv_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_train_csv(self):\n try:\n self.train_article = pd.read_csv(constants.DATA_DIR / 'knn_article_tags.csv')\n except FileNotFoundError:\n train = pd.Series([])\n for csv_file in os.listdir(constants.CLEAN_DIR):\n if csv_file in self.article_feat_csv...
[ "0.6195976", "0.6011024", "0.5942107", "0.5922481", "0.58989626", "0.5866416", "0.5861009", "0.5847968", "0.5842481", "0.58299094", "0.5811881", "0.57927126", "0.5787342", "0.5765693", "0.57488084", "0.5745156", "0.57150435", "0.570471", "0.57046884", "0.5702524", "0.5699526"...
0.0
-1
Create event files, having milliseconds data of running train at every interval of one minute
def runEventCreation(): config = CONFIG['steps']['EventCreation'] ci = config['inputs'] co = config['outputs'] min_window_size = ci['min_window_size'] change_speed_by = ci['change_speed_by'] speed_ratio = ci['train_zero_speed_ratio'] datetime_limit = ci['datetime_limit'] csv_na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\r\n # handle arguments\r\n parser = argparse.ArgumentParser()\r\n\r\n parser.add_argument('-t', '--time', help = 'start time', default = \"2018-12-26 18:11:08.509654\")\r\n parser.add_argument('-bd', '--min_duration', type = int, help = 'minimum duration', default = 25)\r\n parser.add_a...
[ "0.6032952", "0.5831476", "0.57964736", "0.579341", "0.56763124", "0.5651286", "0.55910707", "0.5543689", "0.550672", "0.5505693", "0.54488367", "0.5447712", "0.5447712", "0.54450935", "0.5443203", "0.5438387", "0.5438387", "0.54381704", "0.54252434", "0.53706056", "0.5366133...
0.6412924
0
Create 39 features on minute level across all the dimensions
def runCreateFeatures(): config = CONFIG['steps']['CreateFeatures'] ci = config['inputs'] co = config['outputs'] filename_include = ci['filename_include'] speed_vars = ci['speed_vars'] sample_value = ci['sample_value'] nominal_feature_name = ci['nominal_feature_name'] input_buc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_features(energy_data, label=None):\n energy_data['date'] = energy_data.index\n energy_data['hour'] = energy_data['Datetime'].dt.hour\n energy_data['dayofweek'] = energy_data['Datetime'].dt.dayofweek\n energy_data['month'] = energy_data['Datetime'].dt.month\n energy_data['quarter'] = energ...
[ "0.6637407", "0.65910864", "0.6412256", "0.635219", "0.62710595", "0.60828805", "0.60776263", "0.605273", "0.594589", "0.59310734", "0.59202075", "0.5814362", "0.57052064", "0.5665928", "0.55998516", "0.55987155", "0.5552933", "0.55348146", "0.5525949", "0.5524143", "0.551734...
0.0
-1
Anomaly model training on all the trains
def runAnomalyTraining(features_dir: str, file_path: str = None, vehicle_id: Union[List[Union[str, int]], str, int] = None, deploy: bool = True): CONFIG = DEFAULT_CONFIG CONFIG['training'] = train_config['training'] CONFIG['artifacts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_train_begin(self, logs=None):", "def on_train_begin(self, logs=None):", "def train_models(self):\n\n #keep track on the number of iterations (needed to scale lambda)\n nr_iteration = 0\n \n for epoch in range(self.epochs):\n start = time.time()\n print()\n...
[ "0.68569267", "0.68569267", "0.68300176", "0.6750975", "0.6731922", "0.6705594", "0.6642371", "0.66192347", "0.6608613", "0.65960234", "0.65723825", "0.65516835", "0.65516835", "0.65516835", "0.65516835", "0.65516835", "0.6528889", "0.6524378", "0.6467101", "0.6466627", "0.64...
0.0
-1
Run training for single or multiple train to classify multiple dimensions
def _runOdometryTraining(file_path: str, vehicle_id: Union[List[Union[str, int]], str, int], epochs: int = None, deploy: bool = True): CONFIG = DEFAULT_CONFIG CONFIG['training'] = train_config['training'] CONFIG['artifacts'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_all(X_train_fuse, Y_train, X_dev_fuse, Y_dev, R_train, R_dev, hyperparams):", "def train(self):\n self.ae_train(self.net0, self.ae0_optimizer, self.train0_loader, self.val_loader, name='Net0')\n self.ae_train(self.net1, self.ae1_optimizer, self.train1_loader, self.val_loader, name='Net1')...
[ "0.7344431", "0.7141327", "0.70556134", "0.7055513", "0.70254785", "0.6892675", "0.6868181", "0.68609035", "0.68515223", "0.6851477", "0.6850279", "0.68353176", "0.68349445", "0.6815057", "0.68067247", "0.67225635", "0.6716465", "0.6714835", "0.671098", "0.67071354", "0.67045...
0.0
-1
Run training for single or multiple train to classify multiple dimensions
def runOdometryTraining(file_path: str, vehicle_id: Union[List[Union[str, int]], str, int], epochs: int = None, num_workers: int = None, deploy: bool = True): write_json({}, os.path.join(CURRENT_DIR, 'state.json')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_all(X_train_fuse, Y_train, X_dev_fuse, Y_dev, R_train, R_dev, hyperparams):", "def train(self):\n self.ae_train(self.net0, self.ae0_optimizer, self.train0_loader, self.val_loader, name='Net0')\n self.ae_train(self.net1, self.ae1_optimizer, self.train1_loader, self.val_loader, name='Net1')...
[ "0.7344769", "0.7142878", "0.7056258", "0.70556635", "0.70264465", "0.68942755", "0.68696475", "0.6862299", "0.68531317", "0.6852366", "0.6851828", "0.683718", "0.6835841", "0.68166924", "0.6807723", "0.6724378", "0.6716797", "0.6715018", "0.6713", "0.6708464", "0.67057776", ...
0.0
-1
Compute an n x n Mandelbrot matrix with maxi maximum iterations.
def mandel_numpy(n=400,maxi=512): # get 2-d arrays for x and y, using numpy's convenience function xs, ys = N.meshgrid(N.linspace(x0,x1,n), N.linspace(y0,y1,n)) z = N.zeros((n,n),'complex128') # a matrix of complex zeros c = xs + 1j*ys escape = N.empty((n,n),'int32') escape[:,:] = maxi ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_mandelbrot(self, iterations):\n if self.grid is None:\n raise RuntimeError(\"Grid hasn't been setup - call set_grid first.\")\n # Define the tensorflow variables\n c = tf.constant(self.grid.astype(np.complex64))\n z = tf.Variable(c)\n n = tf.Variable(tf.ze...
[ "0.6948238", "0.6483979", "0.647635", "0.60975", "0.577624", "0.56804156", "0.56472903", "0.56135315", "0.55913776", "0.54975516", "0.5475175", "0.5427021", "0.5401388", "0.5397574", "0.5332212", "0.53113306", "0.5310061", "0.526007", "0.52369773", "0.5234702", "0.5232932", ...
0.6586663
1
Creates a menu. Groups them so you can only select one at a time.
def create_menu(self, menu_name, menu_actions): menu_action_group = QActionGroup(self) menu_action_group.setExclusive(True) menubar = self.menuBar() menu = menubar.addMenu(menu_name) for action in menu_actions: menu_action_group.addAction(action) me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_menus( self ):", "def create_menu():", "def makeMenu(self):\n\t\tself.fileMenu = self.menuBar().addMenu(self.tr(\"&Arquivo\"))\n\t\tself.fileMenu.addAction(self.newAct)\n\t\tself.fileMenu.addAction(self.openAct)\n\t\tself.fileMenu.addAction(self.saveAct)\n\t\tself.fileMenu.addAction(self.exportAct)\...
[ "0.8513713", "0.851117", "0.7472199", "0.7454179", "0.7438703", "0.7294844", "0.7233795", "0.71766436", "0.7172203", "0.70985466", "0.7084178", "0.7068717", "0.70463675", "0.7042298", "0.70285493", "0.701556", "0.6977839", "0.69565207", "0.69117475", "0.6907816", "0.6900176",...
0.75000876
2
Parse the command line arguments
def parse_args(): parser = argparse.ArgumentParser('simpleLSTM_2D') add_arg = parser.add_argument add_arg('-m', '--model', default='default', choices=['default', 'deep'], help='Name the model to use') add_arg('-n', '--num-event', type=int, default=100000, help='Number of events t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_args():\n parser = argparse.ArgumentParser(\n description=\"Reads datapacket pcds, interpolates quaternions and generates scans from dataset in config file\")\n parser.add_argument(\"--visualization\", \"-v\", action=\"store_true\", help=\"if generated clouds ...
[ "0.8463088", "0.7762483", "0.7595797", "0.75803727", "0.75363654", "0.74865943", "0.74373615", "0.74205333", "0.74059993", "0.73710746", "0.7360746", "0.7359222", "0.7348543", "0.7336221", "0.7312769", "0.7304517", "0.7295875", "0.72851336", "0.72816515", "0.72586316", "0.725...
0.0
-1
Flattens each 2D detector layer into a 1D array
def flatten_layers(data): return data.reshape((data.shape[0], data.shape[1], -1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_array(tiffs: list[np.ndarray], idx: int, shape: tuple[int, ...], dtype: type | np.dtype) -> np.ndarray:\n feature_arrays = (np.atleast_3d(img)[..., idx] for img in tiffs)\n return np.asarray(list(feature_arrays), dtype=dtype).reshape(*shape, 1)", "def flattenImage(input_array):\r\n ...
[ "0.65512943", "0.63869417", "0.6224323", "0.62073267", "0.6146212", "0.61214846", "0.60448676", "0.6012312", "0.6004641", "0.59888744", "0.5885316", "0.587274", "0.58667505", "0.58584476", "0.5855942", "0.58501977", "0.58499795", "0.5836353", "0.5810114", "0.57356036", "0.572...
0.6616059
0
Expands the flattened layers to original (width x width)
def flat_to_2d(data, det_width): return data.reshape((data.shape[0], data.shape[1], det_width, det_width))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _flatten(prev_layer):\n\n with tf.name_scope('flatten'):\n shape = int(np.prod(prev_layer.get_shape()[1:]))\n return tf.reshape(prev_layer, [-1, shape])", "def flatten_layers(data):\n return data.reshape((data.shape[0], data.shape[1], -1))", "def expand(self):\n self.vertices[-1,...
[ "0.6771324", "0.6351823", "0.6298724", "0.606491", "0.606491", "0.602826", "0.6010248", "0.6004883", "0.59286594", "0.587519", "0.5845546", "0.5828611", "0.5787488", "0.5766465", "0.5737655", "0.57100713", "0.5702959", "0.56962895", "0.5683116", "0.56766665", "0.56734496", ...
0.0
-1
Allow dumping the packed files to a folder. Returns a zipfile.write() method.
def get_zip_writer(zipfile: ZipFile): dump_folder = CONF['packfile_dump', ''] if not dump_folder: return zipfile.write dump_folder = os.path.abspath(dump_folder) # Delete files in the folder, but don't delete the folder itself. try: dump_files = os.listdir(dump_folder) except F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pack_file(zip_write, filename: str, suppress_error=False):\n if '\\t' in filename:\n # We want to rename the file!\n filename, arcname = filename.split('\\t')\n else:\n arcname = filename\n\n if filename[-1] == '*':\n # Pack a whole folder (blah/blah/*)\n directory =...
[ "0.7331823", "0.7246399", "0.70958483", "0.7027812", "0.6948637", "0.6911189", "0.68038255", "0.6792268", "0.6757164", "0.6726353", "0.6699952", "0.6696708", "0.66505677", "0.6580177", "0.65668654", "0.65554553", "0.65272367", "0.6514948", "0.650231", "0.6482944", "0.64609164...
0.7529858
0
Check multiple locations for a resource file.
def pack_file(zip_write, filename: str, suppress_error=False): if '\t' in filename: # We want to rename the file! filename, arcname = filename.split('\t') else: arcname = filename if filename[-1] == '*': # Pack a whole folder (blah/blah/*) directory = filename[:-1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_files_exist(self, folder, resources):\r\n for item in resources:\r\n file_name = item.get('path')\r\n full_path = os.path.join(folder, file_name)\r\n if not os.path.isfile(full_path):\r\n raise ValueError('%s does not exist' % full_path)", "def ...
[ "0.6588558", "0.64468163", "0.62412316", "0.6210111", "0.6133009", "0.581858", "0.58156425", "0.578492", "0.578492", "0.57809335", "0.5693985", "0.5666035", "0.5660128", "0.5588516", "0.556399", "0.5561242", "0.5555635", "0.555446", "0.555437", "0.55242395", "0.5502128", "0...
0.0
-1
Generate a new game_sounds_manifest.txt file. This includes all the current scripts defined, plus any custom ones. Excludes is a list of scripts to remove from the listing this allows overriding the sounds without VPK overrides.
def gen_sound_manifest(additional, excludes): if not additional: return # Don't pack, there aren't any new sounds.. orig_manifest = os.path.join( '..', SOUND_MAN_FOLDER.get(CONF['game_id', ''], 'portal2'), 'scripts', 'game_sounds_manifest.txt', ) try: w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_sounds(names, path, base_label='Sound_'):\n\tfor filename, output in dump_sounds(names, base_label):\n\t\twith open(os.path.join(path, filename), 'w') as out:\n\t\t\tout.write(output)", "def add_sounds(self) -> None:\n self.sounds.append(arcade.Sound(\"sounds/minecraft-theme.mp3\"))\n se...
[ "0.634194", "0.6167628", "0.6143036", "0.574207", "0.5583267", "0.5577609", "0.55683976", "0.54692596", "0.53306884", "0.52429533", "0.523025", "0.5224628", "0.5199384", "0.5083675", "0.50342655", "0.49966714", "0.49445674", "0.48723647", "0.48541355", "0.48308998", "0.48279"...
0.82363987
0
Generate a new particle system manifest file. This includes all the current ones defined, plus any custom ones.
def gen_part_manifest(additional): if not additional: return # Don't pack, there aren't any new particles.. orig_manifest = os.path.join( '..', GAME_FOLDER.get(CONF['game_id', ''], 'portal2'), 'particles', 'particles_manifest.txt', ) try: with open(orig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_manifest(self):\n import time\n import sys\n with open('bake-manifest-' + time.strftime('%Y-%m-%d-%H:%M:%S') + \n '.txt', 'w') as hout:\n hout.write(' '.join(sys.argv) + '\\n')\n for k, v in self.table.items():\n hout.write(';'.join([k...
[ "0.62623477", "0.61897093", "0.61677384", "0.60479397", "0.58180106", "0.5817169", "0.5700848", "0.56880516", "0.5666152", "0.56610906", "0.55579436", "0.554421", "0.5497124", "0.548652", "0.5405297", "0.5399095", "0.538896", "0.5375458", "0.5372112", "0.5355626", "0.5350976"...
0.7731379
0
Generate a soundscript file for music.
def generate_music_script(data: Property, pack_list): # We also pack the filenames used for the tracks - that way funnel etc # only get packed when needed. Stock sounds are in VPKS or in aperturetag/, # we don't check there. # The voice attrs used in the map - we can skip tracks voice_attr = CONF['V...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_audio():\n text, lang = introduction()\n ses = boto3.Session(profile_name=\"default\")\n pol = ses.client(\"polly\")\n res = pol.synthesize_speech(Text=text, LanguageCode=lang, OutputFormat=\"mp3\", VoiceId=VOICE)\n return res", "def make_a_sound(): # document string\n print('quack...
[ "0.69354683", "0.69074094", "0.6694641", "0.6556796", "0.6548967", "0.6373594", "0.6314922", "0.62685734", "0.62347925", "0.61781305", "0.614819", "0.6109333", "0.61045724", "0.60798234", "0.6031474", "0.60156626", "0.5977319", "0.5961787", "0.5923874", "0.5900185", "0.588932...
0.7483942
0
Write either a single sound, or multiple rndsound. snd_prefix is the prefix for each filename , , @, etc.
def write_sound(file, snds: Property, pack_list, snd_prefix='*'): if snds.has_children(): file.write('"rndwave"\n\t{\n') for snd in snds: file.write( '\t"wave" "{sndchar}{file}"\n'.format( file=snd.value.lstrip(SOUND_CHARS), sndchar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_sounds(names, path, base_label='Sound_'):\n\tfor filename, output in dump_sounds(names, base_label):\n\t\twith open(os.path.join(path, filename), 'w') as out:\n\t\t\tout.write(output)", "def write_wav(fname, samps, sampling_rate=16000, normalize=True):\n\t# for multi-channel, accept ndarray [Nsamples,...
[ "0.6428006", "0.63598406", "0.63356966", "0.62533575", "0.613192", "0.6080928", "0.6072929", "0.60464036", "0.60073996", "0.6006992", "0.6005394", "0.59996164", "0.5970193", "0.5965686", "0.59485584", "0.59431666", "0.59283555", "0.59256744", "0.59218687", "0.5920869", "0.589...
0.8022576
0
Run various commands on spawn. This allows precaching specific sounds on demand.
def gen_auto_script(preload, is_peti): dest = os.path.join('bee2', 'inject', 'auto_run.nut') if not preload and not is_peti: return # Don't add for hammer maps with open(dest, 'w') as file: if not preload: # Leave it empty, don't write an empty function body. file.w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n\tglobal mode\n\tmode=\"./music/\"\n\tglobal message\n\tif message!=2:\n\t\tmessage=1\n\t\tbot.loop.create_task(play())", "def introductions(self):\n speak('omxplayer {0}'.format(os.path.join(self.audio_commands, 'introductions3.ogg')))\n speak('omxplayer {0}'.format(os.path.join(...
[ "0.60214734", "0.5946128", "0.5867636", "0.5865283", "0.5789775", "0.57848495", "0.57831305", "0.5722775", "0.56623846", "0.5640631", "0.5611211", "0.5605549", "0.5588514", "0.55479145", "0.5544387", "0.5513963", "0.5502672", "0.55000776", "0.5486369", "0.5469046", "0.5463223...
0.0
-1
Generate the names of files to inject, if they exist..
def inject_files(): for filename, arcname in INJECT_FILES.items(): filename = os.path.join('bee2', 'inject', filename) if os.path.exists(filename): yield filename, arcname # Additionally add files set in the config. for prop in CONF.find_children('InjectFiles'): filename...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processed_file_names(self):\n if self.force_reprocess == True:\n self.force_reprocess = False\n return 'reprocess.pt'\n \n ''' HR 01/06/22 Workaround to avoid FileNotFoundError '''\n print('self.processed_dir:', self.processed_dir)\n # folder,file = os.p...
[ "0.6215151", "0.6173545", "0.6165678", "0.6132175", "0.60765666", "0.60045236", "0.59673595", "0.5943801", "0.5906433", "0.5898301", "0.5871709", "0.5870495", "0.5845655", "0.58379316", "0.5836181", "0.583417", "0.58176804", "0.58070236", "0.57988113", "0.5745292", "0.5741855...
0.6815235
0
Pack any custom content into the map.
def pack_content(bsp_file: BSP, path: str, is_peti: bool): files = set() # Files to pack. soundscripts = set() # Soundscripts need to be added to the manifest too.. rem_soundscripts = set() # Soundscripts to exclude, so we can override the sounds. particles = set() additional_files = set() # .vv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pack(self):\n pass", "def prepare_map(self):\n for y_coord, row in enumerate(self.contents):\n for x_coord, tile in enumerate(row):\n bit_map = self.get_tile_bitmap(tile)\n self.image[y_coord * TILE_SIZE:(y_coord+1) * TILE_SIZE,\n x_coord...
[ "0.5415575", "0.54143125", "0.5413991", "0.5277969", "0.5264932", "0.51510346", "0.51320654", "0.5126178", "0.51020855", "0.50949067", "0.5079023", "0.50489825", "0.5045023", "0.502607", "0.50219417", "0.4974724", "0.49419495", "0.49405614", "0.4931492", "0.490285", "0.489075...
0.0
-1
Find candidate screenshots to overwrite.
def find_screenshots(): # Inside SCREENSHOT_DIR, there should be 1 folder with a # random name which contains the user's puzzles. Just # attempt to modify a screenshot in each of the directories # in the folder. for folder in os.listdir(SCREENSHOT_DIR): full_path = os.path.join(SCREENSHOT_DI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grab_heroes_pool_images(screenshot):\n\n #screenshot = WindowManager.preprocess_image(screenshot)\n return [screenshot.crop((509, 280, 820, 790)),\n screenshot.crop((820, 280, 1131, 790)),\n screenshot.crop((1131, 280, 1442, 790)),\n screenshot.crop((1...
[ "0.56268287", "0.55836725", "0.5466227", "0.54593205", "0.54427487", "0.5429798", "0.5360617", "0.5355129", "0.533144", "0.52600294", "0.52395785", "0.516024", "0.513637", "0.5128769", "0.51157874", "0.5084877", "0.50637954", "0.5062044", "0.50510454", "0.5047947", "0.5047658...
0.66657865
0
Modify the map's screenshot.
def mod_screenshots(): mod_type = CONF['screenshot_type', 'PETI'].lower() if mod_type == 'cust': LOGGER.info('Using custom screenshot!') scr_loc = CONF['screenshot', ''] elif mod_type == 'auto': LOGGER.info('Using automatic screenshot!') scr_loc = None # The automati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n cv2.imshow(self.window_name, self.map.get_crop())", "def screenshot(self):\n self.context.draw.window.screenshot(self.filename)", "def drawMap(self, lmap):\n w = lmap.width\n h = lmap.height\n # set size of canvas and create bitmap of same size\n se...
[ "0.6247219", "0.6162519", "0.61406696", "0.6003231", "0.598526", "0.59820366", "0.5965917", "0.5913316", "0.58785844", "0.58752924", "0.58663815", "0.57839024", "0.5782715", "0.5770308", "0.5758204", "0.57545245", "0.5746627", "0.5653463", "0.5634315", "0.5629908", "0.5609187...
0.57020146
17
Adds to the inference graph the ops required to generate loss (crossentropy).
def add_op(self, logits, labels): with tf.name_scope(self.name_scope): labels = tf.cast(labels, tf.int64) cross_entropy = tf.nn.softmax_cross_entropy_with_logits(labels=labels, logits=logits) cross_entropy_mean = tf.reduce_mean(cross_entropy, name=self.name_scope) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_loss_op(self, pred):\n ### YOUR CODE HERE\n loss = cross_entropy_loss(self.labels_placeholder,pred)\n ### END YOUR CODE\n return loss", "def add_training_op(self, loss):\n ### YOUR CODE HERE\n train_op=tf.train.GradientDescentOptimizer(learning_rate=Config.lr).mi...
[ "0.70493436", "0.6704626", "0.6665308", "0.6641694", "0.6611778", "0.6503434", "0.6490546", "0.64825714", "0.6338819", "0.6281584", "0.62647676", "0.62612593", "0.62347114", "0.6169226", "0.6162311", "0.614848", "0.61087394", "0.607867", "0.6072244", "0.6064916", "0.6039295",...
0.5915225
42
Returns the UofT Graduate GPA for a given grade.
def grade_to_gpa(grade): letter_grade = "" gpa = 0.0 if type(grade) is str: accepted_values = ["A+", "A", "A-", "B+", "B", "B-", "FZ"] # check that the grade is one of the accepted values if grade in accepted_values: # assign grade to letter_grade letter_grade...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gpa(current_bucket_gpa):\r\n\r\n computed_grade = re.findall(r\"\\d+[.]?\\d*\", current_bucket_gpa)\r\n if len(computed_grade) > 0:\r\n computed_grade = computed_grade[0]\r\n if float(computed_grade) > 10:\r\n computed_grade = float(computed_grade[0]) / 10.0\r\n return...
[ "0.6791343", "0.64294994", "0.610843", "0.59711015", "0.593342", "0.5807375", "0.57462656", "0.5738365", "0.5735842", "0.5732751", "0.5731037", "0.572275", "0.5679913", "0.56496114", "0.5646817", "0.5641173", "0.5636095", "0.5517465", "0.5508186", "0.5495881", "0.5381232", ...
0.6462246
1
Connect a datacenter to this endpoint. An endpoint can only be connected to a single datacenter.
def connect_datacenter(self, dc): self.compute.dc = dc for ep in self.openstack_endpoints.values(): ep.manage = self.manage logging.info \ ("Connected DC(%s) to API endpoint %s(%s:%d)" % (dc.label, self.__class__.__name__, self.ip, self.port))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_dc_network(self, dc_network):\n self.manage.net = dc_network\n self.compute.nets[self.manage.floating_network.id] = self.manage.floating_network\n logging.info(\"Connected DCNetwork to API endpoint %s(%s:%d)\" % (\n self.__class__.__name__, self.ip, self.port))", "def ...
[ "0.68350774", "0.59132737", "0.5732963", "0.57322764", "0.57078254", "0.5706639", "0.5680314", "0.5666111", "0.5593733", "0.5567479", "0.5567184", "0.55639863", "0.55574876", "0.55011344", "0.5458151", "0.54542726", "0.54163355", "0.540785", "0.5394772", "0.53901094", "0.5384...
0.7805443
0
Connect the datacenter network to the endpoint.
def connect_dc_network(self, dc_network): self.manage.net = dc_network self.compute.nets[self.manage.floating_network.id] = self.manage.floating_network logging.info("Connected DCNetwork to API endpoint %s(%s:%d)" % ( self.__class__.__name__, self.ip, self.port))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_datacenter(self, dc):\n self.compute.dc = dc\n for ep in self.openstack_endpoints.values():\n ep.manage = self.manage\n logging.info \\\n (\"Connected DC(%s) to API endpoint %s(%s:%d)\" % (dc.label, self.__class__.__name__, self.ip, self.port))", "def connec...
[ "0.75026584", "0.6867479", "0.64917773", "0.6375236", "0.6371488", "0.62445194", "0.62019926", "0.61340374", "0.6125503", "0.61206913", "0.6095818", "0.60791093", "0.606961", "0.6069137", "0.60621864", "0.6056231", "0.6043292", "0.6030431", "0.6009846", "0.6002214", "0.600133...
0.75623393
0
Start all connected OpenStack endpoints that are connected to this API endpoint.
def start(self, wait_for_port=False): for c in self.openstack_endpoints.values(): c.compute = self.compute c.manage = self.manage c.server_thread = threading.Thread(target=c._start_flask, args=()) c.server_thread.daemon = True c.server_thread.name = c....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def start_all(self):\n try:\n for service in self.services:\n try:\n await service.start()\n await service.healthcheck()\n except Exception as e:\n log.exception(\"Exception while starting %s service\", s...
[ "0.6081534", "0.60684043", "0.59456795", "0.5857773", "0.58120763", "0.5776767", "0.57513654", "0.56928366", "0.5676735", "0.56644404", "0.563852", "0.5633027", "0.5626252", "0.5604621", "0.5600612", "0.559889", "0.5575616", "0.5568452", "0.55555224", "0.5530493", "0.55136335...
0.6768158
0
Stop all connected OpenStack endpoints that are connected to this API endpoint.
def stop(self): for c in self.openstack_endpoints.values(): c.stop() #for c in self.openstack_endpoints.values(): # if c.server_thread: # print("Waiting for WSGIServers to be stopped ...") # c.server_thread.join()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown_all_endpoints(self):\n logger.debug('Removing all endpoints')\n endpoints = []\n with self._endpoint_lock:\n endpoints = list(self._endpoints)\n # be sure we're not holding the lock when shutdown calls\n # _remove_endpoint.\n for e in endpoints:\n ...
[ "0.7218453", "0.71554255", "0.6913532", "0.6757825", "0.6647372", "0.6572691", "0.6498089", "0.64354163", "0.6427609", "0.6418356", "0.63848424", "0.63806695", "0.635318", "0.63259894", "0.6320032", "0.63064104", "0.62986004", "0.6274114", "0.622263", "0.6214541", "0.6208437"...
0.7770021
0
Download and generate Alexia top 1 million url lists
def get_alexia_urls(): #download top 1 million site urls zip_top_urls = requests.get(ALEXIA_URL) response_buf = StringIO.StringIO(zip_top_urls.content) # unzip contents zfile = zipfile.ZipFile(response_buf) buf = StringIO.StringIO(zfile.read('top-1m.csv')) for line in buf.readlines(): (rank,domain) = line.spl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_50(url):\n\n results = requests.get(url,headers = headers).json()\n return results", "def main(url):\n \n words = fetch_words(url)\n print_items(words)", "def _fetch_large():\n # Large training data:\n resource(\n target=data_path(\"eeg\", \"SMNI_CMI_TRAIN.tar.gz\"),\n ur...
[ "0.6438779", "0.6052566", "0.600989", "0.5963049", "0.59457004", "0.59386194", "0.5916427", "0.59098995", "0.5860502", "0.5847924", "0.57740724", "0.5756279", "0.575132", "0.5734446", "0.5716643", "0.56921947", "0.5688688", "0.56574255", "0.56539947", "0.5652997", "0.5643443"...
0.7255304
0
Format new sequence so it matches the type of the original sequence.
def format_seq(seq, new_seq): if type(seq) == str: return "".join(new_seq) elif type(seq) == tuple: return tuple(new_seq) else: return new_seq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asformat(self, format):", "def test_sequence_to_moltype(self):\n s = Sequence(\"TTTTTTTTTTAAAA\", name=\"test1\")\n annot1 = s.add_annotation(Feature, \"exon\", \"fred\", [(0, 10)])\n annot2 = s.add_annotation(Feature, \"exon\", \"trev\", [(10, 14)])\n got = s.to_moltype(\"rna\")\...
[ "0.5782192", "0.57681745", "0.56224316", "0.5617714", "0.5553125", "0.55416995", "0.5499011", "0.5464796", "0.5445919", "0.54286814", "0.5403455", "0.5346777", "0.5314133", "0.5298421", "0.52948034", "0.52948034", "0.52077514", "0.5198649", "0.5171699", "0.51702905", "0.51660...
0.73359036
0
Return sequence with first and last items exchanged.
def exchange_first_last(seq): # Create new list and set it to the last element of the original sequence new_seq = [seq[-1]] # Add the middle elements from the original sequence new_seq.extend(seq[1:-1]) # Add the first element from the original sequence new_seq.append(seq[0]) # Run new se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchange_first_last(seq):\n return seq[-1:]+seq[1:-1]+seq[0:1]", "def exchange_first_last(seq):\n first = seq[0:1]\n middle = seq[1:-1]\n last = seq[-1:]\n seq_copy = last + middle + first\n return seq_copy", "def exchange_first_last(seq):\n seq = seq[-1:] + seq[1:-1] + seq[:1]\n re...
[ "0.69334733", "0.69124305", "0.6668452", "0.6471184", "0.62818694", "0.60973865", "0.606451", "0.59351087", "0.5784156", "0.5649789", "0.55690235", "0.5496396", "0.5496396", "0.5496396", "0.54937124", "0.5408944", "0.5392558", "0.5360007", "0.5353742", "0.53511894", "0.534505...
0.64671797
4
Return sequence with every other item removed.
def remove_every_other(seq): # Make a copy of the original sequence and step by 2 new_seq = seq[::2] return new_seq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_every_other_item(seq):\n seq_copy = seq [0::2]\n return seq_copy", "def remove_every_other(seq):\n length = len(seq)\n new_seq = seq[0:length:2]\n return new_seq", "def remove_four_and_every_other(seq):\n # Make a copy of the original sequence, but omit the first four and last four...
[ "0.814443", "0.7579058", "0.65186775", "0.64783514", "0.6305853", "0.61302996", "0.6013019", "0.59792227", "0.5977844", "0.5863139", "0.58459187", "0.58252424", "0.5821521", "0.565928", "0.565343", "0.5642883", "0.5621129", "0.55982196", "0.55754906", "0.55539966", "0.5539476...
0.7961374
1
Return sequence with the first four and last four items removed, plus every other item in the remaining sequence.
def remove_four_and_every_other(seq): # Make a copy of the original sequence, but omit the first four and last four elements new_seq = seq[4:-4] # Make a copy of new sequence and step by 2 new_seq = new_seq[::2] return new_seq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_4s_every_other_in_between(seq):\n seq_copy = seq [4:-4:2]\n return seq_copy", "def fours_removed(seq):\n length = len(seq) - 4\n new_seq = seq[4:length:2]\n return new_seq", "def remove_every_other_item(seq):\n seq_copy = seq [0::2]\n return seq_copy", "def remove_every_other(...
[ "0.7949985", "0.72331405", "0.6958973", "0.66397864", "0.6586896", "0.65185237", "0.61443645", "0.5820111", "0.5701834", "0.5620001", "0.5594261", "0.55820346", "0.5514332", "0.5510886", "0.54914135", "0.54914135", "0.54914135", "0.545188", "0.5427004", "0.5376906", "0.533284...
0.8401329
0
Return a sequence with the elements reversed (just with slicing).
def reverse_elements(seq): new_seq = [] i = -1 while i >= -len(seq): new_seq.append(seq[i]) i -= 1 return format_seq(seq, new_seq)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elements_reversed(seq):\n new_seq = seq[::-1]\n return new_seq", "def reverse_elements(seq):\n seq_copy = seq [::-1]\n return seq_copy", "def reverse(seq):\n return seq[::-1]", "def reverse(seq):\n return seq[::-1]", "def reverse_this(seq):\n r_seq = seq[::-1]\n return r_seq", ...
[ "0.8603703", "0.846069", "0.78083086", "0.78083086", "0.765158", "0.7496876", "0.74166316", "0.73268104", "0.72175366", "0.7200563", "0.7104105", "0.7055184", "0.6991067", "0.69756705", "0.69632924", "0.6910891", "0.6903917", "0.68976235", "0.6875341", "0.68499684", "0.679250...
0.80524373
2
Return a sequence with the last third, then first third, then middle third in the new order.
def last_first_middle_third(seq): # Using the length of the sequence, figure out roughly what one third should be one_third = len(seq) // 3 new_seq = list(seq[-one_third:]) new_seq.extend(seq[:-one_third]) return format_seq(seq, new_seq)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def third_reorder(seq):\n third = len(seq)//3\n return seq[third:-third]+seq[-third:]+seq[:third]", "def replace_thirds(seq):\n third = int(len(seq)/3)\n middle_third = seq[third:-third]\n last_third = seq[-third:]\n first_third = seq[0:third]\n seq_copy = middle_third + last_third + first_t...
[ "0.84744817", "0.7467445", "0.7467445", "0.7054174", "0.7008001", "0.6548605", "0.6217295", "0.6016097", "0.58688897", "0.5803951", "0.57408905", "0.57041776", "0.565916", "0.565916", "0.56146777", "0.5578442", "0.55430853", "0.55274", "0.549154", "0.5474041", "0.5442637", ...
0.7918163
1
Get the power in W/m^2/bin that the detectors see when doing a skychop. This can be multiplied by the flatdivided spectra later.
def flat_to_wm2(sky_transparency, obs_wavelength, pixel_deltalambda, sky_temp=270*units.K, cabin_temp=288*units.K, beam_size=((6*units.arcsec/2)**2*np.pi/np.log(2)).to(units.steradian) ): frequency = (const.c/obs_wavelen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_power(self) -> float:\n\n #:READ[n][:CHANnel[m]][:SCALar]: POWer[:DC]?\n return float(self._inst.query(\":READ:POW?\"))", "def get_power(self):\r\n return self.p", "def get_power(self):\r\n _debug('simq03b_api.get_power')\r\n \r\n x = self.query('POWer?')\r\n ...
[ "0.75200355", "0.7203939", "0.70948946", "0.70771205", "0.70771205", "0.7062039", "0.7057602", "0.7022602", "0.69680905", "0.6887066", "0.67973745", "0.6766449", "0.6757309", "0.6741151", "0.6738871", "0.66962", "0.6549008", "0.6549008", "0.6549008", "0.6549008", "0.6490433",...
0.0
-1
Get the power in W that the detectors see when looking at a source. This is useful for dark IV tests and stuff
def bb_temp_watts(obs_wavelength, pixel_deltalambda, source_temp=270*units.K ): frequency = (const.c/obs_wavelength).to(units.Hz) bt = units.brightness_temperature(frequency) brightness_temp = source_temp.to("Jy/steradian", equivalencies=bt) spectral...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_power(self) -> float:\n\n #:READ[n][:CHANnel[m]][:SCALar]: POWer[:DC]?\n return float(self._inst.query(\":READ:POW?\"))", "def get_power(self):\r\n x = self.query('SOURce1:POWer:POWer?')\r\n if x == None: return None\r\n return float(x)", "def get_power(self):\r\n ...
[ "0.7167674", "0.70128745", "0.70128745", "0.67554533", "0.6718837", "0.6642687", "0.66169035", "0.65132004", "0.6497659", "0.6480875", "0.6439544", "0.64357466", "0.6435339", "0.64059335", "0.6396239", "0.6372977", "0.6356208", "0.6300656", "0.6293334", "0.62825173", "0.62768...
0.0
-1
Given the zenith PWV (reported by APEX) and altitude of source, returns the real amount of water between the telescope and space. Basically returns pwv/cos(zenith_angle)
def get_real_pwv(pwv, altitude): zenith_angle = 90-altitude airmass = 1/np.cos(zenith_angle*np.pi/180) return pwv*airmass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def VaporPressure(dwpt):\n\n return 611.2*exp(17.67*dwpt/(243.5+dwpt))", "def pressure(altitude):\n t = temperature(altitude) # R\n if altitude <= 36152:\n p = 2116*(t/518.6)**5.256 # psf\n else:\n p = 473.1*exp(1.73-0.000048*altitude) # psf\n return p", "def water_vapour(t):\n ...
[ "0.6731954", "0.6352121", "0.6210927", "0.6185982", "0.6112099", "0.6091341", "0.60461605", "0.60024655", "0.5860308", "0.5859313", "0.5838366", "0.5835615", "0.58182067", "0.57965446", "0.575435", "0.5737927", "0.5728905", "0.5710867", "0.57060504", "0.57017237", "0.5690225"...
0.7299661
0
Delete the entire database and create a new empty one
def createDB(self): mycursor.execute("DROP TABLE tweet") mycursor.execute("DROP TABLE follower") mycursor.commit() createFollowerTable = "CREATE TABLE follower (" \ "screen_name VARCHAR(255)," \ "name varchar(255)," \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createDb():\n db.drop_all()\n db.create_all()", "def recreate_db():\n drop_db()\n create_db()", "def recreate_db():\n drop_db()\n create_db()\n populate_db()", "def create_empty_db():\r\n drop_db()\r\n database.create_tables([Customer])\r\n database.close()", "def clearDat...
[ "0.80165124", "0.8016056", "0.7870058", "0.784249", "0.78211653", "0.7778728", "0.7769241", "0.7768113", "0.7673232", "0.76674294", "0.76318437", "0.76257247", "0.7617027", "0.7543103", "0.75326365", "0.7481981", "0.74488425", "0.74003005", "0.7342668", "0.73206306", "0.72583...
0.0
-1
Insert a Follower into the database
def fillFollowerInDB(self): sqlInsertFollowers = "INSERT INTO follower screen_name VALUES %s" mycursor.execute(sqlInsertFollowers,self.screen_name) mydb.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def followUser(following):\n\n cur, user_id, con = initialise(3, True)\n cur.execute(\"INSERT INTO followers (user, following) VALUES ((SELECT username FROM users WHERE id = ?), ?)\", (user_id, following))\n finish(con)", "def follow(self, followerId: int, followeeId: int) -> None:\n if followeeI...
[ "0.78603786", "0.6736899", "0.6574572", "0.6521408", "0.6442153", "0.6402648", "0.6336011", "0.6331151", "0.6322974", "0.6309035", "0.63037306", "0.6298957", "0.62458616", "0.62110263", "0.6175521", "0.61738724", "0.6148766", "0.6145518", "0.61096025", "0.6083749", "0.6081882...
0.76846194
1
Insert a Tweet into the database
def fillTweetInDB(self): sqlInsertTweets = "INSERT INTO tweet content VALUES %s" mycursor.executemany(sqlInsertTweets,self.content) mydb.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_tweet(value):\n execute(query=_query['ins_tweet'],\n value=value,\n single=False)\n\n id_value = [[element[0]]for element in value]\n\n execute(query=_query['ins_sentiment'],\n value=id_value, # Tweet ID value\n single=False\n )", "def a...
[ "0.75584316", "0.7385258", "0.73308057", "0.7099532", "0.70351124", "0.7005978", "0.68218", "0.6784365", "0.66374534", "0.650229", "0.6442494", "0.6382255", "0.63594294", "0.6320834", "0.6261915", "0.6224364", "0.6216574", "0.6179981", "0.6179981", "0.6179981", "0.61465013", ...
0.7222889
3
load a wave file and retirieve the buffer ending to a given frame
def load_wavfile(total_frame, wav_file): wav_data, sr = sf.load(wav_file, sr=audio_params.SAMPLE_RATE, dtype='float32') assert sf.get_duration(wav_data, sr) > 1 features = waveform_to_feature(wav_data, sr) features = np.resize(features, (int(total_frame), features.shape[1], features.shape[2])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_wav(wav_file):\n rate, data = wavfile.read(wav_file)\n return rate, data", "def rec_one_shot(self, sec, file_name=None):\n self.__open_noncallback_stream()\n frames = []\n for i in range(int(self.RATE / self.CHUNK * sec)):\n data = self.stream.read(self.CHUNK)\n ...
[ "0.6001345", "0.59007126", "0.5815914", "0.581523", "0.5812148", "0.57489264", "0.573132", "0.56689626", "0.5605089", "0.5597917", "0.5514933", "0.55080855", "0.5504028", "0.5490869", "0.5471549", "0.54712766", "0.54708934", "0.54604053", "0.53825766", "0.53482234", "0.534794...
0.58279485
2
Calculate the total loss on a single tower running the CIFAR model.
def tower_loss(scope): # Get images and flows for Flownet. img1, img2, flo = flownet_input.inputs(False, FLAGS.data_dir, FLAGS.batch_size) # Build a Graph that computes predictions from the inference model. logits = flowNet.inference(img1, img2, FLAGS.batch_size) # Add to the Graph the Ops for loss calculation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loss_total(self):\r\n def loss(y_true, y_pred):\r\n l2 = 1/2*K.sum(K.square(y_true-y_pred))\r\n\r\n return l2\r\n return loss", "def compute_loss(self):", "def loss_total(self, mask):\n\n def loss(y_true, y_pred):\n\n # Compute predicted image with non-...
[ "0.6700091", "0.6494981", "0.64351314", "0.6419666", "0.6419666", "0.635259", "0.634228", "0.6337857", "0.6266046", "0.61995566", "0.61981475", "0.61751956", "0.61435133", "0.6103842", "0.6090877", "0.60856736", "0.6064605", "0.60511935", "0.60422295", "0.6033311", "0.6024074...
0.67803407
0
Calculate the average gradient for each shared variable across all towers. Note that this function provides a synchronization point across all towers.
def average_gradients(tower_grads): average_grads = [] for grad_and_vars in zip(*tower_grads): # Note that each grad_and_vars looks like the following: # ((grad0_gpu0, var0_gpu0), ... , (grad0_gpuN, var0_gpuN)) grads = [] for g, _ in grad_and_vars: # Add 0 dimension to the gradients to represent the towe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_gradients(self, tower_grads):\n average_grads = []\n\n # get variable and gradients in differents gpus\n for grad_and_vars in zip(*tower_grads):\n # calculate the average gradient of each gpu\n grads = []\n for g, _ in grad_and_vars:\n ...
[ "0.72354025", "0.7135026", "0.71200424", "0.70678306", "0.68387413", "0.6818384", "0.67901576", "0.6753733", "0.67226434", "0.671972", "0.6718127", "0.671387", "0.6701249", "0.67007685", "0.6699292", "0.6665018", "0.6507723", "0.6472384", "0.64402944", "0.63853544", "0.637842...
0.6777371
7
Train Flownet for a number of steps.
def train(): # Tell TensorFlow that the model will be built into the default Graph. with tf.Graph().as_default(), tf.device('/cpu:0'): global_step = tf.Variable(0, trainable=False) #boundaries = [300000, 400000, 500000] #values = [0.0001, 0.00005, 0.000025, 0.0000125]#S #boundaries = [5000*2, 10000*2, 400...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, training_steps=10):", "def train_step(self):\n pass", "def train(self, num_batches: int):", "def train(self, iterations=1):\n for _ in range(iterations):\n self.trainer.train()\n self.test_network()", "def trainNet():", "def TrainOneStep(self):\n ...
[ "0.8048335", "0.73466617", "0.7271432", "0.72231144", "0.71683115", "0.7127437", "0.70689", "0.6932755", "0.690822", "0.68855876", "0.6838631", "0.68223697", "0.6790748", "0.678181", "0.67572373", "0.67545897", "0.67524034", "0.6729017", "0.67070657", "0.66936785", "0.6693678...
0.0
-1
Creates a random string that contains numbers and letters. The size is a random number between 10 and 30
def randomSub(seed: float): crc = str(string.ascii_letters + string.digits) random.seed(seed) n = random.randint(10,30) return "".join(random.sample(crc, n))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringGen(size, chars=string.ascii_uppercase + string.digits):\n\treturn ''.join(random.choice(chars) for _ in range(size))", "def random_string_alphanumeric(size):\n\t# requirements = random, string\n\treturn ''.join(random.choice(string.ascii_letters + string.digits) for x in range(size))", "def _random_...
[ "0.85948324", "0.8484244", "0.82903683", "0.82625693", "0.8126156", "0.80316836", "0.79779726", "0.7961973", "0.7956126", "0.79325324", "0.7896901", "0.786111", "0.7832646", "0.77807236", "0.7778246", "0.7766766", "0.77627265", "0.7751188", "0.7735884", "0.77282315", "0.77124...
0.0
-1
Gives a random ip
def genIp(): ip = ".".join(str(random.randint(0, 255)) for _ in range(4)) return ip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_ip():\n return new_ip(\"%i.%i.%i.%i\" % (randint(1, 254), # nosec\n randint(1, 254), # nosec\n randint(1, 254), # nosec\n randint(1, 254))) # nosec", "def randomIP():\n\tip = \".\".join(map(str...
[ "0.8933192", "0.8555914", "0.845883", "0.79994214", "0.79353136", "0.77626103", "0.7504948", "0.72778857", "0.7221266", "0.71743506", "0.6929209", "0.6785606", "0.67700946", "0.6733782", "0.6732668", "0.6643141", "0.6636202", "0.660653", "0.6525031", "0.6495551", "0.6442011",...
0.83677465
3
Random Subdomain attack packet builder
def randomSubBuilder(dom: string, src_ip: string, dst_ip: string, src_port: int, t: float, seed: float): id_IP = int(RandShort()) #id for IP layer id_DNS = int(RandShort()) #id for DNS layer sub = randomSub(seed) #Random subdomain q_name = sub + '.' + dom #Complete domain request ans = Ether(src= '1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_domainname():\n domainname = ''.join(generate_string(10, valid_domain_name_chars))\n domain = random.choice(['com', 'co.il', 'info'])\n return domainname+'.'+domain", "def generateBaseDRQ(self, domain):\n if not DB.isValidTarget(domain):\n Error.printErrorAndExit(domain + ...
[ "0.5977173", "0.59681684", "0.57653284", "0.57206655", "0.5675084", "0.5635172", "0.54800284", "0.54657984", "0.5421064", "0.53999", "0.53358173", "0.532985", "0.53167856", "0.5308277", "0.52976847", "0.5266126", "0.5246301", "0.52280766", "0.52115506", "0.5182972", "0.516677...
0.71283317
0
Gives a regular response to packet "p"
def regularResponse(p, dom: string, ip_dom: string, ip_srv: string, dt: float): id_IP = int(RandShort()) #id for IP layer ar_ans = DNSRR(rrname = dom, rdata = ip_dom) #Domain answer ar_ext = DNSRROPT(rclass=4096) #Extension an_ans = DNSRR(rrname = dom, rdata = ip_srv) #Domain server answer ns_ans =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def respond(cmd,t,p):\n\tt.write(cmd)\n\treturn wait(t,p)", "def gotProtocol(self,p): \n p.send_hello()", "def response(self):\n return self._send(bytes([0xef,0xfe,0x02,0x0,0x0,0x0,0x0,0x0]))", "def TestResponse(port):\n\tcommandString = \"F\"\n\tport.write(commandString)\n\tcommandString = \"PM3,C...
[ "0.64267373", "0.6177844", "0.6120277", "0.60341656", "0.5889571", "0.58397853", "0.58374655", "0.57198566", "0.5696393", "0.5658963", "0.56549406", "0.5631298", "0.5599501", "0.55910087", "0.55803406", "0.55703026", "0.55557036", "0.55309546", "0.55113727", "0.5450179", "0.5...
0.5878185
5
Gives an array that contains a request and response
def genPackets(l: list): check(len(l), lambda x: x== 9, "Wrong number of given arguments for genPackets(l), must be 9") req = randomSubBuilder(l[0], l[1], l[2], l[3], l[4], l[5]) res = regularResponse(req, l[0], l[6], l[7], l[8]) return [req, res]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response( self, request, error_code, data ):\n array = []\n if request == b'CAUTH' and data != self.__null_byte:\n # process differently\n data_array = self.ds_document.break_data(data)\n # print('after data is broken: {}'.format(data_array))\n for item...
[ "0.6513677", "0.6247986", "0.6110045", "0.59873134", "0.5932181", "0.581069", "0.579288", "0.5758704", "0.57207423", "0.56488246", "0.56292224", "0.5628262", "0.56053007", "0.560049", "0.5597421", "0.5574301", "0.55689687", "0.55658734", "0.5564341", "0.5560625", "0.5560625",...
0.0
-1
Gives an array of arguments to create packets
def argsBuilder(target_dom:string, server_ip: string, domain_ip:string, server_dom_ip:string, ti:float, d:int, packets:int, n_bot:int): tf = ti + d #End time of the attack new_packets_args = [] if n_bot == 1: #If dos attack ips = randomIP(n_bot, Time.time(), False) else: #If ddos attack ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_args(port, n, t, population, test=None, value=0, failure=None, tx_rate=0, loglevel=logging.INFO, output=None,\n broadcast=True, fan_out=10, profile=None, validate=False, ignore_promoter=False):\n res = [str(port), str(n), str(t), str(population)]\n\n if test is not None:\n res.ap...
[ "0.6156209", "0.5899861", "0.5849596", "0.58321226", "0.5789751", "0.5764216", "0.57535285", "0.57535285", "0.57303244", "0.5728946", "0.5726997", "0.5719696", "0.56849927", "0.5654152", "0.5565254", "0.55376214", "0.55330455", "0.5521985", "0.5521701", "0.5485274", "0.542656...
0.62451375
0
Initialize and show the gui.
def __init__( self ): # Create the main window in which our gui will display. self.main_window = QtGui.QWidget() # Or QMainWindow(). # Create an instance of our gui and set it up in the main window. self.gui = Ui_StopwatchGui() self.gui.setupUi( self.main_window ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_gui():\n pass", "def initGui(self):\n from p4_view import Gui\n self.updateStatus(\"Launching GUI...\")\n self.gui = Gui(self, self.lmap)\n self.gui.setStart(self.cfg[\"START\"])\n self.gui.setGoal(self.cfg[\"GOAL\"])\n self.gui.setPossGoals(self.cfg[\"PO...
[ "0.8153765", "0.7843676", "0.76524836", "0.759329", "0.75602967", "0.74742526", "0.74659204", "0.74613905", "0.7419844", "0.7398565", "0.73541003", "0.73492503", "0.73042625", "0.72723967", "0.72653127", "0.7215829", "0.7197258", "0.7184774", "0.71799994", "0.7175633", "0.716...
0.0
-1
Start the stopwatch if it is not running; stop it if it is running.
def start_stop( self ): if self.stop_event.is_set(): # Stopwatch was stopped, so start it. self.stop_event.clear() self.timer_thread = Thread( target=self.run_stopwatch, args=( time(), ) ) self.timer_thread.start() else: # Stopwatch was ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_stopwatch( self, start_time ):\r\n self.start_time = start_time\r\n while not self.stop_event.is_set():\r\n sleep( 0.01 ) # Accurate to about 1/100th of a second.\r\n self.gui.time_label.setText( \"{:.2f}\".format( time() - self.start_time ) )", "def start(self):\n ...
[ "0.7138144", "0.7008591", "0.67390275", "0.66714877", "0.66500926", "0.6405324", "0.6306759", "0.626701", "0.619082", "0.6111843", "0.60280937", "0.60244936", "0.59438825", "0.59425366", "0.5927466", "0.59179336", "0.5896777", "0.5890608", "0.58734024", "0.5858474", "0.585765...
0.8451777
0
Runs a stopwatch loop showing the time elapsed at regular intervals.
def run_stopwatch( self, start_time ): self.start_time = start_time while not self.stop_event.is_set(): sleep( 0.01 ) # Accurate to about 1/100th of a second. self.gui.time_label.setText( "{:.2f}".format( time() - self.start_time ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timer():\n start = time.time()\n\n yield\n\n end = time.time()\n\n print('Elapsed: {:.2f}s'.format(end - start))", "def run(self):\n last_time = time.time()\n while self.running:\n now_time = time.time()\n interval = now_time - last_time\n last_time ...
[ "0.67962104", "0.6714543", "0.6504831", "0.64995676", "0.6336717", "0.6330287", "0.6256835", "0.62167007", "0.6187998", "0.6170958", "0.6117941", "0.607546", "0.60544944", "0.6039015", "0.60389596", "0.6019436", "0.6006544", "0.5976301", "0.5935193", "0.5933771", "0.59141564"...
0.70103276
0
Main program to launch the counter application.
def main(): # Create a QApplication to handle event processing for our gui. app = QtGui.QApplication( sys.argv ) # Create an instance of our application. stopwatch = StopwatchApp() # Start the application executing, exiting when it returns (i.e., the window is closed). sys.exit( app....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n run_program()", "def main():\n print(\"Call your main application code here\")", "def main():\n print(\"Call your main application code here\")", "def main():\n print(\"Call your main application code here\")", "def main():\n CLI_APP.run()", "def main():\n\n BASIC.run(PROG...
[ "0.70348245", "0.6839625", "0.6839625", "0.6839625", "0.6737468", "0.6687955", "0.6673181", "0.6633849", "0.66200536", "0.66038615", "0.6585533", "0.6585533", "0.6579676", "0.65675765", "0.6521409", "0.65026414", "0.6424223", "0.6418093", "0.6418093", "0.6418093", "0.6418093"...
0.6376073
40
return a dict of string types to one of method
def _get_type_to_one_of(): return { 'primitive': Settings._is_in_prim, 'list': Settings._is_sublist_in_one_of_lists, 'dict': Settings._is_dict_in_one_of_dicts }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dict_of_str2(self):\n pass", "def _asdict(self) -> Dict[Text, Any]:\n return self.as_base_types()", "def types(self) -> Dict[str, str]:\n return {name: self.hyperparams[name][0] for name in self.names()}", "def get_type_data(name):\n name = name.upper()\n try:\n return {...
[ "0.66147655", "0.6354928", "0.62288505", "0.5983211", "0.5936938", "0.59243", "0.59083545", "0.58516544", "0.584994", "0.5806753", "0.58019274", "0.57870644", "0.56842905", "0.56641465", "0.5618441", "0.56037694", "0.5547041", "0.55417395", "0.5489757", "0.5489446", "0.547389...
0.53125936
40
return True if |val| is a JSON primitive, False otherwise
def _is_primitive(val): prims = [int, float, str, bool] for prim in prims: if isinstance(val, prim): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isJson(data):\r\n try:\r\n json.loads(data)\r\n return True\r\n except ValueError:\r\n return False", "def is_json(self):\n # return ( True if ( \n # self.json_field_type and self.json_field_type.upper() != 'VIRTUAL' ) \n # else False )\n return True if ...
[ "0.7477848", "0.7366013", "0.71818185", "0.7161975", "0.71473515", "0.6835757", "0.6831207", "0.6791649", "0.6643828", "0.6610344", "0.659999", "0.6569066", "0.6519001", "0.64818954", "0.6448922", "0.6446701", "0.6365501", "0.63478434", "0.6347386", "0.6273909", "0.62731177",...
0.6882537
5
return True if |val| is an instance of list, False otherwise
def _is_list(val): return isinstance(val, list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_list(value):\n return isinstance(value, list)", "def is_list(value):\n return isinstance(value, list) or None", "def _is_list(item):\n return isinstance(item, list)", "def is_list(obj):\n return type(obj) is list", "def is_list ( self, s ):\r\n\t\treturn isinstance ( s, type( list () ) )...
[ "0.81332123", "0.7750742", "0.767848", "0.7669833", "0.76221544", "0.7603478", "0.75646144", "0.7458807", "0.7454284", "0.7441061", "0.7392627", "0.73333895", "0.7226106", "0.7216461", "0.7105663", "0.70489925", "0.7037061", "0.7035671", "0.7025254", "0.6976099", "0.6933247",...
0.89659095
0
return True if |val| is an instance of dict, False otherwise
def _is_dict(val): return isinstance(val, dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isdict(val: Any) -> bool:\n return isinstance(val, MutableMapping)", "def is_dict(value):\n return isinstance(value, dict)", "def isdictinstance(obj):\n return isinstance(obj, dict) or isinstance(obj, DotDict)", "def is_dict(obj):\n return type(obj) == type({})", "def _is_dict(item):\n r...
[ "0.81098014", "0.7984968", "0.78048414", "0.7678112", "0.7643852", "0.7478924", "0.7321905", "0.7204761", "0.71674895", "0.6830731", "0.68238515", "0.6810352", "0.67759424", "0.66980416", "0.6552115", "0.65379673", "0.6410042", "0.63863635", "0.6381625", "0.6375066", "0.63157...
0.8864714
0
return True if |wildcard| string matches |s| string. A valid wildcard
def _is_wildcard_match(s, wildcard): wildcard = wildcard.strip() glob_pat = re.compile(r'\*(:(?P<type>\w+))?$') m = glob_pat.match(wildcard) if m: if m.group('type'): type_to_meth = globals()['__builtins__'] type_to_meth = {k:v for k,v in type_to_meth.items() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __reWildcard(self, regexp, string):\n regexp = re.sub(\"\\*+\", \"*\", regexp)\n match = True\n if regexp.count(\"*\") == 0:\n if regexp == string:\n return True\n else:\n return False\n blocks = regexp.split(\"*\")\n start ...
[ "0.715021", "0.67261773", "0.6713398", "0.6707344", "0.6571823", "0.6482795", "0.6318864", "0.6266622", "0.623342", "0.6226286", "0.6225357", "0.61540484", "0.61485624", "0.6146087", "0.61196405", "0.59138566", "0.59130514", "0.5899484", "0.58328605", "0.5817263", "0.5811018"...
0.76775545
0
return True if regex pattern string |pat| matches string |s|. A valid
def _is_regex_match(s, pat): pat = pat.rstrip() m = re.search(Settings._REPAT, pat) if m: flags_combined = 0 if m.group('flag'): char_to_flag = { 'A':re.A, 'I':re.I, 'L':re.L, 'M':re.M, 'S':re.S, 'X':re.X} for flag in list(m.group('flag')): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isMatch(self, s: str, p: str) -> bool:\n def is_match(self, text, pattern):\n if not pattern:\n return not text\n\n first_match = bool(text) and pattern[0] in {text[0], '.'}\n\n if len(pattern) >= 2 and pattern[1] == '*':\n return (self.isMa...
[ "0.70966935", "0.70157164", "0.6960576", "0.6815772", "0.6807737", "0.67286736", "0.6649333", "0.6632213", "0.6626841", "0.65312064", "0.652153", "0.65018463", "0.6370927", "0.63706475", "0.63171095", "0.6270721", "0.6270025", "0.6266336", "0.6263732", "0.6250111", "0.6238221...
0.8187956
0
return True if |v| is in |valid_v|. |v| should be a primitive of either int, float, str, or bool. |valid_v| should be a list of any possible legal primitive, wildcard, or regex values. |valid_v| can also be a single primitive value, which will implicitly be converted to a list containing one element. Return False other...
def _is_in_prim(v, valid_v): if not isinstance(valid_v, list): valid_v = [valid_v] for pat in valid_v: if isinstance(pat, str): if '*' in pat: if Settings._is_wildcard_match(v, pat): return True elif re.search(Settings._REPAT, pat)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has(self, v):\n return v in self.values", "def _primitive_validity_check(v, valid_v):\n\n if not Settings._is_in_prim(v, valid_v):\n raise InvalidSettingError()", "def is_valid_value(self, value):\n return value in self.values", "def _is_in_list(l, valid_l):\n\n for elem i...
[ "0.65102774", "0.65090954", "0.62292314", "0.62203526", "0.62055993", "0.6187271", "0.60626274", "0.5736672", "0.5600317", "0.55947465", "0.55650556", "0.55649483", "0.5529547", "0.55027205", "0.54704666", "0.54414445", "0.5438185", "0.54267836", "0.54200864", "0.5377313", "0...
0.7078393
0
return True if every element in list |sublist| is in one of the lists contained in |lists|, False otherwise. Legal elements in |sublist| or the lists in |lists| are any primitive (int, float, str, bool), list, or dict. If an illegal element exists in |sublist|, an InvalidSettingError is raised
def _is_sublist_in_one_of_lists(sublist, lists): type_to_one_of = Settings._get_type_to_one_of() for vl in lists: next_vl = False for e in sublist: if Settings._is_primitive(e): t = 'primitive' elif Settings._is_list(e): vl = [l for l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sublist_in(lst, sublst):\n for i in sublst:\n if i not in lst:\n return False\n return True", "def contains(base, sub_list):\n\n return set(base) & set(sub_list) == set(sub_list)", "def _is_in_list(l, valid_l):\n\n for elem in l:\n if Settings._is_pri...
[ "0.7168912", "0.6911516", "0.689753", "0.6571266", "0.6512159", "0.6431463", "0.64059114", "0.63500553", "0.6314237", "0.6075374", "0.6047245", "0.59738773", "0.5970836", "0.5957095", "0.5953869", "0.59509546", "0.58234435", "0.57280076", "0.5707694", "0.5649077", "0.56412464...
0.8294943
0
return True if dict |d| is in one of the dicts in |dicts|, False otherwise. |dicts| is obviously just a list of dictionaries. Legal elements in the dictionaries are the typical primitives (int, float, bool, str), lists, and dicts.
def _is_dict_in_one_of_dicts(d, dicts): for vd in dicts: if Settings._is_in_dict(d, vd): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_in_dict(d, valid_d):\n\n for k, v in d.items():\n if k not in valid_d:\n return False\n else:\n if Settings._is_primitive(v):\n if not Settings._is_in_prim(v, valid_d[k]):\n return False\n elif Settings._is_list(v):\n ...
[ "0.64084905", "0.60281664", "0.5984001", "0.5980985", "0.59457546", "0.5872692", "0.57876366", "0.57641065", "0.5747921", "0.57217395", "0.5614708", "0.5484641", "0.54599655", "0.53625906", "0.5358206", "0.5351264", "0.533104", "0.53166837", "0.5306886", "0.5287404", "0.52817...
0.8241347
0
return True if all elements in list |l| is in one of the lists contained in |valid_l|, False otherwise. Legal elements in the lists are the typical primitives (int, float, bool, str), lists, and dicts.
def _is_in_list(l, valid_l): for elem in l: if Settings._is_primitive(elem): if not Settings._is_in_prim(elem, valid_l): return False elif Settings._is_list(elem): valid_lists = [l for l in valid_l if isinstance(l, list)] if not Settings._is_su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list_validity_check(l, valid_l):\n\n if not Settings._is_in_list(l, valid_l):\n raise InvalidSettingError()", "def allIn(listA: Union[int, List[int]], listB: Union[int, List[int]]) -> bool:\n if isinstance(listA, int):\n listA = [listA]\n if isinstance(listB, int):\n ...
[ "0.7000915", "0.6149883", "0.61312413", "0.6082698", "0.59904224", "0.5970148", "0.5934717", "0.5885762", "0.5882798", "0.5851436", "0.5785513", "0.5773051", "0.57016706", "0.5689442", "0.56725544", "0.5652237", "0.5626126", "0.56227636", "0.5618623", "0.56080157", "0.5601694...
0.7949676
0
return True if dict |d| has all keys in dict |valid_d|. False otherwise.
def _has_all_keys_from(d, valid_d): for k, v in valid_d.items(): if k not in d: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_in_dict(d, valid_d):\n\n for k, v in d.items():\n if k not in valid_d:\n return False\n else:\n if Settings._is_primitive(v):\n if not Settings._is_in_prim(v, valid_d[k]):\n return False\n elif Settings._is_list(v):\n ...
[ "0.7827297", "0.680757", "0.66193026", "0.6566625", "0.6357033", "0.62774754", "0.6261642", "0.6259637", "0.6217635", "0.62153924", "0.6203975", "0.6185486", "0.6110884", "0.6004363", "0.5946864", "0.58883274", "0.57816666", "0.5731112", "0.5690174", "0.56880385", "0.56877536...
0.87729234
0
return True if all dict |d| keys are in dict |valid_d|, values in |d| are legal values with respect to the valid values defined in |valid_d|, and all |valid_d| keys are in |d|. Values in |d| are determined legal based on Settings._is_in_prim(), Settings._is_list(), or recursively Settings._is_in_dict(). False otherwise...
def _is_in_dict(d, valid_d): for k, v in d.items(): if k not in valid_d: return False else: if Settings._is_primitive(v): if not Settings._is_in_prim(v, valid_d[k]): return False elif Settings._is_list(v): if no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dict_validity_check(d, valid_d):\n\n if not Settings._is_in_dict(d, valid_d):\n raise InvalidSettingError()", "def _has_all_keys_from(d, valid_d):\n\n for k, v in valid_d.items():\n if k not in d:\n return False\n return True", "def _is_dict_in_one_of_dicts(d, dic...
[ "0.80089605", "0.79015756", "0.68252265", "0.66869044", "0.6565693", "0.6309288", "0.6258104", "0.60240465", "0.5989314", "0.5946436", "0.5847185", "0.577302", "0.57671636", "0.56919193", "0.56556475", "0.56521857", "0.56458354", "0.5585945", "0.5582982", "0.55797684", "0.557...
0.87256515
0
raise InvalidSettingError if primitive (int, float, bool, str) value |v| is not in list |valid_v|
def _primitive_validity_check(v, valid_v): if not Settings._is_in_prim(v, valid_v): raise InvalidSettingError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list_validity_check(l, valid_l):\n\n if not Settings._is_in_list(l, valid_l):\n raise InvalidSettingError()", "def _validate_value(self, val):\r\n if type(val) in (int, long, float, str, unicode, ):\r\n return val\r\n if isinstance(val, tuple) or isinstance(val, frozens...
[ "0.6487991", "0.62959874", "0.6258109", "0.6215541", "0.618264", "0.61013937", "0.6074505", "0.60655147", "0.60485035", "0.6044406", "0.6028974", "0.6027474", "0.6026257", "0.60188854", "0.59915787", "0.59838104", "0.59746593", "0.59627825", "0.5954613", "0.5924983", "0.59240...
0.82608044
0
raise InvalidSettingError if list |l| is not in list |valid_l| where \"in\" semantics are aligned with Settings._is_in_list(), so see the doc for that
def _list_validity_check(l, valid_l): if not Settings._is_in_list(l, valid_l): raise InvalidSettingError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_in_list(l, valid_l):\n\n for elem in l:\n if Settings._is_primitive(elem):\n if not Settings._is_in_prim(elem, valid_l):\n return False\n elif Settings._is_list(elem):\n valid_lists = [l for l in valid_l if isinstance(l, list)]\n if not Se...
[ "0.719088", "0.62734437", "0.6226575", "0.587397", "0.58457685", "0.57075506", "0.56937474", "0.5466414", "0.5451235", "0.5410411", "0.54094964", "0.54041463", "0.5403871", "0.53722614", "0.5351291", "0.5345841", "0.5297422", "0.5291149", "0.52697456", "0.5263931", "0.5228808...
0.87735647
0
raise InvalidSettingError if dict |d| is not in dict |valid_d| where \"in\" semantics are aligned with Settings._is_in_dict(), so see the doc for that
def _dict_validity_check(d, valid_d): if not Settings._is_in_dict(d, valid_d): raise InvalidSettingError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_in_dict(d, valid_d):\n\n for k, v in d.items():\n if k not in valid_d:\n return False\n else:\n if Settings._is_primitive(v):\n if not Settings._is_in_prim(v, valid_d[k]):\n return False\n elif Settings._is_list(v):\n ...
[ "0.7488277", "0.6641955", "0.6196617", "0.59063935", "0.5877175", "0.57327497", "0.57189006", "0.5654708", "0.5553554", "0.53341234", "0.5283865", "0.5279843", "0.5265277", "0.5223105", "0.52217144", "0.5210006", "0.5198275", "0.51907164", "0.5188572", "0.51837295", "0.517812...
0.86825794
0
error check |settings| and |valid|. Both are dict types. |settings| represents the user settings where each pair is a setting name associated to a chosen setting value. |valid| represents all valid user settings where each pair is a setting name associated to legal valid setting values.
def _validity_check(settings, valid): Settings._dict_validity_check(settings, valid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_settings(self, settings):\n pass", "def validate_settings(_cfg, _ctx):\n pass", "def _dict_validity_check(d, valid_d):\n\n if not Settings._is_in_dict(d, valid_d):\n raise InvalidSettingError()", "def check_settings_syntax(settings_dict: dict, settings_metadata_dict: dict):\...
[ "0.76656973", "0.68101305", "0.6712639", "0.6699112", "0.6521201", "0.6304268", "0.62737554", "0.62068", "0.611062", "0.5977708", "0.595072", "0.5796342", "0.5790598", "0.57904774", "0.5786704", "0.5760153", "0.5697195", "0.5671662", "0.56589305", "0.5599054", "0.5580645", ...
0.814493
0
inject any defaults specified in |defaults| into settings. Default values will only be applied if a key exists in |defaults| and doesn't exist in |settings|, or if a key in |settings| has an associating value of None. If |defaults| is None, |settings| is returned as is.
def _inject_defaults(settings, defaults): new_settings = {} if defaults is None: return settings elif settings is None or len(settings) == 0: new_settings = defaults else: for k, v in settings.items(): if isinstance(v, dict) or v is None: ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_defaults(self, settings_dict=None, **settings):\n settings_dict = settings_dict or {}\n settings_dict.update(settings)\n return self.set_values(settings_dict, override=False)", "def loadDefaults(self,defaults):\n for key in defaults.keys():\n if key not in self.data...
[ "0.65865844", "0.64090306", "0.6406142", "0.6250104", "0.62078786", "0.61736166", "0.61570066", "0.61391175", "0.6111803", "0.6052231", "0.60497946", "0.60248345", "0.6000381", "0.5997895", "0.5956305", "0.5923101", "0.5910845", "0.5898228", "0.5872198", "0.58597386", "0.5825...
0.85035056
0
create a Settings object. |settings| can be a dict or path to json file. If a dict, then values in |settings| must be a primitive (int, float, bool, str), list, or dict. |valid| must be a dict. |settings| represents the user settings where each pair is a setting name associated to a chosen setting value. |valid| repres...
def __init__(self, settings, valid, defaults=None): try: with open(settings, 'r') as settings_file: self._settings = json.load(settings_file) except TypeError: self._settings = dict(settings) self._settings = Settings._inject_defaults(self._settings, defaults) Sett...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validity_check(settings, valid):\n\n Settings._dict_validity_check(settings, valid)", "def _read_settings_file(cls, settings_path=''):\n if not settings_path:\n return {}\n\n if os.path.isdir(settings_path):\n settings_path = os.path.join(settings_path, '.' + cls.__n...
[ "0.6769524", "0.6685451", "0.65674096", "0.652653", "0.6333047", "0.62696064", "0.6178105", "0.6040261", "0.59549224", "0.591162", "0.58818275", "0.58598006", "0.5854006", "0.5809394", "0.5806272", "0.57916164", "0.5766842", "0.57582766", "0.5749986", "0.5732465", "0.5693892"...
0.7713784
0
return the value associated to setting name |name|. Raise KeyError if not in Settings
def __getitem__(self, name): return self._settings[name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getValue(self, valueName):\n\t\treturn self.settings[valueName][0]", "def get_config_value(self, name):\r\n if name in self.config_values:\r\n return self.config_values[name]", "def setting(setting_name):\n\n return getattr(settings, setting_name)", "def get_setting_value(self, title...
[ "0.76803833", "0.75613636", "0.7081991", "0.69454545", "0.68509626", "0.68007004", "0.67388666", "0.67261124", "0.66861844", "0.6639788", "0.65979385", "0.6584807", "0.64453006", "0.6443931", "0.64366484", "0.6366752", "0.63637066", "0.6356994", "0.63466847", "0.63138545", "0...
0.74323106
2
return an iterator over the names of the Settings
def __iter__(self): return iter(self._settings)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n return self._visible_setting_names_gen", "def listAllSettingNames(self):\n\t\treturn sorted(self.settings.iterkeys())", "def iter_default_settings():\n\tfor name in dir(default_settings):\n\t\tif name.isupper():\n\t\t\tyield name, getattr(default_settings, name)", "def get_settin...
[ "0.76409954", "0.75338864", "0.69145787", "0.6878282", "0.6665888", "0.66176474", "0.66125125", "0.65705866", "0.64462084", "0.64241296", "0.64241296", "0.6374535", "0.628579", "0.62095124", "0.62074983", "0.6182075", "0.6087782", "0.6065265", "0.6062819", "0.60515", "0.60482...
0.736747
2
return the number of settings
def __len__(self): return len(self._settings)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_sections(self):\n #print (len(self.config.sections()))\n return len(self.config.sections())", "def count(cls, client) :\n\t\ttry :\n\t\t\tobj = appfwlearningsettings()\n\t\t\toption_ = options()\n\t\t\toption_.count = True\n\t\t\tresponse = obj.get_resources(client, option_)\n\t\t\tif...
[ "0.73933834", "0.73484594", "0.7338341", "0.7232637", "0.69817024", "0.6793652", "0.6730186", "0.66864556", "0.6681215", "0.66763896", "0.66130507", "0.6599068", "0.65807015", "0.65699047", "0.65699047", "0.65607816", "0.6549674", "0.65447354", "0.651406", "0.6512395", "0.650...
0.76182985
0
Assumes objects do NOT have an id.
def push_group(self, parent_data, parent_doc_type, es_obj_list, doc_type, refresh=True): parent_doc_id = self.push(parent_data, doc_type=parent_doc_type, refresh=refresh) if parent_doc_id is None: raise RuntimeError("Failed to create parent doc") es_repr_list = [] for es_obj ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_id_instaningObjects(self):\n B._Base__nb_objects = 0\n\n b1 = B()\n self.assertEqual(b1.id, 1)\n\n b2 = B()\n self.assertEqual(b2.id, 2)\n\n b3 = B()\n self.assertEqual(b3.id, 3)\n\n b4 = B()\n\n self.assertEqual(b4.id, 4)\n\n b5 = B()\...
[ "0.6672393", "0.6642141", "0.66174996", "0.6517562", "0.65081036", "0.6467506", "0.64525497", "0.6440224", "0.62221366", "0.62168723", "0.61383104", "0.61012405", "0.6011796", "0.6011796", "0.6011796", "0.6011796", "0.5982923", "0.59803253", "0.59449494", "0.59204704", "0.592...
0.0
-1
Assumes objects do NOT have an id.
def push_bulk(self, obj_list, doc_type=None, refresh=True): assert isinstance(obj_list, collections.Sequence) assert len(obj_list) > 0 es_obj_list = [] for obj in obj_list: if obj is None: logger.warning("None object in input list") continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_id_instaningObjects(self):\n B._Base__nb_objects = 0\n\n b1 = B()\n self.assertEqual(b1.id, 1)\n\n b2 = B()\n self.assertEqual(b2.id, 2)\n\n b3 = B()\n self.assertEqual(b3.id, 3)\n\n b4 = B()\n\n self.assertEqual(b4.id, 4)\n\n b5 = B()\...
[ "0.66731095", "0.6642907", "0.6617255", "0.6517615", "0.6508019", "0.64679754", "0.6452759", "0.6439303", "0.622171", "0.62172323", "0.61379606", "0.61001897", "0.60110474", "0.60110474", "0.60110474", "0.60110474", "0.59821916", "0.5979548", "0.5946153", "0.5921062", "0.5918...
0.0
-1
Push a single ElasticSearchObject to index. Assumes objects do NOT have an id.
def push(self, es_obj, doc_type=None, refresh=True): doc_type, es_repr = self._validate_doc_and_get_type_and_repr(es_obj, doc_type) response = self.conn.elastic_search_client.index(index=self.index_name, doc_type=doc_type, body=es_repr, refresh=u'true' if refre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_object(self, content, object_id = None):\n if object_id is None:\n return AlgoliaUtils_request(self.client.headers, self.write_hosts, \"POST\", \"/1/indexes/%s\" % self.url_index_name, self.client.timeout, content)\n else:\n return AlgoliaUtils_request(self.client.header...
[ "0.70250475", "0.66799045", "0.6536268", "0.6320226", "0.62905204", "0.6278442", "0.6247867", "0.62353545", "0.6212382", "0.6159699", "0.60891485", "0.60850763", "0.6084126", "0.6069489", "0.6048055", "0.601098", "0.601018", "0.59969294", "0.59266204", "0.5904166", "0.5878974...
0.72160566
0
Recreate the index. Warning, deletes and recreates it, all existing data will be wiped
def create_index(self): if self.index_exists(): logger.info('Index {} already exists'.format(self.index_name)) logger.info('Deleting existing index') self.indices_client.delete(index=self.index_name) self.create_index_if_not_exist()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reindex(self):", "def reindex(self):", "def reindex(self):\n raise NotImplementedError()", "def _rebuild_index(self):\n from django.core.management import call_command\n call_command('rebuild_index', interactive=False, verbosity=0)", "def rebuild_index(self):\n with warnings...
[ "0.8078765", "0.8078765", "0.7487655", "0.7143024", "0.71268106", "0.7114232", "0.7103166", "0.7058547", "0.69511276", "0.6946107", "0.6870689", "0.6832705", "0.67996275", "0.67919475", "0.6763535", "0.6673527", "0.6637829", "0.6635391", "0.65675575", "0.6486065", "0.6484687"...
0.67264247
15
Uses http for now.
def __init__(self, hosts, port, user_name, password, connection_class=RequestsHttpConnection): self.hosts = hosts self.connection_class = connection_class self.elastic_search_client = Elasticsearch(self.hosts, connection_class=self.connection_class) self.elastic_search_client = Elasticse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _http(self):\n raise NotImplementedError(\"HTTP transport is not supported.\")", "def _setupHttp(self):\r\n if self._http == None:\r\n http = httplib2.Http()\r\n self._http = self._credentials.authorize(http)", "def http(self, url):\n \n res = 'fail', url\n...
[ "0.7734392", "0.6912618", "0.6637347", "0.66326994", "0.66053224", "0.6535946", "0.6402265", "0.62634736", "0.62518936", "0.62290335", "0.6199113", "0.6121421", "0.61070573", "0.60671085", "0.60671085", "0.6051972", "0.6007464", "0.6006203", "0.59838206", "0.5975039", "0.5975...
0.0
-1
This is the class' constructor.
def __init__(self, data_df, target_df, data_cache_path_str, train_nb_days, test_nb_days, process_lst: list, process_names_lst = ["process"], nb_folds = 3, verbose = False): self.data_cache_path_str = data_cache_path_str self.train_nb_days = train_nb_days self.test_nb_days = test_nb_days ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self) -> None:\n # TODO: Provide the complete constructor for this object", "def __init__ (self):\n pass", "def __init__ (self) :", "def __init__(self):\n\t\tpass", "def __init__(self):\n\t\tpass", "def __init__(self):\n\t\tpass", "def __init__(self):\n\t\tpass", "def __ini...
[ "0.88221973", "0.87222993", "0.86248744", "0.84114116", "0.84114116", "0.84114116", "0.84114116", "0.84114116", "0.84114116", "0.84114116", "0.84114116", "0.84114116", "0.84114116", "0.84114116", "0.84114116", "0.84114116", "0.84114116", "0.84054804", "0.84054804", "0.84054804"...
0.0
-1
This method gives the score for the predictions if the data ended `days_back` days ago.
def _generate_validation_fold(self): for offset in range(self.nb_folds): # Load all the data from cache (do this to save memory) with open(self.data_cache_path_str + "data_cache.pkl", "rb") as f: data_df, target_df = pickle.load(f) # Generate train and test ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, requested_day):\n\n df = load_data()\n\n # preprocess\n df = preprocess(df)\n df = filter_by_country(df, self.country_code)\n\n # separate cases from data\n dates, Y = separate(df)\n\n # normalize Y\n Y = normalize(Y)\n\n # apply look...
[ "0.63345003", "0.61882794", "0.5962358", "0.5910797", "0.58045536", "0.57999533", "0.57871073", "0.57857996", "0.5735156", "0.57306755", "0.56504303", "0.56397146", "0.5630498", "0.5582569", "0.5561387", "0.5551824", "0.5533667", "0.5509346", "0.5481691", "0.5472088", "0.5461...
0.0
-1
This method actually runs the backtest.
def run(self, orig_target_df): # For each fold for fold_idx, (fold_training_set_df, fold_testing_set_df, fold_target_df, fold_truth_df) in enumerate(self._generate_validation_fold()): train_test_date_split = fold_training_set_df["date"].max() eval_start_date = train_test_date_sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_backtest(self):\n i = 0\n while True:\n i += 1\n if self.data_handler.continue_backtest == True:\n self.data_handler.update_bars()\n #print(self.data_handler.get_latest_bar_datetime(self.symbol_list[0]))\n else:\n ...
[ "0.74178606", "0.7220213", "0.71934736", "0.7173628", "0.7160305", "0.6815801", "0.67030585", "0.6603986", "0.65820676", "0.656537", "0.6565049", "0.6482149", "0.6467572", "0.6438601", "0.63940626", "0.6385239", "0.63840383", "0.63630825", "0.6352746", "0.62950546", "0.628490...
0.0
-1
Build the commandline argument parser.
def build_parser(): def commaSplitter(str): """ Argparse a comm-seperated list """ # leave this here as a reminder of what I should do to make the argument parsing more robust # if sqrt != int(sqrt): # msg = "%r is not a perfect square" % string # r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_arg_parser():\n\n main = ArgumentParser(description='AMFinder command-line arguments.',\n allow_abbrev=False,\n formatter_class=RawTextHelpFormatter)\n\n subparsers = main.add_subparsers(dest='run_mode', required=True,\n ...
[ "0.7819183", "0.75244045", "0.74812686", "0.74425006", "0.7431058", "0.7427424", "0.7427424", "0.7427424", "0.7419653", "0.73960817", "0.738059", "0.73209536", "0.7176779", "0.71652627", "0.71511096", "0.70648", "0.7057541", "0.701601", "0.6986371", "0.6980058", "0.69682664",...
0.6846123
32
Argparse a commseperated list
def commaSplitter(str): # leave this here as a reminder of what I should do to make the argument parsing more robust # if sqrt != int(sqrt): # msg = "%r is not a perfect square" % string # raise argparse.ArgumentTypeError(msg) # return value return str.split(',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_arg_list(self):\n\t\targ_list = {}\n\t\tfor arg in getopt.getopt(sys.argv[1:], 'c:r:j:d')[0]:\n\t\t\targ_list[arg[0][1:]] = arg[1]\n\t\n\t\treturn arg_list", "def test_arg_parser_list(self):\n args = self.parser.parse_args(['list'])\n self.assertEqual(args.command, 'list')", "def cmd_l...
[ "0.7047815", "0.6920758", "0.68657094", "0.686171", "0.67957515", "0.6768823", "0.67588264", "0.672577", "0.6719424", "0.671625", "0.6708041", "0.66733116", "0.6648506", "0.6627966", "0.65104073", "0.6491474", "0.64637864", "0.64596814", "0.64089745", "0.637171", "0.63712955"...
0.0
-1
Argparse type for an existing file
def existing_file(fname): if not os.path.isfile(fname): raise ValueError("Invalid file: " + str(fname)) return fname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def external_argtype(t):\n\n if t is None:\n return None\n\n if typing:\n if issubclass(t, typing.IO):\n # Assume file arguments are for reading; this can be\n # overridden using argparse's type= parameter\n return argparse.FileType('r')\n\n return t", "def...
[ "0.6765893", "0.6542875", "0.6438014", "0.62269133", "0.6149086", "0.61363196", "0.6128788", "0.6009495", "0.6001671", "0.58530414", "0.5850566", "0.5841429", "0.5825708", "0.58222395", "0.5785103", "0.57769704", "0.5771957", "0.57708013", "0.5750617", "0.574963", "0.5742368"...
0.0
-1