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
Do not return anything, modify head inplace instead.
def reorderList(self, head: ListNode) -> None: if head is None or head.next is None: return # middle slow,fast = head, head while fast.next is not None and fast.next.next is not None: slow = slow.next fast = fast.next.next # reverse f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def head(self, head):\n\n self._head = head", "def move_to_head(self, node):\n if node is self.head:\n return\n value = node.value\n self.delete(node)\n self.add_to_head(value)", "def _move_to_head(self, node):\n self._remove_node(node)\n self._add_no...
[ "0.7218526", "0.6802109", "0.6732775", "0.6622557", "0.6466963", "0.64551795", "0.63585746", "0.63523316", "0.63093", "0.62923217", "0.6231313", "0.622523", "0.62005043", "0.62005043", "0.62005043", "0.62005043", "0.6198878", "0.6193791", "0.61740905", "0.6149187", "0.6120934...
0.65217346
4
Returns the unit vector of length 'b' with the 'a'th element = 1
def unit_vector(a, b): tmp = _np.zeros(b) tmp[a] = 1 return tmp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_vectors_ab(a, b):\n # print('dot = ', np.dot(a,b))\n # print('norm = ', np.linalg.norm(b))\n return np.dot(a, b) / np.linalg.norm(b)", "def d_ucross(a, b):\n ev = a / np.linalg.norm(a)\n return np.dot(d_unit_vector(a), d_cross(ev, b))", "def _tf_scalar_a_in1d_b(a, b):\n return...
[ "0.69103354", "0.61789805", "0.60266304", "0.5970242", "0.5917055", "0.58055925", "0.57747823", "0.5774343", "0.57275933", "0.57108617", "0.57086194", "0.5653378", "0.5640164", "0.56363696", "0.5635201", "0.5619316", "0.5612011", "0.5578644", "0.5567598", "0.55610627", "0.554...
0.8058672
0
Produce a transition matrix of a given dimension given a parameter vector v. The only enforced constraint here is that the columns sum to 1
def transition_matrix(v, dimension): assert len(v) == dimension * (dimension - 1), f"Parameter vector must have length {dimension*(dimension-1)}." for ind in range(dimension): v = _np.insert(v, dimension * ind + ind, 1 - sum(v[dimension * ind:dimension * (ind + 1) - 1])) return _np.reshape(v, (dimen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comprehensive_transition_matrix(v, weight, n_bits):\n assert len(v) == n_parameters(weight, n_bits), \"v is the wrong dimension\"\n\n n_w = n_parameters_per_matrix(weight, n_bits)\n n_a = n_matrices_per_weight(weight, n_bits)\n\n vs = _np.reshape(v, (n_a, n_w))\n\n pairs = list(_itertools.combin...
[ "0.66123855", "0.659839", "0.6512675", "0.6472071", "0.61607957", "0.61280847", "0.61172813", "0.6090249", "0.6060008", "0.60289866", "0.59395105", "0.5909324", "0.589461", "0.5881158", "0.5878696", "0.5810041", "0.58098805", "0.5797492", "0.57407725", "0.5706977", "0.5677166...
0.83805686
0
nlog(p) such that if n == 0 the product is 0 too
def nlogp(n, p): return 0 if n == 0 else n * _np.log(max(p, 1e-8))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logp(value, n, p):\n\n res = factln(n) + pt.sum(-factln(value) + logpow(p, value), axis=-1)\n res = pt.switch(\n pt.or_(pt.any(pt.lt(value, 0), axis=-1), pt.neq(pt.sum(value, axis=-1), n)),\n -np.inf,\n res,\n )\n return check_parameters(\n ...
[ "0.69442666", "0.6770327", "0.6560092", "0.65417457", "0.65413964", "0.65390885", "0.6524766", "0.65025663", "0.6501616", "0.64737916", "0.6412889", "0.640194", "0.63932335", "0.63794905", "0.637259", "0.6369177", "0.6364026", "0.6317889", "0.6317574", "0.6298147", "0.6280467...
0.7609741
0
Builds transition matrix from a vector of parameters
def build_transfer_mx(self, t_params=None, apply_abs=True): if t_params is None: t_params = self.t_params tmx = _np.sum([t_params[ind] * self.t_basis[ind] for ind in range(self.dim)], axis=0) + _np.eye(self.n) return _np.abs(tmx) if apply_abs else tmx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transition_matrix(v, dimension):\n assert len(v) == dimension * (dimension - 1), f\"Parameter vector must have length {dimension*(dimension-1)}.\"\n for ind in range(dimension):\n v = _np.insert(v, dimension * ind + ind, 1 - sum(v[dimension * ind:dimension * (ind + 1) - 1]))\n return _np.reshap...
[ "0.69204134", "0.6382577", "0.6335726", "0.62243617", "0.58674526", "0.5734184", "0.5701933", "0.56205916", "0.56174636", "0.5589384", "0.5578534", "0.5559582", "0.5553468", "0.55382735", "0.5537075", "0.552143", "0.5487318", "0.54845685", "0.54607314", "0.5458033", "0.539927...
0.0
-1
Initialize a RegularizedLikelihood function object.
def __init__(self, data_p, data_q, solver="SCS"): self.data_P = data_p self.data_Q = data_q self.solver = solver self.warning_msg = None self.n = len(data_p) # Hold values *separate* from cvxpy variables as we sometimes need to revert # cvxpy optimizations which...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init(self):\n likelihoods.Gaussian()\n self._standard_likelihood()", "def __init__(self, X, Y, kern, mean_function=None, **kwargs):\n likelihood = likelihoods.Gaussian(dtype=X.dtype)\n super(GPR,self).__init__(X, Y, kern, likelihood, mean_function, **kwargs)\n self.num...
[ "0.66586584", "0.61447257", "0.59808815", "0.59475356", "0.5901353", "0.58593845", "0.5846005", "0.5815114", "0.5811548", "0.5807189", "0.5797716", "0.5762734", "0.57596713", "0.5753917", "0.57181686", "0.57065177", "0.5696117", "0.5692102", "0.56874007", "0.56769747", "0.564...
0.0
-1
Compute the ResidualTVD and its `confidence_percent`% confidence interval.
def __call__(self, confidence_percent=68.0, maxiters=20, search_tol=0.1, reltol=1e-5, abstol=1e-5, init_log10_alpha=3, verbosity=1): if self.exactly_zero: return 0.0, 0.0 # shortcut for trivial case resid_tvd = self.residual_tvd(self.pML, self.qML) # print("ResidTVD = ",resid_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_residual_tvds(n_bits, data_ref, data_test, confidence_percent=68.0,\n max_weight=4, maxiters=20, search_tol=0.1, reltol=1e-5,\n abstol=1e-5, solver=\"SCS\", initial_treg_factor=1e-3, verbosity=1):\n residualtvd_by_weight = []\n last_rtvd = None; l...
[ "0.5448839", "0.52839804", "0.5215852", "0.4962623", "0.4926112", "0.49241406", "0.483998", "0.48300937", "0.48188868", "0.4811723", "0.47545677", "0.47459364", "0.4735199", "0.47160155", "0.4711473", "0.47067535", "0.46958262", "0.46733773", "0.46714255", "0.4669242", "0.465...
0.64043117
0
Compute the weightX distrubances between two data sets (including error bars). This function is computes the weightX disturbance, defined as the difference between the weight(X1) and weightX residual TVDs, (evaluated at the ML probability distributions implied by the data) for all weights up to `max_weight`. It also us...
def compute_disturbances_with_confidence(n_bits, data_ref, data_test, confidence_percent=68.0, max_weight=4, maxiters=20, search_tol=0.1, reltol=1e-5, abstol=1e-5, solver="SCS", initial_treg_factor=1e-3, verbosity=1): rtvds_by_weight ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_W2(elec_sets, districts, min_cand_weights_dict, black_pref_cands_df, hisp_pref_cands_df, \\\n cand_race_dict):\n \n min_cand_black_W2 = np.empty((len(elec_sets),0), float)\n min_cand_hisp_W2 = np.empty((len(elec_sets),0), float)\n min_cand_neither_W2 = np.empty((len(elec_sets)...
[ "0.57511914", "0.57052124", "0.5599488", "0.53826284", "0.5343219", "0.530402", "0.5238291", "0.5229988", "0.5189967", "0.51886225", "0.5132434", "0.5092004", "0.5081781", "0.50800526", "0.50700015", "0.5065203", "0.50579405", "0.50577325", "0.5034092", "0.49957445", "0.49927...
0.56327325
2
Compute the weightX distrubances between two data sets (including error bars). This function is computes the weightX disturbance, defined as the difference between the weight(X1) and weightX residual TVDs, (evaluated at the ML probability distributions implied by the data) for all weights up to `max_weight`. It also us...
def compute_disturbances_bootstrap_rawdata(n_bits, data_ref, data_test, num_bootstrap_samples=20, max_weight=4, solver="SCS", verbosity=1, seed=0, return_resampled_data=False, add_one_to_data=True): #p_ml = _np.array(data_ref) / _...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_weights(self, X, target_X, method='l2'):\n if method == 'proj_l2' or method == 'proj_l2_nonorm':\n #\n # At first calculate unrestricted weights: (X.T)^-1\n # Then project answer onto Unit simplex\n # \n target_center = np.mean(target_X, ax...
[ "0.5746039", "0.57294637", "0.5658846", "0.5586402", "0.55617136", "0.5450887", "0.5448413", "0.54287875", "0.53808665", "0.5329094", "0.5290882", "0.5256008", "0.52393866", "0.51843524", "0.5163458", "0.5157238", "0.5156935", "0.5142792", "0.51124406", "0.5104448", "0.510230...
0.52336836
13
Compute the weightX disturbances between two data sets (including error bars). This function is computes the weightX disturbance, defined as the difference between the weight(X1) and weightX residual TVDs, (evaluated at the ML probability distributions implied by the data) for all weights up to `max_weight`. It also us...
def compute_disturbances(n_bits, data_ref, data_test, num_bootstrap_samples=20, max_weight=4, solver="SCS", verbosity=1, add_one_to_data=True): dist_ml, dist = compute_disturbances_bootstrap_rawdata( n_bits, data_ref, data_test, num_bootstrap_samples, max_weight, solver, ver...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_weights(self, X, target_X, method='l2'):\n if method == 'proj_l2' or method == 'proj_l2_nonorm':\n #\n # At first calculate unrestricted weights: (X.T)^-1\n # Then project answer onto Unit simplex\n # \n target_center = np.mean(target_X, ax...
[ "0.5817197", "0.57323575", "0.56812716", "0.5595151", "0.55457175", "0.5417026", "0.53960073", "0.5356345", "0.535349", "0.5335695", "0.5195208", "0.51854223", "0.51795703", "0.51758546", "0.513834", "0.5130398", "0.5111673", "0.5107391", "0.5103545", "0.51035184", "0.5102634...
0.4700948
87
Returns levelappropriate list of tokens. text single string of text to tokenize
def tokens_from_string(self, text): if self.level == "character": return list(text) elif self.level == "word": return nltk.word_tokenize(text) else: print("error: invalid level")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_token_list(text):\n return text.split()", "def tokenize(text):\n return tokens_re.findall(text)", "def tokenize(self, text: str) -> List[str]:\n\n # calls the selected tokenizer function e.g. 're' => re_tokenize(text)\n word_tokens = self.gpt2_tokenize(text)\n\n return word_tok...
[ "0.8395141", "0.831102", "0.82778656", "0.827472", "0.8222971", "0.8100803", "0.8089632", "0.8055674", "0.8055533", "0.8006163", "0.79727954", "0.7971628", "0.7934016", "0.7921817", "0.7859965", "0.7849485", "0.78251755", "0.7822752", "0.77641356", "0.77472496", "0.77387273",...
0.7967735
12
Sets the lun_count of this VnicFcAdapterPolicyAllOf.
def lun_count(self, lun_count): self._lun_count = lun_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iscsi_luns_every(self, iscsi_luns_every):\n\n self._iscsi_luns_every = iscsi_luns_every", "def lun(self, lun):\n\n self._lun = lun", "def vlans_every(self, vlans_every):\n\n self._vlans_every = vlans_every", "def vm_count(self, vm_count):\n\n self._vm_count = vm_count", "def...
[ "0.52866864", "0.49690428", "0.49519306", "0.4915979", "0.4915979", "0.48392224", "0.4805429", "0.47879255", "0.47772548", "0.4736789", "0.4670654", "0.46086815", "0.46013558", "0.4506781", "0.45022792", "0.44786662", "0.44687417", "0.44602594", "0.44586164", "0.44425517", "0...
0.704226
0
Sets the lun_queue_depth of this VnicFcAdapterPolicyAllOf.
def lun_queue_depth(self, lun_queue_depth): self._lun_queue_depth = lun_queue_depth
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_lrbt_dimension(self, l, r, b, t, near, far):\n self.__fdim = l, r, b, t, near, far\n return self", "def _set_lsp_config_frr_holding_priority(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=in...
[ "0.47381592", "0.4707144", "0.4589882", "0.45773852", "0.45730025", "0.45462763", "0.45462763", "0.45462763", "0.45411894", "0.45411894", "0.45411894", "0.45234373", "0.44790027", "0.44655037", "0.44600165", "0.44499394", "0.43994594", "0.43762532", "0.43686432", "0.43305865", ...
0.76161265
0
Sets the organization of this VnicFcAdapterPolicyAllOf.
def organization(self, organization): self._organization = organization
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setOrganization(self, *args):\n return _libsbml.ModelCreator_setOrganization(self, *args)", "def setOrganisation(self, *args):\n return _libsbml.ModelCreator_setOrganisation(self, *args)", "def organization(self, value):\n organization = self._tower.get_organization_by_name(value)\n ...
[ "0.5135674", "0.4929529", "0.4895023", "0.4821758", "0.47351527", "0.47320288", "0.46962047", "0.46612102", "0.4644318", "0.46372673", "0.45655122", "0.45655122", "0.45655122", "0.45513192", "0.45513192", "0.45213237", "0.44702268", "0.44630924", "0.44579676", "0.44550458", "...
0.53954524
2
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, VnicFcAdapterPolicyAllOf): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, VnicFcAdapterPolicyAllOf): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Compute the LeastSquares GAN metrics for the discriminator.
def ls_discriminator_loss(scores_real, scores_fake): loss = (torch.mean((scores_real - 1) ** 2) + torch.mean(scores_fake ** 2)) / 2 return loss
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_gan(epoch, generator, discriminator, x_real, domain, n=100, latent_dim=1):\n\n # Discriminator on real samples\n _, acc_real = discriminator.evaluate(\n x_real, np.ones((x_real.shape[0], 1)), verbose=0)\n\n # Discriminator on fake samples\n z = generate_latent_points(latent_dim, n)\n ...
[ "0.6416926", "0.63275605", "0.6027656", "0.5978039", "0.5974943", "0.5971676", "0.59659046", "0.59446245", "0.5943579", "0.58846956", "0.58793634", "0.58473355", "0.5832685", "0.5826789", "0.5794599", "0.5786867", "0.57866853", "0.57841074", "0.5757086", "0.5718163", "0.57101...
0.5765451
18
Given an x by y by c img, returns a xy by c array, and the original shape. Essentially, gets the img as a list of pixels, each pixel being a vector of length c.
def get_pixel_list(img): orig_shape = img.shape # Remember the original shape of the img. # Store the img as a x by z array (z being the length of the colour space) # Essentially just a list of pixels. if len(img.shape) == 3: img = img.reshape(img.shape[0] * img.shape[1], img.shape[2]) eli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcul_xy_array(img_x, img_y, tile_x, tile_y):\n array = []\n\n modu_x = img_x % tile_x\n modu_y = img_y % tile_y\n div_x = img_x // tile_x\n div_y = img_y // tile_y\n current_x = 0\n current_y = 0\n\n for i in range(div_y):\n for j in range(div_x):\n array.append((cur...
[ "0.6520238", "0.6212084", "0.6212084", "0.6058352", "0.59900266", "0.5980272", "0.59720075", "0.5923761", "0.59104073", "0.5883469", "0.58737314", "0.5866302", "0.58648556", "0.5863817", "0.58549285", "0.58212554", "0.5819949", "0.58088756", "0.580134", "0.57945895", "0.57898...
0.71679634
0
Given an x by y by c img, a number (n) of buckets per channel (c), and a max value (in the case of RGB, 255), returns an x by y array denoting the bin indices for each pixel.
def hash_img(img, n=3, max_value=255): orig_shape, img = get_pixel_list(img) # Note: apply along axis is slower, but this is still slow. # There probably exists a way of making this faster with numpy. # return np.apply_along_axis(hash_pixel, 1, img, n, max_value).reshape(orig_shape[:2]) return np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bins(size, n, max_value):\n bin_lims = get_bin_lims(n, max_value)\n return sort_by_rows(np.array(list(itertools.product(bin_lims, repeat=size))))", "def bins_from_image(path):\n _, Y = util.imread(path)\n closest_bins = util.closest_bins(Y).flatten()\n count = np.zeros(len(util.bins))\n ...
[ "0.6368335", "0.6052963", "0.6049015", "0.5968018", "0.5940938", "0.5912678", "0.5826723", "0.57849973", "0.5782082", "0.57811564", "0.57696104", "0.5741694", "0.5706028", "0.56856173", "0.5644078", "0.5624339", "0.56134695", "0.56134695", "0.561309", "0.5595429", "0.55845946...
0.5677147
14
Given a list of colours and a list of pixels assigned to each colour, returns list of pixels with correctly assigned colours.
def make_img_with_assigned_colours(colours, hashed_img): orig_shape = hashed_img.shape hashed_img = hashed_img.flatten() img = np.ones((*hashed_img.shape, colours.shape[1],), dtype="uint8") for i in range(len(colours)): img[np.where(hashed_img == i)] = colours[i] return img.reshape((*orig_sh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_colours(colours_list, colours_required):\n colour_range = spectra.range(colours_list, colours_required)\n return [colour.hexcode for colour in colour_range]", "def get_colors(color_list):\n rgba_colors = []\n a = [0.5,0.5,0.6,0.4,0.3,0.2]\n i = 0\n for c in color_list:\n rgba_c...
[ "0.7355043", "0.65628546", "0.64582306", "0.6348912", "0.61109716", "0.6024544", "0.601874", "0.5998875", "0.5965268", "0.5947477", "0.58933634", "0.586785", "0.5850018", "0.57869726", "0.5757383", "0.574751", "0.57411", "0.57241637", "0.5721022", "0.5715938", "0.57097244", ...
0.6144681
4
Sets the uninstanced_item_objectives of this DestinyCharacterProgressionComponent.
def uninstanced_item_objectives(self, uninstanced_item_objectives): self._uninstanced_item_objectives = uninstanced_item_objectives
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uninstanced_item_components(self, uninstanced_item_components):\n\n self._uninstanced_item_components = uninstanced_item_components", "def postInitialization(self, objectives = None):\n self.objectives = objectives", "def setNotRenderable(objList):\r\n # declare a list of attributes for re...
[ "0.6069788", "0.50686973", "0.4641322", "0.46393347", "0.4600873", "0.45567068", "0.44952974", "0.44842806", "0.44752657", "0.4380454", "0.4368845", "0.4356389", "0.43173862", "0.4311341", "0.42860755", "0.42321068", "0.4224013", "0.42219788", "0.4213827", "0.41893125", "0.41...
0.7625923
0
Sets the checklists of this DestinyCharacterProgressionComponent.
def checklists(self, checklists): self._checklists = checklists
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_checklists_status(auth, args):\n global checklists_on\n\n if auth['checklists'] == \"true\":\n checklists_on = True\n else:\n checklists_on = False\n\n # reverse the config setting if specified by the CLI option\n# if args['--checklists']:\n# checklists_on = not checklis...
[ "0.5388448", "0.5178056", "0.47633874", "0.4745521", "0.4715553", "0.47147065", "0.47000226", "0.4678718", "0.46702096", "0.46173793", "0.45208922", "0.4478666", "0.44753748", "0.44658512", "0.4457892", "0.443784", "0.44317162", "0.4390128", "0.43871358", "0.4377698", "0.4372...
0.6916538
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, DestinyCharacterProgressionComponent): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Apply the 1d adaptive average pooling to input.
def adaptive_avg_pool1d(input, output_size): args = utils._get_adaptive_pool_args( input.size()[-1:], utils._single(output_size)) return _pool('AVG', utils._single, input, **args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\r\n x = x.permute(0, 2, 1)\r\n x = torch.nn.functional.avg_pool1d(x, self.kernel_size)\r\n return x.permute(0, 2, 1)", "def forward(self, x):\n x = x.permute(0, 2, 1)\n x = torch.nn.functional.avg_pool1d(x, self.kernel_size)\n return x.permute(0, 2,...
[ "0.7058034", "0.7049231", "0.70460516", "0.7009492", "0.6925214", "0.6824373", "0.67714304", "0.67641926", "0.66673446", "0.6594632", "0.65405375", "0.65323025", "0.6501119", "0.6490693", "0.648852", "0.64639956", "0.6299861", "0.6245185", "0.620425", "0.60869217", "0.6065628...
0.7919951
0
r"""Compute the sigmoid cross entropy with contiguous target.
def binary_cross_entropy_with_logits( input, target, weight=None, size_average=None, reduce=None, reduction='mean', pos_weight=None, ): if size_average is not None or reduce is not None: reduction = _reduction.legacy_get_string(size_average, reduce) else: reduction = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sigmoid_cross_entropy(self):\n loss_op = pointwise_losses.SigmoidCrossEntropy()\n\n y_pred = loss_op.final_activation_op({\n \"logits\": self.logits,\n \"metadata\": {\n \"mask\": self.mask\n }\n })\n assert np.isclose(y_pred[0][0...
[ "0.7352075", "0.7167979", "0.7135719", "0.70857906", "0.7030672", "0.6897947", "0.68060154", "0.6803094", "0.6719097", "0.670368", "0.666273", "0.66219085", "0.66211456", "0.6617892", "0.6589703", "0.65851134", "0.65599525", "0.65517175", "0.654601", "0.654601", "0.6537982", ...
0.6195339
76
r"""Apply the 3d deconvolution to input.
def conv_transpose3d( input, weight, bias=None, stride=1, padding=0, output_padding=0, groups=1, dilation=1, ): return _conv_transpose('ConvTranspose', utils._triple, **locals())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, in_obj, channel_axes=\"C\", spatial_axes=(\"D\", \"H\", \"W\"), **kwargs):\n output = super(Deconvolution, self).__call__(in_obj, channel_axes, spatial_axes, **kwargs)\n return self._slice_output(output, spatial_axes, **kwargs)", "def deconv(dims, inplanes, outplanes, kernel_size...
[ "0.6751181", "0.6668589", "0.66188866", "0.6615516", "0.66007274", "0.6568923", "0.6460536", "0.6394214", "0.638967", "0.6287257", "0.628673", "0.62740326", "0.6241009", "0.6235752", "0.6231016", "0.6191527", "0.61702406", "0.6115791", "0.6084227", "0.607948", "0.6073386", ...
0.0
-1
Lookup the embedding matrix using index.
def embedding(input, weight, padding_idx=None): if padding_idx is not None: num_embeddings = weight.size(0) if padding_idx > 0: if padding_idx >= num_embeddings: raise ValueError('<padding_idx> must be within embedding matrix.') elif padding_idx < 0: i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embedding_matrix(path_to_embedding : str,embedding_dim: int, word_index : dict) -> np.array:\n embeddings_index = {}\n f = open(path_to_embedding, encoding='utf-8')\n for line in f:\n try:\n values = line.split()\n word = values[0]\n coefs = np.asarray(values[1:...
[ "0.64250535", "0.63307875", "0.6012205", "0.59973156", "0.59043014", "0.5786562", "0.57417053", "0.5724894", "0.57154804", "0.5696327", "0.56394887", "0.5635848", "0.5548168", "0.5541293", "0.5534547", "0.5517164", "0.5475266", "0.5466939", "0.54125106", "0.5383648", "0.53700...
0.5847938
5
r"""Apply the hard sigmoid function to input.
def hardsigmoid(input, inplace=False): return FunctionLib.apply( 'HardSigmoid', input.device, [input], outputs=[input if inplace else None], alpha=1. / 6., beta=0.5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(input, inplace=False):\n return FunctionLib.apply(\n 'Sigmoid', input.device, [input],\n outputs=[input if inplace else None])", "def hard_sigmoid(x):\n x = (0.2 * x) + 0.5\n x = F.threshold(-x, -1, -1)\n x = F.threshold(-x, 0, 0)\n return x", "def sigmoid(x):\n retu...
[ "0.80894077", "0.7951312", "0.78221464", "0.78221464", "0.7819268", "0.7770174", "0.7760276", "0.77378976", "0.77297324", "0.77159405", "0.77159405", "0.77159405", "0.77159405", "0.77159405", "0.77159405", "0.7710882", "0.77062887", "0.77031165", "0.7698375", "0.76947874", "0...
0.8654183
0
r"""Apply the composite of logarithm and softmax to input.
def log_softmax(input, dim, inplace=False): return FunctionLib.apply( 'LogSoftmax', input.device, [input], outputs=[input if inplace else None], axis=dim)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(inputs):\n return np.exp(inputs) / float(sum(np.exp(inputs)))", "def softmax(inputs):\n return np.exp(inputs) / float(sum(np.exp(inputs)))", "def softmax(x):\n \"\"\"\"\"\"\n return exp(x) / sum(exp(x), axis=0)", "def softmax(inputs):\n # Your code pass\n # 对向量的每个元素归一化,先...
[ "0.71724147", "0.71724147", "0.7116447", "0.6964141", "0.6947973", "0.6946497", "0.6882925", "0.68721914", "0.6845333", "0.6842002", "0.6842002", "0.6824814", "0.6824814", "0.6824814", "0.6824814", "0.6824814", "0.6824814", "0.6824814", "0.6824814", "0.6811273", "0.68048394",...
0.71576583
2
r"""Pad the input according to the given sizes.
def pad(input, pad, mode='constant', value=0): ndim = input.ndimension() pads_begin, pads_end = [0] * ndim, [0] * ndim for i in range(len(pad) // 2): pads_begin[ndim - 1 - i] = pad[i * 2] pads_end[ndim - 1 - i] = pad[i * 2 + 1] mode = {'constant': 'CONSTANT', 'reflect': 'REFLECT', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(size, value):\n return (value + size - 1)/size*size", "def pad(plain, size):\n offset = size - (len(plain) % size)\n return plain + chr(offset) * offset", "def wrap_pad(input, size):\n M1 = tf.concat([input[:, :, -size[1]:, :], input, input[:, :, 0:size[1], :]], 2)\n M1 = tf.concat([M1[:...
[ "0.7171839", "0.68146545", "0.6789705", "0.66900754", "0.667438", "0.66301286", "0.6561065", "0.6443874", "0.64412755", "0.6316012", "0.627691", "0.62747955", "0.62624496", "0.6235029", "0.6217416", "0.6213305", "0.6173451", "0.6168228", "0.6163619", "0.615822", "0.61428016",...
0.0
-1
r"""Apply parametric rectified linear unit to input.
def prelu(input, weight): return FunctionLib.apply('PRelu', input.device, [input, weight])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rectified_linear_unit(x):\r\n # TODO\r\n return(max(0,x))", "def __call__(self, x):\n if self.W.data is None:\n in_size = functools.reduce(operator.mul, x.shape[1:], 1)\n self._initialize_params(in_size)\n return linear.linear(x, self.W, self.b)", "def rectified_li...
[ "0.56634676", "0.55331546", "0.5529746", "0.5515971", "0.54260683", "0.535713", "0.5265965", "0.5264894", "0.5231824", "0.5196171", "0.51897967", "0.5181318", "0.5145442", "0.51351285", "0.5131469", "0.51311266", "0.5102792", "0.5093369", "0.5074015", "0.50522906", "0.5051210...
0.0
-1
r"""Apply the sigmoid function to input.
def sigmoid(input, inplace=False): return FunctionLib.apply( 'Sigmoid', input.device, [input], outputs=[input if inplace else None])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(x):\r\n #pred_x = (np.exp(x) - np.exp(-x)) / (np.exp(x) + np.exp(-x))\r\n pred_x = 1.0 / (1.0 + np.exp(-x))\r\n return pred_x\r\n pass", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\r\n return 1 / (1 + np.exp(-x)...
[ "0.8157151", "0.815461", "0.815461", "0.81402355", "0.81262636", "0.81251985", "0.8111566", "0.8104822", "0.81041235", "0.81039155", "0.8098754", "0.80976367", "0.80976367", "0.80976367", "0.80976367", "0.80976367", "0.80976367", "0.8093672", "0.808155", "0.8028085", "0.80163...
0.84198445
0
r"""Compute the sigmoid focal loss with sparse labels.
def sigmoid_focal_loss( input, target, alpha=0.25, gamma=2., weight=None, size_average=None, start_index=0, reduce=None, reduction='valid', ): if size_average is not None or reduce is not None: reduction = _reduction.legacy_get_string(size_average, reduce) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def focal_loss_sigmoid(labels, logits, alpha=0.5, gamma=2):\n\n prob = logits.sigmoid()\n labels = torch.nn.functional.one_hot(labels.squeeze().long(), num_classes=prob.shape[1])\n\n cross_ent = torch.clamp(logits, min=0) - logits * labels + torch.log(1+torch.exp(-torch.abs(logits)))\n prob_t = (la...
[ "0.71321917", "0.7093262", "0.6633947", "0.65949", "0.6584017", "0.65449595", "0.64796317", "0.64272046", "0.63746697", "0.63526267", "0.63237005", "0.6298054", "0.6298054", "0.62878186", "0.6272728", "0.62723005", "0.62723005", "0.62723005", "0.62723005", "0.62723005", "0.62...
0.6522867
6
r"""Apply the sigmoid linear unit to input.
def silu(input): return FunctionLib.apply('Silu', input.device, [input])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(input, inplace=False):\n return FunctionLib.apply(\n 'Sigmoid', input.device, [input],\n outputs=[input if inplace else None])", "def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "d...
[ "0.80268824", "0.77496886", "0.7746871", "0.7746871", "0.7740873", "0.7735992", "0.7733483", "0.77136153", "0.7711808", "0.77068734", "0.7700224", "0.7695171", "0.7694648", "0.7682478", "0.7682478", "0.7682478", "0.7682478", "0.7682478", "0.7682478", "0.7679615", "0.7661875",...
0.0
-1
r"""Apply the softmax function to input.
def softmax(input, dim, inplace=False): return FunctionLib.apply( 'Softmax', input.device, [input], outputs=[input if inplace else None], axis=dim)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(x):\n #pass # TODO: Compute and return softmax(x)\n return np.exp(x) / np.sum(np.exp(x), axis=0)", "def softmax(x):\n \"\"\"\"\"\"\n return exp(x) / sum(exp(x), axis=0)", "def softmax(x): \n return np.exp(x) / np.sum(np.exp(x), axis=0)", "def softmax(x):\r\n ...
[ "0.8264099", "0.82065403", "0.81856155", "0.8172896", "0.8162891", "0.81533456", "0.81320536", "0.81202364", "0.8104102", "0.8104102", "0.8104102", "0.8104102", "0.8104102", "0.8104102", "0.8104102", "0.8104102", "0.81020945", "0.81020945", "0.8095041", "0.80907416", "0.80886...
0.841033
0
Build VAE = encoder + decoder + vae_loss
def _build_model(self): # Build Encoder inputs = Input(shape=(self.n_features_,)) # Input layer layer = Dense(self.n_features_, activation=self.hidden_activation)( inputs) # Hidden layers for neurons in self.encoder_neurons: layer = Dense(neurons,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_and_compile_vae(self):\n z_dimension = int(self.n_dims//2)+1\n\n self.encoder, inputs, z_mean, z_var = self._encoder(z_dimension, self.mcd)\n\n self.decoder, outputs = self._decoder(inputs, z_dimension, self.mcd)\n\n self.model = Model(inputs, outputs, name=\"VAE IMPUTER\")\n...
[ "0.8243037", "0.68461365", "0.66015685", "0.6523023", "0.62951744", "0.62521744", "0.62478775", "0.62023884", "0.6195851", "0.6177701", "0.61707133", "0.6160874", "0.6093952", "0.60430026", "0.59880006", "0.5972288", "0.59566015", "0.5952833", "0.59501654", "0.58542556", "0.5...
0.65911645
3
Round a datetime object to any time laps in seconds
def roundTime(dt=None, roundTo=60): if dt == None : dt = datetime.datetime.now() seconds = (dt - dt.min).seconds # // is a floor division, not a comment on following line: rounding = (seconds+roundTo/2) // roundTo * roundTo dt + datetime.timedelta(0,rounding-second...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_time(time):\n t_min = time.minute % 5\n t_sec = time.second\n t_mic = time.microsecond\n time = time - timedelta(minutes=t_min, seconds=t_sec, microseconds=t_mic)\n return time", "def _round_time(dt=None, round_to=60):\n if hasattr(dt, 'tzinfo'):\n dt.replace(tzinfo=None)\n ...
[ "0.74292034", "0.72201437", "0.7187189", "0.7071502", "0.70527256", "0.7039349", "0.68839186", "0.687624", "0.685757", "0.6757203", "0.6480596", "0.64093435", "0.63737726", "0.6337756", "0.62954307", "0.6294884", "0.6241491", "0.62292844", "0.6213652", "0.6170456", "0.6164732...
0.71589094
3
Round a datetime object to any time laps in seconds
def roundTime(dt=None, roundTo=60): if dt == None : dt = datetime.datetime.now() seconds = (dt - dt.min).seconds # // is a floor division, not a comment on following line: rounding = (seconds+roundTo/2) // roundTo * roundTo return dt + datetime.timedelta(0,rou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_time(time):\n t_min = time.minute % 5\n t_sec = time.second\n t_mic = time.microsecond\n time = time - timedelta(minutes=t_min, seconds=t_sec, microseconds=t_mic)\n return time", "def _round_time(dt=None, round_to=60):\n if hasattr(dt, 'tzinfo'):\n dt.replace(tzinfo=None)\n ...
[ "0.74292034", "0.72201437", "0.7187189", "0.71589094", "0.70527256", "0.7039349", "0.68839186", "0.687624", "0.685757", "0.6757203", "0.6480596", "0.64093435", "0.63737726", "0.6337756", "0.62954307", "0.6294884", "0.6241491", "0.62292844", "0.6213652", "0.6170456", "0.616473...
0.7071502
4
Randomly initialize the LBM model and variationnal parameters.
def _init_LBM_random(self, n1, n2, nq, nl, nb_ones): eps_1 = 1e-2 / n1 eps_2 = 1e-2 / n2 alpha_1 = (self._np.ones(nq) / nq).reshape((nq, 1)) alpha_2 = (self._np.ones(nl) / nl).reshape((1, nl)) tau_1 = self._np.random.uniform(size=(n1, nq)) ** 2 tau_1 /= tau_1.sum(axis=1)....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_parameters(self):\n for i in range(1, self.L):\n self.W[i - 1] = np.random.randn(self.layer_dims[i], self.layer_dims[i - 1]) * 0.01\n self.b[i - 1] = np.zeros((self.layer_dims[i], 1))", "def initializeWeights(mlModel):\n\n randInitRange = mlModel.randInitRange\n\n ...
[ "0.6830697", "0.67434275", "0.6667895", "0.6575137", "0.64593416", "0.6400432", "0.6391768", "0.63335735", "0.62968785", "0.62917453", "0.6282881", "0.6282866", "0.6200315", "0.6192509", "0.61925", "0.61759675", "0.6128037", "0.61205316", "0.61205316", "0.61205316", "0.610299...
0.68578535
0
Returns a copy of the model.
def copy(self): model = LBM( n_row_clusters=self.n_row_clusters, n_column_clusters=self.n_column_clusters, max_iter=self.max_iter, n_init=self.n_init, n_init_total_run=self.n_init_total_run, n_iter_early_stop=self.nb_iter_early_stop, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n new_model = Model(\n name=self.name,\n functions=copy.deepcopy(self.functions),\n domain=self.domain.copy(),\n density=self.density.copy(),\n )\n new_model.update()\n\n return new_model", "def clone(self):\n return _...
[ "0.8543849", "0.84137756", "0.7987762", "0.7848592", "0.7686054", "0.764714", "0.7518212", "0.74770737", "0.7470365", "0.7470365", "0.7470365", "0.7456633", "0.7456633", "0.7456633", "0.7456633", "0.743308", "0.7431004", "0.74092996", "0.74092996", "0.7405514", "0.74039346", ...
0.71084404
83
Load the training data into pandas DataFrames.
def __init__(self, feature_selection=True, clinical_path='data/tidy/train_cli.csv', proteomic_path='data/tidy/train_pro.csv', rna_path='data/tidy/train_rna.csv', mismatch_path='data/tidy/sum_tab_1.csv', test_proteomic_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(args) -> pd.DataFrame:\n\n df = pd.read_csv(os.path.join(args.data_dir, args.training_file), delimiter=\"\\t\").sample(frac=1, random_state=args.random_seed).reset_index(drop=True)\n df_test = pd.read_csv(os.path.join(args.data_dir, args.testing_file), delimiter=\"\\t\")\n\n # startified val...
[ "0.7290695", "0.7172334", "0.7125734", "0.7074254", "0.7070494", "0.70487684", "0.6976454", "0.6856729", "0.6817604", "0.6802518", "0.6802518", "0.6798619", "0.6789632", "0.67561597", "0.675587", "0.675044", "0.67149955", "0.6713223", "0.66921693", "0.6638781", "0.66356754", ...
0.0
-1
Normalize each column into roughly [1.0, 1.0] centered around 0.0.
def normalize(self, df): return (df - df.mean()) / (df.max() - df.min())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalise(x):\n x = np.copy(x)\n n_cols = x.shape[1]\n for col_index in range(n_cols):\n col = x[:, col_index]\n factor = np.max(col)\n x[:, col_index] = col / factor\n\n return x", "def normalizeColumns(W):\n for i in range(W.shape[1]):\n W[:, i] /= np.linalg.norm(...
[ "0.76790047", "0.75072354", "0.74424016", "0.7401769", "0.738595", "0.73849434", "0.73720634", "0.737123", "0.7362824", "0.7362824", "0.73594344", "0.7342005", "0.7226741", "0.71751434", "0.71619254", "0.71619254", "0.715494", "0.715236", "0.71468616", "0.7138", "0.7114321", ...
0.7423873
3
Return the initial estimages of parameters to be refined for this frame
def get_x0(self): from xfel.cxi.postrefine.mod_leastsqr import prep_input from xfel.cxi.postrefine.test_rs import calc_spot_radius a_star = sqr(self.orientation.reciprocal_matrix()) miller_indices = self.miller_array.indices() spot_radius = calc_spot_radius(a_star, miller_indices, self.wavelength) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_parameters(self):\n return self._initial_parameters", "def recoverParams(self):\n self.shape, self.rate = self.posterior[1] + 1, -self.posterior[0]", "def get_initial_params(self, x, y, yerr):\n estimated_height = max(y)\n y1 = map(int, y *1000)\n estimated_positi...
[ "0.66962445", "0.6666156", "0.6228862", "0.6228862", "0.6102147", "0.60714555", "0.60399663", "0.60087705", "0.5939458", "0.59192914", "0.5900483", "0.58851665", "0.58702064", "0.5864475", "0.5837283", "0.5827749", "0.5812604", "0.5798921", "0.5787811", "0.57839376", "0.57694...
0.0
-1
Get current run state.
def _get_run_state(self): if not self._run_state: state = self.lookup_enum(["State", "state"]) if not state: self._run_state = STATE_DISHWASHER_POWER_OFF else: self._run_state = state return self._run_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state(self):\n return self._env.get_state()", "def get_current_state(self):\n return self._current_state", "def get_current_state(self):\n return self.game.get_current_state()", "def get_state(self):\n return self.env.sim.get_state()", "def get_current_state(self):\n ...
[ "0.8044872", "0.7973345", "0.79697686", "0.78499836", "0.77975625", "0.77106464", "0.76119226", "0.7602612", "0.75981814", "0.7592718", "0.75753564", "0.7575198", "0.7575198", "0.7574362", "0.7560948", "0.75504", "0.75151485", "0.7506284", "0.7506284", "0.7506284", "0.7506284...
0.74632627
23
Return minute initial time.
def initialtime_min(self): return self._get_time_info(["Initial_Time_M", "initialTimeMinute"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MINUTE(time):\n return _make_datetime(time).minute", "def getMinute(self):\n return _libsbml.Date_getMinute(self)", "def minute(self) -> int:\r\n return self._minute", "def get_minute(self):\n\n # First we get the first 8 bits stored in the minute register\n # and translate i...
[ "0.7449618", "0.72936636", "0.7269373", "0.718579", "0.7172708", "0.7038206", "0.70348656", "0.70348656", "0.70348656", "0.70348656", "0.69821894", "0.67240936", "0.67166716", "0.66924185", "0.6684537", "0.66503394", "0.664964", "0.6648116", "0.6639523", "0.65989166", "0.6565...
0.80797535
0
Return hour reserved time.
def reservetime_hour(self): return self._get_time_info(["Reserve_Time_H", "reserveTimeHour"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hour(self):\n return \"%s:00:00\" % self.timestamp[:13]", "def hour(self) -> int:\n return pulumi.get(self, \"hour\")", "def get_hour_today() -> str:\n return datetime.now().strftime(\"%H\")", "def hour(self) -> int:\r\n return self._hour", "def hour(self) -> int:\r\n ...
[ "0.71878135", "0.70029706", "0.6913823", "0.6901592", "0.6901592", "0.68942165", "0.6884703", "0.687418", "0.6792223", "0.6713945", "0.66753066", "0.66351604", "0.6625625", "0.6625625", "0.6625625", "0.65861046", "0.65464854", "0.6467843", "0.64672446", "0.64450455", "0.64304...
0.82742125
0
Return minute reserved time.
def reservetime_min(self): return self._get_time_info(["Reserve_Time_M", "reserveTimeMinute"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MINUTE(time):\n return _make_datetime(time).minute", "def get_minute(time):\n m = time[4] + (time[3]*60) + (time[2]*60*24) * time[1] * time[0]\n return m", "def getMinute(self):\n return _libsbml.Date_getMinute(self)", "def get_minute(self):\n\n # First we get the first 8 bits stored...
[ "0.73375547", "0.68311155", "0.67657065", "0.6731555", "0.67059034", "0.66879284", "0.6623251", "0.6603561", "0.6480532", "0.64482164", "0.6434304", "0.6427498", "0.6421625", "0.6421625", "0.6421625", "0.6421625", "0.635119", "0.63110065", "0.6255719", "0.6250382", "0.6212609...
0.7332861
1
Return current run state.
def run_state(self): run_state = self._get_run_state() if STATE_DISHWASHER_POWER_OFF in run_state: run_state = StateOptions.NONE return self._update_feature(WashDeviceFeatures.RUN_STATE, run_state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state(self):\n return self._env.get_state()", "def state(self) -> RunState:\n return self._async_scheduler.state", "def get_state(self):\n return self.env.sim.get_state()", "def get_current_state(self):\n return self._current_state", "def get_current_state(self):\n ...
[ "0.764026", "0.7608723", "0.7584185", "0.75462747", "0.7546251", "0.75007325", "0.7460319", "0.7442854", "0.74373645", "0.74256086", "0.7414044", "0.73823124", "0.7329727", "0.7314073", "0.72667015", "0.72667015", "0.7257132", "0.7246678", "0.7240237", "0.72148645", "0.717836...
0.0
-1
Return current error message.
def error_msg(self): if not self.is_error: error = StateOptions.NONE else: error = self._get_error() return self._update_feature(WashDeviceFeatures.ERROR_MSG, error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_error_message(self):\n\n return self.err_message", "def get_error_message(self):\n return self.error_message.get_error_message()", "def error_message(self) -> str:\n return self._error_message", "def error_message(self) -> str:\n return pulumi.get(self, \"error_message\")"...
[ "0.85122126", "0.8404663", "0.83976895", "0.8365827", "0.8365827", "0.8365827", "0.83305883", "0.8288979", "0.82823473", "0.82516134", "0.80052084", "0.80052084", "0.80052084", "0.80052084", "0.80052084", "0.80052084", "0.80052084", "0.7981391", "0.7981391", "0.7942575", "0.7...
0.72023666
41
returns the verbosity level for the application
def verbose( self ): return Verbose.__level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verbosity(self):\n return self._get('verbosity')", "def verbosity(self):\n return self._verbosity", "def logging_verbosity(self):\n\n return self.get_raw(\"logging_verbosity\")", "def verbosity(v):\n assert v in [0,1,2] # debug, warn, info\n GLOBAL['VERBOSITY'] = v", "def ...
[ "0.8197492", "0.79568106", "0.76362604", "0.75130254", "0.73579353", "0.733171", "0.72384864", "0.7171709", "0.7098925", "0.70909417", "0.68829465", "0.6838042", "0.660714", "0.65924084", "0.65752625", "0.6525807", "0.6521431", "0.64616066", "0.6394454", "0.6279348", "0.62052...
0.7171638
8
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant.
def precision(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1))) precision = true_positives / (predicted_positives + K.epsilon()) return precision
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)", "def comp...
[ "0.74906194", "0.7289004", "0.7160026", "0.7153636", "0.70664865", "0.69872606", "0.696703", "0.6955486", "0.6913438", "0.683529", "0.68184656", "0.6810287", "0.68057126", "0.68057126", "0.68057126", "0.68057126", "0.68057126", "0.68057126", "0.67864585", "0.675569", "0.67556...
0.6758343
26
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected.
def recall(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) possible_positives = K.sum(K.round(K.clip(y_true, 0, 1))) recall = true_positives / (possible_positives + K.epsilon()) return recall
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t...
[ "0.7605249", "0.74491084", "0.7405392", "0.7281231", "0.72096574", "0.716614", "0.71576375", "0.7145557", "0.7145557", "0.7145557", "0.7145557", "0.7145557", "0.7145557", "0.71319014", "0.7101232", "0.70974207", "0.70974207", "0.70974207", "0.70974207", "0.70974207", "0.70974...
0.70628613
42
Basic test case for _GetPortageEnvVar function.
def testGetPortageEnvVar(self): stage = self.ConstructStage() board = self._current_board envvar = 'EXAMPLE' rc_mock = self.StartPatcher(cros_build_lib_unittest.RunCommandMock()) rc_mock.AddCmdResult(['portageq-%s' % board, 'envvar', envvar], output='RESULT\n') result ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_environment_string(self):\n pass", "def test_environ() -> None:\n os.environ[\"TEST\"] = \"tester\"\n assert os.getenv(\"TEST\") == \"tester\"", "def getenv(space, var):\n e = os.environ.get(var)\n if e is None:\n return space.w_False\n return space.newstr(e)", "def ...
[ "0.7136267", "0.6721173", "0.66267234", "0.65088505", "0.6474452", "0.6370629", "0.6335231", "0.6298478", "0.6283475", "0.62627774", "0.6255816", "0.62556237", "0.62448245", "0.62285626", "0.62112993", "0.6185357", "0.61800927", "0.61720765", "0.61714715", "0.6152691", "0.611...
0.80791813
0
Merge other dict with self
def merge_dict(own: dict, other: dict) -> dict: for element in other: if own.get(element, None) is None: own[element] = other[element] else: raise ValueError('Conflicting kwargs') return own
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _merge(self, other: dict):\n self._storage = dict_merge(self._storage, other)", "def update(self, other):\n _merge_dicts(self, other)", "def merge_two_dicts(self, x, y):\n z = x.copy()\n z.update(y)\n return z", "def mergedict(x, y):\n z = x.copy()\n z.update(y)\n...
[ "0.85541844", "0.7914095", "0.77960443", "0.75815874", "0.7570534", "0.7513104", "0.74766093", "0.73298365", "0.72854775", "0.72798103", "0.72626877", "0.7237087", "0.7237087", "0.72219723", "0.7220527", "0.7209097", "0.7209097", "0.7209097", "0.7209097", "0.7209097", "0.7209...
0.7372927
7
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8195189", "0.8096179", "0.80311364", "0.80207354", "0.79955184", "0.799279", "0.7982649", "0.7977064", "0.7962826", "0.7958447", "0.7939309", "0.79364014", "0.7936101", "0.7932949", "0.7927847", "0.792615", "0.7925553", "0.79244494", "0.7924244", "0.79234385", "0.79194653"...
0.79085964
24
Get an existing AppServicePlan resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'AppServicePlan': opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = dict() __props__["free_offer_expiration_time"] = None __pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n additional_locations: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ServiceAdditionalLocationArgs']]]]] = None,\n certificates: Optional[pulumi.Input[S...
[ "0.57290375", "0.5710548", "0.5656689", "0.5628976", "0.5623351", "0.56181014", "0.560099", "0.5595483", "0.5561368", "0.55420697", "0.55345184", "0.54926866", "0.54758227", "0.5450106", "0.5411644", "0.5382765", "0.5371309", "0.5320858", "0.5299524", "0.5294666", "0.52929103...
0.7191034
0
Geographical location for the App Service plan.
def geo_region(self) -> pulumi.Output[str]: return pulumi.get(self, "geo_region")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cal_location(self):\n return self.location.name", "def location(self) -> str:\n return pulumi.get(self, \"location\")", "def location(self) -> str:\n return pulumi.get(self, \"location\")", "def location(self) -> str:\n return pulumi.get(self, \"location\")", "def location(s...
[ "0.724661", "0.7085838", "0.7085838", "0.7085838", "0.7085838", "0.7085838", "0.7085838", "0.7085838", "0.7085838", "0.7085838", "0.7085838", "0.7085838", "0.7085838", "0.7085838", "0.6978101", "0.69435763", "0.6863276", "0.6806949", "0.6806949", "0.6806949", "0.6798617", "...
0.0
-1
Specification for the App Service Environment to use for the App Service plan.
def hosting_environment_profile(self) -> pulumi.Output[Optional['outputs.HostingEnvironmentProfileResponse']]: return pulumi.get(self, "hosting_environment_profile")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_environment():\n namespace = current_app.config.get('POD_NAMESPACE').lower()\n if namespace.endswith('dev'):\n return 'DEV'\n if namespace.endswith('test'):\n return 'TEST'\n if namespace.endswith('tools'):\n return 'SANDBOX'\n return ''"...
[ "0.63267326", "0.62592775", "0.6152408", "0.5996348", "0.5969418", "0.5969418", "0.5969418", "0.5901923", "0.5838675", "0.5800287", "0.57192075", "0.5712205", "0.56596595", "0.56596595", "0.5653121", "0.56256473", "0.55968755", "0.5590464", "0.55750215", "0.55750215", "0.5575...
0.0
-1
Maximum number of instances that can be assigned to this App Service plan.
def maximum_number_of_workers(self) -> pulumi.Output[int]: return pulumi.get(self, "maximum_number_of_workers")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_instance_count(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"max_instance_count\")", "def max_instance_count(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"max_instance_count\")", "def max_count(self):\n return self.config.get('max_count', 500...
[ "0.78948367", "0.78948367", "0.70457363", "0.6994073", "0.6918854", "0.6908444", "0.68151224", "0.6798898", "0.6796091", "0.6675283", "0.6660098", "0.66394424", "0.6612029", "0.6554477", "0.65514547", "0.65103114", "0.6498872", "0.6476233", "0.6476233", "0.6476233", "0.647623...
0.6873039
6
Number of apps assigned to this App Service plan.
def number_of_sites(self) -> pulumi.Output[int]: return pulumi.get(self, "number_of_sites")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAppCount(self):\n logger.debug('Getting the number of apps discovered...')\n return get_text(get_element_by_css(\"span[data-nsmodule='totalAppCount']\"))", "def deployed_app_count(self):\n if \"deployedAppCount\" in self._prop_dict:\n return self._prop_dict[\"deployedAppCou...
[ "0.72554183", "0.71319366", "0.6945194", "0.6725981", "0.6636547", "0.65384436", "0.63", "0.6173378", "0.615106", "0.61007833", "0.6096796", "0.6009178", "0.5995984", "0.5993739", "0.59642744", "0.594903", "0.59157157", "0.5902345", "0.5900447", "0.5898395", "0.58721286", "...
0.5787416
25
If true, apps assigned to this App Service plan can be scaled independently. If false, apps assigned to this App Service plan will scale to all instances of the plan.
def per_site_scaling(self) -> pulumi.Output[Optional[bool]]: return pulumi.get(self, "per_site_scaling")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale(self, app: Application) -> bool:\n pass", "def scale(self, _: Application) -> bool:\n return False", "def scaling_enabled(self):\n return False", "def scale(self, app: Application) -> bool:\n\n changed = False\n\n if self.max_nranks:\n app.mpi_ranks = m...
[ "0.72969997", "0.7269339", "0.6734259", "0.66752565", "0.66700554", "0.65106124", "0.61596847", "0.6019654", "0.5999613", "0.59901965", "0.59586", "0.59282225", "0.5816758", "0.579915", "0.5798835", "0.5789448", "0.57616717", "0.5669938", "0.5669938", "0.5632145", "0.561097",...
0.58527833
13
Initialise the notification binary_sensor.
def __init__(self, api, coordinator, name, dev_id, binary_sensor, model): super().__init__( api, coordinator, name, dev_id, False, binary_sensor, None, model ) self._attributes = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize(self):\n self.flush()\n print(\"Initializing sensor...\")\n try:\n self.get_sample()\n print('Initialization successful')\n except:\n print('Initialization failed. Please disconnect and reconnect sensor.')", "def initialize(self):\n ...
[ "0.6897996", "0.68686163", "0.66113603", "0.65066206", "0.6491397", "0.6454278", "0.6362223", "0.6361235", "0.63572985", "0.63518715", "0.63193005", "0.6273549", "0.62524164", "0.6229923", "0.6206946", "0.6199336", "0.61901677", "0.61808354", "0.61409384", "0.6128215", "0.611...
0.5698499
78
Return the state attributes.
def device_state_attributes(self): return self._attributes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_attributes(self):\n return self._attributes", "def state_attributes(self):\n return self._attributes", "def device_state_attributes(self):\r\n return self.attributes", "def device_state_attributes(self):\n return self._state_attrs", "def device_state_attributes(self):\...
[ "0.8953404", "0.8953404", "0.85239846", "0.8366765", "0.8366765", "0.8363429", "0.83362615", "0.8334551", "0.8310377", "0.8292682", "0.8289349", "0.8289349", "0.8273077", "0.82236886", "0.8223562", "0.8205066", "0.8184393", "0.81659013", "0.8102565", "0.8064994", "0.8064994",...
0.82871646
20
Return true if the binary_sensor is on.
def is_on(self): return getattr(self._node, STICK_API[USB_MOTION_ID][ATTR_STATE])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_on(self):\n return self._sensor_state()", "def is_on(self):\n return getattr(self.coordinator.data[0], self._sensor) is True", "def is_on(self):\n data = self.sensor_data\n if data and data[\"model\"] == \"SML\" and data[\"changed\"]:\n return data[\"state\"] == ST...
[ "0.7884619", "0.7740934", "0.74744123", "0.7355086", "0.711196", "0.7103455", "0.70885575", "0.70885575", "0.70885575", "0.70857835", "0.70182335", "0.70182335", "0.70131624", "0.6916831", "0.6902558", "0.6866156", "0.68592364", "0.68461555", "0.6827404", "0.68255574", "0.681...
0.6812347
21
Gets the instance_group of this InstanceGroupAdjustment. name of the instance group
def instance_group(self): return self._instance_group
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group_name(self):\n return self.groupname", "def instance_group(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"instance_group\")", "def group_name(self):\n\n return self._group_name", "def get_group(self):\n return self._group", "def group_name(self) -> str:\n ...
[ "0.7614599", "0.754568", "0.7523818", "0.7462292", "0.7337843", "0.7278929", "0.7230947", "0.7230947", "0.7230947", "0.72081053", "0.72081053", "0.71454126", "0.7095452", "0.7086733", "0.7055093", "0.7051869", "0.7036893", "0.69629997", "0.69391316", "0.6882258", "0.6882258",...
0.7617951
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, InstanceGroupAdjustment): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Test the BSBLan configuration entry unloading.
async def test_unload_config_entry( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: entry = await init_integration(hass, aioclient_mock) assert hass.data[DOMAIN] await hass.config_entries.async_unload(entry.entry_id) await hass.async_block_till_done() assert not hass.data.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_unload_entry(opp, nzbget_api):\n entry = await init_integration(opp)\n\n assert len(opp.config_entries.async_entries(DOMAIN)) == 1\n assert entry.state is ConfigEntryState.LOADED\n\n assert await opp.config_entries.async_unload(entry.entry_id)\n await opp.async_block_till_done()\n\n ...
[ "0.7041483", "0.66955966", "0.6618876", "0.653744", "0.6507313", "0.64824146", "0.6479773", "0.64394236", "0.6366993", "0.6290416", "0.6280121", "0.6245817", "0.6207921", "0.61921537", "0.6184587", "0.61777985", "0.61771244", "0.6153141", "0.61505836", "0.61372113", "0.612225...
0.68803066
1
Convert AB magnitude [ABSOLUTE] to restframe luminosity.
def MAB_to_L(self, mag, z=None, dL=None): assert (z is not None) or (dL is not None) if z is not None: dL = self.cosm.LuminosityDistance(z) # Apparent magnitude m = mag + 5. * (np.log10(dL / cm_per_pc) - 1.) # Luminosity! return 10**(m / -2.5) * flux_AB * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _value_as_luminance(self):\n return round(float(self._value), 1)", "def app_mag(abs_mag, phase_angle, slope_g, d_ast_sun, d_ast_earth):\n\n # Compute the apparent / visual magnitude\n mag = red_mag(abs_mag, phase_angle, slope_g) \\\n + 5.0 * np.log10(d_ast_sun * d_ast_earth)\n\n # Re...
[ "0.5966299", "0.59467286", "0.5803559", "0.5785793", "0.5767002", "0.57316047", "0.5709128", "0.5673359", "0.5616612", "0.56047904", "0.5519201", "0.5516444", "0.5513975", "0.54990464", "0.5495292", "0.541064", "0.53913414", "0.53854954", "0.5381503", "0.53592443", "0.5353577...
0.640297
0
Return first observed pair (t, x), still in queue.
def sample(self): if self.do_filter: if len(self.t_filtered) > 0: yield self.t_filtered.popleft(), self.x_filtered.popleft() else: yield None, None else: # let's not filter if len(self.t) > 0: yield self.t.popleft(), se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek(self): # total: O(1)\n return self._queue[self._start] #O(1)", "def first(self):\n if self.is_empty():\n raise Empty('Queue is empty')\n return self._data[self._front]", "def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass", "def peek(s...
[ "0.62607014", "0.61503196", "0.6140623", "0.612124", "0.60441554", "0.600568", "0.6000461", "0.6000461", "0.59809357", "0.5956261", "0.58923316", "0.58604616", "0.58444226", "0.5832202", "0.58286065", "0.5806295", "0.58058816", "0.5803953", "0.5793435", "0.57870173", "0.57819...
0.0
-1
now = datetime.datetime.now() birth_date = datetime.datetime(year=1991, month=12, day=7, hour=13) delta = now birth_date bd = Event("Birth date", birth_date) age_years = delta.total_seconds()/60/60/365.25/24
def main(): t = Task("Clean Garage") t.datetime_start = datetime.datetime(2017, 10, 10) t.datetime_end = datetime.datetime(2018, 5, 12) for k, v in t.__dict__.items(): print(k, v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def age(self):\n return datetime.now().year - self.birth_day.year", "def compute_age(epoch):\n birth_date = datetime.datetime.fromtimestamp(epoch/1000)\n now = datetime.datetime.now()\n age = (now - birth_date).days / 365\n return age", "def age(self):\n today = date.today()\n ...
[ "0.72155315", "0.6858989", "0.68535894", "0.6696562", "0.66254866", "0.6610578", "0.6495561", "0.64837456", "0.6457723", "0.6439189", "0.640517", "0.63811177", "0.63758624", "0.63030636", "0.6239629", "0.62373155", "0.6222188", "0.62114227", "0.61905265", "0.6164338", "0.6159...
0.0
-1
Creates a sanitized path of both destination directory and filename. This function replaces nonprintable and other characters defined in _DIRTY_CHARACTERS with an underscore "_".
def _CreateSanitizedDestination( self, source_file_entry, source_path_spec, destination_path): file_system = source_file_entry.GetFileSystem() path = getattr(source_path_spec, u'location', None) path_segments = file_system.SplitPath(path) # Sanitize each path segment. for index, path_segment ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_directory_path(path):\n allowed = string.digits + string.ascii_letters + string.whitespace\n stripped = \"\".join(c for c in path if c in allowed)\n return stripped.replace(\" \", \"_\")", "def sanitize_fname(directory, fname):\n return opath.join(\n bytes(directory, enco...
[ "0.6775777", "0.6745234", "0.6449432", "0.6441605", "0.6386014", "0.6355329", "0.6355329", "0.63542557", "0.6328465", "0.630671", "0.6287807", "0.6266574", "0.62636364", "0.6241424", "0.6240826", "0.62348145", "0.61986953", "0.6173473", "0.61657506", "0.6128106", "0.61162317"...
0.6990354
0
Generate batches of data. Given a list of arraylike objects, generate batches of a given size by yielding a list of arraylike objects corresponding to the same slice of each input.
def batch_generator(data, batch_size, shuffle=True): if shuffle: data = shuffle_aligned_list(data) batch_count = 0 while True: if batch_count * batch_size + batch_size >= len(data[0]): batch_count = 0 if shuffle: data = shuffle_aligned_list(data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_batches(data, batch_size):\n data = np.array(data)\n\n for i in range(0, data.shape[0], batch_size):\n yield data[i:i+batch_size]", "def batches(iterable, size):\n sourceiter = iter(iterable)\n while True:\n batchiter = islice(sourceiter, size)\n yield chain([next(batchit...
[ "0.7913559", "0.7735626", "0.75815535", "0.7544984", "0.7544984", "0.7544984", "0.75427717", "0.7540418", "0.7522112", "0.74630684", "0.7429418", "0.73907006", "0.7369802", "0.7312263", "0.7281441", "0.7249911", "0.7216067", "0.72040963", "0.7152612", "0.7140532", "0.71337605...
0.7228953
17
Plot images in a grid of a given shape.
def imshow_grid(images, shape=[2, 8]): fig = plt.figure(1) grid = ImageGrid(fig, 111, nrows_ncols=shape, axes_pad=0.05) size = shape[0] * shape[1] for i in range(size): grid[i].axis('off') grid[i].imshow(images[i]) # The AxesGrid object work as a list of axes. plt.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotgrid(data,d=10,shape=(30,30)):\n ion()\n gray()\n clf()\n for i in range(min(d*d,len(data))):\n subplot(d,d,i+1)\n row = data[i]\n if shape is not None: row = row.reshape(shape)\n imshow(row)\n ginput(1,timeout=0.1)", "def plot_grid(im_list, grid_shape, scale=0....
[ "0.7484121", "0.74046993", "0.73620325", "0.6860462", "0.684499", "0.67779976", "0.6769338", "0.67463005", "0.67150784", "0.67113155", "0.670916", "0.66835725", "0.661467", "0.66104794", "0.66089", "0.6584181", "0.6518732", "0.65097487", "0.6443745", "0.64390516", "0.6341405"...
0.7639835
1
Assert that a property on the OEM paritition matches allowed values.
def AssertOemProperty(self, name, values, oem_no_mount): if not name: raise ValueError("must specify an OEM property") if not values: raise ValueError("must specify the OEM value") if oem_no_mount: get_prop_command = 'getprop("%s")' % name else: get_prop_command = 'file_getprop(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAddingPropertyFields(self):\n map_sheet = self.properties[PROPERTY_SHEET]\n for key, value in PROPS.items():\n self.failUnless(map_sheet.hasProperty(key) and list(map_sheet.getProperty(key)) == value)", "def testRequired(self):\n prop = make_prop()\n with self.assertRaises(...
[ "0.6416141", "0.6385663", "0.63321966", "0.6252355", "0.62245715", "0.6182595", "0.61146265", "0.58727515", "0.5868431", "0.58225745", "0.57879716", "0.5777534", "0.57046825", "0.56732374", "0.5632829", "0.5614199", "0.56101924", "0.56025565", "0.55756867", "0.5575597", "0.55...
0.7282858
0
creates some test data in a temporary folder. This function is called automatically before the tests are run.
def setUpClass(self): # Create a new temporary folder self.dir = tempfile.mkdtemp(self.__name__, dir=os.getcwd()) # this folder should be on a hadoop file system if self.dir.startswith("/gpfs/"): # remove /gpfs/ because on sdil hadoop-path starts at "/smartdata/" self.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_temp_file():\n global TEST_DATA_PATH\n TEST_DATA_PATH = tempfile.mkstemp()", "def setUp(self):\n self.tmp = TemporaryDirectory()", "def setUp(self):\n self.tmpdir = mkdtemp()", "def setUp(self):\n if not isdir(tmp_dir_path):\n os.mkdir(tmp_dir_path)\n sel...
[ "0.82624257", "0.7658081", "0.74822265", "0.7382916", "0.7260009", "0.7250378", "0.71764344", "0.7164233", "0.71398365", "0.71366143", "0.7080097", "0.7060086", "0.7056444", "0.7056444", "0.70551836", "0.7037593", "0.7037565", "0.69585913", "0.6934195", "0.69309133", "0.69309...
0.65483856
66
Shows a single product.
def product(category_slug, product_slug): prod = Product.by_slug_and_cat(category_slug, product_slug) return render_template('frontend/product.html', product=prod)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_detail(request, product_id):\n product = get_object_or_404(Product, pk=product_id)\n\n context = {\n 'product': product,\n }\n\n return render(request, 'products/product_detail.html', context)", "def product_view(request, product):\n product = Products.objects.get(product=produc...
[ "0.83005804", "0.8247606", "0.8232875", "0.80034554", "0.78125614", "0.780981", "0.734413", "0.7215662", "0.70673805", "0.70370495", "0.70294654", "0.70257854", "0.7005329", "0.6967435", "0.6949782", "0.6931588", "0.69206446", "0.68139", "0.6736751", "0.6719651", "0.67141825"...
0.72669184
7
shows the mean class images on a single plot
def plot_images(images_dict, plotting=True): fig, axs = plt.subplots(len(images_dict), sharex=True, sharey=True) for key, fig in zip(images_dict, range(len(images_dict))): image = images_dict[key] axs[fig].imshow(image) if plotting: plt.plot() return fig, axs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_sample_images(self):\n if self.train_dataset is None:\n self.init_datasets()\n\n images, labels = next(self.train_dataset)\n plt.figure(figsize=(5,5))\n for n in range(min(25, images.shape[0])):\n ax = plt.subplot(5,5,n+1)\n plt.imshow(images...
[ "0.6937243", "0.68812406", "0.6740296", "0.66632783", "0.64958906", "0.6475996", "0.6420258", "0.640326", "0.63776517", "0.63432646", "0.619122", "0.614448", "0.61298907", "0.6125381", "0.6118477", "0.61049944", "0.60688937", "0.59758514", "0.59501517", "0.5943565", "0.594116...
0.0
-1
Return a batch of data. When dataset end is reached, start over.
def next(self, batch_size): if self.batch_id == len(self.data): self.batch_id = 0 batch_data = (self.data[self.batch_id:min(self.batch_id + batch_size, len(self.data))]) batch_labels = (self.labels[self.batch_id:min(self.batch_id + batch_size, len(self.data))]) batch_seqlen =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Batch(dataset, batch_size, drop_last=False):\n\n return dataset.batch(batch_size=batch_size, drop_remainder=drop_last)", "def get_batch(self, idxs):\r\n return self.data[(self.start + idxs) % self.maxlen]", "def get_batch(X, Y, iteration):\n offset = 100\n start = iteration * offset % len(Y...
[ "0.75088954", "0.7216718", "0.7174731", "0.7077746", "0.7076612", "0.70406866", "0.69428563", "0.6859179", "0.6850791", "0.6730221", "0.669502", "0.6648573", "0.6635658", "0.6623825", "0.66061085", "0.6602157", "0.65850383", "0.657099", "0.65697217", "0.65535486", "0.65219486...
0.65235
21
Return a batch of data. When dataset end is reached, start over.
def next(self, batch_size): if self.batch_id == len(self.data): self.batch_id = 0 batch_data = (self.data[self.batch_id:min(self.batch_id + batch_size, len(self.data))]) batch_labels = (self.labels[self.batch_id:min(self.batch_id + batch_size, len(self.data))]) batch_seqlen =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Batch(dataset, batch_size, drop_last=False):\n\n return dataset.batch(batch_size=batch_size, drop_remainder=drop_last)", "def get_batch(self, idxs):\r\n return self.data[(self.start + idxs) % self.maxlen]", "def get_batch(X, Y, iteration):\n offset = 100\n start = iteration * offset % len(Y...
[ "0.750772", "0.72174037", "0.7176143", "0.7077677", "0.70767546", "0.70392084", "0.6941587", "0.68593496", "0.6851331", "0.6730295", "0.6696889", "0.66474146", "0.6635386", "0.6623784", "0.6605644", "0.6602627", "0.65864515", "0.65714574", "0.6571034", "0.6551777", "0.6521244...
0.6524279
20
Add post form should be valid for new user.
def test_valid_add_post_form(self, proto_post, proto_user): testfile = ( b"\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x00\x00\x00\x21\xf9\x04" b"\x01\x0a\x00\x01\x00\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02" b"\x02\x4c\x01\x00\x3b" ) data = { "tit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_post(request):\n if request.session.get('id_user') is None:\n request.session['res'] = 'Warn'\n messages.add_message(request, messages.WARNING,\n \"The session has expired\")\n return HttpResponseRedirect(reverse('home'))\n form = PostForm(request.POST...
[ "0.7758752", "0.7426635", "0.7139664", "0.7111356", "0.7111278", "0.7062138", "0.6995754", "0.6990302", "0.69612545", "0.69040644", "0.6854454", "0.6827446", "0.68178016", "0.6806136", "0.6771159", "0.6727292", "0.67259437", "0.6722513", "0.6715259", "0.662533", "0.6602418", ...
0.71394855
3
Fixture for baked Comment model.
def proto_comment(self, proto_user, proto_post): return baker.make(Comment, user=proto_user, post=proto_post)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.comment = Comment()\n self.comment.comment_description = 'This is a test comment'\n self.post = create_post()\n self.post.user = self.create_user()\n self.post.save()\n self.comment.post = self.post\n self.comment.user = self.user\n se...
[ "0.736787", "0.6774098", "0.667587", "0.65992755", "0.6562571", "0.65589195", "0.65039736", "0.6443268", "0.6426852", "0.63261217", "0.6308769", "0.6302988", "0.62212145", "0.62080127", "0.61963046", "0.6117623", "0.61051434", "0.60783327", "0.6067946", "0.60462135", "0.60462...
0.6026035
21
Should return list of products when user is authenticated with Basic auth
def test_list_basic_auth(self): headers = { 'HTTP_AUTHORIZATION': 'Basic ' + base64.b64encode(b'test:test').decode("ascii") } expected = { 'count': 2, 'next': None, 'previous': None, 'results': [ { 'i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_list(request):\n if request.method == 'GET':\n _products = Product.objects.all()\n serializer = ProductSerializer(_products, many=True)\n return Response(serializer.data, status=status.HTTP_200_OK)\n\n return Response(status=status.HTTP_405_METHOD_NOT_ALLOWED)", "def list_p...
[ "0.73845947", "0.72134966", "0.72012395", "0.7091781", "0.70805347", "0.70736545", "0.7019989", "0.6959495", "0.6955658", "0.69374645", "0.69327396", "0.68803996", "0.6858718", "0.6852992", "0.68261105", "0.6814444", "0.6811382", "0.67910504", "0.67694217", "0.6767503", "0.67...
0.6994506
7
Should return list of products when user is authenticated with Token auth
def test_list_token_auth(self): token = Token.objects.create(user=self.user_1) headers = { 'HTTP_AUTHORIZATION': 'Token ' + str(token) } expected = { 'count': 2, 'next': None, 'previous': None, 'results': [ { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_list(request):\n error = {\n 'status': False,\n 'name': None,\n 'text': None,\n 'level': None,\n 'debug': None\n }\n\n limit, error = get_limit(request, error)\n\n serializer = FreshSerializer()\n queryset = Product.objects.all()[:limit]\n\n if not q...
[ "0.7282902", "0.7235862", "0.7203875", "0.7183432", "0.7156193", "0.7143123", "0.7142645", "0.7124954", "0.7080105", "0.7032852", "0.70188487", "0.69722784", "0.69694805", "0.69249266", "0.6914114", "0.68604624", "0.68529665", "0.6840477", "0.68140876", "0.6807114", "0.679338...
0.6954797
13
Should return 401 when provided APIClient credentials are invalid
def test_list_api_client_auth_invalid_credentials(self): api_client = APIClient.objects.create( name='test', accesskey='a' * 32, secretkey='s' * 32) headers = {'secretkey': 'INVALID-SECRETKEY'} response = self.client.get( '/api/products/?accesskey={}'.format('INVALID-ACC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_call_unauthenticated(self):\n\n with Client('username', 'password') as client:\n self.setSessionResponse(401)\n with self.assertRaises(APIError):\n data = client.call(**self.build_parameters)", "def test_instantiate401(self):\n bad_config = lob_python.C...
[ "0.7363557", "0.7223623", "0.72072923", "0.71086425", "0.70149237", "0.70011276", "0.6913864", "0.6909355", "0.6878723", "0.6850469", "0.6850469", "0.6839984", "0.6834164", "0.68291247", "0.6823918", "0.68169403", "0.68118954", "0.67776144", "0.676219", "0.6758526", "0.675790...
0.78211755
0
Should return 403 when trying to retrieve product data with NOT odd id
def test_detail_odd_product_id_permission(self): self.assertEqual(self.product_2.id, 2) token = Token.objects.create(user=self.user_1) headers = { 'HTTP_AUTHORIZATION': 'Token ' + str(token) } response = self.client.get( '/api/products/{}/'.format(self.pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_security_on_get(self):\n # test the listing url\n product = Product.objects.all()[0]\n url = '/product/xml/'\n response = self.client.get(url)\n self.failUnlessEqual(response.status_code, 401)\n # test the product detail url\n url = '/product/xml/%s/' % pro...
[ "0.71695715", "0.68654996", "0.6848436", "0.6736747", "0.6436925", "0.63845617", "0.6355374", "0.6340724", "0.6301647", "0.625949", "0.6238184", "0.62259114", "0.6189167", "0.61871624", "0.61332285", "0.6115308", "0.6067344", "0.6056607", "0.60183525", "0.60042006", "0.599271...
0.7476734
0
Should return 403 when a non admin user tries to create a product
def test_create_not_admin(self): self.assertEqual(Product.objects.count(), 2) payload = { 'name': 'New product', 'category': self.category_1.id, 'sku': '11111111', 'description': 'New product description', 'price': 39.99 } toke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_only_admin_can_create_product(self):\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='denims',\n stock=20,\n price=150\n )\n ...
[ "0.7858901", "0.74386656", "0.71572113", "0.6744433", "0.6705456", "0.6672319", "0.654055", "0.6463193", "0.63810766", "0.637129", "0.63538116", "0.6352268", "0.632451", "0.63050807", "0.62410426", "0.6231317", "0.6225348", "0.6209865", "0.61834675", "0.61495364", "0.61220026...
0.7587683
1
get_data_from_row(x) Helper function to extract data from cells.
def get_data_from_row(x): import re data = [] x = re.findall("<(TD|td)[^>*]+>(.*?)(</(td|TD)>)", x, re.S) for rec in [tmp[1] for tmp in x]: if len(rec) == 0: data.append(None) continue # If no value if re.match("[-]+", rec): data.append(None)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_datapoints(sheet, row, col):\n rowc = _FIELDS['cell_value']['datapoints']['row']\n # Data can start on two different rows. Try first option and then next row.\n if sheet.cell(row + rowc, col).value:\n start_row = row + rowc\n final_row = row + rowc\n else:\n start_row = ro...
[ "0.6253455", "0.60393095", "0.59488595", "0.58800644", "0.5756069", "0.5740555", "0.57401764", "0.572934", "0.56825244", "0.56747067", "0.5655564", "0.565309", "0.5600345", "0.5594082", "0.55751634", "0.55577815", "0.550283", "0.54898304", "0.54707295", "0.54410183", "0.54348...
0.76344615
0
Ensure boxplot method creates correct boxplot.
def test_boxplot(self): values = [37, 48, 30, 53, 3, 83, 19, 71, 90, 16, 19, 7, 11, 43, 43] result = boxplot(values) self.assertEqual(3, result['min_val']) self.assertEqual(17.5, result['q1_val']) self.assertEqual(37, result['mean_val']) self.assertEqual(50.5, result['q3_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_box_plots(categorical_var, numerical_var):\n\n sns.boxplot(x=categorical_var, y=numerical_var, palette=\"Set2\")\n\n plt.show()", "def box_plots(norm, original):\n bp = plt.boxplot([norm, original], notch=False, patch_artist=True)\n for box in bp['boxes']:\n box.set(color=\...
[ "0.74556", "0.7281648", "0.71461874", "0.68902576", "0.6852831", "0.6843435", "0.68276644", "0.68205494", "0.6737267", "0.66802907", "0.66190803", "0.65740037", "0.65723455", "0.65608275", "0.6543584", "0.654097", "0.65406674", "0.6513018", "0.64843005", "0.64686406", "0.6442...
0.77577245
0
Go back to login page.
def goBack(self): self.displayUi = LoginScreen() self.hide() self.displayUi.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_back(self):\n self.displayUi = LoginScreen()\n DB.log_out()\n self.hide()\n self.displayUi.show()", "def page_back(self):\n self.password_entry.hide_password()\n self.pager_frame.change_to_page(Welcome)", "def post_login(self, came_from='/'):\n if not req...
[ "0.76966846", "0.71566474", "0.69595146", "0.69226754", "0.6787304", "0.6757747", "0.67275214", "0.66269314", "0.6587169", "0.65680933", "0.65172803", "0.6432948", "0.6429299", "0.6419182", "0.64125377", "0.64125377", "0.6411985", "0.6393476", "0.63835335", "0.6376773", "0.63...
0.7338138
1
Reset internal stats variables to their initial values.
def reset(self): self.pred_classes.clear() self.gold_classes.clear() self.pred_probas.clear() self.gold_probas.clear() self.loss = 0 self.nb_batches = 0 self.prec_rec_f1 = None self.acc = None self.mcc = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats_reset(self):\n self.stats.reset()", "def stats_reset(self):\n self.stats.reset()", "def reset_stats() -> None:\n STATS[\"cleaned\"] = 0\n STATS[\"null\"] = 0\n STATS[\"unknown\"] = 0", "def reset(self):\n self.sum_metric = 0.\n self.num_inst = 0.\n self.m...
[ "0.8119415", "0.8119415", "0.8092611", "0.80221564", "0.79551476", "0.78616405", "0.7858947", "0.7793384", "0.772833", "0.7642302", "0.76413196", "0.7578741", "0.7566325", "0.75635815", "0.756335", "0.75604135", "0.75505936", "0.7537277", "0.75206286", "0.7495109", "0.7489095...
0.7138554
77
String representation of the class instance
def __str__(self): return str(f'Token({self.type}, {self.value})')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k,v in class_dictionary.items():\n if v > 0:\n out += ' : ' + str(k) + ' = ' + str(v)\n return out", "def __repr__(self):\n outl = 'class :'+self.__class__.__name_...
[ "0.8187196", "0.8105794", "0.8012798", "0.8012798", "0.8012798", "0.8012798", "0.8012798", "0.8000445", "0.7990798", "0.7987651", "0.79754084", "0.79545295", "0.79545295", "0.79545295", "0.7945915", "0.79142505", "0.7912164", "0.78745496", "0.78730536", "0.7871885", "0.786324...
0.0
-1
Return a `RequestContext` subclass for a specified request.
def with_request(cls, request): # Subclasses `RequestContext` with a value for `request`, so that it # does not need it as an explicit request argument for initialization. return type( cls.__name__, (cls,), {'request': request, '__module__': cls.__module__})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_from_request(cls, request: HttpRequest) -> BaseContext:\n\n return cast(\n BaseContext,\n cls.objects.create(\n performed_by_id=getattr(request.user, \"id\", None),\n context_type=\"http-request\",\n context={\n ...
[ "0.65404594", "0.6459419", "0.64536005", "0.57912415", "0.5646513", "0.5646513", "0.56184983", "0.5587388", "0.5544032", "0.5513704", "0.5512074", "0.54976994", "0.54615515", "0.5432914", "0.5366975", "0.5309852", "0.52400804", "0.5194007", "0.5185652", "0.517897", "0.5162998...
0.7453318
0
Set a fit calibration into the calibration file. data should contain a `fit` key/value formatted according to the cal schema `fit` object. This function will add the fit into the fits list for a given calibration.
async def on_setfitcalibrations(sid, data): try: calibrations = [] with open(os.path.join(LOCATION, CALIBRATIONS_FILENAME)) as f: calibrations = json.load(f) for calibration in calibrations: if calibration["name"] == data["name"]: if calibr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addFit(self, fitdata, name='default'):\n if not hasattr(self, 'fits'):\n self.fits={}\n self.fits[name] = fitdata\n return", "def fit(self, data):\n raise NotImplementedError(\"To be implemented in sub classes\")", "def set_data(self, data_name, data, scratch_dir=None...
[ "0.7082027", "0.57823944", "0.57547396", "0.5639045", "0.5600142", "0.5560476", "0.5547562", "0.5529404", "0.5500446", "0.5491704", "0.5414475", "0.5353127", "0.53501254", "0.53252864", "0.5321121", "0.5313475", "0.52625626", "0.5235871", "0.5233953", "0.5229926", "0.5229926"...
0.64055306
1
The Y Power Gate YPowGate = {{1, 0}, {0, exp(ipitheta)}} Performs the rotation along Y axis with some global phase shift
def YPowGate(self, theta:Union[int, float], qubit_expr): self.apply_gate_operation(cirq.ops.YPowGate(exponent=theta), qubit_expr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y_rotmat(theta):\n cos_t = np.cos(theta)\n sin_t = np.sin(theta)\n return np.array([[cos_t, 0, sin_t],\n [0, 1, 0],\n [-sin_t, 0, cos_t]])", "def apply_rotation_y(self, phi=0.0 ):\n \n phi = radians(phi)\n new_rotation_matrix = [[ +...
[ "0.6477519", "0.6456203", "0.61491597", "0.6132028", "0.6108547", "0.59176177", "0.5794693", "0.5777148", "0.57662255", "0.57642514", "0.57409555", "0.573315", "0.5703519", "0.56733125", "0.563206", "0.56191385", "0.5579036", "0.5577216", "0.55599236", "0.55360854", "0.551034...
0.698677
0
Returns the qasm string of the circuit
def to_qasm_str(self): return qasm(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_qasm_noname(self):\n q_program = QuantumProgram(specs=self.QPS_SPECS_NONAMES)\n qc = q_program.get_circuit()\n\n qrn = list(q_program.get_quantum_register_names())\n self.assertEqual(len(qrn), 1)\n qr = q_program.get_quantum_register(qrn[0])\n\n crn = list(q_p...
[ "0.68475837", "0.65476245", "0.6426011", "0.6393123", "0.63454723", "0.6330998", "0.6265832", "0.6171315", "0.5990657", "0.59842426", "0.59749675", "0.58780754", "0.5826766", "0.5823144", "0.5816047", "0.5783323", "0.57714313", "0.57670456", "0.576395", "0.57571524", "0.57455...
0.78283775
0
Sets the version of this GroupModel.
def version(self, version): self._version = version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version(self, version):\n \n self._version = version", "def version(self, version):\n self._version = version", "def version(self, version):\n self._version = version", "def version(self, version: int):\n\n self._version = version", "def version(self, version: str):\n...
[ "0.6830814", "0.6757423", "0.6757423", "0.662891", "0.65751976", "0.65751976", "0.6549486", "0.62164354", "0.61901075", "0.61757094", "0.6086725", "0.60358244", "0.59905744", "0.5948987", "0.5948987", "0.5948987", "0.594068", "0.5869415", "0.58654255", "0.57721454", "0.576632...
0.6708211
20
Sets the name of this GroupModel.
def name(self, name): if name is not None and len(name) > 255: raise ValueError("Invalid value for `name`, length must be less than or equal to `255`") # noqa: E501 if name is not None and len(name) < 1: raise ValueError("Invalid value for `name`, length must be greater than or ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_group_name(self, name):\n self.groupname = name", "def set_group_name(self, name):\n params = [('groupname', name, 'cdata')]\n\n self.get(COMMAND_UIC, 'SetGroupName', params)", "def set_name(self, name: str):\n self._name = name", "def set_name(self, name):\n self._...
[ "0.8214496", "0.7869435", "0.77135277", "0.7711789", "0.77075845", "0.77075845", "0.77075845", "0.77075845", "0.77075845", "0.7663026", "0.7662493", "0.7649865", "0.7639145", "0.7639145", "0.75805247", "0.757948", "0.7531414", "0.7451502", "0.7437939", "0.74193287", "0.741417...
0.0
-1
Sets the providertype of this GroupModel.
def providertype(self, providertype): allowed_values = ["external"] # noqa: E501 if providertype not in allowed_values: raise ValueError( "Invalid value for `providertype` ({0}), must be one of {1}" # noqa: E501 .format(providertype, allowed_values) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_group_type(self, item_group_type):\n\n self._item_group_type = item_group_type", "def set_type(self, rtype=ALL_USERS):\r\n self.type = rtype", "def set_projection_type(self, p_type):\n self.scenes[self.current_scene].set_projection_type(p_type)", "def set_type(self, type):\n ...
[ "0.6143198", "0.58883405", "0.58339894", "0.56197476", "0.56197476", "0.5588444", "0.5568696", "0.5515527", "0.55023485", "0.5494397", "0.5456374", "0.5401751", "0.53965855", "0.53646356", "0.5336094", "0.5301755", "0.5297561", "0.52783334", "0.5200048", "0.51981777", "0.5192...
0.696661
0