query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Load an RSA key object from the provided raw key bytes. | def load_rsa_key(key, key_type, key_encoding):
# (bytes, EncryptionKeyType, KeyEncodingType) -> Any
# narrow down the output type
# https://github.com/aws/aws-dynamodb-encryption-python/issues/66
try:
loader = _RSA_KEY_LOADING[key_type][key_encoding]
except KeyError:
raise ValueError... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_pub_key_bytes(bs: bytes) -> rsa.RSAPublicKey:\n k = serialization.load_pem_public_key(bs)\n assert isinstance(k, rsa.RSAPublicKey)\n return k",
"def load_received_public_key_bytes(self, public_key_str):\n return self.load_received_public_key(\n VerifyingKey.from_string(public_... | [
"0.7208243",
"0.70755935",
"0.666694",
"0.65687746",
"0.6510906",
"0.6437169",
"0.63164747",
"0.6254293",
"0.6246368",
"0.6195578",
"0.61379737",
"0.612565",
"0.6102126",
"0.6098875",
"0.60632586",
"0.606191",
"0.60521996",
"0.604991",
"0.6013708",
"0.598687",
"0.5981849",
... | 0.71104133 | 1 |
Refreshes all the documentation from the setup file | def setup_doc(request):
if not request.user.is_superuser:
messages.info(request, "Logon to set up VNS")
return HttpResponseRedirect('/login/')
do_setup_doc()
messages.info(request, "Refreshed documentation")
return HttpResponseRedirect('/') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_docs():\n site_path = os.path.join(PROJECTS_ROOT, CURRENT_SITE)\n docs_path = os.path.join(site_path, 'doc_src')\n with cd(docs_path):\n run('git reset --hard && git pull --all')\n run('workon djangopatterns && cd doc_src && make clean')\n run('workon djangopatterns && cd d... | [
"0.66370356",
"0.61865705",
"0.6133271",
"0.60266846",
"0.60199726",
"0.6001001",
"0.59662145",
"0.5954449",
"0.5954449",
"0.59355634",
"0.59227663",
"0.590723",
"0.5865221",
"0.5850653",
"0.58391005",
"0.58206296",
"0.58092827",
"0.58048993",
"0.57612497",
"0.5723433",
"0.56... | 0.6188458 | 1 |
Return a dictionary of suggestion data keyed by total costs. | def suggestion_data_by_cost(suggestions, costs, details, cutoff_rank=None):
data_by_cost = dict()
sugg_count = 0
last_cost_to_include = None
for i in range(len(suggestions)):
sugg_count += 1
sugg = suggestions[i]
cost = costs[i]
detail = de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_cost(self):\n number_collisions = self.get_collisions()\n cs = dict(\n number_collisions=number_collisions,\n cost_collisions=number_collisions\n )\n # sum all costs in one total cost\n cs['cost'] = sum(v for k, v in cs.items() if k.startswith(... | [
"0.64476556",
"0.6041535",
"0.6035976",
"0.597796",
"0.5914629",
"0.5909583",
"0.58140266",
"0.57297426",
"0.5588694",
"0.55829734",
"0.5522664",
"0.54770464",
"0.5375533",
"0.53104943",
"0.53004616",
"0.5293903",
"0.52517605",
"0.52332014",
"0.5226337",
"0.5219528",
"0.52077... | 0.7675635 | 0 |
Method to download PDF CV. | def download(filename):
return send_from_directory(directory='pdf', filename=filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_pdf(url, browser):\n\tpass\n\n\t# grab link page\n\n\t# search soup for pdf file\n\n\t# grab pdf file and return it",
"def download_pdf( url, filename = None ):\n r = urlopen( Request( url ) )\n try:\n if filename is None:\n filename = give_filename( url )\n with open( fi... | [
"0.6691662",
"0.6534439",
"0.65170586",
"0.64478904",
"0.636999",
"0.63247436",
"0.631335",
"0.6256269",
"0.6252549",
"0.6110644",
"0.6072096",
"0.59133637",
"0.5857389",
"0.5853405",
"0.58489525",
"0.58106774",
"0.58026326",
"0.57670665",
"0.57546794",
"0.5742379",
"0.571132... | 0.6604825 | 1 |
Called when bot has successfully signed on to server. | def signedOn(self):
log.msg("Signed on")
if self.nickname != self.factory.nickname:
log.msg('Name taken, new is ''"{}".'.format(self.nickname))
self.join(self.factory.channel) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signedOn(self):\n log.info(\"Signed on as %s.\", self.nickname)\n if not self.password:\n # We aren't wating for auth, join all the channels\n self.joinChannels()\n else:\n self.msg(\"NickServ\", \"IDENTIFY %s\" % self.password)",
"def signedOn(self):\n ... | [
"0.66706383",
"0.6350279",
"0.61954117",
"0.61370677",
"0.60901403",
"0.60594326",
"0.6002132",
"0.5976414",
"0.58143145",
"0.5803297",
"0.57989275",
"0.57712966",
"0.5759648",
"0.57260644",
"0.56933284",
"0.5667493",
"0.5600553",
"0.55883765",
"0.55833244",
"0.5578382",
"0.5... | 0.6482549 | 1 |
Objective function for Matthews correlation coefficient for binary classification. | def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):
with warnings.catch_warnings():
# catches runtime warning when dividing by 0.0
warnings.simplefilter("ignore", RuntimeWarning)
return metrics.matthews_corrcoef(
y_true, y_predicted,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matthews_correlation_coefficient(self, y_true=None, y_pred=None, labels=None, average=\"macro\", decimal=None, **kwargs):\n y_true, y_pred, binary, representor, decimal = self.get_processed_data(y_true, y_pred, decimal)\n matrix, imap, imap_count = cu.calculate_confusion_matrix(y_true, y_pred, la... | [
"0.66589504",
"0.66293865",
"0.65846217",
"0.6547294",
"0.63941485",
"0.63199747",
"0.63177824",
"0.63059455",
"0.62894905",
"0.618413",
"0.6147253",
"0.6125291",
"0.6114341",
"0.611193",
"0.6064707",
"0.6037009",
"0.6013612",
"0.6005628",
"0.5963985",
"0.5963822",
"0.5963567... | 0.7271015 | 1 |
Objective function for Matthews correlation coefficient for multiclass classification. | def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):
with warnings.catch_warnings():
# catches runtime warning when dividing by 0.0
warnings.simplefilter("ignore", RuntimeWarning)
return metrics.matthews_corrcoef(
y_true, y_predicted,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matthews_correlation_coefficient(self, y_true=None, y_pred=None, labels=None, average=\"macro\", decimal=None, **kwargs):\n y_true, y_pred, binary, representor, decimal = self.get_processed_data(y_true, y_pred, decimal)\n matrix, imap, imap_count = cu.calculate_confusion_matrix(y_true, y_pred, la... | [
"0.6568589",
"0.63601166",
"0.62474686",
"0.6176377",
"0.61050653",
"0.60304606",
"0.5994701",
"0.594257",
"0.5851956",
"0.58256775",
"0.58070236",
"0.580117",
"0.5799206",
"0.5782289",
"0.57819927",
"0.57342726",
"0.56823575",
"0.56731737",
"0.56656873",
"0.56622094",
"0.564... | 0.6865232 | 0 |
Objective function for root mean squared error for regression. | def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):
return metrics.mean_squared_error(
y_true, y_predicted, squared=False, sample_weight=sample_weight
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):\n return metrics.mean_squared_error(\n y_true, y_predicted, sample_weight=sample_weight\n )",
"def root_mean_squared_error(y_true, y_pred):\n return sm.mean_squared_error(y_true, y_pred)**0.5",
"def objec... | [
"0.72848046",
"0.70387864",
"0.7020444",
"0.6971558",
"0.69114774",
"0.6782937",
"0.67071015",
"0.65921503",
"0.6591075",
"0.6578214",
"0.6540373",
"0.64853626",
"0.64682907",
"0.6459434",
"0.6459434",
"0.64516485",
"0.642182",
"0.6414577",
"0.637546",
"0.6373059",
"0.6358913... | 0.72607374 | 1 |
If True, this objective is only valid for positive data. | def positive_only(self):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_Positive(self):\n return self.signature() > 0",
"def is_nonpositive(self, a):\n return a <= 0",
"def is_positive(self):\n return (self._num > 0)",
"def is_nonnegative(self, a):\n return a >= 0",
"def is_Negative(self):\n return self.signature() < 0",
"def is_nega... | [
"0.7130363",
"0.68878573",
"0.6871231",
"0.6807907",
"0.6723572",
"0.6713042",
"0.6695723",
"0.6630901",
"0.66216576",
"0.65197283",
"0.65163654",
"0.6514209",
"0.64172107",
"0.6359864",
"0.63331234",
"0.62790275",
"0.6278503",
"0.62462217",
"0.6181479",
"0.6180418",
"0.61609... | 0.7482567 | 1 |
Objective function for mean squared log error for regression. | def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):
return metrics.mean_squared_log_error(
y_true, y_predicted, sample_weight=sample_weight
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def objective(self,w):\n l = 0\n for i in range(len(self.x)):\n # Each example contributes log(sigma(y_i * x_i . w))\n l -= log(sigmoid(self.y[i] * np.dot(w, self.x[i,:])))\n # regularisation 1/2 * alpha * ||w||^2\n l += 0.5 * self.alpha * np.dot(w,w)\n return l",
"def log_error(X, y, w)... | [
"0.72911537",
"0.7139746",
"0.69664",
"0.69664",
"0.694376",
"0.6836439",
"0.6807337",
"0.66348135",
"0.6632952",
"0.6629289",
"0.6584413",
"0.65773875",
"0.65620524",
"0.6561843",
"0.6548084",
"0.65464765",
"0.6513843",
"0.6454532",
"0.6448455",
"0.6420828",
"0.6406195",
"... | 0.72791976 | 1 |
Objective function for mean absolute error for regression. | def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):
return metrics.mean_absolute_error(
y_true, y_predicted, sample_weight=sample_weight
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):\n return metrics.mean_squared_error(\n y_true, y_predicted, sample_weight=sample_weight\n )",
"def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):\n return metrics.mean_square... | [
"0.7138123",
"0.7121232",
"0.70180637",
"0.6911948",
"0.6838132",
"0.6791639",
"0.677895",
"0.6750062",
"0.6702271",
"0.6649202",
"0.6619069",
"0.6577468",
"0.6569766",
"0.6548762",
"0.6533743",
"0.6533743",
"0.6512425",
"0.65019464",
"0.6460206",
"0.6456915",
"0.6419581",
... | 0.76205623 | 0 |
If True, this objective is only valid for positive data. | def positive_only(self):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_Positive(self):\n return self.signature() > 0",
"def is_nonpositive(self, a):\n return a <= 0",
"def is_positive(self):\n return (self._num > 0)",
"def is_nonnegative(self, a):\n return a >= 0",
"def is_Negative(self):\n return self.signature() < 0",
"def is_nega... | [
"0.7130363",
"0.68878573",
"0.6871231",
"0.6807907",
"0.6723572",
"0.6713042",
"0.6695723",
"0.6630901",
"0.66216576",
"0.65197283",
"0.65163654",
"0.6514209",
"0.64172107",
"0.6359864",
"0.63331234",
"0.62790275",
"0.6278503",
"0.62462217",
"0.6181479",
"0.6180418",
"0.61609... | 0.7482567 | 0 |
Objective function for mean squared error for regression. | def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):
return metrics.mean_squared_error(
y_true, y_predicted, sample_weight=sample_weight
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):\n return metrics.mean_squared_error(\n y_true, y_predicted, squared=False, sample_weight=sample_weight\n )",
"def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):\n return metr... | [
"0.76172316",
"0.72898775",
"0.7231345",
"0.72192216",
"0.70447373",
"0.69416624",
"0.6939925",
"0.6829598",
"0.6806602",
"0.6747388",
"0.6747388",
"0.674313",
"0.67376137",
"0.67195916",
"0.6712598",
"0.6682999",
"0.66506225",
"0.66250515",
"0.6604902",
"0.6559999",
"0.65296... | 0.76411664 | 0 |
Objective function for median absolute error for regression. | def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):
return metrics.median_absolute_error(
y_true, y_predicted, sample_weight=sample_weight
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def median_absolute_error(y_true, y_pred, *, multioutput=..., sample_weight=...):\n ...",
"def median_absolute_error(self):\n print('Median absolute error regression loss: ' + str(median_absolute_error(self.model.dataset.get_y_test(),\n ... | [
"0.6999318",
"0.69563085",
"0.65205926",
"0.64662397",
"0.62337905",
"0.6160651",
"0.6090309",
"0.60822666",
"0.60689557",
"0.60651344",
"0.6061989",
"0.6061747",
"0.60343504",
"0.6025916",
"0.59845304",
"0.59845304",
"0.59789383",
"0.59656286",
"0.59630394",
"0.59522474",
"0... | 0.7165233 | 0 |
Objective function for maximum residual error for regression. | def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):
return metrics.max_error(y_true, y_predicted) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_error(self):\n print('Maximum residual error: ' + str(max_error(self.model.dataset.get_y_test(), self.model.get_predicted())))",
"def max_error(y_true, y_pred):\n ...",
"def objective(z, x):\n num_tr_data_to_use = _get_tr_dataset_size_from_z0(z[0])\n return salsa_compute_negative_validation... | [
"0.6904142",
"0.6718622",
"0.63026744",
"0.6184855",
"0.6172645",
"0.6152341",
"0.61488885",
"0.61407036",
"0.61322975",
"0.6085151",
"0.6065585",
"0.6028198",
"0.5974811",
"0.59717965",
"0.59717965",
"0.5927039",
"0.59240896",
"0.5907478",
"0.59049314",
"0.58956367",
"0.5893... | 0.6935681 | 0 |
Objective function for explained variance score for regression. | def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):
return metrics.explained_variance_score(
y_true, y_predicted, sample_weight=sample_weight
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def explained_variance_score(self):\n print('Explained variance score: ' + str(explained_variance_score(self.model.dataset.get_y_test(),\n self.model.get_predicted())))",
"def explained_variance(ypred,y):\n assert y.ndim == 1 and ... | [
"0.7083206",
"0.6858508",
"0.68223095",
"0.6753364",
"0.6710913",
"0.66359204",
"0.65627617",
"0.65427935",
"0.64497685",
"0.6436994",
"0.64247775",
"0.62969035",
"0.62033224",
"0.61843103",
"0.6137211",
"0.61165047",
"0.61165047",
"0.61118525",
"0.6101192",
"0.60976857",
"0.... | 0.7271615 | 0 |
initialize connection and cursor to the database file named 'class_num_2' (or specified with an argument). | def __init__(self, name='class_num_2'):
self.conn = self.cursor = None
exists = os.path.exists(name)
self.conn = sqlite3.connect(name)
self.cursor = self.conn.cursor()
if not exists:
for command in self.CREATE_TABLES:
self.conn.execute(command)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\r\n assert isfile(DBClass.db_name), \"Database doesn't exists!\"\r\n\r\n self.conn = self.create_connection()\r\n self.cursor = self.conn.cursor()",
"def __init__(self, dbfile):\n self.dbfile = dbfile\n self.cxn = sqlite3.connect(dbfile)\n self.cur = ... | [
"0.66508967",
"0.645947",
"0.63699245",
"0.63419384",
"0.62864",
"0.6251479",
"0.62076044",
"0.6063487",
"0.6035127",
"0.6021464",
"0.5986314",
"0.59232324",
"0.5917155",
"0.5913866",
"0.59055823",
"0.58755213",
"0.5843414",
"0.58310163",
"0.58271974",
"0.5763186",
"0.5758773... | 0.70822716 | 0 |
Return sql statement that is augmnted by ORDER BY clause. | def _augment_order(self, stmt, key, reverse):
sqlstmt = stmt + " ORDER BY %s" % key
if reverse:
sqlstmt += " DESC"
else:
sqlstmt += " ASC"
return sqlstmt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_by_as_sql(self):\n return comma_join([\n '%s DESC' % field[1:] if isinstance(field, str) and field[0] == '-' else str(field)\n for field in self._order_by\n ])",
"def _orderby_expression(self):\n return ''",
"def get_random_order_by_clause(columns: List[str]... | [
"0.70921326",
"0.6581115",
"0.6499746",
"0.64270526",
"0.6343062",
"0.6283647",
"0.6254741",
"0.6233828",
"0.61573535",
"0.61001843",
"0.60519564",
"0.5962781",
"0.59196585",
"0.58932185",
"0.58238155",
"0.5777642",
"0.5764855",
"0.57506454",
"0.5734286",
"0.5645581",
"0.5640... | 0.77133936 | 0 |
Select class numbers for range of discriminants. disc_low < disc_high. | def _select_by_range(self, disc_low, disc_high):
sqlstmt = "SELECT h FROM %s WHERE d>=? and d<=?" % self.VIEW
pickup = self.cursor.execute(sqlstmt, (disc_low, disc_high,))
return [h[0] for h in pickup] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _select_by_range(self, disc_low, disc_high):\n sqlstmt = \"SELECT h FROM %s WHERE d>=? and d<=?\" % self.VIEW\n pickup = self.cursor.execute(sqlstmt, (-disc_high, -disc_low))\n return [h[0] for h in pickup]",
"def create_classes(row):\n if(row[' shares'] <= 10):\n \n ret... | [
"0.6030812",
"0.5924544",
"0.5725753",
"0.57145995",
"0.55804974",
"0.5487777",
"0.53221315",
"0.5287345",
"0.5256985",
"0.52320546",
"0.5196958",
"0.5194344",
"0.51848775",
"0.51802135",
"0.5171835",
"0.5155396",
"0.51386446",
"0.5127439",
"0.51160413",
"0.510559",
"0.509054... | 0.61144674 | 0 |
Insert a (discriminant, class number) pair into the table. | def _insert_single(self, disc, class_num):
self.cursor.execute(self.INSERT, (disc, class_num))
self.conn.commit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testInsertClass(self):\n\t\tid = 999999\n\t\tpossibilityid = 7\n\n\t\tcur = con.cursor()\n\t\tcur.execute(\"INSERT INTO Class$ VALUES (%s, %s, %s, %s, %s);\" % (\n\t\t\tid, 0, possibilityid, 0, \"'classinsert'\"))\n\t\tcur.close()\n\n\t\t#( Make sure the record made it into Class$\n\n\t\tcount = fwdb.fetchonev... | [
"0.5940896",
"0.5753177",
"0.5634207",
"0.55856013",
"0.5450727",
"0.54215837",
"0.5392554",
"0.5374819",
"0.5374819",
"0.5374819",
"0.5339375",
"0.5324333",
"0.5319466",
"0.5275537",
"0.5206024",
"0.5205185",
"0.51815736",
"0.5181063",
"0.51564795",
"0.51534945",
"0.51531345... | 0.71702766 | 0 |
Update value of class number corresponding to the discriminant. | def _update_single(self, disc, class_num):
self.cursor.execute(self.UPDATE, (class_num, disc))
self.conn.commit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_class(self):\n neighbors_set = list(set(self.neighbors))\n counts = np.array([self.neighbors.count(n) for n in neighbors_set])\n probs = (counts / counts.sum()) * (1-self.mutation_prob)\n probs = np.append(probs, self.mutation_prob)\n neighbors_set.append(np.random.cho... | [
"0.6515443",
"0.57821906",
"0.5593519",
"0.5541937",
"0.55377525",
"0.55269456",
"0.5440295",
"0.54311275",
"0.53247523",
"0.52858394",
"0.52196765",
"0.51771444",
"0.5172003",
"0.513605",
"0.5124539",
"0.5094409",
"0.5089683",
"0.5063058",
"0.50516707",
"0.50512165",
"0.5038... | 0.6472765 | 1 |
Select class numbers for range of discriminants. disc_low < disc_high, both ends included. | def _select_by_range(self, disc_low, disc_high):
sqlstmt = "SELECT h FROM %s WHERE d>=? and d<=?" % self.VIEW
pickup = self.cursor.execute(sqlstmt, (-disc_high, -disc_low))
return [h[0] for h in pickup] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _select_by_range(self, disc_low, disc_high):\n sqlstmt = \"SELECT h FROM %s WHERE d>=? and d<=?\" % self.VIEW\n pickup = self.cursor.execute(sqlstmt, (disc_low, disc_high,))\n return [h[0] for h in pickup]",
"def create_classes(row):\n if(row[' shares'] <= 10):\n \n retu... | [
"0.6272803",
"0.5879293",
"0.5851991",
"0.5589378",
"0.55857986",
"0.5517073",
"0.52579856",
"0.5232158",
"0.5195605",
"0.5192528",
"0.5173775",
"0.5172257",
"0.51654327",
"0.5161842",
"0.5135162",
"0.51326406",
"0.51325595",
"0.5128868",
"0.51181453",
"0.50695634",
"0.505499... | 0.6189044 | 1 |
Funktion to find an arbitrary first hinge X is a numpy ndarray that contains the X values of all datapoints the dimension of data[0] is d x n | def arbitrary_first_hinge(data):
n, d = data[0].shape
max_val = np.zeros((d))
min_val = np.zeros((d))
for i in range(d):
max_val[i] = np.max(data[0][:,i])
min_val[i] = np.min(data[0][:,i])
Delta = np.zeros((d))
no_suitable_hinge = True
count = 0
while no_suitable_hinge: #... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hinge_g(datax,datay,w):\n #chaque exemplaire donne un gradient\n fx=-datay*np.dot(datax,w.T)\n fx2=-datay.reshape(-1,1)*datax\n res=[]\n for i in range(len(fx)):\n if fx[i]<0:\n res.append(np.zeros(len(w)))\n else:\n res.append(fx2[i])\n return np.mean(np.a... | [
"0.6348591",
"0.6285579",
"0.6049639",
"0.5915652",
"0.5724354",
"0.56790656",
"0.56472296",
"0.56407607",
"0.56027794",
"0.55619717",
"0.5549578",
"0.5522638",
"0.54996717",
"0.549763",
"0.54904693",
"0.5486065",
"0.5474864",
"0.5414224",
"0.5411821",
"0.54072714",
"0.536880... | 0.8228787 | 0 |
Solve the tile in row one at the specified column Updates puzzle and returns a move string | def solve_row1_tile(self, target_col):
moves_str = ""
current_row, current_col = self.current_position(1, target_col)
zero_row, zero_col = self.current_position(0, 0)
moves_str += self.position_tile(zero_row, zero_col, current_row, current_col)
moves_str += "ur"
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve_puzzle(self):\n cur0_row, cur0_col = self.current_position(0, 0)\n move_str = 'd' * (self._height - cur0_row - 1) + 'r' * (self._width - cur0_col - 1)\n self.update_puzzle(move_str)\n for row in range(self._height-1, 1, -1):\n for col in range(self._width-1, -1, -1)... | [
"0.75331515",
"0.74919623",
"0.7480167",
"0.740426",
"0.7347467",
"0.73144126",
"0.72876054",
"0.72775614",
"0.72608143",
"0.7247127",
"0.7240531",
"0.72378457",
"0.72240204",
"0.7211",
"0.71956366",
"0.719281",
"0.71438867",
"0.7120054",
"0.708346",
"0.70679855",
"0.70410216... | 0.76108 | 0 |
This will extract the weights from we big W array. in a 1hidden layer network. this can be easily generalized. | def _extract_weights(self,W):
wl1_size = self._D*self._hidden_layer_size
bl1_size = self._hidden_layer_size
wl2_size = self._hidden_layer_size*self._output_size
bl2_size = self._output_size
weights_L1 = W[0:wl1_size].reshape((self._D,self._hidden_layer_size))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_weights(self):",
"def get_weights(self):\n # First part is iterating over hidden weights. Then append the output weight.\n return [self.hidden_layers[i].get_weight().cpu().detach().numpy() for i in range(self.depth)] + \\\n [self.output_weight.cpu().detach().numpy()]",
"def ... | [
"0.6988331",
"0.6986408",
"0.6980775",
"0.6888071",
"0.6859273",
"0.675932",
"0.6703869",
"0.66439676",
"0.66439676",
"0.66145414",
"0.65849143",
"0.65849143",
"0.65849143",
"0.65849143",
"0.6531037",
"0.6528811",
"0.65226936",
"0.65220845",
"0.65165293",
"0.65156686",
"0.650... | 0.78002816 | 0 |
Check if a given packet is a terminal element. | def is_terminal(p):
return isinstance(p, _TerminalPacket) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_terminal(self, u1):\n\t\treturn (u1 in self.T) # returns True if in array, else False",
"def is_terminal(node):\n return isinstance(node, int)",
"def is_terminal(instruction):\n if instruction.mnemonic == 'jmp':\n return True\n if instruction.mnemonic == 'ud2':\n return True\n ... | [
"0.64572185",
"0.64105755",
"0.6279162",
"0.62357503",
"0.5972062",
"0.5898446",
"0.5887261",
"0.5857016",
"0.5841704",
"0.5814704",
"0.5809109",
"0.5777619",
"0.5763926",
"0.57500225",
"0.5746571",
"0.57132316",
"0.570799",
"0.5700133",
"0.56962043",
"0.56717706",
"0.5653657... | 0.762584 | 0 |
Attempts to get something from the results queue. | def results_q_get(self):
while not self.stopped():
try:
return self.results_queue.get(timeout=self.heart_beat)
except queue.Empty:
pass
raise StopIteration() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n if self.result_data.get(self.get_idx + 1) is not None:\n self.get_idx += 1\n res = self.result_data[self.get_idx]\n del self.result_data[self.get_idx]\n return res\n while True:\n res = self.result_queue.get(block=False)\n ... | [
"0.69179416",
"0.67834824",
"0.6698224",
"0.66785306",
"0.66610247",
"0.65808207",
"0.658027",
"0.64036334",
"0.6391208",
"0.6341154",
"0.6328688",
"0.6289565",
"0.6289565",
"0.62859356",
"0.62071997",
"0.62050194",
"0.6152513",
"0.61352766",
"0.609663",
"0.60696006",
"0.6061... | 0.7365436 | 0 |
Try to put the given value into the output queue until it is inserted (if it was previously full), or the stop signal was given. | def q_put(self, val):
put = False
while not put and not self.stopped():
try:
self.q.put(val, timeout=self.heart_beat)
put = True
except queue.Full:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def q_put(self, val):\n put = False\n while not put and not self.stopped():\n try:\n self.out_q.put(val, timeout=self.heart_beat)\n put = True\n except queue.Full:\n pass",
"def _put_nowait(self, value):\n while True:\n ... | [
"0.7591706",
"0.7145824",
"0.6879009",
"0.67163765",
"0.6443333",
"0.6404963",
"0.6350865",
"0.6336114",
"0.62798136",
"0.62380445",
"0.6143508",
"0.61336714",
"0.6025617",
"0.60202956",
"0.5921876",
"0.59022725",
"0.58127224",
"0.5805871",
"0.58013946",
"0.57997674",
"0.5764... | 0.715076 | 1 |
Try to put the given value into the output queue while keeping an eye out for an exit request. | def q_put(self, val):
put = False
while not put and not self.stopped():
try:
self.out_q.put(val, timeout=self.heart_beat)
put = True
except queue.Full:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue(self, queue_, value):\n while not self.closed:\n try:\n queue_.put(value, block=True, timeout=1)\n return\n except queue.Full:\n continue",
"def _put_nowait(self, value):\n while True:\n if self._waiting_consume... | [
"0.67790014",
"0.6746977",
"0.66978484",
"0.62604994",
"0.62283874",
"0.6169123",
"0.611658",
"0.61132234",
"0.60120815",
"0.6008213",
"0.5998941",
"0.5974077",
"0.59662634",
"0.5966226",
"0.5891294",
"0.58610135",
"0.5834615",
"0.57730913",
"0.57281363",
"0.5704808",
"0.5704... | 0.6758068 | 1 |
Shortcut to get the point format | def point_format(self) -> PointFormat:
return self.points.point_format | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fmt_point(point):\n assert len(point) == 2\n return f\"({point[0]},{point[1]})\"",
"def _format_point(self, point):\n return (point + self.draw_offset).intify()",
"def point(value):\r\n return '({}, {})'.format(value.x(), value.y())",
"def coords_format(format):\n if format == ... | [
"0.71667224",
"0.7140473",
"0.686632",
"0.66184884",
"0.65480775",
"0.6460085",
"0.6394508",
"0.63519347",
"0.63215923",
"0.6310085",
"0.6152419",
"0.6054102",
"0.6051808",
"0.6051808",
"0.60466886",
"0.6037981",
"0.598576",
"0.59497267",
"0.59159887",
"0.5891078",
"0.5881567... | 0.80615675 | 0 |
Returns a new 2D numpy array with the x,y,z coordinates >>> import laspy >>> las = laspy.read("tests/data/simple.las") >>> xyz = las.xyz >>> xyz.ndim 2 >>> xyz.shape (1065, 3) >>> np.all(xyz[..., 0] == las.x) True | def xyz(self) -> np.ndarray:
return np.vstack((self.x, self.y, self.z)).transpose() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def carla_xyz_to_ndarray(xyz: Any) -> np.ndarray:\n return np.asarray(\n [xyz.x, xyz.y, xyz.z],\n dtype=np.float32,\n )",
"def xyz(self) -> np.ndarray:\n return self._vector[0:3]",
"def test_xyz_to_np_array(self):\n xyz_dict = {'symbols': ('O', 'N', 'C', 'H', 'H'),\n ... | [
"0.7163908",
"0.6581683",
"0.6572348",
"0.6427895",
"0.62238467",
"0.6169673",
"0.6085524",
"0.6039228",
"0.6037447",
"0.60006875",
"0.6000233",
"0.600004",
"0.5982589",
"0.59646046",
"0.59463483",
"0.5929885",
"0.58729416",
"0.5867755",
"0.58617914",
"0.58530164",
"0.5839803... | 0.6869546 | 1 |
Add multiple extra dimensions at once | def add_extra_dims(self, params: List[ExtraBytesParams]) -> None:
self.header.add_extra_dims(params)
new_point_record = record.PackedPointRecord.from_point_record(
self.points, self.header.point_format
)
self.points = new_point_record | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_extra_dim(self, params: ExtraBytesParams) -> None:\n self.add_extra_dims([params])",
"def _add_keepdims(func):\n @functools.wraps(func)\n def wrapped(a, axis, **kwargs):\n res = func(a, axis=axis, **kwargs)\n if axis is None:\n axis = 0 # res is now a scalar, so we ... | [
"0.7370198",
"0.6150748",
"0.6022895",
"0.5712826",
"0.5707477",
"0.56860507",
"0.56048715",
"0.56024325",
"0.5548181",
"0.5530567",
"0.5514939",
"0.5511657",
"0.5509451",
"0.5495741",
"0.54917973",
"0.5489993",
"0.5461412",
"0.54279226",
"0.54229844",
"0.54217494",
"0.540748... | 0.64829373 | 1 |
Update the information stored in the header to be in sync with the actual data. This method is called automatically when you save a file using | def update_header(self) -> None:
self.header.partial_reset()
self.header.point_format_id = self.points.point_format.id
self.header.point_data_record_length = self.points.point_size
if len(self.points) > 0:
self.header.update(self.points)
if self.header.version.minor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_header_checksum(self):\n self.header_checksum = self.generate_header_checksum()",
"def update_header(self, key, value):\n if self.mode != 'write':\n raise IOError(\"Must open file in write mode to do this!\")\n\n if isinstance(value, CommentedSeq):\n # Always... | [
"0.72980464",
"0.7031593",
"0.70280397",
"0.683849",
"0.67697793",
"0.670883",
"0.66841036",
"0.6580405",
"0.6571592",
"0.6551829",
"0.6537697",
"0.6502819",
"0.6502819",
"0.63916695",
"0.635294",
"0.63311934",
"0.63274366",
"0.62795246",
"0.62374896",
"0.6229574",
"0.6212498... | 0.76055604 | 0 |
This changes the scales and/or offset used for the x,y,z dimensions. It recomputes the internal, nonscaled X,Y,Z dimensions to match the new scales and offsets. It also updates the header with the new values of scales and offsets. | def change_scaling(self, scales=None, offsets=None) -> None:
self.points.change_scaling(scales, offsets)
self.header.scales = scales
self.header.offsets = offsets | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_metadata(self, cubes):\n cube = self.get_cube_from_list(cubes)\n\n # Add auxiliary coordinate from list of cubes\n coords_to_add = {\n 'ap': 1,\n 'b': 1,\n 'ps': (0, 2, 3),\n }\n add_aux_coords_from_cubes(cube, cubes, coords_to_add)\n ... | [
"0.5542398",
"0.5539607",
"0.55246663",
"0.5506363",
"0.5484583",
"0.54840875",
"0.54747707",
"0.5433454",
"0.5432325",
"0.5421466",
"0.5398096",
"0.53626895",
"0.53541446",
"0.53148645",
"0.52748847",
"0.526418",
"0.5240242",
"0.5199212",
"0.516557",
"0.514026",
"0.513449",
... | 0.70421565 | 0 |
Automatically called by Python when the attribute named 'item' is no found. We use this function to forward the call the point record. This is the mechanism used to allow the users to access the points dimensions directly through a LasData. | def __getattr__(self, item):
try:
return self.points[item]
except ValueError:
raise AttributeError(
f"{self.__class__.__name__} object has no attribute '{item}'"
) from None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _point(self):\n raise NotImplementedError",
"def __getitem__(self, item):\n return None",
"def __getitem__(self, item) -> Union[MoleculeDatapoint, List[MoleculeDatapoint]]:\n if self.preload:\n return self.data_ram[item]\n else:\n return self.data[item]",
... | [
"0.5814407",
"0.5640329",
"0.55439866",
"0.55156744",
"0.5510484",
"0.5468163",
"0.5396472",
"0.53705597",
"0.53308845",
"0.5289186",
"0.5271497",
"0.5237821",
"0.5228247",
"0.5228247",
"0.5212746",
"0.51971865",
"0.51803577",
"0.51642036",
"0.51641905",
"0.514916",
"0.513965... | 0.683438 | 0 |
This is called on every access to an attribute of the instance. Again we use this to forward the call the the points record But this time checking if the key is actually a dimension name so that an error is raised if the user tries to set a valid LAS dimension even if it is not present in the field. | def __setattr__(self, key, value):
try:
key = OLD_LASPY_NAMES[key]
except KeyError:
pass
if (
key in self.point_format.dimension_names
or key in self.points.array.dtype.names
):
self.points[key] = value
elif key in dim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_attr(self):\n super(Scatter, self).check_attr()",
"def validatePointDict(self, pointDict):\n assert isinstance(pointDict, dict)\n for key in pointDict.keys():\n assert key in self.indVars or key in self.indLogVars, \\\n \"'%s' of your pointDict is not a va... | [
"0.595018",
"0.5949909",
"0.58414143",
"0.56946003",
"0.5686822",
"0.56605047",
"0.56245536",
"0.5612058",
"0.55236906",
"0.5475995",
"0.54312456",
"0.5412335",
"0.5406085",
"0.5375272",
"0.53417885",
"0.5314922",
"0.5311319",
"0.52851415",
"0.5280058",
"0.522966",
"0.5206767... | 0.6875277 | 0 |
Prepares ElasticSearch index for work if it's not yet ready. | def prepare_environment():
elastic_search = Elasticsearch('{}:{}'.format(
_CONFIG.elastic.elastic_hostname,
_CONFIG.elastic.elastic_port))
try:
if not elastic_search.indices.exists(_CONFIG.elastic.elastic_index):
elastic_search.indices.create(
index=_CONFIG.el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(self):\n collection = self._get_collection()\n\n indices = copy(self.params[\"indices\"])\n\n if \"when\" not in indices:\n indices[\"when\"] = {}\n\n for index in indices:\n self.log(DEBUG, \"Ensuring we have index for {}\".format(index))\n\n ... | [
"0.6822464",
"0.6608476",
"0.6578373",
"0.65098244",
"0.6410101",
"0.6350535",
"0.63355875",
"0.6299239",
"0.628596",
"0.62516123",
"0.6217381",
"0.6179033",
"0.6161813",
"0.6150631",
"0.60264784",
"0.5980867",
"0.59180737",
"0.5883443",
"0.58652765",
"0.58378285",
"0.5803318... | 0.7071441 | 0 |
accept data from an mca call and make a transformer | def mca_transformer(transform_data):
M, dims, index, v0v1 = transform_data
def transform(dfp):
# dims, index, v0v1
P = np.zeros((len(dfp), dims), dtype=float)
print("transforming")
for i, (_, row) in (enumerate(dfp.iterrows())):
ivec = np.zeros(M)
for col,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform(self, data):",
"def transform():",
"def _transform_data(self, *args, **kwargs) -> None:\n raise NotImplementedError",
"def transform():\n pass",
"def transform_M(pca, M):\n return pca.transform(M)",
"def fit_transform(self, *args, **kwargs):\n self.fit(*args, **kwarg... | [
"0.64503646",
"0.6186081",
"0.59814787",
"0.58701295",
"0.5764457",
"0.5754863",
"0.5753702",
"0.5753702",
"0.5753702",
"0.5753702",
"0.5753702",
"0.5753702",
"0.5753702",
"0.5731063",
"0.571918",
"0.57147735",
"0.56695944",
"0.5642564",
"0.5582936",
"0.55694467",
"0.55679184... | 0.6399205 | 1 |
given either, uid, email or cell delete user | def delete_user(self, uid: typing.Union[str, None] = None, email: typing.Union[str, None] = None,
cell: typing.Union[str, None] = None) -> tuple:
if (uid != "") and (uid is not None):
user_instance: UserModel = UserModel.query(UserModel.uid == uid).get()
if isinstanc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_user():",
"def delete_user():\n #TODO user delete\n pass",
"def delete_user(id):\n pass",
"def delete_user():\r\n raise NotImplementedError()",
"async def delete_user_async(self, uid: typing.Union[str, None] = None, email: typing.Union[str, None] = None,\n cell: ty... | [
"0.8063457",
"0.77943003",
"0.750916",
"0.7319417",
"0.7179262",
"0.70298296",
"0.70271325",
"0.6993175",
"0.69857246",
"0.6935591",
"0.68059003",
"0.676924",
"0.6759346",
"0.67173064",
"0.670622",
"0.6703536",
"0.66915566",
"0.66839904",
"0.66393626",
"0.66366845",
"0.663639... | 0.79242414 | 1 |
return a user either by uid, cell or email | def get_user(self, uid: typing.Union[str, None] = None, cell: typing.Union[str, None] = None,
email: typing.Union[str, None] = None) -> tuple:
if (uid is not None) and (uid != ""):
user_instance: UserModel = UserModel.query(UserModel.uid == uid).get()
if isinstance(us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def helper_get_by_email(user_email):\n user = heart_rate_databases_starter.models.User.objects.raw({\"_id\": user_email}).first() # Get the first user where _id=email\n return user",
"def user(email):\r\n return User.objects.get(email=email)",
"def get_info(email):\n # Get the first user where _id=... | [
"0.7651549",
"0.74783397",
"0.74545854",
"0.73901826",
"0.7250669",
"0.7162273",
"0.7144269",
"0.71026564",
"0.7100497",
"0.70976406",
"0.7061907",
"0.7061907",
"0.70599616",
"0.7057769",
"0.7049539",
"0.70171154",
"0.70123094",
"0.7002466",
"0.69446295",
"0.69274014",
"0.691... | 0.77902895 | 0 |
Get the main page, frame data page and icon.png from all characters | def _get_all_characters(self, main_page):
heading_div = main_page.find('div', {'class': 'heading'}) # dustloop changed its code so this is necessary
character_div = heading_div.next.next
if character_div is None: # CF fix
character_div = main_page.find_all('div', {'class': 'cente... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_page(data):\n main_index = [html.H1(\"INDEX\"),\n html.Div([html.A(\"Characters\", href=\"/character\"),\n \" | \", html.A(\"Search\", href=\"/search\")]),\n dcc.Loading(html.Img(src=create_wordcloud(data[\"tokens\"]))),\n ge... | [
"0.5962371",
"0.5603198",
"0.5425942",
"0.53752774",
"0.52706",
"0.52631027",
"0.52476233",
"0.5227522",
"0.5222663",
"0.5209187",
"0.52023345",
"0.5132806",
"0.51298815",
"0.5083322",
"0.506516",
"0.50444674",
"0.503743",
"0.50013596",
"0.4982596",
"0.49715155",
"0.49574405"... | 0.69636035 | 0 |
Find the specific character given a name | def _get_specific_character(self):
characters = self._get_all_characters(self._main_page)
for character in characters.keys():
if self._find_name.lower() in character.lower():
return {character: characters[character]}
else:
raise CharacterNotFound | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup(c):\r\n if c not in chars:\r\n return ValueError\r\n p = chars.index(c)\r\n return vals[p]",
"def map_char(self, char):\n for key, pattern in self.char_map.items():\n if char in pattern:\n return key\n return 'U'",
"def get_character(self, name... | [
"0.686217",
"0.65783554",
"0.65432125",
"0.6508384",
"0.6446429",
"0.640912",
"0.6370401",
"0.6344659",
"0.6292809",
"0.6287532",
"0.62821776",
"0.6278763",
"0.62620926",
"0.6258683",
"0.6253632",
"0.62053305",
"0.62053305",
"0.62053305",
"0.62053305",
"0.6184599",
"0.6147725... | 0.76066995 | 0 |
Parse a bs4 object cointaining the character's page and extract its sprite links | def _get_sprites(self):
character = self._get_main_page(self._data[self.name]['sprites'])
result = {}
for big_tag in character.find_all('big'):
# big contain the move name. Its next siblings contain the sprite link.
move_name = big_tag.get_text()
sprite = ''
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_all_characters(self, main_page):\n\n heading_div = main_page.find('div', {'class': 'heading'}) # dustloop changed its code so this is necessary\n character_div = heading_div.next.next\n\n if character_div is None: # CF fix\n character_div = main_page.find_all('div', {'cla... | [
"0.59069526",
"0.54173696",
"0.5399497",
"0.53945065",
"0.5173656",
"0.51398855",
"0.51057523",
"0.50836",
"0.5082662",
"0.5081799",
"0.5080319",
"0.50611377",
"0.50428677",
"0.5031358",
"0.5030395",
"0.5002891",
"0.49791157",
"0.49360043",
"0.4920005",
"0.49096623",
"0.48798... | 0.6506151 | 0 |
Translate a value in a range to a value in the servo's limits | def translate(self, value, left_min, left_max, right_min=None, right_max=None):
if right_min is None:
right_min = self.values['pulse_min'].data
if right_max is None:
right_max = self.values['pulse_max'].data
# Figure out how 'wide' each range is
left_span = left_ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(value, from_min, from_max, to_min, to_max):\n # Figure out how 'wide' each range is\n left_span = from_max - from_min\n right_span = to_max - to_min\n\n # Convert the left range into a 0-1 range (float)\n value_scaled = float(value - from_min) / float(left_span)\n\n # Convert the 0-... | [
"0.73215246",
"0.72151345",
"0.7083968",
"0.68883926",
"0.658511",
"0.6504402",
"0.6464664",
"0.6372067",
"0.63498366",
"0.6278319",
"0.6260081",
"0.6257299",
"0.622617",
"0.61917245",
"0.61762935",
"0.61659163",
"0.6140141",
"0.6124716",
"0.61224556",
"0.61178166",
"0.609229... | 0.7247345 | 1 |
Prueba transformar una lista de ciudades | def test_obtener_lista_ciudades_transformadas(self):
lista = [{"id": 707860, "name": "Hurzuf", "country": "UA", "coord": {"lon": 34.283333, "lat": 44.549999}}, {"id": 519188, "name": "Novinki", "country": "RU", "coord": {"lon": 37.666668, "lat": 55.683334}}]
lista_transformada = CIUDADES_CONTROLLER.obte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_obtener_lista_ciudades_transformadas_vacia(self):\n lista = []\n lista_transformada = CIUDADES_CONTROLLER.obtenerListaCiudades(lista)\n self.assertEqual(len(lista_transformada), len(lista))",
"def pretraga_po_cijeni(self, lst, broj):\n pretrazeno = []\n for i in lst:\n... | [
"0.64637715",
"0.57248276",
"0.5394441",
"0.53746897",
"0.52636087",
"0.5241776",
"0.5221326",
"0.5206932",
"0.52068555",
"0.5128128",
"0.5123698",
"0.5112072",
"0.50739044",
"0.50739044",
"0.5040759",
"0.50264275",
"0.5015901",
"0.4997237",
"0.49942932",
"0.49705258",
"0.495... | 0.63365334 | 1 |
Sets the primary_language of this BlogAuthorCloneRequestVNext. | def primary_language(self, primary_language):
self._primary_language = primary_language | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primary_lead_source(self, primary_lead_source):\n\n self._primary_lead_source = primary_lead_source",
"def primary_election(self, primary_election):\n\n self._primary_election = primary_election",
"def set_default_language(language_code):\n thread_locals.DEFAULT_LANGUAGE = language_code",
... | [
"0.56208014",
"0.54539996",
"0.5342789",
"0.53413796",
"0.510116",
"0.50406414",
"0.49752814",
"0.49555436",
"0.4937906",
"0.49368346",
"0.49306494",
"0.49193388",
"0.489806",
"0.48586872",
"0.48586872",
"0.48586872",
"0.48586872",
"0.48586872",
"0.4775442",
"0.47245005",
"0.... | 0.7538336 | 0 |
Sets the blog_author of this BlogAuthorCloneRequestVNext. | def blog_author(self, blog_author):
if self.local_vars_configuration.client_side_validation and blog_author is None: # noqa: E501
raise ValueError("Invalid value for `blog_author`, must not be `None`") # noqa: E501
self._blog_author = blog_author | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_author (self, author):\n self.author = author",
"def author(self, author):\n self._author = author",
"def author(self, author):\n\n self._author = author",
"def author(self, author):\n\n self._author = author",
"def author(self, author: str):\n\n self._author = au... | [
"0.7224278",
"0.6921415",
"0.6881826",
"0.6881826",
"0.6812635",
"0.6807915",
"0.67896956",
"0.6371064",
"0.6253165",
"0.62105346",
"0.61932445",
"0.6144888",
"0.61404",
"0.5877912",
"0.5796",
"0.5457017",
"0.53739065",
"0.53106886",
"0.51514614",
"0.510211",
"0.510211",
"0... | 0.8142379 | 0 |
Kernel for deleting particles if they are out of bounds. | def DeleteParticle(particle, fieldset, time):
print('particle is deleted')
#print(particle.lon, particle.lat, particle.depth)
particle.delete() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_particle():\n function = LegacyFunctionSpecification()\n function.must_handle_array = True\n #function.can_handle_array = True\n function.addParameter('index_of_the_particle', dtype='int32', direction=function.IN,\n description = \"Index of the particle to be remov... | [
"0.67769444",
"0.6055123",
"0.59765166",
"0.597622",
"0.5788498",
"0.5526069",
"0.55018276",
"0.5414637",
"0.5387598",
"0.53062934",
"0.529881",
"0.52508664",
"0.5245848",
"0.5231394",
"0.520805",
"0.5200969",
"0.51794755",
"0.51622355",
"0.51304185",
"0.511951",
"0.5119222",... | 0.6056301 | 1 |
Create a Zipline bundle for US stocks. This function defines the bundle parameters but does not ingest the actual data. To ingest the data, see `ingest_bundle`. | def create_usstock_bundle(code, sids=None, universes=None, free=False, data_frequency=None):
params = {}
params["ingest_type"] = "usstock"
if sids:
params["sids"] = sids
if universes:
params["universes"] = universes
if free:
params["free"] = free
if data_frequency:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_bundle_from_db(code, from_db, calendar,\n start_date=None, end_date=None,\n universes=None, sids=None,\n exclude_universes=None, exclude_sids=None,\n fields=None):\n params = {}\n params[\"ingest_type\"] ... | [
"0.5737599",
"0.5624168",
"0.52454215",
"0.51961",
"0.51895124",
"0.5141124",
"0.5002819",
"0.49275422",
"0.48552963",
"0.48290926",
"0.48285222",
"0.478253",
"0.4778453",
"0.47420585",
"0.47138026",
"0.47078657",
"0.46798554",
"0.46585497",
"0.46437377",
"0.46415734",
"0.462... | 0.705462 | 0 |
Create a Zipline bundle from a history database or realtime aggregate database. You can ingest 1minute or 1day databases. This function defines the bundle parameters but does not ingest the actual data. To ingest the data, see `ingest_bundle`. | def create_bundle_from_db(code, from_db, calendar,
start_date=None, end_date=None,
universes=None, sids=None,
exclude_universes=None, exclude_sids=None,
fields=None):
params = {}
params["ingest_type"] = "from_db"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_usstock_bundle(code, sids=None, universes=None, free=False, data_frequency=None):\n params = {}\n params[\"ingest_type\"] = \"usstock\"\n if sids:\n params[\"sids\"] = sids\n if universes:\n params[\"universes\"] = universes\n if free:\n params[\"free\"] = free\n i... | [
"0.5224077",
"0.5196188",
"0.5181473",
"0.5154182",
"0.5124924",
"0.51062536",
"0.5084187",
"0.50500804",
"0.49181616",
"0.48891172",
"0.48560527",
"0.48154488",
"0.4794641",
"0.47894952",
"0.47602564",
"0.47574356",
"0.47317144",
"0.47280684",
"0.4721878",
"0.47159988",
"0.4... | 0.70531654 | 0 |
List available data bundles and whether data has been ingested into them. Returns dict data bundles and whether they have data (True indicates data, False indicates config only) | def list_bundles():
response = houston.get("/zipline/bundles")
houston.raise_for_status_with_json(response)
return response.json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_available(dataset_name=None):\r\n for file_list in data_resources[dataset_name]['files']:\r\n for file in file_list:\r\n if not os.path.exists(os.path.join(data_path, dataset_name, file)):\r\n return False\r\n return True",
"def list_datasets():\n return METADAT... | [
"0.569917",
"0.5497132",
"0.5455914",
"0.544919",
"0.5427864",
"0.5385617",
"0.5335501",
"0.53352034",
"0.5286906",
"0.52617186",
"0.5234778",
"0.5181927",
"0.5128465",
"0.510662",
"0.5101093",
"0.5100395",
"0.5093144",
"0.5080593",
"0.5068448",
"0.5065139",
"0.5055053",
"0... | 0.5848908 | 0 |
Return the current default bundle, if any. Returns dict default bundle | def get_default_bundle():
response = houston.get("/zipline/config")
houston.raise_for_status_with_json(response)
# It's possible to get a 204 empty response
if not response.content:
return {}
return response.json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _bundle(self):\n # Default to DEFAULT_BUNDLE_NAME\n bundle_path = os.path.join(self.working_dir, DEFAULT_BUNDLE_NAME)\n return self.config['app'].get('bundle', bundle_path)",
"def bundle(self):\n return self._bundle",
"def set_default_bundle(bundle):\n data = {\n \"def... | [
"0.7652356",
"0.68254375",
"0.66041327",
"0.6490423",
"0.61902595",
"0.61386484",
"0.61181325",
"0.6053376",
"0.5990121",
"0.59785056",
"0.59209555",
"0.59107226",
"0.5892718",
"0.58923465",
"0.58859545",
"0.58652484",
"0.58470947",
"0.5778259",
"0.5771413",
"0.57703006",
"0.... | 0.76861393 | 0 |
Set the default bundle to use for backtesting and trading. Setting a default bundle is a convenience and is optional. It can be overridden by manually specifying a bundle when backtesting or trading. | def set_default_bundle(bundle):
data = {
"default_bundle": bundle
}
response = houston.put("/zipline/config", data=data)
houston.raise_for_status_with_json(response)
return response.json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _bundle(self):\n # Default to DEFAULT_BUNDLE_NAME\n bundle_path = os.path.join(self.working_dir, DEFAULT_BUNDLE_NAME)\n return self.config['app'].get('bundle', bundle_path)",
"def set_default_backend(new_default_backend):\n global __default_backend\n assert new_default_backend in _... | [
"0.5795146",
"0.57184917",
"0.55907506",
"0.54614604",
"0.54378706",
"0.5327243",
"0.5316259",
"0.53112996",
"0.52811897",
"0.5278304",
"0.5221235",
"0.5199214",
"0.51627177",
"0.5141746",
"0.51271313",
"0.5108786",
"0.50976634",
"0.5082149",
"0.50721675",
"0.5051544",
"0.505... | 0.7540899 | 0 |
Backtest a Zipline strategy and write the test results to a CSV file. | def backtest(strategy, data_frequency=None, capital_base=None, bundle=None,
start_date=None, end_date=None, progress=None, filepath_or_buffer=None):
params = {}
if data_frequency:
params["data_frequency"] = data_frequency
if capital_base:
params["capital_base"] = capital_base
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_to_file(self):\n with TemporaryDirectory() as tmp:\n df_test = make_simple_dataframe()\n Base = BaseDataClass.from_object(df_test)\n fp_save = os.path.join(tmp, \"test_save.csv\")\n Base.to_file(fp_save)\n assert os.path.exists(fp_save)",
"de... | [
"0.60043824",
"0.5797413",
"0.5641993",
"0.5641104",
"0.5621839",
"0.558643",
"0.54995644",
"0.5467596",
"0.5443679",
"0.5440333",
"0.5436705",
"0.5419202",
"0.5387541",
"0.5355273",
"0.5333728",
"0.5306812",
"0.5300358",
"0.52832425",
"0.52598757",
"0.52445376",
"0.52430385"... | 0.57999974 | 1 |
Create a pyfolio PDF tear sheet from a Zipline backtest result. | def create_tearsheet(infilepath_or_buffer, outfilepath_or_buffer=None):
url = "/zipline/tearsheets"
# Pyfolio can take a long time
timeout = 60*60*5
if infilepath_or_buffer == "-":
infilepath_or_buffer = sys.stdin.buffer if six.PY3 else sys.stdin
response = houston.post(url, data=infile... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_pdf(f,s1,s2='',s3=''):\n # does not need reportlab!\n if s1 == 'White Ballot': s1 = '\"'+'_'*10+'\"'\n cod = zlib.compress('BT /F1 16 Tf ET\\r\\nBT 300 270 Td (%s) Tj ET\\r\\nBT /F1 48 Tf ET\\r\\nBT 5 180 Td (%16s) Tj ET\\r\\nBT /F1 12 Tf ET\\r\\nBT 10 50 Td (%s) Tj ET'%(s3,s1,s2))\n open(f,... | [
"0.54373765",
"0.5301332",
"0.52755183",
"0.5163104",
"0.5157768",
"0.5151152",
"0.5084435",
"0.5061132",
"0.50347525",
"0.50151926",
"0.4997838",
"0.49663877",
"0.49494618",
"0.49173144",
"0.49119133",
"0.4898193",
"0.48937094",
"0.48910657",
"0.4872321",
"0.48326224",
"0.48... | 0.5324984 | 1 |
Trade a Zipline strategy. | def trade(strategy, bundle=None, account=None, data_frequency=None):
params = {}
if bundle:
params["bundle"] = bundle
if account:
params["account"] = account
if data_frequency:
params["data_frequency"] = data_frequency
response = houston.post("/zipline/trade/{0}".format(stra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trades(self, symbol, **kwargs):\n pass",
"def new_order(self, signal, type):\n # self.client = bitmex.bitmex(test=True, api_key=self.strategy.api_key.key, api_secret=self.strategy.api_key.secret)\n if not self.strategy.live_trade:\n self.logger.info('Notice: Trading on testnet... | [
"0.544575",
"0.50332904",
"0.49879092",
"0.4963623",
"0.49505508",
"0.49245483",
"0.4848188",
"0.48248678",
"0.4819458",
"0.4792309",
"0.47710982",
"0.4750564",
"0.4735343",
"0.47004038",
"0.4697547",
"0.46796694",
"0.46482828",
"0.4644792",
"0.46419233",
"0.46271163",
"0.461... | 0.6242859 | 0 |
List actively trading Zipline strategies. Returns dict | def list_active_strategies():
response = houston.get("/zipline/trade")
houston.raise_for_status_with_json(response)
return response.json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_strategies(self) -> Dict[str, str]:\n strategies = [method for method in dir(self) if STRATEGY_IDENTIFIER in method]\n\n if not strategies:\n logger.warning(\n \"There are no strategy provided. \"\n \"Make sure the implemented strategy methods \"\n ... | [
"0.6025971",
"0.56356186",
"0.5233015",
"0.5213136",
"0.5213136",
"0.51326525",
"0.51007736",
"0.5030562",
"0.5003694",
"0.486264",
"0.48559678",
"0.4845097",
"0.48448005",
"0.47955704",
"0.47892332",
"0.47347358",
"0.4700591",
"0.46800238",
"0.46583483",
"0.46561205",
"0.465... | 0.7914323 | 0 |
Cancel actively trading strategies. | def cancel_strategies(strategies=None, accounts=None, cancel_all=False):
params = {}
if strategies:
params["strategies"] = strategies
if accounts:
params["accounts"] = accounts
if cancel_all:
params["cancel_all"] = cancel_all
response = houston.delete("/zipline/trade", param... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel(self):\n pass",
"def cancel():",
"async def cancel(self, ctx):\n\n return",
"def cancel(self):",
"def cancel(self):",
"def cancel(self):",
"def cancel(self):\n GameLoop.getInstance()._cancelation_token = True",
"def cancel_workers(self):\n pass",
"def cancel_p... | [
"0.6881652",
"0.68782014",
"0.68056035",
"0.6792938",
"0.6792938",
"0.6792938",
"0.67078626",
"0.66075724",
"0.6586988",
"0.64879715",
"0.647202",
"0.63794047",
"0.63794047",
"0.63761556",
"0.6369079",
"0.63625336",
"0.63591325",
"0.6332661",
"0.6331556",
"0.62745965",
"0.627... | 0.70745325 | 0 |
Given any string input, output should always be a MultiDict. | def test_parse_always_return_a_multidict(text):
result = parser.parse(text)
assert isinstance(result, MultiDict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _handle_dict(string):\n dict_lines = [line.split(Parser.FIELD_DELIM) for line in string.split(Parser.LINE_DELIM)\n if Parser.FIELD_DELIM in line]\n cur_dict = 0\n results = [{}]\n for line in dict_lines:\n if line[0] in results[cur_dict]:\n ... | [
"0.63851255",
"0.5997747",
"0.58942497",
"0.5788481",
"0.5660299",
"0.5619567",
"0.55112684",
"0.54624325",
"0.5428779",
"0.5427389",
"0.5356716",
"0.5343627",
"0.53428036",
"0.53142154",
"0.5312761",
"0.52732563",
"0.5236433",
"0.523301",
"0.51915973",
"0.51749986",
"0.51486... | 0.6881765 | 0 |
Copies contents of a directory to selected target location (also a directory). the specific source file to destination. If the source directory contains a directory, it will copy all the content recursively. Symlinks are preserved (not followed). The destination directory tree will be created if it does not exist. | def copy_recursively(source_directory, destination_directory):
# If the source directory does not exists, return
if not os.path.isdir(source_directory):
return
# Iterate over content in the source directory
for name in os.listdir(source_directory):
src = os.path.join(source_directory, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_directory(source, dest):\n for path, dirs, files in walk(source):\n relative_src_path = path.replace(source, \"\").lstrip(\"/\")\n abs_dest_path = join(dest, relative_src_path)\n if not exists(abs_dest_path):\n makedirs(abs_dest_path)\n for tdir in dirs:\n ... | [
"0.78698575",
"0.75631243",
"0.73947525",
"0.72985554",
"0.72549814",
"0.71111524",
"0.71096367",
"0.7081039",
"0.70594734",
"0.694694",
"0.69213504",
"0.69142485",
"0.69125223",
"0.69053984",
"0.6824952",
"0.68234557",
"0.68234557",
"0.6800539",
"0.6762316",
"0.67616564",
"0... | 0.77166575 | 1 |
Handles dependencies from selected object. If the object has 'dependencies' method, it will be called to retrieve a set of dependencies to check for. | def handle(self, o, params):
if not o:
return
# Get the class of the object
clazz = type(o)
for var in [clazz, o]:
# Check if a static method or variable 'dependencies' exists
dependencies = getattr(var, "dependencies", None)
if not dep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __handleDependArg(self):\n if not self.isArgSet(\"depend\"):\n return\n\n depends = self.getArg(\"depend\")\n if not isinstance(depends, (list,tuple)):\n depends = [depends]\n\n for dep in depends:\n if isinstance(dep, (tuple, list)):\n ... | [
"0.6101178",
"0.57944345",
"0.57552785",
"0.5746973",
"0.5683278",
"0.55662155",
"0.5467363",
"0.5411106",
"0.539399",
"0.5364756",
"0.5347721",
"0.533417",
"0.53025323",
"0.52779186",
"0.52249575",
"0.51903194",
"0.5185624",
"0.5175347",
"0.515894",
"0.5154528",
"0.5153659",... | 0.65346336 | 0 |
Initialize the minimal database needed to run the next tests. For testing inclusion of Knowns 1. A known transcript (id = 1) (dataset 1) with low fracA 2. A known transcript (id = 2) (dataset 2) with high fracA For testing selective exclusion of genomic transcripts and min_dataset and min_count criteria 3. A genomic tr... | def init_mock_db(db_file):
# Add reads. Fields that are not relevant for this purpose are set to None
known = [(1, 1, 1, "read_1", "dataset_1", None, None, None, None, None, None,
None, 0.2, None, None),
(2, 1, 2, "read_2", "dataset_2", None, None, None, None, None, None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def produce_all_database(is_debug):\n\tproduce_database([\"apnea-ecg\", \"train\"], is_debug)\n\tproduce_database([\"apnea-ecg\", \"test\"], is_debug)",
"def initialize(self):\n\n cursor = self.conn.cursor()\n\n # This table can be used as a parent for a collection of runs\n cursor.execute(\... | [
"0.63632995",
"0.63586783",
"0.6302861",
"0.63008267",
"0.62173074",
"0.6206588",
"0.6203436",
"0.6165715",
"0.6069049",
"0.60627854",
"0.6046322",
"0.6044242",
"0.5990898",
"0.59877425",
"0.5981873",
"0.597216",
"0.594306",
"0.5934508",
"0.5929362",
"0.5926552",
"0.5915737",... | 0.7084739 | 0 |
Emits signal after the team is saved. | def team_post_save_callback(sender, instance, **kwargs): # pylint: disable=unused-argument
changed_fields = instance.field_tracker.changed()
# Don't emit events when we are first creating the team.
if not kwargs['created']:
for field in changed_fields:
if field not in instance.FIELD_BLA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emit_save(self):\n self.saveNeeded.emit()",
"def on_post(self):\n return \"Ok, the stuff is being saved\"",
"def save(self):\n self.rpc.call(MsfRpcMethod.CoreSave)",
"def tool_save_clicked(self, widget, data=None):\n self.communicator.save_project()",
"def save(self)... | [
"0.71695304",
"0.66151935",
"0.61541957",
"0.60944235",
"0.60943586",
"0.6092622",
"0.6092622",
"0.6092622",
"0.6035435",
"0.6035435",
"0.6035435",
"0.6035435",
"0.6035435",
"0.60303354",
"0.6004041",
"0.59935254",
"0.5962158",
"0.5960021",
"0.59526396",
"0.59440774",
"0.5891... | 0.66895336 | 1 |
Serialize and paginate objects in a queryset. | def _serialize_and_paginate(self, pagination_cls, queryset, request, serializer_cls, serializer_ctx):
# Django Rest Framework v3 requires that we pass the request
# into the serializer's context if the serialize contains
# hyperlink fields.
serializer_ctx["request"] = request
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginate_queryset(self, queryset):\n if self.paginator is None:\n return None\n return self.paginator.paginate_queryset(\n queryset, self.request, view=self, count=self.data_count\n )",
"def paginate(self, *args, **kwargs):\n result = {}\n result.updat... | [
"0.71021366",
"0.6910735",
"0.68816143",
"0.68816143",
"0.6863937",
"0.6837659",
"0.67682266",
"0.6689846",
"0.6663731",
"0.6622385",
"0.64819586",
"0.63666826",
"0.6338943",
"0.62797666",
"0.62524116",
"0.6247991",
"0.62453747",
"0.6236762",
"0.6234747",
"0.622983",
"0.61560... | 0.7763758 | 0 |
Get the list of team ids that should be excluded from the response. Staff can see all private teams. Users should not be able to see teams in private teamsets that they are not a member of. | def _get_private_team_ids_to_exclude(self, course_module):
if has_access(self.request.user, 'staff', course_module.id):
return set()
private_teamset_ids = [ts.teamset_id for ts in course_module.teamsets if ts.is_private_managed]
excluded_team_ids = CourseTeam.objects.filter(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter_hidden_private_teamsets(user, teamsets, course_module):\n if has_course_staff_privileges(user, course_module.id):\n return teamsets\n private_teamset_ids = [teamset.teamset_id for teamset in course_module.teamsets if teamset.is_private_managed]\n teamset_ids_user_has_access_to = set(\n ... | [
"0.6896735",
"0.67550886",
"0.66091347",
"0.6536255",
"0.6337814",
"0.61999565",
"0.5997843",
"0.5916034",
"0.5862846",
"0.5827431",
"0.5732979",
"0.567555",
"0.5664162",
"0.56478506",
"0.5635067",
"0.56280315",
"0.56172055",
"0.5549673",
"0.55391186",
"0.5490045",
"0.5475751... | 0.7793252 | 0 |
Returns the queryset used to access the given team. | def get_queryset(self):
return CourseTeam.objects.all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n team = get_object_or_404(models.Team, pk=self.kwargs.get('pk'))\n\n return team.players.all()",
"def get_queryset(self):\n\t\tleague = League.objects.filter(participants=self.request.user)\n\t\treturn Team.objects.filter(league=league).order_by('-team_points').reverse()",
... | [
"0.7140566",
"0.68525076",
"0.68003845",
"0.67084926",
"0.65242296",
"0.63258034",
"0.63073957",
"0.6235347",
"0.6188112",
"0.61006284",
"0.60078096",
"0.60061246",
"0.60041696",
"0.600334",
"0.6001514",
"0.5993864",
"0.59816295",
"0.59700835",
"0.59692854",
"0.59650505",
"0.... | 0.7526071 | 0 |
Get the unit name where the ORA is located for better display naming | def _display_name_for_ora_block(self, block):
unit = modulestore().get_item(block.parent)
section = modulestore().get_item(unit.parent)
return "{section}: {unit}".format(
section=section.display_name,
unit=unit.display_name
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _display_unit(unit):\r\n name = getattr(unit, 'display_name', None)\r\n if name:\r\n return u'{0} ({1})'.format(name, unit.location.to_deprecated_string())\r\n else:\r\n return unit.location.to_deprecated_string()",
"def unit(self) -> str:",
"def get_organization_unit(self):\n ... | [
"0.6814345",
"0.64742565",
"0.6431361",
"0.63656455",
"0.6331347",
"0.62170213",
"0.62118816",
"0.6138227",
"0.61259097",
"0.6113987",
"0.6106627",
"0.6079564",
"0.6074329",
"0.60735947",
"0.6073245",
"0.6059044",
"0.6059044",
"0.6059044",
"0.6059044",
"0.6059044",
"0.6059044... | 0.65807664 | 1 |
Get the URL for jumping to a designated XBlock in a course | def _jump_location_for_block(self, course_id, location):
return reverse('jump_to', kwargs={'course_id': str(course_id), 'location': str(location)}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xblock_studio_url(xblock):\r\n if not xblock_has_own_studio_page(xblock):\r\n return None\r\n category = xblock.category\r\n parent_xblock = get_parent_xblock(xblock)\r\n parent_category = parent_xblock.category if parent_xblock else None\r\n if category == 'course':\r\n return rev... | [
"0.658554",
"0.6529052",
"0.6258376",
"0.6036088",
"0.60299546",
"0.5979776",
"0.5974855",
"0.5963222",
"0.5909378",
"0.5791184",
"0.57662684",
"0.5660542",
"0.56149435",
"0.5610368",
"0.5567706",
"0.5527173",
"0.5518062",
"0.5503949",
"0.5495674",
"0.54878414",
"0.54874384",... | 0.66912705 | 0 |
Return a filtered list of teamsets, removing any private teamsets that a user doesn't have access to. Follows the same logic as `has_specific_teamset_access` but in bulk rather than for one teamset at a time | def _filter_hidden_private_teamsets(user, teamsets, course_module):
if has_course_staff_privileges(user, course_module.id):
return teamsets
private_teamset_ids = [teamset.teamset_id for teamset in course_module.teamsets if teamset.is_private_managed]
teamset_ids_user_has_access_to = set(
Cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_private_team_ids_to_exclude(self, course_module):\n if has_access(self.request.user, 'staff', course_module.id):\n return set()\n\n private_teamset_ids = [ts.teamset_id for ts in course_module.teamsets if ts.is_private_managed]\n excluded_team_ids = CourseTeam.objects.filte... | [
"0.6755524",
"0.63036036",
"0.6234977",
"0.59630865",
"0.57284164",
"0.56667364",
"0.56176966",
"0.5563463",
"0.5542023",
"0.5526518",
"0.54849756",
"0.54461503",
"0.5419549",
"0.53458124",
"0.5268576",
"0.52402765",
"0.52311945",
"0.52100325",
"0.51957524",
"0.5180716",
"0.5... | 0.8336481 | 0 |
Return a list of team topics sorted alphabetically. | def get_alphabetical_topics(course_module):
return sorted(
course_module.teams_configuration.cleaned_data['team_sets'],
key=lambda t: t['name'].lower(),
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_topics(self):\r\n return [x[0] for x in get_published_topics()]",
"def get_sorted_topics(self, bow):\n return sorted(self.lda[bow], key=lambda x: x[1], reverse=True)",
"def get_sorted_topics_courses(self):\n return sorted(self.topics_courses, key=lambda course_topic: course_topic.s... | [
"0.6718301",
"0.6547439",
"0.6481919",
"0.64151615",
"0.63983524",
"0.6384925",
"0.63843715",
"0.63074464",
"0.61940634",
"0.6184367",
"0.61795145",
"0.615916",
"0.611461",
"0.61025083",
"0.60855836",
"0.60771537",
"0.6038198",
"0.60360616",
"0.60158175",
"0.600587",
"0.59740... | 0.7494829 | 0 |
Returns the team with team_id, or throws Http404 if it does not exist. | def get_team(self, team_id):
try:
return CourseTeam.objects.get(team_id=team_id)
except CourseTeam.DoesNotExist:
raise Http404 # lint-amnesty, pylint: disable=raise-missing-from | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_team(team_id):\n team = TeamController.get(filters={\"Team\": {\"id\": team_id}})\n return jsonify(format_team(team)), 200",
"def find_by_id(self, team, params={}, **options):\n path = \"/teams/%s\" % (team)\n return self.client.get(path, params, **options)",
"def get_one_team(id):\... | [
"0.80195063",
"0.8017829",
"0.7589412",
"0.7492985",
"0.740146",
"0.7379286",
"0.73767227",
"0.7071142",
"0.69879884",
"0.69508374",
"0.67793345",
"0.6736599",
"0.6716099",
"0.66796213",
"0.6637976",
"0.6634639",
"0.6607551",
"0.6604378",
"0.6567973",
"0.65156466",
"0.6284957... | 0.86852056 | 0 |
Returns the membership for the given user and team, or throws Http404 if it does not exist. | def get_membership(self, username, team):
try:
return CourseTeamMembership.objects.get(user__username=username, team=team)
except CourseTeamMembership.DoesNotExist:
raise Http404 # lint-amnesty, pylint: disable=raise-missing-from | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_returns_200_if_user_team_member(self):\n # Arrange\n # Create a team and add user to it\n test_team = create_canned_team()\n add_user_to_team(\n test_team, self.test_user, TeamMemberFunctions.MEMBER.value, True\n )\n # Assign team to project\n as... | [
"0.6222691",
"0.6211157",
"0.60510975",
"0.6021159",
"0.59259635",
"0.5858665",
"0.5842184",
"0.58242506",
"0.57344973",
"0.5721195",
"0.5719993",
"0.5710802",
"0.5702623",
"0.5699718",
"0.56888103",
"0.5678177",
"0.5673566",
"0.5652559",
"0.56405485",
"0.56106555",
"0.560642... | 0.8189664 | 0 |
Download CSV with team membership data for given course run. | def get(self, request, **_kwargs):
self.check_access()
response = HttpResponse(content_type='text/csv')
filename = "team-membership_{}_{}_{}.csv".format(
self.course.id.org, self.course.id.course, self.course.id.run
)
response['Content-Disposition'] = f'attachment; fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _csv_download(page):\n # gc = gspread.login(page.timetable.google_user, page.timetable.google_passwd)\n gc = googleoauth.authenticate_google_docs()\n csv_file = gc.open('WebValley2019')\n\n # gsession = gss.Client(page.timetable.google_user, page.timetable.google_passwd)\n # ss = gss.Spreadsheet... | [
"0.6244683",
"0.61488867",
"0.61174875",
"0.60466135",
"0.60196394",
"0.6010293",
"0.5996514",
"0.59831053",
"0.5944545",
"0.5923875",
"0.5895541",
"0.5893355",
"0.5875354",
"0.57277274",
"0.57213414",
"0.5717357",
"0.57094496",
"0.5685863",
"0.56795263",
"0.56787395",
"0.566... | 0.73994946 | 0 |
Process uploaded CSV to modify team memberships for given course run. | def post(self, request, **_kwargs):
self.check_access()
inputfile_handle = request.FILES['csv']
team_import_manager = TeamMembershipImportManager(self.course)
team_import_manager.set_team_membership_from_csv(inputfile_handle)
if team_import_manager.import_succeeded:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ProcessCSV(self, input_file, verbose, output_file):\n row_dict = self.CSVReader(input_file)\n report = []\n output_field_names = row_dict.fieldnames\n output_field_names.append('status')\n\n for row in row_dict:\n if 'action' in row.keys():\n if row['action'] == 'create':\n ... | [
"0.5829203",
"0.5684277",
"0.56755745",
"0.54426867",
"0.5373168",
"0.5292731",
"0.5240808",
"0.5231574",
"0.5214341",
"0.52073157",
"0.5177465",
"0.5176057",
"0.51721936",
"0.5167948",
"0.51524955",
"0.51391864",
"0.50790375",
"0.5051516",
"0.50377864",
"0.50362396",
"0.5031... | 0.6237988 | 0 |
return the version of pyzmq as a string | def pyzmq_version():
if __revision__:
return '@'.join([__version__,__revision__[:6]])
else:
return __version__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zmq_version():\n return \"%i.%i.%i\" % zmq_version_info()",
"def zmq_version():\n return \"%i.%i.%i\" % zmq_version_info()",
"def pyzmq_version_info():\n return version_info",
"def versionstring():\n return \"%i.%i.%i\" % __version__",
"def versionstring():\n return \"%i.%i.%i\" % __vers... | [
"0.8694501",
"0.8694501",
"0.8418009",
"0.72448",
"0.72448",
"0.72034657",
"0.7011062",
"0.69681036",
"0.6949386",
"0.69432604",
"0.6936414",
"0.6926458",
"0.69066197",
"0.69010836",
"0.6899091",
"0.689267",
"0.6848807",
"0.683185",
"0.683185",
"0.68175805",
"0.6794193",
"0... | 0.8830094 | 1 |
return the pyzmq version as a tuple of at least three numbers If pyzmq is a development version, `inf` will be appended after the third integer. | def pyzmq_version_info():
return version_info | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pyzmq_version_info():\n import re\n parts = re.findall('[0-9]+', __version__)\n parts = [ int(p) for p in parts ]\n if 'dev' in __version__:\n parts.append(float('inf'))\n return tuple(parts)",
"def zmq_version():\n return \"%i.%i.%i\" % zmq_version_info()",
"def zmq_version():\n ... | [
"0.8633001",
"0.7051661",
"0.7051661",
"0.69875443",
"0.69875443",
"0.66481936",
"0.6546135",
"0.64929646",
"0.63629013",
"0.63161844",
"0.6204475",
"0.6151709",
"0.61515826",
"0.6136629",
"0.6033484",
"0.601112",
"0.5972935",
"0.59679633",
"0.5963959",
"0.5955798",
"0.591376... | 0.7188286 | 1 |
return the version of libzmq as a string | def zmq_version():
return "%i.%i.%i" % zmq_version_info() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pyzmq_version():\n if __revision__:\n return '@'.join([__version__,__revision__[:6]])\n else:\n return __version__",
"def pyzmq_version():\n if __revision__:\n return '@'.join([__version__,__revision__[:6]])\n else:\n return __version__",
"def pyzmq_version_info():\n... | [
"0.8488278",
"0.8488278",
"0.8235017",
"0.73599553",
"0.7354212",
"0.7354212",
"0.71145326",
"0.7078067",
"0.70083076",
"0.6988752",
"0.6988752",
"0.69861287",
"0.6978695",
"0.6951259",
"0.68948215",
"0.6886311",
"0.6873413",
"0.6861176",
"0.68594515",
"0.684331",
"0.6834396"... | 0.8732305 | 1 |
Load an account from a keystore file. | def load(cls, path, password=None):
with open(path) as f:
keystore = json.load(f)
if not keys.check_keystore_json(keystore):
raise ValueError('Invalid keystore file')
return Account(keystore, password, path=path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_key(self, path):\n with open(path, 'r') as f:\n self._key = f.readline().strip()\n self._secret = f.readline().strip()",
"def load_accounts():\n logger.info('Loading accounts...')\n with open(\"C:\\\\Users\\\\harun\\\\Desktop\\\\BigSwede-volume-bot\\\\keys.txt\") as f... | [
"0.63404834",
"0.6274201",
"0.61477184",
"0.606554",
"0.6018339",
"0.59492487",
"0.59492487",
"0.59296626",
"0.59296626",
"0.59296626",
"0.59067225",
"0.5844401",
"0.5766854",
"0.5734278",
"0.57276446",
"0.5704144",
"0.5691289",
"0.5666819",
"0.56591445",
"0.5651659",
"0.5639... | 0.75301814 | 0 |
Dump the keystore for later disk storage. The result inherits the entries `'crypto'` and `'version`' from `account.keystore`, and adds `'address'` and `'id'` in accordance with the parameters `'include_address'` and `'include_id`'. If address or id are not known, they are not added, even if requested. | def dump(self, include_address=True, include_id=True):
d = {}
d['crypto'] = self.keystore['crypto']
d['version'] = self.keystore['version']
if include_address and self.address is not None:
d['address'] = encode_hex(self.address)
if include_id and self.uuid is not None... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dumpKey(self, key):\n return self.serializer.dumpKey((self.path, self._internalNs, key))",
"def dumpprivkey(self, address):\n return self.proxy.dumpprivkey(address)",
"def to_solders(self) -> instruction.AccountMeta:\n return instruction.AccountMeta(\n pubkey=self.pubkey.to... | [
"0.54970676",
"0.5473019",
"0.50777024",
"0.49854168",
"0.4960956",
"0.4940919",
"0.48113632",
"0.47993472",
"0.47677994",
"0.47404644",
"0.472648",
"0.47187394",
"0.47091952",
"0.46621236",
"0.4662119",
"0.4652701",
"0.46410176",
"0.46365127",
"0.4591232",
"0.4576956",
"0.45... | 0.6871018 | 0 |
Unlock the account with a password. If the account is already unlocked, nothing happens, even if the password is wrong. | def unlock(self, password):
if self.locked:
self._privkey = keys.decode_keystore_json(self.keystore, password)
self.locked = False
self.address # get address such that it stays accessible after a subsequent lock | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unlock_password(self, unlock_password):\n\n self._unlock_password = unlock_password",
"def wallet_unlock(timeout, password):\r\n return make_request({\"method\": \"wallet_unlock\",\r\n \"params\": [timeout, password],\r\n \"jsonrpc\": \"2.0\",\r\n ... | [
"0.78020746",
"0.7397535",
"0.7369417",
"0.7303214",
"0.6791064",
"0.6604817",
"0.65742713",
"0.63482356",
"0.6076229",
"0.6052057",
"0.5993819",
"0.59797645",
"0.5846542",
"0.5843638",
"0.5811201",
"0.5790452",
"0.5776551",
"0.5775485",
"0.57581645",
"0.57478845",
"0.5724141... | 0.77236056 | 1 |
Relock an unlocked account. This method sets `account.privkey` to `None` (unlike `account.address` which is preserved). After calling this method, both `account.privkey` and `account.pubkey` are `None. `account.address` stays unchanged, even if it has been derived from the private key. | def lock(self):
self._privkey = None
self.locked = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def un_lock(self):\n self._un_lock()",
"def unlock(self, password):\n if self.locked:\n self._privkey = keys.decode_keystore_json(self.keystore, password)\n self.locked = False\n self.address # get address such that it stays accessible after a subsequent lock",
"... | [
"0.60151225",
"0.58680826",
"0.56057805",
"0.55968404",
"0.5551273",
"0.54979974",
"0.54932714",
"0.5351291",
"0.5351185",
"0.53259677",
"0.5206671",
"0.5192101",
"0.5175717",
"0.51530045",
"0.5150401",
"0.5147221",
"0.5118755",
"0.5100769",
"0.50852764",
"0.5057117",
"0.4959... | 0.6688677 | 0 |
The account's private key or `None` if the account is locked | def privkey(self):
if not self.locked:
return self._privkey
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key_from_keyring(self):\n private_key = keyring.get_password(self.keyring_service_name, \"private_key\")\n\n if private_key is not None:\n return base64.b64decode(private_key)\n else:\n return None",
"def get_private_key():\n if not os.path.exists(_private_ke... | [
"0.7372854",
"0.70987725",
"0.7064863",
"0.7064863",
"0.7064863",
"0.7064863",
"0.7064863",
"0.7064863",
"0.70125204",
"0.69680035",
"0.6962871",
"0.69466114",
"0.69370025",
"0.6905054",
"0.6763055",
"0.6726718",
"0.6726718",
"0.66815436",
"0.6622614",
"0.6600715",
"0.6594226... | 0.79743135 | 0 |
The account's public key or `None` if the account is locked | def pubkey(self):
if not self.locked:
return privtopub(self.privkey)
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_public_key(self):\n return self.public_key",
"def get_public_key(self) -> str:\n\t\treturn self._publicKey",
"def public_key(self):\n return self._public_key",
"def public_key():\n if not Authorizer.__public_key:\n Authorizer.__public_key = download_public_key()\n ... | [
"0.74750537",
"0.72366947",
"0.72240925",
"0.715975",
"0.7080993",
"0.69483757",
"0.68467164",
"0.683302",
"0.6826058",
"0.67788434",
"0.67652756",
"0.6706563",
"0.66600585",
"0.6658998",
"0.6645899",
"0.6596226",
"0.65917075",
"0.6481067",
"0.646873",
"0.64667726",
"0.645523... | 0.7634534 | 0 |
The account's address or `None` if the address is not stored in the key file and cannot be reconstructed (because the account is locked) | def address(self):
if self._address:
pass
elif 'address' in self.keystore:
self._address = decode_hex(self.keystore['address'])
elif not self.locked:
self._address = keys.privtoaddr(self.privkey)
else:
return None
return self._addre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getaccountaddress(self, account):\n return self.proxy.getaccountaddress(account)",
"def __get_account(self, address):\n\t\tfor acct in self.wallet:\n\t\t\tif acct[\"address\"] == address:\n\t\t\t\treturn acct\n\t\traise ValueError(\"The given address does not exist in the bunkr-wallet\")",
"def get_... | [
"0.67752254",
"0.6772453",
"0.6334248",
"0.6160156",
"0.6129454",
"0.6075952",
"0.60441464",
"0.5999055",
"0.5988334",
"0.59722364",
"0.59495986",
"0.5936168",
"0.58568406",
"0.58568406",
"0.5835196",
"0.582275",
"0.58210737",
"0.5780858",
"0.5767812",
"0.574483",
"0.57388943... | 0.76786757 | 0 |
Sign a Transaction with the private key of this account. If the account is unlocked, this is equivalent to ``tx.sign(account.privkey)``. | def sign_tx(self, tx):
if self.privkey:
log.info('signing tx', tx=tx, account=self)
tx.sign(self.privkey)
else:
raise ValueError('Locked account cannot sign tx') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_transaction(self, transaction, prvkey):\n return self.web3.eth.account.sign_transaction(transaction, prvkey)",
"def sign_transaction(self, private_key):\n\n to_be_hashed = (str(self.timestamp) +\n str(self.sender_address) +\n str(self.recipient... | [
"0.73827463",
"0.67347753",
"0.66826165",
"0.64173603",
"0.6113134",
"0.6061946",
"0.5923547",
"0.58520955",
"0.5851417",
"0.5762892",
"0.5756385",
"0.56937367",
"0.5636568",
"0.556315",
"0.5550092",
"0.53663015",
"0.53283775",
"0.5224501",
"0.5224043",
"0.52132404",
"0.52121... | 0.81171614 | 0 |
Return the address that should be used as coinbase for new blocks. The coinbase address is given by the config field pow.coinbase_hex. If this does not exist or is `None`, the address of the first account is used instead. If there are no accounts, the coinbase is `DEFAULT_COINBASE`. | def coinbase(self):
cb_hex = self.app.config.get('pow', {}).get('coinbase_hex')
if cb_hex is None:
if not self.accounts_with_address:
return DEFAULT_COINBASE
cb = self.accounts_with_address[0].address
else:
# [NOTE]: check it!
# if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_coin_address(self, coin, idx=0):\n return self.coins[coin][idx]",
"def coinbase_transaction(self):\n return self.txns[0]",
"def _generate_new_address(self) -> str:\n while True:\n address = \"0x\" + \"\".join([str(hex(randint(0, 16)))[-1] for _ in range(20)])\n ... | [
"0.5670176",
"0.5642931",
"0.56078154",
"0.55952734",
"0.5577637",
"0.55478376",
"0.5547059",
"0.53384995",
"0.525013",
"0.52022433",
"0.51845676",
"0.51752895",
"0.50634557",
"0.5037472",
"0.4950477",
"0.4922192",
"0.48936066",
"0.48864445",
"0.48722824",
"0.48722824",
"0.48... | 0.8363927 | 0 |
Add an account. If `store` is true the account will be stored as a key file at the location given by | def add_account(self, account, store=True, include_address=True, include_id=True):
log.info('adding account', account=account)
if account.uuid is not None:
if len([acct for acct in self.accounts if acct.uuid == account.uuid]) > 0:
log.error('could not add account (UUID collis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_account(insert_dict):\n return ar.add_account(insert_dict)",
"def add_account(self, account):\n self.accounts[account.account_number] = account.json()\n # We should save in database the new account using self.di, but not now in order to get our tests passed",
"def put_account(self, acc... | [
"0.68259156",
"0.67054635",
"0.6587283",
"0.635063",
"0.630832",
"0.6297776",
"0.6190835",
"0.61585236",
"0.61477023",
"0.6079518",
"0.6062298",
"0.601684",
"0.6014998",
"0.588823",
"0.588823",
"0.58576864",
"0.5807971",
"0.57892823",
"0.57798",
"0.57309824",
"0.5724925",
"... | 0.77335066 | 0 |
Return a list of accounts whose address is known. | def accounts_with_address(self):
return [account for account in self if account.address] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getaddressesbyaccount(self, account):\n return self.proxy.getaddressesbyaccount(account)",
"def get_addresses_by_account(account):\n try:\n stdout = subprocess.check_output([\"litecoin-cli\", \"getaddressesbyaccount\", account])\n addresses = json.loads(stdout.decode())\n except:\n... | [
"0.74999386",
"0.7423678",
"0.66109467",
"0.6543392",
"0.64424306",
"0.64361393",
"0.63961643",
"0.6354172",
"0.630364",
"0.62626207",
"0.62626207",
"0.62626207",
"0.62267244",
"0.6221322",
"0.6163293",
"0.6120996",
"0.6102652",
"0.609976",
"0.60813385",
"0.6067618",
"0.60595... | 0.82608813 | 0 |
Return a list of all unlocked accounts. | def unlocked_accounts(self):
return [account for account in self if not account.locked] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_accounts(self):\n pass",
"def GetAccountList(self):\n\t\treturn self.accounts.keys()",
"def accounts(self):\n return self._accounts.values()",
"def get_accounts(self):\n\n\t\treturn self.__accounts",
"def get_accounts(self):\r\n return self._accounts",
"def get_accounts(self... | [
"0.7449079",
"0.7311108",
"0.69943327",
"0.6931124",
"0.6904392",
"0.6902841",
"0.6852999",
"0.6754795",
"0.6718667",
"0.6716359",
"0.66539514",
"0.6652501",
"0.6649218",
"0.6606659",
"0.65906733",
"0.6573111",
"0.6571516",
"0.6534863",
"0.64908",
"0.6382824",
"0.6382606",
... | 0.826161 | 0 |
Find an account by either its address, its id or its index as string. | def find(self, identifier):
try:
uuid = UUID(identifier)
except ValueError:
pass
else:
return self.get_by_id(uuid.hex)
try:
index = int(identifier, 10)
except ValueError:
pass
else:
if index <= 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_by_address(self, address):\n assert len(address) == 20\n accounts = [account for account in self.accounts if account.address == address]\n if len(accounts) == 0:\n raise KeyError('account with address {} not found'.format(encode_hex(address)))\n elif len(accounts) > 1... | [
"0.7091282",
"0.70101",
"0.6741426",
"0.6607906",
"0.65452147",
"0.6368728",
"0.6288083",
"0.6240474",
"0.6190939",
"0.6162079",
"0.6142825",
"0.6110892",
"0.59903294",
"0.59591204",
"0.59506804",
"0.59100705",
"0.5863223",
"0.5813489",
"0.5795571",
"0.5765253",
"0.57527816",... | 0.7409255 | 0 |
Get an account by its address. Note that even if an account with the given address exists, it might not be found if it is locked. Also, multiple accounts with the same address may exist, in which case the first one is returned (and a warning is logged). | def get_by_address(self, address):
assert len(address) == 20
accounts = [account for account in self.accounts if account.address == address]
if len(accounts) == 0:
raise KeyError('account with address {} not found'.format(encode_hex(address)))
elif len(accounts) > 1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_account(self, address):\n\t\tfor acct in self.wallet:\n\t\t\tif acct[\"address\"] == address:\n\t\t\t\treturn acct\n\t\traise ValueError(\"The given address does not exist in the bunkr-wallet\")",
"def get_account_address(account_name):\n command = 'getaddressesbyaccount {0}'.format(account_name)\n ... | [
"0.83126724",
"0.7148914",
"0.6936631",
"0.6594375",
"0.65813875",
"0.6577688",
"0.65748435",
"0.65710855",
"0.65379053",
"0.6483291",
"0.63688654",
"0.6363923",
"0.63583165",
"0.6298005",
"0.6284329",
"0.6278346",
"0.6228392",
"0.621566",
"0.62042093",
"0.61884844",
"0.61740... | 0.8195575 | 1 |
Provide app object to this function so it can render to the active screen. offset is tuple of x,y offset between screen and world spaces. | def render(self, app, offset, scale):
if self.alive:
# make the rectangle call more clear
x, y = self.position
x_off, y_off = offset
# (x, y, width, height)
pygame.draw.rect(app.screen, (0, 0, 0), ((x-x_off)*scale, (y-y_off)*scale, scale, scale)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw(self, screen, offsets: tuple):\r\n pass",
"def draw_final_screen(self):\r\n root = Tk()\r\n MapGUI(root, self)\r\n root.geometry('710x540')\r\n root.mainloop()",
"def draw(self):\n self.bufferX = (self.appWidth/2) - self.viewX\n self.bufferY = (self.app... | [
"0.5831567",
"0.5504448",
"0.55038303",
"0.54872006",
"0.5391657",
"0.5367334",
"0.53469855",
"0.53441095",
"0.5339002",
"0.52833486",
"0.525184",
"0.525184",
"0.525184",
"0.5250178",
"0.52477396",
"0.5215031",
"0.5191282",
"0.5160158",
"0.5156862",
"0.5154013",
"0.5150535",
... | 0.7094045 | 0 |
Converts radar constraints to loss function. | def _radar_constraints_to_loss_fn(model_object, model_metadata_dict, weight):
if weight is None:
return None
list_of_layer_operation_dicts = model_metadata_dict[
cnn.LAYER_OPERATIONS_KEY]
if list_of_layer_operation_dicts is None:
return None
error_checking.assert_is_greater(w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_loss(self):",
"def loss_function(self, train_head, train_tail, train_relation, train_head_corrupted, train_tail_corrupted):\n\n # train_head = tf.nn.l2_normalize(train_head, 1)\n # train_tail = tf.nn.l2_normalize(train_tail, 1)\n # train_head_corrupted = tf.nn.l2_normalize(train_... | [
"0.572387",
"0.5597469",
"0.5569241",
"0.5566827",
"0.55438685",
"0.5539016",
"0.5521757",
"0.5474468",
"0.538427",
"0.537411",
"0.5365464",
"0.5301405",
"0.52986217",
"0.52943707",
"0.5293178",
"0.52905613",
"0.528787",
"0.52767533",
"0.52766347",
"0.5273891",
"0.5249488",
... | 0.7147463 | 0 |
Converts minmax constraints to loss function. | def _minmax_constraints_to_loss_fn(model_object, model_metadata_dict, weight):
if weight is None:
return None
if isinstance(model_object.input, list):
list_of_input_tensors = model_object.input
else:
list_of_input_tensors = [model_object.input]
return weight * physical_constra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimum_maximum_model():\n inputs = tf.keras.Input(shape=(32, 32, 3,))\n x = tf.keras.layers.Conv2D(32, (3, 3))(inputs)\n x = tf.keras.layers.BatchNormalization(momentum=.3, epsilon=.65)(x, training=False)\n x = tf.minimum(x, .2)\n x = tf.maximum(x, .5)\n x = tf.keras.layers.Conv2D(16, (2, 2)... | [
"0.61076856",
"0.59945303",
"0.5945365",
"0.5944486",
"0.57432187",
"0.57406336",
"0.5717252",
"0.5641713",
"0.5635187",
"0.56118286",
"0.5606875",
"0.5570331",
"0.5559507",
"0.55502224",
"0.5524341",
"0.55190015",
"0.54859525",
"0.54845",
"0.54673964",
"0.5464751",
"0.545231... | 0.7389758 | 0 |
Initializes model input to climatological means. This function uses one mean for each radar field/height pair and each sounding field/height pair, rather than one per field altogether, to create "realistic" vertical profiles. If len(matrix_dimensions) = 3, this function creates initial soundings. If len(matrix_dimensio... | def init_function(matrix_dimensions):
initial_matrix = numpy.full(matrix_dimensions, numpy.nan)
if len(matrix_dimensions) == 5:
if model_metadata_dict[cnn.CONV_2D3D_KEY]:
radar_field_names = [radar_utils.REFL_NAME]
else:
radar_field_names = train... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_sequential(self, no_species): \n \n if not self.no_species is None and self.no_species != no_species:\n raise UserWarning('Inconsistent number of species')\n \n if not self.reaction_matrix is None:\n raise UserWarning('Reaction matrix already specif... | [
"0.5745114",
"0.54039425",
"0.5382511",
"0.53767085",
"0.53637964",
"0.53610015",
"0.5310794",
"0.5295331",
"0.5221406",
"0.52211905",
"0.5159903",
"0.5154952",
"0.51422185",
"0.511328",
"0.5110107",
"0.5085344",
"0.50707406",
"0.5057479",
"0.5044343",
"0.50182146",
"0.501587... | 0.66682935 | 0 |
Writes mean backwardsoptimized map to Pickle file. This is a mean over many examples, created by PMM (probabilitymatched means). T = number of input tensors to the model | def write_pmm_file(
pickle_file_name, list_of_mean_input_matrices,
list_of_mean_optimized_matrices, mean_initial_activation,
mean_final_activation, threshold_count_matrix, model_file_name,
standard_bwo_file_name, pmm_metadata_dict, monte_carlo_dict=None):
error_checking.assert_is_st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_exact_samples(expt):\n if isinstance(expt, str):\n expt = get_experiment(expt)\n tr_expt = get_training_expt(expt)\n\n for it in tr_expt.save_after:\n for avg in AVG_VALS:\n print 'Iteration', it, avg\n try:\n rbm = load_rbm(expt, it, avg)\n ... | [
"0.5540502",
"0.5410919",
"0.52998245",
"0.5268456",
"0.5252147",
"0.5138389",
"0.51344913",
"0.501607",
"0.5013239",
"0.49971172",
"0.49877456",
"0.49048364",
"0.4897931",
"0.48755917",
"0.48680896",
"0.48629835",
"0.48344624",
"0.48107708",
"0.4782014",
"0.47806332",
"0.477... | 0.5663493 | 0 |
Generate host labels for given target paths. | def _target_hosts(self, paths):
for path in paths:
response = self.api_client.get(path)
self.assertHttpOK(response)
content = json.loads(response.content)
(volume_node,) = content["volume"]["volume_nodes"]
yield volume_node["host_label"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_path_label(all_paths):\r\n n_folders_int = random.sample(range(0, len(all_paths)), n_way)\r\n image_labels = [[(glob.glob(all_paths[n] + '\\*')[k], n) # (path, label)\r\n for n in n_folders_int\r\n for k in random.sample(range(0, len(glob.glob(all_paths[n]... | [
"0.5883073",
"0.587188",
"0.58128756",
"0.57813144",
"0.5609945",
"0.5518473",
"0.5497135",
"0.5487288",
"0.54602253",
"0.5455289",
"0.5452322",
"0.5451359",
"0.5442688",
"0.5438281",
"0.5419456",
"0.5417686",
"0.5407599",
"0.54019946",
"0.5389299",
"0.5371655",
"0.53537387",... | 0.69032854 | 0 |
Test selecting target by filesystem with valid and invalid filesystem ids. | def test_select_by_filesystem(self):
self.create_simple_filesystem(synthetic_host("myserver"))
response = self.api_client.get("/api/target/", data={"filesystem_id": self.fs.id})
self.assertHttpOK(response)
content = json.loads(response.content)
self.assertEqual(3, len(content["o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bad_uuid_filesystem(self):\n command_line = [\"filesystem\", \"debug\", \"get-object-path\", \"--uuid=not\"]\n for prefix in [[], [\"--propagate\"]]:\n self.check_system_exit(prefix + command_line, _PARSE_ERROR)",
"def test_selectfiles_valueerror():\n base_dir = op.dirname(ni... | [
"0.58322895",
"0.5762496",
"0.5441926",
"0.537931",
"0.523172",
"0.52044904",
"0.5173235",
"0.51471275",
"0.51413643",
"0.5136519",
"0.5123438",
"0.51056176",
"0.508515",
"0.50498205",
"0.5000369",
"0.4993082",
"0.4965801",
"0.49629062",
"0.49609557",
"0.4960763",
"0.4946188"... | 0.6933552 | 0 |
(DivideAndConquer, list of numbers, number) > integer Return the index of key if key exists in list num_lst. Otherwise, return 1. | def linear_search(self, num_lst, key):
# Running time: O(n)
for i in range(len(num_lst)):
if num_lst[i] == key:
return i
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_search(self, num_lst, key):\r\n # Running time: O(log n) with O(n logn) overhead\r\n # get sorted list\r\n num_lst = sorted(num_lst)\r\n \r\n low, high, idx = 0, len(num_lst), -1\r\n \r\n while low < high:\r\n mid = int(math.floor((low+high) / ... | [
"0.7697088",
"0.6543535",
"0.653643",
"0.64344317",
"0.63068306",
"0.6304214",
"0.626743",
"0.6229502",
"0.6219176",
"0.6210949",
"0.6200517",
"0.61691916",
"0.61496985",
"0.6137044",
"0.6132949",
"0.6074663",
"0.6071227",
"0.6059525",
"0.60560364",
"0.60532534",
"0.6041803",... | 0.7588597 | 1 |
(DivideAndConquer, list of numbers, number) > integer Return the index of key if key exists in list num_lst. Otherwise, return 1. | def binary_search(self, num_lst, key):
# Running time: O(log n) with O(n logn) overhead
# get sorted list
num_lst = sorted(num_lst)
low, high, idx = 0, len(num_lst), -1
while low < high:
mid = int(math.floor((low+high) / 2.0))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linear_search(self, num_lst, key):\r\n # Running time: O(n)\r\n for i in range(len(num_lst)):\r\n if num_lst[i] == key:\r\n return i\r\n \r\n return -1",
"def linear_search(mylist, key):\r\n for i in range(len(mylist)):\r\n if mylist[i] == k... | [
"0.7588597",
"0.6543535",
"0.653643",
"0.64344317",
"0.63068306",
"0.6304214",
"0.626743",
"0.6229502",
"0.6219176",
"0.6210949",
"0.6200517",
"0.61691916",
"0.61496985",
"0.6137044",
"0.6132949",
"0.6074663",
"0.6071227",
"0.6059525",
"0.60560364",
"0.60532534",
"0.6041803",... | 0.7697088 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.