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
Whether this schema has no labels of any kind.
def is_empty(self): return not bool(self.schema)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_for_labels(self):\n check = True\n if 'labels' not in self.mapper:\n check = False\n return check", "def allowNoInternalLabel(self):\n if (self.internallabels != None):\n return self.internallabels.isempty()\n elif self.layer != None:\n ...
[ "0.72563845", "0.72375864", "0.72189367", "0.72189367", "0.71678513", "0.7137653", "0.7046597", "0.70134956", "0.6766707", "0.6729228", "0.66815865", "0.66678643", "0.66526204", "0.65826744", "0.6545621", "0.65203995", "0.6513872", "0.6497965", "0.6497965", "0.64752144", "0.6...
0.66217494
14
clear the table and create one book
def test_books_list(self): delete_books() book_one = create_book("title one")["book"] with test_client.get("/book/list/") as response: self.assertEqual( json.loads( response.get_data(as_text=True) ), { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_books_table():\n try:\n print(\"Creating 'books' table..\")\n db.execute(\"CREATE TABLE books (\\\n id SERIAL PRIMARY KEY, \\\n isbn VARCHAR NOT NULL, \\\n title VARCHAR NOT NULL, \\\n author VARCHAR NOT NULL, \\\n year INTEGER NOT ...
[ "0.6849245", "0.6814122", "0.6550023", "0.653003", "0.64636695", "0.6162651", "0.61342436", "0.60789204", "0.60537714", "0.6024269", "0.59604627", "0.5954154", "0.5948459", "0.58591366", "0.5827146", "0.5814476", "0.5777074", "0.5754299", "0.5731961", "0.57193613", "0.5713634...
0.5465368
50
Return the circle associated to the arc.
def circle(self): return circle(self.N, self.o, self.r)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetArc(arc):\r\n pass", "def GetCircle(circle):\r\n pass", "def circleCirc(radius):\n radius = float(radius)\n return 2*math.pi*radius", "def circle(draw, centrex, centrey, radius, color=\"#AAAAAAFF\") -> None:\n # convert cartesian centre to pixel centre\n cx, cy = pixelcoord(c...
[ "0.7488493", "0.72593105", "0.69445103", "0.6827994", "0.67802036", "0.6582089", "0.6546231", "0.6503568", "0.6482981", "0.64788955", "0.6450415", "0.64423907", "0.6429825", "0.639928", "0.639928", "0.63959175", "0.63804114", "0.6367668", "0.6348792", "0.6347201", "0.63452417...
0.73955214
1
removes the obfuscated suffix of a package structure, if there are at least 2 element remaining it returns the structure, otherwise it returns _OBFUSCATED_
def process_obfuscated_pkg(self, pkg): chunks = pkg.split('/') prefix = list(itertools.dropwhile(lambda chunk: len(chunk) <= self.MAX_OBFUSCATION_CHUNK_SIZE, reversed(chunks))) res = '/'.join(reversed(prefix)) if len(prefix) > 1 or len(prefix) == len(chunks) else '_OBFUSCATED_' retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _strip_package_name(name):\n name = _strip(name)\n if name.find('.') != -1:\n name = name.split('.')[0]\n return name", "def clearString(name):\n if name.find(\".tar\") != 0:\n name = name.replace(\".tar\", \"\")\n\n if name.find(\".gz\") != 0:\n name = name.replace(\".gz\...
[ "0.6510802", "0.6058965", "0.5984447", "0.59638286", "0.57809335", "0.5772717", "0.5751242", "0.57449114", "0.56860876", "0.5669037", "0.5637926", "0.56001174", "0.557038", "0.55449843", "0.5537648", "0.5515052", "0.54990643", "0.5449868", "0.5431732", "0.5421043", "0.5420953...
0.6809245
0
create a plot of randomly generated images (reversed grayscale)
def plot_random_generated_images(self): dimensions=(10, 10) figsize=(10, 10) n_samples=100 (X, _), _ = self.generate_generator_prediction_samples(n_samples) self.grid_plot(X, dimensions=dimensions, figsize=figsize)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotRandImages(train_data, output):\n rint_array = np.random.randint(0,train_data.shape[0],size=4)\n\n fig = plt.figure(figsize=(8,8))\n plt.subplot(2,2,1)\n for ii,rint in enumerate(rint_array):\n plt.subplot(2,2,ii+1)\n img = train_data[rint].reshape((20,20)).T\n #print \" o...
[ "0.67856956", "0.6722465", "0.66302305", "0.6363954", "0.63108516", "0.62768316", "0.6250604", "0.6212091", "0.613716", "0.6119215", "0.6112668", "0.60965955", "0.6094223", "0.6064633", "0.6060373", "0.60599", "0.60547584", "0.60533047", "0.6023476", "0.6008927", "0.5996602",...
0.7080448
0
Returns a list of stations from the dataset
def stations(): # Query all station names from dataset station_list = session.query(Measurement.station).distinct().all() all_stations = list(np.ravel(station_list)) return jsonify(all_stations)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stations():\n\n return station_list", "def stations():\n # Return a JSON list of stations from the dataset\n session = Session(engine)\n stations = session.query(Station.name).all()\n\n # Convert list of tuples into normal list\n station_names = list(np.ravel(stations))\n\n return jsonif...
[ "0.85446864", "0.78387636", "0.774722", "0.7649436", "0.7583171", "0.75344354", "0.7420569", "0.7404994", "0.7350493", "0.73467046", "0.7344987", "0.73333746", "0.7319325", "0.72977495", "0.72885984", "0.7269064", "0.72558457", "0.7207911", "0.71813667", "0.7180665", "0.71722...
0.77542865
2
Gets a single rule.
def get(self, request): rule = self.get_object() return success(rule.summary())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rule(self):\n\n return self.__rule_", "def getRule(self, *args):\n return _libsbml.Model_getRule(self, *args)", "def get_rule(self, rule_name):\n assert rule_name in self.rules.keys(), 'Rule name not in current set of rules'\n return self.rules[rule_name]", "def _get_rule(...
[ "0.8278721", "0.8077203", "0.803587", "0.785479", "0.785479", "0.785479", "0.78335196", "0.7691647", "0.74970007", "0.7445792", "0.73671985", "0.73671985", "0.73671985", "0.73671985", "0.73671985", "0.73671985", "0.73671985", "0.7235633", "0.7235633", "0.7235633", "0.7174903"...
0.58431536
59
r""" Use this API to fetch filtered set of appfwlearningsettings resources.
def get_filtered(cls, client, filter_) : try : obj = appfwlearningsettings() option_ = options() option_.filter = filter_ response = obj.getfiltered(client, option_) return response except Exception as e : raise e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_settings(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:\n return pulumi.get(self, \"all_settings\")", "def get_settings(self):\n return AlgoliaUtils_request(self.client.headers, self.read_hosts, \"GET\", \"/1/indexes/%s/settings\" % self.url_index_name, self.client.timeou...
[ "0.5380571", "0.5316898", "0.5177114", "0.5085346", "0.50266653", "0.5018635", "0.49892712", "0.49692947", "0.4965442", "0.49283218", "0.49115553", "0.4910119", "0.4886868", "0.48745605", "0.48563504", "0.48504964", "0.48413262", "0.48341447", "0.48334667", "0.4811156", "0.47...
0.6370895
0
Deletes files and directories that are used when a test is run Sets the module level variables in the config module back to None, so each test is executed from a clean state
def tearDown(self): # set the config module level variables back to None config.config._conf_parser = None config.config._user_config_file = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def module_cleanup():\n\n os.chdir(os.path.dirname(__file__))\n shutil.rmtree(TestModule.full_path())", "def tearDown(self):\n test_utils.delete_test_config()", "def tearDown(self) -> None:\n os.remove(TestConfigFile.TEST_CONFIG)", "def tearDownModule():\n shutil.rmtree(TMPDIR)", "de...
[ "0.7995422", "0.7551438", "0.75250787", "0.7506744", "0.7476751", "0.7398432", "0.7357032", "0.73218614", "0.72806233", "0.7269948", "0.72201794", "0.72061425", "0.7181644", "0.71710527", "0.71697044", "0.71697044", "0.71634924", "0.71634924", "0.7162906", "0.7161617", "0.715...
0.7597013
1
Stores the default arguments for the given set of applied_nnops. For usage, please see examples at top of the file.
def nnop_scope(scope=None, id_start=None, ops=[], **kwargs): # ====== prepare Name Scope ====== # global _NAME_SCOPE, _NNOP_ID # name scope if is_string(scope): if scope not in _NAME_SCOPE: _NAME_SCOPE = str(scope) if len(_NAME_SCOPE) == 0 else \ _NAME_SCOPE + '/' + s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_default_ops(op_name):\n _add_default_op(op_name)\n _add_default_reverse_op(op_name)", "def has_default_args(self, node, ordered_functions):\n # Need to create individual routines for Fortran and C\n if node.wrap.fortran == False and node.wrap.c == False:\n ...
[ "0.61806464", "0.5891875", "0.58795387", "0.5815226", "0.56980276", "0.563041", "0.56184256", "0.55964077", "0.55616367", "0.553574", "0.5526593", "0.551433", "0.551433", "0.54933065", "0.5460341", "0.544785", "0.54163915", "0.5414838", "0.540881", "0.5400877", "0.53910416", ...
0.0
-1
Return True if shape1 == shape2
def _shape_compare(shape1, shape2): if len(shape1) != len(shape2): return False for s1, s2 in zip(shape1, shape2): if s1 != s2: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def have_same_shapes(array1, array2):\n return array1.shape == array2.shape", "def __eq__(self, other):\n result = False\n if isinstance(other, Shape) and (self.area == other.area):\n return True\n else:\n return False", "def __eq__(self, other):\n if self._...
[ "0.75166106", "0.72128135", "0.7141856", "0.714108", "0.7052285", "0.7025076", "0.701751", "0.7016404", "0.69673544", "0.68581736", "0.68307865", "0.6788698", "0.6775903", "0.67580014", "0.6696667", "0.66570157", "0.66501576", "0.6634908", "0.66217494", "0.6597373", "0.659319...
0.85870194
0
Get all variables related to this Op
def variables(self): # created variable from `get_variable` allname = [name for _, (name, t) in self._variable_info.iteritems() if t == 'variable'] allvars = [v for v in K.get_all_variables() if v.name in allname] # related variables to all `Tensor` tensors = [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self):\n return [i.name for i in self.inputs + self.outputs]", "def variables(self, *args, **kwargs):\n return self._optimizer.variables(*args, **kwargs)", "def get_all_variables(self):\n raise NotImplementedError()", "def get_variables(self):\n return self.varia...
[ "0.7939259", "0.7827795", "0.7780544", "0.7726934", "0.77243793", "0.7671766", "0.75497943", "0.7548899", "0.7546986", "0.7430166", "0.74225795", "0.74143535", "0.7413383", "0.7385674", "0.7369713", "0.7351404", "0.7351404", "0.7351404", "0.73302597", "0.7313701", "0.72909546...
0.7376338
14
return all TensorVariables which have the PARAMETER role
def parameters(self): return [i for i in self.variables if has_roles(i, Parameter)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainable_variables(self):\n return [v for p in self.parameters for v in p.trainable_variables]\n # TODO: look for variables NOT in parameters too\n # so users can mix-n-match tf.Variables and pf.Parameters in modules", "def get_vars(scope=''):\n return [x for x in tf.trainable_variable...
[ "0.7160044", "0.7081361", "0.6934779", "0.6708122", "0.6680285", "0.6650661", "0.66222584", "0.6602444", "0.6586596", "0.65748703", "0.6477245", "0.64408255", "0.6408994", "0.6408994", "0.63914573", "0.63503975", "0.6302091", "0.6300213", "0.6295474", "0.62830323", "0.6262211...
0.7855038
0
Return backend specific random dataset.
def get_dataset(self, input_size: Tuple): return StaticDatasetMock(input_size, self.fn_to_type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset_sampler(self):\n return None", "def get_dataset(config, data_rng):\n _, train_ds, test_ds = create_datasets(config, data_rng)\n\n if config.dataset == 'mnist':\n shape = (28, 28, 1)\n n_classes = 256\n elif config.dataset == 'binarized_mnist':\n shape = (28, 28, 1)\n n_class...
[ "0.6275911", "0.62073207", "0.6200004", "0.6185032", "0.6118045", "0.59886354", "0.5979937", "0.58964324", "0.58829856", "0.58817804", "0.58710706", "0.5865128", "0.58478475", "0.58477545", "0.58337784", "0.58119065", "0.57484967", "0.5736459", "0.5734616", "0.57243854", "0.5...
0.0
-1
Dot product of self by a vector V in sparsedense to dense format V dense vector of shape (self.m,)
def dot(self, V): assert V.shape == (self.m,) return np.bincount(self.rows, weights=self.vals*V[self.cols], minlength=self.m)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(self, v):\n if (len(self) != len(v)):\n raise IndexError('Vectors to be dotted must be the same size.')\n return sum([x[0]*x[1] for x in zip(self, v)])", "def dotProduct(self, v):\n return self.x * v.x + self.y * v.y + self.z * v.z", "def dot(self, vec):\n pass", ...
[ "0.73530287", "0.73219293", "0.7280644", "0.7279359", "0.7217133", "0.71385455", "0.7057486", "0.7035553", "0.69569504", "0.6844897", "0.6813205", "0.67954814", "0.6664798", "0.6650015", "0.6608764", "0.65791535", "0.6552482", "0.6550807", "0.65255684", "0.6474568", "0.645636...
0.61898196
41
Returns the (dense) vector of the diagonal elements.
def diag(self): in_diag = (self.rows == self.cols) diag = np.zeros(min(self.n, self.n), dtype=np.float64) # default 0. diag[self.rows[in_diag]] = self.vals[in_diag] return diag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonal(self):\n return self.rep.diagonal()", "def diagonal(self):\n M = self.rep\n m, n = self.shape\n return [M[i, i] for i in range(min(m, n))]", "def diagonal(self) -> Float[Array, \" N\"]:\n return self.value * jnp.ones(self.size)", "def diag(x):\r\n xx = as_te...
[ "0.77127284", "0.76471806", "0.7374665", "0.7286015", "0.7263007", "0.7239486", "0.71734244", "0.71619266", "0.711941", "0.6992547", "0.6975051", "0.69089365", "0.683053", "0.68254954", "0.6753246", "0.66568476", "0.6577181", "0.65462613", "0.65350735", "0.652558", "0.6523551...
0.70933163
9
Extracts selected blocks of a matrices M depending on parameters block_indices and block_size.
def _extract_submatrices(M, block_indices, block_size, axis): assert block_indices.ndim == 1 assert axis in [0, 1] r, c = M.shape if axis == 0: sh = [block_indices.shape[0], block_size, c] elif axis == 1: sh = [block_indices.shape[0], r, block_size] dt = M.dtype M_res = np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_block(M, i, j, row_range, col_range):\r\n # pass\r\n return M[row_range[i]:row_range[i+1], col_range[j]: col_range[j+1]].copy()", "def matrix_chunker(blocksize, matrix, axis=0, offset=0):\r\n length=matrix.shape[axis]\r\n index=np.arange(0+offset, length+offset, blocksize)\r\n index=np.app...
[ "0.6191897", "0.6057728", "0.5937161", "0.58858114", "0.57284105", "0.5639187", "0.5556601", "0.55230266", "0.54642296", "0.5414495", "0.52994233", "0.52893496", "0.52858233", "0.52239704", "0.52014714", "0.5195018", "0.5179752", "0.5151467", "0.51445997", "0.5144032", "0.513...
0.762177
0
[batch_size, sequence_length, hidden_length] > [B, S, 1 ,H]
def attention(self, in_q, in_k, in_v, mask=None, is_self_attention=False, compute_dense_grad=False): # Parameter dimensions b_shape = self.attention_heads * self.qkv_length use_bias = not self.exclude_attention_biases if self.disable_concat_qkv or not is_self_attention: # P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_hidden(self, batch_size, device):\n if self.mode == 'LSTM':\n return (torch.ones((1+self.bidirectional , batch_size, self.hidden_dim), device=device),\n torch.ones((1+self.bidirectional, batch_size, self.hidden_dim), device=device))\n else:\n return t...
[ "0.64206415", "0.63006455", "0.6141154", "0.60965323", "0.6090984", "0.6066164", "0.60580295", "0.6040921", "0.60338366", "0.6032637", "0.60303336", "0.60232204", "0.60134757", "0.5992404", "0.59895486", "0.5966104", "0.59622204", "0.5954728", "0.5939255", "0.5937662", "0.591...
0.0
-1
Creates a random string from alphanumeric characters. While it's unlikely that duplicates will be created, client code should still test this.
def random_string(length=5): possibles = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' return ''.join(random.choice(possibles) for i in range(0, length))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_alphanumeric_string():\n return get_random_string(char_choice=string.ascii_letters + string.digits)", "def random_string_alphanumeric(size):\n\t# requirements = random, string\n\treturn ''.join(random.choice(string.ascii_letters + string.digits) for x in range(size))", "def generate_random_al...
[ "0.8761063", "0.8317953", "0.8219287", "0.8185905", "0.8130348", "0.80720973", "0.7921839", "0.79116464", "0.7852993", "0.78426445", "0.78114015", "0.7794713", "0.7785034", "0.7769775", "0.7733262", "0.77235943", "0.7712778", "0.7703085", "0.7669973", "0.7623046", "0.76139057...
0.7400388
43
Set the pool of servers used by this client.
def set_servers(self, servers): self.servers = [_Host(s, self.debug, dead_retry=self.dead_retry, socket_timeout=self.socket_timeout) for s in servers] self._init_buckets()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_pool(self, server_pool):\n\n self._server_pool = server_pool", "def set_servers(self, servers):\n\n\t\tself.servers = []\n\t\tself.buckets = []\n\n\t\tfor server_desc in servers:\n\t\t\tif type(server_desc) == tuple:\n\t\t\t\tserver_addr, weight = server_desc\n\t\t\telse:\n\t\t\t\tserver_addr, ...
[ "0.7319679", "0.7087884", "0.6783699", "0.6467647", "0.6271275", "0.615868", "0.60961", "0.60128826", "0.5960502", "0.5913157", "0.58820456", "0.5873742", "0.5798574", "0.5772111", "0.5718808", "0.5644137", "0.55850923", "0.55629134", "0.5554513", "0.55439126", "0.55362344", ...
0.680685
2
Transform val to a storable representation, returning a tuple of the flags, the length of the new value, and the new value itself.
def _val_to_store_info(self, val, min_compress_len): flags = 0 if isinstance(val, str): pass elif isinstance(val, int): flags |= Client._FLAG_INTEGER val = "%d" % val # force no attempt to compress this silly string. min_compres...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _value_to_stored(value, min_compress_len):\n\n\t\tflags = 0\n\t\tif isinstance(value, str):\n\t\t\tpass\n\t\telif isinstance(value, int):\n\t\t\tflags |= Client._FLAG_INTEGER\n\t\t\tvalue = \"%d\" % value\n\t\t\t# Don't try to compress it\n\t\t\tmin_compress_len = 0\n\t\telif isinstance(value, long):\n\t\t\tfl...
[ "0.62823075", "0.6096067", "0.5640779", "0.5292934", "0.5206345", "0.51901823", "0.5182342", "0.51321834", "0.51321834", "0.5092355", "0.49739844", "0.4964282", "0.4904789", "0.48912632", "0.4881916", "0.48522413", "0.48376516", "0.48217183", "0.4792239", "0.47672203", "0.475...
0.6702017
0
Returns the number of seconds from the epoch to date. Should match the number returned by the equivalent function in postgres.
def epoch_seconds(date): td = date - epoch return td.days * 86400 + td.seconds + (float(td.microseconds) / 1000000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch_seconds(date):\n td = date - epoch\n return td.days * 86400 + td.seconds + (float(td.microseconds) / 1000000)", "def epoch_seconds(date):\n td = date - epoch\n return td.days * 86400 + td.seconds + (float(td.microseconds) / 1000000)", "def seconds_since_epoch(date_time, epoch=None):\n ...
[ "0.80922514", "0.80922514", "0.7945236", "0.7506645", "0.71594447", "0.7067575", "0.68515295", "0.6746382", "0.67439777", "0.67207676", "0.66486436", "0.6620893", "0.6620893", "0.6606734", "0.65902865", "0.65062416", "0.64704", "0.6452434", "0.64258116", "0.640299", "0.636732...
0.810289
0
Constructs an importer that takes a data structure based on a yaml file.
def __init__(self, url_handler=None): self.url_handler = url_handler if url_handler else self._default_url_handler self.username_mapping = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_yaml(cls, model: nn.Module, yaml_path: str) -> pl.LightningModule:\n with open(yaml_path, \"r\") as stream:\n kwargs = yaml.full_load(stream)\n\n return cls(model, **kwargs)", "def from_yaml(cls, f, resolve_imports=True):\n if isinstance(f, str):\n with open(f,...
[ "0.66920453", "0.64421743", "0.6418202", "0.6335006", "0.63316417", "0.624798", "0.62384844", "0.62174565", "0.6208334", "0.61887056", "0.6186245", "0.61758035", "0.61690754", "0.6139741", "0.61203724", "0.60933965", "0.6085823", "0.60823864", "0.6071912", "0.6070817", "0.606...
0.0
-1
Return True if the stack has any items, False otherwise
def empty(self): return len(self.stack) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self): #checks to see if stack is empty or not\n if self.num_items == 0:\n return True\n else:\n return False", "def is_empty(self):\n return self._stack_items == []", "def is_empty(self):\n return len(self.the_stack) == 0", "def e...
[ "0.8640607", "0.8384896", "0.83039576", "0.8294889", "0.82426995", "0.8162645", "0.8162645", "0.816244", "0.8157954", "0.8100274", "0.80811626", "0.8037128", "0.79938006", "0.7973465", "0.7973465", "0.7925865", "0.7915802", "0.7899525", "0.78055054", "0.77998394", "0.7788897"...
0.8193697
5
Convenience method for getting a list of 'quantity' strings from the RandomString named 'attr'
def get(self, attr, quantity = 0): return self.strings[attr].get(quantity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseAttribute(self, attr_str):\r\n parts = []\r\n lastpos = 0\r\n while lastpos < len(attr_str):\r\n newpos = self.nextString(attr_str, lastpos)\r\n s = attr_str[lastpos:newpos-1]\r\n if (s[0] == \"(\" and s[-1] == \")\"): # list, recurse\r\n ...
[ "0.55149657", "0.55140907", "0.546348", "0.5418178", "0.52843404", "0.52367496", "0.52326226", "0.5113158", "0.5104948", "0.5084972", "0.50735784", "0.50735784", "0.50695837", "0.5065191", "0.50635546", "0.50000334", "0.499991", "0.49904165", "0.49841562", "0.4975838", "0.495...
0.63512796
0
Makes a pretty date from a date
def pretty_date(self, date): return time.strftime("%a, %b %d, %Y", time.strptime(date,"%Y%m%d"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty_date(date_):\n day_str = humanize_day(date_.day)\n month_str = date_.strftime('%B')\n year_str = date_.strftime('%Y')\n return PrettyDate(day_str, month_str, year_str)", "def date_prettyfier(self, date):\n units = 'days since 1900-01-01 00:00'\n date = date * 365.25\n ...
[ "0.82389563", "0.79867023", "0.7430773", "0.69187784", "0.67759526", "0.67725164", "0.67428035", "0.6710222", "0.67096394", "0.66659904", "0.6650048", "0.66224366", "0.66217923", "0.6620905", "0.6620818", "0.65857303", "0.65691596", "0.6565835", "0.656035", "0.6560211", "0.65...
0.76761764
2
Takes a URL and returns the domain part, minus if present
def domain(s): res = r_domain.findall(s) domain = (res and res[0]) or s return domain.lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_domain(url):\n a = urllib.parse.urlsplit(url)\n return str(a.scheme) + \"://\" + str(a.hostname)", "def get_domain(url):\n assert url is not None\n protocol = get_protocol(url)\n find = re.search(r\"(^https?://)?([a-z]|[A-Z]|[0-9]|\\.)+/?\", url)\n result = None\n if find:\n r...
[ "0.8655283", "0.86170614", "0.85984564", "0.8553324", "0.8551012", "0.84421355", "0.84127265", "0.8385016", "0.83127636", "0.8216069", "0.8096774", "0.8058539", "0.8015671", "0.7970023", "0.7867089", "0.78461486", "0.7827538", "0.7820362", "0.7803871", "0.779978", "0.77090037...
0.6424751
65
Returns a datetime object corresponding to time 'interval' in the past. Interval is of the same form as is returned by timetext(), i.e., '10 seconds'. The interval must be passed in in English (i.e., untranslated) and the format is [num] second|minute|hour|day|week|month|year(s)
def timeago(interval): from pylons import g return datetime.now(g.tz) - timeinterval_fromstr(interval)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pastTime(interval, unit):\n\tcurTime = int(time.time())\n\tif unit == \"d\":\n\t\t#day\n\t\tpastTime = curTime - interval * secInDay\n\telif unit == \"h\":\n\t\t#hour\n\t\tpastTime = curTime - interval * secInHour\n\telif unit == \"m\":\n\t\t#minute\n\t\tpastTime = curTime - interval * secInMinute\n\telif unit...
[ "0.65804213", "0.54617864", "0.5299602", "0.5298647", "0.52681166", "0.5181039", "0.51584196", "0.49770483", "0.49653432", "0.4933692", "0.4900558", "0.48558792", "0.48536974", "0.47445643", "0.47312304", "0.47229862", "0.471219", "0.46741104", "0.46727133", "0.46681464", "0....
0.6933155
0
Takes a datetime object, returns the time between then and now as a nicely formatted string, e.g "10 minutes" Adapted from django which was adapted from
def timetext(delta, resultion = 1, bare=True): chunks = ( (60 * 60 * 24 * 365, lambda n: ungettext('year', 'years', n)), (60 * 60 * 24 * 30, lambda n: ungettext('month', 'months', n)), (60 * 60 * 24, lambda n : ungettext('day', 'days', n)), (60 * 60, lambda n: ungettext('hour', 'hours',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_formatted_time() -> datetime.strftime:\n\t\n\tnow = datetime.now() # time now\n\thalf_hour = (now - timedelta(minutes = 30)) # time 30 min ago\n\t# returns half hour ago to accommodate for failed checks\n\t# (bc twint behaves as if none found if check failed)\n\tcurrent_time = half_hour.strftime(\"%Y-%m-...
[ "0.7234549", "0.6857311", "0.67275363", "0.6670941", "0.6475366", "0.64525664", "0.6386341", "0.63611746", "0.6356836", "0.6346629", "0.63443947", "0.6342283", "0.63195896", "0.62999016", "0.6284367", "0.6225699", "0.6188356", "0.61769813", "0.61760795", "0.6161277", "0.61244...
0.0
-1
Converts a ?cnameframe url into the corresponding cnamed domain if applicable. Useful for framebusting on redirect.
def mk_cname(self, require_frame = True, subreddit = None, port = None): # make sure the url is indeed in a frame if require_frame and not self.query_dict.has_key(self.cname_get): return self # fetch the subreddit and make sure it subreddit = subreddit or se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_domain_name(url):\n\n parsed_uri = urlparse(url)\n return parsed_uri.netloc", "def getDomain(url):\n domain = string.replace(url,\"https://www.\",\"\")\n domain = string.replace(domain,\"http://www.\",\"\")\n domain = string.replace(domain,\"http://\",\"\")\n domain = string.replace(domain,\".c...
[ "0.6197644", "0.6159966", "0.5963769", "0.5907886", "0.5852895", "0.58388484", "0.58284247", "0.5792198", "0.57182163", "0.56948596", "0.56632704", "0.5660369", "0.5638289", "0.55650324", "0.5547438", "0.5546161", "0.5523178", "0.5495719", "0.5482025", "0.54640037", "0.545711...
0.617074
1
Takes an iterator and returns an iterator that returns only the first occurence of each entry
def UniqueIterator(iterator): so_far = set() def no_dups(x): if x in so_far: return False else: so_far.add(x) return True return IteratorFilter(iterator, no_dups)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _first(self, \n iterable, \n condition=lambda x: True):\n try:\n return next(x for x in iterable if condition(x))\n except:\n return None", "def first(l: iter, predicate):\n for ele in l:\n if predicate(ele):\n return ele\n ...
[ "0.6662245", "0.6558268", "0.65078807", "0.64133495", "0.64133495", "0.64071995", "0.62734216", "0.6250841", "0.6167601", "0.61336493", "0.6115642", "0.61110455", "0.6059177", "0.60256934", "0.5976923", "0.5963067", "0.59148407", "0.590669", "0.58869797", "0.58488554", "0.580...
0.615555
9
Takes a string and makes it suitable for use in URLs
def title_to_url(title, max_length = 50): title = _force_unicode(title) #make sure the title is unicode title = rx_whitespace.sub('_', title) #remove whitespace title = rx_notsafe.sub('', title) #remove non-printables title = rx_underscore.sub('_', title) #remove double underscor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def URLify(s):\n\n # Without any additional libraries and by doing it in an array as intended by the writer.\n return ''.join('%20' if c == ' ' else c for c in s.strip())\n\n # Time Complexity: O(n)\n # Space Complexity: O(1)", "def encode_url(url):\n\treturn url.replace(' ', '_')", "def make_url...
[ "0.6556111", "0.6527914", "0.6515691", "0.6470153", "0.6388749", "0.6344972", "0.63395154", "0.627813", "0.62732196", "0.6252135", "0.6246198", "0.6217608", "0.61840826", "0.61289954", "0.61121154", "0.6110993", "0.609346", "0.60719675", "0.6051838", "0.6035905", "0.60187197"...
0.0
-1
Return query for all meetups that are in the future
def upcoming_meetups_query(cls): # Warning, this timestamp inequality is actually done as a string comparison # in the db for some reason. BUT, since epoch seconds won't get another digit # for another 275 years, we're good for now... return Meetup._query(Meetup.c.timestamp > time.time() - g.meetup...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upcoming(self):\n\n today = datetime.now().strftime(\"%Y-%m-%d\")\n last_day = (datetime.now() + timedelta(days=7)).strftime(\"%Y-%m-%d\")\n\n query = \"SELECT * FROM {} WHERE happening_on BETWEEN\\\n '{}' AND '{}'\".format(self.table, today, last_day)\n\n return self.fetch_a...
[ "0.71593964", "0.6860382", "0.6841186", "0.66529363", "0.6401368", "0.6360072", "0.62354666", "0.6084642", "0.60374886", "0.60255665", "0.5999513", "0.5977051", "0.59436744", "0.59424406", "0.5915156", "0.5901143", "0.5895411", "0.5805544", "0.5803228", "0.5801198", "0.580055...
0.7740171
0
Returns true if the supplied user is allowed to edit this meetup
def can_edit(self, user, user_is_admin=False): if user is None or isinstance(user, FakeAccount): return False elif user_is_admin or self.author_id == user._id: return True elif Subreddit._by_name('discussion').is_editor(user): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_edit_user(user):\n\tu = current_user._get_current_object()\n\treturn u==user or u.is_admin()", "def user_can_edit(self, user):\n return user == self.owner", "def can_be_edited(self, user):\n return (self.is_public or user == self.owner or\n user in list(self.auth_users.all()))", "def...
[ "0.83741283", "0.8356442", "0.82882535", "0.8279635", "0.81570023", "0.7951602", "0.7847489", "0.7725675", "0.7522701", "0.74701333", "0.72449917", "0.7232902", "0.7203058", "0.7200138", "0.7174519", "0.7126445", "0.7098502", "0.70908755", "0.6980087", "0.6936545", "0.6922237...
0.76542854
8
Converts a time struct to a Blogger time/date string.
def _ToBlogTime(self, time_tuple): return time.strftime('%Y-%m-%dT%H:%M:%SZ', time_tuple)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _time_str(self):\n try:\n if not self._time:\n raise ValueError\n format_ = '%a, %d %b %Y %H:%M:%S'\n return datetime.fromtimestamp(float(self._time)).strftime(format_)\n except ValueError:\n return plastic_date()", "def datetime_to_str...
[ "0.7741819", "0.6992845", "0.69640374", "0.6890449", "0.68889165", "0.6888506", "0.68024224", "0.67773944", "0.67394155", "0.66852427", "0.6667664", "0.6635254", "0.66259456", "0.6622707", "0.6563565", "0.6561921", "0.6556215", "0.6556215", "0.6538662", "0.6538662", "0.652975...
0.7510641
1
Get the current background width.
def get_width(self): return len(self._background) if self._background else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def background_color_value(self) -> int:\n return self.background_color.value", "def get_height(self):\n\t\treturn len(self._background[0]) if self.get_width() > 0 and self._background[0] else 0", "def get_width(self) -> int:\n return int(self._surface.get_width())", "def getWidth(self):\n ...
[ "0.7021511", "0.67397255", "0.6696741", "0.6554188", "0.6522735", "0.64964706", "0.6489986", "0.6489986", "0.6427883", "0.6427883", "0.6427883", "0.6427883", "0.642383", "0.64176", "0.6410324", "0.6410324", "0.6410324", "0.640403", "0.63914996", "0.6337707", "0.63292736", "...
0.8295908
0
Get the current background height.
def get_height(self): return len(self._background[0]) if self.get_width() > 0 and self._background[0] else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_height(self) -> int:\n return self.current_height", "def get_height(self):\r\n return self.state['h']", "def get_height(self) -> int:\n return int(self._surface.get_height())", "def get_height(self):\n return self.__height", "def get_height(self):\r\n retu...
[ "0.7541687", "0.70664275", "0.7017184", "0.699317", "0.6991168", "0.6991168", "0.6991168", "0.6983764", "0.6983764", "0.6983764", "0.6983764", "0.6943631", "0.6943144", "0.6943144", "0.68905807", "0.68512267", "0.68419564", "0.68191266", "0.6788108", "0.67586297", "0.6729708"...
0.83606935
0
Get the front element.
def peek(self): return self.front
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass", "def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1", "def front(self):\n return self.queue[0] if not self.empty() else None", "def peek_front(...
[ "0.82009244", "0.79261875", "0.7852642", "0.7791182", "0.77886623", "0.752337", "0.7510604", "0.7478953", "0.7379256", "0.7379256", "0.734284", "0.7323573", "0.7320296", "0.7291721", "0.72772557", "0.7269801", "0.72657627", "0.7253295", "0.72355044", "0.72213495", "0.721701",...
0.75723046
5
Returns whether the queue is empty.
def empty(self): return not self.values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_queue) == 0", "def is_empty(self):\n return len(self.__queue) > 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return self.queue == []", "def ...
[ "0.9270249", "0.92506766", "0.923635", "0.923635", "0.9155843", "0.9098441", "0.9095006", "0.90922606", "0.90731245", "0.9053733", "0.89205354", "0.89137155", "0.8877591", "0.88436323", "0.88436323", "0.8835949", "0.88038146", "0.8758203", "0.87577534", "0.87310195", "0.86462...
0.0
-1
Generate all items for the given endpoint. Could produce more than one test item if parametrization is applied via ``pytest.mark.parametrize`` or ``pytest_generate_tests``.
def _gen_items(self, endpoint: Endpoint) -> Generator[Function, None, None]: try: hypothesis_item = create_test(endpoint, self.test_function) except InvalidSchema: hypothesis_item = lambda: pytest.fail("Invalid schema for endpoint") items = self.ihook.pytest_pycollect_mak...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_endpoint_list(name, filter_by, limit, offset, quiet, all_items):\n\n get_endpoint_list(name, filter_by, limit, offset, quiet, all_items)", "def test_access_all_data_all_endpoints(self):\n\n # Some end points just can't be fetched so we have to ignore them.\n end_point_exceptions = [\n ...
[ "0.6143566", "0.6075885", "0.5945847", "0.5889709", "0.58042955", "0.57707775", "0.57425666", "0.57353044", "0.5714523", "0.5704624", "0.5686927", "0.5529842", "0.55225164", "0.5502713", "0.5477991", "0.54265237", "0.53864914", "0.5379258", "0.5347762", "0.5311735", "0.531156...
0.75900507
0
Generate different test items for all endpoints available in the given schema.
def collect(self) -> List[Function]: # type: ignore try: return [ item for endpoint in self.schemathesis_case.get_all_endpoints() for item in self._gen_items(endpoint) ] except Exception: pytest.fail("Error during collection")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gen_items(self, endpoint: Endpoint) -> Generator[Function, None, None]:\n try:\n hypothesis_item = create_test(endpoint, self.test_function)\n except InvalidSchema:\n hypothesis_item = lambda: pytest.fail(\"Invalid schema for endpoint\")\n items = self.ihook.pytest_p...
[ "0.62797457", "0.62201464", "0.61220795", "0.604933", "0.59677726", "0.5963135", "0.5856897", "0.5779563", "0.5749573", "0.5744169", "0.56704587", "0.5665546", "0.56556123", "0.56173605", "0.56068426", "0.5600911", "0.5586501", "0.55836356", "0.5579573", "0.5579494", "0.55544...
0.5311357
37
The name of the sqg as an int, this is optional and may be null.
def getName(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_int(self, name):\n return self.field(name).toInt()[0]", "def name(self):\n return s.GLPK", "def _get_generation_strategy_id(\n experiment_name: str, decoder: Decoder\n) -> Optional[int]:\n exp_sqa_class = decoder.config.class_to_sqa_class[Experiment]\n gs_sqa_class = decoder.conf...
[ "0.587419", "0.58507115", "0.57900316", "0.57229364", "0.5504715", "0.5416826", "0.5403211", "0.5391398", "0.5382226", "0.53794175", "0.5349332", "0.5267572", "0.5254856", "0.5251923", "0.5250796", "0.5216763", "0.52152115", "0.5213173", "0.5204345", "0.5182669", "0.5171748",...
0.0
-1
Sets the array list type of a given type. Only one arrayList of a given type may be included in an SQG.
def setArrayList(self, arrayList): if arrayList.getType() in self.arrayLists: raise RuntimeError("Trying to set an array list of type %s for an Sqg which already has such an array list type" % arrayList.type) self.arrayLists[arrayList.getType()] = arrayList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setDataSetType(self, type):\n self.__data_set_type__ = type", "def set_type(self, val):\n if not contain_in_list_equal(val, PARAM_TYPES):\n raise ArgumentError(\"[WARNING] `type`, should be \" + \", \".join(PARAM_TYPES))\n self._type = val\n pass", "def set_type(self,...
[ "0.6247798", "0.6166538", "0.6012726", "0.6012726", "0.59471697", "0.58363324", "0.58115846", "0.5757654", "0.5726093", "0.5639712", "0.56347656", "0.5551752", "0.54953694", "0.5492203", "0.54695684", "0.546802", "0.546802", "0.54545087", "0.54541373", "0.54541373", "0.545413...
0.73090965
0
Makes sure that the given url has a scheme in front, if none was provided.
def ensure_scheme(url: str, default: str = 'http') -> str: if not url: return url # purl (or to be precise urlparse) will parse empty host names ('abc.xyz') # wrongly, assuming the abc.xyz is a path. by adding a double slash if # there isn't one already, we can circumvent that problem if '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_url_scheme(self, url):\n if self.base_scheme and not url.startswith(\"%s://\" % self.base_scheme):\n # url_split = urlparse.urlsplit(url)\n url_split = urlsplit(url)\n # url = urlparse.urlunsplit(\n url = urlunsplit(\n [\n ...
[ "0.75058997", "0.7437641", "0.7281136", "0.7203908", "0.7188092", "0.71131873", "0.69555897", "0.685098", "0.6838269", "0.6831752", "0.6738719", "0.6692059", "0.6665901", "0.66567034", "0.661623", "0.6585292", "0.65061617", "0.6500077", "0.64900446", "0.64827365", "0.64727026...
0.79594964
0
Returns true if the given value is a uuid. The value may be a string or of type UUID. If it's a string, the uuid is checked with a regex.
def is_uuid(value: str | UUID) -> bool: if isinstance(value, str): return _uuid.match(str(value)) and True or False return isinstance(value, UUID)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_uuid_like(val):\n try:\n return str(uuid.UUID(val)) == val\n except (TypeError, ValueError, AttributeError):\n return False", "def is_uuid_like(val):\n try:\n return str(uuid.UUID(val)) == val\n except (TypeError, ValueError, AttributeError):\n return False", "def...
[ "0.8455478", "0.8455478", "0.8029188", "0.7843651", "0.7794354", "0.7694741", "0.76459783", "0.7575199", "0.7530541", "0.7494805", "0.7480939", "0.73566675", "0.7283223", "0.72780937", "0.7022001", "0.69870055", "0.69147795", "0.65341836", "0.6376335", "0.62484616", "0.623474...
0.9190001
0
Returns true if the given obj is an iterable, but not a string.
def is_non_string_iterable(obj: object) -> bool: return not (isinstance(obj, str) or isinstance(obj, bytes))\ and isinstance(obj, Iterable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isiterable(obj, strings=False, isinstance=isinstance, Iterable=Iterable):\n return (isinstance(obj, Iterable) and\n not (isinstance(obj, str) and not strings))", "def nonstringiter(obj):\n return not isinstance(obj, string_types) and isinstance(obj, Iterable)", "def is_iterable(obj, isStrI...
[ "0.8819772", "0.8782847", "0.8680526", "0.8534543", "0.8456351", "0.84327716", "0.83216363", "0.8232543", "0.8204043", "0.8147831", "0.8118153", "0.8090593", "0.80423206", "0.8021403", "0.8015776", "0.7980622", "0.7947369", "0.78371555", "0.78227997", "0.773803", "0.764366", ...
0.9190952
0
Removes everything in front of the path, including scheme, host, username, password and port.
def relative_url(absolute_url: str | None) -> str: url = URL._mutate( URL(absolute_url), scheme=None, username=None, password=None, host=None, port=None ) return url.as_string()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def host_cleanup(host):\n if not host.startswith('https://'):\n host = 'https://' + host # Add schema\n host = strip_end(host, '/')\n host = strip_end(host, '/api/v1')\n host = strip_end(host, '/')\n return host", "def strip_path(self):\n return self.path.replace('/', '')", "def _...
[ "0.71767884", "0.67963123", "0.67461425", "0.67461425", "0.6618697", "0.64288473", "0.6352149", "0.6242105", "0.62055314", "0.61658514", "0.6146189", "0.61302227", "0.6124761", "0.61133295", "0.6094514", "0.6058579", "0.60390717", "0.60377663", "0.60180247", "0.59973025", "0....
0.0
-1
Returns True if the iterable is sorted.
def is_sorted( iterable: 'Iterable[Any]', key: 'Callable[[Any], SupportsRichComparison]' = lambda i: i, reverse: bool = False ) -> bool: # NOTE: we previously used `tee` here, but since `sorted` consumes # the entire iterator, this is the exact case where tee is # slower than just p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_sorted(self):\n return self._sorted", "def is_sorted(self):\n previous = 0 # Setting to 0 shouldn't be an issue aslong as MIN_VALUE is at least 0\n for value in self.data:\n if value < previous:\n return False\n previous = value\n return Tr...
[ "0.75455016", "0.7302388", "0.72134596", "0.71293396", "0.71074814", "0.70934767", "0.68608123", "0.68579763", "0.6809051", "0.67405665", "0.6714944", "0.6712902", "0.659822", "0.6547163", "0.6546891", "0.6496275", "0.6478172", "0.6371364", "0.6327991", "0.6261303", "0.625449...
0.80162364
0
Returns a set of keys found in an hstore column over all records of its table.
def get_unique_hstore_keys( session: 'Session', column: 'Column[dict[str, Any]]' ) -> set[str]: base = session.query(column.keys()).with_entities( # type:ignore sqlalchemy.func.skeys(column).label('keys')) query = sqlalchemy.select( [sqlalchemy.func.array_agg(sqlalchemy.column('keys')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_keys(self):\r\n\r\n #using database\r\n\r\n if self.using_database:\r\n aprint('GET KEYS')\r\n value_tuple = (notebookname,)\r\n db_cursor.execute(\"SELECT keyword\"\r\n +\" FROM keys_to_indexes\"\r\n +...
[ "0.71927756", "0.6927493", "0.69176304", "0.6884229", "0.68739766", "0.6851405", "0.67200774", "0.66515774", "0.6636166", "0.6604113", "0.6595645", "0.64870447", "0.6445271", "0.64266795", "0.63916236", "0.63866013", "0.6375089", "0.63321924", "0.6313424", "0.6280891", "0.627...
0.76195127
0
Appends a single query parameter to an url. This is faster than using Purl, if and only if we only add one query param. Also this function assumes that the value is already url encoded.
def append_query_param(url: str, key: str, value: str) -> str: template = '?' in url and '{}&{}={}' or '{}?{}={}' return template.format(url, key, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_to_query_string(url, key, value) -> str:\n url = list(urlparse(url))\n query = dict(parse_qsl(url[4]))\n query[key] = value\n url[4] = '&'.join(f'{p}={v}' for p, v in query.items())\n\n return urlunparse(url)", "def add_query_param(request, key, val):\n iri = request.get_full_path()\...
[ "0.7627061", "0.71932733", "0.7122428", "0.700618", "0.6976837", "0.6976837", "0.6932545", "0.68469477", "0.67915773", "0.67451537", "0.6696911", "0.6693607", "0.66794866", "0.64410084", "0.63793033", "0.63773775", "0.63249516", "0.6297215", "0.6125421", "0.6102701", "0.60347...
0.79377896
0
Takes a usersupplied string with format blocks and returns a string where those blocks are replaced by values in a dictionary.
def safe_format( format: str, dictionary: dict[str, Any], types: set[type[Any]] | None = None, adapt: 'Callable[[str], str] | None' = None, raise_on_missing: bool = False ) -> str: types = types or {int, str, float} output = StringIO() buffer = StringIO() opened = 0 for ix, cha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_placeholder_formats(self, format_string, placeholder_formats):\n # Tokenize the format string and process them\n output = []\n for token in self.tokens(format_string):\n if (\n token.group(\"placeholder\")\n and (not token.group(\"format\"))\...
[ "0.6703094", "0.63435066", "0.633352", "0.59490496", "0.59408355", "0.5905249", "0.58807915", "0.57084", "0.56357414", "0.55893123", "0.55200344", "0.55117404", "0.55093706", "0.54955494", "0.54838383", "0.54837054", "0.5481274", "0.5458646", "0.54566276", "0.5440442", "0.543...
0.517883
36
Splits an iterable into batches of batch_size and puts them inside a given collection (tuple by default). The container_factory is necessary in order to consume the iterator returned by islice. Otherwise this function would never return.
def batched( iterable: Iterable[_T], batch_size: int, container_factory: 'Callable[[Iterator[_T]], Collection[_T]]' = tuple ) -> 'Iterator[Collection[_T]]': iterator = iter(iterable) while True: batch = container_factory(islice(iterator, batch_size)) if len(batch) == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunkify(iterable, chunk_size):\n _it = iter(iterable)\n while True:\n batch = islice(_it, chunk_size)\n yield chain([batch.__next__()], batch)", "def batches(iterable, size):\n sourceiter = iter(iterable)\n while True:\n batchiter = islice(sourceiter, size)\n yield ch...
[ "0.6788661", "0.67884827", "0.6714264", "0.6709461", "0.67029256", "0.66682523", "0.6664805", "0.65973073", "0.65535605", "0.65448266", "0.65195376", "0.65189743", "0.64779365", "0.644198", "0.6409895", "0.6380411", "0.6336733", "0.6289576", "0.62828106", "0.6272226", "0.6252...
0.8289067
0
Return list of cells we are waiting for user to click on.
def get_allowed_cells(self): if self.step is None: return [] return self.step.toclick
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cells(self):\n cell_list = []\n for cell_row in self.board:\n for current_cell in cell_row:\n if current_cell is not None:\n cell_list.append(current_cell)\n return cell_list", "def get_visible_cells(self):\r\n ux, uy = self.GetScro...
[ "0.62226903", "0.59864146", "0.597345", "0.5942186", "0.5871239", "0.5796442", "0.577594", "0.57299006", "0.5703505", "0.56535816", "0.56385803", "0.5574921", "0.5550854", "0.55331886", "0.54889506", "0.5481883", "0.5436452", "0.5423051", "0.5400062", "0.5372724", "0.5365421"...
0.7215959
0
Gets the pin_code of this PinCodeSummaryResultsObject.
def pin_code(self) -> List[PinCodeSummary]: return self._pin_code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_code(self):\n return self.code", "def get_code(self):\n return self.code", "def get_code(self):\n return self.code", "def get_code(self):\n return self.code", "def code(self):\n return self._code", "def code(self):\n return self._code", "def code(self):...
[ "0.65996116", "0.65996116", "0.65996116", "0.65996116", "0.63884544", "0.63884544", "0.63884544", "0.63884544", "0.6312581", "0.62994224", "0.6243439", "0.6208346", "0.6208346", "0.6208346", "0.6208346", "0.61627483", "0.61627483", "0.61627483", "0.6104146", "0.6083761", "0.6...
0.70086735
0
Renders the home page.
def home(): return render_template( 'index.html', title='Sairam sai baba', year=datetime.now().year, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_home():\r\n\treturn render_template(\"index.html\")", "def home():\n\n return render_template('home_page.html')", "def home():\n\n return render_template(\"home.html\")", "def home():\n return render_template('home.html')", "def home():\n return render_template('home.html')", "def ...
[ "0.85574406", "0.853399", "0.8351404", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.827363", "...
0.7776065
81
Get an array of all matching executable files in PATH; same as UNIX which a. ``paths`` must be a list of dirs like that returned by
def _whicha(cmd, paths=None): import os if paths is None: paths = os.environ['PATH'].split(':') possibilities = [os.path.expanduser(os.path.join(p, cmd)) for p in paths] return filter(lambda bin: os.path.exists(bin), possibilities)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(cls, paths):\r\n pythons = []\r\n for path in paths:\r\n for fn in cls.expand_path(path):\r\n basefile = os.path.basename(fn)\r\n if any(matcher.match(basefile) is not None for matcher in cls.REGEXEN):\r\n try:\r\n pythons.append(cls.from_binary(fn))\r\n ...
[ "0.67455274", "0.670481", "0.6563973", "0.65499187", "0.638122", "0.63745165", "0.6325976", "0.6272965", "0.6259136", "0.6201444", "0.6190485", "0.59739125", "0.59722435", "0.5886799", "0.58645946", "0.5830521", "0.5796174", "0.5795165", "0.57596576", "0.57300735", "0.5711377...
0.7365259
0
Initialize this dataset class.
def __init__(self, opt): BaseDataset.__init__(self, opt) self.dir_A = os.path.join(opt.dataroot, opt.phase5 + 'A') # create a path '/path/to/data/trainA' #self.dir_B20 = os.path.join(opt.dataroot, opt.phase + 'B20') # create a path '/path/to/data/trainB1' #self.dir_B2 = os.path.join(o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.__dataset = None", "def __init__(self, dataset):\n self._dataset = dataset", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def __init__(self, config):\n logger.info(f\"{self.__class__.__name__}: Dataset initializing ...\")\n s...
[ "0.816631", "0.81641185", "0.8013762", "0.76137954", "0.7422038", "0.7393049", "0.7352237", "0.73437655", "0.7111143", "0.71019876", "0.7099074", "0.7096382", "0.70223516", "0.696418", "0.6961817", "0.6889772", "0.6879775", "0.68740934", "0.68599087", "0.68520594", "0.6842619...
0.0
-1
Return a data point and its metadata information.
def __getitem__(self, index): A_path = self.A_paths[index % self.A_size] # make sure index is within then range #if self.opt.serial_batches: # make sure index is within then range A_img = Image.open(A_path).convert('L') A = self.transform_A(A_img) # B20 = self.transform_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point(self):\n return self.x, self.y, self.z", "def to_data(self):\n point = {\n 'point': [self.pt[0], self.pt[1], self.pt[2]],\n 'layer_height': self.layer_height,\n\n 'mesh_normal': self.mesh_normal.to_data(),\n 'up_vector': self.up_vector.to_data()...
[ "0.6607296", "0.6599758", "0.65745145", "0.6535129", "0.65202826", "0.63402396", "0.6291092", "0.6291092", "0.61568433", "0.61515397", "0.6138252", "0.6133588", "0.6116883", "0.60677505", "0.6049698", "0.60260797", "0.5992455", "0.59917825", "0.59876746", "0.59777427", "0.596...
0.0
-1
Return `True` if ``value`` is a member of this search space, else `False`. A point is a member if all of its coordinates lie in the closed intervals bounded by the lower and upper bounds.
def __contains__(self, value: TensorType) -> Union[bool, tf.Tensor]: if not shapes_equal(value, self._lower): raise ValueError( f"Point must have the same shape as the Box bounds, got {value.shape}, expected" f" {self._lower.shape}" ) return tf.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isMember(self, value):\n\n returnValue = False\n\n if self.min != None and self.max != None:\n if self.min <= value <= self.max:\n returnValue = True\n\n if self.values != None:\n if value in self.values:\n returnValue = True\n\n r...
[ "0.7831904", "0.70661855", "0.6481586", "0.63352835", "0.63188195", "0.6318524", "0.62891877", "0.6283665", "0.6281761", "0.6257974", "0.62485486", "0.62368715", "0.62054247", "0.62054247", "0.6157577", "0.6157577", "0.6143361", "0.6127679", "0.6052992", "0.60521984", "0.6040...
0.7242925
1
Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'. An empty string is returned if the value cannot be determined.
def system(): return uname().system
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(cls):\n\n system = platform.system()\n\n # Apply system map\n if system in NAME_MAP:\n system = NAME_MAP[system]\n\n return system", "def _get_osname():\n osname = sys.platform.lower()\n if osname == \"linux2\":\n osname = \"linux\"\n return osname"...
[ "0.8345971", "0.8241422", "0.82383716", "0.8029699", "0.7995332", "0.7933993", "0.79095614", "0.7878901", "0.7816576", "0.77897096", "0.77140045", "0.7701038", "0.76653016", "0.7579017", "0.7575624", "0.7519562", "0.7509163", "0.7509163", "0.7454606", "0.7419475", "0.741323",...
0.70311445
43
Returns the system's release, e.g. '2.2.0' or 'NT' An empty string is returned if the value cannot be determined.
def release(): return uname().release
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_os_release():\n if platform.linux_distribution()[0]:\n return \" \".join(platform.linux_distribution())\n elif platform.mac_ver()[0]:\n return \"%s %s\" % (platform.mac_ver()[0], platform.mac_ver()[2])\n else:\n return \"Unknown\"", "def systemversion...
[ "0.7697108", "0.72590387", "0.71696675", "0.6918059", "0.6875784", "0.6847798", "0.6840346", "0.68332213", "0.6797963", "0.660396", "0.6601632", "0.65981174", "0.6579251", "0.6561983", "0.65532374", "0.6530201", "0.6521793", "0.6508942", "0.6502385", "0.64877146", "0.6485661"...
0.617546
56
Returns the system's release version, e.g. '3 on degas' An empty string is returned if the value cannot be determined.
def version(): return uname().version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n vers = [\"%(major)i.%(minor)i\" % __version_info__, ]\n\n if __version_info__['micro']:\n vers.append(\".%(micro)i\" % __version_info__)\n if __version_info__['releaselevel'] != 'final':\n vers.append('%(releaselevel)s' % __version_info__)\n return ''.join(vers)", "...
[ "0.7700201", "0.7485304", "0.74701524", "0.7468164", "0.74496835", "0.74377143", "0.73149705", "0.72955203", "0.7295201", "0.72883725", "0.727167", "0.7208091", "0.7207224", "0.7150865", "0.7126908", "0.7115683", "0.71081066", "0.70728755", "0.70420396", "0.7041854", "0.70382...
0.6968805
37
Returns the machine type, e.g. 'i386' An empty string is returned if the value cannot be determined.
def machine(): return uname().machine
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def machine_type(self):\n\n return self._machine_type", "def machine():\n mach = platform.machine()\n if mach.startswith('arm'):\n return 'arm'\n else:\n # Assume x86/x86_64 machine.\n return None", "def get_arch():\n arch = platform.machine()\n if arch == \"i686\":\n...
[ "0.7881856", "0.7427668", "0.6863126", "0.661586", "0.65854347", "0.6507089", "0.64510703", "0.63936067", "0.63524", "0.63313717", "0.63256544", "0.629151", "0.62874293", "0.6267362", "0.62508065", "0.62348896", "0.6232881", "0.6228495", "0.62009543", "0.61916864", "0.6173874...
0.6898889
3
The function selects the topk most simialer items, columnwise
def similarity_matrix_topk(item_score_matrix, topk=100,verbose=False): assert(item_score_matrix.shape[0] == item_score_matrix.shape[1]), "the score matrix is not square" start_time = time.time() if verbose: print("generaing topk matrix") # iterate over each column and keep only the topk simila...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tops(similarities, k):\n tops = similarities.argsort(axis=1)[:, :k].tolist()\n return tops", "def fetch_top_k(vect, mat, k):\n resultant = np.dot(mat, vect)\n arglist = np.argsort(resultant)\n arglist = arglist[-1:(-1 - k):-1]\n return arglist, resultant", "def sorted_top_k(item_count...
[ "0.72856355", "0.6772192", "0.6732249", "0.6719441", "0.6704846", "0.6687262", "0.6493734", "0.6449657", "0.6418085", "0.63955986", "0.6393791", "0.63423514", "0.6310252", "0.6283091", "0.6270568", "0.6266971", "0.6261688", "0.62480503", "0.62043244", "0.61917156", "0.6146968...
0.6228949
18
Get BERT features for the `text`
def getBERTFeatures(model, text, attn_head_idx=-1): # attn_head_idx - index o[] tokenized_text = tokenizer.tokenize(text) if len(tokenized_text) > 200: tokenized_text = tokenized_text[0:200] indexed_tokens = tokenizer.convert_tokens_to_ids(tokenized_text) #print('indexed_tokens: ', indexed_tok...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset_features(text):\n return model.extract(text)", "def get_text_features(text, word_features):\n words = word_tokenize(text)\n features = {}\n for w in word_features:\n features[w] = (w in words)\n\n return features", "def create_bert_features(raw_text, tokenizer, model):\n ...
[ "0.7402677", "0.7323911", "0.7015995", "0.69010335", "0.6272743", "0.62242776", "0.6162517", "0.6133971", "0.60780185", "0.60120946", "0.60109484", "0.6001324", "0.5937683", "0.5903751", "0.58373886", "0.58295524", "0.5826632", "0.581496", "0.5766751", "0.5758596", "0.5758062...
0.7880739
0
Convert a string to raw bytes without encoding
def rawbytes(s): outlist = [] for cp in s: num = ord(cp) if num < 256: outlist.append(pack("b", num)) elif num < 65536: outlist.append(pack(">H", num)) else: b = (num & 0xFF0000) >> 16 H = num & 0xFFFF outlist.append(pac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _as_bytes(s):\n if isinstance(s, bytes):\n return s\n return bytes(s, encoding='latin_1')", "def asbytes(s):\n if isinstance(s, bytes):\n return s\n else:\n return s.encode('utf-8')", "def as_bytes(string):\n return same_string_type_as(b\"\", string)", "def str_to_byte...
[ "0.7809434", "0.777581", "0.7731383", "0.76541096", "0.75558203", "0.7517334", "0.74570334", "0.7431554", "0.7420785", "0.73332804", "0.73037195", "0.72042966", "0.71964186", "0.7194585", "0.7186927", "0.710661", "0.7010463", "0.6987726", "0.6983025", "0.6978843", "0.68831444...
0.6303861
62
Test for loading context from an invalid path.
def test_invalid_path(self, tmp_path): other_path = tmp_path / "other" other_path.mkdir() pattern = ( "Could not find any of configuration files '.kedro.yml, pyproject.toml'" ) with pytest.raises(KedroContextError, match=re.escape(pattern)): load_context(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_context_raise_error(self, mock_open, _):\n mock_open.side_effect = FileNotFoundError()\n with self.assertRaises(FileNotFoundError) as exception:\n ctx_obj = CtxCore()\n self.assertEqual(exception.exception, FileNotFoundError(ctx_obj.CONTEXT_FILE))", "def verify_n...
[ "0.6540689", "0.64278746", "0.64275765", "0.6427475", "0.64250255", "0.6355664", "0.6344772", "0.6344571", "0.6312738", "0.6307764", "0.6285292", "0.6264428", "0.6208635", "0.6190709", "0.6183984", "0.6175314", "0.61321884", "0.6125353", "0.6105022", "0.60690105", "0.60524386...
0.71264845
0
Test for loading context from an invalid path.
def test_kedro_yml_has_no_context_path(self, fake_repo_path): payload = {"fake_key": "fake_value", "project_version": kedro_version} _create_kedro_config(fake_repo_path, payload) pattern = "'.kedro.yml' doesn't have a required `context_path` field" with pytest.raises(KedroContextError, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_path(self, tmp_path):\n other_path = tmp_path / \"other\"\n other_path.mkdir()\n pattern = (\n \"Could not find any of configuration files '.kedro.yml, pyproject.toml'\"\n )\n with pytest.raises(KedroContextError, match=re.escape(pattern)):\n ...
[ "0.7126596", "0.6540768", "0.6427867", "0.6427606", "0.6425032", "0.63555926", "0.6344911", "0.6344646", "0.6312764", "0.6307729", "0.62852323", "0.6264451", "0.62087464", "0.61907506", "0.6183979", "0.61753434", "0.6132332", "0.61252844", "0.6105023", "0.6069052", "0.6052592...
0.64275575
4
Test for loading context from an invalid path.
def test_pyproject_toml_has_no_context_path(self, fake_repo_path): payload = { "tool": { "kedro": {"fake_key": "fake_value", "project_version": kedro_version} } } _create_kedro_config(fake_repo_path, payload, yml=False) (fake_repo_path / ".kedro.y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_path(self, tmp_path):\n other_path = tmp_path / \"other\"\n other_path.mkdir()\n pattern = (\n \"Could not find any of configuration files '.kedro.yml, pyproject.toml'\"\n )\n with pytest.raises(KedroContextError, match=re.escape(pattern)):\n ...
[ "0.71264845", "0.6540689", "0.64278746", "0.64275765", "0.6427475", "0.64250255", "0.6355664", "0.6344772", "0.6344571", "0.6312738", "0.6307764", "0.6285292", "0.6264428", "0.6208635", "0.6190709", "0.6183984", "0.6175314", "0.61321884", "0.6125353", "0.6105022", "0.60690105...
0.5822744
44
Test exception generation for empty template file
def test_empty_template(self): with TemplateRenderThread('yaml_file_empty.t', 'yaml_file_empty.tmp.out') as renderer: def check_render_got_exception(): return renderer.raised_exception self.assertTrue(legion.utils.ensure_function_succeed(check_render_got_exception, 5, 3)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_wrong_template(self):\n with self.assertRaises(IncompetentQiitaDeveloperError):\n Sample('SKB8.640193', PrepTemplate(1))", "def test_init_wrong_template(self):\n with self.assertRaises(IncompetentQiitaDeveloperError):\n PrepSample('1.SKB8.640193', SampleTemplate(...
[ "0.6971016", "0.688642", "0.68261236", "0.67710406", "0.6770827", "0.67004234", "0.6689417", "0.6594266", "0.6573386", "0.6557245", "0.65283227", "0.65247226", "0.646004", "0.64299965", "0.6412845", "0.63721037", "0.6337155", "0.6315295", "0.6301395", "0.6296042", "0.6289831"...
0.7851426
0
Init a Thread object.
def __init__(self, template_path, output_path): Thread.__init__(self) self.name = 'template_render_loop' self.daemon = True self.template_path = os.path.join(TEST_FILES_LOCATION, template_path) self.output_path = os.path.join(TEST_FILES_LOCATION, output_path) self.event_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,Thread):\n\t\tthreading.Thread.__init__(self)", "def __init__(self):\n Thread.__init__(self)\n self.start() # start the thread", "def __init__(self):\r\n\t\tthreading.Thread.__init__(self)\r\n\t\tself._want_abort = 0\r\n\t\t# This starts the thread running on creation, but yo...
[ "0.81883866", "0.73821926", "0.7134052", "0.7070083", "0.69984823", "0.6933961", "0.6933961", "0.68908215", "0.68401635", "0.6795925", "0.67856073", "0.67654353", "0.6754059", "0.67206377", "0.67189276", "0.6670278", "0.66411453", "0.6639359", "0.65926397", "0.658642", "0.657...
0.5852772
72
Initialize a _GenomicsSource for use with readers for genomics files.
def __init__(self, file_pattern, validate, **nucleus_kwargs): super(_GenomicsSource, self).__init__( file_pattern=file_pattern, splittable=False, validate=validate) self.nucleus_kwargs = nucleus_kwargs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, genomeReader=None):\n self.genomeReader = genomeReader", "def __init__(self, source):\n self._source = source", "def __init__(self, chromo = None, generation = None):\n\t\tsuper(self.__class__, self).__init__(chromo, generation)\n\n\t\t# Subclass-specific member vars\n\t\tself....
[ "0.6307445", "0.5946417", "0.59454685", "0.5945089", "0.5760283", "0.5634762", "0.5634762", "0.5569867", "0.55479383", "0.55432045", "0.5529948", "0.5505287", "0.5474581", "0.5473627", "0.53766054", "0.5341568", "0.53349316", "0.53189886", "0.5300569", "0.529335", "0.5288642"...
0.6183628
1
Yield records returned by nucleus_reader.
def read_records(self, input_path, offset_range_tracker): if offset_range_tracker.start_position(): raise ValueError('Start position not 0: %d' % offset_range_tracker.start_position()) current_offset = offset_range_tracker.start_position() reader = self.nucleus_reader(input_path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def records(self) -> Generator[Record, None, None]:\n mapping = [(r, self.get_column(r).name) for r in self.query.refs]\n q = self.compose_query()\n log.info(\"Query: %s\", q)\n with self.engine.connect() as conn:\n rp = conn.execution_options(stream_results=True).execute(q)\...
[ "0.6892264", "0.6665735", "0.636002", "0.63110304", "0.6276594", "0.6275283", "0.6253503", "0.61912435", "0.6142751", "0.61407644", "0.6115483", "0.6037173", "0.5996096", "0.5993023", "0.59681994", "0.596808", "0.59375966", "0.59198", "0.5899513", "0.5892537", "0.5871404", ...
0.56048024
42
Get the average complete progress. Therefore, the progress of all events divided by the number of events. Returns float
def get_average_complete_progress(self): cnt_events = len(self.get_events()) if cnt_events > 0: return sum([self.get_average_progress(event) for event in self.get_events()]) * 1.0 / cnt_events return 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_progress(self, event=None):\n cnt_items = len(self)\n sum_progress = None\n\n if event == self.EVENT_TOTAL_PROGRESS:\n return self.get_average_complete_progress()\n\n if event is None:\n sum_progress = sum(map(lambda node: node.get_average_progress(...
[ "0.814884", "0.71450186", "0.7123173", "0.7123173", "0.7110102", "0.7110102", "0.7110102", "0.6976692", "0.6948955", "0.6927273", "0.6900741", "0.68918276", "0.6863581", "0.68132913", "0.67188114", "0.66604567", "0.6658337", "0.66286844", "0.66216004", "0.661835", "0.66103965...
0.9078786
0
Given a path to a workspace, return paths to repositories in it.
def repositories_in_folder(path): for thing in os.listdir(path): thing = os.path.join(path, thing) if os.path.isdir(thing): # Is it a repository? if repo(thing): yield thing else: yield from repositories_in_folder(thing) eli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_repositories(path):\n\n repository_list = []\n os.chdir(path)\n directories = list_directories(path)\n\n # is this a standard git/git-svn repo?\n if git_signature in directories:\n cmd = get_command(False, path)\n repository_list.append((cmd, path))\n return repository_...
[ "0.6624237", "0.6181718", "0.61169624", "0.6033933", "0.60245323", "0.5978644", "0.587066", "0.58556247", "0.5774682", "0.5752448", "0.5721695", "0.57034487", "0.56457466", "0.56132007", "0.5611163", "0.56089896", "0.55935985", "0.55160755", "0.55032724", "0.5500778", "0.5496...
0.60516804
3
Save entry to JSON file
def set_item(filename, item): with atomic_write(os.fsencode(str(filename))) as temp_file: with open(os.fsencode(str(filename))) as products_file: # load the JSON data into memory products_data = json.load(products_file) # check if UUID already exists uuid_list = [i fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save(self):\n with open(self.file_path, 'w') as fid:\n json.dump(self.data, fid, indent=4, sort_keys=True)", "def save(self, filename):\n content = self.to_dict()\n with open(filename, 'w') as f:\n json.dump(content, f)", "def save(self, file):\n with open...
[ "0.7924711", "0.7843761", "0.7741946", "0.75990045", "0.75408524", "0.7489421", "0.74605817", "0.7408117", "0.73916906", "0.73852557", "0.73819953", "0.73802346", "0.7358507", "0.7349808", "0.7340515", "0.7320343", "0.7310677", "0.7310677", "0.7310677", "0.73031205", "0.73022...
0.0
-1
Change the current slide to the specified slide (via the slide TextBox).
def MoveToSlide(self, event): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MoveToNextSlide(self, event):\n pass", "def selected(self, point):\n local_point = (point[0] - self.x, point[1] - self.y)\n self.remove(self.slide.rect)\n self.slide.update(local_point)\n self.insert(1, self.slide.rect)\n self.slide.rect.fill = self.slide_color\n ...
[ "0.6445182", "0.6354256", "0.62920386", "0.6021219", "0.59739137", "0.5919385", "0.58651716", "0.5807023", "0.5601016", "0.5594786", "0.55529064", "0.55505466", "0.55480325", "0.5544927", "0.54611963", "0.5445087", "0.5416229", "0.53964806", "0.53808254", "0.52165246", "0.518...
0.6879944
0
Hides the forum window and unchecks the "Show Forum" menu item in the "View" menu.
def onClose(self, event): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide(self):\n self.window.run_command(\"hide_panel\", {\"panel\": self.full_name})", "def hide(self):\r\n\t\tself.frame.Show(False)", "def CloseForum(self, event):\n pass", "def hide(self):\n self.visible = False", "def hide(self):\n self.set_visible(False)", "def unHide(sel...
[ "0.647883", "0.6414951", "0.6347981", "0.63441956", "0.62634677", "0.6248565", "0.6208979", "0.6188313", "0.61760527", "0.60208946", "0.6015778", "0.59674346", "0.59467703", "0.5914101", "0.5834296", "0.57905406", "0.5781232", "0.5780363", "0.5777049", "0.57531255", "0.574943...
0.0
-1
Changes opacity of selected layer
def ChangeOpacity(self, event): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setOpacity(self, opacity):\n item = self.item()\n if item is not None:\n color = item.getColor()\n color.setAlpha(opacity)\n item.setColor(color)", "def change_opacity(self, _):\n raise ChangeOpacityEvent", "def opacity( self ):\n if ( self.isIs...
[ "0.70105016", "0.6834342", "0.6815256", "0.66322213", "0.6507769", "0.6504487", "0.64808524", "0.63673335", "0.6270009", "0.62619174", "0.6247294", "0.623107", "0.6192486", "0.6178794", "0.61571085", "0.6128702", "0.60965335", "0.60800827", "0.60401654", "0.6017393", "0.59796...
0.6864688
1
Returns project root folder.
def get_project_root() -> Path: return Path(__file__).parent.parent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_root() -> Path:\n return PROJECT_ROOT", "def getProjectRootDir():\n return ROOT_DIR", "def getProjectRootPath():\n rootpath = os.getcwd().split('\\eles')[0]\n return rootpath", "def get_project_root():\n return Path(__file__).parent.parent", "def get_project_root():\n retu...
[ "0.8855307", "0.8816829", "0.847031", "0.8462203", "0.84460264", "0.84460264", "0.8425219", "0.8419815", "0.83712715", "0.8356894", "0.83145547", "0.8294601", "0.828788", "0.8250647", "0.82296336", "0.8205302", "0.81644493", "0.8087945", "0.8083112", "0.80584306", "0.7945301"...
0.8488286
5
The home page with webcam.
def home(): return render_template('video_test.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n return render_template(\n 'index.html',\n title= \"Pi-Lapse\",\n year=datetime.now().year,\n image = Cam.do.GetLastImage(),\n \n )", "def camera():\n return render_template('home/cam.html')", "def StartWebcam(self):\n if not os.path.exists('static'):...
[ "0.78150177", "0.7259388", "0.72377515", "0.7003676", "0.6830796", "0.68103164", "0.6664987", "0.66421866", "0.6570881", "0.6567656", "0.6515781", "0.6479413", "0.64204144", "0.6411538", "0.6402749", "0.6393225", "0.6392908", "0.63563985", "0.63546693", "0.6338067", "0.633806...
0.7083339
3
Set ups test loader and loads data
def _load_test_data(self): self.test_loader = data.Test_loader(self.N_max, self.n_per_conn, self.data_path, self.device) self.test_loader.load_data() # load mean and std from train scc_mean_std = np.loadtxt( os.path.join(self.dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_test_data(self):\n self._save_test_data()", "def setUp(self):\n\n self.test_data_path = 'testing/test_data/'", "def setUpClass(cls):\n cls.run_mgr = runner(['start', 'execute'], ['stop'])\n cls.load_mgr = loader(verbose=False, recursive=True)\n cls.load_mgr.set_addo...
[ "0.7731667", "0.7313849", "0.71905166", "0.71753466", "0.7116051", "0.7071192", "0.7019473", "0.70137405", "0.70137405", "0.70137405", "0.70137405", "0.69670415", "0.69664717", "0.69476265", "0.69476265", "0.6918654", "0.69094384", "0.6891531", "0.68460226", "0.68411195", "0....
0.68372816
20
Normalize a header name.
def normalizeHeaderName(name): # type: (AnyStr) -> AnyStr return name.lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_header_id(name: str) -> str:\n name = name.lower()\n name = re.sub(r\"\\s\", \"-\", name)\n name = re.sub(r\"[^a-zA-Z0-9-]\", \"\", name)\n return name", "def convert_header_names(word: str, delim='-') -> str:\n return delim.join(x.capitalize() or '_' for x in word.split('_'))", "def nor...
[ "0.733931", "0.6905193", "0.68979824", "0.68673354", "0.67008847", "0.67003983", "0.67003983", "0.67003983", "0.6673018", "0.66119725", "0.6606038", "0.6603155", "0.6563133", "0.6539501", "0.65214735", "0.6396969", "0.63729584", "0.6352426", "0.62996686", "0.6275212", "0.6271...
0.8751204
0
Returns maximum number of iterations for gradient descent.
def get_max_iters(): return 2000
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_em_iterations(self):\n return self._max_em_iterations", "def get_max_steps(self) -> float:\n return float(self.trainer_parameters[\"max_steps\"])", "def get_max_steps(self):\n return float(self.trainer_parameters['max_steps'])", "def get_max_steps(self):\n return float(sel...
[ "0.7174041", "0.6682379", "0.66471106", "0.66471016", "0.66270876", "0.66089654", "0.66074145", "0.6603905", "0.65376437", "0.6486289", "0.63755363", "0.6303527", "0.6291429", "0.62789917", "0.62404025", "0.62404025", "0.62389827", "0.62362933", "0.6204433", "0.61927", "0.616...
0.7070852
1
>>> is_iterable([]) True >>> is_iterable(()) True >>> is_iterable([x for x in range(10)]) True >>> is_iterable((1, 2, 3)) True >>> g = (x for x in range(10)) >>> is_iterable(g) True >>> is_iterable("abc") False >>> is_iterable(0) False >>> is_iterable({}) False
def is_iterable(obj): return isinstance(obj, (list, tuple, types.GeneratorType)) or \ (not isinstance(obj, (int, str, dict)) and bool(getattr(obj, "next", False)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isiterable(x):\n try:\n iter(x)\n return True\n except TypeError:\n return False", "def isiterable(x):\n try:\n iter(x)\n except TypeError:\n return False\n return True", "def is_iterable(thing):\n\n try:\n iter(thing)\n except TypeError:\n ...
[ "0.7895537", "0.7872792", "0.78257865", "0.76740617", "0.7627081", "0.7624022", "0.7590455", "0.75887215", "0.7585927", "0.7454823", "0.74163187", "0.74115425", "0.73565316", "0.72547644", "0.7207713", "0.7114762", "0.7086665", "0.7084388", "0.7075423", "0.7053886", "0.702620...
0.73794496
12
Generate a random string of fixed length
def randomString(stringLength=10): letters = string.ascii_lowercase return ''.join(random.choice(letters) for i in range(stringLength))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",...
[ "0.8680464", "0.8573714", "0.85486245", "0.85297275", "0.85209286", "0.84331024", "0.8432044", "0.84157014", "0.84120053", "0.8389201", "0.8345882", "0.8343962", "0.83406156", "0.83348686", "0.83240855", "0.82986933", "0.82911193", "0.8281826", "0.82818025", "0.82811046", "0....
0.0
-1
Scale features of X according to feature_range.
def transform(self, X): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale(x, feature_range=(-1, 1)):\n \n # scale from 0-1 to feature_range\n min, max = feature_range\n #x = x * (max - min) + min\n #x = torch.add(torch.mul(x, (max-min)), min)\n x = x.mul(max-min).add_(min)\n return x", "def scale(x, feature_range=(-1,1)):\r\n x = x * 2 - 1\r\n retu...
[ "0.81609005", "0.81433034", "0.7903771", "0.7345295", "0.7274094", "0.69223624", "0.6884785", "0.68541414", "0.6786072", "0.67727387", "0.66296446", "0.6573912", "0.64878356", "0.64718354", "0.636914", "0.6338572", "0.6317017", "0.630757", "0.63006496", "0.6299736", "0.629463...
0.0
-1
Transform features by scaling each feature to a given range. This estimator scales and translates each feature individually such that it is in the given range on the training set, i.e. between zero and one.
def minmax_scale(X, feature_range=..., *, axis=..., copy=...): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale(x, feature_range=(-1, 1)):\n \n # scale from 0-1 to feature_range\n min, max = feature_range\n #x = x * (max - min) + min\n #x = torch.add(torch.mul(x, (max-min)), min)\n x = x.mul(max-min).add_(min)\n return x", "def __scale(data, max_value_list, min_value_list, scale_value_list, ...
[ "0.7591412", "0.7253509", "0.7188856", "0.6898487", "0.67834324", "0.6693322", "0.6654447", "0.6632101", "0.65817297", "0.64924973", "0.64843005", "0.64689887", "0.637908", "0.6342756", "0.6217517", "0.6195506", "0.6195263", "0.61670625", "0.61331373", "0.6126643", "0.6124032...
0.6850895
4
Compute the maximum absolute value to be used for later scaling.
def fit(self, X, y=...): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def absmax(self):\n raise NotImplementedError", "def max_abs(self):\n\n return np.nanmax(self.abs_data)", "def max_absolute_magnitude(self):\n return self._max_absolute_magnitude", "def max_abs_error(self) -> float:\n return np.max(np.abs([self.error]))", "def _abs_cap(val, max_...
[ "0.8457922", "0.83062845", "0.8170532", "0.7905586", "0.74248654", "0.7405637", "0.7335071", "0.7326715", "0.7239608", "0.72089505", "0.71862376", "0.7174167", "0.7163728", "0.715378", "0.71426505", "0.7128576", "0.70801014", "0.7055785", "0.69762975", "0.69733053", "0.693210...
0.0
-1
Online computation of max absolute value of X for later scaling. All of X is processed as a single batch. This is intended for cases
def partial_fit(self, X, y=...): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_batchwise(data_source, batch_size=1024):\n max_val = np.zeros(data_source.dshape, dtype=np.float32)\n\n for x, _ in iterate_batches(data_source, batch_size, expand=True):\n max_val = np.maximum(max_val, np.abs(x).max(axis=0))\n\n return max_val", "def max(self):\n maxs = self.clien...
[ "0.6996219", "0.69768274", "0.69459546", "0.6934485", "0.6880107", "0.6838995", "0.67724705", "0.6733747", "0.66889983", "0.6581789", "0.6568523", "0.65352863", "0.64993495", "0.64868915", "0.64800423", "0.64721495", "0.6458217", "0.6456964", "0.64534277", "0.64241654", "0.64...
0.0
-1
Scale each feature to the [1, 1] range without breaking the sparsity. This estimator scales each feature individually such that the maximal absolute value of each feature in the training set will be 1.0. This scaler can also be applied to sparse CSR or CSC matrices.
def maxabs_scale(X, *, axis=..., copy=...): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scale_features(self, features):\n assert isinstance(features, np.ndarray), \"Input is not a numpy array!\"\n\n return self.scaler.transform(features.reshape(1, -1))", "def scale(x, feature_range=(-1,1)):\r\n x = x * 2 - 1\r\n return x", "def test_scale_features_min_max_norm(self):\n ...
[ "0.72496974", "0.6970486", "0.6799068", "0.67821556", "0.6711588", "0.67039096", "0.6683673", "0.6663225", "0.6610411", "0.6448253", "0.64089227", "0.6344876", "0.63291645", "0.6328882", "0.6278327", "0.6255703", "0.61976403", "0.61969185", "0.61831164", "0.6147232", "0.61230...
0.0
-1
Compute the quantiles used for transforming.
def fit(self, X, y=...): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantiles(self):\n return self._quantiles", "def quantiles(self, q: int):\n return self.dist.quantiles(q)", "def quantile_transform(X, *, axis=..., n_quantiles=..., output_distribution=..., ignore_implicit_zeros=..., subsample=..., random_state=..., copy=...):\n ...", "def quantile(self,...
[ "0.7632843", "0.75077456", "0.7276324", "0.6944732", "0.6894197", "0.6755116", "0.6666638", "0.6605933", "0.6454587", "0.6410958", "0.63660324", "0.63323736", "0.6330814", "0.6330365", "0.6290474", "0.6290474", "0.6290474", "0.62834036", "0.6281298", "0.6271829", "0.62713695"...
0.0
-1
Transform features using quantiles information. This method transforms the features to follow a uniform or a normal distribution. Therefore, for a given feature, this transformation tends to spread out the most frequent values. It also reduces the impact of
def quantile_transform(X, *, axis=..., n_quantiles=..., output_distribution=..., ignore_implicit_zeros=..., subsample=..., random_state=..., copy=...): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantile(features,quantile_transform): \n \n features['FEMA_21'] = quantile_transform(np.nan_to_num(features.FEMA_21.astype(np.float32)).reshape(-1, 1))\n features['FEMA_8'] = quantile_transform(np.nan_to_num(features.FEMA_8.astype(np.float32)).reshape(-1, 1))\n features['FADRLo'] = quantile_tra...
[ "0.7500894", "0.6304288", "0.6301823", "0.6182658", "0.6097836", "0.60041714", "0.6000332", "0.59357613", "0.5909969", "0.5771541", "0.5725014", "0.572436", "0.57161516", "0.5702626", "0.5662967", "0.5642326", "0.56178176", "0.5591624", "0.5577114", "0.55763465", "0.55454135"...
0.71738434
1
A decorator for functions that define TensorFlow operations. The wrapped function will only be executed once. Subsequent calls to it will directly return the result so that operations are added to the graph only once. The operations added by the function live within a tf.variable_scope(). If this decorator is used with...
def define_scope(function, scope=None, *args, **kwargs): attribute = '_cache_' + function.__name__ name = scope or function.__name__ @property @functools.wraps(function) def decorator(self): if not hasattr(self, attribute): with tf.variable_scope(name, *args, **kwargs): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scope_op(name=None):\n def decorator(function):\n @functools.wraps(function)\n def wrapper(*args, **kwargs):\n with tf.name_scope(name or function.__name__):\n return function(*args, **kwargs)\n return wrapper\n return decorator", "def scoped_fn(fn: Callab...
[ "0.7893209", "0.7513416", "0.73756826", "0.7355218", "0.7162491", "0.6325369", "0.61793435", "0.61692065", "0.61486983", "0.61024624", "0.61024624", "0.6031894", "0.60214275", "0.6010123", "0.6004921", "0.59787714", "0.59298766", "0.58732486", "0.5864417", "0.5849395", "0.584...
0.73756117
3
Computes the accuracy over the k top predictions for the specified values of k
def accuracy(output, target, topk=(1,)): with torch.no_grad(): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)", "def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua...
[ "0.8330614", "0.8285004", "0.82375455", "0.8229273", "0.82195294", "0.8185992", "0.8184316", "0.8174685", "0.817106", "0.8169587", "0.8166069", "0.8164076", "0.816332", "0.816176", "0.816176", "0.816176", "0.816176", "0.816176", "0.816176", "0.816176", "0.816176", "0.816176...
0.7846885
95
Copy the source image into the framebuffer at the specified location.
def BitBlt(x, y, width, height, data): # # Perform the clipping for x,y, width & height. # if x >= (NUMBER_OF_8x8_MATRICES*8): return if y < -height: return if x < -width: return if y >= 8: return if x+widt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copyTexture(self, src, dest):\n self.copyTextureNode.setShaderInput(\"src\", src)\n self.copyTextureNode.setShaderInput(\"dest\", dest)\n self._executeShader(\n self.copyTextureNode,\n (src.getXSize() + 15) / 16,\n (src.getYSize() + 15) / 16)", "def draw...
[ "0.64249265", "0.6286526", "0.61838186", "0.61827546", "0.6176883", "0.5973708", "0.59406966", "0.5888412", "0.56527984", "0.5522438", "0.55076605", "0.54754335", "0.5435013", "0.5425795", "0.5362075", "0.5347571", "0.527732", "0.5276092", "0.5243935", "0.52410483", "0.522624...
0.47583205
99
If image is not 500x500 resize the contours for appropriate display
def resizeContours(self): scale = 500/self.images.shape[1] print('Scaling images by {} for display'.format(scale)) self.lumenCopy = (self.lumen[0][:], self.lumen[1][:]) self.plaqueCopy = (self.plaque[0][:], self.plaque[1][:]) self.stentCopy = (self.stent[0][:], self.stent[1][:]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize(image):\r\n return cv2.resize(image, (200, 66), interpolation=cv2.INTER_AREA)", "def contours(self, image,debug=False):\n imgray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)\n if debug: cv2.imwrite('debug_pics/gray_scale_contour.jpg',imgray) # cv2.imshow('gray_scale_contour',imgray)\n ...
[ "0.65126145", "0.6266808", "0.62586683", "0.6060555", "0.6050624", "0.60281247", "0.6022835", "0.6003653", "0.59329927", "0.59291726", "0.5923624", "0.59159005", "0.5885434", "0.5881396", "0.5870009", "0.5857393", "0.5841759", "0.5820415", "0.5802517", "0.57898796", "0.576673...
0.7953076
0
Loads weights from checkpoint.
def load_checkpoint(self, checkpoint_path, silent = False): ckc = CheckpointCache(checkpoint_path) if not self.built: dymmy_inputs = np.array([[0,1,2]]) self([dymmy_inputs]) symbolic_weights = self.trainable_weights + self.non_trainable_weights ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_weights(self, model_name: str, checkpoint: int, path: str = './models/'):\n path_to_model = path + model_name + '/checkpoint_' + str(checkpoint) + '/model_weights'\n self.model.load_weights(path_to_model)", "def load_model_weights(sess, checkpoint_dir):\n\n init_fn = slim.assign_from_ch...
[ "0.7959396", "0.7952753", "0.7908471", "0.7858304", "0.7858304", "0.7717808", "0.7717808", "0.7717808", "0.75467175", "0.75319225", "0.75050163", "0.74764127", "0.731902", "0.73156345", "0.72877693", "0.718835", "0.71477747", "0.7135577", "0.71152645", "0.7109566", "0.7049629...
0.700931
22
Add a new experience to memory.
def add(self, state, action, reward, next_state, done): e = self.experience(state, action, reward, next_state, done) self.memory.append(e) self.priorities.append(max(self.priorities, default=1)) # Save all new experiences as maximum priority
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)", "def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st...
[ "0.79568833", "0.79042006", "0.78795445", "0.7577913", "0.7570969", "0.74478436", "0.72697705", "0.721816", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71451885", ...
0.7361023
6
Gets the sampling probabilities associated with each experience.
def get_probs(self, a): with torch.no_grad(): probabilities = (np.array(self.priorities) ** a) / sum(np.array(self.priorities) ** a) return probabilities
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probabilities(self):\n raise NotImplementedError", "def _get_selection_probabilities(self):\r\n probabilities = np.arange(1, self.population_size+1, dtype=float)[::-1]\r\n probabilities /= probabilities.sum()\r\n return probabilities", "def probs(self) -> List:\n return s...
[ "0.7158673", "0.69207996", "0.67479706", "0.66182864", "0.65187925", "0.64736277", "0.64463925", "0.6382768", "0.6301898", "0.6286138", "0.620744", "0.6203173", "0.61712784", "0.6167491", "0.61107916", "0.6107221", "0.60906804", "0.60776174", "0.60683393", "0.60683393", "0.60...
0.64533925
6