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
Writes an inverted depth map for visualization purposes
def write_inverse_depth_map(image, file_path, exp=2): max_int = 65535 image = image.astype(np.float) # First normalize image so it has min 0 and max = max_int image -= image.min() image *= (max_int / image.max()) # Invert the depth map and clip values inv_depth = np.power((max_int - ima...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depth_write(filename, depth):\n height,width = depth.shape[:2]\n f = open(filename,'wb')\n # write the header\n f.write(TAG_CHAR)\n np.array(width).astype(np.int32).tofile(f)\n np.array(height).astype(np.int32).tofile(f)\n \n depth.astype(np.float32).tofile(f)\n f.close()", "def vi...
[ "0.6111801", "0.5630799", "0.56008345", "0.55997056", "0.5511597", "0.542956", "0.5360804", "0.5283929", "0.52789986", "0.52727956", "0.52653193", "0.52343005", "0.5219354", "0.5218975", "0.52015257", "0.51914287", "0.5164077", "0.5152135", "0.51328915", "0.51264036", "0.5116...
0.7003182
0
Write the reference image to file
def write_reference_image(image, file_path): image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR) image_file = file_io.FileIO(file_path, mode='w') scipy.misc.imsave(image_file, image) if FLAGS.wandb: import_wandb_idempotent() wandb.log({"reference_images": wandb.Image( image, capti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, image):\n raise NotImplementedError()", "def write_image(self, filename):\n cv2.imwrite(filename, self.image)", "def write(self, filename):\n\n self.__image.save(filename)", "def write_image(self, image_name, image):\n raise NotImplementedError", "def _write_imag...
[ "0.69628483", "0.69618964", "0.68769765", "0.6668209", "0.66418636", "0.6594738", "0.6593247", "0.6537305", "0.65141255", "0.6454284", "0.6440225", "0.6417902", "0.63384825", "0.62854207", "0.6278705", "0.6278705", "0.62725496", "0.62672776", "0.62109727", "0.62030536", "0.62...
0.8076047
0
Writes an inverted depth map for visualization purposes
def write_residual_depth_map(image, file_path, exp=0.5): max_int = 255 image = image.astype(np.float) mean = image.mean() max_val = image.max() min_val = image.min() logger.debug('Residual max: {}'.format(max_val)) logger.debug('Residual min: {}'.format(min_val)) logger.debug('Resi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_inverse_depth_map(image, file_path, exp=2):\n \n max_int = 65535\n image = image.astype(np.float)\n # First normalize image so it has min 0 and max = max_int\n image -= image.min()\n image *= (max_int / image.max())\n # Invert the depth map and clip values\n inv_depth = np.power((...
[ "0.70031416", "0.6110085", "0.56295574", "0.5600064", "0.5599017", "0.5512026", "0.54294527", "0.5361181", "0.52845156", "0.5278336", "0.52728504", "0.5265435", "0.5233144", "0.52196044", "0.5217397", "0.5202344", "0.51654273", "0.5151796", "0.51325256", "0.51262194", "0.5116...
0.5189412
16
generate data paths for dtu dataset
def gen_dtu_resized_path(dtu_data_folder, mode='training'): sample_list = [] # parse camera pairs cluster_file_path = dtu_data_folder + '/Cameras/pair.txt' # cluster_list = open(cluster_file_path).read().split() cluster_list = file_io.FileIO(cluster_file_path, mode='r').read().split() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autogen_dataset_dir():\n return TabularDataset.autogen('tests/data/dummy_tabular',\n seed=42,\n sep=',')", "def generateDataset(self):\n if self.outdir[-1] != \"/\": \n self.outdir += \"/\"\n self.outdir += \"datase...
[ "0.66966194", "0.6437311", "0.6421882", "0.6421093", "0.6316651", "0.6315315", "0.6259675", "0.619285", "0.61859965", "0.60999316", "0.6097666", "0.60788786", "0.60581553", "0.60104614", "0.60084826", "0.6007234", "0.59923065", "0.5981146", "0.5971617", "0.59422904", "0.59422...
0.5999998
16
generate data paths for dtu dataset
def gen_dtu_mvs_path(dtu_data_folder, mode='training'): sample_list = [] # parse camera pairs cluster_file_path = dtu_data_folder + '/Cameras/pair.txt' cluster_list = open(cluster_file_path).read().split() # 3 sets training_set = [2, 6, 7, 8, 14, 16, 18, 19, 20, 22, 30, 31, 36, 39, 41, 42,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autogen_dataset_dir():\n return TabularDataset.autogen('tests/data/dummy_tabular',\n seed=42,\n sep=',')", "def generateDataset(self):\n if self.outdir[-1] != \"/\": \n self.outdir += \"/\"\n self.outdir += \"datase...
[ "0.6694901", "0.6435885", "0.64210147", "0.6420062", "0.631535", "0.6313179", "0.62584823", "0.6191585", "0.6185221", "0.6098146", "0.6097748", "0.607737", "0.60091794", "0.6007109", "0.60057515", "0.59979534", "0.5991712", "0.5981123", "0.59703183", "0.59416646", "0.5940204"...
0.6056206
12
The data_root directory should contain multiple sessions, which are then parsed into the data structure that the train data generator expects
def gen_data(data_root, val_ratio = 0.1): session_list = os.listdir(data_root)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_sessions_raw(data_folder, dataset_id, subject):\r\n runs = []\r\n labels = []\r\n sessions_path = []\r\n bad_sessions_path = []\r\n\r\n # the following verification will be required for handling several datasets\r\n if dataset_id in [\"raw_clean_32\"]:\r\n # stack all subject's se...
[ "0.6645324", "0.6629811", "0.6509914", "0.6344045", "0.6299465", "0.62585074", "0.6237367", "0.61997366", "0.6190447", "0.61850005", "0.6172695", "0.6130764", "0.6053007", "0.6043277", "0.6009851", "0.6003062", "0.5983032", "0.5980272", "0.59700936", "0.5967737", "0.5965835",...
0.7452929
0
mvs input path list
def gen_pipeline_mvs_list(dense_folder): image_folder = os.path.join(dense_folder, 'images') cam_folder = os.path.join(dense_folder, 'cams') cluster_list_path = os.path.join(dense_folder, 'pair.txt') cluster_list = open(cluster_list_path).read().split() # for each dataset mvs_list = [] pos ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReadMaterialNameList(InputPath,MaterialInputFormat):\r\n\r\n FullNameList=os.listdir(InputPath)\r\n MaterialPathList=[]\r\n\r\n for FullName in FullNameList:\r\n Name,NameType=os.path.splitext(FullName)\r\n if NameType=='.'+MaterialInputFormat:\r\n MaterialPath=os.path.join(In...
[ "0.5590496", "0.55235755", "0.551063", "0.5434746", "0.5407543", "0.533063", "0.5286901", "0.5258207", "0.52529585", "0.5233829", "0.5219519", "0.52053213", "0.51721156", "0.5170925", "0.5170338", "0.51638436", "0.51434004", "0.5124624", "0.50988007", "0.5092586", "0.5089801"...
0.56417423
0
Bottleneck style deconvolutional block. Applies convolution to decrease to fewer features. upscales in lower feature space. Convolves to specified feature numbers
def deconv_block(input_tensor: tf.Tensor, features: int, name: str) -> tf.Tensor: out = input_tensor out = KL.Conv2D( int(features // 2), 1, strides=(1, 1), name=name + f"_c{1}", )(input_tensor) out = KL.Activation("relu")(KL.BatchNormalization()(out)) out = KL.Conv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deconv2d(layer_input, skip_input, filters, f_size=4, dropout_rate=0):\n u = UpSampling2D(size=2)(layer_input)\n u = Conv2D(filters, kernel_size=f_size, strides=1, padding='same', activation='relu')(u)\n if dropout_rate:\n u = Dropout(dropout_rate)(u)\n ...
[ "0.66970915", "0.6696661", "0.65982324", "0.6569558", "0.6451675", "0.64417726", "0.6432913", "0.64248526", "0.6383107", "0.638251", "0.6306522", "0.62553823", "0.62296945", "0.62154955", "0.6210682", "0.62052447", "0.6203493", "0.6182055", "0.6151423", "0.6131423", "0.612682...
0.69930655
0
Bottleneck style convolutional block with skip connections across blocks. Applies downsample convolution in lower features space. Followed by single kernel convolution to higher feature space. Also, applies skip connections across blocks for routing information across levels.
def conv_block( input_tensor: tf.Tensor, skip_tensors: List[tf.Tensor], features_in: int, features_out: int, name: str, ) -> Tuple[tf.Tensor, List[tf.Tensor]]: out = KL.Conv2D( features_in, 1, strides=(1, 1), padding="same", use_bias=False, name=n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bottleneck_block(x, num_out_channels, block_name):\n # skip layer\n if K.int_shape(x)[-1] == num_out_channels:\n _skip = x\n else:\n _skip = Conv2D(num_out_channels, kernel_size=(1, 1), activation='relu', padding='same',\n name=block_name + '_skip')(x)\n\n # resi...
[ "0.68322164", "0.6781432", "0.6746523", "0.66436356", "0.6612772", "0.6579295", "0.6521966", "0.65205854", "0.6513803", "0.64872867", "0.64735466", "0.6468668", "0.6424998", "0.64214027", "0.6407201", "0.63719285", "0.6370339", "0.63593894", "0.6357853", "0.6347723", "0.63421...
0.61381096
47
shared classifier block across different training methods
def classifier_block( encoded_features: List[tf.Tensor], num_classes: int = 10, activation: str = "sigmoid", ) -> List[tf.Tensor]: # logits from the final layer of features of auto-encoder encoded_flat = KL.Flatten()(encoded_features[-1]) encoded_flat = KL.Dropout(rate=0.2)(encoded_flat) pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainModel( self, featureTrain, classTrain):", "def init_base_classifiers(x_train, y_train, num_iters=100):\n skcl = []\n inittime = time.time()\n clrf = RandomForestClassifier(n_estimators=num_iters, n_jobs=-1)\n skcl.append(('Plain RF', clrf))\n clgbdt = AdaBoostClassifier(n_estimators=num_i...
[ "0.68534786", "0.66875035", "0.6619651", "0.66132927", "0.6613114", "0.65983295", "0.6594656", "0.656212", "0.6537598", "0.65369475", "0.65308404", "0.6512962", "0.65069455", "0.6494956", "0.6486226", "0.6486226", "0.6486226", "0.6486226", "0.6486226", "0.6486226", "0.6486226...
0.0
-1
Creates an encoder model object
def encoder(self, features=[8], name="encoder") -> KM.Model: input_tensor = KL.Input( shape=(32, 32, 3) ) # shape of images for cifar10 dataset encoded = KL.Conv2D( features[0], 3, strides=(2, 2), padding="same", use_bias=F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, *args, **kwargs):\n return self.encoder_model(args[0])", "def __call__(self, *args, **kwargs):\n return self.encoder_model(args[0])", "def _define_encoder(self):\n raise NotImplementedError", "def build(self) -> KM.Model:\n\n # For decoder number of features in oppo...
[ "0.7027391", "0.7027391", "0.6910639", "0.6744384", "0.6633687", "0.65714514", "0.6520185", "0.64954454", "0.64383334", "0.63612366", "0.6351485", "0.63318825", "0.63094145", "0.6259516", "0.6197326", "0.61876756", "0.6138584", "0.6127006", "0.6114518", "0.6104231", "0.605633...
0.5484258
72
Creates a decoder model object
def decoder(self, features=[8], name="decoder") -> KM.Model: input_tensor = KL.Input(shape=(2, 2, features[0])) decoded = input_tensor for i, feature_num in enumerate(features[1:], start=1): decoded = deconv_block( decoded, feature_num, name + f"_deconv_{len(feature...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_decoder():\n # Create decoder instance and add predictors\n \n try:\n decoder = decoding.DECODER_REGISTRY[args.decoder](args)\n except Exception as e:\n logging.fatal(\"An %s has occurred while initializing the decoder: %s\"\n \" Stack trace: %s\" % (sys.ex...
[ "0.71663064", "0.7123767", "0.70514774", "0.68833774", "0.67947286", "0.6614461", "0.6368121", "0.63565487", "0.63006437", "0.6296596", "0.62494385", "0.6197395", "0.6173515", "0.6122774", "0.6061952", "0.60360974", "0.60130554", "0.6011263", "0.5970607", "0.594091", "0.59324...
0.60535115
15
Method to build Autoencoder model
def build(self) -> KM.Model: # For decoder number of features in opposite order of encoder decoder_features = self.encoder_features.copy() decoder_features.reverse() # build the encoder model self.encoder_model = self.encoder( features=self.encoder_features, name="e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_autoencoder(self):\n # first build the encoder model\n inputs = Input(shape=(self.state_dim, ), name='state')\n feature_size = 32\n x = Dense(256, activation='relu')(inputs)\n x = Dense(128, activation='relu')(x)\n feature = Dense(feature_size, name='feature_vect...
[ "0.82949173", "0.76155895", "0.75755745", "0.7398432", "0.7116697", "0.70985246", "0.7069066", "0.7069066", "0.70482296", "0.6987326", "0.6975115", "0.6914817", "0.69129205", "0.6911162", "0.68955237", "0.68723565", "0.6821266", "0.68082154", "0.6784743", "0.67726874", "0.676...
0.7890221
1
Method to build classifier model
def build_classify(self, num_classes: int = 10) -> KM.Model: input_tensor = KL.Input(shape=(32, 32, 3)) # if self.train_mode == "classifier": # # Use the pretrained encoder for classifier only training # self.encoder_model = KM.load_model("ae_model/ae_model.h5").get_layer( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model(train_inputs,train_labels,model_params,model_mode='classification',\n model_type='naive_bayes'):\n if model_mode == \"classification\":\n if model_type == \"naive_bayes\":\n model = GaussianNB()\n if model_type == \"knn\":\n model = KNeighbo...
[ "0.7652224", "0.7328233", "0.7305963", "0.72811687", "0.7168226", "0.7131451", "0.71167207", "0.71167207", "0.7115883", "0.7113275", "0.7082382", "0.7067969", "0.7043852", "0.70428365", "0.6967058", "0.6958724", "0.6957626", "0.6952456", "0.69424015", "0.6935968", "0.69316834...
0.7226934
4
Method to build combined AEclassifier model
def build_combined(self, num_classes: int = 10) -> KM.Model: # For decoder number of features in opposite order of encoder decoder_features = self.encoder_features.copy() decoder_features.reverse() # build the encoder model self.encoder_model = self.encoder( feature...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_basic_classifier_combined(model_1, model_2):\n dropout = None\n if model_1._dropout:\n dropout = model_1._dropout.p\n return BasicClassifierCombined(\n vocab=model_1.vocab,\n text_field_embedder=model_1._text_field_embedder,\n seq2vec_encoder=model_1._seq2vec_encoder,\...
[ "0.6536244", "0.6483086", "0.6468797", "0.6392163", "0.6377353", "0.6337379", "0.62867445", "0.6278908", "0.6192616", "0.6178061", "0.6157654", "0.6108731", "0.61081105", "0.61081105", "0.6094483", "0.60803396", "0.60578644", "0.60448474", "0.5951529", "0.59457785", "0.594467...
0.63710093
5
method to compile the model object with optimizer, loss definitions and metrics
def compile( self, classifier_loss: str = "focal", lr: float = 1e-3, gamma: float = 2.0, train_batch_size: int = 32, ): c_loss = contrastive_loss(hidden_norm=True, temperature=0.5, weights=1.0) if self.train_mode in ["both", "pretrain"]: self.model...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_model(\n self, \n loss: str, \n optimizer: Union[str, keras.optimizers.Optimizer], \n metrics: Optional[Union[Tuple[str,...], Tuple[Callable,...]]] = None\n ) -> None:\n self.model.compile(optimizer, loss, metrics)", "def _compile_model(\n ...
[ "0.7891401", "0.78085625", "0.76695526", "0.76102716", "0.75935614", "0.7457227", "0.7453047", "0.72680044", "0.72169596", "0.7204694", "0.71368915", "0.7109636", "0.708131", "0.7054109", "0.7015584", "0.70107293", "0.69914633", "0.69537216", "0.6947715", "0.6927457", "0.6901...
0.6450641
46
method to define all the required callbacks
def callbacks(self, val_generator: DataGenerator) -> List[Callback]: if self.train_mode in ["classifier", "both"]: model = self.classifier model_dir = "class_model" elif self.train_mode == "combined": model = self.combined model_dir = "com_model" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback(self):\n pass # pragma: no cover", "def set_callbacks(self):\n\t\tself.set_floor_callbacks()\n\t\tself.set_button_callbacks()\n\t\tself.set_stop_callback()", "def callback_connect(self):\n pass", "def callback_connect(self):\n pass", "def callback_connect(self):\n ...
[ "0.7459408", "0.72844726", "0.6991284", "0.6991284", "0.6991284", "0.683932", "0.683932", "0.67834765", "0.67641205", "0.6758745", "0.6750384", "0.6733693", "0.6601107", "0.6583069", "0.65707916", "0.656778", "0.6501852", "0.64510846", "0.6407385", "0.6347029", "0.6309399", ...
0.0
-1
method to initiate model training
def train( self, epochs: int = 10, train_steps: int = None, train_batch_size: int = 32, val_batch_size: int = 32, classifier_loss: str = "focal", lr: float = 1e-3, gamma: float = 2.0, cache: bool = False, ): # compile the model object ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def trainModel( self, featureTrain, classTrain):", "def train_model(self, *args, **kwargs):\n raise NotImplementedError", ...
[ "0.8240833", "0.8230497", "0.80646914", "0.8056009", "0.8009724", "0.7984459", "0.7965985", "0.7952179", "0.7921483", "0.7909781", "0.7909781", "0.7909781", "0.7909781", "0.7909781", "0.7905806", "0.7886011", "0.7863479", "0.78574073", "0.78479517", "0.78439844", "0.7816832",...
0.0
-1
Method to run evaluation on the given dataset
def eval(self, val_batch_size: int = 32): val_generator = DataGenerator( batch_size=val_batch_size, split="test", layers=self.n_blocks, train_mode="classifier", ) if self.train_mode == "combined": model = KM.Model( inpu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, dataset):\n\t\tpass", "def evaluate(self, dataset):\n return self.model.evaluate(dataset.X_val, dataset.y_val)", "def eval(self, dataset=None, criterion=None):\n # Recover the defaults, if missing\n dataset, criterion = self._resolve_defaults(testset=dataset, criterion=criterion...
[ "0.8704821", "0.7853026", "0.77188313", "0.7575933", "0.7353189", "0.72148305", "0.71808416", "0.70597965", "0.70350236", "0.6920078", "0.6875345", "0.6875345", "0.68562233", "0.6839884", "0.6836511", "0.6816252", "0.680603", "0.6796919", "0.6753765", "0.673557", "0.67209274"...
0.0
-1
Method to run single image inference
def infer(self, image_path: str = None): # Class labels labels = [ "airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck", ] # Retriev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_inference_on_image(image):\n if not gfile.Exists(image):\n tf.logging.fatal('File does not exist %s', image)\n image_data = gfile.FastGFile(image, 'rb').read()\n\n # Creates graph from saved GraphDef.\n create_graph()\n\n with tf.Session() as sess:\n # Runs the softmax tensor by feeding the imag...
[ "0.7333703", "0.7214207", "0.71643066", "0.71237755", "0.7121064", "0.71181184", "0.7106002", "0.70640945", "0.7047557", "0.7046369", "0.7007072", "0.69227576", "0.6919159", "0.69167954", "0.6906537", "0.6886225", "0.683456", "0.68204415", "0.678271", "0.6743307", "0.674258",...
0.59543294
83
Serial Port Listener Thread Parse incoming serial data as NMEA and update global position variables
def serialListener(): global serial_running, serial_port, serial_baud _ser = None while serial_running: # Attempt to connect to the serial port. while _ser == None: try: _ser = serial.Serial(port=serial_port,baudrate=serial_baud,timeout=5) logging...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_from_serial(self):\n self.running = True\n while self.running:\n data = self.serial.readline().decode()\n if \"DATA\" not in data:\n print(\"ERREUR : {}\".format(data))\n continue\n\n try:\n _, hum, tem = data.spli...
[ "0.66137105", "0.6448608", "0.638399", "0.63070023", "0.62900025", "0.62591594", "0.6203933", "0.6140255", "0.6090649", "0.607038", "0.60594726", "0.6046943", "0.603479", "0.6034654", "0.60236263", "0.59371054", "0.59338635", "0.59257245", "0.5924867", "0.59244245", "0.592183...
0.6639838
0
Habitat Uploader Thread. Every X seconds, upload current position to Habitat (if it is valid).
def uploadLoop(): global position_valid, update_rate, upload_loop_running, last_upload_time while upload_loop_running: if position_valid: if (time.time() - last_upload_time) > update_rate: uploadPosition() last_upload_time = time.time() time.sleep(0.5...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_upload(self):\n # print \"starting upload...\", self.current_upload['filepath']\n self.touch()\n self.log(\"STARTING_UPLOAD\", level=INFO)\n try:\n Backend.put_file(self.fileobj, self.current_upload[\"gcs_url\"])\n except exceptions.FilePutError as err:\n ...
[ "0.62125075", "0.58900535", "0.588939", "0.57625514", "0.56021225", "0.558986", "0.55853134", "0.55834824", "0.55829453", "0.5580088", "0.5574044", "0.55571914", "0.5483306", "0.5414025", "0.54065275", "0.54006064", "0.5394117", "0.53883696", "0.53689504", "0.5345808", "0.532...
0.77333915
0
Escape any regex special characters other than alternation.
def clean_regex(regex): # copy for return ret_regex = regex # these characters are escaped (all except alternation | and escape \) # see http://www.regular-expressions.info/refquick.html escape_chars = '[^$.?*+(){}' # remove any escape chars ret_regex = ret_regex.replace('\\', '') # e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape_special_characters_for_regex(expression):\n spec_char_escaper = re.compile(r\"[^a-zA-Z0-9]\", re.IGNORECASE)\n expression = re.sub(spec_char_escaper, r'\\1', expression)\n return expression", "def _escapeSpecialCharacters(text):\n text.replace('\\\\', '\\\\\\\\')\n escape = ['~', '#', '...
[ "0.8002786", "0.7242627", "0.6902015", "0.67211866", "0.67027724", "0.66900957", "0.6685918", "0.6629022", "0.66281027", "0.6616511", "0.65282166", "0.64622", "0.64366305", "0.63958883", "0.6391205", "0.63478005", "0.6326186", "0.62273145", "0.62108475", "0.6194388", "0.61783...
0.5825887
44
Parse value in form of '>value' to a lambda and a value.
def parse_query_value(combined_value): split = len(combined_value) - len(combined_value.lstrip('<>=')) operator = combined_value[:split] if operator == '': operator = '=' try: operator_func = search_operators[operator] except KeyError: raise ValueError( 'Numeric q...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, value):\n with tf.name_scope('parser'):\n data = decode(value)\n return self._parse_fn(data)", "def _parse_lambda(text):\n text = text.split('lambda')[1]\n param, rest = text.split(':')\n param = param.strip()\n # There are three things that could terminate a lambda: a...
[ "0.6170552", "0.5918198", "0.5848075", "0.57830256", "0.5676031", "0.55363166", "0.55363166", "0.5522777", "0.5507854", "0.5385727", "0.53557146", "0.52028364", "0.51591295", "0.51278824", "0.5051407", "0.50475127", "0.50350493", "0.50246483", "0.5010348", "0.4988602", "0.497...
0.565511
5
Set default values for mData and filter. On creation, sets default None values for mData and string value for
def __new__(cls, sqla_expr, column_name=None, mData=None, search_method='string_contains', nulls_order=None, global_search=True): # check if allowed value if nulls_order and nulls_order not in ['nullsfirst', 'nullslast']: raise ValueError('`%s` is not an allow...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_data_filter(self):\n df_params = self._loading_params.copy()\n df_params[\"filter_negate\"] = True\n df_params[\"filter_upper\"] = True\n self._data_filter = LoadProcessedData(**df_params)", "def getDefaultData(dmd):", "def default_setting(self):\n\t\tunknown_as_zero...
[ "0.6719329", "0.6427295", "0.63290215", "0.6324458", "0.6282488", "0.6258176", "0.60583264", "0.60280794", "0.60079515", "0.59874284", "0.5965811", "0.584564", "0.5817508", "0.58173066", "0.5799405", "0.57909393", "0.5760275", "0.5747483", "0.56973565", "0.5677917", "0.565392...
0.0
-1
Initialize object and run the query.
def __init__(self, request, query, columns, allow_regex_searches=False): self.params = dict(request) if 'sEcho' in self.params: raise ValueError( 'Legace datatables not supported, upgrade to >=1.10') self.query = query self.filtered_query = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_query(self):", "def query(self):\n pass", "def make_query(self):", "def query(self) -> None:\n raise NotImplementedError()", "def run_query(self):\n return _run_query(self.query)", "def query(self):", "def run(self):\n query = self.query\n\n # count before fi...
[ "0.72549474", "0.71934485", "0.69807553", "0.6908636", "0.6898875", "0.6887655", "0.66520745", "0.66343975", "0.6608067", "0.65931666", "0.6590031", "0.6588359", "0.656037", "0.6549891", "0.64678156", "0.6409622", "0.6406281", "0.6371014", "0.6371014", "0.6371014", "0.6352778...
0.0
-1
Output results in the format needed by DataTables.
def output_result(self): output = {} output['draw'] = str(int(self.params['draw'])) output['recordsTotal'] = str(self.cardinality) output['recordsFiltered'] = str(self.cardinality_filtered) if self.error: output['error'] = self.error return output ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_columns(self) -> List[str]:", "def show_output(self, outputs):\n i = 0\n self.table.setSortingEnabled(True)\n for output in outputs:\n self.table.insertRow(i)\n j = 0\n for x in output[0]:\n item = QTableWidgetItem()\n ...
[ "0.6362009", "0.6357592", "0.63561076", "0.6213599", "0.6212957", "0.61893684", "0.6083764", "0.60733384", "0.60591847", "0.60388535", "0.60310423", "0.6012207", "0.6005336", "0.60052323", "0.600343", "0.5999184", "0.5979485", "0.59405386", "0.5897605", "0.58926374", "0.58898...
0.60496265
9
Launch filtering, sorting and paging to output results.
def run(self): query = self.query # count before filtering # self.cardinality = query.add_columns(self.columns[0].sqla_expr).count() self._set_column_filter_expressions() self._set_global_filter_expression() self._set_sort_expressions() self._set_yadcf_data(quer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _main_search(args = None, stdout = None, stderr = None) :\n if stdout is None :\n stdout = sys.stdout\n if stderr is None :\n stderr = sys.stderr\n # Process arguments\n if args is None :\n parser = _makeParser_search()\n args = parser.parse_args()\n args = _processAr...
[ "0.6229353", "0.59733063", "0.59710497", "0.595373", "0.59382564", "0.5879047", "0.586713", "0.5776297", "0.57640386", "0.5739738", "0.5725649", "0.5720083", "0.5701067", "0.56792367", "0.56787074", "0.5669591", "0.56633604", "0.56586134", "0.5649159", "0.5640814", "0.5633297...
0.6596437
0
find any bad numbers which deviate more than 5 pixels from the median and correct them to median of the array
def correct_shifts(shifts, median_dev = 5): shifts = tonumpyarray(shifts.shared_array_base, shifts.shape, shifts.dtype) for i in range(shifts.shape[1]): for j in range(shifts.shape[2]): shifts[:,i,j] = np.where((abs(shifts[:,i,j] - np.median(shifts[:,i,j])) > median_dev), np.median...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quick_median(array):\n length = len(array)\n if length < 2:\n return array\n pivot_index = Quick.median_of_three(array, 0, length-1)\n pivot = array.pop(pivot_index)\n above = []\n below = []\n for item in array:\n if item > pivot:\n ...
[ "0.7066127", "0.70131624", "0.6985321", "0.6984857", "0.69662255", "0.69067526", "0.68968225", "0.68919826", "0.6830189", "0.68096495", "0.68053395", "0.67850804", "0.6783996", "0.6748709", "0.6740007", "0.6737866", "0.6724389", "0.6714158", "0.6711459", "0.6701286", "0.67009...
0.0
-1
calculate the rotation axis comparing 0 and 180 projection shift
def rotaxis(proj, N_steps): a = proj.shape[1]//4 b = 3 * proj.shape[1]//4 c = proj.shape[2]//4 d = 3 * proj.shape[2]//4 cent = [] N_rot = proj.shape[0] - 180 * N_steps for i in range(N_rot): distances = shift(proj[i, a:b, c:d], np.flip(proj[i + N_steps*...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotation(self) -> float:\n xs, ys = self.xcoords.data, self.ycoords.data\n rot = 0\n if xs.ndim == 2:\n ddx1 = xs[0, -1] - xs[0, 0]\n ddy1 = ys[0, -1] - ys[0, 0]\n if not np.isclose(ddx1, 0):\n rot = math.degrees(math.atan(ddy1 / ddx1))\n ...
[ "0.71367425", "0.67009413", "0.6516682", "0.6514901", "0.6483966", "0.6455309", "0.64200747", "0.63879645", "0.6383368", "0.63247836", "0.6303186", "0.6292502", "0.62873346", "0.6215172", "0.6214855", "0.62061334", "0.6195886", "0.6180086", "0.6176578", "0.6152595", "0.614493...
0.63237727
10
interpolates the coordinates for the rotation axis with the line basically finds the inclination of the rotation axis through the image
def interpolate(cent, level = None): step = cent[1,0] - cent[0,0] if not level: x = cent[:,0] y = cent[:,1] else: x = [] y = [] for i in range(len(cent)): if np.absolute(cent[i,1] - np.median(cent[:,1])) < level: x.append(i*ste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpol(self,x,y,x1):\n \n N = len(x)\n i = np.minimum(np.maximum(np.searchsorted(x,x1,side='right'),1),N-1)\n xl = x[i-1]\n xr = x[i]\n yl = y[i-1]\n yr = y[i]\n y1 = yl + (yr-yl)/(xr-xl) * (x1-xl)\n above = x1 > x[-1]\n below = x1 < x[0]\n y1...
[ "0.6375671", "0.6173722", "0.6142764", "0.60853004", "0.605438", "0.6005682", "0.5813565", "0.58041674", "0.57182676", "0.5679554", "0.5669238", "0.56576973", "0.56399643", "0.5636227", "0.56235516", "0.5600318", "0.5588667", "0.5581319", "0.5570728", "0.5541568", "0.55275214...
0.0
-1
Calculate the Npad for padding can be adjusted with compression parameter By default, 8 times smaller than ROI
def init_Npad(ROI, compression = 8): if (ROI[2]-ROI[0])>(ROI[3]-ROI[1]): Npad = (ROI[2]-ROI[0])//compression else: Npad = (ROI[3]-ROI[1])//compression return Npad
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def padding(self):\n pad = self.ntiles - self.windowsize\n return (int((pad - 1)/2.), int((pad + 1)/2.))", "def padding_width(self):\n ...", "def make_padding(kernel_size, stride, dilation):\n return -((-kernel_size - (kernel_size - 1) * (dilation - 1)) // stride + 1) // 2", "def padd...
[ "0.7143295", "0.6820026", "0.6658783", "0.65967077", "0.6595212", "0.6571076", "0.652692", "0.6465871", "0.64643", "0.64542764", "0.64039046", "0.63836664", "0.6337319", "0.6321386", "0.63163275", "0.6272476", "0.62662464", "0.6221071", "0.6217532", "0.6215494", "0.62136424",...
0.82028204
0
Initialize parameters. Normally should contain ROI, N_distances, etc
def __init__(self, ROI, folder, N_start, N_finish, compNpad = 8): self.N_start = N_start self.ROI = ROI self.N_files = (N_finish - N_start) self.im_shape = (ROI[3]-ROI[1], ROI[2]-ROI[0]) self.Npad = init_Npad(ROI, compression = compNpad)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self, **params):\n\n self._n_x = params['n_x']\n self._n_y = params['n_y']\n self._dx = params['dx']\n self._dy = params['dy']\n\n self._r_corr_in_points = self._r_corr_in_meters // max(self._dx, self._dy)", "def __init__(self):\r\n\t\tself.params = arcpy.GetPara...
[ "0.7111081", "0.6844626", "0.68408275", "0.6836813", "0.6748096", "0.66874", "0.6661579", "0.6624091", "0.66201425", "0.6551462", "0.65479", "0.6522711", "0.6514942", "0.65043855", "0.6496992", "0.6449185", "0.6444581", "0.6436469", "0.6416338", "0.64146185", "0.6410094", "...
0.6097438
82
Generate paths images & flatfields
def init_paths(self, data_name, path, N_distances, first_distance = 1): #set data_names data_names, ff_names = init_names(data_name, N_distances, first_distance = first_distance) #find images imlist = var.im_folder(path) #set proper paths images = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _submodel_images_path(self, i):\n template = self.config['submodel_images_relpath_template']\n return os.path.join(self.data_path, template % i)", "def imagePath(self):\n if self.use_dic:\n if self.imlist:\n paths = []\n for img in self.allimgs:\n...
[ "0.66702086", "0.64537376", "0.61941236", "0.61530745", "0.6033223", "0.59877884", "0.5970774", "0.59508294", "0.59153676", "0.59153676", "0.58394426", "0.5822564", "0.57893103", "0.57747567", "0.57438517", "0.57431483", "0.5739627", "0.5737334", "0.57118016", "0.569724", "0....
0.6246009
2
Create shared value array for processing.
def __init__(self, shape, dtype = 'd'): self.shape = shape self.dtype = dtype ncell = int(np.prod(self.shape)) self.shared_array_base = Array(dtype, ncell,lock=False) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_shared(self, array):\n\n dtype = self.NUMPY_TO_C_DTYPE[array.dtype.type]\n\n shape = array.shape\n shared = RawArray(dtype, array.reshape(-1))\n return np.frombuffer(shared, dtype).reshape(shape)", "def _share_array(arr_np, typecode_or_type):\n\n arr = mp.RawArray(typecode...
[ "0.626806", "0.61840063", "0.60703146", "0.60589635", "0.59842116", "0.5827925", "0.57436484", "0.573604", "0.5735303", "0.56646836", "0.5650954", "0.56390727", "0.5633703", "0.5622187", "0.56210047", "0.56182814", "0.55977863", "0.5581165", "0.5576576", "0.5574943", "0.55631...
0.5306393
39
A readonly reference to the underlying tag object.
def tag(self): return self._tag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_tag(self):\n return self.__tag", "def tag(self):\n return self._tag", "def __init__(self):\n self.tag = None", "def tag(self):\n return self.tag_", "def Tag(self):\r\n\t\tfrom ixnetwork_restpy.testplatform.sessions.ixnetwork.topology.tag import Tag\r\n\t\treturn Tag(self)", "...
[ "0.7090957", "0.6997916", "0.6766917", "0.64465004", "0.6443733", "0.6443056", "0.63883275", "0.6386731", "0.63805306", "0.635879", "0.63364214", "0.6226222", "0.61181486", "0.6096178", "0.60927707", "0.608924", "0.60543203", "0.60110277", "0.5995584", "0.5982375", "0.5975268...
0.65780264
3
Length of the current NDEF message in bytes.
def length(self): return len(self._data) if self._data else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message_length(self):\n return len(self._payload)", "def message_length(self):\n return self._message_length", "def length(self):\n return struct.unpack('<B', self.pkt.payload[1:2])[0]", "def size(self):\n return struct.calcsize(b\"<ii\") + len(self.body.encode(\"ascii\"))...
[ "0.82075506", "0.8186214", "0.76814055", "0.76572454", "0.76536983", "0.76536983", "0.7612558", "0.7601566", "0.75368243", "0.7529016", "0.75132066", "0.74651134", "0.7439849", "0.7439455", "0.74283344", "0.738212", "0.7371528", "0.7371528", "0.73538524", "0.73385465", "0.733...
0.69050336
68
Maximum number of bytes for an NDEF message.
def capacity(self): return self._capacity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_packet_size(self):\n return max(self.fcip_doc['packet_lengths'])", "def len_max(self):\n return 16 + 16 + 8 + 8 + Tools.bin_to_dec(self.get_data_size()) + Tools.bin_to_dec(self.get_verification_size())", "def maxsize(self):\n return len(self._data)", "def maxsize(self) -> int:\n ...
[ "0.74016315", "0.73370296", "0.73239356", "0.7295089", "0.7270637", "0.7230625", "0.7192798", "0.71847194", "0.716232", "0.7144826", "0.71137786", "0.6944603", "0.69235635", "0.69155115", "0.6910975", "0.69020885", "0.6897231", "0.6897231", "0.6861211", "0.68498904", "0.68446...
0.0
-1
The unique tag identifier.
def identifier(self): return str(self._nfcid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniqueid(self):\n return self.raw.get(\"uniqueid\")", "def unique_identifier(self) -> str:\n return pulumi.get(self, \"unique_identifier\")", "def tag(self) -> str:\n return pulumi.get(self, \"tag\")", "def unique_id(self):\n return (\n \"a80f3d5b-df3d-4e38-bbb7-102...
[ "0.77253276", "0.7635662", "0.7532038", "0.74544877", "0.74493426", "0.74414605", "0.74414605", "0.74414605", "0.74414605", "0.74414605", "0.74414605", "0.74414605", "0.74414605", "0.7420556", "0.7375269", "0.7349632", "0.7336322", "0.7328277", "0.7328219", "0.7328219", "0.73...
0.6951588
71
True if the tag is within communication range.
def is_present(self): return self._is_present()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _in_interval(value, low, up):\n if low <= value <= up:\n return True\n else:\n return False", "def is_in_interval(self, low, high, value):\n return low <= value and value <= high", "def is_in_interval(self, x):\r\n \r\n bool_intval = False\r\n\r\n if np.logic...
[ "0.61319286", "0.60530126", "0.604067", "0.5983159", "0.59711546", "0.59409094", "0.59195983", "0.59011227", "0.5855804", "0.57906765", "0.57906765", "0.57343334", "0.56985563", "0.5692748", "0.568262", "0.5681003", "0.5676534", "0.5656932", "0.5644072", "0.5603345", "0.56021...
0.0
-1
True if the tag was successfully authenticated.
def is_authenticated(self): return bool(self._authenticated)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticated(self):\n # We don't support authentication yet\n return False", "def authenticated(self):\n return self.token is not None", "def is_authenticated(self):\n return bool(get_auth_token())", "def is_authenticated(self):\n return True #self.authenticated", "d...
[ "0.7368968", "0.7262149", "0.7220438", "0.7184808", "0.7106596", "0.70972407", "0.70972407", "0.70972407", "0.70972407", "0.70972407", "0.70972407", "0.70972407", "0.7064969", "0.6947067", "0.69109917", "0.6868387", "0.6868387", "0.6868387", "0.6868387", "0.6868387", "0.68683...
0.68093497
28
The dump() method returns a list of strings describing the memory structure of the tag, suitable for printing with join(). The
def dump(self): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump(self) : \n mybuffer = []\n if None not in (self.version, self.operation_id) :\n mybuffer.append(chr(self.version[0]) + chr(self.version[1]))\n mybuffer.append(pack(\">H\", self.operation_id))\n mybuffer.append(pack(\">I\", self.request_id or 1))\n ...
[ "0.69860065", "0.6731522", "0.63727385", "0.63554734", "0.6334931", "0.631974", "0.62619233", "0.6211208", "0.61863095", "0.6178631", "0.6169962", "0.6127721", "0.6067054", "0.60600877", "0.6046598", "0.6044149", "0.6036777", "0.5998513", "0.5989506", "0.59705776", "0.5962360...
0.6774778
1
Format the tag to make it NDEF compatible or erase content.
def format(self, version=None, wipe=None): if hasattr(self, "_format"): args = "version={0!r}, wipe={1!r}" args = args.format(version, wipe) log.debug("format({0})".format(args)) status = self._format(version, wipe) if status is True: self._ndef = None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setHTMLFormat(self, tag):\r\n\r\n self.formatBeginTag = tag.strip()\r\n name = tag.split(\"<\")[1].strip().split(\" \")[0]\r\n self.formatEndTag = \"</\" + name + \">\"", "def format_tag(tag):\n # If the tag presented is an IP address then no modifications are required\n try:\n ip_netwo...
[ "0.6241722", "0.62015337", "0.5582614", "0.5329126", "0.52722013", "0.52667856", "0.5261306", "0.5112217", "0.5098085", "0.5040138", "0.50002456", "0.4988982", "0.49860567", "0.49759218", "0.49672845", "0.4957511", "0.48991778", "0.48872223", "0.48762155", "0.48676845", "0.48...
0.64110184
0
Protect a tag against future write or read access.
def protect(self, password=None, read_protect=False, protect_from=0): if hasattr(self, "_protect"): args = "password={0!r}, read_protect={1!r}, protect_from={2!r}" args = args.format(password, read_protect, protect_from) log.debug("protect({0})".format(args)) stat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_data_protected(self): \n pass", "def __setattr__(self,name,value):\n\n if name == '_dont_touch':\n super.__setattr__(self,name,value) \n elif name in self._dont_touch:\n raise ValueError(\"Parameter %s is protected, please don't touch!\"%name)\n el...
[ "0.59561586", "0.594719", "0.594719", "0.58282864", "0.57149583", "0.54391855", "0.54248357", "0.54208803", "0.5324558", "0.5254834", "0.52534926", "0.52204204", "0.5175479", "0.51700366", "0.5158411", "0.51412594", "0.51372266", "0.51314455", "0.5121294", "0.51139563", "0.50...
0.5470027
5
Authenticate a tag with a password. A tag that was once protected with a password requires authentication before write, potentially also read, operations may be performed. The password must be the same as the
def authenticate(self, password): if hasattr(self, "_authenticate"): args = "password={0!r}".format(password) log.debug("authenticate({0})".format(args)) self._authenticated = self._authenticate(password) if self._authenticated is True: self._ndef = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate(self, password):\n request = self.request(Message.SERVERDATA_AUTH, unicode(password))\n with self.response_to(request) as response:\n if response.id == -1:\n raise AuthenticationError\n self.is_authenticated = True", "def authenticate(self, user...
[ "0.6604293", "0.6422022", "0.6362609", "0.62599635", "0.6093403", "0.599157", "0.59540224", "0.59466195", "0.5909857", "0.5858733", "0.58374655", "0.5792238", "0.57880074", "0.5733425", "0.5731193", "0.57185864", "0.5706808", "0.56747884", "0.5662594", "0.5651024", "0.5629167...
0.6644355
0
Holds the error reason code.
def errno(self): return self._errno
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_reason(self):\n return self._error_reason", "def error_code(self) -> str:\n return self.__error_code", "def error_code(self) -> str:\n return self._error_code", "def errorcode(self):\n return self._errorcode", "def error_code(self):\n return self._error_code", ...
[ "0.7568088", "0.7295729", "0.71950513", "0.71546984", "0.7134255", "0.71300083", "0.7091953", "0.70894736", "0.70592344", "0.6959284", "0.68686455", "0.6859332", "0.67543507", "0.67137045", "0.66912013", "0.6671734", "0.6653744", "0.6578572", "0.6568388", "0.6551337", "0.6537...
0.62851506
38
testing adding Nans to empty rows in sparse matrix
def test_add_nans_to_weights(): # create input sparse matrix with one empty row (j=2) coords = np.array([[0, 3, 1, 0], [0, 3, 1, 2]]) data = np.array([4.0, 5.0, 7.0, 9.0]) Matin = sps.COO(coords, data, shape=(4, 4)) # this is what is expected to come out (Nan added at i=0, j=2) coords = np.arra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_nans_to_weights():\n # create input sparse matrix with one empty row (j=2)\n row = np.array([0, 3, 1, 0])\n col = np.array([0, 3, 1, 2])\n data = np.array([4., 5., 7., 9.])\n Matin = sps.coo_matrix((data, (row, col)), shape=(4, 4))\n\n # this is what is expected to come out (Nan ad...
[ "0.7653261", "0.6942307", "0.6642543", "0.65246856", "0.6388985", "0.638396", "0.63753945", "0.614265", "0.6079368", "0.5998489", "0.5955489", "0.5925455", "0.5894164", "0.58506966", "0.5786227", "0.57838506", "0.57823104", "0.57536805", "0.5743613", "0.5722805", "0.5714739",...
0.7446927
1
For each entry in op_dict, create an appropriate dictionary that can be used to fill the 'code' template.
def _pull_argops(op_dict): import inspect out = [] keys = op_dict.keys() keys.sort() # Not necessary, but makes scanning the printout easier for k in keys: # Create a dictionary that will be used to fill the 'code' template d = {} d["enum_name"] = enum_name = op_dict[k][3:] #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code_input(dict_, i):\n for key in dict_:\n dict_[key] = i + dict_[key]\n return dict_", "def render(self, code_proxy):\n code_proxy.bytecode.add(opcode.opmap[self.opname])", "def dict_to_code(mapping):\n lines = (\"{} = {}\".format(key, repr(value))\n for key...
[ "0.57808787", "0.55444884", "0.5413896", "0.5402583", "0.5367587", "0.5339427", "0.532061", "0.5296568", "0.5256839", "0.52433896", "0.51989514", "0.5136526", "0.5134199", "0.51259196", "0.5122549", "0.51182413", "0.51154214", "0.5094699", "0.5089987", "0.50874263", "0.503335...
0.61465585
0
Implemented by the childclasses
def force(self, osc): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\n raise NotImplementedError", "def __call__(self):\r\n raise NotImplementedError('override me')", "def __call__(self):\n raise NotImplementedError()", "def __call__(self):\n pass", "def __call__(self):\n pass", "def __call__(self):\n\t\treturn", "d...
[ "0.77800536", "0.7597183", "0.7430055", "0.7418082", "0.7418082", "0.74175555", "0.7400415", "0.70954275", "0.70497704", "0.7025521", "0.69220436", "0.6831898", "0.6808222", "0.68004316", "0.68004316", "0.68004316", "0.68004316", "0.6779338", "0.67689687", "0.6755094", "0.675...
0.0
-1
Perform a single integration step
def integrate(self, simsystem, osc, obs): self.timestep(simsystem, osc, obs) # Append observables to their lists obs.time.append(osc.t) obs.pos.append(osc.theta) obs.vel.append(osc.dtheta) obs.energy.append(0.5 * osc.m * osc.L ** 2 * osc.dtheta ** 2 + 0.5 * osc.m * G * o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_step(self) -> None:", "def test_integration1(self):\n self._test_integration(1)", "def integrate(self, t):", "def perform_step(self) -> None:\n pass", "def step(self):\n self.function()", "def _integrate(self, integrator, dt, tf, post_step_callback):\n t = 0.0\n ...
[ "0.69058335", "0.6804668", "0.6784654", "0.67268384", "0.6578567", "0.6559397", "0.6437082", "0.6378224", "0.6323779", "0.6285938", "0.62750435", "0.618968", "0.6180098", "0.6180098", "0.6121735", "0.6104034", "0.61000466", "0.60940635", "0.6088289", "0.6057766", "0.60553765"...
0.0
-1
Implemented by the childclasses
def timestep(self, simsystem, osc, obs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\n raise NotImplementedError", "def __call__(self):\r\n raise NotImplementedError('override me')", "def __call__(self):\n raise NotImplementedError()", "def __call__(self):\n pass", "def __call__(self):\n pass", "def __call__(self):\n\t\treturn", "d...
[ "0.77800536", "0.7597183", "0.7430055", "0.7418082", "0.7418082", "0.74175555", "0.7400415", "0.70954275", "0.70497704", "0.7025521", "0.69220436", "0.6831898", "0.6808222", "0.68004316", "0.68004316", "0.68004316", "0.68004316", "0.6779338", "0.67689687", "0.6755094", "0.675...
0.0
-1
r""" The naive implementation simply calculates the topk of a linear layer's output.
def forward(self, inp, return_all_scores=False): gate = self.gate(inp) gate_top_k_val, gate_top_k_idx = torch.topk( gate, k=self.top_k, dim=-1, largest=True, sorted=False ) # [.. x top_k] gate_top_k_val = gate_top_k_val.view(-1, self.top_k) # (BxL) x 1 x top_k ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_k(input, k=1, sorted=True, index_type=dtypes.int32, name=None): # pylint: disable=redefined-builtin\n return gen_nn_ops.top_kv2(\n input, k=k, sorted=sorted, index_type=index_type, name=name\n )", "def in_top_k(predictions, targets, k, name=None):\n with ops.name_scope(name, \"in_top_k\"):\n ...
[ "0.7440344", "0.72381604", "0.6975233", "0.68716294", "0.67940646", "0.6786215", "0.67805046", "0.6726646", "0.66277933", "0.6550718", "0.6539295", "0.64932567", "0.6452183", "0.64044917", "0.63626915", "0.6361559", "0.6321251", "0.6311895", "0.62869394", "0.62519705", "0.624...
0.0
-1
Consumes a list of items and allows the user to choose a subset of them. Users can mark items using the 'm' key and navigate using standard vi bindings (hjkl).
def multi_vend(self, items, display=lambda x: x): global mark_color_fg, mark_color_bg, select_color_bg, select_color_fg try: self._init_colors() return vend(items, display, markable_mode=True) finally: util.cursesclean()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_list_items(self, arg):\n try:\n cprint (\"These are your items: \\n\", 'blue')\n my_items = arg[\"<all_items>\"]\n choice = arg[\"--choice\"]\n if choice == \"name\":\n my_items_str = \" \".join(my_items)\n print(my_items_str)\...
[ "0.65305096", "0.6069966", "0.5985156", "0.5663849", "0.56510615", "0.5601315", "0.556097", "0.556097", "0.5518682", "0.5512448", "0.54145163", "0.54132724", "0.5382185", "0.5319403", "0.53161687", "0.5309963", "0.53029007", "0.52668047", "0.5254248", "0.5248045", "0.5217755"...
0.0
-1
Presents a menu which allows the user to select from a list of items. If provided, the display parameter should yield a display string for each item in the provided list. If display is omitted it is the identity function and the provided items are expected to be strings.
def vend(self, items, display=lambda x: x): try: self._init_colors() res = vend(items, display) if res == None: return None return res[0] finally: util.cursesclean()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_query(\n items: Sequence,\n max_display: int = 10,\n fallback: Callable[[], T] = None,\n item_formatter: Callable[[T], str] = str,\n header: str = \"Available options:\",\n footer: str = \"Please enter the number of the option to use.\",\n) -> T:\n\n # Truncate if needed\n print(...
[ "0.6181722", "0.60401714", "0.59569395", "0.5916381", "0.57529306", "0.5726644", "0.5722584", "0.5674494", "0.5655079", "0.5640531", "0.5636625", "0.5626458", "0.55540675", "0.55519223", "0.5542278", "0.55387706", "0.54949", "0.54815316", "0.54632676", "0.546043", "0.5435306"...
0.0
-1
Replace with nothing, remove seqs containing N or other nonallowed letters and duplicate sequences containing RYKMSW, replacing with AGCT alternatives The sequences are deliberately returned in the order they are received
def get_interval_seqs(interval_alignment: AlignIO.MultipleSeqAlignment): gapless_seqs = [str(record.seq.ungap("-")) for record in interval_alignment] callback_seqs, expanded_seqs = [], [] expanded_set = set() for seq in remove_duplicates(gapless_seqs): if len(expanded_set) == 0: cal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_nonsense_sequences(sequences):\n\n # filter sequences if contains at least one 'N' character\n good_index = []\n filter_sequences = []\n for i, seq in enumerate(sequences):\n if \"N\" not in seq.upper():\n good_index.append(i)\n filter_sequences.append(seq)\n return np.array(filter_seq...
[ "0.63460577", "0.6039206", "0.6036013", "0.60109615", "0.6006546", "0.5983262", "0.588265", "0.58484596", "0.5641882", "0.556758", "0.54953396", "0.54889804", "0.5482042", "0.547729", "0.5463651", "0.54433906", "0.5355123", "0.5351987", "0.5336972", "0.5335196", "0.53335005",...
0.0
-1
get JWT token with payload
def post(self, **kwargs): username: str = request.json.get("username", None) password: str = request.json.get("password", None) user = get_user_instance(username, password) return {"access_token": create_access_token(identity=user)}, 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_jwt_token(self):\n payload = jwt_payload_handler(self)\n token = jwt_encode_handler(payload)\n return token", "def get_token(self, obj):\n jwt_payload_handler = api_settings.JWT_RESPONSE_PAYLOAD_HANDLER\n jwt_encode_handler = api_settings.JWT_ENCODE_HANDLER\n\n ...
[ "0.7796991", "0.76815265", "0.7674934", "0.75916886", "0.755968", "0.745634", "0.74310356", "0.7418954", "0.7418954", "0.7418954", "0.73436046", "0.7342093", "0.7314826", "0.7289472", "0.7249558", "0.72494876", "0.72345626", "0.7178754", "0.7165063", "0.7127183", "0.7096723",...
0.0
-1
Render the body template, if defined. Otherwise, jump the context as a JSON object.
def render_body(self, context): if self.body_template: return render_jinja2(self.body_template, context) else: return json.dumps(context, cls=JSONEncoder)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(self, _template, context=None):\n variables = {}\n if context:\n variables.update(context)\n rv = self.jinja2.render_template(_template, **variables)\n self.response.write(rv)", "def render(self, _template, **context):\n context['_request'] = self.request\...
[ "0.6415161", "0.6371459", "0.614349", "0.6088617", "0.6073203", "0.6023662", "0.59383094", "0.59063464", "0.5894329", "0.5863352", "0.58564246", "0.5829931", "0.5821167", "0.57523584", "0.573967", "0.5728318", "0.57185173", "0.5712654", "0.5710085", "0.5700231", "0.5688118", ...
0.8101176
0
Render the payload URL.
def render_payload_url(self, context): return render_jinja2(self.payload_url, context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def renderHTTP(self, ctx):\n return url.URL.fromContext(ctx).child('')", "def url(self):\n return url_for_item(self.key)", "def url(self):\n return url_for_item(self.key)", "def __str__(self):\n self.render()\n params = '&'.join(['%s=%s'%x for x in self.data.items() if x[1]...
[ "0.69234157", "0.60506034", "0.60506034", "0.60468316", "0.58912516", "0.58324456", "0.58206755", "0.57969487", "0.57580036", "0.5751476", "0.5719406", "0.5718504", "0.5689432", "0.5686505", "0.5625121", "0.56219465", "0.561779", "0.5611863", "0.5607267", "0.56013036", "0.558...
0.83381814
0
Render the CustomLink given the provided context, and return the text, link, and link_target.
def render(self, context): text = render_jinja2(self.link_text, context).strip() if not text: return {} link = render_jinja2(self.link_url, context).strip() link_target = ' target="_blank"' if self.new_window else '' # Sanitize link text allowed_schemes = get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_links(context, obj):\n content_type = ContentType.objects.get_for_model(obj)\n custom_links = CustomLink.objects.filter(content_types=content_type, enabled=True)\n if not custom_links:\n return ''\n\n # Pass select context data when rendering the CustomLink\n link_context = {\n ...
[ "0.65826654", "0.65728986", "0.6345681", "0.59130216", "0.57122743", "0.56766665", "0.5618983", "0.5512928", "0.5460195", "0.543479", "0.54293305", "0.54070026", "0.53497344", "0.5223261", "0.51964355", "0.51875687", "0.5176072", "0.5161376", "0.51202476", "0.5097645", "0.509...
0.67232096
0
Synchronize template content from the designated DataFile (if any).
def sync_data(self): self.template_code = self.data_file.data_as_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateFileData(self):\n with open(pagePath(self.pageName)) as f:\n self.fileData = f.read()\n self.lastUpdated = time.time()", "def test_yaml_file_watch(self):\n # Set initial data\n _setup_template_value('yaml_file_test_values.tmp.yml', 'yaml_file_test_values_1.yml')\n...
[ "0.5942566", "0.58803123", "0.5711093", "0.5618945", "0.56182575", "0.55685955", "0.55464983", "0.5508211", "0.54465634", "0.5385772", "0.5309885", "0.5250627", "0.52483416", "0.52441293", "0.5243234", "0.52383935", "0.52373266", "0.5227429", "0.5219678", "0.5208981", "0.5191...
0.7512393
0
Render the contents of the template.
def render(self, queryset): context = { 'queryset': queryset } output = render_jinja2(self.template_code, context) # Replace CRLF-style line terminators output = output.replace('\r\n', '\n') return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(self):\n master = Template(self.master_file.read_text())\n content = Template(self.content_template.read_text())\n\n # Render content\n d = {\n \"citekey\": self.citekey,\n \"author\": self.author,\n \"ts\": self.ts_iso,\n \"ts_day\...
[ "0.7574617", "0.75551015", "0.7486521", "0.7311431", "0.72948", "0.7290793", "0.7266634", "0.7247682", "0.72444826", "0.72142696", "0.7134402", "0.7103293", "0.70680225", "0.70636356", "0.70636356", "0.70636356", "0.7062125", "0.7038034", "0.6997276", "0.6949699", "0.6944542"...
0.0
-1
Render the template to an HTTP response, delivered as a named file attachment
def render_to_response(self, queryset): output = self.render(queryset) mime_type = 'text/plain; charset=utf-8' if not self.mime_type else self.mime_type # Build the response response = HttpResponse(output, content_type=mime_type) if self.as_attachment: basename = qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_to_response(self, context, **response_kwargs):\n\n response = HttpResponse(mimetype=self.mimetype)\n response['Content-Disposition'] = ('attachment; filename=%s.%s' %\n (context['filename'],\n self.extensio...
[ "0.76397675", "0.72074544", "0.7164007", "0.70961756", "0.70561403", "0.683689", "0.67827255", "0.6758859", "0.67566186", "0.67399937", "0.65976185", "0.65759933", "0.6505081", "0.65012646", "0.648969", "0.6469387", "0.6434514", "0.64186233", "0.6398963", "0.6391499", "0.6377...
0.6453741
16
Wrapper around `image.size` to suppress an OSError in case the file is inaccessible. Also opportunistically catch other exceptions that we know other storage backends to throw.
def size(self): expected_exceptions = [OSError] try: from botocore.exceptions import ClientError expected_exceptions.append(ClientError) except ImportError: pass try: return self.image.size except tuple(expected_exceptions): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_size(file_name):\r\n return Image.open(file_name).size", "def size(path):", "def remove_img_size(self, id):\n\n try:\n img_size = os.path.getsize(\"{}{}.jpg\".format(self.img_path, id))\n logger.debug(\"img_size: {}\".format(img_size))\n except FileNotFoundE...
[ "0.6170825", "0.5982166", "0.59802794", "0.59526426", "0.5938609", "0.5935151", "0.5859361", "0.5820605", "0.57776374", "0.5775356", "0.5722424", "0.5716205", "0.5692693", "0.5692693", "0.56543833", "0.56506926", "0.56453097", "0.5643101", "0.5634143", "0.5629508", "0.5626837...
0.70213586
0
Cache the configuration data.
def activate(self): cache.set('config', self.data, None) cache.set('config_version', self.pk, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_cached_config(self):\n running_config = self.driver.get_cached_config()\n self.assertEquals(running_config[\"foo\"], 10)\n self.assertEquals(running_config[\"bar\"], 15)", "def cache_data(self):\n # Initialize key variables\n result = self.data['cache_data']\n ...
[ "0.6832349", "0.6740254", "0.6727959", "0.6721722", "0.66342336", "0.66284156", "0.6623114", "0.66190845", "0.65584034", "0.65468013", "0.65230304", "0.6500785", "0.6500341", "0.643505", "0.643505", "0.643505", "0.643505", "0.6403182", "0.6394703", "0.63908744", "0.638542", ...
0.6542908
10
Sets screen timeout to integer given in wait, 0 to not wait, 1 to wait
def set_timeout(self, wait): self._screen.timeout(wait)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(wait_time=WAIT_TIME):\n # time.sleep(wait_time)\n pass", "def wait_second(self, time_wait):\n # each test case 1st check for the stop button flag\n if not self.stopLoop:\n # get time\n ts = datetime.datetime.now().strftime(self.tsFormat)\n # Create la...
[ "0.6864472", "0.6734727", "0.66955775", "0.6690098", "0.66128355", "0.65210015", "0.65123713", "0.6465837", "0.64603263", "0.6449477", "0.6414831", "0.63922095", "0.6379595", "0.63737917", "0.6324914", "0.6282336", "0.6238094", "0.622744", "0.62160945", "0.6168285", "0.614871...
0.8473102
0
Resize terminal, returns terminal size as [y,x]
def _size_term(self): curr_dim = self._screen.getmaxyx() dims = [50, 150] if curr_dim[0] < dims[0] or curr_dim[1] < dims[1]: sys.stdout.write("\x1b[8;{rows};{cols}t".format(rows=dims[0], cols=dims[1])) curses.resize_term(dims[0], dims[1]) return dims e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_terminal_size_windows():\r\n\r\n\r\n #from https://gist.github.com/jtriley/1108174, thank you very much for this hard to produce code!\r\n\r\n # stdin handle is -10\r\n # stdout handle is -11\r\n # stderr handle is -12\r\n h = windll.kernel32.GetStdHandle(-12)\r\n csbi = create_string_bu...
[ "0.72301054", "0.72121006", "0.69198793", "0.69139826", "0.68285036", "0.67593", "0.67591816", "0.6742283", "0.66999054", "0.66502917", "0.6555379", "0.65499055", "0.6541336", "0.65292513", "0.6461325", "0.64533347", "0.642946", "0.6397398", "0.63638514", "0.63601255", "0.635...
0.7643062
0
Reads in text file and returns it as a list of strings
def read_text(self, file_name, strip=True): fh = open(file_name, 'r') lines=[] for line in fh.readlines(): if strip: lines.append(line.strip()) else: lines.append(line) fh.close() return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readStrings(filename):\n txtlist = []\n f = open(filename)\n for line in f.readlines():\n txtlist.extend(line.split())\n return txtlist", "def read_list(file_name):\n with open(file_name, 'r') as f:\n text = f.read().splitlines()\n return text", "def getlistfromtext(self,fil...
[ "0.84307253", "0.8406117", "0.839526", "0.82812923", "0.8016627", "0.7982037", "0.7974472", "0.79344875", "0.7894651", "0.7889376", "0.7701646", "0.76758283", "0.7665948", "0.7664956", "0.76464695", "0.7633489", "0.7566172", "0.7566172", "0.7533374", "0.7532505", "0.75271416"...
0.74932736
23
Adds char to screen at modified y, modified x and returns modified coordinates
def add_char(self, coord, char, modify=False): if modify: range_y, range_x = self._map_dims new_coord = [coord[0]+range_y[0]-1, coord[1]+range_x[0]-1] self._screen.addch(new_coord[0], new_coord[1], char) self._screen.refresh() return new_coord ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point(self, x, y, char):\n assert len(char) == 1\n assert x >= 0\n assert x < self.cols\n assert y >= 0\n assert y < self.lines\n\n self.canvas[y][x] = char", "def move_character(self, old_y, old_x, y_pos, x_pos):\n self.map[old_y][old_x] = ' '\n self.m...
[ "0.7519669", "0.7025201", "0.699285", "0.6764224", "0.6750597", "0.6709837", "0.6686409", "0.6661057", "0.6660266", "0.6515418", "0.6512104", "0.64473236", "0.6424062", "0.6377652", "0.63251984", "0.62041324", "0.61488396", "0.61447257", "0.6105792", "0.60999763", "0.60823166...
0.72516125
1
return cell in coord given from the screen
def get_char(self, coord): return self._screen.inch(coord[0], coord[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_cell(self):\n\n pos = pygame.mouse.get_pos()\n\n x = pos[1] // (self.cell_size+1)\n y = pos[0] // (self.cell_size+1)\n\n return self.grid[x][y]", "def get_cell(self, point):\n return self._grid[point.x][point.y]", "def getCellpos(self, event):\n e = event.wi...
[ "0.7911217", "0.74120855", "0.7327371", "0.7318145", "0.71363145", "0.708024", "0.70556945", "0.70528847", "0.7021455", "0.7009642", "0.70083654", "0.6995055", "0.69760835", "0.69645035", "0.696276", "0.696276", "0.696276", "0.6945097", "0.6889586", "0.68885714", "0.6884513",...
0.63579464
85
Returns a list of the cells surrounding y, x at the radius given
def get_neighbors(self, coord, radius=1): y, x = coord neighbors = {} if radius == 1: neighbors['right'] = [self._screen.inch(y, x+1)] neighbors['left'] = [self._screen.inch(y, x-1)] neighbors['up'] = [self._screen.inch(y-1, x)] neighbors['down'] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_neighbours_round(self, cell, radius):\n\t\tx,y = cell.find_id()\n\t\tlength = self.space.shape[1]\n\t\twidth = self.space.shape[0]\n\t\tif (length == 0 or width == 0 or x < 0 or x >= length or y < 0 or y >= width or radius < 2):\n\t\t\treturn []\n\t\tneighs = [(i,j) for i in range(y-radius,y+radius+1) if 0...
[ "0.74002504", "0.70362663", "0.69714886", "0.67488265", "0.67288375", "0.6702016", "0.6696595", "0.6665909", "0.66412973", "0.66393113", "0.6604607", "0.659284", "0.6591264", "0.65885115", "0.6575803", "0.65166384", "0.64661986", "0.642393", "0.6407202", "0.6385768", "0.63681...
0.6373017
20
Prints to input given y is the coordinate of first line, x is the center coordinate for the text to be printed text is a list of text to be written
def ascii_to_screen_map(self, y, text): text_height = len(text) for line_index, line in enumerate(text): text_width = len(line) x_start = (self._dims[1]/2) - (text_width/2) for char_index, char in enumerate(line): if char == u'.': s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text(self, x, y, text):\n for i, char in enumerate(text):\n self.point(x + i, y, char)", "def PrintAt(self,x=0,y=0,text=''):\n self.SetCursor(x,y)\n self.Print(text)", "def text_draw(self, x, y, text, style={}):", "def print_my_coords(x = 0, y = 0):\n\tprint(\"Coords (%d;%...
[ "0.68702525", "0.66629314", "0.6305802", "0.62362224", "0.6219254", "0.61920685", "0.61826706", "0.6095448", "0.6058942", "0.6030189", "0.6020815", "0.5956955", "0.5944021", "0.5931498", "0.5897773", "0.5869629", "0.58642316", "0.5835159", "0.5827776", "0.5816054", "0.5802517...
0.5444548
69
Prints to input given y is the coordinate of first line, x is the center coordinate for the text to be printed text is a list of text to be written
def ascii_to_screen(self, y, text, color=1, width=0): text_height = len(text) for line_index in range(len(text)): text_width = len(text[line_index]) if not width else width self._screen.hline(y+line_index, 0, ord(' '), self._dims[1]) if self._dims[0] > text_height and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text(self, x, y, text):\n for i, char in enumerate(text):\n self.point(x + i, y, char)", "def PrintAt(self,x=0,y=0,text=''):\n self.SetCursor(x,y)\n self.Print(text)", "def text_draw(self, x, y, text, style={}):", "def print_my_coords(x = 0, y = 0):\n\tprint(\"Coords (%d;%...
[ "0.6870429", "0.6664248", "0.6306215", "0.6236138", "0.62187475", "0.61919284", "0.6182574", "0.6095427", "0.6059037", "0.6029234", "0.6022243", "0.5957079", "0.59463555", "0.5931007", "0.58990866", "0.5871186", "0.58648026", "0.5835454", "0.5827098", "0.58171695", "0.5802914...
0.5632186
45
y is the spacing wanted for the text below the dialog line
def text_to_dialog(self, text, y=4, color=1, clear_low=False): if clear_low: for cline in range(y, self._dims[0]): self._screen.hline(cline, 0, ord(' '), self._dims[1]) for idx, line in enumerate(text): self._screen.hline(y+idx, 0, ord(' '), self._dims[1]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ytext(y_min, XRD_plot_fig_shift_add):\n return y_min-XRD_plot_fig_shift_add*0.05", "def toTk(self,y):\r\n if y == maxValue: return 0\r\n tk_y = Size\r\n if y != minValue:\r\n tk_y -= y\r\n return tk_y", "def loc(y,x):\n return '\\033[%s;%sH' % (str(y),str(x...
[ "0.60474455", "0.5989319", "0.5768556", "0.57443345", "0.56798685", "0.56428516", "0.55174005", "0.5496558", "0.54927975", "0.54835033", "0.54620916", "0.54499996", "0.53958696", "0.53821343", "0.5356639", "0.5352859", "0.53457505", "0.53448004", "0.533972", "0.53364307", "0....
0.5770061
2
Displays room on screen from room object given and returns player position
def display_room(self, room, player_start=[]): map_start = 8 self.clear() room_width = 0 spacing = 3 image_file = str(room.include[0].value.strip()) room_tx = self.read_text(image_file) room_id = room.attrs['id'] self.ascii_to_screen_map(map_start, room_tx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adminDisplayRoom(player, room):\r\n curRoom = world.maps.World.mapGrid[room]\r\n exitstr = ''\r\n \r\n sendToPlayer( player, \"{0}{1} - (Room #: {2})\".format(LCYAN, curRoom.name, room) )\r\n \r\n items = curRoom.getItems()\r\n if items:\r\n sendToPlayer( player, \"{0}You notice: {1...
[ "0.6467579", "0.6305366", "0.59879905", "0.5919578", "0.588053", "0.58723104", "0.5866267", "0.582144", "0.5761883", "0.5741979", "0.57015663", "0.56834424", "0.5594203", "0.5560418", "0.5539656", "0.55343395", "0.5512155", "0.55069023", "0.5488417", "0.54213583", "0.54205406...
0.7651127
0
uses input to run pathfinder and return next move
def find_enemy_move(self, start, goal, space, enemy_symbol, player_symbol): path = pathfinder.astar(self._screen, start, goal, self._map_dims, space, enemy_symbol, player_symbol) return path.get_shortest_path()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_move(self):\n return int(input('Enter your move: '))", "def act_after_input(self, current_dir, subdirs, car):\n new_dir = current_dir\n if car == 'q':\n new_dir = None\n elif car in {str(i+1) for i in range(len(subdirs))}:\n print ('----> Moving to d...
[ "0.68959737", "0.62043047", "0.6148075", "0.61206156", "0.60208774", "0.5987205", "0.592181", "0.5836035", "0.5830049", "0.58081454", "0.57934374", "0.57828265", "0.5765277", "0.57563716", "0.5751015", "0.57386833", "0.57312626", "0.57312626", "0.57312626", "0.56927747", "0.5...
0.0
-1
Helper function that returns a simple 3layer ReLU MLP model with a hidden layer with 500 activation in it. Used as the default estimator for computing the completeness score.
def _get_default_model(num_concepts, num_hidden_acts): return tf.keras.models.Sequential([ tf.keras.layers.Dense( 500, input_dim=num_concepts, activation='relu' ), tf.keras.layers.Dense( num_hidden_acts, activation=None, ),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lenet300_classic():\n return LeNet300(dropout=False, nonlinearity=nn.Tanh)", "def MLP_model(self):\n print(\"Building model..\")\n self.model = Sequential()\n\n # first hidden layer (0)\n self.model.add(Dense(self.h_nodes0, input_dim=self.input_size, use_bias=True))\n se...
[ "0.6727413", "0.6492614", "0.6439487", "0.6432276", "0.64169866", "0.63344175", "0.62862355", "0.62604475", "0.62487525", "0.62471527", "0.6227833", "0.61612016", "0.61170363", "0.6071701", "0.6059761", "0.6053481", "0.6043138", "0.5976267", "0.59746516", "0.59585524", "0.595...
0.5912773
27
Returns a vector of concept scores for the given features using a normalized dot product similarity as in Yeh et al.
def dot_prod_concept_score( features, concept_vectors, epsilon=1e-5, beta=1e-5, channels_axis=-1, ): # First check that all the dimensions make sense assert features.shape[channels_axis] == concept_vectors.shape[-1], ( f'Expected input to have {concept_vectors.shape[-1]} elements in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_normalization_scalar(features: List[List[float]]) -> List[List[float]]:\n normalized_features = []\n for feature in features:\n sum_squares = 0\n for i in feature:\n sum_squares += i * i\n sum_squares_root = np.sqrt(sum_squares)\n if sum_squares == 0:\n ...
[ "0.6520329", "0.6430667", "0.6394072", "0.6382461", "0.6351479", "0.6329946", "0.6322808", "0.6261107", "0.6182496", "0.6160588", "0.60493076", "0.60208386", "0.59891814", "0.59368724", "0.593012", "0.58729786", "0.5855223", "0.58174413", "0.57436484", "0.5715467", "0.5713523...
0.6894692
0
Returns the completeness score for the given set of concept vectors `concept_vectors` using testing data `X` with labels `y`. This score is computed using Yeh et al.'s definition of a concept completeness score based on a model `features_to_concepts_fn`, which maps input features in the test data to a Mdimensional spac...
def completeness_score( X, y, features_to_concepts_fn, concepts_to_labels_model, concept_vectors, task_loss, g_model=None, test_size=0.2, concept_score_fn=dot_prod_concept_score, predictor_train_kwags=None, g_optimizer='adam', acc_fn=sklearn.metrics.accuracy_score, ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def direct_completeness_score(\n X,\n y,\n features_to_concepts_fn,\n concept_vectors,\n task_loss,\n g_model=None,\n test_size=0.2,\n concept_score_fn=dot_prod_concept_score,\n predictor_train_kwags=None,\n g_optimizer='adam',\n acc_fn=sklearn.metrics.accuracy_score,\n channels...
[ "0.7881465", "0.63660175", "0.5906341", "0.57350284", "0.57198316", "0.56847036", "0.5677614", "0.54979914", "0.5444112", "0.54306525", "0.54055405", "0.53992796", "0.5395767", "0.5350958", "0.5346281", "0.53277713", "0.5252939", "0.5245883", "0.52315956", "0.52152485", "0.52...
0.7786654
1
Returns the completeness score for the given set of concept vectors `concept_vectors` using testing data `X` with labels `y`. This score is computed as the predictive accuracy of a model trained to predict the labels using the concepts scores alone. It differs from the method above in that it does not require a pretrai...
def direct_completeness_score( X, y, features_to_concepts_fn, concept_vectors, task_loss, g_model=None, test_size=0.2, concept_score_fn=dot_prod_concept_score, predictor_train_kwags=None, g_optimizer='adam', acc_fn=sklearn.metrics.accuracy_score, channels_axis=-1, ): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def completeness_score(\n X,\n y,\n features_to_concepts_fn,\n concepts_to_labels_model,\n concept_vectors,\n task_loss,\n g_model=None,\n test_size=0.2,\n concept_score_fn=dot_prod_concept_score,\n predictor_train_kwags=None,\n g_optimizer='adam',\n acc_fn=sklearn.metrics.accur...
[ "0.746663", "0.6051819", "0.60288906", "0.58814985", "0.5831503", "0.582439", "0.58031857", "0.5762847", "0.57567835", "0.57425153", "0.57226914", "0.5668934", "0.56666696", "0.56418574", "0.5637015", "0.5628586", "0.56230634", "0.56153", "0.56012875", "0.55907965", "0.557798...
0.7730111
0
Finds the delta in time since the last timestamp If the game is not started it resets timestamp to None and returns 0. If the game is started but the timestamp is None, make the first timestamp to the current time. Otherwise it will return the amount of time since the timestamp in seconds.
def elapsed_time(self): # reset timer if game is not started if not self.started: self.timestamp = None return 0 # sets the first timer if self.timestamp is None: self.timestamp = time.time() return 0 # if there is a previous timer ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_left(timestamp):\n if timestamp is None:\n return None\n return max(0.0, timestamp - time.time())", "def seconds_from_last_update(self):\n return (datetime.utcnow() - self.last_update_datetime).total_seconds()", "def seconds_since_previous_event(self):\n if self.previous_eve...
[ "0.7057593", "0.6650774", "0.6599977", "0.659276", "0.65243965", "0.65226424", "0.64636683", "0.64425397", "0.6433153", "0.64077157", "0.63585246", "0.6326008", "0.6321055", "0.63080907", "0.6296014", "0.62940556", "0.6289301", "0.6285546", "0.62577814", "0.6245347", "0.62418...
0.72524625
0
Searches the list of players for a given name Returns the first instance where a player has the given name.
def find_player(self, name): for index in range(0, len(self.player_list)): if self.player_list[index].name == name: return self.player_list[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player(self, name):\n\n self.name = name\n q = Query()\n data = TinyDB('app/data/db_player.json').table('players')\n\n self.search_result = data.search(\n (q.name == self.name) |\n (q.surname == self.name)\n )\n\n if len(self.search_re...
[ "0.7655409", "0.7581371", "0.73113996", "0.72627175", "0.7086329", "0.70571876", "0.70207703", "0.686663", "0.6809111", "0.67774487", "0.6688535", "0.6658734", "0.66132474", "0.6570869", "0.65514565", "0.65377414", "0.6527125", "0.65249634", "0.6492997", "0.6479223", "0.64773...
0.8673462
0
Find yourself from the player list
def find_self(self): for index in range(0, len(self.player_list)): if self.player_list[index].name == self.jid: return self.player_list[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_player(self, name):\n for index in range(0, len(self.player_list)):\n if self.player_list[index].name == name:\n return self.player_list[index]", "def found_specific_player(self) -> Player:\n search_question = ('Nom du joueur recherché : ',\n ...
[ "0.71058077", "0.692956", "0.6456459", "0.62968767", "0.6243386", "0.60800767", "0.6001927", "0.5991489", "0.5903297", "0.5883829", "0.5882624", "0.58718306", "0.58087987", "0.5801809", "0.57950425", "0.5751915", "0.5722757", "0.5700745", "0.5680296", "0.5672891", "0.5670528"...
0.6999478
1
Validate an activation key and activation the corresponding User if vaild.
def activate_user(self, activation_key): if SHA1_RE.search(activation_key): try: profile = RegistrationProfile.objects.get(activation_key=activation_key) except self.model.DoesNotExist: return False if not profile.activation_key_expired(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate_user(cls, activation_key):\n #from registration.signals import user_activated\n \n # Make sure the key we're trying conforms to the pattern of a\n # SHA1 hash; if it doesn't, no point trying to look it up in\n # the database.\n db = DB_Session()\n if SH...
[ "0.7640714", "0.76170933", "0.74822164", "0.74723625", "0.73766863", "0.73560387", "0.72935295", "0.7134963", "0.7120151", "0.71090966", "0.69468325", "0.6935453", "0.6893573", "0.68875057", "0.6880358", "0.6837814", "0.6795624", "0.6781909", "0.6763041", "0.67129433", "0.670...
0.7478007
3
Create a new, inactive ``User``, generates a ``RegistrationProfile`` and email its activation key to the ``User``, returning the new ``User``.
def create_inactive_user(self,request, username,password,email, send_email=True, profile_callback=None, **kwargs): #如果存在用户的话不必进行新建只需对权限表进行操作即可,否则新建用户 if User.objects.filter(email=email).count() == 0: new_user = User.objects.create_use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_inactive_user(self, username, password, email, send_email=True, profile_callback=None):\n # Create the user.\n new_user = User.objects.create_user(username, email, password)\n new_user.is_active = False\n new_user.save()\n \n # And finally create the registratio...
[ "0.81380326", "0.808892", "0.8042128", "0.8009329", "0.796567", "0.7933601", "0.78815943", "0.7812859", "0.7776406", "0.7746961", "0.7717471", "0.7642031", "0.7625987", "0.7610514", "0.754873", "0.7547343", "0.75323546", "0.75179845", "0.7500091", "0.7494735", "0.748131", "...
0.72280025
85
Create a ``RegistrationProfile`` for a given ``User``, and return the ``RegistrationProfile``.
def create_profile(self,user): salt= sha.new(str(random.random())).hexdigest()[:5] activation_key = sha.new(salt+user.username).hexdigest() return RegistrationProfile(user=user, activation_key=activation_key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_registration_profile(self, user):\n salt = hashlib.sha1(str(random.random())).hexdigest()[:10]\n activation_key = hashlib.sha1(salt + user.username).hexdigest()\n\n return self.create(user=user, activation_key=activation_key)", "def create_profile(self, user):\n salt = sha....
[ "0.8223235", "0.78692263", "0.7372174", "0.73067397", "0.70762444", "0.6990593", "0.69725096", "0.6967239", "0.6944255", "0.6929402", "0.6837238", "0.6790474", "0.67200273", "0.6655921", "0.6645508", "0.6624257", "0.6616297", "0.6602875", "0.6593323", "0.6572731", "0.6567856"...
0.82466364
0
Remove expired instances of ``RegistrationProfile`` and their associated ``User``s. It is recommended that this method be executed regularly as part of your routine site maintenance; this application provides a custom management command which will call this method, accessible as ``manage.py cleanupregistration``.
def delete_expired_users(self): for profile in self.all(): if profile.activation_key_expired(): user = profile.user if not user.is_active: user.delete()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_expired_users(self):\n for profile in self.all():\n if profile.activation_key_expired():\n user = profile.user\n if not user.is_active:\n user.delete() # Removing the ``User`` will remove the ``RegistrationProfile``, too.", "def delete...
[ "0.73485786", "0.70826864", "0.67892396", "0.63968474", "0.63140017", "0.6178437", "0.59981287", "0.59697443", "0.58801055", "0.58665377", "0.5861399", "0.57514364", "0.56671995", "0.5614381", "0.5590029", "0.5549079", "0.54921854", "0.54647243", "0.54460067", "0.5438572", "0...
0.67647916
3
Determine whether this ``RegistrationProfile``'s activation key has expired, returning a boolean ``True`` if the key has expired.
def activation_key_expired(self): expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS) return self.activation_key == "ALREADY_ACTIVATED" or \ (self.user.date_joined + expiration_date <= datetime.datetime.now())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activation_key_expired(self):\n expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)\n return self.activation_key == RegistrationProfile.ACTIVATED or \\\n (self.user.date_joined + expiration_date <= datetime.datetime.now())", "def activation_key_expired(self...
[ "0.83501804", "0.8222682", "0.81992865", "0.81386024", "0.7516272", "0.7467682", "0.74582344", "0.73868984", "0.7339861", "0.73238057", "0.73221445", "0.7315253", "0.7312832", "0.7293252", "0.7281807", "0.7278523", "0.72605157", "0.72463185", "0.7241741", "0.7210935", "0.7179...
0.81454015
3
Test simple creation of FCS data objects.
def test_simple(self): with self.subTest("from np array"): data = np.random.rand(10, 4) mask = np.ones((10, 4)) channels = ["a", "b", "c", "d"] fcs.FCSData((data, mask), channels=channels)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_creation(self):\n\n # Create a new model-free data pipe.\n name = 'new'\n pipes.create(name, 'mf')\n\n # Test that the data pipe exists.\n self.assert_(name in ds)\n\n # Test that the current pipe is the new pipe.\n self.assertEqual(pipes.cdp_name(), name)"...
[ "0.6500922", "0.64547837", "0.6330782", "0.6293225", "0.6256731", "0.62162656", "0.6202227", "0.6180555", "0.6134302", "0.60411376", "0.6032592", "0.60213226", "0.60207963", "0.6019068", "0.597896", "0.5971636", "0.5969382", "0.5944398", "0.59388745", "0.59306365", "0.5924186...
0.62696636
4
Creates a new Url instance
def url_generator(request): if request.method == "POST": data = json.loads(request.body.decode("utf-8")) url_received = data.get("urlToShorten") shortened_url = check_available_short_url() new_url = Url.objects.create(long_url=url_received, short_url=shortened_url) new_url.sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_url(self):\n ...", "def url_obj(self):\n if self._url_obj is None:\n self._url_obj = Url(self.url)\n self._url_obj.base_path = config['project_folder']\n self._url_obj.default_filename = 'index.html'\n self._url_obj._unique_fn_required = False\n...
[ "0.7269231", "0.71459675", "0.68103904", "0.6707005", "0.6706794", "0.65641475", "0.6548232", "0.6511777", "0.6412974", "0.6342479", "0.63386196", "0.62022376", "0.61701685", "0.6162101", "0.6160003", "0.61540544", "0.61481446", "0.61276895", "0.6100461", "0.60753065", "0.606...
0.0
-1
Redirects to url associated with shortened url
def link_redirect(request, shortened_url: str): try: url = Url.objects.get(short_url=shortened_url) long_url = url.long_url return HttpResponseRedirect(long_url) except Url.DoesNotExist or TypeError: return HttpResponseBadRequest("Wrong url")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_to_short_url(short_url):\n try:\n original_url = storage.get(short_url)\n return redirect(original_url)\n except:\n abort(400)", "def redirect_to_url(request, short_url):\n try:\n url = Url.objects.get(short_url=short_url)\n except Url.DoesNotExist:\n raise H...
[ "0.83120644", "0.8086085", "0.77167374", "0.76132107", "0.7463425", "0.7415398", "0.729672", "0.7218429", "0.7165089", "0.7079031", "0.7077186", "0.7062728", "0.70217586", "0.7017701", "0.6979237", "0.6929563", "0.6903711", "0.67491883", "0.674119", "0.6737849", "0.6708151", ...
0.8299281
1
For a given `course_id`, generate a CSV file containing all student answers to a given problem, and store using a `ReportStore`.
def generate(_xmodule_instance_args, _entry_id, course_id, task_input, action_name): start_time = time() start_date = datetime.now(UTC) num_reports = 1 task_progress = TaskProgress(action_name, num_reports, start_time) current_step = {'step': 'XblockCompletion - Calculating students answers to probl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_csv(request, cur_course_user, assessment_id):\n assessment = shortcuts.get_object_or_404(models.Assessment, pk=assessment_id)\n\n # Create the HttpResponse object with the appropriate CSV header.\n response = http.HttpResponse(content_type='text/csv')\n\n filename = \"%s-scores.csv\" % assessment.name\...
[ "0.6681831", "0.6210121", "0.6072917", "0.604187", "0.6029564", "0.56147665", "0.5609348", "0.5553079", "0.55339897", "0.5481398", "0.536873", "0.53386503", "0.53110987", "0.52652204", "0.5244391", "0.5237948", "0.522431", "0.5219502", "0.5210926", "0.5194309", "0.5186458", ...
0.4847259
56
Given a list of `rows` containing unicode strings, return a new list of rows with those strings encoded as utf8 for CSV compatibility.
def _get_utf8_encoded_rows(row): if six.PY2: return [six.text_type(item).encode('utf-8') for item in row] else: return [six.text_type(item) for item in row]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unicode_rows(stream, encoding, dialect, **kwds):\n # Get Unicode stream.\n if isinstance(stream, io.IOBase):\n streamreader_type = codecs.getreader(encoding)\n unicode_stream = streamreader_type(stream)\n elif isinstance(stream, Iterable):\n first_row, str...
[ "0.7000041", "0.69420046", "0.65636086", "0.643498", "0.6428575", "0.64129543", "0.6176699", "0.59829676", "0.59803176", "0.59619296", "0.596183", "0.58481246", "0.57346743", "0.57331055", "0.56966454", "0.55054474", "0.5471676", "0.5449447", "0.54462504", "0.5416911", "0.535...
0.8232703
0
Verify if the user is instructor
def have_permission(self, user, course_id): """ any([ request.user.is_staff, CourseStaffRole(course_key).has_user(request.user), CourseInstructorRole(course_key).has_user(request.user) ]) """ try: course_key = CourseKey.from_string(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_instructor(self):\n # pylint: disable=no-member\n return self.xmodule_runtime.get_user_role() == 'instructor'", "def test_user_role_instructor(self):\r\n self.assertEqual(\r\n 'instructor',\r\n access.get_user_role(self.course_instructor, self.course_key)\r\n ...
[ "0.77287406", "0.7598626", "0.7576974", "0.7528569", "0.74561703", "0.7144648", "0.67414063", "0.67364407", "0.66155523", "0.6517867", "0.6488433", "0.6459225", "0.6442829", "0.6412536", "0.6391039", "0.6346299", "0.6329346", "0.6240036", "0.6230296", "0.6197095", "0.6168086"...
0.0
-1
Verify format and course id
def validate_and_get_data(self, request): data = {'format': None, 'course': None} aux_resumen = request.GET.get('format', '') if aux_resumen == 'resumen': data['format'] = True elif aux_resumen == 'all': data['format'] = False # valida curso if req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_course(self, course, course_id='edX/toy/2012_Fall'):\n assert course_id == str(course.id)", "def clean_course_id(self):\r\n cleaned_id = self.cleaned_data[\"course_id\"]\r\n try:\r\n course_key = CourseKey.from_string(cleaned_id)\r\n except InvalidKeyError:\r\n ...
[ "0.7670736", "0.7454682", "0.7146575", "0.67267644", "0.6640026", "0.6604412", "0.6574738", "0.6475206", "0.6338128", "0.63089854", "0.6031048", "0.60297084", "0.60095537", "0.6005062", "0.59813017", "0.59299326", "0.59112054", "0.59066075", "0.5896106", "0.58957887", "0.5875...
0.5696473
35
Verify if course.id exists
def validate_course(self, id_curso): from openedx.core.djangoapps.content.course_overviews.models import CourseOverview try: aux = CourseKey.from_string(id_curso) return CourseOverview.objects.filter(id=aux).exists() except InvalidKeyError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_course(self, course, course_id='edX/toy/2012_Fall'):\n assert course_id == str(course.id)", "def is_course_exists(self):\n db = Course._file.read_db()\n courses = db[\"courses\"]\n for crs in courses:\n if crs[\"course_name\"] == self._course_name:\n ...
[ "0.78091115", "0.70707774", "0.68760955", "0.68757963", "0.6827377", "0.6823711", "0.6817545", "0.67981637", "0.6734861", "0.67331326", "0.6726011", "0.6682209", "0.6659843", "0.66595834", "0.66560584", "0.66188556", "0.65669453", "0.6452305", "0.6389866", "0.638358", "0.6345...
0.76066273
1
Returns information about the ancestors of an xblock.
def get_block_ancestors(self, xblock, store): ancestors = [] def collect_ancestor_info(ancestor): """ Collect xblock info regarding the specified xblock and its ancestors. """ if ancestor.location.block_type != 'course': ancestors.append({...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ancestors(self):\r\n return Node.s_ancestors(self)", "def ancestors(self):\n return self._ancestors", "def ancestors(self):\n return self._ancestors", "def ancestors(self):\n l = []\n n = self.node.parentNode\n while n:\n l.append(XmlWrapper(n))\n ...
[ "0.735646", "0.7268895", "0.7268895", "0.7257731", "0.7257731", "0.71810794", "0.7109341", "0.69479054", "0.6913855", "0.6909901", "0.68298626", "0.6665915", "0.66607493", "0.6615914", "0.6523836", "0.6522884", "0.6334188", "0.6259896", "0.6209838", "0.6107409", "0.60912377",...
0.78379494
0
Collect xblock info regarding the specified xblock and its ancestors.
def collect_ancestor_info(ancestor): if ancestor.location.block_type != 'course': ancestors.append({'type': ancestor.location.block_type, 'display_name': ancestor.display_name}) collect_ancestor_info(store.get_item(ancestor.parent))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_block_ancestors(self, xblock, store):\n ancestors = []\n\n def collect_ancestor_info(ancestor):\n \"\"\"\n Collect xblock info regarding the specified xblock and its ancestors.\n \"\"\"\n if ancestor.location.block_type != 'course':\n ...
[ "0.72645545", "0.56650704", "0.55771035", "0.5513479", "0.5433513", "0.532408", "0.532408", "0.5282096", "0.51781416", "0.51250774", "0.4981804", "0.49569547", "0.49468282", "0.4935761", "0.4935761", "0.49333844", "0.49292848", "0.49287447", "0.4918975", "0.48472416", "0.4801...
0.6892105
1
Create list of list to make csv report
def _build_student_data(self, data, csvwriter): url_base = data['base_url'] course_id = data['course'] is_resumen = data['format'] course_key = CourseKey.from_string(course_id) if is_resumen: header = ['Username', 'Email', 'Run', 'Seccion', 'SubSeccion', 'Unidad', 'Ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_csv(self):\n try:\n # Convert List of Lists to DataFrame and write it to a CSV\n pd.DataFrame(self.data, columns=self.header) \\\n .to_csv(os.path.join(self.file_path, self.file_name), index=False)\n self.successful_run = True\n except:\n ...
[ "0.6995488", "0.67714137", "0.64282215", "0.6406984", "0.64015085", "0.6396689", "0.63869965", "0.63632107", "0.6302933", "0.62706673", "0.6260956", "0.6232697", "0.6209204", "0.6198083", "0.61855125", "0.61794126", "0.6164397", "0.6153252", "0.6149598", "0.61407495", "0.6110...
0.0
-1
Return a list of student responses to this block in a readable way.
def generate_report_data(self, block): from capa.capa_problem import LoncapaProblem, LoncapaSystem capa_system = LoncapaSystem( ajax_url=None, # TODO set anonymous_student_id to the anonymous ID of the user which answered each problem # Anonymous ID is required for M...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def students(self):\n return self._parser.students", "def get_responses():\n\n\tresponses = []\n\tif auth.user_id is not None:\n\t\trows = db(db.response.created_by == auth.user_id).select(db.response.ALL)\n\tfor i, r in enumerate(rows):\t \n\t\t\tt = dict(\n\t\t\t\tuser_email = r.user_email,\n\t\t\t\tuse...
[ "0.61306065", "0.5758603", "0.56107897", "0.5570085", "0.55445415", "0.55292714", "0.5478727", "0.54398626", "0.54379135", "0.5432624", "0.54004055", "0.5371398", "0.5326652", "0.530327", "0.5291481", "0.5284827", "0.52781594", "0.5277163", "0.5270876", "0.52704656", "0.52546...
0.0
-1
Format contact for UI list interface.
def formatted_list_timecard_line(timecard_dict): return '%s %s %s %s %s %s %s ' % ( timecard_dict['id'], timecard_dict['contract']['client']['name'], timecard_dict['contract']['employee']['first'], timecard_dict['contract']['employee']['last'], timecard_dict['date'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_contact(self):\n contacts = \"\".join(str(contact) for contact in self.contact_list)\n print(contacts)", "def showEditContact(self):", "def create_contacts_list(self, contactsfile, templatefile='templates/contacts_list_template.tex', encoding='utf-8'):\n\n self.tex = \"\"\n\n ...
[ "0.74897474", "0.64901185", "0.6291291", "0.61752117", "0.6166811", "0.6104557", "0.60812867", "0.6025871", "0.6011121", "0.5974362", "0.59497803", "0.5892435", "0.5754909", "0.5754047", "0.5744188", "0.5737257", "0.57152945", "0.5708708", "0.570732", "0.56828934", "0.5668609...
0.0
-1