query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Load parameters from a 1D vector.
def load_from_vector(self, vector: np.ndarray) -> None: nn.utils.vector_to_parameters(torch.FloatTensor( vector).to(self.device), self.parameters())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadVector(vector):\n expVecCmmd = 'v.out.ascii format=standard input=' + vector\n# JL p = Popen(expVecCmmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)\n p = Popen(expVecCmmd, shell=True, stdin=PIPE, stdout=PIPE,\n stderr=STDOUT, close_fds=False)\n vectorAscii ...
[ "0.68627447", "0.6800378", "0.6086661", "0.6011979", "0.58621246", "0.5789618", "0.5787037", "0.5777748", "0.57738626", "0.5760214", "0.57372475", "0.57234144", "0.56987345", "0.56727606", "0.5651498", "0.56486243", "0.5614828", "0.55927557", "0.5558382", "0.5543643", "0.5532...
0.77678216
0
Convert the parameters to a 1D vector.
def parameters_to_vector(self) -> np.ndarray: return nn.utils.parameters_to_vector(self.parameters()).detach().cpu().numpy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _as_vector(self):\n return np.hstack([self.global_parameters, self.weights])", "def ones():\n return Vec2d(1, 1)", "def AsVector(self) -> ngsolve.la.BaseVector:", "def getParamsToVector(self):\n #vectorise and concat weights arrays\n weights = np.concatenate( ( self.w_ih.flatt...
[ "0.6716756", "0.66873074", "0.6678909", "0.6534435", "0.6527958", "0.64633775", "0.6420395", "0.63429964", "0.62444645", "0.6244374", "0.62292475", "0.62187886", "0.6208448", "0.6178671", "0.6143533", "0.6126629", "0.6072439", "0.6061924", "0.6061584", "0.60416055", "0.603134...
0.7613381
0
(bool) Getter for squash_output.
def squash_output(self) -> bool: return self._squash_output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_output(self):\n status = self.is_running()\n self.write_queued_output()\n return status", "def logging_outputs_can_be_summed() -> bool:\n return False", "def logging_outputs_can_be_summed() -> bool:\n return True", "def logging_outputs_can_be_summed() -> bool:\n ...
[ "0.6013937", "0.5938657", "0.59185934", "0.59185934", "0.59185934", "0.59185934", "0.59185934", "0.59185934", "0.56687444", "0.5649194", "0.56371576", "0.55670184", "0.5496267", "0.5471356", "0.5419418", "0.53497756", "0.53497756", "0.53497756", "0.53497756", "0.53497756", "0...
0.8868124
0
Rescale the action from [low, high] to [1, 1] (no need for symmetric action space)
def scale_action(self, action: np.ndarray) -> np.ndarray: low, high = self.action_space.low, self.action_space.high return 2.0 * ((action - low) / (high - low)) - 1.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rescale_action(self, action: np.ndarray) -> np.ndarray:\n action_rescaled = (\n action * (self.action_max - self.action_min) / 2.0\n + (self.action_max + self.action_min) / 2.0\n )\n return action_rescaled", "def unscale_action(self, scaled_action: np.ndarray) -> np...
[ "0.7782695", "0.7495374", "0.73117286", "0.6958304", "0.68541455", "0.6743386", "0.6743084", "0.670537", "0.6639131", "0.62057394", "0.60836136", "0.5962617", "0.58455205", "0.5799036", "0.5759577", "0.57262087", "0.5722328", "0.57107013", "0.5678667", "0.566894", "0.561874",...
0.78559923
0
Retrieve action distribution given the latent codes.
def _get_action_dist_from_latent(self, latent_pi: torch.Tensor) -> Distribution: mean_actions = self.action_net(latent_pi) if isinstance(self.action_dist, DiagGaussianDistribution): return self.action_dist.proba_distribution(mean_actions, self.log_std) elif isinstance(self.action_di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_distribution(self, state):\n means, stds = self.__call__(state)\n dist = Normal(means, torch.exp(stds))\n\n return dist", "def get_action(self, state, action=None):\n logits = self.actor(state)\n\n # Multinomial Distribution (to sample from action spaces with probabi...
[ "0.5672109", "0.56032616", "0.5453678", "0.54422694", "0.5441499", "0.5301397", "0.5271215", "0.5233836", "0.5218", "0.5205581", "0.51685977", "0.51384455", "0.5113037", "0.5059928", "0.5058348", "0.50524926", "0.5049666", "0.50462973", "0.50311977", "0.50254637", "0.502528",...
0.56543833
1
test to check if we can find a credential entry by account name and display the details of the credential
def test_find_credentials(self): self.new_credentials.save_credentials() new_account= Credentials("Twitter","josephat_otieno", "joseotis45") new_account.save_credentials() found_credential= Credentials.find_credentials("Twitter") self.assertEqual(found_credential.account_name,n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_credential_exist(self):\n self.new_credentials.save_creds()\n account_found = Credentials.search_by_account(\"Instagram\")\n\n self.assertTrue(account_found)", "def credential_exist(cls,name):\n for credential in cls.credential_list:\n if credential.user_name == na...
[ "0.7083544", "0.70249516", "0.699233", "0.6925012", "0.6913137", "0.6849366", "0.6823571", "0.68228126", "0.68161035", "0.6795426", "0.6711052", "0.6668683", "0.6642743", "0.6641219", "0.66098106", "0.6605302", "0.6583325", "0.6567394", "0.65140545", "0.64980423", "0.6476", ...
0.7044037
1
Compute a vector stabilized by an element of the monster Le ``g`` be an element of the monster group of order ``n`` and ``v`` a vector in a represention of the monster. We return the vector ``sum(v gi for i in range(n))`` which is stabilized by ``g``. We always return ``None`` if that sum is 0 or a multiple of the 1 el...
def stabilizer_vector(v, g, n): vg = v.copy() w = v.copy() for i in range(1, n): vg *= g w += vg assert v == vg * g if (w['B'] == 0).all(): return None return w
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def g(s, v):\n\n if len(s) == 0:\n return cost(v_start, v)\n\n k = key(s, v)\n if k not in g_memo:\n min_c = None\n for elem in s:\n # Condition on elem being penultimate\n s_small = s.copy()\n s_small.remove(elem)\n c = g(s_small, elem) + c...
[ "0.5751024", "0.5655445", "0.5556304", "0.553694", "0.55164397", "0.5372963", "0.52559763", "0.5241885", "0.5238846", "0.52004004", "0.5196171", "0.51722324", "0.5170683", "0.5166864", "0.516171", "0.51609993", "0.51607066", "0.5132307", "0.5131845", "0.51243764", "0.51243764...
0.81926763
0
Return ``g1 == g2`` for elements ``g1, g2`` of the monster. If ``mode == 0`` (default) we first try to check equality inside in the subgroup ``N_0`` of the monster, which may be considerbly faster. If ``mode != 0`` or this is not possible we check if ``v g1 g2(1) == v`` holds for the ORDER_VECTOR ``v``. We just check t...
def check_mm_equal(g1, g2, mode = 0): assert isinstance(g1, (MM, MM0)) assert isinstance(g2, (MM, MM0)) g3 = np.zeros(2 * (g1.length + g2.length) + 1, dtype = np.uint32) status = mm_group_words_equ(g1._data, g1.length, g2._data, g2.length, g3) if status < 2: return not status v ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_match(n1, n2):\r\n return n1['name'] == n2['name'] and n1['modes'] == n2['modes']", "def are_same(self, value1, value2):\n (group_1, val_1) = self.get_val_tuple(value1)\n (group_2, val_2) = self.get_val_tuple(value2)\n f_aresame = Or(*[ And(self.X[group_1, val_1, idx], self.X...
[ "0.58660734", "0.5732941", "0.5382623", "0.5361553", "0.5015167", "0.5008704", "0.50012624", "0.49450102", "0.49424455", "0.49338236", "0.49311075", "0.49178842", "0.48852837", "0.48629686", "0.4853434", "0.48532036", "0.48286387", "0.48214853", "0.48145497", "0.48128924", "0...
0.70979625
0
Return order of monster group element ``g``. if ``order(g) < max_order`` return ``order(g)``; else return ``0``. If mode is ``0`` (default) we first check if ``g`` is in the subgroup ``N_0 of`` the monster. If this is the case the we check the order of ``g`` by calculating in ``N_0``. Othewise we compute the minimum ``...
def check_mm_order_old(g, max_order = 119, mode = 0): assert isinstance(g, (MM0, MM)) g.reduce() if mode == 0: n0 = np.zeros(5, dtype = np.uint32) status = mm_group_check_word_n(g._data, g.length, n0) if status == 0: return 1 if status == 1: n1 = np.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_mm_order(g, max_order = 119):\n assert isinstance(g, (MM0, MM))\n g.reduce()\n v = get_order_vector().data\n o = mm_op15_order(g._data, g.length, ORDER_TAGS, v, max_order)\n return chk_qstate12(o)", "def order(self):\n p = self._pants_decomposition\n g = p.genus()\n ...
[ "0.63555944", "0.59763795", "0.58155614", "0.57110953", "0.5698193", "0.5637015", "0.5511451", "0.54993415", "0.53159016", "0.5193683", "0.5191356", "0.50626314", "0.50170135", "0.49995813", "0.49985203", "0.49985203", "0.49899474", "0.497645", "0.49531853", "0.4940482", "0.4...
0.75211066
0
Return order of monster group element ``g``. ``g`` must be an instance of class ``MM``. The function returns the order of ``g`` if ``max_order`` is set to its default value. Computing the order of an element of the monster is time consuming; and in some cases we are interested in small orders only. If ``max_order``is g...
def check_mm_order(g, max_order = 119): assert isinstance(g, (MM0, MM)) g.reduce() v = get_order_vector().data o = mm_op15_order(g._data, g.length, ORDER_TAGS, v, max_order) return chk_qstate12(o)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_mm_order_old(g, max_order = 119, mode = 0):\n assert isinstance(g, (MM0, MM))\n g.reduce()\n if mode == 0:\n n0 = np.zeros(5, dtype = np.uint32)\n status = mm_group_check_word_n(g._data, g.length, n0)\n if status == 0:\n return 1\n if status == 1:\n ...
[ "0.6788255", "0.62596315", "0.57607317", "0.5720373", "0.5720373", "0.5716744", "0.57105136", "0.5613651", "0.5581848", "0.54419535", "0.5384425", "0.53127384", "0.529546", "0.5208584", "0.51713955", "0.51210815", "0.50993526", "0.5033962", "0.49830946", "0.49785888", "0.4948...
0.7287482
0
Return (halved) order of monster group element ``g``. ``g`` must be an instance of class ``MM``. The function returns a pair ``(o, h)`` where ``o`` is the order of ``g``, and ``h = g(o/2)`` for an even ``o``. We put ``h = None`` if ``o`` is odd. Parameter ``max_order`` is as in function ``check_mm_order``.
def check_mm_half_order(g, max_order = 119): assert isinstance(g, (MM0, MM)) g.reduce() h = np.zeros(10, dtype = np.uint32) v = get_order_vector().data o1 = mm_op15_order_Gx0(g._data, g.length, ORDER_TAGS, v, h, max_order) chk_qstate12(o1) if o1 == 0: return 0, None h = h[:o1 & 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_mm_order(g, max_order = 119):\n assert isinstance(g, (MM0, MM))\n g.reduce()\n v = get_order_vector().data\n o = mm_op15_order(g._data, g.length, ORDER_TAGS, v, max_order)\n return chk_qstate12(o)", "def check_mm_order_old(g, max_order = 119, mode = 0):\n assert isinstance(g, (MM0, M...
[ "0.6826018", "0.6368965", "0.53790426", "0.5159738", "0.50342286", "0.4979008", "0.49495527", "0.4845111", "0.4845111", "0.4842105", "0.4834916", "0.4742605", "0.4736852", "0.46922505", "0.46910718", "0.4674844", "0.4672232", "0.4662422", "0.4644789", "0.4639572", "0.46373802...
0.71873015
0
Check if ``g`` is in the subgroup ``G_x0`` of the monster If ``g`` is in the subgroup ``G_x0`` of the monster then the function changes the word representing ``g`` to a (uniquely defined) word in the generators of the subgroup ``G_x0`` and returns ``g``. Otherwise the function does not change ``g`` and returns ``None``...
def check_mm_in_g_x0(g): g1 = np.zeros(10, dtype = np.uint32) v = get_order_vector().data res = chk_qstate12(mm_op15_order_Gx0(g._data, g.length, ORDER_TAGS, v, g1, 1)) #print("RES", hex(res)) if ((res >> 8) != 1): return None length = res & 0xff assert length <= 10 g....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains(self, g):\n if not isinstance(g, FreeGroupElement):\n return False\n elif self != g.group:\n return False\n else:\n return True", "def reduce_mm(g, check = True):\n global reduce_mm_time\n v = get_order_vector().data\n g1 = np.zeros(256,...
[ "0.53967947", "0.52655655", "0.50559324", "0.49038082", "0.47768843", "0.4751469", "0.4742526", "0.4698661", "0.4664318", "0.46331215", "0.4617278", "0.46052814", "0.45890802", "0.45713642", "0.45630887", "0.45620078", "0.45542562", "0.4550955", "0.4543314", "0.4526072", "0.4...
0.60445833
0
The fastest reduction procedure for a monster element ``g``
def reduce_mm(g, check = True): global reduce_mm_time v = get_order_vector().data g1 = np.zeros(256, dtype = np.uint32) t_start = time.perf_counter() res = mm_op15_reduce_M(g._data, g.length, ORDER_TAGS, v, g1) reduce_mm_time = time.perf_counter() - t_start if (res < 0): err = "Redu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduced(f, G):\n lev, dom, per, f, G = f.unify(G)\n return per(dmp_reduced(f, G, lev, dom))", "def rem(f, g):\n lev, dom, per, F, G = f.unify(g)\n return per(dmp_rem(F, G, lev, dom))", "def alg(c):\n return c[0]*G[0] + c[1]*G[1] + c[2]*G[2]", "def g(s, v):\n\n if len(s) ==...
[ "0.63692796", "0.5959349", "0.5818378", "0.5749958", "0.5717874", "0.5700757", "0.55645967", "0.5555263", "0.5550128", "0.553642", "0.55166954", "0.5507713", "0.54878324", "0.54736197", "0.54662114", "0.5439723", "0.5397746", "0.5393919", "0.53931504", "0.53476936", "0.534479...
0.731899
0
increment the count of the attacks / messages about some anomolous packet
def incr_no_of_attacks(self): self.__anom += 1 self.__anom_lbl.setText(str(self.__anom))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def touch_packet (self, byte_count, now=None):\n if now is None: now = time.time()\n self.byte_count += byte_count\n self.packet_count += 1\n self.last_touched = now", "def increment_etherscan_calls():\n _increment_counter(\"etherscan_calls\")", "def add_count(self):\n self.count += 1", ...
[ "0.66043764", "0.6491657", "0.63604474", "0.63020444", "0.6297644", "0.62805796", "0.6262084", "0.62166846", "0.6192047", "0.6117013", "0.60519814", "0.6020894", "0.60118794", "0.595661", "0.5928834", "0.58992386", "0.58992386", "0.58837086", "0.5869176", "0.5823949", "0.5822...
0.76744694
0
set an icon, add a menu and add actions to the menu
def set_up_icon(self): self.__menu = QMenu() self.__show = QAction("Show") self.__quit = QAction("Quit") # signals --> slots self.__show.triggered.connect(self.show_app_slot) self.__quit.triggered.connect(self.close_app_slot) self.__menu.addActions([self.__show, self.__quit]) self.setIcon(QIcon('app.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_menu(menu_name, parent_menu=None, tear_off=True, icon='', **kwargs):\n\n pass", "def _addMenu(self):\n self.action = QAction(QIcon(), 'WakaTime', self)\n self.action.triggered.connect(self._promptForApiKey)\n fileMenu = e5App().getObject('UserInterface').getMenu('file')\n f...
[ "0.7478671", "0.7178195", "0.711998", "0.70816773", "0.6963166", "0.6910467", "0.6882156", "0.6874211", "0.6860417", "0.68523103", "0.6832403", "0.6815139", "0.6744745", "0.67242354", "0.6707614", "0.67005914", "0.6696604", "0.6676635", "0.6670182", "0.66640955", "0.66502184"...
0.7582884
0
set mac address at (row, 1)
def set_mac_at(self, row, mac): self.__hh_table.item(row, 1).setText(mac)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_macaddr(self):\n if not self.macaddr:\n return\n try:\n cmd = [rcEnv.syspaths.nsenter, \"--net=\"+self.netns, \"ip\", \"link\", \"set\", self.final_guest_dev, \"address\", self.macaddr]\n ret, out, err = self.vcall(cmd)\n except ex.excError:\n ...
[ "0.6857622", "0.65099883", "0.65041757", "0.63588583", "0.6256582", "0.6164309", "0.6143647", "0.6119342", "0.6042654", "0.60135406", "0.59927195", "0.59927195", "0.5981977", "0.59596914", "0.5922506", "0.5915336", "0.59116685", "0.58847374", "0.5857707", "0.5847008", "0.5845...
0.81970847
0
add mac address to black list
def add_to_blacklist(self): # get mac row = self.__hh_table.currentRow() mac = self.__hh_table.item(row, 1).text() if mac == 'unknown' or mac == 'resolving ...': qmb = QMessageBox(self) qmb.setText('Cannot add machine to black list. Could not resolve MAC address') qmb.setWindowTitle('Snort Log Serv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_colons_to_mac(self, mac_addr):\n\t\ts = list()\n\t\tfor i in range(12/2): # mac_addr should always be 12 chars, we work in groups of 2 chars\n\t\t\ts.append(mac_addr[i*2:i*2+2])\n\t\tr = \":\".join(s)\n\t\treturn r", "def _mac_addr(address):\n return ':'.join('%02x' % ord(b) for b in address)", "de...
[ "0.67951745", "0.62601876", "0.61818695", "0.60890687", "0.60736597", "0.59309953", "0.59309953", "0.59309953", "0.59309953", "0.5898476", "0.58085144", "0.5786589", "0.5780941", "0.5775045", "0.5751589", "0.5719438", "0.57027525", "0.56771636", "0.5665284", "0.5651029", "0.5...
0.7359528
0
Create and an icon to the system tray
def create_system_tray_icon(self): self.__sys_tray_icon = SystemTrayIcon() self.__sys_tray_icon.setVisible(False) self.__sys_tray_icon.show_app.connect(self.show) self.__sys_tray_icon.close_app.connect(self.exit_app)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tray_icon(self):\n tray_icon = gtk.StatusIcon()\n tray_icon.set_from_file(AFM_LOGO_PATH)\n tray_icon.connect('popup-menu', self.popup_menu)\n tray_icon.set_tooltip('Audio Failure Monitor')\n tray_icon.set_visible(True)\n return tray_icon", "def create_tray_ico...
[ "0.8309896", "0.8097276", "0.7896472", "0.7215221", "0.698861", "0.67025447", "0.6636753", "0.659348", "0.6527294", "0.6511002", "0.64956844", "0.64731103", "0.64688605", "0.6393258", "0.6253968", "0.6249742", "0.61881125", "0.6185548", "0.6182874", "0.6161", "0.61563975", ...
0.8326891
0
create a worker thread to handle the Ssh connection
def start_ssh_client_worker(self): self.__ssh_client_worker = Util.SshClientWorker() self.__ssh_client_worker.finished.connect(self.__ssh_client_worker.deleteLater) self.__ssh_client_worker.finished_closing_ssh_connection.connect( self.__ssh_client_worker.quit) self.__ssh_client_worker.finished_connecting_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def launcher(i,q,cmd):\n while True:\n #grabs ip,cmd from queue\n ip = q.get()\n print \"Thread %s: Running %s to %s\" % (i,cmd,ip)\n host = \"root@%s\"%ip\n subprocess.call([\"ssh\", host, cmd])\n q.task_done()", "def run(self):\n server = TCPServer((self.host...
[ "0.6207313", "0.58948535", "0.58537084", "0.58166796", "0.5800138", "0.5789499", "0.56956977", "0.5682695", "0.56723213", "0.56521016", "0.5648036", "0.55986714", "0.55911905", "0.552375", "0.55177003", "0.5516853", "0.55010027", "0.54868996", "0.54796356", "0.54688513", "0.5...
0.6497826
0
generate a queue of commands expected to be executed, with regard to action to be
def get_cmds_queue(self): return Queue()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\tnum_commands = raw_input() # Taking user's input for number of commands\n\tcommand_index = 0\n\tqueue = [] # Initializing the queue\n\tqueue_printed = [] # Initializing the queue list to be printed\n\twhile command_index < int(num_commands):\n\t\tx = raw_input()\n\t\tif int(x[0]) == 1:\n\t\t\ttry:\n...
[ "0.6603627", "0.65506524", "0.65000254", "0.6496127", "0.64592814", "0.63077897", "0.6274599", "0.61914504", "0.6187893", "0.6119096", "0.6104885", "0.6019012", "0.60104334", "0.59989965", "0.5988611", "0.5975492", "0.5950661", "0.59489226", "0.59210247", "0.58903784", "0.588...
0.6812674
0
return the direction vector (p2p1)/|p2p1| as a sympy matrix
def dirVector(self,p1,p2): v=p2-p1 l=v.Length return self.toMatrix(v)/l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ps2D2psxhat(ps2Di):\n\t\t\tpsrelproj3D = np.array([ps2Di[0], ps2Di[1], 0], float)\n\t\t\tpsrel = np.dot(psbasis, psrelproj3D)\n\t\t\tps = psrel + reqv\n\t\t\t#ps = np.array([ps3D[0], 0, ps3D[1], ps3D[2]], float)\n\t\t\treturn ps", "def perp_2d_vec(vec):\n return normalized(np.dot(R90, vec))", "def dir_v...
[ "0.5900738", "0.58821523", "0.5821003", "0.56920874", "0.5684477", "0.56735724", "0.5563094", "0.5541476", "0.55197746", "0.5493376", "0.5464507", "0.54622483", "0.5433674", "0.54318553", "0.5409925", "0.5403104", "0.5388749", "0.53831756", "0.533579", "0.5327513", "0.5327485...
0.69145805
0
Return string representation of the order object
def __str__(self): return f'{self.order_id}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self.order_id", "def __str__(self):\n return f'Order: {self.size} {self.drink_name} from {self.shop}\\n' \\\n f'Details: {self.details}\\n' \\\n f'Location: {self.location}\\n' \\\n f'Contact Info: {self.customer_name}, {self.cus...
[ "0.722646", "0.72201663", "0.7207535", "0.7179147", "0.71155256", "0.70440394", "0.70284915", "0.6983926", "0.6921129", "0.68726534", "0.6865996", "0.6814752", "0.6796412", "0.6796412", "0.6796412", "0.6796412", "0.6796412", "0.6796412", "0.6796412", "0.6796412", "0.6796412",...
0.73897535
0
Run the automation with the given id once or in a loop, looping the optionally specified number of times, otherwise forever.
def run_automation(self, automation_id: int, loop=True, loop_count=None) -> None: self._load_automation(automation_id) self.maple_logger.info("Waiting for start key ({0}) to be pressed.", self.START_KEY) self._wait_for_automation_start_key() self.maple_logger.info( "Starti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loop_test(loop_wait=0, loop_times=sys.maxsize):\n looped_times = 0\n\n while looped_times < loop_times:\n # run an API test\n test_result, elapsed_time = test_mock_service()\n # put results into a queue for statistics\n queue_results.put([\"test_mock_service\", test_result, el...
[ "0.58454996", "0.57865703", "0.5773958", "0.5746551", "0.5659389", "0.5635139", "0.563125", "0.5618772", "0.55730236", "0.556472", "0.5539207", "0.5534097", "0.5485227", "0.54683906", "0.5465438", "0.5457316", "0.5451016", "0.5443487", "0.5405984", "0.5403265", "0.5395408", ...
0.6311149
0
Load an automation based on the automation_id.
def _load_automation(self, automation_id: int) -> None: self.maple_logger.info("Loading automation with ID {0}.", automation_id) # TODO load the automation dynamically based on automation_id hand_automation = HandAutomation123() self.loaded_automation_sequence = hand_automation.get_aut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(cls, id):\n key = cls.get_key_prefix()+\"#\"+str(id)\n src = dal_get(key)\n logger.debug( \"LOAD %s %s %s\", str(key), str(id), str(src))\n if src == None:\n raise cls.NotExist(\"No instance could be found with ID: \"+str(id))\n result = dal_retrieve(src)\n ...
[ "0.576046", "0.55753064", "0.5465543", "0.52129424", "0.5202951", "0.51653427", "0.5115566", "0.5057078", "0.4987835", "0.49572968", "0.49255738", "0.4915747", "0.48934153", "0.48876587", "0.48844513", "0.48182642", "0.47554263", "0.47364417", "0.4713787", "0.47069252", "0.46...
0.82048476
0
Run the next loop of the loaded automation sequence .. only running the subsequent step if automation is not paused
def _run_next_automation_sequence(self) -> None: sequence_iterator = iter(self.loaded_automation_sequence) while True: # sleep for a bit if we are paused to save resources if self.paused: time.sleep(0.1) else: sequence_finished = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _step(self):\n title()\n self.runCount = 1\n self.experiment.pause = False\n self._runExperiment()\n self.pause = True", "def next_step(self):\n self.proceed()\n self.execute_current()", "def pause(self):\n if self._pause:\n self._pause = False\n else:\...
[ "0.75074595", "0.68645364", "0.6763919", "0.66864413", "0.66625315", "0.6617415", "0.6400414", "0.63589275", "0.62988394", "0.62594855", "0.62507814", "0.62168914", "0.61997324", "0.6194811", "0.6181751", "0.6181468", "0.6173686", "0.61473095", "0.61212695", "0.6117688", "0.6...
0.8462751
0
Save a set of input examples to a file
def save_examples(examples: List['InputExample'], path: str) -> None: with open(path, 'wb') as fh: pickle.dump(examples, fh)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_out_examples(examples, path):\n\n writer = tf.io.TFRecordWriter(path)\n for example in examples:\n writer.write(example.SerializeToString())", "def write_example_to_file(examples,\n tokenizer,\n max_seq_length,\n output_fil...
[ "0.7591175", "0.6569832", "0.64277864", "0.6372379", "0.63513345", "0.6307391", "0.62734795", "0.6265631", "0.6224683", "0.62139183", "0.6207594", "0.6173282", "0.61520165", "0.61112654", "0.610657", "0.60863966", "0.60799277", "0.60578465", "0.6049085", "0.6044998", "0.60424...
0.77996653
0
Save an array of logits to a file
def save_logits(path: str, logits: np.ndarray): with open(path, 'w') as fh: for example_logits in logits: fh.write(' '.join(str(logit) for logit in example_logits) + '\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save2file(lis, path):\r\n np.save(path, np.array(lis))", "def save(self, path=None):\n data = self._collect_data()\n\n name = np.random.choice(['a', 'b', 'c', 'd', 'e', 'f']+list(map(str, range(0, 10))), size=8)\n if path is None:\n path = './logs/'+\"\".join(name)+'_'\n ...
[ "0.67471564", "0.66612536", "0.64886576", "0.64275914", "0.64046544", "0.640443", "0.6345724", "0.6326013", "0.62661725", "0.62247336", "0.62094694", "0.6173525", "0.6117285", "0.60993", "0.6094771", "0.60923433", "0.6085981", "0.6084124", "0.60823494", "0.6064324", "0.605743...
0.8307946
0
Trim a sequence of input ids by removing all padding tokens and keeping at most a specific number of mask tokens.
def trim_input_ids(input_ids: torch.tensor, pad_token_id, mask_token_id, num_masks: int): assert input_ids.shape[0] == 1 input_ids_without_pad = [x for x in input_ids[0] if x != pad_token_id] trimmed_input_ids = [] mask_count = 0 for input_id in input_ids_without_pad: if input_id == mask_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim_batch(\n input_ids,\n pad_token_id,\n attention_mask=None,\n):\n keep_column_mask = input_ids.ne(pad_token_id).any(dim=0)\n if attention_mask is None:\n return input_ids[:, keep_column_mask]\n else:\n return (input_ids[:, keep_column_mask], attention_mask[:, keep_column_mas...
[ "0.7205048", "0.6221906", "0.6162543", "0.61539996", "0.5985549", "0.5895688", "0.58152986", "0.5788217", "0.57238835", "0.5697447", "0.5696224", "0.5688048", "0.56562954", "0.5617717", "0.5612038", "0.5605834", "0.5539708", "0.5526343", "0.54298687", "0.542843", "0.53915924"...
0.82930446
0
duplicate samples. train_Y has N 1,0 tuples. dup_target_y in [0,N). multiplier must be >=2. append to end of input arrays
def duplicate_train_samples(train_X, train_Y, dup_target_y, multiplier=2): target_y = train_Y[:,dup_target_y] #print(target_y) mask = ma.make_mask(target_y) additional_X = train_X[mask] #print(additional_X) additional_Y = train_Y[mask] #print(additional_Y) for i in range(1, multiplier): train_X = np.conca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spy_train_dataset():\n train_p = np.load(\"./processed_data/train/raw/train_p.npy\")\n train_u = np.load(\"./processed_data/train/raw/train_u.npy\")\n print(train_p.shape)\n print(train_u.shape)\n\n np.random.shuffle(train_p)\n spy = train_p[: int(_spy_rate * train_p.shape[0]), :]\n spy[:,...
[ "0.56895626", "0.559557", "0.54956675", "0.54325247", "0.5429865", "0.5393505", "0.5360578", "0.5348415", "0.5341492", "0.5333943", "0.52978426", "0.52923024", "0.5286079", "0.5257948", "0.5256797", "0.525413", "0.52424103", "0.5186221", "0.51842016", "0.5183713", "0.51740587...
0.88116354
0
take two feature dictionaries d1 and d2 as inputs, and it should compute and return their log similarity score
def compare_dictionaries(d1, d2): score = 0 gef = 0 for z in d1: gef += d1[z] total = gef for x in d2: if x in d1: score += math.log(d1[x] / total) * d2[x] else: score += math.log(0.5/total) * d2[x] return score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_dictionaries(d1, d2):\n score = 0\n total = 0\n for key in d1:\n total += d1[key]\n for item in d2:\n if item in d1:\n score += d2[item] * math.log(d1[item]/total)\n else:\n score += d2[item] * math.log(0.5/total)\n return score", "def compare_...
[ "0.7357167", "0.73444015", "0.6847985", "0.68025696", "0.67945343", "0.67909455", "0.6782189", "0.6665095", "0.6627431", "0.6623234", "0.6565889", "0.65605026", "0.6474892", "0.6463154", "0.64380956", "0.6423472", "0.6414897", "0.64102346", "0.640842", "0.63974315", "0.635844...
0.75381964
0
accepts a string as a parameter. The function should then return the stem of s. The stem of a word is the root part of the word, which excludes any prefixes and suffixes.
def stem(s): if len(s) < 5 : return s if s[-3:] == 'ing': if s[-4] == s[-5]: if s[-4] == 'l' : s = s[:-3] s = s[:-4] else: s = s[:-3] elif s[-2:] == 'er': s = s[:-2] elif s[-1] == 's' : s = s[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stemm_word(word):\n return stem(word)", "def stem(s):\n short_words = {'is': 'is', 'the': 'the','he': 'he', 'she': 'she', \\\n 'my': 'my', }\n if s in short_words:\n return s\n if s[-1] == 's':\n s = s[:-1]\n special_cases = {'children': 'child', 'doing': 'do', ...
[ "0.82995576", "0.8035064", "0.79727995", "0.791844", "0.791844", "0.7818235", "0.7671933", "0.76379144", "0.7616681", "0.7527591", "0.7448246", "0.74252564", "0.72972834", "0.72252023", "0.6999601", "0.6984558", "0.69662714", "0.6965841", "0.69595385", "0.6954107", "0.6952668...
0.8085931
1
Set the user ID for later use in logging.
def set_user_id(uid): local.user_id = uid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_userId(self, userId):\n self.authentication.userId = userId", "def id_user(self, id_user):\n\n self._id_user = id_user", "def user(self, user):\n self.user_id = user.get_id()", "def user_id(self, user_id):\n\n self._user_id = user_id", "def user_id(self, user_id):\n\n ...
[ "0.8000985", "0.7696615", "0.7558133", "0.7510105", "0.7510105", "0.7510105", "0.7510105", "0.7510105", "0.7510105", "0.7510105", "0.7510105", "0.7510105", "0.7510105", "0.7510105", "0.7510105", "0.7510105", "0.7510105", "0.7469039", "0.7024879", "0.6970846", "0.6925725", "...
0.8480165
0
Decorator returning a Producer instance from a generating function. Producers are multitransversal iterables (not iterators). Generators are 'oneshot' transversal objects. Therefore to support multiple data transversals, Producers can be built from generating functions. This decorater converts any generating function t...
def as_producer(func): # only decorate generator functions if not inspect.isgeneratorfunction(func): msg = 'as_producer requires a generating function not {}' raise TypeError(msg.format(type(func))) @functools.wraps(func) def decorated(pro, *args, **kwargs): """Returns a produc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decorated(pro, *args, **kwargs):\n\n if not isinstance(pro, Producer):\n msg = (\"First positional argument of decorated function\"\n \" must be of type {} not {}\")\n msg.format('Producer', type(pro))\n\n genfunc = functools.partial(func, pro, *args, **kwa...
[ "0.7521282", "0.6512116", "0.64713603", "0.6440815", "0.6210608", "0.59300536", "0.5877317", "0.5844914", "0.57791686", "0.5670909", "0.56454545", "0.5629814", "0.5566036", "0.5558922", "0.5485034", "0.54797935", "0.5458799", "0.5443321", "0.53991795", "0.5381145", "0.5375255...
0.83804554
0
Pads the edges of a producer along its axis.
def pad_producer(pro, pad, value): #convert int pad to seq. of pads & place along axis of pads pads = [pad, pad] if isinstance(pad, int) else pad def genfunc(): left_shape, right_shape = list(pro.shape), list(pro.shape) left_shape[pro.axis] = pads[0] right_shape[pro.axis] = pads[1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_edges(self, pad):\n weights=[]\n for dim, xy in zip([0, 1], [self.x, self.y]):\n xy0 = np.mean(xy)\n W = xy[-1]-xy[0]\n dist = np.abs(xy-xy0)\n wt=np.ones_like(dist)\n wt[ dist >= W/2 - pad] = 0\n weights += [wt]\n self....
[ "0.60306835", "0.5613865", "0.5581342", "0.5507449", "0.5410015", "0.5379686", "0.52002054", "0.51807445", "0.51807445", "0.51807445", "0.51533556", "0.51392597", "0.5128504", "0.51269317", "0.5001935", "0.4997942", "0.4984185", "0.49738342", "0.49708384", "0.49404427", "0.49...
0.6184286
0
Returns the chunksize of this Producer.
def chunksize(self): return self._chunksize
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunksize(self):\n\n return self.data.chunksize", "def chunk_size(self):\r\n return int(self.frame_length * self.sample_rate)", "def get_num_chunks(self) -> int:", "def nbytes(self):\n # type: () -> int\n size = 0\n for chunk in self.data.chunks:\n for buf in...
[ "0.84528935", "0.7736382", "0.71479833", "0.7118443", "0.7065115", "0.70083916", "0.6999574", "0.6966646", "0.6950854", "0.6950854", "0.6942866", "0.6918867", "0.6918867", "0.6896651", "0.68951285", "0.68949974", "0.688744", "0.68751526", "0.6850941", "0.6850941", "0.6850941"...
0.86696684
0
Sets this Producer's chunksize attr ensuring it is int type.
def chunksize(self, value): self._chunksize = int(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunksize(self, value):\n\n self.data.chunksize = int(value)\n self.mask.chunksize = int(value)", "def setsize(self, size):\n self.__size = size", "def batch_size(self, batch_size: ConfigNodePropertyInteger):\n\n self._batch_size = batch_size", "def size(self, size: int):\n\n ...
[ "0.7461481", "0.66601086", "0.6610058", "0.6489596", "0.6484879", "0.6470784", "0.64263624", "0.64135087", "0.64118916", "0.64118916", "0.64118916", "0.64118916", "0.64097124", "0.6296053", "0.629147", "0.6277643", "0.6220337", "0.6220337", "0.6220337", "0.62055194", "0.62002...
0.77982473
0
Builds a tuple of slice objs. between start and stop indexes.
def _slice(self, start, stop, step=None): slices = [slice(None)] * self.data.ndim slices[self.axis] = slice(start, stop, step) return tuple(slices)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_slices(start: Sequence[int], stop: Sequence[int] = None) -> Tuple[slice, ...]:\n if stop is not None:\n check_len(start, stop)\n return tuple(map(slice, start, stop))\n\n return tuple(map(slice, start))", "def create_slice(*, stop : Optional[int] = None, start : Optional[int] = None...
[ "0.8348682", "0.7186348", "0.6997662", "0.6953549", "0.6874282", "0.6774014", "0.6744734", "0.6645162", "0.66127825", "0.6552883", "0.6535076", "0.6521721", "0.6510662", "0.6390565", "0.63468206", "0.6332942", "0.6319138", "0.63171333", "0.6288672", "0.6278372", "0.6232683", ...
0.7830859
1
Returns an iterator yielding ndarrays of chunksize along axis. Since the shape of the arrays yielded from the generating function (i.e. data) may be very small compared to chunksize, we store generated arrays to a temporary array to reduce the number of fifo 'put' calls (see note in FIFOArray.put).
def __iter__(self): # collector will fetch chunksize array for each 'get' call collector = FIFOArray(self.chunksize, self.axis) # make tmp array to hold generated subarrs tmp = [] tmp_size = 0 for subarr in self.data(**self.kwargs): tmp.append(subarr) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterate_array_in_chunks(arr, size: int):\n for i in range(0, len(arr), size):\n yield arr[i:i+size]", "def chunks(array, size: int):\r\n for i in range(0, len(array), size):\r\n yield array[i:i + size]", "def yield_chunks(arr, chunk_size):\r\n larr = len(arr)\r\n if larr < chunk_s...
[ "0.6992089", "0.6900754", "0.6792408", "0.6608984", "0.65759915", "0.6569415", "0.6560407", "0.655808", "0.65408766", "0.65207744", "0.6476222", "0.6457231", "0.643329", "0.6414242", "0.63855255", "0.6358552", "0.6290567", "0.6253341", "0.6250967", "0.62419", "0.62262493", ...
0.7121666
0
Returns the chunksize of this MaskedProducer.
def chunksize(self): return self.data.chunksize
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunksize(self):\n\n return self._chunksize", "def chunk_size(self):\r\n return int(self.frame_length * self.sample_rate)", "def get_num_chunks(self) -> int:", "def get_per_slot_batch_size(self) -> int:\n return self._per_slot_batch_size", "def block_size(self):\n\n return s...
[ "0.7815233", "0.7146796", "0.6651533", "0.6535611", "0.64883393", "0.64856946", "0.6443143", "0.64038014", "0.639811", "0.63756645", "0.63602734", "0.6345641", "0.6321593", "0.63184077", "0.6296267", "0.6290503", "0.62897676", "0.6281717", "0.6273625", "0.6269459", "0.6268879...
0.7660569
1
On change, set chunksize for both producer and mask.
def chunksize(self, value): self.data.chunksize = int(value) self.mask.chunksize = int(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunksize(self, value):\n\n self._chunksize = int(value)", "def set_batch_size(self, batch_size):\n final_sz = self.full_dataset_size % batch_size\n if not self.final_batch:\n self.dataset_size = self.full_dataset_size - final_sz\n self.enqueuer.set_num_elements(self.dataset_size)\n s...
[ "0.6508122", "0.6109509", "0.61027354", "0.61018455", "0.6008631", "0.5971439", "0.5961792", "0.5941684", "0.5937425", "0.593576", "0.59317696", "0.5931757", "0.5913386", "0.5897878", "0.5884504", "0.5876819", "0.58655703", "0.5854518", "0.5808106", "0.5783494", "0.5775254", ...
0.75351876
0
Generate parameters list of the trainings Gets the parameters of SupervisedTrain Add to these parameters the max miss parameter
def prms(widget: QWidget) -> List: parameters = SupervisedTrain.prms(widget) parameters.append( StdPrm("max miss", "", False, StdPrmInput.spinBox, [10], widget.spinValueChanged, [])) return parameters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _training_params(self):\n if isinstance(\n self.lyapunov_hybrid_system.system,\n feedback_system.FeedbackSystem) and self.search_controller:\n # For a feedback system, we train both the Lyapunov network\n # parameters and the controller network paramet...
[ "0.6879973", "0.6593617", "0.6440566", "0.6438242", "0.6429262", "0.6302979", "0.6297", "0.6275665", "0.62493", "0.6243894", "0.6188239", "0.6158141", "0.6154223", "0.61486363", "0.61437565", "0.61369544", "0.6127337", "0.6119522", "0.6119522", "0.6106424", "0.61014485", "0...
0.66668475
1
Scores the result of a step performed by the algorithm Compare the StepResults and the ResultPresentation and get the number of wrong values Get the percent of these values
def score(self) -> Tuple[bool, str, float]: num_miss = np.sum(self.algorithm_data[:,FieldRolls.StepResult] != self.algorithm_data[:,FieldRolls.ResultPresentation]) num_miss_perc = num_miss * 100/self.algorithm_data.shape[0] return True, "", num_miss_perc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calculate_result(found, total):\n return (found * 100) / total", "def get_percentage_false_class(arr_of_results):\n\n count_success = np.zeros_like(arr_of_results[:,0], dtype=float)\n count_correct_prediction = 0\n\n for i in range(len(arr_of_results[0])):\n use = True\n for result...
[ "0.6737546", "0.66882837", "0.6687243", "0.66701436", "0.65690434", "0.6531956", "0.6519872", "0.65000796", "0.64884126", "0.64864445", "0.6438912", "0.637973", "0.6369035", "0.63494223", "0.63448805", "0.63141024", "0.6309508", "0.6303989", "0.6290383", "0.6290383", "0.62712...
0.76860714
0
Check if the algorithm study ended Decide if the study finished The study finished if the score (which is the percent of missed) is less then the the algorithm parameter
def finished(self, score) -> Tuple[bool, str, bool]: finish_level = self.parameters["max miss"]["value"] return True, "", score < finish_level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(self, algorithm_data: AlgorithmData) -> Tuple[bool, str, bool]:\n\n num_miss = np.sum(self.algorithm_data[:,FieldRolls.StepResult] != self.algorithm_data[:,FieldRolls.ResultPresentation])\n num_miss_perc = num_miss * 100/algorithm_data.shape[0]\n finish_level = self.parameters[\"max ...
[ "0.6639693", "0.64884424", "0.63174707", "0.63174707", "0.6185332", "0.6169295", "0.6128907", "0.6115886", "0.6103106", "0.60640895", "0.6062467", "0.6035699", "0.60353684", "0.6015644", "0.6015644", "0.6015644", "0.59749675", "0.5971769", "0.591901", "0.59040534", "0.5870415...
0.64909506
1
Registers an icon name from files found in a directory
def add_icon_name_from_directory(self, icon_name, directory): for size in self._sizes: try: sizedir = '%dx%d' % (size, size) except TypeError: sizedir = size filepath = os.path.join(directory, sizedir, "apps", icon_name) files = gl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def icons_from_folder(folder, resolution=None, col=None,\n cmap=None, border_type=None, border_width=2,\n make_square=False, circ_cut=None):\n icons = dict()\n for filename in os.listdir(folder):\n try:\n im = PIL.Image.open(filename)\n i...
[ "0.67232287", "0.64960545", "0.6486575", "0.64738697", "0.6212737", "0.606703", "0.6065435", "0.5994834", "0.5856067", "0.58510303", "0.5780598", "0.5773923", "0.57083046", "0.5676852", "0.5641354", "0.5638804", "0.5635245", "0.56261337", "0.56245834", "0.55761015", "0.556125...
0.6979242
0
Registers an icon name from a filename
def add_icon_name_from_file(self, icon_name, filename, size=None): try:# TODO: Make svg actually recognized pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename) self.add_icon_name_from_pixbuf(icon_name, pixbuf, size) except Exception as e: print "exception in icons.py Ic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processIconFilename(self):\n\t\tself.iconFilename = self._getVal(64, 2)", "def createIcon(self, name):\n path = 'data/images/' + name\n icon = QtGui.QIcon(path)\n return icon", "def add_icon_name_from_pixbuf(self, icon_name, pixbuf, size=None):\n if size is None:\n si...
[ "0.7087807", "0.7019064", "0.6796056", "0.6762957", "0.6673365", "0.64389974", "0.63887507", "0.6380574", "0.63078433", "0.62925017", "0.6163503", "0.6148544", "0.6142611", "0.6131108", "0.6118983", "0.60536945", "0.60254043", "0.60043263", "0.59811115", "0.59670377", "0.5960...
0.7602962
0
Registers an icon name from a pixbuf
def add_icon_name_from_pixbuf(self, icon_name, pixbuf, size=None): if size is None: size = pixbuf.get_width() Gtk.IconTheme.add_builtin_icon(icon_name, size, pixbuf) # print "added ",icon_name, size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seticon(iconname):\n # from an anonymous commentator to pygame docs site.\n icon=pygame.Surface((32,32))\n icon.set_colorkey((0,0,0))#and call that color transparant\n rawicon=pygame.image.load(iconname)#must be 32x32, black is transparant\n for i in range(0,32):\n for j in range(0,32):\n...
[ "0.67483103", "0.6662172", "0.6467198", "0.6317078", "0.62178373", "0.60687816", "0.60610825", "0.6006869", "0.59512913", "0.59329873", "0.58819515", "0.5825886", "0.5823996", "0.5821755", "0.5814989", "0.57939005", "0.57903796", "0.5775488", "0.5767066", "0.5683963", "0.5673...
0.741623
0
Checks for new updates every 8 hours and when the bot starts
async def check(): while True: if rss.check_new(): item = rss.most_recent() queue = format_message.format_notes(item) for message in queue: await client.send_message(client.get_channel("350634825516056577"), message) await asyncio.sleep(2880...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_updates(self):\n try:\n if not common.latest_version(version):\n self.update_notify()\n except:\n self.neterror()", "def checkForUpdates(self):\r\n url = self.config.get_conf(\"Client\", \"versions-url\")\r\n try:\r\n self._log...
[ "0.6549399", "0.6500539", "0.64526516", "0.64487964", "0.6439174", "0.64032525", "0.6375948", "0.6203274", "0.61837256", "0.61709285", "0.61611974", "0.61485326", "0.60799235", "0.6073149", "0.6072334", "0.6054374", "0.60537314", "0.60403407", "0.5969", "0.59635437", "0.59622...
0.65638065
0
Retrieves a router by any of its subnet address
def _get_router_by_ip_address(self, subnet_cidr): router_id = None subnets = self.neutron.list_subnets(cidr=subnet_cidr, tenant_id=self.project_id) try: subnet_id = subnets['subnets'][0]['id'] except (IndexError, KeyError) as e: msg = "No subnet found with cidr a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_routers(self, location=None, mask=None):\n\n if mask is None:\n mask = \"\"\"\n topLevelLocation\n \"\"\"\n object_filter = ''\n if location:\n object_filter = {\n 'routers': {\n 'topLevelLocation': {...
[ "0.6096565", "0.6082762", "0.5969989", "0.5965186", "0.5939976", "0.5926655", "0.5905129", "0.58993673", "0.57754797", "0.57034135", "0.5657076", "0.5650008", "0.5634346", "0.56162834", "0.55780625", "0.55462813", "0.55299735", "0.54960513", "0.5494444", "0.54929477", "0.5478...
0.65942454
0
Retrieves Floating IP router network port ID
def get_fip_router_interface(self, net_name): nets = self.neutron.list_networks(tenant_id=self.project_id, name=net_name) try: net_id = nets['networks'][0]['id'] except (IndexError, KeyError) as e: msg = "No network found with name %s!" % net_name logger.error...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_nport(self):\n return self.__nport", "def remote_getPort(self):\r\n return int(self._fwdPort)", "def Port(self) -> int:", "def _get_port(self):\n return self.__port", "def PortNumber(self):\n\t\treturn self._get_attribute('portNumber')", "def _find_vpn_service_port(self, context, ro...
[ "0.67261785", "0.65729564", "0.65600866", "0.64373505", "0.643042", "0.64224327", "0.64178896", "0.64150304", "0.6392377", "0.633623", "0.63292485", "0.63220274", "0.631832", "0.62940985", "0.6280982", "0.62645483", "0.6253354", "0.6236747", "0.61991984", "0.6165", "0.6147353...
0.69397056
0
Adds a static route on a router which owns any interface with the router_cidr param
def configure_route(self, router_subnet_cidr, destination, next_hop): router = self._get_router_by_ip_address(router_subnet_cidr) logger.info("Adding static route on VIM %s router=%s destination=%s, nexthop=%s", self.vim_name, router['id'], destination, next_hop) routes = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subnet(template, name, vpc, availability_zone='eu-west-1a', cidr='10.0.36.0/24', gateway=None, nat=None,\n map_public_ip=False, acl_table=None):\n s = Subnet(name, template=template)\n s.Tags = Tags(Name=aws_name(s.title))\n s.VpcId = Ref(vpc)\n s.CidrBlock = cidr\n s.MapPublicIpOnLaun...
[ "0.65999526", "0.6399896", "0.6232563", "0.62141335", "0.6172038", "0.6117026", "0.6022359", "0.6018793", "0.59952265", "0.59936017", "0.59726137", "0.5886457", "0.58815503", "0.5868492", "0.58616036", "0.579177", "0.57853395", "0.57774323", "0.575891", "0.57419497", "0.57169...
0.7417087
0
Removes a static route on a router which owns any interface with the router_cidr param
def remove_route(self, router_subnet_cidr, destination, next_hop): router = self._get_router_by_ip_address(router_subnet_cidr) logger.info("Removing static route from VIM %s router=%s destination=%s, nexthop=%s", self.vim_name, router['id'], destination, next_hop) routes =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_returned_route_on_gw(self, context, router_id, subnet_id):\n LOG.debug('OVNL3RouterPlugin::')\n ovn_router_name = utils.ovn_gateway_name(router_id)\n subnet = self._plugin.get_subnet(context, subnet_id)\n route = {'destination': subnet['cidr'], 'nexthop': '169.254.128.2'}\n ...
[ "0.7289791", "0.6889004", "0.6679226", "0.6648214", "0.6552394", "0.6397702", "0.63847226", "0.6380265", "0.6329497", "0.62777644", "0.62258637", "0.6115673", "0.6048093", "0.5951378", "0.59242004", "0.58994347", "0.58470964", "0.5800432", "0.579622", "0.57852167", "0.5734135...
0.7551147
0
Adds a security policy rule on the openstack to allow traffic incoming into VNFs and SFCs
def configure_security_policies(self, ip_proto, port_range_min=None, port_range_max=None): # if ip_proto is None: # ip_proto = 61 # any # msg = "IP Protocol must have a value!" # logger.error(msg) # raise VIMAgentsException(ERROR, msg) # if ip_pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ingress_security_policy(self):\n if not VncSecurityPolicy.ingress_svc_fw_policy_uuid:\n ingress_svc_fw_policy_uuid =\\\n VncSecurityPolicy.create_firewall_policy(\n self._k8s_event_type,\n None, None, is_global=True)\n Vnc...
[ "0.69489914", "0.5832325", "0.5664982", "0.55521226", "0.55321026", "0.5511907", "0.5432821", "0.5423466", "0.5385707", "0.53849083", "0.53669804", "0.53652734", "0.52827346", "0.5264798", "0.52554905", "0.5179754", "0.5177079", "0.514133", "0.5131689", "0.5130205", "0.512883...
0.6300187
1
Return True if mongod is up and listening on defined port
def is_mongod_running(self): try: _connect_to_mongo_port(int(self.port)) return True except OSError: return False except Exception: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def did_mongod_start(self, port=0, timeout=60):\r\n if port == 0:\r\n port = self.port\r\n \r\n while timeout > 0:\r\n time.sleep(1)\r\n try:\r\n _connect_to_mongo_port(int(port))\r\n return True\r\n except OSError as ex...
[ "0.77796817", "0.7577046", "0.7159504", "0.6976937", "0.68824947", "0.6578689", "0.6463406", "0.6356062", "0.6353833", "0.61421484", "0.608082", "0.6068783", "0.605707", "0.5968123", "0.59623134", "0.59211695", "0.5880274", "0.58802277", "0.58794874", "0.58516514", "0.5837635...
0.82879984
0
Wait timeout secs trying to connect to mongod defined port. Return True as soon as connection succeed or False if could not connect after timeout.
def did_mongod_start(self, port=0, timeout=60): if port == 0: port = self.port while timeout > 0: time.sleep(1) try: _connect_to_mongo_port(int(port)) return True except OSError as ex: prin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect_to_mongo_port(port):\r\n \r\n sock = socket.socket()\r\n sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)\r\n sock.settimeout(1)\r\n sock.connect((\"localhost\", int(port)))\r\n sock.close()", "def connect(self, timeout: float = 5) -> bool:\n if not self.conne...
[ "0.7018974", "0.70025665", "0.692226", "0.6811508", "0.672213", "0.66915905", "0.6670337", "0.66356003", "0.6591194", "0.6583415", "0.65770036", "0.6404617", "0.6403973", "0.63837206", "0.6341076", "0.62887436", "0.6284341", "0.62594527", "0.6207344", "0.6201353", "0.6180328"...
0.805383
0
Start mongod instance using defined port and db path
def start(self): if self.is_mongod_running(): return cmd = self.mongod_bin + " --port " + str(self.port) + " --smallfiles --dbpath " + self.db_path + " > /dev/null &" #if self.kwargs.get('noJournal'): #argv += ['--nojournal'] #if self.kwa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_mongo(dbpath,logpath,mongoexe='mongod'):\n import subprocess\n subprocess.call([mongoexe,'--logpath', logpath, '--fork', '--dbpath', dbpath])\n return", "def run_server(host='0.0.0.0', port=8080, database_url='mongodb://0.0.0.0:27017/'):\n f = furl(database_url)\n db, db_host, db_port = ...
[ "0.7356549", "0.7128157", "0.71178067", "0.69378835", "0.69350356", "0.6700028", "0.6664692", "0.6637834", "0.66092527", "0.65978855", "0.65567166", "0.65268856", "0.64987975", "0.64009404", "0.63590425", "0.6350045", "0.63407046", "0.6282369", "0.62517834", "0.6250261", "0.6...
0.776806
0
Try to connect to mongod listening port. Raise exception under failure
def _connect_to_mongo_port(port): sock = socket.socket() sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) sock.settimeout(1) sock.connect(("localhost", int(port))) sock.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def did_mongod_start(self, port=0, timeout=60):\r\n if port == 0:\r\n port = self.port\r\n \r\n while timeout > 0:\r\n time.sleep(1)\r\n try:\r\n _connect_to_mongo_port(int(port))\r\n return True\r\n except OSError as ex...
[ "0.75294405", "0.7073415", "0.68080205", "0.65788054", "0.6520379", "0.64965194", "0.6494677", "0.6488793", "0.64752454", "0.6468151", "0.6463619", "0.64295834", "0.64026314", "0.63835657", "0.62241954", "0.61974365", "0.6161621", "0.6159316", "0.6159316", "0.6159316", "0.615...
0.72562224
1
Uses ALTextToSpeech to vocalize the given string. If "block" argument is False, makes call asynchronous.
def say(self, text, block = True): if block: self.tts.say(text) else: self.tts.post.say(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speak(text):\r\n engine.say(text)\r\n engine.runAndWait()\r\n print(text)", "def speak(self, text):\r\n self.engine.say(text)\r\n self.engine.runAndWait()", "def say(self, text):\r\n return self._execute(self._espeak_args(text))", "def speak(self, newtext):\n self.loc...
[ "0.56601757", "0.5528867", "0.53880036", "0.5382174", "0.5252211", "0.5172946", "0.5172946", "0.5149971", "0.50466996", "0.50408596", "0.50158155", "0.49993068", "0.4994933", "0.49942273", "0.4991411", "0.4978864", "0.49704927", "0.4963683", "0.4955333", "0.49335906", "0.4926...
0.63459015
1
Has the robot ask a question and returns the answer
def ask(self, question): # If you're just trying to test voice detection, you can uncomment # the following 5 lines. Bobby will guess "yellow flashlight" and will prompt # you to correct him by saying "blue flashlight" # fake_answers = ["no", "yes", "yes", "yes", "no", "yes", "yes"] # global count # count...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_question(self, question):\n self.response((question))\n return input()", "def ask(self, question):\n if self.options.yes:\n return True\n\n result = False\n while True:\n print(question + ' [y/n] ')\n response = sys.stdin.readline()\n ...
[ "0.79993993", "0.70917803", "0.7073066", "0.69706315", "0.69556504", "0.6940896", "0.6900297", "0.68648696", "0.6811479", "0.67412865", "0.6719345", "0.6635936", "0.6587893", "0.65476036", "0.6539559", "0.65370864", "0.6502751", "0.6493667", "0.6493614", "0.6490732", "0.64237...
0.81782806
0
Turns robot head to the specified yaw and/or pitch in radians at the given speed. Yaw can range from 119.5 deg (left) to 119.5 deg (right) and pitch can range from 38.5 deg (up) to 29.5 deg (down).
def turnHead(yaw = None, pitch = None, speed = 0.3): if not yaw is None: self.motion.setAngles("HeadYaw", yaw, speed) if not pitch is None: self.motion.setAngles("HeadPitch", pitch, speed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turnHead(self, yaw = None, pitch = None, speed = 0.2):\n\n\t\tif not yaw is None:\n\t\t\tself.motion.setAngles(\"HeadYaw\", math.radians(yaw), speed)\n\t\tif not pitch is None:\n\t\t\tself.motion.setAngles(\"HeadPitch\", math.radians(pitch), speed)", "def set_joystick_speed(self, speed):\n if self.tab...
[ "0.7202783", "0.67670256", "0.6622254", "0.66106844", "0.6531885", "0.6388416", "0.63622576", "0.6315861", "0.62143433", "0.62080556", "0.6172572", "0.61054695", "0.6104195", "0.6097489", "0.6087141", "0.6079322", "0.6076654", "0.6076654", "0.60756266", "0.60723865", "0.60642...
0.73044163
0
Sets face tracker to just head and starts.
def trackFace(): # start face tracker self.track.setWholeBodyOn(False) self.track.startTracker()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trackFace(self):\n\n\t\t# start face tracker\n\t\tself.track.setWholeBodyOn(False)\n\t\tself.track.startTracker()", "def faceTrackingStarted(faceSize):\n\n\t# First, wake up\n\t#motionProxy.wakeUp()\n\t#motionProxy.rest()\n\n\t# Add target to track\n\ttargetName = \"Face\"\n\tfaceWidth = faceSize\n\ttracker....
[ "0.7231593", "0.6692019", "0.6471274", "0.6158261", "0.60427535", "0.59131914", "0.5786792", "0.57801205", "0.57416546", "0.5665318", "0.5646576", "0.55611765", "0.5511766", "0.5511766", "0.55116904", "0.5502947", "0.5489433", "0.5488704", "0.5476716", "0.5412752", "0.5361020...
0.7319472
0
Subscribes to gaze analysis module so that robot starts writing gaze data to memory. Also sets the highest tolerance for determining if people are looking at the robot because those people's IDs are the only ones stored.
def subscribeGaze(): self.gaze.subscribe("_") self.gaze.setTolerance(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n print \"Python has started\"\n #os.system(\"xterm -e \\\"pyhton Listen_link.py\\\"\") \n #print \"Started Listener\"\n tutorial = MoveGroupPythonIntefaceTutorial()\n model_info_prox = rospy.ServiceProxy('/gazebo/get_link_state', GetLinkState)\n rospy.wait_for_service('/gazebo/get_...
[ "0.5828921", "0.552011", "0.54928887", "0.5490298", "0.5487918", "0.546369", "0.5364343", "0.5333807", "0.5301183", "0.527257", "0.526763", "0.5214608", "0.52016026", "0.5188364", "0.51720643", "0.5143087", "0.5135013", "0.5134738", "0.5126199", "0.5122594", "0.50905645", "...
0.73353803
0
Retrieves people IDs from robot memory. If list of IDs was empty, return None.
def getPeopleIDs(): people_ids = self.mem.getData("GazeAnalysis/PeopleLookingAtRobot") if len(people_ids) == 0: return None return people_ids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIDs():", "def getPersonIds(withApp=False):\n with driver.session() as s:\n ids = s.write_transaction(getPersonId, withApp)\n\n pIds = []\n for idEl in ids:\n pIds.append(idEl[\"ID(p)\"])\n\n return pIds", "def get_person_ids(self) -> np.ndarray:\n return self.person_ids"...
[ "0.61387664", "0.5976508", "0.5974754", "0.590116", "0.5795006", "0.5762654", "0.56756544", "0.5661571", "0.5609183", "0.5544214", "0.5508234", "0.5441758", "0.54272926", "0.5421818", "0.54149723", "0.5398562", "0.5361636", "0.5350937", "0.5337409", "0.5330441", "0.5315476", ...
0.779393
0
Returns person's gaze as a list of yaw (left , right +) and pitch (up pi, down 0) in radians, respectively. Bases gaze on both eye and head angles. Does not compensate for variable robot head position.
def getRawPersonGaze(person_id): try: # retrieve GazeDirection and HeadAngles values gaze_dir = self.mem.getData("PeoplePerception/Person/" + str(person_id) + "/GazeDirection") head_angles = self.mem.getData("PeoplePerception/Person/" + str(person_id) + "/HeadAngles") # extract gaze direction and head ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHeadAngles(self):\n\n\t\trobot_head_yaw, robot_head_pitch = self.motion.getAngles(\"Head\", False)\n\n\t\t# return adjusted robot head angles\n\t\treturn [robot_head_yaw, -robot_head_pitch]", "def motor_angles(self):\n return np.asarray(self._robot_state.position)", "def test_get_egovehicle_yaw_cam()...
[ "0.6171107", "0.5865613", "0.58635765", "0.58395135", "0.5834089", "0.5789722", "0.57267785", "0.5686434", "0.5666217", "0.5665683", "0.56433785", "0.5637611", "0.56375724", "0.56363463", "0.5592349", "0.5585973", "0.55444443", "0.55442476", "0.55287385", "0.5508982", "0.5503...
0.6417888
0
Turns eye LEDs white.
def resetEyes(self): self.leds.on("FaceLeds")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_off():\n Leds.red_left.brightness = 0\n Leds.red_right.brightness = 0\n Leds.green_left.brightness = 0\n Leds.green_right.brightness = 0\n Leds.blue_left.brightness = 0\n Leds.blue_right.brightness = 0", "def brighter_switch(turtle, color):\n turtle.fillcolor(...
[ "0.64245826", "0.6159041", "0.6157741", "0.6148148", "0.6138537", "0.61093056", "0.60983384", "0.6087422", "0.6081189", "0.60781646", "0.60693383", "0.6064539", "0.60173994", "0.60062534", "0.599622", "0.5983108", "0.5975766", "0.5972171", "0.5969246", "0.5914878", "0.5864278...
0.6488516
1
Waits until either a sound is detected or until the given time limit expires.
def waitForSound(self, time_limit = 7): self.sound.subscribe("sound_detection_client") # give waiting a 7-second time limit timeout = time.time() + 7 # check for new sounds every 0.2 seconds while (self.mem.getData("SoundDetected")[0] != 1) and (time.time() < timeout): time.sleep(0.2) self.sound.unsu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_until_playing(self, item, timeout=None):\n self.play_media_event.clear()\n self.play_media(item)\n self.play_media_event.wait(timeout)\n self.play_media_event.clear()", "def block_until_playing(self, media=None, timeout=None, **kwargs):\n # In case med...
[ "0.65449303", "0.6419887", "0.5968276", "0.5896194", "0.5896194", "0.5896194", "0.5867232", "0.5867216", "0.5848363", "0.5740337", "0.5739567", "0.57323074", "0.57261264", "0.56998765", "0.56519127", "0.56492543", "0.5639349", "0.561746", "0.5572916", "0.55645365", "0.5527745...
0.83642423
0
Check if the analysis has results returned.
def has_result(self): return len(self.__analysis_items) > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_results(self):\n pass", "def result(self):\n result = True\n if self.state != \"error\":\n if self.tests_run < len(self.tests):\n result = False\n else:\n failed = [test for test in self.tests if test.test_result == False]\n ...
[ "0.85265684", "0.72287965", "0.71542335", "0.70279634", "0.69601256", "0.68356836", "0.6833048", "0.6809922", "0.6787496", "0.6733789", "0.6681512", "0.659976", "0.6599646", "0.655447", "0.65166694", "0.6490166", "0.64702094", "0.64171815", "0.6371117", "0.6368291", "0.631142...
0.8699397
0
r""" Get a sublist of "analysis items" based on the given "type lists".
def get_analysis_items(self, analysis_types: List[EditingAnalysisItemType] = None, element_types: List[SecondaryStructureElementType] = None) -> List[EditingAnalysisItem]: # If not set, return all if analysis_types is None and element_types is None: return self.__...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bib_sublist(bibfile_data, val_type):\n sublist = [bibfile for bibfile in bibfile_data if isinstance(bibfile.bib, val_type)]\n return sublist", "def type_filter(self, items, types=None):", "def type_filter(self, items, types=None):\n if not types:\n return items\n allowed_item...
[ "0.61447644", "0.6063728", "0.57342", "0.5633626", "0.5549349", "0.5473308", "0.5452261", "0.54464686", "0.5398685", "0.5398621", "0.53741544", "0.5369535", "0.5336736", "0.5325458", "0.5281795", "0.52637285", "0.52339494", "0.52334887", "0.5178113", "0.515919", "0.5129007", ...
0.61934406
0
Check if the element can be used to analyze "contain" type.
def can_analyze_contain(cls, element): if element is None: return False return element.ele_type == SecondaryStructureElementType.Stem \ or element.ele_type == SecondaryStructureElementType.Hairpin \ or element.ele_type == SecondaryStructureElementType.Interior...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_contain(self):\n return False", "def contains(self, element):\n pass", "def contains(self, element) -> bool:\n\n return self.__find_node(element) is not None", "def _is_element_present():\r\n return self.q(css=element_selector).present", "def contain(self, structure,...
[ "0.77560556", "0.7081752", "0.67459637", "0.6513341", "0.6461409", "0.6461409", "0.6450391", "0.6430953", "0.63478357", "0.633622", "0.6273477", "0.62616754", "0.62572163", "0.61958605", "0.61871535", "0.6176056", "0.6139996", "0.6106203", "0.60714173", "0.60440624", "0.60430...
0.7322614
1
Check if the element can be used to analyze "before" type.
def can_analyze_before(cls, element): if element is None: return False return element.ele_type == SecondaryStructureElementType.Stem \ or element.ele_type == SecondaryStructureElementType.Hairpin \ or element.ele_type == SecondaryStructureElementType.Multiloop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_before(self):\n\n try:\n return self._validate_before()\n except TypeError:\n return False", "def before(self):\n return self._before", "def can_transform(self, html_element: ET.Element):\n return html_element.tag == \"mark\"", "def _is_input_element(...
[ "0.7132466", "0.57545173", "0.56774426", "0.55780524", "0.5552958", "0.5493247", "0.5312844", "0.519526", "0.51697963", "0.5127252", "0.5115429", "0.5102943", "0.5092704", "0.5091602", "0.5076706", "0.50032854", "0.49799433", "0.4978727", "0.49716112", "0.49658084", "0.494042...
0.7003871
1
Returns all geometric elements of a link, i.e. 'visual' and 'collision' objects.
def getGeometricElements(link): visuals = [] collisions = [] if 'visual' in link: visuals = [link['visual'][v] for v in link['visual']] if 'collision' in link: collisions = [link['collision'][v] for v in link['collision']] return visuals, collisions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def links (self):\n return (link for src, dst, link in self.network.edges_iter(data=True) if\n link.type == Link.STATIC or link.type == Link.DYNAMIC)", "def _link_elements(self):\n raise NotImplementedError(\"Please implement this method\")", "def _get_link_elem_array(self):\n # abr...
[ "0.60600716", "0.6000526", "0.57837087", "0.56078565", "0.54343164", "0.53601724", "0.5322076", "0.5303827", "0.5291934", "0.52747947", "0.5233276", "0.5225268", "0.52151555", "0.5211919", "0.51701146", "0.5167679", "0.51636636", "0.5124677", "0.51223433", "0.5093366", "0.507...
0.87013584
0
Derives a link from an object using its name, transformation and parenting.
def deriveLinkfromObject(obj, scale=1, parent_link=True, parent_objects=True, reparent_children=True, nameformat='', scaleByBoundingBox=False): log('Deriving link from ' + nUtils.getObjectName(obj), level="INFO") # create armature/bone bUtils.toggleLayer('link', True) bpy.ops.ob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mklinkto(self, oldname):\n error.checked_call(os.link, str(oldname), str(self))", "def process_link(self, env, refnode, has_explicit_title, title, target):\n refnode['json:name'] = normalize_object_name(target)\n return title, normalize_object_name(target)", "def linkify(field_name...
[ "0.5919343", "0.58784205", "0.58540666", "0.5839964", "0.57728153", "0.5771955", "0.57273173", "0.55541885", "0.5551572", "0.54341155", "0.53871334", "0.53851676", "0.5346565", "0.53426135", "0.5285458", "0.5274386", "0.52717155", "0.52711654", "0.5261082", "0.5215044", "0.51...
0.769677
0
Assigns the transformations recursively for a model parent link according to the model. This needs access to the object key of a link entry in the specified model. The transformations for each link object are extracted from the specified model and applied to the Blender object.
def setLinkTransformations(model, parent): #todo: bpy.context.scene.layers = bUtils.defLayers(defs.layerTypes['link']) for chi in parent['children']: child = model['links'][chi] # apply transform as saved in model location = mathutils.Matrix.Translation(child['pose']['translation']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_to_model(self, model):\n verts = model.verts\n norms = model.norms\n\n # transform all verts and norms\n newverts = []\n newnorms = []\n for i in range(len(verts)):\n group = verts[i].group\n sf = self.subframes[group]\n rot_matri...
[ "0.6434486", "0.5923369", "0.5352922", "0.5321611", "0.5266869", "0.5201829", "0.516844", "0.5123401", "0.5088347", "0.50728786", "0.50142586", "0.4995103", "0.49719194", "0.4967402", "0.49524692", "0.4944167", "0.49365467", "0.4933688", "0.4930235", "0.48378754", "0.48297444...
0.72367924
0
Adds a layer from a CSV file
def addLayerFromCSV(layNumList): rhinoLayerFilePath = "Q:\\Staff Postbox\\Tim Williams\\10 DESIGN LAYERS\\dev\\LAYERS\\RhinoLayersV3.csv" #Read the CSV file = open(rhinoLayerFilePath, "r") contents = file.readlines() file.close() #Variables RhinoLayerCol = 1 ColorCol = 3 Ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadCSV(input_file):", "def add_csv(filename):\n with open(f'{filename}') as csvfile:\n reader = csv.DictReader(csvfile)\n for row in reader:\n new_entry = False\n name = row['product_name']\n price = clean_price(row['product_price'])\n quantity = ...
[ "0.64719963", "0.6273253", "0.6202069", "0.6118442", "0.5981428", "0.59525394", "0.58984506", "0.5778889", "0.57760704", "0.57601804", "0.570467", "0.5704598", "0.5694556", "0.56617564", "0.56461644", "0.5645179", "0.5641673", "0.56304663", "0.5621997", "0.5597355", "0.557082...
0.6836847
0
Create the projection matrix from the current viewing position. elev stores the elevation angle in the z plane azim stores the azimuth angle in the x,y plane dist is the distance of the eye viewing point from the object point.
def get_proj(self): relev, razim = np.pi * self.elev/180, np.pi * self.azim/180 xmin, xmax = self.get_xlim3d()/self.pbaspect[0] ymin, ymax = self.get_ylim3d()/self.pbaspect[1] zmin, zmax = self.get_zlim3d()/self.pbaspect[2] # transform to uniform world coordinates 0-1.0,0-1.0,0-1.0 worldM = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_proj(self):\n relev, razim = np.pi * self.elev/180, np.pi * self.azim/180\n\n xmin, xmax = self.get_xlim3d()\n ymin, ymax = self.get_ylim3d()\n zmin, zmax = self.get_zlim3d()\n\n # transform to uniform world coordinates 0-1.0,0-1.0,0-1.0\n worldM = proj3d.world_tra...
[ "0.6950592", "0.57356656", "0.5604143", "0.5604143", "0.5604143", "0.55896205", "0.55805355", "0.55279654", "0.5525718", "0.55147177", "0.5496664", "0.54521847", "0.5426019", "0.5383377", "0.5338151", "0.5306241", "0.5248644", "0.524063", "0.523978", "0.52061206", "0.51957655...
0.6728051
1
Ask for the type of search and then lists books based of the criteria
def search_for_books(main_page): # Add information to the printout if the book is rented type_of_search = 0 header = """ Do you want to search for books by the first letter of the title or by the type? """ search_choices= ( ("To search by letter", search_by_letter), ("T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def book_search(library: list) -> None:\n options = ['Author', 'Title', 'Publisher', 'Shelf', 'Category', 'Subject']\n prompt = '\\nWhat option would you like to search by?'\n choice = get_user_choice(options, prompt)\n if choice == '1':\n search_by_chosen_option(library, options[0])\n elif c...
[ "0.7993024", "0.7641626", "0.76000047", "0.74449384", "0.74371374", "0.7101183", "0.7036552", "0.7019114", "0.7002566", "0.69410557", "0.6915585", "0.6807983", "0.68031013", "0.67606115", "0.67557144", "0.6749006", "0.66825587", "0.66368455", "0.66146564", "0.66032165", "0.65...
0.8128295
0
Lists books that are starting with the entered letter
def search_by_letter(book_search): print("What is the first letter of the searched title? Use uppercase") letter = input("> ") # books.csv = [title,author,year,ID,book_type] with open('books.csv', 'r') as book_base: book_list = csv.reader(book_base) next(book_list) pointer = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all_by_name_begin ( self, prefix, **kw ):\n return self.find_all (\n lambda s, pre: s.name.startswith ( pre ), c_args=( prefix, ), **kw\n )", "def book_search(self, term):\n\n try:\n cur = self._db.cursor()\n search = f'%{term.upper()}%'\n ...
[ "0.60517025", "0.5857847", "0.57964766", "0.57608336", "0.5733448", "0.5696728", "0.55963695", "0.5595418", "0.5590167", "0.55792475", "0.55693305", "0.5529944", "0.5522319", "0.5502698", "0.5485333", "0.5450822", "0.54474914", "0.5433724", "0.5420219", "0.54153156", "0.54054...
0.7227701
0
Prints books of the type
def book_printer(book_type): # books.csv = [title,author,year,ID,book_type] with open('books.csv', 'r') as book_base: book_list = csv.reader(book_base) next(book_list) for book_data in book_list: if book_data[-1] == book_type: print(book_data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_catalog(self):\n for book in self.books.keys():\n print(book)", "def print_catalog(self):\n for book in self.books.keys():\n print(book)", "def display_book(self):\n print(\"List of books available is: \")\n for book in books_list :\n print...
[ "0.7401431", "0.7401431", "0.729861", "0.7260649", "0.67850137", "0.65705675", "0.65617484", "0.64624554", "0.6368032", "0.61414516", "0.6104747", "0.60982543", "0.6042393", "0.6035576", "0.60228896", "0.6003078", "0.59837013", "0.59221905", "0.5899725", "0.5854168", "0.58436...
0.74475276
0
checks the books rented by the person in rented.csv base
def check_my_books(main_page): login = main_page.login # rented.csv = [ID, rental_date, return_date, login] with open('rented.csv', 'r') as rented_base: rented_reader = csv.reader(rented_base) next(rented_reader) books_table = [] for line in rented_reader: if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def if_rented(ID):\n\n # rented.csv = [ID,rental_date,return_date,RETURNED,login]\n with open('rented.csv','r') as rented_base:\n rented_reader = csv.DictReader(rented_base)\n for rented_data in rented_reader:\n if rented_data['ID'] == ID:\n if rented_data['RETURNED'] ...
[ "0.7170691", "0.6626496", "0.65971607", "0.6557393", "0.6473171", "0.63748425", "0.62622875", "0.5811615", "0.5715877", "0.55674124", "0.5484904", "0.5386499", "0.5370754", "0.53361577", "0.5325254", "0.53136766", "0.5301556", "0.52626467", "0.52102786", "0.51264316", "0.5103...
0.71198195
1
changes books data to 'rented' in rented.csv
def rent_book(main_page): print("Which book do you wish to rent? Enter its code") book_code = input('> ') check_code_and_rent(main_page, book_code) os.remove('rented.csv') os.rename('rented_temp.csv','rented.csv')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_books_status(main_page, book_code, rented_book_data):\n\n new_rented_data = rented_book_new_data(main_page, book_code)\n\n with open('rented.csv', 'r') as rented_base_r:\n rented_reader = csv.reader(rented_base_r)\n\n with open('rented_temp.csv','w', newline = '') as rented_base_w:\n...
[ "0.7834255", "0.6210494", "0.5978053", "0.5823318", "0.5783796", "0.5733037", "0.5712181", "0.5591351", "0.5456713", "0.5436211", "0.535549", "0.5351047", "0.53323764", "0.52284455", "0.5227054", "0.5142413", "0.51112103", "0.50715715", "0.50634015", "0.5047535", "0.50377095"...
0.65451074
1
Check if book code exists in base and rents it
def check_code_and_rent(main_page, book_code): with open('rented.csv', 'r') as rented_base: rented_reader = csv.reader(rented_base) next(rented_reader) rented_book_data = [] check_if_available(main_page, rented_reader, book_code, rented_book_data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_book(code: str) -> Dict:\n pass", "def is_book_exist(self, book_info):\n for type, link in book_info.links.items():\n try:\n bookfile = BookFile.objects.get( link_hash = md5(link).hexdigest() )\n books = bookfile.book_set.all()\n if books...
[ "0.65027696", "0.60517156", "0.589691", "0.5876977", "0.58417934", "0.5840119", "0.576887", "0.57486266", "0.5704971", "0.56963736", "0.5634084", "0.56131417", "0.5600297", "0.55385005", "0.5518983", "0.55107814", "0.5477188", "0.5456752", "0.5452005", "0.54430246", "0.540362...
0.61997736
1
Checks if book is available and if yes, rents it
def check_if_available(main_page,rented_reader, book_code, rented_book_data): for line in rented_reader: if line[0] == book_code: if line[-2] == 'FALSE': print('Books is unavailable') return else: rented_book_da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_book_available(self, book):\n request_url = \"%s?q=%s\" % (self.API_URL, book)\n json_data = self.make_request(request_url)\n if json_data and len(json_data['docs']) >= 1:\n return True\n return False", "def view_books():\r\n flag = 0\r\n for book in Li...
[ "0.779338", "0.72739387", "0.7165715", "0.71600056", "0.6697303", "0.6691239", "0.66045207", "0.6557002", "0.6523944", "0.64789456", "0.64547515", "0.64477825", "0.6435371", "0.63864714", "0.6366464", "0.63331854", "0.63308525", "0.6330189", "0.6328277", "0.6260421", "0.62379...
0.7592701
1
Sets a table of rented book data
def rented_book_new_data(main_page, book_code): login = main_page.login # modifying book_data: rental_date, return_date = date_setter() new_rented_data = [book_code, rental_date, return_date, 'FALSE', login ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setRevertable(self, b):\n\n self.revertable = b", "def table(self, table):\n self._table = table", "def table(self, table):\n self._table = table", "def sit(self, table):\n self.table = table", "def set_data(self, indexer_table):\n\n self.indexer_table = indexer_table...
[ "0.61888486", "0.57303846", "0.57303846", "0.57230216", "0.56694067", "0.56069976", "0.5581474", "0.556478", "0.5542181", "0.5419345", "0.5391155", "0.52969027", "0.52503175", "0.52485174", "0.52329755", "0.5218925", "0.5184847", "0.51547265", "0.5151733", "0.51391983", "0.51...
0.6101336
1
Creates rented_temp.csv file with changed book status
def change_books_status(main_page, book_code, rented_book_data): new_rented_data = rented_book_new_data(main_page, book_code) with open('rented.csv', 'r') as rented_base_r: rented_reader = csv.reader(rented_base_r) with open('rented_temp.csv','w', newline = '') as rented_base_w: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rent_book(main_page):\n\n print(\"Which book do you wish to rent? Enter its code\")\n book_code = input('> ')\n\n check_code_and_rent(main_page, book_code)\n\n os.remove('rented.csv')\n os.rename('rented_temp.csv','rented.csv')", "def writeVerdictFile(verdict=\"PASS\", descr=\"PASS\",\r\r\n ...
[ "0.58841807", "0.5766071", "0.56500095", "0.5414087", "0.5404459", "0.5401221", "0.54003984", "0.5285078", "0.52805346", "0.52648", "0.52006704", "0.5173486", "0.51592106", "0.51445013", "0.51231664", "0.5062752", "0.5042528", "0.49932206", "0.49886978", "0.49873006", "0.4985...
0.6983809
0
Delegates change_name() to change_data() with 'name'
def change_name(change_account): change_data(change_account, changed_data='name')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _name_changed ( self, name ):\n self.name_last = parse_name( name )[-1]\n self.inputs_changed()", "def new_name(self,new_name):\n self.name = new_name", "def updateName(self,name):\n self.name = name", "def update_name(self, new_name):\r\n self.__name = new_name", "de...
[ "0.7117959", "0.7094645", "0.69756895", "0.68427765", "0.68427765", "0.6833366", "0.67321074", "0.6681817", "0.6628632", "0.6519476", "0.6517514", "0.6493459", "0.6493459", "0.64875716", "0.648496", "0.64799446", "0.64736694", "0.64676255", "0.6451896", "0.6402322", "0.639314...
0.79923725
0
Delegates change_name() to change_data() with 'surname'
def change_surname(change_account): change_data(change_account, changed_data='surname')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_name(change_account):\n change_data(change_account, changed_data='name')", "def new_name(self,new_name):\n self.name = new_name", "def rename(self,newName):\n self.userName = newName", "def userRenamed(self, oldname, newname):\n # Send messasge to Server bot.\n self....
[ "0.7677292", "0.6416407", "0.6340846", "0.6336195", "0.63281256", "0.6279591", "0.6181002", "0.6177204", "0.61762637", "0.6151835", "0.6143273", "0.6131492", "0.6054849", "0.6002122", "0.6002122", "0.59858865", "0.5952554", "0.5917959", "0.5900225", "0.5899154", "0.58841294",...
0.8680367
0
Delegates change_name() to change_data() with 'password'
def change_password(change_account): change_data(change_account, changed_data='password')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_name(change_account):\n change_data(change_account, changed_data='name')", "def change_username(self, name):\n self.username = name", "def change_surname(change_account):\n change_data(change_account, changed_data='surname')", "def doChangeUser(self, login, password, **kwargs):\n ...
[ "0.7045615", "0.6681818", "0.651073", "0.64875126", "0.6371859", "0.635908", "0.63011897", "0.6292751", "0.6261046", "0.6248071", "0.6230643", "0.617344", "0.61618614", "0.61280376", "0.6069497", "0.60547876", "0.6052256", "0.6049684", "0.604227", "0.6042066", "0.60381055", ...
0.76464206
0
Tells if transaction is in context mode
def is_context_active(self): return self.is_active and bool(self.__inside_context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_transaction(self) -> bool:\n return False", "def is_transaction(self):\n return self._request.has_var(\"_transid\")", "def isTx(self):\n\t\treturn self.extension == '.tx'", "def supports_transactions(self):\n return False", "def autocommit(self):\n if self.isolation_level...
[ "0.66507083", "0.63734734", "0.60491186", "0.6036501", "0.581334", "0.57735115", "0.57431686", "0.5678711", "0.5671184", "0.5665506", "0.56261843", "0.55929124", "0.55863196", "0.55692405", "0.5555271", "0.5542856", "0.5504941", "0.5502588", "0.5502588", "0.5502588", "0.54889...
0.67148185
0
Tells if transaction is active (is opened somehow)
def is_active(self): active = bool( self.__is_connected and self._db_connection and self._db_transaction and self._db_connection.in_transaction() and self._db_transaction.is_active ) if not active and self.__is_connected: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_transaction(self) -> bool:\n return False", "def is_active():\n return True", "def is_active(self):\n return not self.pending", "def is_active(self):\n return True", "def is_active(self):\n return True", "def is_active(self):\n return True", "def is_acti...
[ "0.7357674", "0.7272807", "0.7239989", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "0.7118543", "...
0.77008957
0
The current ORM session associated with transaction and connection
def session(self): if not self.is_active: raise errors.InactiveTransaction() return self._orm_session_proxy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sa_session( self ):\n return self.model.context.current", "def sa_session( self ):\n return self.app.model.context", "def session(self):\n return session", "def session(self):\n\t\treturn self._session", "def session(self):\n return self.__session", "def dbsession(cls):\n ...
[ "0.82958525", "0.79473364", "0.7590066", "0.7527266", "0.7504051", "0.7498453", "0.7408203", "0.73879975", "0.73879975", "0.72187656", "0.7206092", "0.7193918", "0.7105391", "0.7074726", "0.70488775", "0.70358425", "0.6997756", "0.699591", "0.6995745", "0.6990835", "0.6979276...
0.8178579
1
Flushes data from ORM Session into DB, but does not commit transaction
def flush(self): if not self.is_active: return # XXX: investigate if there is db transaction flush self._orm_session.flush()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit(self):\n self.session.commit()", "def _commit(self):\n if self.__session is not None:\n self.__session.commit()", "def commit(self):\n try:\n self.session.commit()\n except:\n self.session.rollback()\n raise\n finally:\n ...
[ "0.7524094", "0.75122565", "0.7408665", "0.73853624", "0.7330973", "0.7265482", "0.7238094", "0.7169909", "0.7111744", "0.70777774", "0.6964285", "0.6961208", "0.6935387", "0.6935387", "0.6935387", "0.6935387", "0.6935387", "0.6935387", "0.6935387", "0.6935387", "0.6924248", ...
0.7542106
0
Creates a savepoint under current transaction
def savepoint(self): if not self.is_active: raise errors.InactiveTransaction() return Savepoint(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def savepoint(self, id):\n self.execute(\"SAVEPOINT {}\".format(id))", "def savepoint(self, name: str = None) -> Iterator:\n if name is None:\n name = str(uuid4())\n\n # Quote the name as a SQL identifier\n id = Identifier(name)\n\n with self.cursor() as cursor:\n ...
[ "0.6915986", "0.6242868", "0.6174945", "0.61397773", "0.5986192", "0.5944323", "0.58977103", "0.5677149", "0.55982286", "0.5571927", "0.55433923", "0.542671", "0.54099387", "0.5405038", "0.5405038", "0.53853494", "0.5354268", "0.534313", "0.5326175", "0.53107136", "0.5295824"...
0.71420336
0
Starts db connection, transaction, SqlAlchemy ORM session
def _connect(self): assert not self.__is_connected self._db_engine = create_engine(self._database.url) from sqlalchemy import event if self._database.driver == 'sqlite': @event.listens_for(self._db_engine, "connect") def do_connect(dbapi_connection, *args, **k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n \n self.db.session.add(self.sql_model_instance)\n self.db.session.commit()", "def setup_session():\n print(\"Setting up session\")\n engine = setup_engine()\n Base.metadata.bin = engine\n\n DBSession = sessionmaker(bind=engine)\n session = DBSession()\n\n ...
[ "0.7167832", "0.70630944", "0.7061418", "0.7033788", "0.7017483", "0.6905415", "0.6875719", "0.68594307", "0.6809427", "0.6806148", "0.6797554", "0.6791578", "0.67465895", "0.66850495", "0.6653355", "0.66238874", "0.6602373", "0.66011673", "0.65981543", "0.65888107", "0.65882...
0.76530164
0
Executes deferred queries within separate transaction
def _execute_deferred_queries(self): assert not self.__is_connected if not self._deferred_queries: return with Transaction(self.__database_name) as txn: while True: try: query = self._deferred_queries.popleft() tx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_execute_transaction_1(self):\n result = find_domains.execute_transaction(self.connection)\n domain_table_results = test_db_utils.get_data(test_db_utils.domain_table_query)\n with self.subTest():\n self.assertEqual(len(domain_table_results), 0)\n with self.subTest():\...
[ "0.64808583", "0.63582104", "0.63470197", "0.6324412", "0.63015395", "0.6296334", "0.62806845", "0.62674254", "0.6229034", "0.60791755", "0.607419", "0.60501367", "0.60486823", "0.597425", "0.5957508", "0.59547406", "0.59541756", "0.59528995", "0.59158325", "0.59132975", "0.5...
0.8057309
0
Time the execution of the statement `number` of times and repeat it number of `repetitions`. The returned timing is the all recorded `repetitions` with discarded potential outliers with the highest and lowest times, then averaged. The statement is executed number of times for each repetition and for each repetition we ...
def timeitrep(statement, number=1, repetition=1): timings = [] results = [] for _ in range(repetition): t0 = time.time() statement_result = None for _ in range(number): statement_result = statement() t1 = time.time() timings.append(t1 - t0) if len(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure_time(stmt, context=None, repeat=10, number=50, div_by_number=False,\n max_time=None):\n if not callable(stmt) and not isinstance(stmt, str):\n raise TypeError(\n f\"stmt is not callable or a string but is of type {type(stmt)!r}.\")\n if context is None:\n ...
[ "0.70075953", "0.5887293", "0.5724382", "0.5693303", "0.55251324", "0.54279584", "0.5417353", "0.53766906", "0.53438985", "0.5330369", "0.5306764", "0.52975863", "0.5285499", "0.5275816", "0.5262539", "0.5236426", "0.5226267", "0.51958233", "0.51832604", "0.51632494", "0.5133...
0.80716807
0
Returns a list of the properties under the specified key name.
def list_property( self, key: str) -> Collection[Tuple[str, PropertyAttribute]]: return self._env.list_property(key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_for_key(self, key) -> list:\n return [res[key] for res in self.list]", "def get_list(key, nodename=None):\n return _get_property(key, nodename, [])", "def get_all_properties(cls):\n return ['key', 'id'] + _.keys(cls._properties)", "def _PropList(self):\n prop_list = []\n\n if s...
[ "0.64988965", "0.64191806", "0.6185174", "0.61731964", "0.613282", "0.6111854", "0.60069877", "0.59670436", "0.5964201", "0.588338", "0.5880211", "0.5851629", "0.58091396", "0.5719073", "0.5695497", "0.5684898", "0.56833875", "0.56779325", "0.56646776", "0.5661517", "0.563038...
0.7640736
0
Randomly sample a batch of experiences from memory.
def sample(self): sample_ind = np.random.choice(len(self.memory), self.batch_size) # get the selected experiences: avoid using mid list indexing es, ea, er, en, ed = [], [], [], [], [] i = 0 while i < len(sample_ind): self.memory.rotate(-sample_ind[i]) # rotate the m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def experience_replay(batch_size):\n memory = []\n while True:\n experience = yield rsample(memory, batch_size) if batch_size <= len(memory) else None\n memory.append(experience)", "def sample(self, batch_size):\n if len(self._buffer) <= batch_size:\n print(\"There are only ...
[ "0.7664635", "0.743932", "0.7405311", "0.7355313", "0.72966963", "0.7283894", "0.7274549", "0.72717017", "0.72717017", "0.7262714", "0.72463816", "0.7175717", "0.70837855", "0.70716524", "0.6962316", "0.69450194", "0.69399315", "0.6939355", "0.68166035", "0.68011534", "0.6798...
0.74570787
1
Return a LaTeX table for the strategy results.
def result_table(fmt='latex_booktabs'): names = [ "ETF EW.", "Antonacci ETF", "Antonacci ETF Inv. Vol.", "Futures EW.", "Antonacci Futures", "Antonacci Futures Inv. Vol.", "TSMOM Futures Low Vol.", "TSMOM Futures High Vol." ] # Get stats ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latex_table(result, *, decimal_places=3, label=None):\n if label is None:\n label = 'tbl:stat_results'\n\n table_df = result.rankdf\n columns = table_df.columns.to_list()\n if result.omnibus != 'bayes' and result.pvalue >= result.alpha or \\\n result.omnibus == 'bayes' and len({'smalle...
[ "0.7108413", "0.6597466", "0.6470617", "0.6392221", "0.6379411", "0.62972975", "0.626275", "0.62506974", "0.6193465", "0.6174914", "0.6170586", "0.6166405", "0.6162457", "0.6137973", "0.6120239", "0.61030406", "0.60559034", "0.6055785", "0.6051054", "0.6049858", "0.6021768", ...
0.7132232
0
get the configuration file name according to the command line parameters
def get_config_file_name(self): argv = sys.argv config_type = "dev" # default configuration type if None != argv and len(argv) > 1 : config_type = argv[1] config_file = config_type + ".cfg" logger.info("get_config_file_name() return : " + config_file) return c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_name():\n name = CONFIG_FILE_NAME\n for i, arg in enumerate(sys.argv):\n if arg.startswith('--config'):\n if arg == '--config':\n return sys.argv[i + 1]\n else:\n name = sys.argv[i].split('--config')[1]\n if name[0] == '...
[ "0.81517005", "0.7209939", "0.70977616", "0.7069732", "0.69151145", "0.68013585", "0.67519194", "0.6692196", "0.6685003", "0.663142", "0.6591063", "0.6544629", "0.652599", "0.6524444", "0.65038514", "0.6494794", "0.64812326", "0.64669794", "0.64343", "0.64286256", "0.64117724...
0.8423875
0
Update review data based on last performance.
def review(self, performance_rating): self.correct = performance_rating >= 0.6 now = datetime.datetime.now() if self.date_last_reviewed is None: self.date_last_reviewed = now percent_overdue = self.percent_overdue self.difficulty += percent_overdue / 17 * (8 - 9 * per...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_performance(self, reviewed_verbs: VerbReview) -> None:\n self._update_lambdas_of_reviewed_words(reviewed_verbs)\n self._update_last_time_reviewed()\n self._update_min_to_review(reviewed_verbs)", "def update_review(self, new_review):\n new_review = new_review.convert_review_to_d...
[ "0.6584024", "0.62176794", "0.5809278", "0.57231486", "0.5690471", "0.5635679", "0.5626761", "0.5573838", "0.55362856", "0.5502796", "0.5496065", "0.5475911", "0.54704773", "0.54490465", "0.544424", "0.54282093", "0.5417214", "0.5412468", "0.5400982", "0.5370741", "0.53474414...
0.6276474
1
Returns cards that require reviewing. This defaults to at most 20 items, for cards that have not been reviewed in the last 8 hours.
def fetch_review(self): c = self.db.cursor() c.execute("""SELECT * FROM cards WHERE date_last_reviewed < (DATETIME('now', 'localtime', '-8 hours')) OR correct = 0""") rows = c.fetchall() cards = [ Card( id=id, card_type=card_typ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_consumed_cards_longer(self):\n game = TestGames.replay(9, [3, 1, 0, 0, 1, 2, 2, 0, 6, 3,\n 0, 0, 1, 2, 6, 0, 0, 0, 0, 0])\n consumed_cards = game.consumed_cards()\n self.assertEqual(len(consumed_cards), 8)\n\n self.assertListEqual(list(consume...
[ "0.5924182", "0.5767671", "0.5607335", "0.5572473", "0.5559083", "0.5515181", "0.5465687", "0.54451674", "0.53176945", "0.52970797", "0.52793026", "0.5250517", "0.52305734", "0.5224727", "0.5224431", "0.5213799", "0.52080363", "0.5195416", "0.51821995", "0.517701", "0.5157818...
0.72277975
0