query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Make a remote process call to release the dhcp port.
def release_dhcp_port(self, network_id, device_id): return self.call(self.context, self.make_msg('release_dhcp_port', network_id=network_id, device_id=device_id, host=sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release_dhcp_port(self, network_id, device_id):\n LOG.debug(\"release_dhcp_port: %s %s\", network_id, device_id)", "def dhcp_release(ifname):\n\n logging.debug('Releasing %s...', ifname)\n\n try:\n subprocess.call(['dhcpcd', '--release', ifname])\n except OSError, err:\n if err....
[ "0.705921", "0.6589862", "0.580546", "0.55769974", "0.55496395", "0.5542536", "0.5490024", "0.5460197", "0.54363143", "0.53853947", "0.53727317", "0.5369885", "0.53608006", "0.5334013", "0.5265669", "0.5128569", "0.51262695", "0.51248026", "0.50996053", "0.5078857", "0.506425...
0.6612475
1
Make a remote process call to release a fixed_ip on the port.
def release_port_fixed_ip(self, network_id, device_id, subnet_id): return self.call(self.context, self.make_msg('release_port_fixed_ip', network_id=network_id, subnet_id=subnet_id, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remote_kill():", "def ReleasePort(self, *args, **kwargs):\n # type: (*Any, **Any) -> None\n payload = { \"Arg1\": self }\n for i in range(len(args)): payload['Arg%s' % (i + 2)] = args[i]\n for item in kwargs.items(): payload[item[0]] = item[1]\n return self._execute('releas...
[ "0.5751554", "0.56354207", "0.5619003", "0.54908806", "0.54209656", "0.5399607", "0.5373213", "0.53657866", "0.5338972", "0.5337617", "0.5322124", "0.53005093", "0.525492", "0.51884073", "0.5165239", "0.5156112", "0.51426136", "0.51397544", "0.51306945", "0.511095", "0.510230...
0.6276679
0
Make a remote process call to update the ip lease expiration.
def update_lease_expiration(self, network_id, ip_address, lease_remaining): self.cast(self.context, self.make_msg('update_lease_expiration', network_id=network_id, ip_address=ip_address, lease_remai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, *args):\n\n gmtexpires = None\n (name, ip, expires) = args[:3]\n\n for arg in args:\n if arg.lower().startswith('expires='):\n gmtexpires = arg[8:]\n\n if gmtexpires is None:\n if len(args) == 3:\n gmtexpires = expires...
[ "0.5781035", "0.5655976", "0.5412396", "0.5290201", "0.5213446", "0.51987845", "0.5019132", "0.50062484", "0.49905106", "0.49797148", "0.4976283", "0.49701196", "0.49448273", "0.4910099", "0.49022925", "0.48599997", "0.4854406", "0.4850345", "0.4835414", "0.48195204", "0.4783...
0.63969594
0
Return interface(device) name for use by the DHCP process.
def get_interface_name(self, network, port=None): if not port: device_id = self.get_device_id(network) port = self.plugin.get_dhcp_port(network.id, device_id) return self.driver.get_device_name(port)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_interface_name():\n interface_name = ''\n interfaces = psutil.net_if_addrs()\n for name, details in interfaces.items():\n for detail in details:\n if detail.family == socket.AF_INET:\n ip_address = ipaddress.ip_address(detail.address)\n if not (ip_ad...
[ "0.7754688", "0.7292888", "0.72684246", "0.7240329", "0.72280574", "0.71967864", "0.7171746", "0.7142047", "0.701453", "0.69190764", "0.68561924", "0.68412864", "0.67124903", "0.6670526", "0.6562061", "0.65597874", "0.6453947", "0.6371652", "0.6349215", "0.63410044", "0.63398...
0.73330253
1
Return a unique DHCP device ID for this host on the network.
def get_device_id(self, network): # There could be more than one dhcp server per network, so create # a device id that combines host and network ids host_uuid = uuid.uuid5(uuid.NAMESPACE_DNS, socket.gethostname()) return 'dhcp%s-%s' % (host_uuid, network.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_id(self):\n return self.unique_id", "def device_id(self) -> str:\n return self._device_info[\"ID\"]", "def get_device_id(self) -> str:\n return Config.get('device_id')", "def device_id(self) -> Optional[str]:\n return self.relay(\"device_id\")", "def device_id(self):\...
[ "0.73077106", "0.7298454", "0.72520554", "0.71881825", "0.7102662", "0.7056606", "0.704042", "0.6955741", "0.6934329", "0.69141144", "0.6878838", "0.6839864", "0.68147016", "0.67973", "0.6795465", "0.6704469", "0.6691843", "0.6679224", "0.66670865", "0.66638803", "0.6633019",...
0.8490437
0
Create and initialize a device for network's DHCP on this host.
def setup(self, network, reuse_existing=False): device_id = self.get_device_id(network) port = self.plugin.get_dhcp_port(network.id, device_id) interface_name = self.get_interface_name(network, port) if self.conf.use_namespaces: namespace = NS_PREFIX + network.id el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_dhcp_env(device):\n raise NotImplementedError", "def elAddNetworkConfigurationWithDhcp(self, device):\n commandSection = self.sectionByName(\"command\")\n # see http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s1-kickstart2-options.html\n ...
[ "0.6997817", "0.674639", "0.64192647", "0.63564396", "0.6154114", "0.61231625", "0.6063283", "0.60560066", "0.5956769", "0.59495527", "0.5929514", "0.5879821", "0.58772236", "0.58456236", "0.5761779", "0.57187897", "0.5710458", "0.56871796", "0.56771624", "0.56416315", "0.563...
0.6328014
4
Destroy the device used for the network's DHCP on this host.
def destroy(self, network, device_name): if self.conf.use_namespaces: namespace = NS_PREFIX + network.id else: namespace = None self.driver.unplug(device_name, namespace=namespace) self.plugin.release_dhcp_port(network.id, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy(self, context=None):\n self.dbapi.destroy_nic(self.uuid)\n self.obj_reset_changes()", "def destroy_node(self):\n driver = self.driver\n driver.ex_detach_floating_ip_from_node(self.node, self.floating_ip)\n driver.destroy_node(self.node)\n sleep(15)\n f...
[ "0.63705355", "0.6200864", "0.6193805", "0.6192019", "0.61369485", "0.6060995", "0.60351926", "0.59916675", "0.59413284", "0.5918379", "0.5916078", "0.5872993", "0.5829491", "0.58259064", "0.5774636", "0.5741544", "0.5731216", "0.57206935", "0.57002115", "0.5697077", "0.56899...
0.7568489
0
Validate value against a regular expression and return if valid.
def _validate_field(self, value, regex): match = re.match(regex, value) if match: return value raise ValueError(_("Value %s does not match regex: %s") % (value, regex))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validator_regex(self, field, value):\n try:\n re.compile(value)\n except re.error:\n self._error(field, \"{} is not a valid regex\".format(value))", "def string_validate_regular_expression(cls, value):\n if value is None:\n return value\n\n if not...
[ "0.7598519", "0.75967777", "0.75010866", "0.7477238", "0.7303168", "0.7277673", "0.7156195", "0.687343", "0.68461555", "0.6806273", "0.660515", "0.65665877", "0.64467674", "0.64461094", "0.63882786", "0.6347836", "0.63040394", "0.6208035", "0.6126982", "0.6108813", "0.6094763...
0.7598315
1
Handle incoming lease relay stream connection. This method will only read the first 1024 bytes and then close the connection. The limit exists to limit the impact of misbehaving clients.
def _handler(self, client_sock, client_addr): try: msg = client_sock.recv(1024) data = jsonutils.loads(msg) client_sock.close() network_id = self._validate_field(data['network_id'], attributes.UUID_PATTERN) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_read(self):\n while True:\n try:\n content = self.recv(1024)\n if content:\n self.rbuf.write(content.decode('utf-8'))\n if len(content) < 1024:\n break\n except Exception as e:\n ...
[ "0.62060666", "0.6183686", "0.5830963", "0.5776027", "0.57630414", "0.5755018", "0.57015896", "0.5606217", "0.55097467", "0.54902726", "0.54840934", "0.5481293", "0.54781973", "0.53888357", "0.53813994", "0.5288314", "0.52739257", "0.5272853", "0.5260518", "0.52552116", "0.52...
0.53806835
15
Spawn a green thread to run the lease relay unix socket server.
def start(self): listener = eventlet.listen(cfg.CONF.dhcp_lease_relay_socket, family=socket.AF_UNIX) eventlet.spawn(eventlet.serve, listener, self._handler)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n server = TCPServer((self.host, self.port), TCPHandler)\n server.lymphocytes_getter = self.lymphocytes_getter\n\n #runs forever - so make this thread daemon\n server.serve_forever()", "def main():\n # Clear the terminal before a new run\n os.system('cls') \n\n...
[ "0.718199", "0.6661798", "0.6513136", "0.64684916", "0.637286", "0.6361127", "0.6353088", "0.63464284", "0.6327527", "0.63006586", "0.6287364", "0.62497455", "0.62400097", "0.6211207", "0.62012124", "0.62009555", "0.6200558", "0.61990255", "0.6187328", "0.6142365", "0.6077814...
0.698998
1
takes the original tweet text and returns the preprocessed texts.
def _preprocess_feed(tweet: str): t = tweet.lower() t = re.sub(url_re, " <URL> ", t) t = t.replace("\n", "") t = t.replace("#", " <HASHTAG> ") t = re.sub(mention_re, " <USER> ", t) t = re.sub(smile_re, " <EMOTICON> ", t) t = re.sub(emoji_re, " <EMOJI> ", t) t = re.sub(time_re, " <TIME> "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self, text):\r\n return text", "def preprocess(self,text):\n return preprocess.get_tokens(text)", "def preprocess_tweets(tweets):\n tweets = clean_html(tweets)\n tweets = detweettify(tweets)\n tweets = remove_numbers(tweets)\n tweets = remove_punctuation(tweets)\n tw...
[ "0.7566967", "0.7467431", "0.738912", "0.730991", "0.722519", "0.7110993", "0.70971894", "0.7094896", "0.70701337", "0.6990219", "0.69773144", "0.6968755", "0.6935003", "0.68867147", "0.6803225", "0.6801379", "0.6793875", "0.67900354", "0.6776054", "0.6768327", "0.67605615", ...
0.63083714
57
load each celebrity, concat the first 500 tweets and add a separator token between each
def _read_text_linewise(p, mode): if mode == 'celeb': for line in open(p, "r"): yield " <eotweet> ".join(json.loads(line)["text"][:MAX_TWEETS_PER_USER]) elif mode == 'follow': for line in open(p, "r"): yield " <eofollower> ".join([" <eotweet> ".join(follower[:MAX_TWEETS_P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tweets(self):\n chunker = Chunker.Chunker(500)\n for batch in chunker(self.cids):\n query = [\n {'$match': {'lid': {'$in': batch}}},\n {'$project': {'lid': 1}},\n ]\n if isinstance(self.city, str) and self.city in cities.SHORT_KEY...
[ "0.5971527", "0.58274555", "0.58167905", "0.57916", "0.5788923", "0.57195675", "0.5711067", "0.5633862", "0.5590568", "0.5584303", "0.5445918", "0.54027176", "0.53997636", "0.53938067", "0.53760326", "0.5370495", "0.5339488", "0.53326637", "0.53278416", "0.53190356", "0.53060...
0.0
-1
convert the birthyears of a certain range to the center point. This is to reduce the number of classes when doing a classification model over regression on age
def _get_age_class(by): by = int(by) if 1940 <= by <= 1955: return 1947 elif 1956 <= by <= 1969: return 1963 elif 1970 <= by <= 1980: return 1975 elif 1981 <= by <= 1989: return 1985 elif 1990 <= by <= 1999: return 1994
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getagefromyear(year=None):\n if year is None:\n print(\"Please enter the year to assign class to them\")\n try:\n t = datetime.datetime.today()\n b = datetime.datetime.strptime(str(year), '%Y')\n a = (t - b).days / 365\n a = int(a)\n if (a < 10) or (a > 80):\n ...
[ "0.5999794", "0.59221816", "0.5844322", "0.5806519", "0.57929456", "0.5738596", "0.56947285", "0.5682877", "0.56782824", "0.56642705", "0.56635046", "0.5658976", "0.56326574", "0.56149614", "0.5565969", "0.5530023", "0.5472231", "0.546988", "0.54366285", "0.5412874", "0.54118...
0.5842931
4
load the dataset, preprocess the texts for ML and build a feature matrix
def load_dataset(dataset_path: str, mode: str, vectorizer_path: str): if mode == "celeb": x_path = dataset_path + "/celebrity-feeds.ndjson" else: x_path = dataset_path + "/follower-feeds.ndjson" y_data = [json.loads(line) for line in open(dataset_path + "/labels.ndjson", "r")] if not Pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):\n\n x = [] # input documents (n_docs, max_seq_len)\n labels = [] # targets we are predicting for each input\n\n for file_path in glob.glob(self.train_dir + '*.txt'):\n tokens = read_tokens(file_path)\n unique = list(set(tokens))\n x_count = round(len(unique) * 0.85)\n\n ...
[ "0.6873847", "0.6771321", "0.67625684", "0.66853976", "0.6684797", "0.66633147", "0.66306025", "0.6575743", "0.65331876", "0.64986175", "0.6469622", "0.6462651", "0.6460789", "0.64582276", "0.6436508", "0.64318967", "0.64197", "0.6404501", "0.6401439", "0.63936836", "0.639067...
0.0
-1
Main method for the baselines. It wires data loading, model training, and evaluation. The model used is a simple, linear LogisticRegression from sklearn. The method predicts on the given test dataset and writes the results to a labels.ndjson. Use the evaluator from the celebrity profiling task at PAN2020 to evaluate th...
def logreg(mode, vectorizer, training_dir, test_dir): # 1. load the training dataset logging.basicConfig(level=logging.INFO) logging.info("loading training dataset") x_train, y_train_age, y_train_gender, y_train_occ, _ = \ load_dataset(training_dir, mode, vectorizer) # 2. train models l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n parser = argparse.ArgumentParser(description='Duolingo shared task baseline model')\n parser.add_argument('--train', help='Training file name', required=True)\n parser.add_argument('--test', help='Test file name, to make predictions on', required=True)\n parser.add_argument('--pred', he...
[ "0.7670619", "0.75885636", "0.7251273", "0.715975", "0.71588683", "0.70943546", "0.70568967", "0.70433867", "0.7035157", "0.70211583", "0.69730866", "0.69535923", "0.693389", "0.69214296", "0.6915987", "0.6909108", "0.6894069", "0.6878732", "0.6878043", "0.68695116", "0.68371...
0.0
-1
>>> hamming_distance("attttgggaa", "ATTGagaGAT") 4
def hamming_distance(s1, s2): assert len(s1)==len(s2), ",".join((s1, s2)) s1 = np.array(s1.upper(), dtype="c") s2 = np.array(s2.upper(), dtype="c") return np.sum(s1 != s2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hamming_distance(str1, str2):\n\n # TODO: Write your solution here\n # Edge case check\n if len(str1) != len(str2):\n return None\n\n count = 0\n for index in range(len(str1)):\n if str1[index] != str2[index]:\n count += 1\n\n if count is 0:\n return None\n\n ...
[ "0.8071709", "0.79256994", "0.77318686", "0.76397955", "0.7592835", "0.75870985", "0.7473032", "0.72747177", "0.7261725", "0.7240274", "0.72203976", "0.7219557", "0.7201422", "0.71931374", "0.7184794", "0.71738684", "0.71686417", "0.7164325", "0.7138686", "0.71182394", "0.705...
0.7495115
6
Applies Ridge Regression algorithm and returns the weights vector wRR
def RidgeRegression(X, y, lam=1, centering=False, standarize=False): n_features = X.shape[1] # Preprocessing if centering: y = y - np.mean(y) xmean = np.mean(X, axis=0) if standarize: sigma = np.var(X, axis=0) X = (X - xmean)//sigma I = np.identity(n_features) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ridge_regression(y, tx, lambda_):\n D = tx[0].size\n\n # w = (Xt + λ' * I)^(-1) * Xt * y\n lambdap = lambda_ * (2 * len(y))\n A = tx.T.dot(tx) + lambda_ * np.eye(D)\n w = np.linalg.inv(A).dot(tx.T.dot(y))\n\n loss = compute_mse_loss(y, tx, w)\n\n return w, loss", "def ridge_regression(y,...
[ "0.69519377", "0.68995565", "0.6844785", "0.67542213", "0.67494196", "0.672827", "0.66820043", "0.66564137", "0.6632492", "0.66306275", "0.6535608", "0.6408946", "0.63402414", "0.62906736", "0.623844", "0.61602646", "0.6094281", "0.60723513", "0.60165584", "0.6015603", "0.598...
0.6096145
16
Implements the Active Learning Scheme as seen in class. Returns a list of the first 10 chosen vectors in X_test
def ActiveLearning(X_train, X_test, lam=1, sigma2=1): X = np.copy(X_train) D = np.copy(X_test) selected = [] n_features = X.shape[1] I = np.identity(n_features) # I[-1, -1] = 0 for i in xrange(10): sigma02_max = float('-Inf') idx_max = None for idx in range(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_impl_variational(in_train, in_test, labels):\n X_train = []\n X_test = []\n for lab in labels:\n for datum in in_train[lab]:\n X_train.append([datum, lab])\n for datum in in_test[lab]:\n X_test.append([datum, lab])\n Variationer_learn(X_train, 500, 1, 0.01, X_...
[ "0.6407244", "0.6252256", "0.61563945", "0.6147052", "0.6129238", "0.61026", "0.60756004", "0.6071751", "0.60336673", "0.602746", "0.60267353", "0.60159856", "0.5990562", "0.59761053", "0.59511435", "0.5943814", "0.59321856", "0.5868017", "0.58638775", "0.5863876", "0.5857149...
0.6903305
0
Controls elements of settings and updates values
def update(self, mouse_pos, mouse_click): if self.show: pg.draw.rect(self.window, c.BLUE, pg.Rect(self.x, self.y, self.l, self.w)) self.window.blit(self.exit_icon, (c.RES_X - 55, 0)) self.turn_speed_slider.update(mouse_pos, mouse_click) self.player_speed_slider.up...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_control_widgets(self):\n logger.info(f'Loading settings: {self.settings_dict}')\n for k, section in self.settings_dict.items():\n for setting_name, value in section.items():\n self.set_control_value(setting_name, value)", "def settingstowidgets(self):\n\n ...
[ "0.7669663", "0.736302", "0.7218585", "0.68501705", "0.6838213", "0.68094075", "0.68005043", "0.67564225", "0.66863275", "0.6591002", "0.6523926", "0.65003026", "0.6499622", "0.64457685", "0.64428496", "0.64219916", "0.63932836", "0.6386411", "0.6373868", "0.63510126", "0.630...
0.0
-1
Draws value on screen
def draw(self): if self.is_clicked: pg.draw.circle(self.window, self.color, (self.x, self.y), self.r, 0) else: pg.draw.circle(self.window, self.color, (self.x, self.y), self.r, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self, win):\n font = pygame.font.SysFont(\"comicsans\", 40)\n\n gap = self.width / 9\n x = self.col * gap\n y = self.row * gap\n\n if self.temp != 0 and self.value == 0:\n text = font.render(str(self.temp), 1, (128,128,128))\n win.blit(text, (x+5, y...
[ "0.7256944", "0.71788496", "0.69589424", "0.69558156", "0.69492", "0.6923104", "0.68882227", "0.68221706", "0.6773283", "0.6763322", "0.6718767", "0.6695994", "0.669379", "0.669379", "0.669379", "0.669379", "0.66910875", "0.6603367", "0.6587968", "0.65211713", "0.6504177", ...
0.0
-1
Saves parameters to txt file
def set_param(self, param_value): with open("settings.txt", "r") as f: filedata = f.read() settings = [_.split("=") for _ in filedata.split("\n")] for setting in settings: if len(setting) < 2: # if blank line continue if setting[0] == self.par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_save_parameters(self):\n obj_points = self.get_object_points()\n cam_pos = self.get_camera_position()\n distortion = self.get_distortion_coeeficients()\n\n d = {\n 'object positions': obj_points,\n 'camera positions': cam_pos,\n 'distortion coe...
[ "0.68710876", "0.6830528", "0.67880505", "0.67193514", "0.66373163", "0.6631557", "0.6600538", "0.6570675", "0.6565469", "0.6565469", "0.6563612", "0.6562384", "0.65408957", "0.65222305", "0.6521612", "0.6521078", "0.65022236", "0.6473686", "0.6443179", "0.64313823", "0.64237...
0.0
-1
Upadtes value of slider
def update(self, mouse_pos, mouse_click): if mouse_click[0] == 1 and math.sqrt(((float(mouse_pos[0]) - self.b_x)**2 + (float(mouse_pos[1]) - self.b_y)**2)) < float(self.button_size): self.is_clicked = True if mouse_click[0] == 0: self.is_clicked = False if self.is_click...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetValue(self, val):\n self.spin.SetValue(val)\n self.slider.SetValue(100*(val-self.minval)/(self.maxval-self.minval))", "def storeSliderValue(self):\n\n\t\tcategory, attr = self.getWidgetMeta(self.sender())\n\t\tvalue = self.sender().value()\n\t\tself.storeValue(category, attr, value)", "def...
[ "0.6890296", "0.6846201", "0.67737436", "0.67694914", "0.66258675", "0.6594357", "0.65715533", "0.6451174", "0.63753986", "0.6355502", "0.6328119", "0.628872", "0.62839395", "0.6250207", "0.62247103", "0.6204547", "0.6196597", "0.6187941", "0.61739737", "0.6160226", "0.615457...
0.0
-1
Saves parameters to txt file
def set_param(self): with open("settings.txt", "r") as f: filedata = f.read() settings = [_.split("=") for _ in filedata.split("\n")] for setting in settings: if len(setting) < 2: # if blank line continue if setting[0] == self.param: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_save_parameters(self):\n obj_points = self.get_object_points()\n cam_pos = self.get_camera_position()\n distortion = self.get_distortion_coeeficients()\n\n d = {\n 'object positions': obj_points,\n 'camera positions': cam_pos,\n 'distortion coe...
[ "0.68710876", "0.6830528", "0.67880505", "0.67193514", "0.66373163", "0.6631557", "0.6600538", "0.6570675", "0.6565469", "0.6565469", "0.6563612", "0.6562384", "0.65408957", "0.65222305", "0.6521612", "0.6521078", "0.65022236", "0.6473686", "0.6443179", "0.64313823", "0.64237...
0.5928797
69
Helping function that randomly reorders all the letters in words that are shorter than a given number of letters
def shuffle_short(sentence:str, n:int) -> str: def shuffle_short_words(word): if len(word) >= n: return word shuffle_word=shuffle_string(word) if len(word) > 1: while shuffle_word == word: shuffle_word=shuffle_string(word) return shuffle_w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def typoglycemia(sequence):\n words = sequence.split()\n\t\n for i in range(len(words)):\n if len(words[i]) > 4:\n word_partial = list(words[i][1:-1])\n random.shuffle(word_partial)\n word_shuffle = \"\".join(word_partial)\n words[i] = words[i][0] + word_shu...
[ "0.74613917", "0.68939656", "0.6847483", "0.6812126", "0.6699029", "0.6699029", "0.6699029", "0.6625604", "0.6611706", "0.65957206", "0.65634125", "0.6512646", "0.64810795", "0.6479116", "0.646554", "0.6424865", "0.6420267", "0.64034677", "0.63381433", "0.6332955", "0.6326069...
0.6660418
7
For now, this thread doesn't do anything periodically.
def run(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self): # pragma: no cover\n while True:\n self.update()", "def run(self):\n\t\t\n\t\twhile self.update():\n\t\t\tpass", "def _run(self):\n while(self._loop):\n pass", "def process_thread(self):", "def loop(self):\n pass", "def run(self):\n self._...
[ "0.7574247", "0.748637", "0.7271296", "0.72142804", "0.7146549", "0.7080866", "0.7025878", "0.6999136", "0.6963862", "0.6807874", "0.67590576", "0.6758429", "0.67574316", "0.67323905", "0.67283034", "0.6724101", "0.6718747", "0.6712344", "0.6701859", "0.6688299", "0.6648409",...
0.65230507
35
Nothing to do for now.
def run(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self) -> None:", "def __call__(self):\n\t\treturn", "def use(self):", "def __call__(self):\n pass", "def __call__(self):\n pass", "def support(self):", "def __call__( self ):\n pass", "def _prepare(self):", "def _prepare(self):", "def __call__(self):\n rai...
[ "0.7039426", "0.70010626", "0.6905124", "0.6810202", "0.6810202", "0.6772632", "0.67366546", "0.67112446", "0.67112446", "0.6679233", "0.6595687", "0.6595687", "0.6595687", "0.6595687", "0.6595687", "0.6595687", "0.6595687", "0.6595687", "0.6595687", "0.6595687", "0.6575207",...
0.62053204
74
Initalizeds the client and some global strings
def __init__(self): self.client = soundcloud.Client(client_id="e54975908f6d3073657a1a66b654f79a") self.client_str = "?client_id=e54975908f6d3073657a1a66b654f79a" self.past_songs_db = open("past_songs.db", 'r+') self.past_songs_db_data = [(line.strip(), "") for line in self.past_songs_db....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_setup(self):\n self.client = Client()", "def init_client():\n init_config()\n begin_sending_packets()", "def service_client_initialization(self) -> global___Snippet.ClientInitialization:", "def init_client(self, client):\n self.client = client", "def _initialize(self):\n ...
[ "0.748437", "0.74357724", "0.72365063", "0.7165116", "0.68053865", "0.65882003", "0.65882003", "0.65882003", "0.65713793", "0.65421814", "0.6526021", "0.6491916", "0.6445353", "0.64435047", "0.64435047", "0.6434431", "0.64309484", "0.640944", "0.6404571", "0.640439", "0.64019...
0.0
-1
Gets the filename of a track based off the headers of a url
def get_track_filename(self, url = None): track_file = urllib.urlopen(url) headers = track_file.info() track_file.close() return wget.filename_from_headers(headers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_url_filename(url, headers=None, strip=[]):\n filename = get_url_disposition_filename(url, headers)\n if filename:\n return filename\n return get_url_straight_filename(url, strip=[])", "def get_file_name(url: str):\n filename = os.path.basename(url)\n fname, extension = os.path.split...
[ "0.7299136", "0.710809", "0.68631077", "0.684902", "0.6672016", "0.6661408", "0.6651063", "0.6625067", "0.6586317", "0.6574036", "0.65387857", "0.6461432", "0.64488965", "0.6422117", "0.6405276", "0.6404342", "0.6381905", "0.63627076", "0.63227975", "0.63170123", "0.63093925"...
0.80735415
0
Moves all tracks in the current folder to the ~/Music/ folder
def move_tracks_to_music_folder(self): home = os.path.expanduser("~") dest = home + "/Music/" for each_file, artist in self.past_songs_db_data: sub_folder = artist + "/" if artist != "" else "" # possible race condition if not os.path.exists(dest + sub_folder...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_move(self, artist, album, song):\n try:\n move_to = \"{0}{1}/{2}/\".format(self.dupe_dir, \n artist, album)\n if not os.path.exists(move_to):\n os.makedirs(move_to)\n \n shutil.move(song['pa...
[ "0.6169354", "0.60723484", "0.6025653", "0.59947664", "0.5966635", "0.59113675", "0.58590925", "0.57916886", "0.57881904", "0.57249045", "0.57191676", "0.5678596", "0.5565063", "0.5562512", "0.5485806", "0.54774505", "0.54692006", "0.5413971", "0.54099286", "0.5391516", "0.53...
0.8270894
0
Find and set all metadata for a track
def set_track_metadata(self, track = None, filename = None, url = None): if url == None or track == None: return None if filename == None: filename = get_track_filename(url) # id3 is only for mp3 if not filename.endswith(".mp3"): if filename.endswith...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_nowplaying_metadata(self, track, album, artist):\n\n\t\tparts = [artist[:30], album[:30], track[:30]]\n\t\tself._send_message(\"MUSIC_CONTROL\", self._pack_message_data(16, parts))", "def set_nowplaying_metadata(self, track, album, artist):\n\n\t\tparts = [artist[:30], album[:30], track[:30]]\n\t\tself._...
[ "0.689562", "0.689562", "0.6419808", "0.62818295", "0.6159478", "0.61100864", "0.60070544", "0.5941569", "0.59195507", "0.59143335", "0.59020805", "0.58483756", "0.58387387", "0.5828475", "0.58254874", "0.58005095", "0.579113", "0.57742536", "0.5765951", "0.5753168", "0.57420...
0.6495024
2
Download a track pointed at by the url given
def download_track(self, track = None, url = None): # check that track doesn't exist if url == None or track == None: return print "Retrieving the name of the track." filename = self.get_track_filename(url) print "Filename found: " + filename if (fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_song(url, filename):\n page = requests.get(url, headers=HEADERS)\n if page.status_code == 200: # OK\n with open(filename, 'w') as outf:\n outf.write(page.text)\n else:\n print(f'download failed with status code {page.status_code}!')", "def download_track(trackpath)...
[ "0.7309085", "0.7252067", "0.6934912", "0.6847038", "0.6825551", "0.68067807", "0.6724556", "0.6714492", "0.6657802", "0.66412157", "0.65748054", "0.65468055", "0.6545219", "0.65393245", "0.65367454", "0.65257233", "0.6506926", "0.6446718", "0.6434038", "0.6421497", "0.640676...
0.7958018
0
Downloads the first songs from tracks/q=
def download_free_tracks_by_search(self, query='trapstep', limit=10): tracks = self.client.get('tracks/', q=query, limit=limit) for track in tracks: if track.downloadable: url = track.download_url + self.client_str # print out some useful data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_8tracks_songs(self):\n logging.info('getting tracks from 8tracks')\n API_KEY = '7fe2e057bb81abf2248a06ecab027b8dc09e01d3' \n self.info_var.set('\\n\\n Now playing 8Tracks Songs: \\n')\n\n api = Api(api_key=API_KEY)\n mixes = api.get_mixes(num_results=1)\n tr...
[ "0.6338008", "0.62776303", "0.62629706", "0.6250336", "0.61471456", "0.6128437", "0.60963446", "0.60775757", "0.6053801", "0.6050617", "0.6031621", "0.6012589", "0.6011378", "0.6003287", "0.5957437", "0.5933667", "0.5861777", "0.5846252", "0.5837947", "0.58110344", "0.5805988...
0.67752016
0
Convert all .wav files to .mp3 files in the current folder
def all_wav_to_mp3(self): for each_file, artist in self.past_songs_db_data: self.convert_wav_to_mp3(each_file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mp3_to_wav(show_progress=True):\n\n # Define a devnull var to supress subprocess output\n devnull = open(os.devnull, 'w')\n\n # Get a list of the filepath for each of the mp3 files in each subdirectory of data/fma_small\n file_list = glob.glob('./../data/fma_small/*/*.mp3')\n\n # Get the number ...
[ "0.74014467", "0.7148263", "0.6751976", "0.6705585", "0.66649914", "0.6631666", "0.6620781", "0.6530281", "0.65300494", "0.6521014", "0.65070164", "0.64703506", "0.6462281", "0.63890207", "0.6369542", "0.6361365", "0.63011235", "0.62873816", "0.62860155", "0.61241585", "0.612...
0.8493313
0
Remove all leftover songs that could not be moved over because we already had a copy of it somehow
def delete_leftovers(self): for each_file, artist in self.past_songs_db_data: if os.path.isfile(each_file): os.remove(each_file) print "Deleted " + each_file for each_file in os.listdir("."): if each_file.endswith(".jpg"): os.remo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n for artist in self.audio_dict:\n for album in self.audio_dict[artist]:\n for songlist in self.audio_dict[artist][album]:\n if len(self.audio_dict[artist][album][songlist]) > 1:\n \n # track the song that...
[ "0.7379587", "0.6529362", "0.63871706", "0.6352371", "0.6054021", "0.60165644", "0.595798", "0.5925949", "0.58864945", "0.58732814", "0.58706284", "0.58316857", "0.58295476", "0.57719314", "0.573926", "0.5734612", "0.5715898", "0.5702195", "0.56977755", "0.5672036", "0.563202...
0.66432697
1
Last minute cleaning up such as moving songs to ~/Music/
def cleanup(self): self.all_wav_to_mp3() self.past_songs_db.close() self.move_tracks_to_music_folder( ) self.delete_leftovers() print "Cleanup finished"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_cleanup(self):\n self.past_songs_db.close()", "def update():\n\tglobal songList\n\tglobal songs\n\tsongList=os.listdir(\"./music/\")\n\tsongs=['```']\n\tfor song in songList:\n\t\tif len(songs[-1])>1800:\n\t\t\tsongs[-1]+='```'\n\t\t\tsongs.append('```')\n\t\tif '.mp3' in song:\n\t\t\tsongs[-1]+=s...
[ "0.6738972", "0.63275284", "0.60766363", "0.601346", "0.5995643", "0.59815437", "0.5894408", "0.5746696", "0.57395715", "0.5724052", "0.5710683", "0.5706564", "0.56509155", "0.5629594", "0.5569479", "0.55685073", "0.55458707", "0.55235755", "0.5510457", "0.5507455", "0.550616...
0.642854
1
Do absolute mininum cleanup needed
def min_cleanup(self): self.past_songs_db.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def horde_cleanup(self):", "def CleanUp(self):\n for Ind in self.IndList():\n if amax(abs(self[Ind]))<1e-10:\n del self[Ind]", "def clean(self):\n for i in range(len(self.asteroid_type) - 1, -1, -1):\n x, y = self.get_coords(self.asteroid_type[i])\n ...
[ "0.6401098", "0.6384323", "0.5867853", "0.57721686", "0.5722933", "0.5722933", "0.5718232", "0.5716011", "0.5670256", "0.5668926", "0.566482", "0.5656903", "0.5599921", "0.554", "0.55238295", "0.5522905", "0.54992676", "0.5472014", "0.5461269", "0.545876", "0.5453096", "0.5...
0.0
-1
Tests for metric works with accumulation.
def test_accumulation(preds, targets, exact_match, f1): squad_metric = SQuAD() for pred, target in zip(preds, targets): squad_metric.update(preds=[pred], target=[target]) metrics_score = squad_metric.compute() _assert_tensor(metrics_score["exact_match"]) _assert_tensor(metrics_score["f1"]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_summarize(self):\n measurement = self.measurement(self.metric())\n self.assertEqual(\n {\n \"count\": {\"value\": None, \"status\": None},\n \"start\": measurement[\"start\"],\n \"end\": measurement[\"end\"],\n },\n ...
[ "0.6638574", "0.65793973", "0.6346243", "0.62330616", "0.6227776", "0.6179155", "0.60952276", "0.6091839", "0.60903305", "0.6070068", "0.6063105", "0.6062281", "0.6044133", "0.5999467", "0.5984636", "0.59845644", "0.5932534", "0.59302336", "0.5928781", "0.59001726", "0.589158...
0.6557511
2
Define a DDP process for SQuAD metric.
def _squad_score_ddp(rank, world_size, pred, targets, exact_match, f1): os.environ["MASTER_ADDR"] = "localhost" os.environ["MASTER_PORT"] = "12355" dist.init_process_group("gloo", rank=rank, world_size=world_size) squad_metric = SQuAD() squad_metric.update(pred, targets) metrics_score = squad_me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dunning_process_no(self, dunning_process_no):\n\n self._dunning_process_no = dunning_process_no", "def dworker(self):\n\t\t\"\"\" {pid:{subkey:subvalue}} \"\"\"\n\t\t\"\"\" line colors in use: black, blue, red\"\"\"\n\t\t\"\"\" fill colors in use: cyan, yellow, orange, red\"\"\"\n\t\tif self.pslist:...
[ "0.5505989", "0.5426503", "0.53447145", "0.53441024", "0.53260225", "0.49359587", "0.4927588", "0.49224964", "0.49179453", "0.49071914", "0.49071893", "0.49060753", "0.4902909", "0.48797745", "0.48461652", "0.48392186", "0.47885707", "0.4779368", "0.4768873", "0.47611788", "0...
0.56313103
0
Core functionality for the `test_score_ddp` test.
def _test_score_ddp_fn(rank, world_size, preds, targets, exact_match, f1): _squad_score_ddp(rank, world_size, preds[rank], targets[rank], exact_match[rank], f1[rank])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self, test_data):\n\n\t\tpass", "def test_get_score(self):\r\n\r\n score_dict = self.get_score(True, 3, 3)\r\n\r\n # Score should be 1.0.\r\n self.assertEqual(score_dict[\"score\"], 1.0)\r\n\r\n # Testing score after data is stored in student_data_for_location in xmodule.\r\...
[ "0.7068864", "0.69648415", "0.6868908", "0.67215055", "0.6707211", "0.66553664", "0.65471405", "0.6499154", "0.6377464", "0.6229254", "0.6140717", "0.61075974", "0.6053336", "0.6031183", "0.6014362", "0.6003147", "0.5980275", "0.5911025", "0.5881889", "0.585568", "0.5815525",...
0.6874784
2
Tests for metric using DDP.
def test_score_ddp(preds, targets, exact_match, f1): world_size = 2 mp.spawn(_test_score_ddp_fn, args=(world_size, preds, targets, exact_match, f1), nprocs=world_size, join=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_derived_metric(self):\n pass", "def test_get_host_configuration_metrics1(self):\n pass", "def test_service_perfdata_special_cases(self, aggregator):\n self.log_file = tempfile.NamedTemporaryFile()\n # Get the config\n config, _ = get_config(\n \"servic...
[ "0.6036698", "0.5839559", "0.58340734", "0.5833282", "0.5832313", "0.57819396", "0.5764973", "0.5758957", "0.57318056", "0.5704307", "0.56689024", "0.56600976", "0.5642456", "0.5608637", "0.5585179", "0.55792", "0.5553001", "0.5523119", "0.55214006", "0.55175734", "0.5515608"...
0.5231933
54
Perform MUSIC at frequency freqs[idx]
def music(idx, n_music=200): f = freqs[idx] Rxx = np.dot(X[:, idx], X[:, idx].H) lam, V = eig_sorted(Rxx) En = V[:, 1:] # Noise subspace for one source theta_range = np.linspace(0, 2*np.pi, n_music) P_music = np.zeros(n_music) for i in range(n_music): sv = ma.steering_vector(theta_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def analyze2(ys, freqs, ts):", "def update_frequencies():\n pass", "def setfreqs(self, freqs):\n self.fm_freq, self.hfm_freq, self.sv_freq = freqs[0], freqs[1], freqs[2]", "def freq_at_octave(freq_at_zero, target_octave):\n target_frequency = 0\n\n if target_octave<0:\n b = (target_oct...
[ "0.60125726", "0.59969664", "0.56162065", "0.55160475", "0.54664046", "0.54283315", "0.531813", "0.53076774", "0.52961713", "0.5284241", "0.52565277", "0.51878655", "0.51857436", "0.5162814", "0.51619595", "0.5161843", "0.51594913", "0.5150779", "0.5132257", "0.5115299", "0.5...
0.6406316
0
Update avatar's position based on movement flag
def update(self): if self.moving_right and self.rect.right < self.screen_rect.right: self.x += self.settings_sky.ava_speed if self.moving_left and self.rect.left > 0: self.x -= self.settings_sky.ava_speed if self.moving_up and self.rect.top > 0: self.y -= self.settings_sky.ava_speed if self.moving_down...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moveMyAvatar(self) :\n\t\tif Util.AUTO : self.autoMove(); return\n\n\t\tnewH = self.avatarNP.getH()\n\t\tnewY = 0\n\t\tnewX = 0\n\n\t\tif self.keyMap[\"left\"] :\n\t\t\tnewH += 30 * globalClock.getDt()\n\t\tif self.keyMap[\"right\"] :\n\t\t\tnewH -= 30 * globalClock.getDt()\n\t\tif self.keyMap[\"forward\"] :\n...
[ "0.7291536", "0.68666506", "0.68240136", "0.6659778", "0.66082096", "0.6607806", "0.6589492", "0.6588192", "0.6539933", "0.6515344", "0.64653206", "0.6449772", "0.6433638", "0.6430297", "0.64281327", "0.64028496", "0.63888025", "0.637632", "0.6372024", "0.63676", "0.6315056",...
0.6117629
51
Center the ava on the screen.
def center_ava(self): self.rect.midbottom = self.screen_rect.midbottom self.x = float(self.rect.x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center_mario(self):\n self.rect.midbottom = self.screen_rect.midbottom\n self.x, self.y = float(self.rect.x), float(self.rect.y)", "def center(self):\n self.root.update_idletasks()\n w = self.root.winfo_screenwidth()\n h = self.root.winfo_screenheight()\n size = tupl...
[ "0.7571731", "0.7510738", "0.7266956", "0.72459733", "0.7204455", "0.70775634", "0.70301646", "0.68635684", "0.68635684", "0.6860699", "0.6833622", "0.6829853", "0.6808482", "0.6786134", "0.67701036", "0.6770095", "0.6681063", "0.66643727", "0.66643727", "0.66412467", "0.6638...
0.8325066
0
You are given a 2 dimensional data, as a nested lists, which is similar to matrix, however, unlike matrices, it may have different number of columns and rows. Given lst, and integer x, find integers x in the list, and return list of tuples, [(x1, y1), (x2, y2) ...] such that each tuple is a coordinate (row, columns), s...
def get_row(lst, x): # Please print out which line of the above program contains an error. E.g. if the bug is on line 4 then print 4 # END OF CONTEXT print("6") # END OF SOLUTION
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort(self,xy):\n xy.sort()\n #print xy\n x0=xy[0][0] # x of first tuple\n listy=[] # list of list of y values for given x\n listx=[] # list of x values\n ll=[]\n for i in xy:\n if(i[0] == x0): # change of x\n ll.append(i[1])\n else:\n lis...
[ "0.674272", "0.6185431", "0.610712", "0.6088879", "0.60366356", "0.5917174", "0.58244884", "0.5702623", "0.56293917", "0.55819875", "0.55370504", "0.54331225", "0.5428363", "0.53880036", "0.5387001", "0.53840226", "0.53827626", "0.536883", "0.5346692", "0.53463584", "0.531792...
0.0
-1
Calculate received signal power received from another transmitter according to Friis transmission formula (free space). This can be substituted with a more accurate formula later on. CALCULATION IS DONE FROM THE RECEIVER PERSPECTIVE. i.e. The object calling the function.
def calculate_signal_power(self, sender, freq_range): distance = np.sqrt( np.power(self.x - sender.x, 2) + np.power(self.y - sender.y, 2)) avg_frequency = np.average(freq_range) * 1e6 wavelength = settings.speed_of_light / avg_frequency received_signal_power = ( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcPower(self, inputs):\n if self.getAtt('available', inputs):\n possible_charge_rate = self.getAtt('possible_charge_rate', inputs)\n Vm = self.getAtt('Vm', inputs)\n P = possible_charge_rate * Vm\n if not self.stayConnected:\n P = P * self.cal...
[ "0.61260206", "0.5782018", "0.57050014", "0.56360364", "0.5605495", "0.55946743", "0.55897003", "0.55162644", "0.55079454", "0.5502509", "0.54827815", "0.54756224", "0.5474993", "0.5459773", "0.54442394", "0.54292107", "0.5421081", "0.5417615", "0.5400089", "0.5396992", "0.53...
0.71575606
0
Calculate throughput according to Shannon Capacity. Return value is in kbps
def calculate_throughput(self,sender,noise_from_other_devices): B = 0 sig_pow = 0 for freq_range in sender.currently_used_frequencies: B += (freq_range[1] - freq_range[0]) * 1000 #kHz sig_pow += self.calculate_signal_power(sender, freq_range)\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def throughput(self):\n return self.cwnd_from_file * self.mss / self.rtt", "def throughput(self) -> Optional[int]:\n return pulumi.get(self, \"throughput\")", "def throughput(self) -> Optional[int]:\n return pulumi.get(self, \"throughput\")", "def throughputbin(conn):\n c = conn.curso...
[ "0.7358087", "0.69442177", "0.69442177", "0.6904347", "0.6880202", "0.6880085", "0.6880085", "0.6880085", "0.624557", "0.614641", "0.61387426", "0.6009478", "0.5998741", "0.5956967", "0.59455633", "0.59445304", "0.59200335", "0.5916807", "0.5891796", "0.586625", "0.5807531", ...
0.6495137
8
Calculate the received power from each possible user to determine who we can communicate with.
def update_users_in_range(self, user_list): self.users_in_range = [] for user in user_list: if user != self: for freq_range in user.currently_used_frequencies: received_power = self.calculate_signal_power(user, freq_range) if rece...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manage_power(agent):\n total_active_power = agent.power_rating\n total_reactive_power = reactive_power(power_rating=total_active_power, power_factor=agent.power_factor)\n # power_surplus > 0 ==> incoming_power exceeds power demand\n if agent.incoming_power > 0:\n incoming_power = agent.incom...
[ "0.60773253", "0.58176035", "0.56342834", "0.5539435", "0.5536529", "0.55362797", "0.55271864", "0.5498496", "0.546873", "0.5447735", "0.54470223", "0.5441058", "0.5441058", "0.54154587", "0.5361145", "0.5326284", "0.5287118", "0.52623767", "0.52477324", "0.5242587", "0.52007...
0.5109
30
Calculate the received power from each possible base_station to determine who we can communicate with. Can also be used to refresh the list if a nreaby station switches frequency and thus turns invisible.
def update_base_stations_in_range(self, base_station_list): self.base_stations_in_range = [] for station in base_station_list: # Don't compare a base station with itself if station != self: for freq_range in station.currently_used_frequencies: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_list():", "def kick_all_passengers(self):\n\n changed_lines = self.__stations_dict.keys()\n for line in changed_lines:\n if line in self.__bus_dict:\n self.__message_sender.send_line(line, update_passengers=True)\n self.__stations_dict = {}", "def open_a...
[ "0.5736611", "0.5622538", "0.56059015", "0.54758173", "0.5434806", "0.5361476", "0.5348425", "0.5299765", "0.5280472", "0.52715003", "0.52699375", "0.5267048", "0.52638125", "0.5251505", "0.5237092", "0.5202273", "0.51876175", "0.51876175", "0.5160817", "0.515068", "0.5136238...
0.6616486
0
Updates a document with various segmentations and creates an sem.corpus (CoNLLformatted data) using field argument as index.
def process_document(self, document, **kwargs): start = time.time() if self._log_file is not None: map_annotations_logger.addHandler(file_handler(self._log_file)) map_annotations_logger.setLevel(self._log_level) ref_annotation = document.annotation(self._an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def document_segmentation(document, tokeniser,\r\n field=u\"word\",\r\n log_level=logging.WARNING, log_file=None):\r\n \r\n start = time.time()\r\n \r\n if log_file is not None:\r\n segmentation_logger.addHandler(file_handler(log_file))\r\n se...
[ "0.63489574", "0.581336", "0.5767562", "0.57373685", "0.5708803", "0.56358254", "0.55094427", "0.546028", "0.54463077", "0.54254484", "0.54246575", "0.54184794", "0.53777117", "0.53563917", "0.53339285", "0.53049004", "0.52577424", "0.52282137", "0.51846313", "0.51715267", "0...
0.0
-1
add a line to a SVG group
def addToGroup(self, frontorback, drawing, svggroup, **extra): super(byA_FB_SideLine, self).addToGroup(drawing, svggroup, **extra)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_svg_line(points_list, parent, style):\n line_attribs = {'style': simplestyle.formatStyle(style),\n inkex.addNS('label', 'inkscape'): 'line',\n 'd': to_path_string(points_list, False)}\n\n inkex.etree.SubElement(parent, inkex.addNS('path', 'svg'), line_attribs)",...
[ "0.6765925", "0.6018009", "0.5968184", "0.5929282", "0.59292215", "0.58818865", "0.5871255", "0.58446777", "0.58432126", "0.5815739", "0.5812686", "0.57987815", "0.57962376", "0.57535255", "0.575127", "0.57409406", "0.571864", "0.56766874", "0.56713814", "0.5660027", "0.56500...
0.7344968
0
Fetches new github commits
async def fetch_commits(self): for repo in self.config['repos'].split(','): since = datetime.min async for msg in self.channel.history(limit=None): if not msg.embeds: continue e = msg.embeds[0] if e.title == 'github comm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch():\n project = get_project(require=True)\n resp = request('post', '/api/v0/projects/{id}/fetch/'.format(id=project.id))\n data = resp.json()\n commits = data.get('commits', ())\n if commits:\n for commit in commits:\n success('Fetched: {ref} ({identifier})'.format(ref=com...
[ "0.75750375", "0.74212277", "0.69381", "0.64448285", "0.6438989", "0.64219135", "0.64179325", "0.6414816", "0.64099866", "0.6344521", "0.6343075", "0.6340277", "0.6335508", "0.63086504", "0.6268753", "0.6132046", "0.6079412", "0.60743535", "0.5987012", "0.59716344", "0.595498...
0.7687702
0
Shows info about a github user/repository Provide as "thesadru" or "thesadru/culturebot"
async def github(self, ctx: commands.Context, *, path: str): user, _, repo = path.replace(' ', '/', 1).partition('/') if repo: async with self.bot.session.get( f"https://api.github.com/repos/{user}/{repo}", headers={"Authorization": f"token {self.config['token...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def githubinfo_command(self, ctx, *, githubusername: str):\n async with aiohttp.ClientSession() as session:\n async with session.get(\n f\"https://api.github.com/users/{githubusername}\"\n ) as resp:\n githubinfo = await resp.json()\n ...
[ "0.74447393", "0.7021837", "0.6970902", "0.6782444", "0.65884364", "0.6436053", "0.639084", "0.6308251", "0.6302997", "0.62871265", "0.6279263", "0.6150466", "0.6147615", "0.61308235", "0.6064066", "0.6040957", "0.5977029", "0.594144", "0.5939721", "0.5927862", "0.5872469", ...
0.6716188
4
Return True if user is in the group, False otherwise.
def is_user_in_group(user, group): if type(group) is not Group: raise ValueError("Not a valid group") if type(user) is not str: raise ValueError("Not a valid user") user_name = find_user(user, group) if user_name == "": return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_user_in_group(user, group):\n users = group.get_users()\n if user in users:\n return True\n return False", "def is_in_group(user, group_name):\n return is_in_group_user_id(user.id, group_name)", "def is_user_in_group(user, group):\n\n if user == group.get_name():\n return Tr...
[ "0.8791304", "0.84474826", "0.8253319", "0.81782854", "0.8154014", "0.80775934", "0.8077066", "0.7917411", "0.79046553", "0.78879106", "0.7874985", "0.78737533", "0.7837497", "0.7784908", "0.7714273", "0.7684502", "0.76652265", "0.7655611", "0.7571193", "0.7561973", "0.737242...
0.7991211
7
v[0] = theta Latitude v[1] = phi Longitude
def spherical2cartesian(v): x = np.cos(v[0]) * np.cos(v[1]) y = np.cos(v[0]) * np.sin(v[1]) z = np.sin(v[0]) return [x,y,z]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xyz(phi, theta):\n x = cos(theta) * cos(phi)\n y = cos(theta) * sin(phi)\n z = sin(theta)\n loc = asarray([x,y,z])\n return(loc)", "def t2v(T):\n x = T[0, 2]\n y = T[1, 2]\n theta = np.arctan2(T[1, 0], T[0, 0])\n v = np.array([x, y, theta])\n return v", "def uvmap(self, p):\n # l...
[ "0.66489136", "0.6570035", "0.64525616", "0.6346985", "0.63155854", "0.6270639", "0.6270408", "0.6258027", "0.625073", "0.6243341", "0.6194001", "0.619318", "0.6129875", "0.6124875", "0.6111353", "0.6087798", "0.6058893", "0.60422945", "0.60274965", "0.60226613", "0.6003796",...
0.55912715
70
Take an array of lenght 3 correspoingt to a 3dimensional vector and returns a array of lenght 2 with latitade (inclination) and longitude (declination)
def cartesian2spherical(v): theta = np.arcsin(v[2]) phi = np.arctan2(v[1], v[0]) return [theta, phi]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector(self):\n return np.array([self.lat, self.lng])", "def ll2xyz(lon_pt,lat_pt):\n\n xPt = np.cos(lat_pt) * np.cos(lon_pt)\n yPt = np.cos(lat_pt) * np.sin(lon_pt)\n zPt = np.sin(lat_pt)\n return [xPt,yPt,zPt]", "def geo_m_v2(data_array):\n r = 6378.137 #promien ziemi w km\n ...
[ "0.6403682", "0.62953746", "0.6208549", "0.61141884", "0.6075391", "0.60709894", "0.5998875", "0.5962572", "0.5930136", "0.59059614", "0.58831966", "0.58795285", "0.5847779", "0.5811129", "0.58089334", "0.5789585", "0.57749873", "0.5774589", "0.5741308", "0.57288724", "0.5725...
0.0
-1
Return True if the number it was passed is an odd number. Return False if the number it was passed is an even number.
def is_odd(number): return number % 2 != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_odd(number: int) -> bool:\n return number % 2 != 0", "def is_odd(number):\n return (number%2)==1", "def is_odd(n):\n if n % 2:\n return True\n else:\n return False", "def is_odd(x):\n return x % 2 != 0", "def isOdd (n):\n if type(n) != int:\n return False\n ...
[ "0.8910139", "0.88778764", "0.86567736", "0.85502493", "0.84932417", "0.8464938", "0.84520775", "0.8422581", "0.83795774", "0.835107", "0.8337976", "0.83243823", "0.8289874", "0.8273915", "0.8243354", "0.82220197", "0.8118846", "0.8059153", "0.79635155", "0.7933069", "0.79226...
0.8937428
0
>>> from datetime import datetime >>> do_datetime(datetime(2014, 1, 21, 5, 2, 0))
def do_datetime(dt, format=None): if dt is None: # By default, render an empty string. return '' if format is None: # No format is given in the template call. Use a default format. # # Format time in its own strftime call in order to: # 1. Left-strip leading 0 in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _date_to_datetime(value):\r\n assert isinstance(value, datetime.date)\r\n return datetime.datetime(value.year, value.month, value.day)", "def datetime_object(__date):\n if isinstance(__date, datetime.datetime):\n return datetime.datetime(__date.year, __date.month, __date.day, __date.hour, __d...
[ "0.69720894", "0.66332227", "0.6568906", "0.6545804", "0.6539519", "0.65378284", "0.6504533", "0.6499593", "0.6314397", "0.6268944", "0.62330896", "0.62122756", "0.62007934", "0.6174209", "0.6147361", "0.61114347", "0.60890085", "0.6085074", "0.6081719", "0.60671353", "0.6063...
0.0
-1
>>> from datetime import date >>> do_date(date(2014, 1, 13)) '20140113 Monday' >>> do_date(None) ''
def do_date(dt, format='%Y-%m-%d - %A'): if dt is None: return '' # Only difference with do_datetime is the default format, but that is # convenient enough to warrant its own template filter. return dt.strftime(format)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_to_string(my_date):\n if my_date:\n return my_date.strftime(DATE_FORMAT)\n return None", "def get_date(date):\n return date", "def process_datetime(a_date: datetime) -> str:\n\n return str(a_date.date()) if a_date else Presenter.DEFAULT", "def to_date_or_none(value: Optional[U...
[ "0.65349555", "0.65142083", "0.6289463", "0.62881124", "0.62800014", "0.6277747", "0.6231417", "0.6231417", "0.6181932", "0.61784095", "0.60995704", "0.6092293", "0.6089748", "0.6086101", "0.6046179", "0.59914243", "0.59520066", "0.59492534", "0.59133357", "0.590625", "0.5903...
0.6233514
6
>>> do_duration(8000) '0 day, 2 hours, 0 minutes, 0 seconds'
def do_duration(seconds): m, s = divmod(seconds, 60) h, m = divmod(m, 60) d, h = divmod(h, 24) tokens = [] tokens.append(one_many(d, '{d} day')) tokens.append(one_many(h, '{h} hour')) tokens.append(one_many(m, '{d} minute')) tokens.append(one_many(s, '{d} second')) template = ', '.jo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def say_duration(duration):\r\n result = []\r\n for d in ['day', 'hour', 'minute', 'second']:\r\n if duration[d] == 1:\r\n result.append(\"{0} {1}\".format(duration[d], d))\r\n if duration[d] > 1:\r\n result.append(\"{0} {1}s\".format(duration[d], d))\r\n if result:\r\n...
[ "0.79546064", "0.785983", "0.74646884", "0.7433196", "0.72565824", "0.7216425", "0.7124735", "0.7037477", "0.6948589", "0.6943271", "0.67773587", "0.6773942", "0.6714449", "0.6675341", "0.66656", "0.6648351", "0.6636749", "0.6618495", "0.6604794", "0.66005135", "0.6571271", ...
0.7955701
0
>>> one_many(1, '{d} day') '{d} day' >>> one_many(2, '{d} day') '{d} days'
def one_many(number, str_duration): return str_duration + 's' if number > 1 else str_duration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_many1(self):\n\n xs = t.Many1(t.Exactly(\"x\"))\n self.assertEqual(writePython(xs),\n dd(\"\"\"\n def _G_many1_1():\n _G_exactly_2, lastError = self.exactly('x')\n self.considerEr...
[ "0.57898444", "0.5183852", "0.49592152", "0.4934458", "0.49110043", "0.4846958", "0.4706555", "0.4673666", "0.45450735", "0.45241177", "0.45239285", "0.44858345", "0.4443756", "0.44393557", "0.44370747", "0.44303963", "0.44048327", "0.44039005", "0.4373759", "0.43677723", "0....
0.6458752
0
move to nav item
def move_to_nav(self,num=2): self.move_to_element("xpath->//ul[@id='headerNav']/li[%s]" % num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_menu_item(self, name):\n from modules.pages.contact_us_page import ContactUsPage\n menu_pages = {UIC.MENU_PLATFORM: PlatformPage,\n UIC.MENU_SOLUTIONS: SolutionsPage,\n UIC.MENU_ABOUT_US: AboutUsPage,\n UIC.MENU_CONTACT_US: Conta...
[ "0.63784087", "0.623346", "0.6048475", "0.5944718", "0.5752141", "0.57504153", "0.5703136", "0.569433", "0.5674312", "0.56644297", "0.56479615", "0.5613031", "0.56083614", "0.5589197", "0.55327857", "0.5519775", "0.5515736", "0.54966897", "0.54966897", "0.54966897", "0.549668...
0.7308112
0
click and get nav item
def click_nav(self,num=2): self.click("xpath->//ul[@id='headerNav']/li[%s]" % num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sidebar_click(sidebar_item):\n #print('sidebar_click')\n sidebar = driver.find_element_by_class_name('m-menu__nav')\n return click_on(sidebar_item, scope=sidebar)", "def get_menu_item(menu_item_name):\n\n pass", "def getMenuItem(self, event):\n return self.GetMenuBar().FindItemById(event.Get...
[ "0.6431703", "0.6209024", "0.60301465", "0.588942", "0.5877723", "0.58067155", "0.57894486", "0.57894486", "0.5783159", "0.56954354", "0.5683426", "0.56516695", "0.5601901", "0.55922246", "0.5554369", "0.55407244", "0.549524", "0.5475049", "0.5438124", "0.5397154", "0.5391862...
0.6951613
0
Reads data from dataframe data containing path to images in column 'path' and, in case of dataframe, also containing artist name, technique name, and period of creation for given artist. In case of content images we have only the 'path' column.
def get_batch(self, augmentor, batch_size=1): batch_image = [] for _ in range(batch_size): image = scipy.misc.imread(name=random.choice(self.dataset), mode='RGB') if max(image.shape) > 1800.: image = scipy.misc.imresize(image, size=1800. / max(image.shape)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadDataOrig(df, path, im_shape, disp_names=False):\r\n X, y = [], []\r\n for i, item in df.iterrows():\r\n if disp_names == True:\r\n print('i={} {} {}\\n'.format(i, path + item[0], path + item[1]))\r\n img = io.imread(path + item[0])\r\n img = transform.resize(img, im_sh...
[ "0.648307", "0.6394734", "0.6227284", "0.6157809", "0.6129117", "0.57942325", "0.57618886", "0.57390696", "0.57257617", "0.56972086", "0.5583221", "0.55744785", "0.5561718", "0.5538594", "0.5533018", "0.5451843", "0.5438273", "0.5414525", "0.53982335", "0.53951627", "0.539413...
0.0
-1
Constructs the parent path of the folder where the files of this class are held
def _get_parent_path(self): return os.path.join(os.getcwd(), "src", "data", "genes")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_dir(self):\n parent = os.path.dirname(self.dirn)\n if self.is_subdir:\n parent = os.path.basename(parent)\n else:\n if self.platform is not None and parent.endswith(self.platform):\n parent = parent[:-len(self.platform)].rstrip(os.sep)\n ...
[ "0.7516042", "0.7425503", "0.7233814", "0.7187311", "0.708849", "0.70793384", "0.6989474", "0.6972251", "0.6928673", "0.68959326", "0.68793297", "0.6850787", "0.68455803", "0.6822468", "0.68000185", "0.67682356", "0.6768187", "0.6763842", "0.67598325", "0.67461765", "0.673264...
0.81032115
0
Constructs and returns the gene file paths
def _get_gene_file_path(self): return os.path.join(os.getcwd(), "src", "data", "genes", "genes.txt")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genome_paths(self, ext=\"fasta\"):\n return [\n os.path.join(self.path, genome)\n for genome in os.listdir(self.path)\n if genome.endswith(ext)\n ]", "def setup_filepaths():\n if organism == 'cerevisiae':\n biogridpath = os.path.join('..', 'data', \n ...
[ "0.6801986", "0.6463004", "0.63174415", "0.6131427", "0.6107057", "0.59613675", "0.59605056", "0.5920906", "0.58928406", "0.5882822", "0.58670783", "0.5866723", "0.58401537", "0.58361024", "0.5833032", "0.5823612", "0.58002096", "0.5796087", "0.5743622", "0.5667002", "0.56579...
0.75735086
0
Loads the genes into the class gene_ids
def _load_genes(self): with open(self.gene_file_path, 'r') as gene_file: csv_reader = csv.reader(gene_file, delimiter=',') for gene in csv_reader: yield (gene[self.GENE_NAME_IDX], gene[self.GENE_ID_IDX])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_gene_ids(self, genes_list):\n orig_num_genes = len(self.genes)\n\n for g in list(set(genes_list)):\n if not self.genes.has_id(g):\n new_gene = GenePro(id=g, pdb_file_type=self.pdb_file_type, root_dir=self.genes_dir)\n if self.model:\n ...
[ "0.66729474", "0.66438574", "0.66160977", "0.6368416", "0.6222823", "0.616151", "0.60341156", "0.5939436", "0.5897515", "0.5890509", "0.58519554", "0.58203644", "0.57946724", "0.57890147", "0.57806593", "0.5742939", "0.57355374", "0.5728091", "0.57230425", "0.571332", "0.5696...
0.7522899
0
Builds the file path to the organisms file of the given gene name and ID
def _get_organisms_file_path(self, gene_name, gene_id): return os.path.join(os.getcwd(), "src", "data", "organisms", "{}_{}.txt".format(gene_name, gene_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_gene_file_path(self):\n return os.path.join(os.getcwd(), \"src\", \"data\", \"genes\", \"genes.txt\")", "def get_organisms_genes(self):\n path = os.path.join(self.parent_path, \"organisms_genes.txt\")\n with open(path, \"w\") as freqs:\n freqs.write(\"Organism,Genes\\n\")...
[ "0.5999423", "0.59490174", "0.5756022", "0.56829166", "0.56753504", "0.5670816", "0.5629179", "0.56172353", "0.56054807", "0.55734795", "0.55691856", "0.5535874", "0.54451907", "0.54241616", "0.53895986", "0.53739434", "0.5357763", "0.53570634", "0.5334147", "0.5289614", "0.5...
0.8304314
0
Responsible for loading all the organisms curated for the list of genes of interest. Builds and returns two maps one mapping each organism to its genes and one mapping each gene to its organisms
def _load_orgs_and_genes(self): organisms = {} genes = {} for gene in self.gene_ids: org_file_path = self._get_organisms_file_path(gene[self.GENE_NAME_IDX], gene[self.GENE_ID_IDX]) with open(org_file_path, "r") as orgs: org = orgs.read().splitlines() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_organisms_genes(self):\n path = os.path.join(self.parent_path, \"organisms_genes.txt\")\n with open(path, \"w\") as freqs:\n freqs.write(\"Organism,Genes\\n\")\n for org, data in self.organisms.items():\n genes = \"\"\n for gene in data.get(...
[ "0.7257849", "0.6969675", "0.65355396", "0.59686047", "0.59212977", "0.5901838", "0.5866191", "0.5773964", "0.5670796", "0.5636288", "0.56034166", "0.55489737", "0.5502659", "0.54966867", "0.54793173", "0.5463934", "0.54597753", "0.5455461", "0.5452701", "0.54415894", "0.5440...
0.8302835
0
Builds a file containing the gene frequencies of each organism
def get_gene_frequencies(self): path = os.path.join(self.parent_path, "gene_frequencies.txt") with open(path, "w") as freqs: freqs.write("Organism,Gene Frequency\n") for org, data in self.organisms.items(): freqs.write("{},{}\n".format(org, data.get(self.FREQ_KEY)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_organisms_genes(self):\n path = os.path.join(self.parent_path, \"organisms_genes.txt\")\n with open(path, \"w\") as freqs:\n freqs.write(\"Organism,Genes\\n\")\n for org, data in self.organisms.items():\n genes = \"\"\n for gene in data.get(...
[ "0.6712296", "0.629522", "0.6098355", "0.60669476", "0.599409", "0.5991727", "0.59792763", "0.5972482", "0.59362316", "0.59301496", "0.5923917", "0.5902305", "0.587066", "0.5810633", "0.5787571", "0.57831913", "0.57830215", "0.57779163", "0.57060593", "0.5686999", "0.56859577...
0.8010384
0
Builds a file containing which organisms a gene appears in
def get_genes_organisms(self): path = os.path.join(self.parent_path, "genes_organisms.txt") with open(path, "w") as f: f.write("Gene,Organisms\n") for gene in self.genes.keys(): f.write("{},{}".format(gene, "/".join(self.genes.get(gene).keys()) + "\n"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_organisms_genes(self):\n path = os.path.join(self.parent_path, \"organisms_genes.txt\")\n with open(path, \"w\") as freqs:\n freqs.write(\"Organism,Genes\\n\")\n for org, data in self.organisms.items():\n genes = \"\"\n for gene in data.get(...
[ "0.794365", "0.67426956", "0.66816664", "0.6313496", "0.6175617", "0.6159461", "0.60158247", "0.5918782", "0.59116703", "0.5909354", "0.58925825", "0.58855027", "0.5876534", "0.5863022", "0.5852412", "0.5731719", "0.5703419", "0.565085", "0.56269586", "0.56260884", "0.5610541...
0.7951638
0
Builds a file containing the genes exhibited by each organism
def get_organisms_genes(self): path = os.path.join(self.parent_path, "organisms_genes.txt") with open(path, "w") as freqs: freqs.write("Organism,Genes\n") for org, data in self.organisms.items(): genes = "" for gene in data.get(self.GENE_IDS_KEY): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_genes_organisms(self):\n path = os.path.join(self.parent_path, \"genes_organisms.txt\")\n with open(path, \"w\") as f:\n f.write(\"Gene,Organisms\\n\")\n for gene in self.genes.keys():\n f.write(\"{},{}\".format(gene, \"/\".join(self.genes.get(gene).keys()...
[ "0.6994183", "0.62892514", "0.61515087", "0.606735", "0.6034793", "0.6006025", "0.6001628", "0.58848614", "0.5883449", "0.5781529", "0.5773816", "0.57700855", "0.5767919", "0.57626975", "0.5721481", "0.57126635", "0.57104987", "0.57042205", "0.5698435", "0.56948847", "0.56536...
0.7444359
0
Constructs and returns the EBI url
def _construct_ebi_taxon_url(self, org): split = self._parse_organism_name(org) return "http://www.ebi.ac.uk/ena/data/taxonomy/v1/taxon/scientific-name/{}%20{}".format(split[0], split[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_url(self):\n ...", "def build_url(self, endpoint_url: str) -> str:\n return self.base_url + endpoint_url % self.instance_id", "def _build_url(self):\n url = BASE_URL.format(self._host, self._port)\n _LOGGER.debug(\"TOON fetch URL: %s\", url)\n return url", "def Ur...
[ "0.7056419", "0.6922711", "0.69012517", "0.68858933", "0.6847581", "0.6778686", "0.6778686", "0.67280847", "0.67206544", "0.657591", "0.65436673", "0.6507789", "0.6495611", "0.64947647", "0.6466603", "0.64654285", "0.6457043", "0.6436351", "0.6387732", "0.63697004", "0.635730...
0.6440876
17
Returns the split organism name as (genus, species)
def _parse_organism_name(self, org): split_org = org.split() return split_org[0], split_org[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _format_organism_info(self, org, info):\n species_idx = 1\n split_org = self._parse_organism_name(org)\n return \",\".join(info.replace(\";\", \"\").split()) + \",{}\\n\".format(split_org[species_idx])", "def get_species_name(fasta):\n name = fasta.description\n if ',' in name:\n ...
[ "0.646665", "0.6447309", "0.6158343", "0.6056546", "0.60517704", "0.60313845", "0.59915733", "0.58163685", "0.58135873", "0.5806952", "0.5765122", "0.57254785", "0.5696996", "0.56775403", "0.5658982", "0.5649861", "0.5647005", "0.5640148", "0.56336176", "0.56233454", "0.56070...
0.6820799
0
Creates a nicely formatted string to add to organisms.txt
def _format_organism_info(self, org, info): species_idx = 1 split_org = self._parse_organism_name(org) return ",".join(info.replace(";", "").split()) + ",{}\n".format(split_org[species_idx])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_formatted_string(self):\n string = NALSyntax.StatementSyntax.Start.value + \\\n self.get_subject_term().get_formatted_string()\n\n string += \" \" + self.get_copula_string() + \" \"\n\n string += self.get_predicate_term().get_formatted_string() + \\\n NALSyntax....
[ "0.5992396", "0.59910434", "0.5967836", "0.59130067", "0.58954525", "0.5876477", "0.585665", "0.5854676", "0.5846432", "0.5830909", "0.5823335", "0.5782792", "0.57779396", "0.5777004", "0.5766911", "0.5761065", "0.5758965", "0.5752614", "0.5749041", "0.5735354", "0.57322717",...
0.67078245
0
Viterbi derivation using the MaxTimes semiring.
def viterbi_derivation(forest, tsort, omega=lambda e: e.weight, generations=10, node_values=None, edge_values=None): root = tsort.root() if node_values is None: node_values = compute_values(forest, tsort, semiring=MaxTimes, omega=omega, infinity=generations) d = sample_one(forest, root, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deriv(self, t: float, endBehavior: str = 'halt') -> Vector:\n return self.deriv_state(t,endBehavior)", "def derv(self, t, y):\n x = y[0];\n xc = y[1];\n n = y[2];\n\n Bhat = self.G * (1.0 - n) * self.alpha0(t) * (1 - 0.4 * x) * (1 - 0.4 * xc);\n\n dydt = np.zeros(3)\...
[ "0.58219033", "0.56157297", "0.5590959", "0.55673176", "0.5501021", "0.54774886", "0.545786", "0.543763", "0.54316425", "0.5418838", "0.54103255", "0.53980565", "0.53941154", "0.5382634", "0.5382634", "0.53287655", "0.5307189", "0.5275985", "0.52446187", "0.5242827", "0.52337...
0.5901211
0
Single source shortest path algorithm from s to t
def dijkstra(G, s, t, heap_type): n = len(G.V) d = {} #temporary distance function scanned = set() p = {} #Optimal path # Initialize distances to Infinity for v in G.V: if v == s: d[v] = 0 p[s] = s else: d[v] = float('inf') p[v] = None labelled = make_heap(heap_type) no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constructShortestPath(self):\r\n sp = []\r\n v = self.t\r\n while self.preds[v]: # is not None\r\n sp.append(v)\r\n v = self.preds[v]\r\n sp.append(self.s) # source\r\n sp.reverse() # to have the path from source to dest and not t to s\r\n retu...
[ "0.76858926", "0.7450117", "0.7302542", "0.72764516", "0.7027004", "0.69292843", "0.6927332", "0.69209456", "0.68980163", "0.6840069", "0.6810618", "0.6789855", "0.67759067", "0.6717231", "0.6713864", "0.6705973", "0.6703101", "0.6675219", "0.66694856", "0.66680837", "0.66653...
0.0
-1
Return the field, without its values. Actual values can be retrieved with read_values() method.
def read_field(self, fieldname): if fieldname in ['wind_speed', 'wind_direction']: # create a virtual field variable = Variable( shortname=fieldname, description=VIRTUALFIELD_DESCR[fieldname], authority=self.get_naming_authority...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field(self):\n return None", "def field(self):\r\n return self.value", "def get(self):\n return self.field.copy()", "def field(self) -> Optional[str]:\n return pulumi.get(self, \"field\")", "def read_fillvalue(self, fieldname):\n return self.read_field(fieldname).fill...
[ "0.6961342", "0.6920321", "0.6787121", "0.6623858", "0.6600951", "0.6576376", "0.6516199", "0.6516199", "0.6516199", "0.6516199", "0.64795893", "0.6435257", "0.6417333", "0.63878626", "0.6380598", "0.63561904", "0.62878627", "0.62739205", "0.6262821", "0.6252768", "0.624512",...
0.0
-1
init most variables, this functions helps no going through each files too many times
def initVariables(self): lines = self.getLines() self.__numberOfWords = 0 wordsSet = set() for line in lines: self.__numberOfWords += line.count(' ') - 2 for word in line.split(' ')[0:-2]: wordsSet.add(word) self.__nbOfLines = len(lines) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_from_file(self):\n self.src.load('start.00') \n self.oe1.load('start.01')\n #self.det.load('start.02')\n print('NOTE: variables loaded from start.00/start.01 files')", "def file_init():\r\n answer_files, ran, answers = initialize_files(\"DBF_\", 15, \".txt\")\r\n answ...
[ "0.6975851", "0.69505644", "0.6723696", "0.6712589", "0.6662356", "0.6592179", "0.6575588", "0.65315586", "0.6516065", "0.64769256", "0.64480644", "0.6440904", "0.641317", "0.64073575", "0.64018905", "0.63542193", "0.6286936", "0.6261751", "0.62603885", "0.6254381", "0.622372...
0.630641
16
care for if speaker id is b the lines will be returned from the last to the first
def getLines(self): f = open(self.__father.getpath() + self.__father.getidFile() + ".TRN", "r") lines = f.readlines() subUnitLines = [] if self.__speakerId == "A": for line in lines: if self.__speakerId == line.split("-")[-2]: subUnitLines...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speaker_sequence(self, speaker_id, n):\n seq = []\n for i in range(n):\n seq.append(speaker_id)\n speaker_id = self.after(speaker_id)\n return seq", "def transcript_lines(transcript_text):\n lines = []\n for line in transcript_text.splitlines():\n if li...
[ "0.5758805", "0.5695762", "0.52602303", "0.5214662", "0.52095467", "0.51924115", "0.5182535", "0.4993569", "0.4979", "0.49647054", "0.49508744", "0.49474433", "0.49418852", "0.49197292", "0.48420635", "0.48403987", "0.48385614", "0.4829934", "0.4820813", "0.48027512", "0.4756...
0.59322
0
The DOM identifier for the window. This id can be used to target CSS directives
def id(self): return self._id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCurrentWindowId(*args):", "def set_window_id(self, window_id):\r\n self.window_id = window_id", "def wwid(self):\n return self._uuid", "def getApplicationwindowId(ReferenceID):\n try:\n ldtp.wait(5)\n window = ReferenceID.windows()[0]\n logging.info(\"Application ...
[ "0.6516393", "0.6120082", "0.59446776", "0.5920029", "0.5900118", "0.5791288", "0.57835513", "0.57835513", "0.573234", "0.57241225", "0.57094085", "0.5695665", "0.5678569", "0.5675281", "0.5675281", "0.56643987", "0.56610847", "0.5643739", "0.5641235", "0.563798", "0.56378937...
0.0
-1
Title of the window. If no title is given it defaults to "Toga".
def title(self): return self._title
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_window_title(self): # real signature unknown; restored from __doc__\n return \"\"", "def title(self):\n with switch_window(self._browser, self.name):\n return self._browser.title", "def winTitle(self, title):\n winTitle = title\n window = self.window\n wind...
[ "0.8147803", "0.7984767", "0.7839244", "0.7801168", "0.7501261", "0.74131125", "0.7408626", "0.7292664", "0.72558916", "0.72551167", "0.72146744", "0.7074396", "0.70315194", "0.7029961", "0.6991459", "0.6991459", "0.6991459", "0.69670624", "0.69670624", "0.69670624", "0.69607...
0.6905912
47
Toolbar for the window.
def toolbar(self): return self._toolbar
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createToolBar(self):\n pass", "def addToolBarButtons(self):", "def buildToolbarWidgets(self):\n self.clear()\n self.addToolBarButtons()\n self.addExitButton()", "def main_menu_toolbar():\n\n pass", "def create_tool_bar(self):\n tb = self.CreateToolBar(wx.TB_DEFAULT...
[ "0.7916344", "0.7885699", "0.7719043", "0.7566087", "0.754715", "0.753798", "0.74919164", "0.7483197", "0.7419077", "0.72754294", "0.7133032", "0.7123043", "0.70913476", "0.7058772", "0.7021701", "0.6989598", "0.6972086", "0.69364214", "0.68815565", "0.68749094", "0.68657184"...
0.7440295
8
Content of the window. On setting, the content is added to the same app as the window and to the same app.
def content(self): return self._content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetContent(self, window):\n window.SetName(\"content\")\n window.SetBackgroundColour(wx.GetApp().settings.bg_color)\n window.SetForegroundColour(wx.GetApp().settings.fg_color)\n window.SetFont(wx.GetApp().settings.text_font)", "def set_content(self, widget):\n\t\tpass", "def set...
[ "0.82179654", "0.6814457", "0.67617285", "0.6608389", "0.63617086", "0.6346334", "0.6324068", "0.62483495", "0.6187921", "0.61428005", "0.5995274", "0.59152335", "0.5830571", "0.5805026", "0.5802689", "0.5783157", "0.5765239", "0.57355183", "0.57273126", "0.57100695", "0.5694...
0.0
-1
Size of the window, as width, height.
def size(self): return self._size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self):\n\n\t\treturn self._window.size", "def _window_size(self):\n width = self.cv.winfo_width()\n if width <= 1: # the window isn't managed by a geometry manager\n width = self.cv['width']\n height = self.cv.winfo_height()\n if height <= 1: # the window isn't ma...
[ "0.826916", "0.78636795", "0.7831321", "0.7665548", "0.76204646", "0.7546724", "0.7529605", "0.74190944", "0.7234328", "0.70530164", "0.7042555", "0.7008061", "0.7008061", "0.7008061", "0.7008061", "0.7008061", "0.7008061", "0.7008061", "0.6982977", "0.6982969", "0.6979031", ...
0.0
-1
Position of the window, as x, y
def position(self): return self._position
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_window_position(self):\n self.x = SQUARE_SIZE * self.col + SQUARE_SIZE // 2\n self.y = SQUARE_SIZE * self.row + SQUARE_SIZE // 2", "def position(self):\n\n\t\treturn self._window.position", "def _pos(self):\n sw = self.parent.winfo_screenwidth()\n sh = self.parent.winf...
[ "0.83354396", "0.8195197", "0.8020839", "0.7639207", "0.7528871", "0.749939", "0.74910766", "0.7393557", "0.7348043", "0.7321052", "0.7280519", "0.71274126", "0.71274126", "0.71274126", "0.7094522", "0.7054128", "0.70499986", "0.7043386", "0.6989405", "0.6966289", "0.6966289"...
0.6458234
87
Show window, if hidden
def show(self): self._impl.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_window(self):\n self.show()", "def show(self, window):\r\n\r\n return", "def show(self):\n self._window.show()", "def show_window(self):\n self._window.grab_set()\n self._window.wait_window()", "def show(self):\n # * displays the window, after using either...
[ "0.812324", "0.7886207", "0.7681656", "0.76643115", "0.7583664", "0.7578163", "0.74663645", "0.74595016", "0.72505873", "0.7162127", "0.71114856", "0.708924", "0.7063544", "0.7059368", "0.70573133", "0.70428973", "0.7018202", "0.7014531", "0.6991582", "0.6964435", "0.69429064...
0.626804
73
Opens a info dialog with a 'OK' button to close the dialog.
def info_dialog(self, title, message): return self._impl.info_dialog(title, message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_info_dialog(self):\n info_dialog = InfoDialog()\n info_dialog.exec_()", "def on_info_click(self, event):\n def on_close(event, wind):\n wind.Close()\n wind.Destroy()\n event.Skip()\n wind = wx.PopupTransientWindow(self, wx.RAISED_BORDER)\n ...
[ "0.8259219", "0.71658874", "0.6957866", "0.6890818", "0.6767728", "0.67439896", "0.67373097", "0.6603612", "0.6554293", "0.64986795", "0.6409967", "0.6369525", "0.63324416", "0.63220555", "0.6310293", "0.62939674", "0.62877095", "0.6253959", "0.61893255", "0.6185355", "0.6177...
0.7097178
2
Opens a dialog with a 'YES' and 'NO' button.
def question_dialog(self, title, message): return self._impl.question_dialog(title, message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_yes_no(message=\"\", title=None):\n return dialog(\"ask_yes_no\", message=message, title=title)", "def yes_no_cancel_popup(title=None,\n text=None):\n d = gtk.Dialog(title=title,\n parent=None,\n flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_...
[ "0.79824096", "0.76647705", "0.7300554", "0.70973873", "0.70957583", "0.7007805", "0.6956098", "0.6921481", "0.6921154", "0.69128484", "0.68116885", "0.67715955", "0.6717134", "0.6709416", "0.6685706", "0.6633088", "0.66033435", "0.65917414", "0.65909696", "0.65606934", "0.65...
0.5837525
74
Opens a dialog with a 'Cancel' and 'OK' button.
def confirm_dialog(self, title, message): return self._impl.confirm_dialog(title, message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_ok_cancel(message=\"\", title=None):\n return dialog(\"ask_ok_cancel\", message=message, title=title)", "def yes_no_cancel_popup(title=None,\n text=None):\n d = gtk.Dialog(title=title,\n parent=None,\n flags=gtk.DIALOG_MODAL | gtk.DIALOG_DE...
[ "0.79191375", "0.7177982", "0.7058854", "0.6856819", "0.6810971", "0.6684592", "0.6684495", "0.66808194", "0.6618115", "0.6603177", "0.6600166", "0.6593605", "0.6579481", "0.6568944", "0.6566472", "0.65642804", "0.6554064", "0.65086174", "0.64967954", "0.64944935", "0.6431576...
0.63828766
23
Opens a error dialog with a 'OK' button to close the dialog.
def error_dialog(self, title, message): return self._impl.error_dialog(title, message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def errorDialog(self, errormessage):\n print('error')\n edialog = tk.tkMessageBox.showerror(self, 'Error', errormessage)", "def errorDialog(self, errormessage):\r\n Tk.tkMessageBox.showerror(self, 'Error', errormessage)", "def errorDialog(self, errormessage):\n\t\tedialog = wx.MessageDialo...
[ "0.77225745", "0.76459414", "0.7529965", "0.7455542", "0.74429506", "0.7437188", "0.7318622", "0.72694796", "0.72694415", "0.72", "0.7112292", "0.70772386", "0.69510216", "0.69183916", "0.6879932", "0.6771121", "0.67157257", "0.6680234", "0.6637841", "0.6632582", "0.6521221",...
0.74728507
3
Calling this function opens a dialog that allows to display a large text body in a scrollable fashion.
def stack_trace_dialog(self, title, message, content, retry=False): return self._impl.stack_trace_dialog(title, message, content, retry)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view(self):\n self.w = TextScrollCombo(self.master,\n self._df.to_string(header=True, max_rows=None, min_rows=None, max_cols=None))\n self.master.wait_window(self.w.top)", "def messageScrolled(self,message):\n from dialogs import speDialog\n if sys....
[ "0.63326555", "0.6221394", "0.5746161", "0.57382464", "0.56688756", "0.54964864", "0.5487231", "0.53827566", "0.53651875", "0.5295682", "0.52834153", "0.52803004", "0.52644503", "0.5260106", "0.5249087", "0.5240596", "0.5238577", "0.523563", "0.52305645", "0.5228717", "0.5214...
0.0
-1
This opens a native dialog where the user can select a place to save a file. It is possible to suggest a filename and force the user to use a specific file extension. If no path is returned (eg. dialog is canceled), a ValueError is raised.
def save_file_dialog(self, title, suggested_filename, file_types=None): return self._impl.save_file_dialog(title, suggested_filename, file_types)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_file(message=\"Select file for open.\", title=None):\n return dialog(\"ask_file\", message=message, title=title)", "def fileDialog(*args, application: bool=True, defaultFileName: AnyStr=\"\", directoryMask:\n AnyStr=\"\", mode: int=0, title: AnyStr=\"\", **kwargs)->AnyStr:\n pass", ...
[ "0.7408925", "0.73850614", "0.7220403", "0.70527846", "0.6985201", "0.69562143", "0.6954243", "0.6939839", "0.69356203", "0.69344085", "0.69100094", "0.690617", "0.6884399", "0.6876516", "0.68655914", "0.684181", "0.68266374", "0.6792314", "0.6770598", "0.6764503", "0.6695568...
0.7294479
2
This opens a native dialog where the user can select the file to open. It is possible to set the initial folder and only show files with specified file extensions. If no path is returned (eg. dialog is canceled), a ValueError is raised.
def open_file_dialog(self, title, initial_directory=None, file_types=None, multiselect=False): return self._impl.open_file_dialog(title, initial_directory, file_types, multiselect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fileDialog(*args, application: bool=True, defaultFileName: AnyStr=\"\", directoryMask:\n AnyStr=\"\", mode: int=0, title: AnyStr=\"\", **kwargs)->AnyStr:\n pass", "def ask_file(message=\"Select file for open.\", title=None):\n return dialog(\"ask_file\", message=message, title=title)", ...
[ "0.76149505", "0.75887764", "0.7514204", "0.7512995", "0.7493741", "0.74327594", "0.7362546", "0.7331848", "0.7299773", "0.72536474", "0.72374344", "0.71717244", "0.7113339", "0.7035079", "0.7017773", "0.701149", "0.6960194", "0.69411033", "0.6916474", "0.68990165", "0.688893...
0.7920909
0
This opens a native dialog where the user can select a folder. It is possible to set the initial folder. If no path is returned (eg. dialog is canceled), a ValueError is raised.
def select_folder_dialog(self, title, initial_directory=None, multiselect=False): return self._impl.select_folder_dialog(title, initial_directory, multiselect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_folder(self):\r\n\r\n root = Tkinter.Tk()\r\n root.withdraw()\r\n diroption = {}\r\n diroption['initialdir'] = '.'\r\n diroption['mustexist'] = False\r\n diroption['parent'] = root\r\n diroption['title'] = 'Select a directory to organize'\r\n retur...
[ "0.7975965", "0.7914239", "0.7769091", "0.7391767", "0.7360317", "0.7279071", "0.72332084", "0.7215742", "0.7138055", "0.7098083", "0.7078011", "0.6972983", "0.6933139", "0.6930957", "0.69294643", "0.6921932", "0.6871297", "0.6791354", "0.67841876", "0.67575437", "0.6756537",...
0.7796286
2
Builds client_init, client_step, client_final for for_each_client.
def create_train_for_each_client(grad_fn, client_optimizer): def client_init(server_params, client_rng): opt_state = client_optimizer.init(server_params) client_step_state = { 'params': server_params, 'opt_state': opt_state, 'rng': client_rng, } return client_step_state def...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_compute_clients(self):\n\n print \"\\t* instantiating clients\"\n # instantiate nova client\n self.gen_nova_client()\n\n # instantiate neutron client\n self.gen_neutron_client()\n\n # instantiate heat client (used to validate templates)\n self.gen_heat_clie...
[ "0.63728994", "0.6033087", "0.5908199", "0.5752185", "0.5739272", "0.57106054", "0.56500596", "0.563913", "0.5635348", "0.5624539", "0.56128895", "0.5568599", "0.55664706", "0.5552906", "0.54882747", "0.5395813", "0.53645706", "0.53471327", "0.5304894", "0.52946997", "0.52399...
0.582314
3
Parse a Card Object from it's string representation
def from_string(string): if len(string) == 2: value = string[0] elif len(string) == 3: value = string[:2] else: raise ValueError(f"cannot parse card from {repr(string)} invalid length") suit = string[-1] if (value not in STRING_TO_VALUE_MAPP...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_card_representation(cards_string):\n cards_string = cards_string.split()\n cards = list()\n for card in cards_string:\n if len(card) != 2:\n raise Exception(\"The card should be represented by 2 characters,\"\n \" got '%s'\" % cards_string)\n n...
[ "0.74304885", "0.65599", "0.6112448", "0.6071192", "0.59783554", "0.5888686", "0.58846676", "0.58517516", "0.58509004", "0.58192426", "0.5787652", "0.5740318", "0.57373387", "0.570132", "0.56658304", "0.5659433", "0.5654869", "0.5651489", "0.5650546", "0.5644746", "0.56178224...
0.68890905
1
Finds the smallest item in a list starting at a given index
def find_min(start, user_list): minimum = start for j in range(start, len(user_list)): if user_list[minimum].value > user_list[j].value: minimum = j return minimum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_min(list):\n return find_value_at(list, -1)", "def find_smallest(list):\n smallest_index = 0\n smallest_number = list[0]\n for index, number in enumerate(list):\n if number < smallest_number:\n smallest_index = index\n smallest_number = number\n del list[small...
[ "0.80789644", "0.7943173", "0.7936158", "0.78641474", "0.7806867", "0.77677035", "0.75502586", "0.74800456", "0.7433551", "0.741327", "0.7316826", "0.72551984", "0.7238463", "0.72347677", "0.72340626", "0.71827656", "0.7154592", "0.70994294", "0.7073256", "0.7060353", "0.7023...
0.69554347
24
Sorts the list using selection sort algorithm and draws rectangles representing items in the list as they are being sorted
def selection_sort(master, canvas, user_list): for i in range(len(user_list)): low = find_min(i, user_list) canvas.delete(user_list[i].object) canvas.delete(user_list[low].object) user_list[i], user_list[low] = user_list[low], user_list[i] user_list[i].iteration = i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_sorting(self):\n if self.sorting:\n return None\n self.sorting = True\n\n passes = 0\n while self.sorting:\n swap_done = False\n for i in range(len(self.sort_list)-passes-1):\n if not self.sorting:\n break\n ...
[ "0.7300899", "0.6371467", "0.62282383", "0.6223536", "0.60836124", "0.5974031", "0.59525186", "0.5950724", "0.594177", "0.5894374", "0.58508456", "0.5846683", "0.5834884", "0.57782805", "0.56923485", "0.56752694", "0.56744236", "0.5661119", "0.5657958", "0.56299466", "0.55952...
0.72284585
1
Generate a presigned URL to share an S3 object
def create_presigned_url(bucket_name, object_name, expiration=3600): # Generate a presigned URL for the S3 object s3_client = boto3.client('s3') try: response = s3_client.generate_presigned_url('get_object', Params={'Bucket': bucket_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_presigned_url(bucket_name, object_name):\n\n logger = logging.getLogger(\"SimpleReplayLogger\")\n\n s3_client = boto3.client('s3')\n try:\n response = s3_client.generate_presigned_url('get_object',\n Params={'Bucket': bucket_name,\n ...
[ "0.7818953", "0.7756839", "0.7680877", "0.7658545", "0.7651632", "0.76490694", "0.7647379", "0.7646296", "0.7609004", "0.75697136", "0.7361706", "0.7353515", "0.73297143", "0.73094666", "0.7162048", "0.7113277", "0.70949465", "0.70596546", "0.70513654", "0.7022255", "0.700629...
0.7818621
1
More compact dumper with wide lines.
def json_dumps(data, indent=2, indent_increment=None, toplevel=True, one_line_max_width=200, object_fields_sorting_key=None): def simple(d): r = True if isinstance(d, dict): r = not any(isinstance(v, (list, tuple, set, dict)) for v in d.values()) and len(d) < 17 elif isinstance(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roolsPrintLongLs(keyList,optDict,indent):\n if len(keyList) > 0: # Width informations\n maxCharClass = max([len(key.GetClassName()) for key in keyList])\n maxCharTime = 12\n maxCharName = max([len(key.GetName()) for key in keyList])\n dic = { \\\n \"classWidth\":maxCha...
[ "0.57786334", "0.5664548", "0.557097", "0.554617", "0.548296", "0.5473205", "0.5470682", "0.5393047", "0.53594077", "0.53591704", "0.5316547", "0.526621", "0.52586424", "0.525581", "0.5239848", "0.52365494", "0.5221599", "0.5220271", "0.5200006", "0.5194356", "0.5182506", "...
0.0
-1