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 |
|---|---|---|---|---|---|---|
Checks existence and reads the dataset ids from the datasets file in the path directory | def are_datasets_created(path, number_of_datasets, suffix='parts'):
dataset_ids = []
try:
with open("%s%sdataset_%s" % (path, os.sep, suffix)) as datasets_file:
for line in datasets_file:
dataset = line.strip()
try:
dataset_id = bigml.api.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_existing_dataset(path: str):\n x_path = os.path.join(path, IMG_DIR)\n y_path = os.path.join(path, MSK_DIR)\n\n if os.path.isdir(x_path) and os.path.isdir(y_path):\n _, _, x_files = next(os.walk(x_path))\n _, _, y_files = next(os.walk(y_path))\n x = len(x_files)\n y = ... | [
"0.69508994",
"0.6614289",
"0.6478565",
"0.6459204",
"0.6396717",
"0.62318563",
"0.6189682",
"0.6144771",
"0.60864127",
"0.6037007",
"0.60348356",
"0.6009118",
"0.60084736",
"0.5995934",
"0.5956434",
"0.59551835",
"0.5938447",
"0.59359014",
"0.5930838",
"0.59119314",
"0.58973... | 0.6862595 | 1 |
Checks existence and reads the model ids from the models file in the path directory | def are_models_created(path, number_of_models):
model_ids = []
try:
with open("%s%smodels" % (path, os.sep)) as models_file:
for line in models_file:
model = line.strip()
try:
model_id = bigml.api.get_model_id(model)
mod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_models(self):\n result = os.system(\"python try_models.py\")\n return result == 0",
"def loadModel(self,path):\n print(\"Do you want to load previous model?\")\n models = os.walk(path).next()[1]\n i = 0\n for model in models:\n i+=1\n print ... | [
"0.65524",
"0.6300961",
"0.6269563",
"0.626782",
"0.6245917",
"0.61376613",
"0.60523903",
"0.60456765",
"0.60284334",
"0.59957314",
"0.5944237",
"0.59399444",
"0.59368753",
"0.5900701",
"0.5887453",
"0.5882582",
"0.5837352",
"0.58255213",
"0.5809561",
"0.58050466",
"0.5784281... | 0.6758628 | 0 |
Checks existence and reads the evaluation id from the evaluation file in the path directory | def is_evaluation_created(path):
evaluation_id = None
try:
with open("%s%sevaluation" % (path, os.sep)) as evaluation_file:
evaluation_id = evaluation_file.readline().strip()
try:
evaluation_id = bigml.api.get_evaluation_id(evaluation_id)
return Tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def are_evaluations_created(path, number_of_evaluations):\n evaluation_ids = []\n try:\n with open(\"%s%sevaluations\" % (path, os.sep)) as evaluations_file:\n for line in evaluations_file:\n evaluation = line.strip()\n try:\n evaluation_id =... | [
"0.6163792",
"0.5697825",
"0.56429964",
"0.5587962",
"0.5501932",
"0.54565716",
"0.5423377",
"0.5421286",
"0.5411025",
"0.5346915",
"0.53449285",
"0.53251463",
"0.5306407",
"0.52821845",
"0.5267402",
"0.5266863",
"0.520616",
"0.51961464",
"0.5171313",
"0.5169394",
"0.5145076"... | 0.7293446 | 0 |
Checks existence and reads the evaluation ids from the evaluations file in the path directory and checks the corresponding evaluations | def are_evaluations_created(path, number_of_evaluations):
evaluation_ids = []
try:
with open("%s%sevaluations" % (path, os.sep)) as evaluations_file:
for line in evaluations_file:
evaluation = line.strip()
try:
evaluation_id = bigml.api.get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_evaluation_created(path):\n evaluation_id = None\n try:\n with open(\"%s%sevaluation\" % (path, os.sep)) as evaluation_file:\n evaluation_id = evaluation_file.readline().strip()\n try:\n evaluation_id = bigml.api.get_evaluation_id(evaluation_id)\n ... | [
"0.7132974",
"0.6230202",
"0.5753548",
"0.5672073",
"0.56504387",
"0.56030095",
"0.5531955",
"0.5484185",
"0.54200715",
"0.5413317",
"0.5398396",
"0.5388747",
"0.53874403",
"0.5337041",
"0.5317957",
"0.5295957",
"0.5291907",
"0.5290801",
"0.52776295",
"0.5270711",
"0.5265054"... | 0.7365887 | 0 |
Checks and reads the ensembles ids from the ensembles file in the path directory | def are_ensembles_created(path, number_of_ensembles):
ensemble_ids = []
try:
with open("%s%sensembles" % (path, os.sep)) as ensembles_file:
for line in ensembles_file:
ensemble = line.strip()
try:
ensemble_id = bigml.api.get_ensemble_id(ens... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _search_for_edge_ids(path):\n for label in os.listdir(path):\n\n label_path = os.path.join(path, label)\n\n # skip over files because we are only looking for directories.\n if os.path.isfile(label_path):\n continue\n\n # run over all the edge id's that we can find\n ... | [
"0.5848508",
"0.5795825",
"0.5751438",
"0.5633122",
"0.55975336",
"0.55883926",
"0.5583644",
"0.5564009",
"0.5540943",
"0.55323786",
"0.5479212",
"0.5445843",
"0.5392122",
"0.5389563",
"0.53860235",
"0.5372258",
"0.5363183",
"0.53431255",
"0.5342207",
"0.53270364",
"0.5325015... | 0.68549156 | 0 |
Checks existence and reads the batch prediction id from the batch_prediction file in the path directory | def is_batch_prediction_created(path):
batch_prediction_id = None
try:
with open("%s%sbatch_prediction"
% (path, os.sep)) as batch_prediction_file:
batch_prediction_id = batch_prediction_file.readline().strip()
try:
batch_prediction_id = bigml.ap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_batch_centroid_created(path):\n batch_centroid_id = None\n try:\n with open(\"%s%sbatch_centroid\"\n % (path, os.sep)) as batch_prediction_file:\n batch_centroid_id = batch_prediction_file.readline().strip()\n try:\n batch_centroid_id = bigm... | [
"0.6292112",
"0.61347395",
"0.6040491",
"0.588049",
"0.577372",
"0.5770257",
"0.5758085",
"0.5662908",
"0.5652563",
"0.56143993",
"0.56143403",
"0.5590299",
"0.55595005",
"0.5555321",
"0.5504496",
"0.54917634",
"0.54780984",
"0.5477779",
"0.54773515",
"0.54676497",
"0.5434658... | 0.7900772 | 0 |
Checks existence and reads the batch centroid id from the batch_centroid file in the path directory | def is_batch_centroid_created(path):
batch_centroid_id = None
try:
with open("%s%sbatch_centroid"
% (path, os.sep)) as batch_prediction_file:
batch_centroid_id = batch_prediction_file.readline().strip()
try:
batch_centroid_id = bigml.api.get_batc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_batch_prediction_created(path):\n batch_prediction_id = None\n try:\n with open(\"%s%sbatch_prediction\"\n % (path, os.sep)) as batch_prediction_file:\n batch_prediction_id = batch_prediction_file.readline().strip()\n try:\n batch_prediction... | [
"0.5684861",
"0.55700254",
"0.5402168",
"0.5373294",
"0.53131473",
"0.5303044",
"0.5278353",
"0.5162516",
"0.51456755",
"0.5019115",
"0.5019115",
"0.5011427",
"0.5002791",
"0.500226",
"0.49815163",
"0.4965306",
"0.49350756",
"0.49140757",
"0.49133533",
"0.49112892",
"0.487490... | 0.8258264 | 0 |
Checks existence and reads the cluster ids from the clusters file in the path directory | def are_clusters_created(path, number_of_clusters):
cluster_ids = []
try:
with open("%s%sclusters" % (path, os.sep)) as clusters_file:
for line in clusters_file:
cluster = line.strip()
try:
cluster_id = bigml.api.get_cluster_id(cluster)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_clusters(cluster_path): #{{{\n print 'loading cluster info'\n indicesToParticle = pickle.load(open(cluster_path+\"/verticesToParticle.p\",\"rb\"))\n indicesOnCluster = pickle.load(open(cluster_path+\"/verticesOnCell.p\",\"rb\"))\n maxIndices = pickle.load(open(cluster_path+\"/maxVertices.p\",\"... | [
"0.6521857",
"0.65111554",
"0.59153485",
"0.5873677",
"0.5729161",
"0.56219536",
"0.55279994",
"0.55245763",
"0.5462616",
"0.5458218",
"0.5438761",
"0.53862226",
"0.5382349",
"0.53420544",
"0.5297303",
"0.52951795",
"0.5267583",
"0.5242905",
"0.5234494",
"0.5231533",
"0.52243... | 0.70944107 | 0 |
Checks existence and reads the batch anomaly score id from the batch_anomaly_score file in the path directory | def is_batch_anomaly_score_created(path):
batch_anomaly_score_id = None
try:
with open("%s%sbatch_anomaly_score"
% (path, os.sep)) as batch_prediction_file:
batch_anomaly_score_id = batch_prediction_file.readline().strip()
try:
batch_anomaly_scor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_batch_centroid_created(path):\n batch_centroid_id = None\n try:\n with open(\"%s%sbatch_centroid\"\n % (path, os.sep)) as batch_prediction_file:\n batch_centroid_id = batch_prediction_file.readline().strip()\n try:\n batch_centroid_id = bigm... | [
"0.6063852",
"0.6058655",
"0.5549551",
"0.5188341",
"0.5080789",
"0.5012873",
"0.4952389",
"0.4951337",
"0.49360022",
"0.49267706",
"0.4880867",
"0.48798177",
"0.4849954",
"0.4840906",
"0.48230192",
"0.48171574",
"0.4763462",
"0.47251898",
"0.4725091",
"0.47154698",
"0.471377... | 0.799724 | 0 |
Checks existence and reads the anomaly detector ids from the anomalies file in the path directory | def are_anomalies_created(path, number_of_anomalies):
anomaly_ids = []
try:
with open("%s%sanomalies" % (path, os.sep)) as anomalies_file:
for line in anomalies_file:
anomaly = line.strip()
try:
anomaly_id = bigml.api.get_anomaly_id(anomaly... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_anomaly_ids(self):\n\n return list(self.anomalies_dict.keys())",
"def load_annos(self, anno_path):\n\n if os.path.exists(anno_path) is False or os.path.isfile(anno_path) is False or anno_path.endswith('txt') is False:\n print(\"Wrong path: not exist or not a txt file: %s\" % anno... | [
"0.569608",
"0.5688023",
"0.55869764",
"0.54770017",
"0.5436613",
"0.5371917",
"0.52183867",
"0.5217379",
"0.5184739",
"0.51843405",
"0.51440156",
"0.5127035",
"0.50912595",
"0.5085647",
"0.50769573",
"0.5061242",
"0.50260806",
"0.50260556",
"0.5016195",
"0.49755508",
"0.4969... | 0.71869653 | 0 |
Checks existence and reads project id from the project file in the path directory | def is_project_created(path):
project_id = None
try:
with open("%s%sproject"
% (path, os.sep)) as project_file:
project_id = project_file.readline().strip()
try:
project_id = bigml.api.get_project_id(
project_id)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_project_by_id(self, project_id):\n try:\n with open('{}/{}'.format(self._storage_location, project_id)) as project_file:\n name = project_file.readline().rstrip('\\n')\n description = project_file.readline().rstrip('\\n')\n members = project_f... | [
"0.6570896",
"0.6409932",
"0.63601273",
"0.63177305",
"0.62860036",
"0.6036987",
"0.6019873",
"0.59948355",
"0.5994519",
"0.5994519",
"0.59796953",
"0.59755075",
"0.5958248",
"0.5942535",
"0.5925003",
"0.5909906",
"0.5895709",
"0.58922344",
"0.57947063",
"0.57551557",
"0.5739... | 0.7370473 | 0 |
Extract tensors from a TF checkpoint file. Arguments | def extract_tensors_from_checkpoint_file(filename, output_folder='weights'):
if not os.path.exists(output_folder):
os.makedirs(output_folder)
reader = tf.train.NewCheckpointReader(filename)
for key in reader.get_variable_to_shape_map():
# not saving the following tensors
if key == ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensors_key_in_file(file_name):\n try:\n reader = pywrap_tensorflow.NewCheckpointReader(file_name)\n return reader.get_variable_to_shape_map()\n except Exception as e: # pylint: disable=broad-except\n print(str(e))\n return None",
"def extract_input(config, params, num_take... | [
"0.62842596",
"0.6082958",
"0.603471",
"0.6004818",
"0.59452486",
"0.5900973",
"0.58502144",
"0.58471453",
"0.579675",
"0.5768008",
"0.57032853",
"0.5697751",
"0.5685617",
"0.5622366",
"0.56073815",
"0.5598",
"0.55509114",
"0.55441743",
"0.55099916",
"0.550919",
"0.5499702",
... | 0.73526514 | 0 |
Helper function which calculates the target state value using a Double Q value estimation procedure. Essentially the same as _q_state_value_estimate, except we use the current network to choose the actions which inform next state value. | def _double_q_state_value_estimate(self, state, nonterminal_mask, non_final_states, feasible_mask):
next_state_values = to_variable(to_cuda(torch.zeros(state[0].size(0)).float(), self.gpu_device))
nonterminal_feasible_mask = feasible_mask[nonterminal_mask.nonzero().view(-1)]
predictions_dq = sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getQValue(self, state, action):\n \"*** YOUR CODE HERE ***\"\n # OUR CODE HERE\n #get the value of the state\n qVal = self.values[state]\n #iterate through the MDP transition states from the current state\n for transitionState, probability in self.mdp.getTransitionStatesAndProbs(state, action... | [
"0.7085973",
"0.6998429",
"0.6955414",
"0.6887809",
"0.6849144",
"0.68480814",
"0.68450147",
"0.6774333",
"0.66910607",
"0.66718096",
"0.66662997",
"0.661473",
"0.660896",
"0.6608444",
"0.6550372",
"0.6530071",
"0.6522578",
"0.64948535",
"0.6487683",
"0.6475836",
"0.64442134"... | 0.70714486 | 1 |
Convenience function for logging state value and actionadvantage values | def log_values_and_advantages(self, state):
advantage = self.model.get_advantage(to_variable(to_cuda(state, self.gpu_device)))
self.writer.add_histogram(tag='predictions/advantages',
values=advantage.view(-1),
global_step=self.total_ste... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magic_logstate(self,parameter_s=''):\n\n self.logstate()",
"def log_state(self):\n\n log('-' * 50)\n log('.level=%d' % self.level)\n log('.view_llon=%.3f, .view_rlon=%.3f'\n % (self.view_llon, self.view_rlon))\n log('.view_tlat=%.3f, .view_blat=%.3f'\n ... | [
"0.64897895",
"0.6394397",
"0.61965495",
"0.6193664",
"0.6090853",
"0.60332114",
"0.5908176",
"0.58908147",
"0.5860385",
"0.5856234",
"0.5821361",
"0.5796618",
"0.5737136",
"0.57267636",
"0.57195586",
"0.56981784",
"0.5697701",
"0.5690816",
"0.56618196",
"0.56543565",
"0.5647... | 0.6472947 | 1 |
Returns a list of WeightSeq extracted from the sequence file | def parse(self):
if self._parse is None:
seqs = [] # list of Weighted Sequences generated by parsing file
with open(self._seqfile, "r") as f:
for i, l in enumerate(f.readlines()):
try:
float(l) # try if line is numbers only... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sequence(self):\n\n with open(self.input_file, 'r') as input_file:\n\n tree = ET.parse(input_file)\n root = tree.getroot()\n\n #print('Root:', root)\n\n # TODO: Expand to handle multiple parts\n part_list_idx = -1\n part_idx = -1\n\n ... | [
"0.64108676",
"0.6391239",
"0.61099696",
"0.579101",
"0.5783094",
"0.5779583",
"0.5770836",
"0.5766802",
"0.5726474",
"0.5646491",
"0.5617893",
"0.5602426",
"0.5569256",
"0.5554135",
"0.55480313",
"0.54824543",
"0.54511106",
"0.544651",
"0.5443406",
"0.54264915",
"0.54146636"... | 0.7071571 | 0 |
Returns a dictionary of sequences motifs, using the prediction threshold thre. | def motifs(self, thre, align):
if self._parse is None:
print "No previous parsing"
print "Parsing file..."
seqs = self.parse()
self._parse = seqs
print "Done"
else:
seqs = self._parse
seqs[0].weight(self._seqfile, self._pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, text, threshold=.0):\n if not self.k_model or not self.w2v_model:\n raise RuntimeError(\"Model not in memory, please load it train new model\")\n start_at = time.time()\n x_test = keras.preprocessing.sequence.pad_sequences(\n self.tokenizer.texts_to_sequ... | [
"0.5951144",
"0.5902914",
"0.58115363",
"0.5776467",
"0.56621766",
"0.5658737",
"0.5572019",
"0.54720587",
"0.54682094",
"0.54625624",
"0.5448748",
"0.5351352",
"0.53127074",
"0.5301677",
"0.5289368",
"0.5279566",
"0.5279346",
"0.52598876",
"0.52520496",
"0.5234284",
"0.52297... | 0.6571638 | 0 |
Write the output file of all the found motifs. Compute the motifs search first. | def write(self, output):
keys = self._motifs.keys()
keys.sort()
thre = self._motifs['threshold'] # threshold used for motif detection
align = self._motifs["align"] # alignment score used to detect motifs
with open(output, "w") as o:
# Precise time of the computa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_results(out_models, output):\n i = 1\n print(\"Saving models...\")\n path = os.getcwd()\n for model in out_models: # Saves all models in the current working directory\n model.save_to_mmCIF(path+\"/\"+output + \"_\" + str(i))\n i += 1\n print(\"Done\\n\")",
"def create_outpu... | [
"0.5801621",
"0.56843776",
"0.5672842",
"0.56423485",
"0.5611933",
"0.560736",
"0.56033814",
"0.55976254",
"0.55966514",
"0.55679494",
"0.55648607",
"0.5560963",
"0.5522328",
"0.5513184",
"0.55054325",
"0.5503646",
"0.54982406",
"0.5490208",
"0.5485489",
"0.5477042",
"0.54759... | 0.75619805 | 0 |
Disallow crossservice imports backend.common is allowed | def _is_allowed(self, i):
x = re.search(r"src\/backend\/(.*)\/", self.filename)
if not x:
return True
service = x.group(1).split("/")[0]
frm, imp, _ = i
if frm == ["backend"]:
return False
if frm and frm[0] == "backend" and frm[1] not in {service... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supports_ordinary_make_module_imports(self):\n return True",
"def modifyComponentsNotPreferableOnServer(self):\n # Nothing to do\n pass",
"def importlib_only(fxn):\n return unittest.skipIf(using___import__, \"importlib-specific test\")(fxn)",
"def test_import_error_message_maintai... | [
"0.5900071",
"0.58623016",
"0.5859138",
"0.56879085",
"0.5487771",
"0.5433567",
"0.53926075",
"0.53201085",
"0.5319822",
"0.5309835",
"0.52735174",
"0.523188",
"0.52019984",
"0.51840407",
"0.5168991",
"0.5131262",
"0.507478",
"0.5070411",
"0.50365",
"0.50136185",
"0.4975917",... | 0.6013417 | 0 |
Twosided symmetric version of match(). | def match_twosided(desc1,desc2):
matches_12 = match(desc1, desc2)
matches_21 = match(desc2, desc1)
ndx_12 = matches_12.nonzero()[0]
# remove matches that are not symmetric
for n in ndx_12:
if matches_21[int(matches_12[n])] != n:
matches_12[n] = 0
return matches_12 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_twosided(desc1,desc2):\n\t\n\tmatches_12 = match(desc1,desc2)\n\tmatches_21 = match(desc2,desc1)\n\t\n\tndx_12 = matches_12.nonzero()[0]\n\t\n\t#remove matches that are not symmetric\n\tfor n in ndx_12:\n\t\tif matches_21[int(matches_12[n])] != n:\n\t\t\tmatches_12[n] = 0\n\t\n\treturn matches_12",
"de... | [
"0.67383593",
"0.6653829",
"0.65622157",
"0.62280434",
"0.62277544",
"0.61835223",
"0.6165463",
"0.6158128",
"0.6085873",
"0.59920526",
"0.5964808",
"0.59354484",
"0.59230363",
"0.58303934",
"0.5819086",
"0.5798695",
"0.5782075",
"0.57652706",
"0.57652706",
"0.5760947",
"0.57... | 0.6759908 | 0 |
Flag of the type of electrodes. In reality, all electrodes are electric. But we do idealize some loops as theoretical "magnetic dipoles" (TxMagneticDipole, RxMagneticPoint). ``xtype`` is a flag for this. | def xtype(self):
if not hasattr(self, '_xtype'):
if 'Magnetic' in self.__class__.__name__:
self._xtype = 'magnetic'
else: # Default
self._xtype = 'electric'
return self._xtype | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def electric_conductivity_type(self, electric_conductivity_type):\n\n self._electric_conductivity_type = electric_conductivity_type",
"def determine_type(self):\n \n t = \" \" # Holder string\n self.cs = 0. \n ## On the lowest rigidities\n if ... | [
"0.5380986",
"0.5166215",
"0.5109209",
"0.5069397",
"0.4998176",
"0.490009",
"0.48088792",
"0.48088792",
"0.4785739",
"0.4783738",
"0.4753157",
"0.46910185",
"0.46853745",
"0.4669401",
"0.46679038",
"0.45764908",
"0.45552787",
"0.45506328",
"0.44963318",
"0.4480175",
"0.44746... | 0.64197206 | 0 |
Center point of all unique electrodes. | def center(self):
if not hasattr(self, '_center'):
self._center = np.unique(self.points, axis=0).mean(axis=0)
return self._center | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getcenter(self):\n return self.centro.cartesianas()",
"def center(self):\n return np.array([0,0,1/self.C+self.pos()])",
"def center_coords(self):\n coords = set()\n for x in range(self.radius, self.container.width - self.radius):\n for y in range(self.radius, self.con... | [
"0.7497538",
"0.72402495",
"0.7230702",
"0.7188021",
"0.71684515",
"0.7156947",
"0.7155124",
"0.7150742",
"0.7122283",
"0.70652604",
"0.70320046",
"0.70289564",
"0.7020563",
"0.7007491",
"0.6973991",
"0.6965426",
"0.6962298",
"0.6956157",
"0.69408244",
"0.6928281",
"0.6890359... | 0.75465447 | 0 |
Total length of all dipole segments formed by the electrodes. | def length(self):
if not hasattr(self, '_length'):
lengths = np.linalg.norm(np.diff(self.points, axis=0), axis=1)
self._segment_lengths = lengths
self._length = lengths.sum()
return self._length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perimeter(self):\n return sum([s.length for s in self.segments])",
"def perimeter(self):\n return sum(seg.length for seg in self.segments) + \\\n sum([p.perimeter for p in self.subs])",
"def Lengths(self):\n\n self.__do_essential_memebers_exist__()\n\n if self.ele... | [
"0.80503774",
"0.7307756",
"0.72855043",
"0.7231356",
"0.720365",
"0.7186324",
"0.7186324",
"0.70576584",
"0.7001449",
"0.6893308",
"0.6877794",
"0.686698",
"0.68479615",
"0.68406725",
"0.68000835",
"0.6771557",
"0.67691845",
"0.674418",
"0.6726382",
"0.6705633",
"0.6674243",... | 0.7385069 | 1 |
Number of dipole segments in the wire. | def segment_n(self):
return len(self.segment_lengths) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSegmentCount(self) -> int:\n ...",
"def perimeter(self):\n return sum([s.length for s in self.segments])",
"def numSegments(self):\n\n return self.getHierView().numSegments()",
"def get_number_of_segments(self):\n\n return len(self._break_points) - 1",
"def Test_NumSegmen... | [
"0.7402712",
"0.7225274",
"0.7203328",
"0.7046521",
"0.692937",
"0.68568283",
"0.67618185",
"0.675613",
"0.6744179",
"0.6694563",
"0.66095746",
"0.6567191",
"0.6509661",
"0.6490328",
"0.6486113",
"0.6427348",
"0.6426144",
"0.64130676",
"0.640741",
"0.63927484",
"0.6356994",
... | 0.730032 | 1 |
Returns source field for given grid and frequency. | def get_field(self, grid, frequency):
return fields.get_source_field(grid, self, frequency) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_source(self, fire, nx, ny):\n\n source_function = fire.get_fire_intensity(nx, ny)\n return source_function",
"def process_source(self):\n source_col = getattr(self.model_cls, self.source)\n return source_col",
"def get_source(source, data):\n\n # source = 'NCv1.143'\n ... | [
"0.60641634",
"0.5519083",
"0.5452689",
"0.54273677",
"0.5252738",
"0.5159689",
"0.50812256",
"0.5000313",
"0.49818432",
"0.4947018",
"0.49054027",
"0.48774648",
"0.4850176",
"0.48488113",
"0.48453102",
"0.48416123",
"0.48333117",
"0.48157346",
"0.4815526",
"0.47603464",
"0.4... | 0.8502229 | 0 |
Returns coordinates as absolute positions. | def coordinates_abs(self, source):
if not hasattr(self, 'azimuth'):
return self.center_abs(source)
else:
return (*self.center_abs(source), self.azimuth, self.elevation) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAbsCoords( self, x=None, y=None ):\n\n if x is None:\n x = self.x\n if y is None:\n y = self.y\n\n p = self.parent\n\n absX = 0\n absY = 0\n\n while( p != None ):\n absX += p.x\n absY += p.y\n\n p = p.parent\n\n... | [
"0.7399363",
"0.7141006",
"0.70108825",
"0.70069796",
"0.6961071",
"0.676948",
"0.66608614",
"0.6656578",
"0.65883106",
"0.65872556",
"0.65746295",
"0.65456504",
"0.6528503",
"0.6520862",
"0.65205306",
"0.6500652",
"0.6487818",
"0.6487818",
"0.6478254",
"0.64700836",
"0.64659... | 0.7315676 | 1 |
Return points of a loop of area perpendicular to source dipole. | def point_to_square_loop(source, area):
half_diag = np.sqrt(area/2)
xyz_hor = rotation(source[3]+90.0, 0.0)*half_diag
xyz_ver = rotation(source[3], source[4]+90.0)*half_diag
points = source[:3] + np.stack(
[xyz_hor, xyz_ver, -xyz_hor, -xyz_ver, xyz_hor])
return points | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def side_points(p, v, L): \r\n u = np.array([-v[1], v[0]]) # positive normal of v:\r\n N = list() # list of points on one side of the line p,v:\r\n for k in range(len(L)):\r\n if (L[k] - p).dot(u) >= 0:\r\n N.append(L[k])\r\n \r\n return N",
"def f_v(_a, _vs, _Ps, _Ps0): # _a... | [
"0.61379343",
"0.59706724",
"0.59346133",
"0.57996655",
"0.5789641",
"0.57445914",
"0.5728997",
"0.57270455",
"0.5724417",
"0.572157",
"0.57177347",
"0.5708585",
"0.5653201",
"0.56021845",
"0.55937946",
"0.5518361",
"0.5517352",
"0.5466883",
"0.54622954",
"0.54515094",
"0.544... | 0.6380234 | 0 |
Return a list of all possible DOM CWDs on a hub | def getAllCWDs():
return ["%01d%01d%s" % (card, pair, dom)
for card in range(MAXCARDS)
for pair in range(MAXPAIRS)
for dom in DOMLABELS] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_paths():\n paths = [\n '/'\n ]\n return paths",
"def get_htdocs_dirs(self):\n return []",
"def get_htdocs_dirs(self):\n return []",
"def get_dirs(hub: pop.hub.Hub, sub: pop.hub.Sub) -> List[str]:\n return sub._dirs",
"def get_drives() -> list:\n\n drives = []\n bitma... | [
"0.6307109",
"0.6117734",
"0.6117734",
"0.60298336",
"0.5876268",
"0.5815954",
"0.57664955",
"0.57047606",
"0.5668845",
"0.5553812",
"0.55284995",
"0.55111086",
"0.54948545",
"0.54704875",
"0.5465287",
"0.5461864",
"0.5433296",
"0.5416863",
"0.540349",
"0.54031587",
"0.536569... | 0.7072273 | 0 |
Returns Trajectory object by guessing the type from basename. | def open_trajectory(basename):
if os.path.isfile(basename + '.trr'):
print "Detected GROMACS trajectory"
return gromacs.Trajectory(basename)
if os.path.isfile(basename + '.psf'):
print "Detected NAMD trajectory"
return namd.Trajectory(basename)
if os.path.isfile(basename + '.top'):
print "Dete... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(path):",
"def _get_file_object(infilename):\n\n _, extension = os.path.splitext(infilename)\n if extension.lower() == '.spe':\n return parsers.SpeFile(infilename)\n elif extension.lower() == '.spc':\n return parsers.SpcFile(infilename)\n elif extension.lower() == '.cnf':\n ... | [
"0.6108348",
"0.60932434",
"0.6087357",
"0.55990344",
"0.55393994",
"0.5527216",
"0.55259997",
"0.55259997",
"0.54993016",
"0.5482326",
"0.54304856",
"0.5339499",
"0.5324195",
"0.52972865",
"0.52902544",
"0.52732736",
"0.51666754",
"0.5134144",
"0.51300573",
"0.51194865",
"0.... | 0.7009351 | 0 |
Make a PDB from the ith frame of a trajectory described by basename. Optional residue bfactors are loaded into residues. | def make_pdb_from_trajectory(
basename, i_frame, out_pdb, res_bfactors=None):
trajectory = open_trajectory(basename)
trajectory.load_frame(i_frame)
if res_bfactors is not None:
trajectory.soup.load_residue_bfactors(res_bfactors)
trajectory.soup.write_pdb(out_pdb)
del trajectory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, input_pdb, autodock, autodock_2, psiblast_path, nr_path):\n self.home = os.getcwd()\n self.autodock = \"MGL=\" + autodock + \"\\n\"\n self.autodock_2 = \"ADT=\" + autodock_2 + \"\\n\"\n self.psiblast_path = psiblast_path\n self.nr_path = nr_path\n self.p... | [
"0.52199477",
"0.52163404",
"0.5095667",
"0.5093261",
"0.5042101",
"0.4995638",
"0.49392733",
"0.4908115",
"0.48156542",
"0.4768204",
"0.4754739",
"0.474425",
"0.46991536",
"0.46769282",
"0.4669942",
"0.46699008",
"0.46455985",
"0.4613742",
"0.45921308",
"0.45730266",
"0.4551... | 0.7069034 | 0 |
Returns the n_frame_per_ps of a trajectory by reading any .config files that would have been generated using simualte.py. | def guess_n_frame_per_ps(basename):
config = basename + ".config"
try:
params = util.read_dict(config)
# assuming 1fs time step
n_step_per_ps = 1000
if 'n_step_per_snapshot' in params:
n_step_per_snapshot = params['n_step_per_snapshot']
n_frame_per_ps = n_step_per_ps / n_step_per_snapshot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNFiles(self, config, base, logger=None):\n if 'nfiles' in config:\n return galsim.config.ParseValue(config, 'nfiles', base, int)[0]\n else:\n return 189",
"def _get_num_steps(trajectory: gsd.hoomd.HOOMDTrajectory) -> int:\n # Start with the index being the last frame... | [
"0.59914404",
"0.59607935",
"0.5866079",
"0.5810951",
"0.57379156",
"0.56929755",
"0.5683085",
"0.5680713",
"0.5680713",
"0.56220967",
"0.55147165",
"0.55077046",
"0.5491919",
"0.54492724",
"0.5368442",
"0.5320789",
"0.5311296",
"0.5303595",
"0.5302764",
"0.5297113",
"0.52920... | 0.7048133 | 0 |
Return all available output formats. Returns | def available_output_formats():
output_formats = []
for v in pkg_resources.iter_entry_points(_DRIVERS_ENTRY_POINT):
try:
output_formats.append(
v.load().OutputData.METADATA["driver_name"])
except AttributeError:
pass
return output_formats | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_formats(self) -> List[DataFormat]:\n return [DataFormat.NGEN_OUTPUT]",
"def available_output_formats() -> Dict:\n output_formats = {}\n for v in drivers:\n driver_ = v.load()\n if hasattr(driver_, \"METADATA\") and (driver_.METADATA[\"mode\"] in [\"w\", \"rw\"]):\n ... | [
"0.8014056",
"0.7774638",
"0.7744746",
"0.7554377",
"0.7439517",
"0.7368245",
"0.73478186",
"0.7248938",
"0.7074706",
"0.7042081",
"0.67619634",
"0.67571443",
"0.6710912",
"0.6593027",
"0.65163505",
"0.6512377",
"0.6480068",
"0.62770015",
"0.6241907",
"0.6228549",
"0.61607057... | 0.8307449 | 0 |
Return all available input formats. Returns | def available_input_formats():
input_formats = []
# Extensions.
for v in pkg_resources.iter_entry_points(_DRIVERS_ENTRY_POINT):
try:
input_formats.append(v.load().InputData.METADATA["driver_name"])
except ImportError:
raise
except Exception:
pass
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formats(self):\n logger.debug(\"Get formats\")\n return self._raw_api.formats.get()",
"def test_available_input_formats():\n assert set([\"Mapchete\", \"raster_file\", \"vector_file\"]).issubset(\n set(available_input_formats())\n )",
"def get_import_formats(self):\n retur... | [
"0.7496176",
"0.74461544",
"0.73611027",
"0.731491",
"0.71019524",
"0.70249325",
"0.6943627",
"0.6916563",
"0.6871027",
"0.67508274",
"0.672959",
"0.6711386",
"0.66898644",
"0.6684593",
"0.6552732",
"0.65227216",
"0.64209926",
"0.63732475",
"0.62202567",
"0.61848813",
"0.6108... | 0.81445754 | 0 |
Return a list of the elements in s, but without duplicates. For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3], unique("abcabc") some permutation of ["a", "b", "c"], and unique(([1, 2], [2, 3], [1, 2])) some permutation of [[2, 3], [1, 2]]. For best speed, all sequence elements should be hashable. Then u... | def unique(s):
n = len(s)
if n == 0:
return []
# Try using a dict first, as that's the fastest and will usually
# work. If it doesn't work, it will usually fail quickly, so it
# usually doesn't cost much to *try* it. It requires that all the
# sequence elements be hashable, and suppo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uniq(seq):\r\n seen = set()\r\n seen_add = seen.add\r\n return [x for x in seq if x not in seen and not seen_add(x)]",
"def unique(seq):\n return list(set(seq))",
"def _unique_sorted(seq):\n seen = set()\n seen_add = seen.add\n return [x for x in seq if not (x in seen or seen_add(x))]"... | [
"0.73046064",
"0.72944945",
"0.7278668",
"0.72444713",
"0.72254175",
"0.72023",
"0.70915973",
"0.70714456",
"0.70321584",
"0.7005913",
"0.6956718",
"0.69519854",
"0.68733823",
"0.6810534",
"0.6795005",
"0.676601",
"0.67638236",
"0.6740827",
"0.6734546",
"0.66632324",
"0.65908... | 0.7969764 | 1 |
Domains we receive email for, but which we don't actually accept for local storage (IMAP) but just for forwarding. | def virtual_domains():
domains = set([(item.strip()).partition("=")[0].partition("@")[2] \
for item in os.environ["POSTFIX_MAIL_FORWARDS"].split(",")])
domains.discard("")
return domains | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actual_domains():\n domains = set([item.strip()\n for item in os.environ[\"POSTFIX_EMAIL_HOSTS\"].split(\",\")])\n domains.discard(\"\")\n for virtual in virtual_domains():\n domains.discard(virtual)\n return domains",
"def relevant_domains(self):\n pa... | [
"0.70132357",
"0.6468016",
"0.6384975",
"0.59673417",
"0.58842134",
"0.58732474",
"0.58578837",
"0.58250284",
"0.5810187",
"0.58032334",
"0.5778817",
"0.5773457",
"0.5773457",
"0.5767844",
"0.5744374",
"0.5725108",
"0.5720069",
"0.56639296",
"0.56633884",
"0.56358606",
"0.563... | 0.6960647 | 1 |
All domains for which we are the true final destination, that is no email forwarding to external providers. | def actual_domains():
domains = set([item.strip()
for item in os.environ["POSTFIX_EMAIL_HOSTS"].split(",")])
domains.discard("")
for virtual in virtual_domains():
domains.discard(virtual)
return domains | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relevant_domains(self):\n pass",
"def virtual_domains():\n domains = set([(item.strip()).partition(\"=\")[0].partition(\"@\")[2] \\\n for item in os.environ[\"POSTFIX_MAIL_FORWARDS\"].split(\",\")])\n domains.discard(\"\")\n return domains",
"def all_domains():\n ... | [
"0.7209617",
"0.6609535",
"0.6351444",
"0.6304639",
"0.62784135",
"0.627307",
"0.62657344",
"0.6234329",
"0.61379534",
"0.61027527",
"0.6099811",
"0.60929966",
"0.6077022",
"0.6025631",
"0.6008572",
"0.59999204",
"0.59442985",
"0.5943879",
"0.5935924",
"0.5894087",
"0.5861971... | 0.7259303 | 0 |
Connect the database to our Flask App. | def connect_to_db(app):
#Configure to use our Postgres databse
app.config['SQLALCHEMY_DATABASE_URI'] ='postgresql:///results' #double check this
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db.app = app
db.init_app(app) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_to_db(app):\n\n # Configure to use our SQLite database\n app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///snaillove.db'\n db.app = app\n db.init_app(app)",
"def connect_db(app: Flask):\n\n db.app = app\n db.init_app(app)",
"def connect_to_db(app):\n\n # Configure to use our P... | [
"0.81742525",
"0.81375396",
"0.80520564",
"0.8047942",
"0.80444306",
"0.8022344",
"0.8008353",
"0.8000845",
"0.7993593",
"0.7983762",
"0.79692155",
"0.793527",
"0.7934183",
"0.7927277",
"0.7906329",
"0.7904533",
"0.7904533",
"0.7903049",
"0.7884125",
"0.7884125",
"0.7884125",... | 0.8165678 | 1 |
Test case for workflows_get | def test_workflows_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_workflows_find_one_get(self):\n pass",
"def test_workflows_list(self):\n pass",
"def test_workflows_id_team_get(self):\n pass",
"def test_workflows_id_get(self):\n pass",
"def test_workflows_id_exists_get(self):\n pass",
"def test_get_workflow_definition(self):... | [
"0.8070687",
"0.7967046",
"0.79318464",
"0.79281706",
"0.75574213",
"0.7503531",
"0.74831486",
"0.7395697",
"0.72457546",
"0.71581185",
"0.70519435",
"0.6942522",
"0.68664724",
"0.6820854",
"0.6763503",
"0.67598945",
"0.6735586",
"0.67130214",
"0.66862565",
"0.6623346",
"0.66... | 0.9234206 | 0 |
Test case for workflows_list | def test_workflows_list(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_workflows_get(self):\n pass",
"def test_workflows_get(self):\n pass",
"def test_cron_workflow_service_list_cron_workflows(self):\n pass",
"def test_cron_workflow_service_list_cron_workflows2(self):\n pass",
"def test_workflows_count_get(self):\n pass",
"def tes... | [
"0.8237379",
"0.8237379",
"0.7943174",
"0.789291",
"0.7043261",
"0.68932676",
"0.68891174",
"0.68331075",
"0.6821893",
"0.67970777",
"0.6750702",
"0.67496383",
"0.6708938",
"0.6565932",
"0.6557964",
"0.65472",
"0.6536024",
"0.65205544",
"0.6413697",
"0.64115953",
"0.6396738",... | 0.9316845 | 0 |
Test case for workflows_restart | def test_workflows_restart(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_relaunch_deployment_run(self):\n pass",
"def restart(self):\n self.client.post(self.path+'/action', { 'restart': {} })\n return True",
"def _restart(self):\n pass",
"def test_hostmgr_restart_job_succeeds(self, failure_tester):\n job = failure_tester.job(job_file=\"... | [
"0.7136366",
"0.6973278",
"0.690132",
"0.6893637",
"0.6882668",
"0.6861319",
"0.67941874",
"0.67120594",
"0.6686659",
"0.6684018",
"0.6644943",
"0.65984666",
"0.6565029",
"0.654949",
"0.6549472",
"0.65442497",
"0.6543798",
"0.653278",
"0.6522977",
"0.6505811",
"0.6490706",
... | 0.93425924 | 0 |
Return the default access token passed by constructor. | def get_default_access_token(self):
return self.default_access_token | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_token(self, access_token):\n if access_token:\n return access_token\n elif self.default_access_token:\n return self.default_access_token\n else:\n return ''",
"def access_token(*args, **kwargs):\n return None",
"def _get_token(self):\n if ... | [
"0.770101",
"0.7082217",
"0.6983656",
"0.69209474",
"0.6902591",
"0.6902591",
"0.6902591",
"0.6902591",
"0.6902591",
"0.6902591",
"0.6902591",
"0.6902591",
"0.6902591",
"0.6902591",
"0.6902591",
"0.686125",
"0.6827636",
"0.6692377",
"0.66869175",
"0.6596651",
"0.65312254",
... | 0.86561614 | 0 |
Convert an datetime string to RFC1123 format. Example | def _convert_to_rfc1123(self, datetime):
try:
new_date_format = parse(datetime).strftime(
'%a, %d %b %Y %H:%M:%S GMT')
except Exception as ex:
raise InvalidDateTimeFormat({'datetime': datetime})
return new_date_format | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_rfc1123(when):\n # AWS sends us a time zone in all cases, but in Python it's more\n # annoying to figure out time zones, so just fake it.\n assert when.tzinfo is None\n return when.strftime(RFC1123) + 'GMT'",
"def rfc1123_date(ts=None):\n ts = _get_gmtime_compatible_timestamp(ts)\n year,... | [
"0.7438959",
"0.7387103",
"0.64358395",
"0.5991403",
"0.5954925",
"0.5913922",
"0.58671314",
"0.5787306",
"0.578061",
"0.57456684",
"0.57118696",
"0.57000786",
"0.5639048",
"0.55980295",
"0.55590135",
"0.5509751",
"0.5504431",
"0.54575586",
"0.5409709",
"0.540778",
"0.5405193... | 0.79866266 | 0 |
Choose an access_token to be used for each request. | def get_token(self, access_token):
if access_token:
return access_token
elif self.default_access_token:
return self.default_access_token
else:
return '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_access_token(self, *args, **kwargs):\n response = super().request_access_token(*args, **kwargs)\n if \"access_token\" not in response:\n response[\"access_token\"] = response[\"id_token\"]\n return response",
"def _set_access_token(self):\n integration_context =... | [
"0.72032034",
"0.67438114",
"0.67014915",
"0.65984637",
"0.65911996",
"0.65698713",
"0.65373254",
"0.65298885",
"0.64713866",
"0.6443348",
"0.6384484",
"0.6350625",
"0.63311726",
"0.6278322",
"0.6252074",
"0.6215772",
"0.6174813",
"0.6164255",
"0.61552703",
"0.6149511",
"0.61... | 0.7058946 | 1 |
Factory/dispatch method for returning a PacBio Choice Option Type | def _pacbio_choice_option_from_dict(d):
choices = d['choices']
default_value = d['default']
# this will immediately raise
option_type_id = TaskOptionTypes.from_choice_str(d['optionTypeId'])
opt_id = d['id']
name = d['name']
desc = to_utf8(d['description'])
klass_map = {TaskOptionTypes.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, choice):\r\n self.choice = choice",
"def pacbio_option_from_dict(d):\n # This should probably be pushed into pbcommand/pb_io/* for consistency\n # Extensions are supported by adding a dispatch method by looking for\n # required key(s) in the dict.\n if \"choices\" in d and d... | [
"0.6315759",
"0.62639457",
"0.6201601",
"0.6074929",
"0.60170126",
"0.59150046",
"0.5827651",
"0.5712287",
"0.5712287",
"0.5711449",
"0.5710883",
"0.5709212",
"0.56913024",
"0.56407434",
"0.5637033",
"0.56220746",
"0.55641913",
"0.55554587",
"0.55426127",
"0.55355257",
"0.553... | 0.6321403 | 0 |
Fundamental API for loading any PacBioOption type from a dict | def pacbio_option_from_dict(d):
# This should probably be pushed into pbcommand/pb_io/* for consistency
# Extensions are supported by adding a dispatch method by looking for
# required key(s) in the dict.
if "choices" in d and d.get('choices') is not None:
# the None check is for the TCs that ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pacbio_choice_option_from_dict(d):\n choices = d['choices']\n default_value = d['default']\n # this will immediately raise\n option_type_id = TaskOptionTypes.from_choice_str(d['optionTypeId'])\n\n opt_id = d['id']\n name = d['name']\n desc = to_utf8(d['description'])\n\n klass_map = {T... | [
"0.6975218",
"0.6883456",
"0.5733877",
"0.5652194",
"0.5610695",
"0.54534376",
"0.54523367",
"0.5424139",
"0.53617144",
"0.5239894",
"0.51549876",
"0.51395416",
"0.5127605",
"0.5098348",
"0.50602573",
"0.5050498",
"0.50451106",
"0.50279456",
"0.5004721",
"0.49707347",
"0.4952... | 0.745734 | 0 |
Load pipeline presets from dictionary. This expects a schema where the options are arrays of type (id,value,optionTypeId), but it will also accept a shorthand where the options are dictionaries. | def load_pipeline_presets_from(d):
validate_presets(d)
options = d['options']
if isinstance(options, list):
options = {o['id']: o['value'] for o in options}
taskOptions = d['taskOptions']
if isinstance(taskOptions, list):
taskOptions = {o['id']: o['value'] for o in taskOptions}
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_preset(self, filename, options, REQUEST=None):\r\n\r\n # TODO presets.py - load_preset - specify options parameter to map plugins, fields, etc.\r\n\r\n raise NotImplementedError",
"def from_dict(cls, dikt) -> 'PipelineDefinition':\n return util.deserialize_model(dikt, cls)",
"def ... | [
"0.5869272",
"0.54986167",
"0.54267955",
"0.51771784",
"0.51771784",
"0.50867397",
"0.50464827",
"0.5045407",
"0.4866802",
"0.48285294",
"0.4823274",
"0.4735606",
"0.47212029",
"0.47183105",
"0.47178125",
"0.4672122",
"0.46380574",
"0.46209493",
"0.46178946",
"0.45966622",
"0... | 0.758141 | 0 |
Encode field data to integer. | def encode(self, value: typing.Union[int, str]) -> int:
return int(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_int(self, data):\n return u'%d' % data",
"def encode_int(n):\n return struct.pack(\">I\", n)",
"def _encode_field(self, field_type, field_data, subcontent=None):\n self.logger.debug(\n '_encode_field(): pytype %s values %s',\n type(field_data).__name__, repr(fi... | [
"0.6812039",
"0.6595646",
"0.65577626",
"0.63327485",
"0.63142365",
"0.6165077",
"0.6117363",
"0.6090864",
"0.6023376",
"0.60161436",
"0.59732836",
"0.59493953",
"0.5908374",
"0.58190507",
"0.5793727",
"0.578483",
"0.57664716",
"0.57543963",
"0.5754299",
"0.5747672",
"0.57449... | 0.712766 | 0 |
Decode field integer to user readable data. | def decode(self, number: int) -> typing.Union[int, str]:
return number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_extra_field(self, string):\n\n if isinstance(string, str):\n try:\n decode = int(string)\n except ValueError:\n return string\n return decode\n else:\n return string",
"def decode(self, value):\r\n pass",
... | [
"0.6864027",
"0.63531303",
"0.633361",
"0.6315359",
"0.62673813",
"0.6195054",
"0.61505705",
"0.6067177",
"0.6060564",
"0.6055781",
"0.5977854",
"0.582253",
"0.5821836",
"0.5809388",
"0.58006054",
"0.5756726",
"0.5706289",
"0.5687559",
"0.5684129",
"0.56773263",
"0.5655196",
... | 0.650782 | 1 |
Parse final id to info dictionary. | def parse(self, the_id: typing.Union[int, str]) -> typing.Dict:
id_num = self._parse(the_id)
parts = self._disassemble(id_num)
info = self._decode(parts)
return info | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_res_id(response):\n pass",
"def extract_obj_id_from_query(id_row: Text) -> Dict:\n pairs = id_row.split(\",\")\n _id = {}\n for pair in pairs:\n key, value = pair.split(\"=\")\n _id[key] = value\n return _id",
"def decode(id):\n parts = _from_hashid(id).split(\".\")\n ... | [
"0.6101815",
"0.5991716",
"0.5986676",
"0.5957056",
"0.5699884",
"0.56192374",
"0.5570541",
"0.5549716",
"0.55473965",
"0.5544718",
"0.54703426",
"0.5420432",
"0.5397389",
"0.5379969",
"0.53717124",
"0.5362212",
"0.531876",
"0.5308405",
"0.5305951",
"0.5300774",
"0.5297522",
... | 0.7048866 | 0 |
Assemble list of number components to id number. | def _assemble(self, parts: typing.List[int]) -> int:
if len(parts) != len(self.fields):
raise ValueError('the number of parts must be the same with fields')
id_num = 0
number: int
field: IdField
for number, field in zip(parts, self.fields):
if not 0 <= nu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_id(elements: Iterable) -> str:\r\n i = 1\r\n while str(i) in elements:\r\n i += 1\r\n return str(i)",
"def genNumIdList(numId, idSize):\n\tiDs = []\n\tfor i in range(numId):\n\t\tiDs.append(genNumID(idSize))\n\treturn iDs",
"def mk_lst_atnum(self):\n\t\telem_rnge=[]\n\t\tfor i in sel... | [
"0.62259835",
"0.61142963",
"0.6106656",
"0.5978999",
"0.58860636",
"0.5815764",
"0.58104277",
"0.58091563",
"0.5803445",
"0.5789259",
"0.5733388",
"0.5700235",
"0.5676421",
"0.56755966",
"0.5661031",
"0.565708",
"0.56529063",
"0.56528264",
"0.563435",
"0.5626979",
"0.5622427... | 0.64970696 | 0 |
Disassemble id number to a list of number components. | def _disassemble(self, id_num: int) -> typing.List[int]:
parts: typing.List[int] = []
for field in reversed(self.fields):
number = id_num & field.mask
parts.append(number)
id_num >>= field.bits
if id_num != 0:
raise ValueError(f'the highest not us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genNumIdList(numId, idSize):\n\tiDs = []\n\tfor i in range(numId):\n\t\tiDs.append(genNumID(idSize))\n\treturn iDs",
"def two_digits_into_list(nr: int) -> list:\n return [int(a) for a in list(str(nr))]\n pass",
"def __ui_convert_ids_string_to_list(string_of_ids):\n if string_of_ids == \"\":\n ... | [
"0.57069206",
"0.564162",
"0.56138444",
"0.5562113",
"0.54734707",
"0.5470049",
"0.543087",
"0.54243475",
"0.53579736",
"0.527423",
"0.52425474",
"0.52371424",
"0.5212557",
"0.51916504",
"0.5177181",
"0.5148028",
"0.51163846",
"0.51108664",
"0.51059103",
"0.50871164",
"0.5078... | 0.7343412 | 0 |
Convert id number to human readable number or string. | def _format(self, id_num: int) -> typing.Union[int, str]:
return id_num | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internal_id_to_display_id(i_id: int) -> str:\n i_id = str(i_id).zfill(9)\n return ''.join(i_id[x - 1] for x in [1, 5, 9, 6, 3, 8, 2, 4, 7])",
"def to_number(self, id):\r\n if isinstance(id, int):\r\n return id\r\n else:\r\n return self.name_to_number(id)",
"def to_... | [
"0.7482443",
"0.7353478",
"0.67633516",
"0.66934085",
"0.6634442",
"0.6476008",
"0.6442243",
"0.6408369",
"0.6373768",
"0.63609725",
"0.63312715",
"0.632353",
"0.6317255",
"0.6306219",
"0.63052404",
"0.62990665",
"0.6231041",
"0.62251574",
"0.62188715",
"0.6165512",
"0.613591... | 0.78892547 | 0 |
Parse number id from human readable number or string. | def _parse(self, the_id: typing.Union[int, str]) -> int:
return int(the_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_number(txt):\n return int(txt)",
"def parse(value):\n return int(value)",
"def try_parse_number(s):\n if s.startswith(\"0\") and len(s) != 1 and not s.startswith(\"0.\"):\n return s\n # Try parsing a nmeric\n try:\n return int(s)\n except ValueError: # Try float or... | [
"0.7031369",
"0.6487151",
"0.6422873",
"0.63092387",
"0.63074",
"0.63002795",
"0.62676585",
"0.62528056",
"0.62378776",
"0.62360334",
"0.6221814",
"0.6210405",
"0.6158311",
"0.615466",
"0.6152703",
"0.6144594",
"0.61277574",
"0.6087264",
"0.6057295",
"0.6037283",
"0.60296035"... | 0.70958203 | 0 |
This function returns the content of the GIS's layout templates formatted as dict. | def get_layout_templates(gis=None):
from arcgis.geoprocessing import DataFile
from arcgis.geoprocessing._support import _execute_gp_tool
kwargs = locals()
param_db = {
"output_json": (str, "Output JSON"),
}
return_values = [
{"name": "output_json", "display_name": "Ou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_template_data(self) -> dict:\n template_data = self._get_template_data()\n\n @dataclass\n class FileEntry:\n \"\"\"Provides an entry into manifest object.\"\"\"\n\n name: str\n size: str\n md5: Optional[str]\n\n template_data[\"resourc... | [
"0.607484",
"0.6032562",
"0.5983779",
"0.5972719",
"0.5889923",
"0.5873045",
"0.5828445",
"0.57792765",
"0.5773428",
"0.575569",
"0.5738789",
"0.57386744",
"0.5733378",
"0.57162774",
"0.5710317",
"0.5648379",
"0.562339",
"0.5613403",
"0.5593175",
"0.55093825",
"0.5507729",
... | 0.68387705 | 0 |
Write a chunk to the file specified by the open file object, chunk number and data supplied. | def chunk(f, n, data):
# Chunk ID
f.write(number(2, n))
# Chunk length
f.write(number(4, len(data)))
# Data
f.write(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writeChunk(chunk):",
"def exposed_write_data(self, chunk_id, data):\n local_filename = self.chunk_filename(chunk_id)\n with open(local_filename, \"w\") as file:\n file.write(data)\n # self.handle_table[chunk_id] = local_filename",
"def write_chunks(file, chun... | [
"0.72443557",
"0.7063639",
"0.7023709",
"0.6554109",
"0.6511954",
"0.6470567",
"0.6422777",
"0.63440853",
"0.6293792",
"0.6200333",
"0.61798894",
"0.61678743",
"0.60873127",
"0.6057285",
"0.59995997",
"0.59689665",
"0.5949116",
"0.59309393",
"0.5925884",
"0.5913812",
"0.58790... | 0.7126541 | 1 |
Read a data block from a tape chunk and return the program name, load and execution addresses, block data, block number and whether the block is supposedly the last in the file. | def read_block(chunk):
# Chunk number and data
chunk_id = chunk[0]
data = chunk[1]
# For the implicit tape data chunk, just read the block as a series
# of bytes, as before
if chunk_id == 0x100:
block = data
else: # 0x102
if UEF_major == 0 and UEF_minor < 9:
# For UEF file versions earlier than 0.9,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _block_info(data):\n # check that the data is an array of bytes\n if len(data) != 6:\n raise ValueError(\"'data' should be 6 bytes. Got {} instead.\".format(\n len(data)))\n return struct.unpack('<Hi', data)",
"def get_block(self):\n # Read in data in blocks so as to not tie... | [
"0.5665381",
"0.5631371",
"0.55277836",
"0.5479697",
"0.5472151",
"0.5392832",
"0.53812736",
"0.53668875",
"0.5364994",
"0.52919036",
"0.524602",
"0.5185491",
"0.516049",
"0.5155399",
"0.5136651",
"0.5107634",
"0.5105618",
"0.51014274",
"0.50963074",
"0.5059121",
"0.50206476"... | 0.6397294 | 0 |
Get the leafname of the specified file. | def get_leafname(path):
pos = string.rfind(path, os.sep)
if pos != -1:
return path[pos+1:]
else:
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_name(filename: str):\n basename = os.path.basename(filename)\n basename_split = os.path.splitext(basename)\n root = None\n if len(basename_split) == 2:\n root = basename_split[0]\n return root",
"def rootname(filename):\n name = os.path.basename(filename)\n root, ext = os.pat... | [
"0.6976201",
"0.6899912",
"0.6824257",
"0.67096627",
"0.66442513",
"0.65279335",
"0.6458309",
"0.64063346",
"0.63521576",
"0.6351935",
"0.6351935",
"0.63391185",
"0.6315485",
"0.6300824",
"0.6298311",
"0.6292117",
"0.62914497",
"0.6287577",
"0.6284846",
"0.62813586",
"0.62801... | 0.7109227 | 0 |
Find the next chunk from the position specified which has an ID in the list of IDs given. | def find_next_chunk(chunks, pos, IDs):
while pos < len(chunks):
if chunks[pos][0] in IDs:
# Found a chunk with ID in the list
return pos, chunks[pos]
# Otherwise continue looking
pos = pos + 1
return None, None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_next_block(chunks, pos):\n\n\twhile pos < len(chunks):\n\n\t\tpos, chunk = find_next_chunk(chunks, pos, [0x100, 0x102])\n\n#\t\tif chunks[pos][0] == 0x100 or chunks[pos][0] == 0x102:\n\n#\t\t\tif len(chunks[pos][1]) > 1:\n\n\t\tif pos == None:\n\n\t\t\treturn None\n\t\telse:\n\t\t\tif len(chunk[1]) > 1:\n... | [
"0.600599",
"0.59835386",
"0.5943317",
"0.5663881",
"0.55934817",
"0.5587817",
"0.55786186",
"0.5518458",
"0.5504024",
"0.5408037",
"0.5378468",
"0.53575325",
"0.5352472",
"0.5294345",
"0.5289194",
"0.52188545",
"0.5218617",
"0.5200436",
"0.51936644",
"0.51886356",
"0.515609"... | 0.86052835 | 0 |
Find the next file block in the list of chunks. | def find_next_block(chunks, pos):
while pos < len(chunks):
pos, chunk = find_next_chunk(chunks, pos, [0x100, 0x102])
# if chunks[pos][0] == 0x100 or chunks[pos][0] == 0x102:
# if len(chunks[pos][1]) > 1:
if pos == None:
return None
else:
if len(chunk[1]) > 1:
# Found a block, return this posi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_file_start(chunks, pos):\n\n\tpos = pos - 1\n\twhile pos > 0:\n\n\t\tif chunks[pos][0] != 0x100 and chunks[pos][0] != 0x102:\n\n\t\t\t# This is not a block\n\t\t\treturn pos\n\n\t\telse:\n\t\t\tpos = pos - 1\n\n\treturn pos",
"def find_file_end(chunks, pos):\n\n\tpos = pos + 1\n\twhile pos < len(chunks)... | [
"0.697973",
"0.69048446",
"0.66371393",
"0.61183995",
"0.58899575",
"0.58194757",
"0.580845",
"0.57708406",
"0.57293695",
"0.57030886",
"0.56779855",
"0.5640135",
"0.5612054",
"0.55223644",
"0.5518697",
"0.55133915",
"0.55102086",
"0.5508604",
"0.54951084",
"0.5472255",
"0.54... | 0.7569317 | 0 |
Find a chunk before the one specified which is not a file block. | def find_file_start(chunks, pos):
pos = pos - 1
while pos > 0:
if chunks[pos][0] != 0x100 and chunks[pos][0] != 0x102:
# This is not a block
return pos
else:
pos = pos - 1
return pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_next_block(chunks, pos):\n\n\twhile pos < len(chunks):\n\n\t\tpos, chunk = find_next_chunk(chunks, pos, [0x100, 0x102])\n\n#\t\tif chunks[pos][0] == 0x100 or chunks[pos][0] == 0x102:\n\n#\t\t\tif len(chunks[pos][1]) > 1:\n\n\t\tif pos == None:\n\n\t\t\treturn None\n\t\telse:\n\t\t\tif len(chunk[1]) > 1:\n... | [
"0.6531959",
"0.64561254",
"0.6206573",
"0.59149754",
"0.58008",
"0.57870895",
"0.5611538",
"0.5590496",
"0.55514336",
"0.55464274",
"0.54865235",
"0.54514736",
"0.5451451",
"0.5389041",
"0.5318842",
"0.52776855",
"0.5245404",
"0.5221601",
"0.52212423",
"0.5215123",
"0.520014... | 0.73474026 | 0 |
Find a chunk after the one specified which is not a file block. | def find_file_end(chunks, pos):
pos = pos + 1
while pos < len(chunks)-1:
if chunks[pos][0] != 0x100 and chunks[pos][0] != 0x102:
# This is not a block
return pos
else:
pos = pos + 1
return pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_file_start(chunks, pos):\n\n\tpos = pos - 1\n\twhile pos > 0:\n\n\t\tif chunks[pos][0] != 0x100 and chunks[pos][0] != 0x102:\n\n\t\t\t# This is not a block\n\t\t\treturn pos\n\n\t\telse:\n\t\t\tpos = pos - 1\n\n\treturn pos",
"def find_next_block(chunks, pos):\n\n\twhile pos < len(chunks):\n\n\t\tpos, c... | [
"0.6899765",
"0.68623376",
"0.59608024",
"0.58929473",
"0.58870953",
"0.58684754",
"0.5796162",
"0.5783809",
"0.55599594",
"0.5549232",
"0.5542972",
"0.55371046",
"0.55353194",
"0.5435706",
"0.53687376",
"0.53617156",
"0.53470737",
"0.53340805",
"0.53241694",
"0.5295418",
"0.... | 0.76235753 | 0 |
Write the UEF file header and version number to a file. | def write_uef_header(file, major, minor):
# Write the UEF file header
file.write('UEF File!\000')
# Minor and major version numbers
file.write(number(1, minor) + number(1, major)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _write_header(self, out_handle):\n out_handle.write(\"##gff-version 3\\n\")",
"def write_to_file(unit, fobj):\n\n _write_all_headers(unit, fobj)\n _write_all_sections(unit, fobj)",
"def write_header(self):\r\n if self.arguments['--out']:\r\n self.file = open(self.arguments['-... | [
"0.7131227",
"0.6982185",
"0.68458116",
"0.6630245",
"0.6548148",
"0.65364665",
"0.6405133",
"0.63510054",
"0.63078344",
"0.62870014",
"0.6249134",
"0.62067604",
"0.62042403",
"0.61852497",
"0.6175493",
"0.6158622",
"0.61522216",
"0.61198986",
"0.6084054",
"0.60605603",
"0.60... | 0.7984582 | 0 |
Write a creator chunk to a file. | def write_uef_creator(file, originator):
origin = originator + '\000'
if (len(origin) % 4) != 0:
origin = origin + ('\000'*(4-(len(origin) % 4)))
# Write the creator chunk
chunk(file, 0, origin) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writeChunk(chunk):",
"def write(self, fname):\n pass",
"def write( chunk, callback=None ):",
"def create_file(self, name: str, content: str) -> None:\n file_path = self.path + os.path.sep + name\n with open(file_path, \"w+\") as file:\n file.write(content)\n fil... | [
"0.64100707",
"0.6066347",
"0.6031312",
"0.59644854",
"0.59570944",
"0.5801987",
"0.5801987",
"0.5801505",
"0.5767103",
"0.5713072",
"0.57108897",
"0.5709923",
"0.5695413",
"0.5644885",
"0.56303734",
"0.5617313",
"0.56171423",
"0.559269",
"0.5568376",
"0.55679005",
"0.5523469... | 0.6926097 | 0 |
Write the target machine and keyboard layout information to a file. | def write_machine_info(file, machine, keyboard):
machines = {'BBC Model A': 0, 'Electron': 1, 'BBC Model B': 2, 'BBC Master':3}
keyboards = {'any': 0, 'physical': 1, 'logical': 2}
if machine in machines:
machine = machines[target_machine]
else:
machine = 0
if keyboard in keyboards:
keyboard = keyboards[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_target_info(self):\n \n #make sure the file exists\n path = self.communicator.image_store.project_path + \\\n self.target_file_name\n fout = open(path, 'w')\n\n print str(1)\n print str(len(self.target_list)-1)\n for i in range(1, len(self.targe... | [
"0.591069",
"0.5701914",
"0.5684859",
"0.5653159",
"0.5633111",
"0.5617388",
"0.5576352",
"0.55507",
"0.5543504",
"0.5513595",
"0.5507975",
"0.5495696",
"0.5475892",
"0.5474484",
"0.5465598",
"0.54419035",
"0.54094565",
"0.5369284",
"0.53678536",
"0.5350123",
"0.5347424",
"... | 0.7100612 | 0 |
Write all the chunks in the list to a file. Saves having loops in other functions to do this. | def write_chunks(file, chunks):
for c in chunks:
chunk(file, c[0], c[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_list(self):\n with open(self.path, 'w') as file:\n for i in map(self.addziros, range(1, int(str(1) + self.number_length * '0') + 1)):\n file.write(i + '\\n')\n file.close()",
"def write(lst):\n # TODO",
"def writeAlltoFile(self):\n with open(self.... | [
"0.6848338",
"0.652354",
"0.6477836",
"0.6395893",
"0.638424",
"0.6364835",
"0.63633317",
"0.6317153",
"0.62954223",
"0.6243458",
"0.6220498",
"0.62164426",
"0.6159575",
"0.6134967",
"0.6099251",
"0.6095363",
"0.60939705",
"0.60598403",
"0.6053925",
"0.6035411",
"0.5983696",
... | 0.7401738 | 0 |
Traverse the list of filenames to insert, reading the relevant information, creating suitable chunks, and inserting them into the list of chunks. | def create_chunks(file_names):
new_chunks = []
for name in file_names:
# Find the .inf file and read the details stored within
try:
details = open(name + suffix + 'inf', 'r').readline()
except IOError:
try:
details = open(name + suffix + 'INF', 'r').readline()
except IOError:
print("Couldn'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_chunk(self, idx):\n for f in self.filenames[idx:]:\n ...",
"def chunk_input(self, input_files, chunksize):\n part_lists = [] # Lists of partial files\n known_nlines = None\n part_suffix = \"\"\n chunk_nlines = chunksize * 2\n\n for input_file in inpu... | [
"0.64536774",
"0.6082033",
"0.60642034",
"0.58560264",
"0.5782456",
"0.5780947",
"0.57476187",
"0.5739023",
"0.56999916",
"0.5691127",
"0.56863034",
"0.5604628",
"0.5572229",
"0.55204123",
"0.5497575",
"0.5492186",
"0.5459591",
"0.54563016",
"0.543934",
"0.5432482",
"0.542337... | 0.68652356 | 0 |
Count the number of a given type of scoring event. | def count(self, score_type="try"):
df = self.scores
try:
return df[df['type']==score_type].count()['value']
except KeyError:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_type_score(self, g, w):\n if w.event_type == \"malicious-email\":\n return self.n_score((w.event_type == g.event_type, w.event_subtype == g.event_subtype))\n else:\n return self.indicator(w.event_type, g.event_type)",
"def count(time):\n \n return len(events(ti... | [
"0.65875006",
"0.62305194",
"0.6034122",
"0.5974303",
"0.5966218",
"0.59525543",
"0.58753324",
"0.5837921",
"0.57769793",
"0.57744545",
"0.5755776",
"0.5744962",
"0.57098216",
"0.5657005",
"0.56454796",
"0.5624197",
"0.5597559",
"0.55964625",
"0.558902",
"0.5584577",
"0.55820... | 0.7211417 | 0 |
Find the difference in utility between two mRS probability distributions. | def find_added_utility_between_dists(
mRS_dist1,
mRS_dist2,
utility_weights=[]
):
if len(utility_weights) < 1:
utility_weights = np.array(
[0.97, 0.88, 0.74, 0.55, 0.20, -0.19, 0.00])
# Combine the two mRS distributions into one ordered list:
mRS_dist_mix... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def difference(first, second, rf, rs, years=(1980, 2000),smooth=1, corpus='bok'):\n try:\n a_first = nb_ngram(first, years=years, smooth=smooth, corpus=corpus)\n a_second = nb_ngram(second, years=years, smooth=smooth, corpus=corpus)\n a = a_first.join(a_second) \n b_first = nb_ngram... | [
"0.6427845",
"0.62475425",
"0.6140385",
"0.6031095",
"0.5999346",
"0.5998327",
"0.59979486",
"0.5951556",
"0.59202963",
"0.5903306",
"0.58968925",
"0.5854682",
"0.582531",
"0.5798003",
"0.5785041",
"0.5761404",
"0.5755429",
"0.5747107",
"0.57367885",
"0.5718688",
"0.57141626"... | 0.6890861 | 0 |
print("Offsprings(self) Impresso dentro de selection (INICIO).") self.printPopulation(popSize) print("Parents Impresso dentro de selection (INICIO).") parents.printPopulation(popSize) | def selection(self,parents,popSize):
for i in range(popSize):
idx1 = np.random.randint(0,popSize)
idx2 = np.random.randint(0,popSize)
if parents.individuals[idx1].violationSum < parents.individuals[idx2].violationSum:
self.individuals[i] = parents.individuals[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printPop(population: list):\n for p in population:\n print(p)",
"def display_population(self, evolution_number=0):\n print(\"Population after evolution #\" + str(evolution_number))\n for i in range(len(self.population)):\n print(\"chrom{}\\t{}\".format(i, self.population[i]... | [
"0.65710765",
"0.64363205",
"0.633016",
"0.61920756",
"0.6097785",
"0.60909283",
"0.60219526",
"0.5987823",
"0.5901706",
"0.58786654",
"0.58660936",
"0.58226454",
"0.5818997",
"0.5800331",
"0.578337",
"0.57611364",
"0.5753088",
"0.5742074",
"0.57069045",
"0.57069045",
"0.5702... | 0.7019642 | 0 |
Return some sort of score for automatically ranking names based on all the features we can extract so far. I guess we'll just add the scores weights up for now. | def judge(name):
score = 0
for scoreID, scorer, weight in weights:
subscore = scorer(name)
score += subscore * weight
name.scores[scoreID] = subscore
name.score = score
return score | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rank_skill_support():\n import collections\n score_dict = collections.defaultdict(int)\n for item in classes.Crusader.items:\n for name in classes.Crusader.skill_names:\n if name in inspect.getsource(item):\n score_dict[name] += 1\n\n for name, freq in sorted(score_... | [
"0.6672081",
"0.6615712",
"0.6615318",
"0.6560758",
"0.6536322",
"0.6404011",
"0.6400573",
"0.6394728",
"0.637099",
"0.6369657",
"0.6209162",
"0.62091345",
"0.6186289",
"0.6151755",
"0.6147722",
"0.6145297",
"0.6125358",
"0.6101284",
"0.6080182",
"0.60785925",
"0.6054262",
... | 0.6663255 | 1 |
Release the acquired user immediately. | def release(self, user):
ret = self._communicate('put %s' % user)
return ret == 'okay' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release_user(self) -> 'outputs.ActingUserResponse':\n return pulumi.get(self, \"release_user\")",
"def release(self):\n if not self._released:\n logging.debug('Release {}'.format(self.username))\n self.ref.done(self.username)\n\n self._released = True",
"def r... | [
"0.73442316",
"0.7158226",
"0.6729011",
"0.66322577",
"0.6467651",
"0.6467651",
"0.6467651",
"0.62798977",
"0.6259443",
"0.6146784",
"0.6057368",
"0.60229975",
"0.5927556",
"0.59190184",
"0.58559096",
"0.58559096",
"0.58456403",
"0.5814781",
"0.58015215",
"0.57593364",
"0.573... | 0.72310317 | 1 |
Populate db with employees sample data | def populate_employees():
employees = get_employees()
db.session.bulk_save_objects(employees)
db.session.commit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_db():\n\n populate_table(db, models.Department, departments_data)\n populate_table(db, models.Employee, employees_data)",
"def example_data():\n\n # In case this is run more than once, empty out existing data\n EmployeeProject.query.delete()\n Employee.query.delete()\n Department.q... | [
"0.70376706",
"0.70348513",
"0.68673253",
"0.6733837",
"0.64411956",
"0.63254523",
"0.63064975",
"0.6244478",
"0.6155851",
"0.61438394",
"0.6134008",
"0.6117163",
"0.6104453",
"0.60885006",
"0.60863227",
"0.60794145",
"0.6074616",
"0.606664",
"0.60633546",
"0.5981801",
"0.597... | 0.7481993 | 0 |
Populate db with menus sample data | def populate_menus():
menus = get_menus()
# can't just bulk_save_objects
# need to save each menu on database so item has a menu id to link
for menu in menus:
menu.create() # save menu on database
# then save its items, because now, Item has a menu id to make the relation
db.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atest_data_init(self):\n menus = self.session.query(User,Menu) \\\n .outerjoin(UserGroup,UserGroup.user_id==User.role_id) \\\n .outerjoin(Group,Group.id==UserGroup.group_id) \\\n .outerjoin(GroupMenu,GroupMenu.group_id==Group.id) \\\n .outerjoin(Menu,Menu.id==... | [
"0.66077805",
"0.65618837",
"0.6515407",
"0.64256483",
"0.6067947",
"0.60336536",
"0.6009482",
"0.5909201",
"0.589953",
"0.5895893",
"0.58890945",
"0.5861996",
"0.5778139",
"0.5726926",
"0.5721616",
"0.57066786",
"0.5695282",
"0.5680497",
"0.56750184",
"0.5655387",
"0.5617311... | 0.6981609 | 0 |
Check abilities to create and terminate networks on DVS. | def dvs_vcenter_networks(self):
self.show_step(1)
self.env.revert_snapshot("dvs_vcenter_systest_setup")
cluster_id = self.fuel_web.get_last_created_cluster()
self.show_step(2)
os_ip = self.fuel_web.get_public_vip(cluster_id)
os_conn = os_actions.OpenStackActions(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dvs_vcenter_security(self):\n # constants\n wait_to_update_rules_on_dvs_ports = 30\n\n self.show_step(1)\n self.env.revert_snapshot(\"dvs_vcenter_systest_setup\")\n\n cluster_id = self.fuel_web.get_last_created_cluster()\n\n os_ip = self.fuel_web.get_public_vip(cluster... | [
"0.6432704",
"0.627376",
"0.6273472",
"0.60336006",
"0.60168666",
"0.5994827",
"0.59946597",
"0.59672666",
"0.59420884",
"0.5922626",
"0.58922243",
"0.58799607",
"0.5868252",
"0.5852771",
"0.585177",
"0.5849867",
"0.57485986",
"0.57465523",
"0.5729617",
"0.5710275",
"0.569252... | 0.6324387 | 1 |
Connectivity between instances in different tenants. | def dvs_vcenter_tenants_isolation(self):
self.show_step(1)
self.env.revert_snapshot("dvs_vcenter_systest_setup")
cluster_id = self.fuel_web.get_last_created_cluster()
os_ip = self.fuel_web.get_public_vip(cluster_id)
os_conn = os_actions.OpenStackActions(
os_ip, SERV... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_connection(cls, instances):\n try:\n instance, = instances\n except ValueError:\n cls.raise_user_error('multiple_instances')\n\n try:\n with magento.API(\n instance.url, instance.api_user, instance.api_key\n ):\n ... | [
"0.5978682",
"0.59230876",
"0.58624625",
"0.58050835",
"0.57716614",
"0.57540387",
"0.5710957",
"0.56928295",
"0.5638762",
"0.560934",
"0.55830216",
"0.55586606",
"0.5556007",
"0.555137",
"0.5545805",
"0.55396605",
"0.5505456",
"0.54970706",
"0.5455151",
"0.54519814",
"0.5439... | 0.6289852 | 0 |
Check abilities to assign multiple vNIC to a single VM. | def dvs_vcenter_multiple_nics(self):
self.show_step(1)
self.env.revert_snapshot("dvs_vcenter_systest_setup")
cluster_id = self.fuel_web.get_last_created_cluster()
os_ip = self.fuel_web.get_public_vip(cluster_id)
os_conn = os_actions.OpenStackActions(
os_ip, SERVTEST_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_vpn_interface(result):\n for iface in result:\n if 'tun0' in iface:\n print 'Interface tun0 - OK'\n return True\n print 'Interface tun0 - DOWN'\n return False",
"def test_get_valid_networks_for_virtualization_realm(self):\n pass",
"def _test_update_vlan... | [
"0.575303",
"0.56643176",
"0.55305266",
"0.5511282",
"0.5488779",
"0.54264265",
"0.540036",
"0.52860916",
"0.5284259",
"0.5270072",
"0.52672994",
"0.52473915",
"0.5239492",
"0.52332485",
"0.52239835",
"0.5215812",
"0.5210209",
"0.52038205",
"0.52016705",
"0.5191734",
"0.51371... | 0.5707047 | 1 |
Launch cluster with multiple active and standby uplinks. | def dvs_multiple_uplinks_active_standby(self):
self.env.revert_snapshot("ready_with_5_slaves")
self.show_step(1)
self.show_step(2)
plugin.install_dvs_plugin(self.ssh_manager.admin_ip)
self.show_step(3)
cluster_id = self.fuel_web.create_cluster(
name=self.__c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dvs_multiple_uplinks_active(self):\n self.env.revert_snapshot(\"ready_with_5_slaves\")\n\n self.show_step(1)\n self.show_step(2)\n plugin.install_dvs_plugin(self.ssh_manager.admin_ip)\n\n self.show_step(3)\n cluster_id = self.fuel_web.create_cluster(\n name=... | [
"0.70448565",
"0.62212306",
"0.6193526",
"0.61889553",
"0.6147269",
"0.6138935",
"0.61263937",
"0.5833729",
"0.5828421",
"0.5797476",
"0.57395774",
"0.5735438",
"0.57350653",
"0.5684985",
"0.5664284",
"0.5649855",
"0.56009287",
"0.5594778",
"0.5566078",
"0.554837",
"0.5543154... | 0.73887056 | 0 |
Launch cluster with multiple active uplinks. | def dvs_multiple_uplinks_active(self):
self.env.revert_snapshot("ready_with_5_slaves")
self.show_step(1)
self.show_step(2)
plugin.install_dvs_plugin(self.ssh_manager.admin_ip)
self.show_step(3)
cluster_id = self.fuel_web.create_cluster(
name=self.__class__._... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dvs_multiple_uplinks_active_standby(self):\n self.env.revert_snapshot(\"ready_with_5_slaves\")\n\n self.show_step(1)\n self.show_step(2)\n plugin.install_dvs_plugin(self.ssh_manager.admin_ip)\n\n self.show_step(3)\n cluster_id = self.fuel_web.create_cluster(\n ... | [
"0.6926492",
"0.62136364",
"0.6113272",
"0.6103674",
"0.59520364",
"0.5779538",
"0.55906445",
"0.5589637",
"0.5585624",
"0.5548647",
"0.5504727",
"0.54992896",
"0.5446949",
"0.54234934",
"0.54158986",
"0.5411005",
"0.54009044",
"0.53878117",
"0.5374124",
"0.5372256",
"0.53294... | 0.7156998 | 0 |
Validate given branch, set branch attribute, call load_settings Raise exception if branch is invalid. | def set_branch(self, branch):
if branch in self.valid_branches:
self.branch = branch
self.load_settings()
self.connect()
else:
raise Exception('Error BranchConfig: invalid branch') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_settings(self):\n # config file from branch's asdf\n config_exists = os.path.isfile(self.config_path)\n\n if config_exists:\n\n config_file = open(self.config_path, 'r')\n self.config_json = json.load(config_file)\n config_file.close()\n\n else:... | [
"0.59047556",
"0.56378996",
"0.52621764",
"0.5247763",
"0.5135201",
"0.5123723",
"0.50814176",
"0.50806594",
"0.49415335",
"0.49055132",
"0.49055132",
"0.4897303",
"0.48346663",
"0.48022094",
"0.47851124",
"0.47810212",
"0.47539732",
"0.47449702",
"0.46878737",
"0.4626371",
"... | 0.74190766 | 0 |
Load setting for branch from config json Raise exception if config json does not exist. | def load_settings(self):
# config file from branch's asdf
config_exists = os.path.isfile(self.config_path)
if config_exists:
config_file = open(self.config_path, 'r')
self.config_json = json.load(config_file)
config_file.close()
else:
ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_config():\n global config\n\n with open(\"config.json\") as f:\n json_config = f.read()\n f.close()\n config = json.loads(json_config)",
"def load_config(self):\r\n with open('config.json', 'r') as f:\r\n self.config = json.load(f)",
"def set_branch(branch, config=... | [
"0.61120075",
"0.5982747",
"0.5819684",
"0.58105063",
"0.57632804",
"0.5761074",
"0.5760722",
"0.5746095",
"0.5736411",
"0.5704689",
"0.56786215",
"0.5634762",
"0.55950594",
"0.558821",
"0.55757296",
"0.5570778",
"0.5532154",
"0.54932517",
"0.5490672",
"0.54897493",
"0.548661... | 0.73898625 | 0 |
Vertex array from attributes and optional index array. Vertex Attributes should be list of arrays with one row per vertex. | def __init__(self, attributes, index=None, usage=GL.GL_STATIC_DRAW):
# create vertex array object, bind it
self.glid = GL.glGenVertexArrays(1)
GL.glBindVertexArray(self.glid)
self.buffers = [] # we will store buffers in a list
nb_primitives, size = 0, 0
# load buffer p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_attribute_array(self, attributes):\n\t\tself.attributes = attributes\n\n\t\t# Combine all of the attribute data into one data array\n\t\tdata = bytearray()\n\t\toffset = 0\n\t\tfor attr in attributes:\n\t\t\tattr.set_offset(offset)\n\t\t\toffset += attr.data.nbytes\n\t\t\tdata.extend(attr.data.tobytes())... | [
"0.6253494",
"0.60370386",
"0.5666623",
"0.5639608",
"0.5499189",
"0.54207194",
"0.5396124",
"0.539105",
"0.5380962",
"0.53181416",
"0.5254117",
"0.5247671",
"0.5243757",
"0.51574284",
"0.5118166",
"0.5095338",
"0.50711495",
"0.506401",
"0.5044437",
"0.50359",
"0.49962413",
... | 0.6064079 | 1 |
Add drawables to this node, simply updating children list | def add(self, *drawables):
self.children.extend(drawables) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, *drawables):\n self.drawables.extend(drawables)",
"def add(self, drawable):\n groups = self.textureGroups\n if groups.has_key(drawable.render.textures):\n groups[drawable.render.textures].add(drawable)\n else:\n newGroup = TextureGroup([drawable])\n... | [
"0.6716814",
"0.61558425",
"0.60178953",
"0.5890669",
"0.57575595",
"0.5671219",
"0.56083703",
"0.5587438",
"0.556305",
"0.55508417",
"0.55488294",
"0.55334294",
"0.5512811",
"0.546614",
"0.5436778",
"0.5427886",
"0.53897125",
"0.5389547",
"0.5376765",
"0.5367084",
"0.5356650... | 0.74856126 | 1 |
Recursive draw, passing down updated model matrix. | def draw(self, projection, view, model):
for child in self.children:
child.draw(projection, view, model @ self.transform) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drawAll(self):\r\n for x in range(len(self.model)):\r\n self.model[x].draw()",
"def draw(self):\n draw(self.graph)",
"def draw(self, projection, view, model, **param):\n # merge named parameters given at initialization with those given here\n param = dict(param, **self.param)\n... | [
"0.66190296",
"0.64794976",
"0.6471101",
"0.640193",
"0.6186497",
"0.6186497",
"0.6186497",
"0.6186497",
"0.6182965",
"0.61759967",
"0.61686164",
"0.6168004",
"0.6128553",
"0.6116609",
"0.6075574",
"0.6033474",
"0.6005693",
"0.5982198",
"0.5966392",
"0.5951851",
"0.59425986",... | 0.67294973 | 0 |
stores 3 keyframe sets for translation, rotation, scale | def __init__(self, translate_keys, rotate_keys, scale_keys):
self.translate = KeyFrames(translate_keys)
self.rotate = KeyFrames(rotate_keys, quaternion_slerp)
self.scale = KeyFrames(scale_keys) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_keyframes(self):\n\n props = ['rotate', 'translate','zoom','vis','time']\n states_copy = copy.deepcopy(self.states_dict)\n key_frames = [y for y in states_copy if np.any([y[x] for x in props])]\n \n self.key_frames = key_frames",
"def create_animation_dict(self):\n ... | [
"0.5990296",
"0.5916322",
"0.58461124",
"0.5766811",
"0.55440605",
"0.54235685",
"0.5410762",
"0.53663063",
"0.5345718",
"0.52912635",
"0.5252744",
"0.52064145",
"0.5196818",
"0.5159929",
"0.5126668",
"0.51080877",
"0.51048714",
"0.50835735",
"0.50818825",
"0.50812465",
"0.50... | 0.60899526 | 0 |
Init needs a GLFW window handler 'win' to register callbacks | def __init__(self, win):
super().__init__()
self.mouse = (0, 0)
glfw.set_cursor_pos_callback(win, self.on_mouse_move)
glfw.set_scroll_callback(win, self.on_scroll) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, window):\n self._ptr = lib.SDL_GL_CreateContext(window._ptr)",
"def onInit(*args):",
"def onInit(*args):",
"def onInit(*args):",
"def onInit(*args):",
"def on_window_ready(self):\n pass",
"def appInit(self):\n self.shapes = []\n glClearColor(1.0, 1.0, 1.0,... | [
"0.6377146",
"0.6151664",
"0.6151664",
"0.6151664",
"0.6151664",
"0.5919815",
"0.57856804",
"0.57452714",
"0.56396085",
"0.56351393",
"0.55766195",
"0.5512165",
"0.5485715",
"0.54461694",
"0.5436918",
"0.5433628",
"0.5422801",
"0.5405098",
"0.53731775",
"0.53407645",
"0.53260... | 0.6667989 | 1 |
Convert a string (bytes, str or unicode) to unicode. | def to_unicode(string):
assert isinstance(string, basestring)
if sys.version_info[0] >= 3:
if isinstance(string, bytes):
return string.decode('utf-8')
else:
return string
else:
if isinstance(string, str):
return string.decode('utf-8')
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_unicode(string):\n\n if isinstance(string, str):\n return string.decode('utf-8')\n else:\n return unicode(string)",
"def to_unicode(self, _string):\n if not isinstance(_string, unicode):\n try:\n _string = unicode(_string)\n except:\n ... | [
"0.8569411",
"0.8277175",
"0.8265658",
"0.82231534",
"0.82179624",
"0.8200368",
"0.81510067",
"0.81174254",
"0.8028561",
"0.8026601",
"0.7969193",
"0.7962071",
"0.79523396",
"0.7951651",
"0.7951651",
"0.7927631",
"0.7736176",
"0.76974946",
"0.76833177",
"0.7647062",
"0.763754... | 0.8280398 | 1 |
Convert a string (bytes, str or unicode) to bytes. | def to_bytes(string):
assert isinstance(string, basestring)
if sys.version_info[0] >= 3:
if isinstance(string, str):
return string.encode('utf-8')
else:
return string
else:
if isinstance(string, unicode):
return string.encode('utf-8')
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asbytes(s):\n if isinstance(s, bytes):\n return s\n else:\n return s.encode('utf-8')",
"def _as_bytes(s):\n if isinstance(s, bytes):\n return s\n return bytes(s, encoding='latin_1')",
"def str_to_bytes(data):\n u_type = type(b''.decode('utf8'))\n if isinstance... | [
"0.83166814",
"0.8276273",
"0.81541514",
"0.80628175",
"0.8053019",
"0.79973334",
"0.7918652",
"0.78740764",
"0.7695469",
"0.76587254",
"0.7574489",
"0.75354373",
"0.7494106",
"0.7475211",
"0.74321854",
"0.73888975",
"0.7321566",
"0.726465",
"0.7222552",
"0.7194866",
"0.71457... | 0.83013546 | 1 |
Verify that base_url specifies a protocol and network location. | def validate_base_url(base_url):
parsed_url = urllib.parse.urlparse(base_url)
if parsed_url.scheme and parsed_url.netloc:
return parsed_url.geturl()
else:
error_message = "base_url must contain a valid scheme (protocol " \
"specifier) and network location (hostname)"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_base_url(url: str) -> None:\n parse_result = urlparse(url)\n if parse_result.scheme not in ('http', 'https'):\n raise ValueError(\n f'Only HTTP[S] URLs are permitted. Actual URL: {url!r}')\n if url.endswith('/'):\n raise ValueError('Base (DICOMweb service) URL cannot... | [
"0.7752545",
"0.75044143",
"0.74613833",
"0.7459881",
"0.72312504",
"0.7182754",
"0.7153386",
"0.7136699",
"0.69687665",
"0.6966098",
"0.6965254",
"0.6958959",
"0.69446975",
"0.6914046",
"0.6839185",
"0.6798751",
"0.67762434",
"0.6769234",
"0.6731541",
"0.6712499",
"0.6712499... | 0.80751884 | 0 |
Check to see if string is a valid local file path. | def is_local_file(string):
assert isinstance(string, basestring)
return os.path.isfile(string) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_local(path: str) -> str:\n import os\n\n URL = path\n if os.path.exists(path) or path.startswith(\"file\"):\n if not URL.startswith(\"file\"):\n URL = f\"file://{URL}\"\n return URL",
"def test_local_path():\n URL_PATH = \"http://www.google.com\"\n URL_PATH1 = \"www.goo... | [
"0.7191641",
"0.7049063",
"0.6644435",
"0.6604089",
"0.65892035",
"0.65531105",
"0.6524201",
"0.6479932",
"0.6477299",
"0.64742285",
"0.64520526",
"0.64380795",
"0.6435675",
"0.64268655",
"0.64129716",
"0.63373643",
"0.63210243",
"0.62851346",
"0.6277787",
"0.6264345",
"0.624... | 0.8206881 | 0 |
Open the file and return an EncodableFile tuple. | def open_local_file(file_path):
assert isinstance(file_path, basestring)
assert is_local_file(file_path)
file_name = os.path.basename(file_path)
file_object = open(file_path, 'rb')
content_type = mimetypes.guess_type(file_name)[0] or 'text/plain'
return EncodableFile(file_name=file_name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open(self):\n return File(open(self.get_path()), \"rb\")",
"def _open(self, file_path=None):\n\t\tif file_path is None:\n\t\t\tfile_path = self.file_path\n\n\t\tif not os.path.exists(file_path):\n\t\t\traise ValueError('Could not find file: {}'.format(file_path))\n\n\t\ttry:\n\t\t\tf = open(file_path,... | [
"0.73528194",
"0.67529213",
"0.6746135",
"0.671111",
"0.66400117",
"0.66229814",
"0.65830874",
"0.65556914",
"0.6473261",
"0.64627486",
"0.64588827",
"0.64528805",
"0.6426703",
"0.6422355",
"0.6372081",
"0.6329315",
"0.6318306",
"0.6309694",
"0.629989",
"0.6294399",
"0.629151... | 0.7020415 | 1 |
Check response code against the expected code; raise SparkApiError. Checks the requests.response.status_code against the provided expected response code (erc), and raises a SparkApiError if they do not match. | def check_response_code(response, expected_response_code):
if response.status_code == expected_response_code:
pass
elif response.status_code == RATE_LIMIT_RESPONSE_CODE:
raise SparkRateLimitError(response)
else:
raise SparkApiError(response) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_status_code(resp, expectedStatusCode):\n if resp.status_code != expectedStatusCode:\n raise MiteError(f\"Invalid status code. Expected: {expectedStatusCode}, Actual: {resp.status_code} \")",
"def assert_status_code(r, expected_code):\n if isinstance(expected_code, list):\n a... | [
"0.69577694",
"0.6868495",
"0.6838925",
"0.6837328",
"0.66191643",
"0.6503946",
"0.641922",
"0.63817734",
"0.63574034",
"0.62928927",
"0.62675935",
"0.62053555",
"0.620474",
"0.6197974",
"0.6165782",
"0.6152348",
"0.6127273",
"0.61242896",
"0.6096467",
"0.6091301",
"0.6077919... | 0.83267397 | 0 |
Create a new generator object. | def new_generator(self):
return self.generator_function(*self.args, **self.kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_generator(generator: Generator, **kwargs) -> Generator:\n return generator(**kwargs)",
"def __iter__(self):\n return self.new_generator()",
"def __init__(self, gen):\n self.gen = gen",
"def get_generator_class(self) -> Any:",
"def __init__( self, generator):\n DictObject.__init_... | [
"0.7498877",
"0.7075019",
"0.6806494",
"0.6767724",
"0.6566726",
"0.65290993",
"0.64454305",
"0.6364136",
"0.63458943",
"0.6236623",
"0.6224448",
"0.62235785",
"0.6217078",
"0.6196175",
"0.6159024",
"0.6158621",
"0.6154922",
"0.6151075",
"0.61447257",
"0.6133625",
"0.61276597... | 0.7786621 | 0 |
Return a fresh iterator. | def __iter__(self):
return self.new_generator() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n self.reset()\n return self",
"def __iter__(self):\n self.iterator = 0\n return self",
"def __iter__(self):\n self.iterator = 0\n return self",
"def __iter__(self):\n self.iterator = 0\n return self",
"def __iter__(self):\n ... | [
"0.6787318",
"0.6639856",
"0.6639856",
"0.6639856",
"0.6639856",
"0.64030266",
"0.6359154",
"0.6326801",
"0.63230234",
"0.6273083",
"0.62508345",
"0.6234522",
"0.6232418",
"0.622732",
"0.62235445",
"0.6155811",
"0.61383545",
"0.61202335",
"0.60942787",
"0.607228",
"0.6065891"... | 0.69935095 | 0 |
Store a generator call in a container and return the container. | def generator_container_wrapper(*args, **kwargs):
return GeneratorContainer(generator_function, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_generator(self):\n return self.generator_function(*self.args, **self.kwargs)",
"def __iter__(self):\n return self.new_generator()",
"def test_generator_scope():\n def inner(val):\n print(\"inner running\")\n return [0, val]\n gen = (a for a in inner(10))\n print(\"g... | [
"0.6163043",
"0.60708296",
"0.60148346",
"0.5839558",
"0.5836473",
"0.58040917",
"0.57026815",
"0.5696499",
"0.55901563",
"0.5578056",
"0.5551555",
"0.55291927",
"0.5486737",
"0.54697406",
"0.5391068",
"0.5348358",
"0.5342683",
"0.5321079",
"0.53087646",
"0.5302777",
"0.52994... | 0.7552704 | 0 |
Estimate frequency using autocorrelation | def freq_from_autocorr(x):
corr = autocorr(x)
# Find the first low point
d = np.diff(corr)
start = np.where(d>0)[0]
if len(start)>0 :
return np.argmax(corr[start[0]:]) + start[0]
return 0
# Find the next peak after the low point (other than 0 lag). This bit is
# not reliable f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autocorrelation(x):\n x = np.asarray(x)\n N = len(x)\n x = x-x.mean()\n s = fft.fft(x, N*2-1)\n result = np.real(fft.ifft(s * np.conjugate(s), N*2-1))\n result = result[:N]\n result /= result[0]\n return result",
"def autocorrFFT(x):\n\n N = len(x)\n F = np.fft.fft(x, n=2*N) # ... | [
"0.7526238",
"0.736925",
"0.71124977",
"0.71124977",
"0.7063112",
"0.69385695",
"0.6938109",
"0.6794599",
"0.6611376",
"0.65896916",
"0.65713364",
"0.65711",
"0.6564182",
"0.65255094",
"0.65255094",
"0.65116596",
"0.6448979",
"0.63878894",
"0.63536227",
"0.63380903",
"0.62817... | 0.7524238 | 1 |
Translate list of features in format "+/name1 +/name2 into dictionary of features given full list of possible features | def get_features(feature_list, these_feature):
features = {}
def feat_filter(feature, this):
try:
mapper = lambda x, feat: filter(lambda y: feat in y, x.split(" "))[0]
val = mapper(this, feature)
if '+' in val:
return TRUE
return FALSE
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_feature_map(string, features):\n fmap = {}\n vec = create_vector(string)\n\n for ngram in features:\n if ngram in vec:\n fmap[ngram] = vec[ngram]\n\n return fmap",
"def get_word_list_features(word_list, word_features):\n document = ' '.join(word_list)\n words = word... | [
"0.68142074",
"0.6307293",
"0.61250114",
"0.6103673",
"0.60028625",
"0.5970271",
"0.59358406",
"0.5880876",
"0.5874309",
"0.5824641",
"0.5810703",
"0.57946545",
"0.5775944",
"0.57687885",
"0.5750962",
"0.57285243",
"0.5701762",
"0.5679957",
"0.56770045",
"0.56609243",
"0.5637... | 0.71586454 | 0 |
Determine whether two sets of features match. A phone is "matched" if every defined feature in the matching environment is matches the feature in phone | def match_features(phone_feats, other_feats):
for feat in other_feats.keys():
if phone_feats[feat] != other_feats[feat] and other_feats[feat] != UNDEF:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches(self, feature):\n pass",
"def __call__(self, f1, f2):\n # return len(f1.set & f2.set)\n return len(set(f1.features) & set(f2.features))",
"def match_features(self):\n type_of_None = type(None)\n if type(self.featureDesA) != type_of_None and type(self.featureDesB) ... | [
"0.6762258",
"0.6535459",
"0.6491467",
"0.63508093",
"0.62427926",
"0.6179118",
"0.6082387",
"0.60390174",
"0.603076",
"0.60110193",
"0.6009265",
"0.5983878",
"0.59630203",
"0.59279037",
"0.5925902",
"0.5885373",
"0.5869973",
"0.5845107",
"0.57935166",
"0.5756144",
"0.573184"... | 0.7899205 | 0 |
This function "cleans" off the command line, then prints whatever cmd that is passed to it to the bottom of the terminal. | def print_cmd(cmd):
padding = " " * 80
sys.stdout.write("\r"+padding)
sys.stdout.write("\r"+prompt+cmd)
sys.stdout.flush() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_output():\n print(\"\\n\" * 20)",
"def clear():\n sys.stdout.write('\\033[2J')\n sys.stdout.write('\\033[H')\n sys.stdout.flush()",
"def remove_command_in_output(self, text, cmd):\n\n # Display info message\n log.info(f\"remove_command_in_output: cmd = '{cmd}'\")\n\n ... | [
"0.65795076",
"0.6433623",
"0.63132674",
"0.62942076",
"0.62428194",
"0.6128273",
"0.6068438",
"0.60534096",
"0.60383546",
"0.59973407",
"0.5973259",
"0.59681875",
"0.59491557",
"0.5931133",
"0.5929993",
"0.5919181",
"0.5909413",
"0.58598995",
"0.57984984",
"0.57718074",
"0.5... | 0.6639863 | 0 |
Attendance leaderboard for cycle PARAMETERS | def attendance_leaderboard(cycle):
f = f'{DOWNLOADS_DIR}\\{cycle}_TotalAttendanceHistory.xlsx'
u = f'{DOWNLOADS_DIR}\\{cycle}_Users.xlsx'
if os.path.isfile(f) and os.path.isfile(u): # TODO: separate function to validate files exist
users = pd.read_excel(u)
att = pd.read_excel(f)
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leaderboard(self):\n pass",
"def main():\n # attendance_leaderboard(CYCLE)\n # metcon_leaderboards(CYCLE)\n weightsheets(CYCLE, TESTING_START, TESTING_END)",
"def take_attendance():\n\t\tcount = 0\n\t\tfor person in Simulation.community:\n\t\t\tif Simulation.community[person].went_to_bar():... | [
"0.590185",
"0.5669982",
"0.5633095",
"0.5581541",
"0.5567346",
"0.5329504",
"0.5264732",
"0.5216812",
"0.5166241",
"0.5162985",
"0.51487166",
"0.51368886",
"0.51368296",
"0.5121696",
"0.51138073",
"0.509702",
"0.5085738",
"0.5085738",
"0.50754535",
"0.5045691",
"0.504041",
... | 0.6462022 | 0 |
Main function. Calculates attendance, metcon and weight leaderboards, and weightshet percentages for current cycle. | def main():
# attendance_leaderboard(CYCLE)
# metcon_leaderboards(CYCLE)
weightsheets(CYCLE, TESTING_START, TESTING_END) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attendance_leaderboard(cycle):\n f = f'{DOWNLOADS_DIR}\\\\{cycle}_TotalAttendanceHistory.xlsx'\n u = f'{DOWNLOADS_DIR}\\\\{cycle}_Users.xlsx'\n if os.path.isfile(f) and os.path.isfile(u): # TODO: separate function to validate files exist\n users = pd.read_excel(u)\n att = pd.read_excel(... | [
"0.62692595",
"0.61417526",
"0.57808286",
"0.55132246",
"0.546569",
"0.54242206",
"0.53936416",
"0.5357352",
"0.535118",
"0.53337187",
"0.531937",
"0.5310548",
"0.5296758",
"0.52806664",
"0.5275189",
"0.5273115",
"0.5261565",
"0.525788",
"0.52355015",
"0.5231531",
"0.5223243"... | 0.72166115 | 0 |
Construct the oracle circuit. | def construct_circuit(self):
return self._circuit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_run_circuit_oracle(self):\n oracle = QuantumCircuit(2)\n oracle.cz(0, 1)\n list_good_state = [\"11\"]\n grover = Grover(oracle=oracle, good_state=list_good_state)\n ret = grover.run(self._qasm)\n self.assertIn(ret['top_measurement'], list_good_state)",
"def mk_i... | [
"0.6296334",
"0.6130935",
"0.6103476",
"0.6055985",
"0.6032703",
"0.5983159",
"0.5869294",
"0.58203524",
"0.5727183",
"0.56996715",
"0.55764574",
"0.5565291",
"0.55128616",
"0.5506376",
"0.5504892",
"0.5492839",
"0.54856324",
"0.54748744",
"0.54563296",
"0.54552764",
"0.54121... | 0.6743529 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.