query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Get a random system quality attribute. An alias for system_quality_attribute().
def ility(self) -> str: return self.system_quality_attribute()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def system_quality_attribute(self) -> str:\n return self.random.choice(SYSTEM_QUALITY_ATTRIBUTES)", "def quality(self):\n try:\n qid = int((self.tool_metadata or {}).get(\"quality\", 0))\n except:\n qid = 0\n\n # We might be able to get the quality strings from t...
[ "0.87941146", "0.61170155", "0.6050746", "0.5851535", "0.5762336", "0.5579478", "0.55139697", "0.5418243", "0.5411513", "0.535925", "0.53295076", "0.52709144", "0.52343696", "0.520349", "0.51900476", "0.5188331", "0.5184759", "0.5182861", "0.5176378", "0.51667213", "0.5160519...
0.6239924
1
Fit scaler and transform input data Winsorise `X` at `quantile` and `1quantile`. Scale each variable (as long as they aren't binary in which case they are already rules).
def fit_transform(self, X, y=None): self.scale = np.ones(X.shape[1]) self.lower = np.percentile(X, self.quantile*100, axis=0) self.upper = np.percentile(X, (1-self.quantile)*100, axis=0) # Winsorize at `self.quantile` winX = X.copy() is_lower = (winX < self.lower...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, X):\n q_min, q_max = self.quantile_range\n self.center_ = np.nanmedian(X, axis=0) if self.with_centering else None\n \n if self.with_scaling:\n quantiles = []\n for feature_idx in range(X.shape[1]):\n column_data = X[:, feature_idx]\n ...
[ "0.6935344", "0.6514156", "0.6485185", "0.6348961", "0.62394345", "0.606469", "0.5963839", "0.591956", "0.5840398", "0.58116454", "0.58023864", "0.5767737", "0.5724162", "0.5704402", "0.5686381", "0.5667723", "0.56520194", "0.5641679", "0.5634941", "0.5634244", "0.562591", ...
0.7883213
0
Transform data into modified features (before being passed to penalised regression step). If `linear_features=True` then this will be scaled linear features followed by the onehotencoding signifying which rules are "on". Otherwise this is just the onehotencoding signifying which rules are "on".
def transform(self, X, y=None): if isinstance(X, DataFrame): is_df = True # Serves no purpose X = check_array(X) # Validate input data X = self.ext_scaler.transform(X) # Scale and centre features if self.linear_features: X_scale = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_linear_transform(self):\n \n with tf.variable_scope(\"linear_transform\"):\n \n # feature scales/weights\n self.w = tf.get_variable(\"weights\", shape=[self.dim_input], \n initializer= tf.contrib.layers.xavier_initializer())\n ...
[ "0.64672863", "0.6376041", "0.620645", "0.6029789", "0.59679097", "0.59625727", "0.5958583", "0.5933087", "0.59234154", "0.5873284", "0.57592976", "0.57417256", "0.5729975", "0.57214034", "0.571568", "0.57002", "0.56780124", "0.56722736", "0.5665581", "0.5648128", "0.56347185...
0.65656894
0
Extract rule set from single decision tree according to `XGBClassifier` format
def __extract_xgb_dt_rules__(self, dt): md = self.max_depth + 1 # upper limit of max_depth? rules = [] levels = np.zeros((md, 3)) # Stores: (feature name, threshold, next node id) path = [] # Extract feature numbers and thresholds for all nodes feat_thresh_l = re.find...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_xgboost_dump(model):\n trees= []\n for tree_string in model._Booster.get_dump():\n nodes = [feature_regex.search('t' + node).groupdict() if '[' in node else leaf_regex.search('t' +node).groupdict() for node in tree_string.split('\\n')[:-1]]\n trees.append(nodes)\n return trees", ...
[ "0.5865318", "0.5536741", "0.54987574", "0.5455966", "0.54210675", "0.5409109", "0.5405483", "0.53791", "0.53362054", "0.53147733", "0.53034365", "0.52629757", "0.51678437", "0.51664716", "0.51662976", "0.5051097", "0.50148183", "0.49448028", "0.49409705", "0.49294248", "0.49...
0.63547754
0
Extract rule set from single decision tree according to sklearn binarytree format
def __extract_dt_rules__(self, dt): t = dt.tree_ # Get tree object rules = [] stack = [(0, -1, -1)] # (node id, parent depth, true[<=thresh]/false[>thresh] arm) path = [(0, -1, -1)] # Begin path at root while len(stack) > 0: # While nodes to visit is not empty n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __extract_xgb_dt_rules__(self, dt): \n md = self.max_depth + 1 # upper limit of max_depth?\n rules = []\n levels = np.zeros((md, 3)) # Stores: (feature name, threshold, next node id)\n path = []\n\n # Extract feature numbers and thresholds for all nodes\n feat_thresh...
[ "0.63081384", "0.5973033", "0.5891241", "0.5791572", "0.57859606", "0.5680792", "0.5676548", "0.56683165", "0.5648141", "0.5642845", "0.56323576", "0.562277", "0.5616259", "0.5608892", "0.5596876", "0.55703026", "0.55625194", "0.5539325", "0.54848295", "0.5470803", "0.5442930...
0.63386476
0
Extract rules from `base_estimator`
def extract_rules(self, labels=None): # Extract flat list of rules in array form if isinstance(self.base_estimator, RandomForestClassifier): rules = list(it.chain(*[self.__extract_dt_rules__(dt) for dt in self.base_estimator.estimators_])) elif isinstance(self.base_estimator, Gradien...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _TP_estimator_requirements(estimator):\n if estimator == 'Natural':\n do_DD = True\n do_DR = False\n do_RR = True\n elif estimator == 'Davis-Peebles':\n do_DD = True\n do_DR = True\n do_RR = False\n elif estimator == 'Hewett':\n do_DD = True\n do...
[ "0.5808173", "0.5672008", "0.56038344", "0.55043817", "0.54182005", "0.5397512", "0.5376288", "0.53144646", "0.5294726", "0.52705055", "0.5173132", "0.5156924", "0.5128409", "0.5119125", "0.5093487", "0.5083402", "0.50692993", "0.50663245", "0.50592685", "0.5044347", "0.50386...
0.6383667
0
Returns the index of the section, or pseudosection, for the symbol. the index of the section, or pseudosection, for the symbol
def getSectionIndex(self) -> int: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_index_for_symbol(self, symbol):\n for idx, state in enumerate(self):\n if state.symbol == symbol:\n return idx\n if value in self.symbol_synonyms:\n return self.index(self.symbol_synonyms[value])\n raise Exception(\"State with symbol of '%s' not d...
[ "0.6868311", "0.6411154", "0.6275179", "0.6243905", "0.59100974", "0.5822145", "0.5802371", "0.57700807", "0.5695456", "0.56313735", "0.55781096", "0.557163", "0.5570825", "0.55552155", "0.55312073", "0.5525112", "0.5520313", "0.5517731", "0.5509883", "0.55041385", "0.5454695...
0.6920975
0
Read logfile with the profiles written
def read_log(prefix): l = [] with open('%s.log' % prefix) as F: for line in F: if 'profile written' not in line: continue else: l.append(line.split()[0]) return l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_linelog():", "def log(length, file):\n\n if user_init.check_pre_init() and user_utility.check_drive_init() == 'True':\n \n data = user_utility.read_log(length, file)\n\n for log in data:\n print(log)\n\n\n else:\n user_utility.print_error(\"Sink folder not Fo...
[ "0.64771223", "0.6366919", "0.6224004", "0.6189014", "0.6156716", "0.589416", "0.56880486", "0.5653552", "0.5653552", "0.5563616", "0.55355364", "0.55350137", "0.55187297", "0.5504658", "0.5428539", "0.54203796", "0.54149693", "0.5402457", "0.53929543", "0.53881913", "0.53774...
0.66682994
0
Execute line with subprocess
def executeLine(line): pl = Popen(line, shell=True, stderr=PIPE, stdout=PIPE) o, e = pl.communicate() return o, e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subproc(self,line):\n self.set_stdout()\n proc = subprocess.Popen(line.split(),stdout=self.stdout)\n proc.wait() #ensures that the subprocess executes and terminates before returning to the shell", "def do_shell(self, line):\n os.system(line)", "def do_shell(self, line):\n ...
[ "0.748457", "0.7471307", "0.7392303", "0.71741265", "0.7088497", "0.69453466", "0.68881345", "0.6846201", "0.6814815", "0.67655087", "0.6763409", "0.6605997", "0.65672106", "0.6551925", "0.6531274", "0.65091294", "0.64287466", "0.6407803", "0.6388115", "0.63674563", "0.634924...
0.78371656
0
Read a bim/fam files from the plink fileset
def read_BimFam(prefix): Bnames = ['CHR', 'SNP', 'cM', 'BP', 'A1', 'A2'] bim = pd.read_table('%s.bim' % (prefix), delim_whitespace=True, header=None, names=Bnames) Fnames = ['FID', 'IID', 'father', 'mother', 'Sex', 'Phenotype'] fam = pd.read_table('%s.fam' % (prefix), delim_white...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_plink(file_prefix, verbose=True):\n\n fn = {s: \"%s.%s\" % (file_prefix, s) for s in ['bed', 'bim', 'fam']}\n\n with TimeIt(\"Reading %s...\" % fn['bim'], not verbose):\n bim = _read_bim(fn['bim'])\n nmarkers = bim.shape[0]\n\n with TimeIt(\"Reading %s...\" % fn['fam'], not verbose):\n ...
[ "0.64510775", "0.5825708", "0.5510868", "0.55018467", "0.5465175", "0.5433269", "0.54157674", "0.53745013", "0.52349013", "0.5129814", "0.5121936", "0.51169163", "0.50746495", "0.5056231", "0.5055647", "0.50515175", "0.5049878", "0.5017783", "0.5001219", "0.4999236", "0.49899...
0.6117494
1
Generate and read frequency files and filter based on threshold
def read_freq(bfile, plinkexe, freq_threshold=0.1, maxmem=1700, threads=1): high = 1 - freq_threshold low = freq_threshold if not os.path.isfile('%s.frq.gz' % bfile): nname = os.path.split(bfile)[-1] frq = ('%s --bfile %s --freq gz --keep-allele-order --out %s --memory ' '%d -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_frequencies(self, args):\n\n for file in args.frequencies:\n self._check_valid_file(file[0])", "def automatic_checking(files):\n for i in range(10):\n fft_checking(files[i])", "def update_freq_dist(filename):\r\n pass", "def test_filtered_scan(self):\n self.run...
[ "0.6244121", "0.615341", "0.60893506", "0.6055009", "0.5997631", "0.58850914", "0.58467615", "0.5836657", "0.5833301", "0.5826538", "0.5804678", "0.5772488", "0.5745384", "0.5713081", "0.5678326", "0.56347597", "0.5622866", "0.5610701", "0.56093115", "0.55927515", "0.5584923"...
0.6175935
1
Parse and sort clumped file
def parse_sort_clump(fn, allsnps): # make sure allsnps is a series allsnps = pd.Series(allsnps) try: df = pd.read_table(fn, delim_whitespace=True) except FileNotFoundError: spl = fn.split('.') if spl[0] == '': idx = 1 else: idx = 0 fn = '.'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _out_order(self, fname):\r\n # t = 1\r\n orderDict = {}\r\n order = []\r\n readWells = False\r\n lastBlock = False\r\n addOrder = False\r\n with open(fname, \"r\") as fp:\r\n for line in fp:\r\n item ...
[ "0.6187829", "0.6099515", "0.6068014", "0.6001136", "0.59910196", "0.5986808", "0.58804303", "0.5873911", "0.57860065", "0.5770826", "0.5711253", "0.57094413", "0.5662024", "0.5638028", "0.5623567", "0.5581438", "0.553245", "0.5521676", "0.55184275", "0.5508633", "0.55056983"...
0.62394416
0
Generate qrange file to be used with plink qrange
def gen_qrange(prefix, nsnps, prunestep, every=False, qrangefn=None): order = ['label', 'Min', 'Max'] # dtype = {'label': object, 'Min': float, 'Max': float} if qrangefn is None: # Define the number of snps per percentage point and generate the range percentages = set_first_step(nsnps, prune...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_qubits(self):\n return cq.LineQubit.range(4)", "def process_qrange_file(filename):\n\n f = open(filename, 'r')\n q_ranges = yaml.load(f)\n\n return q_ranges", "def write_q_table_file(q_table, q_file=\"Q_Table.txt\"):\n file = open(q_file, \"w+\")\n rows = len(q_table)\n c...
[ "0.60668355", "0.56891936", "0.5675259", "0.56339264", "0.55886894", "0.5510636", "0.5363446", "0.535094", "0.53416795", "0.5267484", "0.5214582", "0.5211727", "0.51969045", "0.5183751", "0.51725626", "0.5170478", "0.51103914", "0.5081725", "0.5069747", "0.50608844", "0.50602...
0.6948805
0
Helper function to paralellize score_qfiles
def single_score_plink(prefix, qr, tup, plinkexe, gwasfn, qrange, frac_snps, maxmem, threads): qfile, phenofile, bfile = tup suf = qfile[qfile.find('_') + 1: qfile.rfind('.')] ou = '%s_%s' % (prefix, suf) # score = ('%s --bfile %s --score %s 2 4 7 header --q-score-range %s %s ' # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task3(dataset,writepickle=False,pfilename=None,usepickle=True):\n model,bitext = task1(dataset,printoutput = False,writepickle=writepickle,pfile = pfilename,usepickle=usepickle)\n phrases = extract_phrases(bitext,model)\n scored_phrases = phrase_scoring_ranking(phrases,model,dataset,bitext)\n print...
[ "0.575768", "0.56732047", "0.5492514", "0.548684", "0.54390764", "0.5437585", "0.54353154", "0.5411575", "0.53655994", "0.5360998", "0.53581184", "0.535637", "0.5347568", "0.5334679", "0.5334244", "0.53258014", "0.53248626", "0.53238755", "0.5297921", "0.5297799", "0.52928126...
0.5791598
0
Return a list of strings of METAR meteorological data for the specified station on sthe specified date.
def get_met_data(self, stn, ignore_errors, retries, **kwargs): # Validate the common station name and convert it to the # corresponding official station ID try: stn = self.stns[stn] except: raise UnknownStationError, stn # Process the date components in th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metar_data(station, begin, end, ignore_errors, retries):\n\n def _parse_date(date_str):\n \"\"\"Minimal date parser.\"\"\"\n yr, mo, day = [int(x) for x in date_str.split('-')]\n try:\n return date(yr, mo, day)\n except ValueError:\n raise InvalidDateError, ...
[ "0.6079679", "0.60203874", "0.59128946", "0.5794843", "0.57113194", "0.5494066", "0.5489716", "0.5488133", "0.5465871", "0.53732324", "0.53613657", "0.5346025", "0.5334262", "0.5303991", "0.5268003", "0.5259103", "0.523938", "0.52334833", "0.52326477", "0.5229239", "0.5220071...
0.6702449
0
Return the METAR data for the specified station and date range.
def metar_data(station, begin, end, ignore_errors, retries): def _parse_date(date_str): """Minimal date parser.""" yr, mo, day = [int(x) for x in date_str.split('-')] try: return date(yr, mo, day) except ValueError: raise InvalidDateError, begin ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_met_data(self, stn, ignore_errors, retries, **kwargs):\n # Validate the common station name and convert it to the\n # corresponding official station ID\n try:\n stn = self.stns[stn]\n except:\n raise UnknownStationError, stn\n # Process the date comp...
[ "0.7159997", "0.5764372", "0.5731595", "0.5731141", "0.56950647", "0.5617954", "0.5477128", "0.5425443", "0.542119", "0.540292", "0.5396697", "0.5381608", "0.5376013", "0.536097", "0.53551173", "0.53006876", "0.5294632", "0.52827334", "0.5266694", "0.52493864", "0.524286", ...
0.7412664
0
Add trick to the dog This function illustrate mistaken use of mutable class variable tricks (see below).
def add_trick(self, trick): self.tricks.append(trick)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_class_and_instance_variables():\n\n # pylint: disable=too-few-public-methods\n class Dog:\n \"\"\"Dog class example\"\"\"\n\n kind = \"canine\" # Class variable shared by all instances.\n\n def __init__(self, name):\n self.name = name # Instance variable unique to e...
[ "0.62275213", "0.54250777", "0.5253472", "0.5125945", "0.50684893", "0.50618595", "0.50537896", "0.50460774", "0.50388473", "0.5032443", "0.5029293", "0.5029293", "0.5029293", "0.5029293", "0.5029293", "0.5029293", "0.5029293", "0.5029293", "0.5029293", "0.5029293", "0.502929...
0.5709575
1
This method register the book in the books table, but before checks if the books is already registered. I decided to use the barcode in data string, because I can use the both bar code parameters. And the stock is defined in 0, because if the user doesn't pass the stock, the quantity is already set to 0
def register_book(self, title: str, author: str, price: float, barcode: str, stock=0): try: if not self.verify_register(barcode): self.db.cursor.execute('INSERT INTO books (title, author, price, bar_code, stock) VALUES (%s, %s, %s, ' '%s, %s)', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_book(self, data):\n exists = self.check_if_exists(data['isbn'])\n\n if exists:\n query = f\"\"\"UPDATE {TABLE} SET quantity = quantity + 10 WHERE bookID = '{data[\"isbn\"]}'\"\"\"\n else:\n query = f\"\"\"INSERT INTO {TABLE}(bookID, title, authors, avg_rating, rat...
[ "0.7018125", "0.67015535", "0.6207142", "0.6084916", "0.60626495", "0.60456854", "0.59645706", "0.591887", "0.5900992", "0.5860568", "0.5826839", "0.57534194", "0.5710244", "0.57028556", "0.5676682", "0.56455344", "0.56382316", "0.5637503", "0.5599727", "0.5594511", "0.558963...
0.824485
0
This method update the price of the books, by the barcode.
def update_price_books(self, barcode, new_price): try: self.db.cursor.execute('UPDATE books SET price = %s where id_books = %s', (round(new_price, 2), barcode)) except Exception as error: print(error) else: self.db.con.commit() self.db.con.close() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __on_update_bookticker(self, action, bookticker):\n self.best_bid_price = float(bookticker['b'])\n self.best_ask_price = float(bookticker['a'])", "def update(self, price, volume):\r\n if price > self.hig:\r\n self.hig = price\r\n if price < self.low:\r\n self...
[ "0.6417695", "0.62173057", "0.61378425", "0.603132", "0.5936183", "0.5868149", "0.58071566", "0.5730834", "0.57285744", "0.5673982", "0.5657812", "0.56183827", "0.5603246", "0.55851513", "0.55851513", "0.55851513", "0.55851513", "0.55597377", "0.555364", "0.55461675", "0.5521...
0.8498672
0
This method deleted books already registered in the database, by the barcode.
def delete_book(self, barcode): try: self.db.cursor.execute('DELETE FROM books where id_books = %s', (barcode,)) except Exception as error: print(error) else: self.db.con.commit() self.db.con.close() print('Deleted Successfully!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, book_info, destroy):\n self.connect()\n bid = book_info[0].get()\n\n delete_sql = f\"delete from {self.book_table} where bid = '{bid}'\"\n delete_issue = f\"delete from {self.issued_table} where bid = '{bid}'\"\n try:\n self.cur.execute(delete_sql)\n ...
[ "0.72892725", "0.7267948", "0.70717716", "0.6985194", "0.6930456", "0.6827797", "0.6826523", "0.6772539", "0.67015284", "0.6700609", "0.6663117", "0.66131103", "0.6519632", "0.6362935", "0.63454336", "0.63371575", "0.6292271", "0.62690663", "0.6228916", "0.6208259", "0.614254...
0.8566365
0
This method return the specifications of the books, consulting the database by barcode
def consult_books(self, bar_code: str): try: book_data = [] self.db.cursor.execute('SELECT * from books WHERE bar_code = %s', (bar_code,)) for i in self.db.cursor.fetchall(): book_data.append(i) except Exception as error: print(error) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_book(code: str) -> Dict:\n pass", "def get_all_books() -> List[Dict]:\n pass", "def search_for_redbooks(book_codes: tuple):\n\n book_dict = {}\n\n global setup\n\n for book_code in book_codes:\n URI_string = build_URI_string(book_code)\n search_web_page = requests.get(URI_...
[ "0.6242606", "0.6134235", "0.61072266", "0.6074063", "0.601683", "0.6006033", "0.5984732", "0.59228015", "0.59210134", "0.59080076", "0.5892924", "0.5887974", "0.5790417", "0.577142", "0.57639205", "0.57627887", "0.5726483", "0.5719359", "0.57189673", "0.5704592", "0.5703736"...
0.7258699
0
This method checks if the books is already registered in the database, by barcode.
def verify_register(self, barcode: str): try: test = [] self.db.cursor.execute(f'SELECT * FROM books where bar_code = {barcode}') for i in self.db.cursor.fetchall(): test.append(i) except Exception as error: print(error) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_book(self, title: str, author: str, price: float, barcode: str, stock=0):\n try:\n if not self.verify_register(barcode):\n self.db.cursor.execute('INSERT INTO books (title, author, price, bar_code, stock) VALUES (%s, %s, %s, '\n '%...
[ "0.7017784", "0.6627457", "0.6388775", "0.6382595", "0.6364732", "0.6298332", "0.6274584", "0.6257029", "0.620658", "0.6175331", "0.61634517", "0.6128748", "0.6127025", "0.6117657", "0.60925686", "0.6036167", "0.59862727", "0.5967401", "0.59655285", "0.5958692", "0.5928705", ...
0.8429786
0
A method to generate a nonce to send to the validation server. As specified by the protocol, the nonce must be between 16 and 40 alphanumeric characters long with random unique data.
def generate_nonce(): return uuid4().hex
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonce():\n return random.randint(0, 4294967295)", "def nonce():\n return random.randint(0, 4294967295)", "def _generate_nonce(self):\n return str(random.randrange(100000, 999999))", "def gen_nonce(self, length=32):\n if(length < 32):\n res = {\"message\": 'Invalid nonce len...
[ "0.8042163", "0.8042163", "0.8010228", "0.7921566", "0.79005414", "0.78887206", "0.78473306", "0.78447676", "0.78447676", "0.77639616", "0.75877625", "0.75856775", "0.748053", "0.74550116", "0.7397726", "0.73679745", "0.73569447", "0.7110729", "0.70935357", "0.7075415", "0.70...
0.8238167
0
Check that the response is a valid response to our request that is, the otp that was returned is the otp we sent originally, that the nonce that was sent was the nonce we had originally, and that the signature (if C{self.api_key} is not C{None}) is valid
def _verify_response(self, text_response, orig_otp, orig_nonce): response_dict = dict([line.strip(' ').split('=', 1) for line in re.split(r'\r\n', text_response) if line.strip()]) if 'otp' in response_dict and response_dict['otp'] != orig_otp:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_response(self, response):\n pass", "def _check_response(self, res: requests.Response, token: str) -> None:\n return", "def verify_response_dict(api_key, response):\n LOGGER.debug('Verifying WSAPI response signature')\n\n # Remove signature from the response\n r = dict(respon...
[ "0.6813327", "0.6812169", "0.67820585", "0.65645856", "0.6504918", "0.6386462", "0.63724524", "0.6230743", "0.622919", "0.6145281", "0.6137439", "0.60897577", "0.608821", "0.6076044", "0.607178", "0.6069999", "0.60647804", "0.60482323", "0.6047397", "0.60116434", "0.59915906"...
0.7006299
0
Verifies an OTP against the validation servers provided to the verifier. It queries all servers in parallel and waits for answers. Servers will not respond positively until it has synchronized the new OTP counter with the other servers, and this will wait until it has received one valid (200, otp and nonce match, and s...
def verify(self, otp, timestamp=None, sl=None, timeout=None): query_dict = { 'id': self.verifier_id, 'otp': otp, 'nonce': self.generate_nonce() } if timestamp is not None: query_dict['timestamp'] = int(bool(timestamp)) if sl is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_otp(request: Request, body: VerifyOTPIn, db: Session = Depends(get_db)):\n mgr = LoginManager()\n mgr.verify_otp(db, body.identifier, body.code)\n request.session[\"access_token\"] = secrets.token_hex(16)\n return {\"status\": \"OK\"}", "def sync_remote(self, otp_params, local_params, serv...
[ "0.5752108", "0.5737716", "0.56494606", "0.5645329", "0.5643826", "0.5574296", "0.5451564", "0.5326181", "0.53075504", "0.5299279", "0.52365446", "0.52112764", "0.5197768", "0.51941586", "0.51802087", "0.51605034", "0.514498", "0.51412606", "0.5097546", "0.508744", "0.5070752...
0.68441504
0
r"""Makes a gif using a list of images.
def make_gif(image_list, gif_name): if not gif_name.endswith(".gif"): gif_name += ".gif" imageio.mimsave(gif_name, [imageio.imread(x) for x in image_list])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_gif():\n anim_file = 'sample/training.gif'\n\n with imageio.get_writer(anim_file, mode='I') as writer:\n filenames = glob.glob('sample/*.jpg')\n filenames = sorted(filenames, key=lambda filename: int(filename[11:-4]))\n for filename in filenames:\n image = imageio.imread(filename)\n ...
[ "0.78579974", "0.7659993", "0.7557394", "0.75059664", "0.72135156", "0.7159185", "0.7140775", "0.7111952", "0.69703233", "0.6958537", "0.694323", "0.68651026", "0.68095165", "0.68038476", "0.6797115", "0.6718196", "0.6681492", "0.6675865", "0.66499966", "0.66303796", "0.65588...
0.818792
0
wrapper function for starting a net.Server connected to `pipe`
async def net_server(pipe): server = await net.Server(pipe, host="0.0.0.0", port=8080) return await server.wait_closed()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def net_proc(pipe):\n asyncio.run(net_server(pipe))", "def new_server(self, name, pipeline, port=None):\n if port is None:\n port = self.next_port\n self.next_port += 1\n\n self.servers[name] = port\n\n args = [\"owl-server\",\"--port\", str(port)] + pipeline.split()...
[ "0.7584677", "0.6351429", "0.6300604", "0.617805", "0.60826844", "0.5990248", "0.5973056", "0.5972735", "0.5965008", "0.5957159", "0.5957159", "0.5944811", "0.58804023", "0.5860215", "0.58540183", "0.58201164", "0.58175886", "0.57931465", "0.57761294", "0.5772888", "0.5771360...
0.8183566
0
wrapper for running net_server on its own thread/process
def net_proc(pipe): asyncio.run(net_server(pipe))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n server = TCPServer((self.host, self.port), TCPHandler)\n server.lymphocytes_getter = self.lymphocytes_getter\n\n #runs forever - so make this thread daemon\n server.serve_forever()", "async def net_server(pipe):\n server = await net.Server(pipe, host=\"0.0.0.0\", p...
[ "0.7307538", "0.68068635", "0.6780022", "0.6780022", "0.6734137", "0.6704307", "0.668211", "0.66599005", "0.6595216", "0.65842754", "0.6539571", "0.65383536", "0.6500156", "0.6459733", "0.64578015", "0.6419993", "0.6366262", "0.6355513", "0.63487566", "0.6294894", "0.62633705...
0.7150661
1
Dynamic import of CVXOPT dense interface.
def get_cvxopt_dense_intf(): import cvxpy.interface.cvxopt_interface.valuerix_interface as dmi return dmi.DenseMatrixInterface()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cvxopt_sparse_intf():\n import cvxpy.interface.cvxopt_interface.sparse_matrix_interface as smi\n return smi.SparseMatrixInterface()", "def dense2cvxopt(value):\n import cvxopt\n return cvxopt.matrix(value, tc='d')", "def test_import_type_dense():\n x = np.random.rand(7, 11)\n export_d...
[ "0.6213993", "0.6188066", "0.59842515", "0.59137076", "0.58391494", "0.55679363", "0.5485139", "0.5233388", "0.5186878", "0.5140729", "0.5139248", "0.5135993", "0.5131671", "0.5050744", "0.5043737", "0.5000771", "0.4989075", "0.49857393", "0.49512193", "0.4937559", "0.4929777...
0.76370394
0
Dynamic import of CVXOPT sparse interface.
def get_cvxopt_sparse_intf(): import cvxpy.interface.cvxopt_interface.sparse_matrix_interface as smi return smi.SparseMatrixInterface()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_import_type_sparse():\n x = sps.csr_matrix(np.random.rand(7, 11))\n export_data('/tmp/test.sparse', x)\n assert x.dtype == import_data('/tmp/test.sparse').dtype", "def test_import_values_sparse():\n x = sps.csr_matrix(np.random.rand(7, 11))\n export_data('/tmp/test.sparse', x)\n assert...
[ "0.6678251", "0.6325364", "0.6168615", "0.61634254", "0.6101723", "0.6002239", "0.59741104", "0.5861257", "0.58531886", "0.5842924", "0.5654546", "0.56046325", "0.5598766", "0.559268", "0.557955", "0.5525964", "0.5518082", "0.550019", "0.5469042", "0.5434541", "0.5425496", ...
0.76998776
0
Converts a SciPy sparse matrix to a CVXOPT sparse matrix.
def sparse2cvxopt(value): import cvxopt if isinstance(value, (np.ndarray, np.matrix)): return cvxopt.sparse(cvxopt.matrix(value.astype('float64')), tc='d') # Convert scipy sparse matrices to coo form first. elif sp.issparse(value): value = value.tocoo() return cvxopt.spmatrix(val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sparse(self):\n from divisi2.sparse import SparseMatrix\n return SparseMatrix(self, self.row_labels, self.col_labels)", "def makesparse(matrix):\n n = matrix[0].size\n elements = []\n for i in range(n):\n for j in range(n):\n if matrix[i][j] != 0 :\n ...
[ "0.74020207", "0.7093455", "0.70311135", "0.6989213", "0.69172007", "0.68352145", "0.6795465", "0.67651546", "0.6756018", "0.6749724", "0.6736512", "0.67179906", "0.66992825", "0.6644021", "0.6587182", "0.65845096", "0.6561744", "0.6558976", "0.65500927", "0.65500927", "0.655...
0.80747503
0
Converts a NumPy matrix to a CVXOPT matrix.
def dense2cvxopt(value): import cvxopt return cvxopt.matrix(value, tc='d')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cvxopt2dense(value):\n return np.array(value)", "def sparse2cvxopt(value):\n import cvxopt\n if isinstance(value, (np.ndarray, np.matrix)):\n return cvxopt.sparse(cvxopt.matrix(value.astype('float64')), tc='d')\n # Convert scipy sparse matrices to coo form first.\n elif sp.issparse(valu...
[ "0.6312579", "0.6233762", "0.58347297", "0.5797177", "0.56139076", "0.5566805", "0.54767096", "0.5372099", "0.53622454", "0.535068", "0.5341642", "0.52930886", "0.52172667", "0.5217212", "0.51898384", "0.51890403", "0.5079698", "0.50713885", "0.5059637", "0.5054085", "0.50439...
0.66287154
0
Is the constant a sparse matrix?
def is_sparse(constant) -> bool: return sp.issparse(constant)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_sparse(A):\n if isinstance(A, torch.Tensor):\n return A.layout == torch.sparse_coo\n raise TypeError(\"expected Tensor but got %s\" % (type(A).__name__))", "def is_sparse(tensor):\n return isinstance(tensor, sparse_tensor.SparseTensor)", "def is_sparse(x: Any, backend=None) -> bool:\r\n ...
[ "0.76833653", "0.7436849", "0.74230564", "0.72037745", "0.7105081", "0.6872479", "0.6814387", "0.67973125", "0.67928153", "0.67843324", "0.66110086", "0.6596236", "0.6586943", "0.65716755", "0.6568378", "0.64620703", "0.641447", "0.6402279", "0.6368499", "0.62777996", "0.6246...
0.7981942
0
Check if a matrix is Hermitian and/or symmetric.
def is_hermitian(constant) -> bool: complex_type = np.iscomplexobj(constant) if complex_type: # TODO catch complex symmetric but not Hermitian? is_symm = False if sp.issparse(constant): is_herm = is_sparse_symmetric(constant, complex=True) else: is_herm = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_Hermitian(q_1: Qs) -> bool:\n\n hc = Hermitian_conj(q_1, q_1.rows, q_1.columns)\n\n return equals(q_1, hc)", "def is_symmetric(mat):\n return np.allclose(mat.T, mat)", "def IsHermitian(self):\n \n Hermitian=True\n for Ind in self.IndList():\n Q=tuple(-x for x in ...
[ "0.7288421", "0.70511174", "0.695801", "0.660251", "0.6573264", "0.6567614", "0.6554783", "0.6513599", "0.65056306", "0.64851743", "0.64565355", "0.63981193", "0.6385611", "0.63054913", "0.62993294", "0.62919945", "0.6259792", "0.6143758", "0.6118125", "0.6030024", "0.6024043...
0.71756566
1
Walks through the full state trie, yielding one missing node hash/prefix at a time. The yielded node info is wrapped in a TrackedRequest. The hash is marked as active until it is explicitly marked for review again. The hash/prefix will be marked for review asking a peer for the data. Will exit when all known node hashe...
async def _missing_trie_hashes(self) -> AsyncIterator[TrackedRequest]: # For each account, when we have asked for all known storage and bytecode # hashes, but some are still not present, we "pause" the account so we can look # for neighboring nodes. # This is a list of paused account...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _request_tracking_trie_items(\n self,\n request_tracker: TrieNodeRequestTracker,\n root_hash: Hash32) -> AsyncIterator[Tuple[Nibbles, Nibbles, bytes]]:\n if self._next_trie_root_hash is None:\n # We haven't started beam syncing, so don't know which root ...
[ "0.6850051", "0.6614492", "0.5646459", "0.5422282", "0.53472066", "0.5297117", "0.52896756", "0.5159195", "0.50123775", "0.4973791", "0.49718073", "0.4961415", "0.49293295", "0.49292937", "0.4928424", "0.4927427", "0.49176684", "0.4904762", "0.48756814", "0.4864487", "0.48493...
0.7028946
0
Walk through the supplied trie, yielding the request tracker and node request for any missing trie nodes.
async def _request_tracking_trie_items( self, request_tracker: TrieNodeRequestTracker, root_hash: Hash32) -> AsyncIterator[Tuple[Nibbles, Nibbles, bytes]]: if self._next_trie_root_hash is None: # We haven't started beam syncing, so don't know which root to start a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _missing_trie_hashes(self) -> AsyncIterator[TrackedRequest]:\n # For each account, when we have asked for all known storage and bytecode\n # hashes, but some are still not present, we \"pause\" the account so we can look\n # for neighboring nodes.\n # This is a list of pau...
[ "0.6288311", "0.56712145", "0.56443197", "0.5567986", "0.55481374", "0.54169506", "0.5246231", "0.5213265", "0.51985264", "0.51985264", "0.51985264", "0.51985264", "0.5185277", "0.5173819", "0.5107165", "0.50870496", "0.50870496", "0.50827366", "0.50448364", "0.50392336", "0....
0.6903136
0
Walks through the storage trie at the given root, yielding one missing storage node hash/prefix at a time. The yielded node info is wrapped in a ``TrackedRequest``. The hash is marked as active until it is explicitly marked for review again. The hash/prefix will be marked for review asking a peer for the data. Will exi...
async def _missing_storage_hashes( self, address_hash_nibbles: Nibbles, storage_root: Hash32, starting_main_root: Hash32) -> AsyncIterator[TrackedRequest]: if storage_root == BLANK_NODE_HASH: # Nothing to do if the storage has an empty root ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _request_tracking_trie_items(\n self,\n request_tracker: TrieNodeRequestTracker,\n root_hash: Hash32) -> AsyncIterator[Tuple[Nibbles, Nibbles, bytes]]:\n if self._next_trie_root_hash is None:\n # We haven't started beam syncing, so don't know which root ...
[ "0.70497036", "0.6926985", "0.5630191", "0.48730353", "0.48023686", "0.47926912", "0.4764393", "0.46911123", "0.4685286", "0.4670354", "0.46662426", "0.4628357", "0.46207827", "0.45691854", "0.45436504", "0.45341483", "0.44921196", "0.4481057", "0.44659668", "0.4446959", "0.4...
0.766844
0
Checks if this bytecode is missing. If so, yield it and then exit. If not, then exit immediately. This may seem like overkill, and it is right now. But... Code merkelization is coming (theoretically), and the other account and storage trie iterators work similarly to this, so in some ways it's easier to do this "overge...
async def _missing_bytecode_hashes( self, address_hash_nibbles: Nibbles, code_hash: Hash32, starting_main_root: Hash32) -> AsyncIterator[TrackedRequest]: if code_hash == EMPTY_SHA3: # Nothing to do if the bytecode is for the empty hash ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_bytecode_generation():\n sentinel, sys.dont_write_bytecode = sys.dont_write_bytecode, True\n\n try:\n yield\n finally:\n sys.dont_write_bytecode = sentinel", "async def _missing_trie_hashes(self) -> AsyncIterator[TrackedRequest]:\n # For each account, when we have asked ...
[ "0.5561266", "0.5535464", "0.5518014", "0.49592614", "0.4936246", "0.4916298", "0.48616886", "0.470336", "0.46492574", "0.4646029", "0.46459916", "0.46368012", "0.4590937", "0.45884967", "0.4579382", "0.4562117", "0.45618558", "0.45422032", "0.4526873", "0.4470122", "0.446246...
0.713805
0
Estimate the completed fraction of the trie that is contiguous with the current index (which rotates every 32 blocks) It will be probably be quite noticeable that it will get "stuck" when downloading a lot of storage, because we'll have to blow it up to more than a percentage to see any significant change within 32 blo...
def _contiguous_accounts_complete_fraction(self) -> float: starting_index = bytes_to_nibbles(self._next_trie_root_hash) unknown_prefixes = self._account_tracker._trie_fog._unexplored_prefixes if len(unknown_prefixes) == 0: return 1 # find the nearest unknown prefix (typicall...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fraction_completed(self):\n return sum(self._chunk_done.values()) / len(self.chunks)", "def get_utilization(self):\n child_prefixes = Prefix.objects.filter(prefix__net_contained_or_equal=str(self.prefix))\n # Remove overlapping prefixes from list of children\n networks = cidr_merg...
[ "0.57871044", "0.57394934", "0.5700969", "0.557595", "0.55153626", "0.5491407", "0.54715765", "0.54007584", "0.53748786", "0.5336496", "0.5328934", "0.5310399", "0.5259188", "0.52554494", "0.5247512", "0.5241603", "0.5217785", "0.51893973", "0.51840824", "0.5177834", "0.51671...
0.764008
0
Return the Trie Fog that can be searched, ignoring any nodes that are currently being requested.
def _get_eligible_fog(self) -> fog.HexaryTrieFog: return self._trie_fog.mark_all_complete(self._active_prefixes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_trie():\n trie = Trie()\n return trie", "def empty_trie():\n from trie import Trie\n trie = Trie()\n return trie", "def traversal_test_trie():\n from trie import Trie\n trie = Trie()\n trie.insert('alpha')\n trie.insert('alpaca')\n trie.insert('boy')\n return trie", ...
[ "0.5776142", "0.57360816", "0.5326462", "0.5315044", "0.5267867", "0.5225813", "0.51331353", "0.5095872", "0.50827706", "0.49944326", "0.49880475", "0.496863", "0.48768044", "0.4836348", "0.48069534", "0.4800665", "0.47692093", "0.47494227", "0.47216982", "0.47108996", "0.469...
0.7354035
0
Return title + episode (if series)
def inclusive_title(self): return self.title + (" %s" % (self.episode_to_string(self.latest_season, self.latest_episode),) if self.is_series() else "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def episode_title_for_tvdb(self):\n \n # strip out the year from the episode title:\n return \"Episode %d\"%self.episode_number[1]", "def episode_title_for_tvdb(self):\n return self.episode_title", "def episode_title_for_tvdb(self):\n \n # strip out the year from the e...
[ "0.74555385", "0.7378745", "0.6963783", "0.68400466", "0.66249967", "0.6508349", "0.64518964", "0.6446037", "0.6445582", "0.6437754", "0.6297738", "0.62690187", "0.6210943", "0.6200764", "0.61216825", "0.6120273", "0.611263", "0.59974575", "0.5988067", "0.5951355", "0.5944540...
0.7791267
0
Returns dataframe with mean profit per cluster basing on a df given as an argument
def get_profit_per_cluster(df: pd.core.frame.DataFrame) -> pd.core.frame.DataFrame: return pd.DataFrame(df.groupby(by='cluster')['profit'].mean(), columns=['profit']).reset_index()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mean_profit_per_class_from_train_df(df_profit_per_cluster_train: pd.core.frame.DataFrame) -> tuple:\n # if condition returns False, AssertionError is raised:\n assert len(df_profit_per_cluster_train) >= 3, \"Algorithm, returned less than 3 clusters.\"\n\n df_profit_per_cluster = df_profit_per_clus...
[ "0.77887636", "0.71788836", "0.68467784", "0.64547867", "0.62752557", "0.62094164", "0.6097976", "0.6032077", "0.59859556", "0.5968796", "0.5952526", "0.5906807", "0.59013987", "0.58965117", "0.58917665", "0.5887675", "0.5864871", "0.5808137", "0.5738972", "0.5717941", "0.564...
0.87321883
0
Basing on a dataframe given as an argument, returns mean profit per class (buy, sell) in training dataset. sort dataframe descending by profit marks 1/3 of clusters with the highest profit as buy marks 1/3 of clusters with the lowest profit as sell if data contains less than 3 different clusters returns AssertionError
def get_mean_profit_per_class_from_train_df(df_profit_per_cluster_train: pd.core.frame.DataFrame) -> tuple: # if condition returns False, AssertionError is raised: assert len(df_profit_per_cluster_train) >= 3, "Algorithm, returned less than 3 clusters." df_profit_per_cluster = df_profit_per_cluster_train.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mean_profit_per_class_from_test_df(df_profit_per_cluster_test: pd.core.frame.DataFrame,\n buy_clusters_list: List[int], sell_clusters_list: List[int]) -> tuple:\n # if condition returns False, AssertionError is raised:\n assert len(buy_clusters_list) != 0 and...
[ "0.72233945", "0.6792338", "0.6017771", "0.58476025", "0.57573664", "0.5649134", "0.56137496", "0.5605749", "0.56018263", "0.55858415", "0.55482686", "0.55418605", "0.5532151", "0.551682", "0.5425047", "0.54250115", "0.5417848", "0.5410822", "0.5366402", "0.53150505", "0.5294...
0.78250796
0
Basing on a dataframe given as an argument, and list of buy and sell clusters returns mean profit per class (buy, sell) in testing dataset.
def get_mean_profit_per_class_from_test_df(df_profit_per_cluster_test: pd.core.frame.DataFrame, buy_clusters_list: List[int], sell_clusters_list: List[int]) -> tuple: # if condition returns False, AssertionError is raised: assert len(buy_clusters_list) != 0 and len(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mean_profit_per_class_from_train_df(df_profit_per_cluster_train: pd.core.frame.DataFrame) -> tuple:\n # if condition returns False, AssertionError is raised:\n assert len(df_profit_per_cluster_train) >= 3, \"Algorithm, returned less than 3 clusters.\"\n\n df_profit_per_cluster = df_profit_per_clus...
[ "0.8185011", "0.7136002", "0.5966785", "0.59034175", "0.58183724", "0.5765148", "0.5717098", "0.56850725", "0.56474286", "0.56181526", "0.5601236", "0.557191", "0.55662805", "0.5527561", "0.55179936", "0.55108774", "0.54241854", "0.5415164", "0.5412711", "0.5410539", "0.54015...
0.8361798
0
Creates strategy which can be used in testing part of the script. reads preprocessed split into training and testing sets data train som model calculates mean profit per cluster in training and testing dataset gets mean profits
def create_strategy(filename: str, columns_list: List[str], som_width: int, som_height: int, n_iter: int, sigma=0.3, learning_rate=0.01) -> tuple: # get prepared data df, df_prepared, df_train, df_test, df_train_columns = get_data(filename, columns_list) # train som final_df_train, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_train_test(option, transform, params, split=0.2):\r\n clip_im_dir = option.clip_im_dir\r\n matting_dir = option.matting_dir\r\n csv_path = option.csv_path\r\n \r\n print(\"create datasets\")\r\n \r\n \r\n data_df = pd.read_csv(csv_path)\r\n # data_df = MergeDataframe(clip_i...
[ "0.67197025", "0.6372317", "0.6326024", "0.62784594", "0.62007445", "0.6187098", "0.61727315", "0.61609745", "0.6150832", "0.61274564", "0.6109672", "0.60908484", "0.60526675", "0.60400504", "0.5990867", "0.59906036", "0.59859765", "0.5970628", "0.5950032", "0.5942936", "0.59...
0.6798001
0
Initialize the bzip2 package.
def __init__(self, system): super(Bzip2106, self).__init__("bzip2-1.0.6", system, "bzip2-1.0.6.tar.gz")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n\t\tself.verbose = kwargs.pop('verbose', self.verbose)\n\t\t#super(ZipArchive, self).__init__(*args, **kwargs)\n\t\tzipfile.ZipFile.__init__(self, *args, **kwargs)", "def __init__(self):\n _snap.TStrHashF_DJB_swiginit(self, _snap.new_TStrHashF_DJB())", "def hasBzip2...
[ "0.61423457", "0.5892953", "0.5870998", "0.58182406", "0.5793603", "0.5732819", "0.5602661", "0.5576144", "0.55652636", "0.55539757", "0.5521145", "0.5483834", "0.5482151", "0.54801524", "0.5467347", "0.54053587", "0.54005855", "0.53714246", "0.53280556", "0.5319646", "0.5318...
0.7995384
0
Helper function to check for blacklisted tokens
def check_blacklisted_token(token): token = models.TokenBlackList.query.filter_by(token=token).first() if token: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_token_in_blacklist(decrypted_token):\n return (\n decrypted_token[\"jti\"] in BLACKLIST\n ) # if True, go to revoked_token_callback", "def check_if_token_in_blacklist(decrypted_token):\n jti = decrypted_token['jti']\n return model.revoked_token.RevokedToken.is_blackli...
[ "0.76352197", "0.76228154", "0.7478889", "0.7431049", "0.7411897", "0.7238838", "0.7137883", "0.69916326", "0.69205165", "0.68788165", "0.66148496", "0.65662944", "0.64836353", "0.6441574", "0.635617", "0.6342027", "0.63384205", "0.62987286", "0.6216427", "0.6215166", "0.6212...
0.7947959
0
Determine the anticipated host switch name for the logical switch respresented by and store it in caller's . If an existing name is present, use it.
def _preprocess_resolve_switch_name(obj, kwargs): # Determine the expected host_switch_name from the associated # TransportZone. This must be done via API regardless of requested # execution_type. if kwargs.get('host_switch_name') is None: # XXX(jschmidt): read() should be able to default to pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_switch(self,host):\n switch_list = self.__graph_dict[host]\n switch_num = switch_list[0]\n return switch_num", "def get_initiator_host_name(self, connector):\n name = connector.get('initiator',\n connector.get('wwnns', [''])[0])[::-1]\n if se...
[ "0.59917486", "0.5900308", "0.58105445", "0.5809452", "0.57702166", "0.57147825", "0.562613", "0.558732", "0.55398726", "0.55224764", "0.5492891", "0.5492891", "0.5477548", "0.5439147", "0.53883976", "0.5365079", "0.5351319", "0.534847", "0.53416914", "0.5320049", "0.53086567...
0.7307711
0
Fit LDA from a scipy CSR matrix (X).
def fit_lda(X, vocab): print('fitting lda...') return LdaModel(matutils.Sparse2Corpus(X, documents_columns=False), num_topics=100, passes=1, iterations=500, chunksize=1000, update_every=1, id2word=dict([(i, s) for i, s in enumerate(vocab)]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, X):\n\n X_sparse = X.copy().astype(np.float64)\n self.X_sparse = X_sparse\n self._fit()\n return self", "def fit(self, X, y=None):\n #X = check_array(X, accept_sparse='csr')\n return self", "def fit(self, X: sp.csr_matrix, n_samples: int):\n X = ch...
[ "0.64050597", "0.6399704", "0.6362117", "0.62613547", "0.6251182", "0.6121596", "0.610392", "0.6086461", "0.59369344", "0.5904508", "0.5868396", "0.5860403", "0.585907", "0.58524126", "0.5779344", "0.5778336", "0.575929", "0.57262206", "0.5716203", "0.5701557", "0.569485", ...
0.75815755
0
Used at initialization to update all scan groups with their database values
def load_all_groups(self): for _, group in self.scopes.items(): group.update()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update(self):\n # clear group before rebuild\n self.clear()\n\n # build configuration groups\n self._config_names = []\n for i in range(self._n_configs):\n config_name = f\"config{i+1:02}\"\n self._config_names.append(config_name)\n self._bui...
[ "0.62571394", "0.6019692", "0.5947787", "0.59254926", "0.5868216", "0.5769238", "0.55904764", "0.5585611", "0.5578358", "0.5528191", "0.54845923", "0.54744333", "0.54352814", "0.5428182", "0.54216605", "0.54042125", "0.5394926", "0.538905", "0.5349979", "0.5349979", "0.534997...
0.61861694
1
Generate header for oauth2
def oauth_headers(oauth): import base64 encoded_credentials = base64.b64encode(('{0}:{1}'.format(oauth.client_id, oauth.client_secret)).encode('utf-8')) headers = { 'Authorization': 'Basic {0}'.format(encoded_credentials.decode('utf-8')), 'Content-Type': 'application/x-www-form-urlen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_oauth_headers(access_token: str) -> dict:\n return {'Authorization': 'Bearer ' + access_token}", "def __header_base64(self):\n header_base64 = base64.b64encode(f'{self.client_id}:{self.client_secret}'.encode('ascii'))\n header_base64 = str(header_base64).split(\"'\")[1]\n ret...
[ "0.7510096", "0.71629244", "0.71587896", "0.7056566", "0.7027807", "0.69251823", "0.6914705", "0.6914705", "0.68121415", "0.67767835", "0.6775404", "0.67447174", "0.67390746", "0.67297125", "0.6694022", "0.66927457", "0.66704285", "0.6578851", "0.65618974", "0.64950544", "0.6...
0.73699313
1
Creates an access token from the supplied oauth2.0 object
def create_access_token(oauth): #create parameters for API authorization redirect_uri = 'oob' params = {'client_secret': oauth.client_secret, 'redirect_uri': redirect_uri, 'response_type': 'code'} #store the access code url = oauth.get_authorize_url(**params) #open a web browser to get access token ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_oauth2_access_token(self):\n if not isinstance(self.session, DropboxSession):\n raise ValueError(\"This call requires a DropboxClient that is configured with an \"\n \"OAuth 1 access token.\")\n url, params, headers = self.request(\"/oauth2/token_from...
[ "0.77427965", "0.7283522", "0.6906905", "0.6883373", "0.68754137", "0.6776269", "0.6742007", "0.6687795", "0.66251546", "0.6614909", "0.6581949", "0.65400434", "0.6519731", "0.6517932", "0.65080005", "0.64990944", "0.6489406", "0.6487857", "0.648599", "0.64817834", "0.6473712...
0.7380083
1
API query to return all available players, ssorted by number of fantasy points\n
def available_players_query(): #start the calculation timer calc_start = time.time() #initialize everything last_first_names = [] full_names = [] player_key = [] player_pos = [] start = 1 done = False #this is where the data is actually created #loop thru to get all of the players available while(not done...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def playerStandings():\n\n getPlayers = \"SELECT id, name, wins, matches FROM playerstats ORDER BY wins DESC\"\n players = executeQuery({'dbname': 'tournament', 'query' : getPlayers, 'type' : 'find'})\n return players", "def player_stats_query(week, player_list, session=s): \n #initialize lists\n ...
[ "0.688901", "0.668698", "0.6631293", "0.6608959", "0.6578679", "0.656035", "0.65281093", "0.6521085", "0.6487832", "0.6485906", "0.64535034", "0.64514905", "0.6449632", "0.63346374", "0.63248485", "0.63226306", "0.6192959", "0.61134183", "0.60795534", "0.6069883", "0.60646695...
0.74588764
0
Returns the player stats for the given week\n Takes the player list as an argument so the function can be used for available players and rostered players\n Only works for offensive players (QB, WR, RB, TE) right now
def player_stats_query(week, player_list, session=s): #initialize lists pos_list = [] team_list = [] #cycle thru each player that is currently available for player in avail_player_key: #build the API url for the unique player key url_player = base_query_url+'league/'+leagueI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_player_stats_from_game(team, year, week):", "def get_players_game_stats_for_season_for_week(self, season, week, season_type=\"REG\"):\n try:\n season = int(season)\n week = int(week)\n if season_type not in [\"REG\", \"PRE\", \"POST\"]:\n raise Value...
[ "0.85106057", "0.6774097", "0.67719406", "0.6636765", "0.6384417", "0.6382811", "0.6193241", "0.616072", "0.6121495", "0.60404086", "0.60138744", "0.59989476", "0.59980756", "0.5972492", "0.5948775", "0.58840317", "0.58802027", "0.5877149", "0.5872693", "0.58488315", "0.58389...
0.8211842
1
Build and display svg view for current tab.
def refresh_svg_canvas(self): if self.ui.tabWidget.currentIndex() == 0: self.ui.svg_canvas.build_schematic() self.ui.svg_canvas.viewport().update() elif self.ui.tabWidget.currentIndex() in (1,2): self.ui.svg_canvas.build_pcb() self.ui.svg_canvas.viewport().update() else: raise ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self, stats=[]):\n clear_output(wait=True)\n svg_html = self.to_html(stats)\n display(svg_html)", "def _repr_svg_(self):\n pass", "def _repr_svg_(self):\n if not IPythonConsole.ipython_useSVG:\n return None\n mol = self.owner.mol\n keku = IPy...
[ "0.62321585", "0.6213278", "0.6118039", "0.6118039", "0.6038661", "0.58348596", "0.58015627", "0.5744214", "0.5506525", "0.54956293", "0.5444143", "0.54360074", "0.54353726", "0.54283196", "0.5415451", "0.5410552", "0.53604287", "0.5355877", "0.5347241", "0.52882683", "0.5273...
0.68582183
0
Adds extra height to schematic body
def on_body_height_add(self, val): val = max(0, int(val)) self.mdl.cmp.s_add_height = val self.refresh_svg_canvas()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def footprint_height():", "def body_resize(self):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*...
[ "0.6295264", "0.61815864", "0.60334027", "0.60334027", "0.60334027", "0.60334027", "0.60334027", "0.60334027", "0.60334027", "0.60334027", "0.60334027", "0.60334027", "0.60334027", "0.5969041", "0.58549297", "0.57929575", "0.578066", "0.5753543", "0.5753543", "0.5753543", "0....
0.7480933
0
Adds extra width to schematic body
def on_body_width_add(self, val): val = max(0, int(val)) self.mdl.cmp.s_add_width = val self.refresh_svg_canvas()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extra_width(self) -> int:\n width = 0\n if self.box and self.show_edge:\n width += 2\n if self.box:\n width += len(self.columns) - 1\n return width", "def body_resize(self):", "def width(self):\n\t\tpass", "def width(self) -> int:", "def width(self) ->...
[ "0.6539015", "0.64924866", "0.60851705", "0.6076208", "0.6076208", "0.6055567", "0.6055567", "0.6055567", "0.6055567", "0.6055567", "0.6055567", "0.6055567", "0.6055567", "0.6055567", "0.6055567", "0.6055567", "0.5926316", "0.58366567", "0.5834761", "0.58082455", "0.5742201",...
0.7276638
0
Run figure's event loop while listening to interactive events. The events listed in event_names are passed to handler. This function is used to implement `.Figure.waitforbuttonpress`, `.Figure.ginput`, and `.Axes.clabel`.
def blocking_input_loop(figure, event_names, timeout, handler): if figure.canvas.manager: figure.show() # Ensure that the figure is shown if we are managing it. # Connect the events to the on_event function call. cids = [figure.canvas.mpl_connect(name, handler) for name in event_names] try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fig1_press(event):\n if event.key == 'n':\n if results.type is not None:\n print(\"Moving to next neuron\")\n callback.next_move = 'next'\n plt.close(fig1)\n else:\n print('Ensure type is set')\n\n if event.key == '...
[ "0.58663946", "0.5447554", "0.54228073", "0.53521365", "0.53415567", "0.5315508", "0.5248115", "0.52316606", "0.5220068", "0.5174886", "0.5119426", "0.51046586", "0.5099623", "0.5095802", "0.5055943", "0.503854", "0.5026388", "0.4981488", "0.49244776", "0.4902189", "0.4895454...
0.7370716
0
Calculates the perimeter given the bottom length, top length, 1st side length, and 2nd side length.
def perimeter(self): return self.sidelength1 + self.sidelength2 + self.baselength1 + self.baselength2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perimeter(self):\n return (\n self.side_1_length +\n self.side_2_length +\n self.side_3_length +\n self.side_4_length\n )", "def calculateperimeter(self):\r\n return (self.width * 2) + (self.height * 2)", "def perimeter(self):\n\t\treturn 2 *...
[ "0.73933774", "0.7245891", "0.720648", "0.7175091", "0.7159154", "0.7143771", "0.7052815", "0.6963846", "0.6854498", "0.6804715", "0.6780466", "0.6780466", "0.6722681", "0.6501043", "0.6399388", "0.63739026", "0.63721514", "0.6371612", "0.6364265", "0.63316923", "0.6298338", ...
0.76503986
0
labels with round numbers
def init_round_numbers(self): for round_num in range(1, 13): lbl_round_num = tk.Label(self.master, text=str(round_num), font='courier 10 bold', fg='green', pady=2) lbl_round_num.grid(row=round_num+1, column=0) row = 14 for trump ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autolabel(X_pos,values,height_lift):\r\n\theight= np.round(np.nan_to_num(values),2);y_pos = height_lift*height\r\n\tfor i in range(len(height)):\r\n\t\tax.text(X_pos[i],y_pos[i],'%4.2f' % height[i], ha='center', va='bottom',size=4)", "def getLabels(self):\n return self.numToLabel", "def label(self, marg...
[ "0.6358072", "0.635775", "0.6293751", "0.621447", "0.6207149", "0.62016577", "0.6130753", "0.61188644", "0.61017317", "0.60645777", "0.6025209", "0.60067993", "0.59946424", "0.5989236", "0.59892356", "0.597898", "0.597898", "0.597898", "0.59719455", "0.5968639", "0.59655595",...
0.65299755
0
command button that calculates scores
def init_button_calc(self): btn_calc = tk.Button(self.master, text='calculate', font='courier 10 bold', fg='purple', command=self.update_scores) btn_calc.grid(row=20, column=1, columnspan=3, sticky=tk.W+tk.E, pady=5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disp_score():", "def update_score():\n pass", "def enter_game_scores():\n pass", "def score(self):", "def update_score(self, engine, *args):\n #pdb.set_trace()\n self.score_label.text = \"Gold: {}/{}\".format(str(engine.score),\n ...
[ "0.695034", "0.676045", "0.66949934", "0.668477", "0.6502419", "0.649244", "0.64213395", "0.63838565", "0.62789667", "0.62286115", "0.6212426", "0.62090117", "0.61582416", "0.61512876", "0.6119021", "0.61164653", "0.61131734", "0.6094686", "0.60794663", "0.6069196", "0.605037...
0.6769738
1
calculate and display scores for each valid bid x trick pair
def update_scores(self): totals = [0, 0, 0, 0] for player in range(0, 4): for round_num in range(0, 17): try: bid = int(self.spin_bids[player][round_num].get()) tricks = int(self.spin_tricks[player][round_num].get()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disp_score():", "def resultat_match(self, binomes):\n for binome in binomes:\n while True:\n score_un = self.vue.entree_resultats(binome[0])\n score_deux = self.vue.entree_resultats(binome[1])\n if score_un + score_deux != 1:\n ...
[ "0.6550589", "0.64147127", "0.6227076", "0.60567015", "0.6029427", "0.6025697", "0.5990587", "0.5938982", "0.5932216", "0.59277326", "0.592605", "0.59216154", "0.5920696", "0.5903962", "0.58853215", "0.5872225", "0.5831863", "0.58293426", "0.5814984", "0.58139294", "0.581041"...
0.6524363
1
Connect to address and return the socket object. Convenience function. Connect to address (a 2tuple ``(host, port)``) and return the socket object. Passing the optional timeout parameter will set the timeout on the socket instance before attempting to connect. If no timeout is supplied, the
def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT): msg = "getaddrinfo returns an empty list" host, port = address for res in getaddrinfo(host, port, 0, SOCK_STREAM): af, socktype, proto, canonname, sa = res sock = None try: sock = socket(af, socktype, proto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(spec, timeout=None, nagle_off=True, cache=0,\n _cache=_connect_cache, _lock=_connect_cache_lock):\n # pylint: disable = W0102, R0912, R0915\n\n sock = None\n try:\n adi = None\n if cache > 0:\n _lock.acquire()\n try:\n if spec in _c...
[ "0.744305", "0.7351968", "0.71428746", "0.7093566", "0.69392675", "0.68707865", "0.6829429", "0.6805412", "0.67925763", "0.6737057", "0.6718961", "0.66749173", "0.6562161", "0.65577984", "0.65336025", "0.64614576", "0.6453029", "0.64274627", "0.6397214", "0.6356111", "0.63293...
0.73768765
1
Writes refl and exper files for each experiment modeled during the ensemble refiner
def write_output_files(Xopt, LMP, Modelers, SIM, params): opt_det = geometry_refiner.get_optimized_detector(Xopt, LMP, SIM) # Store the hessian of negative log likelihood for error estimation # must determine total number of refined Fhkls and then create a vector of 0's of that length num_fhkl_param = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _OpenOutputFiles(self):\n self.gfile = open(self.geomout, \"w\")\n self.efile = open(self.energyout, \"w\")\n self.PrintEnergyHeader()", "def write_data_model(doc_filename='data/documents.txt'):\n\n numiters = num_iters(doc_filename) + 1\n print 'number of iterations:', numiters - 1\n\n pic...
[ "0.5975395", "0.59592813", "0.58979046", "0.58952695", "0.5826259", "0.58093685", "0.58026266", "0.5795915", "0.57447165", "0.57213265", "0.57084817", "0.56667113", "0.56539685", "0.562931", "0.56153154", "0.5604128", "0.5590978", "0.5588866", "0.55703115", "0.55635935", "0.5...
0.62107396
0
Given a URL, try to return its associated region, bucket, and key names based on this object's endpoint info as well as all S3 endpoints given in the configuration.
def resolve_url_to_location(self, url): parsed_url = six.moves.urllib.parse.urlparse(url) if not parsed_url.scheme: parsed_url = six.moves.urllib.parse.urlparse('http://' + url) parsed_own_url = six.moves.urllib.parse.urlparse(self.endpoint) bucket, key = self.__match_path(pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_for_bucket(self, base_url, extra_configurations=None):\n\n warnings.warn(\n \"Use backend_config.bucket_config.BucketList.get_config_for_uri\",\n DeprecationWarning,\n )\n configs = S3BucketConfig.from_list(self.get(\"sdk.aws.s3.credentials\", []))\n ...
[ "0.6745669", "0.6435143", "0.62151855", "0.5942863", "0.59099114", "0.59099114", "0.5813266", "0.5788725", "0.5757353", "0.5635177", "0.56279933", "0.5561384", "0.55386037", "0.55036676", "0.5499892", "0.54674625", "0.54305124", "0.54026806", "0.5393976", "0.53860795", "0.536...
0.78750426
0
construct the P_kd (kappaDelta) matrix such that kappa = P_kd Delta equivalent to equation 31 & 32 in Simon 2009, using Delta = delta/a as in Hu and Keeton 2003
def construct_P_kd(N1,N2,z_kappa,z_Delta, cosmo=None,**kwargs): if cosmo==None: cosmo = Cosmology(**kwargs) Nj = len(z_kappa) Nk = len(z_Delta) if max(z_Delta) > max(z_kappa): print "-------" print "WARNING: construct_P_kd: singular matrix [ min(z_kappa) < min...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_kappa(D):\n\n return -0.5*D*np.log(2*np.pi) + 0.5*np.log(D*np.pi) - 1", "def em_epsilon_cdp(epsilon, delta, k):\n if delta <= 0:\n return epsilon / k\n else:\n log_delta = np.log(1 / delta)\n return max(\n epsilon / k,\n np.sqrt((8 * log_delta + 8 * epsilon) / k) -\n n...
[ "0.6006358", "0.5726812", "0.5607486", "0.55964506", "0.5561811", "0.55442095", "0.5524946", "0.5505259", "0.5502432", "0.54426163", "0.537911", "0.5328839", "0.5327884", "0.53229845", "0.53121215", "0.53063035", "0.530413", "0.52961487", "0.52916247", "0.52867043", "0.528461...
0.67988276
0
Show that basic numpy operations with Column behave sensibly
def test_numpy_ops(self): arr = np.array([1, 2, 3]) c = Column('a', arr) eq = c == arr assert np.all(eq) assert len(eq) == 3 assert type(eq) == Column assert eq.dtype.str == '|b1' eq = arr == c assert np.all(eq) lt = c - 1 < arr a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getattr__(self, col):\n return self._obj[col].to_numpy()", "def _modify_columns(self, cols, X, y=None):", "def _create_metric_column(\n data: pd.DataFrame,\n column_a: str,\n column_b: str,\n numpy_method: str,\n conjunction: str,\n) -> pd.DataFrame:\n column_operation = getattr(...
[ "0.6132716", "0.5897211", "0.57506585", "0.57329494", "0.5698936", "0.5586861", "0.55237365", "0.548468", "0.54814553", "0.5479346", "0.5474814", "0.54733694", "0.5452359", "0.54214543", "0.54059917", "0.54054594", "0.53947806", "0.53844583", "0.53784984", "0.5374963", "0.537...
0.70421773
0
Method to create embedddings for documents by encoding their image.
def encode( self, docs: Optional[DocumentArray] = None, parameters: dict = {}, *args, **kwargs, ) -> None: if not docs: return batch_generator = docs.batch( traversal_paths=parameters.get('traversal_paths', self.traversal_paths), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_image_embeddings(self):\n inception_output = image_embedding.inception_v3(\n self.images,\n trainable=self.train_inception,\n is_training=self.is_training())\n\n # Map inception output onto embedding space.\n with tf.variable_scope(\"image_embedding\") as scope:\n image...
[ "0.5972184", "0.5909413", "0.5838329", "0.5812766", "0.5676898", "0.566756", "0.56353486", "0.5634795", "0.5614541", "0.560931", "0.55710936", "0.5562259", "0.5523897", "0.5518542", "0.5506819", "0.5501866", "0.54833275", "0.54608405", "0.5443685", "0.5399601", "0.5336045", ...
0.6467108
0
Test that the digits are classified correctly by a classifier.
def __test_digits(self, X, y, clf): self.assertEqual(len(X), len(y)) correct = 0 for i in xrange(len(y)): expected = y[i] prediction = clf.classify([X[i]])[0] if expected == prediction: correct += 1 self.assertGreaterEqual(correct, sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_classify(self):\n classifiers, estimates =\\\n ada_boost.train_dataset(self.larger_matrix,\n self.larger_class_labels,\n 9)\n data_to_classify = [1, 0.5]\n classifications = ada_boost.classify(data_to_cla...
[ "0.6504808", "0.6338742", "0.63143575", "0.62959284", "0.62814325", "0.62447387", "0.61741614", "0.61499375", "0.61478704", "0.61478704", "0.6142268", "0.61027217", "0.6074408", "0.6066596", "0.60418713", "0.60381013", "0.603409", "0.6030845", "0.6029761", "0.6024929", "0.601...
0.7913877
0
Load training data from digits.png
def load_digits(cls): gray = cls.imgfile_to_grayscale(cls.DIGITS_FILE) # Now we split the image to 5000 cells, each 20x20 size cells = [np.hsplit(row, 100) for row in np.vsplit(gray, 50)] # Make it into a Numpy array. It size will be (50,100,20,20) x = np.array(cells) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_digits():\n \n images, target = [], []\n for image_file in digit_image_filenames:\n image = cv2.imread(image_file)\n if image is None:\n raise RuntimeError(\"Failed to read the image file '{}'\".format(\n image_file))\n image = cv2.cvtColor(image, cv...
[ "0.708967", "0.6994615", "0.6965878", "0.6935963", "0.6672894", "0.66682076", "0.65903187", "0.6515253", "0.64869475", "0.64020413", "0.6389433", "0.6385904", "0.63520086", "0.63297844", "0.632445", "0.632055", "0.63086367", "0.62679493", "0.6263167", "0.6256531", "0.6240129"...
0.7322466
0
Using the public method mount to test _get_drive_mount_point_name
def test_get_drive_mount_point_name_unique_id_None(self): try: tmpdir = mkdtemp() root = os.path.join(tmpdir, 'mnt/gluster-object') drive = 'test' _init_mock_variables(tmpdir) gfs._allow_mount_per_server = True self.assertTrue(gfs.mount...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_googledrive_mounting_point():\n return None", "def test_get_drive_mount_point_name_unique_id_exists(self):\n try:\n tmpdir = mkdtemp()\n root = os.path.join(tmpdir, 'mnt/gluster-object')\n drive = 'test'\n\n _init_mock_variables(tmpdir)\n ...
[ "0.71002924", "0.6954491", "0.6827536", "0.6759451", "0.6704294", "0.66067576", "0.64347553", "0.6420853", "0.63291794", "0.63125104", "0.6307517", "0.62765527", "0.62722826", "0.6255401", "0.61517626", "0.61497533", "0.6133829", "0.6132875", "0.6093856", "0.6090868", "0.6059...
0.75672483
0
Using the public method mount to test _get_drive_mount_point_name and the _unique_id is already defined
def test_get_drive_mount_point_name_unique_id_exists(self): try: tmpdir = mkdtemp() root = os.path.join(tmpdir, 'mnt/gluster-object') drive = 'test' _init_mock_variables(tmpdir) gfs._allow_mount_per_server = True gfs._unique_id = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_drive_mount_point_name_unique_id_None(self):\n try:\n tmpdir = mkdtemp()\n root = os.path.join(tmpdir, 'mnt/gluster-object')\n drive = 'test'\n\n _init_mock_variables(tmpdir)\n gfs._allow_mount_per_server = True\n self.assertT...
[ "0.8202178", "0.71788365", "0.69768405", "0.67600346", "0.659675", "0.6513326", "0.6325042", "0.62535024", "0.62465084", "0.62291175", "0.61986035", "0.61748713", "0.6147795", "0.61267954", "0.6116906", "0.6063496", "0.6041668", "0.6027162", "0.6020935", "0.6009902", "0.60019...
0.7969075
1
lees de keyboard definities uit het/de settings file(s) van het tool zelf en geef ze terug voor schrijven naar het csv bestand
def buildcsv(settnames, page, showinfo=True): shortcuts = collections.OrderedDict() fdesc = ("File containing keymappings", "File containing command descriptions") ## pdb.set_trace() for ix, name in enumerate(settnames): try: initial = page.settings[name] except KeyError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataSave():\n # NR5G = gui_reader()\n try: #Python3\n f = open(__file__ + \".csv\",'wt', encoding='utf-8')\n except:\n f = open(__file__ + \".csv\",'wb')\n f.write('%s,'%(entryCol.entry0.get()))\n f.write('%s,'%(entryCol.entry1.get()))\n f.write('%s,'%(entryCol.entry2.get()))\n ...
[ "0.58790845", "0.57085", "0.56216234", "0.5558641", "0.5554129", "0.5521753", "0.54928106", "0.54494387", "0.54430705", "0.54299235", "0.5418328", "0.54119194", "0.5343505", "0.5333444", "0.532513", "0.53054166", "0.53034294", "0.5302163", "0.5286992", "0.52804625", "0.528005...
0.63631856
0
Returns the graph complement of G.
def complement(G): R = G.__class__() R.add_nodes_from(G) R.add_edges_from(((n, n2) for n, nbrs in G.adjacency() for n2 in G if n2 not in nbrs if n != n2)) return R
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complement(G):\n\n nset = set(G.nodes())\n n_nodes = G.order()\n n_edges = n_nodes * (n_nodes - 1) - G.size() + 1\n \n cmp_edges = ((u, v) for u in G.nodes()\n\t\t for v in nset - set(G.successors(u)))\n deg = make_deg(n_nodes, cmp_edges)\n cmp_edges = ((u, v) for u in G.nodes()\n\t\t ...
[ "0.8520391", "0.64977443", "0.64359856", "0.6389732", "0.6337305", "0.62457705", "0.6208965", "0.60704297", "0.60221344", "0.59848946", "0.5968795", "0.5959875", "0.59059066", "0.589863", "0.5895703", "0.5880331", "0.5879972", "0.58771133", "0.58479995", "0.58314204", "0.5827...
0.8689336
0
Returns the reverse directed graph of G.
def reverse(G, copy=True): if not G.is_directed(): raise nx.NetworkXError("Cannot reverse an undirected graph.") else: return G.reverse(copy=copy)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reversed_graph(directed_graph):\n\n reversed = directed_graph.__class__()\n for i in directed_graph.get_vertices().keys():\n reversed.add_vertex(i)\n\n for i in directed_graph.get_vertices().keys():\n vertex = directed_graph.get_vertex(i)\n for j in vertex.get_heads():\n ...
[ "0.7581556", "0.75628114", "0.7346692", "0.70150614", "0.6863429", "0.65913934", "0.64809585", "0.64787996", "0.643853", "0.63429785", "0.6326808", "0.62946874", "0.62814265", "0.627383", "0.62476474", "0.61388195", "0.6093543", "0.60812247", "0.6077702", "0.60706794", "0.605...
0.83771706
0
Reads an INIfile containing domain type definitions and fills them into a TypeDefsobject.
def readDomainTypes(self, domainTypeFilePath): result = TypeDefs() inifile = IniFile(domainTypeFilePath) for section in inifile.getSections(): if section.endswith("(n)"): td = TypeDef(section[:-3], withLength = True) else: td = TypeDef(sect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_domain(self, domainfile):\n\n with open(domainfile) as dfile:\n dfile_array = self._get_file_as_array(dfile)\n #Deal with front/end define, problem, :domain\n if dfile_array[0:4] != ['(', 'define', '(', 'domain']:\n print('PARSING ERROR: Expected (define (domain ... at start of domain ...
[ "0.5692447", "0.56770426", "0.55325735", "0.5285232", "0.50543946", "0.4953483", "0.4840075", "0.48231658", "0.48218992", "0.4821366", "0.47643015", "0.47455364", "0.4673499", "0.4642409", "0.46207514", "0.46002218", "0.4586546", "0.4583959", "0.45795232", "0.4578879", "0.455...
0.7333319
0
write spec back to directory, (if dir not specified is default spec dir)
def writeSpec(self,dir=""): for codestruct in self.codestructures: codestruct.writeSpec(dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_change_dir_to_file(self):\n dir0, dir1 = self.make_temp_dirs(2)\n self.write_dir(dir0, \"foo\")\n self.sync_all()\n self.assertDirPresent(dir0, \"foo\")\n self.assertDirPresent(dir1, \"foo\")\n\n self.delete_dir(dir0, \"foo\")\n self.write_file(dir0, \"foo\...
[ "0.59088475", "0.5767855", "0.56413054", "0.54185474", "0.53972125", "0.5375559", "0.5354217", "0.5278695", "0.5238211", "0.52255595", "0.5221744", "0.5195567", "0.5194306", "0.5183714", "0.51730597", "0.5154644", "0.51394916", "0.51373714", "0.5113076", "0.5090471", "0.50892...
0.658977
0
read spec code and populate codestructures
def processSpecs(self): specSubDirName="_spec" codestructure = CodeStructure() for dir in self._dirs: if q.system.fs.exists(q.system.fs.joinPaths(dir,specSubDirName)): files=q.system.fs.listPyScriptsInDir(q.system.fs.joinPaths(dir,specSubDirName)) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processSourceCode(self):\n specSubDirName=\"\"\n codestructure = CodeStructure() \n for dir in self._dirs:\n if q.system.fs.exists(q.system.fs.joinPaths(dir,specSubDirName)): \n files=q.system.fs.listPyScriptsInDir(q.system.fs.joinPaths(dir,specSubD...
[ "0.6069532", "0.602706", "0.5843338", "0.5768507", "0.5756641", "0.571061", "0.5692741", "0.5651732", "0.55933094", "0.5569754", "0.5564679", "0.5557777", "0.5535603", "0.54826546", "0.5445141", "0.5437613", "0.5425164", "0.535459", "0.53148675", "0.529252", "0.5287907", "0...
0.65098464
0
If the flow in the pipe is laminar, you can use the Poiseuille Equation to calculate the flow rate mu = 0.001 @ 25 degrees C Q = (pi (D4) delta_p) / (128 mu pipe_length)
def pois_metric(pipe_diameter, delta_p, pipe_length): mu = 0.001 # water @ 25 degrees C pois = mu * 10 flow_rate_lam = (math.pi * (pipe_diameter ** 4) * delta_p) / (128 * pois * pipe_length) return flow_rate_lam
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bern_metric(pipe_diameter, delta_p, pipe_length):\n fr_c = 0.003 # assuming Reynolds number is 10**5 and pipe material is smooth copper\n fr_reyn = 0.046 / (reynolds_num(pipe_diameter, delta_p, pipe_length) ** 0.2) # Taitel and Dukler approximation\n rho = 1000 # density of water @ 4 deg celsius (k...
[ "0.64306885", "0.6375345", "0.6155883", "0.6086178", "0.5807599", "0.57985467", "0.5757301", "0.5742598", "0.57329386", "0.57231694", "0.5673357", "0.56649464", "0.56552863", "0.55984855", "0.5589797", "0.55843973", "0.55824184", "0.5581834", "0.55515593", "0.5546592", "0.554...
0.7763178
0
Create a Plotly Dash 'A' element that downloads a file from the app.
def file_download_link(filename): location = f"/{UPLOAD_DIRECTORY}/{filename}" return html.A(filename, href=location)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_download_link(filename):\n location = \"/download/{}\".format(urlquote(filename))\n return html.A(filename, href=location)", "def download_link(request, job_id, filename):\n template_values = remote_view_util.fill_job_values(request, job_id)\n template_values = remote_view_util.fill_template...
[ "0.6015341", "0.56226736", "0.55951804", "0.552248", "0.5511452", "0.5382601", "0.53783137", "0.53105325", "0.5288451", "0.52870387", "0.5222768", "0.5213722", "0.5212254", "0.5193048", "0.5184498", "0.5182813", "0.51763964", "0.51701194", "0.5161087", "0.5158966", "0.515461"...
0.61712605
0
Locate the value for a grounded node and its parents in a rule set, return 1 if not found. For functors with binary ranges, when all parents match but child's value does not, return 1prob for other value.
def ruleMatch (ruleSet, node, parents): def getProb (node): for rule in ruleSet: #print rule if (rule.child.eq(node) and len(rule.parentList)==len(parents) and all([n[0].eq(n[1]) for n in zip(rule.parentList,parents)])): #print "winning...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getValue(self):\n r = 1 if self.left.getValue() <= self.right.getValue() else 0\n return r", "def find(self, node):\n if not node:\n return 0\n\n left = self.find(node.left)\n right = self.find(node.right)\n cur = 1 # node.val\n path = 1\n i...
[ "0.5753097", "0.5747222", "0.57390654", "0.57036936", "0.56338394", "0.55915225", "0.5584634", "0.5555824", "0.5537557", "0.5537557", "0.5511906", "0.54953927", "0.5484709", "0.5481439", "0.5480224", "0.5455876", "0.5380829", "0.53786016", "0.53774273", "0.537409", "0.5355800...
0.62124074
0
Return default uniform distribution for the range of a functor
def default(functor): return 1.0/functorRangeSize(functor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _uniform(val_range):\r\n return np.random.uniform(val_range[0], val_range[1])", "def initializeDistribution(self):\n self.minVal = min(math.exp(self.upperBound),math.exp(self.lowerBound))\n self.maxVal = max(math.exp(self.upperBound),math.exp(self.lowerBound))", "def glorot_uniform(seed=None):\n ...
[ "0.67329484", "0.63917905", "0.634777", "0.63349366", "0.61998284", "0.61475074", "0.61413395", "0.6124729", "0.6119773", "0.61055756", "0.6086929", "0.6079064", "0.60665655", "0.6043183", "0.6039257", "0.5985008", "0.5984233", "0.59805816", "0.59690744", "0.59467566", "0.594...
0.7167602
0
Look up the range for a functor
def functorRange(functor): for (name, range) in functorRangeList: if functor == name: return range else: raise Exception ("Functor " + functor + " not present in range list")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _in_range_op(spec):", "def _range_func(self, withscores, score_cast_func, decode_value_func=lambda x: x):\n if withscores:\n return lambda score_member: (decode_value_func(score_member[1]), score_cast_func(self._encode(score_member[0]))) # noqa\n else:\n return lambda sco...
[ "0.68109703", "0.63385564", "0.6327256", "0.6227952", "0.62047696", "0.61920094", "0.61834943", "0.6165325", "0.6165325", "0.61133087", "0.61056334", "0.6076185", "0.60739946", "0.60496026", "0.6020257", "0.60012704", "0.6000408", "0.5993944", "0.5981103", "0.5969238", "0.591...
0.839487
0
Return cardinality of range for a functor
def functorRangeSize(functor): return len(functorRange(functor))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cardinality(self):\n estimate = self._alpha * math.pow(self._m, 2) / sum(math.pow(2, -x) for x in self._registers)\n\n if estimate <= 2.5 * self._m:\n # get number of registers equal to zero\n empty_registers = self._registers.count(0)\n if empty_registers != 0:\n...
[ "0.6364935", "0.6203069", "0.6184483", "0.6088533", "0.5999436", "0.5949017", "0.5914987", "0.5850817", "0.5838362", "0.58077663", "0.57850456", "0.56294644", "0.55813044", "0.5576867", "0.5546719", "0.55258554", "0.55099475", "0.5464677", "0.5460476", "0.54486597", "0.543011...
0.799879
0
For functors with a binary range, return the other element
def functorOtherValue(functor, val): range = functorRange(functor) assert len(range) == 2 if val == range[0]: return range[1] else: return range[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def functorRange(functor):\n for (name, range) in functorRangeList:\n if functor == name:\n return range\n else:\n raise Exception (\"Functor \" + functor + \" not present in range list\")", "def ranges(self, predicate):\n\n x = np.zeros(len(self)).astype(np.bool)\n f...
[ "0.6828715", "0.6507789", "0.62094086", "0.6026386", "0.5969396", "0.5849859", "0.5836691", "0.58243334", "0.57149607", "0.5674531", "0.5671843", "0.56514573", "0.56158537", "0.56145406", "0.55590016", "0.55359095", "0.5534223", "0.5493425", "0.54904515", "0.5454143", "0.5448...
0.75341356
0
Return the atoms, derived from the first entry in the joint probability table
def atomList(joints): assert len(joints) > 0 first = joints[0] functorList = first[1][:-2] # Second element of row, last two elements of that are joint prob and log prob atomList = [] for (node,_) in functorList: atomList.append(node.functor+"("+",".join(node.varList)+")") return atomLis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jointProbabilities(constants, db, ruleList, bn):\n vars = bn.variableList()\n combs = generateCombos(vars, constants)\n joints = []\n for grounding in combs:\n joints.append((grounding, bn.jointProbs(grounding, db, ruleList)))\n return (vars, atomList(joints), joints)", "def enumerate_j...
[ "0.594754", "0.5753266", "0.57007027", "0.5424559", "0.539321", "0.5265403", "0.52582085", "0.52560824", "0.5244419", "0.5229816", "0.5205455", "0.51626754", "0.51596713", "0.5148809", "0.51186013", "0.51104856", "0.51007", "0.50988847", "0.50907356", "0.5085001", "0.50847787...
0.63074166
0
Compute the joint probabilities for all combinations of values
def jointProbabilities(constants, db, ruleList, bn): vars = bn.variableList() combs = generateCombos(vars, constants) joints = [] for grounding in combs: joints.append((grounding, bn.jointProbs(grounding, db, ruleList))) return (vars, atomList(joints), joints)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def joint_proba(self, X):\n return self.weights * self._bernoulli(X)", "def joint_prob(network, assignment):\n prob = 1\n for a_key in assignment:\n conditions = []\n current = network[a_key]\n for parent in current['Parents']:\n conditions.append(True) if assignment[...
[ "0.6887764", "0.6807377", "0.6577042", "0.6448017", "0.64271957", "0.6388704", "0.621264", "0.61288685", "0.6084318", "0.60133076", "0.59769166", "0.59629256", "0.5954798", "0.5925714", "0.5911252", "0.5900835", "0.5882425", "0.5880176", "0.5865823", "0.5850093", "0.580452", ...
0.6838733
1
Generate all possible groundings (assignments of constants to variables)
def generateCombos(vars,constants): # SUPER NOT GENERALIZED---TOO LATE AT NIGHT FOR ME TO DO RECURSIVE ALGORITHMS assert len(vars) == 2 and len(constants) == 2 combs = [] for c1 in constants: for c2 in constants: combs.append(Grounding([(vars[0], c1), (vars[1], c2)])) return comb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ground_operator(self, op_name):\n op = self.domain.operators[op_name]\n self._set_operator_groundspace( op_name, op.variable_list.items() )\n for ground in self._instantiate( op_name ):\n # print('grounded', ground)\n st = dict(ground)\n gop = Operator(op_n...
[ "0.586086", "0.5699041", "0.5360215", "0.53582025", "0.53362375", "0.53046995", "0.5301871", "0.52834463", "0.521038", "0.51668525", "0.5156945", "0.51415384", "0.5131329", "0.51303786", "0.51272744", "0.51083404", "0.51081413", "0.5107868", "0.50947726", "0.5074924", "0.5066...
0.62475884
0
` Given a joint probability table, format it for LaTeX. This function will have to be tailored for every paper. This function simply generates the {tabular} part of the table. The prologue and epilogue, including the caption and label, must be specified in the including file.
def formatJointTableForLaTeX(joints): (varList, atoms, probs) = joints cols = len(varList) + len (probs[0][1]) with open("table1.tex","w") as out: out.write ("\\begin{tabular}{|" + "|".join(["c"]*(cols-2))+"||c|c|}\n") out.write ("\\hline\n") # Table header out.write (" & ".j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_latex_table(true_hmm, sampled_hmm_list, conf=0.95, dt=1, time_unit='ms', obs_name='force', obs_units='pN', outfile=None):\n\n # confidence interval\n for sampled_hmm in sampled_hmm_list:\n sampled_hmm.set_confidence(conf)\n # dt\n dt = float(dt)\n # nstates\n nstates = sampled...
[ "0.6535216", "0.6499372", "0.6494908", "0.6360739", "0.6058271", "0.605461", "0.60403585", "0.6008605", "0.59048015", "0.5904452", "0.59012544", "0.5884655", "0.58371955", "0.5809221", "0.5790608", "0.57705444", "0.576766", "0.57066625", "0.5678048", "0.56749755", "0.5656739"...
0.8194145
0
Take replay file that was uploaded to ObjectStore and process data and store it to database and link to account
async def parse_replay(request, game): game = game.lower() replay_file = request.files.get("replay") if replay_file: if game == STARCRAFT: basic, result = await SC2Replay.process_replay(replay_file, request.args.get("load_map", False)) if result: # Lets creat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_to_restore(file_name, data):\n urlfetch.fetch(url=config.RESTORE_URL + '?name=' + file_name + '&source=db&packet',\n payload=urllib.urlencode({\"data\": services.event.entity_to_string(data)}),\n method=urlfetch.POST)", "def transfer(file_obj):", "def post_origin...
[ "0.59654164", "0.5942923", "0.58948725", "0.58847404", "0.5826352", "0.57525676", "0.5647753", "0.56387746", "0.5543896", "0.55360585", "0.5521623", "0.5506403", "0.5493576", "0.5484211", "0.54712117", "0.54331356", "0.5429796", "0.53877634", "0.5359096", "0.5353566", "0.5341...
0.62600714
0
_execute_ map the request name provided to an ID
def execute(self, requestName, conn = None, trans = False): self.sql = "SELECT request_id from reqmgr_request WHERE " self.sql += "request_name=:request_name" binds = {"request_name": requestName} reqID = self.dbi.processData(self.sql, binds, conn = conn, transaction = trans) res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _execute(self, _):\r\n pass", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):"...
[ "0.55304587", "0.5463426", "0.5463426", "0.5463426", "0.5463426", "0.5463426", "0.5463426", "0.5463426", "0.5463426", "0.5463426", "0.5463426", "0.5463426", "0.5463426", "0.5370444", "0.5351898", "0.53309184", "0.5321808", "0.5240275", "0.5239346", "0.52391875", "0.52137643",...
0.5936447
0
Use float16 for faster IO during training.
def save_float16_npy(data, path): np.save(path, data.astype(np.float16))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_use_bfloat16(configs, use_bfloat16):\n configs[\"train_config\"].use_bfloat16 = use_bfloat16", "def data_type():\n if FLAGS.use_fp16:\n return tf.float16\n else:\n return tf.float32", "def data_type():\n if FLAGS.use_fp16:\n return tf.float16\n else:\n return tf.float32...
[ "0.69121385", "0.65502363", "0.65130097", "0.647946", "0.6455792", "0.6408274", "0.63850254", "0.6354032", "0.63375044", "0.63351613", "0.6293508", "0.62589705", "0.6142071", "0.6129017", "0.60476065", "0.6029137", "0.59642065", "0.59619236", "0.5940161", "0.5863883", "0.5842...
0.7207755
0
Return if Persona object passed into args is in defaul componenti propperty
def has_componente(self, persona): return True if persona.pk in self.pks_componenti else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def XCAFDoc_ShapeTool_IsComponent(*args):\n return _XCAFDoc.XCAFDoc_ShapeTool_IsComponent(*args)", "def IsComponent(*args):\n return _XCAFDoc.XCAFDoc_ShapeTool_IsComponent(*args)", "def __contains__(self, arg):\r\n\r\n return arg in self.grfx[0]", "def particleExists(*args, **kwargs)->bool:\n p...
[ "0.6626677", "0.6543731", "0.6026395", "0.60095984", "0.59585935", "0.5927557", "0.5893944", "0.5893944", "0.58926296", "0.5830509", "0.5820323", "0.57275677", "0.5694341", "0.56732976", "0.5672737", "0.5656124", "0.5637087", "0.5625537", "0.5621446", "0.5609848", "0.5569029"...
0.71104115
0
If an bundle is for native iOS, it has these properties in the Info.plist
def is_info_plist_native(plist): return ( 'CFBundleSupportedPlatforms' in plist and 'iPhoneOS' in plist['CFBundleSupportedPlatforms'] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ios_app_info(self) -> Optional[pulumi.Input['IosAppInfoArgs']]:\n return pulumi.get(self, \"ios_app_info\")", "def system_properties(self):\r\n return dict(self._get_system_properties(self.java))", "def ios_app_info(self) -> 'outputs.IosAppInfoResponse':\n return pulumi.get(self, \"ios_app...
[ "0.550685", "0.5398409", "0.5094902", "0.5077413", "0.5070626", "0.505988", "0.5054438", "0.49296305", "0.49282697", "0.48895228", "0.48720244", "0.48373243", "0.48084444", "0.48046267", "0.4804201", "0.47875956", "0.47442275", "0.47442275", "0.47250745", "0.4656228", "0.4646...
0.6288776
0
Sign all the dylibs in this directory
def sign_dylibs(self, signer, path): for dylib_path in glob.glob(join(path, '*.dylib')): dylib = signable.Dylib(self, dylib_path, signer) dylib.sign(self, signer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_dylibs(self, cms_signer, path):\n for dylib_path in glob.glob(join(path, '*.dylib')):\n dylib = signable.Dylib(self, dylib_path, cms_signer)\n dylib.sign(self, cms_signer)", "def sign(self, signer):\n # log.debug(\"SIGNING: %s\" % self.path)\n frameworks_path =...
[ "0.8432315", "0.6325134", "0.59998757", "0.5821335", "0.5536926", "0.5455998", "0.53087306", "0.51840645", "0.5171187", "0.5158678", "0.5043617", "0.4983382", "0.49256852", "0.4905008", "0.48366326", "0.48080102", "0.47965342", "0.47516686", "0.47421157", "0.47248307", "0.470...
0.8295412
1
Sign everything in this bundle, recursively with subbundles
def sign(self, signer): # log.debug("SIGNING: %s" % self.path) frameworks_path = join(self.path, 'Frameworks') if exists(frameworks_path): # log.debug("SIGNING FRAMEWORKS: %s" % frameworks_path) # sign all the frameworks for framework_name in os.listdir(framew...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resign(self, deep, cms_signer, provisioner):\n # log.debug(\"SIGNING: %s\" % self.path)\n if deep:\n plugins_path = join(self.path, 'PlugIns')\n if exists(plugins_path):\n # sign the appex executables\n appex_paths = glob.glob(join(plugins_path,...
[ "0.5995381", "0.5584379", "0.55598193", "0.55531466", "0.55146366", "0.54876906", "0.52974087", "0.52845377", "0.5166314", "0.51473546", "0.5102368", "0.50621337", "0.50598043", "0.5002848", "0.49882516", "0.49192393", "0.4897663", "0.48194253", "0.48167092", "0.48128116", "0...
0.59542173
1
signs bundle, modifies in place
def resign(self, signer): self.sign(signer) log.debug("Resigned bundle at <%s>", self.path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign(self, object):\n pass", "def sign(self, payload):\n raise NotImplementedError", "def _re_codesign(app_path, signing_identity, provision_path=None):\n bundle_type = PackageType.get_type(app_path)\n logger.debug('Re-codesigning %s...' % (bundle_type,))\n if bundle_type == PackageT...
[ "0.6849241", "0.65445966", "0.6377147", "0.6371257", "0.63314426", "0.6310475", "0.62609345", "0.61872184", "0.61623085", "0.6129731", "0.61247724", "0.607729", "0.6056486", "0.60021913", "0.59386194", "0.59081775", "0.58716357", "0.5862046", "0.5852787", "0.58021504", "0.577...
0.66369
1
Given a path to a provisioning profile, return the entitlements encoded therein
def extract_entitlements(provision_path): cmd = [ 'smime', '-inform', 'der', '-verify', # verifies content, prints verification status to STDERR, # outputs content to STDOUT. In our case, will be an XML plist '-noverify', # accept se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resign(self, signer, provisioning_profile, alternate_entitlements_path=None):\n\n # TODO all this mucking about with entitlements feels wrong. The entitlements_path is\n # not actually functional, it's just a way of passing it to later stages of signing.\n # Maybe we should determine entit...
[ "0.5083228", "0.49126115", "0.49077302", "0.47404766", "0.4691661", "0.4553458", "0.454329", "0.4531003", "0.4473628", "0.44085193", "0.4406375", "0.44050503", "0.439604", "0.43790016", "0.43628758", "0.4326153", "0.43213052", "0.43070796", "0.43030575", "0.42926168", "0.4262...
0.7646078
0
Write entitlements to self.entitlements_path. This actually doesn't matter to the app, it's just used later on by other parts of the signing process.
def write_entitlements(self, entitlements): biplist.writePlist(entitlements, self.entitlements_path, binary=False) log.debug("wrote Entitlements to {0}".format(self.entitlements_path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entitlements(self) -> Entitlements:\n return self.__entitlements", "def resign(self, signer, provisioning_profile, alternate_entitlements_path=None):\n\n # TODO all this mucking about with entitlements feels wrong. The entitlements_path is\n # not actually functional, it's just a way of ...
[ "0.54211116", "0.5367477", "0.51338154", "0.51240337", "0.50888306", "0.508606", "0.4937517", "0.48715833", "0.48602337", "0.48598403", "0.48598403", "0.4844882", "0.48447084", "0.4842885", "0.48324612", "0.48164335", "0.47696745", "0.4747149", "0.4736882", "0.46891227", "0.4...
0.7737914
0
this function shows the log in window
def log_in(self): self.clear_screen() lbl_log_in = Label(self.root, text="Welcome. Please log in to the system.", font=self.title_font, bg=self.bg_color) lbl_log_in.pack(pady=5, padx=10) user_name = Label(self.root, text="ente...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_in(self):\n\t\tpass", "def show(self, window):\r\n\r\n return", "def iniciaUI(self):\n\n self.setGeometry(100,100, 250, 250)\n self.setWindowTitle(\"Login\")\n self.displayWidgets()\n\n self.show()", "def OnShowLog(self, event):\n dlg = LogViewer(self)\n ...
[ "0.6801101", "0.6755017", "0.6737144", "0.66676944", "0.65847325", "0.6565406", "0.655964", "0.64743286", "0.6425789", "0.64248353", "0.6400713", "0.63787353", "0.6243237", "0.624312", "0.62406", "0.62182665", "0.62177074", "0.6210246", "0.61971325", "0.61968756", "0.61666393...
0.685493
0