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
Initializes batch normalization axis
def init_bn_axis(): if K.image_data_format() == 'channels_first': bn_axis = 1 else: bn_axis = -1 return bn_axis
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_norm(self):\n with tf.name_scope('init_norm'):\n flat = tf.reshape(self.v, [-1, self.layer_depth])\n self.g.assign(\n tf.reshape(tf.linalg.norm(flat, axis=0), (self.layer_depth,)))", "def __init__(self, reduction_indices=None, offset=True, scale=False,\n ...
[ "0.6898164", "0.689096", "0.6800002", "0.67654866", "0.6455606", "0.64516187", "0.6423677", "0.6414971", "0.6396319", "0.6357348", "0.63528067", "0.6349475", "0.63430935", "0.6318749", "0.6273592", "0.62298125", "0.62289274", "0.6211508", "0.619495", "0.61622876", "0.6161921"...
0.61274785
23
Initializes network input shape
def init_input_shape(image_size, channels=3): (img_rows, img_cols) = image_size if K.image_data_format() == 'channels_first': input_shape = (channels, img_rows, img_cols) else: input_shape = (img_rows, img_cols, channels) return input_shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, shape, input_var=None):\n\n self.output = layers.InputLayer(shape, input_var=input_var)", "def __init__(self, netSize):\n\t\t\n\t\t# TRY THIS FOR RANDOM!\n\t\t#\n\t\t#\n\t\t#\n\t\t\n\t\tself.biases = [self.randomArray(i, 1) for i in netSize[1:]] # Biases do not exist for the ...
[ "0.7029771", "0.7024046", "0.6919055", "0.68907285", "0.68846923", "0.68404883", "0.6822069", "0.6804236", "0.6804236", "0.6804236", "0.67505586", "0.66984344", "0.66806984", "0.666526", "0.6639504", "0.66085154", "0.6592786", "0.6583862", "0.65691096", "0.65449697", "0.65282...
0.0
-1
Initializes network input shape and batch normalization axis
def init_input_shape_and_bn_axis(image_size): (img_rows, img_cols) = image_size if K.image_data_format() == 'channels_first': input_shape = (1, img_rows, img_cols) bn_axis = 1 else: input_shape = (img_rows, img_cols, 1) bn_axis = 3 return (input_shape, bn_axis)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, net, batch):\n self.net = net\n self.train_batch_is(batch)\n self.image_height = len(batch.image_array[0][0])\n self.image_width = len(batch.image_array[0][0][0])\n self.net.reset_forward()", "def initialize_network(self):\n # intermediate layer size\n...
[ "0.726126", "0.69356924", "0.6871046", "0.6827918", "0.66717565", "0.66414213", "0.65312356", "0.6525526", "0.64984953", "0.645438", "0.64380443", "0.63919", "0.63639694", "0.6353767", "0.63438046", "0.6335529", "0.633095", "0.6296713", "0.62875813", "0.628072", "0.6252297", ...
0.0
-1
Adds "dropout" layer to model
def dropout(keep_prob, net, is_training): return Dropout(keep_prob)(net) if is_training else net
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dropout_layer(self):\n return tf.keras.layers.Dropout(rate=self.dropout)", "def add_drop_out_layer(self, input_layer):\n return tf.nn.dropout(input_layer, self.keep_prob)", "def dropout(input_var=None):\n\n # Hyperparameters\n hp = Hyperparameters()\n hp('batch_size', 20)\n ...
[ "0.8024405", "0.7728018", "0.74729925", "0.72339785", "0.71602124", "0.6933945", "0.69273853", "0.6838031", "0.6837817", "0.682116", "0.6715737", "0.6679599", "0.65281695", "0.6525919", "0.65130067", "0.65084773", "0.64376026", "0.63970506", "0.62666637", "0.62647206", "0.622...
0.633441
18
Initializes training cost function
def retrieve_optimizer(flags): lrate = flags.learning_rate momentum = flags.momentum decay = lrate / flags.epochs if flags.optimizer == 'adam': optimizer = Adam(lr=lrate, decay=decay) logger.print_directly(flags, 'ADAM optimizer was configured') else: optimizer = SGD(lr=lrat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_trainer(self):\n self.cost = mse(0., 0.)\n for task_id in self.task_ids.keys():\n self.cost += self.model.get_layer(task_id + '-loss')\n\n opt = Optimizer(self.cost)\n self.optimizer = opt.get_adagrad(self.learning_rate)", "def __init__(self, cost_func):\n ...
[ "0.7631753", "0.7487942", "0.71219885", "0.7037173", "0.694103", "0.6896091", "0.6878694", "0.68467164", "0.6837462", "0.6803369", "0.6757318", "0.6744617", "0.6744267", "0.67090356", "0.66888", "0.66572183", "0.6620065", "0.661703", "0.66004735", "0.6590226", "0.6585318", ...
0.0
-1
Compiles network for training
def compile_network_model(model, optimizer, loss_func): model.compile(optimizer=optimizer, loss=loss_func, metrics=['accuracy'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_network(model, optimizer):\n compile_network_model(model, optimizer, categorical_crossentropy)", "def compile(self):\n logger.info('Define network with dnnet of version : %s'\\\n % dnnet.__version__)\n if self.layers.size == 0:\n msg = 'NeuralNetwork has...
[ "0.7822134", "0.75386256", "0.7513529", "0.7442466", "0.71998936", "0.71950305", "0.7178709", "0.71079236", "0.7097527", "0.70253724", "0.6996287", "0.69950825", "0.6874142", "0.6854327", "0.68316686", "0.679506", "0.6751136", "0.67454094", "0.67450076", "0.6727265", "0.67063...
0.681932
15
Compiles network for training
def compile_network(model, optimizer): compile_network_model(model, optimizer, categorical_crossentropy)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile(self):\n logger.info('Define network with dnnet of version : %s'\\\n % dnnet.__version__)\n if self.layers.size == 0:\n msg = 'NeuralNetwork has no layer.\\n Add layers before compiling.'\n raise DNNetRuntimeError(msg)\n\n parent = self.laye...
[ "0.7539172", "0.7513481", "0.7444233", "0.72000104", "0.719475", "0.71787214", "0.7108279", "0.70971787", "0.70245636", "0.699772", "0.699507", "0.68741465", "0.6854814", "0.68306136", "0.68187803", "0.67940164", "0.67512035", "0.6746178", "0.67435986", "0.6729193", "0.670608...
0.78212905
0
Randomly rotate the point clouds to augument the dataset rotation is per shape based along up direction
def rotate_point_cloud(batch_data): rotated_data = np.zeros(batch_data.shape, dtype=np.float32) for k in np.arange(batch_data.shape[0]): rotation_angle = np.random.uniform() * 2 * np.pi cosval = np.cos(rotation_angle) sinval = np.sin(rotation_angle) rotation_matrix = np.array([[c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_point_cloud(data):\n rotated_data = np.zeros(data.shape, dtype=np.float32)\n for k in xrange(data.shape[0]):\n rotation_angle = np.random.uniform() * 2 * np.pi\n cosval = np.cos(rotation_angle)\n sinval = np.sin(rotation_angle)\n rotation_matrix ...
[ "0.7384044", "0.69522613", "0.6924791", "0.6924791", "0.6924791", "0.68159866", "0.6813395", "0.6813395", "0.6746108", "0.669056", "0.6641431", "0.65933377", "0.65933377", "0.65933377", "0.65219665", "0.64666146", "0.641492", "0.6368018", "0.62005866", "0.61693", "0.6102413",...
0.6964295
1
Get maximum depth of given tree by BFS
def max_depth(root): # basic case if root is None: return 0 # breadth-first traversal queue = collections.deque([root]) depth = 0 while queue: queue_size = len(queue) for i in range(queue_size): curr = queue.popleft() if curr.left is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _max_depth(self):\n max_depth = 0\n for node, data in self.traverse():\n max_depth = max(max_depth, data['level'])\n return max_depth", "def max_depth(node):\n if not node:\n return 0\n return max(max_depth(node.left), max_depth(node.right)) + 1", "def maxDepth(...
[ "0.7669001", "0.7654562", "0.7653014", "0.7614319", "0.7599487", "0.74606186", "0.74326384", "0.73375744", "0.7196552", "0.718703", "0.7182534", "0.71651614", "0.7148998", "0.71120065", "0.7107149", "0.7074876", "0.706041", "0.7011375", "0.6983949", "0.6968935", "0.6909913", ...
0.7672864
0
Initlize config from YAML file
def __init__(self, configFileName): config = yaml.load(open(configFileName, "r")) # Logging self.log_level = logging.DEBUG if config['log_level'] == 'INFO': self.log_level = logging.INFO if config['log_level'] == 'ERROR': self.log_level = logging.ERROR # CPU count self.multiple...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_init(filename='./config.yml'):\n try:\n cfg = yaml.safe_load(open(filename))\n except IOError:\n msg = f'Loading config file ({filename}) failed.'\n raise IOError(msg)\n return cfg", "def load_config(filename):\n AS[\"config\"] = load_yaml_file(filename)", "def load_config...
[ "0.78310275", "0.75019807", "0.72568125", "0.7239557", "0.7188735", "0.7183867", "0.71801865", "0.71490663", "0.71455586", "0.71418613", "0.7119411", "0.70776075", "0.70237774", "0.700751", "0.69708675", "0.69608235", "0.694945", "0.6896558", "0.6868082", "0.6859895", "0.6859...
0.0
-1
Util to make path
def mkdir_p(start_path): try: os.makedirs(start_path) except OSError as exc: # Python >2.5 if exc.errno == errno.EEXIST and os.path.isdir(start_path): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_creator(rel_path=''):\n if platform.system() != 'Windows':\n if rel_path == '':\n path_list=sys.argv[0].split('/')[:-1]\n return '/'.join(path_list)\n else:\n path_list = sys.argv[0].split('/')[:-1]\n return '/'.join(path_list) + '/' + rel_path\...
[ "0.7679384", "0.75879025", "0.7498985", "0.74565715", "0.737568", "0.7094449", "0.7010396", "0.6994071", "0.69334644", "0.6852602", "0.6852222", "0.67747194", "0.6739483", "0.6722316", "0.67053086", "0.6696218", "0.66496366", "0.66158193", "0.6606479", "0.66040236", "0.654456...
0.0
-1
Util to get total size of path in MB
def dir_size(start_path): total_size = 0 for dirpath, dirnames, filenames in os.walk(start_path): for f in filenames: fp = os.path.join(dirpath, f) if os.path.exists(fp): try: total_size += os.path.getsize(fp) except: continue # convert to MB...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_size(path):\n return str(os.path.getsize(path)/1024) + 'kb'", "def size(path):", "def getsize(path):\n return get_instance(path).getsize(path)", "def getsize(self, path):\n return os.path.getsize(path)", "def get_size_bytes( path ):\n cmd = [ 'du', '-s', '-B1', '--apparent-size',...
[ "0.842222", "0.8361867", "0.8233926", "0.81820023", "0.813203", "0.8001843", "0.79292035", "0.7899288", "0.7849692", "0.78464174", "0.77591735", "0.77309155", "0.7719227", "0.7716033", "0.76963025", "0.76753175", "0.7606359", "0.7567961", "0.7567961", "0.7564459", "0.7554968"...
0.7675255
16
Extracts all the data from the crawled pages and appends them to authors list
def parse(self, response, **kwargs): key_url = response._get_url().rsplit('/')[-2] # get the author nickname after the last slash name = response.xpath('//*[@id="woe"]/div[2]/div/div[1]/div[2]/h3/text()').extract_first() job_title = response.xpath('//*[@id="woe"]/div[2]/div/div[1]/div[2]/p/tex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, response, **kwargs):\n title = response.xpath('//*[@id=\"wrap\"]/h1/text()').extract_first()\n if title:\n url_to_full_version = response._get_url()\n first_160 = ''.join(response.xpath('//*[@id=\"woe\"]/section/div/p/text()').extract())[:160]\n base_d...
[ "0.6515397", "0.6493973", "0.64058137", "0.6364981", "0.6291647", "0.6258661", "0.6218389", "0.61712474", "0.61032647", "0.6082514", "0.60737187", "0.602179", "0.6013204", "0.5997872", "0.5973892", "0.596097", "0.5955605", "0.5949766", "0.5940653", "0.5926298", "0.5921988", ...
0.633091
4
Crawls each authors pages starting from allauthors main page stored in authors report
def start_requests(self): authors_pandas = conf.read_from_data('authors.json') author_link_list = list( map(lambda obj: (obj['keyUrl'], conf.gd_base_url + obj['article_url'], obj['article_url']), authors_pandas)) for link in author_link_list: yield Request...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_author(self, author_name, min_len=0, max_len=9999):\n search = sc.search_author(author_name)\n author = next(search)\n sc.fill(author, sections=['publications'])\n print(author.keys())\n with open(\n 'loadings\\\\authors_papers\\\\{}.txt'.format(author_name)...
[ "0.66120636", "0.6457187", "0.6398303", "0.6192936", "0.61002207", "0.60938454", "0.6064179", "0.6056438", "0.60388", "0.5980902", "0.5950264", "0.59492725", "0.5898721", "0.5894304", "0.58883196", "0.5852367", "0.581795", "0.5807714", "0.58075255", "0.5806006", "0.5805787", ...
0.64995414
1
Extracts all the data from the crawled pages and appends them to articles list
def parse(self, response, **kwargs): title = response.xpath('//*[@id="wrap"]/h1/text()').extract_first() if title: url_to_full_version = response._get_url() first_160 = ''.join(response.xpath('//*[@id="woe"]/section/div/p/text()').extract())[:160] base_date = response...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(self):\n has_next_page = True\n page = 1\n while has_next_page:\n print(f'Getting page {page}')\n response = self.get_articles(\n page=page,\n size=200,\n order_by='extracted_at',\n o...
[ "0.737759", "0.71375436", "0.6939972", "0.68686", "0.677189", "0.6745556", "0.67038983", "0.66500175", "0.6645783", "0.6633248", "0.6561571", "0.65434307", "0.6535052", "0.65009606", "0.6485128", "0.64842933", "0.6419887", "0.6404132", "0.64039326", "0.63916636", "0.63700855"...
0.65011173
13
initialize a network with normalizing flows.
def __init__(self, n_components=1, init_sigma_params=1e-4, w_prior_sigma= 1., **kwargs): self.n_components = n_components # 1 output for predicting offset. # if input dependent, then predict mixing proportion, mean and variance # for each mixing component. self.w_pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_network(self):\n # intermediate layer size\n ils = int((self.specbinnum + self.numfilters) / 2)\n\n network = lasagne.layers.InputLayer((None, 1, self.specbinnum, self.numtimebins), self.input_var)\n\n network = NormalisationLayer(network, self.specbinnum)\n self.n...
[ "0.726364", "0.70838445", "0.7032408", "0.67254543", "0.66174716", "0.6567007", "0.64898306", "0.64257777", "0.6404362", "0.63733166", "0.6250138", "0.61597544", "0.61556476", "0.6155297", "0.6144982", "0.6139448", "0.6134628", "0.6117033", "0.6114269", "0.60687244", "0.60680...
0.0
-1
construct_network establishes all weight matrices and biases and connects them. The outputs may include parameters of the flow
def construct_network(self, n_units, n_samples=1, noise_dim=0, keep_p=1., nonlinearity=True, init_params=None, name=""): print "constructing network, n_units: ",n_units # TODO use kwargs for more elagant solutions to being called by this # base class assert keep_p ==1. and n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_networks(self):\n self.online_convnet = self._create_network(name='Online')\n self.target_convnet = self._create_network(name='Target')\n self._net_outputs = self.online_convnet(self.state_ph, training=True)\n self._q_argmax = tf.argmax(self._net_outputs.q_values, axis=1)[0]\n self._repla...
[ "0.7192482", "0.7097717", "0.70156425", "0.69921356", "0.69625026", "0.68106323", "0.67981684", "0.6779482", "0.67386734", "0.67300445", "0.6718721", "0.6694646", "0.6689944", "0.6686015", "0.66773814", "0.66746324", "0.6673208", "0.6619003", "0.66150516", "0.6595705", "0.656...
0.71916044
1
construct_flow builds and links together the normalizing flow and establishes the log likelihood of samples.
def construct_mog(self, outputs): # check for correct number of input dimensions. assert outputs.shape[-1] == (self.n_components)*3 + 1 out_idx = 0 # keep track of which output we are working with. self.shift = outputs[0, :, out_idx:out_idx+1]; out_idx += 1 with tf.name_scope("Mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(self, input_shape):\n with tf.name_scope(self.name):\n # Using the PyTorch default hyperparameters.\n self.batch_norm = tf.keras.layers.BatchNormalization(epsilon=1e-5,\n momentum=0.9)\n self.latent_dim = input_shape[-1]\n i...
[ "0.61279553", "0.57909757", "0.5786865", "0.57724696", "0.5767959", "0.57207876", "0.5715004", "0.5664029", "0.5578143", "0.55653596", "0.55619967", "0.55383277", "0.5536612", "0.54801136", "0.5474818", "0.54728127", "0.5437271", "0.5427648", "0.5400124", "0.5386498", "0.5384...
0.0
-1
Check transaction and journal and stuff.
def beforeEditing(self): infotext, self.journal, self.parentApp.tmpTransC = ( ledgeradd.check_trans_in_journal( settings=self.parentApp.S, transaction=self.parentApp.tmpTransC ) ) # set form title, color and infotext self.name = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkAllTx(self):\n return None", "def in_transaction(self):\n # We likely just changed data - give it a second to catch up\n time.sleep(0.1) # I think I keep reading journal watermark too soon without this\n \n # Get relevant data\n water_mark = pos.read_journal_wat...
[ "0.670862", "0.640443", "0.6317232", "0.6199903", "0.60706097", "0.6067854", "0.6045636", "0.59766394", "0.59426844", "0.58845556", "0.5867006", "0.58334965", "0.57512766", "0.57473826", "0.5746719", "0.5746719", "0.5746719", "0.5746719", "0.5737928", "0.5692912", "0.56395143...
0.0
-1
Add transaction to the history.
def add_history(self): # add separator, if there already are history entries if self.parentApp.History != '': self.parentApp.History += ( '\n\n--- --- --- --- --- --- --- --- --- --- --- ---\n\n' ) # add the transaction to it self.parentApp.Histor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addTransaction(self, transaction):\n self.transactions.append(transaction)\n self.transactionIDs.add(transaction.id)", "def add(self, transaction):\n if isinstance(transaction, Transaction):\n # If the transaction already exists\n if(transaction.hash in self.transac...
[ "0.73509127", "0.71942204", "0.7029798", "0.6894006", "0.68311554", "0.6707649", "0.6418446", "0.6413464", "0.6399687", "0.6394123", "0.6381334", "0.63626176", "0.6356362", "0.63558763", "0.63207406", "0.62853384", "0.6273537", "0.6218804", "0.61947453", "0.6156782", "0.61382...
0.730184
1
Press cancel go back.
def on_cancel(self, keypress=None): self.parentApp.switchFormPrevious()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def press_back_button(self):\n self.driver.back()", "def skip(self):\n self.click_back_button()", "def back(self):\n self.input_key_event(InputActions.BACK)", "def back( self ):\n super( ConfirmationScreen, self ).back()\n\n self._current_option = self._current_option - 1\n ...
[ "0.7686845", "0.76652855", "0.7510146", "0.73989546", "0.7366367", "0.735423", "0.7283691", "0.7280198", "0.7280198", "0.7280198", "0.72527945", "0.72527945", "0.7245617", "0.7226324", "0.7215707", "0.7212924", "0.72069484", "0.70282036", "0.7014023", "0.6985043", "0.6983128"...
0.80343944
0
`parse` should always `yield` a dict that follows the Event Schema
def parse(self, response): for item in response.css('.listingTable .listingRow'): start_time = self._parse_start(item) data = { '_type': 'event', 'name': self._parse_name(item), 'event_description': '', 'all_day': False, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_events(events_dict):\n return events_dict['events']", "def event_parser(\n message, sample_event, response, payload, log_in_file, language\n):\n event = {}\n message = sample_event_key_evaluator(response, payload, message)\n for key, value in sample_event.items():\n event[key] = s...
[ "0.6623319", "0.6369398", "0.63349575", "0.6207194", "0.61231434", "0.60706687", "0.6053306", "0.6007903", "0.5988026", "0.5986127", "0.5968965", "0.5869501", "0.5863868", "0.58521926", "0.58474016", "0.5812221", "0.5798428", "0.5786188", "0.5765936", "0.5759376", "0.57146984...
0.52081865
55
Parse or generate event name.
def _parse_name(self, item): return item.css('td[headers=Name]::text').extract_first().strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_event_name(event_name):\n pos=find_first_digit(event_name)\n return event_name[pos:]", "def event_name(self):\n return dict.get(self, 'event_name', None)", "def cal_name(self):\n return self.event_name", "def event_name(self):\n return self._event_name", "def getEventI...
[ "0.70926106", "0.6770929", "0.6751488", "0.65823394", "0.63745666", "0.6276526", "0.6255812", "0.62287736", "0.6173391", "0.6092006", "0.6069228", "0.60093296", "0.60023534", "0.5955843", "0.59454787", "0.5880808", "0.5880808", "0.58638054", "0.58026296", "0.5793772", "0.5783...
0.0
-1
Parse or generate classification (e.g. public health, education, etc).
def _parse_classification(self, item): full_name = item.css('td[headers=Name]::text').extract_first() if "Metra" in full_name and "Board Meeting" in full_name: return BOARD elif "Citizens Advisory" in full_name: return ADVISORY_COMMITTEE elif "Committee Meeting" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_classification(self, links):\n for link in links:\n if \"hearing\" in link[\"title\"].lower():\n return FORUM\n return COMMISSION", "def classification(self) -> 'outputs.CaseClassificationResponse':\n return pulumi.get(self, \"classification\")", "def _...
[ "0.707388", "0.6647457", "0.6626518", "0.6521891", "0.6510014", "0.64428645", "0.636594", "0.6330406", "0.6225585", "0.61786884", "0.61213285", "0.6062574", "0.6061338", "0.60570234", "0.6047572", "0.60411346", "0.5997528", "0.5993576", "0.5987054", "0.5979351", "0.5978588", ...
0.68485194
1
Parse start date and time.
def _parse_start(self, item): raw_date_time = item.css('td[headers~=Date]::text').extract_first() date_time_str = re.sub(r'\s+', ' ', raw_date_time).strip() if not date_time_str: return None try: dt = datetime.strptime(date_time_str, '%b %d, %Y - %I:%M %p') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_start(self, date_str):\n # TODO: Find start time\n return datetime.strptime(date_str.title(), \"%B %d, %Y\")", "def _parse_start(self, response):\n date_str = response.css(\".date time::attr(datetime)\").extract_first()\n time_str = \"\".join(response.css(\"article.time::te...
[ "0.8012607", "0.7956383", "0.79541355", "0.775254", "0.7745357", "0.7708766", "0.7648467", "0.7642984", "0.754136", "0.74821883", "0.7399587", "0.7093819", "0.697785", "0.69141096", "0.6728942", "0.65998924", "0.6470897", "0.6462791", "0.6380753", "0.634331", "0.6262659", "...
0.7459805
10
Parse documents from current and past meetings
def _parse_documents(self, item): documents = [] agenda_url = item.css('a[href*=Agenda]::attr(href)').extract_first() if agenda_url: documents.append({'url': agenda_url, 'note': 'Agenda'}) minutes_url = item.css('a[href*=Minutes]::attr(href)').extract_first() if minut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_past_meetings(self, response):\n meetings = []\n for item in response.css('table.table-striped tbody tr'):\n dt_str = item.css('time::text').extract_first()\n meetings.append({\n 'start': {\n 'date': datetime.strptime(dt_str, '%b %d, ...
[ "0.70574003", "0.6554029", "0.64571774", "0.61043", "0.60476214", "0.5917609", "0.59144187", "0.5843874", "0.5824725", "0.5757989", "0.5725755", "0.5612276", "0.5595577", "0.55906874", "0.5554109", "0.5529632", "0.54651964", "0.5390686", "0.53802896", "0.5373121", "0.5335325"...
0.5668923
11
Determine if the given request is marked for caching and if yes, then look it up in the cache and if found, then return the cached value
def process_resource(self, req, resp, resource, params): # Step 1: for 'rest-based' and 'rest&time-based' eviction strategies the # POST/PATCH/PUT/DELETE calls are never cached, they should never be # loaded from cache as they must always execute, # so for those we don't need to try to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache():\n is_conditional = request.headers.get(\"If-Modified-Since\") or request.headers.get(\n \"If-None-Match\"\n )\n\n if is_conditional is None:\n response = view_get()\n response.headers[\"Last-Modified\"] = http_date()\n response.headers[\"ETag\"] = uuid.uuid4().hex\...
[ "0.71749496", "0.69655037", "0.6879033", "0.6858692", "0.665096", "0.66387236", "0.6592808", "0.6526735", "0.65230745", "0.65191174", "0.65162516", "0.6468557", "0.6466649", "0.64410686", "0.64223427", "0.6418258", "0.6404368", "0.63901526", "0.63901526", "0.6369117", "0.6362...
0.57678896
86
Cache the response if this request qualifies and has not been cached yet or for restbased and restandtimebased evict the record from the cache if the request method is POST/PATCH/PUT or DELETE
def process_response(self, req, resp, resource, req_succeeded): # Step 1: for 'rest-based' and 'rest&time-based' eviction strategies the # POST/PATCH/PUT/DELETE calls are never cached and even more they # invalidate the record cached by the GET method if self.cache_config['CACHE_EVICTIO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_resource(self, req, resp, resource, params):\n\n # Step 1: for 'rest-based' and 'rest&time-based' eviction strategies the\n # POST/PATCH/PUT/DELETE calls are never cached, they should never be\n # loaded from cache as they must always execute,\n # so for those we don't need ...
[ "0.7296144", "0.7083652", "0.701264", "0.68986917", "0.6891372", "0.6742869", "0.67302907", "0.66479725", "0.6640116", "0.6626159", "0.653558", "0.6509554", "0.65028024", "0.6493731", "0.64882547", "0.6464503", "0.61653435", "0.6115088", "0.6103556", "0.6070408", "0.6057066",...
0.77516645
0
Generate the cache key from the request using the path and the method
def generate_cache_key(req, method: str = None) -> str: path = req.path if path.endswith('/'): path = path[:-1] if not method: method = req.method return f'{path}:{method.upper()}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_view_response_cache_key( # pylint: disable=unused-argument\n handler: Callable[..., Awaitable[StreamResponse]],\n request: Request,\n *args,\n **kwargs,\n) -> str:\n get_params = request.query\n\n hash_ = sha1(request.path.encode('utf-8'))\n\n for param in sorted(get_params):\n ...
[ "0.7671069", "0.73947465", "0.69811064", "0.69450694", "0.6926922", "0.6827275", "0.66507095", "0.66111356", "0.6543088", "0.65096855", "0.6467866", "0.64333147", "0.6348608", "0.6315374", "0.6295006", "0.6290446", "0.61842054", "0.6159068", "0.6157648", "0.6108428", "0.60800...
0.8796167
0
Serializes the response, so it can be cached. If CACHE_CONTENT_TYPE_JSON_ONLY = False (default), then we need to keep the response ContentType header, so we need to serialize the response body with the content type with msgpack, which takes away performance. For this reason the user can set CACHE_CONTENT_TYPE_JSON_ONLY...
def serialize(self, req, resp, resource) -> bytes: if self.cache_config['CACHE_CONTENT_TYPE_JSON_ONLY']: if FALCONVERSION_MAIN < 3: return resp.body else: return resp.text else: if FALCONVERSION_MAIN < 3: return msgpack....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_http_response(self) -> HttpResponse:\n response = (\n JsonResponse(self.body)\n if (self.headers or {}).get(\"Content-Type\") == \"application/json\"\n else HttpResponse(self.body)\n )\n response.headers = self.headers\n return response", "def r...
[ "0.64963675", "0.64194614", "0.636542", "0.6278377", "0.61988986", "0.6171429", "0.6129956", "0.60481405", "0.6038928", "0.6000924", "0.60004413", "0.59598386", "0.5909832", "0.5895042", "0.5895042", "0.58946943", "0.58941776", "0.5894121", "0.58709216", "0.5853939", "0.58444...
0.72587997
0
Deserializes the cached record into the response Body or the ContentType and Body
def deserialize(self, data: bytes) -> Tuple[str, Any]: if self.cache_config['CACHE_CONTENT_TYPE_JSON_ONLY']: return data else: return msgpack.unpackb(data, raw=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(self, resp):\r\n return self.serializer.deserialize(resp.content, format=resp['Content-Type'])", "def deserialize(self, data, caches=None):\n return data", "def decode(self) -> D:\n if self.has_cached_data():\n return self._data\n\n # Dispatch decoding\n ...
[ "0.66872615", "0.628563", "0.6097179", "0.60517174", "0.6006489", "0.60002464", "0.59839606", "0.59279156", "0.5876185", "0.5767751", "0.57473266", "0.5706114", "0.56609535", "0.56507987", "0.562745", "0.5612654", "0.5603545", "0.5589274", "0.5583386", "0.5578948", "0.5569624...
0.6360597
1
Takes an incoming socket and either stores the command to the command queue, or performs another action based on the command.
def receive_and_store(self, socket, addr): # Create the incoming connection conn = IncomingConnection(addr, socket) # Receive the data from the connection data = conn.recv_data() if not data: logger.warning("Invalid data received") return # Get t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_command(self, command_str):\n print \"Received command: {}\".format(command_str)\n commands = command_str.split('#')\n if len(commands) == 2:\n data = None\n elif len(commands) > 2:\n data = commands[2:]\n elif command_str == '':\n # G...
[ "0.6953094", "0.6832541", "0.6550946", "0.6328179", "0.6293573", "0.6292742", "0.6161187", "0.6027672", "0.5915629", "0.5909542", "0.58832407", "0.5841701", "0.58089155", "0.58026075", "0.5779208", "0.5778535", "0.5763915", "0.5758714", "0.5742956", "0.57220924", "0.5711825",...
0.7060211
0
Runs the state machine. Returns in the EXIT state.
def run(self): # Start the thread to receive commands self.command_input.start() # The next time to execute a state self.next_time = time.time() + self.control_period # Run forever! logger.debug("Starting") while True: old_state = self.current_state ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n \n\n f = FiniteStatesMachine('stopped', [])\n f.setDefaultTransition(Error, None)\n \n f.addTransitionList('start', 'stopped', starFSMVariables, 'started')\n f.addTransitionList('collect', 'started', collectData, 'collecting')\n f.addTransitionList('collect', ...
[ "0.66520494", "0.6551841", "0.6485087", "0.63386077", "0.63172615", "0.6300952", "0.6278196", "0.6263265", "0.6246749", "0.6161754", "0.61544645", "0.6139356", "0.60383415", "0.5993939", "0.5967432", "0.5961428", "0.58711255", "0.5869836", "0.5837625", "0.58372927", "0.581037...
0.5402872
69
Show the girth of black pixels along a line. Highlight said line in orig image
def side_traces(x,im): s0 = x['side-traces'][0] s1 = x['side-traces'][1] t1 = Scatter(y=s0) t2 = Scatter(y=s1) #put_thing(im,x['abs-line'],(255,0,0),(0,0),3) groups = [] diff_traces = [] markers = [] y3 = [] TriangleHumps.get_dimensions(x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addNonBarrelBlue(self, event):\n # let user draw second ROI\n ROI = RoiPoly(color='r') #let user draw ROI\n plt.show(block=False)\n mask = ROI.get_mask(self.greyimg)\n mask = mask*2\n self.ROI += mask", "def _hilightcurrent(self, onoff):\n if len(self.canvas[\"ite...
[ "0.61536944", "0.6099716", "0.5944608", "0.59030896", "0.5892146", "0.5855114", "0.58391273", "0.58272207", "0.58183736", "0.5801204", "0.5785304", "0.57578826", "0.57566464", "0.56925803", "0.5666854", "0.56493896", "0.5643967", "0.56353635", "0.56159747", "0.5602625", "0.55...
0.0
-1
get base64 string repr of object or np image
def getbase64(nparr,): if type(nparr) == type({}): nparr = nparr['img'] im = Image.fromarray(nparr) buf = BytesIO() im.save(buf,format="JPEG") return base64.b64encode(buf.getvalue()).decode('ascii')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base64(self):\n image = self.png.getvalue()\n return base64.encodestring(image).decode('utf-8')", "def data64(self) -> str:\n return Image.encode64(self.data)", "def base64_string(self) -> global___Expression:", "def _get_image(x):\n return b64encode(x).decode('ascii')", "def data...
[ "0.72159815", "0.6906734", "0.68322635", "0.682055", "0.6737309", "0.67277545", "0.6667643", "0.66208005", "0.66028064", "0.6586784", "0.65735114", "0.6563396", "0.65275586", "0.6448807", "0.63930434", "0.63762724", "0.63067997", "0.63018715", "0.62593025", "0.6230752", "0.61...
0.6916091
1
make a plot of each object and put image next to it. func defines the type of plot and anything that is done to each image,obj pair
def _dump_plotly(objs, images, func): l = len(objs) #print(l) titles = [] for i,x in enumerate(objs): if 'id' in x: titles.append('shape id %d' % x.id) else: titles.append('item %d' % i) fig = tools.make_subplots(rows=l, cols=1, subplot_titles = titles,print_g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_single(potential_func, obstacles, filename, xlim=(-400, 400), ylim=(-400, 400)):\n print \"Generating\", filename\n fig = plt.figure()\n plot = plt.subplot(111)\n show_arrows(plot, potential_func, xlim=xlim, ylim=ylim)\n for obstacle in obstacles:\n show_obstacle(plot, obstacle)\n ...
[ "0.6392929", "0.6309091", "0.62998956", "0.62422526", "0.62251675", "0.59421015", "0.59245807", "0.590018", "0.58759063", "0.5816621", "0.5809763", "0.5801232", "0.57604563", "0.57517", "0.5740631", "0.57335705", "0.5718802", "0.5717321", "0.56906945", "0.56868666", "0.568540...
0.6703569
0
Integrates contact into protocolaccountcontactmessagedatastructure and returns it
def get_make_contact(root): root_split = root.split('/') contact_name = root_split[-1] #groupchat's folder's end with .chat group_chat = False if contact_name.endswith(".chat"): contact_name = contact_name[:-5] group_chat = True account_name = root_split[-2] protocol_name =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_(cls, contact):\n assert not isinstance(message, PhoneMessage)\n ret = PhoneMessage(peer=message.peer,text=message.text,timestamp=message.timestamp,direction=message.direction,status=message.status)\n yield ret", "def import_(cls, contact):\n assert not isinstance(message, ...
[ "0.6415014", "0.6415014", "0.6144517", "0.5938548", "0.5781222", "0.5781222", "0.573517", "0.5672302", "0.56584066", "0.5608456", "0.5603349", "0.5595631", "0.5589713", "0.5581832", "0.5555969", "0.5525056", "0.5495442", "0.54939127", "0.54892784", "0.537718", "0.5371565", ...
0.5550638
15
Adds message to global datastructure
def add_message(name, time, message_text, root): (contact, account) = get_make_contact(root) show = None subject = None group_chat = False if root.endswith(".chat"): group_chat = True #actions if message_text and message_text.startswith("***"): for alias in contact.alias: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_message(self, msg):\n self.messages.append(msg)", "def handle_message(self, msg):\n self.messages.append({\n 'type': msg.category,\n 'module': msg.module,\n 'obj': msg.obj,\n 'line': msg.line,\n 'column': msg.column,\n 'path'...
[ "0.7409812", "0.7172363", "0.70097774", "0.6925562", "0.66760397", "0.6673151", "0.66208136", "0.66029525", "0.660143", "0.6600997", "0.65801567", "0.6517668", "0.6481048", "0.6467904", "0.6448488", "0.64417195", "0.6427785", "0.6414664", "0.6409843", "0.639914", "0.63720566"...
0.0
-1
Parses pidgin's htmlformated logfiles HTML within messages is converted to normal text, so messages about HTMLcode will get lost
def parse_html(root, filename): root_filename = os.path.join(root, filename) match_date = regex_date.findall(filename) if not match_date: raise Exception(root_filename, 'r') year = int(match_date[0][0]) month = int(match_date[0][1]) day = int(match_date[0][2]) file = open(root_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_logfile_html(text):\n out_text = \"\"\n buff = \"\"\n start_tag = \"\"\n end_tag = \"\"\n context = \"none\"\n for i in range(len(text)):\n c = text[i]\n # print \"c = \"+str(c)+\" context = \"+str(context)\n if c == \"<\":\n if context == \"none\":\n ...
[ "0.6302063", "0.6082321", "0.60166854", "0.59433186", "0.59056187", "0.57682514", "0.57220733", "0.56769717", "0.5576809", "0.5557175", "0.55498254", "0.5516565", "0.5464202", "0.5434003", "0.5428622", "0.5424175", "0.53731394", "0.5366191", "0.5362259", "0.5360732", "0.53596...
0.6280499
1
Parses pidgin's txtformated logfiles
def parse_txt(root, filename): root_filename = os.path.join(root, filename) match_date = regex_date.findall(filename) if not match_date: raise Exception(root_filename, 'r') year = int(match_date[0][0]) month = int(match_date[0][1]) day = int(match_date[0][2]) file = open(root_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file(self):\n with open(self.file_name, 'r', errors='ignore') as log_file:\n for line in log_file:\n self.process_line(line)", "def __parse(self):\n lines = self.file.readlines()\n name_idx = 2\n name_idx_found = False\n pathre = re.compile(r...
[ "0.64843875", "0.64326483", "0.6343257", "0.6289032", "0.62647706", "0.62052536", "0.6193887", "0.61273474", "0.60964555", "0.6089907", "0.6056501", "0.60470355", "0.6037005", "0.60215807", "0.5989976", "0.5972458", "0.5971046", "0.5943428", "0.5934065", "0.5914323", "0.58844...
0.60863197
10
Insert messages (from global datastructure) into db
def database_insert(db): con = sqlite3.connect(db) cur = con.cursor() for protocol in protocols: if protocol.name == "jabber": for account in protocol.accounts: for contact in account.contacts: print("Inserting", contact.name) cur.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_message_to_db(self, user_name, date_time, message):\n try:\n self.cursor.execute('INSERT INTO {0} (user_name, time_stamp, message) VALUES (?,?,?);'.format(TABLE_NAME),\n (user_name, date_time, message))\n except sqlite3.DatabaseError as err:\n ...
[ "0.6841209", "0.6574107", "0.6454141", "0.64404714", "0.6375744", "0.62187374", "0.6194717", "0.61241376", "0.6104334", "0.6085481", "0.60429436", "0.60366213", "0.60090595", "0.60085547", "0.5956678", "0.59218454", "0.5910281", "0.5906215", "0.58807814", "0.5849432", "0.5838...
0.6568218
2
Parses files into global datastructure
def parse_dir(root, filenames): for filename in fnmatch.filter(filenames, '*.html'): parse_html(root, filename) for filename in fnmatch.filter(filenames, '*.txt'): parse_txt(root, filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n parse_file(sys.argv[1])", "def parse(self):\n\t\tself.maincfg_values = self._load_static_file(self.cfg_file)\n\t\t\n\t\tself.cfg_files = self.get_cfg_files()\n\t\t\n\t\tself.resource_values = self.get_resources()\n\t\t\n\t\tself.timestamps = self.get_timestamps()\n\t\t\n\t\t## This loads everyth...
[ "0.68028134", "0.67118067", "0.6645361", "0.6598039", "0.6507164", "0.645687", "0.6445086", "0.64414036", "0.6389246", "0.63524276", "0.6335487", "0.6325584", "0.6236716", "0.6203235", "0.6191149", "0.618047", "0.61771804", "0.6165077", "0.6151517", "0.61479783", "0.61439776"...
0.0
-1
Asks user for own nicks after listing all encountered ones
def names_interaction(): already_printed = [] for protocol in protocols: for account in protocol.accounts: for contact in account.contacts: for message in contact.messages: if message.name not in already_printed: already_printed.app...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_sticks_ai(self, sticks):\n print(\"\\nThere are {} sticks on the board\".format(sticks))\n sticks_taken = random.choice(self.hats[sticks]['content'])\n self.hats[sticks]['choice'] = sticks_taken\n sticks -= sticks_taken\n return sticks", "def user_picks():\r\n print...
[ "0.601555", "0.5969573", "0.576979", "0.5542987", "0.5438632", "0.5384672", "0.53576845", "0.53359205", "0.5284243", "0.5240409", "0.518095", "0.5168703", "0.5161023", "0.5150909", "0.5149311", "0.5141872", "0.5106042", "0.5085934", "0.50680995", "0.5062412", "0.5058632", "...
0.6445882
0
Updates global datastructure with message type (own, not own)
def message_update_kind(alias_me): for protocol in protocols: for account in protocol.accounts: for contact in account.contacts: for message in contact.messages: #if kind not jet known if message.kind == -1: if messa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_message_data(self) -> None:\n if PrimaryFlight.MESSAGETYPE == self.type:\n self.message_data = PrimaryFlight(self.data, self.config)\n elif GPS.MESSAGETYPE == self.type:\n self.message_data = GPS(self.data, self.config)\n elif Attitude.MESSAGETYPE == self.type:\n ...
[ "0.6372461", "0.6005264", "0.5914773", "0.5829452", "0.56945264", "0.56803596", "0.56739694", "0.5616793", "0.5577698", "0.5549897", "0.5547644", "0.5545447", "0.5525357", "0.5523845", "0.54576707", "0.5430875", "0.53760004", "0.5334801", "0.5321741", "0.5316897", "0.5307633"...
0.5454643
15
Implement the check_unused_args in superclass.
def check_unused_args(self, used_args, args, kwargs): for k, v in kwargs.items(): if k in used_args: self._used_kwargs.update({k: v}) else: self._unused_kwargs.update({k: v})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_args(self, args_):\n\n pass", "def __init__(self, *unused_args, **unused_kwargs):", "def __check_args(self):\n self.__check_args_type()\n self.__check_args_val()", "def ignore(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads\n pass...
[ "0.71085674", "0.6883384", "0.67958516", "0.6730387", "0.66968954", "0.6619412", "0.6390801", "0.6302647", "0.6250002", "0.62224966", "0.6195048", "0.6153181", "0.61491466", "0.6146345", "0.6113333", "0.6072033", "0.60612833", "0.60221803", "0.60128295", "0.6003403", "0.59412...
0.7603612
0
Clear used and unused dicts before each formatting.
def vformat(self, format_string, args, kwargs): self._used_kwargs = {} self._unused_kwargs = {} return super(MemorizeFormatter, self).vformat(format_string, args, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clear_caches(self):\n self._brushes = {}\n self._formats = {}", "def clear(self):\n\n for a in self.formats + self.other_clear:\n setattr(self, a, None)\n self.filename = None\n self.timestamp = None\n self.lastfail = None", "def reset_format(self):\n ...
[ "0.6962335", "0.66672957", "0.65036696", "0.64456564", "0.6429814", "0.638011", "0.63629144", "0.6338855", "0.6315553", "0.62882304", "0.62856793", "0.6279111", "0.6267949", "0.62281585", "0.6219763", "0.6197153", "0.619033", "0.6180451", "0.6177072", "0.615768", "0.6153044",...
0.0
-1
format a string by a map
def format_map(self, format_string, mapping): return self.vformat(format_string, args=None, kwargs=mapping)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reprOfStringToValueMap (stringMap : Map) -> String:\n\n entrySeparator = u\"§\"\n entryTemplate = \"%s: %s\"\n keyList = sorted(list(stringMap.keys()))\n result = \"\"\n \n for key in keyList:\n value = stringMap[key] \n result += (iif(result == \"\", \"\", entrySeparator)\n ...
[ "0.7346636", "0.69570595", "0.6857461", "0.67944145", "0.67872196", "0.65942025", "0.64885473", "0.64343286", "0.6369347", "0.6199872", "0.6082483", "0.6055873", "0.6032503", "0.59989256", "0.59868157", "0.59844786", "0.597163", "0.59715307", "0.5968912", "0.5882509", "0.5869...
0.7537712
0
Get used kwargs after formatting.
def get_used_kwargs(self): return self._used_kwargs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_kwargs(self):\n return {}", "def kwargs(self):\n return self._kwargs", "def kwargs(self):\n return self._kwargs", "def format_arguments(self, **kwargs):\n return kwargs", "def get_kwargs(self):\n return {\n 'user': self.user,\n }", "def get_kwa...
[ "0.7273864", "0.7083243", "0.7083243", "0.7075471", "0.67573947", "0.66603476", "0.6652786", "0.65693074", "0.6531428", "0.65201193", "0.6439507", "0.64319444", "0.6423987", "0.6408022", "0.6377557", "0.6353454", "0.6334118", "0.6269364", "0.6239159", "0.62325567", "0.6228446...
0.7414289
0
Get unused kwargs after formatting.
def get_unused_kwargs(self): return self._unused_kwargs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_used_kwargs(self):\n return self._used_kwargs", "def _scrub_kwargs(kwargs: Dict[str, Any]) -> Dict[str, Any]:\n keywords_to_scrub: List[str] = ['extra_arguments', 'kernel_id']\n scrubbed_kwargs = kwargs.copy()\n for kw in keywords_to_scrub:\n scrubbed_kwargs.pop(kw,...
[ "0.6829997", "0.6761362", "0.6697653", "0.6459872", "0.6360253", "0.63554084", "0.6294143", "0.6281469", "0.6259455", "0.62412184", "0.62412184", "0.62019503", "0.6111536", "0.6063095", "0.60411596", "0.60411596", "0.599486", "0.5875321", "0.5854771", "0.5847538", "0.58386594...
0.7941406
0
Add element_by alias and extension' methods(if_exists/or_none).
def add_element_extension_method(Klass): def add_element_method(Klass, using): locator = using.name.lower() find_element_name = "element_by_" + locator find_element_if_exists_name = "element_by_" + locator + "_if_exists" find_element_or_none_name = "element_by_" + locator + "_or_none...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains(self, element):\n pass", "def add(element):", "def artAttrTool(*args, exists: Union[AnyStr, bool]=\"\", remove: AnyStr=\"\", q=True, query=True,\n **kwargs)->Union[None, Any]:\n pass", "def has_element(parent, xpath):\n ele = parent.find('./' + xpath)\n if ele is n...
[ "0.52138686", "0.5116739", "0.5036193", "0.50305545", "0.49910548", "0.497446", "0.48736545", "0.48461556", "0.48278427", "0.47965333", "0.47628498", "0.46982324", "0.46863768", "0.46765348", "0.46641046", "0.46609923", "0.46489343", "0.46479532", "0.46302179", "0.45912728", ...
0.6793267
0
Fluent interface decorator to return self if method return None.
def fluent(func): @wraps(func) def fluent_interface(instance, *args, **kwargs): ret = func(instance, *args, **kwargs) if ret is not None: return ret return instance return fluent_interface
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __noop(self, *args, **kwargs):\n return None", "def method(self):\n return None", "def return_none() -> None:\n pass", "def __call__(self, *args, **kwargs):\n return self.__wrapped__(*args, **kwargs)", "def pass_null(func):\n\n def wrapper(obj, *args, **kwargs):\n if not o...
[ "0.6567935", "0.6153579", "0.5921167", "0.5789551", "0.57773596", "0.5770913", "0.5758091", "0.57273376", "0.56640935", "0.5651486", "0.5617815", "0.5551248", "0.5544665", "0.5541051", "0.55385506", "0.5533451", "0.5528883", "0.55121976", "0.54744726", "0.5464299", "0.5359974...
0.62337273
1
Convert value to a list of key strokes >>> value_to_key_strokes(123) ['1', '2', '3'] >>> value_to_key_strokes('123') ['1', '2', '3'] >>> value_to_key_strokes([1, 2, 3]) ['1', '2', '3'] >>> value_to_key_strokes(['1', '2', '3']) ['1', '2', '3']
def value_to_key_strokes(value): result = [] if isinstance(value, Integral): value = str(value) for v in value: if isinstance(v, Keys): result.append(v.value) elif isinstance(v, Integral): result.append(str(v)) else: result.append(v) r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_key_val_list(value):\n if value is None:\n return None\n\n if isinstance(value, (str, bytes, bool, int)):\n raise ValueError('cannot encode objects that are not 2-tuples')\n\n if isinstance(value, collections.Mapping):\n value = v...
[ "0.6031192", "0.52026004", "0.5165081", "0.5160203", "0.50922084", "0.5048257", "0.50478864", "0.5046137", "0.50427055", "0.5000748", "0.4961365", "0.49351156", "0.4862569", "0.48579395", "0.48172843", "0.48017225", "0.47746295", "0.4763067", "0.47456744", "0.4712962", "0.463...
0.77909297
0
Execute code in a namespace.
def exec_(code, globs=None, locs=None): if globs is None: frame = sys._getframe(1) globs = frame.f_globals if locs is None: locs = frame.f_locals del frame elif locs is None: locs = globs exec("""exec code in globs, locs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exposed_execute(self, text):\n execute(text, PublicService.exposed_namespace)", "def sbox_exec(self, source: str):\n return exec(source, self.sbox_globals, self.sbox_locals)", "def code():", "def run ( self ) :\n exec self._cmd in self._myglobals,self._mylocals", "def complie_a...
[ "0.62050563", "0.60476995", "0.6043668", "0.60398364", "0.59286726", "0.58017296", "0.5787538", "0.57273376", "0.57222074", "0.57211214", "0.5654667", "0.5628628", "0.5615811", "0.55890703", "0.5584693", "0.5578245", "0.5562799", "0.5552856", "0.5531261", "0.55299324", "0.550...
0.5353693
40
Batch normalization on convolutional maps.
def batch_norm(x, phase_train, scope='bn', affine=True): with tf.variable_scope(scope): og_shape = x.get_shape().as_list() if len(og_shape) == 2: x = tf.reshape(x, [-1, 1, 1, og_shape[1]]) shape = x.get_shape().as_list() beta = tf.Variable(tf.constant(0.0, shape=[shape[-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(batch_img: np.ndarray) -> np.ndarray:\n batch_img = batch_img.astype('float32')\n return batch_img / 127.5 - 1", "def batch_norm(self, inputs):\n x = inputs\n x = self.bn(x)\n return x", "def normalize_data(batch_data):\n B, N, C = batch_data.shape\n normal_data =...
[ "0.6931802", "0.6867194", "0.67963105", "0.6757687", "0.6720907", "0.6656808", "0.6617828", "0.649989", "0.6443505", "0.6426401", "0.6426401", "0.63924474", "0.6389737", "0.637851", "0.63618445", "0.63528675", "0.63390213", "0.63346064", "0.6308552", "0.6296517", "0.6292161",...
0.0
-1
Augment image and key points, bounding boxes !!
def img_and_key_point_augmentation(augmentation, img, bbox, key_points): # img_copy = img.copy() image_shape = img.shape h, w = image_shape[0:2] # Convert the stochastic sequence of augmenters to a deterministic one. # The deterministic sequence will always apply the exactly same effects to the im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def im_detect_keypoints_aug(model, im, boxes):\n\n # Collect heatmaps predicted under different transformations\n heatmaps_ts = []\n # Tag predictions computed under downscaling and upscaling transformations\n ds_ts = []\n us_ts = []\n\n def add_heatmaps_t(heatmaps_t, ds_t=False, us_t=False):\n ...
[ "0.6619781", "0.65760165", "0.6573601", "0.64467424", "0.63438433", "0.6319195", "0.6261868", "0.6209508", "0.6207679", "0.62067044", "0.61714906", "0.6164397", "0.6108835", "0.60427105", "0.6042169", "0.60405695", "0.6033405", "0.60134506", "0.6002291", "0.5998151", "0.59661...
0.7612929
0
Augment image and bounding boxes !!
def img_augmentation(augmentation, img, bbox): # img_copy = img.copy() image_shape = img.shape h, w = image_shape[0:2] # Convert the stochastic sequence of augmenters to a deterministic one. # The deterministic sequence will always apply the exactly same effects to the images. det = augmentati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocessing(image_data, max_height, max_width):\n img = image_data[\"image\"]\n img = resize_image(img, max_height, max_width)\n gt_boxes = image_data[\"objects\"][\"bbox\"]\n gt_labels = image_data[\"objects\"][\"label\"]\n return img, gt_boxes, gt_labels", "def to_imgaug(self, image_shape)...
[ "0.68984985", "0.6853272", "0.6828715", "0.6781937", "0.6781937", "0.66911954", "0.66844195", "0.6655804", "0.6620257", "0.6595388", "0.65874094", "0.6579807", "0.65564126", "0.65507674", "0.6549536", "0.65301317", "0.65256107", "0.6521426", "0.6520758", "0.6511823", "0.65013...
0.6885573
1
Determines which augmenters to apply to masks.
def hook(images, augmenter, parents, default): return augmenter.__class__.__name__ in MASK_AUGMENTERS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hook(images, augmenter, parents, default):\n return augmenter.__class__.__name__ in MASK_AUGMENTERS", "def hook(images, augmenter, parents, default):\n return augmenter.__class__.__name__ in MASK_AUGMENTERS", "def hook(images, augmenter, parents, default):\n return (aug...
[ "0.72273487", "0.7182704", "0.7110781", "0.594772", "0.59287107", "0.5728177", "0.56989866", "0.56986225", "0.56169343", "0.5586497", "0.5522835", "0.55208254", "0.55029047", "0.5455861", "0.54065317", "0.5406343", "0.5406252", "0.53967136", "0.5390863", "0.53442645", "0.5329...
0.70050114
3
Augment image and bounding boxes !!
def img_and_mask_augmentation(augmentation, img, mask): # img_copy = img.copy() image_shape = img.shape # Convert the stochastic sequence of augmenters to a deterministic one. # The deterministic sequence will always apply the exactly same effects to the images. det = augmentation.to_deterministic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocessing(image_data, max_height, max_width):\n img = image_data[\"image\"]\n img = resize_image(img, max_height, max_width)\n gt_boxes = image_data[\"objects\"][\"bbox\"]\n gt_labels = image_data[\"objects\"][\"label\"]\n return img, gt_boxes, gt_labels", "def img_augmentation(augmentatio...
[ "0.68984985", "0.6885573", "0.6853272", "0.6828715", "0.6781937", "0.6781937", "0.66911954", "0.66844195", "0.6655804", "0.6620257", "0.6595388", "0.65874094", "0.6579807", "0.65564126", "0.65507674", "0.6549536", "0.65301317", "0.65256107", "0.6521426", "0.6520758", "0.65118...
0.0
-1
Parses the program commandline arguments. Args must be an array containing all arguments.
def parse_commandline_args(): epilog = """ The configuration file must contained a JSON-encoded map. Example: "{"name":"foo"}". """ parser = utils.ConnectionArgumentParser( description="Update config (key/value pairs) on a board", epilog=epilog ) parser.add_argument( "-c", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_args(args=None):\n\t\treturn _get_args_parser().parse_args(args)", "def parse_args(args=None):\n return AP.parse_args(args=args)", "def parse_args(self, argv=None):\n self.opts, self.args = self.cli_parser.parse_args(argv)\n self._begin_logging()\n ...
[ "0.78749067", "0.75790143", "0.73856956", "0.73781556", "0.72477776", "0.7216756", "0.7198788", "0.71979994", "0.7137461", "0.7108861", "0.7107137", "0.710128", "0.70689136", "0.7023758", "0.70063096", "0.6984291", "0.69759655", "0.6971735", "0.69376504", "0.6935694", "0.6925...
0.0
-1
Init emply player with required settings
def __init__(self): self.id = None self.name = None self.phone = None self.score = 0 # Running sum of player's score self.state = None self.ball_id = None self.start_x = None # start pos of object thrown in game self.angle = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_player():\n global active_track_idx\n global track_last_slided_pos\n global track_last_paused_pos\n global track_total_play_time \n\n # INITIALIZE Player\n active_track_idx = -1\n cancel_update_play_time_loop()\n cancel_track_end_event_loop()\n track_status.set(\"---\")\n tra...
[ "0.7290873", "0.72183263", "0.69451517", "0.6945105", "0.6931438", "0.67666894", "0.6618811", "0.65181553", "0.64596945", "0.6405867", "0.6321414", "0.6309153", "0.6307809", "0.630426", "0.6285705", "0.6270282", "0.6256138", "0.6255461", "0.62332505", "0.622231", "0.6217058",...
0.0
-1
update player state based on incomming data
def update(self, data): # convert to string to json object # see conversions if you're having problems # https://docs.python.org/3/library/json.html#encoders-and-decoders try: data = json.loads(data) # updated player state self.id = data['id'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPlayerStates(self, updates):\r\n for upd in updates:\r\n print \"UPD player %s\" % upd['player']\r\n player = self.players[upd['player']]\r\n player.setStatus(upd['status'], upd['jump'], upd['charge'])\r\n\r\n player.health = upd['health']\r\n if...
[ "0.71735924", "0.6937591", "0.6606941", "0.65582985", "0.65486693", "0.6540643", "0.6533953", "0.6484222", "0.6477047", "0.64653736", "0.6373607", "0.62698174", "0.62684196", "0.62657106", "0.62476707", "0.62337685", "0.6191886", "0.61768854", "0.61741716", "0.6125093", "0.61...
0.6615881
2
Reset the palyer data to ensure no data carries over between rounds
def player_reset(self): logging.info( f"Player.player_reset(): Player {self.id} score and time reset\n") self.id = 0 self.name = "" self.phone = "" self.score = 0 # Running sum of player's score self.state = "innactive" self.ball_id = ""...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resetData(self):\n self.currentHoursLeft = self.maxHoursLeft\n self.currentRound = self.currentRound + 1\n # reset empire data\n for empireID, myEmpire in self.empires.iteritems():\n myEmpire.resetData()\n myEmpire.resetRoundData()\n \n # reset sy...
[ "0.7531799", "0.7322715", "0.71666825", "0.7104449", "0.7095844", "0.7072128", "0.7063651", "0.70372325", "0.7013312", "0.6935498", "0.69190276", "0.69188154", "0.6910696", "0.69025", "0.6897481", "0.6871852", "0.68656075", "0.68656075", "0.6861706", "0.6860858", "0.68599", ...
0.0
-1
Collate function that padds examples to the longest sequence in a batch. It is meant for training the question generation model. Used together with SQuAD2.0 dataset preprocesses with preprocess_dataset function.
def dynamic_padding_collate_fn(batch_list): batch_uncollated = [[] for i in range(3)] for features in batch_list: length = features[1].sum().item() for i, feature in enumerate(features): batch_uncollated[i].append(feature[:length]) batch_collated = [] for batch in batch_unc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collate_fn(self, batch):\r\n batch = list(map(torch.stack, zip(*batch)))\r\n max_seq_len = torch.max(torch.sum(batch[1], 1)).item()\r\n for i in range(len(batch) - 1):\r\n if batch[i].size()[1] > max_seq_len:\r\n batch[i] = batch[i][:, :max_seq_len]\r\n if ...
[ "0.7033074", "0.6944575", "0.67516834", "0.6637126", "0.65820885", "0.65329534", "0.6456716", "0.6453996", "0.629609", "0.62111056", "0.6209131", "0.6203681", "0.6183075", "0.61593163", "0.6139525", "0.6039231", "0.6031318", "0.59539074", "0.5948258", "0.5943981", "0.59365565...
0.59552723
17
Preprocess SQuAD2.0 dataset constructed with load_and_cache_examples function into a form suitable for training the question generation model.
def preprocess_dataset(dataset, tokenizer): eos = torch.tensor([tokenizer.eos_token_id], dtype=torch.long) q_start = torch.tensor(tokenizer.encode('question:'), dtype=torch.long) q_end = torch.tensor(tokenizer.encode(':question'), dtype=torch.long) tensors = [[] for i in range(3)] for i in trange(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_data():\n user_name = os.environ.get('USER')\n traintest_corpus = ResumeCorpus('/Users/' + user_name + '/Documents/Data')\n random.shuffle(traintest_corpus.resumes)\n\n for resume in traintest_corpus.resumes:\n try:\n review_text = pre_processing(resume[0])\n re...
[ "0.6381256", "0.61704665", "0.6150791", "0.61070114", "0.6052635", "0.60219157", "0.6011219", "0.5969777", "0.5967805", "0.5960829", "0.59575015", "0.5916582", "0.5907612", "0.58599246", "0.58495444", "0.583701", "0.58334464", "0.5833186", "0.58210236", "0.5818004", "0.578608...
0.6146939
3
This evaluates the Borehole function using a subprocess running compiled code. Note that the Executor base class submit runs a serial process inplace. This should work on compute nodes so long as there are free contexts.
def subproc_borehole(H, delay): with open("input", "w") as f: H["thetas"][0].tofile(f) H["x"][0].tofile(f) exctr = Executor.executor args = "input" + " " + str(delay) task = exctr.submit(app_name="borehole", app_args=args, stdout="out.txt", stderr="err.txt") calc_status = exctr.pol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n try:\n self._execute_func(self._params)\n except Exception, e:\n print str(e)\n self._parallel_executer.release()", "def __call__(self):\n return self._executor()", "def _run_executor(ejobs, machine, assignment, timeout, kernel_messages):\n ...
[ "0.6250415", "0.610581", "0.6065356", "0.6052186", "0.58854985", "0.5843875", "0.5820821", "0.5800925", "0.5734414", "0.57106155", "0.56652045", "0.56579715", "0.5598459", "0.55800426", "0.5577861", "0.5566699", "0.5563498", "0.55468994", "0.5540453", "0.5497623", "0.54588884...
0.0
-1
Wraps the borehole function Subprocess to test receiving kill signals from manager
def borehole(H, persis_info, sim_specs, libE_info): calc_status = UNSET_TAG # Calc_status gets printed in libE_stats.txt H_o = np.zeros(H["x"].shape[0], dtype=sim_specs["out"]) # Add a delay so subprocessed borehole takes longer sim_id = libE_info["H_rows"][0] delay = 0 if sim_id > sim_specs["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_parent_process_kill(self):", "def remote_kill():", "def test_stopProcessForcedKill(self):\r\n self.pm.startService()\r\n self.pm.addProcess(\"foo\", [\"foo\"])\r\n self.assertIn(\"foo\", self.pm.protocols)\r\n self.reactor.advance(self.pm.threshold)\r\n proc = self.pm...
[ "0.72107", "0.69551826", "0.66956586", "0.6674258", "0.64437044", "0.641544", "0.6345274", "0.62977797", "0.6271215", "0.624368", "0.6164998", "0.6142843", "0.6131285", "0.61203116", "0.61101794", "0.61093026", "0.60986966", "0.60873014", "0.60727215", "0.6048453", "0.602942"...
0.0
-1
Walk the selected fields (part of the gql query) recursively.
def _optimize_gql_selections(self, selected_fields: List[SelectedField], graphql_type, store: QueryOptimizerStore = None) -> QueryOptimizerStore: _logger.info('_optimize_gql_selections %r %r', graphql_type, selected_fields) if not store: store = QueryOptimize...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_fields(node):\r\n for field in getattr(node, '_fields', ()) or ():\r\n try:\r\n yield field, getattr(node, field)\r\n except AttributeError:\r\n pass", "def parse_fields(q, fields):\n for f in fields:\n current_node = q\n last_idx = 0\n quot...
[ "0.60911274", "0.58325875", "0.5736242", "0.5622641", "0.5581321", "0.5567092", "0.55273837", "0.5496403", "0.5462031", "0.545002", "0.53911525", "0.53628486", "0.53516597", "0.53372884", "0.5335005", "0.5310861", "0.5310636", "0.5241845", "0.51789254", "0.5177498", "0.513816...
0.5608912
4
Add optimization to the store by inspecting the model field type.
def _optimize_field_by_name(self, store: QueryOptimizerStore, model, selection, field_def) -> bool: name = self._get_name_from_field_dev(field_def) if not (model_field := self._get_model_field_from_name(model, name)): return False _logger.info('_optimize_field_by_name %r %r', name, m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _optimize_field_by_hints(self, store: QueryOptimizerStore, selected_field, field_def) -> bool:\n if not (optimization_hints := getattr(field_def, 'optimization_hints', None)):\n return False\n args = selected_field.arguments\n self._add_optimization_hints(optimization_hints.sele...
[ "0.53922397", "0.537939", "0.49929884", "0.47674727", "0.47306097", "0.46442184", "0.45238703", "0.45149407", "0.45139423", "0.45052016", "0.45049003", "0.44889838", "0.4485591", "0.4484575", "0.4460081", "0.4451049", "0.44423994", "0.44279674", "0.4426244", "0.442454", "0.44...
0.5479826
0
Add the optimizations from the resolver_hints decorator to the store.
def _optimize_field_by_hints(self, store: QueryOptimizerStore, selected_field, field_def) -> bool: if not (optimization_hints := getattr(field_def, 'optimization_hints', None)): return False args = selected_field.arguments self._add_optimization_hints(optimization_hints.select_relate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_hints(self, **hints):\n self._hints.update(hints)", "def update_optimizer(self, context, optimizer, host):\n pass", "def setup_optimizers(self, *args, **kwargs):\n\n # self.optimizers.append(...)\n # self.loss.append(...)\n pass", "def _add_lazyload_options(self, o...
[ "0.6120944", "0.5490147", "0.54176563", "0.52781653", "0.51241463", "0.50488275", "0.49040857", "0.49034598", "0.4894648", "0.4883001", "0.48744258", "0.48651642", "0.48068908", "0.47903302", "0.47814724", "0.473934", "0.47289", "0.46801856", "0.4662181", "0.46440312", "0.462...
0.5351505
3
Perform an upload of the given file to the current user's account The upload process consists of three steps and a loop. First, we request and receive an "upload ticket" from Vimeo. This ticket represents our place in the queue of videos waiting to upload. After successfully obtaining this ticket, we upload the binary ...
def __call__(self, name, post_check_hook=None): def do_upload(): video_data, filetype = self.read_file(name) ticket_id, upload_uri, complete_uri = self.get_upload_ticket() log.info("Ticket ID: %s" % ticket_id) _range = 0 hook_break = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file(self, file_upload_parameters, progress=None):\n\n file_upload_parameters._submit_upload_parameters.timeout_in_milliseconds = file_upload_parameters.timeout_in_milliseconds\n operation = self.submit_upload(file_upload_parameters._submit_upload_parameters)\n return self.download_...
[ "0.6913328", "0.64488506", "0.6341638", "0.6326437", "0.63007796", "0.62839514", "0.62739664", "0.62476707", "0.6243486", "0.6209967", "0.6197469", "0.6196735", "0.6184578", "0.6173266", "0.6143371", "0.6109111", "0.6083066", "0.60762596", "0.6070302", "0.60671276", "0.604248...
0.59804696
27
Open a binary file and return its contents and extension
def read_file(self, filename): data = None with open(filename, "rb") as f: data = f.read() filetype = filename.split('.')[-1] if '.' in filename.split('/')[-1] else None return data, filetype
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_binary(fname):\n with open(fname, 'rb+') as f_name:\n data = f_name.read()\n return data", "def ReadBinaryFile(name):\n\n try:\n fBinary = open(name, 'rb')\n except:\n return None\n try:\n content = fBinary.read()\n except:\n return None\n finally:\...
[ "0.73417205", "0.6876805", "0.6709726", "0.66392875", "0.6591508", "0.6574621", "0.6560591", "0.6469011", "0.6448845", "0.63792706", "0.63552374", "0.6351509", "0.6344689", "0.6221042", "0.6202726", "0.62002987", "0.61832154", "0.6179081", "0.61498123", "0.6124398", "0.611265...
0.62648433
13
Obtain an upload ticket from the API
def get_upload_ticket(self): r = HTTPClient().fetch(self.config['apiroot'] + self.ticket_path, method="POST", body=urlencode({'type': 'streaming'}), headers = self.standard_headers, validate_cert=not self.config['dev']) response = json.loads(r.body) return respons...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_service_ticket():\n\n payload = {'username': APIC_EM_USER, 'password': APIC_EM_PASSW}\n url = 'https://' + APIC_EM + '/ticket'\n header = {'content-type': 'application/json'}\n ticket_response = requests.post(url, data=json.dumps(payload), headers=header, verify=False)\n if not ticket_respon...
[ "0.67064804", "0.5887511", "0.58059216", "0.5711891", "0.558435", "0.55571055", "0.55388236", "0.5534896", "0.55088025", "0.54868495", "0.54192376", "0.531124", "0.5295683", "0.5222806", "0.5221019", "0.51976347", "0.51389897", "0.51316166", "0.51182204", "0.50823814", "0.507...
0.8335117
0
Upload a piece of a video file to Vimeo Makes a PUT request to the given URL with the given binary data The _range parameter indicates the first byte to send. The first time you attempt an upload, this will be 0. The next time, it will be the number returned from get_last_uploaded_byte, if that number is less than the ...
def upload_segment(self, upload_uri, _range, data, filetype): content_range = '%d-%d/%d' % (_range, len(data), len(data)) upload_headers = {'Content-Type': 'video/%s' % filetype, 'Content-Length': len(data), 'Content-Range': 'bytes: %s' % content_range} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_range( # type: ignore\n self, data, # type: bytes\n start_range, # type: int\n end_range, # type: int\n validate_content=False, # type: Optional[bool]\n timeout=None, # type: Optional[int]\n encoding='UTF-8',\n **kwargs\n ...
[ "0.6141114", "0.5634965", "0.56206375", "0.550832", "0.5482587", "0.54187346", "0.5404088", "0.538972", "0.5272799", "0.52320516", "0.5201052", "0.511785", "0.51038563", "0.5073653", "0.5050996", "0.49917027", "0.49861932", "0.49765033", "0.49168584", "0.49088553", "0.4880528...
0.7709178
0
Get the last byte index of the file successfully uploaded Performs a PUT to the given url, which returns a Range header indicating how much of the video file was successfully uploaded. If less than the total file size, this number is used in subsequent calls to upload_segment
def get_last_uploaded_byte(self, check_uri): upload_check_headers = {'Content-Range': 'bytes */*'} request_headers = dict(upload_check_headers.items() + self.standard_headers.items()) try: HTTPClient().fetch(check_uri, method="PUT", body='', headers=request_headers) except HT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_size(url: str):\n header = requests.head(url).headers\n if \"Content-Length\" in header and header[\"Content-Length\"] != 0:\n return int(header[\"Content-Length\"])\n elif \"Location\" in header:\n h = requests.head(header[\"Location\"]).headers\n return int(h.get(\"Cont...
[ "0.61535513", "0.5919975", "0.5807138", "0.5694676", "0.56919193", "0.5665816", "0.562974", "0.55861944", "0.54725754", "0.54708993", "0.54157346", "0.53107536", "0.53089446", "0.5262854", "0.52135384", "0.51811814", "0.5161932", "0.5133586", "0.5120558", "0.5094605", "0.5090...
0.6557539
0
Delete the upload ticket (to be used once get_last_uploaded_byte() == total file size) Makes a DELETE request to the given URI, removing the upload ticket and setting the upload status to "processing"
def delete_upload_ticket(self, complete_uri): url = self.config['apiroot'] + complete_uri log.info("Requesting %s" % url) r = HTTPClient().fetch(url, method="DELETE", headers=self.standard_headers, validate_cert=not self.config['dev']) log.info("Upload comp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, _uri):\n print(\"Deleting '%s'\"%(_uri))\n response = self.__httpsRequest('DELETE', _uri, '')", "def delete(self):\n try:\n flash_message = request.json[\"flash_message\"]\n folder_path = \"{0}/user_uploads/{1}/{2}/\".format(self.__APP_PATH__, ...
[ "0.67701095", "0.64577615", "0.6345733", "0.61198354", "0.6112959", "0.6029433", "0.59412366", "0.5909342", "0.5896206", "0.5832445", "0.5818534", "0.57876617", "0.5784361", "0.5783744", "0.5763343", "0.57614774", "0.5744645", "0.57401735", "0.5735063", "0.57311624", "0.57280...
0.7901534
0
r"""Helper method for yielding various names + members of modules.
def get_named_members(model, get_members_fn, prefix='', recurse=True): memo = set() modules = model.named_modules(prefix=prefix) if recurse else [(prefix, model)] for i, (module_prefix, module) in enumerate(modules): members = get_members_fn(module) for k, v in members: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _named_members(self, get_members_fn, prefix='', recurse=True):\n memo = set()\n modules = self.named_modules(prefix=prefix) if recurse else [(prefix, self)]\n for module_prefix, module in modules:\n members = get_members_fn(module)\n for k, v in members:\n ...
[ "0.72332364", "0.69934905", "0.66442704", "0.6641855", "0.65818375", "0.65763384", "0.6490665", "0.64709103", "0.6409749", "0.6361901", "0.6215152", "0.6214206", "0.6196199", "0.6162733", "0.61518407", "0.61518407", "0.60533714", "0.6052606", "0.59672785", "0.5960688", "0.594...
0.6819973
2
Init object to store step and trial data.
def init_data(stats_list): data = {stats_name: {} for stats_name in stats_list} return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._trials = [] # private variables _ convention", "def __init__( self ):\n self._env = None\n self._steps = None\n\n self._initialize( )", "def init(self, **kwargs):\n self._d = {}\n self._th = None\n self._run = True\n ...
[ "0.716681", "0.70468086", "0.6757133", "0.6672487", "0.66058046", "0.6582223", "0.653331", "0.65125954", "0.649741", "0.64206564", "0.63828874", "0.6369628", "0.6362635", "0.6338107", "0.6331931", "0.6317953", "0.6301544", "0.6297562", "0.62726104", "0.62723035", "0.6268866",...
0.0
-1
Record trial data and model state after a step during navigation.
def get_rec_stats(village, u, s, r, stim, GS, HC, hc_ro, vS, dlS, data, co_occ_pars, idx=None): res = {} if 'anim_data' in data: # Externally observable variables: action, state, reward, x-y position. x, y = village.animal_coords() res['anim_data'] = {'u': u, 's': s, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record(self, step):", "def do_step(self) -> None:", "def storeState(self):\n\n self.action_history[self.trial] = self.action\n self.ball_history[self.trial] = self.ballcolor", "def step(self, model):\n pass", "def step(self, model):\n pass", "def on_trial_add(self, trial: ...
[ "0.6487955", "0.6050769", "0.5991312", "0.5982613", "0.5982613", "0.5968404", "0.591018", "0.5843705", "0.5831286", "0.5749037", "0.5696999", "0.5677254", "0.56736565", "0.5658061", "0.5658061", "0.5654882", "0.5654626", "0.56524915", "0.5651177", "0.5645648", "0.56064904", ...
0.0
-1
Format recordings of GS HC connectivity.
def format_GS_HC_rec(res, s_hc, GS_HC): # GS - HC x-y mean position per HC unit. gs_hc_pos = pd.concat({i: pd.DataFrame(kv, index=['x', 'y'], columns=s_hc) for i, kv in res['gs_hc_pos'].items()}).unstack() # GS - HC entropy per HC unit. gs_hc_h = pd.Series([utils.entropy(gs_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coregister_formatted():\r\n\r\n print(\"begin coregister_formatted\")\r\n\r\n # check all records for pairs using the recordBegin time\r\n pair_records()\r\n\r\n # establish the beginning and end of the coregistered records\r\n define_pairedRecords()\r\n\r\n # coregister paired data in a sing...
[ "0.5985085", "0.5772294", "0.5695159", "0.5633481", "0.5580155", "0.553478", "0.5474018", "0.546638", "0.54650944", "0.54626495", "0.54481137", "0.53700316", "0.5360647", "0.5341959", "0.5339633", "0.5279129", "0.527552", "0.5239246", "0.5197716", "0.5166865", "0.51560336", ...
0.49148738
49
Process and format recorded learning results.
def format_learning(res, s_real, s_hc, GS_HC): # Format results. res = pd.DataFrame(res).T res.index.name = 'step' # Pre-calculate some stats. s_real_h = pd.concat({i: pd.Series(kv, index=s_real) for i, kv in res['s_real_h'].items()}).unstack() s_hc_h = pd.concat({i: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_results(self, episode, eval):\n if episode % 10 == 9:\n ave = np.mean(self.scores[episode - 9:episode])\n print('Episodes: {}, AveScores: {}, Alpha: {}, Steps: {}'.format(\n episode + 1, ave, self.alpha.item(), self.step_count))\n if eval:\n ...
[ "0.66430914", "0.5997761", "0.5993275", "0.5946991", "0.5923554", "0.5910248", "0.5840243", "0.5838326", "0.58113766", "0.5800332", "0.5793081", "0.5748188", "0.5714592", "0.56949764", "0.5694171", "0.5687105", "0.5685428", "0.5673243", "0.5668452", "0.56547135", "0.5650398",...
0.533079
58
Return summary stats of recorded data.
def summarize_rec_data(data): # Warning: not all collectible data has a summary stats implemented below! # See get_rec_stats() above! stats = {} if 'hc_ro' in data: # Entropy across HC units average over samples. hc_ro_arr = np.array(list(data['hc_ro'].values())) stats['H HC r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_summary_stats(self):\r\n n = len(self.results)\r\n\r\n if n == 0:\r\n mean = None\r\n stdev = None\r\n\r\n elif n == 1:\r\n mean = numpy.mean(self.results)\r\n stdev = None\r\n\r\n else:\r\n mean = numpy.mean(self.results)\r...
[ "0.7375736", "0.71892005", "0.68082", "0.675289", "0.67228687", "0.6701924", "0.66873115", "0.66815513", "0.6668492", "0.6614487", "0.66084427", "0.65882283", "0.6587884", "0.6563548", "0.65191305", "0.6514346", "0.6482753", "0.64782995", "0.64565426", "0.6439179", "0.6433357...
0.6649093
9
Format recorded simulation data.
def format_rec_data(tr_data, village, HC, gs_pars, vfeatures, idx_pars=[]): print('\nFormatting recorded data...') ret_list = [] gs_xvec, gs_yvec = [utils.get_copy(gs_pars[v]) for v in ['xvec', 'yvec']] if 'anim_data' in tr_data: anim_data = pd.DataFrame(tr_data['anim_data']).T ret_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format(self, data):", "def format_data(self, data):", "def _formatData(self):\r\n assert self._runData is not None\r\n\r\n # Getting Axes data into separate lists\r\n x=[]; y=[]; z=[]\r\n for i in range(len(self._runData)):\r\n ySet = []; xSet = []; zSet = []\r\n ...
[ "0.6369223", "0.6365222", "0.585794", "0.5771995", "0.5722368", "0.5701128", "0.5615324", "0.56003875", "0.5577038", "0.55621386", "0.5557003", "0.5556837", "0.55493116", "0.5504945", "0.5502198", "0.54964334", "0.5491324", "0.5473072", "0.5443231", "0.54316455", "0.5413139",...
0.51327187
57
Report progress of simulation.
def report_progr(i, n, freq=1000): if not i % freq: print('\t{} / {}'.format(str(i).rjust(5), n)) # print('{}%'.format(int(100*istep/nsteps)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reportProgress(self):\n \n pass", "def report_scenario_progress(self):\n pass", "def report_progress(self):\r\n stats = self.simulation_stats.stats\r\n solutions = len(self.solutions)\r\n round = self.round\r\n scores = stats[round]\r\n best_score = min(s...
[ "0.78183013", "0.7616774", "0.7516212", "0.7346008", "0.7162934", "0.7073537", "0.6910481", "0.687008", "0.68546647", "0.6802137", "0.670709", "0.6668817", "0.6607123", "0.6585042", "0.65652347", "0.6525252", "0.6525252", "0.6443862", "0.6428839", "0.64268047", "0.64268047", ...
0.0
-1
Report progress during learning simulations.
def report_learning_progress(istep, nsteps, VC_HC, GS_HC, norm, mrh, mhh, rop=None): rep = '{}%'.format(int(100*istep/nsteps)).rjust(4) l_vc_hc = analysis.VC_HC_norm(VC_HC, norm).mean() l_gs_hc = analysis.GS_HC_norm(GS_HC, norm).mean() prog = '{} | VC-HC: {:.3f}, GS-HC: {:....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reportProgress(self):\n \n pass", "def report_scenario_progress(self):\n pass", "def show_progress(self, game):\n if self.verbose:\n if self.params.eval_interval is not None and (self.episode % self.params.eval_interval == 0):\n self._print_progress()\n ...
[ "0.71725804", "0.70678365", "0.6930796", "0.6844124", "0.6836328", "0.68133104", "0.67061037", "0.6654687", "0.6649508", "0.64450794", "0.64312387", "0.6404172", "0.6400389", "0.6358474", "0.63549787", "0.6334084", "0.63017714", "0.62951624", "0.62896836", "0.62857735", "0.62...
0.6581055
9
Return parameterized folder name of simulation.
def sim_dir_name(fdir, nsteps, stim_pars, hc_pars, gs_pars, str_pars): fn = ('nsteps_{}_GSHCsharp_{}'.format(nsteps, hc_pars['gs_hc_sharp']) + '_hcpow_{}'.format(hc_pars['ro_pow']) + '_msig_{}'.format(int(stim_pars['mot_sig'])) + '_vbeta_{}'.format(stim_pars['vis_beta']) + '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def folder(self, step=None):\n if step is None:\n return self._obs_group_folder / self._obs_folder\n else:\n return Path(step) / self._obs_group_folder / self._obs_folder", "def folder(self, step=None):\n if step is None:\n return self._obs_group_folder / sel...
[ "0.67199093", "0.67199093", "0.67199093", "0.6616217", "0.656852", "0.6482704", "0.6465053", "0.62389404", "0.62153554", "0.615684", "0.615684", "0.6155915", "0.6129946", "0.61195314", "0.6086348", "0.6066995", "0.60657847", "0.6050361", "0.5979955", "0.58812314", "0.5849302"...
0.659045
4
Return folder name for simulation results.
def get_res_dir_name(random, nx=None, ny=None, p_state=None, p_path=None, **kws): if random: fdir = 'random_env/' env_dir = 'nx{}_ny{}_pstate{}_ppath{}'.format(nx, ny, p_state, p_path) fdir += utils.format_to_fname(env_dir) + '/' else: fdir = 'village/' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def folder(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"folder\")", "def simulation_dir(self):\n try:\n return (self.output_directory / self.sim_id).expand()\n except AttributeError:\n return Path()", "def name_folder_data(data):\n string = 'results/S0(...
[ "0.7222843", "0.6902778", "0.6742704", "0.6699133", "0.66006047", "0.65905297", "0.65905297", "0.65905297", "0.6492835", "0.6459841", "0.6366473", "0.63570267", "0.630044", "0.62975377", "0.6291892", "0.6234195", "0.621634", "0.6193216", "0.6178031", "0.617218", "0.6141358", ...
0.0
-1
Return name of connectivity configuration.
def conn_config_name(conn_config): n_conn_config = [cname for cname, on in conn_config.items() if on] n_conn_config = ' + '.join(n_conn_config) return n_conn_config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._config_name", "def get_config_name(self): # pragma: no cover\n pass", "def name(self):\n return self._config.get(CONF_NAME)", "def connection_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"connection_name\")", "def connection_name(s...
[ "0.77077055", "0.7493195", "0.745413", "0.72979784", "0.7289367", "0.7035228", "0.6940678", "0.685062", "0.6848523", "0.6846582", "0.6830779", "0.68089354", "0.6791377", "0.675848", "0.67513496", "0.67148095", "0.66720396", "0.6649063", "0.66395855", "0.6601104", "0.6592569",...
0.7347803
3
Return world state HC state cooccurance matrix.
def get_co_occ_mat(s_hc_ml, n_s_real, n_s_hc): co_occs = np.zeros((n_s_hc, n_s_real)) for idx, n in s_hc_ml.items(): co_occs[idx] = n return co_occs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CTMCtoStormpy(h):\n\tstate_labelling = _buildStateLabeling(h)\n\ttransition_matrix = deepcopy(h.matrix)\n\te = array([h.e(s) for s in range(h.nb_states)])\n\ttransition_matrix /= e[:,newaxis]\n\ttransition_matrix = st.build_sparse_matrix(transition_matrix)\n\tcomponents = st.SparseModelComponents(transition_m...
[ "0.635167", "0.59943235", "0.58283806", "0.5816899", "0.5784517", "0.57605594", "0.5751287", "0.5710274", "0.57057977", "0.56717366", "0.5666582", "0.56537753", "0.562778", "0.56184703", "0.56027305", "0.56016433", "0.5601625", "0.55812305", "0.555667", "0.5529863", "0.552653...
0.63109434
1
Update world state HC state cooccurance matrix.
def update_co_occ_mat(hc_ro, i_s_real, co_occs, co_occ_list, idx, nsteps): # Go to next element in circular array. idx = (idx + 1) % nsteps # Remove estimate from left hand side of time window. if len(co_occ_list[idx]): i_s_real_left, hc_ro_left = co_occ_list[idx] co_occs[:, i_s_real_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_world(self):\n pass", "def update_H(self):\n self.grid.H[self.loc] -= (\n self.grid.courant_number\n * self.grid.inverse_permeability[self.loc]\n * self.phi_H\n )", "def _update_loc(self) -> None:\n self.state[:, :, Boids.Attr.LOC] += self...
[ "0.59525", "0.59345645", "0.58975", "0.57189", "0.56345606", "0.5619074", "0.5619074", "0.55726504", "0.55646217", "0.5538941", "0.5527422", "0.5505704", "0.5498921", "0.5483387", "0.54796284", "0.54754066", "0.5472103", "0.5468159", "0.54635316", "0.5440324", "0.54234046", ...
0.5303621
31
Collect data from a single step of connectivity learning.
def record_learning(village, s, GS, HC, hc_ro, dVC_HC, dGS_HC, co_occs, norm): # Animal's real and estimated position and location + uncertainty. x, y = village.animal_coords() gs_x, gs_y = analysis.GS_pos_mean(GS.P, GS.xvec, GS.yvec, GS.circular) gs_h = utils.entropy(GS.P.flatten()) hc_ml = HC.s_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_collect(self, src, collector): # real signature unknown; restored from __doc__\n pass", "def collect_data(endless):\r\n click.echo(\"start collecting data ...\")\r\n _collect_data(endless)", "def collect_data(self,sensation,action,reward,next_sensation):\n pass", "def run(self...
[ "0.58938706", "0.5764855", "0.5659415", "0.555809", "0.54953295", "0.54437625", "0.5437285", "0.54306674", "0.542526", "0.53984416", "0.5388055", "0.5355798", "0.5355798", "0.5281315", "0.52788657", "0.5276297", "0.5263628", "0.5263628", "0.5263628", "0.5263628", "0.5263628",...
0.0
-1
Get number of real and estimated state cooccurances.
def get_co_occ_matrix(res, last_n, s_real, s_hc): s = np.array(res['s'])[-last_n:] hc_ml = np.array(res['hc_ml'])[-last_n:] co_occs = np.zeros((len(s_hc), len(s_real))) for si, hc_mli in zip(s, hc_ml): co_occs[s_hc.index(hc_mli), s_real.index(si)] += 1 co_occs /= co_occs.sum() return c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constituent_count(self):\n return self._constituent_count", "def num_conll(self):\n pass", "def StateCounts(self):\r\n\t\treturn self._get_attribute('stateCounts')", "def num_carns(self):\n return self._num_carns", "def number_of_constituents(bc_class):\n num_trn = 0\n cn = b...
[ "0.72566885", "0.6694087", "0.6514297", "0.65112036", "0.64747995", "0.6469168", "0.64518386", "0.64387137", "0.64271784", "0.64253205", "0.6421117", "0.64210594", "0.6419776", "0.64074904", "0.6388321", "0.63843083", "0.6365295", "0.63594586", "0.63399863", "0.63103896", "0....
0.0
-1
Return learned HC state order from cooccurance matrix by taking best matching pairs world location HC state pairs.
def get_s_order(co_occs, s_hc=None): # Greedy approach: just go through items from max to min. free_rows, free_cols = [list(range(n)) for n in co_occs.shape] s_ord = -np.ones(co_occs.shape[0], dtype=int) co_normed = norm_co_occ_matrix(co_occs) isrtd = np.unravel_index(co_normed.argsort(axis=None)[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_nearest_state(self): # TODO: Check if we need here state, instead of self.state\n self.stateC = self.toConceptual(self.state)\n CTP, winners = self.find_winner()\n\n state_name = self.find_TPname(filleridx=winners)\n binding = self.find_symBinding(filleridx=winners)\n s...
[ "0.5657669", "0.5559561", "0.5372872", "0.53349", "0.5301023", "0.5282986", "0.52419263", "0.5127219", "0.5086206", "0.50741035", "0.5065264", "0.50308555", "0.5025374", "0.50204796", "0.50141317", "0.5002204", "0.5002081", "0.4969301", "0.49646002", "0.4962375", "0.4949405",...
0.62907976
0
Return entropy of each village location state across HC activations.
def get_loc_co_occ_entropy(co_occs, v_repl_nan=None): return utils.get_row_entropy(co_occs, v_repl_nan)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(self):\n raise NotImplementedError", "def entropy(self):\n\n \"\"\"Gets the first neighbours, which are the first 2*r+1 cells.\"\"\"\n current_neighbours = []\n amount = [0] * self.k ** (2 * self.r + 1)\n for i in range(2 * self.r + 1):\n current_neighbours.append(self.confi...
[ "0.64681673", "0.64361626", "0.6397468", "0.63540465", "0.6292579", "0.6235017", "0.6153285", "0.6081148", "0.60573524", "0.6038061", "0.60269433", "0.60266095", "0.60248816", "0.59867597", "0.5969544", "0.59659535", "0.5924177", "0.5898555", "0.58884066", "0.583654", "0.5814...
0.0
-1
Return entropy of each HC state across village locations.
def get_hc_co_occ_entropy(co_occs, v_repl_nan=None): return utils.get_row_entropy(co_occs.T, v_repl_nan)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(self):\n\n \"\"\"Gets the first neighbours, which are the first 2*r+1 cells.\"\"\"\n current_neighbours = []\n amount = [0] * self.k ** (2 * self.r + 1)\n for i in range(2 * self.r + 1):\n current_neighbours.append(self.config[self.t, i % self.width])\n\n \"\"\"Calculates the rule...
[ "0.67780423", "0.6692582", "0.66096693", "0.6583241", "0.646438", "0.6463834", "0.64497703", "0.643623", "0.6350943", "0.6336463", "0.6297908", "0.62889063", "0.62844735", "0.6246048", "0.62386346", "0.62371117", "0.6227964", "0.62140536", "0.6190457", "0.618255", "0.6164896"...
0.0
-1
Test the connection of the bot.
async def ping(self, ctx): msg_time = ctx.message.created_at cur_time = datetime.utcnow() delay = (cur_time - msg_time) / timedelta(milliseconds=1) await ctx.send(f"Pong! ({str(delay)} ms)")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_connection(self):\n await self.webhook_connection.connect()\n assert self.webhook_connection.is_connected is True", "def test_connection(self):\n r = main.List.connection()\n self.assertTrue(r.ping(), \"Connection failed.\")", "def test_connect(rgd):\n assert rgd.c...
[ "0.7984916", "0.73088425", "0.70733136", "0.6972396", "0.6922865", "0.68271625", "0.6753107", "0.67112476", "0.667889", "0.6632673", "0.66180444", "0.66106814", "0.65947783", "0.65855265", "0.6513005", "0.64952236", "0.6448094", "0.6343192", "0.63170284", "0.63074887", "0.630...
0.0
-1
Link a spotify account to the bot.
async def link(self, ctx): if not is_linked(ctx.author.id): token = str(uuid.uuid4()) valid_until = int((datetime.utcnow() + timedelta(days=1)).timestamp()) add_token(ctx.author.display_name, ctx.author.id, token, valid_until, str(ctx.author.avatar_url)) web_base_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def link(ctx, bot: typing.Union[discord.Member, discord.User]):\n if not bot.bot:\n return await r(ctx, \"Not a bot.\")\n await r(ctx, f'<https://www.motiondevelopment.top/bots/{bot.id}>')", "async def info(self, ctx):\n if ctx.guild is not None:\n await ctx.reply(\"This comm...
[ "0.6603521", "0.63787323", "0.6339056", "0.6307534", "0.62112045", "0.6183406", "0.60342115", "0.6027001", "0.60145694", "0.60145694", "0.5984008", "0.59183764", "0.5639046", "0.5622354", "0.5614502", "0.5600881", "0.5547755", "0.5491989", "0.5484494", "0.54839873", "0.547692...
0.7880789
0
Unlink a spotify account from the bot.
async def unlink(self, ctx): # Remove all link tokens and spotify details for this user remove_tokens(ctx.author.id) remove_spotify_details(ctx.author.id) await ctx.reply("All your linked accounts were removed, if you had any!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unlink(self, link_id):", "def unfollow_profile(self):\n self.find_clickable_element(self.ISFOLLOWED_BTN).click()", "async def twitter_unfollow(self, ctx, handle):\n sane_handle = handle.lower().lstrip('@')\n conf = dutils.get(self.conf.follows, screen_name=sane_handle)\n chan_co...
[ "0.63025486", "0.61723953", "0.6036946", "0.59427714", "0.5927398", "0.59164095", "0.5912746", "0.5850332", "0.5843319", "0.58328366", "0.5821932", "0.5803021", "0.57848567", "0.5749491", "0.5748773", "0.5742856", "0.5740611", "0.57387394", "0.5726775", "0.5691439", "0.567866...
0.745899
0
Displays basic info about your linked spotify account (name, avatar)
async def info(self, ctx): if ctx.guild is not None: await ctx.reply("This command can only be used in DMs, because of privacy reasons.") raise commands.CommandError("Invoker not in DMs.") if not is_linked(ctx.author.id): await ctx.reply(f"You don't have a Spotify ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(verbose):\n user_data = Spotify.request('me', method='GET')\n click.echo('Logged in as {}'.format(user_data['display_name']))\n if verbose:\n click.echo('Credentials stored in {}'.format(CREDS_PATH))\n return", "async def githubinfo_command(self, ctx, *, githubusername: str):\n ...
[ "0.65351516", "0.6477003", "0.64630944", "0.62933874", "0.62896085", "0.6278736", "0.6263717", "0.6239856", "0.62017554", "0.61626744", "0.61613786", "0.6148831", "0.6129267", "0.6054022", "0.60383016", "0.6036688", "0.6031312", "0.6021112", "0.5999502", "0.599438", "0.598736...
0.7391768
0
Makes the bot join your voice channel
async def join(self, ctx): if ctx.guild is None: await ctx.reply("This command can only be used in a server, not in DMs.") raise commands.CommandError("Invoker not in a guild.") if not is_linked(ctx.author.id): await ctx.reply(f"You don't have a Spotify account linke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def join(self, ctx):\n voice = ctx.author.voice\n\n if voice and voice.channel:\n channel = voice.channel\n \n try:\n await channel.connect()\n except discord.errors.ClientException:\n await ctx.guild.get_member(self.bot....
[ "0.8252359", "0.8217584", "0.8208582", "0.7949153", "0.79472905", "0.78682876", "0.786053", "0.77314293", "0.7688857", "0.76547545", "0.75633955", "0.75611305", "0.7534342", "0.753236", "0.7313502", "0.71708095", "0.7167358", "0.7105433", "0.70923823", "0.6946052", "0.6941861...
0.69570655
19
Makes the bot leave your voice channel
async def leave(self, ctx): if ctx.guild is None: await ctx.reply("This command can only be used in a server, not in DMs.") raise commands.CommandError("Invoker not in a guild.") if ctx.author.voice is None or ctx.author.voice.channel is None: await ctx.reply("You ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def leave(self, ctx):\n if ctx.guild.voice_client:\n await ctx.guild.voice_client.disconnect()\n await ctx.send(\"Left voice channel.\")\n else:\n await ctx.message.add_reaction('\\U0001F615');\n await ctx.send(\"Not in a voice channel.\")", "async ...
[ "0.8343599", "0.77186316", "0.7650133", "0.76289874", "0.758633", "0.7526717", "0.74780494", "0.7415649", "0.7250327", "0.7245011", "0.7157922", "0.70776135", "0.70071197", "0.6973833", "0.6932585", "0.69310313", "0.6870495", "0.6870495", "0.68690455", "0.68123126", "0.680512...
0.79554284
1