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 |
|---|---|---|---|---|---|---|
Tests change RAM and CPU in provisioning dialog. | def test_change_cpu_ram(provisioner, prov_data, template_name, soft_assert):
prov_data["vm_name"] = "test_prov_dlg_{}".format(fauxfactory.gen_alphanumeric())
prov_data["num_sockets"] = "4"
prov_data["cores_per_socket"] = "1"
prov_data["memory"] = "4096"
vm = provisioner(template_name, prov_data)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_change_provisioned_throughput_usual_case():",
"def test00(self):\n\n # Obtain memory info (only for Linux 2.6.x)\n for line in Path(\"/proc/self/status\").read_text().splitlines():\n if line.startswith(\"VmSize:\"):\n vmsize = int(line.split()[1])\n eli... | [
"0.59592",
"0.57255113",
"0.571019",
"0.5690495",
"0.5609327",
"0.5578463",
"0.55304605",
"0.55304605",
"0.55304605",
"0.55304605",
"0.55304605",
"0.55304605",
"0.55304605",
"0.55304605",
"0.55304605",
"0.55304605",
"0.55304605",
"0.55304605",
"0.55304605",
"0.55304605",
"0.5... | 0.7958381 | 0 |
Tests disk format selection in provisioning dialog. | def test_disk_format_select(provisioner, prov_data, template_name, disk_format, provider):
prov_data["vm_name"] = "test_prov_dlg_{}".format(fauxfactory.gen_alphanumeric())
prov_data["disk_format"] = disk_format
vm = provisioner(template_name, prov_data)
# Go to the VM info
vm.load_details(refresh=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_format():\n device = \"/dev/sdX1\"\n mock = MagicMock(return_value=0)\n with patch.dict(disk.__salt__, {\"cmd.retcode\": mock}), patch(\n \"salt.utils.path.which\", MagicMock(return_value=True)\n ):\n assert disk.format_(device) is True",
"def disk_file_format(self) -> Optional... | [
"0.6537662",
"0.59593475",
"0.59366614",
"0.59177595",
"0.588133",
"0.5857932",
"0.58357406",
"0.5819531",
"0.57507414",
"0.57081705",
"0.5628575",
"0.5589047",
"0.54695094",
"0.5468098",
"0.5464963",
"0.5464963",
"0.5464963",
"0.5464963",
"0.54505855",
"0.54338825",
"0.54291... | 0.86571014 | 0 |
Tests setting the desired power state after provisioning. | def test_power_on_or_off_after_provision(provisioner, prov_data, template_name, provider, started):
vm_name = "test_prov_dlg_{}".format(fauxfactory.gen_alphanumeric())
prov_data["vm_name"] = vm_name
prov_data["power_on"] = started
provisioner(template_name, prov_data)
wait_for(
lambda: pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_init(power_supply):\n power_supply.Init()\n assert power_supply.state() == tango.DevState.STANDBY",
"def test_turn_on(power_supply):\n power_supply.Init()\n assert power_supply.state() != tango.DevState.ON\n power_supply.current = 5.0\n power_supply.turn_on()\n assert power_supply.s... | [
"0.7154703",
"0.7090715",
"0.7052267",
"0.6762197",
"0.6640754",
"0.6584822",
"0.65105575",
"0.6509301",
"0.65073377",
"0.65008086",
"0.6487637",
"0.64660794",
"0.64515084",
"0.6442083",
"0.636133",
"0.6334637",
"0.632592",
"0.6276696",
"0.6263868",
"0.6262879",
"0.62464154",... | 0.7121097 | 1 |
Tests tagging VMs using provisioning dialogs. | def test_tag(provisioner, prov_data, template_name, provider):
prov_data["vm_name"] = "test_prov_dlg_{}".format(fauxfactory.gen_alphanumeric())
prov_data["apply_tags"] = [
([version.pick({version.LOWEST: "Service Level", "5.3": "Service Level *"}), "Gold"], True)]
vm = provisioner(template_name, pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provision(vm='', env=''):\n local( main_dir + '/vagrant/bin/vm.sh provision ' + str(vm) + ' ' + str(env) )\n #result = local( main_dir + '/vagrant/bin/vm.sh provision ' + str(vm) + ' ' + str(env) )\n #if result != '0'\n # abort( \"Failed test - Aborting\")",
"def test_aws_service_api_vm_tag_put(self):\n... | [
"0.6352007",
"0.6273273",
"0.6064551",
"0.588287",
"0.5790242",
"0.5732895",
"0.57056",
"0.5684743",
"0.5668948",
"0.56355506",
"0.56260127",
"0.5609899",
"0.5601966",
"0.55605453",
"0.5540145",
"0.5528657",
"0.55238515",
"0.55233765",
"0.55175275",
"0.54825455",
"0.54787076"... | 0.72578496 | 0 |
Pads all sentences to the same length. The length is defined by the longest sentence. Returns padded sentences. | def pad_sentences(sentences, padding_word="<PAD/>"):
sequence_length = max(len(x) for x in sentences)
padded_sentences = []
for i in range(len(sentences)):
sentence = sentences[i]
num_padding = sequence_length - len(sentence)
new_sentence = sentence + [padding_word] * num_padding
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_sentences(self, sentences, padlen, padding_word=\"<PAD/>\"):\n if padlen == None:\n sequence_length = max(len(x) for x in sentences)\n else:\n sequence_length = padlen\n\n padded_sentences = []\n for i in range(len(sentences)):\n sentence = sente... | [
"0.80845124",
"0.8042058",
"0.80319756",
"0.7986996",
"0.7942444",
"0.76386243",
"0.75553435",
"0.7518657",
"0.7493447",
"0.73408186",
"0.7043601",
"0.7007085",
"0.6957604",
"0.69015884",
"0.6824467",
"0.6684047",
"0.66429424",
"0.6604899",
"0.66040134",
"0.66006076",
"0.6600... | 0.81174576 | 0 |
Loads and preprocessed data for the MR dataset. Returns input vectors, labels, vocabulary, and inverse vocabulary. | def load_data():
# Load and preprocess data
sentences, labels = load_data_and_labels()
sentences_padded = pad_sentences(sentences)
vocabulary, vocabulary_inv = build_vocab(sentences_padded)
x, y = build_input_data(sentences_padded, labels, vocabulary)
return [x, y, vocabulary, vocabulary_inv] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self):\n\n x = [] # input documents (n_docs, max_seq_len)\n labels = [] # targets we are predicting for each input\n\n for file_path in glob.glob(self.train_dir + '*.txt'):\n tokens = read_tokens(file_path)\n unique = list(set(tokens))\n x_count = round(len(unique) * 0.85)\n\n ... | [
"0.681118",
"0.6779423",
"0.67269444",
"0.6632355",
"0.6511277",
"0.6454218",
"0.64526844",
"0.6442908",
"0.6406341",
"0.63996303",
"0.63689023",
"0.63037074",
"0.63024044",
"0.6256101",
"0.6174946",
"0.6171849",
"0.615446",
"0.61541873",
"0.61464936",
"0.6094439",
"0.6092021... | 0.72697884 | 0 |
Return the next job in the queue that matches the query parameters. | def next(self):
# TODO: add ability to query on things like psd type or psd name
try:
query_params = self.request.json
except ValueError as e:
self.abort(400, str(e))
query = {'status': 'pending'}
try:
query_params = self.request.json
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_job(data, rank):\n for j in data.queue:\n process = data.nodes[j[0]]\n status = j[1]\n if process.is_ready() and status == -1:\n j[1] = rank\n return process\n return None # no job ready to execute or job finished",
"def query_queue(self, job_name=None, u... | [
"0.64184064",
"0.62200403",
"0.6055102",
"0.6007448",
"0.60024256",
"0.59556425",
"0.5953326",
"0.5947829",
"0.59162486",
"0.58914983",
"0.5883175",
"0.5876848",
"0.5870487",
"0.5867387",
"0.5865844",
"0.58445954",
"0.5844173",
"0.58430195",
"0.58258283",
"0.5799728",
"0.5799... | 0.63242596 | 1 |
Function will add the password into the passwords array | def save_password(self):
Credential.passwords.append(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_password():\n new_pass = generate_password()\n entry_pass.delete(0, END)\n entry_pass.insert(0, new_pass)",
"def set_password(self, service, username, password):\n segments = range(0, len(password), self._max_password_size)\n password_parts = [password[i : i + self._max_password_si... | [
"0.68480784",
"0.6393846",
"0.63401145",
"0.63238716",
"0.6203632",
"0.6198479",
"0.61621433",
"0.61574805",
"0.6149922",
"0.6149922",
"0.6149922",
"0.6149922",
"0.6139732",
"0.6136696",
"0.6095222",
"0.6081681",
"0.606798",
"0.6063078",
"0.60399836",
"0.60366845",
"0.6022088... | 0.688147 | 0 |
Function to delete user's password from the passwords array | def delete_password(cls, media):
for password in cls.passwords:
if password.media.lower() == media.lower():
cls.passwords.remove(password) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_password_in_keyring(username):\n return keyring.delete_password(KEYRING_SYSTEM, username,)",
"def userdel(pwfile, user):\n return __salt__[\"webutil.userdel\"](pwfile, user)",
"def delete_password(self) -> None:\n\n msg = QtWidgets.QMessageBox()\n icon = QtGui.QIcon()\n ic... | [
"0.6797595",
"0.65839493",
"0.6143038",
"0.6137909",
"0.6097942",
"0.5992653",
"0.5990729",
"0.59467727",
"0.5940864",
"0.59135103",
"0.5850275",
"0.5782848",
"0.5736694",
"0.57218623",
"0.57001066",
"0.56918097",
"0.5673112",
"0.56683373",
"0.56546557",
"0.56546557",
"0.5654... | 0.69817936 | 0 |
Select actions from the tree Normally we select the greedy action that has the highest reward associated with that subtree. We have a small chance to select a random action based on the exploration param and visit count of the current node at each step. We select actions for the longest possible episode, but normally t... | def select_actions(root, action_space, max_episode_steps):
node = root
acts = []
steps = 0
while steps < max_episode_steps:
if node is None:
# we've fallen off the explored area of the tree, just select random actions
act = action_space.sample()
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_action(self) -> int:\n # simulation loop\n for i in range(self.iterations):\n self.__simulate(self.root, self.iterations)\n\n # action choice\n max_q = 0\n best_action = 0\n for action in actions:\n new_node = self.root.children[action]\n ... | [
"0.6825372",
"0.67427224",
"0.66916525",
"0.66016096",
"0.6565831",
"0.6528906",
"0.6520481",
"0.6500832",
"0.64910764",
"0.64855146",
"0.64595157",
"0.64383894",
"0.6407929",
"0.64054406",
"0.6387878",
"0.6365581",
"0.6322155",
"0.62952584",
"0.6237329",
"0.62314457",
"0.622... | 0.784669 | 0 |
Return True if intraresidue energy is Defined. | def defines_intrares_energy(self, weights):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isstationary(self):\n if np.all(np.abs(self.arroots) > 1.0):\n return True\n else:\n return False",
"def is_infrastructure (self):\n return sum([1 for i in self.infras]) != 0",
"def hasEnergyExpended(self, flags):\r\n return (flags & 0x08) != 0",
"def isResid... | [
"0.62013596",
"0.61435",
"0.5973805",
"0.59299743",
"0.5924153",
"0.59066033",
"0.58523756",
"0.5813468",
"0.5757057",
"0.5757057",
"0.57340556",
"0.5698836",
"0.5664409",
"0.5628546",
"0.5621186",
"0.56142515",
"0.56019086",
"0.55651844",
"0.5549849",
"0.55237734",
"0.552377... | 0.649976 | 0 |
exclude some properties in list (some arrays, dataurl, html fields) | def list_available_properties(self):
# exclude file field
properties = self.properties.exclude(
json_schema__contains={"format": 'data-url'},
)
# exclude array object fields
properties = properties.exclude(
json_schema__contains={"type": "array", "items":... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exclude_list(self):\n pass",
"def _more_properties_blacklist(self) -> List[str]:\n return []",
"def data_without(self, fields):\n without = {}\n data = json.loads(self.data())\n for field, value in data.items():\n if field not in fields:\n withou... | [
"0.7164718",
"0.67565376",
"0.656877",
"0.65365255",
"0.6290989",
"0.61298764",
"0.6111251",
"0.60796696",
"0.6027554",
"0.60213065",
"0.5978856",
"0.59637314",
"0.5920197",
"0.5829852",
"0.5809813",
"0.58091426",
"0.58084166",
"0.5755567",
"0.57519466",
"0.5728777",
"0.57198... | 0.69019234 | 1 |
Get feature title base on title field. Return identifier if empty or None | def get_feature_title(self, feature):
data = feature.properties.get(self.feature_title_property.key, '')\
if self.feature_title_property else feature.identifier
return data or feature.identifier | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_title(self):\n return self.title_nlp_tfidf_features",
"def get_title():",
"def get_title(self) -> Optional[str]:\n return self.title",
"def title_or_id(context):\n title = getattr(context, 'title', '')\n if not title:\n if hasattr(context, '__name__'):\n title = ... | [
"0.74769104",
"0.74634445",
"0.714241",
"0.7111305",
"0.70955867",
"0.7068815",
"0.7068583",
"0.69392186",
"0.69392186",
"0.68939966",
"0.68939966",
"0.68939966",
"0.6879837",
"0.68536025",
"0.6844538",
"0.68434095",
"0.6842559",
"0.68417037",
"0.68417037",
"0.68417037",
"0.6... | 0.8730879 | 0 |
Write out RDF data in general fp.py format. | def write_out4fp(fname,specorder,nspcs,agr,nr,rmax,pairs,nperline=6):
ndat = nr *len(pairs)
data = np.zeros(ndat)
n = 0
for pair in pairs:
isid,jsid = pair
for i in range(nr):
data[n] = agr[isid,jsid,i]
n += 1
with open(fname,'w') as f:
f.write('# RDF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_to_file(self, path, graph_format):\n try:\n logging.info(\"Saving RDF data to \" + str(path))\n with open(path, \"wb\") as out_file:\n out_file.write(self.g.serialize(format=graph_format, encoding=\"UTF-8\"))\n except Exception as e:\n loggin... | [
"0.6226861",
"0.60491145",
"0.5971838",
"0.5916801",
"0.58787876",
"0.5864186",
"0.5837006",
"0.57841057",
"0.5782161",
"0.57590324",
"0.56521845",
"0.56293064",
"0.5625373",
"0.55875367",
"0.557751",
"0.55663025",
"0.5548052",
"0.55220586",
"0.55214083",
"0.5514084",
"0.5502... | 0.61721104 | 1 |
Add a excess return column for the dframe. | def add_exc_ret_column(dframe: pd.DataFrame,
rf_series: pd.Series,
exc_col_name: str = 'exc_ret'):
dframe = dframe.copy()
# exc_ret: substract the rf_series from the stock return seires.
exc_ret: pd.Series = dframe['Dretwd'] - rf_series
dframe[exc_col_name]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def augment_dataframe(self, df: pd.DataFrame) -> pd.DataFrame:",
"def df_add(df,index,column,value):\n\ttry:\n\t\tdf[column]\n\texcept:\n\t\tdf[column]=np.nan\n\ttry:\n\t\tdf.loc[index]\n\texcept:\n\t\tdf.loc[index]=np.nan\n\tdf.loc[index,column]=value\n\treturn df",
"def __yearday(self):\n return _VirtualC... | [
"0.5867094",
"0.5533888",
"0.5491336",
"0.5453052",
"0.5410715",
"0.53891844",
"0.5383224",
"0.53589183",
"0.5354401",
"0.5353931",
"0.5320802",
"0.5285182",
"0.5246985",
"0.5184423",
"0.51788193",
"0.5166975",
"0.51427966",
"0.51116616",
"0.5097012",
"0.5078381",
"0.5076115"... | 0.7402006 | 0 |
Posts to this page handle feed deletions | def post(self):
user = users.get_current_user()
if user:
user_obj = utils.get_user(user)
args = self.request.arguments()
feeds = [x for x in args if x != 'delete' and x != 'modify']
delete = self.request.get('delete')
if delete:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_feed(request, feed_id):\n\n __time_update(request.user)\n\n try:\n Feed.objects.get(id=feed_id, user=request.user).delete()\n except:\n pass\n\n return redirect('/feeds')",
"def post(self):\n post_id = int(self.request.get('post_id'))\n post = Posts.get_by_id(po... | [
"0.6837525",
"0.66649115",
"0.66281825",
"0.6468482",
"0.64511317",
"0.63949674",
"0.6204578",
"0.6198235",
"0.6197428",
"0.617682",
"0.61642784",
"0.61379284",
"0.61252666",
"0.61207384",
"0.6102309",
"0.6100023",
"0.6068218",
"0.6042512",
"0.6034393",
"0.60257864",
"0.59910... | 0.6908147 | 0 |
Handles adding tokens and creating private boards. | def post(self):
token = self.request.get('token')
user = users.get_current_user()
if not user:
self.redirect('/')
user_obj = utils.get_user(user)
if token: # Adding a token for a user
if utils.verify_token(token):
user_obj.auth_token = tok... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createToposTokens(self, jobId = TEST_CING_STR):\n\n# jobId = TEST_CING_STR # DEFAULT: TEST_CING_STR Set for testing.\n# jobId = REFINE_ENTRY_STR\n jobId = VALIDATE_ENTRY_NRG_STR\n tokenListFileName = os.path.join(self.results_dir, 'token_list_todo.txt')\n # Sync below code ... | [
"0.5714139",
"0.5474137",
"0.5472308",
"0.5251413",
"0.52123535",
"0.5199151",
"0.51621383",
"0.51242316",
"0.51061064",
"0.5044331",
"0.50401974",
"0.50278395",
"0.5020065",
"0.49609518",
"0.49333033",
"0.49244037",
"0.49168253",
"0.48821995",
"0.48606148",
"0.4840472",
"0.4... | 0.6631915 | 0 |
This function will create the spotify token | def get_token():
def token_helper():
token = util.prompt_for_user_token(username="robbo1992",
scope='user-library-read playlist-modify-private playlist-modify',
client_id=config["spotify"]["client_id"],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_token():\n def token_helper():\n token = util.prompt_for_user_token(username=\"robbo1992\", scope='user-library-read playlist-modify-private playlist-modify',\n client_id=config[\"spotify\"][\"client_id\"], client_secret=config[\"spotify\"][\"secret_id... | [
"0.84494907",
"0.7138685",
"0.6736017",
"0.6680528",
"0.66363955",
"0.6536286",
"0.65323514",
"0.6522775",
"0.6509662",
"0.6479728",
"0.6475347",
"0.64256454",
"0.6422446",
"0.6361668",
"0.63318384",
"0.6322054",
"0.62906957",
"0.62818015",
"0.6280493",
"0.6255878",
"0.624056... | 0.72723526 | 1 |
Respond to a service request. request_id The ID of the service request. response A dict containing the response data. | def respond(self, request_id, response):
response['rdf:type'] = self.response_type
response['response_to'] = uri(request_id)
LOG.debug(
'Responding to request {0} with {1}.'.format(request_id, response))
response_triples = []
for key, values in response.iteritems():... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_response(self, id, result):\n raise NotImplementedError('process_response not implemented in BaseService')",
"def response(service, ip, port, response, user=None, status_code=None):\n\n timestamp = format_time(get_time())\n coordinates = get_coordinates(ip)\n\n if not user:\n u... | [
"0.6135088",
"0.6058052",
"0.58129406",
"0.5765145",
"0.5742148",
"0.56998986",
"0.5688188",
"0.5627308",
"0.55862087",
"0.5578836",
"0.557576",
"0.5548938",
"0.54563737",
"0.5450754",
"0.5447617",
"0.5445607",
"0.5408946",
"0.5359291",
"0.53584313",
"0.53497386",
"0.53497386... | 0.6965929 | 0 |
Add two distributions such that sampling is the sum of the samples. | def __add__(self, dist):
return CombinedDistribution(self, dist, add) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_distributions(a, b):\n assert a.keys() == b.keys()\n return {k: a[k] + b[k] for k in a}",
"def merge_stats(self, other):\n\n self[0] += other[0]\n self[1] += other[1]\n self[2] += other[2]\n\n self[3] = ((self[0] or self[1] or self[2]) and\n min(self[3], ... | [
"0.6526599",
"0.60701746",
"0.59920555",
"0.5984702",
"0.5948797",
"0.59085214",
"0.58785236",
"0.5851156",
"0.5832095",
"0.583119",
"0.58183056",
"0.5761454",
"0.5745232",
"0.5699342",
"0.56821203",
"0.5661131",
"0.5655395",
"0.5640262",
"0.5620746",
"0.56198007",
"0.5614505... | 0.67005897 | 0 |
Updates an existing db tuple | def update_tuple(self, col, col_val, dic):
conn = None
try:
conn = self.create_connection()
c = conn.cursor()
cmd = 'UPDATE %s SET %s WHERE %s="%s"' % (self.TABLE_NAME, update_substr(dic), col, col_val)
c.execute(cmd)
conn.commit()
exce... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_tuple(jwt_payload: dict, schema_name: str, table_name: str,\n tuple_to_update: dict):\n DJConnector.set_datajoint_config(jwt_payload)\n\n schema_virtual_module = dj.create_virtual_module(schema_name, schema_name)\n getattr(schema_virtual_module, table_name).updat... | [
"0.6797988",
"0.6135777",
"0.61028",
"0.60924697",
"0.60335654",
"0.60286075",
"0.60247296",
"0.60247296",
"0.6008191",
"0.6003066",
"0.5979736",
"0.5960371",
"0.59262705",
"0.5905399",
"0.5887205",
"0.58870274",
"0.5883009",
"0.5838226",
"0.5834926",
"0.5817137",
"0.58084476... | 0.7543399 | 0 |
Deletes by given local paths in a transaction | def delete_by_local_path(self, list_of_local_paths): # todo: check error handling
conn = self.create_connection()
conn.isolation_level = None
c = conn.cursor()
c.execute("begin")
try:
for lp in list_of_local_paths:
cmd = 'DELETE FROM %s WHERE %s="%s"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_by_remote_path(self, list_of_remote_paths): # todo: check error handling\n conn = self.create_connection()\n conn.isolation_level = None\n c = conn.cursor()\n c.execute(\"begin\")\n try:\n for rp in list_of_remote_paths:\n # srp = os.path.jo... | [
"0.74271995",
"0.69443345",
"0.6792859",
"0.67059326",
"0.6590553",
"0.6369515",
"0.6194778",
"0.6086419",
"0.60197234",
"0.60055196",
"0.5936367",
"0.59032243",
"0.5893554",
"0.5887404",
"0.58496577",
"0.583872",
"0.5834751",
"0.58317167",
"0.58216256",
"0.58092964",
"0.5790... | 0.8143306 | 0 |
Deletes by given remote paths in a transaction | def delete_by_remote_path(self, list_of_remote_paths): # todo: check error handling
conn = self.create_connection()
conn.isolation_level = None
c = conn.cursor()
c.execute("begin")
try:
for rp in list_of_remote_paths:
# srp = os.path.join(remote_star... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_by_local_path(self, list_of_local_paths): # todo: check error handling\n conn = self.create_connection()\n conn.isolation_level = None\n c = conn.cursor()\n c.execute(\"begin\")\n try:\n for lp in list_of_local_paths:\n cmd = 'DELETE FROM %s... | [
"0.7200434",
"0.6739694",
"0.6439706",
"0.64118063",
"0.6310755",
"0.6305915",
"0.6221505",
"0.6182152",
"0.6138863",
"0.6097439",
"0.60256255",
"0.60256255",
"0.60256255",
"0.60256255",
"0.5985269",
"0.5985269",
"0.5985269",
"0.5985269",
"0.5985269",
"0.5985269",
"0.5985269"... | 0.7984011 | 0 |
Updates local and remote paths after a file / folder has moved, queries db table by local path | def update_by_remote_path(self, tuples_list): # todo: can also happen by local if needed
conn = self.create_connection()
conn.isolation_level = None
c = conn.cursor()
c.execute("begin")
try:
for t in tuples_list:
cur_rp = t[0]
new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_task_info(self, url, path):\n try:\n db_connect = pymysql.connect(**self._taskdb_config)\n with db_connect.cursor() as cursor:\n task_id = self.get_task_id(url)\n cursor.execute(\"UPDATE mv SET localpath = '%s' WHERE taskid = '%s'\" % (path, tas... | [
"0.65754104",
"0.6115787",
"0.5888005",
"0.5887373",
"0.58095807",
"0.5771762",
"0.57316697",
"0.56886023",
"0.5669908",
"0.5641544",
"0.55607295",
"0.5560262",
"0.547808",
"0.5458396",
"0.5450167",
"0.54422945",
"0.54396904",
"0.54367876",
"0.54201007",
"0.5406209",
"0.54047... | 0.67382807 | 0 |
Set camera to default position. | def reset_camera(base):
base.camera.setPos(0, -4, 2)
base.camera.lookAt(0, 0, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setCamera(self, viewX=0, viewY=0):\n self.viewX = viewX\n self.viewY = viewY",
"def __reset_camera(self):\n # Reset Camera\n self.scene.camera.pos = vector(5, 5, 12) # Hover above (5, 5, 0)\n # Ever so slightly off focus, to ensure grid is rendered in the right\n # ... | [
"0.75671625",
"0.7320458",
"0.7298492",
"0.7186523",
"0.7108725",
"0.7034699",
"0.70045793",
"0.6995633",
"0.69917685",
"0.6980095",
"0.695007",
"0.6930338",
"0.6899239",
"0.68932784",
"0.665726",
"0.6622766",
"0.65676427",
"0.65666807",
"0.65468967",
"0.6514829",
"0.64282364... | 0.7552778 | 1 |
Make a cross join (cartesian product) between two dataframes by using a constant temporary key. Also sets a MultiIndex which is the cartesian product of the indices of the input dataframes. | def cross(df1, df2, **kwargs):
df1['_tmpkey'] = 1
df2['_tmpkey'] = 1
res = pd.merge(df1, df2, on='_tmpkey', **kwargs).drop('_tmpkey', axis=1)
res.index = pd.MultiIndex.from_product((df1.index, df2.index))
df1.drop('_tmpkey', axis=1, inplace=True)
df2.drop('_tmpkey', axis=1, inplace=Tru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataframe_crossjoin(df1, df2, **kwargs):\n df1['_tmpkey'] = 1\n df2['_tmpkey'] = 1\n\n res = pd.merge(df1, df2, on='_tmpkey', **kwargs).drop('_tmpkey', axis=1)\n res.index = pd.MultiIndex.from_product((df1.index, df2.index))\n\n df1.drop('_tmpkey', axis=1, inplace=True)\n df2.drop('_tmpkey', ... | [
"0.8220513",
"0.81449294",
"0.7139678",
"0.59908783",
"0.59016204",
"0.57072234",
"0.56718534",
"0.56179506",
"0.5404163",
"0.535215",
"0.53186893",
"0.53088206",
"0.5284694",
"0.5251312",
"0.5247663",
"0.52383393",
"0.5236747",
"0.52170473",
"0.52065206",
"0.51404434",
"0.51... | 0.8147304 | 1 |
Renders the member list page. | def list(request):
assert isinstance(request, HttpRequest)
form = SearchForm(request.GET or None)
if form.is_valid():
search_name = form.data['search_name']
member_list = Member.objects.filter( Q(name__icontains=search_name) | Q(full_name__icontains=search_name) ).order_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_member(request):\n member_list = Member.objects.all()\n paginator = Paginator(member_list, 5)\n\n try:\n page = int(request.GET.get('page', '1'))\n except ValueError:\n page = 1\n\n # If page request (9999) is out of range, deliver last page of results.\n try:\n memb... | [
"0.75016457",
"0.65785074",
"0.6458304",
"0.6436804",
"0.6229259",
"0.61879176",
"0.6112253",
"0.61045104",
"0.6042156",
"0.5975729",
"0.5948615",
"0.59029377",
"0.58934355",
"0.58880055",
"0.5881101",
"0.5881101",
"0.5881101",
"0.5881101",
"0.5881101",
"0.5881101",
"0.584672... | 0.72769624 | 1 |
Renders the entry list page. | def list(request):
return EntryView.__index(request) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_entries():\n db = get_db()\n cur = db.execute('select id, title, ingredients, steps, tags, \\\n url from entries order by id asc')\n entries = cur.fetchall()\n return render_template('show_entries.html', entries=entries)",
"def entry_page() -> 'html':\n return render_... | [
"0.73065585",
"0.68128645",
"0.67460024",
"0.6682635",
"0.66167814",
"0.6508265",
"0.64338547",
"0.63920766",
"0.6380674",
"0.6232382",
"0.6146034",
"0.60737365",
"0.6051623",
"0.6039628",
"0.59967995",
"0.5950963",
"0.59443253",
"0.5924353",
"0.5917722",
"0.58971167",
"0.585... | 0.6878028 | 1 |
Renders the entry detail page. | def detail(request,entry_id):
assert isinstance(request, HttpRequest)
try:
entry = Entry.objects.get(pk=entry_id)
except Member.DoesNotExist:
raise Http404("指定されたブログが見つかりません")
login = request.user and request.user.is_authenticated()
if not login and entry... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_entry(id):\n db = get_db()\n cur = db.execute('select id, title, ingredients, steps, tags, url \\\n from entries where id = ? order by id desc',\n [id.strip()])\n entries = cur.fetchall()\n return render_template('view_entry.html', entries=entries)",
... | [
"0.70241463",
"0.67448187",
"0.65196276",
"0.6423957",
"0.6258639",
"0.6220436",
"0.6211638",
"0.6050148",
"0.6038886",
"0.6025045",
"0.6020437",
"0.60174865",
"0.59980136",
"0.5933936",
"0.5929155",
"0.5897719",
"0.58646804",
"0.5849809",
"0.5800206",
"0.575598",
"0.57482946... | 0.69581026 | 1 |
Renders the new entry page. | def new(request):
assert isinstance(request, HttpRequest)
if request.method == 'POST': # フォームが提出された
form = EntryForm(request.POST) # POST データの束縛フォーム
if form.is_valid(): # バリデーションを通った
entry = form.save(commit=False)
entry.member = request.user
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n\n self.render(\"newpost.html\", user=self.user)",
"def entry():\n return render_template(\n 'entry.html',\n title='Welcome to search4letters on the web!',\n year=datetime.now().year\n )",
"def create():\n if request.method == 'POST':\n if request.for... | [
"0.70988095",
"0.6788907",
"0.6606047",
"0.6603706",
"0.6583792",
"0.6512609",
"0.646804",
"0.6400918",
"0.63680416",
"0.63232595",
"0.6321198",
"0.6319204",
"0.6301062",
"0.6249488",
"0.61615705",
"0.6140102",
"0.6139419",
"0.61345303",
"0.6106301",
"0.60894936",
"0.608233",... | 0.716861 | 0 |
Renders the entry edit page. | def edit(request,entry_id):
assert isinstance(request, HttpRequest)
try:
entry = Entry.objects.get(pk=entry_id)
except Entry.DoesNotExist:
raise Http404("指定されたブログが存在しません。")
if not request.user or request.user.pk != entry.member.pk: # ブログ作成者以外は編集できない
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_render(entry_id):\n\n\tquery = 'SELECT title, text, id, project FROM entries WHERE id=\"%s\"' % str(entry_id)\n\tcur = g.db.execute(query)\n\tentry = [dict(\n\t\t\ttitle=row[0], \n\t\t\ttext=row[1], \n\t\t\tid=row[2], \n\t\t\tproject=row[3]) for row in cur.fetchall()]\n\n\treturn render_template('edit_ent... | [
"0.7551908",
"0.7170135",
"0.7005638",
"0.694366",
"0.69393766",
"0.6927376",
"0.6759323",
"0.6654097",
"0.660589",
"0.6602304",
"0.65727055",
"0.65271515",
"0.6472088",
"0.6461815",
"0.6285972",
"0.62375796",
"0.622978",
"0.61989844",
"0.61920553",
"0.61736995",
"0.616945",
... | 0.74398434 | 1 |
Main implementation of sepia_image. Takes an additional argument to determine which implementation to use. If no argument is given, using numpy. Checking if input_filename is an array or a file for testing purposes. Otherwise same functionality as in toSepia | def sepia_image(input_filename, output_filename=None, implementation=None, scale=None):
if implementation == 'python':
py_sep = python_sepia(input_filename, output_filename, scale)
return py_sep
elif implementation == 'numba':
numb_sep = numba_sepia(input_filename, output_filename, scale... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sepia_image(implementation, input_filename, output_filename=None):\n\n image = cv2.imread(input_filename)\n image = cv2.cvtColor(image,cv2.COLOR_BGR2RGB)\n if implementation == \"py\":\n image = py_s.convert_to_sepia(image)\n elif implementation == \"np\":\n image = np_s.convert_to_se... | [
"0.75711805",
"0.58124757",
"0.57051367",
"0.5622878",
"0.5519812",
"0.5454823",
"0.5394611",
"0.5336686",
"0.5234413",
"0.5214919",
"0.521474",
"0.52139163",
"0.5206162",
"0.5137169",
"0.5090562",
"0.5090196",
"0.50809765",
"0.5056041",
"0.50462794",
"0.5037547",
"0.501055",... | 0.7517735 | 1 |
Build a token from an oauth response. | def build_token_from_oauth_response(oauth_resp):
return Token(
access_token=oauth_resp["access_token"],
refresh_token=oauth_resp["refresh_token"],
expires_in=oauth_resp["expires_in"],
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __step2_get_oauth_request_token(self, oauth_id):\n\n c, r = http._post(\n self.auth_package.OAUTH+'auth/',\n data={\n 'action': 'accepted',\n 'oauth': oauth_id,\n 'login': self.auth_package.login,\n 'user_pwd': self.auth_p... | [
"0.6516488",
"0.65036213",
"0.6348456",
"0.63386154",
"0.6264514",
"0.6244747",
"0.621021",
"0.6209947",
"0.61426723",
"0.6081747",
"0.6046956",
"0.60128826",
"0.6011785",
"0.6011785",
"0.6002564",
"0.5987356",
"0.59701693",
"0.5926505",
"0.59200287",
"0.59109575",
"0.5906275... | 0.88908345 | 0 |
Update a user token. Either associate the provided token with the provided user or update the user's token to reflect the data in the provided token | def update_user_token(session, new_token, user):
token = find_token_by_user_id(session, user.id)
if token is None:
new_token.user_id = user.id
session.add(new_token)
return new_token
token.access_token = new_token.access_token
token.refresh_token = new_token.refresh_token
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_token(token, user, item=None):\n timestamp = time.time()\n # Make sure the mapping from login to user is available\n conn.hset('login:', token, user)\n # Record time when token was last seen\n conn.zadd('recent:', token, timestamp)\n\n if item:\n # Note that a user viewed an ite... | [
"0.7183549",
"0.6954855",
"0.6697945",
"0.6649426",
"0.6634096",
"0.6442218",
"0.64303035",
"0.637554",
"0.6267799",
"0.62675107",
"0.6259936",
"0.6233112",
"0.6229005",
"0.61696064",
"0.6168548",
"0.61426187",
"0.6140833",
"0.607182",
"0.60614336",
"0.60238665",
"0.602172",
... | 0.79176843 | 0 |
Store the performance metrics The metrics are specifically the confusion matrices, accuracies, precisions, recalls and balanced classification rates. | def store_metrics_to_model(self, cm, accuracy, precision, recall, bcr):
self.metrics['confusion_matrices'].append(cm)
self.metrics['accuracies'].append(accuracy)
self.metrics['precisions'].append(precision)
self.metrics['recalls'].append(recall)
self.metrics['bcrs'].append(bcr)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_metrics(self):\n sensitivity = TP + FN\n sensitivity = TP / sensitivity\n\n specificity = TN + FP\n specificity = TN / specificity\n\n accuracy = TP + FP + TN + FN\n divisor = TP + TN\n accuracy = divisor / accuracy\n\n positive_predictive = TP ... | [
"0.7198167",
"0.70756423",
"0.70652425",
"0.6878016",
"0.6856926",
"0.68430626",
"0.6728176",
"0.6721803",
"0.66858923",
"0.6683972",
"0.66547346",
"0.6653607",
"0.66504776",
"0.6636989",
"0.65658575",
"0.6539087",
"0.6476875",
"0.64366364",
"0.6426088",
"0.64080745",
"0.6401... | 0.7719692 | 0 |
Store the metrics results to the model's parameters dictionary Use the same logic of saving the metrics for each model. Dump the cross validation statistics to a pickle file. | def store_metrics_to_params(self):
model = self.model_name
if self.stats_path.exists():
with open(self.stats_path, "rb") as f:
stats_dict = pickle.load(f)
else:
stats_dict = {}
if model not in stats_dict:
stats_dict[model] = defaultd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saving_metrics(model_name, logs_file, num_features, auc_train\n ,auc_val, sens_val, spec_val, f1_val, acc_val\n ,auc_test, sens_test, spec_test, f1_test, acc_test,fpr, tpr):\n name = pd.DataFrame({'model_name':model_name}, index=[0])\n num_features = pd.DataFrame({'num... | [
"0.6969458",
"0.6842187",
"0.6796351",
"0.65485036",
"0.65354896",
"0.6496599",
"0.6480995",
"0.64418465",
"0.64165884",
"0.6395934",
"0.6342875",
"0.6341721",
"0.6331244",
"0.63220245",
"0.6296119",
"0.6292872",
"0.6283007",
"0.62323284",
"0.62056285",
"0.62002254",
"0.61976... | 0.74408334 | 0 |
Return a hash pointtext to point pk, and pointpk to pointmention pk | def get_pointmention_pk_for_point_text(fxfn, ptk2ptmk):
print "Get point pk for point texts"
ptext2pk = {}
fd = gzip.open(fxfn)
for idx, ll in enumerate(fd):
if '\"ui.point\"' in ll:
jso = js.loads(ll.strip().strip(","))
assert jso["fields"]["name"].strip() not in ptext2p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pointmentions_for_points(fxfn):\n print \"Get pointmention pk for point pk\"\n p2pm = {}\n fd = gzip.open(fxfn)\n for idx, ll in enumerate(fd):\n if '\\\"ui.pointmention\\\"' in ll:\n jso = js.loads(ll.strip().strip(\",\"))\n p2pm.setdefault(jso[\"fields\"][\"point\... | [
"0.64226514",
"0.58621407",
"0.5810375",
"0.5751747",
"0.5656294",
"0.5554587",
"0.5510431",
"0.55085003",
"0.53809255",
"0.53091925",
"0.52721626",
"0.527169",
"0.52561694",
"0.51952106",
"0.5164514",
"0.5157091",
"0.5146417",
"0.5119172",
"0.5118795",
"0.51140517",
"0.50736... | 0.75982493 | 0 |
Since called climatetagger with the pointmentions, there will be repetition in the results. See which filenames are for equivalent content | def get_filenames_for_point_text(indir):
print "Get filenames for point"
txt2fn = {}
fn2txt = {}
# populate txt2fn
for idx, fn in enumerate(os.listdir(indir)):
ffn = os.path.join(indir, fn)
with codecs.open(ffn, "r", "utf8") as ifd:
txt = ifd.read().strip()
txt2fn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_annotations(filename,log):\n results = {}\n log.info(\"Creating POS-tagged files and raw text files for '{}'\".format(filename))\n # call function to creat a POS file (into directory ./output/POS by default)\n convert(filename)\n\n # Do annotations in POS tagged files\n for filename i... | [
"0.5488958",
"0.54256225",
"0.53428316",
"0.5321167",
"0.5314249",
"0.5286054",
"0.528199",
"0.5233739",
"0.5233739",
"0.5230767",
"0.5217956",
"0.52037805",
"0.51915467",
"0.5187317",
"0.5182385",
"0.51749736",
"0.5171226",
"0.51678115",
"0.5165087",
"0.515508",
"0.51512396"... | 0.5933746 | 0 |
Based on hash of textstofilename and on the climatetagger output, see which concepts belong to each text and filename | def get_concepts_for_text(f2t, adir, ptext2ptmk, ptmk2sk):
print "Getting concepts for texts (returns pointmention pks for a text)"
cpco2ptmk = {} # simple hash
vbco2ptmk = {} # verbose hash
for idx, fn in enumerate(os.listdir(adir)):
sfn = fn.replace("pointmention_nbr_", "")
with code... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyze_input_files(name_file,title_file,known_for_file):\n\n tconst_set = set()\n\n remove_first_line(title_file)\n title_in = codecs.open(title_file,'r','utf-8')\n title_table = title_in.read().splitlines(True)\n title_in.close()\n\n #Prepare set of tconst values from title table\n for t... | [
"0.59179723",
"0.5788464",
"0.5722965",
"0.57040584",
"0.56348497",
"0.562984",
"0.5606921",
"0.55775756",
"0.55223715",
"0.54821336",
"0.54811066",
"0.5475663",
"0.54725486",
"0.54661006",
"0.5454374",
"0.544071",
"0.5400925",
"0.5393466",
"0.53852016",
"0.53667706",
"0.5365... | 0.66483146 | 0 |
Gets the corresponding extension for any Telegram media | def get_extension(media):
# Photos are always compressed as .jpg by Telegram
if (isinstance(media, UserProfilePhoto) or isinstance(media, ChatPhoto) or
isinstance(media, MessageMediaPhoto)):
return '.jpg'
# Documents will come with a mime type, from which we can guess their mime type
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __type_by_extension(self, media_file):\n media_types = dict(\n video = ('webm'),\n image = ('png', 'jpg', 'gif'),\n )\n if not os.path.isfile(media_file):\n raise IOError(\"The file {0} does not exist.\".format(media_file,))\n ext = media_file.rsplit... | [
"0.62180525",
"0.6171486",
"0.6128443",
"0.61000025",
"0.59809256",
"0.59628063",
"0.59512424",
"0.5934054",
"0.5923368",
"0.5869945",
"0.58516574",
"0.58476746",
"0.5838286",
"0.5837961",
"0.58329225",
"0.5825781",
"0.57936424",
"0.57750946",
"0.57386124",
"0.5736952",
"0.56... | 0.7442449 | 0 |
Gets the input peer for the given "entity" (user, chat or channel). Returns None if it was not found | def get_input_peer(entity):
if (isinstance(entity, InputPeerUser) or
isinstance(entity, InputPeerChat) or
isinstance(entity, InputPeerChannel)):
return entity
if isinstance(entity, User):
return InputPeerUser(entity.id, entity.access_hash)
if isinstance(entity, Chat):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_entity(self):\n if not self._input_entity:\n try:\n self._input_entity = self._client._mb_entity_cache.get(\n get_peer_id(self._peer, add_mark=False))._as_input_peer()\n except AttributeError:\n pass\n\n return self.... | [
"0.6610822",
"0.62785316",
"0.59921163",
"0.579887",
"0.577845",
"0.5383572",
"0.5365546",
"0.53383607",
"0.52416265",
"0.5143288",
"0.51420724",
"0.51253664",
"0.5022575",
"0.5021837",
"0.49925762",
"0.4989398",
"0.49783817",
"0.49478433",
"0.4918078",
"0.4906619",
"0.490531... | 0.8277106 | 0 |
Finds the corresponding user or chat given a peer. Returns None if it was not found | def find_user_or_chat(peer, users, chats):
try:
if isinstance(peer, PeerUser):
user = next(u for u in users if u.id == peer.user_id)
return user
elif isinstance(peer, PeerChat):
chat = next(c for c in chats if c.id == peer.chat_id)
return chat
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def resolve_peer(\n self,\n peer_id: Union[int, str]\n ) -> Union[raw.base.InputPeer, raw.base.InputUser, raw.base.InputChannel]:\n if not self.is_connected:\n raise ConnectionError(\"Client has not been started yet\")\n\n try:\n return await self.... | [
"0.65599126",
"0.65151",
"0.63568276",
"0.62215704",
"0.60116076",
"0.59968454",
"0.5885561",
"0.58733153",
"0.58251303",
"0.58049566",
"0.5779941",
"0.57550216",
"0.5739727",
"0.57195145",
"0.57142776",
"0.5714005",
"0.56735796",
"0.56610864",
"0.5615676",
"0.5606245",
"0.55... | 0.8066533 | 0 |
Gets the appropiate part size when uploading or downloading files, given an initial file size | def get_appropiate_part_size(file_size):
if file_size <= 1048576: # 1MB
return 32
if file_size <= 10485760: # 10MB
return 64
if file_size <= 393216000: # 375MB
return 128
if file_size <= 786432000: # 750MB
return 256
if file_size <= 1572864000: # 1500MB
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_part_size(self): # -> int:\n ...",
"def _get_file_size(self):\n return self.s3_file.size",
"def get_size(self):\n\t\tpath =os.path.join(self.path, self.init_str)\n\t\ttry:\n\t\t\tself.size = os.path.getsize(path)\n\t\texcept :\n\t\t\tself.size = 0",
"def get_file_size(self) -> int:\n ... | [
"0.7222333",
"0.7170633",
"0.71199733",
"0.705209",
"0.69613755",
"0.693013",
"0.6913749",
"0.6808728",
"0.6790665",
"0.6767978",
"0.6696895",
"0.6682699",
"0.6682009",
"0.6672712",
"0.66212577",
"0.6609142",
"0.6573168",
"0.6568687",
"0.6563068",
"0.6562904",
"0.65537846",
... | 0.7410786 | 0 |
Test case for add_admin_to_org | def test_add_admin_to_org(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_admin(self):\n self.test_create_user()\n self.test_create_organization()\n url = reverse('MGA:add_admin')\n data = {'admin id': 1, 'org_id': 1}\n response = self.client.post(url, data, format='json')\n self.assertEqual(response.status_code, status.HTTP_200_OK)... | [
"0.7921961",
"0.7719786",
"0.74053246",
"0.73465055",
"0.7065694",
"0.70543694",
"0.6956051",
"0.6802451",
"0.67707103",
"0.66912997",
"0.6608116",
"0.6584576",
"0.6554834",
"0.65453166",
"0.6534841",
"0.6494253",
"0.64898133",
"0.64665425",
"0.64522636",
"0.6442575",
"0.6417... | 0.9580956 | 0 |
Test case for add_api_key_to_org | def test_add_api_key_to_org(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_api_key(self):\n pass",
"def test_get_test_organization_api_key(self):\n pass",
"def test_get_cloud_organization_api_key(self):\n pass",
"def test_delete_api_key_from_org(self):\n pass",
"def test_get_organization_from_api_key(self):\n pass",
"def test_s... | [
"0.830552",
"0.7797739",
"0.7629585",
"0.75885624",
"0.7238848",
"0.7174232",
"0.71230483",
"0.7062925",
"0.69731957",
"0.69595855",
"0.69292",
"0.6914856",
"0.6769279",
"0.6721949",
"0.66968143",
"0.6625879",
"0.65678966",
"0.65430725",
"0.6542837",
"0.64647126",
"0.64420515... | 0.9544028 | 0 |
Test case for add_organization | def test_add_organization(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_addOrganization(self):\r\n #fetch the object form the datastore\r\n org_obj = db.GqlQuery(\"SELECT * FROM Organization\")\r\n organization = addOrganization(org_obj.run().next())\r\n #view it as a dict\r\n organization_d = importer.etree_to_dict(organization)\r\n ... | [
"0.816615",
"0.7791385",
"0.7771545",
"0.7666019",
"0.7471143",
"0.73739177",
"0.733168",
"0.72699744",
"0.7249427",
"0.71760124",
"0.7157256",
"0.71301013",
"0.70709705",
"0.70586383",
"0.6998399",
"0.6966653",
"0.69061136",
"0.6894316",
"0.68770504",
"0.68499887",
"0.677493... | 0.94186985 | 0 |
Test case for delete_admin_from_org | def test_delete_admin_from_org(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_organization(self):\n pass",
"def test_deleteorganizations_item(self):\n pass",
"def test_add_admin_to_org(self):\n pass",
"def test_handle_delete_not_admin(self):\n team = Team(\"BRS\", \"brs\", \"web\")\n test_user = User(\"userid\")\n self.db.retri... | [
"0.77877444",
"0.7696896",
"0.7445074",
"0.72858006",
"0.72449243",
"0.7197154",
"0.7166521",
"0.7131228",
"0.71047556",
"0.7088114",
"0.7060942",
"0.7039257",
"0.7039257",
"0.7023641",
"0.6992672",
"0.6917952",
"0.6883815",
"0.6875609",
"0.686296",
"0.685129",
"0.6848907",
... | 0.9521118 | 0 |
Test case for delete_api_key_from_org | def test_delete_api_key_from_org(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_api_key(self):\n pass",
"def test_aws_service_api_keypair_delete(self):\n pass",
"def delete_api_key(api_key):\n api.delete(api_key)",
"def test_add_api_key_to_org(self):\n pass",
"def delete_key(self, api_key):\n\t\ttry:\n\t\t\tvalidation.required(api_key, 'api_key'... | [
"0.90144604",
"0.7717735",
"0.7684811",
"0.72116953",
"0.71857256",
"0.70587647",
"0.6993198",
"0.6945517",
"0.69297886",
"0.69137305",
"0.684483",
"0.6795573",
"0.6762317",
"0.67029756",
"0.66214466",
"0.6536752",
"0.65332836",
"0.6524974",
"0.65129685",
"0.6508044",
"0.6494... | 0.9557088 | 0 |
Test case for delete_organization | def test_delete_organization(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deleteorganizations_item(self):\n pass",
"def test_delete_admin_from_org(self):\n pass",
"def test_organization_unauthorized_clearence(self):\n self.client.force_authenticate(user=self.inventory_manager)\n response = self.client.delete(\"/organization/\")\n self.asse... | [
"0.8367292",
"0.78394914",
"0.7264057",
"0.7251315",
"0.71816695",
"0.71538395",
"0.70605683",
"0.70485324",
"0.7003784",
"0.6992505",
"0.6990538",
"0.6972781",
"0.6964057",
"0.6964057",
"0.6923985",
"0.69024324",
"0.68846905",
"0.6868554",
"0.6859544",
"0.68264276",
"0.68096... | 0.94729704 | 0 |
Test case for get_cloud_organization_api_key | def test_get_cloud_organization_api_key(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_test_organization_api_key(self):\n pass",
"def test_get_organization_from_api_key(self):\n pass",
"def test_add_api_key_to_org(self):\n pass",
"def test_get_organization(self):\n pass",
"def test_create_api_key(self):\n pass",
"def test_delete_api_key_from_... | [
"0.90997285",
"0.8918546",
"0.75713456",
"0.71691096",
"0.6989371",
"0.6844788",
"0.6751461",
"0.6676516",
"0.66394144",
"0.6539914",
"0.6527871",
"0.6481596",
"0.6444157",
"0.6416596",
"0.6354571",
"0.6323977",
"0.6318027",
"0.6281878",
"0.6217638",
"0.6193896",
"0.6181781",... | 0.96041065 | 0 |
Test case for get_organization | def test_get_organization(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_retrieve_l_organization(self):\n pass",
"def test_retrieve_l_organizations(self):\n pass",
"def test_getorganizations_item(self):\n pass",
"def test_get_organization_from_api_key(self):\n pass",
"def test_getorgs(self):\n pass",
"def test_organizations_read(sel... | [
"0.9036933",
"0.8306462",
"0.8182898",
"0.8151627",
"0.80266917",
"0.79076415",
"0.77565134",
"0.7681536",
"0.7601403",
"0.7494148",
"0.74174434",
"0.7230969",
"0.72130024",
"0.7176754",
"0.7106198",
"0.7013897",
"0.6947488",
"0.6931106",
"0.6853236",
"0.6804766",
"0.6782247"... | 0.9417209 | 0 |
Test case for get_organization_from_api_key | def test_get_organization_from_api_key(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_test_organization_api_key(self):\n pass",
"def test_get_cloud_organization_api_key(self):\n pass",
"def test_get_organization(self):\n pass",
"def test_retrieve_l_organization(self):\n pass",
"def test_add_api_key_to_org(self):\n pass",
"def test_client_get... | [
"0.89144087",
"0.88077307",
"0.8030137",
"0.7411901",
"0.7375122",
"0.7012065",
"0.6837723",
"0.6705846",
"0.65713406",
"0.6560059",
"0.65467364",
"0.65115184",
"0.6490429",
"0.6445208",
"0.6390063",
"0.637227",
"0.6215229",
"0.6207169",
"0.61871433",
"0.6138815",
"0.6130954"... | 0.96943647 | 0 |
Test case for get_test_organization_api_key | def test_get_test_organization_api_key(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_cloud_organization_api_key(self):\n pass",
"def test_get_organization_from_api_key(self):\n pass",
"def test_add_api_key_to_org(self):\n pass",
"def test_create_api_key(self):\n pass",
"def test_get_organization(self):\n pass",
"def test_get_user_api_keys(s... | [
"0.9327082",
"0.91403574",
"0.7948581",
"0.7405442",
"0.7385897",
"0.7111489",
"0.7109408",
"0.6801211",
"0.67228097",
"0.6678715",
"0.6657073",
"0.6633174",
"0.66236293",
"0.6620424",
"0.66150975",
"0.65542704",
"0.6542644",
"0.64782923",
"0.63855046",
"0.638444",
"0.6272597... | 0.96149343 | 0 |
Test case for update_stripe_customer_id | def test_update_stripe_customer_id(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_customer_update(self):\n # first performe create\n id = self._create_model(\"customer\", self.customer_data, [\"name\", \"email\", \"phone\"])\n if id:\n # then performe update\n data = { \n \"name\": \"Changed the name\",\n \"email\... | [
"0.7367054",
"0.7162821",
"0.7083393",
"0.6719482",
"0.67059684",
"0.66863203",
"0.666122",
"0.6638427",
"0.6539545",
"0.65216875",
"0.64957035",
"0.6478409",
"0.64662045",
"0.64661884",
"0.6461471",
"0.6428305",
"0.6424141",
"0.6393037",
"0.6366442",
"0.63599896",
"0.6352961... | 0.9507563 | 0 |
Import all data files to models. | def import_all():
# count the number of files loaded
count = 0
# get model name
model_name_list = [model for data_models in settings.OBJECT_DATA_MODELS
for model in data_models]
model_name_list += [model for model in settings.OTHER_DATA_MODELS]
# import models one by o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_data(self):\n self.models = []\n for o in self.loader.load():\n klass = self.type_for(o)\n if hasattr(klass, \"from_api\"):\n self.models.append(klass.from_api(o))\n else:\n self.models.append(klass(o))\n return self.mod... | [
"0.71189433",
"0.66391623",
"0.6546014",
"0.6540467",
"0.6509912",
"0.6343779",
"0.63157904",
"0.62844115",
"0.62766767",
"0.6276155",
"0.62347203",
"0.6220017",
"0.6211368",
"0.6137105",
"0.61335367",
"0.6121303",
"0.6119817",
"0.6089977",
"0.60667324",
"0.60666764",
"0.6063... | 0.8046224 | 0 |
Return a redshift_connector connection from a Glue Catalog or Secret Manager. Note You MUST pass a `connection` OR `secret_id`. | def connect(
connection: Optional[str] = None,
secret_id: Optional[str] = None,
catalog_id: Optional[str] = None,
dbname: Optional[str] = None,
boto3_session: Optional[boto3.Session] = None,
ssl: bool = True,
timeout: Optional[int] = None,
max_prepared_statements: int = 1000,
tcp_kee... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_redshift_connection(config: Dict, logger):\n conn_str = \"host={host} dbname={db} user={user} password={paswd} port={port}\".format(\n host=config['CLUSTER']['HOST'],\n db=config['CLUSTER']['DB_NAME'],\n user=config['CLUSTER']['DB_USER'],\n paswd=config['CLUSTER']['DB_PASSWOR... | [
"0.68735677",
"0.5809195",
"0.57946634",
"0.5687844",
"0.5686682",
"0.5667705",
"0.5661718",
"0.5636314",
"0.56154907",
"0.5614007",
"0.5580625",
"0.5541199",
"0.5506161",
"0.5495684",
"0.5433583",
"0.54292125",
"0.5412733",
"0.5408939",
"0.5390782",
"0.53871703",
"0.5379973"... | 0.76038176 | 0 |
Return a redshift_connector temporary connection (No password required). | def connect_temp(
cluster_identifier: str,
user: str,
database: Optional[str] = None,
duration: int = 900,
auto_create: bool = True,
db_groups: Optional[List[str]] = None,
boto3_session: Optional[boto3.Session] = None,
ssl: bool = True,
timeout: Optional[int] = None,
max_prepared... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_redshift_connection(config: Dict, logger):\n conn_str = \"host={host} dbname={db} user={user} password={paswd} port={port}\".format(\n host=config['CLUSTER']['HOST'],\n db=config['CLUSTER']['DB_NAME'],\n user=config['CLUSTER']['DB_USER'],\n paswd=config['CLUSTER']['DB_PASSWOR... | [
"0.7254088",
"0.6735161",
"0.65751135",
"0.63485533",
"0.631202",
"0.63049054",
"0.630306",
"0.62490124",
"0.62389773",
"0.61086017",
"0.6094087",
"0.6087478",
"0.60803694",
"0.6079649",
"0.6055574",
"0.60154015",
"0.59904116",
"0.59586227",
"0.5956175",
"0.5951137",
"0.59355... | 0.6796086 | 1 |
Unload Parquet files on s3 from a Redshift query result (Through the UNLOAD command). | def unload_to_files(
sql: str,
path: str,
con: redshift_connector.Connection,
iam_role: Optional[str] = None,
aws_access_key_id: Optional[str] = None,
aws_secret_access_key: Optional[str] = None,
aws_session_token: Optional[str] = None,
region: Optional[str] = None,
unload_format: Op... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unload_and_copy(\n self,\n query,\n s3_bucket,\n s3_folder=None,\n raw_unload_path=None,\n export_path=False,\n delim=\",\",\n delete_s3_after=True,\n parallel_off=False,\n unload_options=None,\n ):\n # data = []\n s3path = ... | [
"0.7504058",
"0.7191103",
"0.7174893",
"0.68057805",
"0.5794718",
"0.57861274",
"0.55019057",
"0.53436935",
"0.53310376",
"0.53118485",
"0.5291526",
"0.5234244",
"0.52219784",
"0.508515",
"0.50543606",
"0.50319934",
"0.50170165",
"0.5001154",
"0.49863395",
"0.49783194",
"0.49... | 0.7372508 | 1 |
Load Pandas DataFrame from a Amazon Redshift query result using Parquet files on s3 as stage. This is a HIGH latency and HIGH throughput alternative to `wr.redshift.read_sql_query()`/`wr.redshift.read_sql_table()` to extract large Amazon Redshift data into a Pandas DataFrames through the UNLOAD command. This strategy h... | def unload(
sql: str,
path: str,
con: redshift_connector.Connection,
iam_role: Optional[str] = None,
aws_access_key_id: Optional[str] = None,
aws_secret_access_key: Optional[str] = None,
aws_session_token: Optional[str] = None,
region: Optional[str] = None,
max_file_size: Optional[fl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_data_from_s3(spark, s3_bucket):\n raw_path = os.path.join(s3_bucket, 'raw')\n table_names = [y for x, y, z in os.walk(raw_path)][0]\n subdirs = glob.glob(raw_path + '/*/')\n df_raw_all = {}\n for name, path in zip(table_names, subdirs):\n df_raw_all[name] = spark.read.parquet(path... | [
"0.5997857",
"0.59543014",
"0.59382516",
"0.59258854",
"0.5866642",
"0.5817244",
"0.57623106",
"0.57371503",
"0.5714087",
"0.56665355",
"0.5663919",
"0.56460536",
"0.5619082",
"0.56124324",
"0.5597356",
"0.55672616",
"0.5561693",
"0.555014",
"0.5545397",
"0.54992914",
"0.5479... | 0.7075965 | 0 |
Load Parquet files from S3 to a Table on Amazon Redshift (Through COPY command). | def copy_from_files( # pylint: disable=too-many-locals,too-many-arguments
path: str,
con: redshift_connector.Connection,
table: str,
schema: str,
iam_role: Optional[str] = None,
aws_access_key_id: Optional[str] = None,
aws_secret_access_key: Optional[str] = None,
aws_session_token: Opti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def s3_load(self, bucket_name, file_name, region):\n cursor = self.conn.cursor()\n\n table_name = file_name.split(\".\")[0]\n\n cursor.execute(\"\"\"SELECT aws_s3.table_import_from_s3(\\\n %s, '', '(format csv)', \n %s, %s, %s\n );\n \"\"\", (table_name,... | [
"0.7435913",
"0.6740694",
"0.6705388",
"0.66711795",
"0.66023624",
"0.6528935",
"0.6295399",
"0.62858945",
"0.62337184",
"0.619264",
"0.6114141",
"0.5936801",
"0.5856344",
"0.57915634",
"0.5777484",
"0.57433933",
"0.57154405",
"0.56972665",
"0.5694213",
"0.56625533",
"0.56393... | 0.6794392 | 1 |
Load Pandas DataFrame as a Table on Amazon Redshift using parquet files on S3 as stage. This is a HIGH latency and HIGH throughput alternative to `wr.redshift.to_sql()` to load large DataFrames into Amazon Redshift through the SQL COPY command. This strategy has more overhead and requires more IAM privileges than the r... | def copy( # pylint: disable=too-many-arguments
df: pd.DataFrame,
path: str,
con: redshift_connector.Connection,
table: str,
schema: str,
iam_role: Optional[str] = None,
aws_access_key_id: Optional[str] = None,
aws_secret_access_key: Optional[str] = None,
aws_session_token: Optional[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def covert_df_to_parquet(df, s3_path, database_name, table):\n wr.s3.to_parquet(\n df=df,\n path=f\"s3://{s3_path}\",\n dataset=True,\n mode=\"append\",\n database=database_name,\n table=table\n )",
"def load_sql(df):\n engine = create_engine(f'postgres://{user}... | [
"0.71729743",
"0.65380704",
"0.65008163",
"0.6389493",
"0.60908663",
"0.6062319",
"0.60543996",
"0.5992561",
"0.5827544",
"0.5782807",
"0.57407016",
"0.5710552",
"0.5623358",
"0.561092",
"0.5607632",
"0.5599428",
"0.5562551",
"0.55545986",
"0.5550455",
"0.54618484",
"0.544531... | 0.6846796 | 1 |
Sets the study_id of this SubjectMatrixValuesRpc. | def study_id(self, study_id):
self._study_id = study_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_study_system_attr(self, study_id: int, key: str, value: Any) -> None:\n raise NotImplementedError",
"def study(self, study):\n self.logger.debug(\"In 'study' setter.\")\n\n self._study = study",
"def set_study_user_attr(self, study_id: int, key: str, value: Any) -> None:\n r... | [
"0.61165065",
"0.6075766",
"0.57621443",
"0.5587116",
"0.5334524",
"0.52372426",
"0.52367514",
"0.5168686",
"0.5047035",
"0.5038625",
"0.4932461",
"0.49189034",
"0.49183658",
"0.48878828",
"0.48165116",
"0.47879925",
"0.47323093",
"0.46770248",
"0.46770248",
"0.46621636",
"0.... | 0.7020226 | 1 |
Sets the subject_id of this SubjectMatrixValuesRpc. | def subject_id(self, subject_id):
self._subject_id = subject_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject_uuid(self, subject_uuid):\r\n\r\n self._subject_uuid = subject_uuid",
"def subject_identifier(self, subject_identifier):\n\n self._subject_identifier = subject_identifier",
"def set_subject(self, subject):\n self._subject = subject",
"def subject(self, subject):\n\n se... | [
"0.6530537",
"0.6528903",
"0.62437284",
"0.59799564",
"0.59799564",
"0.59799564",
"0.5853966",
"0.5853966",
"0.5776047",
"0.5725107",
"0.5681801",
"0.5596723",
"0.5596723",
"0.5570979",
"0.55641025",
"0.5487383",
"0.5306673",
"0.5288797",
"0.5263358",
"0.5263358",
"0.5211014"... | 0.74624264 | 0 |
Sets the subject_identifier of this SubjectMatrixValuesRpc. | def subject_identifier(self, subject_identifier):
self._subject_identifier = subject_identifier | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject_id(self, subject_id):\n\n self._subject_id = subject_id",
"def subject_uuid(self, subject_uuid):\r\n\r\n self._subject_uuid = subject_uuid",
"def set_subject(self, subject):\n self._subject = subject",
"def subject(self, subject):\n\n self._subject = subject",
"def s... | [
"0.7226011",
"0.67943794",
"0.61905307",
"0.5966199",
"0.5966199",
"0.5966199",
"0.5779178",
"0.5779178",
"0.5765766",
"0.571674",
"0.5702578",
"0.5702578",
"0.5696489",
"0.5594398",
"0.5445627",
"0.54023147",
"0.5327395",
"0.52028024",
"0.516963",
"0.50987667",
"0.5094867",
... | 0.72901267 | 0 |
Sets the crf_version_id of this SubjectMatrixValuesRpc. | def crf_version_id(self, crf_version_id):
self._crf_version_id = crf_version_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crf_version_oid(self, crf_version_oid):\n\n self._crf_version_oid = crf_version_oid",
"def crf_version_name(self, crf_version_name):\n\n self._crf_version_name = crf_version_name",
"def cvr(self, cvr):\n\n self._cvr = cvr",
"def node_version(self, node_version):\n\n self._node... | [
"0.6372119",
"0.574843",
"0.52940446",
"0.5247686",
"0.5213914",
"0.5211336",
"0.49468553",
"0.49468553",
"0.4938295",
"0.49157378",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.... | 0.69869 | 0 |
Sets the crf_version_name of this SubjectMatrixValuesRpc. | def crf_version_name(self, crf_version_name):
self._crf_version_name = crf_version_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_name(self, version_name):\n\n self._version_name = version_name",
"def crf_version_id(self, crf_version_id):\n\n self._crf_version_id = crf_version_id",
"def crf_version_id(self, crf_version_id):\n\n self._crf_version_id = crf_version_id",
"def crf_version_oid(self, crf_versi... | [
"0.6278047",
"0.6097333",
"0.6097333",
"0.57229054",
"0.5430086",
"0.5325513",
"0.51943946",
"0.5162672",
"0.515191",
"0.51080954",
"0.510129",
"0.50954777",
"0.50954777",
"0.50747806",
"0.50747806",
"0.5058683",
"0.5051611",
"0.5051611",
"0.5051611",
"0.5051611",
"0.5051611"... | 0.7561987 | 0 |
Sets the crf_id of this SubjectMatrixValuesRpc. | def crf_id(self, crf_id):
self._crf_id = crf_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crf_version_id(self, crf_version_id):\n\n self._crf_version_id = crf_version_id",
"def crf_version_id(self, crf_version_id):\n\n self._crf_version_id = crf_version_id",
"def event_crf_id(self, event_crf_id):\n\n self._event_crf_id = event_crf_id",
"def rc_response_sets_id(self, rc_re... | [
"0.5619326",
"0.5619326",
"0.55401677",
"0.5324943",
"0.5258222",
"0.5220845",
"0.5203802",
"0.51807433",
"0.51807433",
"0.5115594",
"0.5051563",
"0.50460684",
"0.50096667",
"0.50047284",
"0.4986645",
"0.49853736",
"0.4960003",
"0.49552804",
"0.48896885",
"0.48621207",
"0.484... | 0.6769691 | 0 |
Sets the crf_name of this SubjectMatrixValuesRpc. | def crf_name(self, crf_name):
self._crf_name = crf_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crf_version_name(self, crf_version_name):\n\n self._crf_version_name = crf_version_name",
"def set_res_name(self, res_name):\n assert isinstance(res_name, str)\n self.res_name = res_name\n\n for atm in self.iter_atoms():\n atm.set_res_name(res_name)",
"def name(self, ... | [
"0.60410804",
"0.5482097",
"0.51953715",
"0.51550096",
"0.5142636",
"0.5133685",
"0.5108929",
"0.5108929",
"0.50849366",
"0.50849366",
"0.50674313",
"0.504726",
"0.5024021",
"0.5010257",
"0.5010257",
"0.50085884",
"0.49961376",
"0.49819005",
"0.4953161",
"0.4928691",
"0.49114... | 0.6920374 | 0 |
Sets the event_crf_id of this SubjectMatrixValuesRpc. | def event_crf_id(self, event_crf_id):
self._event_crf_id = event_crf_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crf_id(self, crf_id):\n\n self._crf_id = crf_id",
"def crf_id(self, crf_id):\n\n self._crf_id = crf_id",
"def event_id(self, event_id):\n\n self._event_id = event_id",
"def event_id(self, event_id):\n\n self._event_id = event_id",
"def crf_version_id(self, crf_version_id):\n... | [
"0.6028238",
"0.6028238",
"0.5504692",
"0.5504692",
"0.5407522",
"0.5407522",
"0.50571454",
"0.49532837",
"0.47866318",
"0.47866318",
"0.47692794",
"0.4723801",
"0.47207093",
"0.47078097",
"0.46962267",
"0.4696196",
"0.46801007",
"0.466422",
"0.4616036",
"0.46017292",
"0.4601... | 0.72915924 | 0 |
Sets the event_def_name of this SubjectMatrixValuesRpc. | def event_def_name(self, event_def_name):
self._event_def_name = event_def_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setName(self, *args):\n return _libsbml.Event_setName(self, *args)",
"def event_name(self, event_name):\n self['event_name'] = event_name",
"def event_name(self, event_name):\n\n self._event_name = event_name",
"def setName(self, funcName):\r\n # type: (str) -> None\r\n ... | [
"0.6460156",
"0.6238407",
"0.6155176",
"0.55467284",
"0.54734576",
"0.5460237",
"0.5343305",
"0.53183883",
"0.52695584",
"0.51850027",
"0.516283",
"0.515691",
"0.5141675",
"0.51405287",
"0.51140356",
"0.50734115",
"0.5059256",
"0.49979472",
"0.49973518",
"0.49971655",
"0.4997... | 0.74051213 | 0 |
Sets the event_definition_id of this SubjectMatrixValuesRpc. | def event_definition_id(self, event_definition_id):
self._event_definition_id = event_definition_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_id(self, event_id):\n\n self._event_id = event_id",
"def event_id(self, event_id):\n\n self._event_id = event_id",
"def workflow_definition(self, workflow_definition):\n\n self._workflow_definition = workflow_definition",
"def definition(self, definition):\n\n self._defi... | [
"0.5271029",
"0.5271029",
"0.5190124",
"0.5122959",
"0.5086737",
"0.5083863",
"0.49270618",
"0.48990944",
"0.4836904",
"0.4818143",
"0.47915685",
"0.4727285",
"0.47209057",
"0.46329468",
"0.46329468",
"0.46329468",
"0.46234152",
"0.46234152",
"0.46024126",
"0.45842344",
"0.45... | 0.72139573 | 0 |
Sets the mark_crf_as_complete of this SubjectMatrixValuesRpc. | def mark_crf_as_complete(self, mark_crf_as_complete):
self._mark_crf_as_complete = mark_crf_as_complete | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_complete(self):\n self._current = self._max",
"def _rdm_set_complete(self, uid, succeded, value):\n print \"value: %s\" % value\n print \"rdm set complete\"",
"def date_complete(self, date_complete):\n\n self._date_complete = date_complete",
"def submit_complete( self ):\n ... | [
"0.56883234",
"0.54131633",
"0.5371676",
"0.52225304",
"0.51398903",
"0.51253927",
"0.5043812",
"0.5043812",
"0.5043812",
"0.50198466",
"0.49082902",
"0.48054406",
"0.4729462",
"0.46720043",
"0.46586436",
"0.46307385",
"0.46242422",
"0.45961896",
"0.45608363",
"0.45539096",
"... | 0.795131 | 0 |
Sets the only_sdv_value_changed of this SubjectMatrixValuesRpc. | def only_sdv_value_changed(self, only_sdv_value_changed):
self._only_sdv_value_changed = only_sdv_value_changed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_changed(self, value=0):\n self.data_changed.emit(value)\n self._changed = True",
"def setChanged(self,value=True):\n self.changed = value",
"def setChanged(self,value=True):\n self.changed = value",
"def _voltage_changed(self):\n if self.checkValueBool:\n ... | [
"0.5769745",
"0.5580356",
"0.5580356",
"0.5361677",
"0.53375846",
"0.5028171",
"0.50247914",
"0.4991557",
"0.48669177",
"0.4817246",
"0.48049307",
"0.47663346",
"0.47490513",
"0.47314015",
"0.4683369",
"0.463982",
"0.46320778",
"0.4631738",
"0.46254516",
"0.45988297",
"0.4596... | 0.83576894 | 0 |
Sets the is_e_signature_checked of this SubjectMatrixValuesRpc. | def is_e_signature_checked(self, is_e_signature_checked):
self._is_e_signature_checked = is_e_signature_checked | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature_flag(self, signature_flag):\n\n self._signature_flag = signature_flag",
"def set_checked_ts(self, checked_ts):\n self._checked_ts = checked_ts",
"def econsent_signature(self, econsent_signature):\n\n self._econsent_signature = econsent_signature",
"def signature_type(self, ... | [
"0.5601107",
"0.533608",
"0.53245956",
"0.497232",
"0.49302414",
"0.48964512",
"0.48964512",
"0.48826033",
"0.48826033",
"0.48749083",
"0.4840111",
"0.47412744",
"0.46905324",
"0.46573353",
"0.4639802",
"0.45360234",
"0.45313793",
"0.45265317",
"0.45260087",
"0.4509432",
"0.4... | 0.8172657 | 0 |
Sets the signature_flag of this SubjectMatrixValuesRpc. | def signature_flag(self, signature_flag):
self._signature_flag = signature_flag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature(self, signature):\n\n self._signature = signature",
"def signature(self, signature):\n\n self._signature = signature",
"def signature(self, signature: object):\n\n self._signature = signature",
"def signature(self, signature: object):\n\n self._signature = signature"... | [
"0.63051784",
"0.63051784",
"0.6182385",
"0.6182385",
"0.6059684",
"0.56933784",
"0.5684194",
"0.5684194",
"0.55593544",
"0.5417321",
"0.53967696",
"0.524769",
"0.52100563",
"0.5190573",
"0.5125264",
"0.5091256",
"0.5068939",
"0.5041444",
"0.5006835",
"0.5002917",
"0.49580693... | 0.7206582 | 0 |
Sets the collected_data_status of this SubjectMatrixValuesRpc. | def collected_data_status(self, collected_data_status):
self._collected_data_status = collected_data_status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_status(self, data_status):\n self._data_status = data_status",
"def old_collected_data_status(self, old_collected_data_status):\n\n self._old_collected_data_status = old_collected_data_status",
"def matrix_collection_values_rp_cs(self, matrix_collection_values_rp_cs):\n\n self._ma... | [
"0.63066393",
"0.5921088",
"0.5154762",
"0.5062799",
"0.5033846",
"0.5015661",
"0.4786137",
"0.47790745",
"0.46627745",
"0.46215487",
"0.4608561",
"0.4598799",
"0.4554792",
"0.45546222",
"0.45528463",
"0.45528463",
"0.45528463",
"0.45528463",
"0.45528463",
"0.45528463",
"0.45... | 0.7917273 | 0 |
Sets the old_collected_data_status of this SubjectMatrixValuesRpc. | def old_collected_data_status(self, old_collected_data_status):
self._old_collected_data_status = old_collected_data_status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collected_data_status(self, collected_data_status):\n\n self._collected_data_status = collected_data_status",
"def data_status(self, data_status):\n self._data_status = data_status",
"def setStatus(self, newStatus):\n self._status = newStatus",
"def XPLMDataChanged_f(inRefcon):",
"... | [
"0.636636",
"0.5473131",
"0.5071015",
"0.5032803",
"0.50067586",
"0.497123",
"0.48569977",
"0.4833843",
"0.48255882",
"0.48195663",
"0.47773117",
"0.47693363",
"0.47073743",
"0.464826",
"0.46319208",
"0.4622991",
"0.46092883",
"0.45909083",
"0.45537284",
"0.4539575",
"0.45360... | 0.8179197 | 0 |
Sets the data_import_crf_status of this SubjectMatrixValuesRpc. | def data_import_crf_status(self, data_import_crf_status):
self._data_import_crf_status = data_import_crf_status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_status(self, data_status):\n self._data_status = data_status",
"def setstatus(self, status):\n with self.lock:\n self.status = status",
"def collected_data_status(self, collected_data_status):\n\n self._collected_data_status = collected_data_status",
"def initial_stat... | [
"0.5805397",
"0.50160843",
"0.50126594",
"0.48819005",
"0.4841471",
"0.47597942",
"0.4746065",
"0.47425368",
"0.47291005",
"0.47291005",
"0.47291005",
"0.47245696",
"0.47167277",
"0.47068378",
"0.47049326",
"0.4680637",
"0.4677142",
"0.4671707",
"0.4635286",
"0.4598446",
"0.4... | 0.82825756 | 0 |
Sets the matrix_collection_values_rp_cs of this SubjectMatrixValuesRpc. | def matrix_collection_values_rp_cs(self, matrix_collection_values_rp_cs):
self._matrix_collection_values_rp_cs = matrix_collection_values_rp_cs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMultiPropertyValuesFromCP(self, cp):\n if cp.configurable:\n self.allowedcapacities = cp.allowedcapacities\n elif cp.actual:\n # raise NotImplementedError (\"Can't set allowedcapacities, as the format is yet unclear (range or set)\")\n self.allowedcapacities = ... | [
"0.50176275",
"0.49043766",
"0.45520404",
"0.45490563",
"0.45316553",
"0.45316553",
"0.4525258",
"0.4525258",
"0.4525258",
"0.4525258",
"0.4525258",
"0.4525258",
"0.4525202",
"0.4525202",
"0.4525202",
"0.4525202",
"0.4479653",
"0.44455102",
"0.44267264",
"0.43889087",
"0.4384... | 0.87354636 | 0 |
Calculate GSFLOW Precipitation Ratio Parameters | def ppt_ratio_parameters(config_path):
# Hardcoded HRU field formats for now
ppt_field_format = 'PPT_{:02d}'
ratio_field_format = 'PPT_RT_{:02d}'
# Initialize hru_parameters class
hru = support.HRUParameters(config_path)
# Open input parameter config file
inputs_cfg = ConfigParser.ConfigPa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gsrfp(self, gp, lai):\n\t return (lai*self.gtf()*gp/self.F_CAP)/(self.gtf() + lai*gp/self.F_CAP)",
"def doParametersOfInterest(self):\n ''' ref : physicsmodel -> rvf\n self.modelBuilder.out.var(\"MH\").setRange(float(self.mHRange[0]),float(self.mHRange[1]))\n self.modelBuilde... | [
"0.6214121",
"0.59012675",
"0.5890425",
"0.5884989",
"0.58498096",
"0.5819677",
"0.57864296",
"0.575152",
"0.57457566",
"0.5726573",
"0.5689348",
"0.56361187",
"0.5620673",
"0.5580959",
"0.5563029",
"0.5562155",
"0.55615175",
"0.55550104",
"0.55436355",
"0.55376166",
"0.55169... | 0.62151164 | 0 |
Update this event's times based on a time delta to the event it's associated with. Noop if not applicable. | def update_by_delta(self):
if (not self.smart_scheduled_for) or (not self.smart_schedule_info):
# Doesn't depend on any other event.
return
delta_s = self.smart_schedule_info.get('delta_s')
if delta_s is None: # Doesn't have a time delta.
return
delt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, delta_time):\n pass",
"def update(self, deltaTime):\n pass",
"def update(self, delta_time):\n self.total_time += delta_time",
"def _event_time_changed(self, sender, obj, **kwargs):\n handle_event_time_update(obj)",
"def on_update(self, delta_time):\n pass... | [
"0.717832",
"0.69421685",
"0.67625135",
"0.6669038",
"0.6549583",
"0.6549583",
"0.64545184",
"0.64545184",
"0.64228916",
"0.62049466",
"0.61785895",
"0.61551064",
"0.612273",
"0.6037527",
"0.5994711",
"0.5976155",
"0.5929894",
"0.59019685",
"0.5837826",
"0.58341146",
"0.58310... | 0.69742393 | 1 |
Find the next occurance of obj in the schedule found in dframe | def getNextObject(dframe, obj, ctime):
df = dframe[(dframe['Object']==obj) & (dframe['Date'] > ctime)]
return df.sort_values('Date', ignore_index = True).iloc[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_car(schedule, travel_time):\n\n #travel_time = datetime.datetime.strptime(datetime.datetime.strptime(travel_time, '%Y-%m-%d %H:%M:%S').strftime('%H:%M:%S'), '%H:%M:%S')\n next_time = None\n\n for index, time in enumerate(schedule):\n if time.is_after(travel_time):\n next_time = ... | [
"0.64453214",
"0.6097681",
"0.57936543",
"0.5630498",
"0.5571368",
"0.5538271",
"0.5515357",
"0.55020833",
"0.54922175",
"0.547133",
"0.5464065",
"0.5458508",
"0.5453322",
"0.5442817",
"0.53659415",
"0.53539526",
"0.5352825",
"0.5329746",
"0.5235717",
"0.5225423",
"0.52253926... | 0.7120242 | 0 |
Makes a new alignment object based on the given object given return dict FastaDict other other | def new_align(aln=None):
if aln is None:
return fasta.FastaDict()
elif isinstance(aln, seqlib.SeqDict):
return type(aln)()
else:
return fasta.FastaDict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mapalign(aln, keyfunc=lambda x: x, valfunc=lambda x: x):\n\n aln2 = new_align(aln)\n for key, val in aln.iteritems():\n aln2[keyfunc(key)] = valfunc(val)\n return aln2",
"def unaligned(self):\n new_alignment = Alignment()\n new_alignment.datatype = self.datatype\n for nam... | [
"0.60028195",
"0.57877505",
"0.5769851",
"0.5694888",
"0.56625426",
"0.55104095",
"0.54222304",
"0.52952707",
"0.5263826",
"0.5228231",
"0.5214418",
"0.51612675",
"0.51396924",
"0.51238257",
"0.5083478",
"0.50673985",
"0.501719",
"0.50160027",
"0.5012841",
"0.500737",
"0.5005... | 0.738012 | 0 |
Maps the keys and values of an alignment | def mapalign(aln, keyfunc=lambda x: x, valfunc=lambda x: x):
aln2 = new_align(aln)
for key, val in aln.iteritems():
aln2[keyfunc(key)] = valfunc(val)
return aln2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_align(self):\n\t\tstm_t_dict = self._process_recog()\n\t\ttrans_t_dict = self._process_trans()\n\t\talign_obj = viterbi_align(stm_t_dict, trans_t_dict, self.label, self.pair_file_path)\n\t\tself.trans_t_dict = align_obj.viterbi(0, len(stm_t_dict)-1, 0, len(trans_t_dict)-1)",
"def unaligned(self):\n ... | [
"0.6266823",
"0.62303495",
"0.6187596",
"0.61792564",
"0.61750096",
"0.6051063",
"0.58750093",
"0.5825714",
"0.574159",
"0.57159823",
"0.5594871",
"0.5593787",
"0.5553336",
"0.5522648",
"0.5512856",
"0.55097824",
"0.5474325",
"0.54610926",
"0.54585254",
"0.5436486",
"0.541142... | 0.77747005 | 0 |
Returns an alignment with a subset of the columns (cols) | def subalign(aln, cols):
return mapalign(aln, valfunc=lambda x: "".join(util.mget(x, cols))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _align(self, columns, widths, alignments):\n aligned_columns = []\n\n for column, width, alignment in zip(columns, widths, alignments):\n aligned_column = []\n\n for item in column:\n # add padding to the actual column width\n total_width = widt... | [
"0.62626284",
"0.612884",
"0.6019828",
"0.5955531",
"0.5700935",
"0.5645024",
"0.5629176",
"0.555315",
"0.55369985",
"0.53511906",
"0.53431135",
"0.53308195",
"0.52978116",
"0.52958876",
"0.52612674",
"0.51895434",
"0.5177369",
"0.517642",
"0.5166675",
"0.51646847",
"0.516468... | 0.7701354 | 0 |
Removes any column from an alignment 'aln' that contains only gaps if enforce_codon, only removes empty columns if they correspond to an empty codon position a new alignment is returned | def remove_empty_columns(aln, enforce_codon=False):
ind = []
seqs = aln.values()
alnlen = aln.alignlen()
if not enforce_codon:
for i in range(alnlen):
for seq in seqs:
if seq[i] != "-":
ind.append(i)
break
else:
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_gapped_columns(aln):\n cols = zip(* aln.values())\n ind = util.find(lambda col: \"-\" not in col, cols)\n return subalign(aln, ind)",
"def filter_aligned_codons(aln):\n\n ind = find_aligned_codons(aln)\n return subalign(aln, ind)",
"def CleanUp(self):\n blankColumnPattern = re.... | [
"0.66917884",
"0.64027363",
"0.62161463",
"0.61285317",
"0.57670015",
"0.56432825",
"0.5463415",
"0.54239607",
"0.53346545",
"0.5243871",
"0.51975095",
"0.5151462",
"0.5143705",
"0.5124977",
"0.5096413",
"0.50836235",
"0.49776202",
"0.49612677",
"0.48994187",
"0.48650476",
"0... | 0.81119853 | 0 |
Removes any column form an alignment 'aln' that contains a gap A new alignment is returned | def remove_gapped_columns(aln):
cols = zip(* aln.values())
ind = util.find(lambda col: "-" not in col, cols)
return subalign(aln, ind) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def condenseGappyAlignment(a, thresh=0.9):\n\n a = padAlignment(a)\n smat = align2mat(a)\n gapSiteInd = np.mean(smat == b'-', axis=0) >= thresh\n keepSeqInd = np.all(smat[:, gapSiteInd] == b'-', axis=1)\n print('Removing %d of %d sites and %d of %d sequences from the alignment.' % (gapSiteInd.sum(),... | [
"0.68459195",
"0.6651505",
"0.6511084",
"0.63307935",
"0.62079555",
"0.61311",
"0.61086166",
"0.6073215",
"0.6046519",
"0.60436326",
"0.58474493",
"0.5817973",
"0.58065647",
"0.5737428",
"0.57123995",
"0.56621146",
"0.5645386",
"0.56242",
"0.5509205",
"0.5412391",
"0.5379916"... | 0.8034353 | 0 |
Returns a string of stars representing the conservation of an alignment. | def calc_conservation_string(aln):
percids = calc_conservation(aln)
# find identity positions
identity = ""
for pid in percids:
if pid == 1:
identity += "*"
elif pid > .5:
identity += "."
else:
identity += " "
return identity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def centerStar_align(refName, dictofSeq):\n dictofFinalStr = {}\n refString = dictofSeq.pop(refName)\n #remove the center sequence from the list of sequence so it won't align to itself\n centerString = refString\n #construct a pointer to center squence\n for name in dictofSeq:\n alignment ... | [
"0.63226485",
"0.5825243",
"0.5793804",
"0.5750026",
"0.5699145",
"0.56955826",
"0.56823754",
"0.568177",
"0.56687695",
"0.5665864",
"0.5651827",
"0.56339127",
"0.5628345",
"0.5614027",
"0.5598982",
"0.55870724",
"0.5564882",
"0.5542772",
"0.55401635",
"0.5531035",
"0.5502224... | 0.69697547 | 0 |
Pretty print an alignment | def print_align(aln, seqwidth=59, spacing=2, extra=fasta.FastaDict(),
out=sys.stdout, order=None):
if order is None:
order = aln.keys()
namewidth = max(map(len, order)) + spacing
def mkname(name, namewidth):
name2 = name[:namewidth]
name2 += " " * (namewidth - len(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_alignment(self, alignment):\n raise NotImplementedError(\"This method should be implemented\")\n ###################################################\n # You MUST implement this method in the subclass. #\n ###################################################",
"def align(self... | [
"0.79834676",
"0.734705",
"0.70687884",
"0.70687884",
"0.70687884",
"0.7033782",
"0.67701447",
"0.67018855",
"0.65467566",
"0.63053936",
"0.627013",
"0.627013",
"0.61733776",
"0.61574036",
"0.6153913",
"0.6153841",
"0.6121336",
"0.6116535",
"0.609514",
"0.6082277",
"0.6068575... | 0.7888238 | 1 |
Reverse translates aminoacid alignment into DNA alignment Must supply original ungapped DNA. | def revtranslate_align(aaseqs, dnaseqs, check=False, trim=False):
align = new_align(aaseqs)
for name, seq in aaseqs.iteritems():
try:
dna = dnaseqs[name].upper()
dnalen = len(dna)
aalen = sum(int(a != "-") for a in seq)
if len(dna) != aalen * 3:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Reverse(self):\n if (self.translated == False):\n self.alignment = self.alignment[:,::-1]\n self.Show(self.displayedColumn)\n self.BackupAlignment()\n else:\n self.AlertMessage(\"Can't reverse protein sequences.\", 'medium')",
"def revcomp(self, seq):... | [
"0.71864974",
"0.6812774",
"0.67528117",
"0.6672258",
"0.66207254",
"0.6542916",
"0.648878",
"0.63164526",
"0.6259812",
"0.62526155",
"0.62126786",
"0.6131947",
"0.6128937",
"0.61226314",
"0.611363",
"0.6077821",
"0.60759556",
"0.6050172",
"0.60431933",
"0.6033622",
"0.602497... | 0.72248614 | 0 |
return the codon position for each base in a gapped sequence codon ATG 012 gaps are given codon pos 1 Ns are counted as bases | def mark_codon_pos(seq, pos=0):
codons = []
for base in seq:
if base != "-":
codons.append(pos)
pos = (pos + 1) % 3
else:
codons.append(-1)
return codons | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seq_positions(seq, codon):\n\n positions = []\n i = 0\n\n while codon in seq[i:]:\n pos = seq.find(codon, i)\n positions.append(pos)\n i = pos + 1\n positions.sort()\n return positions",
"def find_aligned_codons(aln):\n # throw out codons with non mod 3 gaps\n ind2 =... | [
"0.61485887",
"0.6142755",
"0.60675496",
"0.5896705",
"0.5804804",
"0.5698641",
"0.5658462",
"0.56378984",
"0.5607607",
"0.5583689",
"0.5554433",
"0.5542303",
"0.5518872",
"0.551064",
"0.54922414",
"0.54865295",
"0.54782075",
"0.5469921",
"0.54616714",
"0.5460566",
"0.5456092... | 0.6355188 | 0 |
Get the codon position of every base in an alignment | def make_codon_pos_align(aln):
def func(seq):
dct = {-1: "-",
0: "0",
1: "1",
2: "2"}
return "".join(util.mget(dct, mark_codon_pos(seq)))
return mapalign(aln, valfunc=func) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_aligned_codons(aln):\n # throw out codons with non mod 3 gaps\n ind2 = []\n for i in range(0, aln.alignlen(), 3):\n bad = False\n\n for key, val in aln.iteritems():\n codon = val[i:i+3]\n if \"-\" in codon and codon != \"---\":\n bad = True\n ... | [
"0.67402256",
"0.62042964",
"0.60226005",
"0.599085",
"0.59695685",
"0.58982",
"0.58924824",
"0.5872509",
"0.5850926",
"0.57532394",
"0.57493573",
"0.5679699",
"0.56796855",
"0.5621302",
"0.56066793",
"0.5563424",
"0.5558595",
"0.5557639",
"0.5557281",
"0.5538554",
"0.5531190... | 0.6217447 | 1 |
Returns the columns indices of the alignment that represent aligned codons. | def find_aligned_codons(aln):
# throw out codons with non mod 3 gaps
ind2 = []
for i in range(0, aln.alignlen(), 3):
bad = False
for key, val in aln.iteritems():
codon = val[i:i+3]
if "-" in codon and codon != "---":
bad = True
break
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_column_offsets(self):\n offsets = [x + self.bitcell_array_inst.lx() for x in self.bitcell_array.get_column_offsets()]\n return offsets",
"def _dofidxs(self):\n return [const['dofidxs'] for i, const in self._constraints_df.iterrows()]",
"def _code_indices(self) -> Tuple[int, ...]:\n... | [
"0.59922004",
"0.5860749",
"0.56989753",
"0.5681737",
"0.5614288",
"0.5608165",
"0.56026506",
"0.55909663",
"0.55902773",
"0.5497771",
"0.5456719",
"0.542552",
"0.5413706",
"0.54135114",
"0.54023445",
"0.53900963",
"0.53102946",
"0.5304884",
"0.52557504",
"0.525486",
"0.52432... | 0.6600308 | 0 |
filters an alignment for only aligned codons | def filter_aligned_codons(aln):
ind = find_aligned_codons(aln)
return subalign(aln, ind) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_four_fold(aln):\n\n aln_codons = filter_aligned_codons(aln)\n ind = find_four_fold(aln_codons)\n return subalign(aln_codons, ind)",
"def find_aligned_codons(aln):\n # throw out codons with non mod 3 gaps\n ind2 = []\n for i in range(0, aln.alignlen(), 3):\n bad = False\n\n ... | [
"0.6275202",
"0.5985325",
"0.5808414",
"0.5657554",
"0.5586616",
"0.5480586",
"0.5476529",
"0.5458169",
"0.5447717",
"0.5427448",
"0.5389868",
"0.53701377",
"0.53629375",
"0.53325",
"0.53202367",
"0.5297917",
"0.5287804",
"0.52648044",
"0.5219207",
"0.5215316",
"0.52071464",
... | 0.80336815 | 0 |
Returns index of all columns in alignment that are completely fourfold degenerate Assumes that columns are already filtered for aligned codons | def find_four_fold(aln):
# create peptide alignment
pepAln = mapalign(aln, valfunc=seqlib.translate)
# find peptide conservation
pepcons = []
pep = []
for i in xrange(pepAln.alignlen()):
# get a column from the peptide alignment
col = [seq[i] for seq in pepAln.itervalues()]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_four_fold(aln):\n\n aln_codons = filter_aligned_codons(aln)\n ind = find_four_fold(aln_codons)\n return subalign(aln_codons, ind)",
"def findAligned(self,nbr_aligned):\n bVerbose = 0\n # horiz:\n for j in range(self.h):\n nPrev = -1\n nConsecutive = ... | [
"0.6976313",
"0.56564444",
"0.55321",
"0.53359705",
"0.5317952",
"0.53000414",
"0.52750903",
"0.5246135",
"0.51694256",
"0.5162794",
"0.5063124",
"0.5046688",
"0.5034413",
"0.5012335",
"0.50098413",
"0.5002169",
"0.49529323",
"0.49236366",
"0.49100626",
"0.48956773",
"0.48817... | 0.7104398 | 0 |
returns an alignment of only fourfold degenerate sites from an alignment of coding sequences | def filter_four_fold(aln):
aln_codons = filter_aligned_codons(aln)
ind = find_four_fold(aln_codons)
return subalign(aln_codons, ind) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_four_fold(aln):\n\n # create peptide alignment\n pepAln = mapalign(aln, valfunc=seqlib.translate)\n\n # find peptide conservation\n pepcons = []\n pep = []\n for i in xrange(pepAln.alignlen()):\n # get a column from the peptide alignment\n col = [seq[i] for seq in pepAln.it... | [
"0.66398257",
"0.5804744",
"0.574768",
"0.5726531",
"0.55221653",
"0.53524363",
"0.530869",
"0.5145633",
"0.51443505",
"0.5076095",
"0.50369513",
"0.50102013",
"0.5007429",
"0.49939534",
"0.49924994",
"0.4940682",
"0.49307466",
"0.49279425",
"0.4921958",
"0.48676747",
"0.4844... | 0.71442384 | 0 |
Returns a string containing the degeneracy for each column in an alignment | def make_degen_str(aln):
degens = find_degen(aln)
degenmap = {
-1: " ",
0: "0",
1: "1",
2: "2",
3: "3",
4: "4",
}
return "".join(util.mget(degenmap, degens)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_degen(aln, **args):\n\n extra = fasta.FastaDict()\n extra[\"DEGEN\"] = make_degen_str(aln)\n\n print_align(aln, extra=extra, **args)",
"def remove_gapped_columns(aln):\n cols = zip(* aln.values())\n ind = util.find(lambda col: \"-\" not in col, cols)\n return subalign(aln, ind)",
"d... | [
"0.61074394",
"0.5931985",
"0.57466483",
"0.57240814",
"0.5627567",
"0.5614252",
"0.557021",
"0.555322",
"0.55024636",
"0.5475245",
"0.53381",
"0.5330796",
"0.524045",
"0.5210575",
"0.52097756",
"0.5195418",
"0.5191528",
"0.5177687",
"0.5172865",
"0.51322633",
"0.51322633",
... | 0.61223656 | 0 |
Returns list such that 'ATGCTGCG' ==> [0,1,2,2,2,3,4,5,5,6,7] Used to go from align > local space | def align2local(seq):
i = -1
lookup = []
for c in seq:
if c != "-":
i += 1
lookup.append(i)
return lookup | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local2align(seq):\n lookup = []\n for i in xrange(len(seq)):\n if seq[i] == \"-\":\n continue\n lookup.append(i)\n return lookup",
"def get_alignments(self) -> list:",
"def exhaust_align(s, e):\n\tns = len(s); ne = len(e)\n\tout = [[]]\n\tfor j in range(ne):\n\t\ttemp = []... | [
"0.6562808",
"0.5932609",
"0.59319025",
"0.58726025",
"0.5643212",
"0.56222177",
"0.56173956",
"0.55368394",
"0.54439574",
"0.5436266",
"0.5406885",
"0.5379483",
"0.534136",
"0.533954",
"0.5338038",
"0.5311031",
"0.5309115",
"0.52870876",
"0.5254734",
"0.5234436",
"0.522927",... | 0.6147287 | 1 |
Return global coordinate within a region from a local coordinate | def local2global(local_coord, start, end, strand):
# swap if strands disagree
if strand == 1:
return local_coord + start
else:
return end - local_coord | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def global_coords(self) -> GlobalCoordsABC:",
"def locate_point(self, coord):\n lowest_lat = self.lower_left[0]\n leftmost_lng = self.lower_left[1]\n dist_lat = utils.haversine((coord[0], leftmost_lng), self.lower_left)*1000 # in meters\n dist_lng = utils.haversine((lowest_lat, coor... | [
"0.6766332",
"0.6342862",
"0.6314777",
"0.6279476",
"0.61844033",
"0.60272366",
"0.602686",
"0.5996794",
"0.59724855",
"0.5945172",
"0.5899301",
"0.57758486",
"0.57130945",
"0.5704306",
"0.5698832",
"0.5684761",
"0.567423",
"0.5657888",
"0.5620119",
"0.5598554",
"0.5597676",
... | 0.67699504 | 0 |
Analyze a photo at location file_name. You feed this function pictures, it analyzes them with the tensorflow model. Once it analyzes the picture, it sees if it has seen the same object more than (streak_threshold) times. If it has, it sets identified_food to what it has found. Upon entering the function, the has_been_c... | def analyze_response(self, file_name):
self.has_been_checked = False
highest_confidence = 0.0
highest_entry = ''
response = analyze_photo(file_name)
print(response)
for food_name, confidence in response.items():
if confidence > highest_confidence:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_evaluate(original_image, img_id, annotations, min_score=0.4, max_overlap=0.3, top_k=200):\n\n # Transform\n image = normalize(to_tensor(resize(original_image)))\n\n # Move to default device\n image = image.to(device)\n\n # Forward prop.\n predicted_locs, predicted_scores = model(image.unsq... | [
"0.5690435",
"0.56460273",
"0.56157184",
"0.55782366",
"0.5534084",
"0.54591966",
"0.5454288",
"0.5441708",
"0.5408321",
"0.5386467",
"0.5368049",
"0.5364968",
"0.53546536",
"0.5352053",
"0.53513336",
"0.5349217",
"0.5288521",
"0.5282977",
"0.52706414",
"0.5250514",
"0.522902... | 0.6377009 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.