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
Append a new node containing data to the end of the single linked list.
def append(self, data): new_node = Node(data) if self.head is None: self.head = new_node self.tail = new_node else: self.tail.next = new_node self.tail = new_node self.size += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(self, data):\n new_node = SingleNode(data)\n\n if self.head is None:\n self.head = new_node\n return\n last_node = self.head\n while last_node.next:\n last_node = last_node.next\n last_node.next = new_node", "def append_node(self, new...
[ "0.86189765", "0.8447595", "0.8386236", "0.83651173", "0.83552116", "0.8319824", "0.8319824", "0.8225419", "0.8215285", "0.8192819", "0.8074252", "0.8014681", "0.7982666", "0.7981225", "0.77045745", "0.76600313", "0.7647342", "0.7595103", "0.75793743", "0.75441706", "0.752379...
0.79826045
13
Returns the unitary for this gate, see Unitary for more info.
def get_unitary(self, params: Sequence[float] = []) -> UnitaryMatrix: self.check_parameters(params) if hasattr(self, 'utry'): return self.utry return self.gate.get_unitary(params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unit(self):\n return self.unit", "def unit(self):\n return self._unit", "def unit(self):\n return self.__unit", "def unit(self):\n return self._unit", "def unit(self):\n return self._unit", "def unit_y(cls):\n return cls(0, 1, 0)", "def getUnit(self, *ar...
[ "0.6853074", "0.6796897", "0.6787496", "0.67088467", "0.67088467", "0.64119154", "0.6364377", "0.63519824", "0.63118136", "0.63069683", "0.6300979", "0.62563705", "0.62363553", "0.62363553", "0.62363553", "0.62363553", "0.62363553", "0.62363553", "0.62363553", "0.62363553", "...
0.73084533
0
Returns the gradient for this gate, see Gate for more info.
def get_grad(self, params: Sequence[float] = []) -> np.ndarray: self.check_parameters(params) if hasattr(self, 'utry'): return np.array([]) return self.gate.get_grad(params) # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gradient(self):\n # Fast path\n if self._gradient is not None:\n return self._gradient\n # Flatten (make if necessary)\n gradient = tools.flatten(tools.grads_of(self._model.parameters()))\n self._gradient = gradient\n return gradient", "def get_grad(self):\n\n return self._g...
[ "0.8085759", "0.80038965", "0.77770317", "0.77462053", "0.77197397", "0.76745313", "0.7669742", "0.7668911", "0.75381553", "0.7504617", "0.74778986", "0.74767464", "0.7301407", "0.7287206", "0.7258881", "0.7254634", "0.71921414", "0.71770763", "0.71519166", "0.71435493", "0.7...
0.67906106
42
Sigmoid crossentropy loss with masking.
def masked_sigmoid_cross_entropy(preds, labels, mask): loss_all = tf.nn.sigmoid_cross_entropy_with_logits( logits=preds, labels=labels) mask = tf.cast(mask, dtype=tf.float32) mask /= tf.reduce_mean(mask) loss = tf.multiply(loss_all, mask[:, tf.newaxis]) return tf.reduce_mean(loss)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def masked_sigmoid_cross_entropy(logits, labels, mask):\n labels = tf.cast(labels, dtype=tf.float32)\n loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=logits, labels=labels)\n loss=tf.reduce_mean(loss,axis=1)\n mask = tf.cast(mask, dtype=tf.float32)\n mask /= tf.reduce_mean...
[ "0.7949688", "0.78518355", "0.7637674", "0.72210187", "0.7200605", "0.7150354", "0.71353704", "0.7117875", "0.7117875", "0.7117875", "0.7099961", "0.7070966", "0.69130826", "0.6911134", "0.6868177", "0.6819512", "0.6773145", "0.6752702", "0.6731546", "0.66547775", "0.6646067"...
0.79726803
0
Initialises the MiriExposureModel class.
def __init__(self, rows, columns, ngroups, nints, readpatt, refrows, refcolumns, grpavg=1, intavg=1, nframes=1, groupgap=0, pixeldq=None, maskwith=None, pixeldq_def=None, groupdq_def=None, include_pixeldq=True, include_groupdq=True, **kwargs): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, exposure = -1):\n self.cam = None\n self.exposure = exposure\n\n self._set_camera()", "def __init__(self):\n self.state = Idle\n self.currExposure = Exposure(None, None, None)\n self.expTimer = Timer()\n self.readTimer = Timer()\n self.ex...
[ "0.6517298", "0.6418817", "0.59929997", "0.5951605", "0.59366703", "0.58338016", "0.57690865", "0.57419914", "0.57396114", "0.57217246", "0.5698535", "0.56610936", "0.5641671", "0.5586444", "0.5565851", "0.5499736", "0.5473636", "0.54540354", "0.54388964", "0.54272485", "0.54...
0.0
-1
Return the contents of the exposure model object as a readable string.
def __str__(self): # First obtain a string describing the underlying ramp # model. strg = super(MiriExposureModel, self).__str__() # Also display the averaged data. if self.grpavg > 1 or self.intavg > 1: title = self.get_data_title('data') title +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n\n mod = f\"{self.__class__.__name__} Model\"\n try:\n mod += f': {self.filename}'\n except AttributeError:\n pass\n s = [mod]\n for name, v in self.metadata.items():\n s += [f\"{name:16} : {v}\"]\n return '\\n'.join(s)...
[ "0.70264465", "0.6700946", "0.6669181", "0.65950733", "0.65223527", "0.65142846", "0.64414907", "0.62907314", "0.6253195", "0.62201947", "0.6186805", "0.61682856", "0.61680245", "0.6149393", "0.6149171", "0.61489487", "0.6131378", "0.6121531", "0.61052376", "0.6091716", "0.60...
0.6272676
8
Return the 3D data belonging to the specified integration.
def get_integration(self, intg): return self.data[intg, :, :, :]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readpil3d(self):\r\n\r\n # Read the data in as an array.\r\n res = np.loadtxt(self.name, delimiter=' ')\r\n\r\n # Split into useful chunks\r\n self.pos = res[:, 0:3] # Grid point locations\r\n self.Pn = res[:, 3:4] # Normal pressure [Pa]\r\n self.flux = res[...
[ "0.58767927", "0.5826349", "0.57815903", "0.57088625", "0.56928843", "0.5628329", "0.5607253", "0.5606923", "0.5604087", "0.5586605", "0.55481243", "0.5545693", "0.5519316", "0.55076396", "0.546792", "0.5446305", "0.54423463", "0.5412611", "0.53820574", "0.5373988", "0.536672...
0.5997587
0
Return a copy of the SCI data array where all group planes have been fitted with a straight line to make slope data.
def slope_data(self, grptime=2.77504, diff_only=False): assert self.ngroups > 1 # TODO: Very inefficient and does not calculate ERR or DQ arrays. output = np.zeros([self.nints, self.rows, self.columns], dtype=self.data.dtype) if diff_only: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_line(data, component=0): # fit 3d line to 3d data\n\n m = data.mean(0)\n max_val = np.round(2*abs(data - m).max()).astype(int)\n uu, dd, vv = np.linalg.svd(data - m)\n return vv[component]", "def get_fit(self) -> np.poly1d:\n if self.log_fits is not None:\n retur...
[ "0.5388156", "0.53550994", "0.52986985", "0.52885634", "0.52675945", "0.5148297", "0.5135332", "0.5121581", "0.5119865", "0.51158285", "0.5093235", "0.50865376", "0.50268376", "0.50178015", "0.50165725", "0.5001841", "0.49889868", "0.4974932", "0.49631363", "0.49479023", "0.4...
0.5903265
0
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: hass.data[DOMAIN].pop(entry.entry_id) return unload_ok
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True", ...
[ "0.697284", "0.6888074", "0.6747459", "0.6689002", "0.6657831", "0.66162205", "0.6603433", "0.65925974", "0.65595686", "0.65411645", "0.6507643", "0.6507643", "0.6507643", "0.6507643", "0.64977276", "0.64931643", "0.6486601", "0.6486601", "0.6486601", "0.6486601", "0.6469397"...
0.6779855
2
Retrieves the URL of the service being called based on the environment that the controller is currently being run.
def get_service_url(service_name): # Use the Service Discovery service if Prod and toggle is on if Config.SD_STATUS == 'ON' and env.get('VCAP_SERVICES') is not None: try: creds = loads(env['VCAP_SERVICES'])['service_discovery'][0]['credentials'] locator = ServiceLocator(creds['u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_service_url():\n return get_config_handler().get_service_url()", "def url(self):\n url = os.environ.get('PATH_INFO')\\\n or os.environ.get('REQUEST_URI')\n return url if url else ''", "def service_url(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"service_ur...
[ "0.7878428", "0.70816535", "0.7066224", "0.6849334", "0.6849334", "0.6839921", "0.67030424", "0.6678387", "0.6597292", "0.6578677", "0.6519747", "0.64966995", "0.6418701", "0.6372157", "0.6368325", "0.6340238", "0.6325369", "0.6315856", "0.6215314", "0.6213789", "0.62096006",...
0.6070548
44
Returns the "number" largest indices from a numpy array.
def largest_indices(array, number): flat = array.flatten() indices = np.argpartition(flat, -number)[-number:] indices = indices[np.argsort(-flat[indices])] return np.unravel_index(indices, array.shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_indices(ary, n):\n flat = ary.flatten()\n indices = np.argpartition(flat, -n)[-n:]\n indices = indices[np.argsort(-flat[indices])]\n return np.unravel_index(indices, ary.shape)", "def largest_indices(ary, n):\n flat = ary.flatten()\n indices = np.argpartition(flat, -n)...
[ "0.81005055", "0.8091049", "0.808059", "0.7122081", "0.7122081", "0.7122081", "0.70790666", "0.6890007", "0.68543714", "0.6606388", "0.65587676", "0.65013754", "0.6321957", "0.6317295", "0.6255883", "0.6248024", "0.6246731", "0.6241117", "0.6232338", "0.61569554", "0.61465985...
0.8631843
0
Returns True if the current atom is a hydrogen isotope.
def is_hydrogen(self) -> bool: if self.element in {'H', 'D', 'T'}: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_hydrogen(self):\n return len(self.h_indices) > 0", "def _is_hydrogen(argument, can_be_atomic_number=False):\n\n if argument == 'p-':\n return False\n\n case_sensitive_aliases = ['p', 'p+', 'H', 'D', 'T']\n\n case_insensitive_aliases = ['proton', 'protium', 'deuterium',\n ...
[ "0.7186246", "0.6390054", "0.608989", "0.607194", "0.5957812", "0.59033656", "0.58537483", "0.57993144", "0.5782787", "0.5679013", "0.55747414", "0.5541969", "0.5527753", "0.5521757", "0.5514229", "0.55092406", "0.5481272", "0.54758304", "0.54604614", "0.544917", "0.544917", ...
0.7613189
0
Loads sqlite database into a dataframe then defines X and Y variables
def load_data(database_filepath): engine = create_engine('sqlite:///' + database_filepath) df = pd.read_sql_table('Messages', engine) X = df['message'] Y = df.drop(['id', 'message', 'original', 'genre'], axis=1) category_names = Y.columns return X, Y, category_names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(values):\n import sqlite3\n conn = sqlite3.connect('./example.db')\n df = pd.DataFrame(values)\n df.to_sql('observations', conn)", "def load_data(database_filepath):\n \n engine = create_engine('sqlite:///'+database_filepath)\n \n #reading table created in ETL part into pandas da...
[ "0.69506377", "0.67480737", "0.66984886", "0.6578721", "0.65454644", "0.6524713", "0.65079516", "0.63730556", "0.6369658", "0.6348334", "0.6322493", "0.63014364", "0.6300861", "0.6296366", "0.6265115", "0.6225452", "0.6207986", "0.6192826", "0.6174375", "0.6172419", "0.612018...
0.5939354
33
Construct an RNN decoder. It provides the input size, the rest is up to the impl. The default implementation provides an RNN cell, followed by a linear projection, out to a softmax
def __init__(self, tgt_embeddings, **kwargs): super(RNNDecoder, self).__init__() self.hsz = kwargs['hsz'] self.arc_policy = create_seq2seq_arc_policy(**kwargs) self.tgt_embeddings = tgt_embeddings rnntype = kwargs['rnntype'] layers = kwargs['layers'] feed_input = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, input_size, hidden_size, output_size, config):\r\n super(Decoder, self).__init__()\r\n\r\n self.config = config\r\n self.input_size = input_size\r\n self.hidden_size = hidden_size\r\n self.out = nn.Linear(hidden_size, output_size)\r\n\r\n if self.config....
[ "0.70451415", "0.68908244", "0.6769286", "0.67447317", "0.6558495", "0.6541182", "0.6497183", "0.6469034", "0.64372295", "0.64145875", "0.64015865", "0.63656616", "0.6315184", "0.630491", "0.6296841", "0.6288427", "0.6284922", "0.6242411", "0.62407744", "0.6236184", "0.623493...
0.61873287
22
In this function the destination embedding is concatenated with the previous attentional output and passed to the decoder. This is implemented using a bound method to a field in the class for speed so that this decision is handled at initialization, not as a conditional in the training or inference
def _feed_input(embed_i, attn_output_i): embed_i = embed_i.squeeze(0) return torch.cat([embed_i, attn_output_i], 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, tgt, m, enc_embed, mask):\n bs = tgt.shape[0]\n enc_embed = enc_embed.permute(2, 0, 1)\n m = m.permute(2, 0, 1)\n tgt = tgt.permute(2, 0, 1)\n dec_embed = self.dec_embed.weight.unsqueeze(1).repeat(1, bs, 1)\n\n out = tgt\n for layer in self.decoder...
[ "0.6656727", "0.6650227", "0.66249627", "0.6571423", "0.65418905", "0.6516768", "0.64977133", "0.64787376", "0.6472464", "0.6450316", "0.6442978", "0.6442285", "0.643849", "0.6436833", "0.64191145", "0.64004505", "0.6384875", "0.6330565", "0.6314791", "0.63086253", "0.6289096...
0.0
-1
Repeat a tensor while keeping the concept of a batch.
def repeat_batch(t, K, dim=0): shape = t.shape tiling = [1] * (len(shape) + 1) tiling[dim + 1] = K tiled = t.unsqueeze(dim + 1).repeat(tiling) old_bsz = shape[dim] new_bsz = old_bsz * K new_shape = list(shape[:dim]) + [new_bsz] + list(shape[dim+1:]) return tiled.view(new_shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tf_repeat(tensor, repeats):\n with tf.variable_scope(\"repeat\"):\n expanded_tensor = tf.expand_dims(tensor, -1)\n multiples = as_tuple(1, repeats)\n tiled_tensor = tf.tile(expanded_tensor, multiples)\n return tf.reshape(tiled_tensor, tf.shape(tensor) * repeats)", "def repeat(t...
[ "0.77964973", "0.75895315", "0.7458389", "0.7136689", "0.71284556", "0.7120772", "0.7025269", "0.6996307", "0.68953896", "0.68547976", "0.683327", "0.6774198", "0.6760057", "0.65370977", "0.65169805", "0.6495146", "0.6344937", "0.6325904", "0.62979496", "0.61938363", "0.61656...
0.7284699
3
Get model evaluation metrics on the test set.
def calc_metrics(model, X, y): # Get model predictions y_predict_r = model.predict(X) # Calculate evaluation metrics for assesing performance of the model. roc = roc_auc_score(y, y_predict_r) acc = accuracy_score(y, y_predict_r) prec = precision_score(y, y_predict_r) rec = recall_score(y, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, test):\r\n self.logger.info(\"Testing model over test set\")\r\n metrics = self.run_evaluate(test)\r\n msg = \" - \".join([\"{} {:04.2f}\".format(k, v)\r\n for k, v in metrics.items()])\r\n self.logger.info(msg)\r\n return metrics", "def evalua...
[ "0.8287773", "0.8285434", "0.7719791", "0.7549616", "0.74978405", "0.73720104", "0.7325736", "0.72177464", "0.71565187", "0.69852847", "0.6968685", "0.6957297", "0.6957297", "0.6957297", "0.6936069", "0.69096714", "0.68707293", "0.68641835", "0.6845766", "0.68300796", "0.6828...
0.68214417
21
Returns True if n is pentagonal, False otherwise. >>> is_pentagonal(330) True >>> is_pentagonal(7683) False >>> is_pentagonal(2380) True
def is_pentagonal(n: int) -> bool: root = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_pentagonal(n):\r\n if ((1+(24*n+1)**0.5) / 6)%1 == 0:\r\n return True\r\n return False", "def is_pentagonal(n):\n if (1+(24*n+1)**0.5) % 6 == 0:\n return True\n return False", "def is_pentagonal(P):\n return sqrt(1 + 24 * P) % 6 == 5", "def is_pentagonal_number(n):\n _,...
[ "0.84583694", "0.83870786", "0.8332773", "0.8305092", "0.78549117", "0.78314745", "0.7766816", "0.774764", "0.72327334", "0.7131192", "0.7101372", "0.6976013", "0.64783776", "0.6174585", "0.6147248", "0.6127962", "0.6123573", "0.61060196", "0.6104121", "0.6045562", "0.5975626...
0.8588094
0
Sets the learning rate to the initial LR decayed by schedule.
def adjust_learning_rate(optimizer, epoch, lr, schedule, gamma, num_gpus=1, warmup=5): if epoch in schedule: lr *= gamma if num_gpus > 1 and epoch < warmup: param_lr = lr * (epoch + 1) / warmup else: param_lr = lr for param_group in optimizer.param_groups: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_learning_rate(self):\n\n if (self.FLAGS.learning_rate_decay is \"exponential\"):\n self.learning_rate = tf.train.exponential_decay(\n self.FLAGS.learning_rate,\n self.global_step,\n self....
[ "0.77144474", "0.7521869", "0.7511448", "0.7474956", "0.7355699", "0.7355699", "0.7343787", "0.7321641", "0.72849476", "0.7276517", "0.7274907", "0.7257363", "0.7257058", "0.7249541", "0.7246921", "0.72336185", "0.72239363", "0.72239363", "0.7214341", "0.72138196", "0.7206589...
0.6928067
40
Get dictionary tokens. Return all the words indexed by this dictionary, except for special tokens.
def tokens(self): tokens = [k for k in self.tok2ind.keys() if k not in {'<NULL>', '<UNK>'}] return tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokens(self):\n\t\tlabels_and_synonyms = list(itertools.chain.from_iterable(list(self.term_to_tokens.values())))\n\t\ttokens = set(list(itertools.chain.from_iterable([word_tokenize(x) for x in labels_and_synonyms])))\n\t\treturn(list(tokens))", "def special_tokens(self) -> List[Hashable]:\n return lis...
[ "0.69030535", "0.6868511", "0.6862133", "0.68619925", "0.66487944", "0.6624025", "0.6590322", "0.6585089", "0.6505818", "0.6502971", "0.6475264", "0.6475264", "0.6475264", "0.64673567", "0.6429127", "0.6415433", "0.6383087", "0.6340743", "0.6312898", "0.6293998", "0.62587214"...
0.6910905
0
r"""Initialize model parameters. All weights and biases other than input / output gate biases are initialized with uniform distribution
def params_init(self) -> None: # Initialize weights and biases with uniform distribution. nn.init.uniform_(self.emb.weight, self.init_lower, self.init_upper) nn.init.uniform_(self.fc_e2h[1].weight, self.init_lower, self.init_upper) nn.init.uniform_(self.fc_e2h[1].bias, self.init_lower, self.init_upper) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_parameters(self):\n stdv = 1. / math.sqrt(self.weight.data.size(1))\n self.weight.data.uniform_(-stdv, stdv)\n if self.bias is not None:\n self.bias.data.uniform_(-stdv, stdv)", "def initialise_parameters(self):\n # Weights\n init = select_w_init(self.w_init...
[ "0.8216526", "0.76406205", "0.76140875", "0.7606549", "0.736204", "0.73598105", "0.7359637", "0.7354102", "0.73458", "0.73293835", "0.73291415", "0.72593725", "0.7243329", "0.72131723", "0.7179244", "0.71634674", "0.71447", "0.71420425", "0.7108164", "0.7102799", "0.7096407",...
0.7701109
1
r"""Calculate next token id probability distribution over tokenizer's vocabulary. Probabilities were calculated based on previous hidden states, memory cell previous internal states and current input token id. This method is only used for inference. No tensor graphs are constructed and no gradients are calculated.
def pred( self, batch_cur_tkids: torch.Tensor, batch_prev_states: Optional[Tuple[List[torch.Tensor], List[torch.Tensor]]] = None, ) -> Tuple[torch.Tensor, Tuple[List[torch.Tensor], List[torch.Tensor]]]: # Get next token id logits, memory cell last internal states and last hidden states. # Logits s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(rnn, prime_id, int_to_vocab, token_dict, pad_value, predict_len=100):\n train_on_gpu = False\n rnn.eval()\n\n # create a sequence (batch_size=1) with the prime_id\n current_seq = np.full((1, data_params.sequence_length), pad_value)\n current_seq[-1][-1] = prime_id\n predicted = [int_...
[ "0.64805955", "0.6316105", "0.621109", "0.60551226", "0.5944767", "0.5908449", "0.5902238", "0.5897344", "0.58928776", "0.58122075", "0.58011615", "0.5799971", "0.5775778", "0.5689132", "0.56744814", "0.5639752", "0.55746996", "0.55746996", "0.5570084", "0.55643606", "0.55636...
0.625248
2
lets the boss shoot
def boss_shoot(ai_settings,screen,boss,boss_bullets): new_boss_bullet = Boss_bullet(ai_settings,screen,boss) boss_bullets.add(new_boss_bullet)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shoot(self):\n if self.gun_interface:\n self.gun_interface.prepare_fire()", "def shoot(self):\n if self.cool_down_counter == 0 and self.specialfire_state == False:\n BULLET_SOUND.play()\n bullet = Bullet(self.x+10, self.y, self.bullet_img)\n self.bull...
[ "0.73755467", "0.736508", "0.7159603", "0.70833415", "0.7080648", "0.70726883", "0.69677234", "0.6963648", "0.69627225", "0.6832813", "0.68197864", "0.6803295", "0.68015105", "0.6791227", "0.6755325", "0.6747627", "0.67317057", "0.6728364", "0.66317236", "0.6616434", "0.66112...
0.7890427
0
updates the position and gets rid of old boss bullets
def update_boss_bullets(ai_settings, stats, screen, ship, boss, bullets, boss_bullets,hit): #update the bullets position boss_bullets.update() for boss_bullet in boss_bullets.copy(): if boss_bullet.rect.top >=ai_settings.screen_height: boss_bullets.remove(boss_bullet) check_boss_bull...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_bullets(ai_settings,screen,ship,boss,bullets,boss_hit):\n\t#update the bullet position\n\tbullets.update()\n\tfor bullet in bullets.copy():\n\t\tif bullet.rect.bottom <= 0:\n\t\t\tbullets.remove(bullet)\n\tcheck_bullet_hit(ai_settings, screen, ship, boss, bullets,boss_hit)", "def update_bullets(bullet...
[ "0.7479498", "0.70265937", "0.6993762", "0.6991082", "0.69708276", "0.69370484", "0.68786705", "0.68313146", "0.679368", "0.6776537", "0.6751948", "0.67117155", "0.67005485", "0.6692526", "0.66814965", "0.66743445", "0.6661536", "0.66347474", "0.6556439", "0.6482842", "0.6437...
0.7702878
0
updates the position and gets rid of old bullets
def update_bullets(ai_settings,screen,ship,boss,bullets,boss_hit): #update the bullet position bullets.update() for bullet in bullets.copy(): if bullet.rect.bottom <= 0: bullets.remove(bullet) check_bullet_hit(ai_settings, screen, ship, boss, bullets,boss_hit)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_bullets(self):\n # Update bullet positions.\n\n # Get rid of bullets that have disappeared.\n for bullet in self.bullets.copy():\n if bullet.rect.bottom <= 0:\n self.bullets.remove(bullet)", "def _update_bullet(self):\n\n # update position of old ...
[ "0.77876914", "0.7786527", "0.773118", "0.7606427", "0.7489922", "0.7463301", "0.74433476", "0.73845017", "0.737036", "0.7360137", "0.7240649", "0.7181326", "0.71782964", "0.70387936", "0.6980971", "0.6969923", "0.6822736", "0.67982054", "0.6708671", "0.6660233", "0.658517", ...
0.7112848
13
Initializes the Flask app and Flask plugins.
def create_app(config=Config): # Initialise app and configuration app = Flask(__name__) app.config.from_object(config) # Initialise flask plugins db.init_app(app) api.init_app(app) ma.init_app(app) login.init_app(app) migrate.init_app(app, db) register_api(api) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init():\n server = Flask(__name__)\n \n return server", "def setup_app():\n\n # 1 Create Flask application\n app = Flask(\n import_name=__name__,\n template_folder=\"templates\",\n static_folder=\"static\"\n )\n\n # 2 Update the apps configuration\n app = config_s...
[ "0.7764065", "0.76146317", "0.7579692", "0.755739", "0.75152946", "0.74432474", "0.7230884", "0.7205608", "0.7203535", "0.71839917", "0.71567965", "0.71366954", "0.7131443", "0.7123235", "0.70937085", "0.70469236", "0.70400953", "0.7022026", "0.7016008", "0.7016008", "0.70028...
0.68790317
26
given a sklearn confusion matrix (cm), make a nice plot Arguments
def plot_confusion_matrix(cm, target_names, title='Confusion matrix', cmap=None, normalize=True): import matplotlib.pyplot as plt import numpy as np import itertools accuracy = np.trace(cm) / float(n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\"Confusion matrix\")\n plt.colorbar()\n tick_marks = np.arange(len(class_names))\n plt.xticks(tick_marks, class_names, rotation=45)\n plt.yticks(tick_...
[ "0.79997694", "0.79955804", "0.7947871", "0.79360676", "0.79129595", "0.7897813", "0.7879448", "0.786082", "0.786082", "0.78540397", "0.78501374", "0.78499055", "0.78404397", "0.7835427", "0.7828328", "0.78253037", "0.78049725", "0.78017557", "0.77822274", "0.77789044", "0.77...
0.0
-1
Sets a pin high by number. This pin must have been previously initialized and set up as with direction of OUT, otherwise this operation will not behave as expected. High represents "on" for lights, and represents normal running state for HALT and RESET pins.
def set_high(pin): _write_value(HIGH, "{0}/gpio{1}/value".format(_path_prefix, pin))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gpio_output_high(self, pin: int) -> None:\n self._pins[pin - 1] = \"OUTPUT_HIGH\"", "def set_pin_high(pin):\n HIGH_PINS.append(pin)", "def high(self, high):\n\n self._high = high", "def set_high(self,chip,line):\n self.output(chip,line, HIGH)", "def gpio_output_low(self, pin: in...
[ "0.78133535", "0.773958", "0.72289854", "0.71715206", "0.6866713", "0.6828846", "0.6776846", "0.67397743", "0.66266394", "0.6614659", "0.6612427", "0.65695846", "0.6456329", "0.64336634", "0.6409028", "0.63683337", "0.6211643", "0.6207867", "0.61854213", "0.6179424", "0.61676...
0.82628775
0
Load TFRecords on disk to pandas dataframe.
def input_fn(self, file_pattern: List[Text]): root_paths = [x.replace("*", "") for x in file_pattern] file_paths = [] for root in root_paths: file_paths.extend(path_utils.list_dir(root)) dataset = tf.data.TFRecordDataset(file_paths, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_tfrecord(fname, n_jobs=1, verbose=0):\n dfx = delayed(bytestring_to_record)\n pool = Parallel(n_jobs=n_jobs, verbose=verbose)\n results = pool(dfx(x) for x in tf.compat.v1.python_io.tf_record_iterator(fname))\n features = np.concatenate([xy[0] for xy in results], axis=0)\n meta = pd.concat(...
[ "0.72119564", "0.6760121", "0.6749778", "0.67116624", "0.66219205", "0.6615198", "0.6313854", "0.626967", "0.62669754", "0.62669754", "0.6251893", "0.6239046", "0.6207921", "0.6200379", "0.6162924", "0.616111", "0.6115471", "0.60668254", "0.6030874", "0.6015996", "0.5964185",...
0.0
-1
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: data: AugustData = hass.data[DOMAIN][entry.entry_id] data.async_stop() unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: hass.data[DOMAIN].pop(entry.entry_id) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True", ...
[ "0.697284", "0.6888074", "0.6779855", "0.6747459", "0.6689002", "0.6657831", "0.66162205", "0.6603433", "0.65925974", "0.65595686", "0.65411645", "0.6507643", "0.6507643", "0.6507643", "0.6507643", "0.64977276", "0.64931643", "0.6486601", "0.6486601", "0.6486601", "0.6486601"...
0.61350876
61
Brand of the device.
def brand(self) -> str: return self._config_entry.data.get(CONF_BRAND, DEFAULT_BRAND)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def brand(self) -> object:\n return self._brand", "def brand(self):\n return \"Nest Labs\"", "def brand_from_request(self, request):\n if b\"brand\" in request.args:\n return request.args[b\"brand\"][0].decode(\"utf-8\")\n return None", "def get_brand(self):\n pr...
[ "0.79064673", "0.7542708", "0.71343946", "0.7123599", "0.67413145", "0.67413145", "0.67413145", "0.67242056", "0.6661956", "0.65580124", "0.65241075", "0.64779574", "0.6472946", "0.6383876", "0.633435", "0.6244304", "0.62196964", "0.6193877", "0.61901283", "0.6090889", "0.608...
0.794675
0
Turn on pressure control.
async def power_on(self): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on(self):\n if not self._is_on:\n self._pwms.enable(self._pin_index, self._frequency)\n self._is_on = True", "def turn_on(self) -> None:\n self._monoprice.set_power(self._zone_id, True)", "def turn_on(self):\n self._interrupt_flash()\n if not self.on:\n ...
[ "0.7364512", "0.6897359", "0.684855", "0.6847314", "0.6798059", "0.67779684", "0.6745765", "0.67210263", "0.6680591", "0.66502297", "0.6637488", "0.6619599", "0.6608343", "0.65380895", "0.65123516", "0.6480303", "0.6447069", "0.6438078", "0.64309895", "0.64019823", "0.6378820...
0.0
-1
The time the instance was created.
def create_time(self) -> str: return pulumi.get(self, "create_time")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_time(self):\n return self._create_time", "def create_time(self):\n return self._create_time", "def create_time(self):\n return self._create_time", "def time_created(self):\n return self._time_created", "def time_created(self):\n return self._time_created", "d...
[ "0.88949937", "0.88949937", "0.88949937", "0.86404544", "0.86404544", "0.86404544", "0.86404544", "0.85532963", "0.85532963", "0.8519395", "0.84569955", "0.84569955", "0.84569955", "0.8359977", "0.82727927", "0.82727927", "0.82727927", "0.82621634", "0.82122934", "0.82045037", ...
0.83537894
21
The crypto key configuration. This field is used by the CustomerManaged Encryption Keys (CMEK) feature.
def crypto_key_config(self) -> 'outputs.CryptoKeyConfigResponse': return pulumi.get(self, "crypto_key_config")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crypto_key_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"crypto_key_id\")", "def get_config(self):\n return 'c2Key', self.key", "def crypto_key_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"crypto_key_id\")", "def get_key(self):\r\n return ...
[ "0.67891717", "0.6717156", "0.66331804", "0.63010734", "0.62470335", "0.6231101", "0.6069917", "0.60167605", "0.60167605", "0.6011009", "0.6003269", "0.59229136", "0.59229136", "0.59042686", "0.5892583", "0.58691823", "0.5853311", "0.5825941", "0.58159125", "0.5806304", "0.58...
0.8318001
0
Cloud Storage bucket generated by Data Fusion in the customer project.
def gcs_bucket(self) -> str: return pulumi.get(self, "gcs_bucket")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bucket():\n return FileBucket(os.path.join(context.site.data_path, 'buckets'))", "def __init__(self, project_id, bucket_name):\n self.project_id = project_id\n self.bucket_name = bucket_name\n self.client = storage.Client(project=project_id)\n self.bucket = self.client.get_bucket(bucket_na...
[ "0.7086721", "0.70747304", "0.7065507", "0.68429416", "0.6839599", "0.66454524", "0.65906894", "0.6576124", "0.6527235", "0.652074", "0.64936554", "0.64936554", "0.6467283", "0.64204687", "0.6419048", "0.6419048", "0.6419048", "0.6419048", "0.6419048", "0.6405746", "0.6386523...
0.7080691
1
The name of this instance is in the form of projects/{project}/locations/{location}/instances/{instance}.
def name(self) -> str: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._client.project_name + '/instances/' + self.instance_id", "def get_instance_name ( base_name, instance_type ) :\n return base_name.upper( ) + '-' + instance_type.upper( )", "def get_project_admin_instance_name(self):\n\n return get_project_admin_instance_name(self....
[ "0.8238942", "0.6825721", "0.6788135", "0.67697346", "0.67125845", "0.6624231", "0.6624231", "0.654432", "0.6357512", "0.635649", "0.62737656", "0.62610817", "0.62247866", "0.6195572", "0.6157683", "0.6146486", "0.6084772", "0.6084772", "0.6084772", "0.6084772", "0.6084772", ...
0.5714642
86
The current state of this Data Fusion instance.
def state(self) -> str: return pulumi.get(self, "state")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state(self):\n return self.get_state()", "def state(self):\n return self.__state", "def state(self):\n return self.__state", "def state(self):\n return self._state()", "def state(self):\r\n return self._state", "def state(self):\r\n return self._state", "de...
[ "0.776445", "0.76710665", "0.76710665", "0.7658393", "0.765556", "0.765556", "0.765556", "0.76432765", "0.761414", "0.761414", "0.761414", "0.761414", "0.761414", "0.761414", "0.761414", "0.761414", "0.761414", "0.761414", "0.761414", "0.761414", "0.761414", "0.761414", "...
0.0
-1
Name of the zone in which the Data Fusion instance will be created. Only DEVELOPER instances use this field.
def zone(self) -> str: return pulumi.get(self, "zone")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zone_name(self):\n return self._zone_name", "def name(self):\n return f\"{self.zone_name} {self.zone_variable}\"", "def zone(self) -> str:\n return self._zone", "def name(self) -> str | None:\n if self.zone.GroupName is not None:\n return self.zone.GroupName\n\n ...
[ "0.8397095", "0.8250072", "0.7724301", "0.7668603", "0.6959013", "0.6959013", "0.6959013", "0.6959013", "0.6959013", "0.6831729", "0.6831729", "0.68061244", "0.6754816", "0.6738458", "0.67076945", "0.67076945", "0.67076945", "0.67076945", "0.67019665", "0.6684262", "0.6487978...
0.75844043
5
This shall be invoked only once at the end of the tests execution contained within this class.
def tearDownClass(cls): print('\n\n─────────────────────────────────────────────────────────────────────────────────────────') print('Finished the execution of tests for class "SlashNextCommandApiQuota" with valid set of inputs.') print('──────────────────────────────────────────────────────────...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n pass", "def tearDown(self):\n \n return", "def tearDown(self):\r\n pass", "def tearDown(self):\r\n pass", "def tearDown(self):\r\n pass", "def tearDown(self):\r\n pass", "def tearDown(self):\r\n pass", "def tearDown(sel...
[ "0.8078177", "0.8075991", "0.806044", "0.806044", "0.806044", "0.806044", "0.806044", "0.8033966", "0.8033966", "0.8033966", "0.8033966", "0.8033966", "0.8033966", "0.8033966", "0.8033966", "0.8033966", "0.8033966", "0.8033966", "0.8033966", "0.8033966", "0.8033966", "0.803...
0.0
-1
Closes database connection after request.
def close_db(error): if hasattr(g, 'pg_cur'): g.pg_cur.close() g.pg_conn.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_request():\n db.close()", "def close_db_connection(cls):\n db.close()", "def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n self.conn.close()", "def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._con...
[ "0.825136", "0.8072465", "0.77520126", "0.7750988", "0.7638422", "0.75972164", "0.7581665", "0.75529474", "0.7505108", "0.7503037", "0.74961585", "0.7483921", "0.7483921", "0.7483921", "0.7483827", "0.7483827", "0.7483827", "0.7483827", "0.7483827", "0.7483827", "0.7483827", ...
0.0
-1
Set the logging level of this dispatchers's logger.
def set_logging_level(self, level): return self.sdk.set_logging_level( level, prefix=self.__class__.__name__, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level(self, log_level):\n self.logger.setLevel(log_level)", "def setlevel(self, lvl):\n self.logger.setLevel(lvl)", "def set_loglevel(self, loglevel=logging.DEBUG):\n self._loggerLevel = loglevel\n\n # set logging levels\n self._logger.setLevel(self._loggerLevel)\n ...
[ "0.79028696", "0.7812232", "0.7765538", "0.77635723", "0.7667724", "0.76175755", "0.7575898", "0.74883366", "0.74391556", "0.74184966", "0.7400367", "0.736609", "0.7213199", "0.717764", "0.7131161", "0.70950705", "0.70306325", "0.6999371", "0.6972056", "0.6956441", "0.695136"...
0.72418123
12
Retrieve the SDK that this dispatcher is associated with.
def sdk(self): return self._sdk
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_api(self):\n return self.api", "def get_minimum_sdk(self):\n return self.minimum_sdk", "def get_sdk_path(cls):\n pass", "def api(self):\n return self.__api", "def api(self):\n return self._api", "def api(self):\n return self._api", "def api(self):\n ...
[ "0.65346867", "0.63743496", "0.6251156", "0.6160768", "0.6094884", "0.6094884", "0.6094884", "0.6094884", "0.60887426", "0.6034575", "0.5988155", "0.5894708", "0.5878444", "0.5848931", "0.58248913", "0.5746", "0.57172966", "0.569607", "0.56272316", "0.56095505", "0.5596974", ...
0.77183867
0
Retrieve this dispatcher's `auto` state.
def auto(self): return self._auto
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def State(self):\n if self.force_auto_sync:\n self.get('State')\n return self._State", "def State(self):\n if self.force_auto_sync:\n self.get('State')\n return self._State", "def get_state(self):\n return self.state", "def get_state(self):\n re...
[ "0.6862492", "0.6862492", "0.6351515", "0.6351515", "0.6340829", "0.632525", "0.632525", "0.6308657", "0.6308657", "0.6308657", "0.6308657", "0.6308657", "0.6308657", "0.6308657", "0.6308657", "0.6308657", "0.6308657", "0.6308657", "0.6308657", "0.6308657", "0.6308657", "0....
0.70764875
0
Yields n chunks about the same size.
def nchunks(xs, n): xs = list(xs) start = 0 for i in range(n): if i + 1 == n: # last chunk yield xs[start:] else: chunksize = round(len(xs[start:]) / (n - i)) yield xs[start:start + chunksize] start += chunksize
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunks(l, n):\n\tfor i in range(0, len(l), n):\n\t\tyield l[i:i + n]", "def chunks(l, n):\n for i in range(0, n):\n yield l[i::n]", "def _chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l),...
[ "0.85636884", "0.84290874", "0.8417545", "0.84127766", "0.8371254", "0.83562046", "0.8353734", "0.8315649", "0.8315649", "0.8299857", "0.82980835", "0.82975054", "0.829573", "0.829573", "0.829573", "0.829305", "0.829305", "0.82890534", "0.8284441", "0.8284441", "0.82834196", ...
0.8548341
1
Validates the input name is letters, numbers and underscores only. Also ensures no longer than 10 characters.
def validate_team_name(name): if not re.match('^[A-Za-z0-9_]*$', name): print('INVALID NAME. LETTERS, NUMBERS AND UNDERSCORES ONLY') return False elif len(name) > 10: print('INVALID NAME. 10 CHARACTERS MAX') return False elif len(name) == 0: print('INVALID NAME. NOT L...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_name(name:str) -> bool:\r\n return name.isalpha() and name.count(\" \") == 0 and len(name) >= 2", "def name_valid(name):\n return name.isalpha()", "def validName(varname):\r\n if (len(varname[0])>32):\r\n return False\r\n if not(varname[0][0].isalpha()):\r\n ...
[ "0.78898174", "0.78529567", "0.7780275", "0.75915873", "0.75463754", "0.7514502", "0.7262556", "0.72510743", "0.72424954", "0.7170377", "0.7097964", "0.7065987", "0.7046786", "0.7043649", "0.70300454", "0.69985026", "0.69492936", "0.6926857", "0.6908971", "0.6872688", "0.6855...
0.7594196
3
Saves class keys and values to JSON file.
def save_json(self, path=None): if path is None: path = self.parampath params = {str(key): str(value) for key, value in self.__dict__.items()} # with open(f'{path}/params_{self.mode}.json', 'w') as f: with open(os.path.join(path, f'params_{self.mode}.json'), 'w') as f: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_class(self):\n with open(self.savefile, \"w\") as f:\n data = {\"name\": self.name, \"host\": self.host, \"port\": self.port}\n json.dump(data, f)", "def save(self):\n a_copy = FileStorage.__objects\n obj_dict = {obj: a_copy[obj].to_dict() for obj in a_copy.key...
[ "0.75562257", "0.7408421", "0.7389194", "0.7323676", "0.730262", "0.727906", "0.7264057", "0.7239185", "0.7214922", "0.72030514", "0.7188105", "0.7188105", "0.7188105", "0.7187428", "0.71811146", "0.71788096", "0.7160741", "0.7133092", "0.7070389", "0.702752", "0.7015021", ...
0.6443315
72
Return a serialized version of a datetime instance in the format of a ``DateTimeField`` from Django Rest Framework.
def serialized_time(time): formatted = time.isoformat() if formatted.endswith("+00:00"): formatted = formatted[:-6] + "Z" return formatted
{ "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 _serialize_datetime(val):\n return datetime_to_iso8601(val)", "def json_datetime_serializer(obj):\n\n if isinstance(obj, ...
[ "0.73515135", "0.68817455", "0.6830978", "0.67013663", "0.6693695", "0.66862774", "0.636585", "0.63233715", "0.63073456", "0.6183072", "0.6137087", "0.6136358", "0.612847", "0.6052072", "0.6049642", "0.5996454", "0.59917325", "0.5971786", "0.5929302", "0.59177476", "0.5900039...
0.0
-1
Context manager to temporary unblock read while reading process stdout/stderr.
def _unblock_read(proc): stdout_flags = unblock_read(proc.stdout) stderr_flags = unblock_read(proc.stderr) try: yield proc finally: set_read_flags(proc.stdout, stdout_flags) set_read_flags(proc.stderr, stderr_flags)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _stdout_reader(self):\n self._is_launched.wait()\n stdout_iterator = iter(self._popen.stdout.readline, b\"\")\n for line in stdout_iterator:\n self._log(\"raw\", \"stdout : {0}\".format(line.strip()))\n self.stdout_queue.put_nowait(line.strip())\n self.stdout_q...
[ "0.6400291", "0.6305782", "0.62369645", "0.60266453", "0.5957529", "0.5952421", "0.5935954", "0.5935954", "0.5935954", "0.5935954", "0.5921897", "0.58576256", "0.5835249", "0.5793651", "0.57675", "0.5763966", "0.57318425", "0.5687169", "0.5676451", "0.5667727", "0.56480414", ...
0.74134153
0
A string representation of the object.
def __str__(self): info = 'cmd="%s", pid=%d, cwd=%s, alive=%s' % ( self._cmd, \ self._pid, \ repr(self._cwd), \ self.alive) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_string(self):\n return self.__repr__()", "def __str__(self):\n return str(self.__dict__['_obj'])", "def __str__(self):\n return str(self.serialize())", "def __repr__(self):\n return str(self.__dict__)", "def __repr__(self):\n return str(self.__dict__)", "...
[ "0.8349324", "0.8338466", "0.8303943", "0.8272602", "0.8272602", "0.8272602", "0.8272602", "0.8272602", "0.82519513", "0.8203925", "0.81838685", "0.81756395", "0.81531453", "0.8149832", "0.8149832", "0.8140097", "0.813171", "0.813171", "0.813171", "0.813171", "0.813171", "0...
0.0
-1
A repr() representation of the object.
def __repr__(self): return str(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return repr(self.__dict__['_obj'])", "def repr_(object_):\n return repr(object_)", "def __str__(self):\n return repr(self)", "def __repr__(self) -> str:\n items = (\"{}={}\".format(k, repr(v)) for k, v in self.__dict__.items())\n return \"<{}({})>\...
[ "0.8769773", "0.87449586", "0.85059416", "0.8480588", "0.8467762", "0.8467762", "0.8467762", "0.8467762", "0.8467762", "0.8422001", "0.8406502", "0.8348098", "0.8347791", "0.8314297", "0.8314297", "0.8314297", "0.83049", "0.83049", "0.83049", "0.83049", "0.83049", "0.83049"...
0.0
-1
Return the number of elements in the ReadingSet.
def __len__(self): return len(self._set)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n\n if self.is_finite_set:\n size = 0\n for set in self.sets:\n size += len(set)\n return size\n else:\n raise ValueError(\"'%s' is not a finite set.\" % self)", "def num_elements(self):\n return self.subset.num_el...
[ "0.8015571", "0.79507786", "0.77393", "0.77183086", "0.7644766", "0.7549923", "0.73557657", "0.7329177", "0.7320571", "0.7300201", "0.7260988", "0.72420096", "0.7216055", "0.71848005", "0.71786773", "0.71533215", "0.7152277", "0.71273756", "0.7114227", "0.7093923", "0.7074391...
0.69880813
25
Get a set of all ReadingProc objects which is currently alive.
def get_alive(self): return ReadingSet(set([x for x in self._set if x.alive]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getActiveProcesses():\n active = []\n\n for p in PROCESSRUNNER_PROCESSES:\n if p.is_alive():\n active.append(p)\n\n return active", "def get_all(self):\n return ReadingSet(self._set)", "def get_readers():\n return all_readers", "def monitoredProcs(self):\n retu...
[ "0.64710325", "0.6462818", "0.6299369", "0.6185235", "0.6141749", "0.5902973", "0.5865562", "0.58464646", "0.58464646", "0.5843352", "0.58222604", "0.5806602", "0.5787589", "0.578448", "0.5762629", "0.56715965", "0.56247324", "0.5607853", "0.5588322", "0.55313694", "0.5500671...
0.69846004
0
Calculates the Lorentzpolarization factor.
def lp_factor(self): num = 1 + np.cos(2 * self.angle) ** 2 den = np.cos(self.angle) * np.sin(self.angle) ** 2 return num / den
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LorentzFactor(self):\n # Use of abs() and x ** 0.5 provides a more stable calculation of lorentz\n # factor than math.sqrt() at high velocities.\n return 1 / abs( 1 - Particle.BetaVelocity(self) * Particle.BetaVelocity(self))**0.5", "def lorentzian(self, params):\n height, width, ...
[ "0.76781714", "0.68244857", "0.66918725", "0.64457476", "0.6416753", "0.6267074", "0.6191421", "0.6186329", "0.6167216", "0.6143315", "0.61364424", "0.60200655", "0.6000025", "0.59597695", "0.5935046", "0.59347284", "0.5932329", "0.5930255", "0.5929436", "0.59075415", "0.5899...
0.6741032
2
Gets Fragments preceding this word.
def getPrevFragments(self): return self.prevFragments
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_predecessors(self, word):\n predecessors = []\n for idx in range(len(word)):\n predecessors.append(word[:idx]+word[idx+1:])\n\n return predecessors", "def get_word_before(self):\n if self.word_before:\n return self.word_before\n\n lines = self.get_...
[ "0.62468195", "0.59978306", "0.5863022", "0.56520385", "0.56253564", "0.5570452", "0.5517506", "0.54704624", "0.53856045", "0.5364343", "0.53282523", "0.5321395", "0.5291006", "0.52414536", "0.5232221", "0.522789", "0.52278125", "0.5219681", "0.5183331", "0.51507276", "0.5145...
0.7136542
0
Parses a serialized simulation tf.SequenceExample.
def parse_serialized_simulation_example(example_proto, metadata): if 'context_mean' in metadata: feature_description = _FEATURE_DESCRIPTION_WITH_GLOBAL_CONTEXT else: feature_description = _FEATURE_DESCRIPTION context, parsed_features = tf.io.parse_single_sequence_example( example_proto, contex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_from_sequence_example(serialized,\n list_size=None,\n context_feature_spec=None,\n example_feature_spec=None,\n size_feature_name=None,\n mask_feature...
[ "0.73863447", "0.7115013", "0.6981102", "0.6954106", "0.68945205", "0.68227965", "0.68152803", "0.67644066", "0.67556775", "0.6664295", "0.6645937", "0.6574397", "0.65618855", "0.64830756", "0.6404538", "0.6350114", "0.62844455", "0.6250081", "0.6167874", "0.6155593", "0.6153...
0.71268475
1
Test email for new user is normalized
def test_new_user_email_normalized(self): email = 'test@GMAIL.COM' user = get_user_model().objects.create_user(email, 'test123') self.assertEqual(user.email, email.lower())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_new_user_email_normalized(self):\n email = 'test@GOOGLE.COM'\n user = get_user_model().objects.create_user(email, '212ds')\n\n self.assertEqual(user.email, email.lower())", "def test_new_email_normalised(self):\n\n email = \"test@RANDOMEMAIL.org\"\n user = get_user_mod...
[ "0.79634017", "0.79402316", "0.7910423", "0.78500974", "0.7834398", "0.78316146", "0.7819254", "0.78072375", "0.780261", "0.77595735", "0.7747029", "0.772265", "0.77194226", "0.767348", "0.7482644", "0.74773765", "0.72931206", "0.7120967", "0.7111582", "0.7012547", "0.6997505...
0.78498566
4
Test creating new user with an invalid email raises error
def test_new_user_invalid_email(self): with self.assertRaises(ValueError): get_user_model().objects.create_user(None, 'test123')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_new_user_invalid_email(self):\n with self.assertRaises(ValueError):\n get_user_model().objects.create_user(\"\", \"test42837492374923749\")", "def test_new_user_invalid_email(self):\n\n with self.assertRaises(ValueError):\n get_user_model().objects.create_user(None, '...
[ "0.91517556", "0.91402507", "0.9122904", "0.91212815", "0.9120622", "0.911257", "0.91067654", "0.9068419", "0.90511435", "0.9051122", "0.90109956", "0.90071887", "0.8984983", "0.89025974", "0.8837477", "0.87679774", "0.84988785", "0.8446912", "0.8409785", "0.8358461", "0.8270...
0.91076136
7
Test the PDD object string representation
def test_pddobj_str(self): pdd = models.Pdd.objects.create( user=sample_user(), name='Jurassic Park', timestamp='2019-12-25 09:00:00-07:00' ) self.assertEqual(str(pdd), pdd.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str_and_repr(self):\n assert str(self.enrollment) == \"[ProgramEnrollment id=1]\"\n assert repr(self.enrollment) == (\n \"<ProgramEnrollment id=1 user=<User: rocko> external_user_key='abc'\"\n \" program_uuid=UUID('88888888-4444-2222-1111-000000000000')\"\n \...
[ "0.70030504", "0.68685365", "0.67097914", "0.6702816", "0.669188", "0.6690676", "0.6674525", "0.667312", "0.66689855", "0.66588676", "0.6656565", "0.6619312", "0.66107863", "0.6608564", "0.6592797", "0.6577202", "0.65762395", "0.65661484", "0.6542349", "0.65254945", "0.651914...
0.7568444
0
Given a slug, returns a list of pages from ascendants to descendants, that form the parent/child page relationships for that slug. The main concern is to do this in a single database query rather than querying the database for parents of a given page. Primarily used in ``PageMiddleware`` to provide the current page, wh...
def with_ascendants_for_slug(self, slug, **kwargs): if slug == "/": slugs = [home_slug()] else: # Create a list of slugs within this slug, # eg: ['about', 'about/team', 'about/team/mike'] parts = slug.split("/") slugs = ["/".join(parts[:i]) fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_page_descendants(page, children_pages=None):\n children_pages = children_pages if children_pages else []\n for child in page.children.all():\n if child in children_pages:\n continue\n children_pages.append(child)\n get_page_descendants(child, children_pages)\n retur...
[ "0.6919419", "0.6036181", "0.58855265", "0.56523085", "0.5610599", "0.55901706", "0.5346821", "0.53047186", "0.52519524", "0.5198329", "0.5122909", "0.51137966", "0.50913435", "0.5069923", "0.5068812", "0.5057356", "0.50538146", "0.5029397", "0.5026853", "0.5015875", "0.49820...
0.8643476
0
returns the current date/time in ISO 8601 standard format.
def ptime(): return time.strftime("%Y-%m-%dT%H:%M:%SZ",time.gmtime(time.time()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isoformat_now():\n return datetime_isoformat(datetime.datetime.utcnow())", "def now_iso():\n return to_iso(now())", "def get_current_datetime_string ( ) :\n return get_current_datetime( ).strftime( \"%Y%m%d-%H%M%S\" )", "def format_iso_now():\n return datetime.datetime.utcnow().isoformat()+'Z'...
[ "0.782193", "0.77042013", "0.7658473", "0.7647727", "0.7592206", "0.75214726", "0.75111705", "0.74698293", "0.7413468", "0.7408821", "0.7338085", "0.7333186", "0.7332797", "0.7322111", "0.7280247", "0.72565085", "0.7202443", "0.7202443", "0.71858305", "0.7182992", "0.714608",...
0.0
-1
Yield successive nsized chunks from l.
def chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.7448925
56
Split words by whitespace. Detect slot references and substitutions.
def split_words(text: str) -> typing.Iterable[Expression]: for token in re.split(r"\s+", text): if token.startswith("$"): if ":" in token: # Slot with substitutions lhs, rhs = token[1:].split(":", maxsplit=1) yield SlotReference(text=token, slot_na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def break_words(stuff):\n\twords = stuff.split(' ')\n\treturn words", "def break_words(stuff):\n\twords = stuff.split(' ')\n\treturn words", "def break_words(stuff):\r\n words = stuff.split(' ')\r\n return words", "def break_words(stuff):\n words = stuff.split(' ')\n return words", "def break_w...
[ "0.69153666", "0.69153666", "0.6860573", "0.6772582", "0.6772582", "0.6772582", "0.6772582", "0.6772582", "0.6758954", "0.6758954", "0.6675673", "0.6616472", "0.64951307", "0.6442102", "0.6427005", "0.6382619", "0.6361654", "0.62963265", "0.62425387", "0.60666424", "0.5984709...
0.74567384
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ComputingResourceFlavorsRsp): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
picks the best location to place an adsorbate around the host atom
def find_best_place(self, index, radius, cutoff, num_pts=500): best_positions = self.get_viable_pos_cluster_centers(index, radius, cutoff, num_pts) best_avg_dist = 0 for pos in best_positions: void = self.find_void(pos) void_avg_dist = self.avg_distance(void) # average ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_anchor(self):\n return self.nearest(\"VP\")", "def default_location(self, thing):\n if isinstance(thing, Agent):\n return (1, 1)\n else:\n get_rand = lambda arg: random.choice(range(1, arg-1))\n while True:\n xloc, yloc = (get_rand(se...
[ "0.6071176", "0.5969349", "0.5768894", "0.5768894", "0.568423", "0.5507182", "0.54870385", "0.54689795", "0.5454114", "0.54425997", "0.53624284", "0.5360391", "0.53399694", "0.53399694", "0.53399694", "0.5338364", "0.53083706", "0.5281837", "0.52698153", "0.5266393", "0.52414...
0.0
-1
HRESULT PTQuerySchemaVersionSupport( PCWSTR pszPrinterName, DWORD pMaxVersion )
def prntvpt_PTQuerySchemaVersionSupport(jitter): ret_ad, args = jitter.func_args_stdcall(["pszPrinterName", "pMaxVersion"]) raise RuntimeError('API not implemented') jitter.func_ret_stdcall(ret_ad, ret_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def QualExtension_getDefaultVersion():\n return _libsbml.QualExtension_getDefaultVersion()", "def QualExtension_getDefaultPackageVersion():\n return _libsbml.QualExtension_getDefaultPackageVersion()", "def api_version() -> APIVersion:\n return MAX_SUPPORTED_VERSION", "def _get_schema(want_version):\n ...
[ "0.57202995", "0.56129235", "0.5287496", "0.52688646", "0.52642006", "0.516583", "0.51481605", "0.5142952", "0.5030709", "0.5012347", "0.49736923", "0.49525312", "0.4875928", "0.48573565", "0.48565266", "0.48480853", "0.4813335", "0.4800334", "0.47961405", "0.47921583", "0.47...
0.85170543
0
Function to validate a social security number (SSN). SSN is considered valid if user breaks format (i.e., omits dashes) and enters 9 digits, no white space. Otherwise, the SSN entered must be in the format ddddddddd, where "d" is a digit
def validate_SSN(SSN_test): is_valid_SSN = False # if user breaks format but enters 9 digits, SSN is counted as valid if len(SSN_test) == 9 and SSN_test.isdigit(): is_valid_SSN = True # otherwise, if the length is not 11 characters, and there aren't at least 2 dashes, entry immediately fails...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invalid_ssn(self) -> str:\n itin_group_numbers = [\n 70,\n 71,\n 72,\n 73,\n 74,\n 75,\n 76,\n 77,\n 78,\n 79,\n 80,\n 81,\n 82,\n 83,\n 84...
[ "0.6522525", "0.63078207", "0.62349457", "0.61977565", "0.60788274", "0.60268646", "0.60089666", "0.6007637", "0.5968918", "0.5965588", "0.5959388", "0.58748746", "0.5864592", "0.58483976", "0.5802473", "0.5801572", "0.5798667", "0.5795735", "0.57858616", "0.57855064", "0.577...
0.8528823
0
Returns starting state of the board.
def initial_state(): return [[EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_state(self):\r\n return np.zeros(self.board_size, dtype=np.int8)", "def start_state():\n return chess.Board()", "def startingState(self):\n # Returns starting position and 4 false because no corners are visited yet\n return (self.startingPosition, (False, False, False, False))...
[ "0.8081514", "0.7890486", "0.7534929", "0.72789717", "0.72789717", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", ...
0.0
-1
Returns player who has the next turn on a board.
def player(board): counter = 0 for i in range(3): for j in range(3): if board[i][j] == X: counter += 1 elif board[i][j] == O: counter -= 1 if counter == 0: return X else: return O
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_player(board, prev_player):\n opp = Othello.opponent(prev_player)\n if Othello.any_legal_move(opp, board):\n return opp\n elif Othello.any_legal_move(prev_player, board):\n return prev_player\n return None", "def next_player(self,board, prev_player):\r\n...
[ "0.7911148", "0.7521969", "0.74204457", "0.73687756", "0.71954805", "0.69775087", "0.69621766", "0.69253695", "0.69208723", "0.69010353", "0.6845991", "0.6841043", "0.6838282", "0.68265843", "0.67751175", "0.67751175", "0.6769739", "0.6713109", "0.67060393", "0.66561204", "0....
0.0
-1
Returns the optimal action for the current player on the board.
def minimax(board): if len(actions(board)) == 9: action = actions(board) return action[random.randint(0, len(actions(board)) - 1)] if terminal(board): return None best_move = None if player(board) == X: best_score = -1 else: best_score = 1 for action ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_action(self):\n if self.bestAction is None:\n self.calculate_best_action()\n return self.bestAction", "def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = min...
[ "0.7766856", "0.76323676", "0.75855315", "0.75285065", "0.75175256", "0.74667144", "0.7460485", "0.74263537", "0.7416421", "0.73943585", "0.7375846", "0.7333894", "0.73147565", "0.7306611", "0.7284639", "0.72650313", "0.72650313", "0.7250975", "0.72331834", "0.7203267", "0.71...
0.7080899
31
Create a wrapper around the given BaseAPIResource to have the api_key prebound
def wrap_class(target_cls: Type[T], api_key: str) -> Type[T]: assert issubclass(target_cls, BaseAPIResource), "Can only wrap BaseAPIResource" class Wrapper(target_cls): @classmethod def _base_request(cls, *args, **kwargs): new_args = {k: v for k, v in kwargs.items()} if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def requires_key(cls, func):\n\n def wrapped(*args, api_key=None, **kwargs):\n if api_key:\n cls.api_key = api_key\n openai.api_key = cls.api_key\n return func(*args, **kwargs)\n\n return wrapped", "def _wrap(self, resource):\n\t\treturn ResourceW...
[ "0.655476", "0.6381175", "0.63475305", "0.63475305", "0.63475305", "0.63475305", "0.6309867", "0.62977195", "0.6295578", "0.6283226", "0.62698406", "0.6233347", "0.6192283", "0.6159838", "0.61068225", "0.6081279", "0.6066499", "0.6066499", "0.60620046", "0.6019216", "0.601886...
0.62175196
12
This method checks if the current FeatureInstance.name exists, and if not creates it before calling 'add_application' method
def call_add_application_method(self, featureinstance_name): if not featureinstance_name: return self.total_num_of_certified_applications += 1 try: self.feature_instances[featureinstance_name].add_application() except Exception: self.feature_instances[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, feature):\n \n if self.bo is not None:\n feature.attach(self.bo)\n \n bo_feature_name = feature.name\n \n if bo_feature_name not in self._d_features:\n log.info(\"Add feature '%s'\" % feature)\n self._d_features[bo_feature...
[ "0.5992495", "0.57482624", "0.5716794", "0.5662957", "0.5619726", "0.56137705", "0.55674034", "0.5503153", "0.53733134", "0.5369881", "0.53372777", "0.5322008", "0.531878", "0.53061956", "0.52996767", "0.52598447", "0.52563745", "0.5197688", "0.5145518", "0.51279765", "0.5107...
0.6666649
0
Resets the gradient buffer to zeros.
def initialize(self, shard_shape): self.accumulated = np.zeros(shard_shape, dtype=np.float32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zero_grad(self):\n self.grad = Tensor(data=np.zeros_like(self.data, dtype=np.float))", "def reset_grad(self):\n self.optimizer.zero_grad()", "def reset_grad(self):\n self.unet.zero_grad()", "def reset_grad(self):\r\n self.unet.zero_grad()", "def reset_grad(self):\r\n ...
[ "0.76649684", "0.7440319", "0.74309134", "0.7417704", "0.74009854", "0.73982024", "0.73874044", "0.730847", "0.72520196", "0.72520196", "0.72520196", "0.72445893", "0.7221493", "0.7121704", "0.71020675", "0.7084088", "0.70316577", "0.69221556", "0.69019485", "0.6886621", "0.6...
0.0
-1
Put the accumulated gradients to the given object id.
def get(self, object_id): self.timeline.start("get") client = ray.worker.global_worker.plasma_client assert self.acc_counter == self.num_sgd_workers, self.acc_counter oid = ray.pyarrow.plasma.ObjectID(object_id) self.accumulated /= self.acc_counter client.put(self.accumul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradientFill(self, elem, gradientId):\n if gradientId not in self.gradients:\n self.alert(\"fill gradient not defined: \"+gradientId, elem )\n return\n gradient = self.gradients[gradientId]\n transformGradient = gradient\n while 'href' in gradient:\n ...
[ "0.58796704", "0.57581425", "0.55406964", "0.53763676", "0.5375029", "0.52819484", "0.5280273", "0.52055985", "0.51455665", "0.5026465", "0.49996096", "0.49828666", "0.49394947", "0.49371347", "0.48907992", "0.48880515", "0.48880515", "0.48880515", "0.48880515", "0.48880515", ...
0.5060793
9
Takes pandas dataframe, creates a countplot, print plots to image folder
def data_plot(hue, data): for i, col in enumerate(data.columns): plt.figure(i) sns.set(rc={'figure.figsize':(7, 3)}) sns.countplot(x=data[col],palette='husl',hue=hue,data=data) plt.savefig('images/{0}.png'.format(col))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_df(data_frame):\n plt.figure(figsize = (10, 5))\n chart = sns.countplot(data_frame['label'], \n palette=\"Set1\"\n )\n plt.show()", "def generate_plots_df(type_, df, name, plots_location):\n plt.cla()\n plt.clf()\n if type_ == 'heatmap':\n ...
[ "0.7152824", "0.66680795", "0.66244286", "0.6554808", "0.6430135", "0.6426214", "0.63668466", "0.62675965", "0.62464076", "0.62296003", "0.62211734", "0.6189203", "0.6065217", "0.60603434", "0.60252637", "0.59797853", "0.5975752", "0.5960248", "0.5956059", "0.59378356", "0.59...
0.7135219
1
Gets the enable_smtp of this Environmentupdate.
def enable_smtp(self): return self._enable_smtp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enabled(self):\n return self._get('enabled')", "def enable_smtp(self, enable_smtp):\n if enable_smtp is None:\n raise ValueError(\"Invalid value for `enable_smtp`, must not be `None`\")\n\n self._enable_smtp = enable_smtp", "def enable(self):\n return self._pa...
[ "0.6068993", "0.5883136", "0.58550483", "0.58171123", "0.58052105", "0.57948375", "0.5781963", "0.57638776", "0.57329404", "0.57178414", "0.5678755", "0.5675703", "0.5668147", "0.56564754", "0.56564754", "0.56564754", "0.56564754", "0.56564754", "0.56564754", "0.56564754", "0...
0.80639654
0
Sets the enable_smtp of this Environmentupdate.
def enable_smtp(self, enable_smtp): if enable_smtp is None: raise ValueError("Invalid value for `enable_smtp`, must not be `None`") self._enable_smtp = enable_smtp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_smtp(self):\n return self._enable_smtp", "def sms_enabled(self, sms_enabled):\n\n self._sms_enabled = sms_enabled", "def setEnabled(self, enable: bool) -> None:\n self.enabled = ...", "def test_sendmail(self):\n assert self.rc_conf.has_key('sendmail_enable')\n as...
[ "0.7358457", "0.5677029", "0.5669248", "0.55781484", "0.55618995", "0.5490005", "0.5470185", "0.5443838", "0.5439113", "0.5439113", "0.54206896", "0.54206896", "0.5405185", "0.5401536", "0.5349478", "0.53431773", "0.5333457", "0.5333457", "0.5326046", "0.5325502", "0.5320038"...
0.8061263
0
Gets the name of this Environmentupdate.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._env_name", "def name(self):\n return get_env_name(self.tool_name,\n self._python,\n self._requirements,\n self._tagged_env_vars)", "def name(self):\n return self.config[\"name\"]...
[ "0.74343807", "0.6908058", "0.68696845", "0.6811264", "0.6805903", "0.680235", "0.6787014", "0.6778483", "0.6778483", "0.67564535", "0.6721689", "0.6708546", "0.6660768", "0.66590095", "0.6656678", "0.6647102", "0.6632508", "0.6631405", "0.6631405", "0.6631405", "0.6631405", ...
0.0
-1
Sets the name of this Environmentupdate.
def name(self, name): if name is None: raise ValueError("Invalid value for `name`, must not be `None`") self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_name(self, new_name):\r\n self.__name = new_name", "def update_name(self, new_name):\r\n self.__name = new_name", "def updateName(self,name):\n self.name = name", "def set_name(self, name):\n self.settings[\"name\"] = name", "def set_name(self, name):\n self._n...
[ "0.7684566", "0.7684566", "0.7562974", "0.7525818", "0.7515865", "0.7502567", "0.7502567", "0.7502567", "0.7502567", "0.7502567", "0.7500976", "0.7500505", "0.7500505", "0.7498538", "0.7498538", "0.7461271", "0.7451179", "0.7427361", "0.74087465", "0.7405998", "0.7390263", ...
0.0
-1
Gets the title of this Environmentupdate.
def title(self): return self._title
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title(self):\n return self.properties.get('Title', None)", "def get_title(self):\n return self.metadata['title']", "def title(self):\n return self.get(self._names[\"title\"])", "def title(self):\n return self.get(self._names[\"title\"])", "def title(self):\n return se...
[ "0.77960676", "0.76958466", "0.76949847", "0.76949847", "0.76280046", "0.7596772", "0.7583214", "0.7583214", "0.7583214", "0.7580617", "0.7580617", "0.7580617", "0.7539942", "0.7534806", "0.7520924", "0.7517295", "0.7512677", "0.75030637", "0.7499291", "0.7495462", "0.7467598...
0.74828094
24
Gets the restrict_robots of this Environmentupdate.
def restrict_robots(self): return self._restrict_robots
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restrict_robots(self, restrict_robots):\n if restrict_robots is None:\n raise ValueError(\"Invalid value for `restrict_robots`, must not be `None`\")\n\n self._restrict_robots = restrict_robots", "def get_velocity_limits(robot):\n return _get_limits(robot, \"Velocity\")", "def g...
[ "0.62799674", "0.5660453", "0.56211734", "0.5443944", "0.54323953", "0.5117736", "0.51024455", "0.51024455", "0.5023561", "0.50147116", "0.4992004", "0.4911939", "0.4875303", "0.487525", "0.48285988", "0.48109904", "0.48109904", "0.48109904", "0.48086688", "0.48086688", "0.48...
0.79684675
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Environmentupdate): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Returns the content for a specific cell.
def render(self, value): return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_cell(self, content, **flags):\n return content", "def get_cell_content_as_string(cell):\n return ''.join(cell['source']) + '\\n'", "def get_cell_content(browser, author):\n content = list()\n cells = browser.find_all(class_='t t2')\n for cell in cells:\n if cell.find(class_=...
[ "0.72595155", "0.70436203", "0.6980137", "0.6702371", "0.66163945", "0.65606713", "0.6457893", "0.64549744", "0.6410841", "0.63882226", "0.63770366", "0.63678384", "0.63387984", "0.6220156", "0.6215154", "0.61747026", "0.6166808", "0.6113557", "0.61101216", "0.60740685", "0.6...
0.0
-1
Return a specialised column for the model field or `None`.
def from_field(cls, field): # Since this method is inherited by every subclass, only provide a # column if this class was asked directly. if cls is Column: return cls(verbose_name=field.verbose_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column(self, model=None):\n try:\n schema = (self.__model or model).schema()\n except AttributeError:\n return None\n else:\n return schema.column(self.__column)", "def column_for_field(self, field):\r\n # iterate in reverse order as columns are re...
[ "0.70405823", "0.69511366", "0.67622656", "0.67557836", "0.6749243", "0.6749243", "0.6523328", "0.63634026", "0.63037515", "0.6297394", "0.62007457", "0.6158639", "0.6129087", "0.6063988", "0.6057729", "0.60369146", "0.6009149", "0.6005756", "0.5979712", "0.59648836", "0.5949...
0.6331528
8
Return an iterator that exposes all `.BoundColumn` objects, regardless of visiblity or sortability.
def iterall(self): return (column for name, column in self.iteritems())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetColumnIterator(self):\n return self.columns.__iter__()", "def __iter__(self):\r\n for column_id in self._columns.keys():\r\n yield column_id", "def columns(self):\n headers = self.headers()\n for h in headers:\n col = self.get_column(h)\n yield co...
[ "0.74998367", "0.6733475", "0.63558817", "0.61557996", "0.60569", "0.5923558", "0.5917288", "0.5830071", "0.5779003", "0.57685", "0.5768309", "0.57504684", "0.57504016", "0.5739775", "0.57377625", "0.568226", "0.56805694", "0.5675297", "0.5672534", "0.56526893", "0.56469643",...
0.6646306
2
Iterate over the rendered values for cells in the row. Under the hood this method just makes a call to `.BoundRow.__getitem__` for each cell.
def __iter__(self): for column, value in self.items(): # this uses __getitem__, using the name (rather than the accessor) # is correct – it's what __getitem__ expects. yield value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_iterator(self, row):\n for cell in row:\n yield cell.value", "def iter_cells(self):\n\t\treturn iter(self._cells)", "def __iter__(self):\n return iter(self.__rows)", "def __iter__(self):\n return iter(self.rows)", "def cells(self) -> Iterable[\"RenderableType\"]:\...
[ "0.72513837", "0.6952072", "0.6808255", "0.6780938", "0.6740394", "0.6674758", "0.6445969", "0.64176613", "0.63560575", "0.6223891", "0.61345124", "0.6116092", "0.6086124", "0.6065281", "0.6021305", "0.5979495", "0.59714013", "0.59514636", "0.5941377", "0.59390664", "0.591453...
0.69146323
2
Slicing returns a new `.BoundRows` instance, indexing returns a single `.BoundRow` instance.
def __getitem__(self, key): container = BoundRows if isinstance(key, slice) else BoundRow return container(self.data[key], table=self.table)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slice(self, start=None, end=None, inplace=False):\n if inplace:\n self.data = self.data[start:end]\n else:\n cpy = self.copy()\n\n cpy.data = cpy.data[start:end]\n\n return cpy\n return", "def to_slice(self):\n return np.index_exp[self.start...
[ "0.64076424", "0.63139033", "0.6271457", "0.61540145", "0.6049486", "0.6019112", "0.59296674", "0.59145045", "0.5772993", "0.5735658", "0.57255775", "0.57184094", "0.5711539", "0.5705664", "0.5689886", "0.5647137", "0.56449705", "0.5616331", "0.5584623", "0.5576386", "0.55459...
0.63265294
1
The full (singular) name for the data. Queryset data has its model's `~django.db.Model.Meta.verbose_name` honored. List data is checked for a ``verbose_name`` attribute, and falls back to using ``"item"``.
def verbose_name(self): if hasattr(self, "queryset"): return self.queryset.model._meta.verbose_name return getattr(self.list, "verbose_name", "item")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verbose_name(self):\r\n # Favor an explicit defined verbose_name\r\n if self.column.verbose_name:\r\n return self.column.verbose_name\r\n\r\n # This is our reasonable fallback, should the next section not result\r\n # in anything useful.\r\n name = title(self.name....
[ "0.6961568", "0.6863045", "0.6717473", "0.65627736", "0.6477277", "0.64678353", "0.64655405", "0.64429027", "0.6372508", "0.631371", "0.631371", "0.6310014", "0.62864983", "0.62737924", "0.6271162", "0.626229", "0.626229", "0.6259583", "0.6252215", "0.62478524", "0.62419856",...
0.77697116
0
The full (plural) name of the data. This uses the same approach as `.verbose_name`.
def verbose_name_plural(self): if hasattr(self, "queryset"): return self.queryset.model._meta.verbose_name_plural return getattr(self.list, "verbose_name_plural", "items")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_verbose_name_plural(instance):\n return instance._meta.verbose_name_plural", "def __str__(self):\n return f\"{self._meta.verbose_name.title()}: {self.name}\"", "def verbose_name(self):\r\n # Favor an explicit defined verbose_name\r\n if self.column.verbose_name:\r\n ...
[ "0.73208904", "0.72696054", "0.7242574", "0.71641815", "0.7046173", "0.7029439", "0.6957256", "0.6957256", "0.6936655", "0.69330144", "0.6778244", "0.6717594", "0.66838825", "0.66794854", "0.66515046", "0.66409886", "0.66280985", "0.6606867", "0.65962243", "0.6577266", "0.657...
0.7351179
0
Render the table to a simple HTML table. If this method is used in the request/response cycle, any links generated will clobber the querystring of the request. Use the ``{% render_table %}`` template tag instead.
def as_html(self): template = get_template(self.template) request = build_request() return template.render(RequestContext(request, {'table': self}))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_html(self): # pragma: no cover\n\n return render_to_string(\n self._meta.template,\n { \"table\": self } )", "def _html_repr(self):\n html = '<table id=%s>' % (self._id,)\n\n for row in range(self.rows):\n html += '<tr>'\n for col in range(self.columns):\n ...
[ "0.71191037", "0.66694224", "0.6646043", "0.65482414", "0.64231706", "0.63537496", "0.6327373", "0.6274737", "0.62582046", "0.62238955", "0.62172115", "0.62112254", "0.6156878", "0.61375934", "0.6132498", "0.6121965", "0.6104695", "0.6064788", "0.6059239", "0.6059096", "0.604...
0.74862283
0
Creates a URL (containing only the querystring [including "?"]) based on the current URL, but updated with the provided keyword arguments.
def set_url_param(parser, token): bits = token.contents.split() qschanges = {} for i in bits[1:]: try: key, value = i.split('=', 1) key = key.strip() value = value.strip() key_line_iter = six.StringIO(key).readline keys = list(toke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url(*args, **kwargs):\n if len(args) == 0 and len(kwargs) == 0:\n return cherrypy.url()\n # First read the old args\n newkwargs = dict(\n (k, v[3:]) for (k, v) in kwargs.iteritems()\n if v is not None and k.startswith('old')\n )\n # Apply neither new nor old args\n for (k...
[ "0.71269083", "0.696206", "0.6933541", "0.6933541", "0.6729611", "0.6729611", "0.6667509", "0.6631334", "0.65537256", "0.6506654", "0.6489046", "0.6487233", "0.6357621", "0.6346923", "0.6331999", "0.6316573", "0.62811273", "0.62674206", "0.6259063", "0.624763", "0.6247539", ...
0.0
-1
Creates a URL (containing only the querystring [including "?"]) derived from the current URL's querystring, by updating it with the provided keyword arguments.
def querystring(parser, token): bits = token.split_contents() tag = bits.pop(0) updates = token_kwargs(bits, parser) # ``bits`` should now be empty of a=b pairs, it should either be empty, or # have ``without`` arguments. if bits and bits.pop(0) != "without": raise TemplateSyntaxE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_with_querystring(url, **kwargs):\n return url + '?' + urlencode(kwargs)", "def append_query_params(original_url, **kwargs):\n scheme, netloc, path, query_string, fragment = urlsplit(original_url)\n query_params = parse_qs(query_string)\n if kwargs is not None:\n for key, value in kwarg...
[ "0.71255714", "0.70960975", "0.70960975", "0.69132155", "0.6744011", "0.6693898", "0.66810757", "0.6602226", "0.65441436", "0.65441436", "0.65200067", "0.6494983", "0.6483776", "0.64059395", "0.6354132", "0.6324165", "0.628746", "0.6250806", "0.62477124", "0.6230619", "0.6222...
0.0
-1
Return `True` if this object induces descending ordering
def is_descending(self): return self.startswith('-')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_descending(self):\n return self._tag == 'descending'", "def is_ascending(self):\r\n return not self.is_descending", "def is_ascending(self):\n return self._tag == 'ascending'", "def is_sorted(self):\n previous = 0 # Setting to 0 shouldn't be an issue aslong as MIN_VALUE is...
[ "0.8404216", "0.7983187", "0.7450965", "0.71013033", "0.70982635", "0.7056469", "0.7013359", "0.6878701", "0.6847868", "0.653225", "0.64804333", "0.64175385", "0.6409212", "0.6303606", "0.6292045", "0.6261215", "0.6244093", "0.6207098", "0.6206484", "0.61938953", "0.6165569",...
0.81954825
1
Return `True` if this object induces ascending ordering.
def is_ascending(self): return not self.is_descending
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ascending(self):\n return self._tag == 'ascending'", "def is_sorted(self):\n previous = 0 # Setting to 0 shouldn't be an issue aslong as MIN_VALUE is at least 0\n for value in self.data:\n if value < previous:\n return False\n previous = value\n ...
[ "0.8327936", "0.77625084", "0.73845375", "0.71444535", "0.71390593", "0.7137105", "0.70656365", "0.70335025", "0.6986424", "0.698436", "0.69682", "0.69393694", "0.68710196", "0.6778779", "0.672027", "0.67108786", "0.6669536", "0.66500854", "0.66257894", "0.6623606", "0.659507...
0.8378771
0
Return a fresh HTTP GET / request. This is essentially a heavily cutdown version of Django 1.3's `~django.test.client.RequestFactory`.
def build_request(uri='/'): path, _, querystring = uri.partition('?') return WSGIRequest({ 'CONTENT_TYPE': 'text/html; charset=utf-8', 'PATH_INFO': path, 'QUERY_STRING': querystring, 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_METHOD': 'GET', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_factory() -> RequestFactory:\n\n return RequestFactory()", "def req():\n return Request()", "def request_factory(environ):\n request = Request(environ)\n _LOG.debug('trunctated request body: {b}'.format(b=request.body[:1000]))\n return request", "def newRequest(self):\n retu...
[ "0.737841", "0.6540925", "0.6465308", "0.64563364", "0.63838285", "0.6350157", "0.6337125", "0.61784714", "0.61557555", "0.6120575", "0.61052895", "0.6083018", "0.60572857", "0.60378414", "0.5970848", "0.5963571", "0.59630895", "0.5957658", "0.5956011", "0.5926464", "0.592164...
0.60054964
14
Return the class to use for the table.
def get_table_class(self): if self.table_class: return self.table_class raise ImproperlyConfigured("A table class was not specified. Define " "%(cls)s.table_class" % {"cls": type(self).__name__})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table(cls):\n return cls.__name__", "def get_class(self):\n\t\treturn self.CLASS", "def _get_tabletype(cls) -> str:\n raise NotImplementedError", "def get_class(self):\n return self.meta_model.get_class()", "def __tablename__(cls):\n return get_table_name(cls.__name__)", "...
[ "0.73946357", "0.72595805", "0.72248554", "0.70972914", "0.6927471", "0.6862894", "0.685894", "0.68172747", "0.6764315", "0.6760252", "0.6751035", "0.6600833", "0.65545726", "0.65224016", "0.6465551", "0.64342874", "0.63920754", "0.63872766", "0.6382919", "0.637335", "0.63406...
0.82822967
0
When a model field uses the ``choices`` option, a table should render the "pretty" value rather than the database value. See issue 30 for details.
def field_choices_used_to_translated_value(): LANGUAGES = ( ('en', 'English'), ('ru', 'Russian'), ) from django.db import models class Article(models.Model): name = models.CharField(max_length=200) language = models.CharField(max_length=200, choices=LANGUAGES)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_choices_str(self):\n return ', '.join(\n '\"%s\"' % choice\n for choice in self.choices\n )", "def get_field_info(self, field):\n field_info = super(SimpleMetadata, self).get_field_info(field)\n if self.should_detail_choices(field, field_info):\n ...
[ "0.58707404", "0.5840146", "0.57558227", "0.56949884", "0.5662058", "0.5639335", "0.55998", "0.5569905", "0.5475428", "0.53925896", "0.53708524", "0.5325692", "0.531032", "0.53069127", "0.5278223", "0.5269571", "0.5246018", "0.52306014", "0.51992244", "0.5189296", "0.5175613"...
0.6036664
0
Compare arbitrary data structures for equality. ``struct_1`` is expected to be the reference data structure. Cannot handle set like data structures.
def _equivalent_data_structures(struct_1, struct_2): if isinstance(struct_1, np.ndarray): return np.allclose(struct_1, struct_2) if isinstance(struct_1, Mapping): if set(struct_1.keys()) != set(struct_2.keys()): return False return all( _equivalent_data_structures...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other: Any) -> bool:\n return (\n super().__eq__(other)\n and isinstance(other, Struct)\n and self._valid_struct_metadata().fields == other._valid_struct_metadata().fields\n and list(self._valid_struct_metadata().fields.keys()) == list(other._vali...
[ "0.68540764", "0.6399608", "0.6170465", "0.615269", "0.6062307", "0.590052", "0.58261555", "0.58115506", "0.57826674", "0.5735285", "0.5722427", "0.5707567", "0.56666404", "0.5666308", "0.56633323", "0.5654025", "0.565348", "0.56528854", "0.5650887", "0.5607844", "0.5597316",...
0.77323884
0
Converts a list of types and type parameter values into dicts.
def to_type_parameter_dicts(types, argument_dict): type_parameters_dicts = {} for name, (values, num_types) in argument_dict.items(): if num_types > 1: type_keys = itertools.combinations_with_replacement( particle_types, num_types) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listify_values(params):\n return dict((k, listify(v)) for (k, v) in params.iteritems())", "def parse_types(schema_types: List[Dict]) -> Dict[str, SchemaType]:\n result = {}\n for schema_type in schema_types:\n new_type = SchemaType(schema_type)\n result[new_type.name] =...
[ "0.67144096", "0.6639492", "0.6530862", "0.64845455", "0.6428697", "0.6336953", "0.6211098", "0.6177127", "0.61542326", "0.6107823", "0.6081378", "0.60794437", "0.6044896", "0.6011951", "0.5982472", "0.5973921", "0.5948798", "0.59248054", "0.58796966", "0.58610576", "0.585175...
0.7086095
0