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
Reveals the private key corresponding to litecoinaddress.
def dump_priv_key(litecoinaddress): try: priv_key = subprocess.check_output(["litecoin-cli", "dumpprivkey", litecoinaddress]) except: sys.exit(1) return priv_key.decode().strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_private_key(self, address58: str) -> 'EllipticCurvePrivateKey':\n return self.keys[address58]", "def dumpprivkey(self, address):\n return self.proxy.dumpprivkey(address)", "def reveal_seed():\n password = getpass.getpass('Password from keystore: ') # Prompt the user for a password of ...
[ "0.6961094", "0.6365756", "0.6230684", "0.61852604", "0.5968992", "0.5968992", "0.5943675", "0.5938039", "0.59248424", "0.5831797", "0.57986903", "0.57368493", "0.5643614", "0.5639946", "0.5611929", "0.558766", "0.55717415", "0.5564377", "0.5564377", "0.553494", "0.553494", ...
0.71057236
0
Returns a list of addresses for the given account.
def get_addresses_by_account(account): try: stdout = subprocess.check_output(["litecoin-cli", "getaddressesbyaccount", account]) addresses = json.loads(stdout.decode()) except: sys.exit(1) return addresses
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getaddressesbyaccount(self, account):\n return self.proxy.getaddressesbyaccount(account)", "def accounts_with_address(self):\n return [account for account in self if account.address]", "def getaccountaddress(self, account):\n return self.proxy.getaccountaddress(account)", "def list_a...
[ "0.8937768", "0.7442948", "0.7099244", "0.6783226", "0.6726622", "0.6665919", "0.6604184", "0.6604184", "0.6604184", "0.6463638", "0.6349946", "0.6319422", "0.6245362", "0.6193754", "0.61181873", "0.61067754", "0.60989714", "0.60827", "0.6078392", "0.6055826", "0.6038597", ...
0.8252917
1
Returns the balance for litecoinaddress
def get_address_balance(litecoinaddress): total_balance = 0 unspent = list_unspent(litecoinaddress) for block in unspent: total_balance += float(block["amount"]) return total_balance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_balance(self, address):\n balance = 0\n for block in self.chain:\n for t in block['transactions']:\n if t['recipient'] == address:\n balance += t['amount']\n elif t['sender'] == address:\n balance -= t['amount']\n ...
[ "0.7711186", "0.7699477", "0.7616533", "0.72856987", "0.7274785", "0.7060863", "0.6971426", "0.6923127", "0.6680456", "0.6627595", "0.66212493", "0.6599131", "0.659477", "0.6551434", "0.65255404", "0.65177476", "0.6513604", "0.65034276", "0.64847016", "0.6483719", "0.63952076...
0.8466337
0
Withdraws ammount from 'from_address' and sends it to 'to_address' Returns the transaction ID if successful
def withdraw_from_address(amount, network_fee, from_address, to_address): tx_total = amount + network_fee address_balance = get_address_balance(from_address) if tx_total > address_balance: # return not enough funds error print("Error: Not enough funds") else: tx_hex_string = cre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def withdraw_from_account(amount, from_account, to_address, min_conf=1):\n amount = str(amount)\n min_conf = str(min_conf)\n \n try:\n txid = subprocess.check_output([\"litecoin-cli\", \"sendfrom\", from_account, to_address, amount, min_conf])\n except:\n sys.exit(1)\n\n return txid...
[ "0.7210136", "0.70873505", "0.6880935", "0.68190783", "0.65082777", "0.6497111", "0.6450092", "0.6342358", "0.6319728", "0.6302984", "0.6302082", "0.6222723", "0.6186968", "0.61721003", "0.6104063", "0.60613024", "0.60498315", "0.6029663", "0.6019236", "0.5961033", "0.5948415...
0.7861894
0
Will send amount from 'from_account' to 'to_address', ensuring the account has a valid balance using minconf confirmations. Returns the transaction ID if successful
def withdraw_from_account(amount, from_account, to_address, min_conf=1): amount = str(amount) min_conf = str(min_conf) try: txid = subprocess.check_output(["litecoin-cli", "sendfrom", from_account, to_address, amount, min_conf]) except: sys.exit(1) return txid.decode().strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendfrom(self, fromaccount, tovergeaddress, amount, minconf=1, comment=None,\n comment_to=None):\n if comment is None:\n return self.proxy.sendfrom(fromaccount, tovergeaddress, amount, minconf)\n elif comment_to is None:\n return self.proxy.sendfrom(fromaccou...
[ "0.6857974", "0.68056613", "0.6797207", "0.6518002", "0.651441", "0.64583534", "0.6382127", "0.6364182", "0.6249058", "0.62291926", "0.62134093", "0.61405724", "0.6081409", "0.6020652", "0.59833604", "0.5980323", "0.5923492", "0.58902675", "0.5865838", "0.58656025", "0.583714...
0.7788288
0
Return atom swap string for DL CONTROL
def print_atom_swap(swap): return "{} {}".format(swap["id1"], swap["id2"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_atom_swap(dlstr):\n\n try:\n tok = dlstr.split()\n swap = {\"id1\": \"{} {}\".format(tok[0], tok[1]), \\\n \"id2\": \"{} {}\".format(tok[2], tok[3])}\n except IndexError:\n raise ValueError(\"Unrecognised atom swap: {!r}\".format(dlstr))\n\n return swap", ...
[ "0.5748594", "0.56975305", "0.56351066", "0.55732745", "0.54446554", "0.5297939", "0.52473116", "0.5246296", "0.5210577", "0.5116348", "0.51156247", "0.50700957", "0.5045276", "0.49982235", "0.49397308", "0.49338365", "0.49101335", "0.48570594", "0.48383296", "0.4823896", "0....
0.5982542
0
Parse GC move line
def _parse_move_statement(dlstr): try: tokens = dlstr.lower().split() if tokens[0] != "move": raise ValueError("Expected 'move' statement") mtype, nmove, pfreq, rmin = \ tokens[1], int(tokens[2]), int(tokens[3]), float(tokens[4]) exce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __parse_move_line(self, line):\n parts = re.sub('\\(.*?\\)', '', line).split()\n x, y = None, None\n for part in parts[:0:-1]:\n axis = part.upper()[0]\n value = float(part[1:])\n if axis in ['Z', 'F']:\n parts.remove(part)\n elif ...
[ "0.7016501", "0.619677", "0.601983", "0.59566694", "0.5944466", "0.5853636", "0.56506604", "0.56506604", "0.56506604", "0.56506604", "0.56409734", "0.5636587", "0.55743676", "0.5484419", "0.54757637", "0.5474653", "0.5391645", "0.538481", "0.53728485", "0.5360658", "0.5307729...
0.63197243
1
Get a link to the song from last fm based on artist and name.
def get_lastfm_link(artist, track, l_creds): pass_hash = pylast.md5(l_creds["password"]) network = pylast.LastFMNetwork( api_key=l_creds["api key"], api_secret=l_creds["shared secret"], username=l_creds["username"], password_hash=pass_hash, ) song = network.get_track(art...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spotify_uri(self,song_name, artist):\n query = f\"track:{song_name} artist:{artist}\"\n result = self.sp.search(q=query,limit=1,type='track')\n\n #only use the first song\n if len(result['tracks']['items']) > 0 and result['tracks']['items'][0]['artists'][0]['name'] == artist:\n ...
[ "0.6919668", "0.6655768", "0.62681353", "0.6202823", "0.6185913", "0.6104478", "0.59958345", "0.5993805", "0.5965433", "0.59291875", "0.58957225", "0.5879973", "0.5808685", "0.5801412", "0.5712504", "0.56969994", "0.5655496", "0.5644498", "0.5637139", "0.563591", "0.56267375"...
0.7493599
0
Get the corresponding song from Genius.
def get_genius_song(song_name, artist_name, genius): song_search = song_name for i in range(0, 2): song = genius.search_song(song_search, artist_name) if isinstance(song, type(None)) or not match( (song_search, artist_name), (song.title, song.artist) ): if i: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_song(self): \n\n song = self.tracks.sample(n=1).to_dict('index')\n return list(song.values())[0]", "def get_song(self, song_id):\n url = get_song_url(song_id)\n result = self.get_request(url)\n\n return result['songs'][0]", "def get_song(self, song_id):\n url =...
[ "0.764114", "0.73598737", "0.71857405", "0.7110866", "0.68528235", "0.67306364", "0.6719249", "0.66200435", "0.6607151", "0.6561489", "0.65417105", "0.6532257", "0.64840215", "0.6428935", "0.64151865", "0.6329123", "0.6305844", "0.6271053", "0.6263074", "0.6169367", "0.614976...
0.7470428
1
Remove the parentheses and hyphens from a song name.
def remove_extra(name): return re.sub(r"-[\S\s]*", "", re.sub(r"\([\w\W]*\)", "", name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_name(name):\n return PUNCT_RE.sub('-', name.lower()).strip('-')", "def sanitize_name(name: str) -> str:\n return re.sub(r\"[^A-Za-z0-9_-]\", \"-\", name)[0:128]", "def sanitize_name(name):\n # For now just change dashes to underscores. Fix this more in the future\n return name.replace...
[ "0.70703393", "0.70367986", "0.7035329", "0.70162845", "0.6974878", "0.6958907", "0.684572", "0.6767284", "0.67154896", "0.66887105", "0.6685595", "0.6648311", "0.658791", "0.6556827", "0.6536671", "0.65230227", "0.65006196", "0.64723617", "0.64384997", "0.6431085", "0.642351...
0.7115448
0
Determine whether a song matches the result
def match(song, other): artist_name = clean(song[1]) other_artist = clean(other[1]) artist_dist = distance(artist_name, other_artist) if artist_dist > REQUIRED_ARTIST_SCORE: log(f"{artist_name} != {other_artist}: {artist_dist} < {REQUIRED_ARTIST_SCORE}") return False song_name = cle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def song_search_matching(chart_song, query):\n song_searches = song_search(query, NUM_SONG_SEARCH_RESULTS)\n if 'error' in song_searches:\n print('>>> error:', song_searches['error'])\n return\n\n songs = []\n # print(song_searches)\n for s in song_searches['songs']:\n # print('...
[ "0.71566886", "0.694608", "0.67360544", "0.66688824", "0.66484874", "0.6521698", "0.6471474", "0.64608866", "0.64040196", "0.6403133", "0.63761145", "0.6370317", "0.63635975", "0.6330745", "0.6306691", "0.6287759", "0.6268218", "0.6165823", "0.612055", "0.60496473", "0.603357...
0.7242499
0
Remove extraneous lines of text from paragraphs
def clean_paragraphs(paragraphs, artist_name, song_name): clean_paragraphs = [] for paragraph in paragraphs: for extraneous_pattern in EXTRANEOUS_TEXT: extraneous_pattern = extraneous_pattern.replace("$BAND$", re.escape(artist_name)) extraneous_pattern = extraneous_pattern.repla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_trailing_spaces(self):\n for paragraph in self.paragraphs:\n for item in paragraph:\n lines = paragraph[item].split(\"\\n\")\n paragraph[item] = \"\\n\".join([l.rstrip() for l in lines])", "def return_text_without_headlines(text):\n\n text = text.repla...
[ "0.6888955", "0.64809084", "0.6443119", "0.6434099", "0.6337557", "0.6309434", "0.62787914", "0.6262084", "0.6229654", "0.6227945", "0.6219618", "0.6197752", "0.6183929", "0.6170428", "0.6168898", "0.61541003", "0.61407423", "0.6127386", "0.60857785", "0.6067472", "0.60669637...
0.69568336
0
Creates a `input_fn` with fake data based on Dataset.
def input_fn_by_dataset_with_fake_data(input_size, padding_length): def _input_fn(params): """A `input_fn` returning features and labels.""" batch_size = params['batch_size'] inputs, labels, lengths = sequence_example_lib.get_fake_data_batch( batch_size, input_size, padding_length) features =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _input_fn(input_pipeline_context=None):\n return _create_dataset(options, is_training, input_pipeline_context)", "def testing_input_fn():\n dataset = tf.data.Dataset.range(len(cube_features))\n dataset = dataset.batch(16)\n dataset = dataset.map(mapping_function)\n return dataset", "def inpu...
[ "0.84087765", "0.7477303", "0.72485495", "0.71630186", "0.7100241", "0.7039749", "0.7036942", "0.7028642", "0.7008866", "0.70008564", "0.69901514", "0.69833237", "0.6928786", "0.6917912", "0.69163114", "0.68954784", "0.6886165", "0.68820995", "0.6839234", "0.68169624", "0.680...
0.8102087
1
A `input_fn` returning features and labels.
def _input_fn(params): batch_size = params['batch_size'] inputs, labels, lengths = sequence_example_lib.get_fake_data_batch( batch_size, input_size, padding_length) features = { 'inputs': inputs, 'lengths': lengths } return features, labels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_input_fn(self) -> types.FeatureAndLabelTensors:\n return self._input_fn_from_file(self._train_path)", "def input_fn(params, is_training):\n features = tf.constant(0)\n labels = tf.constant(0)\n\n return features, labels", "def input_fn():\n features = {\n feature_name: t...
[ "0.754075", "0.74368423", "0.742067", "0.71742415", "0.7124143", "0.7107588", "0.7039249", "0.7015979", "0.7001931", "0.7000006", "0.69833744", "0.6968949", "0.68859965", "0.68649995", "0.6848503", "0.6828859", "0.6823528", "0.68101823", "0.67985994", "0.67934674", "0.6735832...
0.7477171
1
Gets the next model id based on the models in `models_dir` directory.
def get_next_model_id(models_dir=MODELS_DIR, model_prefix=DEFAULT_MODEL_PREFIX, model_ext=MODEL_EXT): models = glob.glob(os.path.join(models_dir, model_prefix + '*')) return model_prefix + str(len(models) + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_experiment_id(models_dir):\n ids = [x for x in os.listdir(models_dir) \n if os.path.isdir(models_dir + os.sep + x)]\n if len(ids) > 0:\n return int(max([int(i) for i in ids])) + 1\n return 1", "def _get_first_model(cls, model_dir, sort: str, desc: bool) -> Tuple[Optional[Path],...
[ "0.72279954", "0.6184097", "0.6160458", "0.6063871", "0.5962224", "0.5862086", "0.5779305", "0.5778121", "0.57479525", "0.5683238", "0.5674088", "0.566332", "0.5660484", "0.5612911", "0.55385345", "0.5457023", "0.5439177", "0.5423469", "0.5399599", "0.53970754", "0.5394284", ...
0.85743797
0
Add or update a leg for this Call.
def create_update_leg(self, event): leg = self.__legs.get(event.call_leg_id) if leg is None: leg = Leg.construct_from(event, self.api_key) self.__legs[leg.call_leg_id] = leg else: leg.call.refresh_from(event) return leg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_leg_for_person(self, person, leg):\n pass", "def leg_count(self, leg_count):\n\n self._leg_count = leg_count", "def leg_maker(size=40, color='0x9C661F'):\n leg = GOval(size, size+30)\n leg.filled = True\n leg.fill_color = color\n leg.color = color\n return leg", "def add_...
[ "0.61321324", "0.59875053", "0.5379403", "0.52214205", "0.518071", "0.49573743", "0.4947872", "0.49052054", "0.48957556", "0.48667598", "0.48333818", "0.48146766", "0.47886142", "0.47882444", "0.47654474", "0.46808717", "0.46680406", "0.46612802", "0.46491456", "0.46282852", ...
0.71122444
0
Gets language from given mongo object of content If not found, returns language as 'en'
def get_language_from_object(self, odata): try: if odata.get('lxp', {}).get('language', None): language = odata['lxp']['language'] elif odata.get('meta', {}).get('ecl', {}).get('lang', None): language = odata['meta']['ecl']['lang'] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lang(context, field):\n lang = json.load(open(\"json/lang.json\", \"r\"))\n conf = json.load(open(\"json/serverconfig.json\", \"r\"))\n return lang[conf[str(context)][\"lang\"]][field]", "def get_meta_lang(self):\n # we have a lang attribute in html\n attr = self.parser.getAttribut...
[ "0.68647563", "0.6836136", "0.6725572", "0.66951734", "0.6512876", "0.6509003", "0.63819456", "0.63222456", "0.62778014", "0.62527883", "0.6238836", "0.62279695", "0.621946", "0.62062365", "0.61793005", "0.61682004", "0.6161649", "0.61520964", "0.6129581", "0.61247927", "0.60...
0.71350133
0
The smoothing process is defined on a matrix of data rows. This checks the dimensions of E and A to see if E should be transposed.
def _need_transpose(expr_matrix, adj_matrix): return expr_matrix.shape[1] != adj_matrix.shape[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _eigs_via_transpose(\n M: fArr, covariance: bool = True, use_sparse: bool = False, **sp_args: Any\n) -> fArr:\n N, T = M.shape\n if N <= T:\n raise ValueError(\"Array is not of correct shape to benefit from transposed intermediates.\")\n r = 1 / (T - 1)\n Z = M - np.mean(M, axis=1, keepdi...
[ "0.5318039", "0.529627", "0.52706283", "0.5025403", "0.49645317", "0.48877385", "0.48837876", "0.48513824", "0.48219308", "0.47486505", "0.47182643", "0.47056627", "0.47046357", "0.47046357", "0.46802193", "0.46703687", "0.46311352", "0.4616732", "0.46140656", "0.45898363", "...
0.5640434
0
Perform smoothing of `expr_matrix` using provided kernel.
def smooth_with_kernel(expr_matrix, kernel, transpose='auto'): if isinstance(kernel, str): with open(kernel, 'rb') as f: kernel = pickle.load(f) transpose = _need_transpose(expr_matrix, kernel) if transpose=='auto' else transpose if transpose: return pd.DataFrame(np.dot(expr_ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_smoothing_kernel(adj_matrix, alpha):\n Anorm = normalize(adj_matrix, axis=1, norm='l1')\n I = np.eye(Anorm.shape[0])\n influence_matrix = (1-alpha) * linalg.inv(I-alpha*Anorm)\n return influence_matrix", "def smooth_by_mtx_inv(expr_matrix, adj_matrix, alpha, transpose='auto'):\n if isi...
[ "0.6391742", "0.61643153", "0.6072616", "0.57087064", "0.5683984", "0.5648057", "0.55410296", "0.54633814", "0.5407038", "0.5404281", "0.5387355", "0.5308879", "0.5265764", "0.52477765", "0.5246567", "0.52394676", "0.5210846", "0.51473963", "0.5136669", "0.50993466", "0.50626...
0.7223305
0
Performs network smoothing of expr_matrix on the graph defined by adj_matrix using the closed form solution. See `compute_smoothing_kernel`.
def smooth_by_mtx_inv(expr_matrix, adj_matrix, alpha, transpose='auto'): if isinstance(adj_matrix, str): adj_matrix = io.mmread(adj_matrix) K = compute_smoothing_kernel(adj_matrix, alpha) return smooth_with_kernel(expr_matrix, K, transpose=transpose)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_smoothing_kernel(adj_matrix, alpha):\n Anorm = normalize(adj_matrix, axis=1, norm='l1')\n I = np.eye(Anorm.shape[0])\n influence_matrix = (1-alpha) * linalg.inv(I-alpha*Anorm)\n return influence_matrix", "def smooth_with_kernel(expr_matrix, kernel, transpose='auto'):\n if isinstance(ke...
[ "0.7173136", "0.67390704", "0.67092377", "0.6394118", "0.55225176", "0.54480517", "0.5184324", "0.5166908", "0.5075518", "0.5030276", "0.50191844", "0.5001596", "0.49686307", "0.49243742", "0.49213976", "0.4920903", "0.48700655", "0.47938496", "0.47930327", "0.4774097", "0.47...
0.7478183
0
split at '\n' or b'\x00' and return list of bytes with identifier as string or bytes
def split_bytes(self, data): tokens = [] idx_null = data.find(b'\x00') idx_nl = data.find(b'\n') if idx_null>=0 and (idx_nl<0 or idx_null<idx_nl): sep = b'\x00' elif idx_nl>=0: sep = b'\n' else: return tokens part = data.partit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_packet(self, data):\n return data.decode().split('\\x00')", "def decode (self, s):\n if s == \"null\": return []\n return s.split(chr(257))", "def decompose_byte(data: str, nibble: bool = False) -> list:\n _bytes = int(len(sanatize_hex(data)) / 2)\n mem_size = 8\n if nib...
[ "0.6620584", "0.6343972", "0.61584103", "0.6103018", "0.6044434", "0.60367215", "0.59782636", "0.59246", "0.5908744", "0.58916676", "0.5787759", "0.57786864", "0.5656204", "0.56354743", "0.56102353", "0.5602953", "0.5530402", "0.55262476", "0.551253", "0.5506036", "0.55059654...
0.74333006
0
Tie up forecast and historic dicts and offer discrepancy amount for checking purposes
def join_historic_forecast(historic_dict, forecast_dict): combined_dict = historic_dict discrepancy_list = [] for key, item in forecast_dict.items(): if key in combined_dict.keys(): discrepancy = float(combined_dict[key]) - float(forecast_dict[key]) discrepancy_list.append(di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adj_join_historic_forecast(historic_dict, forecast_dict):\n combined_dict = historic_dict\n discrepancy_list = []\n for key, item in forecast_dict.items():\n if key in combined_dict.keys():\n discrepancy = float(combined_dict[key]) - float(forecast_dict[key])\n discrepancy...
[ "0.6896127", "0.6071528", "0.59239435", "0.57520276", "0.5729752", "0.571192", "0.5696216", "0.5674002", "0.56546247", "0.5619746", "0.5574298", "0.55738837", "0.5543751", "0.55326396", "0.5521161", "0.551457", "0.5506796", "0.5506636", "0.5486265", "0.547073", "0.54355496", ...
0.69053614
0
Tie up forecast and historic dicts and offer discrepancy amount for checking purposes
def adj_join_historic_forecast(historic_dict, forecast_dict): combined_dict = historic_dict discrepancy_list = [] for key, item in forecast_dict.items(): if key in combined_dict.keys(): discrepancy = float(combined_dict[key]) - float(forecast_dict[key]) discrepancy_list.appen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join_historic_forecast(historic_dict, forecast_dict):\n combined_dict = historic_dict\n discrepancy_list = []\n for key, item in forecast_dict.items():\n if key in combined_dict.keys():\n discrepancy = float(combined_dict[key]) - float(forecast_dict[key])\n discrepancy_lis...
[ "0.690393", "0.6071688", "0.5923153", "0.5751715", "0.572877", "0.5710676", "0.56972885", "0.567492", "0.56550205", "0.5618338", "0.5575396", "0.55737764", "0.55435663", "0.5532539", "0.5522", "0.5515257", "0.55071414", "0.55045754", "0.5486072", "0.54690087", "0.5435839", ...
0.68951154
1
get joint forecast and historic data, update = forecast or update
def get_weather(address, update = ''): def proceed_with_method(): if update == 'forecast': precip_hist_dict = historic_weather_data(address, "P") temp_hist_dict = historic_weather_data(address, "T") else: precip_hist_dict = historic_weather_data(addres...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_data():\n etf_prices = get_prices(start=START_DATE, end=END_DATE)\n etf_returns = compute_returns(etf_prices)\n merged_etf_data = etf_prices.merge(etf_returns, right_index=True, left_index=True)\n indicators = compute_indicators(merged_etf_data) # this uses the \"ta\" lib, but it does not n...
[ "0.6041333", "0.6029729", "0.6013829", "0.5784844", "0.5775665", "0.5649491", "0.55597866", "0.5542124", "0.55319893", "0.55277336", "0.5511153", "0.55094475", "0.5486575", "0.5476967", "0.5465744", "0.5432305", "0.54209286", "0.5413128", "0.54019344", "0.5395749", "0.5379466...
0.62684953
0
Get the values from postgresql and set it to self.values
def get_values_from_pg(self): if self.conn is None: self.connect() if self.attribute_name is None: self.attribute_name = self.get_attribute_name() self.values = self.get_values_from_column( column=self.attribute_name, table=self.pg_table_name, schema=self.sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_values(self, db):", "def _getValues(self):\n res = {}\n for colname, column in self._iterNameColumn():\n res[colname] = column.toSql(self._values[colname])\n return res", "def __init__(self, **values):\r\n self.eid = values.get('_id')\r\n self._values = {}\r...
[ "0.7873662", "0.6761913", "0.6580869", "0.6228414", "0.617139", "0.617139", "0.617139", "0.617139", "0.617139", "0.617139", "0.6105815", "0.6102474", "0.6062436", "0.5912588", "0.59080297", "0.59080297", "0.5903849", "0.5903849", "0.5898272", "0.5822679", "0.58196515", "0.5...
0.75109106
1
Finding the intersections of two circles.
def intersect_two_circles(x0, y0, r0, x1, y1, r1): # circle 1: (x0, y0), radius r0 # circle 2: (x1, y1), radius r1 d = math.sqrt((x1 - x0) ** 2 + (y1 - y0) ** 2) if d > r0 + r1: raise ValueError("non-intersecting") if d < abs(r0 - r1): raise ValueError("one circle within the other...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_intersections_circle_circle(circle1: Circle, circle2: Circle) -> {Point}:\n # Determine some constants, for easy access\n center1 = circle1.center\n r1 = circle1.radius\n center2 = circle2.center\n r2 = circle2.radius\n diff_between_centers = center2 - center1\n ...
[ "0.7789184", "0.7647115", "0.75673187", "0.727036", "0.7212669", "0.7190188", "0.7092842", "0.69107825", "0.68165696", "0.67570317", "0.6687228", "0.66806686", "0.6646433", "0.66384375", "0.6621209", "0.6602192", "0.6560726", "0.65558183", "0.65520734", "0.6543078", "0.653065...
0.769071
1
Convert grid indices to algebraic notation
def grid2alg(grid_x=None, grid_y=None): return ( chr(0x61 + grid_x) if grid_x is not None else '', chr(7 - grid_y + 0x31) if grid_y is not None else '', )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate_to_algebraic(location):\n\n columns = 'abcdefghi'\n return columns[location[0]] + str(location[1] + 1)", "def index_to_algebraic(pos: tuple[int, int]) -> str:\r\n return INDEX_TO_FILE[pos[1]] + INDEX_TO_RANK[pos[0]]", "def state_from_id(index, dims_state_grid):\n\n entries = [...
[ "0.6079223", "0.60320914", "0.5975947", "0.57745254", "0.57666624", "0.5699152", "0.56957847", "0.56755733", "0.5673659", "0.567095", "0.5560969", "0.5531357", "0.54955703", "0.54773486", "0.54460174", "0.5418282", "0.54068565", "0.5397304", "0.53905994", "0.53648144", "0.536...
0.6362442
0
Rank and file difference between two moves in algebraic notation
def algdelta(alg1, alg2, *args): file_delta = ord(alg2[0]) - ord(alg1[0]) rank_delta = ord(alg2[1]) - ord(alg1[1]) return file_delta, rank_delta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def man_dist(pos1, pos2):\n # Compute the file distance\n df = abs(pos1.file - pos2.file)\n # Compute the rank distance\n dr = abs(pos1.rank - pos2.rank)\n # Return their sum\n return df + dr", "def algebraic_to_index(move: str) -> tuple[int, int]:\r\n return (RANK_TO_INDEX[move[1]], FILE_TO...
[ "0.63315636", "0.58899426", "0.5353598", "0.5324099", "0.5276493", "0.52165246", "0.5206388", "0.5163357", "0.51356393", "0.5128819", "0.5113273", "0.50895435", "0.5078684", "0.5078558", "0.5068432", "0.5044797", "0.5025961", "0.5020775", "0.50187665", "0.49829355", "0.497808...
0.6613387
0
Generates the characters between c1 and c2, inclusive. Autodetects reversed range.
def char_range(c1, c2): step = 1 start, end = ord(c1), ord(c2) if start > end: step = -1 for charcode in range(start, end + step, step): yield chr(charcode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charRange(c1, c2):\n for c in range(ord(c1), ord(c2)+1):\n yield chr(c)", "def char_range(c1, c2):\r\n for c in range(ord(c1), ord(c2)+1):\r\n yield chr(c)", "def char_range(c1, c2):\n for c in range(ord(c1), ord(c2)+1):\n yield chr(c)", "def char_range(c1, c2):\n for c i...
[ "0.8105095", "0.80964077", "0.8059262", "0.8059262", "0.80155915", "0.7523351", "0.75178915", "0.616451", "0.59640825", "0.5786996", "0.57490796", "0.5647727", "0.5527411", "0.55176806", "0.5496183", "0.5482725", "0.54628867", "0.5457993", "0.5413955", "0.53490186", "0.532159...
0.81924146
0
Pad text with character, treating ANSI escape sequences as zero width
def pad_ansi(text, width, char, left=False): current_width = len(ANSI_PATTERN.sub('', text)) parts = [text, (width - current_width) * char] if left: parts = reversed(parts) return ''.join(parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(text, width, pad_character=\" \"):\n\n length = len(text)\n if width < 0 and length < -width:\n return text + (-width - length) * pad_character\n elif width > 0 and length < width:\n return (width - length) * pad_character + text\n else:\n return text", "def add_padding(s...
[ "0.73150593", "0.7059062", "0.6732868", "0.67187804", "0.6615262", "0.6600697", "0.6529842", "0.65296227", "0.6500602", "0.6477309", "0.64648044", "0.6409835", "0.624386", "0.6237719", "0.6234958", "0.6218235", "0.6185038", "0.61723506", "0.615966", "0.6159123", "0.6120037", ...
0.82812154
0
Check if given counter exists.
def contains_counter(cls, cname): return cname in cls.__counters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_counter_exist(self):\n self.assertEqual('counterOdd' in dir(self.exercice), True)", "def test_counter(self):\n self.assertEqual(self._n_registered, 1)", "async def _exists(self, key):\n return key in SimpleMemoryBackend._cache", "async def _exists(self, key):\n with a...
[ "0.76261747", "0.5784465", "0.5707453", "0.5667753", "0.5634217", "0.561025", "0.5597902", "0.55691206", "0.55249655", "0.55144125", "0.55039304", "0.5498775", "0.5495947", "0.5494946", "0.54650664", "0.5452392", "0.5418592", "0.54103696", "0.53999573", "0.53999573", "0.53993...
0.7189379
1
Clear saved data and current counters
def clear_data(cls): cls.__data.clear() cls.__counters.clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n #for counterName in self.counters:\n # del self.counters[counterName]\n self.counters={}\n self.title=None", "def resetCounters(self):\n self.chain.zero_counters()\n counters = self.session.query(Counter).all()\n self.session.query(Counter).d...
[ "0.7909134", "0.770781", "0.76506627", "0.75958925", "0.740334", "0.7309937", "0.73087937", "0.72901917", "0.728884", "0.7279492", "0.7246068", "0.72162896", "0.720962", "0.7191953", "0.7186489", "0.7186489", "0.71808195", "0.71808195", "0.71808195", "0.71766156", "0.71752626...
0.8010473
0
Close SSH client session
def close_ssh_client(self): self.ssh_client.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_ssh_connection(self):\n if self.__ssh_client:\n self.__ssh_client.close()", "def close(self):\n self._paramiko_ssh_client.close()\n self._paramiko_ssh_client = None", "def close(self):\n self.ssh.close()", "def close(self) :\n if self.ssh is not None :\...
[ "0.7868864", "0.7472319", "0.74476504", "0.72632706", "0.7192499", "0.7178748", "0.71557546", "0.69734526", "0.6955315", "0.69282067", "0.6877236", "0.6801909", "0.67647594", "0.6752219", "0.6741404", "0.67171854", "0.6691422", "0.66735405", "0.6660727", "0.6634048", "0.65837...
0.8266075
0
Generate a json from the vulnerability data.
def generate_vuln_json(self, vuln_data, pkg): # Convert list to string. ver_str = "" + str(vuln_data['affected']).replace(' ', '')\ .replace('[', '').replace(']', '').replace('\'', '') return { "snyk_vuln_id": vuln_data['id'], "package_name": pkg, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_vulnerabilities_json(self, **kwargs):\n ...", "def json_data(self):\n self.check_proof()\n return {\n \"vars\": [{'name': v.name, 'T': str(v.T)} for v in self.vars],\n \"proof\": sum([printer.export_proof_item(self.thy, item, unicode=True, highlight=True)\...
[ "0.6931433", "0.688951", "0.64284885", "0.62226814", "0.6187204", "0.6147846", "0.6117883", "0.6053744", "0.6034547", "0.60105014", "0.60088015", "0.5992961", "0.59140533", "0.5891644", "0.5889553", "0.5866741", "0.58647245", "0.5852854", "0.5834602", "0.5832801", "0.58216375...
0.7115699
0
Extract the vuln info and modify the existing json.
def extract_info(self, snyk_data, json_data): for eco in SUPPORTED_ECOSYSTEMS: if eco in snyk_data: logger.info("Adding data for {} from the parsed snyk feed.".format(eco)) eco_data = snyk_data[eco] for pkg in eco_data: if pkg not i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_vuln_json(self, vuln_data, pkg):\n # Convert list to string.\n ver_str = \"\" + str(vuln_data['affected']).replace(' ', '')\\\n .replace('[', '').replace(']', '').replace('\\'', '')\n\n return {\n \"snyk_vuln_id\": vuln_data['id'],\n \"package_name...
[ "0.6066656", "0.5984765", "0.5961247", "0.5848971", "0.5767245", "0.5572229", "0.54859227", "0.538646", "0.53170675", "0.5251691", "0.52475494", "0.51395017", "0.50468874", "0.5034333", "0.49964073", "0.49860698", "0.49856552", "0.4968054", "0.4961624", "0.49306184", "0.49188...
0.64548695
0
Formats a node for return to the user.
def formatNode(node): return {'fullName': node.fullName, 'start': node.start, 'finish': node.finish, 'own': node.own, 'tag': node.tag}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_node(format_value, colors, node):\n if isinstance(node, Task):\n return u'{}'.format(\n colors.root(\n format.escape_control_characters(node.root().task_uuid)))\n elif isinstance(node, WrittenAction):\n return message_name(\n colors,\n ...
[ "0.6967737", "0.69232506", "0.64169914", "0.6408037", "0.63735104", "0.6130833", "0.6112053", "0.60858804", "0.60471153", "0.59705657", "0.5923023", "0.59119314", "0.5828721", "0.5792803", "0.5791384", "0.578609", "0.577327", "0.5771558", "0.57407767", "0.5701696", "0.5700611...
0.7366219
0
azscanner(subscription_id, tenant_id) where subscription_id does not belong to tenant_id should fail with useful error
def test_incompatible_subscription_and_tenant(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_request_cancel_no_subscription(self):\n # Customer has not set subscription ID\n with self.assertRaises(BraintreeError):\n SubscriptionManager.request_cancel(self.braintree_customer)", "def test_aws_service_api_validate_subscription_post(self):\n pass", "def test_cancel...
[ "0.5452838", "0.52602786", "0.5189601", "0.5188913", "0.51629823", "0.51616246", "0.5100034", "0.5085121", "0.50148296", "0.49465016", "0.4923055", "0.49173313", "0.48939615", "0.48889232", "0.4878909", "0.48741946", "0.48503545", "0.48374563", "0.48053053", "0.47943762", "0....
0.6508214
0
What happens if ~/.azure is empty
def test_empty_azure_config_dir(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_azure_cloud_config(mp_config_file):\n with custom_mp_config(mp_config_file):\n az_config = AzureCloudConfig()\n check.equal(az_config.cloud, \"global\")\n check.is_in(\"env\", az_config.auth_methods)\n check.is_in(\"msi\", az_config.auth_methods)\n check.is_in(\"cli\", az_config.auth...
[ "0.56525844", "0.55135584", "0.5395982", "0.53500265", "0.53271735", "0.5318726", "0.5263498", "0.5259756", "0.5251716", "0.52478904", "0.5229304", "0.5199787", "0.51650083", "0.5117374", "0.51080805", "0.5083474", "0.5016934", "0.5015275", "0.49819854", "0.49533382", "0.4944...
0.72771066
0
Solves IK to move the right arm to the specified right_target ([x, y, z] in world space)
def right_arm_ik(self, right_target, ignore_elbow_up_constraint=True): self.load_real_robot_state() self.set_model_right_arm(eval('Q_IK_SEED_' + self.current_bin)) qmin,qmax = self.robotModel.getJointLimits() for i in range(1000): point2_local = vectorops.add(VACUUM_POINT_XF...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right_arm_ik_near_seed(self, right_target, ignore_elbow_up_constraint=True):\n self.load_real_robot_state()\n self.set_model_right_arm(eval('Q_IK_SEED_' + self.current_bin))\n\n oldRSquared = -1\n q_ik = None\n\n qmin,qmax = self.robotModel.getJointLimits()\n for i in ...
[ "0.6644356", "0.58482265", "0.58090836", "0.5706518", "0.56957227", "0.56729037", "0.552577", "0.547377", "0.5451379", "0.54154205", "0.5399562", "0.5351738", "0.53351897", "0.53221285", "0.5302969", "0.527876", "0.5270924", "0.5245983", "0.52256817", "0.5220938", "0.52164143...
0.72814286
0
Solves IK to move the right arm to the specified right_target ([x, y, z] in world space)
def right_arm_ik_near_seed(self, right_target, ignore_elbow_up_constraint=True): self.load_real_robot_state() self.set_model_right_arm(eval('Q_IK_SEED_' + self.current_bin)) oldRSquared = -1 q_ik = None qmin,qmax = self.robotModel.getJointLimits() for i in range(1000): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right_arm_ik(self, right_target, ignore_elbow_up_constraint=True):\n self.load_real_robot_state()\n self.set_model_right_arm(eval('Q_IK_SEED_' + self.current_bin))\n\n qmin,qmax = self.robotModel.getJointLimits()\n for i in range(1000):\n point2_local = vectorops.add(VACU...
[ "0.72808784", "0.5843002", "0.5803795", "0.57012224", "0.5693716", "0.5668092", "0.5523375", "0.5471053", "0.5450886", "0.54120386", "0.539681", "0.53461885", "0.53305846", "0.53187305", "0.52974725", "0.52736795", "0.52670604", "0.5242399", "0.52198577", "0.5215831", "0.5215...
0.66439295
1
Tests whether ``parse_matched_keyword`` works as intended.
def test__parse_matched_keyword(): matched_keyword = 'owo' for input_data, expected_output in ( ({}, None), ({'matched_keyword': None}, None), ({'matched_keyword': ''}, None), ({'matched_keyword': str(matched_keyword)}, matched_keyword), ): output = parse_matched...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_keyword_present(self,text):\n if self.keywords_re.search(text) and not self.blocked_keywords_re.search(text):\n print self.blocked_keywords_re.search(text)\n return True\n return False", "def matches(self, test_string, parse_all=True):\n try:\n ...
[ "0.5874404", "0.5759566", "0.5753817", "0.5676568", "0.55423546", "0.5533875", "0.551861", "0.55157584", "0.54416436", "0.54241455", "0.54121625", "0.54121625", "0.53777605", "0.5361726", "0.5340146", "0.5304544", "0.52788764", "0.52544004", "0.52391374", "0.5236991", "0.5219...
0.78515506
0
Move the point to the next line
def next_line(): set_point(point().next_line())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_line(self, context, line):", "def end_of_line():\r\n set_point(point().end_of_line())", "def previous_line():\r\n set_point(point().previous_line())", "def forward_character():\r\n set_point(point()+1)", "def move_to_line_start(self) -> None:\n self.index = self.buffer.get_line_start(sel...
[ "0.70823693", "0.701731", "0.6837466", "0.6820194", "0.68074656", "0.68072224", "0.67890954", "0.67828625", "0.6746876", "0.661109", "0.6571759", "0.6513359", "0.643272", "0.64314884", "0.6422045", "0.64143425", "0.6401336", "0.6371865", "0.63657427", "0.6358825", "0.6344233"...
0.86114085
0
Move the point to the previous line
def previous_line(): set_point(point().previous_line())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def up():\n global y, canvas # y é modificado\n canvas.create_line(x, y, x, y - 10)\n y -= 10", "def delete_backward():\r\n point().delete_left_char()\r\n set_point(point().offset(-1))", "def next_line():\r\n set_point(point().next_line())", "def backward_character():\r\n set_poin...
[ "0.6915086", "0.68906903", "0.68744993", "0.68313634", "0.66659975", "0.65617794", "0.6517465", "0.644899", "0.6429758", "0.6423716", "0.63326985", "0.6331823", "0.6331122", "0.6325393", "0.62896407", "0.62885094", "0.6279957", "0.6256711", "0.62382716", "0.62382716", "0.6221...
0.871943
0
Move the point to the previous character
def backward_character(): set_point(point().offset(-1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_character():\r\n set_point(point()+1)", "def move_forward(self):\n self.pos += 1\n if self.pos > len(self.text) - 1:\n self.current_char = None\n else:\n self.current_char = self.text[self.pos]", "def previous_line():\r\n set_point(point().previous_line(...
[ "0.7733676", "0.7425636", "0.70325816", "0.7028068", "0.6974555", "0.69279766", "0.6788541", "0.67408365", "0.65336514", "0.65153503", "0.6384721", "0.63574827", "0.63500243", "0.6199571", "0.61814654", "0.6172814", "0.61552155", "0.6111222", "0.61057705", "0.6021884", "0.601...
0.82285124
0
Insert a line break at the current point position
def insert_newline(): insert_char("\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enter(self):\n if self.pos < self.line_length():\n # If the position is not at the end of the line split the line\n self.buffer.split_line(self.line, self.pos)\n else:\n self.buffer.insert_line(\"\", self.line + 1)\n \n self.line += 1\n self.pos = 0\n self.has_changes = True", ...
[ "0.70407164", "0.6974613", "0.6862128", "0.6787767", "0.67445916", "0.6727079", "0.6654693", "0.6589549", "0.64914894", "0.6489867", "0.63997096", "0.63964427", "0.6337099", "0.626113", "0.6237441", "0.62312734", "0.61773926", "0.608783", "0.6020401", "0.60148996", "0.6014079...
0.72751987
0
Move the current point to the end of line
def end_of_line(): set_point(point().end_of_line())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to_line_end(self) -> None:\n self.index = self.buffer.get_line_end(self.index)", "def next_line():\r\n set_point(point().next_line())", "def move_to_last_line(self) -> None:\n try:\n end: int = len(self.buffer) - 1\n last_line_start: int = self.buffer.reverse_index...
[ "0.78739804", "0.71263635", "0.7029133", "0.678152", "0.6671315", "0.661359", "0.65959466", "0.65843433", "0.6531536", "0.6519203", "0.64948076", "0.64584213", "0.64315695", "0.6410198", "0.63654774", "0.63620603", "0.63592553", "0.63508874", "0.6319813", "0.6304481", "0.6292...
0.82327455
0
Move the current point to the begining of the line
def begining_of_line(): set_point(point().begining_of_line())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to_line_start(self) -> None:\n self.index = self.buffer.get_line_start(self.index)", "def next_line():\r\n set_point(point().next_line())", "def previous_line():\r\n set_point(point().previous_line())", "def move_forward(self,length,draw=True):\r\n new_x = self.x + length * math.cos(...
[ "0.7846593", "0.73618776", "0.72680414", "0.7019184", "0.70003676", "0.69510746", "0.6734505", "0.67117447", "0.66845775", "0.6677296", "0.66135734", "0.65711665", "0.65567154", "0.6554192", "0.6546463", "0.6529822", "0.652067", "0.65193367", "0.64932156", "0.64606", "0.64552...
0.8297868
0
Test that Xanthos produces correct outputs.
def testOutputs(self): # Remember original (correct) example outputs old_files = self.read_outputs() # Set up and run Xanthos ini = 'example/pm_abcd_mrtm.ini' xth = Xanthos(ini) res = xth.execute() # Check result dimensions self.assertEqual(res.Q.shape, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_normal_goes_normal(self):\n eq_(self.msg, output(self.msg,\"OUTPUT\"))", "def test_others(self):\n outputAssert = self.buildingTests([\"Hola me gust@ programar en ICC 1.03\"])\n self.assertTrue((outputAssert[0][4] == outputAssert[1][4] and outputAssert[0][5] == outputAssert[1][5]) ^...
[ "0.6130019", "0.5921687", "0.58983326", "0.58612436", "0.58368033", "0.58302027", "0.5701776", "0.56787896", "0.5651369", "0.5646824", "0.56436795", "0.5607643", "0.5574747", "0.5529669", "0.5523484", "0.5515527", "0.5512084", "0.548806", "0.54827225", "0.5474357", "0.5467936...
0.59496295
1
Print out biorhythm data for targetdate assuming you were born on birthdate.
def biorhythms(birthdate,targetdate): # print dates print("Born: "+birthdate+" Target: "+targetdate) # convert to date types - Python 3.7 or later birthdate = date.fromisoformat(birthdate) targetdate = date.fromisoformat(targetdate) # days between days = (ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_story_01(self):\n td=datetime.today()\n for person in self.individuals.values():\n pb=person.birthday\n pd=person.death\n if pb !=\"NA\" and pb>td:\n print(f'US01 - {person.name} birthday after today on line {person._birthday_line}')\n ...
[ "0.6398602", "0.63194275", "0.60504603", "0.60199887", "0.595926", "0.5837171", "0.5525253", "0.5517962", "0.5438974", "0.53937566", "0.5388699", "0.5348019", "0.5327897", "0.52956647", "0.5275897", "0.5257876", "0.5250496", "0.524235", "0.5224107", "0.5201758", "0.5186914", ...
0.713347
0
Parametrizable fixture to create an rc file at the desired location. The file is created in an isolated folder and set as the prefix, root prefix, or home folder.
def rc_file( request, rc_file_text, tmp_home, tmp_root_prefix, tmp_prefix, tmp_path, user_config_dir, ): if hasattr(request, "param"): where, rc_filename = request.param if where == "home": rc_file = tmp_home / rc_filename elif where == "root_prefix": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture(fname, label=\"reference\"):\n return os.path.join(FIXTURES, label, fname)", "def creatercfiletemp(rcfile):\n f = open(rcfile, 'w')\n f.write(rcfile_template)\n f.close()", "def _CreateCfgFile():\n default_cfg = \"\"\"\nproject: \"fake_project\"\nzone: \"fake_zone\"\nstorage_bucket_n...
[ "0.6002608", "0.57937795", "0.5741229", "0.5665291", "0.56614965", "0.55434185", "0.5503631", "0.54726624", "0.5465976", "0.5459054", "0.54506236", "0.54493725", "0.54430115", "0.54280967", "0.54165083", "0.54022616", "0.53720945", "0.5346243", "0.5342991", "0.53305626", "0.5...
0.6866318
0
Environment variables should be expanded in settings that have expandvars=True. Test copied from Conda.
def test_expandvars_conda(self, monkeypatch, tmpdir_factory, rc_file, yaml_quote): def _expandvars(attr, config_expr, env_value): config_expr = config_expr.replace("'", yaml_quote) monkeypatch.setenv("TEST_VAR", env_value) return self._roundtrip_attr(rc_file, attr, config_ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_expand_environment_variables(self):\n include_prefixes = ['-I']\n db = CppProperties(include_prefixes)\n environ['TEST_VARIABLE_TO_EXPAND'] = '/lib_include_dir'\n\n expected = [\n Flag('-I', path.normpath('/lib_include_dir')),\n ]\n\n scope = SearchScop...
[ "0.7356023", "0.71881324", "0.67016584", "0.6503125", "0.64702976", "0.64047104", "0.63351023", "0.6284387", "0.6218489", "0.62086004", "0.6163708", "0.6150869", "0.61499584", "0.6121349", "0.6121324", "0.60965407", "0.60668266", "0.605311", "0.6033883", "0.6027796", "0.60232...
0.7639134
0
Runs flip_coins(n) iters number of times. Returns average count.
def monte_carlo(n, iters=1000): counts = [flip_coins(n) for _ in range(iters)] return np.mean(counts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_coins(num_coins, num_flips):\n return np.random.randint(2, size=(num_coins, num_flips))", "def coinflip(num):\n heads = 0\n tails = 0\n for n in xrange(0, num):\n result = random.randint(0, 1)\n if result is 0:\n heads += 1\n else:\n tails += 1\n ...
[ "0.6597802", "0.62113434", "0.59366065", "0.57713455", "0.5759927", "0.571759", "0.56763566", "0.5644948", "0.5637001", "0.5619152", "0.56189674", "0.55041987", "0.54681224", "0.54641205", "0.5442995", "0.54348916", "0.5370233", "0.5360417", "0.5349212", "0.5329333", "0.53224...
0.7104361
0
Archives a Job, setting a flag in the JobDB, which filters job_list entries.
def archive_job(job_id): job_db = JobDb() user = auth.username() if job_db.get_job_by_id(job_id)["user"] == user or user == "admin": job_db.archive_jobs([job_id]) job_db.close() else: job_db.close() body = jsonify({ 'success': False, 'error': { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def archiveJob(_id):\n job = mongo.db.jobs.find_one({'_id': _id})\n \"\"\"Set status of job to future\"\"\"\n job['status'] = 'archived'\n job['is_active'] = False\n \"\"\"find slave\"\"\"\n mongo.db.jobs.update({'_id': _id}, job)\n \"\"\"Bulk update tasks\"\"\"\n bulk = mongo.db.tasks.init...
[ "0.6439376", "0.58045185", "0.56236273", "0.51326054", "0.51086515", "0.5090305", "0.5089104", "0.50828475", "0.50828475", "0.50268906", "0.5026686", "0.5014357", "0.5009801", "0.49991617", "0.4990378", "0.49200398", "0.4916907", "0.49028978", "0.49006033", "0.48818493", "0.4...
0.6386757
1
Serve the contents of the JSON parameter schema for the given job type.
def get_job_param_schema(job_type): try: schema = json_validation.get_schema(job_type) return jsonify(schema) except FileNotFoundError: raise ApiError( "job_type_not_found", f"No definition for given job type '{job_type}' found", 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema_handler(self, schema):\n dict_for_render = schema.get('properties', {}).items()\n if schema.get('$ref', None):\n def_name = schema.get('$ref').split('/')[-1]\n dict_for_render = self.definitions[def_name].get('properties', {}).items()\n elif schema.get('propert...
[ "0.629553", "0.5326558", "0.5087905", "0.5078089", "0.498128", "0.49685407", "0.4951899", "0.49127278", "0.48946568", "0.48936298", "0.48655877", "0.48565507", "0.48565507", "0.4821014", "0.482083", "0.47954628", "0.47898406", "0.47610793", "0.4755812", "0.47518924", "0.47386...
0.70387775
0
Commit a log entry to the Bitcoin blockchain.
def commit(hashes_file, bitcoin_key): logentry = LogEntry() for line in open(hashes_file): logentry.add_sha256(unhexlify(line.rstrip())) logentry.build() tx_id = logentry.commit(bitcoin_key) click.echo("Log entry committed as transaction with ID: %s" % tx_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commitEntry(self, entry):\n logging.info('entry committing! {}'.format(entry))\n # check if the entry is a buy ticket entry\n # if so, and if I am the leader, send a message to client about\n # the operation being successful\n if entry.command and 'ticket_count' in entry.comm...
[ "0.70891404", "0.6319349", "0.624268", "0.61618704", "0.6156535", "0.6108848", "0.6042307", "0.60083985", "0.59161997", "0.59073365", "0.58849496", "0.5859461", "0.5782334", "0.5733668", "0.57257026", "0.57027894", "0.56999934", "0.56905353", "0.56905353", "0.56905353", "0.56...
0.7290574
0
Print the independent probabilities both as a 1d probability list (basically a PDF) or a 2d matrix of independent transitions not a markov chain.
def print_independent_probabilities(query_filter=None): probabilities = get_single_pitch_probabilities(query_filter) ordered_pitch_types = sorted(probabilities.keys(), key=probabilities.get, reverse=True) # First printing just the individual probabilities print 'Independent pitch probabilities:' p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printing_p_matrix(new_all_results):\n\tprint(\"________________________________PROBABILITY MATRIX__________________________________ \")\n\tfor i in range(len(new_all_results)):\n\t\tprint(\"Row Number: \", i+1)\n\t\tprint(\"Vector: \", all_states_explored[i])\n\t\tprint(\"Number of columns: \", len(new_all_res...
[ "0.65037775", "0.64377403", "0.63423115", "0.6173152", "0.6150393", "0.6017597", "0.5919039", "0.5822281", "0.5698483", "0.566071", "0.5588629", "0.5577018", "0.55188173", "0.54623437", "0.5449505", "0.5446319", "0.5430519", "0.54080415", "0.5401491", "0.53988254", "0.5398051...
0.6899464
0
Query the PitchFX database for the counts of transitions, using the pitch types found to exist when querying for pitches independently
def query_transition_counts(ordered_pitch_types, query_filter): transition_counts = {} for first_pitch_type in ordered_pitch_types: transition_counts[first_pitch_type] = {} for second_pitch_type in ordered_pitch_types: count_query = PitchTransition.select().where( P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_single_pitch_probabilities(query_filter, start_date=datetime(2015, 1, 1)):\n pitch_counts = {}\n\n progress = progressbar.ProgressBar()\n # for pitch_type in progress(PitchType.select()): # See comment near the definition of the constant for explanation\n for pitch_type in progress(PITCH_TYPES_...
[ "0.54358584", "0.52796876", "0.5192006", "0.5098356", "0.50893927", "0.4940484", "0.4934199", "0.49304184", "0.4926368", "0.49219462", "0.49195978", "0.49172413", "0.4894433", "0.4872131", "0.4868899", "0.48259583", "0.48203427", "0.48169965", "0.48100576", "0.4804819", "0.48...
0.7339056
0
Calculate the joint probabilities from the transition counts
def joint_probabilities_from_transitions(ordered_pitch_types, transition_counts): first_pitch_totals = {first_pitch_type: sum(transition_counts[first_pitch_type].values()) for first_pitch_type in ordered_pitch_types} total_transitions = sum(first_pitch_totals.values()) markov_row...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_transition_probs(self):\n n = len(self.speakers) # TODO why this line ???\n transitions = np.random.randint(5, size=(n, n)) + 1\n transitions += transitions.transpose()\n for i in range(0, math.floor(n / 2)):\n s1 = np.random.randint(n)\n s2 = np.random.r...
[ "0.67611885", "0.6717455", "0.65528613", "0.6514206", "0.64345974", "0.63998294", "0.6361031", "0.6335052", "0.63111836", "0.6305647", "0.6300583", "0.62774456", "0.62523156", "0.6240676", "0.6236485", "0.6225191", "0.6225032", "0.620356", "0.6157134", "0.6139242", "0.6074952...
0.7380194
0
Prints the conditional probability markov matrix
def print_conditional_probabilities(ordered_pitch_types, query_filter=None): transition_counts = query_transition_counts(ordered_pitch_types, query_filter) joint_probabilities, markov_rows, total_transitions = joint_probabilities_from_transitions(ordered_pitch_types, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printing_p_matrix(new_all_results):\n\tprint(\"________________________________PROBABILITY MATRIX__________________________________ \")\n\tfor i in range(len(new_all_results)):\n\t\tprint(\"Row Number: \", i+1)\n\t\tprint(\"Vector: \", all_states_explored[i])\n\t\tprint(\"Number of columns: \", len(new_all_res...
[ "0.64305687", "0.62678593", "0.6158768", "0.60659397", "0.60176843", "0.5980878", "0.58508825", "0.5834772", "0.583234", "0.58284163", "0.57950896", "0.5793812", "0.57877433", "0.5784194", "0.5772141", "0.5751525", "0.5748714", "0.57268935", "0.5726446", "0.571654", "0.571450...
0.6415435
1
A permutationtest for the joint entropy. Taking the PDF for single pitches, generating ('n') permutations of the same length ('total_transitions') as the observed one, and calculating the entropy of each permutation. Then, doing a ttest using the permutation entropies as the sample and the observed conditional entropy ...
def entropy_permutation_test(ordered_pitch_types, single_pitch_pdf, conditional_joint_probabilities, total_transitions, n=1000): pitch_types, pitch_probabilities = zip(*single_pitch_pdf.items()) permutation_entropies = [] progress = progressbar.ProgressBar() for test_number...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bp_example():\n signal = np.array([4, 7, 9, 10, 6, 11, 3])\n\n pe = permutation_entropy(signal, 2)\n\n assert 0.91 < pe < 0.92 # Should be approx 0.918.\n\n pe = permutation_entropy(signal, 3)\n\n assert 1.52 < pe < 1.53 # Should be approx 1.522.", "def test_dc():\n signal = np.zeros...
[ "0.5944994", "0.59353805", "0.5803436", "0.57073355", "0.5571166", "0.55510175", "0.5549896", "0.554935", "0.55299354", "0.5529309", "0.54703283", "0.54558116", "0.54547316", "0.54469067", "0.54355365", "0.54334664", "0.5422701", "0.5418074", "0.54149467", "0.53777534", "0.53...
0.80808306
0
Print the entropies of the joint probabilities under the assumption of independence and the observed transitions
def print_entropies(independent_joint_probabilities, conditional_joint_probabilities): indepndent_entropy = entropy_from_probability_matrix(independent_joint_probabilities) conditional_entropy = entropy_from_probability_matrix(conditional_joint_probabilities) print 'Independent H(X,Y) = {h}'.format(h=indep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_independent_probabilities(query_filter=None):\n probabilities = get_single_pitch_probabilities(query_filter)\n\n ordered_pitch_types = sorted(probabilities.keys(), key=probabilities.get, reverse=True)\n\n # First printing just the individual probabilities\n print 'Independent pitch probabilit...
[ "0.63093275", "0.62295", "0.6205773", "0.59897286", "0.59553516", "0.5921114", "0.58627325", "0.58527607", "0.5756717", "0.57407975", "0.57340264", "0.57289547", "0.5691328", "0.5674067", "0.5660763", "0.56218", "0.558505", "0.5539616", "0.5531771", "0.5511637", "0.5494553", ...
0.6593063
0
Calculate the probabilities under the assumption of independence and the observed transition probabilities. Afterwards, calculate the entropies and print them, and perform the entropy permutation test.
def print_probabilities_and_entropies(independent_filter=None, conditional_filter=None): ordered_pitch_types, single_pitch_pdf, independent_joint_probabilities = print_independent_probabilities( independent_filter) conditional_joint_probabilities, total_transitions = print_conditional_probabilities(orde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy_permutation_test(ordered_pitch_types, single_pitch_pdf, conditional_joint_probabilities, total_transitions,\n n=1000):\n pitch_types, pitch_probabilities = zip(*single_pitch_pdf.items())\n permutation_entropies = []\n progress = progressbar.ProgressBar()\n\n for ...
[ "0.6750904", "0.64670056", "0.63318765", "0.62944776", "0.6146464", "0.6063847", "0.60276324", "0.59909844", "0.59017867", "0.58737737", "0.5863017", "0.5834739", "0.5805121", "0.5784728", "0.5762215", "0.5725106", "0.5717954", "0.57140326", "0.56970197", "0.5685708", "0.5672...
0.64693135
1
Same as print_probabilities_and_entropies, but for a specific pitcher (by his elias ID)
def print_probabilities_and_entropies_for_pitcher(pitcher_eliasid): pitcher = Player.get(Player.eliasid == pitcher_eliasid) print 'Printing for {first} {last}'.format(first=pitcher.first, last=pitcher.last) independent_entropy, conditional_entropy, z_score, p_value = \ print_probabilities_and_entrop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_experiment_speaker_info(db_root):\n seen_speakers = ['VCTK-speaker-p225-female',\n 'VCTK-speaker-p226-male',\n 'VCTK-speaker-p227-male',\n 'VCTK-speaker-p228-female',\n 'VCTK-speaker-p229-female',\n 'VCTK-speaker-p230-female',\n 'VCTK-speaker-p231-female',\n 'VCTK-speaker-p232-male',\n 'VCTK-speaker-p23...
[ "0.58232987", "0.57096374", "0.5631113", "0.54873246", "0.5381042", "0.5295938", "0.5168578", "0.5115267", "0.5111549", "0.50922364", "0.5085704", "0.50258225", "0.49834913", "0.49810258", "0.49801344", "0.49786335", "0.496842", "0.49671066", "0.49498355", "0.4930704", "0.493...
0.8544658
0
Helper method for asserting that two Field objects are equal.
def assertFieldsEqual(self, f1, f2): # pylint: disable=invalid-name if not isinstance(f1, Field): raise AssertionError(f'{f1} is not a Tetromino') if not isinstance(f2, Field): raise AssertionError(f'{f2} is not a Tetromino') np.testing.assert_array_equal(f1.state, f2.sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assert_fields_equal(self, field1, field2):\n self._assert_field_descriptors_equal(\n field1.descriptor, field2.descriptor)\n self.assertEqual(field1.method_name, field2.method_name)\n self.assertEqual(field1.partial_args, field2.partial_args)\n self.assertEqual(field1.pa...
[ "0.8331686", "0.743471", "0.73670185", "0.72329247", "0.71186453", "0.6986047", "0.6945382", "0.68346834", "0.67785376", "0.67545277", "0.6722613", "0.6666149", "0.665728", "0.665728", "0.66447043", "0.66325206", "0.6625486", "0.66194576", "0.6600737", "0.6594379", "0.6586165...
0.781813
1
Test various drop sequences and line clears.
def test_drop(self): state = generate_valid_state(np.array([ [1, 1, 0, 1, 1, 0, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 0], ], dtype=np.uint8)) field = Field.create(state) self.assertIsNotNone(field) lines_cleared = field.drop(Tetromino.JTetromino(), 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_kill_line_start_blank_line(self):\n before_b = \"\"\"\\\n line 1\n line 2\n\n line 4\n \"\"\"\n after_b = \"\"\"\\\n line 1\n line 2\n line 4\n \"\"\"\n self.run_test(\n before_b=before_b,\n after_b=after_b,\n before_sel=(\"3.0\...
[ "0.62032056", "0.60694885", "0.5980811", "0.59196734", "0.59187615", "0.5882565", "0.58196425", "0.5811649", "0.57997227", "0.577122", "0.5749626", "0.57422704", "0.57182467", "0.5692069", "0.5664152", "0.5654929", "0.5649239", "0.5621424", "0.56005657", "0.55404425", "0.5533...
0.65154904
0
Test that gap counting works as expected with filled/nonfilled columns.
def test_count_gaps(self): field = Field.create() self.assertEqual(field.count_gaps(), 0) field = Field.create(generate_valid_state(np.array([ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1], ]))) self.assertEqual(field.count_gaps(), 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pos_gaps(df, gaps):\n nb_rows, nb_cols = df.shape\n\n value_counts = df.apply(pd.Series.value_counts, axis=0)#.max(axis=0).ge(conservation * nb_rows)\n\n ge = []\n for i in value_counts.columns:\n try:\n if value_counts[i]['-'] > nb_rows * gaps:\n ge.append(i)\n ...
[ "0.65890515", "0.64045817", "0.6382869", "0.62962806", "0.61463034", "0.6038303", "0.6002965", "0.5991427", "0.5962848", "0.5893355", "0.5890198", "0.58353883", "0.58024114", "0.5695747", "0.56551206", "0.56235194", "0.5618865", "0.56038547", "0.55709153", "0.55572295", "0.55...
0.64536124
1
Test that height calculation works as expected with filled/nonfilled columns.
def test_heights(self): # pylint: disable=no-self-use field = Field.create() expected_heights = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) np.testing.assert_array_equal(field.heights(), expected_heights) field = Field.create(generate_valid_state(np.array([ [1, 0, 0, 0, 0, 0, 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_comp_height(self, test_dict):\n test_obj = test_dict[\"test_obj\"]\n result = test_obj.slot.comp_height()\n\n a = result\n b = test_dict[\"H_exp\"]\n msg = \"Return \" + str(a) + \" expected \" + str(b)\n self.assertAlmostEqual((a - b) / a, 0, delta=DELTA, msg=msg...
[ "0.67854625", "0.6621746", "0.6621746", "0.6621746", "0.6501757", "0.6489982", "0.6363143", "0.62681973", "0.6265044", "0.624822", "0.6235674", "0.6192488", "0.61719924", "0.61538833", "0.6139334", "0.59864104", "0.5974474", "0.5974474", "0.5974474", "0.5974474", "0.5974474",...
0.7347489
0
Get virtual machine domain object. Specify at least name or did.
def _get_domain(self, name=None, domain_id=None): try: if name != None: domain = self.conn.lookupByName(name) elif domain_id != None: domain = self.conn.lookupByNamtoprettyxmle(domain_id) self.logger.debug('Get libvirt domain: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vm_by_name(self, name=None):\n\n vm_obj = self.get_obj(self.connect.RetrieveContent(), [vim.VirtualMachine], name)\n if vm_obj:\n return vm_obj\n else:\n print(\"VMUNAVAILABLE(NAME)\")\n # raise VMUnavaiable(name)", "def get(self, vm_name=None):\n ...
[ "0.6233951", "0.6046155", "0.59660214", "0.5800852", "0.5778847", "0.5718934", "0.5716363", "0.55987227", "0.55761045", "0.55390126", "0.552522", "0.5516079", "0.54486334", "0.5376607", "0.53517246", "0.5302481", "0.52862245", "0.523111", "0.522105", "0.5200196", "0.51644206"...
0.66798484
0
r""" Return the respective lengths of the conduit components defined by the throat conns P1 T P2 mode = 'pore' uses pore coordinates mode = 'centroid' uses pore and throat centroids
def conduit_lengths(network, throats=None, mode='pore'): if throats is None: throats = network.throats() Ps = network['throat.conns'] pdia = network['pore.diameter'] if mode == 'centroid': try: pcentroids = network['pore.centroid'] tcentroids = network['throat.ce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cable_length(self):\n skel = self.physical_space(copy=False)\n\n v1 = skel.vertices[skel.edges[:,0]]\n v2 = skel.vertices[skel.edges[:,1]]\n\n delta = (v2 - v1)\n delta *= delta\n dist = np.sum(delta, axis=1)\n dist = np.sqrt(dist)\n\n return np.sum(dist)", "def cones_and_cylinders(\n...
[ "0.5854724", "0.5835", "0.57686794", "0.56934214", "0.56562376", "0.5552107", "0.5496054", "0.5489273", "0.5482432", "0.5443692", "0.54309916", "0.53929883", "0.5392434", "0.53802943", "0.53702235", "0.53640884", "0.5332882", "0.5319639", "0.5300696", "0.5288965", "0.5273604"...
0.72091985
0
1. get every announcement's target url for further analysis 2. get next page url
def parse(self, response): announcement_urls = response.css('#TD1 > table > tbody > tr > td.tdline2 > a::attr(href)').extract() for announcement_url in announcement_urls: yield Request(url=parse.urljoin(response.url, announcement_url), callback=self.parse_detail) # next page ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_target(page):\n\tstart_link = page.find('<a href=')\n\tif start_link == -1:\n\t\treturn None,0\n\turl_start = page.find('\"',start_link)\n\turl_end = page.find('\"',url_start+1)\n\turl= page[url_start+1:url_end]\n\treturn url, url_end", "def extract_page_urls(self, _):\n url = \"https://mossa...
[ "0.67675066", "0.6371854", "0.63615304", "0.63271046", "0.6292973", "0.6193488", "0.6098044", "0.60768425", "0.60700166", "0.6058461", "0.6052222", "0.60438913", "0.6036119", "0.60234106", "0.5996654", "0.5895034", "0.5893721", "0.58933824", "0.5881203", "0.5877355", "0.58713...
0.6699218
1
Load configuration values for this schema.
def load_config(self, schema): partial_config = thaw(self._data) for key_name, sub_schema in iter_schema(schema): try: raw_value = get_in(self._data, key_name) except KeyError: continue coerced_value = coerce_value(raw_value, sub_sche...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self):\n pass", "def load_config(self, schema):\n partial_config = {}\n\n for key_name, sub_schema in iter_schema(schema):\n try:\n raw_value = get_in(self._data, key_name)\n except KeyError:\n continue\n coerced_...
[ "0.7181043", "0.6973081", "0.6903869", "0.68442965", "0.67537105", "0.67303586", "0.6717663", "0.6521089", "0.64798164", "0.64185065", "0.64144444", "0.6392277", "0.6385814", "0.63714325", "0.6342779", "0.63244605", "0.6236541", "0.62086743", "0.61627924", "0.6151885", "0.612...
0.7163669
1
Initialize with the Symbols the User has learned
def __init__(self, symbols): self.symbols = set(symbols)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n self.s_table = SymbolTable.preSymbols", "def __init__(self) -> None:\n self.symbols = {\n \"÷\": \"//\",\n \"+\": \"+\",\n \"-\": \"-\",\n \"×\": \"*\"\n }", "def __init__(self):\n\n self.st = {} # symbol table\n ...
[ "0.7204283", "0.6628259", "0.64961135", "0.64864343", "0.6482606", "0.6423897", "0.6383511", "0.6150415", "0.6145114", "0.61320513", "0.6059796", "0.60136247", "0.5975553", "0.5946285", "0.59280163", "0.5896469", "0.5869643", "0.58424306", "0.58067787", "0.57909703", "0.56930...
0.69980973
1
Convert the given Word
def convert(self, word, readings={}): readingsMap = self.processReadings(readings) return convert(word, [readingsMap] + self.symbolMaps)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalizeWord(word):\n\n return unicodedata.normalize('NFKD', word.lower()).encode('ASCII', 'ignore').decode('utf-8')", "def normalize_word(word):\n\n return word.lower()", "def normalize_word (word):\n return st.stem(word.strip ().lower ())", "def normalize_word(text):\n if text:\n ...
[ "0.6606924", "0.6571956", "0.65514296", "0.6534389", "0.6531012", "0.6243584", "0.6191737", "0.6154731", "0.61296946", "0.61203945", "0.6115259", "0.6068497", "0.6062615", "0.6048398", "0.5998113", "0.598734", "0.5973485", "0.59675324", "0.5960674", "0.59039414", "0.5840107",...
0.70020133
0
Compute the Xi jackknife estimates for a given pair of fields. If cross_term=True, we use both fields. If RRname is nonempty we use this instead of recomputing RR pair counts. Estimates are NaN if there's no particles in the jackknife.
def compute_xi(random1_RR,random1_DR,data1,N_rand1_RR, N_rand1_DR, N_gal1,random2_RR=None,random2_DR=None,data2=None,N_rand2_RR=None,N_rand2_DR=None,N_gal2=None,cross_term=False,RRname="",verbose=False): # Read in fields rX_DR,rY_DR,rZ_DR,rW_DR,rJ_DR = random1_DR if len(random1_RR)>0: rX_RR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_est_val_for_jackknife(rec, epoch_name='TRIAL', modelspecs=None,\n njacks=10, IsReload=False, **context):\n est = []\n val = []\n # logging.info(\"Generating {} jackknifes\".format(njacks))\n\n for i in range(njacks):\n # est_out += [est.jackknife_by_time(...
[ "0.4532662", "0.44098243", "0.4338115", "0.42857328", "0.4223927", "0.4213412", "0.420893", "0.4137556", "0.41352633", "0.41090733", "0.41018227", "0.41006777", "0.40969485", "0.4088149", "0.40698588", "0.40651542", "0.4056524", "0.40461934", "0.40441927", "0.40307596", "0.40...
0.46298248
0
Searches STIX2.1 relationship list for relationships that include a given object and are of specified type.
def search_stix21_objects(rel_list, object_name, rel_type='any') -> list: searched_rel_list = list() for relationship in rel_list: if relationship[3] == rel_type or rel_type == 'any': if relationship[0] == object_name and relationship[0] == relationship[2]: searched_rel_list....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_related_nodes(reltype, inst=None):\n if inst is None:\n inst = ctx.instance\n ret = []\n for rel in inst.relationships:\n if reltype in rel.type_hierarchy:\n ret.append(rel.target)\n return ret", "def test_filter_relationships_by_concept_type__object(self):\n # Set up mocks and tes...
[ "0.665782", "0.6648103", "0.62784183", "0.6137051", "0.60757357", "0.6071272", "0.60613793", "0.6023325", "0.599825", "0.5932912", "0.5821975", "0.581276", "0.57411593", "0.5735408", "0.57148737", "0.5665868", "0.55612063", "0.5557178", "0.5540221", "0.5503538", "0.54895544",...
0.7291478
0
This function distributes the AS nodes on the physical resources available. The distribution is done by cpu, trying to put an equal number of Bird processes on every core available.
def getASDistributionbyCpu(num_as,node_files): node_list = [] num_cpus = 0 for n in node_files: with open(n) as nfd: dati = json.load(nfd) obj = {} obj['name'] = n.split("/", 1)[1] obj['cpus'] = dati['ansible_facts']['ansible_processor_vcpus'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_processes(rank, size, backend='gloo'):\n os.environ['MASTER_ADDR'] = '12.12.10.13'\n os.environ['MASTER_PORT'] = '29500'\n dist.init_process_group(backend, rank=rank, world_size=size)", "def calculate_cpu_parameters(self):\n\n # Calculate the cpu parameters, needed for the\n # vpp...
[ "0.5987604", "0.5791307", "0.5773969", "0.57157487", "0.5689724", "0.5613687", "0.55545515", "0.5471492", "0.5392297", "0.53871316", "0.53843206", "0.537353", "0.53603244", "0.5340562", "0.5326846", "0.53190595", "0.53110486", "0.5309471", "0.52957445", "0.5267855", "0.526161...
0.707319
0
Returns all options Formated as an HTML page when GET Saves the option on a POST
def options(self): self.title = self.action accept = self.request.accept.best_match(['text/html', 'application/json']) if accept == 'application/json': self.render(json=list(self.ConfigService.items())) else: if self.request.method == 'POST': params = self.params self.Config...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def option_post_form(self):\n return six.next(six.itervalues(self.zap._request(self.zap.base + 'spider/view/optionPostForm/')))", "def options(request):\n return {option.name: option.get_value() for option in Option.objects.all()}", "def post_data(self):\n p_d = []\n for f in self:\n ...
[ "0.66350996", "0.64317566", "0.60325354", "0.5943551", "0.5923128", "0.54749167", "0.54630274", "0.54274756", "0.54014754", "0.5369737", "0.5322883", "0.5321382", "0.5310475", "0.5258582", "0.5245589", "0.5239288", "0.519329", "0.51892775", "0.5174775", "0.51654446", "0.51218...
0.6581244
1
New method of the CalibrationStatus.
def __new__(cls, value: int): new_object = super(CalibrationStatus, cls).__new__(cls, value) new_object._value = value # type: ignore[attr-defined] new_object._binary = new_object._to_binary() # type: ignore[attr-defined] return new_object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, status):\n self.period_s = 0.1\n self.distance_threshold = 5.0\n self.time_below_threshold_s = 0.2\n self.time_above_threshold_s = 2.0\n self.ir_sensor = InfraredSensor(INPUT_4)\n self.ir_sensor.mode = InfraredSensor.MODE_IR_PROX\n self.last_below...
[ "0.6435379", "0.59379405", "0.5620989", "0.5615871", "0.55938476", "0.55414313", "0.5511754", "0.5382601", "0.53657025", "0.53476214", "0.5302563", "0.52645004", "0.52581525", "0.52541363", "0.5242261", "0.5206169", "0.5186645", "0.5162657", "0.51602226", "0.5153955", "0.5143...
0.74363357
0
Waits until the specified compensation step is complete.
def wait_done( self, step: t.Optional[int] = None, *, timeout: float = 20.0, sleep_time: float = 0.5, ) -> None: start_time = time.time() while ( start_time + timeout >= time.time() and self.calibrate() and not self.finished...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(self):\n with self.__lock:\n while not self.__complete:\n self.__lock.wait()", "async def wait_until_done(self) -> None:\n ...", "def _wait_for_completion(self):\n if self.do_timing:\n self.timer.start(\"Running.\")\n\n while self.state ...
[ "0.6053004", "0.604173", "0.6009991", "0.59796154", "0.59461534", "0.58464664", "0.5803169", "0.5760209", "0.57206213", "0.5643718", "0.56360567", "0.5621881", "0.5614816", "0.56074554", "0.56074554", "0.56026864", "0.55740327", "0.55411965", "0.55411965", "0.55411965", "0.55...
0.6384714
0
This function adds an NAT to an ESG
def add_nat_rule(client_session, esg_name, nat_type, nat_vnic, original_ip, translated_ip, original_port, translated_port, protocol, description): #def add_nat_rule(client_session, esg_name, nat_type, original_ip, translated_ip): esg_id, esg_params = get_edge(client_session, esg_name) if not esg_id: ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addNeighbor(self, neighbor):", "def add_tcp(ctx, global_ip, global_port, local_ip, local_port, nat_type, twice_nat_id):\n\n # Verify the ip address format \n if is_valid_ipv4_address(local_ip) is False:\n ctx.fail(\"Given local ip address {} is invalid. Please enter a valid local ip address !!\"...
[ "0.64248204", "0.6301923", "0.6300221", "0.61101544", "0.606303", "0.6002647", "0.5959434", "0.5909614", "0.5898596", "0.58452135", "0.582114", "0.5818534", "0.5783385", "0.57622343", "0.57604164", "0.57435906", "0.56706285", "0.5668955", "0.565419", "0.5651776", "0.56203383"...
0.65547955
0
This function returns all NAT rules on an esg with the specified original and translated IPs
def get_nat_rules_with_ip(client_session, esg_name, original_ip, translated_ip): esg_id, esg_params = get_edge(client_session, esg_name) if not esg_id: return None result = client_session.read('edgeNat', uri_parameters={'edgeId': esg_id}) if result['status'] != 200: return None els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nat_rules():\n url = '{}/packetfilter/nat'.format(common_bits.base_url)\n result = common_bits.get_request(url, common_bits.headers, common_bits.payload)\n\n return result.json()", "def get_nat_rules(**kwargs):\n proxy = kwargs['proxy']\n sessiontoken = kwargs['sessiontoken']\n tier1_id...
[ "0.64368737", "0.60672915", "0.58709794", "0.5655031", "0.5504676", "0.54759866", "0.5442728", "0.524186", "0.5230598", "0.518475", "0.5162156", "0.51217175", "0.5074542", "0.5073049", "0.50647616", "0.505019", "0.5047635", "0.5043886", "0.503856", "0.50274724", "0.5025988", ...
0.7732946
0
This function deletes the NAT rule with ID rule_id
def delete_nat_rule(client_session, esg_name, rule_id): esg_id, esg_params = get_edge(client_session, esg_name) if not esg_id: return None result = client_session.delete('edgeNatRule', uri_parameters={'edgeId': esg_id, 'ruleID':rule_id}) if result['status'] != 204: return None else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_rule(self, id: str, rule_id: str) -> dict:\n r = requests.delete(self.url + '/{}/rules/{}'.format(id, rule_id), headers=self.headers)\n\n return r.json()", "def delete_rule(self, ruleid):\n path = '%s/security-group-rules/%s' % (self.ver, ruleid)\n res = self.client.call(pa...
[ "0.7771667", "0.7376337", "0.73297507", "0.7259725", "0.72121185", "0.7196454", "0.7092142", "0.7017575", "0.7002695", "0.6988043", "0.69820714", "0.6980356", "0.68571424", "0.68420553", "0.68337655", "0.67271", "0.6707591", "0.6702612", "0.6681701", "0.6657235", "0.6646962",...
0.7945245
0
Return the correct article for item_name, either 'a' or 'an'.
def guess_article(item_name): return 'an' if item_name[0].lower() in 'aeiouy' else 'a'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, item_name):\n if isinstance(item_name, BaseItem):\n return item_name\n return self.all_items.get(item_name)", "def add_article(str_):\n if str_.istitle() or str_.find('the ') > -1:\n str_ = str_\n else:\n str_ = 'the ' + str_\n return str_", "def __...
[ "0.56993854", "0.56894135", "0.56724316", "0.56282514", "0.560489", "0.55768526", "0.55557674", "0.55241877", "0.5518759", "0.5397468", "0.53961617", "0.53722894", "0.5368976", "0.5347435", "0.53364635", "0.5318658", "0.5309087", "0.5306071", "0.5272642", "0.5267981", "0.5260...
0.84475094
0
renames cluster using it's own id
def rename(self, new_name): method = "rename_cluster" params = { "cluster_id": self.id, 'name': new_name } return self._client.connection.make_request(method, params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rename_clusters(self):\n all_clusters = []\n temp_clusters = self._clusters.copy()\n for clu in temp_clusters:\n all_clusters.append(self._clusters.pop(clu))\n idx = 0\n for clu in all_clusters:\n label = 'S' + str(idx)\n clu.rename(label)\n ...
[ "0.69397014", "0.6857628", "0.64667463", "0.64304024", "0.63560987", "0.6276387", "0.6245018", "0.6194516", "0.61826986", "0.605108", "0.6019908", "0.60069543", "0.6002561", "0.59357464", "0.5925479", "0.59041375", "0.5857283", "0.5820728", "0.58110654", "0.5797183", "0.57165...
0.7021113
0
removes cluster using it's own id
def remove(self): method = "remove_cluster" params = { "cluster_id": self.id } make_request = self._client.connection.make_request return make_request(method, params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_cluster(self):", "def delete_cluster(ctx, project_name, cluster_name):\n project = ctx.obj.groups.byName[project_name].get().data\n ctx.obj.groups[project.id].clusters[cluster_name].delete().data\n click.echo(\"DONE!\")", "def delete_cluster(t2_url, t2_token, id):\n response = requests.d...
[ "0.8300227", "0.7689242", "0.71246684", "0.7101521", "0.7075274", "0.7061935", "0.69792604", "0.6971254", "0.68760955", "0.68448335", "0.6708468", "0.66589373", "0.66397035", "0.6637616", "0.64602035", "0.64579177", "0.6451451", "0.6333208", "0.62711996", "0.6245245", "0.6231...
0.7733207
1
Lists child Clusters directly under the cluster. Queries the elfcloud.fi server with cluster's own ID and returns a list of child Clusters.
def children(self): method = "list_clusters" params = { "parent_id": self.id } response = self._client.connection.make_request(method, params) clusters = [] for item in response: clusters.append(Cluster(self._client, **item)) return cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_list_children(cluster_name, znode, headers=None):\n\n return cluster_znode_children(cluster_name,\n \"/\",\n headers=headers or request.headers)", "def cluster_znode_children(cluster_name, znode, headers=None):\n\n _zclient = get...
[ "0.74486065", "0.6668885", "0.660674", "0.65860313", "0.65070504", "0.647093", "0.64546925", "0.6449182", "0.6363641", "0.6191395", "0.61306167", "0.6099037", "0.60902846", "0.6090013", "0.60789895", "0.60654664", "0.6040867", "0.6028955", "0.5996989", "0.5987226", "0.5943664...
0.82984775
0
Lists DataItems (dataitems) directly under the cluster. Queries the elfcloud.fi server with cluster's own ID and returns a list of DataItems.
def dataitems(self): method = "list_dataitems" params = { "parent_id": self.id } response = self._client.connection.make_request(method, params) data_items = [] for item in response: data_items.append(DataItem(self._client, **item)) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_list():\n request_debug(r, logger)\n json_body = r.get_json(force=True, silent=True) or {}\n result = cluster_handler.list(filter_data=json_body)\n response_ok[\"data\"] = result\n return jsonify(response_ok), CODE_OK", "def list_cluster(self, ip, x_api_session):\n log.log_debug...
[ "0.60918546", "0.58196396", "0.576367", "0.56825024", "0.5670818", "0.5619282", "0.55886596", "0.5492894", "0.5411032", "0.5221906", "0.5221184", "0.52000344", "0.51732814", "0.51692766", "0.51507604", "0.51381415", "0.5103664", "0.5049202", "0.5045618", "0.50430715", "0.5013...
0.7303839
0
Removes vault using it's own ID.
def remove(self): method = "remove_vault" params = { "vault_id": self.id } self._client.connection.make_request(method, params) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vault_delete(self):\n return self._vault_delete", "def test_vault_delete_vault_item(self):\n pass", "def vault_delete(self, vault_delete):\n self._vault_delete = vault_delete", "def remove_virtual_authenticator(self, authenticator_id):\n pass", "def unassign_volume(VolumeId=...
[ "0.62557095", "0.62320834", "0.612581", "0.59543973", "0.5885803", "0.5865692", "0.5795791", "0.5795791", "0.57864517", "0.57657135", "0.5746951", "0.57349056", "0.5644261", "0.5635823", "0.5606877", "0.5578484", "0.55647737", "0.5561686", "0.55477244", "0.5542579", "0.553362...
0.806966
0
Filter Color based on color keyword.
def color(self, operator: Enum, color: list | str): if isinstance(color, list) and operator not in self.list_types: raise RuntimeError( 'Operator must be CONTAINS, NOT_CONTAINS, IN' 'or NOT_IN when filtering on a list of values.' ) self._tql.add_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FindColor(self, *args):\n return _XCAFDoc.XCAFDoc_ColorTool_FindColor(self, *args)", "def color_filter(self, image):\n converted = hls_scale(image)\n\n # white color mask\n white_lower_bnd, white_upper_bnd = self.color_filter_params[\"white_bounds\"]\n white_mask = cv2.inRa...
[ "0.6080253", "0.60444576", "0.5783812", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", "0.5668756", ...
0.6255069
0
Filter Date Added based on dateAdded keyword.
def date_added(self, operator: Enum, date_added: Arrow | datetime | int | str): date_added = self.util.any_to_datetime(date_added).strftime('%Y-%m-%d %H:%M:%S') self._tql.add_filter('dateAdded', operator, date_added, TqlType.STRING)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_added(self):\n return datetime.datetime.fromtimestamp(self.fields['addedDate'])", "def added_dates(self, added_dates):\n\n self._added_dates = added_dates", "def date_added(self, value: datetime) -> None:\n self._date_added = value", "def _datetime_sort_filter(self, df):\n ...
[ "0.6026381", "0.5601391", "0.5488461", "0.5391099", "0.5236732", "0.5168697", "0.51418424", "0.51366043", "0.51312304", "0.51216197", "0.5118855", "0.51117915", "0.5099913", "0.5082899", "0.5067489", "0.50605035", "0.50416106", "0.5024789", "0.50172526", "0.49835297", "0.4955...
0.7341488
0
Filter Associated Group based on hasGroupAttribute keyword.
def has_group_attribute(self, operator: Enum, has_group_attribute: int | list): if isinstance(has_group_attribute, list) and operator not in self.list_types: raise RuntimeError( 'Operator must be CONTAINS, NOT_CONTAINS, IN' 'or NOT_IN when filtering on a list of value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def groups(self):\n new = self.copy()\n new._filter = [\"groups\"]\n return new", "def groupfilter(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"groupfilter\")", "def groupfilter(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"groupfilter...
[ "0.6293052", "0.61592096", "0.61592096", "0.5857845", "0.5853963", "0.583097", "0.58033013", "0.5696321", "0.5584365", "0.55672073", "0.5535851", "0.5465301", "0.5465269", "0.54211557", "0.5398379", "0.5343377", "0.5271181", "0.5253097", "0.52527404", "0.52527404", "0.5233976...
0.6256147
1
Filter Associated Indicator based on hasIndicatorAttribute keyword.
def has_indicator_attribute(self, operator: Enum, has_indicator_attribute: int | list): if isinstance(has_indicator_attribute, list) and operator not in self.list_types: raise RuntimeError( 'Operator must be CONTAINS, NOT_CONTAINS, IN' 'or NOT_IN when filtering on a l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_indicator(self):\n # first-party\n from tcex.api.tc.v3.indicators.indicator_filter import IndicatorFilter\n\n indicators = IndicatorFilter(Tql())\n self._tql.add_filter('hasIndicator', TqlOperator.EQ, indicators, TqlType.SUB_QUERY)\n return indicators", "def attribute_s...
[ "0.6217635", "0.5448229", "0.524443", "0.52287626", "0.5203474", "0.51798195", "0.5174213", "0.51119393", "0.50284934", "0.5004046", "0.49903658", "0.49268627", "0.49092588", "0.48158625", "0.4769457", "0.4765559", "0.47067514", "0.47048405", "0.46913937", "0.46651092", "0.46...
0.5933641
1
Return VictimFilter for further filtering.
def has_victim(self): # first-party from tcex.api.tc.v3.victims.victim_filter import VictimFilter victims = VictimFilter(Tql()) self._tql.add_filter('hasVictim', TqlOperator.EQ, victims, TqlType.SUB_QUERY) return victims
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFilter(self):\n\n return self.filter", "def filter(self):\n return self._filter", "def _get_filter(self, args):\n\n # Create the filters list\n filter_list = []\n \n # If we want to record all requests, add the file logger filter\n if args.record:\n ...
[ "0.5866603", "0.5759211", "0.5706726", "0.56558293", "0.5455807", "0.54481566", "0.53557193", "0.5334475", "0.5314551", "0.52487457", "0.51579887", "0.5147382", "0.5130177", "0.50879973", "0.50771254", "0.5034685", "0.5014403", "0.49859235", "0.49857518", "0.49716744", "0.496...
0.6387619
0
Filter Associated Victim based on hasVictimAttribute keyword.
def has_victim_attribute(self, operator: Enum, has_victim_attribute: int | list): if isinstance(has_victim_attribute, list) and operator not in self.list_types: raise RuntimeError( 'Operator must be CONTAINS, NOT_CONTAINS, IN' 'or NOT_IN when filtering on a list of va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_victim(self):\n # first-party\n from tcex.api.tc.v3.victims.victim_filter import VictimFilter\n\n victims = VictimFilter(Tql())\n self._tql.add_filter('hasVictim', TqlOperator.EQ, victims, TqlType.SUB_QUERY)\n return victims", "def filter_actor():\n name = request.ar...
[ "0.72591895", "0.511806", "0.49584538", "0.49317762", "0.49279347", "0.4903373", "0.4871733", "0.48573554", "0.48555154", "0.48068976", "0.47803384", "0.47561565", "0.47451183", "0.46737394", "0.46424517", "0.46382394", "0.46358624", "0.46324924", "0.46225113", "0.46202683", ...
0.6061826
1
Filter Owner Name based on ownerName keyword.
def owner_name(self, operator: Enum, owner_name: list | str): if isinstance(owner_name, list) and operator not in self.list_types: raise RuntimeError( 'Operator must be CONTAINS, NOT_CONTAINS, IN' 'or NOT_IN when filtering on a list of values.' ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_queryset(self, request, queryset, view):\n owner = request.query_params.get(\"owner\")\n\n if owner:\n kwargs = {self.owner_prefix + \"__username__iexact\": owner}\n\n return queryset.filter(**kwargs)\n\n return queryset", "def txt_name_owner(self, with_owner...
[ "0.6785007", "0.63339144", "0.630677", "0.61624664", "0.5998591", "0.57895494", "0.5709106", "0.5699504", "0.5662935", "0.56071615", "0.559196", "0.55857795", "0.55597746", "0.54967767", "0.54965234", "0.5473114", "0.54287493", "0.54084325", "0.53899676", "0.5375756", "0.5360...
0.7382432
0
Filter Summary based on summary keyword.
def summary(self, operator: Enum, summary: list | str): if isinstance(summary, list) and operator not in self.list_types: raise RuntimeError( 'Operator must be CONTAINS, NOT_CONTAINS, IN' 'or NOT_IN when filtering on a list of values.' ) self._tql...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary(self, summary: str):\n return self.swag({\n 'summary': summary\n })", "def search_listing_summary(self):\n text = self.listing_summary or self.introduction\n text = re.sub(\"<[^<]+?>\", \"\", text)\n return text", "def get_summaries(query, **kwargs):\n ...
[ "0.5997297", "0.55847967", "0.5494449", "0.5298633", "0.52540183", "0.5246481", "0.52098644", "0.5206652", "0.515131", "0.5150868", "0.51487184", "0.51487184", "0.5140247", "0.5139551", "0.5117286", "0.51044226", "0.5091887", "0.508956", "0.508956", "0.508956", "0.5078338", ...
0.63084346
0
Filter Victim ID based on victimId keyword.
def victim_id(self, operator: Enum, victim_id: int | list): if isinstance(victim_id, list) and operator not in self.list_types: raise RuntimeError( 'Operator must be CONTAINS, NOT_CONTAINS, IN' 'or NOT_IN when filtering on a list of values.' ) sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_victim(self):\n # first-party\n from tcex.api.tc.v3.victims.victim_filter import VictimFilter\n\n victims = VictimFilter(Tql())\n self._tql.add_filter('hasVictim', TqlOperator.EQ, victims, TqlType.SUB_QUERY)\n return victims", "def get_all_vulnerable_vm_id(self, vm_id: ...
[ "0.61640495", "0.51893353", "0.5067334", "0.48146677", "0.48145783", "0.47653988", "0.4734127", "0.46884313", "0.4688021", "0.46618626", "0.46317515", "0.46249485", "0.46171564", "0.45738593", "0.45733798", "0.45667815", "0.45596018", "0.45205516", "0.45042923", "0.45023552", ...
0.70479006
0
Creates a map of points with random Pollution Values using a gaussian distribution in 1D evenly starting at x = 05 every 10
def create_points_with_random_pollution_1d(length, mean, std): new_map = {} x = 5 for i in range(0, length): new_map[i] = (Point(i, np.random.normal(mean, std), x)) x = x + 10 return new_map
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_gaussian_maps(x, gaussians, size=None, scaling=6.):\n if size is None:\n size = x.shape[-2:]\n bs = x.shape[0]\n else:\n size = [size] * 2\n bs = 1\n dtype = x.dtype\n device = x.device\n\n gaussian_maps = []\n map_temp...
[ "0.6402223", "0.6398874", "0.6285312", "0.6203555", "0.61758673", "0.6062501", "0.5926517", "0.59015703", "0.58768344", "0.58625257", "0.5833859", "0.58255404", "0.5824808", "0.57602084", "0.5740827", "0.5721333", "0.57191306", "0.5711495", "0.57042605", "0.57014287", "0.5700...
0.7123256
0
Picks random points using poisson distribution
def pick_poisson_random_points(points, pick_number, lam): random = np.random.default_rng() random_picks = [] while len(random_picks) < pick_number: random_num = random.poisson(lam) # picks poisson random number if not random_num in random_picks and 0 < random_num < len( po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_poisson(dp):\n return np.random.poisson(dp)", "def rfd_poisson(ps,n):\n lam = sum(ps)\n G = len(ps)\n sample_q = lambda:nprandom.poisson(lam) # chromosomal occupancy approximately poisson.\n sampler = make_sampler(ps)\n return [direct_sampling_ps(ps,sample_q(),sampler) for i in x...
[ "0.7042956", "0.6683801", "0.6655645", "0.6650648", "0.6524106", "0.64103454", "0.6343214", "0.632034", "0.6317037", "0.6270877", "0.62401664", "0.62349886", "0.6180728", "0.6117252", "0.60571134", "0.60532016", "0.60499454", "0.6047853", "0.6044178", "0.6009581", "0.6006048"...
0.7812374
0
Graphs all points and interpolates unknown points, useful for visualizing Gaussian Interpolation and affects of kernals
def see_what_its_doing_1d(): all_points = create_points_with_random_pollution_1d(100, 100, 10) picked_points = pick_uniform_random_points(all_points, 20) interpolated_points = interpolate_unknown_points(picked_points, all_points) picked_x = [] picked_pollution = [] for label, point in picked_po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_interpolation(self):\r\n self.plot_all_logcalls(True)\r\n print_log('info', 'Interpolation was finished.')", "def test_interpolated():\n # Set random seed for reproducibility\n manualSeed = main.manualSeed\n print(\"Fixed Seed: \", manualSeed)\n random.seed(manualSeed)\n tor...
[ "0.6510402", "0.6353091", "0.63335377", "0.605492", "0.6011792", "0.6011792", "0.6011792", "0.5990307", "0.5940392", "0.5913538", "0.5863067", "0.58239466", "0.58210856", "0.58043647", "0.57680166", "0.57446057", "0.57185596", "0.5710173", "0.56967527", "0.56915724", "0.56820...
0.6986818
1