query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Gets the maximum size that an individual state can have, as configured in the
def get_max_state_size(self) -> int: return self._j_checkpoint_storage.getMaxStateSize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maxsize(self):\r\n return self._maxsize", "def state_size(self):\n\t\treturn (\n\t\t\ttf.TensorShape([self.args[\"kb_node_max_len\"], self.args[\"mp_state_width\"]]),\n\t\t)", "def state_size(self):\n raise NotImplementedError(\"Please implement this method\")", "def maximum_size(self):\n ...
[ "0.75285363", "0.7509355", "0.7476031", "0.74367666", "0.7305832", "0.7106442", "0.70652324", "0.7005597", "0.6962753", "0.689052", "0.68663186", "0.6848874", "0.68478715", "0.68309855", "0.68197405", "0.68184495", "0.68184495", "0.6794982", "0.67947835", "0.677638", "0.67763...
0.82545227
0
Mean perjoint position error (i.e. mean Euclidean distance), often referred to as "Protocol 1" in many papers.
def mpjpe(predicted, target): assert predicted.shape == target.shape, print(predicted.shape,target.shape) return torch.mean(torch.norm(predicted - target, dim=len(target.shape)-1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MeanSqError(self):\r\n\t\treturn self.mse", "def calc_error_dist(self):\n pass", "def mean_error(self) -> float:\n self.ME = sum(np.array(self.sim_data[\"Human (mean)\"]) - np.array(self.sim_data[\"assigned_sim\"])) / len(self.sim_data)\n return self.ME", "def norm_ape(self) -> float...
[ "0.68676", "0.6835788", "0.66268975", "0.654902", "0.64307433", "0.6387262", "0.6387209", "0.63702244", "0.6315875", "0.6285863", "0.6268412", "0.62545526", "0.6254205", "0.61778027", "0.61757517", "0.6163836", "0.6162205", "0.6161708", "0.6152291", "0.61094856", "0.6105163",...
0.5656597
94
Return the unit of measurement of this entity, if any.
def unit_of_measurement(self): return self._unit_of_measurement
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_of_measurement(self):\n return self._metadata[1]", "def unit_of_measurement(self):\n return self._unit", "def unit_of_measurement(self):\n return self._unit", "def unit_of_measurement(self):\n return self._unit", "def unit_of_measurement(self):\n return self._uni...
[ "0.8565862", "0.8477338", "0.8477338", "0.8477338", "0.8477338", "0.8477338", "0.8477338", "0.8477338", "0.8473674", "0.843327", "0.83701795", "0.8368336", "0.8334028", "0.82777756", "0.8239642", "0.82141906", "0.8204512", "0.8196942", "0.81599694", "0.8150877", "0.81474745",...
0.845385
13
Return the device class.
def device_class(self): return DEVICE_CLASS_POWER
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_class(self):\r\n return self._device_class", "def device_class(self):\n return self._device_class", "def device_class(self):\n return self._device_class", "def device_class(self):\n return self._device_class", "def device_class(self):\n return self._device_clas...
[ "0.91731", "0.916097", "0.916097", "0.916097", "0.916097", "0.916097", "0.90751135", "0.9070435", "0.90700305", "0.9045384", "0.9005979", "0.9005979", "0.9005979", "0.8895049", "0.88414824", "0.88414824", "0.88129085", "0.874694", "0.87423843", "0.87423843", "0.87018865", "...
0.78874
37
Returns a string formatted with the emojis corresponding to the pokemon types
def _get_types_string(types_list): type_str = "" for type in types_list: type_str += "{} {} ".format(emojis.get_emoji(type['name']), type['name']) return type_str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringify(self):\n string = self.chars[\"type\"] + \" \"\n \n # current hearts\n for _ in range(self.hearts):\n string += self.chars[\"heart\"]\n\n # dead hearts\n for _ in range(3 - self.hearts):\n string += self.chars[\"noheart\"]\n\n ret...
[ "0.6448906", "0.6194695", "0.6190729", "0.6157109", "0.5953812", "0.59221685", "0.58859473", "0.58358586", "0.5807647", "0.5737063", "0.5708496", "0.57082397", "0.5625021", "0.5596711", "0.5463356", "0.5438079", "0.54252386", "0.5403096", "0.53816986", "0.5350408", "0.5333599...
0.66074723
0
Gets the current version number. If in a git repository, it is the current git tag. Otherwise it is the one contained in the PKGINFO file. To use this script, simply import it in your setup.py file
def get_version(): git_root = find_git_root(dirname(__file__)) if git_root is not None: # Get the version using "git describe". cmd = "git describe --tags --match [0-9]*".split() try: version = subprocess.check_output(cmd).decode().strip() except subprocess.CalledPro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n click.echo(get_current_version_number())", "def version():\n\n version = None\n output = gitopen(['--version'])\n m = re.search(br\" version ([\\d\\.A-Za-z]+)\", output)\n if m is not None:\n version = m.group(1).decode('utf-8')\n return version", "def get_version(...
[ "0.7683499", "0.76360863", "0.75783", "0.75536495", "0.74863416", "0.7452775", "0.74194187", "0.73139966", "0.73014456", "0.7285545", "0.72693604", "0.726743", "0.7204154", "0.72016", "0.71858376", "0.712456", "0.7117981", "0.7117981", "0.7117981", "0.7112603", "0.7106826", ...
0.7601252
2
Visualize and save intrinsic images
def save_intrinsic_images(path, pred_images, label=None, individual=False): # Visualization for intrinsic images ## surface normal vis_N = (-pred_images['pred_N']+1) / 2.0 ## reflectance pred_R = pred_images['pred_R'] vis_R = adjust_image_for_display(pred_R, rescale=False, trans2srgb=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize(**images):\n n = len(images)\n plt.figure(figsize=(16, 5))\n for i, (name, image) in enumerate(images.items()):\n plt.subplot(1, n, i + 1)\n plt.xticks([])\n plt.yticks([])\n plt.title(' '.join(name.split('_')).title())\n plt.imshow(image)\n plt.show()\n...
[ "0.6926623", "0.684527", "0.6688353", "0.66778547", "0.6664221", "0.6664221", "0.6626811", "0.66146433", "0.65886", "0.65516293", "0.6550884", "0.6550754", "0.65414685", "0.65221995", "0.6517008", "0.6516348", "0.64823216", "0.64746994", "0.64576566", "0.6451941", "0.639702",...
0.7085365
0
If any entries are None in the datastructure, prune them. XMLRPC can't marshall None and this is our workaround. Objects that are None are removed from the hash including hash keys that are not None and have None for the value. The WUI or other SW should know how to deal with these returns.
def remove_nulls(self, x): assert x is not None, "datastructure is None" if type(x) == list: newx = [] for i in x: if type(i) == list or type(i) == dict: newx.append(self.remove_nulls(i)) elif i is not None: newx.app...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_empty(self, data, many):\n if not many:\n for key in list(data):\n if key == 'versions':\n data.pop(key)\n\n return {\n key: value for key, value in data.items()\n if value is not None\n }\n f...
[ "0.6979035", "0.66528404", "0.664247", "0.6486911", "0.6429938", "0.6334497", "0.633038", "0.6268716", "0.6251976", "0.61274654", "0.61226344", "0.6096773", "0.6067512", "0.602036", "0.6005617", "0.5958568", "0.5953988", "0.5948177", "0.5944474", "0.58886206", "0.5880055", ...
0.6248447
9
Get a random element from the set.
def getRandom(self) -> int: return choice(self.arr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()", "...
[ "0.77060276", "0.738916", "0.7296881", "0.72187954", "0.6871744", "0.68453854", "0.68330806", "0.67740154", "0.67226046", "0.6703282", "0.6665089", "0.66356236", "0.66217655", "0.6612035", "0.66000897", "0.6567767", "0.6477719", "0.6462421", "0.64428514", "0.64162946", "0.640...
0.5981498
70
Takes in a table and column name. Returns a new table without rows that have missing values for all the columns that start from the given column_name.
def drop_nonserious_rows(table, column_name): # encode table's nan as None for column in table.labels: encode_nans(table, column) full_df = table.to_df() start_idx = table.column_index(column_name) tbl = table.select(range(start_idx, table.num_columns)) df = tbl.to_df() na_df = df.no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_missing_rows(table, column_name=None):\n assert isinstance(table, Table), \"Input not a supported type.\"\n assert (column_name in table.labels), \"Input is invalid. Enter a valid column name.\"\n encode_nans(table, column_name)\n omitted_indices = []\n for index in range(len(table.column(c...
[ "0.7487602", "0.5665309", "0.5353835", "0.53333735", "0.52740467", "0.5265281", "0.5200605", "0.5199007", "0.518938", "0.51851994", "0.51599324", "0.51134235", "0.5057124", "0.4986257", "0.49785915", "0.497327", "0.4965209", "0.49480936", "0.49320793", "0.49228954", "0.491175...
0.6836024
1
Calculate a reasonable embedding size for a vocabulary. Rule of thumb is 6 4th root of vocab_size.
def _embedding_dim(vocab_size): if not vocab_size or (vocab_size <= 0): raise ValueError("Invalid vocab_size %g." % vocab_size) return int(round(6.0 * math.sqrt(math.sqrt(vocab_size))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vocab_size(self) -> int:\n return len(self.vocabulary)", "def vocab_size(self) -> int:\n\n return self._vocab_size", "def vocab_size(self):\n return len(self.vocab)", "def vocab_size(self):\n return self._vocab_size", "def vocabulary_size(self):\n return len(self.vocab)",...
[ "0.77645296", "0.7710975", "0.7681055", "0.767926", "0.7653868", "0.76018673", "0.74916446", "0.74852765", "0.727453", "0.7243855", "0.7224155", "0.7224155", "0.72185904", "0.7131684", "0.68737894", "0.6795329", "0.67595106", "0.6677254", "0.6676375", "0.6664547", "0.6641976"...
0.8563332
0
Lookup embeddings. Looks up an embedding vector for each value in `ids`. All ids must be within [0, vocab_size), else an `InvalidArgumentError` is raised at runtime.
def _build(self, ids): # Construct embeddings. if self._existing_vocab is None: if self.EMBEDDINGS not in self._initializers: self._initializers[self.EMBEDDINGS] = basic.create_linear_initializer( self._vocab_size) self._embeddings = tf.get_variable( "embeddings", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embedded(self, word_ids, embedding_tensor, scope=\"embedding\"):\n with tf.variable_scope(scope):\n with tf.device(\"/cpu:0\"):\n inputs = tf.nn.embedding_lookup(embedding_tensor, word_ids)\n return inputs", "def evaluate_embedding(ids, sess, model, dataset, batch_size, normalize=True, resc...
[ "0.6824782", "0.64794713", "0.61185735", "0.5834524", "0.5799056", "0.57677114", "0.57604367", "0.57444817", "0.57065374", "0.5637807", "0.5619808", "0.56159985", "0.5608072", "0.559175", "0.55827224", "0.5562562", "0.55457425", "0.5541365", "0.553739", "0.55171734", "0.55107...
0.707877
0
Returns the Variable containing embeddings.
def embeddings(self): self._ensure_is_connected() return self._embeddings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embedding_trainable_variables(self) -> Sequence[tf.Variable]:\n return self._embedding_layer.trainable_variables", "def embedding_layer(self):\n with tf.name_scope(\"Embedding_Layer\"):\n V_size = len(self.vocab)\n embed_dim = len(self.embed[0]) \n W_embed_ = tf.get...
[ "0.7563472", "0.68393016", "0.6837873", "0.6615532", "0.6578026", "0.6495219", "0.6395568", "0.63771856", "0.6345286", "0.6302575", "0.6297721", "0.6291443", "0.62854874", "0.62606996", "0.6241241", "0.6219302", "0.6166535", "0.6126553", "0.61253214", "0.6097635", "0.6096881"...
0.65173024
5
Function that returns the new lr for optimizer.
def get_lr(self) -> List[float]: lr, _ = self._get_steps_lr_momentum(self.last_epoch) return [lr] * self.total_groups
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_learning_rate(self):\n\n # TODO(arashwan): Explore if we want to only allow explicit const lr sched.\n if not self._lr_config:\n lr = self._optimizer_config.learning_rate\n else:\n lr = LR_CLS[self._lr_type](**self._lr_config.as_dict())\n\n if self._warmup_config:\n lr = WARMUP...
[ "0.7794985", "0.74895114", "0.7481008", "0.74161017", "0.74161017", "0.7254725", "0.70550764", "0.7033203", "0.69871324", "0.6883289", "0.6861048", "0.68395376", "0.6801096", "0.67819965", "0.67809755", "0.67809755", "0.6751066", "0.6747155", "0.6742342", "0.6722739", "0.6719...
0.0
-1
Add an instance of an application from the Azure AD application gallery into your directory. You can also use this API to instantiate nongallery apps.
def instantiate(self, display_name): return_type = ClientResult(self.context) payload = { "displayName": display_name } qry = ServiceOperationQuery(self, "instantiate", None, payload, None, return_type) self.context.add_query(qry) return return_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self):\n\n if (self.application_name is None):\n print_error(\"Application name is required\")\n self.__logger.error(\"Application name is required\")\n return 1\n\n api_instance = self.__api(self.__engine.api_client)\n\n try:\n self.__logger...
[ "0.58609647", "0.5767912", "0.5678037", "0.55806273", "0.5576713", "0.55731964", "0.5567197", "0.5523701", "0.54121023", "0.5381323", "0.53224474", "0.5319236", "0.5319236", "0.5277294", "0.5222614", "0.5083697", "0.5055914", "0.5009107", "0.49629086", "0.49547073", "0.494174...
0.0
-1
The name of the application.
def display_name(self): return self.properties.get("displayName", None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name():\n return config.APP_NAME", "def app_name(self) -> str:\n return self._app_name", "def app_name(self):\n return self._app_name", "def app_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"app_name\")", "def app_name(self): # pylint:disable=funct...
[ "0.88987994", "0.8826656", "0.87065256", "0.8581351", "0.85392845", "0.8536273", "0.8536273", "0.82712877", "0.8257125", "0.8217089", "0.8217089", "0.8217089", "0.8217089", "0.8210752", "0.82000256", "0.8166687", "0.81319946", "0.7960315", "0.7956777", "0.7956144", "0.7917794...
0.0
-1
Retrieve the pymongo.database.Database instance.
def _get_db_instance(db: Union[str, Database]) -> MongoClient: if isinstance(db, str): db_name = parse_uri(db).get('database') if db_name is None: # TODO: Improve validation message raise ValueError("Invalid db: Could not extract database from uri: %s", db) db = Mongo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_db():\n if not hasattr(g, 'mongo_db'):\n g.db = get_mongo_db()\n\n return g.db", "def get_db():\n\n if not hasattr(g, 'mongo_db'):\n client = MongoClient(C.MONGODB_DATABASE_URI)\n g.db = client.test\n return g.db", "def get_database(self, database, instance=None):\n ...
[ "0.8352656", "0.82122177", "0.8047676", "0.8013389", "0.7937347", "0.78981614", "0.7850286", "0.7797712", "0.7770918", "0.77521634", "0.774944", "0.7735258", "0.7733088", "0.7650277", "0.76440614", "0.7644005", "0.7619896", "0.76054686", "0.7595185", "0.7591943", "0.75835955"...
0.7391481
28
Splits a list in chunks based on provided chunk size.
def _split_in_chunks(lst: Sequence[Any], chunksize: int) -> Iterator[Sequence[Any]]: for i in range(0, len(lst), chunksize): yield lst[i:i + chunksize]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_chunk(list, chunk_size):\n for i in range(0, len(list), chunk_size):\n yield list[i:i + chunk_size]", "def split_to_chunks(of_list, chunk_size):\n assert of_list is not None\n\n for i in range(0, len(of_list), chunk_size):\n yield of_list[i:i + chunk_size]", "def chunks...
[ "0.890636", "0.8613526", "0.8376899", "0.8227241", "0.82271624", "0.82134885", "0.82112545", "0.81332386", "0.81240916", "0.8117184", "0.806168", "0.804529", "0.8015914", "0.7804145", "0.7800791", "0.77937067", "0.77774024", "0.77357066", "0.7688037", "0.76343495", "0.7622223...
0.82645726
3
Takes in label and player as strings and initizalized to corresponding data member. Private data members are _label, _player, _legal_moves, and _potential_moves. Use .upper() method on _player to ensure consistency throughout program. _legal_moves and _potential_moves are initialized to an empty dict() and list(), resp...
def __init__(self, label, player): self._label = label self._player = player.upper() self._legal_moves = dict() self._potential_moves = list()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, label, player):\n \n super().__init__(label, player)\n self.set_legal_moves({\\\n 'RED': {'board':[[0,1,[-1,1],[1,1]],[1,0,[1,1],[1,-1]],[0,-1,[1,-1],[-1,-1]],[-1,0,[-1,-1],[-1,1]]],\\\n 'palace':[]},\\\n 'BLUE':{'board':[[0,1,[-1,1],...
[ "0.7904687", "0.7904687", "0.7763297", "0.7763297", "0.76967627", "0.76967627", "0.7546628", "0.6658947", "0.6405831", "0.64003843", "0.630014", "0.6274675", "0.6267136", "0.61693555", "0.6164105", "0.6160416", "0.61570185", "0.6100479", "0.6022939", "0.5956549", "0.59545636"...
0.894257
0
Takes in no parameters. Returns _legal_moves (dict) for GamePiece. Further access includes 'RED' & 'BLUE' keys with 'board' and 'palace' keys for each first level key. Corresponding values for 'board' and 'palace' contain lists within a list. The legal moves housed within the private data member are dimensional movemen...
def get_legal_moves(self): return self._legal_moves
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_valid_moves(self, piece):\n moves = {}\n left = piece.col - 1 # Left position\n right = piece.col + 1 # Right position\n row = piece.row # Current row\n\n if piece.get_player() == Player.white or piece.is_king():\n # Checks the movements from the bottom to ...
[ "0.7251159", "0.70126075", "0.6926442", "0.6914757", "0.6814497", "0.66781867", "0.66649234", "0.6625153", "0.6620936", "0.6607925", "0.6546394", "0.6536715", "0.646399", "0.64556825", "0.63775253", "0.63225716", "0.6315177", "0.6294941", "0.62741584", "0.6272344", "0.6266581...
0.6716006
5
Takes in legal_moves (dict) and sets _legal_moves to dict for GamePiece.
def set_legal_moves(self, legal_moves): self._legal_moves = legal_moves
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legal_moves():\n\tlegal_moves = (\"r\", \"p\", \"s\")\n\treturn legal_moves", "def get_legal_moves(self, board):\n moves = set()\n capture_moves = set()\n for move in self.pot_moves:\n target_row = self.field_row + move[0]\n target_col = self.field_col + move[1]\n ...
[ "0.644669", "0.6271464", "0.6264648", "0.6206639", "0.61440724", "0.609178", "0.60368735", "0.60206056", "0.5968491", "0.5963104", "0.59231496", "0.5878135", "0.5875474", "0.5844579", "0.5822216", "0.58123493", "0.57143867", "0.57129776", "0.57121867", "0.57040226", "0.569414...
0.78157425
0
Used within __init__ method by loading GamePieces onto the board. Generates potential moves for each GamePiece and uses set_potential_moves method at the end for each GamePiece to set potential moves.
def setup_janggi_game(self): blue_general = General('blue_general', 'BLUE') blue_guard_1 = Guard('blue_guard_1', 'BLUE') blue_guard_2 = Guard('blue_guard_2', 'BLUE') self.adjust_board(blue_general, 'e9') self.adjust_board(blue_guard_1, 'd10',) self.adjust_board(blue_gua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_potential_moves(self):\n\n board = self.get_board()\n\n for row_index, row in enumerate(board):\n\n for column_index, column in enumerate(row):\n\n if column is not None:\n \n position = self.reverse_position(column_index, row...
[ "0.7172797", "0.6994082", "0.6750515", "0.67256105", "0.66685665", "0.65872073", "0.65867627", "0.65860313", "0.6536564", "0.6516233", "0.6503926", "0.64840895", "0.64000136", "0.6373023", "0.6371596", "0.63440764", "0.6342404", "0.6308478", "0.6246396", "0.62343055", "0.6222...
0.0
-1
Takes in position_from (string). Generates potential moves based on Chariot GamePiece and starting position. Returns list of generated potential moves, if any move exists. Returns empty list if no move exists. Diagonal moves are handled with an iteration over a range up to 10 and simply added to simulated colum and row...
def chariot_generate_potential_moves(self, position_from): game_piece_object = self.get_game_piece_object_at_position(position_from) player = game_piece_object.get_player() board_moves = game_piece_object.get_legal_moves()[player]['board'] from_column, from_row = self.transpose_position...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def soldier_generate_potential_moves(self, position_from):\n\n game_piece_object = self.get_game_piece_object_at_position(position_from)\n player = game_piece_object.get_player()\n board_moves = game_piece_object.get_legal_moves()[player]['board']\n from_column, from_row = self.transpos...
[ "0.8455461", "0.8092571", "0.8037841", "0.77337545", "0.7658922", "0.7159673", "0.69821393", "0.66740435", "0.6545245", "0.62302697", "0.6203276", "0.6179662", "0.61773306", "0.61147517", "0.61076057", "0.587951", "0.5878437", "0.5875433", "0.5860348", "0.5845614", "0.5827232...
0.8265566
1
Takes in position_from (string). Generates potential moves based on Cannon GamePiece and starting position. Returns list of generated potential moves, if any move exists. Returns empty list if no move exists. Diagonal moves are handled with an iteration over a range up to 10 and simply added to simulated colum and row....
def cannon_generate_potential_moves(self, position_from): game_piece_object = self.get_game_piece_object_at_position(position_from) player = game_piece_object.get_player() board_moves = game_piece_object.get_legal_moves()[player]['board'] from_column, from_row = self.transpose_position(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def soldier_generate_potential_moves(self, position_from):\n\n game_piece_object = self.get_game_piece_object_at_position(position_from)\n player = game_piece_object.get_player()\n board_moves = game_piece_object.get_legal_moves()[player]['board']\n from_column, from_row = self.transpos...
[ "0.8394991", "0.81567365", "0.7941583", "0.7727276", "0.7654017", "0.72207046", "0.6973992", "0.6635553", "0.65369874", "0.6337052", "0.6259639", "0.6240707", "0.612408", "0.6057981", "0.6050479", "0.5901665", "0.58677304", "0.5828078", "0.58276963", "0.5808304", "0.5796212",...
0.83044153
1
Takes in position_from (string). Generates potential moves based on Horse GamePiece and starting position. Returns list of generated potential moves, if any move exists. Returns empty list if no move exists. Diagonal moves are handled with an iteration over a range of one and simply added to simulated colum and row. In...
def horse_generate_potential_moves(self, position_from): game_piece_object = self.get_game_piece_object_at_position(position_from) player = game_piece_object.get_player() board_moves = game_piece_object.get_legal_moves()[player]['board'] from_column, from_row = self.transpose_position(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def soldier_generate_potential_moves(self, position_from):\n\n game_piece_object = self.get_game_piece_object_at_position(position_from)\n player = game_piece_object.get_player()\n board_moves = game_piece_object.get_legal_moves()[player]['board']\n from_column, from_row = self.transpos...
[ "0.8285342", "0.7936166", "0.7674152", "0.76689804", "0.76110077", "0.69834703", "0.6746205", "0.6440145", "0.6212583", "0.6002381", "0.59949297", "0.5987321", "0.59578925", "0.59460896", "0.59249634", "0.5858117", "0.5853631", "0.58484274", "0.5828585", "0.5825367", "0.57802...
0.8552368
0
Takes in position_from (string). Generates potential moves based on Elephant GamePiece and starting position. Returns list of generated potential moves, if any move exists. Returns empty list if no move exists. Diagonal moves are handled with an iteration over a range of two and simply added to simulated colum and row....
def elephant_generate_potential_moves(self, position_from): game_piece_object = self.get_game_piece_object_at_position(position_from) player = game_piece_object.get_player() board_moves = game_piece_object.get_legal_moves()[player]['board'] from_column, from_row = self.transpose_positio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def soldier_generate_potential_moves(self, position_from):\n\n game_piece_object = self.get_game_piece_object_at_position(position_from)\n player = game_piece_object.get_player()\n board_moves = game_piece_object.get_legal_moves()[player]['board']\n from_column, from_row = self.transpos...
[ "0.83250815", "0.81027687", "0.80936897", "0.7933837", "0.76721483", "0.68827796", "0.66992587", "0.6484028", "0.627106", "0.61743957", "0.61281484", "0.60140026", "0.5998034", "0.5998025", "0.5926127", "0.5896149", "0.5863913", "0.5850071", "0.5816996", "0.5731756", "0.57208...
0.8250648
1
Takes in position_from (string). Generates potential moves based on Soldier GamePiece and starting position. Returns list of generated potential moves, if any move exists. Returns empty list if no move exists. Interacts with get_game_piece_object_at_position, get_player, get_legal_moves, transpose_position, reverse_pos...
def soldier_generate_potential_moves(self, position_from): game_piece_object = self.get_game_piece_object_at_position(position_from) player = game_piece_object.get_player() board_moves = game_piece_object.get_legal_moves()[player]['board'] from_column, from_row = self.transpose_position...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def horse_generate_potential_moves(self, position_from):\n\n game_piece_object = self.get_game_piece_object_at_position(position_from)\n player = game_piece_object.get_player()\n board_moves = game_piece_object.get_legal_moves()[player]['board']\n from_column, from_row = self.transpose_...
[ "0.79048765", "0.79043627", "0.77708054", "0.7737928", "0.7625273", "0.7403633", "0.71639585", "0.6627137", "0.65700424", "0.64100724", "0.6326938", "0.6317687", "0.61348677", "0.61040574", "0.60383373", "0.6034813", "0.5909264", "0.58866984", "0.5833095", "0.57966673", "0.57...
0.8437875
0
Create API endpoints available at /api/ by default
def create_api_endpoints(app): manager = APIManager(app, flask_sqlalchemy_db=models.database) manager.create_api(models.State, results_per_page=0) manager.create_api(models.Party, results_per_page=0) manager.create_api(models.Candidate, results_per_page=0) manager.create_api(models.Election, results...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_routes(api: Api):\n api.add_resource(SignUpApi, '/user/signup/')\n api.add_resource(LoginApi, '/user/login/')\n\n api.add_resource(UsersApi, '/users/')\n\n api.add_resource(CafeteriasCreationAPI, '/createcafeteria/')\n api.add_resource(CreateItemsAPI, '/createcafeteriaitems/')", "def re...
[ "0.7630805", "0.7504494", "0.7302368", "0.7102746", "0.6907493", "0.67967683", "0.67008704", "0.66796035", "0.6646827", "0.6532036", "0.6530052", "0.64738053", "0.64610803", "0.6443381", "0.64390594", "0.63953745", "0.6386179", "0.6340226", "0.6317091", "0.6265763", "0.626131...
0.74787104
2
Fix min and max values.
def _assign_min_max(self, val): if val in self.xml_json_num_map: return self.xml_json_num_map[val] elif val[-2:] == '.0': # or int(float(val)) # or printf-style return val[:-2] else: return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_min_max_values(self):\n\n p_1, p_2 = self.points[0], self.points[1]\n nb_dim = len(p_1.values)\n self._min_values = []\n self._max_values = []\n for d in range(nb_dim):\n d_min = min(p_1[d], p_2[d])\n d_max = max(p_2[d], p_2[d])\n self._m...
[ "0.7075349", "0.702859", "0.69638973", "0.6940012", "0.69349486", "0.69344294", "0.68010265", "0.6754034", "0.6713887", "0.6694001", "0.668051", "0.6651818", "0.65919346", "0.6588433", "0.65536314", "0.653676", "0.64899945", "0.6470343", "0.6462407", "0.64582896", "0.64393127...
0.61890113
49
List of symbols that have zero spin
def symbols_zero_spin(self) -> List[str]: return self._symbols_zero_spin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def non_zero_components(self) :\n return list(self.parent().characters())", "def get_symbol(self):\n return []", "def get_non_empty(self, timeframe):\n new_symbol_names_list = []\n for symbol_name in self.symbol_names_list:\n if self[symbol_name][timeframe].timestamps.size == 0:\n ...
[ "0.61570114", "0.61262316", "0.591315", "0.58478403", "0.5809108", "0.5792243", "0.5792243", "0.5713672", "0.56624913", "0.5653848", "0.5617641", "0.5606576", "0.55981064", "0.55807817", "0.55568004", "0.5546817", "0.5479564", "0.543638", "0.54313993", "0.5405638", "0.5381552...
0.83817905
0
Returns the EFG tensor for a given atom index
def get_efg_tensor(self, atom_index: int) -> ArrayLike: return self._efg_tensors[atom_index - 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_tensor(index):\n output_details = interpreter.get_output_details()[index]\n tensor = np.squeeze(interpreter.get_tensor(output_details['index']))\n return tensor", "def get_output_tensor(self, index):\n output_details = self.model.get_output_details()[index]\n tensor = np.squ...
[ "0.5423408", "0.5389544", "0.5381744", "0.5368347", "0.5349198", "0.5347822", "0.5341656", "0.5296141", "0.5290358", "0.5290358", "0.5290358", "0.5268682", "0.5267774", "0.52351075", "0.5187739", "0.5111109", "0.50812227", "0.5066773", "0.50644755", "0.504053", "0.5039346", ...
0.8123834
0
Create Dataset objects for multiple splits of a dataset.
def splits(cls, search_query = 'all', max_results = 300, start = 0, reduced_words=1000, savepath='.data', split_ratio=0.7, stratified=False, strata_field='abstract', random_state=None, **kwargs): # initialize text field text_field = torchtext.data.Field(tokenize=get_tokenizer("spacy"), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_dataset(self, split, shuffle_files=None):\n return self._as_dataset(split=split, shuffle_files=shuffle_files)", "def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, s...
[ "0.7148054", "0.7128125", "0.7125031", "0.6977792", "0.69340515", "0.685946", "0.6851717", "0.6804024", "0.67322564", "0.671834", "0.6639963", "0.66325855", "0.66004896", "0.6577945", "0.65342003", "0.6509508", "0.65007603", "0.6491623", "0.64852655", "0.6457715", "0.6397481"...
0.0
-1
Construct relative file system path for new file store files relative to FILE_STORE_BASE_DIR. Based on
def file_path(instance, filename): hashcode = hash(filename) mask = 255 # bitmask # use the first and second bytes of the hash code represented as # zero-padded hex numbers as directory names # provides 256 * 256 = 65536 of possible directory combinations dir1 = "{:0>2x}".format(hashcode & mask...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path(self):\n path = os.path.join(self.base_dir, self.store().replace(' ', '_'), self.package_name())\n return os.path.abspath(path)", "def get_absolute_pathname(self):\n return os.path.join(settings.PRIVATE_STORAGE_ROOT, self.get_relative_pathname())", "def make_path(self, filename):\...
[ "0.659409", "0.6542026", "0.65226555", "0.6450107", "0.6357975", "0.6354855", "0.6284593", "0.6208842", "0.62053263", "0.61534625", "0.61512667", "0.6149718", "0.607265", "0.60700256", "0.60121274", "0.598929", "0.5980502", "0.59737957", "0.5966228", "0.5964739", "0.596338", ...
0.58553755
36
Construct the absolute path to the data file.
def get_absolute_path(self): if self.datafile and self.datafile.storage.exists(self.datafile.path): return self.datafile.path else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_path():\n\n # Get pathname absolute or relative.\n path = os.path.join(\n os.path.dirname(__file__), __malstor_data_directory__)\n\n abs_data_path = os.path.abspath(path)\n if not os.path.exists(abs_data_path):\n raise project_path_not_found\n\n return abs_data_path", "d...
[ "0.77355385", "0.7652966", "0.7641336", "0.7602844", "0.75632554", "0.75187165", "0.7515598", "0.7476613", "0.74683344", "0.74135065", "0.7352527", "0.7339394", "0.7290179", "0.7242951", "0.7200372", "0.71432847", "0.7141109", "0.7124863", "0.709032", "0.70719475", "0.7028239...
0.7104179
18
Return the size of the file in bytes.
def get_file_size(self, report_symlinks=False): if self.is_symlinked() and not report_symlinks: return 0 try: return self.datafile.size except ValueError: # file is not local return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_size():\n return os.path.getsize(FILE_NAME)", "def get_file_size(self) -> int:\n return self.get_main_information()['FileSize']", "def file_size(self):\n if self.fn is not None:\n return self.fn.stat().st_size", "def file_size(self) -> int:\n return self.get_main_i...
[ "0.88704294", "0.87261117", "0.8625161", "0.8610508", "0.85884136", "0.8573948", "0.85702705", "0.84625155", "0.84625155", "0.84625155", "0.83991903", "0.8377665", "0.8331511", "0.83067924", "0.8267229", "0.82526696", "0.8236783", "0.82130164", "0.82130164", "0.82108194", "0....
0.7644105
53
Return the absolute path to the file store temp dir
def get_temp_dir(): return settings.FILE_STORE_TEMP_DIR
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_temp_path():\n return os.getcwd() + \"/temp/\"", "def _get_tmp_file_path(self):\n return os.path.join(self.tmp_dir, self.hash)", "def getTempFilePath(self):\n return self.tempDir + os.sep + MyFile(self.sourceFileName).getCurrentFileName() + \".tmp\"", "def tempdir(self):\n pat...
[ "0.8109633", "0.80082315", "0.78191185", "0.77506125", "0.77208626", "0.77028775", "0.75752825", "0.7538172", "0.75062877", "0.75029", "0.74819815", "0.74677444", "0.7401229", "0.7397293", "0.7397209", "0.73901284", "0.7378373", "0.7353003", "0.7287789", "0.7282331", "0.72791...
0.85495704
0
Return a tuple containing S3 bucket name and object key given S3
def parse_s3_url(url): result = urlparse.urlparse(url) return result.netloc, result.path[1:] # strip leading slash
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_bucket_key(s3_uri: str)->tuple:\n s3_regex=\"^s3://([a-z0-9.-]+)/(.*)$\"\n search =re.search(s3_regex, s3_uri)\n if search is None:\n raise Error(\"Invalid s3 uri: {}\".format(s3_uri))\n return search.groups()", "def _get_s3_key():\n\n key = __opts__[\"s3.key\"] if \"s3.key\" i...
[ "0.7586024", "0.73315424", "0.72197735", "0.70603716", "0.691337", "0.6892372", "0.6892045", "0.68520886", "0.68502885", "0.68400675", "0.68320465", "0.68159723", "0.6750333", "0.67149657", "0.6710808", "0.66326886", "0.66222644", "0.6594905", "0.64962345", "0.643446", "0.642...
0.0
-1
Test for updating a configuration
def test_update_configuration(self): ts_name = 'test-update-1' configuration = timeserie_configuration.get_timeserie_configure( self.get_local_dynamo_cli(), ts_name) self.assertTrue(configuration.default) self.assertEquals(configuration.retentions, granularities.RETENTIONS_G...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_config_update(get_config):\n cfg = get_config(Config, {'test': 'main'})\n update_from = {\"name\": \"new_name\"}\n cfg.update(update_from)\n\n assert cfg.data.get('name') == \"new_name\", \"config was not updated\"", "def test_config_change():\n clean_tables()\n config = set_configurat...
[ "0.8463751", "0.8384371", "0.776926", "0.7575652", "0.7483247", "0.74635816", "0.74635816", "0.74635816", "0.72326326", "0.72008586", "0.71751946", "0.71735734", "0.7149747", "0.70990103", "0.70602465", "0.70339155", "0.6993581", "0.69472015", "0.6926296", "0.69138", "0.68697...
0.73241454
8
Test case for model_flow_node_model_flow_id_node_id_component_put
def test_model_flow_node_model_flow_id_node_id_component_put(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_model_flow_node_model_flow_id_node_id_component_post(self):\n pass", "def test_model_flow_node_model_flow_id_node_id_component_get(self):\n pass", "def test_model_flow_node_model_flow_id_node_id_component_delete(self):\n pass", "def test_0_put(self):\n self.assertIsNotNon...
[ "0.8057026", "0.77567786", "0.722733", "0.65671104", "0.64234394", "0.6226533", "0.56367064", "0.5618054", "0.55769783", "0.55674756", "0.5551085", "0.5548222", "0.5482657", "0.5466336", "0.5450811", "0.54335046", "0.535195", "0.535195", "0.5333394", "0.53060746", "0.529083",...
0.95278
0
Keep track of seen nodes to avoid getting caught in loops.
def __repr__(self): string = '' seen = set() curr = self.head while curr: if curr in seen: string += 'loop: ' + str(curr) break else: string += str(curr) seen.add(curr) return string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remember_visited_node(self, node_pos):\n self.visited_nodes.append(node_pos)", "def _seen(node):\n\t\tcheck = linked_list\n\t\twhile check != node:\n\t\t\tif check.value == node.value:\n\t\t\t\treturn True\n\t\t\tcheck = check.next\n\t\treturn False", "def update_visited(self):\n\t\tcount = self...
[ "0.6763543", "0.65695095", "0.6454385", "0.6089076", "0.60830927", "0.60316503", "0.600214", "0.5923689", "0.591743", "0.5904472", "0.5885702", "0.5848081", "0.58304024", "0.5753184", "0.5750692", "0.574317", "0.5741821", "0.5729528", "0.5725163", "0.57248795", "0.5716742", ...
0.0
-1
String for representing the Model object (in Admin site etc.)
def __str__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model if self.model else '')", "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"", "def __str_...
[ "0.7801624", "0.77112937", "0.767426", "0.767426", "0.7524702", "0.74020135", "0.7398639", "0.7378346", "0.7328583", "0.7270028", "0.7244434", "0.7233179", "0.7205981", "0.7174358", "0.7165676", "0.7108926", "0.70379156", "0.70379156", "0.7012156", "0.69865996", "0.6968002", ...
0.0
-1
String for representing the Model object.
def __str__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )", "def __str__(self):\n \n res =...
[ "0.82368803", "0.79901737", "0.7849152", "0.78468513", "0.77520275", "0.7625378", "0.7625378", "0.76225406", "0.76225406", "0.75483394", "0.7522958", "0.7470355", "0.7469358", "0.7447144", "0.7447144", "0.74314755", "0.7427648", "0.7389925", "0.7351721", "0.73424315", "0.7322...
0.0
-1
Returns the url to access a detail record for this book.
def get_absolute_url(self): return reverse('product-detail', args=[str(self.id)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_absolute_url(self):\n return reverse('book-detail', args=[str(self.id)]) \n # Returns an URL that can be used to access a detail record for this model \n # (for this to work we will have to \n # -- Define a URL mapping that has the name 'book-detail' (name='book-detail')\n ...
[ "0.76990575", "0.7611185", "0.7257499", "0.7257499", "0.7257499", "0.7117704", "0.6992158", "0.69547594", "0.6935497", "0.684423", "0.6591669", "0.6543265", "0.6541738", "0.64656514", "0.6445659", "0.64323515", "0.64318234", "0.6417527", "0.6407866", "0.638662", "0.6367192", ...
0.61491823
46
String for representing the Model object
def __str__(self): return '{0} ({1})'.format(self.id,self.product.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )", "def __str__(self):\n \n res =...
[ "0.8219232", "0.8020793", "0.77580154", "0.7699273", "0.7683828", "0.7678613", "0.7568337", "0.7568337", "0.75642484", "0.75642484", "0.75589746", "0.75219977", "0.75219977", "0.7509915", "0.75078505", "0.7363909", "0.73598325", "0.7340365", "0.73359716", "0.73188025", "0.731...
0.0
-1
String for representing the Model object
def __str__(self): return '{0} ({1})'.format(self.id,self.product.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )", "def __str__(self):\n \n res =...
[ "0.8219232", "0.8020793", "0.77580154", "0.7699273", "0.7683828", "0.7678613", "0.7568337", "0.7568337", "0.75642484", "0.75642484", "0.75589746", "0.75219977", "0.75219977", "0.7509915", "0.75078505", "0.7363909", "0.73598325", "0.7340365", "0.73359716", "0.73188025", "0.731...
0.0
-1
Split a iterable in N parts each of len = sz. Last chunk maybe will have len < sz.
def split(it, sz): out = [] last = 0.0 while last < len(it): out.append(it[int(last):int(last + sz)]) last += sz return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_on_chunks(self, iterable, size):\n return utils.split_on_chunks(iterable, size)", "def chunks(iterable, size):\n it = iter(iterable)\n chunk = tuple(itertools.islice(it, size))\n while chunk:\n yield chunk\n chunk = tuple(itertools.islice(it, size))", "def chunker(itera...
[ "0.77397484", "0.76790947", "0.7655592", "0.7655592", "0.7655592", "0.7550172", "0.7496954", "0.7487097", "0.74466246", "0.74416596", "0.7331205", "0.7306668", "0.73049027", "0.72996587", "0.72494453", "0.72209966", "0.7202484", "0.71568", "0.7149335", "0.7139035", "0.712375"...
0.74774987
8
Sets the available_schedule_types of this ThermostatScheduleCapabilities.
def available_schedule_types(self, available_schedule_types): self._available_schedule_types = available_schedule_types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule_type(self, schedule_type):\n\n self._schedule_type = schedule_type", "def schedule_type(self, schedule_type):\n\n self._schedule_type = schedule_type", "def transmission_types(self, transmission_types):\n\n self._transmission_types = transmission_types", "def __init__(self, ...
[ "0.6262808", "0.6262808", "0.5885586", "0.5879984", "0.56795734", "0.5673393", "0.5571108", "0.5457903", "0.5388331", "0.5371618", "0.5311624", "0.5195645", "0.5185144", "0.5130782", "0.5130782", "0.5095781", "0.5092568", "0.5072365", "0.5030252", "0.5015728", "0.4993006", ...
0.85247105
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ThermostatScheduleCapabilities): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Partition can be generate with sequence of integers
def __init__(self, *elems, **kwargs) -> None: self.sequence = tuple(kwargs['partition']) if kwargs.get('partition') else elems
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partition(seq):\n\n return 0", "def parition_generator(n):\n # generator\n k = np.zeros(n, dtype=np.dtype(int))\n Z = np.zeros(n, dtype=np.dtype(int))\n h = [float(n)]\n yield(Z)\n while next_partition(Z, k, h) is not None:\n yield(Z)", "def integer_partitions(n, **kwargs):\n ...
[ "0.76143205", "0.7179246", "0.70688844", "0.70199496", "0.6534656", "0.64397174", "0.6287266", "0.62551814", "0.6193593", "0.61391765", "0.6065057", "0.6050426", "0.60188365", "0.5971983", "0.5948197", "0.59317267", "0.59159505", "0.5903489", "0.58857846", "0.58739465", "0.58...
0.0
-1
Return the plotting point to the origin.
def returnToOrigin(intCurrentLeftPin, intCurrentRightPin, fltXCurrent, fltYCurrent): # First, drawing point should move to bottom-right corner. # Then, it should move to origin (bottom-left). # lsX = [fltDrawingX, fltOriginX] # TODO: Remove this magic number. # TODO: Change ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_origin(self):\n return self.coord_cls(x=0, y=0, system=self)", "def get_origin(self):\n return self.coord_cls(x=0, y=0, z=0, system=self)", "def origin_x(self):\n return self._origin[0]", "def get_origin(self):\n return self.zero", "def x_origin(self):\n return se...
[ "0.7102374", "0.6975801", "0.6895618", "0.6844497", "0.67081857", "0.6604866", "0.6544439", "0.65362334", "0.65107524", "0.64737475", "0.6463307", "0.6381588", "0.63589394", "0.63370824", "0.63370824", "0.632687", "0.63212925", "0.6314136", "0.62591857", "0.62278974", "0.6210...
0.0
-1
Return number of missing values for selected column
def get_missing(self): missing_values = self.df[self.col_name].isnull().sum() return missing_values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_missing_values(col):\n return np.sum(np.isnan(col))", "def count_missing(a_dataframe):\n missing_count = []\n for category in a_dataframe.dtypes.keys():\n try:\n np.mean(a_dataframe.loc[:, category]) # skipping numeric\n except TypeError:\n count = sum(a_da...
[ "0.76435965", "0.719693", "0.69899046", "0.67944235", "0.6767239", "0.67486644", "0.6742597", "0.67146564", "0.66854715", "0.65716153", "0.65413487", "0.65193695", "0.6477303", "0.64713204", "0.6462284", "0.6422103", "0.64116657", "0.6402662", "0.6371612", "0.63603926", "0.63...
0.7710043
0
Return the minimum value for selected column
def get_min(self): min_value= self.df[self.col_name].min() return min_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min(self, column):\n return self.aggregate('min', *[column])", "def get_column_with_min_value(data):\n if not isinstance(data, pd.DataFrame):\n raise TypeError('Invalid input type: type(data) = {}'.format(type(data)))\n min_col_name = pd.Series(index=data.index)\n for i...
[ "0.7936118", "0.7560935", "0.72481465", "0.7153355", "0.711524", "0.7070418", "0.7070418", "0.70680994", "0.7067393", "0.7046302", "0.6931934", "0.6931628", "0.69184643", "0.69149846", "0.6875927", "0.6863844", "0.6807005", "0.6807005", "0.68001133", "0.6797233", "0.6792836",...
0.8765112
0
Return the maximum value for selected column
def get_max(self): max_value= self.df[self.col_name].max() return max_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max(self, column):\n if not column:\n columns = ['*']\n\n return self.aggregate('max', *[column])", "def argmax(table):\n return max((v,k) for k,v in table.iteritems())[1]", "def get_max(self):\r\n df = pd.read_csv(\"MonthlyRate.csv\")\r\n df = df[df.CurrencyCode =...
[ "0.7576187", "0.7242497", "0.7181117", "0.70821965", "0.70780826", "0.6970684", "0.6967628", "0.69617987", "0.69184506", "0.6917806", "0.6917534", "0.6917006", "0.68111783", "0.6797576", "0.67911553", "0.6789248", "0.67862326", "0.67740786", "0.6723624", "0.67139256", "0.6688...
0.87001896
0
Takes a list of string values and rebuilds it as a sting with comma delimiters so it would look like a hard coded yara list of strings
def resort_stings_add_commas(self, list_of_strings): list_of_strings.sort() count_of_strings = len(list_of_strings) for index, string in enumerate(list_of_strings): if index + 1 < count_of_strings: list_of_strings.insert(index+index+1, ',') return li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rejoin(textList):\n return ','.join(textList)", "def _format_list_for_query(input_list):\n return (\n \", \".join(input_list).replace(\" \", \"\").replace(\"'\", \"\").replace(\",\", \"%2C\")\n )", "def _format_list(param_list: Iterable[Any]):\n fmt_list = []\n for...
[ "0.72496146", "0.7076132", "0.70694387", "0.706925", "0.70304424", "0.69891316", "0.6878626", "0.6862383", "0.6850227", "0.68270034", "0.67845917", "0.67502236", "0.6748709", "0.6706046", "0.6691864", "0.66830456", "0.66377276", "0.6605588", "0.65712833", "0.65598106", "0.654...
0.6598418
18
Generates the current date in the valid format
def current_valid_date(self): return datetime.datetime.now().strftime('%Y-%m-%d')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date() -> str:\n\n return datetime.strftime(datetime.today(), _fmt)", "def get_current_date():\n return datetime.datetime.today().strftime(constants.DATE_FORMAT)", "def todaystr():\n today = datetime.datetime.today()\n return f\"{today.year}{today.month:02}{today.day:02}\"", "def get_curr...
[ "0.74857134", "0.7297553", "0.7238977", "0.7166534", "0.71474344", "0.7072026", "0.6971874", "0.68818444", "0.6827289", "0.68036354", "0.6768951", "0.67617637", "0.67536384", "0.67335856", "0.67242736", "0.67050606", "0.6694477", "0.663946", "0.6635277", "0.66224784", "0.6609...
0.8032544
0
Get base attribute. Not pandas object
def _get(self, name): return object.__getattribute__(self, name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_base_patch_attribute(self, name):\n return getattr(self.patches[0],name)", "def get_attribute(self, attr):\n super().get_attribute(attr) # Keep this line, it triggers the parent class method.\n return getattr(self, attr)", "def __getattribute__(self, name):\n # special att...
[ "0.70235664", "0.6671475", "0.6580095", "0.6540233", "0.6485864", "0.6412031", "0.64007384", "0.63869065", "0.6342761", "0.6294118", "0.62887853", "0.62887853", "0.62887853", "0.62873656", "0.62873656", "0.62873656", "0.62731767", "0.62731767", "0.6251906", "0.62453336", "0.6...
0.6011788
29
Return objects for the current authenticated user only
def get_queryset(self): # Check if the parameter assigned_only is on the request assigned_only = bool( int(self.request.query_params.get('assigned_only', 0)) ) # Make copy of queryset so we do not modify the original queryset = self.queryset # If the parameter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n return super().get_queryset().filter(user=self.request.user)", "def get_queryset(self, request):\n qs = super().get_queryset(request)\n return qs.filter(user=request.user)", "def get_queryset(self, *args, **kwargs):\n qs = super().get_queryset(*args, **kwar...
[ "0.8128217", "0.81258285", "0.7882456", "0.78440523", "0.7745406", "0.7604245", "0.7604245", "0.7497975", "0.7315406", "0.7285781", "0.7250722", "0.7198163", "0.71906906", "0.71667135", "0.7160965", "0.7144866", "0.7118433", "0.7115828", "0.7115828", "0.7115828", "0.71137464"...
0.0
-1
Override the get_queryset function and specify to return objects for the current authenticated user only
def get_queryset(self): # Get tags from the request if it was specified tags = self.request.query_params.get('tags') # Get authors from the request if it was specified authors = self.request.query_params.get('authors') # Make copy of queryset as to not modify the original queryse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self, *args, **kwargs):\n qs = super().get_queryset(*args, **kwargs).filter(user=self.request.user)\n return qs", "def get_queryset(self, *args, **kwargs):\n qs = super().get_queryset(*args, **kwargs)\n user = self.request.user\n if not user.is_authenticated:\n...
[ "0.8872766", "0.8771092", "0.870035", "0.86552405", "0.8640782", "0.82057965", "0.82057965", "0.8080614", "0.80786717", "0.8067", "0.80256116", "0.7958871", "0.7818014", "0.77873474", "0.7764411", "0.7693293", "0.7657503", "0.7646021", "0.76365775", "0.7612055", "0.75946206",...
0.7252735
46
Gets the number of actions that can be applied to the environment
def get_number_of_actions(self): return self.__environment.action_space.n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_actions(self) -> int:\n return self.gym_env.action_space.n", "def get_num_actions():\n return 6", "def action_count(self):\n raise NotImplementedError", "def numActions(self):\n return len(self._mdp.A)", "def n_actions(self):\n return sum(op.action is not None for op in...
[ "0.8242846", "0.80170727", "0.77094585", "0.7692836", "0.75689656", "0.75568104", "0.7378993", "0.7366164", "0.7321911", "0.7004179", "0.69697535", "0.6864051", "0.6839154", "0.67751044", "0.6760181", "0.6730745", "0.66710514", "0.6608783", "0.6593166", "0.6584548", "0.65642"...
0.8845425
0
Yield iterable elements in order, skipping duplicate values.
def unique(iterable): seen_items = set() for item in iterable: if item not in seen_items: yield item seen_items.add(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eliminate_duplicates(iterable):\n class NoElement: pass\n\n prev_elem = NoElement\n for elem in sorted(iterable):\n if prev_elem is NoElement:\n prev_elem = elem\n yield elem\n continue\n\n if prev_elem != elem:\n prev_elem = elem\n ...
[ "0.76944953", "0.69205815", "0.68212795", "0.6770732", "0.67306197", "0.6721415", "0.669512", "0.66690344", "0.6642414", "0.6604633", "0.66023463", "0.658374", "0.6561043", "0.65563", "0.64705545", "0.6415076", "0.63000566", "0.6247703", "0.6247703", "0.624303", "0.6240098", ...
0.6767742
4
Return first n items of a given iterable.
def head(iterables, n=1): for index, item in enumerate(iterables): if index >= n: break yield item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take(n, iterable):\n return list(itertools.islice(iterable, n))", "def take(n, iterable):\n return list(itertools.islice(iterable, n))", "def take(n, iterable):\n return list(islice(iterable, n))", "def take(n, iterable):\n return list(islice(iterable, n))", "def take(iterable, n):\n ret...
[ "0.8207224", "0.8207224", "0.8183401", "0.8183401", "0.81163836", "0.80070645", "0.77860975", "0.7629714", "0.7549067", "0.7348816", "0.7279363", "0.72493654", "0.72493654", "0.72493654", "0.7183941", "0.70610285", "0.70589054", "0.70561355", "0.7002608", "0.69836277", "0.693...
0.7525676
9
Yield a tuple containing each item and the item following it. The item after the last one is treated as ``None``.
def pairwise(iterable): previous, current = None, None for current in iterable: if previous: yield previous, current previous = current if current: yield current, None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def around(elements):\n previous, current = None, None\n for next_item in elements:\n if current:\n yield previous, current, next_item\n previous, current = current, next_item\n if current:\n yield previous, current, None", "def pairs(iterable):\n previous = None\n ...
[ "0.74091274", "0.6767717", "0.67574245", "0.65807253", "0.65144515", "0.6288276", "0.62848103", "0.628182", "0.62041765", "0.61874735", "0.6145529", "0.60792595", "0.60418445", "0.6028041", "0.6022806", "0.5997773", "0.59663093", "0.5955394", "0.5955394", "0.5955394", "0.5948...
0.63853073
5
Gets a collection of `InputExample`s for the train set.
def get_train_examples(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_train_inputs(self, example):\n return example", "def get_train_examples(self, input_file):\r\n raise NotImplementedError()", "def _create_examples(self, data, set_type):\n examples = []\n for (i, elem) in enumerate(data):\n guid = \"%s-%s\" % (set_type, i)\n ...
[ "0.73499966", "0.7126833", "0.65602446", "0.64204013", "0.64052176", "0.63422555", "0.6290186", "0.6282746", "0.625262", "0.62499267", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "0.62466323", "...
0.7173421
1
Gets a collection of `InputExample`s for the dev set.
def get_dev_examples(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dev_examples(self, input_file):\r\n raise NotImplementedError()", "def get_train_inputs(self, example):\n return example", "def get_examples(self, env):\n return self.fam.c_get_examples(self, env)", "def _create_examples(self, data, set_type):\n examples = []\n for (i, ...
[ "0.68112403", "0.6588688", "0.655683", "0.64272827", "0.63816285", "0.6255956", "0.61930686", "0.61160946", "0.6094262", "0.6054992", "0.6051947", "0.5994604", "0.5994604", "0.5994604", "0.5994604", "0.5994604", "0.5994604", "0.5994604", "0.5994604", "0.5994604", "0.5994604",...
0.6552607
3
ResNet Version 2 Model builder [b] Stacks of (1 x 1)(3 x 3)(1 x 1) BNReLUConv2D or also known as bottleneck layer First shortcut connection per layer is 1 x 1 Conv2D. Second and onwards shortcut connection is identity. At the beginning of each stage, the feature map size is halved (downsampled) by a convolutional layer...
def resnet_v2(input_shape, depth, num_classes=7): if (depth - 2) % 9 != 0: raise ValueError('depth should be 9n+2 (eg 56 or 110 in [b])') num_filters_in = 16 num_res_blocks = int((depth - 2) / 9) inputs = Input(shape=input_shape) x = resnet_layer(inputs=inputs, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resnet_v2(input_shape, depth, num_classes=10):\n if (depth - 2) % 9 != 0:\n raise ValueError('depth should be 9n+2 (eg 56 or 110 in [b])')\n # Start model definition.\n inputs = Input(shape=input_shape)\n num_filters_in = 16\n num_filters_out = 64\n filter_multiplier = 4\n num_sub_b...
[ "0.69074035", "0.6819524", "0.6781376", "0.67045313", "0.65889347", "0.65814894", "0.6561877", "0.6560504", "0.6556938", "0.6496276", "0.6481267", "0.6467442", "0.6416495", "0.64021254", "0.6392585", "0.63641554", "0.63597256", "0.6346267", "0.6324663", "0.6320834", "0.631445...
0.6847664
1
Formats timedelta (duration) to a human readable form
def format_timedelta(timedelta, in_seconds=False, largest_units=None, auto_singulars=False): units = TIME_UNITS[1:] if in_seconds else TIME_UNITS if largest_units is None: largest_units = units[-1][0] elif largest_units not in map(lambda x: x[0], units): raise ValueError('Invalid largest u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_timedelta(delta):\n return '%dd%dh%dm' % (\n delta.days, delta.seconds / 3600, (delta.seconds % 3600) / 60)", "def format_timedelta(timedelta):\n seconds = timedelta.total_seconds()\n\n days, rmainder = divmod(seconds, 60 * 60 * 24)\n hours, rmainder = divmod(rmainder, 60 * 60)\n ...
[ "0.7879379", "0.7585419", "0.7496258", "0.7466444", "0.746275", "0.7397353", "0.73920316", "0.735107", "0.7331698", "0.72989017", "0.7278574", "0.7272623", "0.7265196", "0.72069955", "0.71822953", "0.7137368", "0.70937043", "0.70017517", "0.69972956", "0.69776845", "0.6967217...
0.6964473
21
parse a field as a string that must be blank.
def get_blank(record, field_name, reason=" in this case."): val = recordval(record, field_name) if val == "": return "" else: parser_error("field "+field_name+" must be blank"+reason) return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_blank_value_19(field):\n if field.null:\n return None\n else:\n return ''", "def non_empty_string(field: str) -> Union[Exception, str]:\n if not field:\n raise ValueError('Field must not be empty')\n\n return field", "def validate_allow_empty(cls, value: str, field: Mo...
[ "0.73723406", "0.7272765", "0.7057843", "0.6944956", "0.6861753", "0.67365986", "0.66554016", "0.6556773", "0.6494771", "0.6466401", "0.6302021", "0.62922096", "0.6128937", "0.61281735", "0.6096716", "0.60965574", "0.6082924", "0.60730165", "0.60423946", "0.6008368", "0.59005...
0.75337356
0
load a spreadsheet into a two dimensional array.
def regex_parse_gspreadsheet(instr, updated): # look ma, watch me parse XML a zillion times faster! #<entry> # <id>http://spreadsheets.google.com/feeds/cells/pMY64RHUNSVfKYZKPoVXPBg/1/public/basic/R14C15</id> # <updated>2009-04-28T03:34:21.900Z</updated> # <category scheme='http://schemas.google.com/spread...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_excel_file(fname, sheet_name='Sheet1', cell_range=None):\n #DEPRICATED CODE\n #d = cell_range.split(:))\n #row_size = int(d[1][1:]) - int(d[0][1:]) + 1\n #col_size = (ord(d[1][0].lower()) - 96) - (ord(d[0][0].lower()) - 96) + 1\n #cell_data = np.zeros([row_size, col_size])\n\n wb = openp...
[ "0.6738305", "0.64995843", "0.6427699", "0.6321427", "0.6255953", "0.62152463", "0.6011546", "0.6002315", "0.59706295", "0.5953945", "0.59345406", "0.58941275", "0.5862707", "0.58418477", "0.5814301", "0.57745826", "0.5710292", "0.567321", "0.56675816", "0.56547797", "0.55977...
0.0
-1
define sigmoid cross entropy loss operation for input(logits) tensors
def compile_time_operation(self, learning_option, cluster): # get input logits = self.get_input('logits') labels = self.get_input('labels') loss = L.SigmoidCrossEntropyLoss(logits, labels, name=self.name) # set output self.set_output('output', loss)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_cross_entropy(inputs, reduction='valid', **kwargs):\n args = ArgHelper.parse(locals())\n args['reduction'] = reduction.upper()\n op_lib = loss_ops_lib.SigmoidCrossEntropy\n if context.executing_eagerly():\n return op_lib \\\n .instantiate(reduction=args['reduction']) \\\n ...
[ "0.76244766", "0.7418454", "0.73906964", "0.73015434", "0.7284032", "0.72491765", "0.72351474", "0.7215843", "0.7177351", "0.7172533", "0.71530855", "0.7122052", "0.71161586", "0.70705247", "0.7055733", "0.7055444", "0.70055574", "0.6998309", "0.69870424", "0.6979939", "0.697...
0.0
-1
If title is None, return the locally saved title (or None if there isn't one) If description is None, return the locally saved description(or None if there isn't one) If title has value, save it locally, and return it. If description has value, save it locally, and return it.
def _generate_title_description(psap_id, title, description): if description is None: description = PersistentFields.get_description(psap_id) else: PersistentFields.set_description(psap_id, description) if title is None: title = PersistentFields.get_title(psap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n if not self.obj:\n self.obj = Book(title=unicode(self.title.data))\n else:\n self.obj.title = self.title.data\n return self.obj", "def Title(self, default=None):\n return self.data.get('title', default)", "def get_description(self):\n ...
[ "0.58710706", "0.57293224", "0.5522415", "0.5474681", "0.54542935", "0.54542935", "0.54542935", "0.54542935", "0.54542935", "0.54356974", "0.5404737", "0.53986293", "0.5382518", "0.5382507", "0.5382507", "0.5381946", "0.5374933", "0.5360073", "0.53277206", "0.53167284", "0.53...
0.6293138
0
r"""Return full path to the userspecific data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls bac...
def user_data_dir(appname=None, appauthor=None, version=None, roaming=False): if system == "win32": if appauthor is None: appauthor = appname const = "CSIDL_APPDATA" if roaming else "CSIDL_LOCAL_APPDATA" path = os.path.normpath(_get_win_folder(const)) # type: ignore if a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_app_data_dir(appname, *args):\n import ubelt as ub\n ub.schedule_deprecation(\n modname='ubelt', name='get_app_data_dir and ensure_app_data_dir', type='function',\n migration='use ubelt.Path.appdir(type=\"data\") instead',\n deprecate='1.2.0', error='2.0.0', remove='2.1.0')\n ...
[ "0.7856741", "0.7803481", "0.73346746", "0.72651124", "0.72388405", "0.71984005", "0.7015684", "0.6847522", "0.66709477", "0.6582244", "0.6546935", "0.6527762", "0.64894813", "0.64777607", "0.64616424", "0.6450551", "0.64119476", "0.6401646", "0.6395014", "0.63893425", "0.635...
0.8501469
0
Populates a dictionary of unexpected street types Searches for the street type from a given street name, and then verifies that it is an expected street type. If not, adds the street type and full street name ot the dictionary.
def audit_street_type(street_types, street_name): # search for street name m = street_type_re.search(street_name) if m: street_type = m.group(2) if street_type.lower() not in expected: # street type unexpected, add to dictionary street_types[street_type].add(street_na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def audit_street_type(street_types, street_name):\n\n match = street_type_re.search(street_name)\n if match:\n street_type = match.group()\n if street_type not in expected:\n street_types[street_type].add(street_name)", "def audit_street_type(street_types, street_name):\n m = st...
[ "0.77990866", "0.7762662", "0.6127011", "0.59686124", "0.5807096", "0.558434", "0.55544484", "0.5546469", "0.539085", "0.538002", "0.52205545", "0.51305807", "0.51295424", "0.50819844", "0.5022449", "0.5009071", "0.49692756", "0.49009764", "0.4886845", "0.48380375", "0.480490...
0.8235513
0
Returns true if tag is a cuisine type
def is_cuisine(elem): return elem.attrib['k'] == 'cuisine'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_tag(t):\n return len(t) > 1 and t.startswith('#') and not t.startswith('##') and t", "def is_co(self, astype):\n if isinstance(astype, (tuple, list)):\n return self.package(\"DataStructure\").CO in astype\n\n return astype is self.package(\"DataStructure\").CO", "def _is_desi...
[ "0.6114137", "0.60678667", "0.59419966", "0.5933535", "0.58470345", "0.5823813", "0.5823813", "0.57800686", "0.5742413", "0.570276", "0.56881636", "0.5638748", "0.562959", "0.5615303", "0.56148523", "0.56134534", "0.5578985", "0.55772704", "0.5566525", "0.5545672", "0.5545205...
0.6996739
0
Returns true if tag is a phone number
def is_phone(elem): return elem.attrib['k'] == 'phone'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_phone_number(elem):\n return (elem.attrib['k'] == \"phone\")", "def is_phone(self):\n return self.name in PHONES", "def is_phonenumber(number):\n\n phonenum = re.compile(r'^(\\d{3})-(\\d{3})-(\\d{4})$')\n if phonenum.match(number) is None:\n return False\n else:\n return...
[ "0.788773", "0.71054673", "0.69268763", "0.66453254", "0.66285753", "0.64105135", "0.6338232", "0.63263917", "0.6277153", "0.62571865", "0.6230956", "0.6129174", "0.6086254", "0.60223037", "0.59972686", "0.59817034", "0.5937863", "0.59270257", "0.592363", "0.58726656", "0.585...
0.7383042
1
Given a tuple of (normal_vec, support_factor, scaling_factor) yield embedding. ``model_stump`` is set to None.
def to_emb(emb_vals: Sequence[float], concept: Concept = None) -> ConceptEmbedding: assert 2 <= len(emb_vals) <= 3 concept_args = dict(concept=concept, model_stump=None, normal_vec=emb_vals[0], support_factor=emb_vals[1]) if len(emb_vals) == 3: concept_args["scalin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_emb(normal_vec, support_factor, scaling_factor):\n return ConceptEmbedding(normal_vec=normal_vec,\n support_factor=support_factor,\n scaling_factor=scaling_factor, **args)", "def linear_film_generator(embedding,\n ...
[ "0.6092227", "0.5451729", "0.5150514", "0.51312345", "0.49900484", "0.4951199", "0.49031228", "0.4894226", "0.48702845", "0.48582798", "0.4855525", "0.48501155", "0.48379552", "0.48356676", "0.48351774", "0.4834412", "0.4821598", "0.47780555", "0.47698602", "0.47349706", "0.4...
0.5001946
4
Test that the mean embedding by distance really fulfills the distance condition. This is that at any point in space the distance of the mean embedding is the mean of the distances of the other embeddings.
def test_distance_mean_condition(self, concept: Concept): # test points for testing the distance condition in several dimensions concept_args = dict(concept=concept, model_stump=None) for desc, (embs, _) in self.DISTANCE_MEAN_EXAMPLES.items(): embeddings = [ConceptEmbedding(normal_ve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_distance_mean_results(self, concept: Concept):\n\n concept_args = dict(concept=concept, model_stump=None)\n for desc, (embs, (m_w, m_b)) in self.DISTANCE_MEAN_EXAMPLES.items():\n m_w: np.ndarray = np.array(m_w)\n embeddings = [ConceptEmbedding(normal_vec=w, support_fact...
[ "0.8121505", "0.7377501", "0.69340163", "0.68616754", "0.6659477", "0.6406043", "0.6390554", "0.6354906", "0.6263909", "0.6210278", "0.6082934", "0.6064681", "0.60404974", "0.59807515", "0.5923", "0.5913996", "0.5873533", "0.5833202", "0.5824695", "0.5820619", "0.5809806", ...
0.7840869
1
Test obtaining the mean concept embedding, meaning the optimal mean hyperplane.
def test_complex_mean(self, concept: Concept): concept_args = dict(concept=concept, model_stump=None) for desc, (embs, (m_w, m_b)) in self.INTUITIVE_MEAN_EXAMPLES.items(): m_w: np.ndarray = np.array(m_w) embeddings = [ConceptEmbedding(normal_vec=w, support_factor=b, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mean_results(self, concept: Concept):\n concept_args = dict(concept=concept, model_stump=None)\n for desc, (embs, (m_w, m_b)) in self.INTUITIVE_MEAN_EXAMPLES.items():\n m_w: np.ndarray = np.array(m_w)\n embeddings = [ConceptEmbedding(normal_vec=w, support_factor=b,\n ...
[ "0.78650266", "0.7641204", "0.7538889", "0.68269557", "0.6481389", "0.63118374", "0.627741", "0.627741", "0.620115", "0.6065722", "0.60561025", "0.59991103", "0.59545773", "0.58616877", "0.58139926", "0.580249", "0.5754221", "0.57398105", "0.57334155", "0.56685895", "0.566736...
0.7440886
3
Test obtaining the mean concept embedding, meaning the optimal mean hyperplane. The condition for the more complex mean here is that at any point the mean distances to the hyperplanes along the normal vector equal the (unscaled!) distance to the mean hyperplane.
def test_complex_mean_condition(self, concept: Concept): concept_args = dict(concept=concept, model_stump=None) for desc, (embs, _) in self.INTUITIVE_MEAN_EXAMPLES.items(): embs: List[ConceptEmbedding] = \ [ConceptEmbedding(normal_vec=w, support_factor=b, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_distance_mean_results(self, concept: Concept):\n\n concept_args = dict(concept=concept, model_stump=None)\n for desc, (embs, (m_w, m_b)) in self.DISTANCE_MEAN_EXAMPLES.items():\n m_w: np.ndarray = np.array(m_w)\n embeddings = [ConceptEmbedding(normal_vec=w, support_fact...
[ "0.74163103", "0.7274535", "0.7211291", "0.6833565", "0.62884676", "0.58938533", "0.58938533", "0.58938533", "0.5891987", "0.5863934", "0.5863934", "0.5863934", "0.57446474", "0.5635343", "0.55909985", "0.5570676", "0.5569738", "0.55431914", "0.5519618", "0.5502745", "0.54995...
0.7975714
0
Return batch normalized output for convolutional layer (3D)
def conv_batch_norm(conv, depth, name): with tf.variable_scope(name) as scope: epsilon = 1e-3 mean, var = tf.nn.moments(conv, axes=[0, 1, 2, 3]) scale = tf.get_variable(name='scale', dtype=tf.float32, initializer=tf.ones([depth])) beta = tf.get_variable(name='beta', dtype=tf.float32,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CustomConv3D(x_in, nf, strides=1, kernel_size = 3):\r\n\tx_out = Conv3D(nf, kernel_size=3, padding='same',kernel_initializer='he_normal', strides=strides)(x_in)\r\n\t#print(\"AAAAA\", x_out.shape)\r\n\tx_out = BatchNormalization()(x_out)\r\n\tx_out = LeakyReLU(0.2)(x_out)\r\n\treturn x_out", "def conv_3d(sel...
[ "0.7142946", "0.67833364", "0.6638657", "0.6578372", "0.6477233", "0.6390021", "0.6389564", "0.6386757", "0.63851446", "0.6373696", "0.63414896", "0.6332316", "0.6318737", "0.63134766", "0.63134766", "0.63134766", "0.63134766", "0.63134766", "0.63134766", "0.63134766", "0.630...
0.0
-1
Gives the shape of the completeness array.
def shape(self): # TODO: perhaps this should be a list? That's what the shape # normally is. return np.array([len(self._R_boundaries)-1, len(self._P_boundaries)-1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shape(self):\n return self.to_array().shape", "def shape(self):\n return self.array.shape", "def shape(self,squeeze=True):\n return np.shape(self.getData(squeeze=squeeze))", "def shape(self):\n return self.abundance_df.shape", "def shape(self):\n return np.array([self.w, ...
[ "0.67455834", "0.6712074", "0.65871894", "0.6548024", "0.65445936", "0.64187896", "0.64187896", "0.64187896", "0.64187896", "0.64187896", "0.6353463", "0.6353463", "0.6353463", "0.6333015", "0.6317812", "0.6301721", "0.62958664", "0.627457", "0.6251432", "0.62376356", "0.6231...
0.66479504
2
Calculates the prior pdf of the occurrence rates.
def prior(self, log_occr_array=None): if log_occr_array is not None: # Catch invalid occurrence rates for zero likelihood try: self.log_occr = log_occr_array except InvalidOccurrenceRate: return 0.0 # Written in terms of occr for ease...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pdf(self,x):\n if self.base == 'natural':\n pdfValue = 1./(self.upperBound-self.lowerBound) * 1./x\n else:\n pdfValue = 1./(self.upperBound-self.lowerBound) * 1./x * 1./math.log(10.)\n return pdfValue", "def pdfPR(self,x,p,r):\n\t\treturn gammaF(x + r) / (factorial(x)*gammaF(r)) * p**r * (...
[ "0.64945275", "0.6343174", "0.63088703", "0.6275705", "0.6217519", "0.61502343", "0.6131702", "0.6069091", "0.60562295", "0.60552114", "0.6047258", "0.6039947", "0.5927951", "0.59155166", "0.5887435", "0.58497363", "0.5829212", "0.5827196", "0.58225137", "0.5804912", "0.58004...
0.0
-1
Calculates the prior pdf of the occurrence rates.
def log_prior(self, log_occr_array=None): if log_occr_array is not None: # Catch invalid occurrence rates for zero likelihood try: self.log_occr = log_occr_array except InvalidOccurrenceRate: return -np.inf if tf.is_tensor(self.occr):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pdf(self,x):\n if self.base == 'natural':\n pdfValue = 1./(self.upperBound-self.lowerBound) * 1./x\n else:\n pdfValue = 1./(self.upperBound-self.lowerBound) * 1./x * 1./math.log(10.)\n return pdfValue", "def pdfPR(self,x,p,r):\n\t\treturn gammaF(x + r) / (factorial(x)*gammaF(r)) * p**r * (...
[ "0.64945275", "0.6343174", "0.63088703", "0.6275705", "0.6217519", "0.61502343", "0.6131702", "0.6069091", "0.60562295", "0.60552114", "0.6047258", "0.6039947", "0.5927951", "0.59155166", "0.5887435", "0.58497363", "0.5829212", "0.5827196", "0.58225137", "0.5804912", "0.58004...
0.0
-1
Calculates the log posterior of a value array of occr. log_occr_array can also be flattened so that emcee can use it, however we then need to set flattened_occr to True.
def log_posterior(self, log_occr_array=None, event_values=None, flattened_occr=False): if flattened_occr and log_occr_array is not None: # Unflatten it into the occurrence rate grid log_occr_array = np.reshape(log_occr_array, np.shape(self.occr)) # Let the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grad_log_posterior(self, log_occr_array=None, event_values=None,\n flattened_occr=False):\n\n if flattened_occr and log_occr_array is not None:\n # Unflatten it into the occurrence rate grid\n log_occr_array = np.reshape(log_occr_array, np.shape(self.occr))\n\n...
[ "0.73412126", "0.6578155", "0.65679276", "0.628834", "0.6266861", "0.62586546", "0.6241569", "0.61834615", "0.6128937", "0.61111546", "0.5951927", "0.5933851", "0.5835209", "0.57750523", "0.54658765", "0.518763", "0.51862806", "0.5108755", "0.5043803", "0.50416434", "0.504157...
0.8224875
0
Calculates the 95% upper limit in different planet classes.
def split_into_classes(self, bounds=None, percentile=95): if self._sample_storage is not None: occr = self.volumise_occr(self._sample_storage) moccr = self.marginalise_occr_period(self._sample_storage) else: raise AttributeError("No stored samples found.") i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upper_bound(self) -> float:\n ...", "def _uppLim(self):\n if self.getResult(param='TS value')[0] >= self.tsmin:\n print(\"\\t=== TS value {} is above TSmin {}, no need to compute an upperlimit ===\"\n .format(self.getResult(param='TS value')[0], self.tsmin))\n ...
[ "0.67000896", "0.5994681", "0.59351856", "0.5855717", "0.58323723", "0.58156824", "0.5801716", "0.5756227", "0.5725512", "0.5713861", "0.57101256", "0.56202406", "0.558345", "0.5570055", "0.5546965", "0.55321455", "0.5523481", "0.55107266", "0.54884905", "0.5476446", "0.54735...
0.0
-1
Calculates a single poisson posterior pdf. If log_rate, then we are sampling rate in log_space and the prior is transformed. It is them assumed that rate is actually log(rate).
def poisson_log_posterior(rate, rate_multiplier, num_events, log_rate): if log_rate: log_prior = 0.5*rate else: log_prior = -0.5*np.log(rate) rate_total = rate_multiplier * (np.exp(rate) if log_rate else rate) log_likelihood = -rate_total + num_events * np.log(rate_total) \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poisson_pdf(x, u, log=False):\n #return np.exp(-u)*(u**x)/factorial(x)\n #return np.exp(-u)*(u**x)/gamma(x+1)\n if log:\n return poisson.logpmf(x, u)\n return poisson.pmf(x, u)", "def poisson_log_likelihood(x, log_rate):\n return x * log_rate - np.exp(log_rate) - lax.lgamma(x + 1.0)", "...
[ "0.7566596", "0.70412296", "0.6840309", "0.6651622", "0.6517675", "0.64906883", "0.6455442", "0.63338935", "0.6312513", "0.6270192", "0.62626606", "0.62009245", "0.62009245", "0.6189353", "0.61691684", "0.61467487", "0.61297816", "0.61081827", "0.60871613", "0.6078026", "0.60...
0.7877538
0
Constructor for an AVL tree. (optional) {key} is a function that returns the parameter which is used during comparisons. The < operator is used when comparing keys of elements. By default the key of the elements are themselves. (optional) {data} will be inserted into the AVL tree. {data} must be an iterable object. O(N...
def __init__(self, data: Iterable=None, key=lambda x: x): if not hasattr(key, "__call__"): raise ValueError("{key} must be a callable object") self.__root = None self.__size = 0 self.__key = key if hasattr(data, "__iter__"): for element in data: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, data):\n if type(data) != np.ndarray or np.shape(data) != (len(data),):\n raise ValueError(\"The data type is incorrect\")\n \n if self.root == None:\n new_node = KDTNode(data) #Sets the root ...
[ "0.61831933", "0.61381054", "0.6059352", "0.6028035", "0.5967719", "0.5961448", "0.59340066", "0.5894667", "0.5854683", "0.58434665", "0.5842824", "0.5816931", "0.57805896", "0.5773767", "0.57384026", "0.57378197", "0.57223016", "0.5613664", "0.5589859", "0.5577409", "0.55444...
0.6392973
0
Returns the number of elements in the tree. O(1)
def __len__(self) -> int: return self.__size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree_size(self) -> int:\n Q = Queue()\n count = 0\n Q.put(self.root)\n while not Q.empty():\n node = Q.get()\n count += 1\n for child in node.children.values():\n Q.put(child)\n return count", "def numNodes(T):\r\n n = 1\r\...
[ "0.79445225", "0.7941638", "0.78924453", "0.7827355", "0.7800792", "0.7769739", "0.76861167", "0.7661476", "0.75745887", "0.7495636", "0.7487593", "0.74720174", "0.7427652", "0.7405953", "0.74025947", "0.73836", "0.737515", "0.73125535", "0.7299223", "0.72835946", "0.7277564"...
0.0
-1
Checks if the AVL Tree is balanced (For debugging purposes).
def __is_balanced(self, curr_node: _AVLTreeNode or None) -> bool: if curr_node is None: return True return abs(curr_node.balance_factor) < 2 \ and self.__is_balanced(curr_node.left) and self.__is_balanced(curr_node.right)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_balanced(root):\n return depth(root) != -1;", "def is_balanced(self):\n\n def _height(node):\n \"\"\"Calculate the height of a node\"\"\"\n\n if not node:\n return 0\n\n return 1 + max(_height(node.left), _height(node.right))\n\n def _is_bal...
[ "0.8013717", "0.7733506", "0.75802624", "0.7547049", "0.7250006", "0.72482055", "0.7223457", "0.7221929", "0.7181821", "0.71737224", "0.70674825", "0.6986667", "0.69750977", "0.6815843", "0.66917634", "0.656172", "0.6509419", "0.65076894", "0.6468358", "0.6453767", "0.6446832...
0.7427523
4
Return an iterable or a collection of iterables that specifies training samples in the dataset.
def train_dataloader(self) -> DataLoader: return self._custom_data_loader()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_classification_training_data() -> Iterable[Tuple[str, Dict[str, Any]]]:\n return (_create_training_entry(*pair) for pair in TRAINING_DATA) # type: ignore", "def get_train_examples(self):\n raise NotImplementedError()", "def get_train_examples(self, data_dir):\r\n raise NotImplementedError...
[ "0.7078119", "0.70150614", "0.6827969", "0.67718875", "0.67718875", "0.67718875", "0.67718875", "0.67718875", "0.67718875", "0.67718875", "0.6744114", "0.6744114", "0.6724417", "0.67232656", "0.67232656", "0.67232656", "0.67232656", "0.67232656", "0.67232656", "0.67232656", "...
0.0
-1
Return an iterable or a collection of iterables that specifies test samples in the dataset.
def test_dataloader(self) -> DataLoader: return self._custom_data_loader()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_test_iterator(self) -> Iterable[Batch]:\n if self._test_name not in self._datasets:\n raise ValueError(\"Test data not provided.\")\n return self.get_iterator(self._test_name)", "def getTestData(self):\n raise NotImplementedError", "def get_test_examples(self, data_path)...
[ "0.6955592", "0.6789463", "0.67403615", "0.6642315", "0.6639678", "0.66375446", "0.65758365", "0.65758365", "0.65758365", "0.65758365", "0.65758365", "0.65263504", "0.6482817", "0.6482817", "0.64300877", "0.6409792", "0.6382469", "0.633993", "0.6234239", "0.6182259", "0.61803...
0.0
-1
Creates a function that iteratively loads images from a directory in batches using a memory efficient generator. Ie, the images will only be loaded when needed so you do not need to store all the data on file at once.
def create_image_batch_generator_function(data_dir, img_shape, pattern="*.jpg", shuffle=True): def batch_generator(batch_size): """ A function that returns a generator object that can be iterated over. Simply specify the batch size. """ # Randomly shuffle the order of the files ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_generator(batch_size, img_dir):\n cat_dirs = glob.glob(img_dir + \"/*\")\n counter = 0\n while True:\n input_images = np.zeros(\n (batch_size, config.height, config.width, 3 * 5))\n output_images = np.zeros((batch_size, config.height, config.width, 3))\n random.shuff...
[ "0.7957682", "0.77835536", "0.77459687", "0.7393", "0.7260616", "0.72353506", "0.72288316", "0.722664", "0.7216541", "0.7170624", "0.7154789", "0.7150006", "0.71498835", "0.7132345", "0.6971263", "0.69510543", "0.6935533", "0.6813726", "0.67937416", "0.67695594", "0.6751", ...
0.6993563
14
Actual UTC with timezone does not validate, change the time to Z
def getUTCDate(dateString, logger=default_logger): if(dateString): date = dateutil.parser.parse(dateString) date = date.astimezone(dateutil.tz.tzutc()) return date.strftime('%Y-%m-%dT%H:%M:%SZ') return dateString
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_utc_in_timez(monkeypatch):\n utcoffset8_local_time_in_naive_utc = (\n datetime.datetime(\n year=2020,\n month=1,\n day=1,\n hour=1,\n minute=23,\n second=45,\n tzinfo=datetime.timezone(datetime.timedelta(hours=8)),\n ...
[ "0.73621255", "0.702239", "0.69153744", "0.68938", "0.686691", "0.685432", "0.66323954", "0.6542876", "0.65214974", "0.65050507", "0.6504785", "0.6424643", "0.6424426", "0.63938224", "0.63879603", "0.63879603", "0.63879603", "0.63879603", "0.63879603", "0.63879603", "0.638796...
0.0
-1
Yield successive nsized chunks from l.
def chunks(l, n): if n: for i in xrange(0, len(l), n): yield l[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.738925
100
Return a valid Email instance.
def get_email(): return Email( subject='[Messages] Integration Test', body='Conducting Integration Testing', attachments=str(TESTDIR.joinpath('file2.png')))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email(self, email_id):\r\n return emails.Email(self, email_id)", "def validate_email(self, email):\n return models.Email.normalize_address(email)", "def clean_email(self):\n if getattr(self.instance, 'email', None):\n raise ValidationError(self.registered_error)\n ret...
[ "0.66479933", "0.64895236", "0.6482769", "0.64521486", "0.64386165", "0.6296082", "0.6248998", "0.62380296", "0.6235116", "0.6229508", "0.6200728", "0.6193384", "0.6174682", "0.6147918", "0.61305875", "0.60973376", "0.6061494", "0.6042414", "0.6027201", "0.60079163", "0.60051...
0.56148744
75
GIVEN a email with the wrong password WHEN sending the email THEN verify MessageSendError is raised
def test_email_badAuth(get_email): e = get_email e.auth = 'baDp@ssw0rd' with pytest.raises(MessageSendError): e.send()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_failed_email(self):\n self.assertEqual(send_email(\"testtestcom\", \"test\", \"test\"), 'There was an error sending')", "def test_invalid_email_when_logging_in(self):\n pass", "def test_sad_login_wrong_email(self):\n\n rv = self.login(\"wrong@email.com\")\n assert rv.status...
[ "0.73359865", "0.6837568", "0.683235", "0.6802293", "0.6742062", "0.6615911", "0.660579", "0.6598991", "0.659019", "0.6570449", "0.6546942", "0.65105915", "0.6501375", "0.6428686", "0.63934267", "0.6337326", "0.63336617", "0.6329955", "0.6319556", "0.6312132", "0.6287105", ...
0.7669346
0
matdatepicker returns a datetime object in UTC time. Need to convert this to local time as only date is stored in db
def convert_timezone(time): if time is None: return None from_zone = tz.tzutc() to_zone = tz.tzlocal() try: utc = datetime.strptime(time, "%Y-%m-%dT%H:%M:%S.%fZ") except ValueError: try: utc = datetime.strptime(time, "%Y-%m-%d") except ValueError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_drf_datetime(cls, obj_dt):\n return timezone.localtime(\n obj_dt, pytz.timezone(settings.TIME_ZONE)\n ).isoformat()", "def utc_to_local_datetime(dt):\n return dt.astimezone(LOCAL)", "def get_local_date(self):\n tz = pytz.timezone(self.timezone)\n utc = pytz...
[ "0.618831", "0.60608834", "0.603259", "0.56925887", "0.56925887", "0.56925887", "0.5672002", "0.56569034", "0.5646602", "0.56260884", "0.56039476", "0.554818", "0.55246395", "0.5514741", "0.5509379", "0.5502181", "0.5498418", "0.5493934", "0.5470504", "0.54625624", "0.5456708...
0.0
-1
generate filename based on rundate and filemask
def generate_filename( filepath, filestartwith, fileendwith, run_date, filemask): filedate = generate_dateformat(run_date, filemask) if not filedate: filename = filestartwith else: filename = filestartwith + filedate if fileendwith: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_filename(prefix='output_',extension='.txt'):\n outputname = prefix + '{:%Y%m%d%H%M%S}utc{}'.format(\n datetime.datetime.utcnow(),extension)\n return outputname", "def filename(N, Dr, g, launch):\n\n return 'N%s_R%s_G%s_E%s.datR' % tuple(map(float_to_letters,\n (N, Dr, g, launch)))", ...
[ "0.692512", "0.68302125", "0.68144524", "0.6812946", "0.6795724", "0.67618483", "0.6717113", "0.66868687", "0.66448766", "0.6613793", "0.6591313", "0.6584164", "0.6565873", "0.6540144", "0.6513157", "0.6487155", "0.64837885", "0.6433606", "0.64100575", "0.64057994", "0.640311...
0.78688365
0
Returns the inverse slope and its absolute error.
def get_estimated_inverse_slope(temp, temp_err, visc, visc_err, rad, rad_error): inv_slope = (1/get_slope(temp, visc, rad)) rel_error = get_relative_error(temp, temp_err, visc, visc_err, rad, rad_error) error = rel_error * inv_slope return inv_slope, error
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slope(self):\n if self.b == 0:\n return None\n else:\n return (-1) * self.a/self.b", "def get_slope(x, y, deg=1, err=[]):\n inverse_error = []\n for i in err:\n inv = 1/i\n inverse_error.append(i)\n\n if len(err)>0:\n z = np.polyfit(x, y, deg,...
[ "0.6968946", "0.66139805", "0.6495961", "0.64841264", "0.6438776", "0.6381706", "0.63693535", "0.6280468", "0.625425", "0.6190025", "0.6135163", "0.6125488", "0.6118671", "0.6092324", "0.60266966", "0.6025327", "0.59983623", "0.59936094", "0.5966528", "0.5957793", "0.58770645...
0.7081196
0
The redshift for this distance assuming its physical distance is a luminosity distance.
def compute_z(self, cosmology=None, **atzkw): from astropy.cosmology import z_at_value if cosmology is None: from astropy.cosmology import default_cosmology cosmology = default_cosmology.get() atzkw.setdefault("ztol", 1.0e-10) return z_at_value(cosmology.lumino...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def luminosity_distance(self, z):\n return self.proper_distance(z) * (1 + z)", "def luminosity_distance(self, z):\n da = self.angular_diameter_distance(z)\n dl = da*(1.+z)**2.\n return(dl)", "def get_luminosity(self):\n\n if self.no_dist is False and self.no_flux is False:\n\...
[ "0.58892405", "0.5867118", "0.5805613", "0.5797758", "0.56900007", "0.5675864", "0.56160057", "0.55806804", "0.5568386", "0.5484724", "0.5445476", "0.5282193", "0.525028", "0.5222759", "0.52049726", "0.51838297", "0.5171828", "0.51401424", "0.51262945", "0.5109634", "0.510601...
0.0
-1