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
Tests POST requests to api/v2/parcels with no token, invalid token or unauthorized user
def test_get_all_orders_authentication(self): # Test with user token response = self.client.get( 'api/v2/parcels', headers=self.user_token_dict) data = json.loads(response.data) self.assertEqual( data, {message: 'You are not authorized to perform this operation'})...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_parcel_authentication(self):\n # Test no token in headers\n response = self.client.post(\n 'api/v2/parcels', data=json.dumps(mock_data['order']))\n data = json.loads(response.data)\n self.assertEqual(data, {message: 'Token missing'})\n self.assertEqual(...
[ "0.73205584", "0.7273098", "0.6908061", "0.6794303", "0.67267287", "0.64467967", "0.63710636", "0.6309213", "0.63001466", "0.62997603", "0.6287899", "0.62821615", "0.628114", "0.6262289", "0.6220885", "0.62079954", "0.6178712", "0.61756676", "0.6169968", "0.6161615", "0.61525...
0.6454965
5
Tests PUT requests to api/v2/parcels/ with no token, invalid token or unauthorized user
def test_deliver_authentication(self): # Test with user token response = self.client.put( 'api/v2/parcels/100/deliver', headers=self.user_token_dict) data = json.loads(response.data) self.assertEqual( data, {message: 'You are not authorized to perform this operati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_put_one(self):\n response = self.client.put('/api/v1/parcels/100')\n self.assertEqual(response.status_code, 200)", "def test_specific_order_put_authentication(self):\n # Test with user token\n response = self.client.put(\n 'api/v1/parcels/100', headers=self.user_to...
[ "0.74913204", "0.74897367", "0.72593164", "0.6901337", "0.66057515", "0.65714085", "0.65425515", "0.6518554", "0.6471985", "0.64376295", "0.64194", "0.6369903", "0.634406", "0.62940407", "0.6266905", "0.6264292", "0.62563074", "0.62482536", "0.624576", "0.62291515", "0.621908...
0.59718424
40
Tests PUT requests to api/v2/parcels//cancel with no token, invalid token or unauthorized user
def test_cancel_order_authentication(self): # Test with admin token response = self.client.put( 'api/v2/parcels/100/cancel', headers=self.admin_token_dict) data = json.loads(response.data) self.assertEqual( data, {message: 'You are not authorized to perform this o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cancel_order_authentication(self):\n # Test with admin token\n response = self.client.put(\n 'api/v1/parcels/100/cancel', headers=self.admin_token_dict)\n data = json.loads(response.data)\n self.assertEqual(data, {message: 'Cannot perform this operation'})\n s...
[ "0.7471731", "0.64067745", "0.6289672", "0.62134594", "0.6094563", "0.6086013", "0.604317", "0.6040768", "0.603638", "0.5929315", "0.5902962", "0.58905023", "0.58549476", "0.58485794", "0.5837276", "0.5761452", "0.5754863", "0.5732573", "0.56624967", "0.56433225", "0.56415117...
0.73901457
1
Populates BatchNorm params in the libpymo object
def _populate_bn_params_in_libpymo_obj(self, prev_layer_bn_params: libpymo.BNParamsHighBiasFold, bn_layer: BNLayer): prev_layer_bn_params.gamma = bn_layer.gamma prev_layer_bn_params.beta = bn_layer.beta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_batchnorm_parameters(model: torch.nn.Module, bn: Union[torch.nn.BatchNorm1d, torch.nn.BatchNorm2d]):\n with utils.in_eval_mode(model), torch.no_grad():\n gamma = bn.weight\n beta = bn.bias\n running_mean = bn.running_mean\n inv_sigma = torch.rsqrt(bn.running_var + bn.eps)...
[ "0.71370214", "0.66896135", "0.65410393", "0.6508519", "0.65036905", "0.6493454", "0.64511853", "0.63916385", "0.6315962", "0.6301169", "0.627683", "0.6265949", "0.61957926", "0.6178009", "0.6153305", "0.61401606", "0.61109626", "0.6105636", "0.6090196", "0.6089092", "0.60843...
0.57094985
63
Unicode representation of MODELNAME.
def __str__(self): return f'{self.group_name} {self.theme} {self.created_at} {self.updated_at}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self) -> str:\n return self._name(self.model).decode(\"utf-8\")", "def get_model_name(self) -> str:\n return self._get_string(openvr.Prop_RenderModelName_String)", "def __str__(self):\n return self.get('name', u'').encode('utf_8', 'replace')", "def model_name(self) -> str:\n ...
[ "0.70880556", "0.68527657", "0.64888394", "0.6418797", "0.63550997", "0.6293938", "0.6279981", "0.6259855", "0.6259855", "0.6259855", "0.6259855", "0.6259855", "0.6238393", "0.62077767", "0.61890024", "0.6182155", "0.6176263", "0.61746436", "0.6131001", "0.610253", "0.6100457...
0.0
-1
Create a data loader for the given data directory.
def __init__(self, data_dir, data_modules=ALL): self.data_dir = data_dir self.data_modules = set(data_modules)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataloaders(data_dir):\n\n trng_dataset = datasets.ImageFolder(data_dir / TRNG_FOLDER,\n transform=flowernet.trng_transform)\n trng_dataloader = torch.utils.data.DataLoader(trng_dataset,\n batch_size=64,\n ...
[ "0.7071948", "0.7054535", "0.67380935", "0.670467", "0.6644504", "0.6637068", "0.6535733", "0.65313196", "0.6489419", "0.64591736", "0.643912", "0.6398455", "0.6366409", "0.63433516", "0.631686", "0.6315694", "0.63002765", "0.62791044", "0.627288", "0.62543416", "0.6211611", ...
0.6120408
32
find ANSI escape sequences in text and remove them
def strip_from_ansi_esc_sequences(text): # esc[ + values + control character # h, l, p commands are complicated, let's ignore them seq_regex = r"\x1b\[[0-9;]*[mKJusDCBAfH]" regex = re.compile(seq_regex) start = 0 response = "" for match in regex.finditer(text): end = match.start() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_ansi(text: str):\n return _ANSI_SEQUENCE_REGEX.sub('', text)", "def strip_ansi(text):\n return ANSI_ESCAPE_RE.sub('', text)", "def strip_ansi(content):\n return ANSI_ESCAPES_REGEX.sub('', content)", "def remove_ansi_escape_sequence(self, text):\n\n # By default no string returned\n ...
[ "0.81952995", "0.8170348", "0.80998874", "0.7671045", "0.73408", "0.7281049", "0.7171884", "0.7076155", "0.69855", "0.6972858", "0.6954148", "0.68256485", "0.6768988", "0.6643025", "0.6620344", "0.6563626", "0.65395457", "0.6512516", "0.64628476", "0.64413416", "0.63898265", ...
0.82806927
0
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8193291", "0.8094472", "0.8027684", "0.80178267", "0.799257", "0.7989883", "0.7979287", "0.7974278", "0.79594076", "0.79549026", "0.79360807", "0.79330444", "0.7932846", "0.7929725", "0.79248244", "0.7923015", "0.7922415", "0.7922163", "0.7921376", "0.79207855", "0.791628"...
0.790576
23
Return external edge force in the x direction.
def fx(x, y): # Check bounds. x[ x < 0 ] = 0. y[ y < 0 ] = 0. x[ x > img.shape[1]-1 ] = img.shape[1]-1 y[ y > img.shape[0]-1 ] = img.shape[0]-1 return ggmix[ (y.round().astype(int), x.round().astype(int)) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_x__(self):\n return self.Direction['x']", "def xedges(self):\n return self.edges[0]", "def get_alien_x(self):\n return self.x", "def x(self):\n return self._turtle.xcor()", "def x(self):\n return self._turtle.xcor()", "def get_x(self):\n return self.coo...
[ "0.6501825", "0.6251096", "0.6235784", "0.6041335", "0.6041335", "0.6002977", "0.59804", "0.5970521", "0.5951013", "0.59445965", "0.5922862", "0.5875828", "0.58734757", "0.5835923", "0.5835923", "0.5835923", "0.5835923", "0.5835923", "0.5835923", "0.5835923", "0.5835923", "...
0.0
-1
Creates usable file name based on input of a tupleself.
def fname_tsk1(tup): #Task 1 & 2 fname1 = f"file_{str(tup[0]).zfill(3):}: {tup[1]:.2f}, {tup[2]:.2e}, {tup[3]:.2e}" return(fname1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_filename(doc_type, login, *args):\n filename = []\n filename.append(doc_type)\n filename.append(login)\n for item in args:\n filename.append(item)\n filename.append(datetime.datetime.now().isoformat(timespec='microseconds'))\n filename = '_...
[ "0.662992", "0.66010094", "0.6519007", "0.64161426", "0.6332648", "0.6308969", "0.62488997", "0.62391573", "0.6212638", "0.6208914", "0.61844087", "0.6179149", "0.6176257", "0.6156963", "0.6119497", "0.61137325", "0.6107827", "0.60656655", "0.5990099", "0.5985679", "0.5978507...
0.7019006
0
Creates usable file name based on input of a tupleself.
def fname_tsk3(tup): t_size = str(len(tup)) fname3 = "The " + t_size + " numbers are: " for t in tup: fname3 = fname3 + "{:d}, " return fname3[:-2].format(*tup)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fname_tsk1(tup): #Task 1 & 2\n fname1 = f\"file_{str(tup[0]).zfill(3):}: {tup[1]:.2f}, {tup[2]:.2e}, {tup[3]:.2e}\"\n return(fname1)", "def _generate_filename(doc_type, login, *args):\n filename = []\n filename.append(doc_type)\n filename.append(login)\n for item in args:\...
[ "0.7019006", "0.662992", "0.66010094", "0.6519007", "0.64161426", "0.6332648", "0.6308969", "0.62391573", "0.6212638", "0.6208914", "0.61844087", "0.6179149", "0.6176257", "0.6156963", "0.6119497", "0.61137325", "0.6107827", "0.60656655", "0.5990099", "0.5985679", "0.5978507"...
0.62488997
7
Resolve the supplied JSON data to get a store object to operate on.
def _getStoreObjectForRequest(self, txn, request): returnObject = txn classObject = None if "allowDisabledHome" in request: txn._allowDisabled = True if "homeUID" in request: home = yield txn.homeWithUID(request["homeType"], request["homeUID"]) if h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_storage_model(self, data: dict) -> None:\n if \"parent_key\" in data:\n self.parent_key = (\n data[\"parent_key\"] if data[\"parent_key\"] is not None else NoKey\n )\n del data[\"parent_key\"]\n\n self.data = self.storage_model.parse_obj(data)"...
[ "0.5526013", "0.5453758", "0.53976786", "0.5303049", "0.528338", "0.52620727", "0.52519155", "0.52351004", "0.5196495", "0.5170166", "0.51447827", "0.51447827", "0.5135737", "0.5122571", "0.51022965", "0.5099414", "0.5084166", "0.50610673", "0.50565755", "0.50548273", "0.5025...
0.0
-1
Return a new chord with one pitch different than `prev`.
def next_chord(prev, scale): # Choose which pitch should be replaced replace = random.sample(range(len(prev)), 1)[0] next = [] for i, pitch in enumerate(prev): prev_pitchspaces = [p.ps for p in prev] if i == replace: # Possible replacement pitches are within a minor third of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complement(self) -> JustLatticeChord:\n nodes = []\n for node in self._nodes:\n nodes.append(list(map(lambda x, y: y - x, node, self._root)))\n return JustLatticeChord(self._fundamental, self._root, nodes)", "def from_pitch(pitch:'Pitch', detune=0) -> 'Pitch':\n return ...
[ "0.53797233", "0.5174813", "0.49936062", "0.48446", "0.48385626", "0.48241383", "0.47621256", "0.47292593", "0.47206882", "0.46779138", "0.46747014", "0.46547133", "0.46537408", "0.4632915", "0.4622987", "0.46116307", "0.46030208", "0.45787105", "0.4565106", "0.45446482", "0....
0.6919998
0
Return the value of the state (computed in __init__).
def getValue(self, state): return self.values[state]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self, state):\n raise NotImplementedError", "def value(self, state):\n raise NotImplementedError", "def value(self, state):\n\t\traise NotImplementedError", "def getValue(self, state):\n util.raiseNotDefined()", "def getValue(self, state):\n util.raiseNotDefined()", ...
[ "0.83014333", "0.83014333", "0.826012", "0.8086146", "0.8086146", "0.79581815", "0.79296756", "0.77367806", "0.77336967", "0.77333474", "0.77333474", "0.77333474", "0.77333474", "0.77333474", "0.77333474", "0.77333474", "0.77333474", "0.77333474", "0.77333474", "0.77333474", ...
0.78013283
7
The policy is the best action in the given state according to the values currently stored in self.values. You may break ties any way you see fit. Note that if there are no legal actions, which is the case at the terminal state, you should return None.
def computeActionFromValues(self, state): # if (self.mdp.isTerminal(state)): return None # ExpectedValuesOfActions = util.Counter() # for a in self.mdp.getPossibleActions(state): ExpectedValuesOfActions[a] = self.computeQValueFromValues(state, a) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPolicy(self, state):\n \"*** YOUR CODE HERE ***\"\n # OUR CODE HERE\n possibleActions = self.mdp.getPossibleActions(state)\n #checking for terminal state (no possible actions)\n if len(possibleActions) is 0: \n return None\n \n #attempt at using the Counter\n eValsActions = ut...
[ "0.7793481", "0.7712789", "0.7614768", "0.7606609", "0.749212", "0.74679196", "0.7373764", "0.7342457", "0.73408645", "0.7338786", "0.7335963", "0.7315231", "0.7310985", "0.7309289", "0.72959334", "0.72736293", "0.7244547", "0.7244547", "0.71558684", "0.7088763", "0.7083506",...
0.70357686
23
Transform [0,1,..., 9] to onehot encoding, and return to the encoded twodimensional array
def get_one_hot_vector(number): from sklearn.preprocessing import LabelBinarizer encoder = LabelBinarizer() seed_vector = np.arange(10) encoder.fit(seed_vector) labels = encoder.transform(seed_vector) return labels.astype(np.float32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output", "def one_hot_encode(x):\n # TODO: Implement Function\n x_l = list(x)\n for index in np.arange(len(x_l)):\n x_...
[ "0.83125967", "0.81769335", "0.81170774", "0.8015078", "0.791906", "0.7837091", "0.7820394", "0.7798323", "0.7779389", "0.7738418", "0.7709548", "0.7693494", "0.7661258", "0.7661258", "0.76427895", "0.7598941", "0.7556874", "0.7553184", "0.7545116", "0.75241166", "0.7522146",...
0.6887208
86
Return a Tensor for a batch of image input
def neural_net_image_input(image_shape): # TODO: Implement Function return tf.placeholder(tf.float32, shape=[None, *image_shape], name="x")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_batch():\n return np.zeros((2, 1, 4, 4))", "def process_batch_input_for_RNN(self, batch_input):\n batch_input_ = tf.transpose(batch_input, perm=[2, 0, 1])\n x = tf.transpose(batch_input_)\n return x", "def preds(self, input_batch):\n raw_output = self._create_network(tf.cast(input_...
[ "0.6982396", "0.697684", "0.69677955", "0.69143456", "0.67242986", "0.67011863", "0.6678814", "0.6667556", "0.66644204", "0.66474915", "0.65924495", "0.6586891", "0.65809345", "0.65522945", "0.6539906", "0.64710915", "0.647023", "0.64531785", "0.6436162", "0.64322406", "0.640...
0.6354534
28
Flatten x_tensor to (Batch Size, Flattened Image Size)
def flatten(x_tensor): # TODO: Implement Function return tf.contrib.layers.flatten(x_tensor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(x_tensor):\n # TODO: Implement Function\n b, w, h, d = x_tensor.get_shape().as_list()\n img_size = w * h * d\n return tf.reshape(x_tensor, [-1, img_size])", "def flatten(self, x_tensor):\n shape = x_tensor.get_shape().as_list()\n assert len(shape) >= 4, 'shape of image is no...
[ "0.8306523", "0.81393874", "0.7994936", "0.7953008", "0.7898106", "0.76849484", "0.7661622", "0.7661622", "0.76227397", "0.76207435", "0.76207435", "0.7570651", "0.7138425", "0.6951441", "0.6934111", "0.69291353", "0.6927618", "0.6910582", "0.68756753", "0.67927945", "0.66872...
0.76103663
11
Apply a output layer to x_tensor using weight and bias
def output(x_tensor, num_outputs): # TODO: Implement Function out_w = tf.Variable(tf.truncated_normal([x_tensor.get_shape().as_list()[1], num_outputs],stddev=0.1,dtype=tf.float32)) out_b = tf.Variable(tf.zeros(num_outputs)) return tf.matmul(x_tensor,out_w)+out_b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_layer_activation(x):\n return x", "def output(x_tensor, num_outputs):\n shape = x_tensor.get_shape().as_list()\n weight = tf.Variable(tf.truncated_normal([shape[-1], num_outputs], stddev=0.1))\n bias = tf.Variable(tf.zeros(num_outputs))\n return tf.add(tf.matmul(x_tensor, weight), bias)...
[ "0.73880553", "0.7379001", "0.73780525", "0.6867772", "0.6791421", "0.6727423", "0.67101616", "0.6698643", "0.6686149", "0.66421616", "0.66083896", "0.66023237", "0.65648735", "0.6524778", "0.6484271", "0.6477665", "0.64373136", "0.64364195", "0.6411001", "0.6399274", "0.6375...
0.67592424
5
Create a convolutional neural network model
def conv_net(x, keep_prob): # TODO: Apply 1, 2, or 3 Convolution and Max Pool layers # Play around with different number of outputs, kernel size and stride # Function Definition from Above: # conv2d_maxpool(x_tensor, conv_num_outputs, conv_ksize, conv_strides, pool_ksize, pool_strides) x_max_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modelbuilder():\n model = Sequential()\n # Add a convolution layer with with a sigmoid activation function\n model.add(layers.Conv2D(1, (2, 2), strides=(1, 1), activation='sigmoid', padding='same', input_shape=(256, 256, 3)))\n model.compile(optimizer='adam', loss='mse', metrics=['accuracy'])\n ...
[ "0.75759804", "0.75662863", "0.75616914", "0.7515004", "0.7484576", "0.73029715", "0.72210497", "0.7213281", "0.7211336", "0.70952636", "0.70872176", "0.70740753", "0.70739937", "0.7005373", "0.69838446", "0.6977015", "0.6968334", "0.696391", "0.69364005", "0.6928159", "0.692...
0.0
-1
Given a function for the bprop, make the augmented function.
def _make_grad_transform(prim, fn, flags): from .pipeline import standard_parse info = NamedDebugInfo(prim=prim, name=prim.name) bprop = clone(standard_parse(fn)) bprop.flags.update(default_grad_flags) bprop.debug.name = None bprop.debug.about = About(info, "grad_bprop") # type: ignore if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bprop_assign_add(self):\n\n def bprop(x, y, out, dout):\n return zeros_like(x), zeros_like(y)\n return bprop", "def get_bprop_tensor_add(self):\n\n def bprop(x, y, out, dout):\n return binop_grad_common(x, y, dout, dout)\n return bprop", "def asympFunc(m, b):\n def f(x):\n ...
[ "0.6211309", "0.59461915", "0.5874208", "0.56668097", "0.56662613", "0.565106", "0.5624408", "0.5621167", "0.5614158", "0.5525236", "0.54894084", "0.54624623", "0.5402979", "0.5376602", "0.536553", "0.53277373", "0.53131175", "0.5299153", "0.5273826", "0.522722", "0.5211797",...
0.5579758
9
Compute synthetic reward from a single observation The network is able to process observations and actions in minibatches, but the RL paradigm enforces the agent to see observations and perform actions in sequences, therefore seeing only one at a time. `ob` and `ac` are structured as np.array([a, b, c, ...]). Since the...
def get_reward(self, ob, ac): synthetic_reward = self.compute_reward({self.p_obs: ob[None], self.p_acs: ac[None]}) return np.asscalar(synthetic_reward.flatten())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_reward(self, obs, action, state):\n pass", "def compute_reward(self, obs, action, state):\n return self._reward_func(obs, action), state", "def get_reward(self, observations, actions):\n\n #initialize and reshape as needed, for batch mode\n self.reward_dict = {}\n ...
[ "0.68257034", "0.65087414", "0.6381602", "0.6286183", "0.62671673", "0.62666655", "0.6256821", "0.6256821", "0.6256821", "0.6244689", "0.6195243", "0.61172605", "0.6112431", "0.6098619", "0.60863674", "0.6078088", "0.60432494", "0.60416967", "0.5991083", "0.5979084", "0.59311...
0.7264441
0
Get current user from request.
def get_current_user(): request = get_current_request() return getattr(request, 'user', None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(request: Request):\n return request.user", "def get_current_user():\n handler = FakeRequest()\n return handler.get_current_user()", "def getUser(self):\n user = users.get_current_user()\n if not user:\n self.redirect(users.create_login_url(self.request.uri))\n else:\n r...
[ "0.8519241", "0.8232155", "0.8183822", "0.8096185", "0.802713", "0.8012228", "0.79987454", "0.7891074", "0.7868447", "0.784084", "0.7806362", "0.78013176", "0.7761471", "0.77496386", "0.77464473", "0.77416825", "0.77416825", "0.7729171", "0.77130693", "0.7701741", "0.7701741"...
0.8582554
0
Gets the output_groups of this JobOutputRequest.
def output_groups(self) -> List[str]: return self._output_groups
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule_groups(self) -> Sequence['outputs.SubResourceResponse']:\n return pulumi.get(self, \"rule_groups\")", "def output_groups(self, output_groups: List[str]):\n\n self._output_groups = output_groups", "def groups(self):\n return self._groups", "def groups(self):\n return self....
[ "0.667067", "0.6538848", "0.6318008", "0.6318008", "0.6318008", "0.61664355", "0.6102993", "0.6026118", "0.60251427", "0.59645283", "0.5959899", "0.595008", "0.58880574", "0.587709", "0.584815", "0.5842339", "0.58296543", "0.58296543", "0.5828", "0.5797264", "0.57920253", "...
0.74742246
0
Sets the output_groups of this JobOutputRequest.
def output_groups(self, output_groups: List[str]): self._output_groups = output_groups
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def groups(self, groups):\n\n self._groups = groups", "def groups(self, groups):\n\n self._groups = groups", "def groups(self, groups):\n\n self._groups = groups", "def groups(self, groups):\n\n self._groups = groups", "def groups(self, groups):\n self._groups = groups", ...
[ "0.60427195", "0.60427195", "0.60427195", "0.60427195", "0.6015777", "0.56668305", "0.55949694", "0.55279243", "0.54233503", "0.5393023", "0.5385665", "0.5213083", "0.5128523", "0.5088395", "0.5038927", "0.48778665", "0.48674014", "0.48168725", "0.48023033", "0.47619703", "0....
0.8120981
0
Gets the log_level of this JobOutputRequest.
def log_level(self) -> str: return self._log_level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_level(self) -> str:\n return pulumi.get(self, \"log_level\")", "def get_logging_level(self):\n return self.logging_level", "def get_output_level(self):\n outlvl = self._local_logger_level\n if outlvl is None:\n outlvl = self.config.output_level\n\n return o...
[ "0.726707", "0.71368146", "0.6845141", "0.6620286", "0.6552888", "0.65294325", "0.65259063", "0.62888473", "0.62579364", "0.61068004", "0.6009926", "0.5947373", "0.59450114", "0.5854923", "0.5841083", "0.58184636", "0.5812218", "0.57855356", "0.577602", "0.57644194", "0.57643...
0.7324889
0
Return a JSON list of stations from the dataset.
def station(): session = Session(engine) results_station = session.query(Station.station, Station.name,Station.latitude,Station.longitude,Station.elevation).all() session.close() # Create a dictionary from the row data and append to a list of all_passengers station = [] for station, name, lat,l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stationdata():\n # * Return a JSON list of stations from the dataset.\n # as this should be a list, I'm just grabbing the station name\n session = Session(engine)\n results = session.query(Station.name).all()\n session.close()\n\n stations = list(np.ravel(results))\n return jsonify(stati...
[ "0.87502384", "0.87111616", "0.87103224", "0.8391929", "0.83858776", "0.8351123", "0.8318487", "0.83133906", "0.83088475", "0.82893324", "0.82849854", "0.82565653", "0.8246363", "0.82374954", "0.8237443", "0.82318974", "0.81887966", "0.81722414", "0.8110365", "0.8088061", "0....
0.7406114
34
Query the dates and temperature observations of the most active station for the last year of data. Return a JSON list of temperature observations (TOBS) for the previous year.
def tobs(): session = Session(engine) latest_day = session.query(Measurement.date).order_by(Measurement.date.desc()).first()[0] previous_year = (dt.datetime.strptime(lastest_day,'%Y-%m-%d') - dt.timedelta(days=365)).strftime('%Y-%m-%d') sel = [Measurement.date,Measurement.tobs] results_date = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tobs():\n \"\"\"Return a JSON list of temperature observations (TOBS) for the previous year.\"\"\"\n # Create a link to the session\n session = Session(engine)\n \n # Query temperature observations of the most active station for the last year of data\n\n # Find the date 1 year prior to the mo...
[ "0.82134354", "0.79607093", "0.7590075", "0.7582213", "0.7525363", "0.7524207", "0.75163716", "0.7443443", "0.74180573", "0.7396114", "0.72920954", "0.72579956", "0.72339785", "0.7225184", "0.71514684", "0.71339077", "0.7129558", "0.7056918", "0.7042582", "0.6712971", "0.6625...
0.7324824
10
Get current CPS Should return a float
def get_cps(self): return self._cps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cps(self):\n\n if self._cps is not None:\n return self._cps\n else:\n try:\n return self.counts / self.livetime\n except TypeError:\n raise SpectrumError(\n 'Unknown livetime; cannot calculate CPS from counts')", ...
[ "0.7728652", "0.7462495", "0.736031", "0.736031", "0.736031", "0.6906312", "0.68568826", "0.6835569", "0.65149987", "0.64797735", "0.64733404", "0.64303815", "0.6356482", "0.6325371", "0.6296346", "0.6296247", "0.6290065", "0.62089956", "0.6181946", "0.61742765", "0.61742765"...
0.7036479
6
Returns item with index idx.
def __getitem__(self, idx): if self.is_superset: for ds in self.data: if idx >= len(ds): continue return ds[idx] else: return self.data[idx]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item(self, index: int) -> _T:\n return self.index_to_item[index]", "def __getitem__(self, idx):\n return self.items[idx]", "def __getitem__(self, idx):\n return self.getitem(idx)", "def __getitem__(self, index: int) -> object:\n return self.get_at_index(index)", "def _ge...
[ "0.832898", "0.82507044", "0.81168145", "0.80850774", "0.79875296", "0.79526263", "0.7932083", "0.7789616", "0.77255356", "0.75987107", "0.75950813", "0.7586895", "0.7561798", "0.749712", "0.74872077", "0.746479", "0.7453728", "0.74371207", "0.74311113", "0.74311113", "0.7428...
0.6798204
94
Returns the size of the dataset.
def __len__(self): if self.is_superset: length = 0 for ds in self.data: length += len(ds) return length else: return len(self.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_size(self):\n return self.dataset.size", "def dataset_size(self):\n if not self._dataset_size:\n # pylint: disable=attribute-defined-outside-init\n self._dataset_size = count_file_lines(\n self._hparams.source_dataset.files)\n return self._dat...
[ "0.91362303", "0.8452737", "0.84227264", "0.8277792", "0.8212795", "0.81773704", "0.81773704", "0.81773704", "0.81773704", "0.8167329", "0.81317335", "0.8117853", "0.8040916", "0.8040916", "0.8040916", "0.8040916", "0.8040916", "0.8002095", "0.79609054", "0.7914592", "0.78854...
0.7689056
30
Returns a string representation of the dataset.
def __str__(self): desc = f'{self.name}\n' + '-' * len(self.name) + '\n' desc += f'Contains {len(self)} data entries.\n' if self.is_superset: for ds in self.data: desc += f'\tSubset {ds.name}: {len(ds)} entries.\n' return desc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self) -> str:\n output = f\"<Dataset(id={self.id}, name={self.dataset_name}\"\n output += f\"organisation name={self.organization_name},n\"\n output += f\"reference period={self.dataset_date}, update frequency={self.update_frequency}, \"\n output += f\"review_date={str(self...
[ "0.79439336", "0.75293446", "0.7424152", "0.71013147", "0.7079452", "0.6956595", "0.6956173", "0.6927973", "0.6896058", "0.6896037", "0.68907183", "0.6795662", "0.67601275", "0.67593396", "0.6753302", "0.6752404", "0.67262733", "0.67262733", "0.66965526", "0.6686483", "0.6686...
0.66158694
30
Splits the data and distributes it over subsets defined in split. If split does not use all data, an additional subset 'rest' is created with the leftover data.
def _split(self, split, randomise=False, **kwargs): # Copy split to prevent modifying outside arguments split = split.copy() # Compute total total = sum(split.values()) # If split contains floats, convert to integers if isinstance(total, float): assert_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_dataset(self, split):\n trunk_pos_size = math.ceil((1 - split) * len(self.Pos))\n trunk_neg_size = math.ceil((1 - split) * len(self.Neg))\n trunk_num = int(1 / (1 - split))\n pos_temp = list()\n neg_temp = list()\n for index in range(trunk_num):\n pos_...
[ "0.6969166", "0.678064", "0.6776481", "0.67285407", "0.669414", "0.6651785", "0.649411", "0.6441663", "0.6429371", "0.641902", "0.6381811", "0.6371774", "0.6371701", "0.6364564", "0.62698704", "0.62424225", "0.6232522", "0.6215225", "0.6137186", "0.6108959", "0.61049867", "...
0.78774583
0
Returns a DataLoader with this dataset.
def to_DataLoader(self, **kwargs): return DataLoader(self, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataloader(self):\n return DataLoader", "def get_dataloader(self):\n shuffle = True if self.mode == \"train\" else False\n return DataLoader(self.get_dataset(), batch_size=self.batch_size, shuffle = shuffle, \n collate_fn=create_mini_batch)", "def train_data...
[ "0.86187786", "0.8333892", "0.82286423", "0.8192484", "0.7935854", "0.7851466", "0.74647367", "0.7452953", "0.74002945", "0.73407966", "0.7292609", "0.72152376", "0.7151805", "0.7134958", "0.71027243", "0.7080524", "0.7016777", "0.7012375", "0.69368166", "0.69064885", "0.6906...
0.8152053
4
Create new instance with given arguments and default values. On object initialization, this receives all arguments and assign them to new instance. Default value is retrieved via __init__ and is assigned if no value is given. Assigned values are stored in an internal dictionary. This dictionary is NOT meant to be acces...
def __new__(cls, *args, **kwargs) -> 'ValueObject': self = super().__new__(cls) # "ValueError: Function has keyword-only arguments or annotations, use # getfullargspec() API which can support them" # names, varargs, keywords, defaults = getargspec(self.__init__) names, varargs, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n \n for arg in args:\n if isinstance(arg, dict):\n for key, value in arg.items():\n self[key] = value\n if hasattr(arg, \"__dict__\"):\n for key, value in arg.__dict__.items():\n ...
[ "0.67005736", "0.65069985", "0.64598", "0.6448414", "0.64020544", "0.633518", "0.62558806", "0.6252439", "0.62514794", "0.6251179", "0.6240231", "0.6229601", "0.6222486", "0.6198489", "0.61956495", "0.6180793", "0.61534417", "0.61451215", "0.6123032", "0.61154485", "0.6098497...
0.6293628
6
Declare arguments and default values as part of its signature. When object is initialized, given arguments and values are passed to __new__ and are stored internally. The signature below creates Friend object with first_name and last_name as its member.
def __init__(self) -> None: # Values are already set on __new__. # Override this method when value modification on initialization is # required. raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, first_name, last_name):\r\n\r\n self.first_name = first_name\r\n self.last_name = last_name", "def __init__(self, first_name, last_name):\r\n self.first_name = first_name\r\n self.last_name = last_name", "def __init__(self, first_name: str, last_name: str):\n ...
[ "0.6566118", "0.6533129", "0.6520135", "0.6396526", "0.6270195", "0.6243517", "0.6236108", "0.6236108", "0.6236108", "0.6236108", "0.6236108", "0.6236108", "0.6236108", "0.6236108", "0.62070704", "0.6170428", "0.6098812", "0.60559267", "0.60077053", "0.59991497", "0.5920224",...
0.0
-1
Create a 2D dataset and add a solution (data) to it
def __init__(self, solution, **kwargs): self.solution = solution # set solution self.parameters = kwargs # set solution parameters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataset():\n nb_subjects_per_category = 100\n\n # Generate random data using numpy\n # Two values are: Concentration of red blood cell and concentration of white blood cell\n # Generates two values and add the corresponding value with -2. Sick people get score lower than 0\n sick = np.ran...
[ "0.6351035", "0.6190176", "0.61053634", "0.6018729", "0.59998786", "0.5980181", "0.5942129", "0.5863638", "0.5839514", "0.5839195", "0.5817144", "0.5781693", "0.5770727", "0.5748257", "0.57429063", "0.573242", "0.572779", "0.5716687", "0.57129997", "0.5691505", "0.5677787", ...
0.0
-1
Pad a ``tensor`` to ``length`` with ``padding_index``.
def pad_tensor(tensor, length, padding_index=PADDING_INDEX): n_padding = length - tensor.shape[0] assert n_padding >= 0 if n_padding == 0: return tensor padding = tensor.new(n_padding, *tensor.shape[1:]).fill_(padding_index) return torch.cat((tensor, padding), dim=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_to(tensor: torch.Tensor, target_length: int, mode: str = 'constant', value: float = 0):\n return F.pad(tensor, (0, target_length - tensor.shape[-1]), mode=mode, value=value)", "def pad_tensor(self, tensor_to_be_padded: torch.Tensor, target_length: int) -> torch.Tensor:\n tensor_shape = tensor_t...
[ "0.7703311", "0.76436466", "0.72149056", "0.70546556", "0.6849222", "0.6799605", "0.67424285", "0.67271006", "0.6717288", "0.67117476", "0.66875464", "0.66755444", "0.66688985", "0.65903234", "0.6544019", "0.651025", "0.64818627", "0.6471782", "0.6427938", "0.63929456", "0.63...
0.8837795
0
Compute ``torch.equal`` with the optional mask parameter.
def torch_equals_ignore_index(tensor, tensor_other, ignore_index=None): if ignore_index is not None: assert tensor.size() == tensor_other.size() mask_arr = tensor.ne(ignore_index) tensor = tensor.masked_select(mask_arr) tensor_other = tensor_other.masked_select(mask_arr) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_equal_basic(self):\n utils.compare_tracing_methods(\n SimpleCompareOpsModule(\"equal\"),\n torch.randn(3, 4, 5),\n torch.randn(3, 4, 5),\n fusible_ops={\"aten::eq\"},\n )", "def test_equal_bcast(self):\n utils.compare_tracing_methods(\n ...
[ "0.65952444", "0.651269", "0.61210626", "0.59154624", "0.590239", "0.57997435", "0.57823455", "0.57574695", "0.5752318", "0.5749059", "0.5728955", "0.57200444", "0.57174116", "0.57143694", "0.56980896", "0.5692225", "0.56904227", "0.5652112", "0.5615237", "0.56116056", "0.561...
0.572564
11
Property for error map.
def error_map(self): return self._error_map
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(self):\n return self['error']", "def error(self):\n return self.get('error')", "def set_error(self, name, value):\n self.errors[name] = value", "def _getErrorNodesDict(self):\n return self._errorDict", "def errors(self):\n return self._properties.get(\"errors\")...
[ "0.69304156", "0.67816484", "0.6495819", "0.63686204", "0.6347542", "0.6265405", "0.62439", "0.62091583", "0.62091583", "0.62091583", "0.6153062", "0.6136196", "0.6089292", "0.6070858", "0.602166", "0.601106", "0.599149", "0.5987528", "0.5941533", "0.5936899", "0.59193116", ...
0.80975163
0
Return a normalized, absolute version of the path, relative to the current working directory.
def abspath(path: str) -> str: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_absolute_path(path):\n if not os.path.isabs(path):\n return os.path.join(os.getcwd(), path)\n else:\n return path", "def absolute_path(path):\n return os.path.abspath(os.path.normpath(path))", "def absolute_path(path):\n return os.path.abspath(\n os.path.join(\n ...
[ "0.83687335", "0.81404257", "0.7872403", "0.78601617", "0.78533274", "0.78531563", "0.77717495", "0.7706932", "0.7694184", "0.7650211", "0.763234", "0.75330055", "0.7530581", "0.75036526", "0.7387635", "0.7383283", "0.73773885", "0.7354764", "0.73445547", "0.7241759", "0.7234...
0.0
-1
Return the basename of the path.
def basename(path: str) -> str: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basename(path):\r\n return split(path)[1]", "def basename(path):\r\n return path.replace(\"\\\\\", \"/\").split(\"/\")[-1]", "def basename(path):\n\n return path.rpartition(\"/\")[2]", "def basename(file_path):\n return os.path.basename(file_path)", "def basename(self):\n return os.p...
[ "0.8845245", "0.86722565", "0.8621982", "0.83706564", "0.8304697", "0.8272658", "0.8227912", "0.80421495", "0.7991163", "0.7924859", "0.7875434", "0.7854527", "0.7852667", "0.78519994", "0.78129154", "0.77607113", "0.7731391", "0.76052004", "0.7561183", "0.75032055", "0.74933...
0.86022526
3
Get the top K scores
def top_k_result(self, score, k=1): self.candidates = [] self.candidate_sub = [] self.top_k = heapq.nlargest(n=k, iterable=score) # Iterate the Top k scores, print each score and standard term for top_i in self.top_k: max_index = score.index(top_i) # Fin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topk_score(self,scores, K=40):\n batch, channel, height, width = scores.shape\n\n # get topk score and its index in every H x W(channel dim) feature map\n topk_scores, topk_inds = torch.topk(scores.reshape(batch, channel, -1), K)\n\n topk_inds = topk_inds % (height * width)\n ...
[ "0.77677983", "0.7419715", "0.73671055", "0.731603", "0.7275869", "0.7143309", "0.70941657", "0.7089829", "0.7089708", "0.7080704", "0.7064632", "0.70400715", "0.7002847", "0.6999033", "0.69596565", "0.6934363", "0.6891679", "0.6889425", "0.6829858", "0.6818496", "0.6761483",...
0.78878367
0
Tests whether or not an invalid format argument in get_top_stories raises an error.
def test_invalid_format(api): with pytest.raises(top_stories.InvalidFormatType): api.get_stories("home", "xml")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_section(api):\n\n\twith pytest.raises(top_stories.InvalidSectionType):\n\t\tapi.get_stories(\"work\")", "def test_api_hackernews_post_topstories_comments_invalid_story_id(client):\n response = client.post(\n \"/api/hackernews/topstories/123456789/comments\",\n )\n response = json...
[ "0.6937069", "0.6035285", "0.5797513", "0.57770485", "0.57626593", "0.57400405", "0.5699425", "0.56728905", "0.5661832", "0.5647831", "0.5627534", "0.5588381", "0.55813956", "0.5528165", "0.55153316", "0.55062675", "0.55025846", "0.54994136", "0.54994136", "0.5489529", "0.548...
0.7623197
0
Tests if missing API key raises error.
def test_api_key_error(api): with pytest.raises(top_stories.APIKeyError): missingAPI = top_stories.TopStoriesAPI()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_key_not_found(self):\n runner = CliRunner()\n\n with patch(\"greynoise.cli.decorator.load_config\") as load_config:\n load_config.return_value = {\"api_key\": \"\"}\n result = runner.invoke(\n subcommand.quick,\n [\"0.0.0.0\"],\n ...
[ "0.79033613", "0.7892794", "0.77941513", "0.7780887", "0.7773254", "0.7729651", "0.76464885", "0.7511763", "0.74724627", "0.74326235", "0.7406809", "0.7406809", "0.7404959", "0.7332351", "0.7300924", "0.7267743", "0.7231532", "0.72243863", "0.7162703", "0.7127919", "0.7120389...
0.8219484
0
Class method that will return a Region object by name.
def get_object(cls, api_token, name): region = cls(token=api_token, name=name) region.load() return region
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_region_by_name(self, name):\n raise NotImplementedError()", "def region(self, region_name):\n return Region(region_name, self)", "def from_region(self, name, with_guards=None):\n return _from_region(self.data, name, with_guards)", "def findRegion(self, nameOrIndex):\n self...
[ "0.87052685", "0.75550497", "0.7218788", "0.6949454", "0.6935229", "0.65964407", "0.6455337", "0.6222211", "0.61406827", "0.61327153", "0.6108496", "0.6007549", "0.60051346", "0.5960006", "0.5947091", "0.58918864", "0.5869989", "0.5854105", "0.5847241", "0.5841671", "0.580940...
0.77118754
1
Returns the norm squared of the vector
def normSq(self): return self.x*self.x+self.y*self.y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def norm(vec):\n return sqrt(sum([i**2 for i in vec]))", "def norm(vec):\n n = 0.0\n for i in vec:\n n += math.pow(i, 2)\n return math.sqrt(n)", "def norm(vec):\n return np.linalg.norm(vec)", "def norm(vec):\n return math.sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2])", "def n...
[ "0.8298769", "0.82095206", "0.8176097", "0.817317", "0.81720406", "0.81580126", "0.81476337", "0.8131472", "0.8093642", "0.8078365", "0.8069816", "0.80674624", "0.802371", "0.80138457", "0.79788035", "0.7798855", "0.7795957", "0.7760731", "0.77479243", "0.77341485", "0.772824...
0.7251604
45
Create or return a deallocated temporary variable
def get_temp_var() -> str: if len(DEALLOCATED_TEMP_VARS) > 1: var = DEALLOCATED_TEMP_VARS.pop() ALLOCATED_TEMP_VARS.append(var) return var # Create a t<0~> variable name to be used else: i = 0 while True: var = f't{i}' if var not in ALLOCATED...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newTemp():\n global varSeq\n toRet = 'var'+str(varSeq)\n varSeq += 1\n scopeDict[currScope].insert(toRet,\"temporary\")\n return toRet", "def ptr_to_fresh(c : Contract, ty : LLVMType, name : Optional[str] = None) -> Tuple[FreshVar, SetupVal]:\n var = c.fresh_var(ty, name)\n ptr = c.alloc...
[ "0.6395274", "0.6390843", "0.575724", "0.5635352", "0.5584721", "0.5468934", "0.54300743", "0.54281807", "0.53682345", "0.53420216", "0.527939", "0.52760017", "0.5262049", "0.52112746", "0.52112746", "0.51925766", "0.51925766", "0.51500666", "0.51368546", "0.51017565", "0.508...
0.54931825
5
Returns the human action to be taken given a state and decision_rule.
def getHumanAction(self, state, coordinator_action): decision_rule = coordinator_action[0] theta = state[1] for item in decision_rule: if item[0] == theta: return item[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAction(self, state):\n # Pick Action\n legalActions = self.getLegalActions(state)\n action = None\n \"*** YOUR CODE HERE ***\"\n length_legalActions = len(legalActions) #Find length of allowed actions\n\n if length_legalActions == 0: #To check if no legal action i...
[ "0.6861973", "0.6693608", "0.65060073", "0.64857364", "0.64743453", "0.64579046", "0.64296275", "0.6377592", "0.6370395", "0.63587886", "0.6355578", "0.6339469", "0.6307149", "0.6301342", "0.629441", "0.6280883", "0.628037", "0.6263723", "0.6243748", "0.62255704", "0.6217539"...
0.7636728
0
get kth smallest value from a list with 'k' starting from 1
def kthsmall(v, k): n=len(v) k-=1 if k<0 or k >= n: return -1 l=0 u=n-1 while True: m=part(v,l,u) if m==k: return v[m] if m<k: l = m+1 else: u=m-1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kthSmallest(A, k):\n if k >= len(A):\n return None\n return select(A, 0, len(A) - 1, k)", "def k_smallest_sorted(a, k):\r\n k_smallest_idxs = np.argpartition(a, k)[:k]\r\n return k_smallest_idxs[np.argsort(a[k_smallest_idxs])]", "def findKthPositive(self, arr: 'List[int]', k: int) -> int...
[ "0.81045634", "0.76425713", "0.75812477", "0.7327748", "0.7324623", "0.70359665", "0.6939793", "0.69190466", "0.690839", "0.6852273", "0.6803172", "0.67941564", "0.6784494", "0.6763231", "0.6759229", "0.6753226", "0.67292416", "0.67117864", "0.6663033", "0.66614985", "0.66540...
0.7771161
1
find lowest index for an integer in a sorted sequence
def lowbound(v, val): n=len(v) if n==0: return -1 l=0 u=n-1 ret=-1 while l<=u: m = (l+u)/2 if v[m]==val: ret=m u=m-1 elif v[m]<val: l=m+1 else: u=m-1 return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_search(arr: Sequence) -> int:\n\tprint(arr)\n\tmin_index = None\n\tmin_elem = arr[0]\n\tfor i in range(1, len(arr)):\n\t\tif min_elem > arr[i]:\n\t\t\tmin_elem = arr[i]\n\t\t\tmin_index = i\n\treturn min_index", "def min_search(arr: Sequence) -> int:\n\tif len(arr) == 0:\n\t\tprint(\"упс\")\n\t\treturn\n...
[ "0.78934443", "0.76537174", "0.75958705", "0.7361285", "0.72589713", "0.7201597", "0.7190653", "0.71737134", "0.71194184", "0.70956343", "0.7093965", "0.7023579", "0.70129377", "0.70001054", "0.69810516", "0.69747055", "0.6960887", "0.6935362", "0.6907573", "0.6898944", "0.68...
0.64680165
55
Return datetime in DRF compatible format.
def get_drf_datetime(cls, obj_dt): return timezone.localtime( obj_dt, pytz.timezone(settings.TIME_ZONE) ).isoformat()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_datetime(self, obj):\r\n if isinstance(obj, datetime.datetime):\r\n return obj.isoformat()\r\n raise TypeError(\"Type not serializable\")", "def format_datetime(self, datetime):\n return datetime.isoformat()", "def date(self):\n return DateTime(self.created)...
[ "0.68962437", "0.6724836", "0.66399604", "0.6623574", "0.66084194", "0.65462875", "0.64898056", "0.6487453", "0.643435", "0.64156675", "0.63989735", "0.6376932", "0.63756186", "0.6372344", "0.6368928", "0.6331212", "0.6299754", "0.6298257", "0.62904376", "0.6279466", "0.62794...
0.68858385
1
Test ProjectListAPIView get() as superuser
def test_get(self): url = reverse('projectroles:api_project_list') response = self.request_knox(url) # Assert response self.assertEqual(response.status_code, 200) response_data = json.loads(response.content) self.assertEqual(len(response_data), 2) expected = [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facade_retrieve_side_effect(*args, **kwargs):\r\n if args[0] == Project:\r\n return Project(\"\", [])\r\n else:\r\n calling_user = User(user)\r\n calling_user.permissions_level = Permissions.admin\r\n return calling_user", "def...
[ "0.69355994", "0.6787859", "0.67786306", "0.677136", "0.6603126", "0.6596117", "0.6558163", "0.6558163", "0.64525294", "0.64525294", "0.6448799", "0.6419854", "0.63927966", "0.638006", "0.637043", "0.63671887", "0.6347184", "0.6338022", "0.6335789", "0.63163555", "0.6313352",...
0.6146869
31
Test ProjectListAPIView get() without roles
def test_get_no_roles(self): user_new = self.make_user('user_new') url = reverse('projectroles:api_project_list') response = self.request_knox(url, token=self.get_token(user_new)) self.assertEqual(response.status_code, 200) response_data = json.loads(response.content) sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_project_request(self):\n pass", "def test_get(self):\n url = reverse('projectroles:api_project_list')\n response = self.request_knox(url)\n\n # Assert response\n self.assertEqual(response.status_code, 200)\n response_data = json.loads(response.content)\n ...
[ "0.7904678", "0.74865276", "0.74525964", "0.7432853", "0.73811793", "0.7320233", "0.7320233", "0.72925586", "0.7242701", "0.7120682", "0.7010683", "0.7004712", "0.6981928", "0.68963933", "0.68448097", "0.6778796", "0.6687298", "0.6680755", "0.66753286", "0.6661796", "0.666113...
0.6947179
13
Test ProjectListAPIView get() with only local role
def test_get_member(self): user_new = self.make_user('user_new') self.make_assignment(self.project, user_new, self.role_contributor) url = reverse('projectroles:api_project_list') response = self.request_knox(url, token=self.get_token(user_new)) self.assertEqual(response.status_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_project_request(self):\n pass", "def test_get_project(self):\n url = reverse(\n 'projectroles:api_project_retrieve',\n kwargs={'project': self.project.sodar_uuid},\n )\n response = self.request_knox(url)\n\n self.assertEqual(response.status_c...
[ "0.7681665", "0.7281322", "0.7214148", "0.70904356", "0.7028139", "0.6994991", "0.69469804", "0.69469804", "0.6940626", "0.6857339", "0.68408954", "0.68342954", "0.68197924", "0.6795849", "0.6617926", "0.6614752", "0.65975493", "0.65824324", "0.6512808", "0.65067166", "0.6417...
0.66285896
14
Test ProjectListAPIView get() with inherited member role
def test_get_inherited_member(self): sub_category = self.make_project( 'SubCategory', PROJECT_TYPE_CATEGORY, self.category ) self.make_assignment(sub_category, self.user_owner, self.role_owner) sub_project = self.make_project( 'SubProject', PROJECT_TYPE_PROJECT, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_project_request(self):\n pass", "def test_get_project(self):\n url = reverse(\n 'projectroles:api_project_retrieve',\n kwargs={'project': self.project.sodar_uuid},\n )\n response = self.request_knox(url)\n\n self.assertEqual(response.status_c...
[ "0.74133265", "0.70474285", "0.7044653", "0.7007098", "0.6897379", "0.68662995", "0.68148017", "0.67660105", "0.67242306", "0.67242306", "0.6690685", "0.6555375", "0.6541312", "0.62956995", "0.62738085", "0.62738085", "0.6258287", "0.62463456", "0.6228392", "0.6184748", "0.61...
0.70202464
3
Test ProjectListAPIView get() with finder
def test_get_finder(self): user_new = self.make_user('user_new') self.make_assignment(self.category, user_new, self.role_finder) url = reverse('projectroles:api_project_list') response = self.request_knox(url, token=self.get_token(user_new)) self.assertEqual(response.status_code,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_project_request(self):\n pass", "def test_list_project(self):\n pass", "def test_show_project_list(self):\n fake_project = FakeResource(1)\n\n # This mocks is faking keystone retrieving a defined list of\n # projects\n patch('identity.views.Keystone.proje...
[ "0.7750695", "0.7450146", "0.73947203", "0.7294699", "0.7248585", "0.7248585", "0.7035132", "0.7007548", "0.6945372", "0.69407713", "0.6859047", "0.6839105", "0.68386805", "0.6826681", "0.67749774", "0.6770757", "0.67707247", "0.6760203", "0.6730892", "0.6683855", "0.66648257...
0.7301913
3
Test ProjectListAPIView get() with public guest access
def test_get_public_guest_access(self): self.project.public_guest_access = True self.project.save() user_new = self.make_user('user_new') url = reverse('projectroles:api_project_list') response = self.request_knox(url, token=self.get_token(user_new)) self.assertEqual(resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_project_request(self):\n pass", "def test_show_project_list(self):\n fake_project = FakeResource(1)\n\n # This mocks is faking keystone retrieving a defined list of\n # projects\n patch('identity.views.Keystone.project_list',\n Mock(return_value=[fake...
[ "0.79020435", "0.75371075", "0.74757445", "0.7298888", "0.7298888", "0.72980213", "0.72409505", "0.7128579", "0.7114131", "0.70863694", "0.70614785", "0.7027198", "0.69725674", "0.6928009", "0.69267255", "0.68801254", "0.6819525", "0.6666552", "0.66592246", "0.6635943", "0.66...
0.722582
7
Test ProjectRetrieveAPIView get() with project
def test_get_project(self): url = reverse( 'projectroles:api_project_retrieve', kwargs={'project': self.project.sodar_uuid}, ) response = self.request_knox(url) self.assertEqual(response.status_code, 200) response_data = json.loads(response.content) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_project(self):\n pass", "def test_list_project_request(self):\n pass", "def test_projects_get(self):\n response = self.client.open('/project-tracker/projects',\n method='GET')\n self.assert200(response, \"Response body is : \" + respon...
[ "0.79326415", "0.7625729", "0.75598395", "0.7499688", "0.74906474", "0.73601717", "0.73038733", "0.72550553", "0.71936166", "0.71641546", "0.7153719", "0.7149401", "0.71451634", "0.71161026", "0.70129526", "0.68695134", "0.68550575", "0.6837927", "0.68247944", "0.68247944", "...
0.775469
1
Test creating category under existing category
def test_create_category_nested(self): self.assertEqual(Project.objects.count(), 2) url = reverse('projectroles:api_project_create') post_data = { 'title': NEW_CATEGORY_TITLE, 'type': PROJECT_TYPE_CATEGORY, 'parent': str(self.category.sodar_uuid), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_category(self):\n pass", "def test_create_category(self):\n res = self.client().post('/categories/', data=self.category)\n self.assertEqual(res.status_code, 201)\n self.assertIn('Stews', str(res.data))", "def test_add_category(self):\n self.signup('Bo', 'Theo'...
[ "0.89491206", "0.8249282", "0.82180405", "0.8168712", "0.80445004", "0.8024451", "0.78857803", "0.78824323", "0.7842523", "0.782921", "0.78006643", "0.766631", "0.76176035", "0.7608156", "0.7591245", "0.7580517", "0.757002", "0.75241286", "0.7466274", "0.746318", "0.74076", ...
0.73326826
24
Test creating project with title already in category (should fail)
def test_create_project_duplicate_title(self): self.assertEqual(Project.objects.count(), 2) url = reverse('projectroles:api_project_create') post_data = { 'title': self.project.title, 'type': PROJECT_TYPE_PROJECT, 'parent': str(self.category.sodar_uuid), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_title_identical(self):\n with self.assertRaises(ValidationError):\n self.make_project(\n title='TestCategory',\n type=PROJECT_TYPE_PROJECT,\n parent=self.category,\n )", "def test_create_project_disable_categories(self):\...
[ "0.79612094", "0.785092", "0.78399557", "0.7472178", "0.74712676", "0.74712676", "0.74712676", "0.7325801", "0.7293111", "0.72701997", "0.7179715", "0.71708465", "0.7127181", "0.7055321", "0.70481604", "0.7036166", "0.70303917", "0.7019829", "0.69857085", "0.69784254", "0.696...
0.8215178
0
Test creating project with nonexistent parent (should fail)
def test_create_project_unknown_parent(self): self.assertEqual(Project.objects.count(), 2) url = reverse('projectroles:api_project_create') post_data = { 'title': NEW_PROJECT_TITLE, 'type': PROJECT_TYPE_PROJECT, 'parent': INVALID_UUID, 'description...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_project_invalid_parent(self):\n self.assertEqual(Project.objects.count(), 2)\n url = reverse('projectroles:api_project_create')\n post_data = {\n 'title': NEW_PROJECT_TITLE,\n 'type': PROJECT_TYPE_PROJECT,\n 'parent': str(self.project.sodar_uuid...
[ "0.84585804", "0.8053668", "0.8053668", "0.8053668", "0.7744661", "0.7599531", "0.74126303", "0.7319727", "0.7304935", "0.7189888", "0.7061388", "0.70342857", "0.70273864", "0.6917588", "0.68787605", "0.6861699", "0.6836607", "0.68325865", "0.68222505", "0.67960507", "0.67683...
0.84662956
0
Test creating project with project as parent (should fail)
def test_create_project_invalid_parent(self): self.assertEqual(Project.objects.count(), 2) url = reverse('projectroles:api_project_create') post_data = { 'title': NEW_PROJECT_TITLE, 'type': PROJECT_TYPE_PROJECT, 'parent': str(self.project.sodar_uuid), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_project(self):\n pass", "def test_create_project(self):\n pass", "def test_create_project(self):\n pass", "def test_create_project_unknown_parent(self):\n self.assertEqual(Project.objects.count(), 2)\n url = reverse('projectroles:api_project_create')\n ...
[ "0.8515897", "0.8515897", "0.8515897", "0.83923817", "0.7883272", "0.78793883", "0.787566", "0.7849151", "0.75227493", "0.73811364", "0.73784184", "0.73598707", "0.7335964", "0.7269568", "0.7238709", "0.71167845", "0.71133274", "0.7102127", "0.709667", "0.70821786", "0.706078...
0.84588516
3
Test creating project as TARGET with target creation disallowed (should fail)
def test_create_project_target_disabled(self): self.assertEqual(Project.objects.count(), 2) url = reverse('projectroles:api_project_create') post_data = { 'title': NEW_PROJECT_TITLE, 'type': PROJECT_TYPE_PROJECT, 'parent': str(self.category.sodar_uuid), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_project_target_enabled(self):\n self.assertEqual(Project.objects.count(), 2)\n url = reverse('projectroles:api_project_create')\n post_data = {\n 'title': NEW_PROJECT_TITLE,\n 'type': PROJECT_TYPE_PROJECT,\n 'parent': str(self.category.sodar_uui...
[ "0.7428875", "0.73888636", "0.73888636", "0.73888636", "0.6862555", "0.6816115", "0.6640188", "0.6485247", "0.6316507", "0.6267212", "0.62574077", "0.62514514", "0.6221575", "0.62139255", "0.6210207", "0.6197122", "0.61577654", "0.6144618", "0.614296", "0.6091788", "0.6088717...
0.7739278
0
Test put() for category updating
def test_put_category(self): self.assertEqual(Project.objects.count(), 2) url = reverse( 'projectroles:api_project_update', kwargs={'project': self.category.sodar_uuid}, ) put_data = { 'title': UPDATED_TITLE, 'type': PROJECT_TYPE_CATEGORY,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_category(self):\n pass", "def test_update_category(self):\n category = sample_category()\n url = category_details_url(category.id)\n self.client.put(url, {\"name\": \"school\"})\n category.refresh_from_db()\n self.assertEqual(category.name, 'school')", ...
[ "0.83673453", "0.82000196", "0.81756395", "0.7849282", "0.7762027", "0.7676135", "0.7629499", "0.7598085", "0.74799967", "0.72931594", "0.7267352", "0.7105668", "0.7097948", "0.70276207", "0.69278663", "0.6901867", "0.689937", "0.68539685", "0.684781", "0.684561", "0.68425995...
0.7666306
6
Test put() for project updating
def test_put_project(self): self.assertEqual(Project.objects.count(), 2) url = reverse( 'projectroles:api_project_update', kwargs={'project': self.project.sodar_uuid}, ) put_data = { 'title': UPDATED_TITLE, 'type': PROJECT_TYPE_PROJECT, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_project(self):\n pass", "def test_update_project(self):\n pass", "def test_projects_put(self):\n project = Project()\n response = self.client.open('/project-tracker/projects',\n method='PUT',\n dat...
[ "0.8040551", "0.8040551", "0.78589016", "0.7449258", "0.7439584", "0.73627573", "0.72931117", "0.7287686", "0.7287686", "0.7287686", "0.72782403", "0.7223989", "0.72088283", "0.71958923", "0.71629405", "0.7155814", "0.7148092", "0.71428317", "0.70836383", "0.7077166", "0.7065...
0.76809
3
Test patch() for updating category metadata
def test_patch_category(self): self.assertEqual(Project.objects.count(), 2) url = reverse( 'projectroles:api_project_update', kwargs={'project': self.category.sodar_uuid}, ) patch_data = { 'title': UPDATED_TITLE, 'description': UPDATED_DES...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_category(self):\n pass", "def test_update_category(self):\n self.update_success(self.test_data['pants'], self.test_data['shirts'])", "def test_update_category(self):\n category = sample_category()\n url = category_details_url(category.id)\n self.client.put(url...
[ "0.8102418", "0.7600256", "0.73723084", "0.73337364", "0.7243893", "0.7226353", "0.7140405", "0.70982236", "0.6955043", "0.68727946", "0.68345743", "0.6783107", "0.6757027", "0.6683372", "0.66590106", "0.6658439", "0.6657015", "0.66484004", "0.6621555", "0.65957564", "0.65752...
0.78134185
1
Test patch() for moving category inside its child (should fail)
def test_patch_project_move_child(self): new_category = self.make_project( 'NewCategory', PROJECT_TYPE_CATEGORY, self.category ) self.make_assignment(new_category, self.user, self.role_owner) url = reverse( 'projectroles:api_project_update', kwargs={'p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_project_move(self):\n self.assertEqual(\n self.project.full_title,\n self.category.title + ' / ' + self.project.title,\n )\n\n new_category = self.make_project(\n 'NewCategory', PROJECT_TYPE_CATEGORY, None\n )\n self.make_assignment...
[ "0.74703336", "0.72524846", "0.719697", "0.7141189", "0.7083989", "0.697512", "0.6817738", "0.6817738", "0.6792506", "0.67441493", "0.6721176", "0.66970724", "0.66235995", "0.65863943", "0.6443717", "0.6395794", "0.63821", "0.6306462", "0.63063204", "0.6277475", "0.6269665", ...
0.79427797
0
Test creating role for remote project (should fail)
def test_create_remote(self): # Create source site and remote project source_site = self.make_site( name=REMOTE_SITE_NAME, url=REMOTE_SITE_URL, mode=SITE_MODE_SOURCE, description=REMOTE_SITE_DESC, secret=REMOTE_SITE_SECRET, ) se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_role_to_project_member(self):\n pass", "def test_add_role(self):\n pass", "def test_create_role_existing(self):\n self.assertEqual(\n RoleAssignment.objects.filter(project=self.project).count(), 1\n )\n\n url = reverse(\n 'projectroles:api_r...
[ "0.7784803", "0.7566737", "0.75169474", "0.7486463", "0.7321579", "0.7260509", "0.7222138", "0.7133264", "0.71066326", "0.700314", "0.6995415", "0.6985415", "0.6957136", "0.6916338", "0.684184", "0.6837595", "0.68371344", "0.6782214", "0.67807156", "0.6723217", "0.6723217", ...
0.7994448
0
Test put() for owner role assignment (should fail)
def test_put_owner(self): url = reverse( 'projectroles:api_role_update', kwargs={'roleassignment': self.update_as.sodar_uuid}, ) put_data = { 'role': PROJECT_ROLE_OWNER, 'user': str(self.assign_user.sodar_uuid), } response = self.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_id_role_put(self):\n pass", "def test_put_change_user(self):\n new_user = self.make_user('new_user')\n url = reverse(\n 'projectroles:api_role_update',\n kwargs={'roleassignment': self.update_as.sodar_uuid},\n )\n put_data = {\n 'r...
[ "0.7820622", "0.75304896", "0.72289723", "0.7181799", "0.71003854", "0.69870275", "0.6981506", "0.69262683", "0.69112694", "0.6898334", "0.6875773", "0.6857838", "0.6792276", "0.6783894", "0.6783005", "0.6782433", "0.6774009", "0.67298394", "0.6706525", "0.6658555", "0.664750...
0.8584444
0
Test patch() for finder role updating in project (should fail)
def test_patch_role_finder_project(self): self.assertEqual(RoleAssignment.objects.count(), 3) url = reverse( 'projectroles:api_role_update', kwargs={'roleassignment': self.update_as.sodar_uuid}, ) patch_data = {'role': PROJECT_ROLE_FINDER} response = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_role(self):\n self.assertEqual(RoleAssignment.objects.count(), 3)\n\n url = reverse(\n 'projectroles:api_role_update',\n kwargs={'roleassignment': self.update_as.sodar_uuid},\n )\n patch_data = {'role': PROJECT_ROLE_GUEST}\n response = self.re...
[ "0.7719404", "0.75303894", "0.73562557", "0.73519486", "0.72536534", "0.72394335", "0.71336246", "0.71105206", "0.6945687", "0.69146454", "0.68857485", "0.68857485", "0.68856084", "0.6880271", "0.6867409", "0.68416137", "0.6841551", "0.6823694", "0.6767177", "0.67238283", "0....
0.8194574
0
Test patch() for finder role updating in categody
def test_patch_role_finder_category(self): user_new = self.make_user('user_new') new_as = self.make_assignment(self.category, user_new, self.role_finder) self.assertEqual(RoleAssignment.objects.count(), 4) url = reverse( 'projectroles:api_role_update', kwargs={'ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_role(self):\n self.assertEqual(RoleAssignment.objects.count(), 3)\n\n url = reverse(\n 'projectroles:api_role_update',\n kwargs={'roleassignment': self.update_as.sodar_uuid},\n )\n patch_data = {'role': PROJECT_ROLE_GUEST}\n response = self.re...
[ "0.75085396", "0.74634135", "0.7071309", "0.70705193", "0.7043695", "0.6929116", "0.691686", "0.69078434", "0.6840237", "0.68315333", "0.68222064", "0.6815904", "0.67231596", "0.6723039", "0.66786414", "0.66536725", "0.66393816", "0.6635645", "0.6618755", "0.65911824", "0.654...
0.79912484
0
Test patch() with promoted role for inherited user
def test_patch_role_inherited_promote(self): self.make_assignment( self.category, self.assign_user, self.role_contributor ) self.assertEqual(RoleAssignment.objects.count(), 4) url = reverse( 'projectroles:api_role_update', kwargs={'roleassignment': se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_role_inherited_demote(self):\n self.make_assignment(\n self.category, self.assign_user, self.role_contributor\n )\n self.assertEqual(RoleAssignment.objects.count(), 4)\n\n url = reverse(\n 'projectroles:api_role_update',\n kwargs={'roleass...
[ "0.7644994", "0.7583307", "0.74607575", "0.72281027", "0.7044906", "0.7018977", "0.68341035", "0.68340176", "0.6787392", "0.6679829", "0.6612944", "0.6536552", "0.653063", "0.6528338", "0.65032786", "0.64963174", "0.6462865", "0.6434766", "0.6395994", "0.63955295", "0.6338857...
0.7694498
0
Test patch() with equal role for inherited user
def test_patch_role_inherited_equal(self): self.make_assignment( self.category, self.assign_user, self.role_contributor ) self.assertEqual(RoleAssignment.objects.count(), 4) url = reverse( 'projectroles:api_role_update', kwargs={'roleassignment': self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_user(self):\n pass", "def test_patch_user(self):\n new_user = self.make_user('new_user')\n url = reverse(\n 'projectroles:api_role_update',\n kwargs={'roleassignment': self.update_as.sodar_uuid},\n )\n patch_data = {'user': str(new_user.soda...
[ "0.78990936", "0.759471", "0.74286824", "0.7268155", "0.70871186", "0.7072328", "0.6928202", "0.68061286", "0.67484105", "0.6727917", "0.67208874", "0.6714333", "0.6677363", "0.6650105", "0.66095865", "0.66089076", "0.65907776", "0.65863234", "0.65277046", "0.64907646", "0.64...
0.70537776
6
Test patch() with demoted role for inherited user (should fail)
def test_patch_role_inherited_demote(self): self.make_assignment( self.category, self.assign_user, self.role_contributor ) self.assertEqual(RoleAssignment.objects.count(), 4) url = reverse( 'projectroles:api_role_update', kwargs={'roleassignment': sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_user(self):\n pass", "def test_patch_user(self):\n new_user = self.make_user('new_user')\n url = reverse(\n 'projectroles:api_role_update',\n kwargs={'roleassignment': self.update_as.sodar_uuid},\n )\n patch_data = {'user': str(new_user.soda...
[ "0.75244725", "0.7442128", "0.7433443", "0.70728", "0.7069245", "0.68443775", "0.6740219", "0.6690396", "0.66817975", "0.6576239", "0.6569521", "0.6556387", "0.6547557", "0.65293366", "0.6451804", "0.6392238", "0.6380254", "0.63730365", "0.63648725", "0.6342819", "0.6336431",...
0.7780059
0
Test patch() for updating role in remote project (should fail)
def test_patch_role_remote(self): # Create source site and remote project source_site = self.make_site( name=REMOTE_SITE_NAME, url=REMOTE_SITE_URL, mode=SITE_MODE_SOURCE, description=REMOTE_SITE_DESC, secret=REMOTE_SITE_SECRET, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_patch_role(self):\n self.assertEqual(RoleAssignment.objects.count(), 3)\n\n url = reverse(\n 'projectroles:api_role_update',\n kwargs={'roleassignment': self.update_as.sodar_uuid},\n )\n patch_data = {'role': PROJECT_ROLE_GUEST}\n response = self.re...
[ "0.7723557", "0.757292", "0.7558679", "0.7420562", "0.7377581", "0.72499967", "0.7198901", "0.7153708", "0.71399456", "0.7015667", "0.6994105", "0.69830215", "0.69506687", "0.6923917", "0.6882876", "0.68598706", "0.68052113", "0.67976236", "0.67692626", "0.67692626", "0.67668...
0.8184482
0
Test delete for owner deletion (should fail)
def test_delete_owner(self): self.assertEqual(RoleAssignment.objects.count(), 3) url = reverse( 'projectroles:api_role_destroy', kwargs={'roleassignment': self.owner_as.sodar_uuid}, ) response = self.request_knox(url, method='DELETE') self.assertEqual(resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_destroy_owner(self):\n\n self.assertEqual(first=1, second=Post.objects.all().count())\n url = reverse('post-detail', args=(self.post.id,))\n self.client.credentials(HTTP_AUTHORIZATION=self.token)\n response = self.client.delete(path=url)\n self.assertEqual(first=204, sec...
[ "0.78570163", "0.77476597", "0.7741425", "0.7639169", "0.7621067", "0.7612775", "0.7565456", "0.7509714", "0.7494346", "0.7494346", "0.74766904", "0.74308014", "0.7414567", "0.7330051", "0.7318409", "0.7305346", "0.7284253", "0.7261282", "0.72566116", "0.72308606", "0.7223298...
0.77241564
3
Test transfer with finder role in project (should fail)
def test_transfer_finder_project(self): self.make_assignment(self.project, self.user_new, self.role_contributor) self.assertEqual(self.project.get_owner().user, self.user_owner) url = reverse( 'projectroles:api_role_owner_transfer', kwargs={'project': self.project.sodar_u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_transfer(self):\n # Assign role to new user\n self.make_assignment(self.project, self.user_new, self.role_contributor)\n self.assertEqual(self.project.get_owner().user, self.user_owner)\n url = reverse(\n 'projectroles:api_role_owner_transfer',\n kwargs={'...
[ "0.7344242", "0.72632235", "0.7032054", "0.6779671", "0.66169727", "0.6425907", "0.63559794", "0.62721515", "0.6263589", "0.6205863", "0.61731225", "0.61605805", "0.61605805", "0.61482555", "0.61282754", "0.6125832", "0.6116205", "0.608751", "0.6038754", "0.6037594", "0.60199...
0.78007156
0
Test transfer to new owner with inherited nonowner role
def test_transfer_new_inherited_member(self): self.make_assignment( self.category, self.user_new, self.role_contributor ) self.assertEqual( self.project.get_owners(inherited_only=True)[0].user, self.user_owner_cat, ) url = reverse( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_transfer_new_inherited_owner(self):\n self.assertEqual(self.project.get_owner().user, self.user_owner)\n self.assertEqual(\n self.project.get_owners(inherited_only=True)[0].user,\n self.user_owner_cat,\n )\n url = reverse(\n 'projectroles:api_ro...
[ "0.8504203", "0.8328822", "0.83080983", "0.8238964", "0.81195587", "0.80647117", "0.79838526", "0.77421266", "0.7669591", "0.76437044", "0.7212461", "0.7168092", "0.71289027", "0.705871", "0.70416045", "0.6999758", "0.6855712", "0.666621", "0.6643053", "0.66331464", "0.657214...
0.8233713
4
Test transfer to new owner with inherited owner role
def test_transfer_new_inherited_owner(self): self.assertEqual(self.project.get_owner().user, self.user_owner) self.assertEqual( self.project.get_owners(inherited_only=True)[0].user, self.user_owner_cat, ) url = reverse( 'projectroles:api_role_owner_tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_transfer_old_inherited_owner(self):\n self.owner_as_cat.user = self.user_owner\n self.owner_as_cat.save()\n self.assertEqual(self.project.get_role(self.user_owner), self.owner_as)\n url = reverse(\n 'projectroles:api_role_owner_transfer',\n kwargs={'projec...
[ "0.84038466", "0.82980084", "0.8296405", "0.8264756", "0.80747116", "0.80176806", "0.79217374", "0.78884906", "0.77914965", "0.7326524", "0.72909516", "0.7237495", "0.72016525", "0.71322525", "0.70887315", "0.70843256", "0.7059956", "0.68336785", "0.67603046", "0.6576064", "0...
0.8652063
0
Test creating invite for owner role (should fail)
def test_create_owner(self): self.assertEqual( ProjectInvite.objects.filter(project=self.project).count(), 0 ) url = reverse( 'projectroles:api_invite_create', kwargs={'project': self.project.sodar_uuid}, ) post_data = { 'email': I...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_teams_invite_member(self):\n pass", "def test_create_owner(self):\n url = reverse(\n 'projectroles:api_role_create',\n kwargs={'project': self.project.sodar_uuid},\n )\n post_data = {\n 'role': PROJECT_ROLE_OWNER,\n 'user': str(self...
[ "0.7389611", "0.71902037", "0.71074605", "0.7101482", "0.7033463", "0.6990546", "0.6974802", "0.6961169", "0.69468045", "0.69171304", "0.68949497", "0.68588483", "0.6847521", "0.6806529", "0.67770267", "0.6769337", "0.6735287", "0.6713361", "0.67120177", "0.6698361", "0.66947...
0.7905464
0
Test creating invite for delegate role
def test_create_delegate(self): self.assertEqual( ProjectInvite.objects.filter(project=self.project).count(), 0 ) url = reverse( 'projectroles:api_invite_create', kwargs={'project': self.project.sodar_uuid}, ) post_data = { 'email'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_delegate_limit(self):\n del_user = self.make_user('delegate')\n self.make_assignment(self.project, del_user, self.role_delegate)\n self.assertEqual(\n ProjectInvite.objects.filter(project=self.project).count(), 0\n )\n\n url = reverse(\n 'pro...
[ "0.7611283", "0.74242353", "0.73539287", "0.73403287", "0.73315966", "0.7187323", "0.71724725", "0.7130378", "0.7031382", "0.70134735", "0.6990878", "0.69478613", "0.68900406", "0.68151414", "0.6797569", "0.67298144", "0.6716701", "0.6713479", "0.65999305", "0.659701", "0.658...
0.78871506
0
Test creating invite with invalid email (should fail)
def test_create_invalid_email(self): self.assertEqual( ProjectInvite.objects.filter(project=self.project).count(), 0 ) url = reverse( 'projectroles:api_invite_create', kwargs={'project': self.project.sodar_uuid}, ) post_data = { 'e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validates_email_not_already_invited_on_create(self):\n # Make an invitation with the same email address, but with different capitalisation\n self.project.invitations.create(email = 'Joe.Bloggs@example.com')\n invitation = Invitation(project = self.project, email = 'joe.bloggs@example....
[ "0.7802406", "0.7624988", "0.7562853", "0.7512872", "0.7452844", "0.7442258", "0.7405405", "0.739286", "0.7392322", "0.73780555", "0.7368247", "0.7366225", "0.73388034", "0.73303133", "0.7328777", "0.7324245", "0.731372", "0.7312899", "0.7302413", "0.73001206", "0.72891617", ...
0.85070086
0
Test creating invite for remote project (should fail)
def test_create_remote(self): # Set up remote site and project source_site = self.make_site( name=REMOTE_SITE_NAME, url=REMOTE_SITE_URL, mode=SITE_MODE_SOURCE, description=REMOTE_SITE_DESC, secret=REMOTE_SITE_SECRET, ) self.make...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_request_project_invitation(self):\n pass", "def test_create(self):\n self.assertEqual(\n ProjectInvite.objects.filter(project=self.project).count(), 0\n )\n\n url = reverse(\n 'projectroles:api_invite_create',\n kwargs={'project': self.project...
[ "0.82931834", "0.76462704", "0.7597827", "0.75752515", "0.7549095", "0.74231225", "0.7407474", "0.739289", "0.7374301", "0.7364446", "0.73117787", "0.7247463", "0.72448385", "0.72132164", "0.7112611", "0.71119606", "0.70572263", "0.7022395", "0.70019543", "0.69986576", "0.695...
0.8293971
0
Test revoking delegate invite with sufficient perms
def test_revoke_delegate(self): self.invite.role = self.role_delegate self.invite.save() url = reverse( 'projectroles:api_invite_revoke', kwargs={'projectinvite': self.invite.sodar_uuid}, ) response = self.request_knox(url, method='POST') self.asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_revoke_delegate_no_perms(self):\n self.invite.role = self.role_delegate\n self.invite.save()\n delegate = self.make_user('delegate')\n self.make_assignment(self.project, delegate, self.role_delegate)\n url = reverse(\n 'projectroles:api_invite_revoke',\n ...
[ "0.81818855", "0.76853967", "0.70116675", "0.6884054", "0.6693552", "0.66888785", "0.6556315", "0.6128789", "0.60673004", "0.602977", "0.60050404", "0.600338", "0.5983393", "0.5965144", "0.596342", "0.5944151", "0.58989424", "0.58979", "0.58853936", "0.5875885", "0.58731073",...
0.7965644
1
Test revoking delegate invite without perms (should fail)
def test_revoke_delegate_no_perms(self): self.invite.role = self.role_delegate self.invite.save() delegate = self.make_user('delegate') self.make_assignment(self.project, delegate, self.role_delegate) url = reverse( 'projectroles:api_invite_revoke', kwargs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_revoke_delegate(self):\n self.invite.role = self.role_delegate\n self.invite.save()\n url = reverse(\n 'projectroles:api_invite_revoke',\n kwargs={'projectinvite': self.invite.sodar_uuid},\n )\n response = self.request_knox(url, method='POST')\n ...
[ "0.81076163", "0.7830668", "0.7330901", "0.7004826", "0.6874727", "0.6746522", "0.6697652", "0.63642067", "0.6360158", "0.62908685", "0.6285968", "0.62406135", "0.62298155", "0.6206612", "0.6206365", "0.61377186", "0.6131367", "0.61029744", "0.60972965", "0.60631686", "0.6041...
0.83221334
0
Test resending delegate invite with sufficient perms
def test_resend_delegate(self): self.invite.role = self.role_delegate self.invite.save() url = reverse( 'projectroles:api_invite_resend', kwargs={'projectinvite': self.invite.sodar_uuid}, ) response = self.request_knox(url, method='POST') self.asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_resend_delegate_no_perms(self):\n self.invite.role = self.role_delegate\n self.invite.save()\n delegate = self.make_user('delegate')\n self.make_assignment(self.project, delegate, self.role_delegate)\n\n url = reverse(\n 'projectroles:api_invite_resend',\n ...
[ "0.7960238", "0.74758977", "0.72616076", "0.6969002", "0.6858194", "0.6519309", "0.6210866", "0.62105614", "0.61719215", "0.6158267", "0.61065227", "0.6070081", "0.60651463", "0.604935", "0.6022254", "0.59836584", "0.5961608", "0.5924828", "0.5923032", "0.5901985", "0.5884472...
0.7457714
2
Test resending delegate invite without perms (should fail)
def test_resend_delegate_no_perms(self): self.invite.role = self.role_delegate self.invite.save() delegate = self.make_user('delegate') self.make_assignment(self.project, delegate, self.role_delegate) url = reverse( 'projectroles:api_invite_resend', kwarg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_revoke_delegate_no_perms(self):\n self.invite.role = self.role_delegate\n self.invite.save()\n delegate = self.make_user('delegate')\n self.make_assignment(self.project, delegate, self.role_delegate)\n url = reverse(\n 'projectroles:api_invite_revoke',\n ...
[ "0.7730911", "0.7613365", "0.7542539", "0.71881825", "0.7039568", "0.65023404", "0.6469419", "0.64266986", "0.64194804", "0.6380715", "0.6371246", "0.63472223", "0.6318336", "0.62380123", "0.6236045", "0.62127316", "0.6067834", "0.6054892", "0.6049412", "0.60386187", "0.60162...
0.81594527
0
Test resending invite with invalid UUID
def test_resend_not_found(self): url = reverse( 'projectroles:api_invite_resend', kwargs={'projectinvite': INVALID_UUID}, ) response = self.request_knox(url, method='POST') self.assertEqual(response.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_resend_inactive(self):\n self.invite.active = False\n self.invite.save()\n url = reverse(\n 'projectroles:api_invite_resend',\n kwargs={'projectinvite': self.invite.sodar_uuid},\n )\n response = self.request_knox(url, method='POST')\n self.as...
[ "0.66938126", "0.64909256", "0.6474229", "0.64177763", "0.6402118", "0.62236863", "0.6204726", "0.6180395", "0.61753577", "0.6125419", "0.61154425", "0.6037084", "0.6031721", "0.6006309", "0.59975404", "0.5992774", "0.59743834", "0.5970398", "0.5949542", "0.5914724", "0.58978...
0.6591699
1
Test retrieving unset PROJECT setting (should return default)
def test_retrieve_project_unset(self): setting_name = 'project_str_setting' default_value = app_settings.get_default(EX_APP_NAME, setting_name) q_kwargs = { 'app_plugin__name': EX_APP_NAME, 'name': setting_name, 'project': self.project, } AppSe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_retrieve_project_user_unset(self):\n setting_name = 'project_user_str_setting'\n default_value = app_settings.get_default(EX_APP_NAME, setting_name)\n q_kwargs = {\n 'app_plugin__name': EX_APP_NAME,\n 'name': setting_name,\n 'project': self.project,\n ...
[ "0.72085345", "0.71948344", "0.70441943", "0.6993154", "0.6877588", "0.67467237", "0.6704457", "0.66822", "0.6582077", "0.6533346", "0.6520467", "0.6515787", "0.6465326", "0.6425774", "0.64071035", "0.6355628", "0.63461196", "0.6346107", "0.6346107", "0.63325864", "0.63163453...
0.79379684
0
Test retrieving app setting with PROJECT_USER scope
def test_retrieve_project_user(self): setting_name = 'project_user_str_setting' url = reverse( 'projectroles:api_project_setting_retrieve', kwargs={'project': self.project.sodar_uuid}, ) get_data = { 'app_name': EX_APP_NAME, 'setting_name':...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_retrieve_project_user_unset(self):\n setting_name = 'project_user_str_setting'\n default_value = app_settings.get_default(EX_APP_NAME, setting_name)\n q_kwargs = {\n 'app_plugin__name': EX_APP_NAME,\n 'name': setting_name,\n 'project': self.project,\n ...
[ "0.7416669", "0.7328382", "0.7320333", "0.6799349", "0.6787784", "0.6780627", "0.6742443", "0.6733997", "0.6656473", "0.6653969", "0.656695", "0.6440223", "0.6405878", "0.63447005", "0.6335134", "0.6203126", "0.61907846", "0.6165728", "0.6146825", "0.6062652", "0.6058904", ...
0.7347148
1
Test setting app setting with invalid app name (should fail)
def test_retrieve_invalid_app_name(self): setting_name = 'project_str_setting' url = reverse( 'projectroles:api_project_setting_retrieve', kwargs={'project': self.project.sodar_uuid}, ) get_data = { 'app_name': 'NON-EXISTING-APP', 'setting_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_invalid_app_name(self):\n setting_name = 'project_str_setting'\n url = reverse(\n 'projectroles:api_project_setting_set',\n kwargs={'project': self.project.sodar_uuid},\n )\n post_data = {\n 'app_name': 'NON-EXISTING-APP',\n 'sett...
[ "0.84166306", "0.83549005", "0.8059631", "0.7208779", "0.7056317", "0.70330197", "0.6963345", "0.69415325", "0.6893585", "0.663794", "0.6483643", "0.647744", "0.6380014", "0.6266738", "0.62560415", "0.6236068", "0.62154025", "0.62090373", "0.6177469", "0.6154339", "0.6091285"...
0.8086905
2
Test setting app setting value with PROJECT_USER scope
def test_set_project_user(self): self.assertEqual(AppSetting.objects.count(), 0) setting_name = 'project_user_str_setting' url = reverse( 'projectroles:api_project_setting_set', kwargs={'project': self.project.sodar_uuid}, ) post_data = { 'app_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_invalid_scope_project_user(self):\n setting_name = 'project_user_str_setting'\n url = reverse('projectroles:api_user_setting_set')\n post_data = {\n 'app_name': EX_APP_NAME,\n 'setting_name': setting_name,\n 'value': 'value',\n }\n re...
[ "0.72608835", "0.70460093", "0.6945712", "0.69287735", "0.6824163", "0.6731177", "0.66837096", "0.64694697", "0.6320714", "0.6318415", "0.63001084", "0.62376946", "0.621422", "0.62123495", "0.6204667", "0.6180628", "0.6143501", "0.6137492", "0.61278546", "0.6124334", "0.61223...
0.768141
0
Test setting app setting with invalid app name (should fail)
def test_set_invalid_app_name(self): setting_name = 'project_str_setting' url = reverse( 'projectroles:api_project_setting_set', kwargs={'project': self.project.sodar_uuid}, ) post_data = { 'app_name': 'NON-EXISTING-APP', 'setting_name': se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_invalid_app_name(self):\n setting_name = 'NON-EXISTING-APP'\n url = reverse('projectroles:api_user_setting_set')\n post_data = {\n 'app_name': EX_APP_NAME,\n 'setting_name': setting_name,\n 'value': 'value',\n }\n response = self.requ...
[ "0.83549005", "0.8086905", "0.8059631", "0.7208779", "0.7056317", "0.70330197", "0.6963345", "0.69415325", "0.6893585", "0.663794", "0.6483643", "0.647744", "0.6380014", "0.6266738", "0.62560415", "0.6236068", "0.62154025", "0.62090373", "0.6177469", "0.6154339", "0.6091285",...
0.84166306
0
Test retrieving app setting with USER scope
def test_retrieve(self): setting_name = 'user_str_setting' url = reverse('projectroles:api_user_setting_retrieve') get_data = {'app_name': EX_APP_NAME, 'setting_name': setting_name} response = self.request_knox(url, data=get_data) self.assertEqual(response.status_code, 200, msg=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_retrieve_project_user_unset(self):\n setting_name = 'project_user_str_setting'\n default_value = app_settings.get_default(EX_APP_NAME, setting_name)\n q_kwargs = {\n 'app_plugin__name': EX_APP_NAME,\n 'name': setting_name,\n 'project': self.project,\n ...
[ "0.69745034", "0.68947834", "0.68358105", "0.681227", "0.68119293", "0.66418034", "0.65758795", "0.6528667", "0.6526934", "0.6443881", "0.6429206", "0.64270353", "0.6393016", "0.62613666", "0.621978", "0.61481947", "0.6101049", "0.6094436", "0.6089339", "0.6080168", "0.608006...
0.69250566
1
Test retrieving USER setting with invalid app name (should fail)
def test_retrieve_invalid_app_name(self): setting_name = 'user_str_setting' url = reverse('projectroles:api_user_setting_retrieve') get_data = { 'app_name': 'NON-EXISTING-APP', 'setting_name': setting_name, } response = self.request_knox(url, data=get_data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_retrieve_invalid_app_name(self):\n setting_name = 'project_str_setting'\n url = reverse(\n 'projectroles:api_project_setting_retrieve',\n kwargs={'project': self.project.sodar_uuid},\n )\n get_data = {\n 'app_name': 'NON-EXISTING-APP',\n ...
[ "0.7517494", "0.7360339", "0.73386294", "0.7059068", "0.70017844", "0.6997709", "0.6860118", "0.6810035", "0.6776564", "0.66329837", "0.6549993", "0.6536088", "0.64886", "0.64601195", "0.6376473", "0.63473725", "0.63305587", "0.63025916", "0.62020916", "0.6171966", "0.6104142...
0.81514084
0
Test setting with invalid app name (should fail)
def test_set_invalid_app_name(self): setting_name = 'NON-EXISTING-APP' url = reverse('projectroles:api_user_setting_set') post_data = { 'app_name': EX_APP_NAME, 'setting_name': setting_name, 'value': 'value', } response = self.request_knox(url,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_invalid_app_name(self):\n setting_name = 'project_str_setting'\n url = reverse(\n 'projectroles:api_project_setting_set',\n kwargs={'project': self.project.sodar_uuid},\n )\n post_data = {\n 'app_name': 'NON-EXISTING-APP',\n 'sett...
[ "0.81214994", "0.8032545", "0.8012612", "0.6872032", "0.67458546", "0.6697793", "0.6579298", "0.6534703", "0.6504582", "0.6358623", "0.6333138", "0.63232774", "0.6294241", "0.6229495", "0.61846185", "0.6179067", "0.6154037", "0.6151156", "0.61111295", "0.6101304", "0.608092",...
0.8091485
1
Test setting with PROJECT scope (should fail)
def test_set_invalid_scope_project(self): setting_name = 'project_str_setting' url = reverse('projectroles:api_user_setting_set') post_data = { 'app_name': EX_APP_NAME, 'setting_name': setting_name, 'value': 'value', } response = self.request_k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_invalid_scope_project_user(self):\n setting_name = 'project_user_str_setting'\n url = reverse('projectroles:api_user_setting_set')\n post_data = {\n 'app_name': EX_APP_NAME,\n 'setting_name': setting_name,\n 'value': 'value',\n }\n re...
[ "0.7188474", "0.702382", "0.70112586", "0.6998374", "0.69888043", "0.69025683", "0.68306965", "0.6741066", "0.6741066", "0.6708721", "0.6708108", "0.66716075", "0.6613061", "0.6511293", "0.6502901", "0.6498592", "0.64279056", "0.6415585", "0.6407384", "0.64071715", "0.6366148...
0.7507097
0
Test UserListAPIView get() as regular user
def test_get(self): url = reverse('projectroles:api_user_list') response = self.request_knox( url, token=self.get_token(self.domain_user) ) self.assertEqual(response.status_code, 200) response_data = json.loads(response.content) self.assertEqual(len(response_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_user_get(self):\n pass", "def test_list_user(self):\n pass", "def test_users_get(self):\n pass", "def test_users_get(self):\n pass", "def test_user_list(self):\r\n self._add_demo_import()\r\n params = {\r\n 'api_key': self.api_key\r\n ...
[ "0.81500524", "0.75338453", "0.7514704", "0.7514704", "0.7514667", "0.73992753", "0.7385937", "0.73615605", "0.7234876", "0.7229685", "0.72232544", "0.7195423", "0.71696955", "0.7137321", "0.71287364", "0.70772916", "0.7054506", "0.7047272", "0.7041793", "0.6975407", "0.69693...
0.7310911
8
Test retrieving project data with invalid secret (should fail)
def test_get_invalid_secret(self): response = self.client.get( reverse( 'projectroles:api_remote_get', kwargs={'secret': build_secret()} ) ) self.assertEqual(response.status_code, 401)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_secret_4(self):\n self.assertIsNone(\n get_secret(\"plain text, no secrets here\")\n )", "def test_authentication_is_not_required(self):\n # Act\n response = self.client.get(self.url)\n # Assert\n self.assertEqual(response.status_code, 200)\n ...
[ "0.68311876", "0.68136746", "0.66883266", "0.66048455", "0.65973055", "0.65572137", "0.65191597", "0.65191597", "0.64828026", "0.64811504", "0.64724463", "0.64333344", "0.6433298", "0.641001", "0.6389318", "0.6357573", "0.62985444", "0.62703025", "0.6266612", "0.6259999", "0....
0.7328321
0