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 |
|---|---|---|---|---|---|---|
Return boolean of the "markdown_convert" option. | def get_opt_markdown_convert(self, command):
if "markdown_convert" in self.command_dict["commands"][command].keys():
return self.command_dict["commands"][command]["markdown_convert"]
else:
return CommandDict.DEFAULT_OPT_MARKDOWN_CONVERT | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_markdown(self):\n return self._tag == 'markdown'",
"def is_markdown(self):\n return self._tag == 'markdown'",
"def isMarkdown(self):\n return self.__isMarkdown",
"def is_markdown_cell(cell):\n return cell[\"cell_type\"] == \"markdown\"",
"def convert_to_markdown(self, text: s... | [
"0.70488286",
"0.70488286",
"0.70230716",
"0.6086967",
"0.60160255",
"0.5977364",
"0.5914026",
"0.5822783",
"0.5729446",
"0.5702347",
"0.56494474",
"0.5415037",
"0.5336228",
"0.5286717",
"0.52686924",
"0.52682716",
"0.52588314",
"0.525169",
"0.51487887",
"0.50701106",
"0.5067... | 0.785019 | 0 |
Return boolean of the "formatted" option. | def get_opt_formatted(self, command):
if "formatted" in self.command_dict["commands"][command].keys():
return self.command_dict["commands"][command]["formatted"]
else:
return CommandDict.DEFAULT_OPT_FORMATTED | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_(self):\n return self.set_format or self.default_format or self.FALLBACK_FORMAT",
"def _format_bool_(value):\n\n from ocgis.util.helpers import format_bool\n\n return format_bool(value)",
"def post_formatter(self, value):\n if isinstance(value, bool):\n return ... | [
"0.64655954",
"0.6382571",
"0.63540566",
"0.61730707",
"0.6100689",
"0.58971924",
"0.579236",
"0.5725349",
"0.562158",
"0.5614783",
"0.5597293",
"0.5546151",
"0.5543412",
"0.5543412",
"0.55330604",
"0.55128133",
"0.54894316",
"0.54732186",
"0.5436595",
"0.5412067",
"0.5407623... | 0.7209383 | 0 |
Return the string defined in the "split" option, or None. | def get_opt_split(self, command):
if "split" in self.command_dict["commands"][command].keys():
return self.command_dict["commands"][command]["split"]
else:
return CommandDict.DEFAULT_OPT_SPLIT | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_or_none(fld):\n if fld is not None:\n split_fld = fld.split(' ')\n else:\n split_fld = None\n\n return split_fld",
"def _parse_option_name(line):\n return line.split('=')[0].strip()",
"def getSplitChars(self):\n return self.getOrDefault(\"split... | [
"0.59221715",
"0.5859727",
"0.5857961",
"0.57524025",
"0.56366026",
"0.56363374",
"0.5515007",
"0.54885024",
"0.5468819",
"0.5438792",
"0.5391925",
"0.53492457",
"0.53471935",
"0.52982587",
"0.52702796",
"0.5250794",
"0.52309585",
"0.52288836",
"0.52288836",
"0.5199767",
"0.5... | 0.6627162 | 0 |
pick actions given numeric agent outputs (np arrays) | def sample_actions(self, agent_outputs):
logits, state_values = agent_outputs
policy = np.exp(logits) / np.sum(np.exp(logits), axis=-1, keepdims=True)
return np.array([np.random.choice(len(p), p=p) for p in policy]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actionSelector(self): \n if self.Temp!=0:\n if len(self.lessons) > 60 and self.var_T: \n # if the agent haven't already gotten food since a certain time \n # we increase the temperature by 0.001 \n if self.count_without_food>12:\n self.... | [
"0.6332541",
"0.62858754",
"0.62273467",
"0.62202567",
"0.62171763",
"0.6207081",
"0.61901003",
"0.6172455",
"0.61401296",
"0.61305875",
"0.6094308",
"0.6051624",
"0.6049658",
"0.60261565",
"0.6015744",
"0.60044897",
"0.60044897",
"0.596948",
"0.5955129",
"0.595375",
"0.59173... | 0.67525196 | 0 |
Returns a dictionary of files and folders for a given reference and path. Implemented using ``git lstree``. If an invalid reference and/or path None is returned. | def ls_tree(reference, path=None, directory=None):
# Try to track the reference as a branch
track_branches(reference, directory=directory)
cmd = 'git ls-tree ' + reference
if path is not None and path != '':
cmd += ':' + path
retcode, out, err = execute_command(cmd, autofail=False, silent_er... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tree_hash_dict(cls, current_dir, file_path, dirs, files, ref_table):\n\n # we sort just to ensure there are no arrangement issues that could affect the hash outcome\n file_hashs = sorted([ref_table['%s/%s' % (file_path, file)]['hash'] for file in files])\n dir_hashs = sorted([ref_ta... | [
"0.61584675",
"0.5878132",
"0.58635056",
"0.5799189",
"0.57655996",
"0.57045203",
"0.5640728",
"0.55679065",
"0.55450636",
"0.5512755",
"0.5477827",
"0.54668874",
"0.54139876",
"0.54109913",
"0.52307737",
"0.5205111",
"0.5195961",
"0.51922023",
"0.5183229",
"0.5154966",
"0.51... | 0.7030277 | 0 |
Interface to the git show command. If path is a file that exists, a string will be returned which is the contents of that file. If the path is a directory that exists, then a dictionary is returned where the keys are items in the folder and the value is either the string 'file' or 'directory'. If the path does not exis... | def show(reference, path, directory=None):
# Check to see if this is a directory
dirs = ls_tree(reference, path, directory)
if dirs is not None:
return dirs
# Otherwise a file or does not exist, check for the file
cmd = 'git show {0}:{1}'.format(reference, path)
# Check to see if it is a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _git_show(self, path, ref=\"HEAD\"):\n res = requests.get(\n \"/\".join([self.loc, ref, path]),\n auth=HTTPBasicAuth(self.username, self.password)\n )\n\n if res.status_code // 100 != 2:\n return None\n\n if res.headers['Content-Type'] == 'applicatio... | [
"0.74270105",
"0.68815726",
"0.6252289",
"0.62171793",
"0.6192653",
"0.59567374",
"0.58447385",
"0.5779722",
"0.57291466",
"0.5719413",
"0.57182735",
"0.5684475",
"0.5651769",
"0.5619608",
"0.5599808",
"0.556769",
"0.5479113",
"0.54499125",
"0.54419017",
"0.54162186",
"0.5378... | 0.7767432 | 0 |
Returns the SHA1 commit hash for the given reference. | def get_commit_hash(reference, directory=None):
# Track remote branch
if branch_exists(reference, local_only=False, directory=directory):
if not branch_exists(reference, local_only=True, directory=directory):
track_branches(reference, directory)
cmd = 'git show-branch --sha1-name ' + ref... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hash(repo, ref='HEAD'):\n return subprocess.check_output(['git', 'rev-parse', '--verify', ref],\n cwd=repo).rstrip()",
"def _get_git_hash(self):\n try:\n with open(os.path.join(self._base_dir, '.git', 'HEAD'), 'r') as head_file:\n ref ... | [
"0.7660623",
"0.725383",
"0.7150455",
"0.71380645",
"0.7114533",
"0.68922997",
"0.6765757",
"0.66595644",
"0.66213447",
"0.66117346",
"0.6610337",
"0.65057325",
"0.6426884",
"0.64247966",
"0.64152366",
"0.63599724",
"0.63132864",
"0.631321",
"0.6288229",
"0.62813455",
"0.6278... | 0.7786271 | 0 |
Returns True is the working branch has untracked files, False otherwise. | def has_untracked_files(directory=None):
out = check_output('git status', shell=True, cwd=directory)
if '# Untracked files:' in out:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_git_dirty():\n dirty_status = local('git diff --quiet || echo \"*\"', capture=True)\n if dirty_status == '*':\n return True\n\n untracked_count = int(local('git status --porcelain 2>/dev/null| grep \"^??\" | wc -l', capture=True))\n if untracked_count > 0:\n return True\n\n retu... | [
"0.7369675",
"0.7245063",
"0.7186721",
"0.6902411",
"0.69018334",
"0.6766072",
"0.6752072",
"0.67305964",
"0.6614926",
"0.66121066",
"0.6557952",
"0.6492854",
"0.6405835",
"0.64045507",
"0.62953687",
"0.626833",
"0.6249092",
"0.6208174",
"0.61656004",
"0.6162128",
"0.6151879"... | 0.8167415 | 0 |
Returns True if the given tag exists, False otherwise | def tag_exists(tag, directory=None):
return tag in get_tags(directory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_tag(self, tag):\n return tag in self.tags",
"def has_tag(self, tag):\n return tag in self.tags",
"async def exists(self, tag_name):\n try:\n if await self.get_id(tag_name):\n return True\n except RtbDoesntExists:\n return False",
"def h... | [
"0.8192115",
"0.8192115",
"0.81442606",
"0.7918354",
"0.77401036",
"0.75310254",
"0.7446307",
"0.74178255",
"0.7344889",
"0.732079",
"0.72747904",
"0.7171363",
"0.71429306",
"0.7109353",
"0.7026018",
"0.67887926",
"0.6704246",
"0.6700222",
"0.6663846",
"0.66027105",
"0.659709... | 0.8404489 | 0 |
Deletes a given remote tag. | def delete_remote_tag(tag, remote='origin', directory=None):
execute_command('git push {0} :{1}'.format(remote, tag), shell=True,
cwd=directory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag_remove(self, remote_path, corpus_id, tag, storage_id=None):\n client, remote_path = self._get_storage(remote_path, storage_id=storage_id)\n return client.tag_remove(corpus_id, tag)",
"def delete(self, tag, params={}, **options):\n path = \"/tags/%s\" % (tag)\n return self.clie... | [
"0.7718818",
"0.7641354",
"0.7475749",
"0.74589896",
"0.7241543",
"0.72296864",
"0.7126731",
"0.6996629",
"0.69694495",
"0.6888142",
"0.68675804",
"0.6833233",
"0.6710165",
"0.66714925",
"0.6669892",
"0.66515905",
"0.66195464",
"0.66030765",
"0.65793186",
"0.65521675",
"0.654... | 0.7991468 | 0 |
Returns a list of tags in the git repository. | def get_tags(directory=None):
out = check_output('git tag -l', shell=True, cwd=directory)
return [l.strip() for l in out.splitlines()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_list_tags(cs, args):\n resp, tags = cs.repositories.list_tags(args.repository)\n tags = [{\"Tag\": t} for t in tags]\n utils.print_list(tags, [\"Tag\"], sortby=\"Tag\")",
"def get_tags(self):\n tags = []\n for image in self.client.images.list():\n for tag in image.tags:\n... | [
"0.7660419",
"0.76550305",
"0.7644801",
"0.75672406",
"0.74624276",
"0.73732084",
"0.7258995",
"0.72259563",
"0.72047967",
"0.71400553",
"0.70663697",
"0.7060839",
"0.7045013",
"0.6962905",
"0.6937564",
"0.6937564",
"0.6908174",
"0.688024",
"0.68553925",
"0.68434227",
"0.6831... | 0.7836319 | 0 |
Checks that you are in the root of the git repository, else exit. | def ensure_git_root():
root = get_root()
if root is None:
error("Not in a git repository.", exit=True)
if os.getcwd() != root:
error("Must call from the top folder of the git repository",
exit=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def navigate_to_git_root() -> bool:\n dir_climb_count = 0\n continue_dir_traverse = True\n while continue_dir_traverse:\n if not Utils.contains_dir('.git'):\n print(f\"Current dir {os.getcwd()} is not a Git repository.\")\n # Change directory up one lev... | [
"0.76070565",
"0.7348511",
"0.70405227",
"0.6678482",
"0.65229124",
"0.64519316",
"0.6368765",
"0.6358901",
"0.63172734",
"0.6314767",
"0.6281854",
"0.62632245",
"0.62627625",
"0.6222363",
"0.6149592",
"0.61405575",
"0.61228436",
"0.6066111",
"0.59869486",
"0.5963188",
"0.596... | 0.85459024 | 0 |
Tracks all specified branches. | def track_branches(branches=None, directory=None):
if type(branches) == str:
branches = [branches]
debug("track_branches(" + str(branches) + ", " + str(directory) + ")")
if branches == []:
return
# Save the current branch
current_branch = get_current_branch(directory)
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_branches(self):\n logging.info('--- Get Branches ---')\n self.local_branches = set(self.find_branches())\n self.remote_branches = set(self.find_branches(remote=True))\n # Tags are remote branches that start with \"tags/\".\n self.tags = {\n single_branch for s... | [
"0.5989476",
"0.5985131",
"0.5974778",
"0.58220303",
"0.5702252",
"0.5696388",
"0.5686802",
"0.5682091",
"0.5580505",
"0.541718",
"0.53673714",
"0.5365935",
"0.5262822",
"0.52213264",
"0.5179027",
"0.5177821",
"0.5168318",
"0.5141571",
"0.5116087",
"0.50699514",
"0.50658035",... | 0.7209036 | 0 |
Returns the most recent, by date, tag in the given local git repository. | def get_last_tag_by_date(directory=None):
cmd = "git for-each-ref --sort='*authordate' " \
"--format='%(refname:short)' refs/tags/upstream"
output = check_output(cmd, shell=True, cwd=directory, stderr=PIPE)
output = output.splitlines()
if len(output) == 0:
return ''
return output[-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest_github_tag():\n release_tags_github_url = \"https://api.github.com/repos/rackerlabs/openstack-guest-agents-unix/tags\"\n release_tags_json = urllib2.urlopen(release_tags_github_url)\n release_tags_data = json.load(release_tags_json)\n return str(release_tags_data[0]['name'])[1:]",
"def get... | [
"0.6903574",
"0.6674831",
"0.65792495",
"0.6339654",
"0.63221633",
"0.63045645",
"0.61844766",
"0.61714214",
"0.60810655",
"0.6045296",
"0.60286623",
"0.5970002",
"0.5933507",
"0.5900507",
"0.5880155",
"0.58799756",
"0.587563",
"0.57677513",
"0.57312053",
"0.5720901",
"0.5693... | 0.73158556 | 0 |
Delete specified scan ID in the OpenVAS server. | def delete_scan(self, scan_id):
self.__manager.delete_task(scan_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_scan(self, scanid, apikey=''):\n return six.next(six.itervalues(self.zap._request(self.zap.base + 'spider/action/removeScan/', {'scanId': scanid, 'apikey': apikey})))",
"def delete(self, id: int):\n self._select_interface(self._rc_delete, self._http_delete, id)",
"def delete(self, id):... | [
"0.64858025",
"0.62438697",
"0.62418026",
"0.6067558",
"0.5964057",
"0.59593976",
"0.5948016",
"0.5885676",
"0.58653855",
"0.5861436",
"0.5857621",
"0.5845131",
"0.58350873",
"0.58299905",
"0.5804953",
"0.5782922",
"0.5780116",
"0.5770324",
"0.57642686",
"0.5763325",
"0.57391... | 0.70357424 | 0 |
Get the results associated to the scan ID. | def get_results(self, scan_id):
if not isinstance(scan_id, basestring):
raise TypeError("Expected string, got %r instead" % type(scan_id))
m_response = None
try:
m_response = self.__manager.make_xml_request('<get_results task_id="%s"/>' % scan_id, xml_result=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def results(self, scanid=None):\n params = {}\n if scanid is not None:\n params['scanId'] = scanid\n return six.next(six.itervalues(self.zap._request(self.zap.base + 'spider/view/results/', params)))",
"def full_results(self, scanid):\n return six.next(six.itervalues(self.z... | [
"0.81305647",
"0.76431435",
"0.7048965",
"0.6860931",
"0.66560125",
"0.6616452",
"0.6616452",
"0.6562809",
"0.6534687",
"0.6507671",
"0.64487296",
"0.6436412",
"0.6357509",
"0.6272296",
"0.6264815",
"0.6251121",
"0.62372833",
"0.6200259",
"0.61653924",
"0.61547935",
"0.613827... | 0.80211973 | 1 |
Transform the XML results of OpenVAS into GoLismero structures. | def transform(xml_results):
PORT = re.compile("([\w\d\s]*)\(([\d]+)/([\w\W\d]+)\)")
m_return = []
m_return_append = m_return.append
# All the results
for l_results in xml_results.findall(".//results"):
for l_results in l_results.findall("result"):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_xml1(filename):\r\n tree = ET.parse(filename)\r\n # tree=ElementTree()\r\n # tree.parse(filename)\r\n\r\n baseInfo={}\r\n baseInfo['foder'] = tree.find('foder').text\r\n baseInfo['filename'] = tree.find('filename').text\r\n baseInfo['path'] = tree.find('path').text\r\n baseInfo['s... | [
"0.5746617",
"0.57251436",
"0.5701722",
"0.55126",
"0.5400629",
"0.52202314",
"0.51965374",
"0.5187935",
"0.5169699",
"0.5107423",
"0.5096457",
"0.50949335",
"0.5082679",
"0.50738865",
"0.50707245",
"0.5036144",
"0.5033714",
"0.50212145",
"0.5018997",
"0.50144964",
"0.5011265... | 0.64514476 | 0 |
Lowlevel interface to send OMP XML to the manager. `xmldata` may be either a utf8 encoded string or an etree Element. If `xml_result` is true, the result is returned as an etree Element, otherwise a utf8 encoded string is returned. | def make_xml_request(self, xmldata, xml_result=False):
if xml_result:
return self._xml_command(xmldata)
else:
return self._text_command(xmldata) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_xml(data, code, headers=None):\r\n resp = make_response(dumps({'response' :data}), code)\r\n resp.headers.extend(headers or {})\r\n return resp",
"def output_xml(data,code,headers=None):\r\n resp = make_response(dumps({'response': data}), code)\r\n resp.headers.extend(headers or {})\r\n... | [
"0.59842473",
"0.590035",
"0.58694977",
"0.58375615",
"0.5746175",
"0.56521654",
"0.55872303",
"0.5380795",
"0.52754253",
"0.52619267",
"0.51760083",
"0.5154628",
"0.5122051",
"0.5100714",
"0.5063454",
"0.5046226",
"0.5041392",
"0.50323397",
"0.50272864",
"0.498374",
"0.49792... | 0.7286837 | 0 |
Delete a target in OpenVAS server. | def delete_target(self, target_id):
request = """<delete_target target_id="%s" />""" % (target_id)
self.make_xml_request(request, xml_result=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteTarget(self, target_instance_id):",
"def delete_target(self, target_id):\n self.__manager.delete_target(target_id)",
"def delete_target(\n self,\n ) -> Callable[[cloud_deploy.DeleteTargetRequest], operations_pb2.Operation]:\n # Generate a \"stub function\" on-the-fly which wil... | [
"0.8091861",
"0.7256433",
"0.6986218",
"0.6948263",
"0.6703882",
"0.6629129",
"0.6562303",
"0.64718026",
"0.6440984",
"0.6424786",
"0.636235",
"0.63571507",
"0.6321625",
"0.63056296",
"0.62310606",
"0.6209659",
"0.61825114",
"0.60985464",
"0.60440814",
"0.60434717",
"0.602911... | 0.73861814 | 1 |
Get IDs of tasks of the server. If name param is provided, only get the ID associated to this name. | def get_tasks_ids(self, name=None):
m_return = {}
for x in self.get_tasks().findall("task"):
m_return[x.find("name").text] = x.get("id")
if name:
return {name : m_return[name]}
else:
return m_return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTaskIdsFromName(tasks_name):\n ids = []\n for name in tasks_name:\n task_obj = Tafv2Task.objects.get(script=name)\n ids.append(task_obj.id)\n\n return ids",
"def list(self, name=None):\n if name is not None:\n tasks = self._list_all_tasks_from_s... | [
"0.7241726",
"0.66047156",
"0.61854565",
"0.617998",
"0.6130526",
"0.6116685",
"0.59722537",
"0.5819954",
"0.581914",
"0.5793457",
"0.572261",
"0.5721991",
"0.5720298",
"0.5713903",
"0.5683129",
"0.5647397",
"0.5627572",
"0.5593505",
"0.5576658",
"0.5566203",
"0.5542736",
"... | 0.7461567 | 0 |
Get IDs of tasks of the server depending of their status. | def get_tasks_ids_by_status(self, status="Done"):
if status not in ("Done", "Paused", "Running", "Stopped"):
raise ValueError("Requested status are not allowed")
m_task_ids = {}
for x in self.get_tasks().findall("task"):
if x.find("status").text == status:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status(self, ids):\n return [self.tasks[id].status for id in ids]",
"async def get_task_status(task_id: TaskId):",
"def get_by_status(status):\n return list(tasks.find({'status': status}))",
"def getTaskIds(self, director):\n # the computation record\n computation = self._getC... | [
"0.7409147",
"0.6804526",
"0.67901206",
"0.67296845",
"0.671727",
"0.6612482",
"0.6425006",
"0.6319168",
"0.6282953",
"0.6219129",
"0.6155044",
"0.60994595",
"0.60912615",
"0.6084754",
"0.6075681",
"0.60585046",
"0.6018567",
"0.5985774",
"0.5976151",
"0.59108424",
"0.59107476... | 0.7915353 | 0 |
Send OMP data to the manager and read the result. `data` may be either an unicode string, an utf8 encoded string or an etree Element. The result is as an etree Element. | def _send(self, data):
# Make sure the data is a string.
if etree.iselement(data):
data = etree.dump(data)
if isinstance(data, unicode):
data = data.encode('utf-8')
# Synchronize access to the socket.
with self.__socket_lock:
# Send the data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self, data):\n\t\t# no processing here\n\t\treturn data",
"def process_data(self, data):\n return data",
"def process(self, data):\n if self.__head:\n self.__head.send(Element(\n stream_id=self.id,\n data=data))",
"def receive_data(self, ... | [
"0.56227386",
"0.5599538",
"0.5506999",
"0.5491832",
"0.5463451",
"0.5454051",
"0.54514366",
"0.54094595",
"0.5358407",
"0.53560555",
"0.52742416",
"0.52742416",
"0.52742416",
"0.52742416",
"0.52742416",
"0.52742416",
"0.5257809",
"0.5192717",
"0.518057",
"0.5177661",
"0.5157... | 0.62201273 | 0 |
Make a request and get the text of the response in raw format. | def _text_command(self, request):
response = self._send(request)
self._check_response(response)
return response.text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_request_txt(self):\n #print (self.url)\n try:\n with closing(get(self.url, stream=True)) as resp: #returns b`txt`\n if self.is_txt(resp):\n return resp.content.decode(\"utf-8\")\n else:\n return None\n exce... | [
"0.76783127",
"0.7064034",
"0.70067334",
"0.65991724",
"0.6491401",
"0.64328295",
"0.635193",
"0.6351664",
"0.63195264",
"0.63114756",
"0.6302482",
"0.6273952",
"0.6234914",
"0.6232645",
"0.62322557",
"0.6210151",
"0.61522424",
"0.61335206",
"0.6114845",
"0.6100542",
"0.60428... | 0.7290089 | 1 |
Make a request and get the response as xml tree format. | def _xml_command(self, request):
response = self._send(request)
self._check_response(response)
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_request_xml(self):\n #print (self.url)\n try:\n with closing(get(self.url, stream=True)) as resp: #returns b`xml`\n if self.is_good_enough_xml(resp):\n return resp.content\n else:\n return None\n except Req... | [
"0.72486365",
"0.65347195",
"0.6500496",
"0.6489617",
"0.64853764",
"0.64333767",
"0.64266306",
"0.6416313",
"0.6391655",
"0.63781",
"0.6280537",
"0.62649214",
"0.6152969",
"0.6142053",
"0.6107071",
"0.59933704",
"0.5915285",
"0.59001976",
"0.5878529",
"0.5878529",
"0.5843144... | 0.6877252 | 1 |
Return all the measurements from the given candidate | def all_measurements(candidate, godata):
measurements = OrderedDict()
measurements.update(concept_measurements(candidate, godata))
measurements.update(evidence_measurements(candidate))
measurements.update(bias_measurements(candidate))
return measurements | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAllMeasurement(self): \n return self.measurement",
"def measurements(self):\n # TODO: add in empty measurements for assays that have none?\n return self._measure_queryset",
"def get_all_DLP_measurements(self):\n pass",
"def measurements(self) -> List[Measurement]:\n ... | [
"0.5974163",
"0.5968742",
"0.5916268",
"0.58943176",
"0.58498883",
"0.58254296",
"0.5810822",
"0.57148933",
"0.5701141",
"0.56946844",
"0.56884414",
"0.5596696",
"0.5587437",
"0.5565164",
"0.553554",
"0.5528445",
"0.55090314",
"0.5449595",
"0.54183304",
"0.540518",
"0.5405111... | 0.70730406 | 0 |
Seed the numpy prng and return a data frame w/ predictable test inputs so that the tests will have consistent results across builds. | def random_df(request):
old_state = np.random.get_state()
def fin():
# tear down: reset the prng after the test to the pre-test state
np.random.set_state(old_state)
request.addfinalizer(fin)
np.random.seed(1)
return pd.DataFrame(
{'some_count': np.random.randint(1, 8, 20)},... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_data_for_tests():\n X = np.random.randn(100, input_dim)\n Y = np.random.randn(100, output_dim)\n X_new = np.random.randn(100, input_dim)\n return X, X_new, Y",
"def build_data(seed):\n rs = np.random.RandomState(seed)\n\n def y(x):\n \"\"\" y(x) = 1 + 0.3 * x_1 - 0.6 * x_2^2 - 0... | [
"0.62640226",
"0.626317",
"0.6150496",
"0.60767347",
"0.6075911",
"0.6051545",
"0.6035735",
"0.6022615",
"0.6013968",
"0.6004197",
"0.5934268",
"0.59313226",
"0.59139127",
"0.5891353",
"0.5879932",
"0.58529955",
"0.57775",
"0.5763144",
"0.57435983",
"0.5702521",
"0.56983835",... | 0.6335399 | 0 |
Create Tab and fill with content of default_script_content | def create_new_tab(default_script_content=""):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_tab(self):",
"def createDefaultTab(self):\n self.welcomePage = WelcomePage(self)\n tabId = self.tab.addTab(self.welcomePage, \"\" )\n self.tab.setTabIcon(tabId, QIcon(\":/main.png\") )\n\n self.welcomePage.LinkConnect.connect(self.onConnectLinkClicked)\n self.welcomePa... | [
"0.64131993",
"0.60441524",
"0.59892756",
"0.59824836",
"0.5936139",
"0.591632",
"0.5874173",
"0.586149",
"0.5849421",
"0.57874686",
"0.575115",
"0.5731017",
"0.5721766",
"0.57141954",
"0.5708622",
"0.5690848",
"0.56825405",
"0.5657574",
"0.5649704",
"0.56325084",
"0.56227934... | 0.85935897 | 0 |
Return the discriminator object that is wrapped. Subclasses may not need to implement this method but can chose to if they are wrapping an object capable of discrimination. | def discriminator(self) -> Any:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discriminator(self) -> str:\n return self.__class__.__name__",
"def discriminator(self) -> Any:\r\n return self._qda",
"def get_real_child_model(self, data):\n discriminator_value = data[self.discriminator].lower()\n return self.discriminator_value_class_map.get(discriminator_va... | [
"0.7162278",
"0.7028762",
"0.6861705",
"0.6829797",
"0.68028903",
"0.67468226",
"0.6720729",
"0.6682106",
"0.6682106",
"0.6682106",
"0.6682106",
"0.65834624",
"0.6465254",
"0.6457462",
"0.6250308",
"0.6051711",
"0.58467674",
"0.5799867",
"0.5700982",
"0.5668812",
"0.5561934",... | 0.72365224 | 0 |
Create a discriminator from the configuration. | def from_config(cls, config: Dict[str, Any]) -> "BaseDiscriminator": | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_discriminator(self):\n # label input\n in_label = Input(shape=(1,))\n # embedding for categorical input\n li = Embedding(self.n_classes, 50)(in_label)\n # scale up to image dimensions with linear activation\n n_nodes = self.in_shape[0] * self.in_shape[1]\n ... | [
"0.7203782",
"0.71097237",
"0.7004021",
"0.69149435",
"0.6872702",
"0.6715182",
"0.6653551",
"0.6575609",
"0.6497181",
"0.6439283",
"0.64347684",
"0.6390408",
"0.6352338",
"0.63269067",
"0.62924856",
"0.6271239",
"0.62504613",
"0.62000203",
"0.6198145",
"0.6189163",
"0.615890... | 0.7627585 | 0 |
Gets a hash code for the current DateTime instance. | def __hash__(self):
return hash(self.date) ^ hash(self.time_of_day) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __hash__(self):\n return int(((self._year % 100 * 12 + self._month) * 31 +\n self._day + self.time) * 100)",
"def _hashDateTime(self):\r\n i = 0\r\n for tp in self._listTimePoints:\r\n self._dateTimeHash[tp.getDateTime()] = i\r\n i += 1",
"def _... | [
"0.7116641",
"0.70797104",
"0.7021982",
"0.6897718",
"0.6678579",
"0.64955324",
"0.6468827",
"0.6436917",
"0.6384239",
"0.6383091",
"0.6382933",
"0.63715667",
"0.6305246",
"0.6295998",
"0.62853426",
"0.62744904",
"0.62410605",
"0.6240619",
"0.621996",
"0.6212789",
"0.62097067... | 0.741404 | 0 |
Finds out if two 'DateTime' instances are not equal. | def __ne__(self, Other):
return self.date != Other.date or self.time_of_day != Other.time_of_day | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def almost_same_datetime(dt1, dt2, allowed_delta=timedelta(minutes=1)):\r\n return abs(dt1 - dt2) < allowed_delta",
"def compare_datetime(self_datetime, other_datetime):\n # pylint: disable=superfluous-parens\n if (isinstance(self_datetime and other_datetime, (datetime, type(None)))):\n return (\n ... | [
"0.7060995",
"0.7005772",
"0.69751614",
"0.67829657",
"0.67326754",
"0.67311144",
"0.66667795",
"0.66145265",
"0.6613488",
"0.6596073",
"0.6548462",
"0.64864844",
"0.6370382",
"0.6360114",
"0.6351058",
"0.625587",
"0.61844254",
"0.61789215",
"0.6171636",
"0.6166754",
"0.61339... | 0.70775914 | 0 |
Gets this timestamp's time of day. | def time_of_day(self):
return self.time_of_day_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def day_ts(self):\n return self.raw() // (60 * 24)",
"def get_time_of_the_day(self, ts):\n h, m, s = ts.hour, ts.minute, ts.second\n # Convert the hours, minutes, and seconds to seconds: referenced to 0 AM\n t = int(h) * 3600 + int(m) * 60 + int(s)\n if t >= 0:\n ret... | [
"0.7439932",
"0.74265647",
"0.69092965",
"0.6888736",
"0.68819934",
"0.6868406",
"0.68665147",
"0.68561435",
"0.68515694",
"0.684759",
"0.684759",
"0.684759",
"0.6750747",
"0.6740334",
"0.67259836",
"0.67207116",
"0.671258",
"0.671258",
"0.671258",
"0.67064935",
"0.67064935",... | 0.8198794 | 0 |
Sets this timestamp's time of day. This accessor is private. | def time_of_day(self, value):
self.time_of_day_value = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_time(self, time):\n self._time = time",
"def setTime(self, timeObj, day=None):\n\n # override day if it's None\n if not day:\n day = getDayFromNum(timeObj.weekday())\n\n self._fileCache[day][\"time-hr\"] = timeObj.hour\n self._fileCache[day][\"time-min\"] = t... | [
"0.67705643",
"0.65735674",
"0.6559325",
"0.6531947",
"0.63953936",
"0.6381746",
"0.6381746",
"0.6374305",
"0.6324803",
"0.6319383",
"0.62798166",
"0.6268972",
"0.62550294",
"0.62300986",
"0.6218603",
"0.62182754",
"0.62113154",
"0.62104666",
"0.6195025",
"0.6189597",
"0.6188... | 0.7851839 | 0 |
Params ====== input_count = number of inputs node_count = number of nodes in the layer activations = activations for each node | def __init__(self, input_count, node_count, activations=[]):
self.input_count = input_count
self.node_count = node_count
# If no activations are passed, generate them randomly.
if (len(activations) == 0):
rand_activations = [random.randint(0, self.node_count) for i in range... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activate(self, inputs, max_iters=10, verbose=False):\n # Node activation values\n self.node_vals = np.zeros(self.A.shape[0])\n\n # Bool to check if node was activated in the current time step\n self.active_nodes = np.zeros((self.A.shape[0]), dtype=bool)\n\n # Label inputs and... | [
"0.6643204",
"0.6569007",
"0.6522227",
"0.64859754",
"0.6354559",
"0.6301704",
"0.62646145",
"0.62479687",
"0.6245054",
"0.6192256",
"0.61219674",
"0.60853064",
"0.60848325",
"0.6047769",
"0.6016878",
"0.6013377",
"0.60133046",
"0.6000324",
"0.5991866",
"0.59814864",
"0.59561... | 0.6972768 | 0 |
Top level function to create Share or Batch instance depending on number of symbols given | def IexFinance(symbol, **kwargs):
if type(symbol) is str:
if not symbol:
raise ValueError("Please input a symbol or list of symbols")
else:
inst = Share(symbol, **kwargs)
elif type(symbol) is list:
if not symbol:
raise ValueError("Please input ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, symbols, short_window, long_window, command_execute):\n\n\t\t# Create a new Macs object for every stock\n\t\tself.data = {s: Macs(short_window, long_window) for s in symbols}\n\t\tself.command_execute = command_execute",
"def test_create_nas_share_by_nas(self):\n pass",
"def create(*a... | [
"0.5649457",
"0.5466746",
"0.54380417",
"0.5288137",
"0.52806205",
"0.5269566",
"0.52595186",
"0.51963764",
"0.5187528",
"0.5149091",
"0.5149091",
"0.5115753",
"0.51052445",
"0.5080091",
"0.50597936",
"0.49435118",
"0.49334913",
"0.49333498",
"0.49316835",
"0.49204686",
"0.49... | 0.56744677 | 0 |
Universal selector method to obtain custom datapoints from an individual endpoint. If an invalid endpoint is specified, throws an IEXEndpointError. If an invalid datapoint is specified, throws an IEXDatapointError. If there are issues with the query, throws an IEXQueryError. | def get_select_datapoints(self, endpoint, attrList= []):
if type(attrList) is str:
attrList = [attrList]
result = {}
if not attrList:
raise ValueError("Please give a valid attribute list")
try:
ep = self.data_set[endpoint]
except:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_select_datapoints(self, endpoint, attrList= []):\r\n if type(attrList) is str:\r\n attrList = [attrList]\r\n result = {}\r\n if not attrList:\r\n raise ValueError(\"Please give a valid attribute list\")\r\n for symbol in self.symbolList:\r\n try:... | [
"0.6004158",
"0.5757326",
"0.56205434",
"0.559747",
"0.5489849",
"0.54704744",
"0.51634777",
"0.5106707",
"0.5091631",
"0.5091631",
"0.50713134",
"0.50563973",
"0.5046296",
"0.5007252",
"0.4949157",
"0.48976734",
"0.488121",
"0.48496354",
"0.48321018",
"0.47773814",
"0.476696... | 0.6258382 | 0 |
Universal selector method to obtain custom endpoints from the data set. Will throw a IEXEndpointError if an invalid endpoint is specified and an IEXQueryError if the endpoint cannot be retrieved. | def get_select_endpoints(self, endpoints=[]):
if type(endpoints) is str:
endpoints = [endpoints]
elif not endpoints:
raise ValueError("Please provide a valid list of endpoints")
result = {}
for symbol in self.symbolList:
temp = {}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_endpoints(self, **kwargs):\n return self._database.lookup('endpoint', kwargs)",
"def get_select_endpoints(self, endpointList=[]):\r\n if type(endpointList) is str:\r\n endpointList = [endpointList]\r\n result = {}\r\n if not endpointList:\r\n raise ValueE... | [
"0.7035371",
"0.6563425",
"0.5973638",
"0.5787101",
"0.56657445",
"0.56499183",
"0.56115985",
"0.55519307",
"0.5545966",
"0.5541535",
"0.546775",
"0.542534",
"0.5412308",
"0.5348684",
"0.5323091",
"0.53188264",
"0.5276792",
"0.5265353",
"0.521188",
"0.52017355",
"0.51605594",... | 0.6566298 | 1 |
Universal selector method to obtain custom datapoints from an individual endpoint. If an invalid endpoint is specified, throws an IEXEndpointError. If an invalid datapoint is specified, throws an IEXDatapointError. If there are issues with the query, throws an IEXQueryError. | def get_select_datapoints(self, endpoint, attrList= []):
if type(attrList) is str:
attrList = [attrList]
result = {}
if not attrList:
raise ValueError("Please give a valid attribute list")
for symbol in self.symbolList:
try:
ep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_select_datapoints(self, endpoint, attrList= []):\r\n if type(attrList) is str:\r\n attrList = [attrList]\r\n result = {}\r\n if not attrList:\r\n raise ValueError(\"Please give a valid attribute list\")\r\n try:\r\n ep = self.data_set[endpoint]\r... | [
"0.6259866",
"0.57575727",
"0.5619659",
"0.5598211",
"0.5490989",
"0.5469542",
"0.5162907",
"0.51040107",
"0.50893545",
"0.50893545",
"0.5070232",
"0.50570154",
"0.504547",
"0.50083077",
"0.49490505",
"0.48968083",
"0.4880763",
"0.48488453",
"0.48321742",
"0.47770387",
"0.476... | 0.6005972 | 1 |
Parses a comment body for amazon book urls, return all comentions | def get_comentions(body):
isbns = set(isbn for _, isbn in ISBN_REGEX.findall(body))
for isbn1, isbn2 in permutations(isbns, 2):
yield isbn1, isbn2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrape_one_book(self, url):\n\n if url in self.url_to_explore:\n self.url_to_explore.remove(url)\n req = requests.get(url, headers = self.headers).content\n soup = BeautifulSoup(req, 'html5lib')\n soupbody = soup.body\n\n book_data = {}\n # get book url\n ... | [
"0.56733966",
"0.5616772",
"0.55885935",
"0.5540495",
"0.5528516",
"0.5509193",
"0.5475242",
"0.53941107",
"0.53796166",
"0.5375941",
"0.536291",
"0.53554696",
"0.53521144",
"0.52970135",
"0.5271222",
"0.52644044",
"0.52596533",
"0.5228912",
"0.5222263",
"0.51596844",
"0.5159... | 0.56806034 | 0 |
for each comment in the csv, count the number of comentions | def count_comentions_csv(csv_reader):
header = next(csv_reader)
index_of = {col: index for index, col in enumerate(header)}
comention_counter = Counter()
for line in csv_reader:
body = line[index_of['body']]
for isbn1, isbn2 in get_comentions(body):
comention_counter[(isbn1, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _count_comment_rows(vcf_path):\n vcf_lines_generator = lines_from_vcf(vcf_path)\n\n comment_lines_count = 0\n for line in vcf_lines_generator:\n if line.startswith('#'):\n comment_lines_count += 1\n else:\n vcf_lines_generator.close() # Don't leave the file handle ... | [
"0.6550013",
"0.651329",
"0.63195485",
"0.61350703",
"0.6074047",
"0.60031706",
"0.600072",
"0.59598917",
"0.58645254",
"0.58162385",
"0.5778962",
"0.5714064",
"0.5712255",
"0.5708559",
"0.56961226",
"0.56937104",
"0.56761754",
"0.56676346",
"0.565836",
"0.5652044",
"0.564942... | 0.7625474 | 0 |
Reads in the all the comment csvs in `csv_directory` and builds a csv containing all the comention frequencies | def main():
csv_paths = sorted(glob(os.path.join('amazon', '*.csv')), key=lambda p: p.split('/'))
with open('comentions.csv', 'w+') as wf:
csv_writer = csv.writer(wf)
# counter for comentions across ALL the csvs
all_comentions_counter = Counter()
for csv_path in csv_paths:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concat_file(filename):\n csv_paths = read_csv(filename)\n\n data_len = 0\n df_total = None\n for csv_name, csv_path in tqdm(csv_paths):\n print(csv_name)\n df = dt.fread(csv_path).to_pandas()\n data_len += df.shape[0]\n\n process_df = filter_law(df)\n\n if df_tota... | [
"0.6203551",
"0.61001015",
"0.59032845",
"0.5900873",
"0.58855546",
"0.577408",
"0.5725831",
"0.5725831",
"0.5722023",
"0.5682996",
"0.5677519",
"0.5640583",
"0.5640177",
"0.5633452",
"0.55537605",
"0.5501322",
"0.5458168",
"0.5458156",
"0.5456997",
"0.54544693",
"0.54528195"... | 0.69587445 | 0 |
This function accepts the column number for the features (X) and the target (y). It chunks the data up with a rolling window of Xt window to predict Xt. It returns two numpy arrays of X and y. | def get_window_data(symbol_signals_df, window_size, feature_col_number, target_col_number):
X = []
y = []
for i in range(len(symbol_signals_df) - window_size):
features = symbol_signals_df.iloc[i : (i + window_size), feature_col_number]
#print(features)
target =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def window_data_proc(X, y=None, delta=1):\n vectorize_windowing = lambda row: train_sample_windowize(row.reshape(20, 20), delta=delta)\n\n X = np.vstack(np.apply_along_axis(vectorize_windowing, 1, X))\n if y is not None:\n y = np.vstack(y.ravel())\n return X, y\n return X",
"def create_... | [
"0.6774904",
"0.6560236",
"0.6472635",
"0.6309464",
"0.6181797",
"0.61627406",
"0.6098337",
"0.60654366",
"0.6061897",
"0.596563",
"0.5918512",
"0.5904378",
"0.5902015",
"0.5901196",
"0.58332914",
"0.5796301",
"0.5725761",
"0.5725353",
"0.57221377",
"0.5710071",
"0.56973004",... | 0.69587827 | 0 |
Display individual listing details Form to edit details if needed | def view_and_edit_listing(request, listing_id):
categories = Category.objects.all()
listing = get_object_or_404(Listing, pk=listing_id)
if request.method == 'POST':
editform = AddListingForm(
request.POST,
request.FILES,
instance=listing)
if editform.is_v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_edit_form(self, obj_pk=None):\n obj = self.model.objects.get(pk=obj_pk)\n # if there is no edit permission then does not show the form\n if not self.has_view_permissions(obj): return\n\n\n # create the edit form a add it to the empty widget details\n # override the funct... | [
"0.6423212",
"0.641157",
"0.63378507",
"0.63075763",
"0.6235448",
"0.6208106",
"0.6087774",
"0.59973407",
"0.59855765",
"0.59694964",
"0.5962369",
"0.59481186",
"0.5931475",
"0.5924304",
"0.59183794",
"0.59069675",
"0.59024376",
"0.58667976",
"0.5819715",
"0.57534856",
"0.574... | 0.7251244 | 0 |
Allow user to delete his own listing from the database | def delete_listing(request, listing_id):
listing = get_object_or_404(Listing, pk=listing_id)
listing.delete()
messages.success(
request,
'Your listing has been removed from the database.')
return redirect(reverse('addlisting')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(request, shoppinglist_id):\n Shoppinglist.objects.filter(pk=shoppinglist_id,\n pantry__owner=request.user).delete()\n return redirect('blackem.users.views.home')",
"def delete_meal():",
"def delete(self):\n ...",
"def delete_single_list(current_user, id)... | [
"0.7306309",
"0.7026673",
"0.67697275",
"0.6706425",
"0.6665472",
"0.66603535",
"0.663963",
"0.6630547",
"0.6598493",
"0.6590657",
"0.65645725",
"0.6553357",
"0.6548903",
"0.6521397",
"0.6521397",
"0.6516474",
"0.65144175",
"0.6508936",
"0.64967644",
"0.64729667",
"0.64729667... | 0.70493543 | 1 |
Shows on the stdout the progress bar for the given progress. | def bar(self, progress):
if not hasattr(self, "_limit") or not self._limit:
self._limit = self.terminal_size()
graph_progress = int(progress * self._limit)
self.stdout.write("\r", ending="")
progress_format = "[%-{}s] %d%%".format(self._limit)
self.stdout.write(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def progress_bar(progress):\n bar_length = 50\n block = int(round(bar_length * progress))\n text = 'Progress: [{0}] {1}'.format('#' * block + '-' * (bar_length - block),\n progress * 100)\n # Print progress after removing the previous progress\n sys.stdout.writ... | [
"0.82115006",
"0.7860901",
"0.7719026",
"0.76584613",
"0.7644995",
"0.7632446",
"0.76069385",
"0.7581132",
"0.75713515",
"0.7540913",
"0.75251687",
"0.7506127",
"0.75033945",
"0.74972796",
"0.7495927",
"0.7455444",
"0.74466825",
"0.7409827",
"0.7370332",
"0.7350555",
"0.73497... | 0.8260696 | 0 |
Given a tkinter widget, this will create a FigureCanvas as a root of that widget and pack it | def create_figure(root_window):
frame = ttk.Frame(root_window)
fig = Figure()
canvas = FigureCanvas(fig, frame)
toolbar = NavigationToolbar2TkAgg(canvas, frame)
frame.pack(expand=tk.YES, fill=tk.BOTH)
canvas.get_tk_widget().pack(expand=tk.YES, fill=tk.BOTH)
toolbar.update()
return fig | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createWidget(self):\n figure = Figure(figsize=(4,2), dpi=100)\n \"\"\"Figure size is measured in inches.\"\"\"\n graph = figure.add_subplot(111)\n \"\"\"The default subplot, which creates one row, one column, with index one.\"\"\"\n graph.plot(self.wave_table[0], self.wave_ta... | [
"0.6434021",
"0.6354336",
"0.6290193",
"0.6223832",
"0.62126684",
"0.60837847",
"0.60644627",
"0.6044969",
"0.60278356",
"0.598321",
"0.59531015",
"0.59531015",
"0.5886708",
"0.5838247",
"0.5838247",
"0.5838247",
"0.5822294",
"0.58217853",
"0.57900804",
"0.57653874",
"0.57375... | 0.6727419 | 0 |
Yields a generator of features for aligned sequences. | def get_alignment(sequenceA, sequenceB, featuresA, featuresB):
alignment = max(pairwise2.align.globalxx(sequenceA, sequenceB), key=operator.itemgetter(1))
alignedA, alignedB, _, __, ___ = alignment
featuresA = iter(featuresA)
featuresB = iter(featuresB)
for x,y in zip(alignedA, alignedB):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_features(self) -> Generator[np.ndarray, None, None]:\n for text in self.texts:\n yield embed(text)",
"def __iter__(self):\n for feature in self.features:\n yield feature",
"def generator(features, labels, batch_size):\n \n # Create empty arrays to contain batch... | [
"0.58422786",
"0.57766163",
"0.5733101",
"0.572696",
"0.56986547",
"0.5611865",
"0.55697197",
"0.5549772",
"0.55406874",
"0.5532181",
"0.55207205",
"0.5516716",
"0.5501799",
"0.5498407",
"0.5498093",
"0.5491017",
"0.54699457",
"0.5461517",
"0.54557294",
"0.543198",
"0.5413791... | 0.6744513 | 0 |
Joins feature_dict with the conservation features based on the sequence alignment. Features loaded are score, color, score confidence interval, color confidence interval and residue variety. | def join_conservation_data(sequence, features_dict, conservation_file):
with open(conservation_file, 'r') as ifile:
lines = [x.rstrip('\n') for x in ifile.readlines()]
lines = [x.split('\t') for x in lines]
lines = [x for x in lines if len(x) == 14]
features = features_dict.keys()
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _series_merging_map(self, map_list, feature_option=\"sift\"):\n print(\" --- Start ---\")\n # Transform state into 3 specified values\n for i in range(len(map_list)):\n map_list[i] = cv2.cvtColor(map_list[i], cv2.COLOR_RGB2GRAY)\n map_list[i] = MF._transform_state(map... | [
"0.5636555",
"0.5480253",
"0.5412035",
"0.5236842",
"0.5235385",
"0.52171755",
"0.51624644",
"0.5105716",
"0.5102434",
"0.50964284",
"0.5079223",
"0.50492746",
"0.50246644",
"0.50122684",
"0.5011619",
"0.50078404",
"0.50054425",
"0.4992147",
"0.49865118",
"0.49690413",
"0.496... | 0.7717556 | 0 |
Create two Species and check that Ecosystem is correctly updated. | def test_speciesCreation():
sys = LVsystem.Ecosystem()
sys.addSpecies('rabbit')
sys.addSpecies('fox')
sys.setInteraction('rabbit', 'fox', -1)
sys.setInteraction('fox', 'rabbit', 1)
sys.setInitialCond('rabbit', 10)
sys.setInitialCond('fox', 5)
sys.setGrowthRate('rabbit', 1)
sys.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testMakeNewSpecies(self):\n\n # adding 3 unique species:\n cerm = CoreEdgeReactionModel()\n\n spcs = [Species().fromSMILES('[OH]'), \n Species().fromSMILES('CC'),\n Species().fromSMILES('[CH3]')]\n\n for spc in spcs:\n cerm.makeNewSpecies(spc... | [
"0.68667287",
"0.656023",
"0.61642134",
"0.60768485",
"0.6068856",
"0.6068856",
"0.59459317",
"0.5942943",
"0.58677506",
"0.5831742",
"0.58130676",
"0.5796804",
"0.5780882",
"0.57244974",
"0.5724118",
"0.5683249",
"0.56828576",
"0.56735647",
"0.5658161",
"0.5650394",
"0.55924... | 0.68553 | 1 |
Create and destroy two species and check that at every step the Ecosystem is correctly updated. | def test_speciesDestruction():
sys = LVsystem.Ecosystem()
sys.addSpecies('rabbit')
sys.addSpecies('fox')
sys.addSpecies('wolf')
sys.removeSpecies('fox')
assert len(sys.species_list) == 2
assert not ('fox' in sys.species_list)
for key in sys.intMatrix:
assert not ('fox' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_speciesCreation():\n \n sys = LVsystem.Ecosystem()\n sys.addSpecies('rabbit')\n sys.addSpecies('fox')\n sys.setInteraction('rabbit', 'fox', -1)\n sys.setInteraction('fox', 'rabbit', 1)\n sys.setInitialCond('rabbit', 10)\n sys.setInitialCond('fox', 5)\n sys.setGrowthRate('rabbit... | [
"0.7024433",
"0.6819262",
"0.65983313",
"0.5896822",
"0.5891256",
"0.58759683",
"0.580056",
"0.5736429",
"0.55829257",
"0.5575694",
"0.55605096",
"0.55312914",
"0.5522494",
"0.55098146",
"0.5448845",
"0.5448845",
"0.5442072",
"0.5338611",
"0.53373635",
"0.53349733",
"0.533401... | 0.7159826 | 0 |
Tests if the method createData of the class Ecosystem returns correctly the data stored. | def test_createData():
sys = LVsystem.Ecosystem()
sys.addSpecies('rabbit')
sys.setInteraction('rabbit', 'hen', 0)
sys.setInteraction('rabbit', 'fox', -1)
sys.setInitialCond('rabbit', 30)
sys.setGrowthRate('rabbit', 0.09)
sys.setCarrCap('rabbit', 10000)
sys.setChangeRate('rabbit', 400)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_device_data(self):\n pass",
"def test_creation(self):\n self.assertEqual(self.book_data, self.reader._books)\n self.assertEqual(1, self.reader._location)\n self.assertEqual([0, 0, 0, 0, 0, 0], self.reader._timing)",
"def create(self, data):\n raise NotImplemen... | [
"0.64928454",
"0.6455364",
"0.6255506",
"0.62456274",
"0.6178591",
"0.6177842",
"0.6141926",
"0.61172384",
"0.6074773",
"0.60663724",
"0.60520685",
"0.6051333",
"0.6007553",
"0.6000438",
"0.598897",
"0.5983702",
"0.59824914",
"0.5970858",
"0.59612536",
"0.59584916",
"0.595611... | 0.65844554 | 0 |
Annotation used to log the HTTP headers of a request. Used for debugging. Headers will be logged as info. | def log_headers(f):
def wrapper(fself, *arguments, **keywords):
import logging
for header_key, header_value in fself.request.headers.items():
logging.info(header_key + ": " + header_value)
# Call the underlying function with the parameter added
return f(fself, *argument... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_headers():\n logger.info(request.headers)\n for h in request.headers:\n logger.info(f\"{h[0]}: {h[1]}\")\n return jsonify({k:v for k, v in request.headers.items()})",
"def requestheaders(self, flow: mitmproxy.http.HTTPFlow):\n pass",
"def requestheaders(self, flow: mitmproxy.htt... | [
"0.7068124",
"0.6656864",
"0.6656864",
"0.6536316",
"0.6233839",
"0.6233012",
"0.6124116",
"0.6074504",
"0.6061556",
"0.60301226",
"0.6003825",
"0.5963785",
"0.5946163",
"0.5938001",
"0.5906835",
"0.5905984",
"0.590182",
"0.589646",
"0.5873743",
"0.5865336",
"0.58603334",
"... | 0.7275658 | 0 |
Decorator that allows an endpoint to use pytracts messages for the request and response. | def endpoint(_wrapped_function=None, lenient=False, **kwargs):
if len(kwargs) > 1:
raise IndexError("Cannot have more than one mapping for request body")
if len(kwargs) == 1:
body_param_name = list(kwargs.keys())[0]
body_param_type = list(kwargs.values())[0]
if not isinstance(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monorail_api_method(\n request_message, response_message, **kwargs):\n time_fn = kwargs.pop('time_fn', time.time)\n method_name = kwargs.get('name', '')\n method_path = kwargs.get('path', '')\n http_method = kwargs.get('http_method', '')\n def new_decorator(func):\n @endpoints.method(request_message... | [
"0.6401912",
"0.60603726",
"0.59293485",
"0.58852273",
"0.586914",
"0.58472216",
"0.5837364",
"0.58304596",
"0.57779384",
"0.57330793",
"0.5651764",
"0.5620239",
"0.56154704",
"0.56032073",
"0.5593258",
"0.5593258",
"0.55751294",
"0.5568334",
"0.55397886",
"0.55388176",
"0.55... | 0.64499915 | 0 |
given the argument PATTERN from the argument parser, this function decides if it's a single pattern or a file. If it's a file, each line is a search pattern. | def extract_pattern(self, patterns):
# if we have more patterns or
# a single one which is not a file:
if len(patterns) > 1 or (
len(patterns) == 1 and not os.path.isfile(patterns[0])):
return patterns
else:
pattern = patterns[0]
pat_list ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findFile(PATH, PATTERN):\n\t#### find all the file located in the PATH corresponding to the PATTERN\n\tfindPattern = subprocess.Popen('find {path} -name \"{pattern}\" 2> /dev/null'.format(path=PATH, pattern=PATTERN), shell=True, stdout=subprocess.PIPE);\n\t#### String containing all the path toward the file's ... | [
"0.6204803",
"0.60617113",
"0.5994919",
"0.57386744",
"0.56577635",
"0.5650249",
"0.5618319",
"0.5582942",
"0.5576439",
"0.5539853",
"0.55385",
"0.5527214",
"0.5495445",
"0.549276",
"0.54618526",
"0.54250616",
"0.54236466",
"0.54076785",
"0.5393178",
"0.53860563",
"0.53833365... | 0.6360427 | 0 |
remove the empty string from the patterns if no patterns are left, stops the programme and warns the user. No need to validate the TEXT parameter as an empty string cannot contain any other pattern | def validate_data(self):
for pattern in self.patterns:
if pattern == "":
self.patterns.remove("")
if not self.patterns:
print("WARNING! Missing pattern or empty string!")
sys.exit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_mask_when_empty(self, text):\n if text in ['()-', '.-', '..-']:\n return ''\n else:\n return text",
"def clean_text(self, text) -> Union[str, None]:\n if text and ''.join(text.split()):\n if type(text) == bytes: #Decoding byte strings\n ... | [
"0.6168507",
"0.5996358",
"0.59933984",
"0.5874263",
"0.5803689",
"0.57598734",
"0.57212836",
"0.5720643",
"0.56914717",
"0.5681065",
"0.5645377",
"0.56068885",
"0.5581656",
"0.5568604",
"0.55501294",
"0.55471134",
"0.5540058",
"0.55348915",
"0.55294496",
"0.54810286",
"0.547... | 0.69046766 | 0 |
This functions prints (or saves in JSON) the output from the matcher based on some parameters (es. self.recursive, type of input). It prints additional informations such as the TEXT string or the name of the file and the calls the function self.results to format the rest of the output. | def output(self, argument):
if not self.json:
if not self.first_print:
print()
self.first_print = False
if isinstance(argument, tuple):
filepath, filename = argument
if not self.json:
# if -r, print the path AND the name of t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print(self, failed_tests=True, passed_tests=True, json_format=False):\n # TODO: Do we need the json option?\n if json_format:\n passed = self.passed\n if (passed and passed_tests) or (not passed and failed_tests):\n print(json.dumps(self, indent=4, cls=MyEncod... | [
"0.6003957",
"0.5898108",
"0.56751025",
"0.56545293",
"0.5604814",
"0.5568598",
"0.55671835",
"0.5561098",
"0.5531501",
"0.55153",
"0.5513097",
"0.54923934",
"0.5433857",
"0.5425692",
"0.54195386",
"0.539011",
"0.53654116",
"0.53612506",
"0.5351342",
"0.53480667",
"0.5315203"... | 0.68714005 | 0 |
Verify that volumes pagination works right and back. | def test_volumes_pagination(self, volumes_steps, create_volumes,
update_settings):
volume_names = list(generate_ids('volume', count=3))
create_volumes(volume_names)
update_settings(items_per_page=1)
tab_volumes = volumes_steps.tab_volumes()
tab_v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pagination(self):\n self.check_pagination()",
"def test03_vms_page_table_paging_buttons(self):\n self.lg('%s STARTED' % self._testID)\n self.lg('try paging from start/previous/next/last and verify it should succeed')\n self.assertTrue(self.Tables.check_next_previous_buttons('... | [
"0.69831944",
"0.62766",
"0.6245892",
"0.62054735",
"0.61570704",
"0.61375374",
"0.60276866",
"0.60012406",
"0.5986151",
"0.59639984",
"0.5956867",
"0.5899587",
"0.58527124",
"0.58507735",
"0.5844528",
"0.5832102",
"0.5763427",
"0.5760909",
"0.57395583",
"0.5714855",
"0.57108... | 0.7495992 | 0 |
Verify that user can view volume info. | def test_view_volume(self, volume, volumes_steps):
volumes_steps.view_volume(volume.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_volume_access_right_exists( user_email, volume_name, caps, allowed_gateways=[msconfig.GATEWAY_TYPE_UG] ):\n client = connect_syndicate()\n return syndicate_provisioning.ensure_volume_access_right_exists( client, user_email, volume_name, caps, allowed_gateways )",
"def can_view(self, user):\r\n ... | [
"0.65072924",
"0.6313191",
"0.5997504",
"0.5938842",
"0.58930606",
"0.5835009",
"0.58183914",
"0.57365507",
"0.57155776",
"0.56943774",
"0.5685391",
"0.567308",
"0.56155986",
"0.56130064",
"0.560022",
"0.55933326",
"0.5576085",
"0.55385345",
"0.55349183",
"0.54941154",
"0.546... | 0.6700226 | 0 |
Verify that user can change volume type. | def test_change_volume_type(self, create_volume, volumes_steps):
volume_name = generate_ids('volume').next()
create_volume(volume_name, volume_type=None)
volumes_steps.change_volume_type(volume_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_retype_setup_fail_volume_is_available(self, mock_notify):\n elevated = context.get_admin_context()\n project_id = self.context.project_id\n\n db.volume_type_create(elevated, {'name': 'old', 'extra_specs': {}})\n old_vol_type = db.volume_type_get_by_name(elevated, 'old')\n ... | [
"0.6560247",
"0.6318833",
"0.6275313",
"0.62473804",
"0.6031198",
"0.57690156",
"0.57422614",
"0.569965",
"0.5690666",
"0.56450164",
"0.5626222",
"0.5607844",
"0.5580567",
"0.5580567",
"0.5580567",
"0.5536625",
"0.5524085",
"0.5510654",
"0.5504379",
"0.5485735",
"0.5483211",
... | 0.7038201 | 0 |
Verify that user can upload volume to image. | def test_upload_volume_to_image(self, volume, images_steps, volumes_steps):
image_name = next(generate_ids('image', length=20))
volumes_steps.upload_volume_to_image(volume.name, image_name)
images_steps.page_images().table_images.row(
name=image_name).wait_for_presence(30)
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_volume_access_right_exists( user_email, volume_name, caps, allowed_gateways=[msconfig.GATEWAY_TYPE_UG] ):\n client = connect_syndicate()\n return syndicate_provisioning.ensure_volume_access_right_exists( client, user_email, volume_name, caps, allowed_gateways )",
"def can_upload_data(self, verif... | [
"0.6100675",
"0.60439867",
"0.5963752",
"0.58335286",
"0.5831634",
"0.5797141",
"0.5795935",
"0.57759506",
"0.5682973",
"0.56629056",
"0.56443405",
"0.560292",
"0.56017274",
"0.5593478",
"0.5586045",
"0.5571096",
"0.55482906",
"0.54941136",
"0.54915893",
"0.5468858",
"0.54664... | 0.60787594 | 1 |
Verify that admin can launch volume as instance. | def test_launch_volume_as_instance(self, volume, instances_steps,
volumes_steps):
instance_name = next(generate_ids('instance'))
volumes_steps.launch_volume_as_instance(
volume.name, instance_name, network_name=INTERNAL_NETWORK_NAME)
instances_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_guest_os(self):\n self.check_guest_os()",
"def test_guest_os(self):\n self.check_guest_os()",
"def test_guest_os(self):\n self.check_guest_os()",
"def test_guest_os(self):\n self.check_guest_os()",
"def test_guest_os(self):\n self.check_guest_os()",
"def test_g... | [
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.62880164",
"0.6120075",
"0.6120075",
"0.6120075",
"0.6120075",
... | 0.693913 | 0 |
Verify that admin can change volume status. | def test_change_volume_status(self, volume, volumes_steps):
volumes_steps.change_volume_status(volume.name, 'Error')
volumes_steps.change_volume_status(volume.name, 'Available') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _status(self, expected_status_code):\n status = cinder_utils.get_volume_status(self._cinder, self.__volume)\n if not status:\n logger.warning(\n 'Cannot volume status for volume with ID - %s',\n self.__volume.id)\n return False\n\n if sta... | [
"0.633983",
"0.6286603",
"0.6239554",
"0.6180753",
"0.6155955",
"0.6117248",
"0.6067968",
"0.6067968",
"0.6054155",
"0.60433626",
"0.60228795",
"0.59958816",
"0.59942013",
"0.59775287",
"0.59159106",
"0.5823149",
"0.5788118",
"0.57730633",
"0.5766912",
"0.5748985",
"0.572745"... | 0.7535339 | 0 |
Verify that admin can manage volume attachments. | def test_manage_volume_attachments(self, volume, instance, volumes_steps):
volumes_steps.attach_instance(volume.name, instance.name)
volumes_steps.detach_instance(volume.name, instance.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_attachment_deletion_allowed_volume_no_attachments(self):\n volume = tests_utils.create_volume(self.context)\n self.volume_api.attachment_deletion_allowed(self.context, None, volume)",
"def test_attachment_deletion_allowed_attachment_from_volume(\n self, mock_get_server):\n ... | [
"0.6995282",
"0.65689677",
"0.63907975",
"0.62546706",
"0.6135261",
"0.6078998",
"0.60550547",
"0.5991479",
"0.59363604",
"0.5931643",
"0.5893291",
"0.5874586",
"0.5873932",
"0.58355445",
"0.5821134",
"0.5810227",
"0.5801993",
"0.5787049",
"0.57592803",
"0.5747946",
"0.572779... | 0.67760146 | 1 |
Verify that volume can be transfered between users. | def test_transfer_volume(self, volume, auth_steps, volumes_steps):
transfer_name = next(generate_ids('transfer'))
transfer_id, transfer_key = volumes_steps.create_transfer(
volume.name, transfer_name)
auth_steps.logout()
auth_steps.login(USER_NAME, USER_PASSWD)
volume... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_volume_access_right_exists( user_email, volume_name, caps, allowed_gateways=[msconfig.GATEWAY_TYPE_UG] ):\n client = connect_syndicate()\n return syndicate_provisioning.ensure_volume_access_right_exists( client, user_email, volume_name, caps, allowed_gateways )",
"def test_least_busy_host_gets_v... | [
"0.6001911",
"0.59510225",
"0.59452003",
"0.5890787",
"0.5814993",
"0.58066094",
"0.5777035",
"0.5719183",
"0.5708301",
"0.5675022",
"0.56528234",
"0.5611603",
"0.5581504",
"0.55581987",
"0.5523851",
"0.54841036",
"0.5479376",
"0.54642123",
"0.5446505",
"0.5428832",
"0.542142... | 0.69842476 | 0 |
Assigns networks to specified interface. | def assign_networks(cls, instance, networks):
instance.assigned_networks_list = networks
db().flush() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def network_interfaces(self, network_interfaces):\n\n self._network_interfaces = network_interfaces",
"def attach_interface_to_namespace(node, namespace, interface):\n cmd = f\"ip link set {interface} netns {namespace}\"\n\n ret_code, _, stderr = exec_cmd(node, cmd, timeout=5, sudo=True)\n ... | [
"0.7055572",
"0.689255",
"0.61575776",
"0.6092796",
"0.5999253",
"0.5881435",
"0.58456975",
"0.58353883",
"0.58285594",
"0.582017",
"0.5815144",
"0.5740349",
"0.5718538",
"0.5695416",
"0.56693494",
"0.56601954",
"0.56459874",
"0.5645395",
"0.5645298",
"0.5542378",
"0.5535832"... | 0.71166056 | 0 |
Checks availability of DPDK for given interface. DPDK availability of the interface depends on presence of DPDK drivers and libraries for particular NIC. It may vary for different OpenStack releases. So, dpdk_drivers vary for different releases and it can be not empty only for node that is assigned to cluster currently... | def dpdk_available(cls, instance, dpdk_drivers):
return (cls.get_dpdk_driver(instance, dpdk_drivers) is not None and
instance.node.cluster.network_config.segmentation_type ==
consts.NEUTRON_SEGMENT_TYPES.vlan) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_enable_dpdk(self):\n logging.info('Pre-flight check')\n self._dpdk_pre_post_flight_check()\n self._ovs_br_ex_port_is_system_interface()\n\n self.enable_hugepages_vfio_on_hvs_in_vms(4)\n with self.config_change(\n {\n 'enable-dpdk': False... | [
"0.6499057",
"0.6261596",
"0.58940613",
"0.588549",
"0.5753477",
"0.56981313",
"0.5615253",
"0.5498032",
"0.54936856",
"0.53996813",
"0.5281756",
"0.5256299",
"0.5163212",
"0.5129217",
"0.5039332",
"0.497954",
"0.49176756",
"0.48825467",
"0.48662212",
"0.48462084",
"0.4842149... | 0.653007 | 0 |
Update information about offloading modes for the interface. | def update_offloading_modes(cls, instance, new_modes, keep_states=False):
def set_old_states(modes):
"""Set old state for offloading modes
:param modes: List of offloading modes
"""
for mode in modes:
if mode['name'] in old_modes_states:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self) -> None:\n active = None\n if self.type == \"on_off\":\n self._data = self._tm_client.api.data\n if self._data:\n active = self._data.active_torrent_count > 0\n\n elif self.type == \"turtle_mode\":\n active = self._tm_client.api.... | [
"0.53883725",
"0.5323775",
"0.52740496",
"0.5260813",
"0.52405226",
"0.5239493",
"0.52206844",
"0.51972073",
"0.5171975",
"0.516889",
"0.51636213",
"0.5140995",
"0.51388824",
"0.51300997",
"0.5129447",
"0.51022875",
"0.5071882",
"0.5071376",
"0.5067457",
"0.50577545",
"0.5016... | 0.68992096 | 0 |
Query networks to interfaces mapping on all nodes in cluster. Returns combined results for NICs and bonds for every node. Names are returned for node and interface (NIC or bond), IDs are returned for networks. Results are sorted by node name then interface name. | def get_networks_to_interfaces_mapping_on_all_nodes(cls, cluster):
nodes_nics_networks = db().query(
models.Node.hostname,
models.NodeNICInterface.name,
models.NetworkGroup.id,
).join(
models.Node.nic_interfaces,
models.NodeNICInterface.assigne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enumerate_network(arg):\n\n network = ip_network(arg, strict=False)\n data = list(map(str, network.hosts()))\n data.insert(0, str(network.network_address))\n if network.prefixlen != network.max_prefixlen:\n data.append(str(network.broadcast_address))\n return data",
"def _compile_networ... | [
"0.6063",
"0.5890889",
"0.57809484",
"0.5535784",
"0.5527903",
"0.5459575",
"0.5419172",
"0.5402386",
"0.5387223",
"0.5363235",
"0.53565717",
"0.5336501",
"0.53361285",
"0.5334019",
"0.52824455",
"0.5259729",
"0.52580357",
"0.5255129",
"0.52336955",
"0.520638",
"0.52045494",
... | 0.78624934 | 0 |
Get interface with specified network assigned to it. This method first checks for a NodeNICInterface with the specified network assigned. If that fails it will look for a NodeBondInterface with that network assigned. | def get_interface_by_net_name(cls, node_id, netname):
iface = db().query(models.NodeNICInterface).join(
(models.NetworkGroup,
models.NodeNICInterface.assigned_networks_list)
).filter(
models.NetworkGroup.name == netname
).filter(
models.NodeNICInt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_interface(\n network: Union[ipaddress.IPv6Interface, ipaddress.IPv4Interface, str], index: int\n) -> Union[ipaddress.IPv6Interface, ipaddress.IPv4Interface]:\n if isinstance(network, str):\n network = ipaddress.ip_network(network)\n\n host = network[index]\n return ipaddress.ip_interface... | [
"0.6707713",
"0.6606925",
"0.61241245",
"0.60492706",
"0.5958547",
"0.5794652",
"0.55923915",
"0.5566157",
"0.5558983",
"0.55508775",
"0.5550377",
"0.54599",
"0.54525834",
"0.5438885",
"0.5434333",
"0.53795886",
"0.5368822",
"0.5366266",
"0.53524244",
"0.5328939",
"0.5320066"... | 0.7778597 | 0 |
Find all interfaces with MAC address not in mac_addresses. | def get_interfaces_not_in_mac_list(cls, node_id, mac_addresses):
return db().query(models.NodeNICInterface).filter(
models.NodeNICInterface.node_id == node_id
).filter(
not_(models.NodeNICInterface.mac.in_(mac_addresses))
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def possible_mac_addresses(interface):\n\n mac_addrs = []\n\n # In case of VLANs, just grab the parent interface\n if interface.interface_type == 'vlan':\n interface = interface.parent\n\n # Bonding/bridge: append the MACs of the physical interfaces\n # TODO: drop the public/bootable check on... | [
"0.61820143",
"0.60239303",
"0.5998274",
"0.5552142",
"0.54893565",
"0.53755784",
"0.534444",
"0.5340872",
"0.5331961",
"0.5222017",
"0.5130869",
"0.51166475",
"0.50925165",
"0.5075239",
"0.50387186",
"0.5014326",
"0.49901056",
"0.49875855",
"0.49597886",
"0.49526137",
"0.493... | 0.8007386 | 0 |
Takes a hypothesis (string) and a list of rules (list of IF objects), returning an AND/OR tree representing the backchain of possible statements we may need to test to determine if this hypothesis is reachable or not. This method should return an AND/OR tree, that is, an AND or OR object, whose constituents are the sub... | def backchain_to_goal_tree(rules, hypothesis):
goal_tree = []
for rule in rules:
var = match(rule.consequent(),hypothesis)
if var:
sub_hypothesis = populate(rule.antecedent(), var)
if isinstance(rule.antecedent(), OR):
sub_tree = [backchain_to_goal_tree(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree_build(sv, piece):\r\n if piece==None: return None \r\n # process various string expressions (or triplets without args for conditions and values)\r\n piece=piece[0].strip(Space) if type(piece)==tuple else piece.strip(Space) # convert to string \r... | [
"0.57285845",
"0.56554633",
"0.56072646",
"0.55281454",
"0.54787534",
"0.54459876",
"0.543675",
"0.5399575",
"0.53608644",
"0.53082603",
"0.524149",
"0.5240573",
"0.519464",
"0.5154944",
"0.5149902",
"0.5137273",
"0.5120655",
"0.511196",
"0.5110548",
"0.51060253",
"0.50971836... | 0.78787416 | 0 |
Adds calibration point fields to the import window. | def add_calibration_entry(self):
self.calibration_points=True
self.begin_ind_calibration = tkinter.Label(self.rightmostframe, text='Calibration Point 1 Row', bg='white')
self.begin_ind_calibration.pack(pady=4)
self.begin_ind_calibration_entry = tkinter.Entry(self.rightmostframe)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addpoints(self):\n x=float(self.x1ValueLabel.text()) \n w=float(self.w1ValueEdit.text())\n #x=[1904.5, 1687.22, 3124.3499999999999, 632.57000000000005]\n #w=[4671.2259999999997, 4624.2757000000001, 4916.5100000000002, 4383.9092000000001]\n self.arcdisplay.addpoints(x, w)",
"def ... | [
"0.5901763",
"0.5490056",
"0.54606605",
"0.53818756",
"0.5338017",
"0.52542025",
"0.52198553",
"0.52113515",
"0.51915157",
"0.5189108",
"0.5149515",
"0.50918996",
"0.50601363",
"0.5030394",
"0.5027425",
"0.49972564",
"0.49930912",
"0.49795052",
"0.4955607",
"0.49454013",
"0.4... | 0.64659566 | 0 |
Adds filter field to import window. Allows user to specify another column in the data to filter the data by. | def add_filter_entry(self, filter_column=None, filter_entry=None):
new_filter_label = tkinter.Label(self.rightmostframe, text='Custom Column Filter:')
new_filter_label.pack(pady=4)
my_str = tkinter.StringVar()
new_filter_columns = tkinter.OptionMenu(self.rightmostframe, my_str, *self.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_data_filter_options(data_url, column_filter, authorization_token):\n # filter_url = data_url\n headers = {'content-type': 'application/json',\n 'Authorization': authorization_token}\n response = requests.get(data_url, headers=headers, verify=False)\n get_json = json.loads(respo... | [
"0.61835283",
"0.576259",
"0.57332873",
"0.57192385",
"0.5686915",
"0.5638789",
"0.55743355",
"0.55560887",
"0.55493474",
"0.5512042",
"0.55096805",
"0.5441423",
"0.54244393",
"0.54233164",
"0.54224974",
"0.5414842",
"0.5397378",
"0.5363333",
"0.5350326",
"0.5346639",
"0.5346... | 0.662433 | 0 |
Retrieves values from filter fields and creates entries in a filter dict | def get_filters(self, saving):
self.filter_entry_dict.clear()
for entry, var in self.filter_entries_list:
if (entry.get() != "") and (var.get() != "") and (not saving):
self.filter_entry_dict[var.get()] = entry.get()
elif saving and var.get() != "":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fieldToFilter(fields):\n if len(fields) == 0:\n return dict()\n return dict(\n pdir_keywords=dict(\n query=[\"%s:%s\" % (k, v) for (k, v) in fields.items()],\n operator=\"and\",\n )\n )",
"def filter(self, filter_dict):\n pass",
"def filters(self):... | [
"0.68263674",
"0.6572805",
"0.64243484",
"0.6419161",
"0.63560766",
"0.6310068",
"0.62887585",
"0.62512815",
"0.6176382",
"0.617537",
"0.6146272",
"0.61409056",
"0.61252195",
"0.6115444",
"0.6105876",
"0.60870826",
"0.607684",
"0.6060113",
"0.60489786",
"0.6046886",
"0.603471... | 0.65957147 | 1 |
Opens up save window to save the current import | def save_import(self, out_dict):
self.attributes('-topmost', 'false')
options = self.create_options(saving=True)
options['spreadsheet_path'] = self.spreadsheet_path
self.wait_window(SavePage(self, options))
self.attributes('-topmost', 'true') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openSave(self):\n save_dir = QFileDialog.getExistingDirectory(\n self, \"Select a folder\", self.user[\"Save\"], QFileDialog.ShowDirsOnly\n )\n if save_dir != \"\":\n self.user[\"Save\"] = save_dir\n name_split = self.splitPath(save_dir)[-1]\n na... | [
"0.7050034",
"0.68424726",
"0.6820891",
"0.6648275",
"0.66444814",
"0.6643438",
"0.66269696",
"0.6616628",
"0.6616628",
"0.6616628",
"0.6616628",
"0.65899795",
"0.65818965",
"0.65569484",
"0.6535644",
"0.652975",
"0.65023637",
"0.64961636",
"0.64725995",
"0.64671546",
"0.6463... | 0.68973863 | 1 |
Handles saving of the import with the specified name Includes error checking for invalid characters, empty name, and file already existing | def save(self, file_name):
invalid_characters = ['#','%','&','{','}','\\','<','>','*','?','/','^','$','!','\'','\"',':','@','+',"`",'|','=','~']
if len(file_name) == 0:
message = "The import name cannot be empty"
SaveError(self, message)
elif any(invalid_char in file_name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_valid_file_name(self):\n Base.save_to_file([self.r0, self.s1])\n self.assertTrue(path.exists('Base.json'))",
"def handle_file_name(self):\r\n self.tmp_name = (os.path.basename(self.source_file_name)).split('.')[0]\r\n result_name = self.tmp_name + '_result_'\r\n log_na... | [
"0.63546175",
"0.61734945",
"0.61724585",
"0.6132157",
"0.5944297",
"0.5903181",
"0.58933043",
"0.5844493",
"0.57878095",
"0.57557",
"0.57276547",
"0.5724395",
"0.5696154",
"0.56941295",
"0.56651986",
"0.5626924",
"0.56145585",
"0.5611102",
"0.559869",
"0.55925167",
"0.558078... | 0.8128952 | 0 |
Set or show the User Role. Members with this role can create polls and manage their own polls. | async def userrole(self, ctx, *, role=None):
server = ctx.message.guild
if not role:
result = await self.bot.db.config.find_one({'_id': str(server.id)})
if result and result.get('user_role'):
await ctx.send(f'The user role restricts which users are able to create... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUserRole(self):\n\n # general question concerning the user's role (hersteller, beauftragter...)\n self.roleView.getUserRole()",
"def __setRole(self, session):\r\n self.__role = session.role\r\n if self._config.has_key('purpose'):\r\n co_role = ccm.get_role_for_purpos... | [
"0.71884406",
"0.6784374",
"0.676158",
"0.66587776",
"0.66587776",
"0.66521305",
"0.64882016",
"0.6451127",
"0.64366496",
"0.64330333",
"0.633826",
"0.633826",
"0.6334347",
"0.6305694",
"0.6305694",
"0.6305694",
"0.62603354",
"0.62150025",
"0.62140286",
"0.6164558",
"0.602059... | 0.7142816 | 1 |
Fuse this track estimates with the current estimates from argument track. | def fuse_estimates(self, tracks):
# compile states and covariances
mu = []
sigma = []
s, t = self.state_estimator.state(get_fused=False)
p = self.state_estimator.P
mu.append(s[0])
sigma.append(p[-1])
for track in tracks:
s, t = track.state_est... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate(self, estimate):\n\n self._estimate = estimate",
"def assign_estimate(self, estimate):\n return self.update(estimate=estimate)",
"def update(self, kf, detection):\n self.mean, self.covariance = kf.update(\n self.mean, self.covariance, detection.to_xyah())\n s... | [
"0.5544471",
"0.52727795",
"0.5136149",
"0.50760716",
"0.50091",
"0.49874175",
"0.49845898",
"0.4978564",
"0.49625763",
"0.49504185",
"0.49458835",
"0.49335563",
"0.49335563",
"0.49217388",
"0.49156517",
"0.49156517",
"0.49156517",
"0.49147886",
"0.4909424",
"0.4891846",
"0.4... | 0.6842899 | 0 |
Pass a new message onto the state estimator and update state of the Track to reflect this. | def store(self, new_msg, track_list):
self.state_estimator.store(new_msg, ts.TimeStamp(new_msg['h'], new_msg['m'], new_msg['s']))
self.received_measurement = True
self.n_consecutive_measurements += 1
self.n_consecutive_missed = 0
self.lane = new_msg['lane']
if se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setstate__(self, message):\n self._message = message",
"def handle_msg(self, state_id, msg):\n pass",
"def _state_message_received(self, msg: ReceiveMessage) -> None:\n try:\n self._state = int(msg.payload)\n self.async_write_ha_state()\n except ValueErro... | [
"0.69827133",
"0.65274626",
"0.6313561",
"0.6236883",
"0.62238866",
"0.6210473",
"0.6189199",
"0.6182856",
"0.61365014",
"0.6115923",
"0.61149055",
"0.60821867",
"0.60749793",
"0.60749793",
"0.605385",
"0.60528314",
"0.6038874",
"0.603857",
"0.603857",
"0.603857",
"0.603857",... | 0.6710784 | 1 |
Write the labels of a 2D grid to file | def write_grid2d(grid_file, grid2d):
with grid_file.open('w') as f:
for row in grid2d['label']:
f.write('\t'.join(row) + '\n') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_labels():\n with open('../data/labels.txt', 'w') as labels_file:\n labels = generate_labels()\n labels_file.write('\\n'.join(labels))",
"def save_GRID( self , filename ):\n self._fwrite_GRID( filename )",
"def write_grid(self, file_path, fmt='%0.16g'):\n with open(file_pat... | [
"0.71003115",
"0.6925979",
"0.6832347",
"0.67913246",
"0.66992986",
"0.65994614",
"0.6515918",
"0.6390906",
"0.63335294",
"0.63307697",
"0.62936795",
"0.61924064",
"0.61924064",
"0.6182035",
"0.61560845",
"0.6152925",
"0.61473215",
"0.6145884",
"0.6100551",
"0.60703844",
"0.6... | 0.8044423 | 0 |
Read the labels of a 2D grid to file | def read_grid2d(grid_file):
labels = []
with grid_file.open('r') as f:
for row in f.readlines():
labels.append([x.strip() for x in row.split('\t')])
labels = array(labels)
grid2d = make_grid(labels.shape[0], labels.shape[1])
grid2d['label'] = labels
return grid2d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_grid2d(grid_file, grid2d):\n with grid_file.open('w') as f:\n for row in grid2d['label']:\n f.write('\\t'.join(row) + '\\n')",
"def load_label(self, idx):\n im = open('{}/GTTXT/{}.txt'.format(root_dir, idx))\n\t#print(type(im.readlines()[0].rstrip(\"\\n\")))\n rgb_lab... | [
"0.72920907",
"0.64701855",
"0.6386603",
"0.6208433",
"0.6121841",
"0.6070264",
"0.6020945",
"0.6020452",
"0.5981528",
"0.5965864",
"0.5960582",
"0.5960582",
"0.59508276",
"0.5949805",
"0.5941208",
"0.59156436",
"0.5911893",
"0.589569",
"0.5853387",
"0.58449346",
"0.58364975"... | 0.75627935 | 0 |
Write the values of ECoG analysis to file | def write_ecog2d(ecog_file, ecog2d):
savetxt(ecog_file, ecog2d['value'], fmt='%.8f', delimiter='\t') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveenergyfile(path, meta, data):\n def serializemeta(meta):\n \"\"\"Convert metadata object to list of comment strings\"\"\"\n return [u\"#CTE_%s: %s\" % (key, meta[key]) for key in meta]\n\n with io.open(path, 'w+') as ff:\n ff.write(u\"\\n\".join(serializemeta(meta)))\n ff.... | [
"0.6469135",
"0.64325714",
"0.63181114",
"0.62568504",
"0.6206715",
"0.6175021",
"0.6094979",
"0.6085525",
"0.6083914",
"0.60705334",
"0.6051837",
"0.6035098",
"0.60194105",
"0.59780884",
"0.5972372",
"0.59563106",
"0.59435415",
"0.59313726",
"0.5927502",
"0.59157795",
"0.590... | 0.64328045 | 1 |
Write electrode position to tsv | def write_tsv(labels, positions, elec_file):
labels = labels.reshape(-1, order='F')
positions = positions.reshape(-1, 3, order='F')
elec_file = elec_file.with_suffix('.tsv')
with elec_file.open('w') as f:
f.write('name\tx\ty\tz\n')
for i in range(labels.shape[0]):
f.write(f'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_towhee_coord(self, filename):\n with open(filename, 'w') as f:\n df = self.contents[['X', 'Y', 'Z']].copy()\n np.savetxt(f, df.values, fmt=\" %20.15f\"*3)",
"def write_tsv(self, filename):\n f = open(filename,'wb')\n wr = csv.writer(f,delimiter='\\t',quoting=csv.QUOT... | [
"0.63908005",
"0.6292356",
"0.6181932",
"0.6171404",
"0.6037974",
"0.5988555",
"0.5952182",
"0.5941722",
"0.5917379",
"0.59172416",
"0.58794904",
"0.5877961",
"0.5865538",
"0.58002007",
"0.57907534",
"0.57813555",
"0.5768386",
"0.5759972",
"0.5754379",
"0.57495767",
"0.571484... | 0.7126136 | 0 |
Export tkRAS transformation to a transform file. | def export_transform(offset, transform_file, format='slicer'):
assert format == 'slicer'
transform_file = Path(transform_file)
transform_file = transform_file.with_suffix('.tfm')
# use ITK convertion ("ITK's convention is to use LPS coordinate system as opposed to RAS coordinate system in Slicer")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filemenu_Export(self):\n line_dict = {}\n for line in self.lines.values():\n for name, arr in line.to_mat().items():\n line_dict[name] = arr\n fileTypes = [(\"MATLAB file\",\"*.mat\"), (\"NumPy file\",\"*.npz\")]\n options = {}\n options['initialdir'... | [
"0.5916673",
"0.57419854",
"0.554426",
"0.543195",
"0.53800714",
"0.5367973",
"0.5343087",
"0.5321925",
"0.5260684",
"0.5219404",
"0.516955",
"0.51652265",
"0.51367575",
"0.5104578",
"0.50920767",
"0.5079807",
"0.50521576",
"0.50394034",
"0.50246775",
"0.5019167",
"0.50150526... | 0.60936 | 0 |
Read 3D volume. You can also apply threshold to the data | def read_volume(volume_file, threshold=-Inf):
volume = nload(str(volume_file))
data = volume.get_fdata()
if threshold is not None:
i = data >= threshold
else:
i = abs(data) > 0.001 # exclude small values
output = zeros(i.sum(), dtype=DTYPE_VOLUME)
output['pos'] = apply_affine(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_volume_3d(self):\n # generate voronoi mesh \n mesh = Mesh3d(self.particles, self.bound)\n print(\"building mesh...\")\n mesh.build_geometry()\n print(\"mesh complete\")\n\n # calculate voronoi volumes of all real particles \n real_indices = self.particles[\... | [
"0.65125376",
"0.65035737",
"0.6461333",
"0.6362523",
"0.6296995",
"0.61123705",
"0.6080686",
"0.60625637",
"0.6014546",
"0.59458286",
"0.5902094",
"0.5897134",
"0.5870413",
"0.5815913",
"0.57933134",
"0.57682717",
"0.5767813",
"0.5749741",
"0.5746253",
"0.57217675",
"0.57074... | 0.681766 | 0 |
Executes openio CLI command. | def openio(cls, cmd, coverage="--coverage ", **kwargs):
return execute("openio " + coverage + cmd, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openio_admin(cls, cmd, coverage=\"--coverage \", **kwargs):\n return execute(\"openio-admin \" + coverage + cmd, **kwargs)",
"def execute(cmd) :\n return os.system( cmd )",
"def cli() -> None:",
"def cli() -> None:",
"def do_command(self, args):\n pass",
"def execute_cli(self, cmd, *... | [
"0.6797947",
"0.6201791",
"0.6181111",
"0.6181111",
"0.61580837",
"0.6095095",
"0.60691255",
"0.60500485",
"0.58856475",
"0.58728683",
"0.58718526",
"0.58718526",
"0.58718526",
"0.58718526",
"0.58718526",
"0.58718526",
"0.58718526",
"0.58718526",
"0.58718526",
"0.58718526",
"... | 0.7085731 | 0 |
Execute several commands in the same openio CLI process. | def openio_batch(cls, commands, coverage="--coverage", **kwargs):
script = "\n".join(commands)
try:
return execute("openio " + coverage, stdin=script, **kwargs)
except CommandFailed:
print("Stdin was:\n\n%s" % (script,))
raise | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openio_admin_batch(cls, commands, coverage=\"--coverage\", **kwargs):\n return execute(\"openio-admin \" + coverage, stdin=\"\\n\".join(commands), **kwargs)",
"def run_commands(commands, pii=False):\n for command in commands:\n run(command, pii=pii)",
"def run(self, commands: list[str]):\n ... | [
"0.7035743",
"0.67764515",
"0.67400265",
"0.66215736",
"0.64620274",
"0.64438605",
"0.6369911",
"0.63289934",
"0.6166716",
"0.6156091",
"0.61401606",
"0.61254555",
"0.60767615",
"0.60650593",
"0.6031006",
"0.60119826",
"0.5984301",
"0.59842825",
"0.5961239",
"0.5931458",
"0.5... | 0.6805472 | 1 |
Executes openioadmin CLI command. | def openio_admin(cls, cmd, coverage="--coverage ", **kwargs):
return execute("openio-admin " + coverage + cmd, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openio_admin_batch(cls, commands, coverage=\"--coverage\", **kwargs):\n return execute(\"openio-admin \" + coverage, stdin=\"\\n\".join(commands), **kwargs)",
"async def admin(ctx):\n if ctx.invoked_subcommand is None:\n await ctx.send(\"Invalid Command\")",
"def _oc_command(self, args):\n... | [
"0.6739558",
"0.6572091",
"0.62097144",
"0.6009581",
"0.5819513",
"0.5667608",
"0.56569225",
"0.5649356",
"0.5629662",
"0.5613385",
"0.5595961",
"0.55712277",
"0.55656326",
"0.55459076",
"0.5506487",
"0.5435759",
"0.53998935",
"0.53734577",
"0.5349197",
"0.5336373",
"0.531218... | 0.7582081 | 0 |
Execute several commands in the same openioadmin CLI process. | def openio_admin_batch(cls, commands, coverage="--coverage", **kwargs):
return execute("openio-admin " + coverage, stdin="\n".join(commands), **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_execute_multiple(self, ipaddr, username, password, commands):\n for cmd in commands:\n rc, output, error = self.node_execute_command(ipaddr, username, password, cmd)\n if rc is False:\n print(\"error running: [%s] %s\" % (ipaddr, cmd))",
"def run(self, command... | [
"0.65307754",
"0.64596766",
"0.6451439",
"0.642095",
"0.63148993",
"0.6174462",
"0.6088206",
"0.60869735",
"0.60494465",
"0.6002248",
"0.5898545",
"0.58760387",
"0.58524823",
"0.58524823",
"0.58524823",
"0.58524823",
"0.5837719",
"0.5812344",
"0.58026713",
"0.57729846",
"0.57... | 0.77418923 | 0 |
Get formatting options for OpenIO CLIs, to make them output the specified fields in the specified format. | def get_format_opts(cls, format_="value", fields=[]):
return " -f {0} {1}".format(format_, " ".join(["-c " + it for it in fields])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getopt_format(self):\n self._print_enum_opt(\"format\", FORMATTERS)",
"def fp_config_formatting(info):\n # From: OpenCL/AMDAPPSDK-3.0/include/CL/cl.h\n options = [((1 << 0), 'CL_FP_DENORM'),\n ((1 << 1), 'CL_FP_INF_NAN'),\n ((1 << 2), 'CL_FP_ROUND_TO_N... | [
"0.64548236",
"0.58642226",
"0.5668938",
"0.5616641",
"0.56150675",
"0.5609857",
"0.55871737",
"0.5584162",
"0.55806154",
"0.5536493",
"0.553237",
"0.55031854",
"0.54341996",
"0.53965104",
"0.5395915",
"0.53318113",
"0.52923864",
"0.5283675",
"0.5283675",
"0.52736145",
"0.526... | 0.7621838 | 0 |
Gets the horizon angles given a terrain profile. Derived from ITM hzns() routine as specified in R2SGN21. | def _GetHorizonAnglesLegacy(its_elev, height_cbsd, height_rx, refractivity):
num_points = int(its_elev[0])
step = its_elev[1]
dist = num_points * step
# Find the refractivity at the average terrain height
start_avg = int(3.0 + 0.1 * num_points)
end_avg = num_points - start_avg + 6
zsys = np.mean(its_elev... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def horiz_angle(time, data):\n\n # TODO What should 0deg be? Set it to inline w/ target? facing target?\n\n # direction of the sun. measured in degrees counted clockwise from north.\n azimuth = data[time]['azimuth']\n\n h_angle = (azimuth / 2 - 90)\n\n # returns answer between -180 and 180 degrees\n... | [
"0.5809133",
"0.56932247",
"0.562133",
"0.5432792",
"0.5391699",
"0.5273448",
"0.5269917",
"0.5258349",
"0.5191962",
"0.5191381",
"0.51645434",
"0.51499426",
"0.5090944",
"0.5034365",
"0.5031973",
"0.50225246",
"0.501417",
"0.4997427",
"0.49757305",
"0.4935782",
"0.49198472",... | 0.633702 | 0 |
Repeats a message multiple times. | async def repeat(ctx, times: int, content='repeating...'):
for i in range(times):
await ctx.send(content) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def repeat(self,ctx, times: int, content='repeating...'):\n for i in range(times):\n await ctx.send(content)",
"async def repeat(times : int, content='repeating...'):\n for i in range(times):\n await bot.say(content)",
"async def repeat(ctx, times : int, content='repeating...'... | [
"0.7628505",
"0.75241643",
"0.74671906",
"0.6782859",
"0.6725025",
"0.66473454",
"0.6640616",
"0.6501877",
"0.6463185",
"0.6406237",
"0.62558305",
"0.6149078",
"0.61431366",
"0.61045724",
"0.60727173",
"0.60414445",
"0.6028678",
"0.59844077",
"0.59493715",
"0.59287435",
"0.57... | 0.75642896 | 1 |
Says if a user is cool. In reality this just checks if a subcommand is being invoked. | async def cool(ctx):
if ctx.invoked_subcommand is None:
await ctx.send('No, {0.subcommand_passed} is not cool'.format(ctx)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def cool(ctx):\n if ctx.invoked_subcommand is None:\n await bot.say('No, {0.subcommand_passed} is not cool'.format(ctx))",
"async def event(self, ctx):\r\n if ctx.invoked_subcommand is None:\r\n await self.bot.say('No, {0.subcommand_passed} is not cool'.format(ctx))",
"async d... | [
"0.7579999",
"0.6899157",
"0.63918954",
"0.6365819",
"0.61112785",
"0.60582155",
"0.60375273",
"0.5930833",
"0.5887822",
"0.58628875",
"0.5848644",
"0.57999957",
"0.5797073",
"0.5797073",
"0.579523",
"0.57907087",
"0.56930506",
"0.5675957",
"0.564224",
"0.56418496",
"0.561967... | 0.7729976 | 0 |
Is the bot cool? | async def _bot(ctx):
await ctx.send('Yes, the bot is cool.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_bot(self) -> bool:",
"def is_bot(self) -> undefined.UndefinedOr[bool]:",
"async def _bot():\n await bot.say('Yes, the bot is cool.')",
"def is_rainbow(msg: str = 'I guess you are not my little pog champ :3'):\n\n async def check(ctx):\n rainbow = ctx.author.id == ctx.bot.owner_id\n ... | [
"0.7927701",
"0.7085806",
"0.70779985",
"0.69509816",
"0.68449193",
"0.6735682",
"0.667686",
"0.6618449",
"0.645192",
"0.6344753",
"0.6315624",
"0.6279006",
"0.6266472",
"0.61349714",
"0.6125706",
"0.6121934",
"0.6118115",
"0.61062866",
"0.6083343",
"0.6079055",
"0.60745174",... | 0.7284892 | 1 |
Returns normalized explicit bolean flags for `absl.flags` compatibility. | def normalize_flags(argv: List[str]) -> List[str]:
bolean_flag_patern = re.compile(r'--[\w_]+=(true|false)')
def _normalize_flag(arg: str) -> str:
if not bolean_flag_patern.match(arg):
return arg
if arg.endswith('=true'):
return arg[: -len('=true')] # `--flag=true` -> `--flag`
elif arg.end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _SanitizeFlags( flags ):\n\n sanitized_flags = []\n saw_arch = False\n for i, flag in enumerate( flags ):\n if flag == '-arch':\n saw_arch = True\n continue\n elif flag.startswith( '-arch' ):\n continue\n elif saw_arch:\n saw_arch = False\n continue\n\n sanitized_flags.a... | [
"0.59382993",
"0.59221536",
"0.5758345",
"0.5547654",
"0.55003345",
"0.5474018",
"0.5454624",
"0.53176725",
"0.5287026",
"0.52538836",
"0.5246436",
"0.52206445",
"0.52093154",
"0.5192281",
"0.51625186",
"0.5133777",
"0.5103207",
"0.5092846",
"0.50773543",
"0.5054406",
"0.5041... | 0.679333 | 0 |
Get request data from NASA APOD API | def get_requests():
global response
#Set the parameters fot the request
url = "https://api.nasa.gov/planetary/apod"
api_key = "DEMO_KEY" #Use your own key
date = calender.get_date()
querystring = {'api_key':api_key, 'date':date}
#Call the request and turn it into a python usable format
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_apod_data(api_key: str, download: bool = False, path: str = \".\") -> dict:\n url = \"https://api.nasa.gov/planetary/apod\"\n return requests.get(url, params={\"api_key\": api_key}).json()",
"def __apiRequest(self, url, parms={}):\n authparms = self.__addAuthParms(parms);\n request = ... | [
"0.675507",
"0.6119157",
"0.60302633",
"0.5864022",
"0.5860251",
"0.5842368",
"0.5795848",
"0.57947344",
"0.57612",
"0.5754473",
"0.5714969",
"0.556975",
"0.5491468",
"0.54912275",
"0.5476093",
"0.5472536",
"0.54627216",
"0.5447599",
"0.5426728",
"0.5425115",
"0.54118353",
... | 0.7090859 | 0 |
Save the desired photo | def save_photo():
save_name = filedialog.asksaveasfilename(initialdir="10.APOD Viewer/", title="Save Image", filetype=(("JPEG", "*.jpg"), ("All Files", "*.*")))
img.save(save_name + ".jpg") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def savePhoto(self, path):\n if self.original_image and path:\n cv2.imwrite(path, self.original_image)",
"def save_image(self):\n self.save()",
"def savePicture(self):\n self.file_name = QtGui.QFileDialog.getSaveFileName(self, \n \"Save as..... | [
"0.7788132",
"0.774997",
"0.7455914",
"0.74308985",
"0.7244878",
"0.72401404",
"0.71777683",
"0.7136806",
"0.7078779",
"0.70240724",
"0.7012547",
"0.7004505",
"0.692248",
"0.6906744",
"0.68199617",
"0.680405",
"0.68036956",
"0.6798691",
"0.6788766",
"0.67621744",
"0.6716808",... | 0.7974888 | 0 |
A method that invokes "It's Always Sunny In Philadelphia" title card generation from ImageUtils. | async def iasip_title_card(self, ctx: Context, *, title: str) -> None:
async with ctx.channel.typing():
if not title.startswith('"'):
title = '"' + title
if not title.endswith('"'):
title += '"'
buffer = await image_utils.title_card_generato... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_title(words):",
"def print_title():\r\n HANGMAN_ASCII_ART = \"\"\"welcome to the game hangman\r\n _ _ \r\n | | | | \r\n | |__| | __ _ _ __ __ _ _ __ ___ __ _ _ __ \r\n | __ |/ _` | '_ \\ / _` | '_ ` _ \\ / _` |... | [
"0.6305679",
"0.62836653",
"0.61354226",
"0.6115783",
"0.6080377",
"0.60758245",
"0.606231",
"0.6042628",
"0.60418034",
"0.5866398",
"0.58305675",
"0.5820785",
"0.57217073",
"0.5705232",
"0.56908786",
"0.5675178",
"0.5664888",
"0.56627333",
"0.5640492",
"0.56279325",
"0.55611... | 0.6612236 | 0 |
helper method to get integer input from user in certain range | def _int_input_in_range(self, print_out, range_):
try:
i = int(input(print_out))
assert range_[0] <= i <= range_[1]
return i
except AssertionError:
print('Please, enter a vaild number')
return None
except ValueError:
print('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask_number (question,low,high):\n response = None\n while response not in range(low,high):\n response = int(input(question))\n return response",
"def ask_number(question, low, high):\n response = None\n while response not in range (low, high):\n response = int(input(question))\n ... | [
"0.78135586",
"0.7703191",
"0.76899767",
"0.76899767",
"0.7627158",
"0.7533919",
"0.7518586",
"0.75072557",
"0.74196607",
"0.7310433",
"0.7306025",
"0.72823185",
"0.725796",
"0.7250905",
"0.71397394",
"0.71391845",
"0.7110826",
"0.7087965",
"0.70310694",
"0.702148",
"0.701446... | 0.81906676 | 0 |
Prints out logging options to the user | def logging_page(self):
print('-=' * 12 + " Logging Page " + '-=' * 12)
options = {1: self.sign_up, 2: self.log_in, 3: self.delete_account, 4: self.exit}
print_out = "(1) Sign up \n (2) Log in \n (3) Delete Account \n (4) Exit"
return self._take_option(options, print_out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_options(self):\n for option in self._options.items():\n print \"{0} = {1}\".format(option[0], option[1])",
"def display_user_options():\r\n print(\"Please choose an option [e/d/a/q]:\")\r\n print(\" e) Encrypt some text\")\r\n print(\" d) Decrypt some text\")\r\n print(\... | [
"0.65579903",
"0.6431838",
"0.63489974",
"0.6298482",
"0.62360644",
"0.6181142",
"0.61544454",
"0.6136024",
"0.61304414",
"0.6068432",
"0.60009336",
"0.5979868",
"0.5954127",
"0.5939901",
"0.59330225",
"0.59311664",
"0.5922984",
"0.59142864",
"0.5908796",
"0.5897866",
"0.5891... | 0.7051415 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.