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 |
|---|---|---|---|---|---|---|
sort the model column After sorting the data in ascending or descending order, a signal `layoutChanged` is emitted. | def sort(self, columnId, order=Qt.AscendingOrder):
self.layoutAboutToBeChanged.emit()
self.sortingAboutToStart.emit()
column = self._dataFrame.columns[columnId]
self._dataFrame.sort_values(column,
ascending=not bool(order),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort(self, Ncol, order):\n self.emit(SIGNAL(\"layoutAboutToBeChanged()\"))\n self.arraydata = sorted(self.arraydata, key=operator.itemgetter(Ncol)) \n if order == Qt.DescendingOrder:\n self.arraydata.reverse()\n self.emit(SIGNAL(\"layoutChanged()\"))",
"def sort(s... | [
"0.7686626",
"0.7660356",
"0.7609118",
"0.75360477",
"0.7532754",
"0.6921959",
"0.6834143",
"0.6465188",
"0.6418707",
"0.6384737",
"0.6375916",
"0.63108104",
"0.6282037",
"0.62464035",
"0.61888105",
"0.61464596",
"0.61439526",
"0.61345136",
"0.6103229",
"0.60899144",
"0.60432... | 0.63957465 | 9 |
Gets a collection of `InputExample`s for the train set. | def get_train_examples(self, data_dir):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_train_inputs(self, example):\n return example",
"def get_train_examples(self):\n raise NotImplementedError()",
"def get_train_examples(self, input_file):\r\n raise NotImplementedError()",
"def _create_examples(self, data, set_type):\n examples = []\n for (i, elem) in en... | [
"0.73499966",
"0.7173421",
"0.7126833",
"0.65602446",
"0.64204013",
"0.64052176",
"0.63422555",
"0.6290186",
"0.6282746",
"0.625262",
"0.62499267",
"0.6233708",
"0.62225735",
"0.62225735",
"0.6205607",
"0.6205607",
"0.6205607",
"0.6205607",
"0.6205607",
"0.6205607",
"0.620560... | 0.62466323 | 20 |
Gets a collection of `InputExample`s for the dev set. | def get_dev_examples(self, data_dir):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dev_examples(self, input_file):\r\n raise NotImplementedError()",
"def get_train_inputs(self, example):\n return example",
"def get_examples(self, env):\n return self.fam.c_get_examples(self, env)",
"def get_dev_examples(self):\n raise NotImplementedError()",
"def _create_ex... | [
"0.680984",
"0.6586721",
"0.6557458",
"0.65529203",
"0.64259696",
"0.6381688",
"0.625446",
"0.6191522",
"0.61163276",
"0.6092532",
"0.60542095",
"0.60498804",
"0.5990785",
"0.5926057",
"0.5921287",
"0.59205073",
"0.5918335",
"0.5916085",
"0.5916085",
"0.5916085",
"0.5916085",... | 0.59952354 | 18 |
Gets a collection of `InputExample`s for the dev set. | def get_test_examples(self, data_dir):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dev_examples(self, input_file):\r\n raise NotImplementedError()",
"def get_train_inputs(self, example):\n return example",
"def get_examples(self, env):\n return self.fam.c_get_examples(self, env)",
"def get_dev_examples(self):\n raise NotImplementedError()",
"def _create_ex... | [
"0.68112403",
"0.6588688",
"0.655683",
"0.6552607",
"0.64272827",
"0.63816285",
"0.6255956",
"0.61930686",
"0.61160946",
"0.6094262",
"0.6054992",
"0.6051947",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",
"0.5994604",... | 0.0 | -1 |
Return a random color as c4d.Vector | def get_random_color():
def get_random_value():
""" Return a random value between 0.0 and 1.0 """
return randint(0, 255) / 256.0
return Vector(get_random_value(), get_random_value(), get_random_value()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randcolor():\r\n r = random(0.0, 1.0)\r\n g = random(0.0, 1.0)\r\n b = random(0.0, 1.0)\r\n return vec(r, g, b) # A color is a three-element vec\r",
"def get_random_color():\n def get_random_value():\n \"\"\" Return a random value between 0.0 and 1.0 \"\"\"\n re... | [
"0.83026356",
"0.8255743",
"0.7439888",
"0.7107803",
"0.70549285",
"0.7053493",
"0.70376676",
"0.7015442",
"0.69945",
"0.69569045",
"0.6873321",
"0.6841347",
"0.6841197",
"0.6791249",
"0.6758189",
"0.67249537",
"0.6690875",
"0.65709573",
"0.65383506",
"0.65089667",
"0.6360487... | 0.81792206 | 2 |
This function reads the text file and returns it as a string. | def read_file(file_path: str) -> str:
try:
with open(file=file_path, mode='r', encoding="utf8") as f:
return f.read()
except FileNotFoundError:
raise FileNotFoundError(f'No text file was found at location {file_path}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_text(file_name):\n\tf = open(file_name, 'r')\n\ttext = f.read()\n\treturn text",
"def read_text_file(str_name_file: str):\n content: str = ''\n with open(str_name_file, mode=\"r\", encoding='utf-8') as file:\n print(\"file being read: \" + str_name_file + \"\\n\")\n content = fil... | [
"0.828257",
"0.8251012",
"0.8209594",
"0.8208901",
"0.8119222",
"0.8033638",
"0.8028715",
"0.8016483",
"0.7973762",
"0.7953504",
"0.7953002",
"0.7890296",
"0.786301",
"0.7840378",
"0.78059036",
"0.77927315",
"0.77896625",
"0.7770816",
"0.7729257",
"0.7713118",
"0.7699153",
... | 0.7464258 | 35 |
Transform a raw result into a result object. | def dict2result(self, dictionary: dict) -> _Result:
result = _Result(uri=dictionary.get("uri"),
pref_label=dictionary.get("prefLabel"),
alt_label=dictionary.get("altLabel"),
hidden_label=dictionary.get("hiddenLabel"),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _process_result(self, r):\n return self._return_type._make(r)",
"def normalize_transaction_result(cls, result: JSON) -> JSON:\n ...",
"def process_result(self, result: Any) -> None:\n raise NotImplementedError()",
"def normalize_transfer_result(cls, result: JSON) -> JSON:\n ..... | [
"0.73860013",
"0.6576357",
"0.64620686",
"0.6302396",
"0.62909645",
"0.6290217",
"0.6190322",
"0.61591643",
"0.61179495",
"0.5933553",
"0.58802587",
"0.5862519",
"0.5812644",
"0.58100003",
"0.5792762",
"0.5790362",
"0.5717754",
"0.5670863",
"0.56573755",
"0.5607943",
"0.55663... | 0.52212816 | 50 |
Set words as JSKOS concept scheme. If the words are not yet a JSKOS concept scheme, they are transformed into one. | def _set_input(self, words: Union[list, str, _ConceptScheme], language) -> _ConceptScheme:
if type(words) is list:
scheme = _Utility.words2scheme(words=words, language=language)
elif type(words) is _ConceptScheme:
scheme = words
else:
scheme = _Utility.load_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_ptype_words(self):\n new_words = []\n # new_words = \"\"\n for word in self.words:\n #after making words to lower letters\n new_word = re.sub(r'\\b(istj|istp|isfj|isfp|infj|infp|intj|intp|estp|estj|esfp|esfj|enfp|enfj|entp|entj)', '', word)\n if new_word != '':\n new_w... | [
"0.5699493",
"0.564014",
"0.560305",
"0.54181963",
"0.53393966",
"0.53358144",
"0.5321427",
"0.53053606",
"0.52888644",
"0.5262378",
"0.5233003",
"0.5190377",
"0.51499665",
"0.51386184",
"0.51318175",
"0.5058953",
"0.50381505",
"0.5018874",
"0.5000191",
"0.49968395",
"0.49815... | 0.5830779 | 0 |
Return the best vector of a vector. The best vector has the best score for each search word. | def make_best_vector(cls, vector: _LevenshteinVector, sensitivity: int) -> Optional[_LevenshteinVector]:
# collect all unique searchwords in vector:
initial_vector = vector.get_vector()
if initial_vector is None:
return None
else:
searchwords = set(score.comparan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def most_parallel_vector(v, vectors, tolerance_dot=0.0):\n\n best_dot = tolerance_dot\n best_w = None\n for w in vectors:\n d = abs_dot(v, w)\n if d > best_dot:\n best_dot = d\n best_w = w\n return best_w",
"def get_best_vector(results, f_x, target):\n index_min... | [
"0.6942959",
"0.6580758",
"0.6432847",
"0.6397034",
"0.6383685",
"0.6131921",
"0.59491545",
"0.5905546",
"0.5899086",
"0.5862022",
"0.5852791",
"0.5837495",
"0.5833848",
"0.5821429",
"0.57959634",
"0.5783312",
"0.5774312",
"0.57693887",
"0.5760407",
"0.5734421",
"0.57002914",... | 0.77227366 | 0 |
Return the suggestion's score type. | def get_score_type(self) -> ScoreType:
return self._score_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spelling(self):\r\n return conf.lib.clang_getTypeKindSpelling(self.value)",
"def _make_suggestion(self, sensitivity: int, score_type: ScoreType, verbose: bool = False) -> Suggestion:\n\n if verbose is True:\n print(\"Calculating suggestions...\", end=\" \")\n\n # determine sor... | [
"0.6271617",
"0.62667257",
"0.6072",
"0.59333915",
"0.5900365",
"0.58527637",
"0.5820442",
"0.57752943",
"0.57273537",
"0.5711135",
"0.5660256",
"0.5659784",
"0.56346226",
"0.56205094",
"0.5610557",
"0.55933857",
"0.55762625",
"0.55731374",
"0.5572404",
"0.55374163",
"0.55249... | 0.75565815 | 0 |
Get as pandas DataFrame. If keys is a list, return only the specified values, otherwise all. | def as_dataframe(self, keys=None) -> pd.DataFrame:
lst = self.as_list(keys)
df = pd.DataFrame(lst)
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DataFrame(dat):\n keys = dat.keys()\n l = []\n for key in keys:\n v = dat[key]\n assert type(v) is np.ndarray and v.ndim <= 2 and v.ndim >= 1, \\\n '%s must be np.ndarray with 1 <= ndim <= 2 !' % key\n\n if v.ndim == 1:\n ix = pd.MultiIndex.from_product([[key... | [
"0.6490659",
"0.62247443",
"0.6186467",
"0.6035148",
"0.5992372",
"0.58087355",
"0.5792262",
"0.5729693",
"0.5648439",
"0.5643608",
"0.5581647",
"0.5577575",
"0.55186385",
"0.5496193",
"0.54955506",
"0.54705286",
"0.5462627",
"0.5449187",
"0.5407251",
"0.53933865",
"0.5385375... | 0.79539824 | 0 |
Extract the list of values for the specified key as a list. | def get_for_key(self, key) -> list:
return [res[key] for res in self.list] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getlist(self, key):\n try:\n vals = _dict_getitem(self, key.lower())\n except KeyError:\n return []\n else:\n if isinstance(vals, tuple):\n return [vals[1]]\n else:\n return vals[1:]",
"def getlist(self, key):\n ... | [
"0.8320048",
"0.8208394",
"0.8032018",
"0.7949522",
"0.7643262",
"0.7641804",
"0.72907823",
"0.72817355",
"0.72678703",
"0.69285166",
"0.6918752",
"0.68843967",
"0.68769276",
"0.6870262",
"0.6771129",
"0.6693715",
"0.6649705",
"0.6641438",
"0.6641438",
"0.6598585",
"0.6556997... | 0.7920585 | 4 |
Using the validator method to keep the `n_wind_directions` attribute up to date. | def wind_directions_validator(self, instance: attrs.Attribute, value: NDArrayFloat) -> None:
self.n_wind_directions = value.size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def het_map_validator(self, instance: attrs.Attribute, value: list | None) -> None:\n if value is None:\n return\n\n if self.n_wind_directions!= np.array(value).shape[0]:\n raise ValueError(\n \"The het_map's wind direction dimension not equal to number of wind di... | [
"0.6396236",
"0.57463574",
"0.53125423",
"0.52856094",
"0.5280262",
"0.51764774",
"0.51656985",
"0.515253",
"0.514733",
"0.49225286",
"0.49214053",
"0.49155375",
"0.48704457",
"0.48037454",
"0.47837922",
"0.47748974",
"0.47602305",
"0.47600368",
"0.47496325",
"0.47486392",
"0... | 0.78646344 | 0 |
Returns current level of indentation inside pushed tags. | def indent_level(self):
return len(self._tagstack) - 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indentation_level(self):\n return self._indentation_levels[-1]",
"def indentation(self):\n return self.options.indentation_char * sum(self._indentation_levels)",
"def determine_indentation(self):\n # Ensuring NEWLINE tokens are actually specified as such\n if self.current.tokenu... | [
"0.70961106",
"0.6695327",
"0.66165316",
"0.6539523",
"0.64611006",
"0.6391528",
"0.62671214",
"0.6253822",
"0.6246255",
"0.6241332",
"0.6204868",
"0.6121867",
"0.6121867",
"0.6107544",
"0.6107544",
"0.6104235",
"0.6103745",
"0.610004",
"0.6092902",
"0.6080785",
"0.6071802",
... | 0.7837296 | 0 |
Given a sequence, embeds the symbols and runs it through a RNN. | def rnn_with_embedding(self,cell,init_state,input_seq,
input_seq_len,reuse=None,
scope="RNN"):
with tf.variable_scope(scope,reuse=reuse) as vs:
log(vs.name+"/Encoding sequences")
with tf.device('/cpu:0'):
emb = tf.get_variable("emb",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_sequence(sequence, rnns, embedder, dropout_amount=0.):\n\n batch_size = 1\n layer_states = []\n for rnn in rnns:\n hidden_size = rnn.weight_hh.size()[1]\n \n # h_0 of shape (batch, hidden_size)\n # c_0 of shape (batch, hidden_size)\n if rnn.weight_hh.is_cuda:\... | [
"0.63551354",
"0.63127804",
"0.60661817",
"0.5897372",
"0.5684063",
"0.55718404",
"0.55567276",
"0.55235744",
"0.55009085",
"0.54807246",
"0.5479477",
"0.54235196",
"0.54058605",
"0.5362318",
"0.5346911",
"0.5321391",
"0.5312344",
"0.53047484",
"0.5285546",
"0.5284771",
"0.52... | 0.6237607 | 2 |
Given a target sentence (and length) and unnormalized probabilities (logits) for predicted sentence, computes the cross entropy, excluding the padded symbols. | def softmax_xent_loss_sequence(
self,logits,target,seq_len,
max_seq_len,reduce_mean=True):
# Loss weights; don't wanna penalize PADs!
ones = tf.ones_like(seq_len)
ones_float = tf.ones_like(seq_len,dtype=tf.float32)
zeros = ones_float*0
weight_list = [
tf.select(
tf.les... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_entropy(predictions, targets):\n likelihood = targets * np.log(predictions)\n return -np.sum(likelihood) / predictions.shape[0]",
"def cross_entropy(input: Tensor, target: Tensor) -> Tensor:\n norm_log = log_softmax(input, 1)\n\n np_one_hot = np.eye(input.shape[1])[target.data]\n tensor_... | [
"0.6959594",
"0.6780298",
"0.67594975",
"0.67403674",
"0.6668072",
"0.6663409",
"0.658034",
"0.6557828",
"0.6520188",
"0.6482352",
"0.64746106",
"0.6470134",
"0.64606",
"0.64569986",
"0.643825",
"0.6423755",
"0.6421237",
"0.63987577",
"0.6395123",
"0.6391207",
"0.6387115",
... | 0.6001862 | 72 |
cpe22() returns a string containing the cpe2.2 ID of a cpe2.3 input | def cpe22(self, param):
data = self._http_get("cpe2.2", query=param)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cpe23(self, param):\n data = self._http_get(\"cpe2.3\", query=param)\n return data",
"def from_cpe23_fs(cpe23_fs):\n\n cpe_parts = cpe23_fs.split(':')\n\n if cpe_parts and len(cpe_parts) == 13:\n return CPE(\n part=cpe_parts[2],\n vendor=cp... | [
"0.6630935",
"0.57633036",
"0.5497087",
"0.541257",
"0.53960246",
"0.52237415",
"0.52049315",
"0.5098695",
"0.50515145",
"0.5013887",
"0.5013887",
"0.5013887",
"0.5013887",
"0.50137585",
"0.4998508",
"0.49531776",
"0.49024463",
"0.48953226",
"0.4893831",
"0.4865647",
"0.48622... | 0.6938188 | 0 |
cpe23() returns a string containing the cpe2.3 ID of a cpe2.2 input | def cpe23(self, param):
data = self._http_get("cpe2.3", query=param)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cpe22(self, param):\n data = self._http_get(\"cpe2.2\", query=param)\n return data",
"def from_cpe23_fs(cpe23_fs):\n\n cpe_parts = cpe23_fs.split(':')\n\n if cpe_parts and len(cpe_parts) == 13:\n return CPE(\n part=cpe_parts[2],\n vendor=cp... | [
"0.6695368",
"0.6105126",
"0.5437129",
"0.54323643",
"0.539157",
"0.5294149",
"0.5223644",
"0.52232444",
"0.519648",
"0.51849777",
"0.51523095",
"0.5075818",
"0.50738186",
"0.50570905",
"0.50485784",
"0.50404114",
"0.5039948",
"0.5033781",
"0.5031555",
"0.5031555",
"0.5031555... | 0.7180104 | 0 |
KL divergence loss for label smoothing. | def kl_div_label_smoothing(logits, label_smoothing_prob,
distribution='uniform', size_average=False):
batch_size, label_num, num_classes = logits.size()
if distribution == 'uniform':
dist = Variable(torch.FloatTensor(
batch_size, label_num, num_classes).fill_(1 / n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_KL_divergence(self):\n KL_loss = 0\n if(self.Bayesian):\n for i in range(self.num_layers):\n KL_loss += getattr(self, 'LSTMCell%i'%(i+1)).get_KL_divergence()\n \n return KL_loss",
"def get_KL_divergence(self):\n KL_loss_W = Vil.get_KL_d... | [
"0.77631253",
"0.7735856",
"0.7184239",
"0.7123723",
"0.711008",
"0.70951635",
"0.7029459",
"0.69768727",
"0.69391775",
"0.690529",
"0.68863285",
"0.6854387",
"0.68506134",
"0.66968983",
"0.65498596",
"0.65129983",
"0.6460759",
"0.6449841",
"0.6434856",
"0.64336187",
"0.64048... | 0.6847771 | 13 |
Sets the type of this PointSource. | def type(self, type):
self._type = type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_type(self, source_type):\n\n self._source_type = source_type",
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self._type = type",
"def set_type(self, type: int):\r\n self.type = type\... | [
"0.7472811",
"0.71074206",
"0.71074206",
"0.6988086",
"0.6758271",
"0.6690656",
"0.6690656",
"0.66478246",
"0.6629015",
"0.6601621",
"0.6508255",
"0.64502424",
"0.6424808",
"0.6424808",
"0.6410846",
"0.6401368",
"0.63896066",
"0.63896066",
"0.63896066",
"0.62326574",
"0.62187... | 0.6666249 | 24 |
Sets the device_group_full_path of this PointSource. | def device_group_full_path(self, device_group_full_path):
if device_group_full_path is None:
raise ValueError("Invalid value for `device_group_full_path`, must not be `None`") # noqa: E501
self._device_group_full_path = device_group_full_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_path(self, value):\n self._device_path = value",
"def _set_device_path(self):\n pass",
"def __set_full_path_of_file(self, value):\n self.full_path_of_file = value",
"def set_group(self, group):\n self._group = group",
"def setGroup(self, group):\n\t\tself.config.G... | [
"0.6343813",
"0.62400657",
"0.5573039",
"0.5414609",
"0.5374962",
"0.5300541",
"0.52986115",
"0.5293769",
"0.5293769",
"0.5293769",
"0.52903366",
"0.52903366",
"0.52903366",
"0.52788424",
"0.52788424",
"0.52788424",
"0.5253133",
"0.5171468",
"0.51232606",
"0.50944954",
"0.501... | 0.7744933 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, PointSource):
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.8456082",
"0.83912885",
"0.81436425",
"0.81406975",
"0.8131807",
"0.8093013",
"0.80912536",
"0.80912536",
"0.80912536",
"0.8084505",
"0.8084505",
"0.8075543",
"0.8075543",
"0.8065009"
] | 0.0 | -1 |
Learning Rate Schedule Learning rate is scheduled to be reduced after 80, 120, 160, 180 epochs. Called automatically every epoch as part of callbacks during training. Arguments | def lr_schedule(epoch):
lr = 1e-3
if epoch > 180:
lr *= 0.5e-3
elif epoch > 160:
lr *= 1e-3
elif epoch > 120:
lr *= 1e-2
elif epoch > 80:
lr *= 1e-1
return lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rnn_learning_rate_schedule(dataset):\n model, prefix = make_rnn(non_negative=True)\n # model.set_params(**{prefix + \"val\": 0.1})\n\n # base = no schedule\n print(\"Baseline RNN\")\n # model.set_params(**{prefix + \"history_file\": \"nn_default.csv\"})\n cross_validate(dataset, model)\n #... | [
"0.752296",
"0.7497643",
"0.7485013",
"0.74808353",
"0.74690914",
"0.74690914",
"0.74690914",
"0.74690914",
"0.74073625",
"0.7365968",
"0.73530453",
"0.73473936",
"0.7266955",
"0.7263914",
"0.7227353",
"0.72229457",
"0.71963936",
"0.7189921",
"0.7098155",
"0.7085787",
"0.7077... | 0.73345053 | 12 |
Returns a intermediary_institution_account as string | def intermediary_institution_56C(self):
if self.use_operations_xml:
intermediary_institution_account = FSwiftWriterUtils.get_value_from_xml_tag(self.swift_metadata_xml_dom,
['SWIFT',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_account_with_institution_option(self):\n return 'A'",
"def _format_intermediary_institution_56A(self, val):\n intermediary_institution_account = val.get('ACCOUNT')\n intermediary_institution_bic = val.get('BIC')\n if intermediary_institution_bic:\n if intermediary_i... | [
"0.74852425",
"0.7026253",
"0.69231075",
"0.66851497",
"0.6650424",
"0.6355309",
"0.6355309",
"0.63351065",
"0.62996703",
"0.62567073",
"0.60395676",
"0.603254",
"0.5992339",
"0.5976033",
"0.5953705",
"0.5926193",
"0.5912343",
"0.5912343",
"0.5912343",
"0.5891503",
"0.5858354... | 0.7071799 | 1 |
Returns a account_with_institution as string | def account_with_institution_57C(self):
if self.use_operations_xml:
account_with_institution_account = FSwiftWriterUtils.get_value_from_xml_tag(self.swift_metadata_xml_dom,
['SWIFT',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_account_with_institution_option(self):\n return 'A'",
"def _format_account_with_institution_57D(self, val):\n account = val.get('ACCOUNT')\n name = val.get('NAME')\n address = val.get('ADDRESS')\n if name and address:\n name = FSwiftWriterUtils.split_text_and... | [
"0.79085237",
"0.71209055",
"0.7116753",
"0.6686492",
"0.6606173",
"0.6602766",
"0.65014666",
"0.6361041",
"0.6361041",
"0.6360945",
"0.63221234",
"0.6292849",
"0.6226572",
"0.6211359",
"0.6132382",
"0.6098485",
"0.6067252",
"0.60392857",
"0.5984762",
"0.5975751",
"0.5971634"... | 0.70420367 | 3 |
Set mac address of the GW | def set_deafult_gw_mac(self, args):
gw_mac = ip_address(args.ip)
gw_info = UplinkGatewayInfo()
gw_info.update_mac(str(gw_mac))
print("set Default gw mac to %s" % gw_info.get_gw_mac()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mac(self, mac):\n\n self._mac = mac",
"def set_macaddr(self):\n if not self.macaddr:\n return\n try:\n cmd = [rcEnv.syspaths.nsenter, \"--net=\"+self.netns, \"ip\", \"link\", \"set\", self.final_guest_dev, \"address\", self.macaddr]\n ret, out, err = self... | [
"0.71729046",
"0.7159784",
"0.70309013",
"0.67942315",
"0.6734158",
"0.66908026",
"0.66329217",
"0.66329217",
"0.66055304",
"0.6560975",
"0.65444046",
"0.6398119",
"0.63839704",
"0.6369574",
"0.6321455",
"0.62182325",
"0.6161446",
"0.60670227",
"0.60637647",
"0.6042741",
"0.5... | 0.6788908 | 4 |
r""" Subset this storm by any of its parameters and return a new storm object. | def sel(self, time=None, lat=None, lon=None, vmax=None, mslp=None,
dvmax_dt=None, dmslp_dt=None, stormtype=None, method='exact'):
# create copy of storm object
new_dict = copy.deepcopy(self.dict)
new_dict['subset'] = True
NEW_STORM = Storm(new_dict)
idx_final = np.ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subset(self, times=None, varids=None):\n if times is None:\n dat = self.ix[:,varids]\n times = self.times\n elif varids is None:\n dat = self.ix[times,:]\n varids = self.varids\n else:\n dat = self.ix[times,varids]\n subtraj... | [
"0.51926243",
"0.5164726",
"0.49006388",
"0.4888185",
"0.4854767",
"0.48165447",
"0.47978213",
"0.4771015",
"0.47611147",
"0.47568908",
"0.4678229",
"0.46702403",
"0.46543923",
"0.46446857",
"0.46317798",
"0.46272188",
"0.46257833",
"0.46257833",
"0.46247217",
"0.46183324",
"... | 0.5258843 | 0 |
Return a string representation of this ``GrammaticalRelationship``. | def __repr__(self):
return str(self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n stringRepresentation = []\n for node in self.getNodes():\n stringRepresentation.append(\"->\".join(\n (str(node), str(self.graph[node]))))\n\n return str(stringRepresentation)",
"def as_string(self):\n return self.__repr__()",
"def str(... | [
"0.7214608",
"0.6988957",
"0.69162846",
"0.6897084",
"0.688025",
"0.6878735",
"0.68773913",
"0.6821063",
"0.6779741",
"0.6764794",
"0.67634404",
"0.6757524",
"0.6731559",
"0.6726188",
"0.6726188",
"0.6726188",
"0.6726188",
"0.67154616",
"0.67097163",
"0.6705135",
"0.670298",
... | 0.0 | -1 |
Converter(specfile=None) The Converter class. Please always use kwargs in the constructor. | def __init__(self, **kwargs):
super(Converter, self).__init__()
self._specfile = kwargs.get("specfile", None)
self._parsed = False
self._columns = []
self._offsets = []
self._fixed_with_encoding = Encodings.default_fixedwidth_enc()
self._included_header = False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, converter, requirement):\n self.converter = converter\n self.requirement = requirement",
"def convert(self, converter=None):\n if converter is not None:\n self.converter = converter\n self.code(self.prepare)",
"def converter(self):\n return self.... | [
"0.7133057",
"0.6230327",
"0.60882884",
"0.60403347",
"0.5980006",
"0.588067",
"0.57713234",
"0.567245",
"0.554401",
"0.5527527",
"0.5527276",
"0.54790145",
"0.5454005",
"0.54209125",
"0.5415735",
"0.53968847",
"0.53966653",
"0.5384133",
"0.5369916",
"0.5369248",
"0.5350384",... | 0.7016629 | 1 |
Calculate the context vector and attention distribution from the decoder state. | def attention(decoder_state, coverage=None, num_words_section=None, step=None):
with variable_scope.variable_scope("Attention"):
# Pass the decoder state through a linear layer (this is W_s s_t + b_attn in the paper)
# (W_s s_t) + b_att is decoder_features; s_t = decoder_state
decoder_feat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attention(self, decoder_state, coverage=None):\n with tf.variable_scope(\"attention_compute\"):\n attn_size = 2*self.hidden_dim\n batch_size = tf.shape(self.encoder_states)[0]\n # Reshape encoder_states (need to insert a dim)\n encoder_states = tf.expand_dims(... | [
"0.6434249",
"0.6233957",
"0.61137545",
"0.60123605",
"0.5962933",
"0.5948498",
"0.5918534",
"0.58688605",
"0.58655345",
"0.5805446",
"0.5757829",
"0.57023203",
"0.5693168",
"0.5652662",
"0.56198937",
"0.55608445",
"0.55564976",
"0.55499417",
"0.5531495",
"0.5504834",
"0.5496... | 0.59904397 | 4 |
Return a JSON list of stations from the dataset | def passengers():
# Create session
session = Session(engine)
# Query
stations = session.query(Station).count()
return jsonify(stations) | {
"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.8867414",
"0.87507737",
"0.87348944",
"0.8479086",
"0.8459233",
"0.84159815",
"0.8383141",
"0.83756554",
"0.8370773",
"0.8342128",
"0.83401954",
"0.83253753",
"0.83172154",
"0.83020216",
"0.8295474",
"0.82855445",
"0.82437897",
"0.82358885",
"0.8235545",
"0.8217311",
"0.82... | 0.6496607 | 52 |
True if user can access this object; False otherwise. | def can_be_accessed(self, user):
if self.shared_with_everyone:
return True
if self.user == user or self.users_allowed.filter(pk=user.pk).exists():
return True
for group in self.groups_allowed.all():
if user.groups.filter(pk=group.pk).exists():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_object_permission(self, request, view, user):\n return user == request.user or request.user.is_superuser",
"def has_object_permission(self, request, view, obj):\n if request.method in permissions.SAFE_METHODS:\n return True\n\n return is_owner_or_privileged_user(obj.user, ... | [
"0.7959666",
"0.7952186",
"0.79096836",
"0.78710836",
"0.78279006",
"0.777003",
"0.7769477",
"0.77049124",
"0.7677851",
"0.7675242",
"0.76722986",
"0.7662701",
"0.76429915",
"0.76398176",
"0.7635179",
"0.762465",
"0.76206577",
"0.76137763",
"0.761245",
"0.75964516",
"0.759453... | 0.770132 | 8 |
Check that this instance has the same access as the specified one. | def validate_identical_access(self, ac):
if self.user != ac.user:
raise ValidationError(
"Instances have different users: %s, %s" % (self.user, ac.user), code="different_user"
)
non_overlapping_users_allowed = set(self.users_allowed.all()).symmetric_difference(ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_access(self, target_member : M, accessor : M, permission : str):\n if not permission: \n return True\n if accessor is None:\n raise errors.NotAllowed(\"Accessor not found\")\n if target_member != accessor:\n raise errors.NotAllowed(\"Access not allow... | [
"0.64721394",
"0.64028245",
"0.6292976",
"0.6201501",
"0.61991817",
"0.61333936",
"0.61254597",
"0.60791415",
"0.6075571",
"0.6075571",
"0.60622823",
"0.60192996",
"0.6009531",
"0.60060424",
"0.5997356",
"0.5977503",
"0.5961192",
"0.59605944",
"0.59377265",
"0.59370846",
"0.5... | 0.6901076 | 0 |
Retrieve a QuerySet of all records of this class that are visible to the specified user. | def filter_by_user(cls, user, is_admin=False, queryset=None):
if queryset is None:
queryset = cls.objects.all()
if is_admin:
if not admin_check(user):
raise Exception('User is not an administrator.')
else:
user_plus = KiveUser.kiveify(user)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_objects(cls, user):\n return cls.objects.filter(UserAccess.Q(user))",
"def for_user(self, user):\n return self.get_query_set().filter(owner=user)",
"def viewable_only(self, user):\n # TODO: integrate this into questions() probably as standard and have\n # TODO: a separate a... | [
"0.7256512",
"0.70785433",
"0.7036385",
"0.7015327",
"0.69669425",
"0.6945848",
"0.69389695",
"0.6904424",
"0.6883395",
"0.67637265",
"0.67520493",
"0.67520493",
"0.67520493",
"0.6735269",
"0.6695591",
"0.66943914",
"0.66933215",
"0.6614238",
"0.6604871",
"0.65982264",
"0.656... | 0.64682233 | 28 |
Run task(input) for each input in the queue. Returns when it encounters an _AllTasksComplete object on the queue. If exceptions occur, save them off and reraise them as a BackgroundFailure once we've finished processing the items in the queue. | def TaskRunner(queue, task, onexit=None, task_args=None, task_kwargs=None):
if task_args is None:
task_args = []
elif not isinstance(task_args, list):
task_args = list(task_args)
if task_kwargs is None:
task_kwargs = {}
errors = []
while True:
# Wait for a new item to show u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit(self):\n for async_femag in self.async_femags:\n async_femag.start()\n\n for task in self.job.tasks:\n self.queue.put(task)\n\n return len(self.job.tasks)",
"def run(self):\n assert self.queue is not None, \"Must specify queue or override run()\"\n\n ... | [
"0.6819832",
"0.65894973",
"0.6578102",
"0.64337426",
"0.62576807",
"0.6184687",
"0.6181251",
"0.615293",
"0.60969037",
"0.5947114",
"0.59376866",
"0.5930255",
"0.5909812",
"0.5877334",
"0.58508605",
"0.5836818",
"0.5826121",
"0.5815489",
"0.5794974",
"0.5792711",
"0.5775146"... | 0.5452192 | 48 |
Test that completely invalid tags generate an error. | def testUnexpectedTagBelowOne(self):
# Message has tag 0, type NUMERIC.
invalid_tag_message = chr(protobuf._Encoder.NUMERIC)
self.assertErrorIs(messages.DecodeError,
'Invalid tag value 0',
protobuf.decode_message,
test_util.OptionalMessag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_parse_tags_invalid(self):\n tagstring = \"tag1, tag2, tag3!\"\n\n with self.assertRaisesRegexp(Exception, \"invalid tag 'tag3!': only numbers, letters, and commas are \"\n \"allowed in tags\"):\n api.parse_tags(tagstring)",
"def test_invalid_t... | [
"0.78688735",
"0.7615075",
"0.7474957",
"0.7404492",
"0.72889",
"0.72382516",
"0.72381175",
"0.7211844",
"0.7204049",
"0.7197362",
"0.71946955",
"0.7172774",
"0.7116077",
"0.706652",
"0.7043109",
"0.6953482",
"0.69004554",
"0.6894062",
"0.6892188",
"0.68717426",
"0.6838426",
... | 0.0 | -1 |
Serialize object properties as dict. | def to_json(self):
return {
'revision': self.revision,
'active': self.active,
'archived_at': self.archived_at
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_dict(obj):\r\n \r\n obj_dict = {}\r\n \r\n # Populate the dictionary with object properties\r\n obj_dict.update(obj.__dict__)\r\n \r\n return obj_dict",
"def to_dict(self):\n return self.properties",
"def to_dict(self):\n return self.properties",
"def json(self):\n ... | [
"0.7212848",
"0.7106636",
"0.7106636",
"0.70032656",
"0.6981998",
"0.6981998",
"0.6981998",
"0.6971889",
"0.6893788",
"0.67685044",
"0.67685044",
"0.6710124",
"0.6710124",
"0.6710124",
"0.6710124",
"0.6710124",
"0.6710124",
"0.6710124",
"0.65729594",
"0.65646374",
"0.6562366"... | 0.0 | -1 |
Serialize object properties as dict. | def to_json(self):
return {
'id': self.id,
'date_created': self.date_created,
'date_modified': self.date_modified,
'link': self.link,
'vulnerability_details_id': self.vulnerability_details_id
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_dict(obj):\r\n \r\n obj_dict = {}\r\n \r\n # Populate the dictionary with object properties\r\n obj_dict.update(obj.__dict__)\r\n \r\n return obj_dict",
"def to_dict(self):\n return self.properties",
"def to_dict(self):\n return self.properties",
"def json(self):\n ... | [
"0.7212872",
"0.71077454",
"0.71077454",
"0.70044136",
"0.6982981",
"0.6982981",
"0.6982981",
"0.6976068",
"0.68956447",
"0.6770523",
"0.6770523",
"0.67119175",
"0.67119175",
"0.67119175",
"0.67119175",
"0.67119175",
"0.67119175",
"0.67119175",
"0.6574118",
"0.6567268",
"0.65... | 0.0 | -1 |
Serialize object properties as dict. | def to_json(self):
return {
'commit_link': self.commit_link,
'repo_owner': self.repo_owner,
'repo_name': self.repo_name,
'repo_url': self.repo_url,
'commit_hash': self.commit_hash,
'relevant_files': self.get_relevant_files()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_dict(obj):\r\n \r\n obj_dict = {}\r\n \r\n # Populate the dictionary with object properties\r\n obj_dict.update(obj.__dict__)\r\n \r\n return obj_dict",
"def to_dict(self):\n return self.properties",
"def to_dict(self):\n return self.properties",
"def json(self):\n ... | [
"0.7212848",
"0.7106636",
"0.7106636",
"0.70032656",
"0.6981998",
"0.6981998",
"0.6981998",
"0.6971889",
"0.6893788",
"0.67685044",
"0.67685044",
"0.6710124",
"0.6710124",
"0.6710124",
"0.6710124",
"0.6710124",
"0.6710124",
"0.6710124",
"0.65729594",
"0.65646374",
"0.6562366"... | 0.0 | -1 |
Serialize object properties as dict. | def to_json_full(self):
data = self.to_json()
# TODO: Enable this once custom resource_links are supported again.
#data['resource_links'] = [
# r.to_json() for r in self.resource_links
# if self.resource_links is not None
#]
data['commits'] = [
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_dict(obj):\r\n \r\n obj_dict = {}\r\n \r\n # Populate the dictionary with object properties\r\n obj_dict.update(obj.__dict__)\r\n \r\n return obj_dict",
"def to_dict(self):\n return self.properties",
"def to_dict(self):\n return self.properties",
"def json(self):\n ... | [
"0.7212872",
"0.71077454",
"0.71077454",
"0.70044136",
"0.6982981",
"0.6982981",
"0.6982981",
"0.6976068",
"0.68956447",
"0.6770523",
"0.6770523",
"0.67119175",
"0.67119175",
"0.67119175",
"0.67119175",
"0.67119175",
"0.67119175",
"0.67119175",
"0.6574118",
"0.6567268",
"0.65... | 0.0 | -1 |
Serialize object properties as dict. | def to_json(self):
return {'vendor': self.vendor, 'product': self.product} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_dict(obj):\r\n \r\n obj_dict = {}\r\n \r\n # Populate the dictionary with object properties\r\n obj_dict.update(obj.__dict__)\r\n \r\n return obj_dict",
"def to_dict(self):\n return self.properties",
"def to_dict(self):\n return self.properties",
"def json(self):\n ... | [
"0.7212848",
"0.7106636",
"0.7106636",
"0.70032656",
"0.6981998",
"0.6981998",
"0.6981998",
"0.6971889",
"0.6893788",
"0.67685044",
"0.67685044",
"0.6710124",
"0.6710124",
"0.6710124",
"0.6710124",
"0.6710124",
"0.6710124",
"0.6710124",
"0.65729594",
"0.65646374",
"0.6562366"... | 0.0 | -1 |
Get the builtin validation error message for when the user's real name is invalid in some way (we wonder how). | def get_name_validation_error(name):
return '' if name else accounts.REQUIRED_FIELD_NAME_MSG | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_username_validation_error(username):\n return _validate(_validate_username, errors.AccountUsernameInvalid, username)",
"def get_error_name(self):\n if hasattr(self, \"ui_name\"):\n # If this instance is part of the UI (has attribute \"ui_name\"), use\n # that to form a \"p... | [
"0.6745288",
"0.66275007",
"0.65634394",
"0.6563082",
"0.65543866",
"0.6501537",
"0.645665",
"0.6401832",
"0.6296059",
"0.6296059",
"0.6263373",
"0.62539154",
"0.6233126",
"0.6163527",
"0.61590856",
"0.6152952",
"0.6089771",
"0.60815257",
"0.60779625",
"0.6065481",
"0.6049547... | 0.8224604 | 0 |
Get the builtin validation error message for when the email is invalid in some way. | def get_email_validation_error(email, api_version='v1'):
return _validate(_validate_email, errors.AccountEmailInvalid, email, api_version) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_message(self, error_field=None, **kwargs):\n\n if error_field:\n return \"Validation failed in Validator \\\"{}\\\" on field \\\"{}\\\"\".format(self.__class__.__name__, error_field)\n return \"Validation failed in Validator \\\"{}\\\"\".format(self.__class__.__name__)",
"def e... | [
"0.7202891",
"0.70885843",
"0.70771116",
"0.70256305",
"0.7020628",
"0.6998897",
"0.6998897",
"0.69935715",
"0.6958218",
"0.69105977",
"0.6897067",
"0.6897067",
"0.6897067",
"0.6897067",
"0.6897067",
"0.6897067",
"0.6897067",
"0.68439925",
"0.68439925",
"0.68439925",
"0.68187... | 0.7410913 | 0 |
Get the builtin validation error message for when the email is invalid in some way. | def get_secondary_email_validation_error(email):
return _validate(_validate_secondary_email_doesnt_exist, errors.AccountEmailAlreadyExists, email) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_email_validation_error(email, api_version='v1'):\n return _validate(_validate_email, errors.AccountEmailInvalid, email, api_version)",
"def error_message(self, error_field=None, **kwargs):\n\n if error_field:\n return \"Validation failed in Validator \\\"{}\\\" on field \\\"{}\\\"\".... | [
"0.74101675",
"0.7203478",
"0.708985",
"0.7078327",
"0.70276797",
"0.70005935",
"0.70005935",
"0.6992388",
"0.69596136",
"0.6911951",
"0.6898979",
"0.6898979",
"0.6898979",
"0.6898979",
"0.6898979",
"0.6898979",
"0.6898979",
"0.68454856",
"0.68454856",
"0.68454856",
"0.682052... | 0.70199513 | 5 |
Get the builtin validation error message for when the confirmation email is invalid in some way. | def get_confirm_email_validation_error(confirm_email, email):
return _validate(_validate_confirm_email, errors.AccountEmailInvalid, confirm_email, email) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_error_message(self):\n return self.error_message.get_error_message()",
"def error_message(self):\n # type: () -> string_types\n return self._error_message",
"def error_message(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"error_message\")",
"def get_error_message... | [
"0.7080343",
"0.6855695",
"0.6824975",
"0.68098694",
"0.67597026",
"0.67597026",
"0.6711665",
"0.6693669",
"0.6693669",
"0.6693669",
"0.6693669",
"0.6693669",
"0.6693669",
"0.6693669",
"0.6676684",
"0.6676684",
"0.6676684",
"0.6665815",
"0.66506976",
"0.66319674",
"0.6622552"... | 0.771496 | 0 |
Get the builtin validation error message for when the email has an existence conflict. | def get_email_existence_validation_error(email, api_version='v1'):
return _validate(_validate_email_doesnt_exist, errors.AccountEmailAlreadyExists, email, api_version) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_secondary_email_validation_error(email):\n return _validate(_validate_secondary_email_doesnt_exist, errors.AccountEmailAlreadyExists, email)",
"def get_name_validation_error(name):\n return '' if name else accounts.REQUIRED_FIELD_NAME_MSG",
"def error_message(self) -> Optional[pulumi.Input[str]]:... | [
"0.7197901",
"0.6924127",
"0.6875918",
"0.6875918",
"0.684771",
"0.6800336",
"0.6800336",
"0.6800336",
"0.6800336",
"0.6800336",
"0.6800336",
"0.6800336",
"0.6783709",
"0.6751165",
"0.67285943",
"0.6663464",
"0.65940493",
"0.65119123",
"0.65119123",
"0.65119123",
"0.6492984",... | 0.62586075 | 30 |
Validate the confirmation email field. | def _validate_confirm_email(confirm_email, email):
if not confirm_email or confirm_email != email:
raise errors.AccountEmailInvalid(accounts.REQUIRED_FIELD_CONFIRM_EMAIL_MSG) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_email(self):\n e = self.cleaned_data['email']\n try:\n user = User.objects.get(email=e)\n if not user.is_active:\n msg = 'This user account has not been confirmed yet'\n raise forms.ValidationError(msg)\n except User.DoesNotExist:\n... | [
"0.74468267",
"0.71829784",
"0.71473795",
"0.7134303",
"0.7126468",
"0.70673615",
"0.70560724",
"0.70451635",
"0.69587725",
"0.6955144",
"0.6952478",
"0.6951607",
"0.6941736",
"0.6939369",
"0.69358456",
"0.69358456",
"0.6930824",
"0.6920938",
"0.69191915",
"0.6910414",
"0.690... | 0.80466354 | 0 |
Validate the format of the user's password. Passwords cannot be the same as the username of the account, so we create a temp_user using the username and email to test the password against. This user is never saved. | def _validate_password(password, username=None, email=None):
try:
_validate_type(password, str, accounts.PASSWORD_BAD_TYPE_MSG)
temp_user = User(username=username, email=email) if username else None
validate_password(password, user=temp_user)
except errors.AccountDataBadType as invalid_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_user_password_too_short(self):\n res = self.client.post(CREATE_USER_URL, {\n **self.mock_user,\n 'password': 'pw'\n })\n\n db_user = get_user_model().objects.filter(\n email=self.mock_user['email']\n )\n\n self.assertEqual(res.stat... | [
"0.6959427",
"0.68843",
"0.68593246",
"0.68046296",
"0.6782172",
"0.677297",
"0.6764933",
"0.6745001",
"0.67395645",
"0.6738005",
"0.6719614",
"0.66970253",
"0.6672124",
"0.6665926",
"0.66619354",
"0.6658467",
"0.664195",
"0.6629181",
"0.66160953",
"0.6604389",
"0.6603167",
... | 0.73186624 | 0 |
Validate that the username is not associated with an existing user. | def _validate_username_doesnt_exist(username, api_version='v1'):
if api_version == 'v1':
error_message = accounts.USERNAME_CONFLICT_MSG.format(username=username)
else:
error_message = accounts.AUTHN_USERNAME_CONFLICT_MSG
if username is not None and username_exists_or_retired(username):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_username(self, username):\n if username.data != current_user.username:\n user = User.query.filter_by(username=username.data).first()\n if user:\n raise ValidationError('That username already exists. Please choose another username.')",
"def validate_usernam... | [
"0.79264224",
"0.788833",
"0.7857764",
"0.7713789",
"0.759303",
"0.75770164",
"0.74394166",
"0.7434979",
"0.74019057",
"0.7369904",
"0.73297596",
"0.7326043",
"0.73005134",
"0.7291905",
"0.72757536",
"0.7228625",
"0.71075684",
"0.71051383",
"0.7090531",
"0.7084921",
"0.707932... | 0.73520076 | 10 |
Validate that the email is not associated with an existing user. | def _validate_email_doesnt_exist(email, api_version='v1'):
if api_version == 'v1':
error_message = accounts.EMAIL_CONFLICT_MSG.format(email_address=email)
else:
error_message = accounts.AUTHN_EMAIL_CONFLICT_MSG
if email is not None and email_exists_or_retired(email):
raise errors.Ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_email(self, email):\n user = User.query.filter_by(email=email.data).first()\n if user is not None:\n raise ValidationError('Please use a different email address.')",
"def validate_email(self, email):\n user = User.query.filter_by(email=email.data).first()\n if ... | [
"0.7622503",
"0.7576384",
"0.75638884",
"0.7538433",
"0.75290483",
"0.7498994",
"0.7498994",
"0.74380535",
"0.7427728",
"0.7298709",
"0.728917",
"0.7278938",
"0.72762215",
"0.7275117",
"0.72700775",
"0.7259042",
"0.7256856",
"0.72393715",
"0.722484",
"0.72218716",
"0.7209648"... | 0.69935536 | 33 |
Validate that the email is not associated as a secondary email of an existing user. | def _validate_secondary_email_doesnt_exist(email):
if email is not None and AccountRecovery.objects.filter(secondary_email=email).exists():
# pylint: disable=no-member
raise errors.AccountEmailAlreadyExists(accounts.EMAIL_CONFLICT_MSG.format(email_address=email)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_email(self, email):\n if email.data != current_user.email:\n user = User.query.filter_by(email=email.data).first()\n if user:\n raise ValidationError('That email already exists. Please choose another email.')",
"def validate_unique_email(email):\n if As... | [
"0.75216126",
"0.7493076",
"0.7376358",
"0.73585933",
"0.7305623",
"0.7224461",
"0.720515",
"0.71921426",
"0.7190707",
"0.71699005",
"0.7147553",
"0.71441454",
"0.70908356",
"0.70818067",
"0.70818067",
"0.7056136",
"0.7031503",
"0.70081663",
"0.70032525",
"0.6857315",
"0.6849... | 0.771862 | 0 |
Checks if queen can be placed in coord of board. Returns True if can, else False | def isSafe(coords, row, col):
rows = []
cols = []
diag_r = []
diag_l = []
for square in coords:
rows.append(square[0])
cols.append(square[1])
diag_r.append(square[0] + square[1])
diag_l.append(square[1] - square[0])
if row... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_move(self, somerow, somecol):\n bool_1 = self.board[somerow][somecol] != 1\n bool_2 = self.num_queens_placed < self.size \n bool_3 = self.attack(somerow, somecol)\n return bool_1 and bool_2 and bool_3",
"def is_queen_move_valid(self, from_row, from_col, to_row, to_... | [
"0.75600076",
"0.7476879",
"0.7469598",
"0.7058161",
"0.6982227",
"0.6973553",
"0.6898411",
"0.6878389",
"0.68669605",
"0.68514156",
"0.6845991",
"0.6833959",
"0.6813208",
"0.6784895",
"0.67800766",
"0.67558897",
"0.6745045",
"0.67351043",
"0.67252624",
"0.6723145",
"0.672232... | 0.0 | -1 |
True if the `hashlock` is known and the correspoding secret is not. | def is_locked(self, hashlock):
return hashlock in self.hashlocks_to_pendinglocks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_known(self, hashlock):\n return (\n hashlock in self.hashlocks_to_pendinglocks or\n hashlock in self.hashlocks_to_unclaimedlocks\n )",
"def know_secret(self):\r\n return(self.secret != \"\") and (self.key != \"\")",
"def __contains__(self, hashlock):\n r... | [
"0.7481523",
"0.74292755",
"0.68880725",
"0.68790513",
"0.6695643",
"0.65044403",
"0.6492829",
"0.6405243",
"0.63108724",
"0.6293218",
"0.6278153",
"0.6277934",
"0.6273595",
"0.62690306",
"0.62690306",
"0.62474954",
"0.62374246",
"0.622471",
"0.6149292",
"0.61217475",
"0.6111... | 0.68200606 | 4 |
Returns a transform_fn that converts features to dense Tensors. | def make_transform_fn(self, ):
return self._transform_fn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparse_to_dense(self, tensor: tf.Tensor, output_shape: tf.TensorShape) -> tf.Tensor:\n return tf.scatter_nd(self.observations_index, tensor, output_shape)",
"def add_dense_layer(self, input_tensor, output_size, activation_fn=None,\n name = None):\n return tf.layers.dense(... | [
"0.60267717",
"0.60228837",
"0.583659",
"0.58034605",
"0.56381494",
"0.56356347",
"0.5622732",
"0.558097",
"0.5571176",
"0.55235296",
"0.5497506",
"0.5487674",
"0.5484177",
"0.54734063",
"0.5394181",
"0.5347578",
"0.5347049",
"0.5337681",
"0.5332883",
"0.5322231",
"0.5316981"... | 0.0 | -1 |
Update the learning rate at the end of the given epoch. | def step(self, epoch, val_loss=None):
super().step(epoch, val_loss)
# we don't change the learning rate at epoch boundaries
return self.optimizer.get_lr() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_learning_rate(self):\r\n self.scheduler.step(self.clock.epoch)",
"def update_learning_rate(self, ppl, epoch):\n if self.start_decay_at is not None and epoch >= self.start_decay_at:\n self.start_decay = True\n if self.last_ppl is not None and ppl > self.last_ppl:\n ... | [
"0.829928",
"0.7959232",
"0.77151215",
"0.7655542",
"0.7543744",
"0.7535445",
"0.7508489",
"0.7440509",
"0.7433783",
"0.7422781",
"0.73838586",
"0.734689",
"0.7339895",
"0.72872365",
"0.72806436",
"0.72749454",
"0.72695",
"0.72695",
"0.7240118",
"0.72216266",
"0.7218098",
"... | 0.6946832 | 77 |
Update the learning rate after each update. | def step_update(self, num_updates):
cycle = math.floor(num_updates / (2 * self.stepsize))
lr_shrink = self.lr_shrink ** cycle
max_lr = self.max_lr * lr_shrink
if self.shrink_min:
min_lr = self.min_lr * lr_shrink
else:
min_lr = self.min_lr
x = abs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_learning_rate(self):\r\n self.scheduler.step(self.clock.epoch)",
"def update_learning_rate(self):\n self.scheduler.step()\n lr = self.optimizer.param_groups[0]['lr']\n print('learning rate = %.7f' % lr)",
"def _update_learning_rate(self):\r\n\r\n self.n_steps += 1\... | [
"0.8525054",
"0.8246478",
"0.81739384",
"0.80492413",
"0.7949033",
"0.7949033",
"0.78992677",
"0.7889223",
"0.78623694",
"0.7703854",
"0.7637969",
"0.76320887",
"0.7508339",
"0.7478694",
"0.73086154",
"0.72947234",
"0.7267212",
"0.7239035",
"0.7234639",
"0.72077906",
"0.71868... | 0.6647708 | 47 |
Return the position of parent for the node currently at pos | def parent(self, pos):
return pos // 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent(self, pos): \n return pos//2",
"def parent(self, pos):\n if pos == 0: \n return None\n return int(math.ceil(pos / self.dary) - 1)",
"def parent(self, p):\n node = self._validate(p)\n return self._make_position(node._parent)",
"def parent(self, p):\n nod... | [
"0.8049816",
"0.7924812",
"0.7788302",
"0.7748893",
"0.7723466",
"0.76427776",
"0.75885135",
"0.75885135",
"0.75885135",
"0.7426",
"0.73305357",
"0.7240945",
"0.71970475",
"0.71769404",
"0.7124077",
"0.7090402",
"0.70792645",
"0.70089245",
"0.69986284",
"0.6955013",
"0.6926",... | 0.82917905 | 0 |
Return the position of the left child for the node at pos | def leftChild(self, pos):
return 2 * pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left_child(self, pos): \n return 2 * pos",
"def left_child(self, position):\n child = 2 * position + 1\n if child > len(self.table) - 1:\n return None\n return child",
"def get_leftchild(self):\n return self._leftchild",
"def left_child(self, index):\n ... | [
"0.83649325",
"0.77543384",
"0.7542705",
"0.7532445",
"0.7519663",
"0.7494396",
"0.74940205",
"0.7462934",
"0.7410025",
"0.7403213",
"0.7351628",
"0.7351628",
"0.73404413",
"0.73026854",
"0.72264564",
"0.719699",
"0.7176353",
"0.7129563",
"0.7113563",
"0.71097285",
"0.7037362... | 0.85475385 | 0 |
Return the position of the right child for the node at pos | def rightChild(self, pos):
return (2 * pos) + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right_child(self, pos): \n return (2 * pos) + 1",
"def right_child(self, position):\n child = 2 * position + 2\n if child > len(self.table) - 1:\n return None\n return child",
"def left_child(self, pos): \n return 2 * pos",
"def leftChild(self, pos):\n ... | [
"0.8484954",
"0.7701789",
"0.74027514",
"0.737924",
"0.737924",
"0.73578656",
"0.7300604",
"0.7287597",
"0.7003468",
"0.697581",
"0.69145036",
"0.6903219",
"0.6882952",
"0.687527",
"0.6845948",
"0.6826754",
"0.67674875",
"0.67378074",
"0.6710584",
"0.6709652",
"0.6697389",
... | 0.8660321 | 0 |
Heapify the nodes of the heap | def minHeapify(self, pos):
# if the node is a non-leaf node and greater than any of its child
if not self.isLeaf(pos):
if self.heap[pos] > self.heap[self.leftChild(pos)] or self.heap[pos] > self.heap[self.rightChild(pos)]:
if self.heap[self.leftChild(pos)] < ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _heapify(self):\n for _ in range(len(self.elements)):\n for i in range(len(self.elements)-1, 0, -1):\n parentPosition = (i-1)/2 # defaults to int i.e. 7/2=3, and 6/2=3\n if parentPosition < 0:\n parentPosition = 0\n \n ... | [
"0.7913199",
"0.75706446",
"0.7525651",
"0.7484029",
"0.7321969",
"0.722133",
"0.71462405",
"0.69940126",
"0.6975017",
"0.68887526",
"0.6831776",
"0.67708695",
"0.67708695",
"0.6751752",
"0.6710631",
"0.6699381",
"0.6693417",
"0.6671732",
"0.66262996",
"0.66081",
"0.659091",
... | 0.6295602 | 48 |
Build the min heap using the minHeapify API | def minHeap(self):
for pos in range(self.size // 2, 0, -1):
self.minHeapify(pos) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_heap(self): \n \n for pos in range(self.size//2, 0, -1): \n self.min_heapify(pos)",
"def build_heap(self):\n n = int((len(self.array) / 2) - 1)\n\n while n >= 0:\n self.heapify_top_down(n)\n n -= 1",
"def __build(self) -> None:\n parent_idx ... | [
"0.69671273",
"0.6824578",
"0.6581896",
"0.6572531",
"0.6492673",
"0.6490563",
"0.648365",
"0.6456313",
"0.6446993",
"0.6384518",
"0.6370518",
"0.6331525",
"0.63174963",
"0.6293025",
"0.62891895",
"0.6278671",
"0.6271318",
"0.6253797",
"0.6251365",
"0.62431824",
"0.6240821",
... | 0.6852612 | 1 |
Return the position of parent for the node at pos | def parent(self, pos):
return pos // 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent(self, pos): \n return pos//2",
"def parent(self, pos):\n if pos == 0: \n return None\n return int(math.ceil(pos / self.dary) - 1)",
"def parent(self, p):\n node = self._validate(p)\n return self._make_position(node._parent)",
"def parent(self, p):\n nod... | [
"0.7847527",
"0.780028",
"0.7652363",
"0.75889504",
"0.75780976",
"0.74631405",
"0.74168783",
"0.74168783",
"0.74168783",
"0.730651",
"0.713375",
"0.6982931",
"0.6903372",
"0.6878589",
"0.6857189",
"0.6848456",
"0.6848456",
"0.68437505",
"0.6842571",
"0.6777982",
"0.6679119",... | 0.8129807 | 1 |
Return the position of the left child for the node at pos | def leftChild(self, pos):
return 2 * pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left_child(self, pos): \n return 2 * pos",
"def left_child(self, position):\n child = 2 * position + 1\n if child > len(self.table) - 1:\n return None\n return child",
"def get_leftchild(self):\n return self._leftchild",
"def left_child(self, index):\n ... | [
"0.83649325",
"0.77543384",
"0.7542705",
"0.7532445",
"0.7519663",
"0.7494396",
"0.74940205",
"0.7462934",
"0.7410025",
"0.7403213",
"0.7351628",
"0.7351628",
"0.73404413",
"0.73026854",
"0.72264564",
"0.719699",
"0.7176353",
"0.7129563",
"0.7113563",
"0.71097285",
"0.7037362... | 0.85475385 | 1 |
Return the position of the right child for the node at pos | def rightChild(self, pos):
return (2 * pos) + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right_child(self, pos): \n return (2 * pos) + 1",
"def right_child(self, position):\n child = 2 * position + 2\n if child > len(self.table) - 1:\n return None\n return child",
"def left_child(self, pos): \n return 2 * pos",
"def leftChild(self, pos):\n ... | [
"0.84850544",
"0.7701583",
"0.7401799",
"0.7378563",
"0.7378563",
"0.73593533",
"0.73007065",
"0.7287842",
"0.70040214",
"0.6976616",
"0.6915747",
"0.6904748",
"0.68832076",
"0.6876537",
"0.68465513",
"0.6826893",
"0.67691547",
"0.6739458",
"0.67110103",
"0.6710301",
"0.66989... | 0.86608 | 1 |
Heapify the node at pos | def maxHeapify(self, pos):
if not self.isLeaf(pos):
if self.heap[pos] < self.heap[self.leftChild(pos)] or self.heap[pos] < self.heap[self.rightChild(pos)]:
if self.heap[self.leftChild(pos)] > self.heap[self.rightChild(pos)]:
self.swap(pos, self.lef... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_heapify(self, pos): \n \n # If the node is a non-leaf node and greater \n # than any of its child \n if not self.is_leaf(pos): \n if (self.Heap[pos] > self.Heap[self.left_child(pos)] or \n self.Heap[pos] > self.Heap[self.right_child(pos)]): \n \n ... | [
"0.76383394",
"0.7330325",
"0.70202285",
"0.6923834",
"0.69188905",
"0.68685764",
"0.6774794",
"0.6666314",
"0.66532457",
"0.65860367",
"0.651174",
"0.6423579",
"0.64198744",
"0.6386632",
"0.6374525",
"0.63470495",
"0.6328869",
"0.6273219",
"0.62544084",
"0.61942303",
"0.6193... | 0.7186695 | 2 |
Finds the common divisors of num1 and num2 Assumes that num1 and num2 are positive integers Returns a tuple containing the common divisors of num1 and num2 | def findDivisors(num1, num2):
divisors = (1,)
for i in range(2, (min(num1, num2) + 1)):
if num1 % i == 0 and num2 % i == 0:
divisors += (i,)
return divisors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findDivisors(n1, n2):\n divisors = () # the empty tuple\n for i in range(1, min(n1, n2) + 1):\n if n1%i == 0 and n2%i == 0:\n divisors = divisors + (i,)\n return divisors",
"def common_divisor(self, numerator_a, denominator_b) -> [None, int]:\n divisors = []\n for div... | [
"0.782692",
"0.75875294",
"0.74997914",
"0.7308669",
"0.7297279",
"0.7229542",
"0.7125726",
"0.6939252",
"0.69323885",
"0.68859977",
"0.68319964",
"0.6783142",
"0.6771212",
"0.67570996",
"0.67326087",
"0.6690231",
"0.66641575",
"0.6654265",
"0.6618124",
"0.65867084",
"0.65749... | 0.83219117 | 0 |
Extract the version string from the file at the given relative path fragments. | def get_version(*file_paths):
filename = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = open(filename).read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version(rel_path: str) -> str:\n for line in read(rel_path).splitlines():\n if line.startswith(\"VERSION\"):\n delim = '\"' if '\"' in line else \"'\"\n return line.split(delim)[1]\n raise RuntimeError(\"Unable to find version string.\")",
"def get_version(rel_path):\n ... | [
"0.7298898",
"0.7062011",
"0.69600326",
"0.67041105",
"0.65719867",
"0.653963",
"0.6510022",
"0.6506127",
"0.64883304",
"0.646948",
"0.6449268",
"0.6435933",
"0.64012104",
"0.63219714",
"0.6284646",
"0.6275555",
"0.6259175",
"0.62124336",
"0.6194351",
"0.6193877",
"0.6187067"... | 0.66895586 | 5 |
Runs through categorical features and transform them into embeding based on the `emb_szs` passed in the layer constructor. It then concatenates the remaining continuous features if any with the embeddings. | def forward(self, x_cat, x_cont=None):
if self.n_emb != 0:
x = [e(x_cat[:,i]) for i,e in enumerate(self.embeds)]
x = torch.cat(x, 1)
if self.n_cont != 0:
x = torch.cat([x, x_cont], 1) if self.n_emb != 0 else x_cont
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embed_features(batch, f_size):\n for f in range(Config.num_feature):\n feature_val = batch[:, f]\n num_cat_value = Config.schema[f]\n\n if f == 0:\n if num_cat_value == 1:\n vector = tf.reshape(feature_val, [-1, 1])\n else... | [
"0.6440913",
"0.6353511",
"0.62025",
"0.6025154",
"0.60213983",
"0.5978514",
"0.5974704",
"0.59275705",
"0.5859687",
"0.5819828",
"0.5779351",
"0.57464707",
"0.57448894",
"0.57263297",
"0.57234025",
"0.5722951",
"0.56878304",
"0.568084",
"0.5665628",
"0.5628793",
"0.5609683",... | 0.5753647 | 11 |
Tests to see if we can get 200 OK from the mainpage | def test_get_indexhtml(self):
url = self.baseurl + "/main"
req = urllib2.urlopen(url, None, 3)
self.assertTrue( req.getcode() == 200 , "200 OK Not FOUND!") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_status_is_ok(self):\n why_page = self.client.get(\"/why/\")\n self.assertEqual(why_page.status_code, 200)",
"def test_status_is_ok(self):\n home_page = self.client.get(\"/\")\n self.assertEqual(home_page.status_code, 200)",
"def test_status_home(self):\n self.assertE... | [
"0.81059605",
"0.8093917",
"0.7981172",
"0.78545433",
"0.77842534",
"0.7735612",
"0.76078093",
"0.76078093",
"0.76078093",
"0.76078093",
"0.76078093",
"0.76078093",
"0.76078093",
"0.76078093",
"0.76078093",
"0.76078093",
"0.76078093",
"0.76078093",
"0.76078093",
"0.76078093",
... | 0.7327486 | 45 |
This tests for a 404 error for a page that dosent exist | def test_get_404(self):
url = self.baseurl + "/do-not-implement-this-page-it-is-not-found"
try:
req = urllib2.urlopen(url, None, 3)
self.assertTrue( False, "Should have thrown an HTTP Error!")
except urllib2.HTTPError as e:
self.assertTrue( e.getcode() == 404... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_404_not_found(self):\n response = self.client.get('/testPage404')\n self.assertEqual(response.status_code, 404)",
"def test_error_handler_PageNotFound404(self):\n response = self.testapp.get('/notexistentpage/', expect_errors=True)\n self.assertEqual(404, response.status_int)... | [
"0.8607289",
"0.85733163",
"0.8306053",
"0.82206005",
"0.81887835",
"0.81649923",
"0.81640923",
"0.8119994",
"0.80908245",
"0.80429465",
"0.80290645",
"0.79893774",
"0.79575026",
"0.79219836",
"0.7892429",
"0.7892429",
"0.7892429",
"0.7892429",
"0.7892429",
"0.7892429",
"0.78... | 0.841503 | 2 |
Return a string expression equivalent of the operator on a dict (k=v arguments) | def argify(kwarg_dict=None, **kwargs):
kwarg_dict = kwarg_dict or {}
kwarg_dict.update(kwargs)
return ', '.join(f'{k}={v}' for k, v in kwarg_dict.items()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluator(operator: str, value1: str, value2: str) -> str:\n\n evaluation_function: str = value1 + operator + value2\n #Because all three are strings, the + operator simply appends them together to be simplified. \n\n result: str = str(simplify(evaluation_function))\n return result",
"def all_mat... | [
"0.6099945",
"0.60630375",
"0.60050005",
"0.59406036",
"0.59213394",
"0.58801216",
"0.58591205",
"0.57290256",
"0.569687",
"0.56651497",
"0.5652674",
"0.5607448",
"0.5551745",
"0.551428",
"0.55024385",
"0.5476369",
"0.543353",
"0.5427718",
"0.5426144",
"0.5398727",
"0.5374343... | 0.0 | -1 |
Text vectorizer, create tokens | def create_vectorizer(ds):
vectorize_layer = TextVectorization(
standardize=clean_text,
split="whitespace",
max_tokens=MAX_WORDS - 1,
output_mode="int",
output_sequence_length=MAX_LEN,
)
vectorize_layer.adapt(ds.map(lambda text, label: text))
return vectorize_laye... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vectorize_text(text):\n\n def remove_punctuation(text):\n \"\"\"Removes special characters from text.\"\"\"\n return re.sub('[,.?\";:\\-!@#$%^&*()]', '', text)\n\n def remove_common_words(text_vector):\n \"\"\"Removes 50 most common words in the uk english.\n\n source: http://... | [
"0.7171441",
"0.7099546",
"0.6921746",
"0.68335986",
"0.68323505",
"0.6825057",
"0.6809375",
"0.67709047",
"0.67664814",
"0.67639273",
"0.67632264",
"0.6733125",
"0.67215675",
"0.670457",
"0.6693301",
"0.66904026",
"0.6685953",
"0.6656549",
"0.66560495",
"0.6651877",
"0.66500... | 0.6772762 | 7 |
Registers all BlobStore implementations in blob_store.REGISTRY. | def RegisterBlobStores():
blob_store.REGISTRY[db_blob_store.DbBlobStore.__name__] = (
db_blob_store.DbBlobStore) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_multi_stores(conf=CONF):\n store_count = 0\n scheme_map = {}\n for (store_entry, store_instance,\n store_identifier) in _load_multi_stores(conf):\n try:\n schemes = store_instance.get_schemes()\n store_instance.configure(re_raise_bsc=False)\n except N... | [
"0.5639379",
"0.5461694",
"0.53282493",
"0.53150374",
"0.52821636",
"0.52692735",
"0.5258954",
"0.5236919",
"0.5226494",
"0.52073973",
"0.5133915",
"0.51137054",
"0.51076144",
"0.50989604",
"0.50717545",
"0.5064849",
"0.50588286",
"0.5055358",
"0.5029635",
"0.50282997",
"0.50... | 0.8349487 | 0 |
Set up SDK testing environment (does not init datastore stubs, they are initialized in derived classes). | def __init__(self, *args, **kwargs):
# view non-shortened diffs
self.maxDiff = None
os.environ['APPLICATION_ID'] = APP_ID
apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
# memcache stub
cache_stub = memcache_stub.MemcacheServiceStub()
apiproxy_st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n # Initialize runtime and MDK:\n self.runtime = fakeRuntime()\n self.runtime.getEnvVarsService().set(\"DATAWIRE_TOKEN\", \"something\")\n self.mdk = MDKImpl(self.runtime)\n self.mdk.start()\n self.session = self.mdk.session()",
"def setUp(self):\n ... | [
"0.7519421",
"0.74487585",
"0.742547",
"0.74189186",
"0.73610145",
"0.7332514",
"0.7283132",
"0.72267556",
"0.722675",
"0.7220677",
"0.71995413",
"0.71789145",
"0.7175522",
"0.71481407",
"0.714493",
"0.71327853",
"0.7110181",
"0.7109041",
"0.70885736",
"0.7081445",
"0.7079823... | 0.0 | -1 |
Checks if a list of coordinates encloses a space Assumes that the there are lines connecting the points | def check_contained(ls, a=1):
indices_of_shapes = set()
min_index = a
for i in range(3,len(ls)):
b2, b1, a2, a1 = ls[i][1], ls[i-1][1], ls[i][0], ls[i-1][0]
for j in range(min_index, i):
y2, y1, x2, x1 = ls[j][1], ls[j-1][1], ls[j][0], ls[j-1][0]
if lines_intersect(a1, b1, a2, b2, x1, y1, x2, y2) an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isSafe(coords, row, col):\n rows = []\n cols = []\n diag_r = []\n diag_l = []\n\n for square in coords:\n rows.append(square[0])\n cols.append(square[1])\n diag_r.append(square[0] + square[1])\n diag_l.append(square[1] - square[0])\... | [
"0.6867008",
"0.66428745",
"0.6635541",
"0.66346705",
"0.65911156",
"0.6590678",
"0.65286434",
"0.64843804",
"0.6444948",
"0.6386605",
"0.63792586",
"0.6351182",
"0.6337786",
"0.6331208",
"0.63113666",
"0.63027155",
"0.6301313",
"0.629786",
"0.629184",
"0.6272483",
"0.6263107... | 0.0 | -1 |
Checks if two line segments intersect | def lines_intersect(x1, y1, x2, y2, a1, b1, a2, b2):
# Ensures that x1 < x2
(x1, x2, y1, y2) = (x1, x2, y1, y2) if x1 < x2 else (x2, x1, y2, y1)
(a1, a2, b1, b2) = (a1, a2, b1, b2) if a1 < a2 else (a2, a1, b2, b1)
# Make lines same domain
if x1 > a1:
if x1 > a2 or a1 == a2:
return False
a = x1
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _lines_intersect(self, line1, line2):\n return self._lines_overlap_on_x_axis(line1, line2) and self._lines_overlap_on_y_axis(line1, line2)",
"def intersect_segment(self, p1, p2):\n p1 = base.getvector(p1)\n if len(p1) == 2:\n p1 = np.r_[p1, 1]\n p2 = base.getvector(p2)\... | [
"0.8074795",
"0.8035403",
"0.7889417",
"0.78724647",
"0.77725",
"0.77366865",
"0.77267706",
"0.76940405",
"0.7592977",
"0.7549426",
"0.75296545",
"0.7434191",
"0.7433662",
"0.7384167",
"0.73487717",
"0.734032",
"0.73243034",
"0.72873294",
"0.72332656",
"0.7213088",
"0.7196308... | 0.7604079 | 8 |
Updates book_stats table with recently quoted books. Alternatively, this function is also used to remove book counts that were added by a comment that has been edited/deleted. | def update_book_stats(new_books, is_edit_or_delete=False):
for book in new_books.items():
with _conn.cursor() as cur:
if is_edit_or_delete:
cur.execute("UPDATE book_stats SET count = count - %d WHERE book = '%s'" % (book[1], book[0]))
else:
cur.execut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_book_stats(new_books, is_edit_or_delete = False):\n\t\n\tfor book in new_books.items():\n\t\twith _conn.cursor() as cur:\n\t\t\tif is_edit_or_delete:\n\t\t\t\tcur.execute('UPDATE book_stats SET count = count - %s WHERE book = %s', [book[1], book[0]])\n\t\t\telse:\n\t\t\t\tcur.execute('UPDATE book_stats ... | [
"0.6546895",
"0.6453667",
"0.5324176",
"0.5258598",
"0.49910733",
"0.49900368",
"0.4938874",
"0.49354044",
"0.4896993",
"0.48550552",
"0.48390737",
"0.4838978",
"0.48186976",
"0.47816008",
"0.47746855",
"0.4727369",
"0.47143131",
"0.47093877",
"0.46954587",
"0.46913052",
"0.4... | 0.6523884 | 1 |
Sets the range (min, max, step) for a given axis (dimension) | def set_range(self, axis: int, range: Sequence[Union[int, float]]):
if axis < 0:
axis += self.ndim
if axis < 0:
raise ValueError(
f'axis is negative, expected positive, got {axis}'
)
if self.range[axis] != range:
self._range[axis] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_range(\n self,\n axis: Union[int, Sequence[int]],\n _range: Union[\n Sequence[Union[int, float]], Sequence[Sequence[Union[int, float]]]\n ],\n ):\n if isinstance(axis, Integral):\n axis = assert_axis_in_bounds(axis, self.ndim) # type: ignore\n ... | [
"0.74639446",
"0.6926373",
"0.6769952",
"0.67676216",
"0.6681346",
"0.666439",
"0.66623724",
"0.65573645",
"0.6480818",
"0.6307268",
"0.6303263",
"0.6168003",
"0.611051",
"0.60913205",
"0.6055209",
"0.60120696",
"0.596351",
"0.59462875",
"0.5917372",
"0.59132725",
"0.5903167"... | 0.7837815 | 0 |
Creates button images which will be drawn, so that button is displayed. | def __initBtnImages__(self) -> None:
self._images = [
pygame.Surface((self.rect.width, self.rect.height)),
pygame.Surface((self.rect.width, self.rect.height)),
]
self._images[ButtonImages.DEFAULT_IMAGE.value].fill(self.notClickedBtnColor)
self._images[ButtonImages... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_buttons(self):\r\n # The buttons are created in the center of the screen then offset in the x/y directions by a number of button\r\n # widths. E.g. The \"-1, 0\" for the easy button means to shift the button one button width left of center.\r\n self.easy_button = Button(self.ai_game... | [
"0.7276746",
"0.72022796",
"0.7180665",
"0.7122168",
"0.7083346",
"0.7032445",
"0.697748",
"0.6973028",
"0.6954986",
"0.6950718",
"0.6934626",
"0.69233984",
"0.6882736",
"0.6857016",
"0.68257254",
"0.6672876",
"0.6626077",
"0.66205865",
"0.66105074",
"0.66083956",
"0.6555704"... | 0.7017815 | 6 |
Get the comparator for the canonicalized vectors. The normal ordering operation will be performed according to this comparator. It will be called with two canonicalized vectors for a boolean value. True should be returned if the first given vector is less than the second vector. The two vectors will be attempted to be ... | def comparator(self) -> typing.Callable[[Vec, Vec, Term], bool]:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare (v1, v2):\n v1_norm = normalize(v1)\n v2_norm = normalize(v2)\n if v1_norm < v2_norm:\n return -1\n if v1_norm > v2_norm:\n return 1\n return 0",
"def __gt__(self,other):\r\n\t\tsorted_self = sorted(self.vector, reverse=True) #sort both lists in descending order\r\n\t\tso... | [
"0.6056182",
"0.5581698",
"0.5528394",
"0.54842395",
"0.546406",
"0.5439525",
"0.53201336",
"0.5227858",
"0.52059835",
"0.51993674",
"0.51711875",
"0.51606274",
"0.5146533",
"0.5144471",
"0.51360923",
"0.5101601",
"0.5080244",
"0.5079309",
"0.50661",
"0.5050741",
"0.5039348",... | 0.6531568 | 0 |
A "subpath" may end but not start with a slash; it resembles a relative filesystem path >>> url_subpath('one/../two/./three/') 'two/three' Characters which you won't reasonably use for filesystem names | def url_subpath(s):
forbidden = forbidden_chars.intersection(s)
if forbidden:
forbidden = ''.join(sorted(forbidden))
raise ValueError('%(s)r contains forbidden characters'
' (%(forbidden)r)'
% locals())
stripped = normpath(s).lstrip(sep)
if stripped == cur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rpath(path):\n if path.startswith('/'):\n path = path[1:]\n return path",
"def sub_path(self) -> str:\n return self._sub_path",
"def basename(path):\n\n return path.rpartition(\"/\")[2]",
"def basename(path):\r\n return path.replace(\"\\\\\", \"/\").split(\"/\")[-1]",
"def pat... | [
"0.66456586",
"0.6506",
"0.6364249",
"0.6353511",
"0.63010335",
"0.62903214",
"0.62415975",
"0.6104406",
"0.6095026",
"0.60816115",
"0.6044421",
"0.6034333",
"0.60331887",
"0.60020095",
"0.5974379",
"0.597392",
"0.5956679",
"0.5952404",
"0.59503317",
"0.59230536",
"0.5905778"... | 0.8132422 | 0 |
Return the default processing scripts folder. | def scripts_folder(self):
# Copy the script
if qgis_version() < 21600:
return ScriptUtils.scriptsFolder()
else:
return ScriptUtils.defaultScriptsFolder() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_script_directory():\n return os.path.dirname(__file__)",
"def getScriptDirectory():\n\n\treturn os.path.dirname(os.path.realpath(__file__))",
"def default_module_dir(self):\n return os.path.dirname(self._modules['default'].path)",
"def scripts_dir(self):\n\n return os.path.join(self.path... | [
"0.75275505",
"0.7366935",
"0.6958117",
"0.68545467",
"0.67660016",
"0.66449887",
"0.66126776",
"0.6573791",
"0.6573791",
"0.65540874",
"0.6549097",
"0.65199965",
"0.64808655",
"0.64676374",
"0.6456232",
"0.64434403",
"0.644102",
"0.6433796",
"0.6427779",
"0.642611",
"0.64222... | 0.7488148 | 1 |
Use this function to return True if the stock looks like a BUY, or False if it doesn't look like a BUY. | def is_buy(ticker: yfinance.Ticker):
# implement your own, better rules (and check that the examples are what the comments say they are!)
buy_rules = [buy_rule_1, buy_rule_2]
for buy_rule in buy_rules:
try:
if buy_rule(ticker):
print(f"Buy rule function {buy_rule} indica... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_buy(self):\n return(copysign(1, self.volume)>0)",
"def is_out_of_stock(self) -> bool:\n return self.on_hand == 0",
"def hay_stock(self):\n return self.producto.stock_disponible >= 0",
"def is_buy(order):\n return(copysign(1, order.amount)>=0)",
"def _is_in_stock(cls, resp_bod... | [
"0.7496954",
"0.7030976",
"0.69996554",
"0.6902119",
"0.68756086",
"0.6839673",
"0.6797274",
"0.66290104",
"0.6612863",
"0.6494335",
"0.639596",
"0.63364214",
"0.6320956",
"0.6241624",
"0.6163118",
"0.6121584",
"0.6096025",
"0.6081908",
"0.6066778",
"0.60638624",
"0.6054594",... | 0.69308317 | 3 |
Return a formatted time string | def format_time(timestamp=None, format=r"%Y%m%d-%H%M%S"):
time_str = time.strftime(format, time.localtime(timestamp if timestamp else time.time()))
return time_str | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_str():\n return time.strftime(time_fmt)",
"def get_time() -> str:\r\n return time.strftime(TIMEFORMAT)",
"def get_time() -> str:\n return strftime(\"%H:%M:%S\")",
"def timestr():\n return dt.strftime(dt.now(),'%H:%M:%S')",
"def _time_str(self):\n try:\n if not sel... | [
"0.8582728",
"0.8326897",
"0.8286512",
"0.8136121",
"0.8118602",
"0.8112331",
"0.7962648",
"0.791475",
"0.7895362",
"0.7871704",
"0.78638715",
"0.7854737",
"0.77074414",
"0.76589286",
"0.7644815",
"0.7637068",
"0.7629804",
"0.7628805",
"0.7626787",
"0.7607554",
"0.7582667",
... | 0.7625369 | 19 |
Return a humanfriendly string of a timestamp e.g. | def readable_time(timestamp=None):
time_readable_str = str(time.asctime(time.localtime(timestamp if timestamp else time.time())))
return time_readable_str | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _timestamp():\n moment = time.time()\n moment_us = repr(moment).split(\".\")[1]\n return time.strftime(\"%Y-%m-%d-%H-%M-%S-{}\".format(moment_us), time.gmtime(moment))",
"def timeStamp():\n import time\n return str(time.strftime(\"%a %d %b %Y %I:%M:%S %p\"))",
"def str_timestamp(time_value=N... | [
"0.8145433",
"0.8096682",
"0.7812531",
"0.7723252",
"0.7702962",
"0.76912314",
"0.76646864",
"0.76629126",
"0.7638235",
"0.7635258",
"0.763414",
"0.7633164",
"0.7626408",
"0.7608596",
"0.75712985",
"0.7525881",
"0.7518307",
"0.75060904",
"0.7489307",
"0.7472612",
"0.7417303",... | 0.7154284 | 46 |
Return a humanfriendly string of ETA time and left time e.g. | def readable_eta(seconds_left):
eta_time = readable_time(time.time() + seconds_left)
time_left = datetime.timedelta(seconds=int(seconds_left))
return str(eta_time), str(time_left) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_eta(seconds_left):\n minutes_left = seconds_left // 60\n seconds_left %= 60\n hours_left = minutes_left // 60\n minutes_left %= 60\n days_left = hours_left // 24\n hours_left %= 24\n\n def helper(cnt, name):\n return \"{} {}{}\".format(str(cnt), name, ('s' if cnt > 1 else '')... | [
"0.6953343",
"0.6876315",
"0.6664446",
"0.666122",
"0.65497065",
"0.65098816",
"0.6476624",
"0.63067955",
"0.62974834",
"0.6281576",
"0.626519",
"0.6263413",
"0.62253726",
"0.61193764",
"0.6117047",
"0.61100626",
"0.6107",
"0.6055907",
"0.60470474",
"0.6043541",
"0.601723",
... | 0.74234664 | 0 |
The checkbox class draws an interactable checkbox on screen. | def __init__(self, x, y, name):
self.x = x
self.y = y
self.width = 20
self.height = 20
self.name = name
self.checked = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DrawCheckBox(*args, **kwargs):\n return _gdi_.RendererNative_DrawCheckBox(*args, **kwargs)",
"def uiCheckboxChecked(checkbox):\n\n return clibui.uiCheckboxChecked(checkbox)",
"def checkBox(parent,label='',pos=defPos,size=defSize,style=0,val=defVal,\r\n name='checkBox',id=defId,onCheck=None... | [
"0.72254366",
"0.6618406",
"0.6598507",
"0.63907",
"0.63171124",
"0.6294901",
"0.6200432",
"0.6115143",
"0.61059535",
"0.60366446",
"0.5946683",
"0.5944035",
"0.5801725",
"0.5790992",
"0.57825196",
"0.5747486",
"0.5705817",
"0.5701623",
"0.5699198",
"0.56629324",
"0.5638513",... | 0.5419606 | 34 |
Pack serialized bytes into buff starting at offset ``offset`` | def pack_into(self, buff, offset):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pack_into(self, buff, offset):\n if self.compression_type == CompressionType.NONE:\n messages = self._messages\n else:\n if self._compressed is None:\n self._compressed = self._get_compressed()\n messages = [self._compressed]\n\n for message ... | [
"0.7432984",
"0.73541933",
"0.6885543",
"0.62027293",
"0.62001574",
"0.6142268",
"0.61325747",
"0.6128324",
"0.6121664",
"0.60242957",
"0.60021704",
"0.598969",
"0.5961675",
"0.5955226",
"0.57715744",
"0.57044",
"0.5668511",
"0.56669444",
"0.5649528",
"0.56240004",
"0.5486048... | 0.7774521 | 0 |
Test if `atoms1` and `atoms2` are clones of each other. | def are_clone_sequences(atoms1, atoms2):
for a1, a2 in it.zip_longest(atoms1, atoms2):
assert a1 is not a2
assert a1.get_id() == a2.get_id()
assert a1.get_charge() == a2.get_charge()
assert a1.__class__ is a2.__class__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_clone_identical(self, cosmo):\n assert cosmo.clone() is cosmo",
"def component_clone ( same ) : \n if isinstance ( same , str ) \\\n and same.strip().lower() in ( 'clone' , 'cloned' , 'same' ) : return True \n return False",
"def is_valid_single_attempt(self, atoms_init, ... | [
"0.687666",
"0.628392",
"0.616162",
"0.59765905",
"0.5909758",
"0.5881605",
"0.5853853",
"0.58409965",
"0.58334446",
"0.58163756",
"0.57761455",
"0.5755352",
"0.5750811",
"0.5686123",
"0.567154",
"0.56668353",
"0.5629731",
"0.56280994",
"0.56103307",
"0.5609737",
"0.5607436",... | 0.75066185 | 0 |
Creates a new heapy object, sets it to begin profiling, and returns to caller. | def StartProfiling(self):
hp = hpy()
hp.setrelheap()
return hp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.heap = [None]",
"def __init__(self):\n self.heap = []",
"def __init__(self):\n self.heap = []",
"def __init__(self):\n self.heap = []",
"def __init__(self):\n self.heapList = [0]\n self.currentSize = 0",
"def __init__(self):\n se... | [
"0.6061616",
"0.6059884",
"0.6059884",
"0.6059884",
"0.5938121",
"0.58225906",
"0.5751",
"0.5707545",
"0.56855077",
"0.55966604",
"0.55407274",
"0.548235",
"0.5480643",
"0.54551744",
"0.5432851",
"0.542534",
"0.53530663",
"0.53280884",
"0.5321047",
"0.527236",
"0.52706534",
... | 0.7852354 | 0 |
Create OperatorConfig from json. | def from_json(cls, params: Dict) -> 'OperatorConfig':
operator_name = params.get("type")
if operator_name:
params.pop("type")
return cls(operator_name, params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_from_json(cls, config_json: str) -> 'ResolverOp':\n return cls.create(**json_utils.loads(config_json))",
"def from_json(cls, cfg):\n params = json.loads(json.dumps(cfg), object_hook=HelperObject)\n return cls(params.data, params.train, params.model)",
"def from_dict(cls, json_object... | [
"0.71167934",
"0.66208285",
"0.6053397",
"0.5826495",
"0.5809321",
"0.58002776",
"0.57553613",
"0.5734468",
"0.5697241",
"0.56940156",
"0.5616187",
"0.55429226",
"0.5535976",
"0.5535966",
"0.551536",
"0.5514549",
"0.54946846",
"0.54946846",
"0.54946846",
"0.54847646",
"0.5481... | 0.78302073 | 0 |
Read a file in as a pandas dataframe | def input_dataframe(self, filename, **kwargs):
# Set defaults for index_col and header
kwargs['index_col'] = kwargs.pop('index_col', 0)
kwargs['header'] = kwargs.pop('header', 0)
# Use any kwargs for this function and any file settings from default
file_settings = self.file_for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_file_to_dataframe(self, file_path: str) -> pd.DataFrame:\n return pd.read_csv(file_path, sep=\"\\t\")",
"def read_data(filepath):\n df = pd.read_csv(filepath)\n return df",
"def read_data(filepath):\n df = pd.read_csv(filepath)\n return df",
"def read_data(filepath... | [
"0.8326751",
"0.7812918",
"0.7812918",
"0.7812918",
"0.76886165",
"0.75824964",
"0.7562956",
"0.7368797",
"0.733999",
"0.7331001",
"0.7312223",
"0.72934407",
"0.7290116",
"0.724696",
"0.72234696",
"0.7190916",
"0.7159741",
"0.71580565",
"0.7145618",
"0.71403086",
"0.712144",
... | 0.6754843 | 61 |
Getter. Returns current config dictionary | def getSettings(self):
return self.cfg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self) -> dict:\n return Config.get()",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__... | [
"0.86454815",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837",
"0.84618837"... | 0.0 | -1 |
Adds a copy of each Range or RangeSet in the given iterable to this RangeSet. Raises a `TypeError` if the argument is not iterable. This method works identically to `.add()` for RangeSets only. | def extend(self, iterable: Iterable[Rangelike]) -> None:
self._ranges = RangeSet._merge_ranges(
self._ranges + (Range(r) for r in iterable)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, iterable):\n raise NotImplementedError()",
"def extend(self, iterable):\n for item in iterable:\n self.append(item)",
"def add(self, rng: Rangelike) -> None:\n # if it's a RangeSet, then do extend instead\n if isinstance(rng, RangeSet):\n self.ext... | [
"0.6860782",
"0.63996875",
"0.6352269",
"0.62559605",
"0.609729",
"0.60079956",
"0.5936614",
"0.5871992",
"0.5822301",
"0.58016634",
"0.5793024",
"0.56846607",
"0.56760025",
"0.56237525",
"0.5505183",
"0.54798245",
"0.5439465",
"0.5384353",
"0.53824985",
"0.5381993",
"0.53804... | 0.7217895 | 0 |
Removes the entire contents of the given RangeSet from this RangeSet. This method will only remove a single RangeSet (or Range) from this RangeSet at a time. To remove a list of Rangelike objects from this RangeSet, use .difference_update() instead. | def discard(self, rng: Rangelike) -> None:
# be lazy and do O(n^2) erasure
if isinstance(rng, RangeSet):
temp = self.copy()
for r in rng:
temp.discard(r)
self._ranges = temp._ranges
return
# elif _is_iterable_non_string(rng):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def difference_update(self, rng_set: Union[Rangelike, Iterable[Rangelike]]) -> None:\n self.discard(RangeSet._to_rangeset(rng_set))",
"def difference(self, rng_set: Union[Rangelike, Iterable[Rangelike]]) -> 'RangeSet':\n new_rng_set = self.copy()\n new_rng_set.difference_update(RangeSet(rng_... | [
"0.75519866",
"0.7201307",
"0.68198085",
"0.6792012",
"0.6649917",
"0.6369244",
"0.6320715",
"0.6281404",
"0.62113464",
"0.61589414",
"0.608959",
"0.5980783",
"0.58486617",
"0.5833409",
"0.5780234",
"0.5638507",
"0.5621895",
"0.55278355",
"0.5490301",
"0.5468529",
"0.54576856... | 0.69272065 | 2 |
Returns `True` if there is no overlap between this RangeSet and the given RangeSet. | def isdisjoint(self, other: Union[Rangelike, Iterable[Rangelike]]) -> bool:
# convert to RangeSet
other = RangeSet._to_rangeset(other)
# O(n^2) comparison
# TODO improve efficiency by mergesort/short-circuiting
return all(rng1.isdisjoint(rng2) for rng1 in self._ranges for rng2 in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doesNotOverlap( self, other):\n return not self.overlaps( other)",
"def isempty(self) -> bool:\n return self._ranges.isempty() or all(r.isempty() for r in self._ranges)",
"def has_atomic_overlaps(self):\n atomic_overlaps = self._get_atomic_overlaps()\n return len(atomic_overlaps... | [
"0.6857287",
"0.6833139",
"0.64820707",
"0.6352934",
"0.62335783",
"0.6205679",
"0.6179725",
"0.60719925",
"0.60383254",
"0.59528255",
"0.59245557",
"0.591833",
"0.5908017",
"0.5857745",
"0.58318865",
"0.5828083",
"0.58174145",
"0.5814212",
"0.5803012",
"0.5802183",
"0.579712... | 0.708128 | 0 |
Returns a RangeSet containing all items not present in this RangeSet | def complement(self) -> 'RangeSet':
return RangeSet(Range()) - self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def difference(self, rng_set: Union[Rangelike, Iterable[Rangelike]]) -> 'RangeSet':\n new_rng_set = self.copy()\n new_rng_set.difference_update(RangeSet(rng_set))\n return new_rng_set",
"def complement(self, aset):\n return self.all_n.difference(aset)",
"def unsolved_cells(self) -> ... | [
"0.6852944",
"0.6513064",
"0.6475641",
"0.6475641",
"0.6383193",
"0.6335221",
"0.63335925",
"0.6311771",
"0.6181002",
"0.61671466",
"0.6086708",
"0.6085837",
"0.6060088",
"0.60333467",
"0.6020219",
"0.6004851",
"0.596275",
"0.59580046",
"0.5935628",
"0.59124553",
"0.5909502",... | 0.76605964 | 0 |
Returns True if this RangeSet contains no values, and False otherwise | def isempty(self) -> bool:
return self._ranges.isempty() or all(r.isempty() for r in self._ranges) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty(self):\n return not self.values",
"def is_empty(self):\n return not bool(self.values)",
"def isempty(self):\n\n if self.values is None or self.values.empty:\n return True",
"def is_empty(self):\n return len(self.values) == 0",
"def is_empty(self):\n #... | [
"0.8354014",
"0.8135113",
"0.8071426",
"0.7933859",
"0.7781738",
"0.77647954",
"0.7733816",
"0.7577532",
"0.74954623",
"0.7395585",
"0.7365703",
"0.7360949",
"0.7312283",
"0.72111726",
"0.7166532",
"0.7166532",
"0.7130271",
"0.7123778",
"0.7123778",
"0.7123778",
"0.7105078",
... | 0.78404826 | 4 |
Returns a shallow copy of this RangeSet | def copy(self) -> 'RangeSet':
return RangeSet(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return IntervalSet(self)",
"def copy(self):\n return set(self)",
"def copy(self):\n return self.__class__(*self.sets)",
"def deepcopy(self):\n return self.copy()",
"def copy(self):\n return copy.deepcopy(self)",
"def copy(self):\n return copy.de... | [
"0.8222557",
"0.78674966",
"0.7321405",
"0.73209566",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
"0.73169273",
... | 0.8991917 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.