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 |
|---|---|---|---|---|---|---|
Get the filter name for the request data parameter. | def get_param_filter_name(cls, param, rel=None):
# check for empty param
if not param:
return param
# strip the rel prefix from the param name.
prefix = '%s%s' % (rel or '', LOOKUP_SEP)
if rel and param.startswith(prefix):
param = param[len(prefix):]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filter_name(self):\n pass",
"async def get_filter(self, **kwargs: Any) -> str:\n return self._telescope.filter_name",
"def name(self) -> StringFilter:\n return self.__name",
"def filter(self) -> Optional[str]:\n return pulumi.get(self, \"filter\")",
"def get_json_callbac... | [
"0.79879385",
"0.73243344",
"0.675019",
"0.65612745",
"0.6520124",
"0.6505116",
"0.64178914",
"0.6189231",
"0.6183338",
"0.61544156",
"0.6082367",
"0.60678583",
"0.6023081",
"0.60075915",
"0.6005047",
"0.59691584",
"0.59691584",
"0.587701",
"0.5817631",
"0.5786401",
"0.576572... | 0.6619432 | 3 |
Filter the provided `queryset` by the `related_filtersets`. It is recommended that you override this method to change the filtering behavior across relationships. | def filter_related_filtersets(self, queryset):
for related_name, related_filterset in self.related_filtersets.items():
# Related filtersets should only be applied if they had data.
prefix = '%s%s' % (related(self, related_name), LOOKUP_SEP)
if not any(value.startswith(prefix)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_filters(self, queryset, applicable_filters=None, applicable_exclusions=None):\n if applicable_filters:\n queryset = queryset.filter(applicable_filters)\n if applicable_exclusions:\n queryset = queryset.exclude(applicable_exclusions)\n return queryset",
"def ge... | [
"0.67854434",
"0.6782465",
"0.66839457",
"0.6680913",
"0.646492",
"0.63564074",
"0.63288736",
"0.63143224",
"0.63010234",
"0.6240037",
"0.6125244",
"0.60945296",
"0.608679",
"0.6075394",
"0.6073214",
"0.60558784",
"0.60067743",
"0.60016656",
"0.5998127",
"0.59923685",
"0.5961... | 0.84336936 | 0 |
Check if multiple or single file is chosen. | def check_multi_single(filenames):
num = len(filenames)
if num == 1:
single = bool(1)
else:
single = bool(0)
return single | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_multi_file(self):\n return 'files' in self.torrent['info']",
"def select_files():\n\n if not Settings.is_prompt(): return [File.get_random_file()]\n category = Settings.select_category()\n if not category: return File.select_file_upload_method()\n # if not Settings.confi... | [
"0.6862918",
"0.6714143",
"0.64036655",
"0.6360947",
"0.62420434",
"0.6179852",
"0.6168158",
"0.606886",
"0.6025578",
"0.5963181",
"0.59183747",
"0.5914388",
"0.59100074",
"0.59086585",
"0.5877628",
"0.5876562",
"0.5874005",
"0.58681023",
"0.5844574",
"0.5818032",
"0.5810063"... | 0.6930178 | 0 |
Called when using a nonce. This method should return C{True} if the nonce has not been used before, and store it for a while to make sure nobody tries to use the same value again. If the nonce has already been used or the timestamp is not current, return C{False}. You may use L{openid.store.nonce.SKEW} for your timesta... | def useNonce(self, server_url, timestamp, salt):
if is_nonce_old(timestamp):
return False
try:
mist_nonces = MistNonce.objects(server_url=server_url, salt=salt,
timestamp=timestamp)
except me.DoesNotExist:
mist_non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def useNonce(self, nonce):\r\n query = datastore.Query('Nonce')\r\n query['nonce ='] = nonce\r\n query['created >='] = (datetime.datetime.now() -\r\n datetime.timedelta(hours=6))\r\n\r\n results = query.Get(1)\r\n if results:\r\n datastore.Delete(results[0].key())\r\n ... | [
"0.73136973",
"0.6600226",
"0.6195637",
"0.61672926",
"0.61513644",
"0.6094848",
"0.6070164",
"0.6020712",
"0.6004455",
"0.5996191",
"0.5996191",
"0.59095937",
"0.5881976",
"0.5801852",
"0.5756545",
"0.569583",
"0.5590977",
"0.5563972",
"0.55559796",
"0.5550194",
"0.5542444",... | 0.76029676 | 0 |
return a list of manifests that are applied on this machine | def fact():
manifests = [x for x in os.walk(manifests_dir)]
return { 'manifests': manifests } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_manifest_strands(self):\n return self._available_manifest_strands",
"def list_manifests():\n import enaml\n with enaml.imports():\n from .pulses.manifest import PulsesManagerManifest\n from .tasks.manifest import PulsesTasksManifest\n from .measure.manifest import ... | [
"0.7041786",
"0.6661976",
"0.65691805",
"0.62815154",
"0.62224513",
"0.6135718",
"0.60951227",
"0.60727566",
"0.5942932",
"0.58993065",
"0.588448",
"0.58641076",
"0.58577496",
"0.5830976",
"0.58182544",
"0.58155537",
"0.58051246",
"0.5784909",
"0.5783124",
"0.57371914",
"0.57... | 0.5902238 | 9 |
Avoid using literal_eval for simple addition expressions. Returns sum of all positive numbers. | def split_and_sum(expression):
split_vals = expression.split('+')
float_vals = [float(v) for v in split_vals]
total = sum([v for v in float_vals if v > 0.0])
return total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_sum(parse_result):\r\n total = 0.0\r\n current_op = operator.add\r\n for token in parse_result:\r\n if token == '+':\r\n current_op = operator.add\r\n elif token == '-':\r\n current_op = operator.sub\r\n else:\r\n total = current_op(total, tok... | [
"0.71442914",
"0.70861304",
"0.62418014",
"0.62357926",
"0.6229933",
"0.62040615",
"0.6063164",
"0.60560673",
"0.6047006",
"0.5978517",
"0.59740245",
"0.59523994",
"0.59317786",
"0.59307003",
"0.5925646",
"0.5923283",
"0.5915873",
"0.5901256",
"0.58456707",
"0.5834098",
"0.58... | 0.65476674 | 2 |
Set a new password for encryption. | def set_password(self, password):
self.__init__(password=password) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setpassword(self, pwd):\n pass",
"def set_password(self, value):\n # Salt need to be generated before set password\n m = hashlib.sha256()\n m.update('-'.join([\n str(datetime.now()),\n config.get('security.password_salt')\n ]))\n self.salt = m.h... | [
"0.8377578",
"0.8145898",
"0.8129737",
"0.80971813",
"0.8089785",
"0.80798155",
"0.80655986",
"0.8056996",
"0.8050682",
"0.7988545",
"0.7963893",
"0.7942522",
"0.7855977",
"0.7843381",
"0.7838417",
"0.78155446",
"0.78155446",
"0.78155446",
"0.78155446",
"0.7810031",
"0.778050... | 0.7456274 | 39 |
Get two lists (for rows and columns) where the row/col index gives the list of col/row indexes of the nonzero elements. | def _get_index_lists(self, mat):
n_row, n_col = mat.shape
col_ind_at_row, row_ind_at_col = [],[]
for i in range(n_row):
aux_ind = _np.where(mat[i]>0)[0]
if len(aux_ind) == 0:
raise Exception('Row {} is composed of zeros'.format(i))
col... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_empty_cells(state):\n cells = []\n for row_index, row in enumerate(state.board):\n for col_index, cell in enumerate(row):\n if cell == 0:\n cells.append([row_index, col_index])\n return cells",
"def empty_cells(state):\n cells = []\n\n for i, row in enumera... | [
"0.70034736",
"0.6999915",
"0.6924702",
"0.6525192",
"0.6505699",
"0.6490474",
"0.64878106",
"0.6456846",
"0.6356905",
"0.63506573",
"0.6348926",
"0.62902606",
"0.6273074",
"0.62722355",
"0.6267735",
"0.62005794",
"0.6167228",
"0.61156595",
"0.6083813",
"0.6070011",
"0.606649... | 0.72458094 | 0 |
Return an ndarray having row per element in data and one column | def make_data(self, data):
return array(data, dtype=float32) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data(data):\n\n np_data = np.array(data)\n array = []\n\n for i in range(0, np_data.shape[1]):\n array.append(np_data[:, i])\n\n return np.array(array)",
"def get_data(data):\n\n np_data = np.array(data)\n array = []\n\n for i in range(0, np_data.shape[1]):\n array.appe... | [
"0.7534442",
"0.7534442",
"0.70013255",
"0.6785662",
"0.6688916",
"0.6645851",
"0.6567787",
"0.65319115",
"0.6462152",
"0.6382598",
"0.63573694",
"0.62963057",
"0.6281688",
"0.627003",
"0.623539",
"0.62131137",
"0.61992896",
"0.6181052",
"0.6180269",
"0.616434",
"0.6149688",
... | 0.573665 | 41 |
Get updated learning rate. | def get_lr(self):
# HACK: We need to check if this is the first time ``self.get_lr()`` was called,
# since ``torch.optim.lr_scheduler._LRScheduler`` will call ``self.get_lr()``
# when first initialized, but the learning rate should remain unchanged
# for the first epoch.
if not s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_learning_rate(self):\n config = self.config\n cur_lr = Train_model_pipeline.adjust_learning_rate(\n self.optimizer,\n self.epoch,\n config[\"training\"][\"learning_rate\"],\n decay=config[\"training\"][\"lr_decay_rate\"],\n step=config[\"... | [
"0.79935455",
"0.79565597",
"0.78638303",
"0.76802355",
"0.7612205",
"0.7602973",
"0.7580131",
"0.74478555",
"0.7442717",
"0.74091333",
"0.7381036",
"0.7336032",
"0.7336032",
"0.7331142",
"0.72541714",
"0.72166234",
"0.72166234",
"0.71983415",
"0.7194819",
"0.70593596",
"0.70... | 0.61572826 | 75 |
Compare the duration to the example. | def test_find_parallel_duration():
pt2_example = {
"C": [],
"A": ["C"],
"F": ["C"],
"B": ["A"],
"D": ["A"],
"E": ["B", "D", "F"],
}
assert find_parallel_duration(pt2_example, 2, 0) == 15 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_duration(self):\n for duration_, _, _ in self.test_cases:\n self.assertEqual(Rest(duration_).duration, duration_)",
"def test_duration_property(self):\n recording_dt = 0.1\n recording_shape = {\n 'no_timesteps': 1000,\n 'no_sweeps': 10,\n ... | [
"0.6993373",
"0.64634085",
"0.6261238",
"0.6072691",
"0.6072691",
"0.60668623",
"0.60171825",
"0.58592576",
"0.58530915",
"0.58014023",
"0.56802076",
"0.5668855",
"0.5660802",
"0.55880255",
"0.55880255",
"0.55513406",
"0.5545389",
"0.5539826",
"0.55272925",
"0.55245674",
"0.5... | 0.5158579 | 75 |
Return the overall mean score of a Player | def score_player(player, objective, opponents_information, weights=None, sample_count=None):
scores_for_all_opponents = []
if sample_count is not None:
indices = np.random.choice(len(opponents_information), sample_count)
opponents_information = [opponents_information[i] for i in indices]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mean_score(rating_scores):\n return sum(rating_scores) / len(rating_scores)",
"def getAverage(self):\n return sum(self.scores) / len(self.scores)",
"def get_total_score(self):\n\n # Return the player's total score\n return self._total_score",
"def calc_mean_score(movies: List[Mo... | [
"0.7505888",
"0.7412792",
"0.7344528",
"0.72962356",
"0.713673",
"0.7091335",
"0.7069279",
"0.68148583",
"0.68021953",
"0.6720858",
"0.6720858",
"0.6720858",
"0.6719883",
"0.670838",
"0.6703316",
"0.66747105",
"0.66253746",
"0.66124016",
"0.65976983",
"0.6594148",
"0.65919864... | 0.61413795 | 86 |
Compares color to pawn color, returns true if they are the same. | def isColor(self,color):
return self.color==color | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_color(self, other: 'Piece') -> bool:\n\n return self.color == other.color",
"def color_check_mate(self, mycolor):\n\n if not self.color_in_check(mycolor):\n return False\n\n incheck = True\n for (x, y) in self.__players[mycolor]:\n moves = self._get_piec... | [
"0.7082352",
"0.6642375",
"0.6420325",
"0.63803416",
"0.6271055",
"0.6236686",
"0.62152225",
"0.6214757",
"0.6146159",
"0.6136335",
"0.6056689",
"0.6049656",
"0.6021747",
"0.60207504",
"0.6019101",
"0.60071254",
"0.6001189",
"0.6000824",
"0.59897274",
"0.59405607",
"0.5914164... | 0.6147662 | 8 |
A custom Django template tag for encoding URL query string parameters. | def urlparams(*_, **kwargs):
non_empty = {k: v for k, v in kwargs.items() if v is not None}
if non_empty:
return '?{}'.format(urlencode(non_empty))
return '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_replace(context, **kwargs):\n query = context['request'].GET.dict()\n query.update(kwargs)\n return urlencode(query)",
"def url_replace(context, **kwargs):\n query = context['request'].GET.dict()\n query.update(kwargs)\n return urlencode(query)",
"def encoded_query_str(request):\n ... | [
"0.6936687",
"0.6936687",
"0.65685886",
"0.6343588",
"0.62395805",
"0.6233473",
"0.6176143",
"0.61670446",
"0.6154101",
"0.6131022",
"0.60958886",
"0.60618484",
"0.6031017",
"0.6029763",
"0.5963693",
"0.59559804",
"0.59069306",
"0.57844955",
"0.57651424",
"0.5763139",
"0.5728... | 0.5674797 | 24 |
Checks whether or not reply to message m2 should be faked If m1's field is None then m2's field value is not compared at all | def _fake_message_compare(m1, m2):
m1 = m1.serialize()
m2 = m2.serialize()
diff = False
for i in range(len(m1)):
if m1[i] is None:
continue
if m1[i] != m2[i]:
diff = True
break
return not diff | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testNoneAssignment(self):\n class MyMessage(messages.Message):\n\n my_field = messages.StringField(1)\n\n m1 = MyMessage()\n m2 = MyMessage()\n m2.my_field = None\n self.assertEquals(m1, m2)",
"def __eq__(self, other):\n if not isinstance(other, SendMmsReq... | [
"0.61221015",
"0.60199493",
"0.5698596",
"0.56491196",
"0.56256944",
"0.55935615",
"0.5585704",
"0.55634177",
"0.55492973",
"0.55470234",
"0.55111665",
"0.5495307",
"0.546077",
"0.5453699",
"0.5440305",
"0.5392359",
"0.5371638",
"0.5361735",
"0.5357879",
"0.53478",
"0.5341549... | 0.7252573 | 0 |
Gives access to the hidden state of the individual components of the input batch. Since encode() encodes the whole batch of sequences in one call, but decoding is performed for every batch sequence individually, this method becomes necessary. | def get_encoded_item(self, encoded, index):
#for vanilla RNN and GRU, since they have a hidden state represented as a single tensor
##return encoded[:, index:index+1]
#for LSTM, since it has a hidden state represented as a tuple of two tensors: the cell state and the hidden state
return encoded[0][:, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode(self, x):\n _, hid = self.encoder(x) #All RNN classes output a tuple of 2 objects: the output of the RNN first and the hidden state from the last item in\n return hid #the input sequence second. We're only interested in the hidden state",
"def _encode(self):\n with tf.variab... | [
"0.6531696",
"0.6165337",
"0.61568475",
"0.59570867",
"0.59406155",
"0.5908961",
"0.58463246",
"0.5821808",
"0.5770365",
"0.57613736",
"0.57613736",
"0.5760088",
"0.5760088",
"0.5760088",
"0.5757003",
"0.57509893",
"0.5750539",
"0.57451725",
"0.570995",
"0.5698639",
"0.569119... | 0.0 | -1 |
Performs one single decoding step for one example. It passes the hidden state for the decoder and input the tensor with the embeddings vector for the input token. The result of the decoder is passed to the output net to obtain the logits for every item in the dictionary. It outputs those logits and the new hidden state... | def decode_one(self, hid, input_x):
out, new_hid = self.decoder(input_x.unsqueeze(0), hid)
out = self.output(out)
return out.squeeze(dim=0), new_hid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode():\n with tf.Session() as sess:\n # Create model and load parameters.\n model = create_model(True)\n model.batch_size = 1 # We decode one sentence at a time.\n init_model(sess, model)\n\n # Load vocabularies.\n vocab, rev_vocab = data_utils.get_vocabulary(FL... | [
"0.7202692",
"0.6928575",
"0.6782827",
"0.6653837",
"0.65899867",
"0.6541342",
"0.6538928",
"0.6499897",
"0.6485077",
"0.641824",
"0.64113784",
"0.637471",
"0.6374259",
"0.6316419",
"0.6304639",
"0.62677693",
"0.62158835",
"0.6194001",
"0.61918765",
"0.61859244",
"0.6164222",... | 0.0 | -1 |
Return the query list as a DataFrame. | def get_query_list():
prov_list = QueryProvider.list_data_environments()
print("Generating documentation for for the following providers")
print(", ".join(list(PROVIDERS)))
print("Skipping the following providers")
print(", ".join(list(set(prov_list) - set(PROVIDERS))))
env_providers = {prov: Q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_to_df(query):\n df = pd.DataFrame(query.all())\n df.columns = [x['name'] for x in query.column_descriptions]\n return df",
"def query2df(query):\n df = pd.DataFrame(data = list(itertools.product([0, 1], repeat=len(query.variables))), columns=query.variables)\n df['p'] = query.values.flat... | [
"0.7733995",
"0.7497827",
"0.73814756",
"0.7326154",
"0.7304706",
"0.7227527",
"0.7195444",
"0.71918434",
"0.71499586",
"0.7113315",
"0.70896244",
"0.7081603",
"0.70788634",
"0.70317006",
"0.70228714",
"0.7020063",
"0.7013619",
"0.6978598",
"0.6976442",
"0.68564945",
"0.68412... | 0.6495787 | 50 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, UpdateUserOption):
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.8089139",
"0.8089139",
"0.8054507",
"0.79827213",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
The module that this command is registered to. Will return `None` if this command has not yet been registered. | def module(self) -> Optional[Module]:
return self._module | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_module(self):\n return self.module",
"def module(self):\n return self._module",
"def module(self):\n return self._module",
"def module(self):\n return self._module",
"def module(self):\n return self._module",
"def module(self):\n return self._module",
"... | [
"0.8003115",
"0.7536935",
"0.7536935",
"0.7536935",
"0.7536935",
"0.7536935",
"0.75261885",
"0.7365347",
"0.70169824",
"0.68556315",
"0.67025244",
"0.66628325",
"0.66449714",
"0.6640801",
"0.6626384",
"0.652614",
"0.6519318",
"0.648883",
"0.64871985",
"0.64552623",
"0.6444489... | 0.74596643 | 7 |
The User that invoked the command. | def invoker(self) -> User:
return self.msg.source | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user(self):\n return self.getattr('user')",
"def user(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"user\")",
"def user(self) -> Optional[str]:\n _args: list[Arg] = []\n _ctx = self._select(\"user\", _args)\n return _ctx.execute_sync(Optional[str])",
"def use... | [
"0.80029744",
"0.78830194",
"0.7869089",
"0.7831611",
"0.7831611",
"0.7831611",
"0.7831611",
"0.7830656",
"0.77808654",
"0.77667016",
"0.77667016",
"0.77667016",
"0.7764792",
"0.77462137",
"0.7722865",
"0.7709639",
"0.77054626",
"0.77054626",
"0.7655964",
"0.7575146",
"0.7570... | 0.74655455 | 22 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title=None,
cmap=plt.cm.Blues,
image_save=False,
image_save_dir="/home/temp/moriz/validation/",
save_suffix=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194862",
"0.80949175",
"0.8029915",
"0.8019153",
"0.79941195",
"0.7991258",
"0.7980955",
"0.7976606",
"0.79610753",
"0.79590565",
"0.79378676",
"0.7934962",
"0.7934504",
"0.79313844",
"0.7926313",
"0.7924577",
"0.79241234",
"0.7923211",
"0.7923023",
"0.7921931",
"0.791787... | 0.0 | -1 |
Use arpack to calculate hte local density of states at a certain energy | def ldos_arpack(intra,num_wf=10,robust=False,tol=0,e=0.0,delta=0.01):
if robust: # go to the imaginary axis for stability
eig,eigvec = slg.eigs(intra,k=int(num_wf),which="LM",
sigma=e+1j*delta,tol=tol)
eig = eig.real # real part only
else: # Hermitic Hamiltonian
eig,eigvec = slg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_density(\n self,\n states: FlowFieldMap,\n additional_states: FlowFieldMap,\n ) -> FlowFieldVal:\n zz = additional_states.get('zz', [tf.constant(0, dtype=TF_DTYPE)] *\n self._params.nz)\n\n if 'T' in states:\n t = states['T']\n elif 'theta' in ... | [
"0.639904",
"0.6349566",
"0.6122259",
"0.587715",
"0.5850544",
"0.5828956",
"0.5805845",
"0.57823133",
"0.57640857",
"0.5762716",
"0.575468",
"0.5743525",
"0.57068014",
"0.568855",
"0.56624216",
"0.56600386",
"0.5653631",
"0.56313336",
"0.5620443",
"0.56074494",
"0.56047225",... | 0.0 | -1 |
Calculate the density of states for a finite system | def ldos_finite(h,e=0.0,n=10,nwf=4,delta=0.0001):
if h.dimensionality!=1: raise # if it is not one dimensional
intra = csc(h.intra) # convert to sparse
inter = csc(h.inter) # convert to sparse
interH = inter.H # hermitian
m = [[None for i in range(n)] for j in range(n)] # full matrix
for i in range(n): # ad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDensityOfStates(self, Elist):\n\t\treturn _modes.freerotor_densityofstates(Elist, self.frequencies, 1 if self.linear else 0)",
"def getDensityOfStates(self, Elist):\n\t\trho = np.zeros((len(Elist)), np.float64)\n\t\trho0 = _modes.hinderedrotor_densityofstates(Elist, self.frequency, self.barrier)\n\t\tfor ... | [
"0.6842676",
"0.6838163",
"0.66934264",
"0.66780734",
"0.6619658",
"0.6589051",
"0.6474599",
"0.63931894",
"0.63873273",
"0.63801605",
"0.6272464",
"0.62401986",
"0.6229511",
"0.61976075",
"0.6176228",
"0.6112314",
"0.6104218",
"0.60965395",
"0.60946393",
"0.60946393",
"0.609... | 0.0 | -1 |
Create a plane through a given point with given normal and surface material | def __init__(self, point, normal, material):
self.point = point
self.norm = unit(normal)
self.mat = material | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_point_plane(point, plane):\n base, normal = plane\n normal = normalize_vector(normal)\n vector = subtract_vectors(point, base)\n snormal = scale_vector(normal, dot_vectors(vector, normal))\n return subtract_vectors(point, snormal)",
"def plot_plane(unit_normal, x_array, y_array, fore):... | [
"0.6926132",
"0.67918247",
"0.66280645",
"0.6622853",
"0.6570255",
"0.6499382",
"0.64442146",
"0.6332076",
"0.62797856",
"0.62646264",
"0.6246257",
"0.6151091",
"0.6120761",
"0.6096576",
"0.60693115",
"0.59628874",
"0.5912617",
"0.58920056",
"0.58715844",
"0.585937",
"0.58575... | 0.683124 | 1 |
Returns the ctf of the dataset series which this datasource operates on | def getColorTransferFunction(self):
return self.ctf | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCDF(self):\n return self.cdfSample",
"def CFL(self):\n return self.__CFL",
"def get_cffts(self):\n return [\n rfft(self.nx, self.dx, fft=self.tfft, ny=self.ny,\n dy=self.dy).get_cfft(),\n rfft(self.nx, self.dx, fft=self.efft, ny=self.ny,\n ... | [
"0.6114998",
"0.5954782",
"0.5948087",
"0.5920047",
"0.59179395",
"0.58852816",
"0.5781732",
"0.57313186",
"0.57007056",
"0.56663144",
"0.5602908",
"0.5576217",
"0.55340517",
"0.5467268",
"0.5431777",
"0.539905",
"0.539905",
"0.5388791",
"0.5385939",
"0.53720737",
"0.53636706... | 0.5846474 | 6 |
Merges the given Item with the last one currently in the given Container if both are whitespace items. Returns True if the items were merged. | def _merge_ws(self, item, container): # type: (Item, Container) -> bool:
last = container.last_item()
if not last:
return False
if not isinstance(item, Whitespace) or not isinstance(last, Whitespace):
return False
start = self._idx - (len(last.s) + len(item.s))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_be_merged(prev, cur):\n\n WHITESPACE = (' ', '\\t')\n if not cur.mergeable or not prev.mergeable:\n return False\n # offset is char offset, not byte, so length is the char length!\n elif cur.offset != (prev.offset + prev.length):\n r... | [
"0.5630323",
"0.562426",
"0.51364464",
"0.5081948",
"0.5043025",
"0.48954043",
"0.48792508",
"0.4865082",
"0.48528847",
"0.48474756",
"0.48178267",
"0.48116726",
"0.47968078",
"0.4795999",
"0.478459",
"0.47503677",
"0.47446725",
"0.47313824",
"0.47310415",
"0.47016767",
"0.46... | 0.75566405 | 0 |
Creates and saves a superuser with the given email and password. | def create_superuser(self, email, password):
user = self.create_user(email, password=password)
user.is_admin = True
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createsuperuser():\n\n email = prompt('User E-Mail')\n email_confirm = prompt('Confirm E-Mail')\n\n if not email == email_confirm:\n sys.exit('\\nCould not create user: E-Mail did not match')\n\n if not EMAIL_REGEX.match(email):\n sys.exit('\\nCould not create user: Invalid E-Mail add... | [
"0.83345544",
"0.82813346",
"0.8258201",
"0.8249415",
"0.8248188",
"0.8223905",
"0.82129776",
"0.8210377",
"0.8180428",
"0.8175924",
"0.8174477",
"0.8159496",
"0.81555283",
"0.8152179",
"0.8147241",
"0.8146682",
"0.81466043",
"0.81466043",
"0.81466043",
"0.81454295",
"0.81319... | 0.80541736 | 37 |
Is the user a member of staff? | def is_staff(self):
return self.is_admin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def is_staff(ctx):\n member = ctx.message.author\n vipRole = discord.utils.get(member.guild.roles, name=ROLE_VIP)\n staffRole = discord.utils.get(member.guild.roles, name=ROLE_STAFF)\n return vipRole in member.roles or staffRole in member.roles",
"def is_staff(self):\n # Simplest possibl... | [
"0.8091983",
"0.79417914",
"0.79417914",
"0.79417914",
"0.78373754",
"0.7725267",
"0.7695455",
"0.7543704",
"0.7538521",
"0.74671674",
"0.74179083",
"0.740949",
"0.740872",
"0.7405209",
"0.7117188",
"0.7050242",
"0.7050242",
"0.7018241",
"0.694894",
"0.68767804",
"0.685789",
... | 0.76052535 | 8 |
Is the user a superuser? | def is_superuser(self):
return self.is_admin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isSuper(self):\n user = self.getSession()\n return self.pipe.auth.isSuper(user)",
"def is_superuser():\n if sys.version > \"2.7\":\n for uid in os.getresuid():\n if uid == 0:\n return True\n else:\n if os.getuid() == 0 or os.getegid() == 0:\n ... | [
"0.8203781",
"0.8123163",
"0.7936285",
"0.77750057",
"0.76693565",
"0.7637397",
"0.757354",
"0.7337289",
"0.7219452",
"0.713708",
"0.70978487",
"0.7031901",
"0.69242924",
"0.69207996",
"0.6917187",
"0.6854157",
"0.68328345",
"0.68302256",
"0.6777356",
"0.6768828",
"0.6747381"... | 0.80404836 | 2 |
Coerce an unknown date to the given timezone, then to UTC | def normalize_to_utc(date, timezone):
local_tz = pytz.timezone(timezone)
new_date = date.replace(tzinfo = local_tz)
utc_tz = pytz.timezone('UTC')
new_date = new_date.astimezone(utc_tz)
return new_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toutc(dateobj, timezone):\n fmtdate = parser.parse(dateobj) # string to datetime object\n user_tz = pytz.timezone(timezone) # getting user's timezone\n localize_date_with_tz = user_tz.localize(fmtdate) #adding user's timezone to datetime object\n utcdate = pytz.utc.normalize(localize_date_with_tz) ... | [
"0.75894195",
"0.7289164",
"0.7209024",
"0.6907422",
"0.6864215",
"0.6698652",
"0.6688846",
"0.6686423",
"0.6653843",
"0.6593803",
"0.6576157",
"0.6573529",
"0.6562767",
"0.6553227",
"0.65446633",
"0.6526314",
"0.64945215",
"0.64906996",
"0.6474339",
"0.64524305",
"0.6386153"... | 0.76795125 | 0 |
Test with only threecard petitions allowed. | def test_only_three_card_petitions(self):
f = gtrutils.check_petition_combos
self.assertTrue( f( 0, 0, [0], False, True))
self.assertFalse( f( 1, 0, [0], False, True))
self.assertTrue( f( 1, 1, [0], False, True))
self.assertTrue( f( 1, 0, [3], False, True))
self.asse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_two_and_three_card_petitions(self):\n f = gtrutils.check_petition_combos\n\n self.assertTrue( f( 0, 0, [], True, True))\n\n self.assertFalse( f( 1, 0, [], True, True))\n self.assertFalse( f( 1, 0, [1], True, True))\n self.assertTrue( f( 1, 0, [2], True, True))\n ... | [
"0.6810119",
"0.6473808",
"0.645677",
"0.62938344",
"0.62752783",
"0.62059915",
"0.6155211",
"0.6148065",
"0.60892385",
"0.59840876",
"0.596696",
"0.5963209",
"0.59501404",
"0.5799793",
"0.5697761",
"0.5672481",
"0.566434",
"0.561755",
"0.56103486",
"0.5594359",
"0.5582937",
... | 0.7429536 | 0 |
Uploads the SVG file to S3, and returns the URL of the object | def upload_svg(filename, xml_string):
s3 = boto3.client('s3')
response = s3.put_object(
ACL='public-read',
Body=xml_string,
Bucket=BUCKET,
Key=filename,
StorageClass='REDUCED_REDUNDANCY',
)
return 'https://s3.amazonaws.com/%s/%s' % (BUCKET, filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload(file_path, aws_path, access_key, secret_key) -> None:\n # bucket = \"dev-com-courtlistener-storage\"\n bucket = \"seals.free.law\"\n client = boto3.client(\n \"s3\",\n aws_access_key_id=access_key,\n aws_secret_access_key=secret_key,\n )\n transfer = S3Transfer(client... | [
"0.65627086",
"0.6511997",
"0.64451045",
"0.63643384",
"0.61173415",
"0.6040773",
"0.6031718",
"0.60039645",
"0.5967601",
"0.5940069",
"0.5857561",
"0.58238834",
"0.5796205",
"0.574195",
"0.57342345",
"0.57331437",
"0.5722847",
"0.57148886",
"0.57147944",
"0.5705097",
"0.5654... | 0.7696398 | 0 |
String representation of this class | def __repr__(self):
return f"<Airport(id={str(self.id)}, name={self.name})>" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toString(self):\n\n sMembers = '';\n for sAttr in self.getDataAttributes():\n oValue = getattr(self, sAttr);\n sMembers += ', %s=%s' % (sAttr, oValue);\n\n oClass = type(self);\n if sMembers == '':\n return '<%s>' % (oClass.__name__);\n return... | [
"0.8405431",
"0.83985007",
"0.83985007",
"0.83985007",
"0.83985007",
"0.83985007",
"0.83985007",
"0.83985007",
"0.83985007",
"0.83985007",
"0.83985007",
"0.83985007",
"0.83985007",
"0.83985007",
"0.8396452",
"0.8396452",
"0.8396452",
"0.8396452",
"0.8396452",
"0.83616906",
"0... | 0.0 | -1 |
Computes the x coordinate of the ball | def getBallX(state):
region = state[93:189, 8:WIDTH-8, 0]
nonzero_x_coords = region.nonzero()[1]
if len(nonzero_x_coords) > 0:
return nonzero_x_coords.mean()
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_x(self):\n return self.position.x",
"def get_x(self):\n\t\treturn self._collision_rect.x + 14",
"def x(self):\r\n return self.position.x",
"def get_x(self):\n return self.posX",
"def get_pos_x(self):\n return self.__pos_x",
"def Getxcoord(self):\n return self.x_coo... | [
"0.7201727",
"0.7096933",
"0.69620883",
"0.69616777",
"0.68398833",
"0.6825444",
"0.68012977",
"0.68012977",
"0.67890507",
"0.67753965",
"0.67356485",
"0.6712596",
"0.67017496",
"0.6700496",
"0.6699452",
"0.6689949",
"0.66789895",
"0.6650196",
"0.6637467",
"0.6616907",
"0.661... | 0.7251717 | 0 |
Computes the x coordinate of the paddle. | def getPaddleX(state):
region = state[190:191, 8:WIDTH-8, 0]
nonzero_x_coords = region.nonzero()[1]
assert len(nonzero_x_coords) > 0
return nonzero_x_coords.mean() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_x(self):\n return self.position.x",
"def get_x(self):\n return self.posX",
"def x(self):\r\n return self.position.x",
"def get_pos_x(self):\n return self.__pos_x",
"def get_x_position(self):\n return self.rect.x",
"def get_alien_x(self):\n return self.x",
... | [
"0.7278048",
"0.71396947",
"0.70126045",
"0.6951281",
"0.69439006",
"0.6811559",
"0.6754752",
"0.6747178",
"0.674097",
"0.6727758",
"0.6699524",
"0.6672045",
"0.6648935",
"0.66291857",
"0.6610564",
"0.6605478",
"0.65597486",
"0.65584433",
"0.6536112",
"0.6401617",
"0.6386279"... | 0.7158066 | 1 |
A convenience wrapper for `visit_iterable` that returns a sequence instead of an iterable. | def visit_sequence(
parent: "CSTNode",
fieldname: str,
children: Sequence[CSTNodeT],
visitor: "CSTVisitorT",
) -> Sequence[CSTNodeT]:
return tuple(visit_iterable(parent, fieldname, children, visitor)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toiter(x):\n if iterable(x):\n return x\n else:\n return [x]",
"def concrete(seq):\n if isinstance(seq, Iterator):\n seq = list(seq)\n if isinstance(seq, (tuple, list)):\n seq = list(map(concrete, seq))\n return seq",
"def make_iterable(arg):\n return arg if is... | [
"0.71035177",
"0.6873974",
"0.66026473",
"0.64714134",
"0.61446095",
"0.61344165",
"0.61129576",
"0.60355216",
"0.60355216",
"0.5988719",
"0.5987896",
"0.5984973",
"0.5884642",
"0.58802277",
"0.5814334",
"0.5812307",
"0.57950664",
"0.57258046",
"0.56900185",
"0.56784594",
"0.... | 0.5409288 | 40 |
Shows your or the selected user's id. | async def user_id(
event,
user_id: ('user_id', 'Get the id of an other user?', 'user') = None,
):
if user_id is None:
user_id = event.user.id
return str(user_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_user(request, user_id):\n return render(request, 'users/view_user.html',\n { })",
"def show_user(user_id):\n user = User.query.get(user_id)\n\n return render_template('user.html',user=user)",
"def show_user():\n\n return render_template('user/show_by_user.html', title='Show Profile... | [
"0.70061904",
"0.6974337",
"0.6950619",
"0.6897555",
"0.6804346",
"0.67851716",
"0.6750138",
"0.67339456",
"0.66650236",
"0.66331357",
"0.6614428",
"0.65648824",
"0.65122503",
"0.65082175",
"0.6507262",
"0.65002286",
"0.6484979",
"0.6484979",
"0.6449136",
"0.6417354",
"0.6394... | 0.66290426 | 10 |
Return the header of request. | def _get_request_header() -> Dict:
metas, envs = get_full_version()
header = {
**{f'jinameta-{k}': str(v) for k, v in metas.items()},
**envs,
}
return header | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_header(self):\n return self._header",
"def getHeader():\n return _HEADER",
"def header(self):\n return self._header",
"def header(self):\n return self._header",
"def header(self):\n return self._header",
"def getHeader(self):\n return self.data.header",
"de... | [
"0.8271102",
"0.8128856",
"0.7752471",
"0.7752471",
"0.7752471",
"0.77344984",
"0.76949877",
"0.7601719",
"0.7559333",
"0.75524616",
"0.7516345",
"0.7507523",
"0.72965723",
"0.72964346",
"0.72653186",
"0.7242549",
"0.72425336",
"0.7175708",
"0.7161306",
"0.71201324",
"0.71052... | 0.69505686 | 28 |
Unfolds a tensor T into a matrix, taking the dimension "dim" of T as the first dimension of the matrix, and flattening all the other dimensions into the other one dimension of the matrix. dim starts from 0. | def unfold(T, dim):
Tm=np.moveaxis(T, dim, 0)
return Tm.reshape(T.shape[dim],-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten(tensor):\n C = tensor.size(1)\n # new axis order\n axis_order = (1, 0) + tuple(range(2, tensor.dim()))\n # Transpose: (N, C, D, H, W) -> (C, N, D, H, W)\n transposed = tensor.permute(axis_order)\n # Flatten: (C, N, D, H, W) -> (C, N * D * H * W)\n return transposed.contiguous().vie... | [
"0.7043688",
"0.6872559",
"0.6866148",
"0.6625046",
"0.6595738",
"0.6544334",
"0.6462534",
"0.6318924",
"0.63155955",
"0.6307684",
"0.6298893",
"0.62986493",
"0.62389565",
"0.6198749",
"0.6193831",
"0.6192542",
"0.6138287",
"0.60814816",
"0.6069293",
"0.6062363",
"0.60362655"... | 0.81962144 | 0 |
nMode product of a tensor T and a matrix M, the summation is made along the nth dim. definition in paper "A MULTILINEAR SINGULAR VALUE DECOMPOSITION" by LIEVEN DE LATHAUWER , BART DE MOOR , AND JOOS VANDEWALLE For example, n with value 0, 1, or 2, would specify the 1st, 2nd or 3rd dim of the tensor T. For the matrix M,... | def nModeProduct(T, M, n):
P=tensordot(T, M, axes=([n], [1]))
return np.rollaxis(P, len(T.shape)-1, n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ttm(t, m, k):\n\n dim_list = [] # initialize a list to save dimension index to transpose the tensor reshapped from 2D matrix\n shape_list = [] # initialize a list to save the dimensions to reshape 2D matrix back to tensor\n total_dim = len(t.shape)\n for i in range(total_dim):\n dim_list.a... | [
"0.60840887",
"0.5962957",
"0.5834595",
"0.57553023",
"0.5729404",
"0.56230754",
"0.55998474",
"0.558549",
"0.55777717",
"0.5541569",
"0.54854864",
"0.54752266",
"0.53972495",
"0.53863096",
"0.53441954",
"0.5337099",
"0.5322091",
"0.5305267",
"0.5296987",
"0.52967924",
"0.527... | 0.84308904 | 0 |
This is a new version of extend_dims() function of numpy, it extend multiple dims rather than one. | def new_expand_dims(a, axes):
# if int is passed, retain the same behaviour
if type(axes) == int:
return np.expand_dims(a, axes)
# insert axes to given indices
for ax in sorted(axes):
a = np.expand_dims(a, ax)
return a | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend(a, b):\n if np.isscalar(a):\n return a\n # CRUFT: python 2.7 support\n extra_dims = (1,)*(b.ndim-a.ndim)\n return a.reshape(a.shape + extra_dims)\n # python 3 uses\n #extra_dims = (np.newaxis,)*(b.ndim-a.ndim)\n #return a[(..., *extra_dims)]",
"def expand_dims(array):\n ... | [
"0.70451933",
"0.6982546",
"0.673844",
"0.66155654",
"0.65966463",
"0.64626193",
"0.6444467",
"0.6379055",
"0.62785256",
"0.62534416",
"0.6246189",
"0.6212844",
"0.61804307",
"0.61784613",
"0.60776794",
"0.5881329",
"0.58224505",
"0.57709056",
"0.57032615",
"0.569746",
"0.566... | 0.642201 | 7 |
Decide whether the minitaur has fallen. If the up directions between the base and the world is larger (the dot product is smaller than 0.5), the minitaur is considered fallen. | def is_fallen(self):
orientation = self.minitaur_env.minitaur.GetBaseOrientation()
rot_mat = self.minitaur_env._pybullet_client.getMatrixFromQuaternion(orientation)
local_up = rot_mat[6:]
return (np.dot(np.asarray([0, 0, 1]), np.asarray(local_up)) < 0.3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def at_goal(self):\n return self.distance_from_goal < self.robot.wheels.base_length/2",
"def at_goal(self):\n return self.distance_from_goal < self.robot.wheels.base_length/2",
"def is_upper(self):\n return self.z < 0",
"def is_at_wall(self):\n return self.distmin < self.distmax*0... | [
"0.63688046",
"0.63688046",
"0.58916235",
"0.58059263",
"0.5784403",
"0.5761813",
"0.57414496",
"0.5711356",
"0.5707844",
"0.5697768",
"0.5675407",
"0.56628335",
"0.56495374",
"0.56233096",
"0.55607885",
"0.555384",
"0.55337554",
"0.5527628",
"0.5523818",
"0.55205244",
"0.550... | 0.72476137 | 0 |
Send null value in EMonth fields | def test_15(self):
assert 'False' == Api.requestBlock('test-15') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def month(self):\n return 0",
"def month(self):\n return 0",
"def _get_blank_value_19(field):\n if field.null:\n return None\n else:\n return ''",
"def _fill_date(self):\n if not self.date['year']:\n self.date['year'] = self.DEFAULT_DATE['year']\n if... | [
"0.5866896",
"0.5866896",
"0.57713896",
"0.5746307",
"0.57161075",
"0.56837165",
"0.5625904",
"0.55780524",
"0.5558474",
"0.54825336",
"0.53664184",
"0.532997",
"0.5325653",
"0.530205",
"0.52342147",
"0.5223373",
"0.5202048",
"0.51526874",
"0.5086805",
"0.5086271",
"0.5052253... | 0.0 | -1 |
Send special characters in EMonth fields | def test_16(self):
assert 'False' == Api.requestBlock('test-16') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _french_month(month):\n mois = \"janvfévrmarsavr-mai-juinjuilaoûtseptoct-nov-déc-\"\n mois_loc = re.search(month.lower(), mois.lower())\n if mois_loc:\n mois_no = (mois_loc.start() + 4) / 4\n return \"0{}\".format(mois_no)",
"def _monthName(self, month):\n if month is not None:\... | [
"0.5688062",
"0.5482961",
"0.548005",
"0.5468909",
"0.54230297",
"0.5412855",
"0.530084",
"0.52983487",
"0.52577066",
"0.51923347",
"0.5177958",
"0.5175429",
"0.5157469",
"0.5145739",
"0.51417935",
"0.5081514",
"0.5069298",
"0.5042676",
"0.5035212",
"0.5016211",
"0.5014319",
... | 0.0 | -1 |
Send boundary values EMonth field (EMonth= 12) | def test_19(self):
assert 'True' == Api.requestBlock('test-19') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_Month(self, value):\n super(GetTimestampFromDateParametersInputSet, self)._set_input('Month', value)",
"def effective_invoice_month(self) -> pulumi.Input['GoogleTypeDateArgs']:\n return pulumi.get(self, \"effective_invoice_month\")",
"def _build_efem_month(self,list_efem_month):\n\n ... | [
"0.5634143",
"0.54065627",
"0.53806704",
"0.5306783",
"0.5197246",
"0.5181283",
"0.5181283",
"0.51676494",
"0.51546735",
"0.51468223",
"0.51246095",
"0.51028955",
"0.5069277",
"0.50182337",
"0.5016101",
"0.49582988",
"0.49270567",
"0.49263218",
"0.48897153",
"0.483824",
"0.48... | 0.0 | -1 |
Send boundary values EMonth field (EMonth= 01) | def test_22(self):
assert 'True' == Api.requestBlock('test-22') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_Month(self, value):\n super(GetTimestampFromDateParametersInputSet, self)._set_input('Month', value)",
"def _build_efem_month(self,list_efem_month):\n\n def add_value_dict(key, dict_data, msj=None):\n if key in dict_data.keys():\n dict_data[key] = dict_data[key] + ... | [
"0.56795377",
"0.5456256",
"0.5432058",
"0.5432058",
"0.5389009",
"0.5362143",
"0.5330217",
"0.52422476",
"0.52419305",
"0.52336526",
"0.5153409",
"0.5141174",
"0.5082032",
"0.5056412",
"0.50128525",
"0.49637815",
"0.49588114",
"0.49463055",
"0.489759",
"0.48916426",
"0.48840... | 0.0 | -1 |
Initializes InvalidUsername with an error message. | def __init__(self, msg):
self.msg = msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, username: str) -> None:\n try:\n check_string(username, 'username', 'a-z0-9', 100)\n except IllegalParameterError as e:\n raise IllegalUsernameError(e.message) from e\n self.name = username",
"def username_error(self, msg):\n raise NotImplement... | [
"0.7104705",
"0.6829881",
"0.6761184",
"0.6483541",
"0.6251707",
"0.6137439",
"0.60849506",
"0.6066154",
"0.60328996",
"0.60174",
"0.5974511",
"0.59486985",
"0.59322745",
"0.59095454",
"0.5881767",
"0.5851913",
"0.58311576",
"0.5790885",
"0.5769815",
"0.57687426",
"0.57497245... | 0.0 | -1 |
Initializes InvalidUserTag with an error message. | def __init__(self, msg):
self.msg = msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(tag, message=None):\n Log._post(\"error\", tag, message)",
"def __init__(self, message=\"\"):\n super(ValidationError, self).__init__(message)",
"def __init__(self, error_msg):\n super(SdkException, self).__init__()\n self.error_msg = error_msg",
"def __init__(self, mess... | [
"0.56462985",
"0.54964924",
"0.536261",
"0.5255886",
"0.52409583",
"0.5214799",
"0.51638514",
"0.51309276",
"0.512227",
"0.5116152",
"0.50880295",
"0.5065294",
"0.50539815",
"0.5043654",
"0.50230527",
"0.5009636",
"0.49937543",
"0.499186",
"0.49844167",
"0.49798706",
"0.49764... | 0.0 | -1 |
Initializes InvalidProfilePicturePath with an error message. | def __init__(self, msg):
self.msg = msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_profile_picture_invalid_image_fails(self):\n image_upload_url = PROCEDURE_URL\n\n payload = {\n 'name': 'temp',\n 'speciality': [self.speciality.pk],\n 'image': 'invalid image',\n 'overview': 'bla bla bla'\n }\n\n res = self.clie... | [
"0.5651921",
"0.5624119",
"0.56222874",
"0.5336274",
"0.52178127",
"0.52178127",
"0.52178127",
"0.51103395",
"0.5086884",
"0.5018844",
"0.49850813",
"0.49842182",
"0.49580494",
"0.49038544",
"0.49034742",
"0.48773718",
"0.48606312",
"0.48144424",
"0.47821972",
"0.4751558",
"0... | 0.0 | -1 |
Return the name of the device if any. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")",
"def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")",
"def name(self):\n return self._device.name",
"def name(self):\n return self._device.name",
"def name(self):... | [
"0.89734465",
"0.89734465",
"0.8584627",
"0.8584627",
"0.8584627",
"0.8502048",
"0.84944665",
"0.84194607",
"0.83955586",
"0.83955586",
"0.8379756",
"0.83165",
"0.8306566",
"0.8161454",
"0.81564134",
"0.8090303",
"0.8087526",
"0.8073198",
"0.8006941",
"0.7999654",
"0.79544145... | 0.0 | -1 |
Return the device state attributes. | def device_state_attributes(self):
attrs = {}
attrs[ATTR_ATTRIBUTION] = DEFAULT_ATTRIBUTION
attrs[ATTR_BRAND] = DEFAULT_BRAND
attrs[ATTR_CAMERA_TYPE] = self._camera_type
return attrs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\r\n return self._attributes",
"def device_state_attributes(self):\n return self._attrs",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self... | [
"0.93173087",
"0.9245708",
"0.92207897",
"0.92147964",
"0.92147964",
"0.9210798",
"0.9210798",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
... | 0.8087728 | 66 |
takes clean str from self.text and creats dict of word length freq. | def makeWordLengths(self):
clean_s = self.cleanString(self.text)
LoW = clean_s.split()
for x in LoW:
if len(x) not in self.wordlengths:
self.wordlengths[len(x)] = 1
else:
self.wordlengths[len(x)] += 1
return self.wordlen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wordFreq(parseThis):\n \n freq = {}\n nono = ('\"', \"'\", '%', '$', '!', '.', '?', '-', ','\n , '\\n', '\\t', '\\r', ':', ';')\n\n for c in nono:\n parseThis = parseThis.replace(c, \" \")\n \n words = parseThis.split()\n \n for word in words:\n temp = word.... | [
"0.72095066",
"0.71612656",
"0.71218807",
"0.711714",
"0.7092993",
"0.7040645",
"0.7019579",
"0.6963053",
"0.6958046",
"0.6943951",
"0.6904577",
"0.68902737",
"0.6876883",
"0.6857476",
"0.68253565",
"0.68212354",
"0.6773053",
"0.6735119",
"0.67350656",
"0.668967",
"0.6683868"... | 0.6272309 | 57 |
takes clean str from self.text and creats dict of word freq. | def makeWords(self):
clean_s = self.cleanString(self.text)
LoW = clean_s.split()
for x in LoW:
if x not in self.words:
self.words[x] = 1
else:
self.words[x] += 1
return self.words | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wordFreq(parseThis):\n \n freq = {}\n nono = ('\"', \"'\", '%', '$', '!', '.', '?', '-', ','\n , '\\n', '\\t', '\\r', ':', ';')\n\n for c in nono:\n parseThis = parseThis.replace(c, \" \")\n \n words = parseThis.split()\n \n for word in words:\n temp = word.... | [
"0.74459994",
"0.74220663",
"0.7391444",
"0.7324509",
"0.7309391",
"0.7289624",
"0.7283719",
"0.7226567",
"0.722053",
"0.7219711",
"0.72076803",
"0.7172384",
"0.7164771",
"0.7158287",
"0.7152727",
"0.7031354",
"0.6992306",
"0.69521797",
"0.691885",
"0.6871911",
"0.68676853",
... | 0.6263762 | 93 |
Test default product price being 10. | def test_default_product_price(self):
prod = product('Test Product')
self.assertEqual(prod.price, 10)
self.assertEqual(prod.weight, 20) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_product_price(self):\n prod = Product('Test Product')\n self.assertEqual(prod.price, 10)",
"def test_default_product_price(self):\n prod = Product('Test Product')\n self.assertEqual(prod.price, 10)",
"def test_default_product_price(self):\n prod = Product('Te... | [
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.87333673",
"0.8580199",
"0.7287374",
"0.72686666",
"0.72686666",
"0.72686666",
"0.72686666",
"0.72686666",
"0.72686666",
"0.726349... | 0.8610413 | 12 |
Test that node names are set correctly for linear ops turned into matmul/add in onnx. | def test_set_node_name_for_matmul_add_linear(self, export_args):
class Linear(torch.nn.Module):
def __init__(self):
super(Linear, self).__init__()
self.linear = torch.nn.Linear(3, 2)
def forward(self, inp):
x = self.linear(inp)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_onnx_node_name_to_input_output_names_util(self):\n model = models.resnet18(pretrained=False)\n dummy_input = torch.randn(1, 3, 224, 224)\n torch.onnx.export(model, dummy_input, './data/resnet18.onnx')\n onnx_utils.OnnxSaver.set_node_names('./data/resnet18.onnx', model, dummy_in... | [
"0.6792893",
"0.67721677",
"0.65422505",
"0.61988956",
"0.6150528",
"0.6148229",
"0.5965357",
"0.59260803",
"0.5876603",
"0.58762425",
"0.584769",
"0.5770553",
"0.57376754",
"0.5707993",
"0.5700042",
"0.5673199",
"0.5655918",
"0.56137747",
"0.5602277",
"0.5545079",
"0.5532079... | 0.7743685 | 0 |
Return a list of segments (as strings) from a word Characters that are not valid segments are included in the list as individual characters. | def segs_safe(self, word, normalize=True):
if normalize:
word = FeatureTable.normalize(word)
return self._segs(word, include_invalid=True, normalize=normalize) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segment(text: str) -> List[str]:\n\n if not text or not isinstance(text, str):\n return []\n\n return _cut_subword(_cut_etcc.word_tokenize(text))",
"def slice(self, word):\n # Short words aren't hyphenated.\n if len(word) <= 4:\n return [word]\n # If the word is a... | [
"0.68789977",
"0.6741519",
"0.65025",
"0.6010337",
"0.6006612",
"0.5996679",
"0.5950866",
"0.5939301",
"0.5936155",
"0.5838023",
"0.58029926",
"0.5797689",
"0.5774421",
"0.572342",
"0.5713739",
"0.57017034",
"0.5683238",
"0.56335175",
"0.5613616",
"0.5602126",
"0.55915654",
... | 0.59464043 | 7 |
Return a string like the input but containing only legal IPA segments | def filter_string(self, word, normalize=True):
return ''.join(self.ipa_segs(word, normalize)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compact(number):\n number = clean(number, ' ').upper().strip()\n if number.startswith('AL'):\n number = number[2:]\n if number.startswith('(AL)'):\n number = number[4:]\n return number",
"def dummy_junction14():\n return \"junction:chr1:176-324:+\"",
"def defangIPaddr(address):... | [
"0.54550743",
"0.54391927",
"0.53663737",
"0.5322689",
"0.5241737",
"0.52362967",
"0.5214989",
"0.52047104",
"0.519561",
"0.51782346",
"0.5152315",
"0.51449424",
"0.51403505",
"0.5121869",
"0.50963056",
"0.506933",
"0.50592506",
"0.5054341",
"0.5052699",
"0.5051405",
"0.50455... | 0.5909749 | 0 |
group([0,3,4,10,2,3], 2) => iterator Group an iterable into an ntuples iterable. Incomplete tuples are padded with Nones e.g. >>> list(group(range(10), 3)) [(0, 1, 2), (3, 4, 5), (6, 7, 8), (9, None, None)] | def group(lst, n):
iters = tee(lst, n)
iters = [iters[0]] + [chain(iter, repeat(None))
for iter in iters[1:]]
return izip(
*[islice(iter, i, None, n) for i, iter
in enumerate(iters)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grouper(iterable: Iterable, n: int, fillvalue: Any = None) -> Iterator[tuple]:\n # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx\"\n # pylint: disable=invalid-name\n args = [iter(iterable)] * n\n # pylint: enable=invalid-name\n return itertools.zip_longest(*args, fillvalue=fillvalue)",
"def group... | [
"0.80415297",
"0.8012354",
"0.7891814",
"0.78612876",
"0.7830936",
"0.7768379",
"0.77457225",
"0.774194",
"0.774194",
"0.7739891",
"0.7731009",
"0.7731009",
"0.7730615",
"0.7714614",
"0.7697723",
"0.76915014",
"0.76890963",
"0.76890963",
"0.76738936",
"0.76717544",
"0.7668773... | 0.71935266 | 33 |
Convert the passed values to colormap. | def get_colormap(level_values: np.ndarray) -> np.ndarray:
color_dimension = level_values # change to desired fourth dimension
color_min, color_max = color_dimension.min(), color_dimension.max()
norm = colors.Normalize(color_min, color_max)
m = plt.cm.ScalarMappable(norm=norm, cmap="Spec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __value2color(self, v):\n if np.isscalar(v):\n r = self.cmap(self.norm(np.asarray([v])))\n else:\n r = self.cmap(self.norm(v))\n return r.flatten()",
"def get_colormap(values, cmap='jet', colorbar=True, log=False):\n by_value = not isinstance(values, int)\n if... | [
"0.7223537",
"0.70907754",
"0.6728139",
"0.6724819",
"0.66896755",
"0.66573834",
"0.65715116",
"0.64982826",
"0.6465033",
"0.6465033",
"0.6465033",
"0.6465033",
"0.6443659",
"0.6338098",
"0.63217264",
"0.6303877",
"0.6251594",
"0.6230061",
"0.62153965",
"0.6132751",
"0.609306... | 0.6442322 | 13 |
Returns True if the self rank is higher than the other rank | def __lt__(self,other):
return self.rank() < other.rank() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return int(self.rank) > int(other.rank)",
"def __ge__(self, other):\n return int(self.rank) >= int(other.rank)",
"def __le__(self, other):\n return int(self.rank) <= int(other.rank)",
"def __gt__(self, other):\n return self.eval_score < other.eval_sc... | [
"0.8275582",
"0.79964995",
"0.7796771",
"0.72897935",
"0.716286",
"0.714543",
"0.7067061",
"0.7035331",
"0.7034307",
"0.70110303",
"0.69910157",
"0.69268256",
"0.6925097",
"0.69192606",
"0.6889218",
"0.68517315",
"0.68517315",
"0.6849785",
"0.6836221",
"0.6831901",
"0.6809451... | 0.69531363 | 11 |
Loads yaml file. Arguments | def load(path: str='config.yaml'):
file = Path(path).open()
result = yaml.safe_load(file)
debug(f'YAML file {path} loaded and parsed succesful')
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadFromFile(self,filename):\n path = os.path.dirname(__file__)+\"/\"+filename\n if os.path.exists(path) and os.path.isfile(path):\n self.load(yaml.load(open(path, 'r')))",
"def load_yaml(filename):\n try:\n f = file(filename, 'r')\n data = yaml.load(f)\n return data\n e... | [
"0.77729696",
"0.7398894",
"0.73696256",
"0.73671806",
"0.7323886",
"0.7295187",
"0.7261868",
"0.72600996",
"0.7254409",
"0.72472084",
"0.722904",
"0.7219554",
"0.7214941",
"0.7211812",
"0.7204388",
"0.716829",
"0.7168116",
"0.71676886",
"0.71614975",
"0.7131892",
"0.71218497... | 0.6669963 | 61 |
Check that the board used is large enough and has enough valid tiles for the given list of players, raises a ValueError if any of these conditions are not met. | def __check_board_is_valid(self, board, players):
total_tiles = board.get_rows() * board.get_cols()
# check the board is big enough
if total_tiles < (6 - len(players)) * len(players):
raise ValueError("Board specified by board_size is too small.")
# check that the board has e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_board(board):\n valid = len(board) == 9\n valid &= -1 <= sum(board) <= 1\n valid &= reduce(lambda x, y: x and y, [utils.is_valid_player(p) for p in board])\n return valid",
"def test_generate_board_too_many_mines_errors(self):\n # arrange\n game = minesweeper.Minesweeper()\... | [
"0.6559245",
"0.65429807",
"0.6363457",
"0.63405097",
"0.6310487",
"0.61935323",
"0.61810786",
"0.61345714",
"0.60889655",
"0.6072533",
"0.5982412",
"0.5976069",
"0.5964283",
"0.59554005",
"0.5949775",
"0.59412664",
"0.59252197",
"0.5920554",
"0.59201723",
"0.5910528",
"0.589... | 0.8507374 | 0 |
Get the player scores. | def get_scores(self):
return [(self.players[p.get_color()], p.get_score()) for p in self.state.get_players()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_scores(self):\n return self.score",
"def get_score(self, player):\n if player in self.player_scores:\n return self.player_scores[player]\n else:\n raise Exception(\"Player not in score list\")",
"def score(self):\n return self.client.call('GET', self.na... | [
"0.81142956",
"0.7553951",
"0.738606",
"0.7267321",
"0.719919",
"0.71760154",
"0.7120312",
"0.704196",
"0.6985496",
"0.6970983",
"0.6936181",
"0.6799197",
"0.6795344",
"0.6784494",
"0.6777752",
"0.67771673",
"0.6773122",
"0.6722797",
"0.6709587",
"0.66867256",
"0.66849506",
... | 0.8255623 | 0 |
Get a rule violators who have been ejected. | def get_violators(self):
return self.violators | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affecteds(self):\n return [m for m in self.members if m.disease == PedigreeMember.AFFECTED]",
"def get_victors(self):\n if self.is_game_over():\n scores = [p.get_score() for p in self.state.get_players()]\n if len(scores) == 0:\n return []\n max_s... | [
"0.6156995",
"0.59065264",
"0.5629059",
"0.5474041",
"0.53551775",
"0.52045214",
"0.5177488",
"0.50929904",
"0.5079941",
"0.5059264",
"0.5059264",
"0.5011072",
"0.4973407",
"0.49627775",
"0.4929745",
"0.4920347",
"0.4912848",
"0.4911266",
"0.4906332",
"0.48964974",
"0.4874137... | 0.61693317 | 0 |
Get a copy of the current state. | def get_current_state(self):
return deepcopy(self.state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n return copy.deepcopy(self._state)",
"def __getstate__(self):\n state = self.__dict__.copy()\n self.__cleanState__(state)\n return state",
"def state(self):\n return self._state.copy()",
"def get_state(self, deepcopy: bool = True):\n s = self.cache_... | [
"0.8455732",
"0.79240113",
"0.78669524",
"0.78233796",
"0.76678777",
"0.76537627",
"0.7607961",
"0.75942713",
"0.7512252",
"0.74859667",
"0.74796313",
"0.7326282",
"0.7263944",
"0.7236717",
"0.7214216",
"0.7181021",
"0.7169202",
"0.71566755",
"0.715247",
"0.7142748",
"0.71140... | 0.81724 | 1 |
Sigmoid backward (derivative) implementation | def sigmoid_backward(dA, Z):
dsig = sigmoid(Z) * (1 - sigmoid(Z))
return dA * dsig | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_derivative(x):\n return x * (1-x)",
"def sigmoid_derivative(x):\n return x * (1.0 - x)",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))",
"def sigmoid_bac... | [
"0.85681444",
"0.8473839",
"0.831426",
"0.831426",
"0.8309925",
"0.8075164",
"0.80000556",
"0.79696095",
"0.79516095",
"0.7931595",
"0.7929404",
"0.7801728",
"0.7743298",
"0.7714867",
"0.7661006",
"0.76579946",
"0.7626087",
"0.76228863",
"0.7605027",
"0.753502",
"0.75197905",... | 0.82721937 | 5 |
Register a new queue in the pool catalog. This method should be called whenever a new queue is being created, and will create an entry in the pool catalog for the given queue. After using this method to register the queue in the catalog, the caller should call `lookup()` to get a reference to a storage driver which wil... | def register(self, queue, project=None, flavor=None):
# NOTE(gengchc): if exist, get queue's pool.flavor:
# if queue's pool.flavor is different, first delete it and add it.
# Otherwise, if the flavor in the meteredata of the queue is
# modified, the catalog will be inconsistent.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register(self, queue, project=None):\n # NOTE(cpp-cabrera): only register a queue if the entry\n # doesn't exist\n if not self._catalogue_ctrl.exists(project, queue):\n # NOTE(cpp-cabrera): limit=0 implies unlimited - select from\n # all shards\n shard = se... | [
"0.71361166",
"0.6695945",
"0.64565563",
"0.6338736",
"0.6160316",
"0.6083422",
"0.5962883",
"0.59370244",
"0.5895258",
"0.5773519",
"0.5767887",
"0.5727844",
"0.5669611",
"0.5621137",
"0.55773187",
"0.5558326",
"0.5552847",
"0.55482846",
"0.55192804",
"0.5471164",
"0.5442383... | 0.7536504 | 0 |
Open the URL for the given DOI in the default browser | def open_doi(doi):
webbrowser.open_new_tab(DOI_URL % doi) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_in_browser(self):\n webbrowser.open(self.url)",
"def open(url):\r\n webbrowser.open(url)",
"def browser_open(story_id, arguments):\r\n\r\n story = load_story(story_id, arguments)\r\n\r\n webbrowser.open(story.url)",
"def open_url(name):\n url = localReadConfig.get_webServer(name)\... | [
"0.7175303",
"0.70528334",
"0.6925984",
"0.68447846",
"0.66982275",
"0.6694972",
"0.654901",
"0.65459543",
"0.64876926",
"0.6484498",
"0.6445093",
"0.64057773",
"0.63870794",
"0.6381969",
"0.63739616",
"0.6357972",
"0.6353263",
"0.62887174",
"0.62686133",
"0.6265236",
"0.6234... | 0.82702404 | 0 |
Test if the add operation returns the correct result for a test case | def test_add_int(self):
self.assertEqual(operations.add(3,4), 7) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_returns_correct_result(self):\n result = self.calc.add(2, 2)\n self.assertEqual(4, result)",
"def test_add(self):\n self.assertEqual(add(1, 1), 2, \"Wrong answer\")\n self.assertEqual(add(10, 1), 11, \"Wrong answer\")\n self.assertEqual(add(15, 15), 30, \"Wrong ans... | [
"0.87641716",
"0.8728581",
"0.85901284",
"0.83460325",
"0.8322828",
"0.82488525",
"0.82488525",
"0.82488525",
"0.8183821",
"0.8175811",
"0.80814475",
"0.8047177",
"0.8006275",
"0.79732543",
"0.79165095",
"0.7913617",
"0.7900404",
"0.77927405",
"0.7747016",
"0.774245",
"0.7690... | 0.8132406 | 10 |
Unit test for Roybal_Student_Analytics constructor. | def test_init(self):
s = Student_Analytics()
self.assertEqual(len(s.data),89) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, student):\n pass",
"def __init__(self, student, start_date, day_periods):\n self.student = student\n self.start_date = start_date\n self.day_periods = day_periods\n self.student_name = student.full_name_lastname_first(\n show_middle_name=False)\n ... | [
"0.6371787",
"0.6314157",
"0.6181478",
"0.6096545",
"0.6089736",
"0.60254514",
"0.5956355",
"0.59550136",
"0.594131",
"0.58837605",
"0.58226454",
"0.5809876",
"0.57946306",
"0.5790085",
"0.578611",
"0.57836026",
"0.57833344",
"0.57766145",
"0.5764777",
"0.5755531",
"0.574614"... | 0.75536776 | 0 |
Returns the network connected to the tenant router. Assumes a single router with a single tenant network connected. | def _tenant_network(self):
port = self._connection.network.ports.find_by_device_owner('network:router_interface')
if port:
return self._connection.network.networks.get(port.network_id)
else:
raise errors.ImproperlyConfiguredError('Could not find tenancy network') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _external_network(self):\n try:\n router = next(self._connection.network.routers.all())\n except StopIteration:\n raise errors.ImproperlyConfiguredError('Could not find tenancy router.')\n return self._connection.network.networks.get(router.external_gateway_info['netw... | [
"0.77449316",
"0.7281764",
"0.7092121",
"0.70122546",
"0.6769052",
"0.6733666",
"0.6733666",
"0.6733666",
"0.6582788",
"0.65117043",
"0.6201502",
"0.61733115",
"0.6108502",
"0.60738486",
"0.60403067",
"0.6020271",
"0.600645",
"0.5939682",
"0.5937701",
"0.5896336",
"0.58795285... | 0.796581 | 0 |
Returns the cluster manager for the tenancy. | def cluster_manager(self):
# Lazily instantiate the cluster manager the first time it is asked for.
if not hasattr(self, '_cluster_manager'):
if self._cluster_engine:
self._cluster_manager = self._cluster_engine.create_manager(
self._username,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetManager(self):\r\n\r\n return self.manager",
"def cluster(self):\n return self._cluster",
"def cluster(self):\n return self._cluster",
"def get_manager(api_version=None):\n from manager import get_keystone_manager\n return get_keystone_manager(get_local_endpoint(), get_admin... | [
"0.66724825",
"0.665754",
"0.665754",
"0.66434646",
"0.663374",
"0.6481853",
"0.6345078",
"0.6344062",
"0.62795883",
"0.6278968",
"0.62144953",
"0.60009164",
"0.59885573",
"0.5977996",
"0.59189504",
"0.5905458",
"0.5904256",
"0.5867709",
"0.5859221",
"0.58005214",
"0.5737495"... | 0.85531485 | 0 |
Computes the forward pass for a layer of rectified linear units (ReLUs). | def relu_forward(x):
out = None
###########################################################################
# TODO: Implement the ReLU forward pass. #
###########################################################################
#out = np.zeros(x.shape)
#np.clip(x,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_relus(self):\n\n def relu_backward_hook_function(module, grad_in, grad_out):\n \"\"\"\n If there is a negative gradient, change it to zero\n \"\"\"\n # Get last forward output\n corresponding_forward_output = self.forward_relu_outputs[-1]\n ... | [
"0.6775336",
"0.6629373",
"0.6602302",
"0.6523369",
"0.6508466",
"0.64465874",
"0.63842785",
"0.626676",
"0.620465",
"0.6178559",
"0.61525744",
"0.613782",
"0.60611176",
"0.6054329",
"0.6047199",
"0.6046748",
"0.59962803",
"0.5989819",
"0.596913",
"0.5962442",
"0.5948833",
... | 0.60177517 | 16 |
Computes the backward pass for a layer of rectified linear units (ReLUs). | def relu_backward(dout, cache):
dx, x = None, cache
###########################################################################
# TODO: Implement the ReLU backward pass. #
###########################################################################
#print(dout)
dx ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relu_backward(self, dUpper, cache):\n x = cache\n #############################################################################\n # TODO: Implement the ReLU backward pass. #\n #########################################################################... | [
"0.70412636",
"0.694716",
"0.6897693",
"0.6847592",
"0.6847592",
"0.6846935",
"0.6841099",
"0.68178034",
"0.6766849",
"0.6754919",
"0.67536426",
"0.67530656",
"0.67419785",
"0.6739244",
"0.6713423",
"0.6708748",
"0.6699276",
"0.6696307",
"0.6696307",
"0.66860896",
"0.6665928"... | 0.66615254 | 25 |
Forward pass for batch normalization. During training the sample mean and (uncorrected) sample variance are computed from minibatch statistics and used to normalize the incoming data. During training we also keep an exponentially decaying running mean of the mean and variance of each feature, and these averages are use... | def batchnorm_forward(x, gamma, beta, bn_param):
mode = bn_param['mode']
eps = bn_param.get('eps', 1e-5)
momentum = bn_param.get('momentum', 0.9)
N, D = x.shape
running_mean = bn_param.get('running_mean', np.zeros(D, dtype=x.dtype))
running_var = bn_param.get('running_var', np.zeros(D, dtype=x.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(self, x, train=True):\n if train is not None:\n mean, variance = tf.nn.moments(x, [0,1,2])\n assign_mean = self.mean.assign(mean)\n assign_variance = self.variance.assign(variance)\n with tf.control_dependencies([assign_mean, assign_variance]):\n return tf.nn.batch_norm_... | [
"0.73375744",
"0.7016016",
"0.69402426",
"0.6930308",
"0.6890035",
"0.6870713",
"0.6845096",
"0.6766321",
"0.67575425",
"0.6714171",
"0.67051464",
"0.6647627",
"0.65995526",
"0.65970504",
"0.65763676",
"0.6518246",
"0.6511042",
"0.6459731",
"0.64524907",
"0.64098454",
"0.6387... | 0.6935189 | 3 |
A naive implementation of the forward pass for a maxpooling layer. | def max_pool_forward(x, pool_param):
out = None
###########################################################################
# TODO: Implement the max-pooling forward pass #
###########################################################################
N, C, H, W = x.shape
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_pool_forward_naive(x, pool_param):\n out = None\n ###########################################################################\n # TODO: Implement the max pooling forward pass #\n ###########################################################################\n N,C,H,W ... | [
"0.78478473",
"0.77464086",
"0.7588915",
"0.75831836",
"0.75474185",
"0.74184185",
"0.7378611",
"0.7318571",
"0.72232896",
"0.71326613",
"0.7098723",
"0.70758176",
"0.6990659",
"0.69255495",
"0.69221073",
"0.68792313",
"0.68130654",
"0.68058133",
"0.6792034",
"0.6792034",
"0.... | 0.74050933 | 6 |
Recommended maximum number of datapoints Returns int | def recommended_max_num_datapoints(self) -> int:
# very large number, essentially no limit by default
return 1e9 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graph_data_size_max(self) -> int:\n return int(self.graph_tuple_stats.graph_data_size_max or 0)",
"def get_minimum_number_of_data_points(cls):\n return cls._MINIMUM_NUMBER_OF_DATA_POINTS",
"def numberOfPoints(self):\n return 20000",
"def data_edge_count_max(self) -> int:\n return int(... | [
"0.74292016",
"0.74018806",
"0.7281152",
"0.7237732",
"0.7090521",
"0.6958116",
"0.6913622",
"0.68758655",
"0.6854837",
"0.68302363",
"0.67935854",
"0.6772748",
"0.6769792",
"0.67452073",
"0.67428017",
"0.67161715",
"0.66959566",
"0.668196",
"0.66803277",
"0.6658686",
"0.6651... | 0.87322336 | 0 |
Get item from self.human_data. | def prepare_raw_data(self, idx: int):
info = super().prepare_raw_data(idx)
if self.cache_reader is not None:
self.human_data = self.cache_reader.get_item(idx)
idx = idx % self.cache_reader.slice_size
if 'smplx' in self.human_data:
smplx_dict = self.human_data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item(self):\n return self.item",
"def get_item(self):\n return self.item",
"def __getitem__(self, item):\n return self._data[item]",
"def __getitem__(self, item):\n return self.data[item]",
"def __getitem__(self, item):\n return self.data[item]",
"def __getitem_... | [
"0.7406864",
"0.7406864",
"0.73144776",
"0.7309078",
"0.7309078",
"0.7309078",
"0.7219982",
"0.71420383",
"0.71420383",
"0.71420383",
"0.70934916",
"0.70712644",
"0.7018385",
"0.7018385",
"0.70036954",
"0.70014024",
"0.7000123",
"0.6842417",
"0.6842417",
"0.6842417",
"0.67811... | 0.0 | -1 |
Name of the dataset. | def get_name(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataset_name(self):\n return self.dataset.name",
"def dataset_name(self):\n return self._dataset_name",
"def get_dataset_name(self):\n raise NotImplementedError",
"def get_dataset_name(self):\n return self.dataset_name",
"def __get_dataset_name(self):\n d = gdal.Open(... | [
"0.919469",
"0.8976905",
"0.87083614",
"0.8686752",
"0.7850114",
"0.7471211",
"0.7451666",
"0.74262846",
"0.7378664",
"0.73779565",
"0.7199527",
"0.70992815",
"0.70992815",
"0.70992815",
"0.6962095",
"0.6886322",
"0.6757635",
"0.6693697",
"0.667641",
"0.6673114",
"0.6660524",... | 0.0 | -1 |
Converts examples into TexttoText batches to be used with a model like T5. Inputs are prefixed with a text prompt that indicates the task to perform. | def convert_examples_to_features(self):
features = []
for ex_index, example in enumerate(self.examples):
if ex_index % 10000 == 0:
logging.info(f"Writing example {ex_index} of {len(self.examples)}")
text_to_text_query = self.processor.get_t5_prompted_query(exampl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_tokenize_fn(examples):\n sources = examples[config.source_lang]\n targets = examples[config.target_lang]\n model_inputs = config.tokenizer(sources, max_length=config.max_source_length, truncation=True)\n\n # setup the tokenizer for targets,\n # huggingface expects the target tokenized ids ... | [
"0.61118716",
"0.592422",
"0.58838516",
"0.585979",
"0.5801184",
"0.5781311",
"0.57746387",
"0.57520574",
"0.57209575",
"0.56961864",
"0.5692046",
"0.5686498",
"0.5684553",
"0.5684334",
"0.56032795",
"0.5577988",
"0.55708474",
"0.55665946",
"0.55582416",
"0.5552899",
"0.55346... | 0.56218064 | 14 |
Converts examples into TexttoText batches to be used with a model like T5. Inputs are prefixed with a text prompt that indicates the task to perform. | def convert_xnli_examples_to_features(self):
features = self.features
lang_filtered_features = []
for ex_index, example in enumerate(self.examples):
language = example.guid.split('-')[1]
if language in self.lang_list:
lang_filtered_features.append(features... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_tokenize_fn(examples):\n sources = examples[config.source_lang]\n targets = examples[config.target_lang]\n model_inputs = config.tokenizer(sources, max_length=config.max_source_length, truncation=True)\n\n # setup the tokenizer for targets,\n # huggingface expects the target tokenized ids ... | [
"0.6111713",
"0.5924071",
"0.58839375",
"0.5859931",
"0.5800309",
"0.5781618",
"0.5774486",
"0.57522273",
"0.57205606",
"0.56961256",
"0.56917894",
"0.5685472",
"0.5684877",
"0.5684489",
"0.5622114",
"0.56032103",
"0.5577944",
"0.55711997",
"0.5566548",
"0.555741",
"0.5552782... | 0.0 | -1 |
r"""One could also use the Laplacian of Gaussian formula to design the filter. | def laplacian_1d(window_size) -> torch.Tensor:
filter_1d = torch.ones(window_size)
filter_1d[window_size // 2] = 1 - window_size
laplacian_1d: torch.Tensor = filter_1d
return laplacian_1d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(self, op=GaussianFilter):\n\n if self._verbose > 0:\n print(\"Filtering...\")\n\n # Import from utils specified params.\n params = get_filtering_params()\n\n negative = self.image_raw - op(sigma=params['sigma_bgd']).convolve(self.image_raw)\n\n self.image_fi... | [
"0.66963106",
"0.65597415",
"0.6478427",
"0.636755",
"0.6351325",
"0.6253081",
"0.62316626",
"0.62082386",
"0.617469",
"0.61242366",
"0.6101194",
"0.6060973",
"0.60049284",
"0.600304",
"0.60001606",
"0.59720194",
"0.59712464",
"0.59702766",
"0.5951012",
"0.59331256",
"0.59309... | 0.0 | -1 |
Get the expression adjustment parameter for certain samples. | def get_size_factor(samples, lib_file_path):
libs = np.loadtxt(lib_file_path, dtype='str', skiprows=1, delimiter='\t')
a, b = np.where(samples[:, np.newaxis] == libs[:, 0])
assert np.all(libs[b, 0] == samples)
libs = libs[b, :]
med = np.median(libs[:, 1].astype('float'))
sf = med / libs[:, 1].as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjustment(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"adjustment\")",
"def adjustment(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"adjustment\")",
"def adjustment(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"adjustment\")... | [
"0.5970573",
"0.5970573",
"0.5970573",
"0.5970573",
"0.5970573",
"0.5970573",
"0.5970573",
"0.5970573",
"0.55451614",
"0.5458691",
"0.5382217",
"0.5338391",
"0.52984136",
"0.52497977",
"0.5241062",
"0.5241062",
"0.52158433",
"0.5213984",
"0.5213984",
"0.5159911",
"0.5122732",... | 0.0 | -1 |
Get all combinations of items in the given array Specifically used for generating variant combination | def get_all_comb(array, r=None):
if r is None:
r = len(array)
return [_ for i in range(1, r + 1) for _ in itertools.combinations(array, i)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combinations(arrays):\n return np.array(np.meshgrid(*arrays)).T.reshape(-1, len(arrays))",
"def combos(array,n=2): \n # base case\n if n==0:\n yield frozenset()\n return\n\n # core recursion\n for c in set(combos(array,n-1)):\n for i in array:\n #added this t... | [
"0.73074627",
"0.7185561",
"0.6950121",
"0.67702305",
"0.67702305",
"0.6750947",
"0.6720031",
"0.6644649",
"0.6399782",
"0.63772047",
"0.63587743",
"0.6318727",
"0.62932175",
"0.62885773",
"0.62456626",
"0.6200499",
"0.6191303",
"0.61892384",
"0.61841613",
"0.6181527",
"0.616... | 0.79023576 | 0 |
Set the `order_by_field` on the filterset and ensure that the field name is respected. | def test_ordering_with_overridden_field_name(self):
class F(FilterSet):
class Meta:
model = User
fields = ['username', 'status']
order_by = ['status']
order_by_field = 'order'
f = F({'order': 'status'}, queryset=self.qs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ordering_with_overridden_field_name(self):\n class F(FilterSet):\n class Meta:\n model = User\n fields = ['username', 'status']\n order_by = ['status']\n order_by_field = 'order'\n\n f = F().form\n self.assertNotIn... | [
"0.7114981",
"0.6805322",
"0.65821075",
"0.6384245",
"0.6316189",
"0.6254384",
"0.6160399",
"0.60926193",
"0.59577346",
"0.59503293",
"0.59400135",
"0.5909272",
"0.5759706",
"0.57583076",
"0.57493776",
"0.5726326",
"0.5716653",
"0.571355",
"0.5712792",
"0.5647503",
"0.5642596... | 0.7341014 | 0 |
Test ordering descending works when order_by=True. | def test_ordering_descending_unset(self):
class F(FilterSet):
class Meta:
model = User
fields = ['username', 'status']
order_by = True
f = F({'o': '-username'}, queryset=self.qs)
self.assertQuerysetEqual(
f.qs, ['jacob', 'c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_orderby(self):\n\n # TODO: make a unit test out of these various combinations\n #m = mapper(User, users, order_by=desc(users.c.user_name))\n mapper(User, users, order_by=None)\n #mapper(User, users)\n\n #l = create_session().query(User).select(order_by=[desc(users.c.user... | [
"0.68660283",
"0.6728724",
"0.6677009",
"0.6650034",
"0.65972036",
"0.6469477",
"0.64451",
"0.6346018",
"0.62945986",
"0.62910104",
"0.6286649",
"0.6240998",
"0.6212203",
"0.619569",
"0.618064",
"0.61099553",
"0.6034809",
"0.5979432",
"0.59784126",
"0.59772485",
"0.59331065",... | 0.6622364 | 4 |
Set the `order_by_field` on the filterset and ensure that the field name is respected. | def test_ordering_with_overridden_field_name(self):
class F(FilterSet):
class Meta:
model = User
fields = ['username', 'status']
order_by = ['status']
order_by_field = 'order'
f = F().form
self.assertNotIn('o', f.fields... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ordering_with_overridden_field_name(self):\n class F(FilterSet):\n class Meta:\n model = User\n fields = ['username', 'status']\n order_by = ['status']\n order_by_field = 'order'\n\n f = F({'order': 'status'}, queryset=se... | [
"0.7341898",
"0.6805477",
"0.6581681",
"0.6385461",
"0.6315338",
"0.6252756",
"0.6159823",
"0.6090766",
"0.5956584",
"0.5951964",
"0.59386057",
"0.59089255",
"0.5759275",
"0.57582235",
"0.5749629",
"0.57229424",
"0.5717913",
"0.5713295",
"0.5711421",
"0.5647316",
"0.56422055"... | 0.7116057 | 1 |
Set the `order_by_field` on the filterset and ensure that the field name is respected. | def test_ordering_with_overridden_field_name_and_descending(self):
class F(FilterSet):
class Meta:
model = User
fields = ['username', 'status']
order_by = ['status', '-status']
order_by_field = 'order'
f = F().form
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ordering_with_overridden_field_name(self):\n class F(FilterSet):\n class Meta:\n model = User\n fields = ['username', 'status']\n order_by = ['status']\n order_by_field = 'order'\n\n f = F({'order': 'status'}, queryset=se... | [
"0.7341014",
"0.7114981",
"0.65821075",
"0.6384245",
"0.6316189",
"0.6254384",
"0.6160399",
"0.60926193",
"0.59577346",
"0.59503293",
"0.59400135",
"0.5909272",
"0.5759706",
"0.57583076",
"0.57493776",
"0.5726326",
"0.5716653",
"0.571355",
"0.5712792",
"0.5647503",
"0.5642596... | 0.6805322 | 2 |
Returns gdal.Band.GetNoDataValue() as a NumPy type | def GetNoDataValue(self):
result = super(Band, self).GetNoDataValue()
if result is not None:
return self.NumPyDataType(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_band_nodata(self, band_idx=1):\n if band_idx < 1 or band_idx > self.dataset.RasterCount:\n raise IndexError(\"band index is out of range\")\n return self.dataset.GetRasterBand(band_idx).GetNoDataValue()",
"def _nodata_value(self):\n try:\n nodata = float(self._i... | [
"0.7544999",
"0.7434405",
"0.7288697",
"0.6567842",
"0.6520311",
"0.6363698",
"0.6319562",
"0.62501335",
"0.6163293",
"0.61502856",
"0.61502856",
"0.61240387",
"0.6110622",
"0.60905856",
"0.590359",
"0.5895869",
"0.58876556",
"0.58424926",
"0.58220965",
"0.5796688",
"0.577856... | 0.86186093 | 0 |
Returns the minimum value that can be stored in this band | def MinimumValue(self):
datatype = self.NumPyDataType
if issubclass(datatype, numpy.integer):
return numpy.iinfo(datatype).min
elif issubclass(datatype, numpy.floating):
return -numpy.inf
else:
raise TypeError("Cannot handle DataType: {0}".format(datat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min(self):\n if self.kind == 'u':\n return 0\n else:\n try:\n val = iinfo._min_vals[self.key]\n except KeyError:\n val = int(-(1 << (self.bits-1)))\n iinfo._min_vals[self.key] = val\n return val",
"def min(... | [
"0.7944226",
"0.7944226",
"0.7937631",
"0.78972983",
"0.7884411",
"0.78611416",
"0.7846386",
"0.7778144",
"0.77733576",
"0.7762124",
"0.7680303",
"0.7642864",
"0.75792414",
"0.75792414",
"0.75784636",
"0.7551094",
"0.75474113",
"0.75474113",
"0.7521111",
"0.7521111",
"0.74849... | 0.7393505 | 28 |
Returns the minimum value that can be stored in this band | def MaximumValue(self):
datatype = self.NumPyDataType
if issubclass(datatype, numpy.integer):
return numpy.iinfo(datatype).max
elif issubclass(datatype, numpy.floating):
return numpy.inf
else:
raise TypeError("Cannot handle DataType: {0}".format(dataty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min(self):\n if self.kind == 'u':\n return 0\n else:\n try:\n val = iinfo._min_vals[self.key]\n except KeyError:\n val = int(-(1 << (self.bits-1)))\n iinfo._min_vals[self.key] = val\n return val",
"def min(... | [
"0.7944226",
"0.7944226",
"0.7937631",
"0.78972983",
"0.7884411",
"0.78611416",
"0.7846386",
"0.7778144",
"0.77733576",
"0.7762124",
"0.7680303",
"0.7642864",
"0.75792414",
"0.75792414",
"0.75784636",
"0.7551094",
"0.75474113",
"0.75474113",
"0.7521111",
"0.7521111",
"0.74849... | 0.0 | -1 |
Transforms pixel coordinates into the destination projection. If transform is None, no reprojection occurs and the dataset's SpatialReference is used. | def PixelCoordinates(self, x, y, transform=None):
# Assert that pixel_x and pixel_y are valid
if not 0 <= x <= self.RasterXSize:
raise ValueError('x %r is not between 0 and %d' %
(x, self.RasterXSize))
if not 0 <= y <= self.RasterYSize:
raise ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reproject(ds, dst_crs=None, dst_transform=None, width=None, height=None,\n res=None, extent=None, **kwargs):\n\n if 'resampling' not in kwargs:\n kwargs['resampling'] = rasterio.warp.Resampling.cubic\n\n src_crs = get_crs(ds)\n src_bounds = get_bounds(ds)\n if extent is not No... | [
"0.6720557",
"0.6548644",
"0.6337521",
"0.6230713",
"0.62149775",
"0.58759457",
"0.58334744",
"0.5782975",
"0.5738817",
"0.56981885",
"0.5647636",
"0.5635617",
"0.5624577",
"0.5602451",
"0.55902624",
"0.5584441",
"0.5567373",
"0.55569345",
"0.55569345",
"0.5550751",
"0.552929... | 0.5615591 | 13 |
Converts a signal name to canonical form. | def name2signal(string):
try:
v = int(string)
except ValueError:
if "_" in string:
raise ValueError("could not convert %r to signal name" % string)
s = string.upper()
if not s.startswith("SIG"):
s = "SIG" + s
v = getattr(signal, s, None)
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canonical_name(self, name):\n raise NotImplementedError",
"def _signal_to_common_name(signal: domain.Signal) -> str: # pragma: no cover\n stationb_map: domain.SIGNAL_MAP = {\n (550.0, 10.0, 610.0, 20.0): \"mRFP1\",\n (430.0, 10.0, 480.0, 10.0): \"ECFP\",\n (500.0, 10.0, 530.0,... | [
"0.70679617",
"0.672173",
"0.66685057",
"0.6528386",
"0.6398456",
"0.6284975",
"0.6257678",
"0.6253902",
"0.6199662",
"0.6199662",
"0.6164654",
"0.61454165",
"0.6111997",
"0.5949534",
"0.58953434",
"0.58953434",
"0.58953434",
"0.5865084",
"0.5847952",
"0.57750165",
"0.5761741... | 0.66648597 | 3 |
Dismiss the alarm that is currently running. | def dismiss(self):
self._get_backend().dismiss_alarm() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dismiss_reminder(self):\n qry = ServiceOperationQuery(self, \"dismissReminder\")\n self.context.add_query(qry)\n return self",
"def stop_animation(self):\n if self.animate_alarm:\n self.loop.remove_alarm(self.animate_alarm)\n self.animate_alarm = None",
"async ... | [
"0.6770825",
"0.6504499",
"0.6491621",
"0.6473124",
"0.6453558",
"0.6367585",
"0.6321344",
"0.61386096",
"0.60624015",
"0.60624015",
"0.59958225",
"0.5922445",
"0.5870512",
"0.5868287",
"0.5867719",
"0.5865545",
"0.58586764",
"0.58586764",
"0.58152795",
"0.58013976",
"0.57735... | 0.8574007 | 0 |
Sets the country of this Organization. | def country(self, country):
self._country = country | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def country(self, country):\n if country is None:\n raise ValueError(\"Invalid value for `country`, must not be `None`\")\n\n self._country = country",
"def domain_settings_set_country(self, country):\n return self._request('domain/settings/set_country', inspect_args_func(inspect.... | [
"0.7712507",
"0.71704066",
"0.6832151",
"0.6527378",
"0.65113974",
"0.62519395",
"0.62519395",
"0.6071815",
"0.6042363",
"0.5949575",
"0.5870461",
"0.56637245",
"0.558508",
"0.5546206",
"0.5546206",
"0.55045587",
"0.54971576",
"0.5478352",
"0.5457733",
"0.5457733",
"0.5406521... | 0.76674914 | 5 |
Sets the person_name of this Organization. | def person_name(self, person_name):
self._person_name = person_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, PersonName):\r\n self.name = PersonName",
"def org_name(self, org_name):\n\n self._org_name = org_name",
"def org_name(self, org_name):\n\n self._org_name = org_name",
"def set_person(self, person):\n if person.upper() == UNKNOWN.upper():\n self.perso... | [
"0.7833753",
"0.7134179",
"0.7134179",
"0.6688187",
"0.65317196",
"0.65317196",
"0.65103024",
"0.65103024",
"0.65096503",
"0.6446856",
"0.64192414",
"0.6416891",
"0.63956535",
"0.63956535",
"0.63956535",
"0.63956535",
"0.63956535",
"0.63945746",
"0.63945746",
"0.6344165",
"0.... | 0.8247543 | 1 |
Sets the email of this Organization. | def email(self, email):
self._email = email | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setEmail(self, email):\n self.email = email\n return self",
"def email(self, email: str):\n\n self._email = email",
"def email(self, email):\n if self.local_vars_configuration.client_side_validation and email is None: # noqa: E501\n raise ValueError(\"Invalid value f... | [
"0.8130456",
"0.7738362",
"0.7542091",
"0.7482652",
"0.7326202",
"0.72683007",
"0.72421545",
"0.71375",
"0.71375",
"0.686361",
"0.686361",
"0.686361",
"0.66893005",
"0.6623506",
"0.6539565",
"0.65185577",
"0.64557123",
"0.6449671",
"0.6417425",
"0.63945293",
"0.6345876",
"0... | 0.7769974 | 9 |
Sets the zip_post_code of this Organization. | def zip_post_code(self, zip_post_code):
self._zip_post_code = zip_post_code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zipcode(self, zipcode):\n self._zipcode = zipcode",
"def zip_code(self, zip_code):\n\n self._zip_code = zip_code",
"def postal_code(self, postal_code):\n\n self._postal_code = postal_code",
"def postal_code(self, postal_code):\n\n self._postal_code = postal_code",
"def posta... | [
"0.7381539",
"0.7371916",
"0.70360076",
"0.70360076",
"0.70360076",
"0.69919515",
"0.67918134",
"0.67918134",
"0.67918134",
"0.6679859",
"0.65118146",
"0.6351724",
"0.61154234",
"0.6063556",
"0.6023592",
"0.59138143",
"0.58627266",
"0.56648487",
"0.56164485",
"0.55818355",
"0... | 0.84573597 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.