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
Repeatedly go through all of the nodes in the graph, moving each of the nodes that has all its edges resolved, onto a sequence that forms our sorted graph. A node has all of its edges resolved and can be moved once all the nodes its edges point to, have been moved from the unsorted graph onto the sorted one.
def topological_sort(graph_unsorted): # This is the list we'll return, that stores each node/edges pair # in topological order. graph_sorted = [] # Convert the unsorted graph into a hash table. This gives us # constant-time lookup for checking if edges are unresolved, and # for removing nodes ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort(self):\n while self.nodes != []:\n iterated = False\n for node in self.leaf_nodes():\n iterated = True\n self.prune_node(node)\n yield node\n if not iterated:\n raise CyclicGraphError(\"Sorting has found a ...
[ "0.6613276", "0.6437548", "0.63618904", "0.6345087", "0.6304695", "0.6194403", "0.61315155", "0.6113515", "0.6079442", "0.60552853", "0.60526454", "0.6005303", "0.5966694", "0.5962036", "0.5949624", "0.5948216", "0.5860762", "0.5841874", "0.58376145", "0.5835875", "0.5815481"...
0.5418986
64
Get neurons belonging to the layer.
def get_layer_neurons(self): return self.neurons
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neurons(self):\n return Neurons(self)", "def getNets(self):\n\t\treturn NetLoader.listNetworks()", "def layers(self) ->Optional[nn.ModuleList]:\n return self._layers", "def all_nodes(self):\n nodes = []\n for layer in self.layers:\n nodes += layer.nodes\n ret...
[ "0.78304404", "0.6300797", "0.62689537", "0.6206035", "0.61814815", "0.61683255", "0.60638213", "0.60436", "0.6020484", "0.6020484", "0.6020484", "0.6020484", "0.6003423", "0.59858376", "0.59631395", "0.59414876", "0.5932493", "0.59302354", "0.5912934", "0.59047455", "0.58946...
0.7291759
1
Set up the sensor platform.
def setup_platform(hass, config, add_entities, discovery_info=None): name = config.get(CONF_NAME) token_path = hass.config.path(config.get(CONF_TOKEN_FILE)) latitude = hass.config.latitude longitude = hass.config.longitude token_cache = load_json(token_path) if not token_cache or "authenticatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_sensors(self, configs):\n self.__sensors = self.setup_components(configs, 'scale_client.sensors')", "def setup_platform(\n hass: HomeAssistant,\n config: ConfigType,\n add_entities: AddEntitiesCallback,\n discovery_info: DiscoveryInfoType | None = None,\n) -> None:\n name = config...
[ "0.7161019", "0.7153022", "0.7074793", "0.70394534", "0.6980015", "0.6920045", "0.6886565", "0.6856597", "0.6846495", "0.6802126", "0.68020207", "0.67781997", "0.67361474", "0.67136997", "0.6710023", "0.67098296", "0.67015344", "0.66937983", "0.66696876", "0.6668303", "0.6638...
0.6456089
37
Return the unit of measurement of the VOI Nearest Scooter Sensor.
def unit_of_measurement(self): return LENGTH_METERS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_of_measurement(self):\n return SENSOR_TYPES[self.sensor][1]", "def unit_of_measurement(self):\r\n return self._sensor_cfg[1]", "def unit_of_measurement(self):\r\n return self._sensor_cfg[1]", "def unit_of_measurement(self):\n return SENSOR_TYPES[self._sensor][0]", "def ...
[ "0.7405097", "0.7368658", "0.7368658", "0.73627526", "0.734061", "0.734061", "0.73093665", "0.7297122", "0.7297122", "0.72949886", "0.72949886", "0.72464526", "0.72460246", "0.7216707", "0.7161493", "0.7161493", "0.7160686", "0.7156156", "0.7076827", "0.69368684", "0.6896939"...
0.634553
71
Return the state of the VOI Nearest Scooter Sensor.
def state(self): return self._state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state(self):\n value = getattr(self.coordinator.senec, self._sensor)\n try:\n rounded_value = round(float(value), 2)\n return rounded_value\n except ValueError:\n return value", "def state(self):\n result = self.probe.get_data(SENSOR_TYPES[self.sen...
[ "0.6882881", "0.6773381", "0.65848166", "0.64114964", "0.61915034", "0.6179189", "0.61541003", "0.614475", "0.6131281", "0.60582405", "0.5974168", "0.592368", "0.5917211", "0.59099895", "0.59012455", "0.58858436", "0.58766145", "0.5855284", "0.5837838", "0.5823838", "0.580470...
0.0
-1
Return the state attributes of the VOI Nearest Scooter Sensor.
def extra_state_attributes(self): return self._attributes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\n return self._emeter_params", "def state_attributes(self):\n return self._vehicle.data", "def device_state_attributes(self):\n # Move these to Thermostat Device and make them global\n return {\n \"current_humidity\": self._current_humidity,...
[ "0.68113834", "0.67895806", "0.67589045", "0.6739182", "0.6735796", "0.672453", "0.672377", "0.672377", "0.6683253", "0.66687787", "0.66495854", "0.6597718", "0.6596731", "0.65964895", "0.6578635", "0.657821", "0.656692", "0.6558389", "0.6545357", "0.65449363", "0.653957", ...
0.0
-1
Aggregate a list of dict to form a new dict
def aggregate_dict(x): agg_x = {} for ele in x: assert isinstance(ele, dict) for k, v in ele.items(): if k not in agg_x: agg_x[k] = [] if isinstance(v, (tuple, list)): agg_x[k].extend(list(v)) else: agg_x[k].a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_dicts(listDicts) :\n return dict(itertools.chain.from_iterable([x.items() for x in listDicts]))", "def sum_dicts(l):\n r = defaultdict(int)\n for d in l:\n for k, v in d.iteritems():\n r[k] += v\n return r", "def sum_dicts(*args):\n result = dict()\n for arg in arg...
[ "0.68939185", "0.6841379", "0.6595016", "0.6568", "0.65669394", "0.647345", "0.6471317", "0.64245915", "0.6387298", "0.63848794", "0.6320118", "0.62052476", "0.6188071", "0.6160425", "0.61553997", "0.6150982", "0.61195767", "0.6104078", "0.6092732", "0.60756314", "0.60691243"...
0.75325274
0
Load dataframe from sql db
def load_data(database_filepath): # load data from database engine = create_engine('sqlite:///' + database_filepath) sql = "SELECT * FROM message" df = pd.read_sql_query(sql, engine) X = df.message Y = df[df.columns.tolist()[4:]] ''' ndf = df.groupby('genre').count() key = [x fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_sql(df):\n engine = create_engine(f'postgres://{user}:{user}@{host}:{port}/{db}')\n df = df.to_sql(table, engine, if_exists='append')\n logging.debug(str(df)) # logging\n # return df\n #print(df.shape)", "def query_to_df(db, sql):\n conn_string = return_connection(db)\n with pg2.co...
[ "0.78740615", "0.74224997", "0.7400016", "0.73261946", "0.73221415", "0.73079914", "0.72367465", "0.718216", "0.7153455", "0.7138383", "0.7107526", "0.70990133", "0.7080693", "0.7047139", "0.69143814", "0.6912695", "0.689276", "0.6884844", "0.6860483", "0.68394965", "0.681429...
0.0
-1
Function returns after performing preprocessing steps on text including tolower, tokenization, stopwords removal and lemmatize
def tokenize(text): text = text.lower() text = re.sub(r"[^a-zA-Z0-9]", " ", text) words = word_tokenize(text) words = [w for w in words if w not in stopwords.words("english")] stemmed = [WordNetLemmatizer().lemmatize(w) for w in words] return(stemmed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocessing(raw_text):\n words_list = tokenize(raw_text)\n words_list = remove_stop_words(words_list)\n words_list = remove_punctuations(words_list)\n words_list = lemmatization(words_list)\n return words_list", "def pre_process(text):\n # replace (,.'\") with ''\n text = text.replace(...
[ "0.7872508", "0.78258264", "0.7742564", "0.7630598", "0.7572216", "0.7552324", "0.74621046", "0.74440384", "0.7430718", "0.731632", "0.7299168", "0.7286178", "0.7250405", "0.72252214", "0.7134336", "0.7086957", "0.70571774", "0.7049251", "0.7039261", "0.70091194", "0.70027757...
0.0
-1
By default, treat self as a whole labeled mutable in the format dict. Subclass can override this to dry run the mutation upon the model and return the mutated model for the followedup dry run. See Also nni.mutable.Mutable.leaf_mutables
def leaf_mutables(self, is_leaf: Callable[[Mutable], bool]) -> Iterable[LabeledMutable]: # Same as `leaf_mutables` in LabeledMutable. return super().leaf_mutables(is_leaf)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_immutable(self):\n # just set the flag to make object immutable and hashable\n self.immutable = True", "def sync(self):\n if not self.is_readonly():\n deser = self._deserialize()\n orig = getattr(self.model, self.name)\n if (orig != deser):\n ...
[ "0.5607227", "0.55874276", "0.55772644", "0.55392027", "0.55359834", "0.5512423", "0.5358014", "0.53020614", "0.5296474", "0.5288524", "0.5271814", "0.5266043", "0.5260885", "0.5243035", "0.5230716", "0.5179477", "0.5138952", "0.5127837", "0.51050174", "0.5087397", "0.5087287...
0.50156146
25
Apply this mutator on a model. The model will be copied before mutation and the original model will not be modified. Returns The mutated model.
def apply(self, model: GraphModelSpace) -> GraphModelSpace: assert self.sampler is not None copy = model.fork() copy.status = ModelStatus.Mutating self._cur_model = copy self._cur_choice_idx = 0 self._cur_samples = [] # Some mutate() requires a full mutation hist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutate(self, model: GraphModelSpace) -> None:\n raise NotImplementedError()", "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 ...
[ "0.69871736", "0.6506618", "0.6329708", "0.6284967", "0.61843365", "0.590766", "0.5863779", "0.58012813", "0.5797277", "0.57606184", "0.5729818", "0.5671089", "0.5669199", "0.5611073", "0.5611073", "0.5611073", "0.5611073", "0.5611073", "0.558845", "0.55877686", "0.5563613", ...
0.79065555
0
Return nodes this link connects.
def nodes(self) -> tuple[Node, Node]: self.lab.sync_topology_if_outdated() return self.node_a, self.node_b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodes(self):\n return self.graph.nodes", "def nodes(self):\n return list(self.__graph.keys())", "def get_nodes(self):\n try:\n return list(self._adjacency_list.keys())\n except Exception as error:\n print(f'An error occurred: {error}')", "def nodes(self):...
[ "0.75398123", "0.75054216", "0.742572", "0.7343231", "0.7343231", "0.7343231", "0.7330424", "0.7314622", "0.7307725", "0.72914404", "0.7268514", "0.7262883", "0.72387296", "0.7231556", "0.7221255", "0.7136115", "0.710924", "0.7083615", "0.7050493", "0.70160896", "0.69960517",...
0.64496106
72
Creates and saves a User with the given username, email and password.
def _create_user(self, username, email, password, is_staff, is_superuser, **extra_fields): now = timezone.now() if not username: raise ValueError('The given username must be set') email = self.normalize_email(email) user = self.model(username=username, em...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se...
[ "0.8602843", "0.8470665", "0.8463091", "0.8418386", "0.8414608", "0.83932084", "0.83469605", "0.83462346", "0.83156294", "0.8307248", "0.8289807", "0.82777566", "0.8271559", "0.8258315", "0.8213312", "0.81987464", "0.81766754", "0.8172822", "0.81634855", "0.8163284", "0.81379...
0.78138345
96
Returns true iff all of the files have been created.
def is_done(self): return_val = False for name in os.listdir(self.results_dir_path): if name.startswith('top_genes_per_phenotype'): return_val = True return return_val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_files(self):\n if self.file_list is None:\n self._set_file_list()\n for individual_file in self.file_list:\n if not os.path.exists(os.path.join(self.base_dir, individual_file)):\n return False\n return True", "def valid(self):\r\n if s...
[ "0.7144649", "0.7046809", "0.70008105", "0.6751728", "0.65991586", "0.65457255", "0.6496147", "0.6496147", "0.6496147", "0.63998175", "0.6346952", "0.63279134", "0.63219327", "0.6281517", "0.6213937", "0.6201962", "0.61999214", "0.6178057", "0.6161244", "0.6127489", "0.611648...
0.5740589
60
Freezes the trainable weigths of the model.
def freeze(self): # Freeze. self.frozen = True for param in self.parameters(): param.requires_grad = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_weights(self):\n\t\tpass", "def reset_weights(self):\n self.policy_backbone.reset_weights()\n self.value_backbone.reset_weights()\n self.action_head.reset_weights()\n self.critic_head.reset_weights()", "def _set_weights(self):\n self.Wc = torch.mm(self.TP.T, self.W...
[ "0.7135174", "0.6750816", "0.6725807", "0.6663738", "0.6618206", "0.6525988", "0.650068", "0.6496958", "0.64957803", "0.64631295", "0.64481777", "0.6441139", "0.6419228", "0.6418764", "0.6410529", "0.6405995", "0.6368522", "0.6349879", "0.6344502", "0.63138664", "0.62988096",...
0.5926056
59
Summarizes the model by showing the trainable/nontrainable parameters and weights\ per layer ( ``nn.Module`` ). Uses ``recursive_summarize`` to iterate through the nested structure of the model (e.g. for RNNs).
def summarize(self): # go recursively in the model architecture summary_str = self.recursive_summarize(self, 0, self.name) # Sum the model parameters. num_total_params = sum([np.prod(p.size()) for p in self.parameters()]) mod_trainable_params = filter(lambda p: p.requires_grad, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive_summarize(self, module_, indent_, module_name_):\n # Recursively inspect the children.\n child_lines = []\n for key, module in module_._modules.items():\n child_lines.append(self.recursive_summarize(module, indent_+1, key))\n\n # \"Leaf information\". \n ...
[ "0.7419983", "0.7368816", "0.73547745", "0.7342049", "0.61972356", "0.613911", "0.61181957", "0.6055124", "0.60027593", "0.5785426", "0.57806665", "0.5706913", "0.5679754", "0.56775373", "0.5633306", "0.5612236", "0.559684", "0.5585853", "0.5584681", "0.55792767", "0.55634075...
0.727457
4
Function to make conv layers easier to create. Returns a nn.Sequential object which has bnconvactivation.
def _conv(self, indim, outdim, ksize, stride, padding): return nn.Sequential( nn.BatchNorm2d(indim), nn.Conv2d(indim, outdim, ksize, stride, padding), self.activ(), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_conv_layers(self):\n conv = nn.Sequential(\n nn.Conv2d(in_channels=3, out_channels=64, kernel_size=7, stride=2, padding=1), # padding=3 so, output is 224.\n nn.LeakyReLU(0.1, inplace=True),\n nn.MaxPool2d(kernel_size=2, stride=2),\n\n nn.Conv2d(64, 192, ...
[ "0.7089747", "0.7085519", "0.69996214", "0.6955849", "0.69030976", "0.68885696", "0.68650013", "0.6762528", "0.6719642", "0.6662334", "0.6654965", "0.6629646", "0.6628744", "0.66165", "0.65915346", "0.6554148", "0.6527607", "0.65027875", "0.6497584", "0.64846075", "0.64634156...
0.6188095
50
stack the list of states to batch array
def _statck_state(self, list_states): batch_last_docs_prob = [] batch_last_turn = [] for ele in list_states: batch_last_docs_prob.append(ele.last_docs_prob) batch_last_turn.append(ele.last_turn) # (batch, num_docs) batch_last_docs_prob = torch.cat(batch_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_state_batch(self, batch):\n # batch = np.squeeze(batch, axis=1)\n batch = np.array([np.concatenate(obs, axis=-1) for obs in batch])\n return batch", "def batch_states(states, xp, phi):\n\n states = [phi(s) for s in states]\n return xp.asarray(states)", "def batch_...
[ "0.71692693", "0.6833224", "0.68109053", "0.6441453", "0.6217112", "0.6194971", "0.6174957", "0.614046", "0.6105812", "0.6105812", "0.6083424", "0.60784954", "0.60693157", "0.60217375", "0.60217375", "0.6019371", "0.59845746", "0.5951955", "0.59064054", "0.5863435", "0.581081...
0.0
-1
Create an instance of the outputs class. Optionally pass complex arrays hp and hc to initialize from.
def __init__(self, return_from_SimIMRPhenomPFrequencySequence=None, hp=None, hc=None): if((isinstance(hp, np.ndarray)) and (isinstance(hc, np.ndarray)) and (isinstance(return_from_SimIMRPhenomPFrequencySequence, type(None)))): self.hp = hp self.hc = hc elif((isinstance(hp, type(N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, inputs, outputs):\n \n self.inputs = inputs\n self.outputs = outputs\n\n self.dim_inp = inputs.dim_output\n self.dim_out = outputs.dim_output\n\n self.test_data_args = {'num_dat': 1000}\n\n self.__name__ = self.__class__.__name__", "def __init__...
[ "0.64967525", "0.63464916", "0.63252324", "0.63222164", "0.6247431", "0.6247398", "0.6182752", "0.60606307", "0.6000754", "0.5968652", "0.5952015", "0.59192383", "0.58633024", "0.5802689", "0.5798203", "0.5786307", "0.5785549", "0.57686824", "0.5762573", "0.5751965", "0.57361...
0.66962796
0
Return a string representation of the parameter set.
def __str__(self): return "chi1=%e chi2=%e m1=%e m2=%e distance=%e thetaJ=%e alpha0=%e chip=%e phic=%e fref=%e mode=%d freqs=[%e...%e]" % ( self.chi1, self.chi2, self.m1 / lal.lal.MSUN_SI, self.m2 / lal.lal.MSUN_SI, self.distance / (lal.lal.PC_SI * 100 * 1e6), self.thetaJ, self.alpha0, self.chip, se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\r\n res = [self.Name + ' parameters:']\r\n for t in self._tracked_properties:\r\n res.append(t + ':' + str(getattr(self, t)))\r\n for k, v in sorted(self.Params.items()):\r\n res.append(str(k) + ':' + str(v))\r\n return '\\n'.join(res)", "def _...
[ "0.72229785", "0.71939456", "0.7133364", "0.7098662", "0.69835883", "0.68385416", "0.6799313", "0.67616457", "0.67436475", "0.67436475", "0.67436475", "0.67436475", "0.67436475", "0.6687684", "0.668693", "0.6665526", "0.66096765", "0.6596699", "0.65507954", "0.6465189", "0.64...
0.0
-1
Tests that a missing parameter causes the request to do nothing.
def test_missing_parameters(self): # request request_body = { 'wwuid': self.student.wwuid, 'enroll_key': self.labgroup.enroll_key } response = self.client.post(reverse(self.view_name), request_body) # test response self.assertEqual(response.status_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_param(self) -> None:\n res = self.app.get('/model-parameters')\n self.assertEqual(400, res.status_code)", "def test_no_parameter(self):\n\n request = service.get_request('GET', {})\n x = self.start_request_tests(request)\n self.assertTrue(x.status_code >= 400)\n ...
[ "0.78010744", "0.75472516", "0.7221625", "0.6896734", "0.68467534", "0.6843462", "0.6766705", "0.65405655", "0.6535958", "0.6520028", "0.651325", "0.6477536", "0.64575565", "0.64234054", "0.6418913", "0.64170843", "0.63964784", "0.6369223", "0.63476235", "0.63316244", "0.6314...
0.67798424
6
Tests that entering invalid student does nothing.
def test_invalid_student(self): # request request_body = { 'wwuid': '123456789', # too long 'labgroup': self.labgroup.id, 'enroll_key': self.labgroup.enroll_key } response = self.client.post(reverse(self.view_name), request_body) # test respon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_careers_invalid_student(self):\n student_id = '1234567890'\n result = self.ucuenca.careers(student_id)\n self.assertFalse(result)", "def test_careers_invalid_student(self):\n student_id = '1234567890'\n result = self.ucuenca.schedule(student_id)\n self.assertFal...
[ "0.7274438", "0.72463053", "0.717515", "0.6744315", "0.6492324", "0.6489391", "0.6343447", "0.6340743", "0.6197275", "0.61943114", "0.61416674", "0.6141561", "0.6079231", "0.6070979", "0.60651654", "0.60646677", "0.6028525", "0.60180444", "0.59687185", "0.5952063", "0.5928128...
0.7147165
3
Compute area of grid cells in square meters. ulon and ulat are 1D arrays containing the edges of the grid cells in degrees.
def grid_area(ulon,ulat): R = 6371. * 1000. # radius of Earth in meters dlon = N.diff(ulon) dlat = N.diff(ulat) dx = N.outer(deg2rad * R * N.cos(deg2rad * ulat),dlon) # dx (meters) dy = 60. * 1852. * dlat # dy (meters) area = (dx[1:] + dx[:-1]) / 2. * dy[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(boxes):\n return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])", "def area(boxes):\n return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])", "def area_equilat(side):\n\treturn side/2 * math.sqrt(side**2 - (side/2)**2)", "def area(self):\n return numpy.prod(\n ...
[ "0.67904425", "0.6754698", "0.6732472", "0.6650701", "0.66063714", "0.66038996", "0.65558666", "0.65468526", "0.65229356", "0.6482552", "0.6436325", "0.6419682", "0.6405907", "0.63795835", "0.63519025", "0.6339286", "0.63358676", "0.6330076", "0.63250315", "0.63153094", "0.62...
0.84482664
0
chech email for validity
def isvalid(email): pattern = re.compile(r"^([a-zA-Z0-9_\-]+)@([a-zA-Z0-9]+)\.\w{,3}$") return bool(pattern.match(email))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_mail(self):\n raise NotImplementedError", "def test_is_valid_email(self):\n self.assertTrue(is_valid_email('abc@example.com'))", "def verify_email(entered_email):\n return EMAIL_RE.match(entered_email)", "def valid_email(line):\n email = line.o_email\n is_valid = validate_em...
[ "0.73370063", "0.7180774", "0.71477103", "0.7036073", "0.69899946", "0.6979016", "0.6978587", "0.69692695", "0.69309604", "0.68917435", "0.6851963", "0.6830524", "0.6820319", "0.68023986", "0.6780568", "0.67640585", "0.67584425", "0.67360306", "0.6730782", "0.6720208", "0.671...
0.0
-1
Imputation for different categories in different ways
def test_impute_test(df): df_copy = df.copy() # set missing original distances to max() for each searchquery and -1 if no info df_copy[['srch_id', 'orig_destination_distance']].fillna( df_copy[['srch_id', 'orig_destination_distance']].groupby('srch_id').transform('max').squeeze(), inplace=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_extra_category_impute(make_missing_categories):\n ab.set_hyperseed(100)\n X, m, ncats = make_missing_categories\n X_true = np.copy(X)\n X_true[:, m[:, 0], 0] = ncats[0]\n X_true[:, m[:, 1], 1] = ncats[1]\n\n # This replicates the input layer behaviour\n def data_layer(**kwargs):\n ...
[ "0.65087634", "0.6344197", "0.62502825", "0.61951655", "0.6168192", "0.6081885", "0.606912", "0.5928479", "0.58769864", "0.58472204", "0.58074594", "0.58003026", "0.5799089", "0.5735007", "0.5731613", "0.56898046", "0.56547064", "0.5625591", "0.5558451", "0.55570453", "0.5551...
0.56815714
16
Load the file and get a distribution of first names. first_name_f is the location of the first names.
def sample_first_name(first_name_file, num_samples): df = pd.read_csv(first_name_file, header=None) df.columns = ["name", "gender", "count"] df = df[(df["count"] > 10)] names = df["name"].sample(n=num_samples, random_state=2021, replace=True).apply(str.title) return list(names.values)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_firstnames(gender):\n return load_resource(\"resources/%s.txt\" % gender)", "def loadFirsts(self, names):\n\n if os.path.exists(names):\n self.firsts, self.w_firsts = self.load(names)\n else:\n self.firsts = [names]\n self.w_firsts = None\n\n retu...
[ "0.72455084", "0.61470735", "0.6025103", "0.5810356", "0.57590806", "0.56038094", "0.55486715", "0.5544613", "0.5531072", "0.54949427", "0.5482349", "0.5474973", "0.547078", "0.547078", "0.547078", "0.547078", "0.547078", "0.547078", "0.547078", "0.547078", "0.547078", "0.5...
0.6412988
1
Load the file and get a distribution of last names. last_name_f is the location of the last names. a function that is able to generate a new last name (i.e. endless generator).
def sample_last_name(last_name_file, num_samples): df = pd.read_csv(last_name_file) df = df[~df.name.isna()] df = df[(df["count"] > 400)] print(num_samples, len(df)) names = df["name"].sample(n=num_samples, random_state=2021).apply(str.title) return list(names.values)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_name():\n return dice.choice(names.lastname)", "def get_first_and_last_name(self) -> Name:\n name_db = self.read_file(self.db_name)\n first_name = str(name_db.at[random.randint(0, len(name_db)), 'first name'])\n last_name = str(name_db.at[random.randint(0, len(name_db)), 'last na...
[ "0.6275044", "0.61338234", "0.610177", "0.6078475", "0.60757905", "0.60156703", "0.5903551", "0.5874189", "0.5851186", "0.5808129", "0.5777178", "0.5727794", "0.5710001", "0.56602776", "0.5633801", "0.5574742", "0.5545156", "0.5533885", "0.55304986", "0.55219257", "0.551994",...
0.6352174
0
Show form for to add a student.
def show_add_student_form(): return render_template("add_student_form.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_form():\n\n return render_template('add_new_student.html')", "def get_add_student_form():\n\n return render_template(\"student_add.html\")", "def get_student_add_form():\n\n return render_template(\"student_add.html\")", "def add_student():\n if request.method == 'POST':\n db.a...
[ "0.8202044", "0.8173583", "0.81227547", "0.79873145", "0.79806924", "0.7733223", "0.75617653", "0.75165117", "0.73122835", "0.725469", "0.7245994", "0.7216317", "0.69031465", "0.66639566", "0.6613713", "0.6501236", "0.64707047", "0.6467131", "0.6457678", "0.6449348", "0.64493...
0.862679
0
Anonymous user has no object permissions, return queryset as it is.
def filter_queryset(self, request, queryset, view): form_id = view.kwargs.get(view.lookup_field, view.kwargs.get("xform_pk")) lookup_field = view.lookup_field queryset = queryset.filter(deleted_at=None) if request.user.is_anonymous: return queryset if form_id: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_queryset(self, request, queryset, view):\n if request.user.is_anonymous:\n return queryset.filter(Q(shared_data=True))\n return queryset", "def get_queryset(self):\n return get_user_model().objects.none()", "def get_queryset(self, *args, **kwargs):\n qs = super...
[ "0.74259883", "0.7394681", "0.72754383", "0.71765935", "0.71704334", "0.71627665", "0.71365076", "0.7129592", "0.7127435", "0.7127435", "0.70025957", "0.68523425", "0.67651474", "0.67598915", "0.6741682", "0.67104656", "0.6643731", "0.661319", "0.6606435", "0.65955335", "0.65...
0.0
-1
Return a filtered queryset or all profiles if a getting a specific profile.
def filter_queryset(self, request, queryset, view): if view.action == "retrieve" and request.method == "GET": return queryset.model.objects.all() filtered_queryset = super().filter_queryset(request, queryset, view) org_users = set( [group.team.organization for group in r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n queryset = Profile.objects.all()\n userid = self.request.query_params.get('userid', None)\n if userid is not None:\n queryset = queryset.filter(user_id=userid)\n return queryset", "def get_queryset(self):\n mo = MemberOrganisation.objects.ge...
[ "0.755265", "0.725869", "0.69714576", "0.65861493", "0.64708245", "0.6469557", "0.6431528", "0.63780457", "0.63629526", "0.63629526", "0.62462324", "0.6142245", "0.6142245", "0.6142103", "0.6111397", "0.6092145", "0.60800606", "0.60800606", "0.6031305", "0.6024656", "0.600714...
0.6236477
11
Filter by `owner` query parameter.
def filter_queryset(self, request, queryset, view): owner = request.query_params.get("owner") if owner: kwargs = {self.owner_prefix + "__username__iexact": owner} return queryset.filter(**kwargs) return queryset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_by_owner(self, user):\n return self.filter(owner=user)", "def owner(self, operator: Enum, owner: int | list):\n if isinstance(owner, list) and operator not in self.list_types:\n raise RuntimeError(\n 'Operator must be CONTAINS, NOT_CONTAINS, IN'\n ...
[ "0.7646194", "0.6965788", "0.65826195", "0.6409607", "0.6103757", "0.59920454", "0.59094703", "0.5796718", "0.5794726", "0.57794684", "0.57424366", "0.572394", "0.57190627", "0.57079446", "0.5669021", "0.5668314", "0.5654205", "0.5641743", "0.5633478", "0.5615246", "0.5607198...
0.80703324
0
Anonymous user has no object permissions, return queryset as it is.
def filter_queryset(self, request, queryset, view): user = request.user project_id = view.kwargs.get(view.lookup_field) if user.is_anonymous: return queryset.filter(Q(shared=True)) if project_id: int_or_parse_error( project_id, "I...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_queryset(self, request, queryset, view):\n if request.user.is_anonymous:\n return queryset.filter(Q(shared_data=True))\n return queryset", "def get_queryset(self):\n return get_user_model().objects.none()", "def get_queryset(self, *args, **kwargs):\n qs = super...
[ "0.7426255", "0.73949665", "0.72751904", "0.7176792", "0.7170634", "0.71630013", "0.7136547", "0.7130003", "0.71270823", "0.71270823", "0.7003037", "0.6851771", "0.6764738", "0.67603064", "0.6741808", "0.6710239", "0.66436696", "0.6613968", "0.6606825", "0.65957516", "0.65853...
0.0
-1
This returns a queryset containing only organizations to which the passed user belongs.
def filter_queryset(self, request, queryset, view): username = request.query_params.get("shared_with") if username: try: # The Team model extends the built-in Django Group model # Groups a User belongs to are available as a queryset property ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_queryset(self, request, queryset, view):\n if str(request.query_params.get(\"orgs\")).lower() == \"false\":\n organization_user_ids = OrganizationProfile.objects.values_list(\n \"user__id\", flat=True\n )\n queryset = queryset.exclude(id__in=organiz...
[ "0.7577224", "0.6995896", "0.6971754", "0.6805129", "0.6706911", "0.6465089", "0.6365396", "0.624034", "0.6230511", "0.62178594", "0.61981183", "0.61911273", "0.60505116", "0.6036519", "0.5977819", "0.59722465", "0.59395593", "0.5898943", "0.5895785", "0.58794427", "0.5879442...
0.6487151
5
Filter to return forms shared with user when ``view.action == "list"``.
def filter_queryset(self, request, queryset, view): if view.action == "list": # Return widgets from xform user has perms to return self._xform_filter_queryset(request, queryset, view, "object_id") return super().filter_queryset(request, queryset, view)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_queryset(self, request, queryset, view):\n has_submitted_by_key = (\n Q(options__has_key=\"query\") & Q(options__query__has_key=\"_submitted_by\"),\n )\n\n if request.user.is_anonymous:\n return self._xform_filter_queryset(\n request, queryset, v...
[ "0.68590915", "0.6857332", "0.65968096", "0.650039", "0.6423582", "0.640895", "0.63494456", "0.6306371", "0.62433", "0.62267786", "0.6223098", "0.6161577", "0.61330414", "0.6128386", "0.61223245", "0.61112714", "0.6086066", "0.60833687", "0.60186845", "0.5990049", "0.597542",...
0.749122
0
Filter by the ``users`` query parameter returns a queryset of only the users in the users parameter when `view.action == "list"`
def filter_queryset(self, request, queryset, view): if view.action == "list": users = request.GET.get("users") if users: users = users.split(",") return queryset.filter(user__username__in=users) if not request.user.is_anonymous: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n return filterUsersByName( self.request.query_params.get('username', None) )", "def users_list(request):\n users_filter = UserFilter(request.GET, queryset=CustomUser.objects.filter(is_admin=False), request=request)\n return render(request, 'users/list.html', {'filter': users...
[ "0.781016", "0.7429242", "0.7280218", "0.72516197", "0.7135937", "0.7085754", "0.70316213", "0.69932675", "0.6981495", "0.69375646", "0.6931343", "0.68870515", "0.6830975", "0.6717417", "0.670001", "0.6621241", "0.66184455", "0.66049325", "0.65883315", "0.6581441", "0.6576638...
0.83800274
0
Return a queryset of shared=True data if the user is anonymous.
def filter_queryset(self, request, queryset, view): if request and request.user.is_anonymous: return queryset.filter(shared=True) return queryset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_queryset(self, request, queryset, view):\n if request.user.is_anonymous:\n return queryset.filter(Q(shared_data=True))\n return queryset", "def filter_queryset(self, request, queryset, view):\n user = request.user\n project_id = view.kwargs.get(view.lookup_field)...
[ "0.8342058", "0.64973146", "0.62343246", "0.61763996", "0.6094837", "0.60541165", "0.6039261", "0.60264957", "0.59868306", "0.59681827", "0.5934615", "0.5930023", "0.59274477", "0.59268105", "0.5880456", "0.58744687", "0.5865632", "0.5857077", "0.58516496", "0.5809551", "0.57...
0.7979802
1
Get absolute path to resource, works for dev and for PyInstaller
def resource_path(relative_path): try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS _BINARY_DIST = True #print sys._M...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep", "def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa...
[ "0.8369028", "0.82811016", "0.82484996", "0.81395954", "0.81144196", "0.8099082", "0.8094557", "0.8080269", "0.8068243", "0.8067889", "0.80630267", "0.80630267", "0.80630267", "0.80630267", "0.80630267", "0.80630267", "0.80630267", "0.805744", "0.80550295", "0.8045351", "0.80...
0.7975159
37
Check that the title of the provided Doi object contains the type of PDS product (bundle, collection, document, etc...).
def _check_field_title_content(self, doi: Doi): product_type_specific_split = doi.product_type_specific.split(" ") # The suffix should be the last field in product_type_specific so # if it has many tokens, check the last one. product_type_specific_suffix = product_type_specific_split[-1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bundle_is_product_pack(self):\n template = self.product_apple_bundle\n product_pack_ids = template.product_pack_ids\n self.assertTrue(template.is_pack, 'Product template is a bundle pack')\n self.assertTrue(len(product_pack_ids) != 0, 'Product: a product bundle should have prod...
[ "0.59042853", "0.58945376", "0.5773633", "0.5768869", "0.5617897", "0.5591744", "0.5584331", "0.5551503", "0.5538214", "0.5531889", "0.55311024", "0.5476935", "0.54744685", "0.5433856", "0.5430865", "0.5408138", "0.5398542", "0.5359131", "0.5317806", "0.52862185", "0.52539116...
0.7513481
0
clean corpus of text and tokenize
def clean_corpus(self, corpus, flatten=True): if flatten: t = [self.process_text(sent) for sent in list(sent_tokenize(corpus))] return [item for sublist in t for item in sublist] return [self.process_text(sent) for sent in list(sent_tokenize(corpus))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_text(text):\n\n lemmizer = WordNetLemmatizer()\n stemmer = porter.PorterStemmer()\n\n stop = stopwords.words('english')\n stop += ['.', ',', ':', '...', '!\"', '?\"', \"'\", '\"', ' - ', ' — ', ',\"', '.\"', '!', ';', '♫♫', '♫', \\\n '.\\'\"', '[', ']', '—', \".\\'\", 'ok', 'okay'...
[ "0.78237814", "0.75231856", "0.75137794", "0.7439124", "0.7429146", "0.7411678", "0.73966765", "0.73252493", "0.73114383", "0.72802", "0.72346854", "0.7210425", "0.7151339", "0.7140675", "0.7114394", "0.7099733", "0.7062862", "0.7062862", "0.7028873", "0.7013894", "0.7012956"...
0.7237763
10
Test if setting a stylesheet overrides all attributes or just the one it is setting.
def stylesheet_test(self, wdgt): #stylesheet_str stylesheet_str = 'background-color: red;' #set stylesheet wdgt.setStyleSheet(stylesheet_str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getProperyOverridesMode(shaderName):\n\n appliedAttributes = []\n c = rsUtility.collection(shaderName.replace(':', '_'), isQuery=True)\n for (index, item) in enumerate(rsUtility.overrideAttributes):\n if c.overrides(item['long']) is not None:\n appliedAttributes.append(c.overrides(it...
[ "0.57092386", "0.5588936", "0.55103153", "0.5507079", "0.5423412", "0.5416012", "0.5414001", "0.53517836", "0.52991873", "0.5291579", "0.5235662", "0.5233968", "0.51157576", "0.5063801", "0.5021085", "0.5012519", "0.5002488", "0.4996876", "0.49915648", "0.493241", "0.4931272"...
0.5205775
12
Access the list of bindable vars for the sequence.
def get_bindable_vars(self): return self.local_vars.keys() + self.parent.get_bindable_vars()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bindable_vars(self):\n return (self.linkable_vars + self.local_vars.keys() +\n self.external_vars.keys())", "def bindings(self):\n return self.__bindings", "def variables(self):\n return self._.vars", "def get_all_variables(self):\n return [self.item]", "def g...
[ "0.75202245", "0.65195453", "0.63851213", "0.6346199", "0.6287978", "0.6196221", "0.6184894", "0.61519825", "0.61489654", "0.61378247", "0.60871696", "0.6082947", "0.6056914", "0.6052577", "0.60128367", "0.5988346", "0.59639925", "0.59366417", "0.5931107", "0.58988", "0.58890...
0.7673205
0
Access the list of bindable vars for the sequence.
def get_bindable_vars(self): return (self.linkable_vars + self.local_vars.keys() + self.external_vars.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bindable_vars(self):\n return self.local_vars.keys() + self.parent.get_bindable_vars()", "def bindings(self):\n return self.__bindings", "def variables(self):\n return self._.vars", "def get_all_variables(self):\n return [self.item]", "def getVars(self):\n return self...
[ "0.76751584", "0.65190053", "0.6386601", "0.63478", "0.62901115", "0.6198567", "0.6187206", "0.6153742", "0.61507803", "0.61392236", "0.6088718", "0.60849667", "0.6059533", "0.6054726", "0.60147285", "0.59897035", "0.5965528", "0.59382516", "0.5932396", "0.59015864", "0.58904...
0.7521902
1
Return a batch of data. When dataset end is reached, start over.
def next(self, batch_size=np.inf): if self.batch_id == len(self.data): self.batch_id = 0 # shuffle the data each pass over it. rng_state = np.random.get_state() np.random.shuffle(self.data) np.random.set_state(rng_state) np.random.shuffle(s...
{ "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.7507682", "0.721605", "0.71748686", "0.70760196", "0.7075752", "0.7038496", "0.69402474", "0.6857702", "0.68493944", "0.6729614", "0.6694771", "0.6646888", "0.6633734", "0.6623263", "0.6605715", "0.66021436", "0.65843296", "0.6570568", "0.65694284", "0.65527266", "0.652286...
0.6412347
31
Returns the location where the posterior mean is takes its minimal value.
def get_fmin(self): return self.model.predict(self.model.X)[0].min()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_value(self):\n return self._fitness[self._minidx]", "def min(self):\n return numpy.ma.min(self.data)", "def MinimumValue(self):\n return self._fitness[self._minIndex]", "def getmin(self):\n\n return self.X", "def get_f_minimum(self):\n return np.min(self._Y)",...
[ "0.6755076", "0.66483307", "0.6639105", "0.6626444", "0.6622252", "0.6614976", "0.6535174", "0.65341866", "0.6519118", "0.64840114", "0.64690405", "0.64344853", "0.64133227", "0.6380736", "0.63707286", "0.634545", "0.6343859", "0.63361627", "0.63000774", "0.6299625", "0.62988...
0.67768604
0
Determines the name of the S3 folder that has the most recent timestamp in its name. The timestamp is formatted as YYYYMMDD_HHMMSS.
def get_most_recent_folder_from_s3_bucket(): s3 = boto3.resource('s3') bucket = s3.Bucket(BUCKET_NAME) result = bucket.meta.client.list_objects(Bucket=bucket.name, Delimiter='/') folders = [] date_pattern = re.compile(r"[0-9_]+") for o in result.get('CommonPrefixes'): folder_name = o.get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_latest_file_name(bucket_name,prefix):\n s3_client = boto3.client('s3')\n objs = s3_client.list_objects_v2(Bucket=bucket_name)['Contents']\n shortlisted_files = dict() \n for obj in objs:\n key = obj['Key']\n timestamp = obj['LastModified']\n # if key starts with ...
[ "0.77511936", "0.6915808", "0.6560655", "0.65320057", "0.6125778", "0.6057918", "0.59998477", "0.58742297", "0.58320874", "0.58268535", "0.5817305", "0.5812881", "0.579791", "0.5793312", "0.5782789", "0.57503194", "0.5691382", "0.5678389", "0.5659491", "0.5636233", "0.5634603...
0.7544764
1
Start episode with a number of num_stacked_frames noops to get the first state of an episode
def _start_episode(self, test = False): self.env.true_reset() new_frame = self.env.reset() if not test: self.memory.add_experience(0, 0.0, new_frame, False) for i in range(self.num_stacked_frames): self._current_state[0, i] = new_frame new_frame, rewar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_first_episodes(trace_path, metadata, n_episodes=None):\n metadata = get_metadata_dictionary(metadata)\n restart_name = metadata[\"restart_name\"]\n trace_df = read_data_with_metadata(trace_path, metadata)\n\n if n_episodes is not None:\n episode_start_ind = np.where(\n (trace_...
[ "0.57826614", "0.5747007", "0.5692965", "0.5589881", "0.5469327", "0.54076153", "0.53903836", "0.53826916", "0.5365109", "0.5357", "0.53308517", "0.5325424", "0.5305656", "0.52783614", "0.52621305", "0.5240889", "0.5202228", "0.51989776", "0.5193075", "0.51726454", "0.5165044...
0.69803154
0
Example grid = plt.GridSpec(2, 3, wspace=0.4, hspace=0.3) plt.subplot(grid[0, 0])
def plot_gridSpec(nrow, ncol, wspace=None, hspace=None): grid = plt.GridSpec(nrows=nrow, ncols=ncol, wspace=wspace, hspace=hspace) yield grid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sizergrid():\n regular_grid(8, 3)\n mpl.show()", "def add_subplot(gridRows, gridCols, plotNo):\n pl.subplot(gridRows, gridCols, plotNo)", "def plot_gridSubplot(shape, loc, colspan=1, rowspan=1):\n return plt.subplot2grid(shape=shape,\n loc=loc,\n ...
[ "0.74055684", "0.73242015", "0.71092314", "0.70288026", "0.70039195", "0.6971195", "0.6956515", "0.69506013", "0.6813775", "0.6678964", "0.65456706", "0.6541274", "0.64914435", "0.648105", "0.6464818", "0.6429535", "0.6406861", "0.6363851", "0.63366324", "0.6295119", "0.62793...
0.79060924
0
code from NIST The input to this function is a cumulative probability. The output from this function is the Normal deviate that corresponds to that probability.
def _ppndf(cum_prob): SPLIT = 0.42 A0 = 2.5066282388 A1 = -18.6150006252 A2 = 41.3911977353 A3 = -25.4410604963 B1 = -8.4735109309 B2 = 23.0833674374 B3 = -21.0622410182 B4 = 3.1308290983 C0 = -2.7871893113 C1 = -2.2979647913 C2 = 4.8501412713 C3 = 2.3212127685 D1 = 3.5438892476 D2 = 1.637...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cumulative_normal_distribution(z):\n from math import exp\n\n b1 = +0.319381530\n b2 = -0.356563782\n b3 = +1.781477937\n b4 = -1.821255978\n b5 = +1.330274429\n p = +0.2316419\n c = +0.39894228\n\n if z >= 0.0:\n t = 1.0 / (1.0 + p * z)\n return 1.0 - c * exp(-z * z / ...
[ "0.70367706", "0.6939712", "0.67904025", "0.67157626", "0.6679432", "0.66152656", "0.6526447", "0.6442094", "0.64180934", "0.6389206", "0.6359531", "0.6333796", "0.6301851", "0.6301851", "0.6301851", "0.6301851", "0.6301851", "0.62903285", "0.62766004", "0.62479466", "0.62287...
0.650553
7
Convert the figure to png image for tensorboard
def plot_to_image(figure: plt.Figure, close_figure: bool = True) -> tf.Tensor: # Save the plot to a PNG in memory. buf = io.BytesIO() figure.savefig(buf, format='png') # Closing the figure prevents it from being displayed directly inside # the notebook. plt.close(figure) buf.seek(0) # Convert PNG buffer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_png_(self):\n mol = self.owner.mol\n keku = IPythonConsole.kekulizeStructures\n size = IPythonConsole.molSize\n opts = IPythonConsole.drawOptions\n return Draw._moltoimg(\n mol, size, self.aix, \"\", returnPNG=True, drawOptions=opts,\n kekulize=kek...
[ "0.7283487", "0.7283487", "0.7277466", "0.7187215", "0.71724033", "0.71724033", "0.7134974", "0.71299666", "0.71299666", "0.71299666", "0.70221883", "0.70029616", "0.69614255", "0.685746", "0.6669422", "0.66607004", "0.66018105", "0.65968424", "0.6577552", "0.6573417", "0.655...
0.7070279
10
Scroll page up. (Prefer the cursor at the bottom of the page, after scrolling.)
def scroll_page_up(event): w = _current_window_for_event(event) b = event.cli.current_buffer if w and w.render_info: # Put cursor at the first visible line. (But make sure that the cursor # moves at least one line up.) line_index = max(0, min(w.render_info.first_visible_line(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_up(self):\n counter = self.get_entry_count_per_screen()\n while counter != 0 and self.pointer != 0:\n logging.debug(\"moved down\")\n self.pointer -= 1\n counter -= 1\n self.refresh()\n self.reset_scrolling()\n return True", "def scroll...
[ "0.7581032", "0.7520429", "0.7402612", "0.722036", "0.7166075", "0.70931387", "0.7000434", "0.6953543", "0.6950133", "0.6928654", "0.6927342", "0.6907457", "0.6788317", "0.678307", "0.67254025", "0.6668036", "0.6647367", "0.6615949", "0.6596462", "0.6572647", "0.6567709", "...
0.8459888
0
Approximates the distance in kilometers between two points on the Earth's surface designated in decimal degrees using an ellipsoidal projection. per CFR 73.208 it is applicable for up to 475 kilometers. p1 and p2 are listed as (longitude, latitude).
def get_distance(p1, p2): deg_rad = math.pi / 180 dphi = p1[1] - p2[1] phim = 0.5 * (p1[1] + p2[1]) dlam = p1[0] - p2[0] k1 = (111.13209 - 0.56605 * math.cos(2 * phim * deg_rad) + 0.00120 * math.cos(4 * phim * deg_rad)) k2 = (111.41513 * math.cos(phim * deg_rad) - 0.09455 * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_distance(point1, point2):\n import math\n\n def convert_to_radians(degrees):\n return degrees * math.pi / 180\n\n radius_earth = 6.371E3 # km\n phi1 = convert_to_radians(point1[0])\n phi2 = convert_to_radians(point2[0])\n delta_phi = convert_to_radians(point1[0] - point2[0])...
[ "0.71067274", "0.7037443", "0.70022", "0.69730616", "0.6917561", "0.68765885", "0.68406034", "0.6832188", "0.67837244", "0.67485684", "0.6728237", "0.67109966", "0.6641687", "0.66135436", "0.66016316", "0.659907", "0.6598094", "0.6595829", "0.65902007", "0.65822417", "0.65666...
0.72083265
0
Set base salary or raise ValueError if invalid.
def base_salary(self, salary): if salary < Decimal('0.00'): raise ValueError('Base salary must be >= to 0') self._base_salary = salary
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def give_raise(self):\r\n self.salary = 45000", "def __init__(self, name, new_salary):\n self._salary = new_salary ## note the _ before attribute", "def __init__(self, eid: str, name: str, weekly_salary: int):\n pay.SalaryPolicy.__init__(self, weekly_salary)\n super().__init__(eid,...
[ "0.6243434", "0.5606272", "0.54914844", "0.5449269", "0.54376566", "0.53353673", "0.5328867", "0.53279847", "0.5327855", "0.5309387", "0.5260889", "0.5248316", "0.5189606", "0.5075893", "0.5059632", "0.50569403", "0.50288606", "0.5005887", "0.49872622", "0.49440905", "0.49297...
0.8280234
0
Return string representation for repr().
def __repr__(self): return ('Salaried' + super().__repr__() + f'\nbase salary: {self.base_salary:.2f}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_string(self):\n return self.__repr__()", "def __repr__(self) -> str:\n items = (\"{}={}\".format(k, repr(v)) for k, v in self.__dict__.items())\n return \"<{}({})>\".format(self.__class__.__name__, \", \".join(items))", "def repr(x) -> String:\n pass", "def repr_(object_):\n r...
[ "0.78689784", "0.7679577", "0.7673822", "0.75970453", "0.7577684", "0.7577684", "0.7577684", "0.75686145", "0.7555081", "0.7470041", "0.74689454", "0.74682516", "0.74306047", "0.74306047", "0.74306047", "0.74306047", "0.74284583", "0.7414092", "0.739995", "0.7387289", "0.7376...
0.0
-1
Find nth lexicographic permutation of elems by calculating the number of permutatios left for each position elems array with elements to permutate, must be sorted n the nth lexicographic permutation to find
def nth_permutation(elems, n): pos, summ = 0, 0 permutation = "" for i in reversed(range(1,len(elems))): fact_i = fact(i) while summ+fact_i < n: summ += fact_i pos += 1 permutation += str(elems[pos]) del(elems[pos]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partial_permutations(n, k):\n return int((factorial(n) / factorial(n - k)) % 1000000)", "def makePermutations(n):\n\thalf = n // 2\n\tfull = half * 2\n\tswap = np.random.rand(half) > 0.5\n\tpx = np.arange(n)\n\tpx[:full:2] += swap\n\tpx[1:full:2] -= swap\n\treturn px", "def lexicographic(n, digits):\n ...
[ "0.648822", "0.64737105", "0.64734733", "0.6361041", "0.63317674", "0.6317636", "0.6312873", "0.63047296", "0.6282666", "0.62262446", "0.6190536", "0.61688745", "0.616045", "0.6160125", "0.61435187", "0.60960144", "0.60658616", "0.6059923", "0.60239357", "0.6018676", "0.60102...
0.76131976
0
Generate a dictionary representing the JSON of this Provider.
def to_dict(self) -> Dict[str, Any]: d: Dict[str, Any] = {"name": self.name} if self.description is not None: d["description"] = self.description if self.roles is not None: d["roles"] = self.roles if self.url is not None: d["url"] = self.url d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n result = super(Provider, self).to_dict()\n result['provider_class'] = self.provider_class.value\n return result", "def json(self):\n return {\n \"qualified_name\": self.qualified_name,\n \"description\": self.description,\n \"data\...
[ "0.7904322", "0.7722973", "0.7572196", "0.75304466", "0.74428815", "0.7390862", "0.73670644", "0.73502326", "0.7329394", "0.7310516", "0.72544265", "0.71987087", "0.7165922", "0.7124095", "0.71240747", "0.7106014", "0.7066234", "0.7052547", "0.7034091", "0.7032674", "0.700935...
0.0
-1
Constructs an Provider from a dict.
def from_dict(d: Dict[str, Any]) -> "Provider": return Provider( name=d["name"], description=d.get("description"), roles=d.get( "roles", ), url=d.get("url"), extra_fields={ k: v for k, v in d....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n provider_id = dictionary.get('providerId')\n server_time = dictionary.get('serverTime')\n ...
[ "0.670957", "0.6599591", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0.6542035", "0...
0.823266
0
Maps rows to list of rows according to input correspondence dtype required if result type != item type.
def flatmap( self, arg: Union[Dict, Callable], na_action: Literal["ignore", None] = None, dtype: Optional[dt.DType] = None, columns: Optional[List[str]] = None, ): if columns is None: return super().flatmap(arg, na_action, dtype) self._check_column...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_dtypes(rows):\n dtype_map = {pd.Timestamp: lambda x: x.to_pydatetime(),\n np.int8: lambda x: int(x),\n np.int16: lambda x: int(x),\n np.int32: lambda x: int(x),\n np.int64: lambda x: int(x),\n np.float16: lambda x: float...
[ "0.6185337", "0.58048403", "0.5735868", "0.55657727", "0.55195147", "0.55133355", "0.5443718", "0.5440403", "0.5404057", "0.5344916", "0.52109843", "0.52026796", "0.5199925", "0.51974076", "0.5184706", "0.5175106", "0.5153073", "0.515158", "0.5101713", "0.50998044", "0.508273...
0.0
-1
Return the minimum of the nonnull values of the Column.
def min(self): return self._summarize(DataFrameCpu._cmin)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_min(self):\n min_value= self.df[self.col_name].min()\n return min_value", "def min(self, column):\n return self.aggregate('min', *[column])", "def min(self):\n return self._reduce_for_stat_function(F.min, only_numeric=False)", "def min(self, column):\n self.aggregate(\"MIN\...
[ "0.79338217", "0.7801381", "0.722462", "0.696758", "0.69359076", "0.69039595", "0.68659055", "0.6855826", "0.6794916", "0.6776946", "0.6770525", "0.6745617", "0.6730362", "0.67095447", "0.6704643", "0.6695322", "0.667139", "0.6659867", "0.6646856", "0.66432655", "0.6640301", ...
0.66682816
17
Return the maximum of the nonnull values of the column.
def max(self): # skipna == True return self._summarize(lambda c: c.max)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max(self):\n max_value= self.df[self.col_name].max()\n return max_value", "def max(self, column):\n if not column:\n columns = ['*']\n\n return self.aggregate('max', *[column])", "def max(*x, na_rm: bool = False) -> Any:\n fun = numpy.nanmax if na_rm else numpy.max\n ...
[ "0.7727826", "0.70793664", "0.69416845", "0.69398797", "0.693579", "0.6866518", "0.6845351", "0.6835988", "0.6779359", "0.6777092", "0.6759752", "0.6759099", "0.67366153", "0.6735269", "0.67103153", "0.6697016", "0.66800284", "0.6638129", "0.6635591", "0.659199", "0.65897286"...
0.7933814
0
Return sum of all nonnull elements in Column
def sum(self): return self._summarize(lambda c: c.sum)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum(self, rows: List[Row], column: NumberColumn) -> Number:\n cell_values = [row.values[column.name] for row in rows if row.values[column.name] is not None]\n if not cell_values:\n return 0.0 # type: ignore\n return sum(cell_values) # type: ignore", "def sum(self):\n ...
[ "0.7251172", "0.7096467", "0.6623649", "0.654605", "0.64647985", "0.64647985", "0.6462042", "0.6431034", "0.63844407", "0.6264261", "0.62177515", "0.6210617", "0.62076926", "0.61899483", "0.6123844", "0.61048", "0.6104072", "0.61017114", "0.60981756", "0.60523736", "0.6047737...
0.6113136
15
Return cumulative minimum of the data.
def cummin(self): return self._lift(lambda c: c.cummin)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Min(data):\n return data.min()", "def cummin(x):\n for i in range(1, len(x)):\n if x[i-1] < x[i]:\n x[i] = x[i-1]\n return x", "def min(self):\n return numpy.ma.min(self.data)", "def min(self):\n return self._summarize(DataFrameCpu._cmin)", "def min(self):\r\n ...
[ "0.7640727", "0.7519042", "0.7514454", "0.7364287", "0.7251631", "0.72367567", "0.7217453", "0.70758396", "0.7034069", "0.69090056", "0.688229", "0.6830814", "0.6816655", "0.6808611", "0.67931354", "0.6781707", "0.67250484", "0.668934", "0.6687687", "0.6679528", "0.66742426",...
0.8161615
0
Return cumulative maximum of the data.
def cummax(self): return self._lift(lambda c: c.cummax)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Max(data):\n return data.max()", "def max(self):\n return numpy.ma.max(self.data)", "def maximum(x):\n return np.maximum(x, 0)", "def max(self):\r\n return np.max(self.data_array)", "def calc_max(data: list) -> float:\n acc = data[0]\n for n in data:\n if n > acc:\n ...
[ "0.7452321", "0.7437361", "0.7163789", "0.7120769", "0.6968473", "0.6922889", "0.688599", "0.6865025", "0.6764877", "0.6734028", "0.67210096", "0.6631422", "0.6555303", "0.6519833", "0.64951015", "0.64837044", "0.64799", "0.64634705", "0.6459134", "0.6457004", "0.643532", "...
0.8172523
0
Return cumulative sum of the data.
def cumsum(self): return self._lift(lambda c: c.cumsum)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cumsum(self) -> np.ndarray:\n\n if not hasattr(self, \"__cumsum\"):\n self.__cumsum = np.insert(np.cumsum(self.sizes), 0, 0)\n return self.__cumsum", "def cumsum(x, axis=None):\r\n return CumsumOp(axis=axis)(x)", "def cumulative_sum(x):\n total = 0\n sum = []\n for num...
[ "0.7721477", "0.7381804", "0.73679084", "0.73402447", "0.73402447", "0.73402447", "0.72238594", "0.72238594", "0.72238594", "0.71742153", "0.71572715", "0.70595247", "0.6982598", "0.69652534", "0.6804261", "0.6804261", "0.6804261", "0.6752408", "0.6653946", "0.66299784", "0.6...
0.82137907
0
Return cumulative product of the data.
def cumprod(self): return self._lift(lambda c: c.cumprod)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cumprod(x, axis=None):\r\n return CumprodOp(axis=axis)(x)", "def cumprod(\n self,\n dim: Dims = None,\n *,\n skipna: bool | None = None,\n keep_attrs: bool | None = None,\n **kwargs: Any,\n ) -> DataArray:\n return self.reduce(\n duck_array_op...
[ "0.6867563", "0.68419266", "0.68419266", "0.68419266", "0.67093605", "0.67093605", "0.67093605", "0.6566412", "0.6479337", "0.6450905", "0.6433689", "0.64271456", "0.64236027", "0.6392698", "0.63916117", "0.63593286", "0.62979436", "0.62666523", "0.6131326", "0.60573745", "0....
0.7150642
0
Return the minimum of the nonnull values of the Column.
def min(self, numeric_only=None): assert numeric_only == None return self._lift("min")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_min(self):\n min_value= self.df[self.col_name].min()\n return min_value", "def min(self, column):\n return self.aggregate('min', *[column])", "def min(self):\n return self._reduce_for_stat_function(F.min, only_numeric=False)", "def min(self, column):\n self.aggregate(\"MIN\...
[ "0.79338217", "0.7801381", "0.722462", "0.696758", "0.69359076", "0.69039595", "0.68659055", "0.6855826", "0.6794916", "0.6776946", "0.6770525", "0.6745617", "0.6730362", "0.67095447", "0.6704643", "0.6695322", "0.667139", "0.66682816", "0.6659867", "0.6646856", "0.66432655",...
0.6376569
44
Return the minimum of the nonnull values of the Column.
def max(self, numeric_only=None): assert numeric_only == None return self._lift("min")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_min(self):\n min_value= self.df[self.col_name].min()\n return min_value", "def min(self, column):\n return self.aggregate('min', *[column])", "def min(self):\n return self._reduce_for_stat_function(F.min, only_numeric=False)", "def min(self, column):\n self.aggregate(\"MIN\...
[ "0.79338217", "0.7801381", "0.722462", "0.696758", "0.69359076", "0.69039595", "0.68659055", "0.6855826", "0.6794916", "0.6776946", "0.6770525", "0.6745617", "0.6730362", "0.67095447", "0.6704643", "0.6695322", "0.667139", "0.66682816", "0.6659867", "0.6646856", "0.66432655",...
0.0
-1
Return sum of all nonnull elements in Column
def sum(self): # skipna == True # only_numerical == True # skipna == True return self._lift("sum")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum(self, rows: List[Row], column: NumberColumn) -> Number:\n cell_values = [row.values[column.name] for row in rows if row.values[column.name] is not None]\n if not cell_values:\n return 0.0 # type: ignore\n return sum(cell_values) # type: ignore", "def col_sums(\n x...
[ "0.7251172", "0.6623649", "0.654605", "0.64647985", "0.64647985", "0.6462042", "0.6431034", "0.63844407", "0.6264261", "0.62177515", "0.6210617", "0.62076926", "0.61899483", "0.6123844", "0.6113136", "0.61048", "0.6104072", "0.61017114", "0.60981756", "0.60523736", "0.6047737...
0.7096467
1
Initiates instance of the class `MainWindow()` and opens GUI
def open_window(): app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _start_gui():\n main_window = MainWindow()\n main_window.mainloop()", "def main():\n app = QtWidgets.QApplication(sys.argv)\n main = MainWindow()\n main.show()\n sys.exit(app.exec_())", "def startup(self) -> None:\n self.main_window = MainWindow(title=self.formal_name)\n\n i...
[ "0.82058847", "0.8100617", "0.75265425", "0.7492633", "0.747266", "0.7330011", "0.72096175", "0.7180779", "0.71064556", "0.7092952", "0.7078661", "0.7077196", "0.707171", "0.7045214", "0.7045214", "0.7045214", "0.7045214", "0.7045214", "0.70374453", "0.70243716", "0.699432", ...
0.80712664
2
Check that full list of Custom Attributes groups is displayed on Admin Dashboard panel.
def test_check_ca_groups(self, admin_dashboard): ca_tab = admin_dashboard.select_custom_attributes() expected_ca_groups_set = set( [objects.get_normal_form(item) for item in objects.ALL_CA_OBJS]) actual_ca_groups_set = set( [item.text for item in ca_tab.get_items_list()]) assert expected...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_permissions(self):\n self.assert_('admin' in get_model_perms(Group))", "def can_group(self) -> bool:\n return (\n self.all_icon is not None and\n self.all_name is not None\n )", "def test_custom_roles_widget(self, admin_dashboard):\n expected_set = set(\n ...
[ "0.5899632", "0.5860328", "0.5835692", "0.5821929", "0.5805348", "0.5642098", "0.55972475", "0.5573637", "0.5573637", "0.5547586", "0.5450587", "0.54495823", "0.54414994", "0.54405826", "0.5439533", "0.54223084", "0.54223084", "0.53896374", "0.5368092", "0.535569", "0.5354842...
0.72439885
0
Compute softmax values for each sets of scores in x.
def softmax(x): #pass # TODO: Compute and return softmax(x) return np.exp(x) / np.sum(np.exp(x), axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7797319", "0.7761927", "0.7760702", "0.7757607", "0.76584643", "0.76584643", "0.76584643", "0.76584643", "0.7585805", "0.7431572", "0.74072486", "0.7393695", "0.73585564", "0.7317323", "0.726931", "0.72627705", "0.72616196", "0.72570264", "0.7230177", "0.7214726", "0.72016...
0.7201872
20
Test that two chambers connected by a single pipe and then by two pipes behave as expected. IE for low conductance of the pipes, and high gass low and pumping in chamber 1 but low pumping and no external gas load in chamber 2, that pressure in chamber 2 should approximately double when two pipes are used. Also compare ...
def test_circular_vs_linear(): vac_sys = circular_or_linear_system(False) P_circ = [chamber.P for chamber in vac_sys.chambers()] P0_circ = [0.9999876873794514, 0.0012312620548606836] vac_sys = circular_or_linear_system(True) P_straight = [chamber.P for chamber in vac_sys.chambers()] P0_straight...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_switch(self):\n\n # Switch to the 'orig' data pipe.\n pipes.switch('orig')\n\n # Test the current data pipe.\n self.assertEqual(pipes.cdp_name(), 'orig')\n\n # Switch to the 'empty' data pipe.\n pipes.switch('empty')\n\n # Test the current data pipe.\n ...
[ "0.60790205", "0.5679798", "0.55366373", "0.55017143", "0.54677814", "0.5443744", "0.54275125", "0.5417915", "0.53949845", "0.5393111", "0.5377092", "0.5373788", "0.5363077", "0.5341027", "0.5340724", "0.5336317", "0.53207064", "0.5318209", "0.5312173", "0.53111446", "0.53082...
0.0
-1
Returns the number of messages your account has sent. ``DEFAULT_MESSAGE_STATUSES`` is set to ``[ "sent", "sending" ]``. Other possible statuses include "draft", "failed_review", "failed_disabled", and "failed_schedule".
def count_messages(self, statuses=DEFAULT_MESSAGE_STATUSES): return self.request("count:Message", [{"status": statuses}])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumOfMsgSend(self):\n return self.MsgSendCount", "def message_count(self):\n return len(self.messages)", "def get_messages(self,\n statuses=DEFAULT_MESSAGE_STATUSES,\n order=\"sent_at desc\",\n offset=None,\n count=None,\n content=Fals...
[ "0.61363477", "0.6028967", "0.5925579", "0.5892954", "0.5742837", "0.5742392", "0.5650634", "0.55786246", "0.5571384", "0.5562187", "0.55445874", "0.549014", "0.5455122", "0.5436265", "0.5332192", "0.53212994", "0.5312335", "0.5158172", "0.51116914", "0.5084898", "0.50658256"...
0.7604966
0
Returns the total number of URLs included in your messages
def count_urls(self): return self.request("count:Message_Url", [ None ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n return len(self.__links)", "def num_links(self):\n return self._num_links", "def message_count(self):\n pass", "def message_count(self):\n return len(self.messages)", "def how_many_entries(URL):\n\treturn len(get_lottery_numbers(URL))", "def countdots(url): ...
[ "0.73092145", "0.68271804", "0.67269033", "0.66395056", "0.6633849", "0.6560645", "0.65249664", "0.65127075", "0.65035534", "0.64989376", "0.649424", "0.6491528", "0.6465213", "0.64218223", "0.6401443", "0.6385026", "0.63767457", "0.63058794", "0.6264319", "0.6246786", "0.621...
0.8716161
0
Returns your newsletter's number of subscribers.
def count_subscribers(self): return self.request("count:Contact", [ None ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_subscribers(subreddit):\n header = {'User-Agent': 'Chrome/90.0.4430.212 Safari/537.36'}\n req = requests.get('https://www.reddit.com/r/{}/about.json'\n .format(subreddit), allow_redirects=False,\n headers=header)\n if req.status_code == 200:\n ...
[ "0.79015887", "0.7884865", "0.7835303", "0.78348064", "0.78234583", "0.7822411", "0.7802158", "0.77986", "0.7787472", "0.77824265", "0.7779703", "0.7736415", "0.7703464", "0.76781195", "0.7669535", "0.76562345", "0.7640647", "0.76302344", "0.7608191", "0.75839275", "0.7418147...
0.79437166
0
Returns a list of subscribers. List is sorted by mostrecenttosubsribe, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items (in sorted order). Returned data includes various statistics about each subscriber, e.g., ``total_sent``, ``total_opens``, ``total_clicks``.
def get_subscribers(self, order="created_at desc", offset=None, count=None): req_data = [ None, order, fmt_paging(offset, count)] return self.request("query:Contact.stats", req_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subscribers(cls, topic, count, starting_at_callback=None):\n\t\tquery = cls.all()\n\t\tquery.filter('topic_hash =', utils.sha1_hash(topic))\n\t\tquery.filter('subscription_state = ', cls.STATE_VERIFIED)\n\t\tif starting_at_callback:\n\t\t\tquery.filter('callback_hash >=', utils.sha1_hash(starting_at_callba...
[ "0.69237936", "0.6666141", "0.62897193", "0.60204464", "0.59342295", "0.59090436", "0.5901126", "0.59003204", "0.5788146", "0.5775675", "0.57145727", "0.56890774", "0.5658723", "0.5645292", "0.56147933", "0.55969745", "0.5594544", "0.55237746", "0.54998857", "0.5436735", "0.5...
0.79553986
0
! Sets up the ODE solver params dict, the parameters used in the ODE solver
def __init__(self, params): # check if the ode is provided. If not, raise an error if "ode" not in params.keys(): raise ValueError("Please specify the ODE to solve for the Integrator class") else: self.rhs = params["ode"] if "type" not in params.keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_parameters(self,diameterInd):\n\n\t\t# topological parameters\n\t\tself.nNodes = 21\n\t\tself._axonNodes=self.nNodes\n\t\tself._paraNodes1=40\n\t\tself._paraNodes2=40\n\t\tself._axonInter=120\n\t\tself._axonTotal=221\n\t\t# morphological parameters\n\t\tpossibleDiameters = [5.7, 7.3, 8.7, 10.0, 11.5, 12....
[ "0.67536044", "0.6432323", "0.6399309", "0.63262194", "0.63226753", "0.6314017", "0.62863195", "0.6279504", "0.6246942", "0.61664736", "0.6117455", "0.61130714", "0.60761577", "0.60598904", "0.60050523", "0.5981191", "0.59651124", "0.59641576", "0.59606814", "0.59568805", "0....
0.6541876
1
Test a password that is too short.
def test_long_password(): expect_error(register, InputError, "abcdef", "a" * (MIN_PASSWORD - 1), "a", "A", "a")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_password(password):\n if len(password) < MIN_LENGTH:\n return False\n return True", "def test_less_than_min_length_invalid_password(self):\n pass_field = Field(\"\".join(['x' * (int(self.app.config['MIN_PWD_LEN']) - 1)]))\n\n with self.assertRaises(ValidationError):\n ...
[ "0.7631044", "0.75717616", "0.75700545", "0.7568545", "0.7549981", "0.7548255", "0.74094886", "0.7403376", "0.73819345", "0.73769575", "0.7375011", "0.7353831", "0.7353412", "0.72912544", "0.7276577", "0.7231762", "0.7223937", "0.7199835", "0.715251", "0.7145561", "0.7121349"...
0.82387906
0
Test names that are too long.
def test_long_name(): expect_error(register, InputError, "a", "abcdef", "a" * (MAX_NAME + 1), "a", "a") expect_error(register, InputError, "a", "abcdef", "a", "a" * (MAX_NAME + 1), "a")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_name_is_3_parts():\n check_name_length()", "def is_name_length_valid(self) -> bool:\n return 2 < len(self.app_name) <= 35", "def test_valid_name_valid():\n assert valid_name(\"1\")\n assert valid_name(\"a\"*20)", "def length_of_name(self, name):\n length = len(name)\n ...
[ "0.7770426", "0.7268297", "0.7198817", "0.7155544", "0.7106875", "0.6934073", "0.69030696", "0.69022405", "0.68811196", "0.6873176", "0.6871145", "0.68685275", "0.68259484", "0.682003", "0.6815378", "0.677598", "0.674192", "0.6705308", "0.6702321", "0.6674632", "0.66607493", ...
0.8251435
0
Test an empty email.
def test_empty_email(): expect_error(register, InputError, "a", "abdkjjd", "a", "A", "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_clean_email_empty(self):\n\n raw_email = 'from=<>'\n result = clean_email(raw_email)\n self.assertEqual(result, '')", "def test_blank_email(self):\n rv = self.signup('Bo', 'Theo', '', 'Bo1995', 'Bo1995')\n self.assertIn(b'Field must be between 6 and 30 characters long....
[ "0.8134599", "0.7954082", "0.7703072", "0.73312354", "0.7244107", "0.7237575", "0.70918524", "0.7028826", "0.70055115", "0.6988291", "0.6979988", "0.6968305", "0.6967076", "0.6933073", "0.6917255", "0.689024", "0.6881207", "0.68670934", "0.6841608", "0.680585", "0.6782665", ...
0.7803495
2
Test a non unique email.
def test_email_not_unique(bot): expect_error(register, InputError, "a", "abcdef", "a", "a", bot.email)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_duplicate_email(self):\n self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n rv = self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n self.assertIn(b'Sorry email already exist', rv.data)", "def unique_email(cls, email):\n user_db = User...
[ "0.7413024", "0.7331212", "0.72571576", "0.72570497", "0.7239188", "0.72244805", "0.7197106", "0.71686274", "0.71686274", "0.71682835", "0.71675557", "0.71504945", "0.7146469", "0.7136091", "0.71020913", "0.7099233", "0.709877", "0.709866", "0.7090702", "0.70896626", "0.70653...
0.7796086
0
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(Cmd_WF, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.enable_steering is None: self.enable_steering = False if self.enable_braking is None: self.enable_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.77939296", "0.7720264", "0.7720264", "0.76866186", "0.7626193", "0.756387", "0.74395823", "0.7416946", "0.73519075", "0.7308225", "0.72806025", "0.72379386", "0.72272825", "0.7224187", "0.7224187", "0.7218873", "0.7211484", "0.7211484", "0.7211484", "0.7211484", "0.7211484...
0.0
-1
Convert the content of a `JSONField` loading it as an object
def convert_json_field_to_generic_scalar(field, registry=None): return OperationArgsType(description=field.help_text, required=not field.null)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_json(self, content):\r\n return simplejson.loads(content)", "def json_object(form, field):\n try:\n obj = json.loads(field.data)\n if not isinstance(obj, dict):\n raise ValidationError('The value must be a JSON object.')\n except json.JSONDecodeError:\n raise...
[ "0.712057", "0.70852107", "0.66860783", "0.6623724", "0.65812504", "0.6579387", "0.65514606", "0.6507986", "0.64245665", "0.639607", "0.63605535", "0.63546425", "0.63366205", "0.63238317", "0.6302199", "0.6299069", "0.62888116", "0.62883466", "0.6282431", "0.6254434", "0.6234...
0.0
-1
get the value of property _TimeZone
def TimeZone(self): if self.force_auto_sync: self.get('TimeZone') return self._TimeZone
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timezone(self):\n return self.data.get(\"timezone\")", "def timezone(self):\n return self._tz", "def timezone(self):\n return self._timezone", "def timezone(self):\n return self._timezone", "def timezone(self):\n return self._timezone", "def get_tz(self):\n f...
[ "0.77333933", "0.75681967", "0.7251268", "0.7251268", "0.7251268", "0.71797276", "0.7149227", "0.71230114", "0.7118429", "0.7064242", "0.7021404", "0.69529396", "0.6944523", "0.69157726", "0.68564266", "0.6837324", "0.68356395", "0.6826264", "0.6785236", "0.6716843", "0.67018...
0.77398276
0
get the value of property _ModifyType
def ModifyType(self): if self.force_auto_sync: self.get('ModifyType') return self._ModifyType
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type(self):\n return self.get(\"type\")", "def t(self):\n\t\treturn self.type", "def type(self):\n\t\treturn self.type_", "def getType(self):\n return \"value\"", "def type(self):\n return self.properties.get('type')", "def getType(self,):\n\t\treturn self.type;", "def type...
[ "0.63383025", "0.63082534", "0.6209539", "0.61708367", "0.6167198", "0.61446905", "0.6143131", "0.61119527", "0.6080829", "0.6055309", "0.60356116", "0.6021744", "0.6007186", "0.5999005", "0.59612167", "0.5937048", "0.5838492", "0.5804437", "0.57746506", "0.57746506", "0.5774...
0.7504367
0
get the value of property _ExpireTime
def ExpireTime(self): if self.force_auto_sync: self.get('ExpireTime') return self._ExpireTime
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_expire(self):\n return self.__expire", "def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")", "def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")", "def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")", "def ex...
[ "0.84020257", "0.7958025", "0.7958025", "0.7958025", "0.78177714", "0.7807214", "0.7807214", "0.768117", "0.768117", "0.7576717", "0.75620925", "0.7474917", "0.7413275", "0.7377242", "0.73583645", "0.7224441", "0.7217871", "0.7203006", "0.7041844", "0.6946096", "0.6904411", ...
0.8140631
1
get the value of property _ExpireIncr
def ExpireIncr(self): if self.force_auto_sync: self.get('ExpireIncr') return self._ExpireIncr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_expire(self):\n return self.__expire", "def expire(self):\n return self._expire", "def expire(self):\n\n return self._expire", "def ExpireIncrSec(self):\n if self.force_auto_sync:\n self.get('ExpireIncrSec')\n return self._ExpireIncrSec", "def expiry(self)...
[ "0.8057308", "0.76185197", "0.73857397", "0.7359539", "0.72683156", "0.71252656", "0.70171285", "0.70171285", "0.7015279", "0.7015279", "0.7015279", "0.6940565", "0.6903992", "0.684914", "0.6820364", "0.6812784", "0.67883706", "0.6729133", "0.6574711", "0.6558835", "0.655828"...
0.7859391
1
get the value of property _ExpireIncrSec
def ExpireIncrSec(self): if self.force_auto_sync: self.get('ExpireIncrSec') return self._ExpireIncrSec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_expire(self):\n return self.__expire", "def expire(self):\n return self._expire", "def expires(self):\n return self._data.get('expires')", "def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")", "def expire_time(self) -> str:\n return pulumi.get(s...
[ "0.81341505", "0.74813074", "0.7315098", "0.7272473", "0.7272473", "0.7272473", "0.72540444", "0.7217821", "0.7183644", "0.7159313", "0.7159313", "0.71500534", "0.71429497", "0.7135469", "0.70767766", "0.69805294", "0.6972484", "0.69264954", "0.6917018", "0.67852026", "0.6782...
0.80779994
1
get the value of property _ExpireIncrPage
def ExpireIncrPage(self): if self.force_auto_sync: self.get('ExpireIncrPage') return self._ExpireIncrPage
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ExpireIncr(self):\n if self.force_auto_sync:\n self.get('ExpireIncr')\n return self._ExpireIncr", "def DateIncrPage(self):\n if self.force_auto_sync:\n self.get('DateIncrPage')\n return self._DateIncrPage", "def _get_expire(self):\n return self.__expire"...
[ "0.6872871", "0.683543", "0.6794806", "0.6438448", "0.6360591", "0.6155847", "0.61206096", "0.60894495", "0.6017309", "0.6017309", "0.6017309", "0.6012106", "0.6012106", "0.5995443", "0.58708125", "0.58534867", "0.5798518", "0.5782198", "0.5776395", "0.5769634", "0.5753551", ...
0.7760552
0
Returns the price of the product.
def get_price(self): return self.price
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_product_price(product):\n return latest_product_version(product).price", "def get_price(self):\n return self._price", "def _product_price_by_id(self, product_id):\n product_spec = self._product_spec_by_id(product_id)\n return product_spec['price']", "def get_price(self):\r\n ...
[ "0.8343362", "0.823493", "0.81663465", "0.8152717", "0.81087416", "0.8093199", "0.8004053", "0.79995036", "0.79995036", "0.79604006", "0.78944147", "0.78488344", "0.7834891", "0.7749411", "0.7661034", "0.76573306", "0.76363474", "0.7536684", "0.74844366", "0.7257256", "0.7228...
0.82620215
3
Returns the expiration date of the product.
def get_expiration_date(self): return self.expiration_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expiration_date(self) -> str:\n return pulumi.get(self, \"expiration_date\")", "def expiration_date(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"expiration_date\")", "def expiration_date(self) -> typing.Optional[datetime.datetime]:\n return self._values.get('expiration_date'...
[ "0.8253032", "0.7695016", "0.75930554", "0.752974", "0.72560924", "0.71703655", "0.70203286", "0.6921331", "0.6869573", "0.6859974", "0.6824306", "0.6698371", "0.6634993", "0.6627209", "0.66208005", "0.6600275", "0.6561096", "0.65532756", "0.65532756", "0.65532756", "0.648545...
0.8158009
1
Returns the name of the product.
def get_name(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_name(self):\n return self._product_name", "def product_name(self):\n return self._stub.List(self._message).product_name", "def product_name(self) -> Optional[str]:\n return pulumi.get(self, \"product_name\")", "def product(self):\n return self.__values['product_name']"...
[ "0.8976567", "0.88299376", "0.87677175", "0.8718881", "0.8090168", "0.7962728", "0.7888005", "0.7753975", "0.77289927", "0.7690244", "0.7576331", "0.7404423", "0.7396115", "0.72465533", "0.7122703", "0.70620704", "0.69977146", "0.69716567", "0.69208735", "0.69208735", "0.6920...
0.0
-1
Generate a random string of letters and digits
def randomStringDigits(stringLength=6): lettersAndDigits = string.ascii_letters + string.digits return ''.join(random.choice(lettersAndDigits) for i in range(stringLength))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rand_string():\n out = ''\n for _ in range(24):\n out += choice(ascii_letters)\n return out", "def get_random_alphanumeric_string():\n return get_random_string(char_choice=string.ascii_letters + string.digits)", "def gen_rand_str(n):\n return \"\".join(random.choice(string.ascii_l...
[ "0.86016387", "0.84852463", "0.8366202", "0.83620757", "0.83602", "0.8158604", "0.8123532", "0.81143093", "0.8089975", "0.80873764", "0.8011259", "0.7957295", "0.79525083", "0.794848", "0.7927194", "0.79182523", "0.7897885", "0.788374", "0.787901", "0.7854035", "0.78254104", ...
0.770958
31
conv2d returns a 2d convolution layer with full stride.
def conv2d(x, W): return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_conv2d():\n img = np.array([\n [0.3, 0.5, 0.7, 0.9],\n [0.1, 0.3, 0.5, 0.7],\n [0.9, 0.7, 0.5, 0.3],\n ])\n template = np.array([\n [1, 0],\n [1, 0],\n ])\n template = np.flipud(np.fliplr(template))\n return fftconvolve(img, template, mode='valid')", ...
[ "0.7630156", "0.7626982", "0.7578824", "0.7464681", "0.7457871", "0.7457871", "0.7386211", "0.73378277", "0.7330424", "0.7329812", "0.73138624", "0.73019135", "0.7296958", "0.72700316", "0.7246276", "0.72318506", "0.7208653", "0.71967596", "0.7190217", "0.7188051", "0.7153030...
0.74261373
7
weight_variable generates a weight variable of a given shape.
def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(initial)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight_variable(shape):\n initial = tf.truncated_normal(shape, stddev=0.1)\n return tf.get_variable(\n 'weight', initializer=initial, regularizer=tf.nn.l2_loss)", "def weight_variable(shape):\n initial = tf.truncated_normal(shape)\n return tf.Variable(initial)", "def create_weight_variable(shape):...
[ "0.8267109", "0.82348764", "0.815819", "0.8156324", "0.8139299", "0.8139299", "0.8139299", "0.81374705", "0.81203765", "0.8064536", "0.7981936", "0.7978305", "0.79572064", "0.7919461", "0.77766806", "0.7552368", "0.75326085", "0.7503494", "0.7303374", "0.7289023", "0.72049916...
0.81341064
10
Test the post model can create a post.
def test_model_can_create_a_post(self): old_count = Post.objects.count() self.post.save() new_count = Post.objects.count() self.assertNotEqual(old_count, new_count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_createPost(self):\n\t\tself.client.force_authenticate(user=User.objects.get(id=1))\n\t\turl = \"/posts/\"\n\t\tdata = {\n\t\t\t'text' : 'Vivaldi',\n\t\t\t'group': 3\n\n\t\t}\n\t\tresponse = self.client.post(url, data, format='json')\n\t\tself.assertEqual(response.status_code, status.HTTP_201_CREATED)\n\t\...
[ "0.76972497", "0.76901144", "0.7592824", "0.7575863", "0.7575049", "0.7217721", "0.71589416", "0.71035886", "0.70973456", "0.6978297", "0.68787086", "0.6773834", "0.67413473", "0.66719", "0.66709095", "0.6622826", "0.6602104", "0.6596092", "0.6589066", "0.65881765", "0.657990...
0.748171
6
Test the api can get a given post.
def test_api_can_get_a_post(self): post = Post.objects.get() response = self.client.get( reverse('details', kwargs={'pk': post.id}), format="json") self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertContains(response, post)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_can_get_a_post(self):\n post = Post.objects.get()\n response = self.client.get(\n '/posts/',\n kwargs={'pk':post.id},\n format=\"json\")\n self.assertEqual(response.status_code, status.HTTP_200_OK)\n self.assertContains(response, post)", "...
[ "0.84188646", "0.73183423", "0.7141893", "0.7009258", "0.69935405", "0.69305396", "0.6915195", "0.6880087", "0.6806787", "0.6774754", "0.6758243", "0.67243093", "0.6674686", "0.66651875", "0.66651875", "0.665764", "0.66488224", "0.66298157", "0.6620121", "0.6588938", "0.65814...
0.8233141
1
Test the api can update a given post.
def test_api_can_update_post(self): post = Post.objects.get() change_post = {'name': 'Something new'} res = self.client.put( reverse('details', kwargs={'pk': post.id}), change_post, format='json' ) self.assertEqual(res.status_code, status.HTTP_200_OK)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_update_sucess(self):\n url = reverse(\n 'post-detail',\n args=[\n self.topic1.url_name,\n self.post1.id\n ]\n )\n payload = {\n 'title': 'Updated title',\n 'content': 'Updated content'\n }...
[ "0.82600814", "0.8161273", "0.8056852", "0.7757284", "0.768548", "0.7673508", "0.75947386", "0.7511743", "0.7365085", "0.73296845", "0.71662784", "0.7158504", "0.7131553", "0.7103729", "0.7097734", "0.69523513", "0.69082874", "0.6907679", "0.68628937", "0.68161815", "0.677750...
0.8063218
2
Test the api can delete a post.
def test_api_can_delete_post(self): post = Post.objects.get() response = self.client.delete( reverse('details', kwargs={'pk': post.id}), format='json', follow=True) self.assertEquals(response.status_code, status.HTTP_204_NO_CONTENT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deleting_patient_posts(self):\n\n data = {\"post\": 1}\n result = self.client.post(\"/delete-post\", data=data)\n post = Post.query.get(1)\n\n self.assertEqual(result.status_code, 200)\n self.assertIsNone(post)", "def test_post_deletion_unauthenticated(self):\n ...
[ "0.842854", "0.82658345", "0.8157572", "0.81377745", "0.8126435", "0.8124078", "0.81226575", "0.81180465", "0.79951364", "0.7985976", "0.7892938", "0.7891186", "0.78258246", "0.76914406", "0.75515044", "0.7485088", "0.7353253", "0.7309626", "0.7290812", "0.72764397", "0.71637...
0.8618328
1
Initialize new transform component.
def __init__(self): super().__init__()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n Transform.__init__(self)", "def __init__(self, transforms):\n super().__init__(transforms)\n self.S1 = transforms[0]\n self.T1 = transforms[1]\n self.S2 = transforms[2]\n self.T2 = transforms[3]", "def __init__(self, transforms):\n super()....
[ "0.7148975", "0.71066797", "0.7055589", "0.7020022", "0.6811697", "0.675439", "0.6715248", "0.6626915", "0.65724355", "0.64931387", "0.6351681", "0.62677914", "0.6217025", "0.61335707", "0.60739964", "0.60561645", "0.60507417", "0.6041276", "0.6008948", "0.5962676", "0.593482...
0.0
-1
Function to get the stations/sites associated with a particular measurement type.
def get_stations(base_url, hts, mtype): stns1 = ws.site_list(base_url, hts, location='LatLong') # There's a problem with Hilltop that requires running the site list without a measurement first... stns1 = ws.site_list(base_url, hts, location='LatLong', measurement=mtype) stns2 = stns1[(stns1.lat > -47.5) & (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stations(self):\n return self.__request('stations')['stations']", "def getStations(self) :\n return self._stations", "def stations():\n\n return station_list", "async def get_stations() -> List[WeatherStation]:\n # Check if we're really using the api, or loading from pre-generated...
[ "0.65707076", "0.6055587", "0.59859604", "0.59740144", "0.5863426", "0.5661493", "0.5657726", "0.5612368", "0.55870605", "0.5517048", "0.54724985", "0.5457293", "0.54267234", "0.5408664", "0.5404343", "0.5401727", "0.53542554", "0.5310957", "0.53051394", "0.53032815", "0.5265...
0.7278327
0