query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Claim iscore and sets new rate daily.
def _check_for_iscore(self) -> None: if self._system.getIISSInfo()["nextPRepTerm"] > self._block_height_day.get() + 1800: self._block_height_day.set(self._system.getIISSInfo()["nextPRepTerm"]) self._claim_iscore()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_current_rate(self, rate_to_set):\n pass", "def _set_rate(self):\r\n interval = self.data.iloc[2, 0] - self.data.iloc[1, 0]\r\n self.rate = int(1 / interval)", "def _claim_iscore(self) -> None:\n iscore_details_dict = self._system.queryIScore(self.address)\n if iscore_...
[ "0.6537691", "0.6242626", "0.6220372", "0.61135656", "0.61135656", "0.60734284", "0.60269517", "0.5867458", "0.5848384", "0.57485807", "0.57235295", "0.57152945", "0.5668259", "0.5667469", "0.5660507", "0.56359756", "0.56104755", "0.5596382", "0.5588775", "0.55878633", "0.555...
0.5276463
33
Checks the balance of the score and transfer the unstaked amount to the address and removing the data from linked list .
def _check_unstake_result(self) -> None: balance_score = self.icx.get_balance(self.address) - self._daily_reward.get() if balance_score > 0: unstake_info_list = self.getUserUnstakeInfo() for each_info in unstake_info_list: value_to_transfer = each_info[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeStake(self, address: str, value_LP: int):\n addr = address.lower()\n balances = self.addresses[addr] if addr in self.addresses else []\n if len(balances) > 0:\n while len(balances) > 0 and value_LP > 0:\n balance = balances[-1]\n initial_LP = ...
[ "0.6432592", "0.5612482", "0.55736476", "0.5467292", "0.5448148", "0.5388455", "0.5355376", "0.5315712", "0.528098", "0.5231815", "0.52249676", "0.5186252", "0.5156468", "0.513889", "0.51251215", "0.5123362", "0.51192874", "0.5118209", "0.5103814", "0.5093112", "0.5073614", ...
0.5967963
1
stakes and delegates some ICX to top prep addresses and receives equivalent of sICX by the user address.
def addCollateral(self, _to: Address = None) -> None: if self._distributing.get() == True: self._total_stake.set(self._total_stake.get() + self._daily_reward.get()) self._distributing.set(False) self._daily_reward.set(0) if _to == None: _to = self.tx.origi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setSicxAddress(self, _address: Address) -> None:\n self._sICX_address.set(_address)", "def getSicxAddress(self) -> Address:\n return self._sICX_address.get()", "def getAddress(user):", "def _send_ICX(self, _to: Address, amount: int, msg: str='') -> None:\n try:\n self.icx....
[ "0.5445231", "0.5385196", "0.51689297", "0.51638705", "0.5160624", "0.50212485", "0.50089616", "0.49819303", "0.49768826", "0.49755865", "0.49623156", "0.49204937", "0.48982558", "0.48172063", "0.48009193", "0.47569516", "0.47566313", "0.4753309", "0.47524184", "0.47457212", ...
0.0
-1
Claims the iScore and distributes it to the top 100 prep addresses.
def _claim_iscore(self) -> None: iscore_details_dict = self._system.queryIScore(self.address) if iscore_details_dict['estimatedICX'] != 0: amount = iscore_details_dict["estimatedICX"] self._system.claimIScore() self._daily_reward.set(amount) self._rate.set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculScore(self):\n for cell in self.notComputeRouter:\n if(cell.isCovered==True):\n self.score += 1000\n self.score += self.budget", "def top_100_score(self,predictions,labels):\n\n # sort the array by predictions\n order = np.flipud(predictions.argsort...
[ "0.60285985", "0.5817724", "0.5764041", "0.57421845", "0.57248867", "0.57037795", "0.56663936", "0.5545361", "0.55202323", "0.54780304", "0.54671097", "0.54642636", "0.5449368", "0.54473275", "0.54473275", "0.54473275", "0.5445719", "0.54322976", "0.5431391", "0.5429363", "0....
0.0
-1
Stakes the ICX in the network.
def _stake(self, _stake_value: int) -> None: self._system.setStake(_stake_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_stim(self):\n self.stim = h.NetStim()\n self.stim.number = self.stim_number\n self.stim.start = 9\n self.ncstim = h.NetCon(self.stim, self.cells[0].synlist[0])\n self.ncstim.delay = 1\n self.ncstim.weight[0] = self.stim_w # NetCon weight is a vector.", "def a...
[ "0.5664815", "0.54133534", "0.523183", "0.51994085", "0.5093293", "0.5040406", "0.5012292", "0.5007908", "0.5007278", "0.49930787", "0.49525902", "0.48961017", "0.4879889", "0.4876623", "0.48565403", "0.48431444", "0.48348346", "0.48343807", "0.4803706", "0.47892678", "0.4789...
0.0
-1
Delegates the ICX to top prep addresses.
def _delegations(self, evenly_distribute_value: int, remainder: int) -> None: delegation_list = [] for each_prep in self._top_preps: if len(delegation_list) == (TOTAL_PREPS - 1): evenly_distribute_value = evenly_distribute_value + remainder delegation_info: Delega...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_top_preps(self) -> None :\n prep_dict = self._system.getPReps(1, 20)\n prep_address_list = prep_dict['preps']\n for each_prep in prep_address_list:\n self._top_preps.put(each_prep['address'])", "def handle_get_main_prep_list(self, _context: 'IconScoreContext', _params: d...
[ "0.593054", "0.5150775", "0.501744", "0.4996949", "0.49350217", "0.49135786", "0.47349587", "0.4714322", "0.4709175", "0.4704338", "0.46738154", "0.4617613", "0.46168512", "0.4597718", "0.45850587", "0.4568212", "0.4540159", "0.45384282", "0.4498532", "0.44880185", "0.4482453...
0.0
-1
Used only to receive sICX for unstaking.
def tokenFallback(self, _from: Address, _value: int, _data: bytes) -> None: if self.msg.sender != self._sICX_address.get(): revert(f'The Staking contract only accepts sICX tokens.') Logger.debug(f'({_value}) tokens received from {_from}.', TAG) try: d = json_loads(_data.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sn(self):\n\t\tstring = []\n\t\tresp = [0x00]\n\t\tself.spi.transfer([0x10], [0x00], 1)\n\t\ttime.sleep(9e-3)\n\t\tfor i in range(60):\n\t\t\tself.spi.transfer([0x00], resp, 1)\n\t\t\tstring.append(chr(resp[0]))\n\t\ttime.sleep(0.1)\n\t\treturn ''.join(string).strip()", "def receive_interrupt_request(self, _...
[ "0.5725389", "0.5437416", "0.52976817", "0.52271223", "0.5199893", "0.5151587", "0.51070213", "0.50734866", "0.50734866", "0.506104", "0.5022422", "0.5011935", "0.5001367", "0.49909127", "0.49771768", "0.49767193", "0.49695894", "0.4956895", "0.49366823", "0.4934447", "0.4916...
0.0
-1
Burns the sICX and removes delegations from the prep addresses and adds the unstaking request to the linked list.
def _unstake(self, _to: Address, _value: int) -> None: try: if self._distributing.get() == True: self._total_stake.set(self._total_stake.get() + self._daily_reward.get()) self._distributing.set(False) self._daily_reward.set(0) self._reset_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_yield(self, affiliate_items_url_factory, affiliate_network_factory):\n network = affiliate_network_factory(name='Network')\n\n with mock.patch('chiton.rack.affiliates.bulk.create_affiliate') as create_affiliate:\n affiliate = ValidatingAffiliate()\n affiliate.val...
[ "0.49018943", "0.48822764", "0.48634377", "0.4716478", "0.46393856", "0.46225703", "0.46193188", "0.46079126", "0.45960215", "0.45934704", "0.45923227", "0.45914638", "0.4558258", "0.45580754", "0.45569086", "0.45355147", "0.4530343", "0.45187205", "0.45116302", "0.45006743", ...
0.43304968
40
Sends ICX to an address.
def _send_ICX(self, _to: Address, amount: int, msg: str='') -> None: try: self.icx.transfer(_to, amount) self.FundTransfer(_to, amount, msg + f' {amount} ICX sent to {_to}.') except BaseException as e: revert(f'{amount} ICX not sent to {_to}. ' f'Ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_ICX(self, _to: Address, amount: int, msg: str) -> None:\n try:\n self.icx.transfer(_to, amount)\n self.FundTransfer(_to, amount, msg + f' {amount} ICX sent to {_to}.')\n except BaseException as e:\n revert(f'{amount} ICX not sent to {_to}. '\n ...
[ "0.67941105", "0.6422302", "0.5968883", "0.593261", "0.5741187", "0.57041913", "0.5646999", "0.5617863", "0.5556189", "0.5440533", "0.53692085", "0.5294152", "0.528091", "0.52612793", "0.52612793", "0.5130072", "0.5127549", "0.51131177", "0.51100826", "0.51076645", "0.5046392...
0.68834853
0
Only for the dummy contract, to simulate claiming Iscore.
def fallback(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dummy(self):\n pass", "def RequiredContract(self) -> _n_0_t_1:", "def test(self):\n raise NotImplementedError", "def contract_pepo_pbc():\n pass", "def test_stub(self):\n pass", "def test_abicontract_interface():\n tester_state = Chain()\n\n contract_path = path.join(CON...
[ "0.6828843", "0.66835016", "0.6159249", "0.6099624", "0.6039241", "0.59682924", "0.58445585", "0.5811602", "0.5795898", "0.57446617", "0.5712862", "0.57051903", "0.5693675", "0.56829774", "0.566784", "0.5667243", "0.56588304", "0.5653454", "0.56472826", "0.56462944", "0.56462...
0.0
-1
Register all directives, exists to avoid race conditions. Sometimes stuff like publish_parts can be ran from command line functions tests. There's also ways we could avoid this by placing it in __init__ of django_docutils.lib, but that's a bit implicit. Investigate that later. In order to make this work across django p...
def register_based_directives(): if not BASED_LIB_RST: return if "directives" in BASED_LIB_RST: for dir_name, dir_cls_str in BASED_LIB_RST["directives"].items(): class_ = import_string(dir_cls_str) directives.register_directive(dir_name, class_)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(app):\n app.add_directive('show_tasks', ShowTasksDirective)", "def setup(app): # noqa\n # Wee want to override the directives:\n # - 'graph' from sphinx.ext.graphviz extension.\n # - 'uml' from sphinxcontrib.plantuml\n # But Sphinx warns of the override, causing failure if warnings are ...
[ "0.56825787", "0.55998087", "0.556161", "0.544905", "0.5275472", "0.52580863", "0.52263993", "0.5223901", "0.519866", "0.51767975", "0.517581", "0.5134543", "0.5127223", "0.50869644", "0.50686884", "0.5055614", "0.5038577", "0.5013569", "0.5008931", "0.50057", "0.5004458", ...
0.7255333
0
chunk by step count
def _chunk_bs(bs, step=2): stop = len(bs) start = 0 bs_to_list = [] for bstep in range(0, stop, step): bs_to_list.insert(bstep, bs[start:bstep+step]) start = start + step return bs_to_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(sequence, chunk_size):\r\n\r\n # YOUR CODE HERE\r", "def get_chunks(num_items, num_steps):\n chunk_sizes = np.zeros(num_steps, dtype=int)\n chunk_sizes[:] = num_items // num_steps\n chunk_sizes[:num_items % num_steps] += 1\n\n chunk_offsets = np.roll(np.cumsum(chunk_sizes), 1)\n chun...
[ "0.7152931", "0.71093166", "0.6911289", "0.6829152", "0.6811473", "0.67924106", "0.6765619", "0.67565936", "0.6739344", "0.6727092", "0.6702155", "0.66849524", "0.66815555", "0.6666477", "0.66645473", "0.6662247", "0.6657508", "0.66518414", "0.66327477", "0.6630342", "0.66095...
0.0
-1
str/int repr to hex
def hexlify(self: str, verbose=False): nbytes = len(_chunk_bs(self)) buf = b'' strlen = '' for b in to_bytes(_chunk_bs(self)): buf+=b # for s in _from_list(_chunk_bs(self)): # strlen+=f'{ _bit_length(s): 02d}' if verbose: for n in range(nbytes): strlen += f'{_bi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int2hex(n: int) -> str:", "def int_to_hex(n):\r\n #return \"0x%X\" % n\r\n return hex(n)", "def int_to_hexstr(data: int) -> str:\n return \"%0.2X\" % data", "def int_to_hex(num):\n return hex(num)", "def int_to_hex(a):\n return hex(a)", "def hex(cls, x):\n return c_hex(x)", "d...
[ "0.85594016", "0.8040766", "0.7699089", "0.7664095", "0.756457", "0.7433254", "0.73482215", "0.7305403", "0.727798", "0.72500014", "0.71698976", "0.716357", "0.71601605", "0.7085572", "0.70646644", "0.7037984", "0.69810885", "0.6955859", "0.6945289", "0.6879481", "0.6840643",...
0.0
-1
Push the item onto the heap, maintaining the heap invariant.
def heappush(heap, item): heap.append(item) _siftdown(heap, 0, len(heap)-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, item: tuple):\n self.__heap.append(item)\n self.__sift_up(self.__len__() - 1)", "def push(self, item):\n heapq.heappush(self.heap, item)", "def push(self, item):\n self.heap.append(self.m * item)\n self._sift_up()", "def insert(self, item):\n self.heap...
[ "0.9063282", "0.8996565", "0.8773676", "0.82297313", "0.8163153", "0.7998835", "0.79950887", "0.7948598", "0.7889434", "0.78529996", "0.7817438", "0.7795371", "0.7776321", "0.7763033", "0.77054644", "0.7682576", "0.7661818", "0.7661818", "0.76568264", "0.76370543", "0.7628241...
0.80675966
5
Pop the smallest item off the heap, maintaining the heap invariant.
def heappop(heap): lastelt = heap.pop() if heap: returnitem = heap[0] heap[0] = lastelt _siftup(heap, 0) return returnitem return lastelt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_min(self):\r\n # Should raise an exception of size is 0...\r\n if self._size == 0: raise KeyError # Can't remove from an empty heap\r\n result = self._data[0] # remember the smallest\r\n self._data[0] = None # None is so we don't have a reference.\r\n ...
[ "0.8549087", "0.8411378", "0.81956744", "0.81826556", "0.8122067", "0.80987185", "0.7935053", "0.79007554", "0.78271985", "0.7778041", "0.77745444", "0.775685", "0.77393687", "0.7724083", "0.766854", "0.76677996", "0.7608669", "0.7605774", "0.75887674", "0.75823057", "0.75724...
0.7422917
33
Implementation of RGCN from the `"Modeling Relational Data with Graph Convolutional Networks"
def __init__(self, num_nodes, h_dim, out_dim, num_rels, num_bases=-1, num_hidden_layers=1, dropout=0.5, bias=False): super(RGCN, self).__init__() self.num_nodes = num_nodes self.h_dim = h_dim self.out_dim = out_dim self.num_rels = num_rels self.num_bases ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n n_in_channel=1,\n nclass=10,\n attention=True,\n activation=\"glu\",\n dropout=0.5,\n train_cnn=True,\n rnn_type=\"BGRU\",\n n_RNN_cell=128,\n n_layers_RNN=2,\n dropout_recurrent=0,\n cnn_integration=False,\...
[ "0.6725458", "0.65787673", "0.64724976", "0.62752014", "0.62358326", "0.61777776", "0.61175686", "0.6113475", "0.60882884", "0.60320884", "0.600548", "0.59998", "0.5995034", "0.5975954", "0.59726614", "0.5959342", "0.5940323", "0.5939544", "0.59256434", "0.591488", "0.5912431...
0.74162155
0
Precomputes and stores the factorial terms up to ``n!``.
def _compute_factorial(n: int) -> None: fact_count = len(_factorial_sequence) # have the terms up to n! already been computed? if n < fact_count: return # compute numbers iteratively from existing sequence product = _factorial_sequence[-1] for i in range(fact_count, n + 1): pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorial(n):\n return product(range(1, n + 1))", "def factorial(n):\r\n temp = 1\r\n for item in range(2, n+1):\r\n temp *= item\r\n return temp", "def factorial(n):\n\n # the code for factorial", "def factorial_factorization(n):\n primes = sympy.primerange(2, n+1)\n factoriz...
[ "0.7415409", "0.7358811", "0.7357318", "0.73475236", "0.73066384", "0.7260437", "0.7232459", "0.7230606", "0.7225571", "0.71934617", "0.71773946", "0.71698505", "0.71696246", "0.71455836", "0.70917183", "0.7090762", "0.7074305", "0.7074229", "0.7064162", "0.6995383", "0.69483...
0.8229444
0
Resets the currently cached list of factorial terms.
def _reset_factorial_cache() -> None: global _factorial_sequence _factorial_sequence = [1, 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_clear(self):\n self.fold_term.cache_clear()", "def reset(self):\n self.__sets = []\n self._computed = False", "def reset(self):\n\n self._problem.reset()\n self._termination_criterion.reset()\n\n self._tabu_list = TabuList(self._list_size)\n\n if self....
[ "0.6321717", "0.62391734", "0.6231912", "0.6231774", "0.615009", "0.60553265", "0.60204417", "0.59892094", "0.59822446", "0.5975522", "0.5887768", "0.5880887", "0.58590513", "0.5852908", "0.58527416", "0.5850188", "0.5849707", "0.58328885", "0.58244604", "0.5810227", "0.58006...
0.81499666
0
Counts the number of ways to choose ``k`` objects from a group of ``n``.
def choose(n: int, k: int) -> int: return permute(n, k) // factorial(k)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_k(n, k):\n if n == 0:\n return 1\n elif n < 0:\n return 0\n else:\n total = 0\n i = 1\n while i <= k:\n total += count_k(n - i, k)\n i += 1\n return total", "def marbles(n: int, k: int) -> int:\n # return (n-1) Choose (k - 1)\n...
[ "0.696728", "0.66254205", "0.6584543", "0.64997256", "0.6488564", "0.63661957", "0.6320098", "0.63069326", "0.62878186", "0.6279388", "0.62690383", "0.6238506", "0.6238506", "0.62351334", "0.6229142", "0.6220324", "0.6217475", "0.6199224", "0.6186264", "0.6161596", "0.6150219...
0.6266476
11
Counts the number of combinations that sum to a given value.
def combination_sums(total: int, terms: Sequence[int]) -> int: if total <= 0: raise ValueError("Argument 'total' must be a positive integer") for term in terms: if term <= 0: raise ValueError("Each term in 'terms' must be a positive integer") # initialize the combination array ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calulate_total_permutations(value):\n if len(value) == len(set(value)):\n return factorial(len(value))\n\n count_map = {}\n for char in value:\n if char in count_map:\n count_map[char] += 1\n else:\n count_map[char] = 1\n\n base_factor = factorial(len(valu...
[ "0.6943409", "0.6418047", "0.633947", "0.63269424", "0.63269424", "0.6300757", "0.62762356", "0.61596483", "0.61341727", "0.61143696", "0.6104481", "0.6030774", "0.6024498", "0.60235465", "0.60031515", "0.5924365", "0.59051305", "0.5903383", "0.5847164", "0.58289903", "0.5814...
0.0
-1
Finds the factorial of a number.
def factorial(n: int) -> int: _compute_factorial(n) return _factorial_sequence[n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorial(number):\n result = 1\n while number:\n result *= number\n number -= 1\n return result", "def get_factorial(number):\n if number == 1:\n return 1\n else:\n return number * get_factorial(number - 1)", "def fact(n):\n\treturn int(factorial(n, exact=True))"...
[ "0.8016843", "0.79547894", "0.7926416", "0.7816246", "0.7811773", "0.7799114", "0.77133864", "0.7668326", "0.76484793", "0.7634401", "0.7630568", "0.762524", "0.7555803", "0.7549835", "0.7546689", "0.7533298", "0.7524768", "0.7445579", "0.74408174", "0.74267644", "0.74137694"...
0.7252463
44
Counts the permutations of ``k`` objects from a group of ``n``.
def permute(n: int, k: int) -> int: # no possible permutations if k > n if n < k: return 0 # if faster, compute n! and (n - k)! and return their quotient fact_count = len(_factorial_sequence) if n - fact_count <= k: return factorial(n) // factorial(n - k) # compute the product...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TAoCPpermutation(n,k):\n perms = []\n for subset in itertools.combinations(range(n), k):\n A = []; B = []; C = []; min = 0; j = 0; up = 0\n for i in xrange(n):\n if(j>=k or i != subset[j]):\n B.append(i)\n up +=1\n else:\n up -=1\n j += 1\n ...
[ "0.67244786", "0.6602117", "0.65821195", "0.6575043", "0.65667427", "0.6461524", "0.6421544", "0.64200276", "0.6202763", "0.6188401", "0.6182074", "0.6161341", "0.60909414", "0.6059227", "0.6050304", "0.6045108", "0.60183555", "0.5992609", "0.59800917", "0.59441495", "0.59124...
0.6858752
0
Returns the ligthness on a scale of 0 1
def lightness(self): min_component = min(self.red, self.green, self.blue) max_component = max(self.red, self.green, self.blue) avg = (max_component + min_component) / 2 light = avg / 255 return light
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def I(x):\n if abs(x-L/2.0) > 0.1:\n return 0\n else:\n return 1", "def Luminosity(self):\n try:\n L = (self.E*self.Weight).sum()\n N = self.E.count()\n except:\n L = self.E.sum()\n N = self.E.count()\n return L,...
[ "0.6352984", "0.62436646", "0.598909", "0.5852461", "0.57085735", "0.5707894", "0.5701839", "0.5700581", "0.5641913", "0.5589319", "0.5579047", "0.55644757", "0.5553218", "0.55043447", "0.54826564", "0.5480887", "0.54791695", "0.54656714", "0.5449916", "0.5430863", "0.5412421...
0.52229875
54
Returns the new colour of two added
def __add__(self, other): red = min(255, self.red + other.red) green = min(255, self.green + other.green) blue = min(255, self.blue + other.blue) return Colour(red, green, blue)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_color(red, green, blue):\r\n\r\n return (red << 16) + (green << 8) + blue", "def combine_colors(c1, c2, factor=0.5):\n c3 = QtGui.QColor()\n c3.setRed(int((factor * c1.red() + (1 - factor) * c2.red())))\n c3.setGreen(int((factor * c1.green() + (1 - factor) * c2.green())))\n c3.setB...
[ "0.72824293", "0.718031", "0.7179917", "0.70171314", "0.6788322", "0.661035", "0.6600029", "0.65749484", "0.64816475", "0.6467034", "0.63840234", "0.6309512", "0.6279438", "0.6279166", "0.6245517", "0.62111986", "0.62088406", "0.618801", "0.61737853", "0.61657524", "0.6154074...
0.7358977
0
Function create the overall graph within the selected time window. Require two table named identity and activity to retrive the data.
def graphformation(time_lower, time_upper): prm = param.Para() try: db_connection = mysql.connector.connect( host=prm.hostname, user=prm.username, passwd=prm.password, database= prm.dbname ) db_cursor = db_connection.cursor() except: print("Can't Connect to database, check credentials in pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(self):\n \n # initialize SQL kit to access database\n s = SQL_Kit(self.userID, self.password, self.database)\n \n \n \"\"\" Total Activity by hour \"\"\"\n \n # get activity data\n all_date_times = self.activity().index\n\n all_days ...
[ "0.5929608", "0.574596", "0.55326647", "0.5474472", "0.5462424", "0.5437014", "0.5401054", "0.5382752", "0.5361706", "0.52705204", "0.52689993", "0.5264251", "0.5233626", "0.5202995", "0.51812655", "0.5161609", "0.51143515", "0.50975466", "0.5093021", "0.50598747", "0.5042939...
0.6528744
0
Make sure we are sharing the embeddings
def set_tied(self): self.lm_head.set_embeddings_weights(self.transformer.wte.weight)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_embeddings(self):", "def load_embeddings(config, name, vocab, training_generator, validation_generator):\n\n # Pickle embeddings should be AGNOSTIC to the name. This is because each pickled embedding is specific to the dataset and transformer.\n # Applies down the road when/if we attempt active lea...
[ "0.6945156", "0.61463964", "0.60498273", "0.60497475", "0.600102", "0.5945561", "0.5919986", "0.5854738", "0.5815848", "0.5764353", "0.5683327", "0.56654304", "0.5660826", "0.56377274", "0.56158054", "0.56053394", "0.5600107", "0.557418", "0.5573172", "0.5568942", "0.5561353"...
0.5177597
65
Returns a generator of the AirbyteMessages generated by reading the source with the given configuration, catalog, and state.
def read( self, logger: AirbyteLogger, config: Mapping[str, Any], catalog: ConfiguredAirbyteCatalog, state: MutableMapping[str, Any] = None ) -> Iterable[AirbyteMessage]:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def amsg_source_make(*args, **kwargs):\n return _uhd_swig.amsg_source_make(*args, **kwargs)", "def loadFromCs(cs) -> Reactor:\n from armi.reactor import blueprints\n\n bp = blueprints.loadFromCs(cs)\n return factory(cs, bp)", "def create_om_sources(self): #TODO: Prob. should make file names specifiab...
[ "0.48040932", "0.47626972", "0.47410765", "0.47083217", "0.46909904", "0.45570529", "0.45484966", "0.4527919", "0.44946748", "0.4476982", "0.4471172", "0.44699246", "0.44605175", "0.44356242", "0.44228485", "0.43957162", "0.43610972", "0.43510348", "0.43501917", "0.43245143", ...
0.71435726
0
Returns an AirbyteCatalog representing the available streams and fields in this integration. For example, given valid credentials to a Postgres database, returns an Airbyte catalog where each postgres table is a stream, and each table column is a field.
def discover(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> AirbyteCatalog:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_catalog(self):\n streams = []\n\n for report in self.reports_definition:\n # For each report in reports_definition generate a Catalog Entry\n schema_name = report['name']\n view_id = report.get('view_id', self.client.view_id)\n\n schema = {\n ...
[ "0.63259274", "0.56996787", "0.5594333", "0.5563564", "0.5491723", "0.5298365", "0.52703625", "0.5256098", "0.52359384", "0.5234309", "0.5234309", "0.5234309", "0.5226757", "0.5211858", "0.5205091", "0.5180719", "0.5156277", "0.51447415", "0.51197815", "0.5114194", "0.5089148...
0.58156174
1
Creates profile automatically using django signals and created object "instance"
def save_user_receiver(sender, instance, created, *args, **kwargs): print("profile created", instance) if created: new_profile = UserProfile.objects.get_or_create(owner=instance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_profile(sender, instance, signal, created, **kwargs):\n \n from phylocommons.models import UserProfile\n \n if created:\n UserProfile(user = instance).save()", "def create_profile(sender, instance, signal, created, **kwargs):\n \n from tutablr_app.models import UserProfile\n \n if c...
[ "0.867299", "0.8570306", "0.8451151", "0.84137326", "0.82464796", "0.8227456", "0.8212175", "0.81878513", "0.81221265", "0.81221265", "0.81221265", "0.8096361", "0.80837584", "0.8083164", "0.80154145", "0.7915596", "0.78678995", "0.7815063", "0.7811869", "0.7810469", "0.77151...
0.8204448
7
Override to return the class object of the port to be tested, or None if a valid port object cannot be constructed on the specified platform.
def port_maker(self, platform): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_port_type(self):\n raise NotImplementedError", "def port(self, **kw):\n return self.portType(**kw)", "def test_port_get_kind(self):\n assert_equal(self.test_port.get_kind(), 'mpport')", "def get_serial(cls, port):\n if port in cls._open_ports:\n return cls._open...
[ "0.6562559", "0.63834244", "0.6243232", "0.6179789", "0.6163945", "0.60676473", "0.60174555", "0.59178525", "0.5900225", "0.5800537", "0.5724092", "0.55979264", "0.5515977", "0.549112", "0.5490424", "0.5437289", "0.5437289", "0.541859", "0.5402839", "0.53838426", "0.53678054"...
0.66482294
0
This routine should be used for tests that should only be run when we can create a full, valid port object.
def make_port(self, options=mock_options): maker = self.port_maker(sys.platform) if not maker: return None port = maker(options=options) if hasattr(options, "results_directory"): port._options.results_directory = port.results_directory() return port
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def port_factory_method(self):\n pass", "def test_createPort(self):\n store = Store()\n factory = DummyFactory(store=store)\n self.assertSuccessStatus(\n self._makeConfig(store),\n [\"create\", \"--strport\", \"tcp:8080\",\n \"--factory-identifier\", ...
[ "0.72466683", "0.7154215", "0.68323827", "0.6829829", "0.68140477", "0.6730438", "0.66361266", "0.6598617", "0.6575301", "0.65724087", "0.6564386", "0.65223306", "0.6477941", "0.642298", "0.642145", "0.63781863", "0.6371469", "0.6295128", "0.6293753", "0.6241559", "0.6236039"...
0.59248734
51
Clean user reports after a certain amount of time
def clean_reports(): logger.info('Cleaning reports older than %d days' % lgr_settings.report_expiration_delay) # set the last run in the settings data lgr_settings.report_expiration_last_run = timezone.now() lgr_settings.save() nbr, __ = LGRReport.objects.filter( created_at__lt=datetime.date...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def afterHoursAutoPurge(self, ctx: Context):", "def clean_timelog():", "def purge(self, width):\n print('Purge', width)\n step_name = 'Purge'\n t0 = time.time()\n t_lastlog = t0\n while True:\n if self.interrupt_measurement_called:\n self.shuto...
[ "0.6732919", "0.6592778", "0.6126299", "0.6061384", "0.60261893", "0.5976596", "0.58207494", "0.57760584", "0.5754052", "0.5697268", "0.5681771", "0.5681109", "0.5671812", "0.56477356", "0.5646306", "0.55700403", "0.55624986", "0.55588466", "0.5548783", "0.5538477", "0.552587...
0.7127584
0
Calculate the index variant labels of the existing TLDs against the selected RZ LGR
def calculate_index_variant_labels_tlds(user_pk=None): logger.info('Calculate the index variant labels of the existing TLDs against the default RZ LGR') tlds_raw = download_file(settings.ICANN_TLDS)[1].read().lower() tlds = LabelInfo.from_form('TLDs', tlds_raw).labels rz_lgr_object: RzLgr = RzLgr.object...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labelingLVQ(self):\n numLabels = len(np.unique(self.y))\n for i, x in enumerate(self.x):\n w = self.find_closest(x)[0]\n for nl in range(numLabels):\n if self.y[i] == nl:\n self.labels[nl, w[0], w[1]] += 1\n return self.labels", "de...
[ "0.6098479", "0.5809883", "0.5792415", "0.5639455", "0.558691", "0.55725765", "0.5469845", "0.5450689", "0.5437865", "0.53840214", "0.5329258", "0.5291685", "0.52631277", "0.51997197", "0.5175804", "0.51625544", "0.5155564", "0.51203215", "0.51166624", "0.51041543", "0.508753...
0.80737275
0
Increase the counter on the last leaf
def increase_counter(self): self.values = self.values + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment(self):\n if self.is_empty():\n return 0\n else:\n self.get_root().value += 1\n if self.get_left():\n self.get_left().increment()\n if self.get_right():\n self.get_right().increment()", "def increment_depth(self)...
[ "0.70217365", "0.6949094", "0.68084276", "0.6739828", "0.6676615", "0.66305053", "0.6569543", "0.65284365", "0.64648086", "0.6421712", "0.6412349", "0.6386599", "0.6334527", "0.6326167", "0.6287127", "0.62532866", "0.62425673", "0.6223496", "0.6206714", "0.61792964", "0.61560...
0.6186647
19
r"""Returns the \IDN? string
def instrID(self): return self.query('*IDN?')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id(self) -> str:\n\n return self._inst.query('*IDN?')", "def get_id(self): # real signature unknown; restored from __doc__\n return \"\"", "def get_identifier_string(self):\n return self.identifier", "def identifier(self):\n return str(self._nfcid)", "def idn(self):\n ...
[ "0.717656", "0.71156234", "0.68709844", "0.6853172", "0.6840426", "0.676197", "0.66740686", "0.6663309", "0.64954865", "0.649054", "0.64688015", "0.6443778", "0.6399165", "0.63663024", "0.63507825", "0.6271779", "0.62524694", "0.6226763", "0.6211105", "0.62026966", "0.6199872...
0.67640144
5
Given an absolute path, return a path relative to the project root. 'subdir/foo'
def _get_relative_path(self, abs_path): relative_path = os.path.relpath(abs_path, settings.PROJECT_ROOT) return relative_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_relative_path(path):\n if os.path.isabs(path):\n return path\n root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))\n return os.path.join(root_dir, path)", "def _abs_path(rel_path):\n return os.path.join(BASE_DIR, rel_path)", "def absPath(path)...
[ "0.76968694", "0.7513431", "0.74758035", "0.7474766", "0.7435405", "0.7332667", "0.7309524", "0.7283314", "0.7236684", "0.7155462", "0.7137708", "0.7106382", "0.70955163", "0.70686436", "0.70526963", "0.7035758", "0.7011202", "0.701053", "0.70069593", "0.6901063", "0.68866503...
0.7532645
1
withdraw ammount If successful return true else return false
def withdraw(self, ammount): if self.ammount < ammount: print(f"Current balance {self.ammount} is not sufficent to withdraw {ammount}") return False self.ammount -= ammount return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def withdraw(self, account_number: int, withdrawal: float) -> bool: \n if (withdrawal <= self._accounts[account_number][1]):\n self._accounts[account_number][1] -= withdrawal\n return True\n else:\n return False", "def withdraw(self,withdrawal_money):\r\n if ...
[ "0.7129063", "0.697466", "0.685374", "0.6743872", "0.6703391", "0.6656968", "0.6639949", "0.6582516", "0.6498409", "0.6463554", "0.6439925", "0.64195585", "0.64138675", "0.6405057", "0.6379571", "0.634767", "0.63386095", "0.63367176", "0.6332831", "0.632186", "0.6317901", "...
0.79275125
0
Alternative SLF finite source trace
def singleEllipse(n,misalign=np.zeros(6),srcdist=89.61e3+1.5e3,az=100.,\ returnRays=False,f=None,\ plist=[[0],[0],[0]],\ ax=100.,psi=psiE): #Establish subannulus of rays r0 = conic.primrad(8426.,220.,8400.) r1 = conic.primrad(8426.+ax,220.,8400.) rays =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trace(self, trace=...):\n ...", "def trace(self, *args, **kwargs): # real signature unknown\n pass", "def Trace1SL(self,Pts=(0,0.5),TOF_base=0.0,debug=0):\n \n #---------------Flow case determination------------------\n CaseID_a=0 #Normal Case\n CaseID_b=0 #Normal ...
[ "0.61455244", "0.59023607", "0.586509", "0.5801", "0.5533315", "0.5513344", "0.5513344", "0.54926205", "0.54771984", "0.5463698", "0.5431483", "0.53561157", "0.5343255", "0.52886647", "0.5285975", "0.52851033", "0.5280199", "0.52764237", "0.5273738", "0.5253578", "0.5250417",...
0.0
-1
Trace an ellipsoidhyperboloid telescope in SLF geometry. plist is [pcoeff,pax,paz]
def ellipsoidPair(N,srcdist=89.61e3+1.5e3,primalign=np.zeros(6),\ secalign=np.zeros(6),rrays=False,f=None,\ plist=[[0],[0],[0]],hlist=[[0],[0],[0]]): #Establish subannulus of rays r1 = conic.ellipsoidRad(srcdist,1.,220.,8400.,8500.) rays = sources.subannulus(220.,r1,100./220...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hexapodZernikeMultiLinearModel_hexapodcoordinate():\n Tfile='/home/jghao/research/decamFocus/psf_withseeing/finerGrid_coeff_matrix/zernike_coeff_finerGrid_training.cp'\n Vfile = '/home/jghao/research/decamFocus/psf_withseeing/finerGrid_coeff_matrix/zernike_coeff_finerGrid_validate.cp'\n b=p.load(open(...
[ "0.60391474", "0.60107124", "0.60082865", "0.5938178", "0.5851101", "0.58187217", "0.5752928", "0.5570206", "0.54817826", "0.5473699", "0.54417425", "0.5419479", "0.5413631", "0.5397274", "0.5381559", "0.53082275", "0.52977777", "0.52790296", "0.52768147", "0.5266951", "0.526...
0.0
-1
Trace single primary mirror from SLF finite source distance.
def singleOptic(N,misalign=np.zeros(6)): #Define some Wolter parameters r1 = conic.primrad(8600.,220.,8400.) dphi = 100./220./2 #Set up subannulus rays = sources.subannulus(220.,r1,dphi*1.25,N) ## #Set direction cosines ## srcdist = 89.61e3+(1.5e3-misalign[2]) ## raydist = sqrt(srcdist**2+\...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, distance):\n self.logger.debug(\"forward \" + str(distance))", "def mirrorPair(N,srcdist=89.61e3+1.5e3,primalign=np.zeros(6),\\\n secalign=np.zeros(6),rrays=False,f=None,\\\n plist=[[0],[0],[0]],hlist=[[0],[0],[0]]):\n #Establish subannulus of rays\n ray...
[ "0.55876553", "0.5574651", "0.51577866", "0.5152266", "0.50840724", "0.5077566", "0.49696693", "0.49318606", "0.49221513", "0.48353785", "0.48303902", "0.48267508", "0.48097965", "0.47763124", "0.47727197", "0.473136", "0.47198337", "0.47080556", "0.47046912", "0.47038278", "...
0.0
-1
Alternative SLF finite source trace
def singleOptic2(n,misalign=np.zeros(6),srcdist=89.61e3+1.5e3,az=100.,\ returnRays=False,f=None,\ plist=[[0],[0],[0]],\ ax=100.): #Establish subannulus of rays r0 = conic.primrad(8426.,220.,8400.) r1 = conic.primrad(8426.+ax,220.,8400.) rays = sources.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trace(self, trace=...):\n ...", "def trace(self, *args, **kwargs): # real signature unknown\n pass", "def Trace1SL(self,Pts=(0,0.5),TOF_base=0.0,debug=0):\n \n #---------------Flow case determination------------------\n CaseID_a=0 #Normal Case\n CaseID_b=0 #Normal ...
[ "0.61455244", "0.59023607", "0.586509", "0.5801", "0.5533315", "0.5513344", "0.5513344", "0.54926205", "0.54771984", "0.5463698", "0.5431483", "0.53561157", "0.5343255", "0.52886647", "0.5285975", "0.52851033", "0.5280199", "0.52764237", "0.5273738", "0.5253578", "0.5250417",...
0.0
-1
SLF finite source trace
def mirrorPair(N,srcdist=89.61e3+1.5e3,primalign=np.zeros(6),\ secalign=np.zeros(6),rrays=False,f=None,\ plist=[[0],[0],[0]],hlist=[[0],[0],[0]]): #Establish subannulus of rays rays = sources.subannulus(220.,221.,100./220.,N,zhat=-1.) #Transform to node position tran.transf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Trace1SL(self,Pts=(0,0.5),TOF_base=0.0,debug=0):\n \n #---------------Flow case determination------------------\n CaseID_a=0 #Normal Case\n CaseID_b=0 #Normal Case\n if (self.Qa0>0.00001 and self.Qa1<-0.00001): CaseID_a=1\n if (self.Qb0>0.00001 and self.Qb1<-0.00001): ...
[ "0.6230355", "0.5977909", "0.57744026", "0.5744352", "0.5569156", "0.55164635", "0.5399088", "0.5375165", "0.5371074", "0.5357935", "0.53396106", "0.53356117", "0.53268087", "0.5321898", "0.5321898", "0.5321898", "0.5321898", "0.5321898", "0.5321898", "0.5321898", "0.5321898"...
0.0
-1
Trace randomly sampled rays from the TruFocus Xray source to the 1.22 m diameter entrance to the test chamber. AB from Jeff K.'s memo is 89.61 Use oversized subapertured annulus, applying translations
def sourceToChamber(N,misalign=np.zeros(6)): #Define some Wolter parameters r1 = conic.primrad(8600.,220.,8400.) dphi = 100./220./2 #Set up subannulus rays = sources.subannulus(220.,r1,dphi*1.25,N) #Set direction cosines srcdist = 89.61e3+(1.5e3-misalign[2]) raydist = sqrt(srcdist**2+\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rayShooting():\r\n \r\n \r\n if nbRay==1:\r\n maxi=1\r\n mini=1\r\n peaceofAngle=angleMax\r\n #to trace one ray at angleMax\r\n else:\r\n maxi=(nbRay-1)/2\r\n mini=-maxi\r\n peaceofAngle=2*angleMax/(nbRay-1)\r\n #to trace rays at regular inter...
[ "0.6080523", "0.59847254", "0.5690276", "0.55761904", "0.5575056", "0.5566404", "0.5541756", "0.55407023", "0.55353624", "0.54024464", "0.5362905", "0.535498", "0.5332336", "0.53296477", "0.5328625", "0.5296574", "0.52668273", "0.5250945", "0.5230823", "0.5207282", "0.5190450...
0.5207867
19
Place the Xray test mirror pair in the beam path. Assume rays are at XY plane with z mean direction Nominal position of intersection plane is 1.5 m past chamber entrance with mirror optical axis coincident with chamber optical axis. Can supply misalignment about X=0,Y=0 in intersection plane.
def placeWolterPair(rays,misalign=np.zeros(6)): #Go to nominal intersection plane tran.transform(rays,0,0,-1500.,0,0,0) #Apply misalignments tran.transform(rays,*misalign) #Go to focus and place primary tran.transform(rays,0,0,-8400,0,0,0) pdb.set_trace() surf.wolterprimary(rays,220.,840...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def singleOptic2(n,misalign=np.zeros(6),srcdist=89.61e3+1.5e3,az=100.,\\\n returnRays=False,f=None,\\\n plist=[[0],[0],[0]],\\\n ax=100.):\n #Establish subannulus of rays\n r0 = conic.primrad(8426.,220.,8400.)\n r1 = conic.primrad(8426.+ax,220.,8400.)\n r...
[ "0.565168", "0.5393081", "0.5283936", "0.522322", "0.5205699", "0.5202616", "0.5123086", "0.5096728", "0.50832695", "0.5066934", "0.5049444", "0.50404763", "0.5020318", "0.4985988", "0.49774337", "0.49748105", "0.49696785", "0.49527", "0.49473488", "0.49434042", "0.49410293",...
0.5219079
4
Compute the alignment sensitivities for the parabola/hyperbola mirror pair in the SLF.
def nominalSensitivities(): #Scan ranges ang = np.linspace(-5*.3e-3,5*.3e-3,100) tx = np.linspace(-.3,.3,100) #Mirror Pair Sensitivities pitch2 = [mirrorPair(1000,primalign=[0,0,0,0,a,0]) for a in ang] yaw2 = [mirrorPair(1000,primalign=[0,0,0,a,0,0]) for a in ang] plt.figure('Pair') plt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prob_t_a_given_s(self, alignment_info):\n ...", "def get_alignment_params(self, s, w):\n\n\n X1 = s.__get_X(w)\n X2 = self.__get_X(w)\n Y1 = s.__get_Y(w)\n Y2 = self.__get_Y(w)\n Z = self.__get_Z(w)\n W = sum(w)\n C1 = self.__get_C1(w, s)\n C2 = ...
[ "0.61029404", "0.6053958", "0.59238786", "0.57227457", "0.5673756", "0.5650301", "0.56068647", "0.55311704", "0.54914594", "0.54535383", "0.54151297", "0.53894895", "0.53610635", "0.5355899", "0.5355502", "0.5321274", "0.5310322", "0.5308136", "0.5305008", "0.5300116", "0.528...
0.59526455
2
wrap pickle with context manager
def pickleload(path): with open(path, 'rb') as file: loaded = pickle.load(file) return loaded
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__pickle_unpickle(self):\n pass", "def test_can_pickle(self):\n settings = UploadSettings(None, FakeDataServiceApi(), None, ProjectNameOrId.create_from_name('mouse'), None)\n params = ('one', 'two', 'three')\n context = UploadContext(settings, params, multiprocessing.Manager()...
[ "0.66330606", "0.66099405", "0.6122704", "0.60778004", "0.5914767", "0.5810733", "0.5740262", "0.5726259", "0.5715038", "0.5690591", "0.5646342", "0.5645512", "0.5605082", "0.560194", "0.55433786", "0.5529835", "0.55211455", "0.5502968", "0.5493324", "0.5484761", "0.547961", ...
0.0
-1
wrap pickle with context manager
def picklesave(obj, path): with open(path, 'wb') as file: pickle.dump(obj, file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__pickle_unpickle(self):\n pass", "def test_can_pickle(self):\n settings = UploadSettings(None, FakeDataServiceApi(), None, ProjectNameOrId.create_from_name('mouse'), None)\n params = ('one', 'two', 'three')\n context = UploadContext(settings, params, multiprocessing.Manager()...
[ "0.66330606", "0.66099405", "0.6122704", "0.60778004", "0.5914767", "0.5810733", "0.5740262", "0.5726259", "0.5715038", "0.5690591", "0.5646342", "0.5645512", "0.5605082", "0.560194", "0.55433786", "0.5529835", "0.55211455", "0.5502968", "0.5493324", "0.5484761", "0.547961", ...
0.5156162
70
inverse operation of zip
def unzip(zipped): return zip(*zipped)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unzip(seq):\n return zip(*seq)", "def unzip(pairs):\n return tuple(zip(*pairs))", "def lzip(*args):\n return list(zip(*args))", "def zip() -> List:\n pass", "def zip(self, *lists):\n return _(zip(self._, *lists))", "def unzip(self, x):\n if (len(x)>0):\n return list...
[ "0.71670586", "0.70784897", "0.70730954", "0.68114686", "0.66874325", "0.6505765", "0.644282", "0.6410914", "0.62485206", "0.62342817", "0.62151444", "0.6032149", "0.60291183", "0.6010827", "0.5977113", "0.5951999", "0.59314424", "0.5911916", "0.58797705", "0.58797705", "0.58...
0.68771124
3
sort a list of lists by applying `key` to the first list
def sort_n(lists, key=None, reverse=False): lists = [list(x) for x in lists] if key is None: return unzip(sorted(zip(*lists), reverse=reverse)) else: return unzip(sorted(zip(*lists), key=lambda x: key(x[0]), reverse=reverse))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_list(list, key):\r\n list.sort(lambda x,y: cmp(key(x), key(y))) # Python < 2.4 hack\r\n return list", "def sort_by(dict_list, key):\n return sorted(dict_list, key=lambda k: k[key])", "def sort(self, key_func):\n pass", "def sort(self, key: Callable):\n self.data.sort(key=key)", ...
[ "0.8160606", "0.68767965", "0.67813087", "0.66011316", "0.66011316", "0.64723945", "0.64605004", "0.63796693", "0.6350524", "0.634693", "0.63394505", "0.63129747", "0.6311414", "0.6256282", "0.62534684", "0.6242892", "0.6225871", "0.61469173", "0.61036456", "0.60641676", "0.6...
0.6743405
3
Initialize your data structure here.
def __init__(self): self.q1 = deque() self.q2 = deque() self.size = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_empty(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__...
[ "0.7765608", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7595176", "0.75853467", "0.7558298", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.74971247", "0.74971247", "0.7478105", "0.7477832", "0.7477832", "0.7477832", ...
0.0
-1
Push element x onto stack.
def push(self, x: int) -> None: self.q1.append(x) self.size += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, x):\n self.stack.append(x)", "def push(self, x):\n self.stack.append(x)", "def push(self, x):\n self.stack1.append(x)", "def push(self, x: int) -> None:\n self.stack.insert(0,x)", "def push(self, x: int) -> None:\n self.stack.append(x)", "def push(self, x...
[ "0.89402515", "0.89402515", "0.88311124", "0.8809358", "0.87103736", "0.8672292", "0.86654997", "0.8621373", "0.8583423", "0.8547227", "0.8547227", "0.8511911", "0.84800553", "0.8436793", "0.8426803", "0.8399629", "0.8271687", "0.8203116", "0.81832", "0.8117397", "0.8117397",...
0.74636024
60
Removes the element on top of the stack and returns that element.
def pop(self) -> int: self._aux() ret = self.q1.popleft() self.q1, self.q2 = self.q2, self.q1 self.size -= 1 return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop(self):\n item = self.stack[-1]\n self.stack = self.stack[:-1]\n return item", "def remove(self):\n return self.stack_list.pop()", "def pop(self):\n popped_node = self.top[0]\n self.top = self.top[1:]\n return popped_node", "def pop(self):\n retur...
[ "0.8126255", "0.8122096", "0.80220246", "0.7989189", "0.7924986", "0.79200727", "0.7894859", "0.7890167", "0.7878725", "0.78787017", "0.78389287", "0.7796697", "0.77866924", "0.7773294", "0.7772558", "0.7746193", "0.7743744", "0.7712175", "0.7706974", "0.7698884", "0.76487166...
0.0
-1
Get the top element.
def top(self) -> int: self._aux() ret = self.q1[0] self.q2.append(self.q1.popleft()) self.q1, self.q2 = self.q2, self.q1 return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top(self) -> int:\n return self.topEle", "def top(self):\n return self[0]", "def top(self):\n\t\tif self.is_empty():\n\t\t\traise Empty('Stack is empty')\n\t\treturn self._head._element", "def top_ele(self):\n if not self.is_empty():\n return self.arr[self.top]\n re...
[ "0.8235124", "0.81769097", "0.81664395", "0.8041673", "0.78638077", "0.78638077", "0.78014153", "0.78005594", "0.778282", "0.775879", "0.7704059", "0.7700389", "0.7652212", "0.7570927", "0.75293076", "0.747555", "0.745659", "0.74140024", "0.7404542", "0.7389149", "0.7385158",...
0.68403614
71
Returns whether the stack is empty.
def empty(self) -> bool: return self.size == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_stack) == 0", "def is_empty(self):\n return len(self.stack) == 0", "def empty(self) -> bool:\n return len(self.stack) == 0", "def isEmpty(self):\n return len(self.stack) == 0", "def empty(self):\n return len(self.stack) == 0", "...
[ "0.9207258", "0.91276956", "0.90185934", "0.9000551", "0.89481044", "0.89481044", "0.8914844", "0.8904091", "0.8881541", "0.88791907", "0.8867761", "0.87955654", "0.8768181", "0.8748518", "0.87393755", "0.8728073", "0.8719241", "0.87090814", "0.87090814", "0.85431594", "0.850...
0.0
-1
set and check parameters.
def parse_args(): parser = argparse.ArgumentParser(description="crnn process") parser.add_argument("--dir_name", type=str, default=None, help="infer input dir") parser.add_argument('--res_dir_name', default='./output', type=str, help='the folder to save the re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_params(self):\n pass", "def set_params(self):\r\n pass", "def _set_params(self, *args, **kwargs):\n startup = False\n try:\n params = args[0]\n except IndexError:\n raise InstrumentParameterException('Set command requires a parameter dict.')\n...
[ "0.79090744", "0.7478332", "0.73961675", "0.73716694", "0.73063236", "0.72327065", "0.7229958", "0.71148866", "0.7112186", "0.7080229", "0.70182025", "0.7015942", "0.6978744", "0.6976777", "0.69733065", "0.6928341", "0.6918894", "0.6894713", "0.68870074", "0.68486726", "0.683...
0.0
-1
Return a checkpoint manager defined by the value of the `type` key in the configuration dictionary. Throws a `TypeError` if no storage manager with `type` is defined.
def build(config: Dict[str, Any]) -> StorageManager: check_in("type", config, "Missing 'type' parameter of storage configuration") # Make a deep copy of the config because we are removing items to # pass to the constructor of the `StorageManager`. config = copy.deepcopy(config) identifier = config....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manager_factory(manager_type):\n return {\n 'web': WebManager,\n 'github': GitHubManager,\n 'apkdownloadmirror': ApkDownloadMirrorManager,\n 'apkplz': ApkPlzManager,\n }[manager_type]", "def _create_checkpoint_manager(\n model_name: str, task_p: InstantiableParams, job_lo...
[ "0.6401131", "0.6069019", "0.59213936", "0.5719229", "0.559669", "0.5482336", "0.54399186", "0.53723955", "0.53366035", "0.52779186", "0.52499807", "0.52420837", "0.52158326", "0.51914054", "0.5121875", "0.5105557", "0.508021", "0.50717044", "0.50554276", "0.50545657", "0.500...
0.5737697
3
Validate that the checkpoint storage can be written to, restored from, and deleted from. Throws an exception if any of the operations fail.
def validate(config: Dict[str, Any]) -> None: class ValidationData(Storable): """ Verification for reading and writing a UUID to a checkpoint. The UUID saved must match the UUID that is loaded. """ def __init__(self) -> None: self.uuid = str(uuid.uuid4()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_checkpoint(self, checkpoint):\n if checkpoint not in self.journal:\n raise ValidationError(\"Checkpoint not found in journal: {0}\".format(\n str(checkpoint)\n ))", "def _checkIntegrity(self):\n return (\n os.path.isfile(os.path.join(sel...
[ "0.6401403", "0.604441", "0.60247445", "0.6014493", "0.5938673", "0.58888197", "0.5848131", "0.58427566", "0.58053726", "0.5703405", "0.5692488", "0.5662562", "0.55983996", "0.55499136", "0.55243295", "0.55065054", "0.5486752", "0.54731613", "0.5468748", "0.54644", "0.5440154...
0.6228919
1
Test handling of unsupported file types.
def test_read_raw_unsupported_single(fname): with pytest.raises(ValueError, match='Unsupported file type'): read_raw(fname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_filekind(self):\n assert self.filekind in self.obs_package.FILEKINDS, \\\n \"Invalid filekind \" + repr(self.filekind) + \" in \" + repr(self.filename)", "def test_invalid_file_type(barred_tac_list_importer):\n expect_failure(barred_tac_list_importer, exc_message='Wrong suffix')", ...
[ "0.73096466", "0.72667396", "0.7169709", "0.7053844", "0.70381856", "0.70034885", "0.6961319", "0.69586676", "0.693639", "0.6911375", "0.6904064", "0.69033587", "0.6871798", "0.6871798", "0.68167496", "0.6815058", "0.68058836", "0.6796886", "0.67907995", "0.67274284", "0.6679...
0.72083527
2
Test handling of supported file types but with bad data.
def test_read_raw_unsupported_multi(fname, tmp_path): fname = tmp_path / fname fname.write_text('') with pytest.raises(RuntimeError, match='Could not read.*using any'): read_raw(fname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_read_raw_unsupported_single(fname):\n with pytest.raises(ValueError, match='Unsupported file type'):\n read_raw(fname)", "def test_mimetypes(self):\n field = TypedFileField(required=False, type_whitelist=self.good_types, use_magic=False)\n\n for t in self.good_types:\n ...
[ "0.74382997", "0.7410078", "0.73706025", "0.7338524", "0.7261793", "0.72291225", "0.71552974", "0.7154416", "0.7031707", "0.68959975", "0.6882427", "0.6861409", "0.684707", "0.6789293", "0.6767486", "0.6741527", "0.6737622", "0.67358255", "0.6731696", "0.67203623", "0.6695517...
0.63953114
35
Test handling of unsupported file types with suggested alternatives.
def test_read_raw_suggested(fname): with pytest.raises(ValueError, match='Try reading'): read_raw(fname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_file_type(barred_tac_list_importer):\n expect_failure(barred_tac_list_importer, exc_message='Wrong suffix')", "def test_available_input_formats():\n assert set([\"Mapchete\", \"raster_file\", \"vector_file\"]).issubset(\n set(available_input_formats())\n )", "def test_general_s...
[ "0.7028738", "0.7011318", "0.69126594", "0.6885521", "0.6855406", "0.67453164", "0.67340046", "0.67340046", "0.6723626", "0.6694643", "0.6680965", "0.66767067", "0.66629815", "0.65844667", "0.657588", "0.6551066", "0.6483879", "0.64343315", "0.642884", "0.6425589", "0.6418884...
0.0
-1
Test supported file types.
def test_read_raw_supported(fname): read_raw(fname) read_raw(fname, verbose=False) raw = read_raw(fname, preload=True) assert "data loaded" in str(raw)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SupportedFiletypes( self ):\n return ['plaintex', 'tex']", "def SupportedFiletypes( self ):\n return ['plaintex', 'tex']", "def check_file_type(fname):\n ext = path.splitext(fname)[1]\n return ext in allowed_extensions", "def supportedType(request, video_types):\n return request.FI...
[ "0.75743014", "0.75743014", "0.7446866", "0.7374533", "0.72811556", "0.7253329", "0.7240825", "0.7200986", "0.71743566", "0.71026045", "0.7073984", "0.6995628", "0.69731855", "0.69684285", "0.68646485", "0.6860663", "0.68215215", "0.6792538", "0.6772953", "0.6734382", "0.6728...
0.0
-1
For a given n, return X(t)
def X_n(a, b, n, T): def X(t): return a * np.cos((np.pi * 2 * n * t) / T) + b * np.sin((np.pi * 2 * n * t) / T) return X
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def I (self, n):", "def H(n,x):\r\n H_values = [] #a list of sequential H values for different n's up to n=n.\r\n H_values.append(1) #appends H_0.\r\n H_values.append(2*x) #appends H_1.\r\n if n>1:\r\n for i in range(1,n):\r\n H_values.append((2*x*H_values[-1])-(2*i*H_values[-2]))...
[ "0.6313942", "0.62647074", "0.6229281", "0.6226506", "0.6218988", "0.6215609", "0.61505866", "0.6141341", "0.6121001", "0.61204237", "0.6110605", "0.60703003", "0.6052773", "0.60342765", "0.6012939", "0.59978163", "0.59976727", "0.59882796", "0.592562", "0.5920827", "0.590750...
0.6888937
0
Takes plain text, returns HTML
def paintText(self, text): return '@paint '+text * 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plain_to_html(plain_text):\n if plain_text is None:\n return \"\"\n\n # We remove trailing whitespace - most notably newlines - so we\n # don't end up with unexpected vertical whitespace in the output.\n html = str(plain_text).rstrip().replace(\"&\", \"&amp;\"). \\\n replace(\"<\", \"...
[ "0.7550789", "0.7188893", "0.700638", "0.6908054", "0.68955153", "0.6698889", "0.6694212", "0.6688597", "0.6665702", "0.66182286", "0.661604", "0.66057044", "0.6555294", "0.64987445", "0.6463699", "0.6456063", "0.6424575", "0.63640916", "0.6352742", "0.63313746", "0.63157815"...
0.0
-1
Extract keywords from text content for recommender
def extract_text(self, categories, entries): text = " ".join( [ self.podcast.title, self.podcast.description, self.podcast.keywords, self.podcast.authors, ] + [c.name for c in categories] + [e["title"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keyword_extraction(file_content):\n\n # [question, question....]\n for key, value in file_content.items():\n seg, hidden = ltp.seg([key])\n # ner: [[('Nh', 2, 2)]]\n ner = ltp.ner(hidden)\n # keywords: [('PERSON', \"吴轩\")], tuple_item: ('Nh', 2, 2)\n keywords = [(tag_t...
[ "0.6903335", "0.6842439", "0.67924124", "0.6734254", "0.6721905", "0.67102164", "0.6706387", "0.6632763", "0.6609244", "0.6552113", "0.65412855", "0.6475794", "0.64006937", "0.63784295", "0.6262502", "0.61701745", "0.61657244", "0.6163229", "0.6147644", "0.6125211", "0.612389...
0.5536626
80
Parses new episodes from podcast feed.
def create_episodes_from_feed(self, entries): guids = self.podcast.episode_set.values_list("guid", flat=True) entries = [entry for entry in entries if entry["id"] not in guids] episodes = [ episode for episode in [self.create_episode_from_feed(entry) for entry in entries...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_podcast_episodes(url):\n\n def parse_pubdate(date_string):\n \"\"\"\n Change pubdate string to datetime object. Tries a bunch of\n possible formats, but if none of them is a match, it will\n return a epoch = 0 datetime object\n\n :param date_string: A string representi...
[ "0.6681258", "0.64088464", "0.61949426", "0.6156933", "0.6130738", "0.6122721", "0.6103838", "0.60889024", "0.60440505", "0.5956099", "0.5897863", "0.5877394", "0.58128", "0.58113426", "0.57403153", "0.57149476", "0.5643858", "0.55934775", "0.5578704", "0.55482566", "0.554315...
0.7159126
0
This function runs hashlib.sha512() on a file using chunks to ensure that too much RAM is not used.
def sha512(fname, /, *, chunksize = 1048576): # Import standard modules ... import hashlib # Create hash object ... hobj = hashlib.sha512() # Open input file as bytes ... with open(fname, "rb") as fObj: # Start infinite loop ... while True: # Read a chunk ... ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_file_sha512(fileIn):\n\n # fileIn is read in chunks to ensure it will work with (very) large files as well\n # Adapted from: http://stackoverflow.com/a/1131255/1209004\n\n blocksize = 2**20\n m = hashlib.sha512()\n with open(fileIn, \"rb\") as f:\n while True:\n buf = ...
[ "0.7312387", "0.72841877", "0.7193235", "0.69665354", "0.68670136", "0.6723953", "0.6630066", "0.6559456", "0.6534818", "0.64672387", "0.63602763", "0.6274184", "0.626974", "0.6252934", "0.6230989", "0.6187304", "0.61721843", "0.6122351", "0.6092596", "0.5980338", "0.59542215...
0.8374994
0
r"""Updating the injection spectrum.
def update_spectrum(self, spectrum): self.spectrum = spectrum return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.probe.update()", "def update(self):\n self.probe.update()", "def update(self):\n self.probe.update()", "def retarder(self):\n self.spectrum = self.spectrum", "def analyzer(self):\n self.spectrum = self.spectrum", "def calibration_wheel(self):\n ...
[ "0.61867964", "0.61867964", "0.61867964", "0.614271", "0.5898126", "0.58536935", "0.5806128", "0.57766", "0.5747572", "0.57033694", "0.56991166", "0.5691732", "0.5648008", "0.56375796", "0.56250036", "0.56163186", "0.56163186", "0.5604377", "0.55946124", "0.55214006", "0.5519...
0.6875147
0
Decrypt Atbash enciphered ``ciphertext``.
def decrypt(ciphertext: str) -> Iterable: return simplesubstitution.decrypt(KEY, ciphertext)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt(ciphertext):\n # AES decrypt\n iv = ciphertext[:16]\n ciphertext = ciphertext[16:]\n aes = AES.new(aes_key, AES.MODE_CBC, iv)\n return unpad(aes.decrypt(ciphertext))", "def AES_decrypt(ciphertext: bytes) -> Text:\n text = b64decode(ciphertext)\n cipher = AES.new(secret_key, mode,...
[ "0.78322375", "0.7773383", "0.76747906", "0.7654733", "0.7619048", "0.7461599", "0.73763734", "0.73708224", "0.73604953", "0.7348656", "0.7313953", "0.7302905", "0.72707146", "0.72664046", "0.7230564", "0.72174984", "0.7199756", "0.7146144", "0.7120665", "0.7120328", "0.71192...
0.71859765
17
Encrypt ``plaintext`` using the Atbash cipher.
def encrypt(plaintext: str) -> Iterable: return simplesubstitution.encrypt(KEY, plaintext)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt(plaintext):\n # Pad plaintext\n plaintext = pad(plaintext)\n\n # AES encrypt\n iv = Random.new().read(BS)\n aes = AES.new(aes_key, AES.MODE_CBC, iv)\n return iv + aes.encrypt(plaintext)", "def encrypt(self, plaintext: str) -> str:\n\n return self.run(plaintext, Cryptography.E...
[ "0.7664223", "0.75808525", "0.7366595", "0.73122513", "0.72628057", "0.7151047", "0.71095973", "0.70853424", "0.7013064", "0.7007951", "0.7000938", "0.6868807", "0.68433076", "0.6824256", "0.68010783", "0.6728267", "0.66872984", "0.66638947", "0.6647861", "0.6626619", "0.6533...
0.70129436
9
Reading configuration file Returns
def read_config_file(self): logging.info('INICIANDO: leitura do arquivo de configuração PC.CFG') config = configparser.ConfigParser() config.read('config/pc.cfg') config.sections() logging.info('FINALIZADO: leitura de arquivo de configuração PC.CFG') return config.has_section('STEMMER'), config['INPUT']['LE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_config(self, config_filename):", "def read_configuration (self):\n\t\tself.config.read(self._configfile)", "def read_config():\n with open(CONFIG_PATH) as config_file:\n return json.load(config_file)", "def read_config(self):\n config = configparser.ConfigParser()\n config.re...
[ "0.82731414", "0.82487226", "0.7645759", "0.76453274", "0.75809246", "0.7491857", "0.7444287", "0.7401327", "0.7388163", "0.7383486", "0.7353306", "0.7320921", "0.72839415", "0.7280581", "0.7267472", "0.72558105", "0.72437257", "0.7223348", "0.7204599", "0.7200702", "0.719202...
0.72244793
17
Gets a text and remove unwanted characters and stopwords
def tokenize_query(self, query_text): tokenizer = RegexpTokenizer(r'\w+') stop_words = set(stopwords.words('english')) abstract = tokenizer.tokenize(query_text.upper()) final_sentence = [w for w in abstract if not w.lower() in stop_words] return " ".join(final_sentence).upper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_text ( self, text ) :\n text = BeautifulSoup ( text , \"lxml\" ).text # HTML decoding\n text = text.lower ( ) # lowercase text\n text = REPLACE_BY_SPACE_RE.sub ( ' ' , text ) # replace REPLACE_BY_SPACE_RE symbols by space in text\n text = BAD_SYMBOLS_RE.sub ( '' , text ) #...
[ "0.8261034", "0.8261034", "0.8261034", "0.8261034", "0.8261034", "0.8261034", "0.80761874", "0.7878042", "0.781106", "0.7800905", "0.7735733", "0.7683698", "0.7679524", "0.7636291", "0.7591591", "0.7556787", "0.75497967", "0.75274956", "0.7526585", "0.7507759", "0.7490869", ...
0.0
-1
Defining score according votes
def define_score(self, votes_string): #2*REW + colleagues + post-doctorate associate + 2* JBW votes = [int(x) for x in votes_string] weights = [2,1,1,2] score = 0 for i in range(0, 4): if votes[i] >= 0 and votes[i] <= 2: score += votes[i]*weights[i] return score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_score(self, obj):\n content_type = ContentType.objects.get_for_model(obj)\n result = self.filter(content_type=content_type,\n object_id=obj._get_pk_val()).aggregate(\n score=Sum('vote'),\n ...
[ "0.716967", "0.6934019", "0.6640118", "0.66166174", "0.6604573", "0.654908", "0.64828604", "0.64662987", "0.6440514", "0.64305836", "0.6388617", "0.63805676", "0.63544095", "0.63482374", "0.6321137", "0.6302071", "0.6254929", "0.62451154", "0.6213553", "0.6203114", "0.6122902...
0.75115824
0
Reading xml file and getting content from QueryNumber, QueryText, Results and Records tags
def read_xml(self, xml_name): logging.info('INICIANDO: leitura do arquivo xml de consultas') doc = xml.dom.minidom.parse(xml_name) query_number = doc.getElementsByTagName("QueryNumber") query_text = doc.getElementsByTagName("QueryText") results = doc.getElementsByTagName("Results") records = doc.getElements...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_XML(filename):\n logger_global.info('Reading '+filename+' file...')\n init = time.time()\n \n queries = []\n queries_keys = []\n results = []\n dom_tree = parse(filename)\n query_xml = dom_tree.documentElement.getElementsByTagName(\"QUERY\")\n \n for qu in query_xml:\n ...
[ "0.7173334", "0.6277773", "0.6025296", "0.58326966", "0.5825554", "0.57722706", "0.55968976", "0.55710435", "0.5553241", "0.5421207", "0.5395721", "0.53890324", "0.53667855", "0.53554547", "0.5332934", "0.53212774", "0.53173196", "0.529998", "0.5299098", "0.5297139", "0.52959...
0.7311271
0
Writing xml file in the query file In the resulting file, it is possible to find all the queries
def generate_query_file(self, query_file, xml_name, apply_stemmer): if apply_stemmer: logging.info('INICIANDO: geração de arquivo de consultas com stemmer') else: logging.info('INICIANDO: geração de arquivo de consultas sem stemmer') content = self.read_xml(xml_name) if apply_stemmer: query_file = qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_expected_file(self, expected_file, xml_name):\n\t\tlogging.info('Gerando arquivo de documentos esperados')\n\t\tcontent = self.read_xml(xml_name)\n\n\t\twith open(expected_file, 'w', newline='') as csvfile:\n\t\t\tfieldnames = ['QueryNumber', 'DocNumber', 'DocVotes']\n\t\t\twriter = csv.DictWriter(csv...
[ "0.6497793", "0.62081456", "0.62006843", "0.6157533", "0.6150465", "0.615025", "0.61167115", "0.60717726", "0.6031287", "0.5999682", "0.59621423", "0.5887432", "0.5863373", "0.5846017", "0.5824117", "0.5806362", "0.58015513", "0.5782127", "0.5765131", "0.5738493", "0.5731863"...
0.68933845
0
Writing xml file in the expected file In the resulting file, it is possible to find all retrieved documents for the queries
def generate_expected_file(self, expected_file, xml_name): logging.info('Gerando arquivo de documentos esperados') content = self.read_xml(xml_name) with open(expected_file, 'w', newline='') as csvfile: fieldnames = ['QueryNumber', 'DocNumber', 'DocVotes'] writer = csv.DictWriter(csvfile, fieldnames=fieldn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_output_file(self, xml_text, xml_file):\n xml_fo = open(xml_file, 'w')\n xml_fo.write(xml_text+'</xml>')\n xml_fo.close()\n return", "def xmlwrite(self, doc, filename):\n pathname = os.path.join(self.session.session_dir, filename)\n f = open(pathname, \"w\")\n ...
[ "0.65399575", "0.63661104", "0.63374054", "0.63239974", "0.6219125", "0.62150633", "0.6206546", "0.61252916", "0.6086908", "0.60831994", "0.5984633", "0.5983388", "0.5897017", "0.58935225", "0.5852003", "0.5838994", "0.5825246", "0.5819493", "0.5794886", "0.57939947", "0.5779...
0.7599953
0
Main method Reads all files and generate a file with queries and a file with expected documents to each query
def generate_files(self): apply_stemmer, xml_file, query_file, expected_file = self.read_config_file() self.generate_query_file(query_file, xml_file, apply_stemmer) self.generate_expected_file(expected_file, xml_file) logging.info('FINALIZADO: MÓDULO PROCESSADOR DE CONSULTAS')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n with read_std_files(OUT_FILE) as (qrys_file, docs_file, out_file):\n doc_count, token_count, word_map = map_docs(docs_file)\n avg_doc_len = token_count / float(doc_count)\n for doc_id, doc_tokens in tokenize(docs_file):\n doc_len = len(doc_tokens)\n doc_d...
[ "0.68237984", "0.6357273", "0.6356943", "0.6325044", "0.63006157", "0.6190093", "0.61827916", "0.61622274", "0.6130799", "0.61200684", "0.6096639", "0.60336506", "0.60316324", "0.60244626", "0.6006422", "0.60005426", "0.5965755", "0.5961854", "0.59602106", "0.5943142", "0.594...
0.709213
0
Method to send the movement commands to the relevant RCSnail car
def send_commands_to_car(self, commands, steering_only=False): if steering_only: data = {'steering': commands[0]} else: assert len(commands) == 4, 'The input array must have all 4 parameters' data = { 'steering': commands[0], 'braking...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drive(self, carstate: State) -> Command:\n command = Command()\n stateList = self.stateToArray(carstate)\n # output = self.network.activate(stateList)\n\n # Set the link to find the file of the one to work with\n if not self.set:\n files = glob.glob(\"cooperation*....
[ "0.7000707", "0.66200346", "0.65237993", "0.65043175", "0.64658767", "0.64266723", "0.6421654", "0.64176905", "0.63326794", "0.6222958", "0.61919874", "0.6152388", "0.6120059", "0.610974", "0.6079726", "0.60552186", "0.6035609", "0.6035609", "0.602871", "0.6015453", "0.597111...
0.61257654
12
V_{pi}(s) = sum _{over a_i} {pi(a_i | s) Q(s, a_i)}
def get_value(self, state): epsilon = self.epsilon possible_actions = self.get_legal_actions(state) #If there are no legal actions, return 0.0 if len(possible_actions) == 0: return 0.0 optimal_action = possible_actions[ np.argmax([self.get_qvalue(state, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v_o(A,vd):\n return A*vd", "def Phi(v, p, q):\n \n return np.sum([Y(t,p,q) for t in v])", "def psi(x, a, q):\n T = q.shape[1]\n covmat = calculate_variance(x + tile(a, [T, 1]).T)\n psi1 = covmat[0, 0] - covmat[1, 1]\n psi2 = covmat[0, 1]\n psi3 = x[0, -1]\n psi4 = x[1, -1]\n\n ...
[ "0.64910585", "0.61752075", "0.61417836", "0.6118552", "0.6099815", "0.60564065", "0.60209495", "0.59644455", "0.59644455", "0.59644455", "0.59408617", "0.5937994", "0.59097135", "0.59003294", "0.5872767", "0.5872767", "0.5872767", "0.5872767", "0.5865587", "0.5857403", "0.58...
0.0
-1
Visualizer for Deep Neural Networks. Solves an inverse problem to find a suited input that minimizes the cost function given in calcCost.
def __init__(self, calcGrad, calcCost, input): self.calcGrad = calcGrad self.calcCost = calcCost self.input = np.asarray(input, dtype=np.float32) self.inp_shape = input.shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, calcGrad, calcCost, input, alpha = 0.01):\n \n\tVisualizer.__init__(self, calcGrad, calcCost, input)\n\n\tself.alpha = alpha", "def visualize(self):\n\n self.check_model()\n show(prepare(self.model, self.vectorized_data, self.vectorizer, mds='tsne'))", "def visualize_sal...
[ "0.59802836", "0.5900457", "0.58743674", "0.5754298", "0.56696457", "0.560777", "0.55553436", "0.55489355", "0.55174387", "0.55137515", "0.5511292", "0.54651713", "0.54602545", "0.5417337", "0.53927183", "0.5383849", "0.5360551", "0.53586024", "0.53448915", "0.53194773", "0.5...
0.0
-1
Deep Visualization for Deep Neural Networks. Solves an inverse problem to find a suited input that minimizes the cost function given in calcCost.
def __init__(self, calcGrad, calcCost, input, alpha = 0.01): Visualizer.__init__(self, calcGrad, calcCost, input) self.alpha = alpha
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deep_dream_of_extreme_control(FLAGS,model,input_images=[],num_iterations=10,step_size=0.1):\n if len(input_images) == 0:\n # use predefined images\n img_dir='/esat/opal/kkelchte/docker_home/pilot_data/visualization_images'\n input_images=sorted([img_dir+'/'+f for f in os.listdir(img_dir)])\n\n print...
[ "0.5776294", "0.5655469", "0.5644679", "0.5526504", "0.5513294", "0.55041754", "0.54516816", "0.5432973", "0.5399264", "0.5386139", "0.5346754", "0.5345675", "0.5330562", "0.53183424", "0.5296879", "0.5293629", "0.52837807", "0.52808344", "0.52775186", "0.52714753", "0.526823...
0.54288465
8
Function that computes the cost value for a given x
def costFun(self, x): tmp = x.reshape(self.inp_shape) c = np.float64(self.calcCost(np.asarray(tmp,dtype=np.float32))) + self.alpha * np.dot(x.T, x) return c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def costFun(self, S, x):", "def cost(self,x):\n Mx = self.generate_vector()\n self.prior.M.mult(x,Mx)\n return .5*Mx.inner(x)", "def final_cost(self, x):\n return self.x_M_x(x[-1,:,:],self.R)", "def fn(x):\n if x == 0: return 0\n if x < 0: return -inf \n ...
[ "0.8048273", "0.7995505", "0.7497831", "0.74943554", "0.72771204", "0.72714454", "0.724877", "0.7232135", "0.72299874", "0.72011256", "0.7193746", "0.7113412", "0.7009601", "0.69141775", "0.68879235", "0.6861625", "0.67966616", "0.67966616", "0.67889404", "0.6746737", "0.6742...
0.820668
0
Function that computes the gradient of the cost function at x
def gradFun(self, x): tmp = x.reshape(self.inp_shape) g = np.ravel(np.asarray(self.calcGrad(np.asarray(tmp,dtype=np.float32)),dtype=np.float64)) + 2*self.alpha*x return g
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(self, x):\n pass", "def gradient(cls, x):\n y = Sigmoid.apply(x)\n return np.multiply(y, 1 - y)", "def gradient(self, x):\n u = np.asarray([x[0]])\n C = self.C_func(u)\n dC = self.dC_func(u, order=1)\n P = self.P\n numerat...
[ "0.77842075", "0.7665237", "0.7622198", "0.7532601", "0.744385", "0.74368525", "0.7415534", "0.7381988", "0.7379216", "0.7374011", "0.73667705", "0.7362312", "0.73497534", "0.7292546", "0.72891796", "0.7286683", "0.72824043", "0.72817236", "0.7221008", "0.7217221", "0.7211500...
0.7418975
6
Solves the inverse problem
def optimize(self, x0): (result,f,d) = fmin_l_bfgs_b(lambda x:self.costFun(x), np.ravel(x0),lambda x: self.gradFun(x)) print("optimization completed with cost: " + str(f)) return result.reshape(self.inp_shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse(self):\n return self.solve(Matrix.I(self.nrows))", "def inverse(self):\n self.check_square()\n\n\n N = self.rows\n\n inverse = make_matrix(N, N)\n\n # Solve on a per-column basis using Ax = b formalism\n for j in range(N):\n b = make_matrix(N, 1)\n...
[ "0.78967696", "0.768662", "0.7365531", "0.7246305", "0.7235828", "0.71719176", "0.7033936", "0.69739187", "0.69531745", "0.6916821", "0.6867409", "0.6858064", "0.6847429", "0.68383527", "0.6826942", "0.68186474", "0.6793239", "0.6787958", "0.67806756", "0.67797565", "0.677384...
0.0
-1
Subset selection for Deep Neural Networks. Solves an inverse problem to find a suited input that minimizes the cost function given in calcCost.
def __init__(self, calcGrad, calcCost, input, alpha = 0.01, gamma = 0.1): Visualizer.__init__(self, calcGrad, calcCost, input) self.alpha = alpha self.gamma = gamma
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def training_batch_selection(train_set_size, input_img):\n\n input_dims = input_img.shape\n all_data_indices = np.arange(input_dims[0]*input_dims[1])\n all_data_indices = all_data_indices.reshape(input_dims[:-1])\n\n conf = get_config()\n inside = int(np.floor(conf[\"inside_part\"]))\n outside = ...
[ "0.57697535", "0.562434", "0.5616341", "0.5610637", "0.56050736", "0.5519219", "0.5512085", "0.55078983", "0.5479911", "0.5459371", "0.54215497", "0.5415881", "0.5408919", "0.53455186", "0.5337947", "0.532884", "0.5326981", "0.5322655", "0.5321926", "0.52773917", "0.5220302",...
0.0
-1
Function that computes the cost value for a given x
def costFun(self, S, x):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def costFun(self, x):\n\ttmp = x.reshape(self.inp_shape)\n\tc = np.float64(self.calcCost(np.asarray(tmp,dtype=np.float32))) + self.alpha * np.dot(x.T, x)\n\treturn c", "def cost(self,x):\n Mx = self.generate_vector()\n self.prior.M.mult(x,Mx)\n return .5*Mx.inner(x)", "def final_cost(self,...
[ "0.820668", "0.7995505", "0.7497831", "0.74943554", "0.72771204", "0.72714454", "0.724877", "0.7232135", "0.72299874", "0.72011256", "0.7193746", "0.7113412", "0.7009601", "0.69141775", "0.68879235", "0.6861625", "0.67966616", "0.67966616", "0.67889404", "0.6746737", "0.67426...
0.8048273
1
Function that computes the gradient of the cost function at x
def gradFun(self, S, x):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(self, x):\n pass", "def gradient(cls, x):\n y = Sigmoid.apply(x)\n return np.multiply(y, 1 - y)", "def gradient(self, x):\n u = np.asarray([x[0]])\n C = self.C_func(u)\n dC = self.dC_func(u, order=1)\n P = self.P\n numerat...
[ "0.77842075", "0.7665237", "0.7622198", "0.7532601", "0.744385", "0.74368525", "0.7418975", "0.7415534", "0.7381988", "0.7379216", "0.7374011", "0.73667705", "0.7362312", "0.73497534", "0.7292546", "0.72891796", "0.7286683", "0.72824043", "0.72817236", "0.7221008", "0.7217221...
0.70971864
37
Solves the inverse problem
def optimize(self, x0, n_iter = 50): x0 = np.asarray(x0, dtype=np.float32) opt = proximal_alg.ProximalGradSolver(self.gamma, self.alpha, lambda x: self.costFun(x,self.input), lambda x: np.sum(np.abs(x)), lambda x: self.gradFun(x, self.input), proximal_alg.prox_l1_01) result = opt.minimize(x0, n_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse(self):\n return self.solve(Matrix.I(self.nrows))", "def inverse(self):\n self.check_square()\n\n\n N = self.rows\n\n inverse = make_matrix(N, N)\n\n # Solve on a per-column basis using Ax = b formalism\n for j in range(N):\n b = make_matrix(N, 1)\n...
[ "0.78967696", "0.768662", "0.7365531", "0.7246305", "0.7235828", "0.71719176", "0.7033936", "0.69739187", "0.69531745", "0.6916821", "0.6867409", "0.6858064", "0.6847429", "0.68383527", "0.6826942", "0.68186474", "0.6793239", "0.6787958", "0.67806756", "0.67797565", "0.677384...
0.0
-1
given a song and an artist, return a uri to that song in Spotify
def get_spotify_uri(song, artist) -> str: song = re.sub("['|\s]", '%20', song) artist = re.sub("['|\s]", '%20', artist) query = "https://api.spotify.com/v1/search?q=track:{}+artist:{}&type=track&offset=0&limit=20".format( song, artist) response = requests.get(query, headers={ "Content-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spotify_uri(self,song_name, artist):\n query = f\"track:{song_name} artist:{artist}\"\n result = self.sp.search(q=query,limit=1,type='track')\n\n #only use the first song\n if len(result['tracks']['items']) > 0 and result['tracks']['items'][0]['artists'][0]['name'] == artist:\n ...
[ "0.83749163", "0.73485065", "0.7067173", "0.6968523", "0.68646127", "0.66602623", "0.6432892", "0.632123", "0.62950456", "0.61599934", "0.61227757", "0.60696423", "0.606751", "0.6037092", "0.59806633", "0.5964562", "0.5937355", "0.5896755", "0.5891374", "0.5862065", "0.585202...
0.8370671
1
Parse the trace.txt for each iteration, calculate DVFS residency state/frequencies and dump the result in csv and flush the data for next iteration.
def process_iteration_result(self, result, context): self.infile = os.path.join(context.output_directory, 'trace.txt') if os.path.isfile(self.infile): self.logger.debug('Running result_processor "dvfs"') self.outfile = os.path.join(settings.output_directory, 'dvfs.csv') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spectrum_parser():\n from tools import file_importer, file_outporter\n from random import random\n # from math import log10\n \n print(\"this is spectrum parser\")\n \n relPath = \"bob/processed/OST-24-05-2017_combined.csv\"\n outPath = \"bob/processed/OST-24-05-2017_combined_no0_spectrum.csv\"\n inpF...
[ "0.5701113", "0.5631786", "0.5608315", "0.55364835", "0.54893756", "0.5474661", "0.5458289", "0.54296297", "0.54242486", "0.5418956", "0.5402291", "0.5402081", "0.53681874", "0.53458184", "0.5335917", "0.53273916", "0.53256774", "0.5292377", "0.5272078", "0.52447605", "0.5243...
0.6252766
0
Store state, cpu_id for each timestamp from trace.txt and flush all the values for next iterations.
def flush_parse_initialize(self): self.current_cluster = 0 self.current_frequency_of_clusters = [] self.timestamp = [] self.currentstates_of_clusters = [] self.state_time_map = {} self.cpuid_time_map = {} self.cpu_freq_time_spent = {} self.cpuids_of_cluste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_trace(self):\n\n tfname = str(int(time.time())) + \".obd2_reader.trace\"\n self.tf_out = open(tfname, 'a')\n self.RecordTrace = 1\n print \"Recoding trace to:\", tfname", "def update_records(self):\n impl.get_runtime().sync()\n self.clear_frontend()\n s...
[ "0.5487987", "0.5408423", "0.5171812", "0.5149306", "0.5137264", "0.51059526", "0.5044956", "0.50032514", "0.50026226", "0.49774602", "0.4974482", "0.49592197", "0.49436066", "0.49434984", "0.49397263", "0.49303812", "0.4918796", "0.4905129", "0.49025974", "0.48947987", "0.48...
0.64534724
0
Update the cluster frequency and current cluster
def update_cluster_freq(self, state, cpu_id): # For IKS devices cluster changes only possible when # freq changes, for other it is determine by cpu_id. if self.device.scheduler != 'iks': self.current_cluster = self.get_cluster(cpu_id, state) if self.get_state_name(state) == "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateClusterInfo(self):\n self.nPoints = len(self.labels)\n self.n = len(np.unique(self.labels))\n self.centers = [ [0.0 for j in range(3)] for i in range(self.n)]", "def update_cluster(self, cluster, params, *args, **kwargs):\n raise NotImplementedError", "def add_update...
[ "0.70926946", "0.6771409", "0.6328401", "0.63172925", "0.6311955", "0.6175837", "0.60610443", "0.6025551", "0.6025551", "0.6025551", "0.6025551", "0.6025551", "0.6025551", "0.59272796", "0.5923734", "0.5918287", "0.58931756", "0.5863579", "0.5851121", "0.5786061", "0.57628703...
0.7776443
0
Update state of each cores in every cluster. This is done for each timestamp.
def update_state(self, state, cpu_id): # pylint: disable=R0912 POWERDOWN = 2 offline_value = -1 # if state is in unknowstate, then change state of current cpu_id # with cluster freq of current cluster. # if state is in powerstate then change state with that power state. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_cores(self):\n num_cores = 0\n for job in self.job_list:\n num_cores += int(job.get_core_info())\n self.cores_used = num_cores\n return", "def cluster_state(self):\n for ip in set([status.ip for status in self.cluster_status]):\n yield self.node...
[ "0.6780373", "0.62166446", "0.60941476", "0.6064973", "0.58558685", "0.5828296", "0.5750417", "0.5698166", "0.559145", "0.55552137", "0.5542846", "0.55281645", "0.55234426", "0.55096674", "0.5472171", "0.5465183", "0.5462773", "0.5457216", "0.5441518", "0.5434996", "0.5420856...
0.6289924
1
Determine the unique Frequency and state
def unique_freq(self): unique_freq = [] for i in self.timestamp: if self.state_time_map[i] not in unique_freq and self.state_time_map[i] != self.UNKNOWNSTATE: unique_freq.append(self.state_time_map[i]) for i in self.minimum_frequency_cluster: if i not in u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freq():", "def freq(self) -> int:", "def get_frequency(self):\r\n # print '*********in get freq'\r\n self.cntr.run('FREQ 1')\r\n f_0_ = self.cntr.get_measurements(1)\r\n self.f_0 = f_0_[0]\r\n self.cntr.run('FREQ 2')\r\n f_rep_ = self.cntr.get_measurements(1)\r\n ...
[ "0.6752879", "0.65904456", "0.6134581", "0.6110019", "0.60763687", "0.6033786", "0.59830177", "0.59820443", "0.59509546", "0.5918082", "0.5894775", "0.5856046", "0.5792838", "0.5790568", "0.5765567", "0.57557666", "0.5713634", "0.5709292", "0.5696585", "0.5632066", "0.5631045...
0.7312302
0
Normalize the result with total execution time.
def percentage(self): temp = self.cpu_freq_time_spent.copy() for i in self.cpu_freq_time_spent: total = 0 for j in self.cpu_freq_time_spent[i]: total += self.cpu_freq_time_spent[i][j] for j in self.cpu_freq_time_spent[i]: if total != 0:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self):\n total = float(self.totalCount())\n if total != 0:\n self.divideAll(total)", "def mean_run_time(self) -> float:\n return float(self.result_array.sum(axis=0).mean())", "def normalize(self):\n total = self.total()\n for x in self.d:\n ...
[ "0.63369775", "0.62145233", "0.5956927", "0.5839907", "0.5755588", "0.57369196", "0.57129204", "0.57077837", "0.56347495", "0.55887246", "0.5531663", "0.5496262", "0.54943055", "0.54918367", "0.54862154", "0.5455096", "0.54451555", "0.5443062", "0.54175466", "0.53954595", "0....
0.0
-1
generate the '''dvfs.csv''' with the state, frequency and cores
def generate_csv(self, context): # pylint: disable=R0912,R0914 temp = self.percentage() total_state = self.unique_freq() offline_value = -1 ghz_conversion = 1000000 mhz_conversion = 1000 with open(self.outfile, 'a+') as f: writer = csv.writer(f, delimiter=','...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeRawFCD():\n global vehId, vehIdDict\n vehIdDict = {}\n vehId = 0\n day = 0\n\n def getVehId(orgId):\n \"\"\"creates new vehicle id's which consists only numerics\"\"\"\n global vehId, vehIdDict\n value = vehIdDict.get(orgId, vehId)\n if value is vehId:\n ...
[ "0.60827273", "0.5674156", "0.5534153", "0.55247027", "0.5505764", "0.55022764", "0.5441504", "0.53989345", "0.5363615", "0.5295529", "0.5295098", "0.5272777", "0.5267846", "0.5244405", "0.5212482", "0.5211538", "0.5181538", "0.5169765", "0.51641446", "0.5136384", "0.51107246...
0.64446026
0
timer event, that is called at timer timeout
def gameLoop(self): #f = open("C:/Users/Carsten/Desktop/test.txt","a") #f.write(str(QtCore.QThread.currentThreadId()) + " - game on server game loop \n") #f.close() self.calculate_scene() self.send_scene_informations()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_timeout(self):\n pass", "def timer_handler():\r\n \r\n global elapsed_time\r\n elapsed_time += 1", "def timeout(self):\n self.timeout_scan_flag=True\n self.timer.stop()\n self.status_sig.emit([\"Update_Status\",\"Timeout during acquisition\",'log'])\n self.sta...
[ "0.76686984", "0.7486532", "0.7313377", "0.7291277", "0.7181817", "0.69615936", "0.6915906", "0.6821288", "0.68168485", "0.67896986", "0.6762602", "0.6755751", "0.67511904", "0.6695119", "0.66732055", "0.6667869", "0.65977186", "0.6574802", "0.6542744", "0.6540145", "0.653772...
0.0
-1
updating the direction information, revived from the client
def update_player_direction(self,direction): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_direction(self, update_data: dict):\n if self.on_update_direction:\n self.on_update_direction(self, update_data)", "def _directionUpdated(self, *args, **kwargs):\n # Invert direction to manipulate the 'source' pointing to\n # the center of the viewport\n x, y, z ...
[ "0.75249773", "0.6738136", "0.641039", "0.62898123", "0.625545", "0.62209475", "0.6207071", "0.6116505", "0.610406", "0.6084203", "0.6081595", "0.6042297", "0.6000609", "0.59838057", "0.59476405", "0.5923903", "0.59084034", "0.5897013", "0.5897013", "0.5890528", "0.5885742", ...
0.7453741
1
set the inital position of the player, if a player joins the game
def set_player_start_position(self): if self.field_size.x() == 0: return parts = len(self.player_list) y_list = [] for p in range(1,parts+1): y_list.append(self.field_size.y()*p/(parts+1)) for i,p in enumerate(self.player_list): p1 = Qt.QPoint(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_first_player(self):\n if self.player2.won_previous:\n self.current_player = self.player2\n else: self.current_player = self.player1", "def _drive_player_position(self) -> None:\n player = self._player\n if player:\n assert self.node\n assert pl...
[ "0.67391527", "0.6602128", "0.6521799", "0.64235747", "0.6403209", "0.6356068", "0.6108178", "0.6093458", "0.60934067", "0.6075032", "0.60552895", "0.6033364", "0.597676", "0.59481853", "0.58926964", "0.58049136", "0.5797736", "0.5780764", "0.577982", "0.5772904", "0.5766168"...
0.6329127
6
game status is changed from hold to go , on game start
def on_game_go(self): print("============game go") # create dict with players - defines the players that are playing self.on_data_to_all_clients({"game":{"hide_all_dialogs":""}}) for pl in self.player_list: if pl.client not in self.client_pl_dict : self.clien...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_new_gamestate(self):", "def update_state(self):\n if not self.platforms:\n self.state = self.states['Win']\n elif self.player.y > 389:\n self.state = self.states['Lose'] \n else:\n self.state = self.states['Game']", "def update(self):\r\n if ...
[ "0.7380898", "0.7280429", "0.6983609", "0.6962316", "0.6960264", "0.6905935", "0.6833638", "0.677917", "0.6773883", "0.6686437", "0.66210973", "0.66116637", "0.65953153", "0.6575552", "0.65732825", "0.65653706", "0.6519847", "0.64996016", "0.6478882", "0.64316595", "0.6426341...
0.6229725
48
culculats all status changes in the game for one game loop
def calculate_scene(self): if self.is_game_going: for pl in self.player_list: pl.make_step() #obj_list = self.player_list + self.foot_list + self.border_list obj_list = self.player_list + self.grafik_item_list for pl in self.player_list: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\r\n self.player_hand.reset()\r\n self.dealer_hand.reset()\r\n self.player_hand.add(self.deck.deal())\r\n self.player_hand.add(self.deck.deal())\r\n self.dealer_hand.add(self.deck.deal())\r\n self.dealer_hand.add(self.deck.deal())\r\n # Checking for ...
[ "0.61955214", "0.61330974", "0.6041856", "0.6010904", "0.59940135", "0.59497553", "0.5944543", "0.5941799", "0.5920345", "0.59200984", "0.591803", "0.58926064", "0.58895403", "0.58456695", "0.5832112", "0.5823152", "0.5813254", "0.5792448", "0.57885593", "0.5739146", "0.56946...
0.0
-1