Unnamed: 0 int64 0 389k | code stringlengths 26 79.6k | docstring stringlengths 1 46.9k |
|---|---|---|
13,900 | def _clean_block(response_dict):
response_dict[] = parser.parse(response_dict[])
response_dict[] = parser.parse(response_dict[])
return response_dict | Pythonize a blockcypher API response |
13,901 | def get_locale_choices(locale_dir):
file_name_s = os.listdir(locale_dir)
choice_s = []
for file_name in file_name_s:
if file_name.endswith(I18n.TT_FILE_EXT_STXT):
file_name_noext, _ = os.path.splitext(file_name)
... | Get a list of locale file names in the given locale dir. |
13,902 | def itemComment(self, commentId):
url = "%s/comments/%s" % (self.root, commentId)
params = {
"f": "json"
}
return self._get(url,
params,
securityHandler=self._securityHandler,
proxy_p... | returns details of a single comment |
13,903 | def translate(self, content):
v = content.value
if v is None:
return
if isinstance(v, dict):
cls = content.real.name
content.value = Factory.object(cls, v)
md = content.value.__metadata__
md.sxtype = content.type
re... | Translate using the XSD type information.
Python I{dict} is translated to a suds object. Most
importantly, primative values are translated from python
types to XML types using the XSD type.
@param content: The content to translate.
@type content: L{Object}
@return: self
... |
13,904 | def analyze(self, handle, filename):
handle.seek(0)
try:
return self.jbx.submit_sample(handle)[][0]
except (jbxapi.JoeException, KeyError, IndexError) as e:
raise sandboxapi.SandboxError("error in analyze: {e}".format(e=e)) | Submit a file for analysis.
:type handle: File handle
:param handle: Handle to file to upload for analysis.
:type filename: str
:param filename: File name.
:rtype: str
:return: Task ID as a string |
13,905 | def AgregarBonificacionPenalizacion(self, codigo, detalle, resultado=None,
porcentaje=None, importe=None, **kwargs):
"Agrega la información referente a las bonificaciones o penalizaciones"
ret = dict(codBonificacionPenalizacion=codigo, detalle=detalle,
... | Agrega la información referente a las bonificaciones o penalizaciones |
13,906 | def read_dna(path):
filename, ext = os.path.splitext(os.path.split(path)[-1])
genbank_exts = [, ]
fasta_exts = [, , , ]
abi_exts = [, ]
if any([ext == extension for extension in genbank_exts]):
file_format =
elif any([ext == extension for extension in fasta_exts]):
file_f... | Read DNA from file. Uses BioPython and coerces to coral format.
:param path: Full path to input file.
:type path: str
:returns: DNA sequence.
:rtype: coral.DNA |
13,907 | def update_extent_location(self, extent_loc):
if not self._initialized:
raise pycdlibexception.PyCdlibInternalError()
self.extent_location = extent_loc | A method to update the extent location for this Path Table Record.
Parameters:
extent_loc - The new extent location.
Returns:
Nothing. |
13,908 | def flip(a, axis):
if not hasattr(a, ):
a = np.asarray(a)
indexer = [slice(None)] * a.ndim
try:
indexer[axis] = slice(None, None, -1)
except IndexError:
raise ValueError(
.format(axis, a.ndim))
return a[tuple(indexer)] | Reverse the order of elements in an array along the given axis.
This function is a backport of `numpy.flip` introduced in NumPy 1.12.
See Also
--------
numpy.flip |
13,909 | def clear(self):
self.prop_dt_map = dict()
self.prop_data = dict()
self.rev_lookup = defaultdict(set) | convinience function to empty this fastrun container |
13,910 | def delete(self, subject):
session = subject.get_session(False)
if (session):
session.remove_internal_attribute(self.dsc_ask)
session.remove_internal_attribute(self.dsc_isk) | :type subject: subject_abcs.Subject |
13,911 | def check_directories(self):
self.log.debug()
if not os.path.exists(self._ve_dir):
os.makedirs(self._ve_dir)
if not os.path.exists(self._app_dir):
os.makedirs(self._app_dir)
if not os.path.exists(self._conf_dir):
os.makedirs(self._conf_dir)
... | Creates base directories for app, virtualenv, and nginx |
13,912 | def clean_key(cls, key):
for var_re in cls.VARIABLE_RES:
key = var_re.sub(, key)
return key | Replace things that look like variables with a '#' so tests aren't affected by random variables |
13,913 | def register_periodic_tasks(self, tasks: Iterable[Task]):
for task in tasks:
self._scheduler.enter(
int(task.periodicity.total_seconds()),
0,
self._schedule_periodic_task,
argument=(task,)
) | Register tasks that need to be scheduled periodically. |
13,914 | def receive(self, decode=True):
payload = self.socket.recv()
payload = self.verify(payload)
if decode:
payload = self.decode(payload)
return payload | Receive from socket, authenticate and decode payload |
13,915 | def hline_score(self, y, xmin, xmax):
return self._hline_score[y, xmin, xmax] | Returns the number of unbroken paths of qubits
>>> [(x,y,0,k) for x in range(xmin,xmax+1)]
for :math:`k = 0,1,\cdots,L-1`. This is precomputed for speed. |
13,916 | def call_for_nodes(node, callback, recursive=False):
result = callback(node)
if recursive and not result:
for child in get_child_nodes(node):
call_for_nodes(child, callback, recursive) | If callback returns `True` the child nodes are skipped |
13,917 | def to_string(self, format_, fps=None, **kwargs):
fp = io.StringIO()
self.to_file(fp, format_, fps=fps, **kwargs)
return fp.getvalue() | Get subtitle file as a string.
See :meth:`SSAFile.save()` for full description.
Returns:
str |
13,918 | def lifting_condensation_level(T, RH):
Tadj = T-55.
return cp/g*(Tadj - (1/Tadj - log(RH)/2840.)**(-1)) | Compute the Lifiting Condensation Level (LCL) for a given temperature and relative humidity
Inputs: T is temperature in Kelvin
RH is relative humidity (dimensionless)
Output: LCL in meters
This is height (relative to parcel height) at which the parcel would become saturated during adiabatic ... |
13,919 | def set_columns(self, columns):
if isinstance(columns, tuple):
self.columns = columns
elif is_text_string(columns):
self.columns = tuple(int(e) for e in columns.split())
self.update() | Set edge line columns values. |
13,920 | def cmd():
parser = argparse.ArgumentParser()
in_group = parser.add_mutually_exclusive_group()
in_group.add_argument(, nargs=, default=[],
help=)
in_group.add_argument(, ,
help=)
parser.add_argument(, ,
help=)
args = parser.parse_arg... | Handler for command line invocation |
13,921 | def get_provider_info(self, user_descriptor):
route_values = {}
if user_descriptor is not None:
route_values[] = self._serialize.url(, user_descriptor, )
response = self._send(http_method=,
location_id=,
version=,
... | GetProviderInfo.
[Preview API]
:param str user_descriptor:
:rtype: :class:`<GraphProviderInfo> <azure.devops.v5_0.graph.models.GraphProviderInfo>` |
13,922 | def _num2deg(self, tile):
n = 2.0 ** tile.zoom
lon_deg = tile.x / n * 360.0 - 180.0
lat_rad = mod_math.atan(mod_math.sinh(mod_math.pi * (1 - 2 * tile.y / n)))
lat_deg = mod_math.degrees(lat_rad)
return (lat_deg, lon_deg) | Taken from http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python |
13,923 | def delete(self, **kwargs):
if self._dxid is not None:
return dxpy.api.app_delete(self._dxid, **kwargs)
else:
return dxpy.api.app_delete( + self._name, alias=self._alias, **kwargs) | Removes this app object from the platform.
The current user must be a developer of the app. |
13,924 | def unset_key(dotenv_path, key_to_unset, quote_mode="always"):
if not os.path.exists(dotenv_path):
warnings.warn("cant exist." % dotenv_path)
return None, key_to_unset
removed = False
with rewrite(dotenv_path) as (source, dest):
for mapping in parse_stream(source):
... | Removes a given key from the given .env
If the .env path given doesn't exist, fails
If the given key doesn't exist in the .env, fails |
13,925 | def _extract_file(self, tgz, tarinfo, dst_path, buffer_size=10<<20):
src = tgz.extractfile(tarinfo)
dst = tf_v1.gfile.GFile(dst_path, "wb")
while 1:
buf = src.read(buffer_size)
if not buf:
break
dst.write(buf)
self._log_progress(len(buf))
dst.close()
src.close() | Extracts 'tarinfo' from 'tgz' and writes to 'dst_path'. |
13,926 | def remove_all_annotations_from_tier(self, id_tier, clean=True):
for aid in self.tiers[id_tier][0]:
del(self.annotations[aid])
for aid in self.tiers[id_tier][1]:
del(self.annotations[aid])
self.tiers[id_tier][0].clear()
self.tiers[id_tier][1].clear()
... | remove all annotations from a tier
:param str id_tier: Name of the tier.
:raises KeyError: If the tier is non existent. |
13,927 | def _get_odoo_version_info(addons_dir, odoo_version_override=None):
odoo_version_info = None
addons = os.listdir(addons_dir)
for addon in addons:
addon_dir = os.path.join(addons_dir, addon)
if is_installable_addon(addon_dir):
manifest = read_manifest(addon_dir)
_... | Detect Odoo version from an addons directory |
13,928 | def clear_cached_realms(self, realms, params=None):
if realms in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument .")
return self.transport.perform_request(
"POST",
_make_path("_security", "realm", realms, "_clear_cache"),
... | `<https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html>`_
:arg realms: Comma-separated list of realms to clear
:arg usernames: Comma-separated list of usernames to clear from the
cache |
13,929 | def _get_transitions(self, probs, indexes, tree_idxs, batch_info, forward_steps=1, discount_factor=1.0):
if forward_steps > 1:
transition_arrays = self.backend.get_transitions_forward_steps(indexes, forward_steps, discount_factor)
else:
transition_arrays = self.backend.g... | Return batch of frames for given indexes |
13,930 | def content():
message = m.Message()
paragraph = m.Paragraph(
m.Image(
% resources_path()),
style_class=
)
message.add(paragraph)
paragraph = m.Paragraph(tr(
),
m.Image(
% resources_path(),
... | Helper method that returns just the content.
This method was added so that the text could be reused in the
dock_help module.
.. versionadded:: 4.1.0
:returns: A message object without brand element.
:rtype: safe.messaging.message.Message |
13,931 | def setup():
if None in [RTs._rt, RTs._rtp]:
RTs._rt = RefactoringTool(myfixes)
RTs._rtp = RefactoringTool(myfixes, {: True}) | Call this before using the refactoring tools to create them on demand
if needed. |
13,932 | def divmod_neg(a, b):
q, r = divmod(a, b)
sr = np.sign(r)
if np.abs(r) > b/2:
q += sr
r -= b * sr
return q, r | Return divmod with closest result to zero |
13,933 | def _update_ret(ret, goids, go2color):
if goids:
ret[].update(goids)
if go2color:
for goid, color in go2color.items():
ret[][goid] = color | Update 'GOs' and 'go2color' in dict with goids and go2color. |
13,934 | def expand_env_variables(lines_enum):
for line_number, line in lines_enum:
for env_var, var_name in ENV_VAR_RE.findall(line):
value = os.getenv(var_name)
if not value:
continue
line = line.replace(env_var, value)
yield line_number, line | Replace all environment variables that can be retrieved via `os.getenv`.
The only allowed format for environment variables defined in the
requirement file is `${MY_VARIABLE_1}` to ensure two things:
1. Strings that contain a `$` aren't accidentally (partially) expanded.
2. Ensure consistency across pl... |
13,935 | def format_info_response(value):
info = {}
for line in value.decode().splitlines():
if not line or line[0] == :
continue
if in line:
key, value = line.split(, 1)
info[key] = parse_info_value(value)
return info | Format the response from redis
:param str value: The return response from redis
:rtype: dict |
13,936 | def _lazy_load_units_by_code():
if UNITS_BY_CODE:
return
for unit in units.UNITS_BY_NAME.values():
UNITS_BY_CODE[unit.code] = unit | Populate dict of units by code iff UNITS_BY_CODE is empty. |
13,937 | def block(self, userId, minute):
desc = {
"name": "CodeSuccessReslut",
"desc": " http 成功返回结果",
"fields": [{
"name": "code",
"type": "Integer",
"desc": "返回码,200 为正常。"
}, {
"name": "errorMessa... | 封禁用户方法(每秒钟限 100 次) 方法
@param userId:用户 Id。(必传)
@param minute:封禁时长,单位为分钟,最大值为43200分钟。(必传)
@return code:返回码,200 为正常。
@return errorMessage:错误信息。 |
13,938 | def remove_context(self, name):
context = self.get_context(name)
contexts = self.get_contexts()
contexts.remove(context) | Remove a context from kubeconfig. |
13,939 | def explain(code, signals=SIGNALS):
if code not in signals:
raise NoSuchSignal(code)
signal, action, description = signals[code]
return {
: code,
: signal,
: action,
: description,
} | Explain what a given integer signal *code* does,
including it's signal name.
:param code: An integer signal.
:param signals: A database of signals. |
13,940 | def start_plugins(conf, watcher_plugin_class, health_plugin_class,
sleep_time):
watcher_plugin = watcher_plugin_class(conf)
watcher_plugin.start()
health_plugin = health_plugin_class(conf)
health_plugin.start()
return watcher_plugin, health_plug... | Start the working threads:
- Health monitor (the health plugin)
- Config change monitor (the watcher plugin) |
13,941 | def add_dictionary(self, dictionary):
if self.word_vectors is None:
raise Exception()
if len(dictionary) > self.word_vectors.shape[0]:
raise Exception(
)
self.dictionary = dictionary
if hasattr(self.dictionary, ):
... | Supply a word-id dictionary to allow similarity queries. |
13,942 | def complete_tags(arg):
search_string =
if arg is not None:
search_string += arg
res = Tag.search({
: ,
: ,
: search_string
})
ret = []
for t in res[]:
ret.append(t.name)
return ret | Complete NIPAP prefix type |
13,943 | def import_settings(self, filename):
if not os.path.isfile(filename):
self._logger.log(
,
.format(
filename
)
)
else:
with open(filename, ) as jsonFile:
data = json.load(json... | Import settings from a JSON file
Args:
filename (string): name of the file to import from |
13,944 | def _multicomplex2(f, fx, x, h):
n = len(x)
ee = np.diag(h)
hess = np.outer(h, h)
cmplx_wrap = Bicomplex.__array_wrap__
for i in range(n):
for j in range(i, n):
zph = Bicomplex(x + 1j * ee[i, :], ee[j, :])
hess[i, j] = cmplx_wr... | Calculate Hessian with Bicomplex-step derivative approximation |
13,945 | def run(command, num_retries=1, timeout=-1, **kwargs):
last_error = None
for _ in range(num_retries):
try:
process = Subprocess(command, **kwargs)
return process.run(timeout)
except Exception as err:
last_error = err
raise last_error | Run a command with optional timeout and retries.
Provides a convenience method for executing a subprocess with
additional error handling.
Arguments:
command (list of str): The command to execute.
num_retries (int, optional): If the subprocess fails, the number of
attempts to exec... |
13,946 | def _add_sequence(self, pdbID, chainID, sequence):
private
pdbID = pdbID.upper()
self[pdbID] = self.get(pdbID, {})
self[pdbID][chainID] = sequence
self.sequences.append((pdbID, chainID, sequence))
if not self.unique_sequences.get(sequence):
self.unique_sequenc... | This is a 'private' function. If you call it directly, call _find_identical_sequences() afterwards to update identical_sequences. |
13,947 | def delay(self, n, start_time):
if (n > self.max_retries or
(n > self.min_retries and
time.time() - start_time > self.max_retry_period)):
return -1
return min(
math.pow(self.backoff_factor, n-1) * self.initial_delay,
self.max_delay) | Calculate delay before the next retry.
Args:
n: the number of current attempt. The first attempt should be 1.
start_time: the time when retry started in unix time.
Returns:
Number of seconds to wait before next retry. -1 if retry should give up. |
13,948 | def print_factoids(input_dict, environment_dict):
dict_mark = input_dict
try:
command = dict_mark.keys()[0]
while dict_mark[command][] != :
dict_mark = dict_mark[command][]
command = dict_mark.keys()[0]
args = command
except IndexError:
raise seash_exceptions.... | <Purpose>
Used to print seash factoids when user uses 'show factoids'
command.
<Arguments>
input_dict: Input dictionary generated by seash_dictionary.parse_command().
environment_dict: Dictionary describing the current seash environment.
For more information, see command_callback... |
13,949 | def include_revision(revision_num, skip_factor=1.1):
if skip_factor <= 1.0:
return True
return (int(math.log1p(revision_num) / math.log(skip_factor)) != int(
math.log(revision_num + 2.0) / math.log(skip_factor))) | Decide whether to include a revision.
If the number of revisions is large, we exclude some revisions to avoid
a quadratic blowup in runtime, since the article is likely also large.
We make the ratio between consecutive included revision numbers
appproximately equal to "factor".
Args:
revision_num: an i... |
13,950 | def get_scheme(self):
scheme = Scheme("Github Repository Forks")
scheme.description = "Streams events giving the number of forks of a GitHub repository."
scheme.use_external_validation = True
scheme.use_sin... | When Splunk starts, it looks for all the modular inputs defined by
its configuration, and tries to run them with the argument --scheme.
Splunkd expects the modular inputs to print a description of the
input in XML on stdout. The modular input framework takes care of all
the details of fo... |
13,951 | def exists(self, relpath):
if self.isignored(self._append_slash_if_dir_path(relpath)):
return False
return self._exists_raw(relpath) | Returns True if path exists and is not ignored. |
13,952 | def get_option_help_info(self, args, kwargs):
display_args = []
scoped_cmd_line_args = []
unscoped_cmd_line_args = []
for arg in args:
is_short_arg = len(arg) == 2
unscoped_cmd_line_args.append(arg)
if self._scope_prefix:
scoped_arg = .format(self._scope_prefix, arg.lstri... | Returns an OptionHelpInfo for the option registered with the given (args, kwargs). |
13,953 | def main(args=None):
if args is None:
args = parse_args(sys.argv[1:])
if args.action == :
conf, doc = Config.example_config()
print(conf)
sys.stderr.write(doc + "\n")
return
if args.verbose > 1:
set_log_debug()
elif args.verbose == 1:... | Main entry point |
13,954 | def delete_entry_tag(sender, instance, **kwargs):
from ..models import (
Entry,
EntryTag
)
entry = Entry.objects.get_for_model(instance.content_object)[0]
tag = instance.tag
EntryTag.objects.filter(tag=tag, entry=entry).delete() | Deletes EntryTag for Entry corresponding to specified
TaggedItemBase instance.
:param sender: the sending TaggedItemBase class.
:param instance: the TaggedItemBase instance. |
13,955 | def resolve_sid(sid):
return d1_gmn.app.models.Chain.objects.get(sid__did=sid).head_pid.did | Get the PID to which the ``sid`` currently maps.
Preconditions:
- ``sid`` is verified to exist. E.g., with d1_gmn.app.views.asserts.is_sid(). |
13,956 | def iter_events(self, number=-1):
url = self._build_url(, base_url=self._api)
return self._iter(int(number), url, IssueEvent) | Iterate over events associated with this issue only.
:param int number: (optional), number of events to return. Default: -1
returns all events available.
:returns: generator of
:class:`IssueEvent <github3.issues.event.IssueEvent>`\ s |
13,957 | def _svgcolor(color):
return % tuple([int(255 * x) for x in [color.r, color.g, color.b]]) | Convert a PyChart color object to an SVG rgb() value.
See color.py. |
13,958 | def get_default_config_help(self):
config = super(StatsiteHandler, self).get_default_config_help()
config.update({
: ,
: ,
: ,
: ,
})
return config | Returns the help text for the configuration options for this handler |
13,959 | def initauth(self):
headers = {: + clam.common.data.VERSION}
if self.oauth:
if not self.oauth_access_token:
r = requests.get(self.url,headers=headers, verify=self.verify)
if r.status_code == 404:
raise clam.common.data.NotFound("A... | Initialise authentication, for internal use |
13,960 | def parse_expression(self, expr):
m = re.match(r, expr);
prefix = m.group(1)
tail = m.group(2)
return [prefix, tail] | split expression into prefix and expression
tested with
```
operator==
!=
std::rel_ops::operator!=
std::atomic::operator=
std::array::operator[]
std::function::operator()
std::vector::at
std::relation... |
13,961 | def filter_query(self, query, filter_info, model):
if filter_info:
filters = create_filters(model, filter_info, self.resource)
query = query.filter(*filters)
return query | Filter query according to jsonapi 1.0
:param Query query: sqlalchemy query to sort
:param filter_info: filter information
:type filter_info: dict or None
:param DeclarativeMeta model: an sqlalchemy model
:return Query: the sorted query |
13,962 | def _rc_dbsize(self):
"Returns the number of keys in the current database"
result = 0
for alias, redisent in iteritems(self.redises):
if alias.find() == -1:
continue
result += redisent.dbsize()
return result | Returns the number of keys in the current database |
13,963 | def _create_element_list_(self):
element_set = stoich.elements(self.compounds)
return sorted(list(element_set)) | Extract an alphabetically sorted list of elements from the compounds of
the material.
:returns: An alphabetically sorted list of elements. |
13,964 | def es_indexers(cls, base_class=None, role=, **kwargs):
def _prop_filter(prop, value, **kwargs):
try:
use_prop = len(set(value.owl_inverseOf) - parent_props) > 0
except AttributeError:
use_prop = True
if prop in nested_p... | Returns the es mapping for the class
args:
-----
base_class: The root class being indexed
role: the role states how the class should be mapped depending
upon whether it is used as a subject of an object. options
are es_Nested or rdf_class |
13,965 | async def del_alternative(self, alt, timeout=OTGW_DEFAULT_TIMEOUT):
cmd = OTGW_CMD_DEL_ALT
alt = int(alt)
if alt < 1 or alt > 255:
return None
ret = await self._wait_for_cmd(cmd, alt, timeout)
if ret is not None:
return int(ret) | Remove the specified Data-ID from the list of alternative
commands. Only one occurrence is deleted. If the Data-ID
appears multiple times in the list of alternative commands,
this command must be repeated to delete all occurrences. The
table of alternative Data-IDs is stored in non-volat... |
13,966 | def _next_radiotap_extpm(pkt, lst, cur, s):
if cur is None or (cur.present and cur.present.Ext):
st = len(lst) + (cur is not None)
return lambda *args: RadioTapExtendedPresenceMask(*args, index=st)
return None | Generates the next RadioTapExtendedPresenceMask |
13,967 | def all_tensorboard_jobs(self):
from db.models.tensorboards import TensorboardJob
return TensorboardJob.all.filter(project=self) | Similar to tensorboard_jobs,
but uses the default manager to return archived experiments as well. |
13,968 | def nest(*content):
if len(content) == 0:
raise ValueError()
return And([LPF, content[0]] + list(itt.chain.from_iterable(zip(itt.repeat(C), content[1:]))) + [RPF]) | Define a delimited list by enumerating each element of the list. |
13,969 | def list_qos_policies(self, retrieve_all=True, **_params):
return self.list(, self.qos_policies_path,
retrieve_all, **_params) | Fetches a list of all qos policies for a project. |
13,970 | def reload_components_ui(self):
selected_components = self.get_selected_components()
self.__engine.start_processing("Reloading Components ...", len(selected_components))
reload_failed_components = []
for component in selected_components:
if component.interface.deac... | Reloads user selected Components.
:return: Method success.
:rtype: bool
:note: May require user interaction. |
13,971 | def returner(ret):
_options = _get_options(ret)
if not _verify_options(_options):
return
level = getattr(syslog, _options[])
facility = getattr(syslog, _options[])
logoption = 0
for opt in _options[]:
logoption = logoption | getattr(syslog, opt)
if i... | Return data to the local syslog |
13,972 | def _dispatch(self, typ):
for can_handle, handler in self._handler_pairs:
try:
if can_handle(typ):
return handler
except Exception:
pass
raise KeyError("unable to find handler for ... | returns the appropriate handler, for the object passed. |
13,973 | def generate(env):
SCons.Tool.cc.generate(env)
env[] = env.Detect(compilers) or
if env[] in [, ]:
env[] = SCons.Util.CLVar()
else:
env[] = SCons.Util.CLVar()
if env[]:
pipe = SCons.Action._subproc(env, [env[], ],
stdin... | Add Builders and construction variables for clang to an Environment. |
13,974 | def switch_showfilter_icon(self, toggled):
at = QtCore.Qt.DownArrow if toggled else QtCore.Qt.RightArrow
self.showfilter_tb.setArrowType(at) | Switch the icon on the showfilter_tb
:param toggled: the state of the button
:type toggled: :class:`bool`
:returns: None
:rtype: None
:raises: None |
13,975 | def get_model(model_id):
assert_is_type(model_id, str)
model_json = api("GET /3/Models/%s" % model_id)["models"][0]
algo = model_json["algo"]
if algo == "svd": m = H2OSVD()
elif algo == "pca": m = H2OPrincipalComponentAnalysisEstimator()
elif algo == "drf": m = ... | Load a model from the server.
:param model_id: The model identification in H2O
:returns: Model object, a subclass of H2OEstimator |
13,976 | def _add_to_upload_queue(self, src, rfile, uid):
ud = blobxfer.models.upload.Descriptor(
src, rfile, uid, self._spec.options, self._general_options,
self._resume)
if ud.entity.is_encrypted:
with self._upload_lock:
se... | Add remote file to download queue
:param Uploader self: this
:param blobxfer.models.upload.LocalPath src: local path
:param blobxfer.models.azure.StorageEntity rfile: remote file
:param str uid: unique id |
13,977 | def query_feature():
args = get_args(
request_args=request.args,
allowed_str_args=[, , ],
allowed_int_args=[]
)
return jsonify(query.feature(**args)) | Returns list of sequence feature by query parameters
---
tags:
- Query functions
parameters:
- name: type_
in: query
type: string
required: false
description: Feature type
default: 'splice variant'
- name: identifier
in: query
typ... |
13,978 | def patch_namespaced_stateful_set_status(self, name, namespace, body, **kwargs):
kwargs[] = True
if kwargs.get():
return self.patch_namespaced_stateful_set_status_with_http_info(name, namespace, body, **kwargs)
else:
(data) = self.patch_namespaced_stateful_set_st... | partially update status of the specified StatefulSet
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.patch_namespaced_stateful_set_status(name, namespace, body, async_req=True)
>>> result = thread.... |
13,979 | def dump_t_coords(dataset_dir, data_dir, dataset, root=None, compress=True):
if root is None:
root = {}
tcoords = dataset.GetPointData().GetTCoords()
if tcoords:
dumped_array = dump_data_array(dataset_dir, data_dir, tcoords, {}, compress)
root[][] = len(root[][])
root[][... | dump vtkjs texture coordinates |
13,980 | def write(self, text):
sys.stdout.write("\r")
self._clear_line()
_text = to_unicode(text)
if PY2:
_text = _text.encode(ENCODING)
assert isinstance(_text, builtin_str)
sys.stdout.write("{0}\n".format(_text)) | Write text in the terminal without breaking the spinner. |
13,981 | def reliability_curve(self):
total = self.frequencies["Total_Freq"].sum()
curve = pd.DataFrame(columns=["Bin_Start", "Bin_End", "Bin_Center",
"Positive_Relative_Freq", "Total_Relative_Freq"])
curve["Bin_Start"] = self.thresholds[:-1]
curve["... | Calculates the reliability diagram statistics. The key columns are Bin_Start and Positive_Relative_Freq
Returns:
pandas.DataFrame |
13,982 | def store_async_result(async_id, async_result):
logging.debug("Storing result for %s", async_id)
key = FuriousAsyncMarker(
id=async_id, result=json.dumps(async_result.to_dict()),
status=async_result.status).put()
logging.debug("Setting Async result %s using marker: %s.", async_result... | Persist the Async's result to the datastore. |
13,983 | def add_bits4subtree_ids(self, relevant_ids):
if relevant_ids:
checking = True
else:
checking = False
relevant_ids = {}
bit = 1
self.bits2internal_node = {}
for node in self.postorder_node_iter():
p = node._parent
... | Adds a long integer bits4subtree_ids to each node (Fails cryptically if that field is already present!)
relevant_ids can be a dict of _id to bit representation.
If it is not supplied, a dict will be created by registering the leaf._id into a dict (and returning the dict)
the bits4subtree_ids wil... |
13,984 | def check_and_adjust_sighandler(self, signame, sigs):
signum = lookup_signum(signame)
try:
old_handler = signal.getsignal(signum)
except ValueError:
sigs[signame].old_handler = old_handler
pass
... | Check to see if a single signal handler that we are interested
in has changed or has not been set initially. On return
self.sigs[signame] should have our signal handler. True is
returned if the same or adjusted, False or None if error or
not found. |
13,985 | def tag(self, name, user, revision=None, message=None, date=None,
**kwargs):
if name in self.tags:
raise TagAlreadyExistError("Tag %s already exists" % name)
changeset = self.get_changeset(revision)
message = message or "Added tag %s for commit %s" % (name,
... | Creates and returns a tag for the given ``revision``.
:param name: name for new tag
:param user: full username, i.e.: "Joe Doe <joe.doe@example.com>"
:param revision: changeset id for which new tag would be created
:param message: message of the tag's commit
:param date: date of... |
13,986 | def repl():
while True:
try:
sys.stdout.write("Type in next query: \n> ")
import locale
query_str = raw_input().decode(sys.stdin.encoding or locale.getpreferredencoding(True))
except KeyboardInterrupt:
break
if u in query_str:
... | Read-Eval-Print-Loop for reading the query, printing it and its parse tree.
Exit the loop either with an interrupt or "quit". |
13,987 | def delete(self, group_id, session):
request = TOPRequest()
request[] = group_id
self.create(self.execute(request, session), fields=[,])
return self.is_success | taobao.crm.group.delete 删除分组
将该分组下的所有会员移除出该组,同时删除该分组。注:删除分组为异步任务,必须先调用taobao.crm.grouptask.check 确保涉及属性上没有任务。 |
13,988 | def get_config(key):
key = .format(key.upper())
local_config = current_app.config.get(key)
return local_config or getattr(theme.current, key, DEFAULTS[key]) | Get an identicon configuration parameter.
Precedance order is:
- application config (`udata.cfg`)
- theme config
- default |
13,989 | def is_all_field_none(self):
if self._id_ is not None:
return False
if self._created is not None:
return False
if self._updated is not None:
return False
if self._avatar is not None:
return False
if self._currency is n... | :rtype: bool |
13,990 | def get_return_elements(return_columns, namespace, subscript_dict):
capture_elements = list()
return_addresses = dict()
for col in return_columns:
if in col:
name, location = col.strip().split()
subs = [l.strip() for l in location.split()]
address = make_coo... | Takes a list of return elements formatted in vensim's format
Varname[Sub1, SUb2]
and returns first the model elements (in python safe language)
that need to be computed and collected, and secondly the addresses
that each element in the return columns list translates to
Parameters
----------
... |
13,991 | def create_rule_section(self, name, add_pos=None, after=None, before=None):
href = self.href
params = None
if add_pos is not None:
href = self.add_at_position(add_pos)
elif before or after:
params = self.add_before_after(before, after)
... | Create a rule section in a Firewall Policy. To specify a specific numbering
position for the rule section, use the `add_pos` field. If no position or
before/after is specified, the rule section will be placed at the top which
will encapsulate all rules below.
Create a rule section for th... |
13,992 | def from_url(location):
req = urllib.request.Request(location)
with urllib.request.urlopen(req) as response:
the_page = response.read().decode()
return the_page | HTTP request for page at location returned as string
malformed url returns ValueError
nonexistant IP returns URLError
wrong subnet IP return URLError
reachable IP, no HTTP server returns URLError
reachable IP, HTTP, wrong page returns HTTPError |
13,993 | def _check_file_exists_unix(self, remote_cmd=""):
if self.direction == "put":
self.ssh_ctl_chan._enter_shell()
remote_cmd = "ls {}".format(self.file_system)
remote_out = self.ssh_ctl_chan.send_command(
remote_cmd, expect_string=r"[\$
)
... | Check if the dest_file already exists on the file system (return boolean). |
13,994 | def get(self):
config = self.get_block()
if not config:
return None
response = dict()
response.update(self._parse_bgp_as(config))
response.update(self._parse_router_id(config))
response.update(self._parse_max_paths(config))
response.update(se... | Returns the bgp routing configuration as a dict object |
13,995 | def _get_sorting_message(request, key):
control_list = []
reverse = request.url.query.get(, None)
if reverse is None:
return control_list
if reverse.lower() == "":
control_list.append(client_list_control_pb2.ClientSortControls(
reverse=Tr... | Parses the reverse query into a list of ClientSortControls protobuf
messages. |
13,996 | def _get_filename(request, item):
if request.keep_image_names:
filename = OgcImageService.finalize_filename(item[].replace(, ))
else:
filename = OgcImageService.finalize_filename(
.join([str(GeopediaService._parse_layer(request.layer)), item[].rsplit(, 1)... | Creates a filename |
13,997 | def write_exports(self, exports):
rf = self.get_distinfo_file(EXPORTS_FILENAME)
with open(rf, ) as f:
write_exports(exports, f) | Write a dictionary of exports to a file in .ini format.
:param exports: A dictionary of exports, mapping an export category to
a list of :class:`ExportEntry` instances describing the
individual export entries. |
13,998 | def _ParseTokenType(self, file_object, file_offset):
token_type_map = self._GetDataTypeMap()
token_type, _ = self._ReadStructureFromFileObject(
file_object, file_offset, token_type_map)
return token_type | Parses a token type.
Args:
file_object (dfvfs.FileIO): file-like object.
file_offset (int): offset of the token relative to the start of
the file-like object.
Returns:
int: token type |
13,999 | def create_app(name, site, sourcepath, apppool=None):
*app0site0C:\\site0site0
current_apps = list_apps(site)
if name in current_apps:
log.debug(, name)
return True
if not os.path.isdir(sourcepath):
log.error(, sourcepath)
return False
ps_cmd = [,
... | Create an IIS application.
.. note::
This function only validates against the application name, and will
return True even if the application already exists with a different
configuration. It will not modify the configuration of an existing
application.
Args:
name (str)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.