query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Return the number of entries in the DB matching the specified stage | def get_entry_count(self, stage):
raise NotImplementedError('Please implement me') | [
"def num_stages(self) -> int:\n pass",
"def recordCount(self,obj):\n self.__expectString(obj)\n try:\n eval('self.Org.{}.metadata()'.format(obj))['objectDescribe']['label']\n try:\n return self.getdf('SELECT count(Id) FROM {}'.format(obj)).at[0,'expr0']\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the absolute feature DB path for the specified stage | def get_feature_db_path(self, stage):
raise NotImplementedError('Please implement me') | [
"def get_label_db_path(self, stage):\n raise NotImplementedError('Please implement me')",
"def database_file_path(self, job):\n path = self.hfb_path / psf_fn(job)\n assert path.is_file(), f\"{path} not found!\"\n return path",
"def dbPath(self):\n return self._parameters['DB_P... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the absolute label DB path for the specified stage | def get_label_db_path(self, stage):
raise NotImplementedError('Please implement me') | [
"def get_feature_db_path(self, stage):\n raise NotImplementedError('Please implement me')",
"def get_database_uri(self, label: str = \"default\") -> str:\n return self.config[\"databases\"][label]",
"def get_filename_from_stage(stage: str, device: TorchDevice) -> str:\n if stage not in [PREPROC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the mean file | def get_mean_file(self):
raise NotImplementedError('Please implement me') | [
"def mean_reader(filename):\r\n os.chdir(r'C:\\Users\\jensj\\OneDrive\\Skrivebord\\Beregninger\\Calculated\\Mean')\r\n txt = []; meanV = []; meanM = []; y = []\r\n infile = open(filename,'r')\r\n for line in infile:\r\n txt = line.split()\r\n meanV.append(float(txt[0]))\r\n meanM.ap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The local dependency fixture uses a longer contracts folder path. This test ensures that the contracts folder field is honored, specifically In the case when it contains subpaths. | def test_dependency_contracts_folder(config, local_dependency):
actual = local_dependency.contracts_folder
assert actual == "source/v0.1" | [
"def test_generate_workfolder_local(self):\n assert bs.generate_workfolder(None) == os.getcwd()",
"def fixture_fixtures_dir() -> Path:\n return Path(\"tests/fixtures/\")",
"def test_relativepath():\n folder = om.Folder(persist)\n for child in folder:\n om_relpath = child.relativepath\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test Appli Git Config | def test_apply_git_config(git_worktree):
foo1 = git_worktree.create_git_project("foo")
upstream = Remote()
upstream.name = "upstream"
upstream.url = "git@srv:bar.git"
foo1.configure_remote(upstream)
foo1.apply_config()
git = qisrc.git.Git(foo1.path)
assert git.get_config("remote.upstream... | [
"def test_repo_get_git_hook(self):\n pass",
"def config_repo(name):\n instance = get_instance(name)\n with settings(host_string=instance.public_dns_name):\n run('git config --global user.name \"Carlos aguilar\"')\n run('git config --global user.email caguilar@dwdandsolutions.com')\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test Branch Without Remote | def test_branch_without_remote(git_worktree):
foo1 = git_worktree.create_git_project("foo")
branch = Branch()
branch.name = "master"
branch.default = True
foo1.branches = [branch]
foo1.apply_config() | [
"def test_get_upstream_branch():",
"def test_set_upstream_branch():",
"def test_create_branch():",
"def test_repo_get_branch_protection(self):\n pass",
"def check_git_branch():\n server = get_odoo_server_url()\n if server:\n urllib3.disable_warnings()\n http = urllib3.PoolManager(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test Warn On Remote Change | def test_warn_on_remote_change(git_worktree, record_messages):
foo1 = git_worktree.create_git_project("foo")
origin = Remote()
origin.name = "origin"
origin.url = "git@srv:foo.git"
foo1.configure_remote(origin)
foo1.configure_branch("master", tracks="origin", default=True)
origin2 = Remote()... | [
"def test_notify_run_status(self):\n pass",
"def test_full_update_notification(self):\n pass",
"def test_update_checker_result(self):\n pass",
"def test_update_notification(self):\n pass",
"def send_change_variable_with_needless_warm_message(computer_id,family_id,process_id):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test Warn on Default Change | def test_warn_on_default_change(git_worktree, record_messages):
foo1 = git_worktree.create_git_project("foo")
gitorious = Remote()
gitorious.name = "gitorious"
gitorious.url = "git@gitorious:libfoo/libfoo.git"
gitorious.default = True
gitlab = Remote()
gitlab.name = "gitlab"
gitlab.url =... | [
"def update_warning(self):\n\t\tpass",
"def assert_default(self, value):\n self.assert_in_help('default: %s' % value)",
"def test_default_severity_level() -> None:\n assert Notification(\"test\").severity == \"information\"",
"def test_override_of_all_the_message_options(self):\n config_file ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test Setting Default Branch | def test_setting_default_branch(git_worktree):
foo1 = git_worktree.create_git_project("foo")
foo1.configure_branch("master", default=False)
assert foo1.default_branch is None
foo1.configure_branch("master", default=True)
assert foo1.default_branch.name == "master" | [
"def test_change_default_branch(git_worktree):\n foo_proj = git_worktree.create_git_project(\"foo\")\n foo_proj.configure_branch(\"master\", default=True)\n foo_proj.configure_branch(\"devel\", default=True)\n assert foo_proj.default_branch.name == \"devel\"",
"def test_set_upstream_branch():",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test Change Default Branch | def test_change_default_branch(git_worktree):
foo_proj = git_worktree.create_git_project("foo")
foo_proj.configure_branch("master", default=True)
foo_proj.configure_branch("devel", default=True)
assert foo_proj.default_branch.name == "devel" | [
"def test_setting_default_branch(git_worktree):\n foo1 = git_worktree.create_git_project(\"foo\")\n foo1.configure_branch(\"master\", default=False)\n assert foo1.default_branch is None\n foo1.configure_branch(\"master\", default=True)\n assert foo1.default_branch.name == \"master\"",
"def test_set... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a cap to to the object. | def add_cap(self, cap):
cap.set_object(self)
self.caps[cap.get_name()] = cap | [
"def add_instance(self, pvc_obj: PVC, capacity_float: float, deployment: str = None):\n pvc_capacity_deployment = PvcCapacityDeployment(\n pvc_obj, capacity_float, deployment\n )\n self.append(pvc_capacity_deployment)",
"def add_resource_limit(self, resource_name, value) -> 'Contai... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the named cap. | def get_cap(self, name):
return self.caps[name] | [
"def get_capacidade(self):\n return self.__capacidade",
"def capability(self):\n return self.data['capability']",
"def smallcapName( glyphName=\"scGlyph\", suffix=\".sc\", lowercase=True ):\n\ttry:\n\t\treturnName = glyphName\n\t\t\n\t\t# make lowercase if requested:\n\t\tif lowercase:\n\t\t\tsuff... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the object that this Cap refers to. | def get_object(self):
return self.the_object | [
"def _get_current_object(self):\n if callable(self.__target):\n return self.__target()\n try:\n return getattr(self.__target, self.__name__)\n except AttributeError:\n raise RuntimeError('no object bound to %s' % self.__name__)",
"def _get_objectReference(self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a right to the cap. | def add_right(self, right):
# Need some error checking here.
if not Cap.rights.has_key(right):
raise MergeError, "'%s' not a supported right." % right
self.rights.append(right)
self.all_rights = self.all_rights | Cap.rights[right] | [
"def add_right(self, node, e = None):\n if node._right is not None:\n raise ValueError('Right child exists')\n self._size += 1\n node._right = self.TreeNode(e, node) # node is its parent\n return node._right",
"def set_right(self, right):\n self.right_child... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate the bootinfo instructions to create the cap. | def generate_bootinfo(self, obj, bi):
self.bi_name = \
bi.write_new_cap(obj.get_bootinfo_id(),
self.all_rights) | [
"def generate_bootinfo(self, bi):\n self.bi_name = \\\n bi.write_new_pool(self.is_virtual())\n \n for cap in self.caps.values():\n cap.generate_bootinfo(self, bi)\n \n for (base, end, mem_type) in self.pool.get_freelist():\n if self.is_virtual... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a new entry to the environment. | def add_entry(self, key, value = None, base = None, cap = None,
cap_name = None, attach=None):
entry = Environment.Entry(key, value = value,
base = base,
cap_name = cap_name,
cap = cap,
... | [
"def add_entry(self, entry):\n self.entries.update(entry)\n self.save()",
"def append(self, entry):\n self.entries.append(entry)",
"def add_entry(self, entry_object):\n self.entries.append(entry_object)",
"def add_elf_entry(self, key, elf_type, entry_point):\n entry = Enviro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a new ELF info entry to the environment. | def add_elf_entry(self, key, elf_type, entry_point):
entry = Environment.ELFEntry(key, elf_type, entry_point)
self.entries.append(entry) | [
"def add_entry(self, key, value = None, base = None, cap = None,\n cap_name = None, attach=None):\n entry = Environment.Entry(key, value = value,\n base = base,\n cap_name = cap_name,\n cap = c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a new pd_extension token entry to the environment. | def add_pd_extension_token_entry(self, key, base_space, pd_ext_space,
pd_ext_utcb, return_utcb):
entry = Environment.PDExtensionTokenEntry(key, base_space,
pd_ext_space, pd_ext_utcb, return_utcb)
self.entries.append(entry) | [
"def add_encoded_extension(self, extension):\n ...",
"def register_extension(extension):\n if not extension in markdown_extensions:\n markdown_extensions.append(extension)",
"def insert(self, extension):\n\n self.__elements.insert(0, extension)",
"def add_extdata(self, message: str) ->... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Snap the cap names pointers in the environment into cap objects. | def snap(self):
for e in self.entries:
if isinstance(e, Environment.Entry) and e.cap is None and \
e.cap_name is not None:
cap = self.scope.lookup(e.cap_name)
if cap is None:
# Needs more context.
raise Merge... | [
"def capaths(self, capaths):\n\n self._capaths = capaths",
"def add_cap(self, cap):\n cap.set_object(self)\n self.caps[cap.get_name()] = cap",
"def _copy_to_globals(namespace, attrs):\n g = globals()\n for attr in attrs:\n g[attr] = getattr(namespace, attr)",
"def __copyEnv (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate the bootinfo instructions to create and fill the environment. | def generate_bootinfo(self, pd, bi):
pd_bi = pd.get_bootinfo_id()
self.snap()
for e in self.entries:
if isinstance(e, Environment.Entry):
if e.value is not None:
bi.write_object_export(pd = pd_bi,
... | [
"def generate_bootinfo(self, bi, heap, callback):\n # Stack.\n\n bi.write_register_stack(thread = self.bi_name,\n ms = self.stack_ms.get_bootinfo_id())\n\n # Dump the caps.\n for cap in self.caps.values():\n cap.generate_bootinfo(self, bi)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate the bootinfo instructions to create and fill the memory pool. | def generate_bootinfo(self, bi):
self.bi_name = \
bi.write_new_pool(self.is_virtual())
for cap in self.caps.values():
cap.generate_bootinfo(self, bi)
for (base, end, mem_type) in self.pool.get_freelist():
if self.is_virtual():
... | [
"def generate_bootinfo(self, bi):\n\n attrs = self.get_attrs()\n # Set defaults for values calculated from attributes generated\n # by layout(). This method can be called from\n # BootInfo.create_dynamic_segments(), which called prior to\n # Image.layout() in which case addresses... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add memory to the pool. | def add_memory(self, src, base, size):
weaver.pools.pools.add_physical_memory(self.name,
src, base, size) | [
"def add_memory(self, src, base, size):\n weaver.pools.pools.add_virtual_memory(self.name,\n src, base, size)",
"def memory(self,reward):\r\n self.memory_rewards.append(reward)\r\n return",
"def add_memory_area(self, address, size):\n # Ad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add memory to the pool. | def add_memory(self, src, base, size):
weaver.pools.pools.add_virtual_memory(self.name,
src, base, size) | [
"def add_memory(self, src, base, size):\n weaver.pools.pools.add_physical_memory(self.name,\n src, base, size)",
"def memory(self,reward):\r\n self.memory_rewards.append(reward)\r\n return",
"def add_memory_area(self, address, size):\n # ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Comparison function for threads. Ordered by priority. | def thread_cmp(x, y):
return cmp(y.get_priority(), x.get_priority()) | [
"def thread_priority(self):\n return _raw_util.raw_divide_ff_sptr_thread_priority(self)",
"def thread_priority(self):\n return _bs_swig.ec_invert_sync_sptr_thread_priority(self)",
"def thread_priority(self):\n return _bs_swig.ec_descrambler_sync_sptr_thread_priority(self)",
"def thread_pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Link a thread to it's stack. | def attach_stack(self, stack_ms):
if self.stack_ms is not None:
raise MergeError, "Thread %s already has a stack." % self.name
# Set the defaults for the stack if they have not yet been
# overridden.
attrs = stack_ms.get_attrs()
attrs.file = None
attrs.page... | [
"def attach_to_thread(self, thread_object):\n thread_id = thread_object.ident\n if not thread_id:\n raise RuntimeError('A running thread is required.')\n DependencyRegistry.register(\n context=self, thread_id=thread_id)\n self._attached_threads.append(thread_id)",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate the bootinfo instructions to create the thread. | def generate_bootinfo(self, bi, heap, callback):
# Stack.
bi.write_register_stack(thread = self.bi_name,
ms = self.stack_ms.get_bootinfo_id())
# Dump the caps.
for cap in self.caps.values():
cap.generate_bootinfo(self, bi)
# ... | [
"def generate_bootinfo(self, bi):\n\n attrs = self.get_attrs()\n # Set defaults for values calculated from attributes generated\n # by layout(). This method can be called from\n # BootInfo.create_dynamic_segments(), which called prior to\n # Image.layout() in which case addresses... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialise the memsection with either the given attributes or the attributes of the given segment. If a segment is passed, then this memsection covers the range of the segment. | def __init__(self, attrs = None, segment = None):
BootInfoObject.__init__(self)
self.owner = None
self.zone = None
if segment is not None:
self.ms = segment
self.token_exported = 0
else:
self.ms = weaver.image.image.add_memsection(attrs) | [
"def record_segment_info(self, segment_prefix, seg):\n # Remove any pathname components from the prefix.\n segment_prefix = basename(segment_prefix)\n\n attrs = seg.get_attrs()\n self.add_segment_info(\"%s.%s\" % (segment_prefix, attrs.name),\n seg.get_elf_se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the attributes of the memsection. | def get_attrs(self):
return self.ms.get_attrs() | [
"def getAttrs(self):\n\t\treturn self._attributes",
"def attributes(self):\n if self.element is not None:\n if isinstance(self.element, DocElement):\n return self.element.attributes\n else:\n return self.element.attrib\n else:\n return {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return whether or not the memsection needs to be attached to a PD. Memsections with custom pagers, and memsections in zones, to not need to be attached. | def need_attach(self):
return self.zone is None and self.get_attrs().pager is None | [
"def is_in_memory(self):\n for r in self.pa_range():\n if not r.is_mapped():\n return False\n return True",
"def HasDPA(self):\n return self.__has('DPA')",
"def has_pt(self) -> bool:\n return self.pt_tracer is not None",
"def HasPLM(self):\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate the bootinfo operations to setup the memsection. | def generate_bootinfo(self, bi):
attrs = self.get_attrs()
# Set defaults for values calculated from attributes generated
# by layout(). This method can be called from
# BootInfo.create_dynamic_segments(), which called prior to
# Image.layout() in which case addresses and defaul... | [
"def generate_bootinfo(self, bi):\n self.bi_name = \\\n bi.write_new_pool(self.is_virtual())\n \n for cap in self.caps.values():\n cap.generate_bootinfo(self, bi)\n \n for (base, end, mem_type) in self.pool.get_freelist():\n if self.is_virtual... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the attributes of the zone. | def get_attrs(self):
return self.image_zone.get_attrs() | [
"def getAttrs(self):\n\t\treturn self._attributes",
"def attributes(self):\n return self._sku['attributes']",
"def get_attrs(self):\n return self.ms.get_attrs()",
"def zone_settings(self, zone=None):\n zone_settings = self._zone(zone or self.default_zone)\n return {\n \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Record the current default pools so that they can be passed on to the PD's runtime allocators. | def set_default_pools(self):
(virt_name, phys_name) = weaver.image.image.current_pools()
self.default_virtpool = bootinfo.get_virtpool(virt_name)
self.default_physpool = bootinfo.get_physpool(phys_name)
self.default_directpool = bootinfo.get_virtpool("direct") | [
"def set_current_pool(self):\n self.ctl.fill_spn_pool()",
"def get_default_spool(self):\n default_pool = self.conn.storagePoolLookupByName('default')\n return default_pool",
"def pools(self, pool=None):\n url = f'{self.hostname}/pools'\n if pool:\n url += '/' + pool... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a list of threads in the PD. | def get_threads(self):
return self.threads | [
"def getAllThreads(self):\n raise NotImplementedError",
"def threads():\n return render_template('threads.html', threads=storage.list_threads())",
"def message_threads(self):\n return resource.MessageThreads(self)",
"def get_process_threads(pid):\n global _system_thread_count\n \n thread_c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add the standard entries to the environment. The standard entries are the callback buffer, default pools and the elf and segment info tables. | def add_std_env(self, elf_info, segment_info, servers, virtpools,
physpools):
if not self.added_std_env:
if hasattr(self, 'callback'):
self.environment.add_entry("__OKL4_CALLBACK_BUFFER",
cap=self.callback.get_cap('master... | [
"def add_entry(self, key, value = None, base = None, cap = None,\n cap_name = None, attach=None):\n entry = Environment.Entry(key, value = value,\n base = base,\n cap_name = cap_name,\n cap = c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Record details about the segment for later inclusion in the object environment. | def record_segment_info(self, segment_prefix, seg):
# Remove any pathname components from the prefix.
segment_prefix = basename(segment_prefix)
attrs = seg.get_attrs()
self.add_segment_info("%s.%s" % (segment_prefix, attrs.name),
seg.get_elf_segment())
... | [
"def log_segment_information(self, segment_tag, text_lines, real_segment_tag):\n\n final_text_lines = []\n file_name = self.ocromore_data['file_info'].name\n\n # add dividers to the lines\n final_text_lines.append(real_segment_tag + \": \" + file_name + \"--------------------------------... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this sends errors to a slack channel so that msg{str} > error message | def reporting(msg,channel,bot):
# Create slack handler
slack_handler = SlackerLogHandler(channel, bot,stack_trace=True)
# Create logger
logger = logging.getLogger('Send Conf.')
logger.addHandler(slack_handler)
# Format
formatter = NoStacktraceFormatter('%(asctime)s --> ERROR - %(m... | [
"async def error(self, user, msg):\n self.logger.warning(\"ERRROR: {}\".format(msg))\n r = {\"command\": \"ERROR\", \"args\": [msg]}\n await self.send_obj(user, r)",
"def send_message_to_slack(text):\n\n try:\n post = {\n \"text\": \":fire: :sad_parrot: *OAG Data Ingest E... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load CalConnect web site | def load(self):
# CalConnect Login Screen
self.driver.get("https://auth.calconnect.cdph.ca.gov/auth/XUI/#login/") | [
"def load(self, url):\n self.browser.get(url)",
"def web():\n from mephisto.client.full.server import app\n\n app.run(debug=False)",
"def open_from_url(self, url):\n self.__html = requests.get(url).text",
"def weath_f():\r\n webbrowser.open(\"https://weather.com\")",
"def request_home... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function loads the list created for Incidents that need bulk update It will then iterate through that list, change Process Status + to "Closed by LHJ", and save | def load_list(self):
# Load List
# This is a list that must be created of all the incident ids you want to update. Currently,
# the target column to be updated is the 3rd column.
self.driver.get(self.list_url) | [
"def execute_bulk_updates(self, bulk_updates):\n for field, values in bulk_updates.items():\n for value, ids in values.items():\n self.model_context.model.objects.filter(**{\"%s__in\" % self.model_context.pk: ids}).update(**{field: value})\n self.records_processed += ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Starts or resumes timer countdown and repeats if specified. | async def start_timer(ctx):
status = timer.get_status()
# Grabs settings and timer duration from `settings.ini`
repeat_mode = config['CURRENT_SETTINGS']['repeat']
time_mins = config['CURRENT_SETTINGS']['time']
time_full = int(time_mins) * 60
# Create role here in case user starts timer before t... | [
"def startCountdown(self):\n self.sec_remaining = endTime_to_seconds(self.game_obj.endTime)\n self.countdown.start(500)\n self.update_countdown()",
"def startCountdown(self): \n if self._state == STATE_COUNTDOWN:\n while self._countdown < 1000:\n self._countdo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Displays remaining time before ping and timer settings. | async def status(ctx):
raw_time = timer.get_time()
time_secs = raw_time % 60
time_mins = int((raw_time - time_secs) / 60)
if time_secs < 10:
time_secs = '0' + str(time_secs)
time_desc = f'Time Remaining: `{time_mins}:{time_secs}`\n'
settings_desc = 'Timer Duration Setting: `' + config['C... | [
"def countdown(t):\r\n while t:\r\n mins, secs = divmod(t, 60)\r\n timeformat = '{:02d}:{:02d}'.format(mins, secs)\r\n print(timeformat, end='\\r')\r\n time.sleep(1)\r\n t -= 1",
"def get_downtime(self):\n return self._read_logs(\"Timeout during PPP negotiation\")",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Catches setmessage command errors and logs unhandled errors. | async def set_message_error(ctx, error):
if DEBUG:
print(f'Caught `setmessage` error: {ctx.message.content}\n {ctx.message}\n {error.args[0]}\n')
if isinstance(error, commands.errors.MissingRequiredArgument): # Missing message argument
em = Embed(title=':warning: Invalid `setmess... | [
"def _notify_error(self, message):\n if not self._arguments.ignore:\n raise Exception(message)\n print(termcolor.colored(\"ERROR: {}\".format(message), 'red'))",
"async def on_command_error(self, ctx: Context, _error):\n await self.handle_error(ctx, _error)",
"def error(self, mes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attempts to load configuration details from lightsweeper conf files. configurationFilePath can be either a a valid configuration file name or a directory containing a valid configuration named "lightsweeper.conf" | def readConfiguration (configurationFilePath = None):
pathList = getConfigurationPaths(configurationFilePath)
# if not silent:
# if len(pathList) is 1:
# print("Loading options from {:s}".format(pathList[0]))
# else:
# print("Loading overrides from {:s}".format(pathL... | [
"def load_config_file():\n\n try:\n return try_load_config()\n except FileNotFoundError:\n logging.error(\"Config file does not exist\")\n raise",
"def load_cfg(self,filepath):\n config = configparser.ConfigParser()\n config.read([filepath])\n return config",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function attempts to load the floor configuration at fileName | def loadConfig(self, fileName):
if os.path.exists(fileName) is True:
if os.path.isfile(fileName) is not True:
raise IOError(fileName + " is not a valid configuration file!")
else:
raise FileDoesNotExistError(fileName + " does not exist!")
try:
... | [
"def selectConfig(self):\n\n floorFiles = self.listFloorFiles()\n \n if len(floorFiles) is 0:\n raise IOError(\"No floor configuration found. Try running LSFloorConfigure.py\")\n elif len(floorFiles) is 1:\n fileName = floorFiles[0]\n else:\n print... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function returns true if the configuration contains any virtual tiles. | def containsVirtual(self):
for cell in self.config:
if "virtual" in cell[2]:
return True
return False | [
"def has_virtual_sites(self):\n for ix in range(self._hybrid_system.getNumParticles()):\n if self._hybrid_system.isVirtualSite(ix):\n return True\n return False",
"def has_validate_tiles(self):\n if not self.tiles or not self.tile_indices or self.tile_size <= 0:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function looks for .floor files in the directory set by the directive FLOORSDIR in the general configuration, or, if unset, in the current directory and prompts the user to select one, then loads it into this instance. | def selectConfig(self):
floorFiles = self.listFloorFiles()
if len(floorFiles) is 0:
raise IOError("No floor configuration found. Try running LSFloorConfigure.py")
elif len(floorFiles) is 1:
fileName = floorFiles[0]
else:
print("\nFound multip... | [
"def import_floorplan(self, path, target=ui_ref.mapping['site explorer floor']['id']):\n\n assert ntpath.exists(path), IOError('Unable to find input file {0}'.format(path))\n\n _properties_tab = ui_ref.mapping['configure properties tab']['id']\n _expander = ui_ref.mapping['configure floor expan... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This process executes in serial, so if you get to call is_alive, the answer must be no. | def is_alive(self):
return False | [
"def check_alive(self):\n returncode = self._process.poll()\n if returncode is not None:\n raise RuntimeError(\"%s unexpectedly quit\" % self._name)",
"def check_alive(self) -> None:\n return",
"def isDone(self):\n ## If the process has not been started yet, then return False\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates model.Operator.Operator instance from json map data | def map_from_json(self, data):
enrolmentNumber = int(data['enrolmentNumber'])
firstName = data['firstName']
lastName = data['lastName']
dob = data['dob']
faculty = data['faculty']
email = data['email']
return Operator(enrolmentNumber, firstName, lastName, dob , fa... | [
"def from_dict(cls, _dict: Dict) -> 'JobDataAction':\n args = {}\n if 'action_name' in _dict:\n args['action_name'] = _dict.get('action_name')\n if 'inputs' in _dict:\n args['inputs'] = [VariableData.from_dict(x) for x in _dict.get('inputs')]\n if 'outputs' in _dict... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates json map from model.Operator.Operator operator | def map_to_json(self, operator):
ret = {}
ret['enrolmentNumber'] = operator.enrolmentNumber
ret['firstName'] = operator.firstName
ret['lastName'] = operator.lastName
if 'str' in str(type(operator.dob)):
ret['dob'] = operator.dob
else:
ret['dob'] = ... | [
"def exportAsJSON(self, operators):\n ret = None\n l = []\n mapper = OperatorJSONMapper()\n for operator in operators:\n l.append(mapper.map_to_json(operator))\n return json.dumps(l, indent=4, sort_keys=True)",
"def _get_op_pair(self, operator_):\n return self.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
download_pubmed downloads full text of articles with pubmed ids pmids to folder | def download_pubmed(pmids,ftp,download_folder):
if isinstance(pmids,str):
pmids = [pmids]
subset = pandas.DataFrame(columns=ftp.columns)
for p in pmids:
row = ftp.loc[ftp.index[ftp.PMCID == p]]
subset = subset.append(row)
# Now for each, assemble the URL
for row in subset.it... | [
"def extract_pubmed_articles(pubmed_ids):\n articles = []\n Entrez.email = my_email\n Entrez.api_key = mike_api_key\n\n for pubmed_id in tqdm(pubmed_ids[4225:]):\n article = {}\n try:\n handle = Entrez.efetch(db='pubmed', rettype='medline', retmode='text', id=pubmed_id)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
download_single single downloads some resource with wget to folder | def download_single(resource,download_folder):
print("Downloading %s" %(resource))
os.system("wget \"%s\" -P %s" %(resource,download_folder)) | [
"def download_url():",
"def download_page(learnUser, url, target_dest, learn_name):\n target_dest = f\"{target_dest}/Single Files/\"\n learnUser.downloadFile(url, target_dest, learn_name)",
"def _wget_download(self):\n print(\"Info : Starting to download with wget %s ...\" %\n (self._d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return whether move_to_make is a valid move for the next player. >>> a = State(True, [1,2,1,1]) >>> a.is_valid_move('ll') True >>> a.is_valid_move('rl') True | def is_valid_move(self, move_to_make: str)->bool:
return move_to_make in self.get_possible_moves() | [
"def move_is_legal(self,move):\n\t\tassert isinstance(move,Move)\n\n\t\tif move in self.possible_moves():\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False",
"def is_move_valid(self):\n if self.current_move is None:\n return False\n\n if self.current_move == 'q':\n return True\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a new state of self given move_to_make. >>> a = State(True) >>> a.value = [0, 2, 3, 0] >>> str(a.make_move('rl')) 'State(p2, 02, 00)' | def make_move(self, move_to_make: str)->'State':
la, lb, ra, rb = self.value[0], self.value[2], self.value[1], self.value[3]
if self.is_p1_turn:
new_value = []
if move_to_make == 'll':
new_value.extend([la, ra, la+lb, rb])
elif move_to_make == 'lr':
... | [
"def make_move(self, move_to_make: int) -> Any:\n s = SubtractState(self.is_p1_turn, self.current_num)\n s.current_num = self.current_num - move_to_make\n if self.is_p1_turn:\n s.is_p1_turn = False\n else:\n s.is_p1_turn = True\n return s",
"def make_move(s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the current antialias setting | def antialias(self):
return self._ripy.antialias | [
"def getAntialiasing(self, smoothing: 'SbBool &', numPasses: 'int &') -> \"void\":\n return _coin.SoRenderManager_getAntialiasing(self, smoothing, numPasses)",
"def getAntialiasing(self, smoothing: 'SbBool &', numPasses: 'int &') -> \"void\":\n return _coin.SoSceneManager_getAntialiasing(self, smoot... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A parser meant specifically for setting the default value of a field whose parser is not called by its parents parser. This parser is currently for fields used inside bitstructs since their parser is not called by their parent bitstructs parser. When "rawdata" is not provided to a bitstructs parser, the parser will cal... | def default_parser(self, desc, node=None, parent=None, attr_index=None,
rawdata=None, root_offset=0, offset=0, **kwargs):
if parent is not None and attr_index is not None:
if not self.is_block:
# non-Block node
parent[attr_index] = desc.get(DEFAULT, self.default())... | [
"def import_data(self, raw_data, **kw):\n data = self.convert(raw_data, **kw)\n del_keys = [\n k for k in data.keys()\n if data[k] == self.__class__.fields[k].default\n or data[k] == getattr(self, k)\n ]\n for k in del_keys:\n del data[k]\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Response type of the associated GatewayResponse. | def response_type(self) -> pulumi.Input[str]:
return pulumi.get(self, "response_type") | [
"def response_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"response_type\")",
"def get_response_type(client):\n return client.service_context.get('behaviour')['response_types'][0]",
"def _handle_response(self,\n response_type: str,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
String identifier of the associated REST API. | def rest_api_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "rest_api_id") | [
"async def identifier(request: Request) -> str:\n api_key = request.headers.get(\"X-API-Key\") or request.query_params.get(\"api_key\")\n return f\"{api_key}\"",
"def GetId(apig,api_name: str):\n\t\t\trest_api_list = AWS.APIGateway.List(apig)\n\n\t\t\tapi_id = ''\n\t\t\tfor api in rest_api_l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Map of templates used to transform the response body. | def response_templates(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "response_templates") | [
"def response_templates(self) -> pulumi.Output[Optional[Mapping[str, str]]]:\n return pulumi.get(self, \"response_templates\")",
"def custom_template_map(self):\n return dict(self.custom_template_items)",
"def get_templates(self) -> dict[str, str]:\n templates = {}\n for file in self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Map of parameters (paths, query strings and headers) of the Gateway Response. | def response_parameters(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
return pulumi.get(self, "response_parameters") | [
"async def parameters(self) -> dict:\n return await self._c._get(\"/wasm/parameters\")",
"def get_hyper_params(self) -> Dict[str, object]:\n return self._hyper_params.values",
"def query_params(self):\n return {}",
"def resp_headers(d: Mapping[str, str]) -> Mapping[str, str]:\n from da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Map of templates used to transform the response body. | def response_templates(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
return pulumi.get(self, "response_templates") | [
"def response_templates(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:\n return pulumi.get(self, \"response_templates\")",
"def custom_template_map(self):\n return dict(self.custom_template_items)",
"def get_templates(self) -> dict[str, str]:\n templates = {}\n for... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Response type of the associated GatewayResponse. | def response_type(self) -> pulumi.Output[str]:
return pulumi.get(self, "response_type") | [
"def response_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"response_type\")",
"def get_response_type(client):\n return client.service_context.get('behaviour')['response_types'][0]",
"def _handle_response(self,\n response_type: str,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
String identifier of the associated REST API. | def rest_api_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "rest_api_id") | [
"async def identifier(request: Request) -> str:\n api_key = request.headers.get(\"X-API-Key\") or request.query_params.get(\"api_key\")\n return f\"{api_key}\"",
"def GetId(apig,api_name: str):\n\t\t\trest_api_list = AWS.APIGateway.List(apig)\n\n\t\t\tapi_id = ''\n\t\t\tfor api in rest_api_l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Present a batch to the model. | def present_batch(self, memory, minibatch_size): | [
"def print_batch(self, batch):\r\n # leave to exact case\r\n raise NotImplementedError",
"def em_set_batch(self):\n self.em_set_params(None, None)",
"def _set_up_new_batch(self, *_):\n self.batch = []",
"def predict_batches(self, list_batches):\n widgets = [progressbar.Perce... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save the function to the specified path | def save(self, path): | [
"def save(self, save_dir_path):\n self.value_function.save(save_dir_path)\n self.save_algorithm_state(save_dir_path)",
"def Save(self, func, filename, subfolder=\"\",val=0,file=None,filetype=\"default\"):\n self.fprint(\"Saving: {0}\".format(filename))\n\n # if not isinstance(init_func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The space to which actions returned by the agent will belong | def action_space(self):
return self._action_space | [
"def get_action_space(self):\n control_space = self.get_control_space()\n if self._with_agent_language and self._with_language:\n action_space = gym.spaces.Dict(\n control=control_space, sentence=self._sentence_space)\n else:\n action_space = control_space\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Trains the learner offpolicy using the provided batch of trajectories. | def train_off_policy(self, batch, weights): | [
"def train_dataloader(self):\n return OnPolicyDataloader(self)",
"async def async_turn_off(self, **kwargs: Any) -> None:\n await self.coordinator.modern_forms.adaptive_learning(adaptive_learning=False)",
"def start_tpot(automated_run, session, path):\n module = functions.import_string_code_as_m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Selects an action for the given observation. | def select_action(self, observation): | [
"def _pick_eval_action(self, observation):\n return choice(range(self.action_space))",
"def get_action(self, observation):\n actions, agent_infos = self.get_actions([observation])\n action = actions[0]\n return action, {k: v[0] for k, v in agent_infos.items()}",
"def choose_action(se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enqueue a new model. | def enqueue(self, model):
assert isinstance(model, FeedForwardModel)
self._models.append(model) | [
"def add(self, obj):\n model_class = type(obj)\n model_key = model_class._meta.label\n self._create_queues[model_key].append(obj)\n if len(self._create_queues[model_key]) >= self.chunk_size:\n if not self._commit(model_class):\n print('Error entre %s -> %s' % (s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lets the agent observe a sequence of observation => action => observation, reward. | def observe(self, pre_observation, action, reward, post_observation, done): | [
"def learn(self, reward, observation):",
"def compute_reward(self, obs, action):\n pass",
"def predict(self, observation, action):\n return self.sess.run([self.obs_output, self.reward_output], \n feed_dict = {self.obs_input: observation, \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send a command in extended mode | def extended_command( self, c ):
# Set extended command mode
self.command( PCD8544_FUNCTIONSET | PCD8544_EXTENDEDINSTRUCTION )
self.command( c )
# Set normal display mode
self.command( PCD8544_FUNCTIONSET )
self.command( PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYNORMAL ) | [
"def _SendAttentionCommand( self ): # also pauses the recording ?\r\n\r\n packet = _Command( 'SendAttentionCommand' ) \r\n self._put( packet )",
"def _aotfSendCmd(self, cmd):\r\n if self.live:\r\n cmd += \"\\n\"\r\n cmd = cmd.encode(self.encoding)\r\n asse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set contrast to specified value (should be 0127). | def set_contrast( self, contrast ):
contrast = max( 0, min( contrast, 0x7f ) ) # Clamp to values 0-0x7f
self.extended_command( PCD8544_SETVOP | contrast ) | [
"def camChangeContrast(self, value):\n # Because QSliders does not work with decimal values, we use percent\n # instead. So we need to get a float between 0 and 1 then we set the\n # value.\n # And because the range is from -50% to +50%, we add 50 to get a positive\n # value\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to import an ASCII file with AFM surface height measurements and some headerlines. Afterwards converts the floats to uint8 format | def import_ascii(file_path=None):
if file_path is None:
file_path = askopenfilename(title='Select AFM image ASCII file', filetypes=(("ASCII files", "*.asc"),))
file_name = file_path.split('/')[-1]
f = open(file_path, 'r')
# Read each line, discriminate between header line and height value line... | [
"def loadsir(filename):\n\n fid = open(filename)\n data_types = dtype(\"int16\").newbyteorder(\">\")\n data_typec = dtype(\"int8\").newbyteorder(\">\")\n data_typef = dtype(\"float32\").newbyteorder(\">\")\n\n # read header\n head = double(fromfile(fid, dtype=data_types, count=256, sep=\"\"))\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate the coclustering rates of cells within the stable clusters | def stable_match_rates(clust_labels, shared, stable_clusters):
rates = []
for cl in stable_clusters:
cl_mask = cl == clust_labels
cl_cells = np.flatnonzero(cl_mask)
for cell_index in cl_cells:
my_mask = np.ones(shared.shape[0]).astype(bool)
my_mask[cell_index] = ... | [
"def cluster_cal(self):\n self.Cluster = []\n for i in range(self.nodenum):\n neighborhood_node = self.neighbor_node(i)\n Node_num = len(neighborhood_node)\n Count = self.neighbor_edge(neighborhood_node)\n if(Node_num == 0 or Node_num == 1):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate the fraction of cells in unstable clusters that match to a stable cluster. The highest coclustering rate with a stable cluster is calculated for each cell in an unstable cluster. If that rate exceeds ``threshold``, that cell is categorized as matching another cluster. The fraction of matching cells is returne... | def match_rates_for_unstable_clusters(unstable_clusters, stable_clusters, clust_labels, shared, threshold):
results = []
for cl in unstable_clusters:
cl_cells = np.flatnonzero(cl == clust_labels)
if len(cl_cells) == 0:
continue
best_match_rates = []
for cell_index in ... | [
"def stable_match_rates(clust_labels, shared, stable_clusters):\n\n rates = []\n for cl in stable_clusters:\n cl_mask = cl == clust_labels\n cl_cells = np.flatnonzero(cl_mask)\n for cell_index in cl_cells:\n my_mask = np.ones(shared.shape[0]).astype(bool)\n my_mask[c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Relabel the cells in a dissolved cluster with their new assignments | def new_labels_for_dissolved_cluster(cl, clust_labels, shared, stable_clusters):
cl_cells = np.flatnonzero(cl == clust_labels)
new_labelling = []
for cell_index in cl_cells:
other_rates = []
for other_cl in stable_clusters:
other_mask = other_cl == clust_labels
other... | [
"def relabel(self, labeled_mask):\n h, w = labeled_mask.shape\n\n relabel_dict = {}\n\n for i, k in enumerate(np.unique(labeled_mask)):\n if k == 0:\n relabel_dict[k] = 0\n else:\n relabel_dict[k] = i\n for i, j in product(range(h), ran... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Execute a single command and return STDOUT and STDERR. | def run_command(cmd, cwd=os.getcwd(), stdout=False, stderr=False, shell=False):
stdout, stdout_str = output_handler(stdout)
stderr, stderr_str = output_handler(stderr, redirect='2>')
p = subprocess.Popen(cmd, stdout=stdout, stderr=stderr, cwd=cwd,
shell=shell)
return p.communi... | [
"def execute(*cmd, **kwargs):\n result = processutils.execute(*cmd, **kwargs)\n LOG.debug('Execution completed, command line is \"%s\"', ' '.join(cmd))\n LOG.debug('Command stdout is: \"%s\"', result[0])\n LOG.debug('Command stderr is: \"%s\"', result[1])\n return result",
"def call_command(*args):... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a gradated colormap or continous, depending on bins specified Continuous really 256 colors gradated, but with ability to extend neutral. The neutral cut off is not used for gradated color maps. Grey is either the first bin or neutral is turned off entirely. | def data_cmap(vmin, vmax, ncolor, neutral_lim, options):
scale_frac = calc_scale_frac(neutral_lim, vmin, vmax)
colors = []
# Set cool maps with neutral cut off
if vmin < 0 and vmax <= 0:
cmap = cool_cmap
lowx = scale_frac
highx = 1
# Set hot maps with neutral cut off
else... | [
"def _continuous_colormap(hue, cmap, vmin, vmax):\n mn = min(hue) if vmin is None else vmin\n mx = max(hue) if vmax is None else vmax\n norm = mpl.colors.Normalize(vmin=mn, vmax=mx)\n return mpl.cm.ScalarMappable(norm=norm, cmap=cmap)",
"def make_colormap(mycolors,ninterp=100): \n\n thecolors = np.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiate a G5_ICARTT object. On input, rc_Sites resource file defining sites to interpolate to coll_names list with names of GEOS5 collections to sample, e.g., inst1_2d_hwl_Nx inst3_2d_asm_Nx etc. If not specified, an internal defined set of collections (defined in global variable COLLECTIONS) will be used. coll_dir... | def __init__ (self, rc_Sites,
coll_names = None,
coll_dir = './Collections',
top_url='http://opendap.nccs.nasa.gov:9090/dods/GEOS-5/fp/0.25_deg/assim',
template='discoveraq-geos5das-PRODUCT_SITE_DATE_RA.1001.ict',
outTopDir='./Arc... | [
"def _g5_icartt ( Sites, Collection, date,\n template='discoveraq-geos5das-PRODUCT_SITE_DATE_RA.1001.ict',\n outTopDir='./Archive',\n PI='DASILVA.ARLINDO',\n Verbose=False, Echo=False ):\n\n # Interpolate Data to site location\n # -------------------... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sample all collections on this date, and write ICARTT files for all sites. Use methods sample() and write() to perform these operations one collection at a time. Each ICARTT file will contain all the time steps available within the collection on this date. | def Sample_N_Write (self, date):
for c in self.Collections:
self.sample(c,date)
self.write() | [
"def write (self):\n if self.Verbose:\n print \"\"\n s = 0\n for site in self.Sites:\n _writeICARTT ( self.Sites[site], self.Collection, self.Table[:,:,s], self.date,\n self.template, self.outTopDir, self.PI, self.Verbose)\n s += 1",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Interpolate collection named coll_name on this date (a datetime object) to all sites. | def sample (self, coll_name, date):
self.Collection = self.Collections[coll_name]
self.date = date
self.Table = _getTable( self.Sites, self.Collection, date, Verbose=self.Verbose) | [
"def get_collection():\r\n collection = datetime.date.today()\r\n return __database.sensors[collection]",
"def refresh(self) -> None:\n self.checkDirectories()\n self.getCalInfo()\n self.getSiteInfo()\n # update start and end dates for the project\n startDates = []\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write ICARTT files for each individual site. You must use method sample() before doing a write(). | def write (self):
if self.Verbose:
print ""
s = 0
for site in self.Sites:
_writeICARTT ( self.Sites[site], self.Collection, self.Table[:,:,s], self.date,
self.template, self.outTopDir, self.PI, self.Verbose)
s += 1 | [
"def write(self,pages):\n\n\t\t# Write web pages\n\t\tfor page in pages:\t\n\t\t\tbuildfile = os.path.join(self.directory,page['name'])\n\t\t\twith open(buildfile, 'wb') as f: \n\t\t\t\tf.write(page['data'])",
"def Sample_N_Write (self, date):\n for c in self.Collections:\n self.sample(c,date)\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiate a G5_AIRCRAFT object given flight navigation information (in ICARTT file flight_ict) and a set of GEOS5 collections. On input, ict_flight ICARTT file name with navigation information coll_names list with names of GEOS5 collections to sample, e.g., inst1_2d_hwl_Nx inst3_2d_asm_Nx etc. If not specified, an in... | def __init__ (self, ict_flight,
coll_names = None,
coll_dir = './Collections',
top_url='http://opendap.nccs.nasa.gov:9090/dods/GEOS-5/fp/0.25_deg/assim',
template='discoveraq-geos5das-PRODUCT_SITE_DATE_RA.1001.ict',
outTopDir='./A... | [
"def __init__ (self, rc_Sites,\n coll_names = None,\n coll_dir = './Collections',\n top_url='http://opendap.nccs.nasa.gov:9090/dods/GEOS-5/fp/0.25_deg/assim',\n template='discoveraq-geos5das-PRODUCT_SITE_DATE_RA.1001.ict',\n outTop... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse collection resource file. rc_Collection resource file defining collection url url/filename for opening the collection | def _parseColl ( rc_Collection, name, url ):
cf = Config(rc_Collection)
Shorts = cf.keys()
del Shorts[Shorts.index('__TITLE__')]
Variables = {}
for short in Shorts:
long, units = cf(short).split(';')
units = units.replace(' ','').replace('1','none')
Variables[short] = dict(lo... | [
"def test_get_collection_from_file(self, source_collection):\n collection = Collection.from_file(source_collection)\n\n assert isinstance(collection, Collection)\n assert collection.description == 'BigEarthNet v1.0'",
"def get_collection(self):\n filename = op.join(op.dirname(__file__)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert gatime to datetime. | def _gatime2dt(gatime):
time, date = gatime.upper().split('Z')
if time.count(':') > 0:
h, m = time.split(":")
else:
h = time
m = '0'
mmm = date[-7:-4]
dd, yy = date.split(mmm)
mm = Months.index(mmm) + 1
dt = datetime(int(yy),int(mm),int(dd),int(h),int(m))
return d... | [
"def yeardec2datetime(atime):\n if isinstance(atime,(float,int)): #typically a float\n\n year = int(atime)\n remainder = atime - year\n boy = datetime(year, 1, 1)\n eoy = datetime(year + 1, 1, 1)\n seconds = remainder * (eoy - boy).total_seconds()\n\n return forceutc(boy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert datetime to grads time. | def _dt2gatime(t):
gatime = "%d:%dZ%d%s%d"%(t.hour,t.minute,t.day,Months[t.month-1],t.year)
return gatime | [
"def neat_time(dt):\r\n if dt.minute:\r\n timestring = dt.strftime('%I:%M%p')\r\n else:\r\n timestring = dt.strftime('%I%p')\r\n\r\n if timestring[0] == '0':\r\n timestring = timestring[1:]\r\n\r\n return timestring",
"def _get_time(self) -> datetime:\n return datetime.from... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate data table for ICARTT files with GEOS5 output. Data is returned at models discrete times, with only lat/lon interpolation. Sites a Sites dictionary (see _parseSites); | def _getTable ( Sites, Collection, when,
Ghosted=False,
AltVar='h', AltColl=None, zrange=None,
Verbose=False, Echo=False ):
# Type of Sites determin whether we are in aircraft mode or not
# -------------------------------------------------------------
if len(... | [
"def _g5_icartt ( Sites, Collection, date,\n template='discoveraq-geos5das-PRODUCT_SITE_DATE_RA.1001.ict',\n outTopDir='./Archive',\n PI='DASILVA.ARLINDO',\n Verbose=False, Echo=False ):\n\n # Interpolate Data to site location\n # -------------------... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Produces ICARTT files with GEOS5 output. filename grADS filename or OPeNDAP URL | def _g5_icartt ( Sites, Collection, date,
template='discoveraq-geos5das-PRODUCT_SITE_DATE_RA.1001.ict',
outTopDir='./Archive',
PI='DASILVA.ARLINDO',
Verbose=False, Echo=False ):
# Interpolate Data to site location
# -------------------------------... | [
"def main(extent_path, output_folder, overwrite_flag=False):\n logging.info('\\nDownload NED tiles')\n # site_url = 'rockyftp.cr.usgs.gov'\n site_url = 'https://prd-tnm.s3.amazonaws.com'\n\n # site_folder = 'vdelivery/Datasets/Staged/Elevation/1/IMG'\n site_folder = 'StagedProducts/Elevation/1/IMG'\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to handle the parsed paramInput for this class. @ In, paramInput, ParameterInput, the already parsed input. @ Out, None | def _handleInput(self, paramInput):
pass | [
"def _handleInput(self, paramInput, dimensionTags=None, dimTagsPrefix=None):",
"def _handleInput(self, paramInput, dimensionTags=None, dimTagsPrefix=None):\n self.grid.getrootnode().get(\"grid\")._handleInput(paramInput, dimensionTags, dimTagsPrefix)",
"def _localInputAndCheckParam(self,paramInput):\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Main method to "do what you do". @ In, datasets, tuple, tuple of datasets (data1,data2,etc.) to "validate" @ In, kwargs, dict, keyword arguments @ Out, None | def run(self, datasets, **kwargs):
return None | [
"def validate(args):\n if args.dataset_dir is None:\n error('Must select dataset with --dataset-dir')\n else:\n # Validation set must be given.\n validate_config.dataset = {\n 'dataset_dir': args.dataset_dir\n }\n # Checks and sets the ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility function to retrieve the data from datasets @ In, datasets, list, list of datasets (data1,data2,etc.) to search from. @ In, names, list, optional, list of datasets names (data1,data2,etc.). If not present, the search will be done on the full list. @ In, var, str, the variable to find (either in fromat dataobjec... | def _getDataFromDatasets(self, datasets, var, names=None):
data = None
pw = None
dat = None
if "|" in var and names is not None:
do, feat = var.split("|")
doindex = names.index(do)
dat = datasets[doindex][feat]
else:
for doindex, ds in enumerate(datasets):
if var in ... | [
"def combined_data ( sample ,\n varset , \n datasets ,\n name = '' ,\n title = '' ,\n args = () ) :\n \n labels = sample.labels()\n \n largs = [ ROOT.RooFit.Index ( sample ) ] \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Specialized to check if the message is in the same channel by the same author. | def reply_check(self, reply: discord.Message):
return reply.author.id == self.ctx.author.id and \
reply.channel.id == self.ctx.channel.id | [
"def _check_message(self, m: Message) -> bool:\n return (m.author == self.ctx.author\n and self.output.channel == m.channel)",
"def is_channel(message):\n try:\n # because 'message' argument is passed as a string without the @ sign, we\n # add this sign with .format()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Specialized to delete the reply on attempt. | async def on_reply_attempt(self, reply: discord.Message):
await reply.delete() | [
"def delete_request():",
"async def delete_original_response(self) -> None:\n adapter = async_context.get()\n http = self._state.http\n await adapter.delete_original_interaction_response(\n self.application_id,\n self.token,\n session=self._session,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An adapter to connect session components to a FastAPI instance. | def connect(
app: FastAPI,
secret: str,
signer: typing.Type[Fernet],
on_load_cookie: typing.Optional[
typing.Callable[[Request, str], typing.Awaitable[str]]
] = None,
settings: typing.Optional[typing.Type[SessionSettings]] = None,
backend_adapter_loader: typing.Optional[
typi... | [
"def new_session(api_url: Optional[str] = None) -> Session:\n sess = Session()\n sess.mount('http+api://', MetadataAPIAdapter(base_url=api_url))\n return sess",
"def session(self) -> 'TcSession': # noqa: F821\n if self._session is None:\n from .sessions import TcSession\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public method to get the attributes of a variable as a dictionary. var variable to be converted any dictionary containing the variable attributes dict | def getDictionary(self, var):
names = dir(var)
if not names and hasattr(var, "__members__"):
names = var.__members__
d = {}
for name in names:
try:
attribute = getattr(var, name)
d[name] = attribute
except Excep... | [
"def getDictionary(self, var):\n names = dir(var)\n if not names and hasattr(var, \"__members__\"):\n names = var.__members__\n \n d = {}\n for name in names:\n try:\n attribute = getattr(var, name)\n d[name] = attribute\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public method to get the attributes of a variable as a dictionary. var variable to be converted any dictionary containing the variable attributes dict | def getDictionary(self, var):
names = dir(var)
if not names and hasattr(var, "__members__"):
names = var.__members__
d = {}
for name in names:
try:
attribute = getattr(var, name)
d[name] = attribute
except Excep... | [
"def getDictionary(self, var):\n names = dir(var)\n if not names and hasattr(var, \"__members__\"):\n names = var.__members__\n \n d = {}\n for name in names:\n try:\n attribute = getattr(var, name)\n d[name] = attribute\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public method to get a string representation for a key. key key to be converted any string representation of the given key str | def keyToStr(self, key):
if isinstance(key, basestring):
key = repr(key)
# Special handling for Python2 unicode strings and bytes object
# Raw and f-Strings are always converted to (unicode) str
if key[0] in 'ub':
key = key[1:]
return key ... | [
"def key_str(self, key):\n res = ''\n tmp = binascii.hexlify(key)\n for i, x in enumerate(tmp):\n if i > 0 and i % 2 == 0:\n res += ':'\n res += x\n return res",
"def to_str(key):\r\n return (slice_to_str(key[0]), slice_to_str(key[1]))",
"def k... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public method to get an attribute from a variable. var variable to extract an attribute or value from tuple or list attribute name of the attribute to extract str value of the attribute any | def resolve(self, var, attribute):
try:
return var[int(attribute)]
except Exception:
return getattr(var, attribute, None) | [
"def resolve(self, var, attribute):\n if attribute.startswith(\"'ID: \"):\n attribute = attribute.split(None, 1)[1][:-1]\n try:\n attribute = int(attribute)\n except Exception:\n return getattr(var, attribute, None)\n\n for v in var:\n if id(v)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public method to get an attribute from a variable. var variable to extract an attribute or value from tuple or list attribute id of the value to extract str value of the attribute any | def resolve(self, var, attribute):
if attribute.startswith("'ID: "):
attribute = attribute.split(None, 1)[1][:-1]
try:
attribute = int(attribute)
except Exception:
return getattr(var, attribute, None)
for v in var:
if id(v) == attribute:
... | [
"def resolve(self, var, attribute):\n try:\n return var[int(attribute)]\n except Exception:\n return getattr(var, attribute, None)",
"def get_attribute(self, attr):\n return self.eval_script('node.getAttribute(\"{0}\")'.format(attr))",
"def attribute_get(self, attr):\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Private method to check, if an array is of a numeric type. arr array to check ndarray flag indicating a numeric array bool | def __isNumeric(self, arr):
try:
return arr.dtype.kind in 'biufc'
except AttributeError:
return False | [
"def is_numeric_dtype(obj):\n if isclass(obj):\n if issubclass(obj, cudf.core.dtypes.DecimalDtype):\n return True\n if issubclass(obj, _BaseDtype):\n return False\n else:\n if isinstance(\n obj,\n (cudf.Decimal128Dtype, cudf.Decimal64Dtype, cudf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public method to get the type information for an object. obj object to get type information for any tuple containing the type name, type string and resolver tuple of str, str, BaseResolver | def getType(obj):
typeObject = type(obj)
typeName = typeObject.__name__
# Between PyQt and PySide the returned type is different (class vs. type)
typeStr = str(typeObject).split(' ', 1)[-1]
typeStr = typeStr[1:-2]
if (typeStr.startswith(ConfigQtNames) and
typeStr.endswith(Config... | [
"def getTypeInfo():",
"def get_object_type(self):\n object_type = self.request_data[\"object\"][\"type\"]\n self.logger.debug('get_object_type: %s' % object_type)\n return object_type",
"def _object_resolution(self, object_to_resolve):\n # Below is the original comment that came with... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |