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
Register HTR (mainnet) and XHTR (testnet) in pycoin networks
def _register_pycoin_networks() -> None: import os global _registered_pycoin if _registered_pycoin: return _registered_pycoin = True paths = os.environ.get('PYCOIN_NETWORK_PATHS', '').split() if 'hathor.pycoin' not in paths: paths.append('hathor.pycoin') os.environ['PYCOIN_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_register_network(self):\n pass", "def register_network(key, module):\n register(key, module, network_dict)", "def register_networks(backend):\n from .network_desc import NetworkDesc\n from .adelaide import AdelaideFastNAS\n from .erdb_esr import ESRN\n from .mobilenet import Mobi...
[ "0.6547388", "0.6097607", "0.59806085", "0.5968251", "0.5830869", "0.57322717", "0.56176394", "0.5555726", "0.55104965", "0.534506", "0.53099746", "0.52939296", "0.5237358", "0.5192724", "0.5177056", "0.5170875", "0.5138953", "0.51370627", "0.5098258", "0.50938267", "0.507207...
0.70235425
0
Create words (if is None) and start seed and master node Then we generate the first addresses, so we can check if we already have transactions
def _manually_initialize(self): self.mnemonic = Mnemonic(self.language) if not self.words: # Initialized but still locked return # Validate words first self.validate_words() assert isinstance(self.passphrase, bytes), 'Passphrase must be in bytes' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(seed, model, tokenizer, temp=0.5):\n\n dictionary = [\"\"] + list(tokenizer.index_word.values())\n start = np.array(tokenizer.texts_to_sequences(seed)).reshape(1, -1)\n if seed[0] == '<start>':\n output = [seed[-1]]\n else:\n output = seed[:]\n\n for _ in range(45):\n ...
[ "0.5785551", "0.5728934", "0.5649208", "0.55091643", "0.5480413", "0.5468495", "0.54453427", "0.5444538", "0.5374258", "0.5360612", "0.53517926", "0.52665097", "0.5249261", "0.5215236", "0.52090055", "0.5205174", "0.51885647", "0.5181177", "0.51633507", "0.51450145", "0.51416...
0.6000683
0
Generate a new key in the tree at defined index We add this new key to self.keys and set last_generated_index
def generate_new_key(self, index): new_key = self.chain_key.subkey(index) self._key_generated(new_key, index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _key_generated(self, key, index):\n self.keys[self.get_address(key)] = key\n self.last_generated_index = index", "def __gen_keys__(self):\n if self.seed == b'':\n self.seed = urandom(self.seed_size)\n\n n_prev = Node(hash=hash_factory(data=bytes(self.seed)).digest())\n ...
[ "0.80246866", "0.67809486", "0.6456904", "0.6355784", "0.63524437", "0.6209058", "0.61994654", "0.6194674", "0.6126169", "0.6099803", "0.6098625", "0.6081934", "0.60543513", "0.59544474", "0.58790505", "0.58374196", "0.58367145", "0.5815566", "0.57760036", "0.57750195", "0.57...
0.7571303
1
Add generated key to self.keys and set last_generated_index
def _key_generated(self, key, index): self.keys[self.get_address(key)] = key self.last_generated_index = index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_append_key(self):\n self.append_key += 1", "def gen_keys():", "def generate_new_key(self, index):\n new_key = self.chain_key.subkey(index)\n self._key_generated(new_key, index)", "def made_key(self):\n \n # select a random number from 1 to infinity \n ran...
[ "0.70120007", "0.67435443", "0.66058487", "0.65902716", "0.65373045", "0.6447427", "0.63391894", "0.6228748", "0.6154519", "0.60397923", "0.60168254", "0.59762555", "0.59666264", "0.595028", "0.59233314", "0.5900949", "0.5872757", "0.5861927", "0.5853988", "0.5841961", "0.582...
0.84722704
0
Return the key generated by the index in the parameter
def get_key_at_index(self, index): return self.chain_key.subkey(index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self, index):\n return self.__keys[index]", "def eval_key(self, index):\n return self._EVAL_PREFIX + str(index)", "def _unique_key(self):\n key = f'param_{self.counter}'\n self.counter += 1\n return key", "def _index_key(self, sig, codegen):\n return (sig,...
[ "0.75036955", "0.72083074", "0.71914303", "0.70859087", "0.69023156", "0.68941003", "0.6885927", "0.68858844", "0.6876659", "0.676597", "0.6760929", "0.6748612", "0.6699479", "0.66887134", "0.66435224", "0.6635806", "0.6619856", "0.660352", "0.66027474", "0.66022474", "0.6597...
0.7258488
1
Method called when the wallet receive new tokens If the gap limit is not yet achieved we generate more keys
def tokens_received(self, address58: str) -> None: received_key = self.keys[address58] # If the gap now is less than the limit, we generate the new keys until the limit # Because we might be in sync phase, so we need those keys pre generated diff = self.last_generated_index - received_k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keychange(self):\n # if response.json()['error']['errors'][0]['reason']=='quotaExceeded':\n self.keyindex += 1\n if self.keyindex == len(self.keylist):\n self.keyindex = 0\n print('Keylist length reached')\n print('Changinf Key..')\n key = self.keylist[s...
[ "0.5717665", "0.5667222", "0.55144507", "0.5494286", "0.5439673", "0.54292053", "0.5385075", "0.5318828", "0.53049546", "0.523834", "0.52360225", "0.520741", "0.51931775", "0.51233554", "0.51119256", "0.51012534", "0.5098826", "0.5066854", "0.5043255", "0.5040246", "0.5038378...
0.7514984
0
Return if wallet is currently locked The wallet is locked if self.words is None
def is_locked(self) -> bool: return self.words is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walletlock(self):\n return self.proxy.walletlock()", "def locked(self) -> bool:\n return pulumi.get(self, \"locked\")", "async def locked(self):\n return not \"not\" in await self.ask(\"locked\")", "def is_locked(self):\r\n pass", "def locked(self):\n if self._locked ...
[ "0.7656873", "0.70531535", "0.70303595", "0.69371295", "0.6897361", "0.6795601", "0.675714", "0.6750617", "0.67489517", "0.67401165", "0.67396694", "0.66538787", "0.66513664", "0.66513664", "0.66513664", "0.6588879", "0.6574526", "0.65563613", "0.6542578", "0.651717", "0.6504...
0.80184186
0
Load all saved txs to fill the wallet txs
def load_txs(self, tx_storage): for tx in tx_storage._topological_sort_dfs(): self.on_new_tx(tx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_txs(self, txs):\n # For now avoid caching orphan transactions. We might want to show them somehow in the future.\n cli_txs = {tx[\"txid\"]: tx for tx in txs if tx[\"category\"] != \"orphan\"}\n raw_txs = self.cache_raw_txs(cli_txs)\n cached_txs = self.cache_txs(raw_txs)\n\n ...
[ "0.5589104", "0.5487311", "0.5350113", "0.5330402", "0.52354324", "0.5202624", "0.5198788", "0.51569533", "0.5109451", "0.51038194", "0.5097838", "0.50742316", "0.5059578", "0.5058267", "0.50488466", "0.5033946", "0.49946192", "0.49710378", "0.49665785", "0.495143", "0.494805...
0.5536482
1
Validate if set of words is valid If words is None or is not valid we raise error
def validate_words(self): if not self.words or not self.mnemonic.check(self.words): raise InvalidWords
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self):\n\n if self.words_list is None:\n raise Exception('Words list is not set')", "def is_valid_words(args, skip=False):\n if is_valid_file_and_directory(args) or skip:\n if args.words is not None:\n return True\n return False", "def validate(self, word)...
[ "0.76675195", "0.6575766", "0.6496483", "0.6485126", "0.6357611", "0.62600315", "0.6259116", "0.6259116", "0.6186593", "0.61348206", "0.61265373", "0.610123", "0.6101203", "0.60853904", "0.6045598", "0.60430956", "0.5989423", "0.5966042", "0.5959515", "0.5955842", "0.5943565"...
0.75707555
1
Total cost of a given set s
def total_cost(self): return np.einsum('i->', self.c[self.s])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def costFun(self, S, x):", "def calculate_total_cost(state):\r\n return state.cost()", "def cost(self) -> float:", "def calculate_total_cost(state):\n pass", "def total_cost(clusters):\n inter = 0\n intra = 0\n dm = 0\n for clst in clusters:\n # print clst.label, \"has cost: \", st...
[ "0.69436836", "0.69279075", "0.6916112", "0.68575907", "0.67779595", "0.6609439", "0.66088957", "0.65838075", "0.65287316", "0.6502622", "0.63530636", "0.6344556", "0.6336414", "0.63225985", "0.629074", "0.625908", "0.625543", "0.62157536", "0.61710256", "0.6160492", "0.61533...
0.74787
0
Reset s, the selected columns
def reset_s(self): self.s = np.copy(self.f_uniq) # (current) solution, selected column
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n for col in self._columns:\n col.reset()\n\n self._next_column = 0\n self._columns = []", "def clear_columns(self):\n self._columns = []\n return self", "def clear(self):\n for col in self.cols:\n self.data[col] = []\n ret...
[ "0.69522244", "0.6536586", "0.6393485", "0.63491374", "0.61455876", "0.60716295", "0.6006219", "0.59355867", "0.58931756", "0.5868809", "0.5864084", "0.58631307", "0.58542395", "0.58395255", "0.5830489", "0.57751304", "0.5765056", "0.5763039", "0.57629293", "0.5731909", "0.56...
0.7383071
0
Fix the unique columns that have to be in the minimal set
def _fix_uniq_col(self): # subgradient; for two boolean arrays, multiplication seems to be the best way # (equivalent to logical_and) n_covered_col = self.a_csr.dot(np.ones(self.ncols)) ifix = np.zeros(self.ncols, dtype=bool) if (np.count_nonzero(n_covered_col) != self.mrows): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique(self):\n # variables for uniques \n self._currentSet = 1\n self._uniqueValue = {}\n\n pd = self._dataTable\n for col in pd:\n arr = pd[col].unique()\n for i in arr:\n unique_entry = ((col,i),)\n self._uniqueValue[uniq...
[ "0.62135583", "0.6177121", "0.6156773", "0.60971934", "0.60081965", "0.6004404", "0.5981918", "0.5978237", "0.5898628", "0.58933026", "0.5860984", "0.58033264", "0.57526135", "0.5745792", "0.57044876", "0.5678293", "0.567165", "0.56686383", "0.56637037", "0.564481", "0.563924...
0.6250709
0
Subgradient step for the core problem N\S.
def subgradient(self): UB_full = self.total_cost ufull = np.copy(self.u) # Update core: possible bottleneck (a_csr, a_csc) = self.update_core() mrows = a_csr.shape[0] ncols = a_csr.shape[1] u_this = self.u[~self.f_covered] # np.einsum is 20% fast...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_subgradient(w, data):\n x, = data\n return -x / (w @ x)", "def compute_subgradient(w, data):\n x, y = data\n return -x if w @ x < y else x", "def gradient(self, x):\n pass", "def gradFun(self, S, x):", "def gradient_step(self):\n n = 3 #Granularity of l...
[ "0.69143575", "0.6433987", "0.5913618", "0.59055036", "0.5770813", "0.5768853", "0.5699996", "0.5663607", "0.5560883", "0.5526188", "0.5465842", "0.5421312", "0.5409416", "0.54049736", "0.5389346", "0.5362276", "0.53341675", "0.53341675", "0.533105", "0.5320766", "0.5319299",...
0.6492092
1
Return noisy data based on a polynomail function. The domain of the function is randomly generated, as well as the coefficients of the polynomial.
def get_data_poly_noise(start, stop, noise_rel=0.1, num=50, order=1): x = (stop - start) * np.random.random_sample(size=num) + start #coefficients for the polynomial in [-5,5] poly_coeff = 10 * np.random.random_sample(size=order+1) - 5 #create polynomial y = np.zeros(x.shape) for i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_polynomial():\n degree = numpy.random.choice(range(3, 7))\n x = numpy.linspace(-10, 10, 1000)\n coefficients = numpy.random.chisquare(3, size=degree) + 1\n coefficients *= numpy.random.choice([-1, 1], size=coefficients.shape)\n coefficients *= 0.5\n y = numpy.polyval(coefficients, x)...
[ "0.6534441", "0.588378", "0.5868336", "0.5808874", "0.5539587", "0.5520163", "0.5374264", "0.5327649", "0.5274025", "0.5241983", "0.52354085", "0.5199385", "0.51953924", "0.51682925", "0.51638764", "0.5158305", "0.5152258", "0.5152128", "0.5151019", "0.51287943", "0.5120953",...
0.60185647
1
r"""Select ``n`` problematic dataset indices based on weighted cluster losses and distribution.
def select_prob_indices(self, n_select, cl_idxs, idx_loss_cl): log.info("\nSelecting problematic structures") cl_losses = np.array([np.mean(losses) for losses in idx_loss_cl]) cl_pop = np.array([len(_) for _ in cl_idxs]) # Cluster population log.info("Computing cluster loss weights") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cluster_indices(self,dataset, cluster_number):\n\t\tself.__init__(dataset, self.k)\n\t\tself.e_step() #got responsibilities\n\t\tmax_cluster = np.argmax(self.w, axis = 1)\n\t\tindices = []\n\t\tfor i in range(dataset.shape[0]):\n\t\t\tif max_cluster[i] == cluster_number:\n\t\t\t\tindices.append(i)\n\t\tret...
[ "0.6193597", "0.5927715", "0.58556", "0.56422186", "0.5625437", "0.5570782", "0.55194324", "0.54963136", "0.54559964", "0.54301596", "0.54224414", "0.5396253", "0.5388968", "0.5360405", "0.5339347", "0.5339048", "0.5330715", "0.5312012", "0.52913034", "0.528683", "0.52831435"...
0.6985315
0
r"""Find problematic structures in a dataset. Uses agglomerative and kmeans clustering on a dataset. First, the dataset is split into ``10`` clusters based on atomic pairwise distances. Then each cluster is further split into ``5`` clusters based on energies. Energies and forces are predicted, and then problematic stru...
def find( self, dset, n_find, dset_is_train=True, train_idxs=None, write_json=True, save_cl_plot=True, image_format="png", image_dpi=600, save_dir=".", ): log.info( "---------------------------\n" "| Fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self):\n self.cluseter_agglomerative(n_clusters=20, linkage='average', iterate=5)\n self.sub_clustering(n_clusters=3, index_cluster=[79], linkage='complete')\n self.merge_clusters([[0,9,53],[1,83],[46,35,67],[88,23],[6,68]])\n self.merge_clusters([[6,33,52],[17,14]])\n se...
[ "0.5972204", "0.5650804", "0.5517453", "0.54442674", "0.5379409", "0.53778493", "0.53348505", "0.533013", "0.53299606", "0.53284603", "0.5322139", "0.53043115", "0.5296058", "0.5293254", "0.52804536", "0.5264909", "0.52561975", "0.5254941", "0.5252345", "0.5240298", "0.524019...
0.5868379
1
r"""Plot cluster losses and population histogram using matplotlib.
def plot_cl_losses(self, cl_pop, cl_losses): import matplotlib.pyplot as plt # pylint: disable=import-outside-toplevel cl_width = 1 cl_losses = np.array(cl_losses) cl_pop = np.array(cl_pop) loss_sort = np.argsort(cl_losses) cl_pop = cl_pop[loss_sort] cl_losses...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_clusters(self):\n pass", "def plot_cluster_histogram(clusters, saveAs=None):\n \n cluster_labels = np.unique(clusters)\n k = len(cluster_labels)\n \n heights = [(clusters == l).sum() for l in cluster_labels]\n \n plt.close('all') \n fig, ax = plt.subplots(1,1)\n sns...
[ "0.6944744", "0.68056774", "0.65191925", "0.6483268", "0.6473939", "0.6376142", "0.63496155", "0.62911314", "0.6242816", "0.6240282", "0.6223415", "0.61980224", "0.615062", "0.61354357", "0.611308", "0.61090106", "0.6094741", "0.60937613", "0.6079056", "0.60751575", "0.606789...
0.74593276
0
Archive processor has respect 'template' argument.
def test_args_template(testapp): stream = archive.process( testapp, [holocron.Item({"title": "The Force", "content": "Obi-Wan"})], template="foobar.txt", ) assert isinstance(stream, collections.abc.Iterable) assert list(stream) == [ holocron.Item({"title": "The Force", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_archiver(random, population, archive, args):\r\n return archive", "def master_archive(f, e):\n template = e.get_template(TEMPLATES['archive'])\n write_file(\"archives.html\", template.render(entries=f))", "def _archive_project(name, buff, files=None, repo=None, branch='master',\n ...
[ "0.59726363", "0.5919844", "0.5840984", "0.57774436", "0.57668006", "0.57397795", "0.560909", "0.55987394", "0.558662", "0.5572569", "0.5498331", "0.54975486", "0.5460308", "0.54522187", "0.54182094", "0.5418069", "0.54033256", "0.53956103", "0.53526306", "0.5346858", "0.5344...
0.64534384
0
Get the function url for HTTP call
def get_function_url(is_async, base_url, function_name): function_url = None if is_async is True: function_url = "{}/async-function/{}".format(base_url, function_name) else: function_url = "{}/function/{}".format(base_url, function_name) logging.debug("Get Function URL. Is As...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url():\n ...", "def Url(self) -> str:", "def gen_query_url(self, url, function, format=None, method=None, get_args=None):\n function = self.namespace_map[function]\n return '%s/%s' % (url, function)", "def get_url(self, *args, **kwargs):\n raise NotImplementedError", "def url(se...
[ "0.7090844", "0.68663275", "0.6810908", "0.6800608", "0.6628658", "0.65886503", "0.6585411", "0.65614337", "0.6500577", "0.64672434", "0.64541775", "0.6430163", "0.64008325", "0.63645357", "0.6343626", "0.63189983", "0.6311656", "0.6309808", "0.6262192", "0.6255734", "0.62380...
0.7248379
0
Retrieves all tasks with the specified ddmreqid
def taskbyddmreqid(self, **kwargs): rows = self.api.query(None, None, self.Task.TaskByDdmReqid_sql, ddmreqid=kwargs["ddmreqid"]) return rows
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tasks(self, task_id=None):\n # Recover all config from OpenVAS\n if task_id:\n return self.make_xml_request('<get_tasks id=\"%s\"/>' % name, xml_result=True)\n else:\n return self.make_xml_request(\"<get_tasks />\", xml_result=True)", "def get_tasks_of_project(s...
[ "0.646642", "0.63193464", "0.61650157", "0.5977577", "0.5922998", "0.5823428", "0.5785389", "0.5712846", "0.5712846", "0.57020664", "0.5684275", "0.5683496", "0.56273025", "0.5614078", "0.55910546", "0.5587263", "0.5565647", "0.5552744", "0.55248016", "0.5497558", "0.5493142"...
0.8535213
0
Change last publication time for task.
def updatepublicationtime(self, **kwargs): if 'workflow' not in kwargs or not kwargs['workflow']: raise InvalidParameter("Task name not found in the input parameters") workflow = kwargs['workflow'] authz_owner_match(self.api, [workflow], self.Task) #check that I am modifying my own ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_last_submission_time(self):\r\n self.last_submission_time = datetime.datetime.now(UTC())", "def republish(self):\n self.timestamp = time.time()", "def publish(self):\n self.published_date = timezone.now\n self.save()", "def publish(self):\n self.published_date = tim...
[ "0.6860852", "0.6508761", "0.6296663", "0.6267985", "0.6267985", "0.6241661", "0.6238545", "0.62332857", "0.6210353", "0.60572064", "0.60487616", "0.5986359", "0.5923287", "0.5916307", "0.5885974", "0.58302766", "0.57849276", "0.57849276", "0.5783901", "0.57617533", "0.574057...
0.7061756
0
Loads sequence data from a CoNLL format data set given at `self.directory`. For the CoNLL formatted dataset given at `self.directory`, updates `self.type_seq` with lists containing the word, character and tag sequences for the train and, if provided, valid/test partitions found at `self.directory/train.`, `self.directo...
def _get_type_seq(self): for partition, filepath in self.directory.items(): if filepath is not None: conll_file = os.path.basename(filepath) # get name of conll file # collect sequence data sents = list(self.conll_parser.sents(conll_file)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):\n if self.directory is None:\n err_msg = \"`Dataset.directory` is None; must be provided before call to `Dataset.load`\"\n LOGGER.error('ValueError %s', err_msg)\n raise ValueError(err_msg)\n\n # unique words, chars and tags from CoNLL formatted datase...
[ "0.69626296", "0.6524709", "0.596794", "0.5951669", "0.5843335", "0.5840305", "0.57236236", "0.5602836", "0.5578917", "0.5575729", "0.55542487", "0.55491525", "0.551724", "0.5510782", "0.54982984", "0.5425961", "0.5419499", "0.5396649", "0.537947", "0.5354146", "0.5336732", ...
0.6857753
1
Updates `self.type_to_idx` with mappings from word, char and tag types to unique int IDs.
def _get_idx_maps(self, types, initial_mapping=None): initial_mapping = constants.INITIAL_MAPPING if initial_mapping is None else initial_mapping # generate type to index mappings self.type_to_idx['word'] = Preprocessor.type_to_idx(types['word'], initial_mapping['word']) self.type_to_idx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_id2idx(self):\n self._id2idx = {}\n for n, cell in enumerate(self._cell_list):\n self._id2idx[cell.id()] = n", "def set_indices(self, part_instance_counts):\n type_indices = {}\n for entry in self._entries:\n try:\n entry.set_indices(\n ...
[ "0.6454551", "0.6133905", "0.6046303", "0.5929449", "0.59073", "0.58796215", "0.5660291", "0.56524235", "0.5624651", "0.5597669", "0.5569194", "0.55043894", "0.5499576", "0.54610884", "0.5451779", "0.541576", "0.5380984", "0.5380984", "0.53680414", "0.53286856", "0.5276909", ...
0.66872704
0
Updates `self.idx_seq` with the final representation of the data used for training. Updates `self.idx_seq` with numpy arrays, by using `self.type_to_idx` to map all elements in `self.type_seq` to their corresponding integer IDs, for the train and, if provided, valid/test partitions found at `self.directory/train.`, `se...
def get_idx_seq(self): for partition, filepath in self.directory.items(): if filepath is not None: self.idx_seq[partition] = { 'word': Preprocessor.get_type_idx_sequence(self.type_seq[partition]['word'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_type_seq(self):\n for partition, filepath in self.directory.items():\n if filepath is not None:\n conll_file = os.path.basename(filepath) # get name of conll file\n\n # collect sequence data\n sents = list(self.conll_parser.sents(conll_file))\...
[ "0.55195016", "0.53395104", "0.52961147", "0.5246112", "0.5237849", "0.52238286", "0.5220458", "0.51024866", "0.5090563", "0.508247", "0.5082226", "0.50806385", "0.5064342", "0.4997088", "0.4990647", "0.49789608", "0.49775425", "0.49547988", "0.49478444", "0.49363944", "0.493...
0.6848295
0
Runs the EnergyPlus software
def run_energyplus(epexe_fp, out_fp, idf_fp, epw_fp, output_prefix='eplus', display=True ): #CREATES THE 'OUT' FOLDER IF IT DOESN'T EXIST if not os.path.isdir(out_fp): o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _start_eplus_simulation(self):\n if not self.model:\n self.exit('No model specified.')\n if not self.weather:\n self.exit('No weather specified.')\n model_path = self.model\n if model_path[0] == '~':\n model_path = os.path.expanduser(model_path)\n ...
[ "0.6986542", "0.6365376", "0.6232239", "0.622486", "0.6160507", "0.6088555", "0.60638857", "0.6017408", "0.59845275", "0.59615433", "0.59400517", "0.59070885", "0.5902622", "0.5880955", "0.586793", "0.5867335", "0.5855683", "0.58437485", "0.58404374", "0.5810828", "0.57694745...
0.7071827
0
Filter generated blocks so that API only sees unique blocks
def unique_blocks_only(gen): seen = set() count = 0 for item in gen: key = tuple([int(x) for x in item]) if key not in seen: seen.add(key) yield item count += 1 # log.info("%s/%s were unique blocks",len(seen),count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FilterBlocks(blocks, filter_func):\n # We retain the 'special' block at the end.\n res = [b for b in blocks[:-1] if filter_func(b)]\n res.append(blocks[-1])\n return res", "def _genBlocksByName(self):\n self.blocksByName = {\n block.getName(): block for block in self.getBlocks(includeAl...
[ "0.6391811", "0.596172", "0.5878976", "0.586717", "0.58146787", "0.5781387", "0.57403624", "0.56411433", "0.5627675", "0.5621748", "0.5612627", "0.560742", "0.557485", "0.5542953", "0.5502141", "0.55009717", "0.54874545", "0.542891", "0.5417295", "0.5398559", "0.5390584", "...
0.63568914
1
change attributes for all tracks
def changeattributes(self, *_, inplace = True, **kwa) -> 'TracksDict': assert len(_) == 0 this = self if inplace else self.clone() for track in this.values(): for i, j in kwa.items(): setattr(track, i, j) return this
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_attributes(self):", "def update(self):\n \n for track in self.tracks:\n track.update()", "def _save(self):\n for attrib in self.attribs:\n setattr(self, attrib, getattr(self.obj, attrib))", "def set_attributes(self, attributes):\n self.attributes = attri...
[ "0.64604264", "0.61889005", "0.60451776", "0.5901282", "0.5860429", "0.5837633", "0.5837633", "0.5837633", "0.58174413", "0.5739532", "0.5694126", "0.5686006", "0.5686006", "0.5678369", "0.567754", "0.5617913", "0.5544684", "0.5544684", "0.5522162", "0.552065", "0.55064726", ...
0.73280555
0
Return the cloned TracksDict corresponding to the current selected items
def _dictview(self) -> TracksDict: return self._items[self._keys, self._beads] # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reset_track_lst(self):\n del self._track_item\n self._track_item = {key : [] for key in self._track_lst}\n return self._track_item", "def checkpoint_items(self):\n items = dict(backbone=self.backbone, head=self.head)\n if self.decoder is not None:\n items.update(decoder=self....
[ "0.5568035", "0.54771763", "0.5457668", "0.545101", "0.53839874", "0.53815985", "0.5333072", "0.52926517", "0.5273943", "0.52510434", "0.52496594", "0.524671", "0.5231919", "0.5220479", "0.5164312", "0.51326734", "0.5117656", "0.5115659", "0.5113828", "0.510586", "0.5099929",...
0.5978185
0
Parse the dwh.cfg configuration file
def config_parse_file(): global ANGELCO_EMAIL, ANGELCO_PASSWORD print("Parsing the config file...") config = configparser.ConfigParser() with open('dwh.cfg') as configfile: config.read_file(configfile) ANGELCO_EMAIL = config.get('ANGELCO', 'EMAIL') ANGELCO_PASSWORD = config.get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_config(self):\n # TODO: parse config file\n pass", "def parse_conf(self):\n\n parser = configparser.RawConfigParser()\n parser.read(self.filename)\n\n try:\n self.id_node = parser['CONF_MACHINE']['ID_NODE']\n\n # eliminate possible white spaces b...
[ "0.7338273", "0.65946966", "0.6553853", "0.6462676", "0.6443636", "0.6435526", "0.64032066", "0.6393902", "0.6384757", "0.6336177", "0.63237095", "0.6297659", "0.62877256", "0.62548345", "0.6230277", "0.6215732", "0.621042", "0.62055796", "0.6202254", "0.6191139", "0.618787",...
0.71468973
1
Find the length of a leb128 field in a bytestream
def len_leb128(self,bstream): start = bstream.offset length = 0 r_byte = bstream.read(1) if r_byte != 0x0: length = 1 while len(r_byte) == 1 and length < 5 and r_byte[0] & 0x80 != 0x0: length+=1 r_byte = bstream.read(1) bstream.offset = start return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bit_length(self, ???):", "def length(self):\n return struct.unpack('<B', self.pkt.payload[2:3])[0]", "def length(self):\n return struct.unpack('<B', self.pkt.payload[2:3])[0]", "def length(self):\n return struct.unpack('<H', self.pkt.payload[2:4])[0]", "def length(self):\n r...
[ "0.6960859", "0.68176603", "0.68176603", "0.68099785", "0.67909276", "0.6746086", "0.6694288", "0.660601", "0.64682", "0.6451434", "0.6451434", "0.6451434", "0.6451434", "0.6451434", "0.6451434", "0.6451434", "0.6451434", "0.6451434", "0.6451434", "0.6451434", "0.6451434", ...
0.7991842
0
Add the given Reply to this transaction store's list of responses. Also add to processedRequests if not added previously.
async def append(self, reply: Reply) \ -> None: result = reply.result identifier = result.get(f.IDENTIFIER.nm) txnId = result.get(TXN_ID) logger.debug("Reply being sent {}".format(reply)) if self._isNewTxn(identifier, reply, txnId): self.addToProcessedTxns...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addToProcessedTxns(self,\n identifier: str,\n txnId: str,\n reply: Reply) -> None:\n self.transactions[txnId] = reply\n if identifier not in self.processedRequests:\n self.processedRequests[identifier] = {}\n...
[ "0.6899966", "0.6166129", "0.61250067", "0.5979266", "0.57536274", "0.56638956", "0.5634618", "0.5630767", "0.54890007", "0.5479965", "0.5479965", "0.5436922", "0.5425434", "0.5344658", "0.5177299", "0.515309", "0.514785", "0.5144238", "0.51264435", "0.5090172", "0.5059836", ...
0.8082104
0
If client is not in `processedRequests` or requestId is not there in processed requests and txnId is present then its a new reply
def _isNewTxn(self, identifier, reply, txnId) -> bool: return (identifier not in self.processedRequests or reply.reqId not in self.processedRequests[identifier]) and \ txnId is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testReplyWhenRequestAlreadyExecuted(looper, nodeSet, client1, sent1):\n # Since view no is always zero in the current setup\n looper.run(eventually(checkSufficientRepliesRecvd,\n client1.inBox,\n sent1.reqId,\n 2,\n ...
[ "0.6786671", "0.64508814", "0.64042187", "0.60409987", "0.5892617", "0.55976886", "0.5570875", "0.54957646", "0.54149187", "0.5410394", "0.5357963", "0.5327926", "0.5290472", "0.5285692", "0.51636094", "0.5159471", "0.5154646", "0.5153234", "0.51339537", "0.5120444", "0.51175...
0.66603124
1
Prints layer by layer inference times. Good for profiling which ops are most costly in your model.
def print_stats(exec_net, input_data, n_channels, batch_size, input_blob, out_blob, args): # Start sync inference print("Starting inference ({} iterations)".format(args.number_iter)) infer_time = [] for i in range(args.number_iter): input_data_transposed_1=input_data[0:batch_size].transpose(0,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_layer_times(filename, only_model = -1):\n results = load_events.load_values(\n filename,\n event_names=['minibatch_time', 'objective_evaluation_time', 'objective_differentiation_time'],\n layer_event_names=['fp_time', 'bp_time', 'update_time', 'imcomm_time', 'opt_time'],\n model=-1)\n for m...
[ "0.68548775", "0.6575847", "0.6525138", "0.64967567", "0.6452878", "0.6437493", "0.63883066", "0.6276323", "0.6178201", "0.613917", "0.60818535", "0.6019198", "0.59552115", "0.5952985", "0.5936522", "0.5865066", "0.5844863", "0.5840789", "0.5832643", "0.58007747", "0.5759451"...
0.6702151
1
Here is where we recieve streamed images from the Kafka Server and convert them to a Flaskreadable format.
def getCamera1(): for msg in camera1: yield (b'--frame\r\n' b'Content-Type: image/jpg\r\n\r\n' + base64.b64decode(msg.value['image_bytes']) + b'\r\n\r\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen(self):\n\n # context = zmq.Context()\n # receiver = context.socket(zmq.PULL)\n self.receiver.connect(inference_url())\n\n while self.is_opened:\n ret = self.receiver.recv_pyobj()\n\n nparr = np.frombuffer(np.array(ret['data']), np.uint8)\n\n # lo...
[ "0.62036604", "0.59223443", "0.58639634", "0.58136076", "0.5789331", "0.57704866", "0.5751171", "0.5749711", "0.57081705", "0.5689918", "0.56880987", "0.5680199", "0.56609046", "0.56456715", "0.56061023", "0.5568508", "0.5554283", "0.5522024", "0.5515289", "0.55122995", "0.55...
0.60920733
1
generate and return a layer dict showing techniques used by software If softwaretype is specified as "malware" or "tool", only shows software of that type. If softwaretype is specified as "software" output layer shows both malware and tools
def generate(softwaretype="software"): # import the STIX data from MITRE/CTI stix = requests.get("https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json").json() ms = MemoryStore(stix_data=stix["objects"]) # software includes malware and tool types so perform two que...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_software(\n client: Act, matrice: AttckMatrice, output_format: Text = \"json\"\n) -> List:\n\n notify: List = []\n\n # Enterprise matrice has malwares and tools, but preattack has none of them\n for software in getattr(matrice, \"malwares\", []) + getattr(matrice, \"tools\", []):\n if de...
[ "0.5966972", "0.55872685", "0.5425678", "0.53959244", "0.528284", "0.52208155", "0.5148771", "0.5053533", "0.5021349", "0.50063014", "0.49968717", "0.49807563", "0.49731576", "0.4966501", "0.49594882", "0.49388883", "0.49147922", "0.4914047", "0.49095652", "0.4860251", "0.485...
0.8044187
0
Prepares letmehear to for audio processing. `source_path` Absolute or relative to the current directory path, containing audio file(s) or subdirectories with audio file(s) to process. `dest_path` Absolute or relative to the current directory path to store output files in. If None, output files are saved in `letmehear` ...
def __init__(self, source_path, dest_path=None, use_logging=logging.INFO): self.path_source = os.path.abspath(source_path) self.path_target = dest_path if use_logging: self._configure_logging(use_logging) logging.info('Source path: %s', self.path_source) if not os.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_audio(a_name, target=False):\n samprate = 16000 # Sampling Rate\n length = 16 # Amount of blocks for 1 walkthrough\n overlap = 8 # Step between samples in amount of blocks\n fft = 1024 # Length of block (64ms)\n\n # Upload and preparing data sets\n # audio_path = \"raw_data_wav/\"...
[ "0.55177593", "0.49116963", "0.47969633", "0.4784276", "0.4767295", "0.4715013", "0.45680743", "0.45591968", "0.45439425", "0.44847107", "0.4469214", "0.44230482", "0.43916404", "0.4383606", "0.4373705", "0.43536156", "0.43401626", "0.4333249", "0.43224534", "0.43181127", "0....
0.54969025
1
Sets letmehear into dry run mode, when all requested actions are only simulated, and no changes are written to filesystem.
def set_dry_run(self): self._dry_run = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dry_run(self, dry_run):\n\n self._dry_run = dry_run", "def dry(self):\n self._dry = True\n return self", "def do_dry_run(self):\n self.loggit.info('DRY-RUN MODE. No changes will be made.')\n msg = f'DRY-RUN: Update cluster routing transient settings: {self.settings}'\n ...
[ "0.6989833", "0.65439415", "0.6299042", "0.62920314", "0.6024881", "0.59835994", "0.59672785", "0.59232223", "0.58818495", "0.58818495", "0.58150184", "0.5740509", "0.55362505", "0.5323272", "0.52800596", "0.51863605", "0.51516193", "0.51297456", "0.50773555", "0.503785", "0....
0.7023573
0
Creates and returns dictionary of files in source directory. `recursive` if True search is also performed within subdirectories.
def get_dir_files(self, recursive=False): logging.info('Enumerating files under the source path (recursive=%s) ...', recursive) files = {} if not recursive: files[self.path_source] = [ f for f in os.listdir(self.path_source) if os.path.isfile(os.path.join(self.path_so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_file_dict():\n import os\n file_dict = {}\n for root, dirs, files in os.walk('.'):\n dirs[:] = [ # add any extra dirs to ignore #\n d for d in dirs\n if '.' not in d\n and 'ENV' not in d\n and '__' not in d\n and 'build' not in d\n ...
[ "0.66049916", "0.6600909", "0.63020784", "0.58902156", "0.58048713", "0.5802294", "0.5765301", "0.57375884", "0.5660179", "0.5609506", "0.5603751", "0.5581873", "0.55007124", "0.5482791", "0.5479842", "0.5460904", "0.54340225", "0.53852797", "0.53830934", "0.5363218", "0.5351...
0.7256247
0
Takes file dictionary created with `get_dir_files` and returns dictionary of the same kind containing only audio files of supported types.
def filter_target_extensions(self, files_dict): files_filtered = defaultdict(list) supported_formats = self.sox_get_supported_formats() logging.info('Filtering audio files ...') paths = list(files_dict.keys()) for path in paths: if not path.endswith('letmehear'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_all_music(directory, accept=(\".wav\", \".mp3\", \".ogg\", \".mdi\")):\n songs = {}\n for song in os.listdir(directory):\n name, ext = os.path.splitext(song)\n if ext.lower() in accept:\n songs[name] = os.path.join(directory, song)\n return songs", "def load_all_music(d...
[ "0.69851065", "0.69818187", "0.66238374", "0.6515361", "0.62522674", "0.6233915", "0.6141677", "0.6095092", "0.5976191", "0.59475046", "0.578013", "0.5737146", "0.5723099", "0.56094027", "0.56092876", "0.5605638", "0.5604673", "0.55708057", "0.5556047", "0.5521467", "0.548284...
0.7316186
0
Used to set output file(s) length in seconds.
def set_part_length(self, seconds): self._part_length = seconds
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputFiles(self, filesizelist):\n self.outputs = filesizelist\n self.outputSize = reduce(lambda x,y: x + y[1], filesizelist, 0)", "def set_length(self, ak_tpl: BKT, newLength: float): # -> None:\n ...", "def setoutputsize(self, size, column=None):\n pass", "def _get_file_leng...
[ "0.5842382", "0.5635569", "0.56217164", "0.5617861", "0.55581576", "0.5520264", "0.5480444", "0.5435008", "0.54311806", "0.5418363", "0.5389413", "0.53848577", "0.53634846", "0.53174406", "0.5293262", "0.5286535", "0.52863", "0.52863", "0.52807194", "0.52784336", "0.5253117",...
0.6179856
0
Used to set a backshift number of seconds for every part to be taken from a previous one.
def set_backshift(self, seconds): self._backshift = seconds
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prev_shifted_time(self):\n return self._prev_sim_time + self.options.time.start_clocktime", "def shift(self, num):\n if not num:\n self._times, self._values = self._times, self._values\n elif num > 0:\n self._times, self._values = self._times[:-num], self._values[n...
[ "0.6316349", "0.60978645", "0.590834", "0.5880278", "0.577192", "0.5754429", "0.56243247", "0.55874705", "0.5542577", "0.5534393", "0.5534393", "0.5491483", "0.5482042", "0.5442997", "0.5414095", "0.5402406", "0.5342204", "0.5330644", "0.5292622", "0.5289171", "0.5285309", ...
0.7543604
0
Used to set output file(s) speed. Expects ratio modifier, e.g. 1.3
def set_speed(self, ratio): self._speed = ratio
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_speed():\n pass", "def setSpeed(self, v):\n\t\tconverted = self.convertSpeed(v)\n\t\tprint(converted)\n\t\t# set both stage speeds\n\t\tself.zaberSend(self.translation[\"hor\"], self.cmd[\"setTargetSpeed\"], data = converted)\n\t\tself.zaberSend(self.translation[\"ver\"], self.cmd[\"setTargetSpeed\"],...
[ "0.6482639", "0.64649606", "0.6284442", "0.6176265", "0.6143324", "0.6112721", "0.6111029", "0.609452", "0.59899086", "0.5989725", "0.5981956", "0.5947498", "0.593144", "0.5919195", "0.5886926", "0.58778495", "0.58514136", "0.5839829", "0.5813059", "0.5805993", "0.5775662", ...
0.7200764
0
Checks whether SoX is available.
def sox_check_is_available(self): result = self._process_command('sox -h', PIPE, supress_dry_run=True) return result[0] == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_available():", "def check_availability(self):\n pass", "def _check(self):\n\t\tif not self._raven:\n\t\t\traise NoDeviceFoundException", "def is_available(self) -> bool:\n raise NotImplementedError() # pragma: nocover", "def available(self):\n\t\t\treturn False", "def available(self...
[ "0.7127908", "0.70180845", "0.65250325", "0.6443219", "0.64104086", "0.64104086", "0.64104086", "0.6391573", "0.6366981", "0.6366981", "0.63340026", "0.63170475", "0.63147825", "0.62995595", "0.62995595", "0.6297277", "0.6297277", "0.6297277", "0.6264491", "0.61891913", "0.61...
0.87171984
0
Asks SoX for supported audio files formats and returns them as a list.
def sox_get_supported_formats(self): formats = ['wav'] result = self._process_command('sox -h', PIPE, supress_dry_run=True) matches = re.findall(RE_SOX_AUDIO_SUPPORT, result[1][0]) if matches is not None: formats = matches[0].strip().split(' ') logging.debug('Sox su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAudioFileFromFilelist(audiofiltered):\n for audioFile in audiofiltered:\n audioRoot, audioExt = os.path.splitext(audioFile)\n if audioExt in ['.wav', '.aiff', '.aif']:\n return audioFile", "def getSupportedFileFormats():\n return {\"Bitmap\":[\"*.bmp\", \"*.dib\"], \"JPE...
[ "0.66873074", "0.6548086", "0.6411624", "0.6321018", "0.63118595", "0.6293166", "0.6282144", "0.6252007", "0.61258864", "0.61227095", "0.60537213", "0.6052438", "0.6052438", "0.60509884", "0.6035291", "0.5974638", "0.58423185", "0.58144164", "0.578201", "0.575945", "0.5685593...
0.8203795
0
Calculates maximum and minimum sample rates for given files. Returns tuple (min_rate, max_rate, files_to_rates_dict).
def sox_get_sample_rates(self, files): min_rate = max_rate = None files_to_rates_dict = {} for f in files: result = self._process_command('soxi -r "%s"' % f, PIPE) try: rate = int(result[1][0].strip('\n')) except ValueError: ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sample_rate_according_filename(filename: str, sample_rates: Dict[str, int]) -> int:\n if filename.split('_')[-1] in ('right', 'left'):\n filename = filename.split('_')[0]\n return sample_rates[filename]", "def load_sample_rates(path: str) -> Dict[str, int]:\n sample_rates = pd.read_csv(pa...
[ "0.65236944", "0.56431794", "0.54856896", "0.5406255", "0.53362864", "0.52786833", "0.52014273", "0.51985294", "0.51510394", "0.5121336", "0.5098462", "0.50319874", "0.50240964", "0.4994486", "0.49664557", "0.49629846", "0.49505916", "0.49496064", "0.49304843", "0.4920416", "...
0.7960825
0
Returns temporary resampled file name from filepath.
def get_resampled_filename(filepath): try: filepath = filepath.encode('utf-8') except UnicodeDecodeError: pass return 'tmp_%s.flac' % md5(filepath).hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_temporary_file_name(original_file):\n directory, basename = os.path.split(original_file)\n basename = basename[-MAX_TEMPORARY_FILE_BASENAME_LENGTH:]\n\n random_hex = binascii.b2a_hex(os.urandom(16)).decode('utf-8')\n new_file_path = os.path.join(directory, '%s%s' % (random_hex, basename))\n\n return n...
[ "0.67282295", "0.6667649", "0.66115636", "0.6438271", "0.64057815", "0.63899124", "0.63718104", "0.62631476", "0.6262597", "0.62606746", "0.6260422", "0.6186918", "0.61814684", "0.6142914", "0.6125212", "0.60798645", "0.6061999", "0.6057938", "0.60536873", "0.6019673", "0.601...
0.76514924
0
Creates a source file at given target path from one more input files.
def sox_create_source_file(self, files, target): logging.debug('Source file will be made from:\n%s\n', '\n'.join(files)) logging.info('Making source file: %s', target) options = '' effects = '' files_to_precess = [] if len(files) > 1: options = '--combine co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assemble_source_files(project, base_dir):\n source_files = project.source_files.all()\n for f in source_files:\n target_dir = os.path.join(base_dir, f.project_dir)\n abs_target = os.path.abspath(os.path.join(target_dir, f.file_name))\n if not abs_target.startswith(target_dir):\n ...
[ "0.6378731", "0.62601465", "0.6132644", "0.6037653", "0.5912019", "0.5846756", "0.5831473", "0.5821771", "0.57860816", "0.57359564", "0.57261264", "0.5705366", "0.5654199", "0.55903476", "0.5587134", "0.5579851", "0.55784553", "0.55677485", "0.5560209", "0.5544423", "0.549489...
0.7413827
0
Asks SoX for given file length in seconds and returns them as float. Returns 1000 on dry run.
def sox_get_audio_length(self, audio_file): logging.info('Getting source file length ...') result = self._process_command('soxi -D "%s"' % audio_file, PIPE) if result[1][0] != '': return float(result[1][0].strip('\n')) else: return 1000
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_duration_sox_s(audio_file_path: str) -> float:\n global FS_HZ\n assert FS_HZ is not None\n duration_n = get_duration_sox_n(audio_file_path)\n return duration_n / FS_HZ", "def get_duration_sox_n(audio_file_path: str) -> float:\n global FS_HZ\n assert FS_HZ is not None\n audiometadata ...
[ "0.695703", "0.6086739", "0.5925723", "0.576181", "0.5759218", "0.5731954", "0.5640799", "0.56291753", "0.5601044", "0.5574256", "0.5565806", "0.55071586", "0.5486385", "0.54476947", "0.54070485", "0.53769195", "0.53756505", "0.53739536", "0.5329043", "0.5325697", "0.5305705"...
0.61282736
1
Using SoX chops source audio file into parts of given length. Chopping is done in such a way that every next audio part contains one (1) second from the previous.
def sox_chop_source_audio(self, source_filename, part_length, backshift=0): logging.info('Preparing for source file chopping ...') wav_length = self.sox_get_audio_length(source_filename) if wav_length <= part_length: parts_count = 1 else: # Calculate audio length...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cut_audio(old_path, new_path, start, end):\r\n fs, data = wavfile.read(old_path)\r\n indx_start = int(start*fs)\r\n indx_end = int(end*fs)+1\r\n wavfile.write(new_path,fs,data[indx_start:indx_end])\r\n\r\n return True", "def read_audiofile(audio_name,cutToLength):\n fs, data = wavfile.read(...
[ "0.61208063", "0.60243565", "0.5976565", "0.584501", "0.58333117", "0.57951015", "0.5730551", "0.56922776", "0.5681019", "0.5678523", "0.5641848", "0.5629693", "0.5624784", "0.55397713", "0.5506439", "0.54790694", "0.5460991", "0.54587924", "0.54231524", "0.54199386", "0.5403...
0.7706262
0
Removes temporary created source files.
def remove_tmp_sources(source_filename): logging.info('Removing temporary files ...') source_dir = os.path.dirname(source_filename) if os.path.exists(source_filename): os.remove(source_filename) for f in os.listdir(source_dir): if f.startswith('tmp_'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(self):\n os.remove(\"temp.py\") # Delete the file \"temp.py\", to free up disk space", "def remove_temporary_files():\n try:\n xml_file_path, bin_file_path = get_ida_exported_files()\n if os.path.isfile(xml_file_path):\n os.remove(xml_file_path)\n\n if os.path...
[ "0.81248486", "0.76791877", "0.75705147", "0.7484428", "0.7383845", "0.7069873", "0.7018626", "0.7002822", "0.69841164", "0.695557", "0.69193155", "0.6911832", "0.6905299", "0.6900335", "0.68992656", "0.6885628", "0.68790567", "0.6870767", "0.6839062", "0.6825669", "0.6798219...
0.796507
1
Load Configurations from config.ini file located in the same directory
def load_config(): config = ConfigParser() config.read(os.path.join(os.path.dirname(__file__), 'config.ini')) return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config():\n config = configparser.ConfigParser()\n config.read('config.ini')\n return config", "def load_config():\n config_file = os.path.join(\n Path(os.path.dirname(os.path.realpath(__file__))).parent,\n \"config.ini\"\n )\n if not os.path.exists(config_file):\n ...
[ "0.82460165", "0.7804471", "0.7645603", "0.76166105", "0.74599785", "0.74189556", "0.7355172", "0.7337519", "0.7330627", "0.727144", "0.7243488", "0.7229853", "0.719841", "0.71764666", "0.7172671", "0.71649605", "0.7143935", "0.71249795", "0.7120902", "0.711131", "0.7106953",...
0.8290944
0
Load configurations from config.ini and call method to set env variables when an object will be instantiated.
def __init__(self): self.config = load_config() self.set_env_var()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, environment):\n with open('config.json') as f:\n self.config = eval(f.read())\n self.config = self.config[environment]", "def __init__(self, environment='develop'):\n\n cwd = path.dirname(path.abspath(__file__))\n config_dir = path.join(cwd, 'configs')\n\...
[ "0.73404276", "0.6964214", "0.68908703", "0.6842718", "0.66873354", "0.6576955", "0.6550852", "0.6545068", "0.6535788", "0.6514443", "0.6433528", "0.64094526", "0.63856107", "0.6378766", "0.63634384", "0.6355668", "0.634891", "0.63091236", "0.62860405", "0.6229751", "0.622409...
0.79680717
0
Load corenlp properties for coreference resolution.
def corenlp_coref_props(self): coref_props = self.config._sections['corenlp_coref_props'] return coref_props
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):\n for prop in self.properties:\n try:\n value = getattr(self, prop)\n self._prop_dict[prop] = value\n except AttributeError as ate:\n pass", "def initProperties(self):\n self.setFoldComments(Preferences.getEditor(\"C...
[ "0.5345785", "0.5221034", "0.5063204", "0.50521326", "0.5028855", "0.49547", "0.4940425", "0.4928802", "0.48686203", "0.48553947", "0.48520488", "0.48199075", "0.48059475", "0.48050794", "0.4777459", "0.47767904", "0.47611597", "0.47114277", "0.47111797", "0.46975923", "0.467...
0.7217
0
Test single digit min base.
def test_single_digit_min_base(self): expected = 2 digit = 1 assert expected == min_base(digit)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_digit_14_min_base(self):\n expected = 6\n digit = 14\n\n assert expected == min_base(digit)", "def test_digit_12_min_base(self):\n expected = 5\n digit = 12\n\n assert expected == min_base(digit)", "def min_digit(x):\n \"\"\" GRAPSTE TON KWDIKA SAS APO KATW...
[ "0.8108461", "0.79613477", "0.6992336", "0.6729573", "0.631448", "0.6166285", "0.60119784", "0.59899604", "0.5962518", "0.59565884", "0.5881729", "0.5834557", "0.5809722", "0.5784438", "0.57559973", "0.5659558", "0.5654602", "0.5641183", "0.55670154", "0.55575097", "0.5541654...
0.87544614
0
Test digit 12 min base.
def test_digit_12_min_base(self): expected = 5 digit = 12 assert expected == min_base(digit)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_digit_14_min_base(self):\n expected = 6\n digit = 14\n\n assert expected == min_base(digit)", "def test_single_digit_min_base(self):\n expected = 2\n digit = 1\n\n assert expected == min_base(digit)", "def modifier(base):\n return int(math.floor((base - 10)...
[ "0.68628234", "0.6560506", "0.5813826", "0.5736882", "0.570259", "0.5691976", "0.55865026", "0.5557803", "0.5555295", "0.54997677", "0.5392188", "0.5373415", "0.5369537", "0.5350108", "0.5335272", "0.53054", "0.5272494", "0.52332306", "0.52300835", "0.5220331", "0.5219849", ...
0.7900096
0
Test digit 14 min base.
def test_digit_14_min_base(self): expected = 6 digit = 14 assert expected == min_base(digit)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_digit_12_min_base(self):\n expected = 5\n digit = 12\n\n assert expected == min_base(digit)", "def test_single_digit_min_base(self):\n expected = 2\n digit = 1\n\n assert expected == min_base(digit)", "def min_digit(x):\n \"\"\" GRAPSTE TON KWDIKA SAS APO K...
[ "0.73744816", "0.67325693", "0.5823343", "0.5726001", "0.5668755", "0.5668755", "0.5592649", "0.55830795", "0.5475364", "0.54414123", "0.5374844", "0.5290579", "0.5288535", "0.52868295", "0.5286815", "0.5249504", "0.5242419", "0.5217242", "0.52117115", "0.5208738", "0.5194527...
0.8115787
0
Set up function that creates a test client, with a new user and a regular user that will be listed in the admin page.
def setUp(self): # Create client self.client = Client() # Create the admin user self.admin_user = get_user_model().objects.create_superuser( email='admin@gmail.com', password='adminTesting123' ) # Login the admin user self.client.force_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.client = Client()\n #creamos un usuario en la db\n self.user = User.objects.create_user('super', 'lennon@thebeatles.com', 'super')", "def setup_test_user(self):\n self.setup_test_tenant()\n self.test_user = rand_name('test_user_')\n se...
[ "0.7668336", "0.7579043", "0.75625336", "0.7551012", "0.7518695", "0.7506115", "0.74307555", "0.73853904", "0.7229625", "0.7229625", "0.7229625", "0.7219692", "0.72146237", "0.72099113", "0.7081468", "0.7060547", "0.70462763", "0.704133", "0.7039718", "0.6998332", "0.6997446"...
0.794958
0
Write RINEX navigation file for 3 days (rundate +/1 day)
def rinex2_nav(dset): for date_offset in range(-1, 2): write_one_day(dset, dset.analysis["rundate"] + timedelta(days=date_offset))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_one_day(dset, date):\n brdc = apriori.get(\n \"orbit\",\n rundate=dset.analysis[\"rundate\"],\n system=tuple(dset.unique(\"system\")),\n station=dset.vars[\"station\"],\n apriori_orbit=\"broadcast\",\n )\n\n meta = brdc.dset_edit.meta[date.strftime(\"%Y-%m-%d\"...
[ "0.6438272", "0.53687155", "0.52514434", "0.5022941", "0.49938595", "0.49613258", "0.49171513", "0.48830613", "0.48462123", "0.48399088", "0.4824141", "0.4767896", "0.47020718", "0.46944073", "0.4677153", "0.46443874", "0.46366394", "0.45609674", "0.45609015", "0.4550348", "0...
0.71589833
0
Write RINEX navigation file for given date
def write_one_day(dset, date): brdc = apriori.get( "orbit", rundate=dset.analysis["rundate"], system=tuple(dset.unique("system")), station=dset.vars["station"], apriori_orbit="broadcast", ) meta = brdc.dset_edit.meta[date.strftime("%Y-%m-%d")] data = brdc.dset_ed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rinex2_nav(dset):\n for date_offset in range(-1, 2):\n write_one_day(dset, dset.analysis[\"rundate\"] + timedelta(days=date_offset))", "def write_file(date, num_days):\n month = '{0:02d}'.format(date.month)\n day = '{0:02d}'.format(date.day)\n\n with open(file_name, 'a+') as out_file:\n ...
[ "0.681492", "0.58828324", "0.5515422", "0.5325432", "0.52559066", "0.5186145", "0.514998", "0.5144424", "0.5138187", "0.5133589", "0.5105928", "0.5087973", "0.50841504", "0.50436205", "0.4952118", "0.49071655", "0.48948997", "0.48907757", "0.48899305", "0.48826486", "0.488112...
0.6964463
0
Calculate some simple statistics about users of sessions
def action_session_user_stats(args, config, db, wdb): wdb.execute('''CREATE OR REPLACE VIEW analysis_session_users AS (SELECT DISTINCT analysis_session_requests.session_id as session_id, analysis_requestlog_combined.user_sid as user_sid FROM analysis_requestlog_combined,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_stats(df):\r\n print('\\nCalculating User Stats...\\n')\r\n start_time = time.time()\r\n # TO DO: Display counts of user types\r\n df = ['user type'].value_counts()\r\n print('count of user typs:\\n')\r\n # TO DO: Display counts of gender\r\n df = ['grnder'].value...
[ "0.7254027", "0.7163929", "0.7048962", "0.7035427", "0.70172447", "0.6989257", "0.69802827", "0.6969384", "0.6962817", "0.69367063", "0.6914038", "0.68993825", "0.6896018", "0.6889866", "0.68877953", "0.68837255", "0.68703", "0.68660045", "0.68443763", "0.6824871", "0.6811637...
0.78045124
0
if user asks for an item that's unavailable, they should not be given the item, and their money should be returned
def test_unavailable_item(self): item, change, _ = give_item_and_change('crisps', .50) self.assertIsNone(item) self.assertEqual(change, 0.5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unavailable_item(self):\n item, change, _ = give_item_and_change('crisps', '1.00 .50')\n self.assertIsNone(item)\n self.assertEqual(change, 1.35)", "def test_unavailabe_items(self):\n item, change, _ = give_item_and_change('crisps', .50)\n self.assertIsNone(item)\n ...
[ "0.7092874", "0.6525508", "0.6484838", "0.64494467", "0.6339492", "0.62511873", "0.6181593", "0.6174058", "0.61449325", "0.6115728", "0.61110276", "0.6052567", "0.60428303", "0.60210925", "0.6020287", "0.60103595", "0.59621745", "0.59602994", "0.595624", "0.5945737", "0.59422...
0.7022732
1
Find the rotation matrix that will rotate a onto b.
def find_rotation(a, b): a.shape = (3,) b.shape = (3,) a /= np.linalg.norm(a) b /= np.linalg.norm(b) v = np.cross(a, b) angle_AB = -1*vector_angle(a, b) print(angle_AB) s = np.linalg.norm(v) * np.sin(angle_AB) c = np.dot(a, b) * np.cos(angle_AB) # Rotat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_rotation(a, b):\n if not np:\n raise PysimmError('pysimm.calc.find_rotation function requires numpy')\n a = np.array(a)\n b = np.array(b)\n\n a_x_b = np.cross(a, b)\n axis = a_x_b / np.linalg.norm(a_x_b)\n theta = acos(np.dot(a, b) / np.linalg.norm(a) / np.linalg.norm(b))\n\n s...
[ "0.8111493", "0.7199534", "0.6795931", "0.656168", "0.65125513", "0.6504331", "0.6497843", "0.64215285", "0.63962364", "0.61423236", "0.61377865", "0.6086032", "0.60602015", "0.60542876", "0.60507715", "0.6009267", "0.5892665", "0.58833164", "0.58649683", "0.5860341", "0.5802...
0.79258054
1
Method to find the rotation that takes points from m1 onto points in m2. Uses singular value decomposition algorithm taken from Nghia Ho,
def SVD_rotate(m1, m2): assert m1.shape[0] == m2.shape[0] # Find the centroids of m1, m2 centroid1 = np.mean(m1, axis=0) centroid2 = np.mean(m2, axis=0) # Build the covariance matrix H = np.dot((m1 - centroid1).T, (m2 - centroid2)) U, S, V = np.linalg.svd(H) # Middle matrix is to ens...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _findrotationmatrix(ccdata1, ccdata2):\n natoms = ccdata1.natom\n J = np.zeros((3, 3), dtype=np.float)\n\n for i in range(natoms):\n J += np.outer(ccdata1.atomcoords[0][i], ccdata2.atomcoords[0][i])\n\n U, s, V = np.linalg.svd(J)\n\n R = np.transpose(np.dot(V, np.transpose(U)))\n\n ret...
[ "0.6994456", "0.69056857", "0.6586826", "0.6516587", "0.6442773", "0.6389191", "0.63765293", "0.62826663", "0.62586", "0.6233807", "0.619714", "0.61885524", "0.61745304", "0.6143739", "0.6107027", "0.61043227", "0.61020106", "0.608416", "0.608416", "0.6079441", "0.6075789", ...
0.7534391
0
Generate some polynomial data
def generate_polynomial(): degree = numpy.random.choice(range(3, 7)) x = numpy.linspace(-10, 10, 1000) coefficients = numpy.random.chisquare(3, size=degree) + 1 coefficients *= numpy.random.choice([-1, 1], size=coefficients.shape) coefficients *= 0.5 y = numpy.polyval(coefficients, x) add_no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_polynomial_features(self, X) :\n\n n,d = X.shape\n\n ### ========== TODO : START ========== ###\n # part b: modify to create matrix for simple linear model\n # part g: modify to create matrix for polynomial model\n Phi = X\n m = self.m_\n\n if m == 1:\n...
[ "0.7538903", "0.7480027", "0.7236792", "0.7120117", "0.7109104", "0.7046839", "0.6833415", "0.6825309", "0.6752898", "0.6739122", "0.6643049", "0.6626195", "0.6606784", "0.65941375", "0.65254253", "0.65011287", "0.64472425", "0.64471453", "0.63934326", "0.63751334", "0.630603...
0.7791223
0
Calls a function, with the function's params being the object's __dict__ values.
def call(self, func): args = tuple(self.__dict__.values()) try: return eval("func" + str(args)) except Exception, e: raise ValueError("Given Function is not valid for calling: %s" % e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _call_it(params): # pragma: no cover\n instance, name, args = params\n kwargs = {}\n return getattr(instance, name)(*args, **kwargs)", "def call_func(self, quantity, obj, args):\n\n try:\n result = getattr(obj, quantity)(*args)\n except KeyError:\n self.log.erro...
[ "0.6939864", "0.65609187", "0.64944154", "0.6451387", "0.6444234", "0.6434979", "0.63308376", "0.62893623", "0.61917114", "0.61473817", "0.6143386", "0.61355615", "0.6069545", "0.60603714", "0.60187966", "0.6007016", "0.59852356", "0.59852356", "0.5959359", "0.59573925", "0.5...
0.6599899
1
Inserts given 'value' inside self.__dict__, with it's key being the inputted 'pos' value. This function is similar to the insert function belonging to lists.
def insert(self, pos, value): items = self.__dict__.values() if not isinstance(pos, int) or pos < 0: raise ValueError("'pos' value is not positive integer.") elif pos > len(items): raise ValueError("'pos' value is not a position in self.__dict__") items.insert(pos, value) new_dict = {} for x, y in enu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert_item(self, key: _KT, value: _VT) -> None:\n dict.__setitem__(self, key, value)", "def insert(self, key, value):\n\t\tself.__insert(key, value, key[1:])", "def __setitem__(self, key, value):\n self.insert(key, value)", "def insert(self, value, pos):\r\n\r\n if self.head is Non...
[ "0.72585404", "0.69225717", "0.69138044", "0.6725754", "0.6710904", "0.66295755", "0.6614174", "0.659485", "0.65802276", "0.65781033", "0.6519577", "0.6513265", "0.6459961", "0.64219296", "0.6367862", "0.6348602", "0.6346603", "0.6286433", "0.62864274", "0.6267077", "0.624122...
0.8579885
0
split_file for the 'src' project in the trunk.
def ChromeTreeFileSplitter(path): # Exclude .DEPS.git from triggering builds on chrome. if path == 'src/.DEPS.git': return None # List of projects we are interested in. The project names must exactly # match paths in the Subversion repository, relative to the 'path' URL # argument. build_utils.SplitPath...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_src_folder(self, src_folder: str) -> None:", "def source_data_files(self, data_dir, tmp_dir, dataset_split):\n raise NotImplementedError()", "def split(self, start, nsamps, filename=None, gulp=1024,\n back_compatible=True, **kwargs):\n if filename is None:\n fi...
[ "0.5839572", "0.5629381", "0.545824", "0.54164666", "0.5395968", "0.53366303", "0.5248026", "0.521077", "0.520225", "0.52008224", "0.5186133", "0.5172932", "0.5105603", "0.5100697", "0.50301254", "0.5015693", "0.50072145", "0.5003615", "0.49936536", "0.49641842", "0.49630165"...
0.61515033
0
convert RGB image to YIQ image using transform matrix
def rgb2yiq(imRGB): trans = np.array([[0.299, 0.587, 0.114], [0.596, -0.275, -0.321], [0.212, -0.523, 0.311]]) return np.dot(imRGB, trans)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgb2yiq(imRGB):\n return np.dot(imRGB, TRANSFORM.T.copy())", "def transformRGB2YIQ(imgRGB: np.ndarray) -> np.ndarray:\r\n YIQ_from_RGB = np.array([[0.299, 0.587, 0.114],\r\n [0.59590059, -0.27455667, -0.32134392],\r\n [0.21153661, -0.52273617, 0.3...
[ "0.7917481", "0.74076706", "0.73373646", "0.73334646", "0.73267543", "0.7238105", "0.7093386", "0.7060213", "0.6968569", "0.6862498", "0.6690507", "0.6534706", "0.6488643", "0.6380209", "0.6290675", "0.62476933", "0.6240027", "0.6191612", "0.61170465", "0.61043394", "0.609820...
0.7516433
1
performs quantization loop until the process converges or at most n_iter rounds
def perform_quantization_loop(z, q, n_iter, hist, bins): error = [] current_error = 0 for i in range(n_iter): sigma = np.zeros(len(q)) for j in range(len(q)): p_z = hist[z[j]:z[j+1]+1] Z = bins[z[j]:z[j+1]+1] divided = sum(p_z*Z) divisor = sum(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n if not self._no_progress and self._verbose:\n from progressbar import ProgressBar\n progress = ProgressBar()\n iter_range = progress(range(self._iters))\n else:\n iter_range = range(self._iters)\n\n if self._no_progress and self._tim...
[ "0.62470347", "0.62403727", "0.6138393", "0.61302924", "0.61291933", "0.5994922", "0.5904798", "0.5871222", "0.5869976", "0.5865474", "0.58552843", "0.58093476", "0.57621", "0.5730274", "0.5709154", "0.56889963", "0.56818104", "0.5676366", "0.5656434", "0.563972", "0.563972",...
0.6888727
0
performs optimal quantization of a given grayscale or RGB image
def quantize(im_orig, n_quant, n_iter): shape_len = len(im_orig.shape) if shape_len == 2: # grayscale return quantization_helper(im_orig, n_quant, n_iter) elif shape_len == 3: # rgb im_yiq = rgb2yiq(im_orig) y = im_yiq[:, :, 0] y_quant, error = quantization_helper(y, n_quan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantize(im_orig, n_quant, n_iter):\n rgb, y, im_yiq = check_rgb(im_orig)\n hist_orig, bin_edges = np.histogram(y*(BITS - 1), BITS, (0, BITS - 1))\n z = np.concatenate([[0], initial_z(hist_orig, n_quant), [(BITS-1)]])\n q = find_q(z, hist_orig)\n error = [calc_err(q, z, hist_orig)]\n for i in...
[ "0.67525816", "0.6369292", "0.6323539", "0.62565947", "0.6214317", "0.5944521", "0.59443814", "0.587811", "0.5848547", "0.5848547", "0.5848547", "0.5751432", "0.5619287", "0.55748063", "0.555569", "0.5498724", "0.54805", "0.54788357", "0.5396808", "0.5392538", "0.53866196", ...
0.67281544
1
Create label tensor for a minibatch training from a list of sequences for the provided target indices. If sequences are unequal then they are padded with a NaN value.
def create_labels_tensor_for_minibatch(sequences: List[ClassificationItemSequence[ScalarItem]], target_indices: List[int]) -> torch.Tensor: return sequences_to_padded_tensor( sequences=[seq.get_labels_at_target_indices(target_indices) for seq in sequences],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_labels_at_target_indices(self, target_indices: List[int]) -> torch.Tensor:\n target_indices = sorted(target_indices)\n\n def _get_label_or_nan(idx: int) -> torch.Tensor:\n return self.items[idx].label if idx < len(self.items) else torch.tensor([np.nan])\n\n if any(p < 0 for ...
[ "0.64945525", "0.61621475", "0.5966142", "0.5797458", "0.5754382", "0.57243425", "0.56933594", "0.56704473", "0.5669515", "0.5635334", "0.56328714", "0.5534819", "0.551395", "0.5425681", "0.54200053", "0.54051876", "0.54023015", "0.5368551", "0.5368551", "0.53455186", "0.5323...
0.8987712
0
Given a url string, find the file extension at the end.
def get_ext(url): path = urlparse(url).path ext = splitext(path)[1] return ext
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_file_extension(url_file):\n pattern = re.split(\"\\.\",url_file)\n return pattern[-1]", "def get_ext(url):\r\n root, ext = splitext(url)\r\n return ext", "def _get_file_name(url: str) -> str:\n url = url.strip('/')\n result = findall(r'/(\\w+\\.\\w+)[?|$]', url)\n if result:\n ...
[ "0.86134696", "0.84738183", "0.80189323", "0.7584992", "0.75357443", "0.7505225", "0.745068", "0.7387205", "0.73681", "0.7355658", "0.73300385", "0.7305834", "0.7290223", "0.7265099", "0.7252523", "0.72133154", "0.72030866", "0.7150729", "0.7100172", "0.70208377", "0.6979139"...
0.8476722
1
Get document context. Lugar staff will be entering and editing URLs for the following 3 document types, and should be editable in their original form but also saved as archived links
def get_document_context(context): document_types = { 'transcript': 'transcript', 'opening_statement_chair': 'chair opening statement', 'opening_statement_rm': 'ranking member opening statement', } eventdocuments_qs = EventDocument.objects.filter( event_id=context['hearing']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def document_details(context, document):\n return {'document': document, 'request': context['request']}", "def get_doc_context(self, docname, body, metatags):\n\n # find out relations\n prev = next = None\n parents = []\n rellinks = self.globalcontext['rellinks'][:]\n relate...
[ "0.7030186", "0.66666174", "0.6468771", "0.62081987", "0.60369486", "0.58938795", "0.5826926", "0.5760497", "0.57392025", "0.57280135", "0.5723985", "0.5702111", "0.56988734", "0.5690935", "0.56782657", "0.5647661", "0.558646", "0.5575863", "0.55497485", "0.5548884", "0.55167...
0.7395891
0
Find and create committees as EventParticipants.
def save_committees(event, committees): for committee in committees: name = committee.name organization = Organization.objects.get(id=committee.id) entity_type = "organization" new_committee = EventParticipant( name=name, event=event, organization=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_committees(collection, committees):\n collection.remove()\n for c in committees:\n if not collection.find_one({\"committee_id\": c[\"committee_id\"]}):\n collection.insert(c)", "def invite_org_or_player(self, event):\n for arg in self.lhslist:\n org, pc = self.g...
[ "0.5298337", "0.5100352", "0.49935168", "0.49894413", "0.4963217", "0.49325606", "0.49297416", "0.48516214", "0.48137006", "0.48101404", "0.47957727", "0.47957727", "0.47882983", "0.47866845", "0.4747633", "0.47383985", "0.47283602", "0.46981072", "0.4695059", "0.46948302", "...
0.69607586
0
Derive a secure Fernet key from arbitrary input password.
def derive_fernet_key(password, salt): kdf = pbkdf2.PBKDF2HMAC( algorithm=hashes.SHA256(), length=32, salt=encoding.force_bytes(salt), iterations=100000, backend=default_backend() ) return base64.urlsafe_b64encode(kdf.derive( encoding.force_bytes(password)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_key(password, iterations=ITERATIONS):\n key = PBKDF2(password, SALT, dkLen=KEY_LENGTH_BYTES, count=iterations)\n return key", "def get_fernet_key(app: Sanic, passphrase: str) -> bytes:\n salted = (passphrase + app.secret_key).encode()\n key = hashlib.sha256(salted).digest()[:32]\n return ...
[ "0.6870849", "0.65315944", "0.647991", "0.6411447", "0.6401939", "0.6350924", "0.6326737", "0.6111555", "0.6109095", "0.6086658", "0.60474956", "0.60229516", "0.59270436", "0.5917966", "0.5900764", "0.5893523", "0.5871855", "0.5840717", "0.58245474", "0.5807514", "0.57842696"...
0.7723482
0
If we get a response, add the node to the routing table. If we get no response, make sure it's removed from the routing table.
def handleCallResponse(self, result, node): if result[0]: self.log.info("got response from %s, adding to router" % node) _log.debug("got response from %s, adding to router" % node) if self.router.isNewNode(node): self.transferKeyValues(node) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def update_routing_table(self, node_id: Optional[DHTID], peer_id: PeerID, responded=True):\n node_id = node_id if node_id is not None else self.routing_table.get(peer_id=peer_id)\n if responded: # incoming request or outgoing request with response\n if node_id not in self.routing_ta...
[ "0.64593494", "0.5994604", "0.5895253", "0.58183753", "0.5763807", "0.5725724", "0.5684319", "0.5683615", "0.56009513", "0.5568529", "0.5514875", "0.55026144", "0.5476952", "0.5465007", "0.5445385", "0.5436398", "0.54311246", "0.53875333", "0.5359572", "0.5351444", "0.5330344...
0.65867233
0
Given a new node, send it all the keys/values it should be storing.
def transferKeyValues(self, node): _log.debug("**** transfer key values %s ****" % node) ds = [] for key, value in self.storage.iteritems(): keynode = Node(digest(key)) neighbors = self.router.findNeighbors(keynode) _log.debug("transfer? nbr neighbors=%d, key=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def welcomeIfNewNode(self, node):\n if not self.router.isNewNode(node):\n return\n\n log.info(\"never seen %s before, adding to router\", node)\n for key, value in self.storage.items():\n keynode = Node(digest(key))\n neighbors = self.router.findNeighbors(keyno...
[ "0.68433034", "0.6387898", "0.6231363", "0.6224902", "0.6179758", "0.5944865", "0.58915156", "0.5804389", "0.57851076", "0.57538104", "0.5727421", "0.57156307", "0.57064646", "0.5705826", "0.5686158", "0.5680778", "0.563601", "0.5572478", "0.5572478", "0.5489811", "0.5487325"...
0.66873896
1
Bootstrap the server by connecting to other known nodes in the network.
def bootstrap(self, addrs): # if the transport hasn't been initialized yet, wait a second if self.protocol.transport is None: return task.deferLater(reactor, .2, self.bootstrap, addrs) else: _log.debug("AppendServer.bootstrap(%s)" % addrs) return Server.bootst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def network_bootstrap(self, args):\n pass", "def connect_to_server(self):\n\t\tself.outside.start()\n\t\tself.outside.register(self.config.server_ip, self.config.server_port)\n\n\t\tself.thin.start()\n\t\tself.thin.register(self.config.server_ip, self.config.server_port)", "def bootstrap(self, params = ...
[ "0.7119504", "0.68823236", "0.6732595", "0.6730273", "0.6507474", "0.6275269", "0.6274168", "0.6267048", "0.62213904", "0.6216114", "0.6149288", "0.61468875", "0.60358363", "0.60321194", "0.60266834", "0.5985796", "0.5937494", "0.59249455", "0.5908087", "0.5892862", "0.586262...
0.69549376
1
For the given key append the given list values to the set in the network.
def append(self, key, value): dkey = digest(key) node = Node(dkey) def append_(nodes): # if this node is close too, then store here as well if not nodes or self.node.distanceTo(node) < max([n.distanceTo(node) for n in nodes]): try: pva...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def appendlist(self, key, value):\n self.setlistdefault(key, [])\n dict.__setitem__(self, key, self.getlist(key) + [value])", "def addlist(self, k, v):\n self_insert = self._insert\n values = super(OrderedMultiDict, self).setdefault(k, [])\n for subv in v:\n self_ins...
[ "0.68404776", "0.64850795", "0.6393843", "0.6393843", "0.6334041", "0.63275087", "0.6321269", "0.61832106", "0.60738695", "0.60602796", "0.60555", "0.6010969", "0.59901476", "0.591847", "0.58933073", "0.58578247", "0.58196485", "0.58180434", "0.5807921", "0.57934815", "0.5766...
0.65909123
1
Set the given key to the given value in the network.
def set(self, key, value): _log.debug("setting '%s' = '%s' on network" % (key, value)) dkey = digest(key) node = Node(dkey) def store(nodes): _log.debug("setting '%s' to %s on %s" % (key, value, map(str, nodes))) # if this node is close too, then store here as we...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(self, key, value):\n self.log.debug(\"setting '%s' = '%s' on network\" % (key, value))\n dkey = digest(key)\n node = Node(dkey)\n\n def store(nodes):\n self.log.info(\"setting '%s' on %s\" % (key, list(map(str, nodes))))\n # if this node is close too, then ...
[ "0.8524701", "0.75702727", "0.75702727", "0.75380826", "0.7519836", "0.7519836", "0.74716425", "0.73170406", "0.73001647", "0.72439593", "0.71774316", "0.715227", "0.71102387", "0.7076738", "0.70714426", "0.70238066", "0.70225656", "0.69618803", "0.69618803", "0.69618803", "0...
0.8498977
1
For the given key remove the given list values from the set in the network.
def remove(self, key, value): dkey = digest(key) node = Node(dkey) _log.debug("Server:remove %s" % base64.b64encode(dkey)) def remove_(nodes): # if this node is close too, then store here as well if not nodes or self.node.distanceTo(node) < max([n.distanceTo(node...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_values_from_list(self,list_,*values):\r\n for value in values:\r\n while value in list_:\r\n list_.remove(value)", "def remove(self, key):", "def remove(self, key: int) -> None:\n \n index = self.hash(key)\n\n # If list doesn't exist just return\...
[ "0.7044609", "0.6552202", "0.6546256", "0.65116614", "0.64858824", "0.64747924", "0.6387488", "0.63731134", "0.63666767", "0.6270694", "0.6248914", "0.6236957", "0.62207824", "0.621597", "0.621597", "0.621597", "0.62116325", "0.6190252", "0.6188199", "0.6174154", "0.61655444"...
0.66019624
1
We got some values! Exciting. But lets combine them all. Also, make sure we tell the nearest node that didn't have the value to store it.
def _handleFoundValues(self, jvalues): # TODO figure out if we could be more cleaver in what values are combined value = None _set_op = True if self.local_value: jvalues.append((None, self.local_value)) _log.debug("_handleFoundValues %s" % str(jvalues)) # Filt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mergeNodes(new, t1, t2):\n \n if t1 and t2:\n new.val = t1.val + t2.val\n elif not t1:\n new.val = t2.val\n elif not t2:\n new.val = t1.val", "def eliminate(values):\n for b in boxes:\n if len(values[b]) == 1:\...
[ "0.59434026", "0.56864935", "0.561745", "0.55376625", "0.5509779", "0.5458379", "0.5435721", "0.5396941", "0.53683496", "0.5350505", "0.5343917", "0.5340923", "0.5333917", "0.5325144", "0.5264902", "0.5218789", "0.5205872", "0.5203127", "0.5198281", "0.5189773", "0.51723", ...
0.7143264
0
Performs a generic find operation on the specified controller and formats the output in color.
def _generic_find(controller, heading, patterns): msg.info(heading) msg.info("--------------------------") msg.blank() for pattern in patterns: for entry in controller.find(pattern): if hasattr(entry, "uuid"): eid = entry.uuid elif hasattr(entry, "fqn"): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_controller(self, controller):\n if controller is None:\n return None\n # If the output specified is a string controller e.g. \"WelcomeController@show\"\n elif isinstance(controller, str):\n if \"@\" in controller:\n controller_path, controller_met...
[ "0.53260326", "0.52767843", "0.524204", "0.51859134", "0.5096391", "0.50732815", "0.5005718", "0.49852437", "0.4893614", "0.4848869", "0.481354", "0.4778124", "0.4775718", "0.47399512", "0.47129112", "0.47054514", "0.46476057", "0.46466988", "0.4642668", "0.4633068", "0.46292...
0.6787234
0
Test creation of a Video and writing/reading to the videocategory table. This test assumes, that there are no entries in the videocategory table! All entries in that table will be deleted!
def test_Dataheap_Video_004_01(self): class VideoCategory(DBDataWrite): """ VideoCategory(data=None, db=None) --> VideoCategory object to database table 'videocategory', data is a `videocategory` string. - get information about the table: $ mysql -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_video_model_functionality(self):\n\n # create a video\n v = Video(title=\"Title of a YouTube Video\", description=\"Description of a YouTube Video\", yt_video_id=\"yfoY53QXEnI\", yt_channel_id=\"UC29ju8bIPH5as8OGnQzwJyA\")\n db.session.add(v)\n db.session.commit()\n\n # ...
[ "0.7072598", "0.66031647", "0.656258", "0.65525234", "0.65179473", "0.631983", "0.6282366", "0.6220394", "0.6195253", "0.6144781", "0.60975116", "0.60858005", "0.60748005", "0.6064746", "0.6035256", "0.60066295", "0.59810054", "0.59662133", "0.5925972", "0.58940107", "0.58623...
0.7127327
0
Make sure entered title does not already exist
def title_exists(form, field): if Entry.select().where(Entry.title ** field.data).exists(): raise ValidationError('That title is already in use.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_title_input(title):\n if len(title) != 0:\n clear()\n return True\n\n else:\n clear()\n print('** Please enter a task title **')\n return False", "def checkTitle(self,event=None):\r\n if self.title.getVal() not in self.titleList:\r\n self.ti...
[ "0.76412404", "0.758198", "0.73525643", "0.72878885", "0.69870245", "0.6916602", "0.6883601", "0.6866875", "0.6806847", "0.6769855", "0.66781723", "0.6619108", "0.64249706", "0.64171153", "0.63547355", "0.6336048", "0.63264096", "0.63135356", "0.6247816", "0.62238014", "0.617...
0.79909974
0
function to detect face and classify whether a mask is worn or not
def detectFaceAndClassify(faceNet, faceMaskClassifier, testImagePath, threshold): # load the input test image from disk image = cv2.imread(testImagePath) # making a copy of image and finding the image spatial dimensions orig = image.copy() (h, w) = image.shape[:2] # construct a blob from the im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def face_detect(sess, net, image_name):\n\n\t# Load the demo image\n\tim_file = os.path.join(cfg.DATA_DIR, 'demo', image_name)\n\tim = cv2.imread(im_file)\n\n\t# Detect all object classes and regress object bounds\n\ttimer = Timer()\n\ttimer.tic()\n\t# scores, boxes = im_detect(sess, net, im)\n\tscores, boxes, eye...
[ "0.7271276", "0.72283274", "0.70361453", "0.69948393", "0.6987588", "0.68838495", "0.68149173", "0.6666867", "0.6590072", "0.6567864", "0.6539547", "0.64649886", "0.64562804", "0.64490664", "0.6446386", "0.64457786", "0.6437423", "0.6422928", "0.6421587", "0.64157873", "0.641...
0.73045164
0
Set up a lexical analyzer for `code` in `language`.
def __init__(self, code, language, tokennames='short'): self.code = code self.language = language self.tokennames = tokennames self.lexer = None # get lexical analyzer for `language`: if language in ('', 'text') or tokennames == 'none': return if not w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\r\n\tlang = get_arguments()\r\n\twiki_analyzer(lang)", "def evaluateCode(lang, code):", "def __init__(\n self, language=Language.ENGLISHCASED, cache_dir=\".\"\n ):\n self.tokenizer = XLNetTokenizer.from_pretrained(language.value, cache_dir=cache_dir)\n self.language = langua...
[ "0.58799744", "0.5864884", "0.58409506", "0.56989753", "0.5639393", "0.5590425", "0.546683", "0.5445196", "0.5430377", "0.53696084", "0.5355774", "0.53089696", "0.5282451", "0.5280632", "0.52497286", "0.5227728", "0.5212123", "0.5178399", "0.5176204", "0.5166289", "0.51205105...
0.71450984
0
Merge subsequent tokens of same tokentype. Also strip the final newline (added by pygments).
def merge(self, tokens): tokens = iter(tokens) (lasttype, lastval) = tokens.next() for ttype, value in tokens: if ttype is lasttype: lastval += value else: yield(lasttype, lastval) (lasttype, lastval) = (ttype, value) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rehydrate_text(self, next_token):\n prefix_text = \"\"\n main_text = next_token.token_text.replace(\n InlineHelper.backspace_character, \"\"\n ).replace(\"\\x08\", \"\")\n\n print(\n \">>rehydrate_text>>\" + main_text.replace(\"\\a\", \"\\\\a\").replace(\"\\n\"...
[ "0.60590655", "0.59240514", "0.57452136", "0.5704347", "0.5698722", "0.5688145", "0.56433755", "0.56253797", "0.5558617", "0.55530834", "0.55441177", "0.55441177", "0.5538296", "0.5537822", "0.55091155", "0.54938656", "0.5481803", "0.5433574", "0.5423299", "0.54027677", "0.54...
0.7113429
0
Parse self.code and yield "classified" tokens.
def __iter__(self): if self.lexer is None: yield ([], self.code) return tokens = pygments.lex(self.code, self.lexer) for tokentype, value in self.merge(tokens): if self.tokennames == 'long': # long CSS class args classes = str(tokentype).lower(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(source_code):\n tokens = tokenize(source_code)\n return read(tokens)", "def tokenize(code):\n lineno = 1\n line_start = 0\n\n for match in TOKEN_REGEX.finditer(code):\n kind = match.lastgroup\n value = match.group(kind)\n\n if kind == 'IGNORE':\n if '\\n' ...
[ "0.6318408", "0.63139665", "0.6242765", "0.6229688", "0.607422", "0.6070667", "0.603829", "0.5967526", "0.5900992", "0.5900432", "0.5861038", "0.5828368", "0.5738229", "0.57144123", "0.5686451", "0.56318927", "0.56315476", "0.5565116", "0.549738", "0.54870355", "0.54863477", ...
0.72035605
0
Execute qemuimg inside a container that mounts input_path and output_path to itself
def convert(input_format, output_format, input_path, output_path): # mount the input file to /work/<filename> inside the container path_in = Path(input_path) input_abspath = path_in.absolute().__str__() assert_path_exists(input_abspath) internal_input_path = f"/input/{path_in.name}" in_mount = f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli(context):\n dev = f\"docker run -it -v {PWD}:/local {IMAGE_NAME}:{IMAGE_VER} /bin/bash\"\n print(f\"{dev}\")\n context.run(f\"{dev}\", pty=True)", "def convert_image(source, dest, out_format, run_as_root=False):\n cmd = ('qemu-img', 'convert', '-O', out_format, source, dest)\n utils.execut...
[ "0.62837875", "0.6074666", "0.60684544", "0.60363144", "0.59255517", "0.586734", "0.5778542", "0.57056147", "0.5665832", "0.56376344", "0.56340975", "0.56335706", "0.55957174", "0.5517197", "0.54937905", "0.54879", "0.54570025", "0.5440607", "0.54342204", "0.5405311", "0.5397...
0.74309325
0
Execute qemuimg show inside a container, direct mapping the volume
def show(vol_path): name = "qemu-img" image = "breqwatr/qemu-img:latest" path = Path(vol_path) vol_abspath = path.absolute().__str__() run = f"qemu-img info {vol_abspath}" mount = f"-v {vol_abspath}:{vol_abspath}" cmd = f"docker run --rm -it --name {name} {mount} {image} {run}" shell(cmd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_show_container(self):\n pass", "def cli(context):\n dev = f\"docker run -it -v {PWD}:/local {IMAGE_NAME}:{IMAGE_VER} /bin/bash\"\n print(f\"{dev}\")\n context.run(f\"{dev}\", pty=True)", "def flash_image(disk_image, device):\n cmd = 'dd if={disk_image} | pv | sudo dd of={device_path...
[ "0.62484497", "0.60517263", "0.5992571", "0.5975449", "0.5839048", "0.57297766", "0.5697807", "0.5689689", "0.56495243", "0.5641624", "0.55717117", "0.5554981", "0.5520627", "0.5518573", "0.5513627", "0.55032563", "0.5500508", "0.5494928", "0.5483127", "0.54741514", "0.545386...
0.7928166
0
Test if artifact is not in the handlers allowlist
def test_allow_build_not_in_allowlist(self): handler = MyHandler() container = {"name": "test", "branch": "branch"} allow = handler.allow_build(ArtifactType.IMAGE, name=container["name"], branch=container["branch"]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_allowlist_not_overwritten(self):\n handler = MyHandler()\n handler.name = \"RebuildImagesOnImageAdvisoryChange\"\n allowed = handler.allow_build(\n ArtifactType.IMAGE, advisory_state=\"SHIPPED_LIVE\")\n self.assertTrue(allowed)\n\n handler.name = \"foo\"\n ...
[ "0.6424493", "0.5595852", "0.5518085", "0.5322846", "0.5233636", "0.52273697", "0.520941", "0.520649", "0.5168272", "0.5164868", "0.51314855", "0.51312107", "0.50916404", "0.50706255", "0.50691235", "0.49980858", "0.49586055", "0.4928604", "0.49190104", "0.49136826", "0.49046...
0.68936956
0
If there is a regex error, method will raise UnprocessableEntity error
def test_allow_build_regex_exception(self): handler = MyHandler() container = {"name": "test", "branch": "branch"} with self.assertRaises(UnprocessableEntity): handler.allow_build(ArtifactType.IMAGE, name=container["name"], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validator_regex(self, field, value):\n try:\n re.compile(value)\n except re.error:\n self._error(field, \"{} is not a valid regex\".format(value))", "def _process_not_ok_response(content, status):\n if status == codes.bad:\n length = len(content)\n ...
[ "0.5660504", "0.56014264", "0.55581367", "0.55553734", "0.54990566", "0.54236627", "0.54236627", "0.54236627", "0.5416616", "0.54129237", "0.5384286", "0.53773355", "0.5325523", "0.53215456", "0.5320322", "0.5318004", "0.5279758", "0.52679384", "0.52658635", "0.52554643", "0....
0.6139659
0
Method to contruct a list of quadrats using a given bounding box. box the bounding box of the meshes to measure size the size of the square quadrilateral (in the units of the provided mesh) list of the quadrats that fit the bounding box
def build(self, box, size): centroid = box.centroid edge1_midpoint = get_midpoint_of_edge( box.vertices[0], box.vertices[1]) distance_to_edge1 = centroid.distance_to_xyz(edge1_midpoint) quadrat_indexes1 = range(int(distance_to_edge1 / size) + 1) edge2_midpoint = get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bound(box_list):\n box_xyxy_list = []\n for box in box_list:\n box_xyxy = xywh2xyxy(box)\n box_xyxy_list.append(box_xyxy)\n\n box_xyxy_list = np.array(box_xyxy_list)\n x1max, y1max, x2max, y2max = np.amax(box_xyxy_list, axis=0)\n x1min, y1min, x2min, y2min = np.amin(box_xyxy_li...
[ "0.5859859", "0.57153344", "0.5666255", "0.5610459", "0.55955267", "0.558588", "0.5577103", "0.5567914", "0.54994035", "0.5485716", "0.54494894", "0.54238886", "0.54005504", "0.53592753", "0.534929", "0.53394306", "0.5338785", "0.5329687", "0.5327499", "0.5321613", "0.5279145...
0.6905943
0
Build offset regression head for each joint
def _make_separete_regression_head(self, layer_config) -> Tuple[nn.ModuleList, nn.ModuleList]: offset_feature_layers = [] offset_final_layer = [] for _ in range(self.num_joints): feature_conv = self._make_layer( blocks_dict[layer_config["BLOCK"]], lay...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_fun(params, slope, x):\n w = params['w']\n t0 = params['t0']\n offset = params['offset']\n return offset + slope * jax.nn.sigmoid(jnp.dot(x, w) - t0)", "def get_offset_model(species_diff_table):\n m_init = modeling.polynomial.Polynomial2D(2)\n fit = modeling.fitting.LevMarLSQF...
[ "0.55294734", "0.5208984", "0.5130402", "0.50781065", "0.50344014", "0.501487", "0.49891034", "0.49852586", "0.49625823", "0.49371865", "0.49345776", "0.49325863", "0.49302906", "0.49096087", "0.48742875", "0.48697242", "0.48597276", "0.48429585", "0.4842753", "0.4841103", "0...
0.5698405
0
Set the processing parameters for the dataset.
def set_dataset_processing_params( self, edge_links: Union[np.ndarray, List[Tuple[int, int]]], edge_colors: Union[np.ndarray, List[Tuple[int, int, int]]], keypoint_colors: Union[np.ndarray, List[Tuple[int, int, int]]], image_processor: Optional[Processing] = None, conf: O...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processing(self, processing):\n\n self._processing = processing", "def set_parameters(self):\n\n if self.model_with_set_params:\n return\n\n self._model_with_set_params = self._parameter_values.process_model(\n self._unprocessed_model, inplace=False\n )\n ...
[ "0.66091186", "0.65634745", "0.63424504", "0.62893957", "0.6289173", "0.6258113", "0.62301064", "0.61419135", "0.61234295", "0.6097829", "0.608046", "0.60428184", "0.59977686", "0.5968489", "0.5958951", "0.59205025", "0.5912154", "0.5910207", "0.59096277", "0.58788115", "0.58...
0.7022556
0
``threshold = max(end_threshold, threshold step)`` (linear) ``threshold = max(end_threshold, step threshold)`` (exponential) where the initial threshold is set to ``start_threshold``.
def __init__(self, start_threshold, end_threshold, step, method="linear"): if start_threshold < 0 or end_threshold < 0 or step < 0: raise ValueError("Thresholds must be positive.") if start_threshold < end_threshold: raise ValueError("Start threshold must be bigger than end " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_e(amount, start, stop, truncated, sequence):\n ratio = .5\n for x in range(start, amount):\n y = abs(round(ratio * math.exp(x)))\n if truncated and y >= stop:\n sequence.append(stop)\n elif y < start:\n sequence.append(start)\n ...
[ "0.6318416", "0.5703446", "0.5681435", "0.5562579", "0.5382603", "0.537008", "0.5349749", "0.5336802", "0.5329492", "0.53214836", "0.5306692", "0.5306511", "0.52809584", "0.5261724", "0.5236843", "0.52299845", "0.52246624", "0.52062243", "0.5202483", "0.51860684", "0.5146353"...
0.6057787
1
Assert equal with better error message.
def assert_eq(a, b, msg=None): assert a == b, msg or __safe_error("!=", a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_equal(self, first, second, msg=\"\"):\r\n assert first == second", "def assert_equal(self, first, second):\n if first != second:\n raise AssertionError('%s and %s not equal' % (str(first), str(second)))", "def _baseAssertEqual(self, first, second, msg=None):\r\n if no...
[ "0.8381916", "0.7973827", "0.7879367", "0.7826144", "0.7825422", "0.76669437", "0.7661126", "0.7659392", "0.7640886", "0.7640886", "0.76360196", "0.7526258", "0.7519615", "0.73260635", "0.7317758", "0.7315744", "0.72970676", "0.7290986", "0.7287053", "0.7247238", "0.7233387",...
0.8015735
1
Raise a type error if obj is not an instance of cls.
def assert_type( obj, cls, msg="{obj} ({obj!r}) should be a {cls}, not {objcls}" ): if not isinstance(obj, cls): raise TypeError(msg.format(obj=obj, objcls=type(obj), cls=cls))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_is_instance(self, obj, cls, msg=\"\"):\r\n assert isinstance(obj, cls)", "def assert_is_not_instance(self, obj, cls, msg=\"\"):\r\n assert not isinstance(obj, cls)", "def assertIsInstance(self, obj, cls, msg=None):\r\n if not _is_instance(obj, cls):\r\n standardMsg = ...
[ "0.8022944", "0.7873061", "0.7360076", "0.7278757", "0.7261065", "0.7160888", "0.70439845", "0.7019144", "0.6977047", "0.6889601", "0.6796127", "0.67910004", "0.6718902", "0.6682022", "0.65874743", "0.6350729", "0.62812877", "0.6236786", "0.62262434", "0.6214717", "0.6192635"...
0.7940661
1
Check all lists in a list are equal length
def assert_len_eq(lists): # Sanity check max_len = max(len(p) for p in lists) for i, p in enumerate(lists): assert len( p ) == max_len, "Length check failed!\nl[{}] has {} elements != {} ({!r})\n{!r}".format( i, len(p), max_len, p, lists )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_size_of_lists(sequence_header, secstr_header):\n if len(sequence_header) != len(sequence):\n sys.exit(\"The size of the sequence list and sequence header doesn't match\")\n else:\n return True", "def test_len(self):\n\t\t# for 2 sample lists, I test that the len of the list is the ...
[ "0.6904997", "0.68040586", "0.680279", "0.67442155", "0.6725389", "0.6724341", "0.671778", "0.66840255", "0.6568775", "0.65605485", "0.65421414", "0.6539833", "0.6526015", "0.6373606", "0.63600415", "0.6360039", "0.63565075", "0.63232565", "0.6305891", "0.630208", "0.6297076"...
0.8220756
0