text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def store(self, value, context=None):
"""
Converts the value to one that is safe to store on a record within
the record values dictionary
:param value | <variant>
:return <variant>
"""
if isinstance(value, (str, unicode)) and self.testFlag(self.Flags.En... | 0.006438 |
def set_value(self, var_name, value):
"""Set the value of a given variable to a given value.
Parameters
----------
var_name : str
The name of the variable in the model whose value should be set.
value : float
The value the variable should be set to
... | 0.003067 |
def get_container_details(self, container_id_or_name: str) -> dict:
"""Get details of a container.
Args:
container_id_or_name (string): docker container id or name
Returns:
dict, details of the container
"""
container = self._client.containers.get(conta... | 0.00545 |
def apply(self, samples, inverse=False):
"""Applies the sampling transforms to the given samples.
Parameters
----------
samples : dict or FieldArray
The samples to apply the transforms to.
inverse : bool, optional
Whether to apply the inverse transforms (... | 0.002899 |
def calc_translations_parallel(images):
"""Calculate image translations in parallel.
Parameters
----------
images : ImageCollection
Images as instance of ImageCollection.
Returns
-------
2d array, (ty, tx)
ty and tx is translation to previous image in respectively
x... | 0.00319 |
def find(self, name):
"""Search the field for a given attribute.
Args::
name attribute name
Returns::
if found, VDAttr instance describing the attribute
None otherwise
C library equivalent : VSfindattr
... | 0.003968 |
def parse_block_scalar_empty_line(indent_token_class, content_token_class):
"""Process an empty line in a block scalar."""
def callback(lexer, match, context):
text = match.group()
if (context.block_scalar_indent is None or
len(text) <= context.block_scalar_in... | 0.002466 |
def day_display(year, month, all_month_events, day):
"""
Returns the events that occur on the given day.
Works by getting all occurrences for the month, then drilling
down to only those occurring on the given day.
"""
# Get a dict with all of the events for the month
count = CountHandler(yea... | 0.001372 |
def _append_to_endog(endog, new_y):
"""Append to the endogenous array
Parameters
----------
endog : np.ndarray, shape=(n_samples, [1])
The existing endogenous array
new_y : np.ndarray, shape=(n_samples)
The new endogenous array to append
"""
return np.concatenate((endog, ne... | 0.002364 |
def vm_snapshot_delete(vm_name, kwargs=None, call=None):
'''
Deletes a virtual machine snapshot from the provided VM.
.. versionadded:: 2016.3.0
vm_name
The name of the VM from which to delete the snapshot.
snapshot_id
The ID of the snapshot to be deleted.
CLI Example:
.... | 0.001654 |
def _vowelinstem(self, stem):
"""vowelinstem(stem) is TRUE <=> stem contains a vowel"""
for i in range(len(stem)):
if not self._cons(stem, i):
return True
return False | 0.009132 |
def simplex(x, rho):
"""
Projection onto the probability simplex
http://arxiv.org/pdf/1309.1541v1.pdf
"""
# sort the elements in descending order
u = np.flipud(np.sort(x.ravel()))
lambdas = (1 - np.cumsum(u)) / (1. + np.arange(u.size))
ix = np.where(u + lambdas > 0)[0].max()
return... | 0.002849 |
def _set_mongodb_host_val(key, default, mongodb_host, mongodb_defaults):
"""
Set a value in a 'cascade' fashion for mongodb_host[key]
Within 'mongodb', as a last resort, its hardcoded default value is going to
be picked.
:param key: key name
:param default: default last resort value
:param... | 0.000978 |
def on_selection_changed(self):
""" Callback invoked one the selection has changed.
"""
d = self.declaration
selection = self.scene.selectedItems()
self._guards |= 0x01
try:
d.selected_items = [item.ref().declaration for item in selection
... | 0.007407 |
def _get_base(obj):
"""Unwrap decorators to retrieve the base object."""
if hasattr(obj, '__func__'):
obj = obj.__func__
elif isinstance(obj, property):
obj = obj.fget
elif isinstance(obj, (classmethod, staticmethod)):
# Fallback for Python < 2.7 back when no `__func__` attribute... | 0.002169 |
def _iter_config_files(self):
# type: () -> Iterable[Tuple[Kind, List[str]]]
"""Yields variant and configuration files associated with it.
This should be treated like items of a dictionary.
"""
# SMELL: Move the conditions out of this function
# environment variables ha... | 0.002641 |
def upload(self,
url,
method="POST",
file_path=None):
"""
:param url:
:type url: str
:param method:
:type method: str
:param file_path:
:type file_path: str
"""
if not os.path.exists(file_path):
... | 0.004617 |
def get_conn(host='', username=None, password=None, port=445):
'''
Get an SMB connection
'''
if HAS_IMPACKET and not HAS_SMBPROTOCOL:
salt.utils.versions.warn_until(
'Sodium',
'Support of impacket has been depricated and will be '
'removed in Sodium. Please in... | 0.001522 |
def define_saver(exclude=None):
"""Create a saver for the variables we want to checkpoint.
Args:
exclude: List of regexes to match variable names to exclude.
Returns:
Saver object.
"""
variables = []
exclude = exclude or []
exclude = [re.compile(regex) for regex in exclude]
for variable in tf.... | 0.016981 |
def top_pages_by_time_period(self, interval='day'):
"""
Get a breakdown of top pages per interval, i.e.
day url count
2014-01-01 /blog/ 11
2014-01-02 /blog/ 14
2014-01-03 /blog/ 9
"""
date_trunc = fn.date_trunc(interval, PageView.timesta... | 0.002813 |
def _mean_prediction(self, lmda, Y, scores, h, t_params):
""" Creates a h-step ahead mean prediction
Parameters
----------
lmda : np.array
The past predicted values
Y : np.array
The past data
scores : np.array
The past scores
... | 0.01 |
def hoverLeaveEvent(self, event):
"""
Processes the hovering information for this node.
:param event | <QHoverEvent>
"""
if self._hoverSpot:
if self._hoverSpot.hoverLeaveEvent(event):
self.update()
self._hoverSpot = None
... | 0.010846 |
def run_driz_img(img,chiplist,output_wcs,outwcs,template,paramDict,single,
num_in_prod,build,_versions,_numctx,_nplanes,chipIdxCopy,
_outsci,_outwht,_outctx,_hdrlist,wcsmap):
""" Perform the drizzle operation on a single image.
This is separated out from :py:func:`run_driz` so ... | 0.021526 |
def _compute_distance(self, rup, dists, C):
"""
Compute the distance function, equation (9):
"""
mref = 3.6
rref = 1.0
rval = np.sqrt(dists.rhypo ** 2 + C['h'] ** 2)
return (C['c1'] + C['c2'] * (rup.mag - mref)) *\
np.log10(rval / rref) + C['c3'] * (rv... | 0.006061 |
def create_issue(self,
title,
body=None,
assignee=None,
milestone=None,
labels=None):
"""Creates an issue on this repository.
:param str title: (required), title of the issue
:param str body... | 0.00536 |
def get_ctm(self):
"""Copies the scaled font’s font current transform matrix.
Note that the translation offsets ``(x0, y0)`` of the CTM
are ignored by :class:`ScaledFont`.
So, the matrix this method returns always has 0 as ``x0`` and ``y0``.
:returns: A new :class:`Matrix` obje... | 0.004124 |
def assert_estimator_equal(left, right, exclude=None, **kwargs):
"""Check that two Estimators are equal
Parameters
----------
left, right : Estimators
exclude : str or sequence of str
attributes to skip in the check
kwargs : dict
Passed through to the dask `assert_eq` method.
... | 0.00463 |
def _disable_encryption(self):
# () -> None
"""Enable encryption methods for ciphers that support them."""
self.encrypt = self._disabled_encrypt
self.decrypt = self._disabled_decrypt | 0.014019 |
def open_uri_cont(self, filespec, loader_cont_fn):
"""Download a URI (if necessary) and do some action on it.
If the file is already present (e.g. a file:// URI) then this
merely confirms that and invokes the continuation.
Parameters
----------
filespec : str
... | 0.001361 |
def p_switch_stmt(p):
"""
switch_stmt : SWITCH expr semi_opt case_list END_STMT
"""
def backpatch(expr, stmt):
if isinstance(stmt, node.if_stmt):
stmt.cond_expr.args[1] = expr
backpatch(expr, stmt.else_stmt)
backpatch(p[2], p[4])
p[0] = p[4] | 0.003344 |
def create_links(self):
"""Create links to installed scripts in the virtualenv's
bin directory to our bin directory.
"""
for link in self.list_exes():
print_pretty("<FG_BLUE>Creating link for {}...<END>".format(link))
os.symlink(link, path.join(ENV_BIN, path.base... | 0.006024 |
def _spin_up(self, images, duration):
"""Simulate the motors getting warmed up."""
total = 0
# pylint: disable=no-member
for image in images:
self.microbit.display.show(image)
time.sleep(0.05)
total += 0.05
if total >= duration:
... | 0.004425 |
def open(self, relpath):
"""Read a file out of the repository at a certain revision.
This is complicated because, unlike vanilla git cat-file, this follows symlinks in
the repo. If a symlink points outside repo, the file is read from the filesystem;
that's because presumably whoever put that symlink t... | 0.010139 |
def colored_map(text, cmap):
"""
Return colorized text. cmap is a dict mapping tokens to color options.
.. Example:
colored_key("foo bar", {bar: "green"})
colored_key("foo bar", {bar: {"color": "green", "on_color": "on_red"}})
"""
if not __ISON: return text
for key, v in cmap.i... | 0.00396 |
def set_stats(stats, value):
"""Updates the stats with the value passed in.
:param stats: :class: `dict`
:param value: :class: `int`
"""
stats["total_count"] += 1
stats["value"] += value
stats["average"] = stats["value"] / stats["total_count"]
# this is just a basic example and not the... | 0.001764 |
def _import_next_layer(self, proto, length=None, *, version=4, extension=False):
"""Import next layer extractor.
Positional arguments:
* proto -- str, next layer protocol name
* length -- int, valid (not padding) length
Keyword Arguments:
* version -- int, I... | 0.003158 |
def register_blueprint(self, blueprint):
'''
Register given blueprint on curren app.
This method is provided for using inside plugin's module-level
:func:`register_plugin` functions.
:param blueprint: blueprint object with plugin endpoints
:type blueprint: flask.Bluepri... | 0.004124 |
def add_mandates(self, representative, rep_json):
'''
Create mandates from rep data based on variant configuration
'''
# Mandate in country group for party constituency
if rep_json.get('parti_ratt_financier'):
constituency, _ = Constituency.objects.get_or_create(
... | 0.00138 |
def set_sparsemem(self, sparsemem):
"""
Enable/disable use of sparse memory
:param sparsemem: activate/deactivate sparsemem (boolean)
"""
if sparsemem:
flag = 1
else:
flag = 0
yield from self._hypervisor.send('vm set_sparse_mem "{name}" {... | 0.007576 |
def to_outer_join_sql(self, orig_where = []):
"""
Construct a SQL query that includes all groups that would have
existed (exists in the orig_where clause) if the WHERE clause were not present
"""
if not self.group:
return str(self)
select = str(self.select)
fr = ','.join(self.fr)
... | 0.015945 |
def _init_entry_points(self, entry_points):
"""
Default initialization loop.
"""
logger.debug(
"registering %d entry points for registry '%s'",
len(entry_points), self.registry_name,
)
for entry_point in entry_points:
try:
... | 0.002008 |
async def get_track(self, spotify_id: str) -> Track:
"""Retrive an track with a spotify ID.
Parameters
----------
spotify_id : str
The ID to search for.
Returns
-------
track : Track
The track from the ID
"""
data = await ... | 0.005168 |
def linecol_to_pos(text, line, col):
"""Return the offset of this line and column in text.
Lines are one-based, columns zero-based.
This is how Jedi wants it. Don't ask me why.
"""
nth_newline_offset = 0
for i in range(line - 1):
new_offset = text.find("\n", nth_newline_offset)
... | 0.001456 |
def _get_config(self):
'''Reads the config file from disk or creates a new one.'''
filename = '{}/{}'.format(self.PLUGIN_LOGDIR, CONFIG_FILENAME)
modified_time = os.path.getmtime(filename)
if modified_time != self.config_last_modified_time:
config = read_pickle(filename, default=self.previous_con... | 0.008403 |
async def restrict(self, user_id: base.Integer,
until_date: typing.Union[base.Integer, None] = None,
can_send_messages: typing.Union[base.Boolean, None] = None,
can_send_media_messages: typing.Union[base.Boolean, None] = None,
c... | 0.008867 |
def monitored(name, device_class=None, collector='localhost', prod_state=None):
'''
Ensure a device is monitored. The 'name' given will be used for Zenoss device name and should be resolvable.
.. code-block:: yaml
enable_monitoring:
zenoss.monitored:
- name: web01.example.com... | 0.003271 |
def read_until_yieldable(self):
"""Read in additional chunks until it is yieldable."""
while not self.yieldable():
read_content, read_position = _get_next_chunk(self.fp, self.read_position, self.chunk_size)
self.add_to_buffer(read_content, read_position) | 0.010204 |
def authorize_url(self, state=None):
'''
Generate authorize_url.
>>> GitHub(client_id='3ebf94c5776d565bcf75').authorize_url()
'https://github.com/login/oauth/authorize?client_id=3ebf94c5776d565bcf75'
'''
if not self._client_id:
raise ApiAuthError('No client i... | 0.004644 |
def piper(self, in_sock, out_sock, out_addr, onkill):
"Worker thread for data reading"
try:
while True:
written = in_sock.recv(32768)
if not written:
try:
out_sock.shutdown(socket.SHUT_WR)
except ... | 0.003091 |
def locale(self, value):
"""Set current locale."""
if not isinstance(value, Locale):
value = Locale.parse(value)
self.local.babel_locale = value | 0.011111 |
def files(self):
"""Yields archive file information."""
# try new file header format first, then fallback on old
for header in (r"(.*)\t\[\[\[1\n", r"^(\d+)\n$"):
header = re.compile(header)
filename = None
self.fd.seek(0)
line = self.readline()
... | 0.002328 |
def _on_write_request(self, request):
"""Callback function called when a write request has been received.
It is executed in the baBLE working thread: should not be blocking.
Args:
request (dict): Information about the request
- connection_handle (int): The connection h... | 0.001361 |
def user_disable_throw_rest_endpoint(self, username, url='rest/scriptrunner/latest/custom/disableUser',
param='userName'):
"""The disable method throw own rest enpoint"""
url = "{}?{}={}".format(url, param, username)
return self.get(path=url) | 0.013029 |
def transition(self, data, year):
"""
Add or remove rows to/from a table according to the prescribed
growth rate for this model.
Parameters
----------
data : pandas.DataFrame
Rows will be removed from or added to this table.
year : None, optional
... | 0.003063 |
def getCalculationDependencies(self, flat=False, deps=None):
""" Recursively calculates all dependencies of this calculation.
The return value is dictionary of dictionaries (of dictionaries...)
{service_UID1:
{service_UID2:
{service_UID3: {},
... | 0.002275 |
def options_from_form(self, formdata):
"""get the option selected by the user on the form
This only constructs the user_options dict,
it should not actually load any options.
That is done later in `.load_user_options()`
Args:
formdata: user selection returned by the... | 0.003774 |
def write(self, settings=None):
"""
Save the current configuration to its file (as given by :code:`self._config_file`).
Optionally, settings may be passed in to override the current settings before
writing. Returns :code:`None` if the file could not be written to, either due to
p... | 0.007519 |
def urlretrieve(self, url, filename=None, method='GET', body=None, dir=None, **kwargs):
"""
Save result of a request to a file, similarly to
:func:`urllib.urlretrieve`.
If an error is encountered may raise any of the scrapelib
`exceptions`_.
A filename may be provided o... | 0.003571 |
def next(self):
"""
Reads the next dataset row.
:return: the next row
:rtype: Instance
"""
if not self.__has_more():
raise StopIteration()
else:
return javabridge.get_env().get_string(self.__next()) | 0.007168 |
def find_python():
"""Search for Python automatically"""
python = (
_state.get("pythonExecutable") or
# Support for multiple executables.
next((
exe for exe in
os.getenv("PYBLISH_QML_PYTHON_EXECUTABLE", "").split(os.pathsep)
if os.path.isfile(exe)), N... | 0.001764 |
def loadBatch(self, records):
"""
Loads the records for this instance in a batched mode.
"""
try:
curr_batch = records[:self.batchSize()]
next_batch = records[self.batchSize():]
curr_records = list(curr_batch)
if self.... | 0.006818 |
def add_to_user(self, name, **attrs):
"""Add attributes to a user.
"""
user = self.get_user(name=name)
attrs_ = user['user']
attrs_.update(**attrs) | 0.010695 |
def label_for(self, name):
'''Get a human readable label for a method given its name'''
method = getattr(self, name)
if method.__doc__ and method.__doc__.strip():
return method.__doc__.strip().splitlines()[0]
return humanize(name.replace(self._prefix, '')) | 0.006667 |
def calc(pvalues, lamb):
""" meaning pvalues presorted i descending order"""
m = len(pvalues)
pi0 = (pvalues > lamb).sum() / ((1 - lamb)*m)
pFDR = np.ones(m)
print("pFDR y Pr fastPow")
for i in range(m):
y = pvalues[i]
Pr = max(1, m - i) / float(m)
pFDR[i]... | 0.002016 |
def get(self,
key: Text,
count: Optional[int]=None,
formatter: Formatter=None,
locale: Text=None,
params: Optional[Dict[Text, Any]]=None,
flags: Optional[Flags]=None) -> List[Text]:
"""
Get the appropriate translation given the spec... | 0.011236 |
def format_short_title(self, format='html5', deparagraph=True,
mathjax=False, smart=True, extra_args=None):
"""Get the document short title in the specified markup format.
Parameters
----------
format : `str`, optional
Output format (such as ``'htm... | 0.002358 |
def remove_member(self, user_lookup_attribute_value):
""" Attempts to remove a member from the AD group.
:param user_lookup_attribute_value: The value for the LDAP_GROUPS_USER_LOOKUP_ATTRIBUTE.
:type user_lookup_attribute_value: str
:raises: **AccountDoesNotExist** if the provide... | 0.008439 |
def threshold(requestContext, value, label=None, color=None):
"""
Takes a float F, followed by a label (in double quotes) and a color.
(See ``bgcolor`` in the render\_api_ for valid color names & formats.)
Draws a horizontal line at value F across the graph.
Example::
&target=threshold(12... | 0.003914 |
def serialize_value_map(self, map_elem, thedict):
"""
Serializes a dictionary of key/value pairs, where the values are
either strings, or Attrib, or PathAttrib objects.
Example::
<variable>
<name>foo</name>
<value>text</value>
</v... | 0.002491 |
def make_csv_tables(self):
"""
Builds the report as a list of csv tables with titles.
"""
logger.info('Generate csv report tables')
report_parts = []
for sr in self.subreports:
for data_item in sr.report_data:
report_parts.append(TextPart(fmt='... | 0.007792 |
def banner(*lines, **kwargs):
"""prints a banner
sep -- string -- the character that will be on the line on the top and bottom
and before any of the lines, defaults to *
count -- integer -- the line width, defaults to 80
"""
sep = kwargs.get("sep", "*")
count = kwargs.get("width", globa... | 0.003992 |
def _get_char_pixels(self, s):
"""
Internal. Safeguards the character indexed dictionary for the
show_message function below
"""
if len(s) == 1 and s in self._text_dict.keys():
return list(self._text_dict[s])
else:
return list(self._text_dict['?']... | 0.006231 |
def grad_global_norm(parameters, max_norm):
"""Calculate the 2-norm of gradients of parameters, and how much they should be scaled down
such that their 2-norm does not exceed `max_norm`.
If gradients exist for more than one context for a parameter, user needs to explicitly call
``trainer.allreduce_grad... | 0.002608 |
def setup_data_model(config, raml_resource, model_name):
""" Setup storage/data model and return generated model class.
Process follows these steps:
* Resource schema is found and restructured by `resource_schema`.
* Model class is generated from properties dict using util function
`generat... | 0.001049 |
def get_target_forums_for_moved_topics(self, user):
""" Returns a list of forums in which the considered user can add topics that have been
moved from another forum.
"""
return [f for f in self._get_forums_for_user(user, ['can_move_topics', ]) if f.is_forum] | 0.013605 |
def hmcorrelation(sites_or_distances, imt, uncertainty_multiplier=0):
"""
Returns the Heresi-Miranda correlation model.
:param sites_or_distances:
SiteCollection instance o distance matrix
:param imt:
Intensity Measure Type (PGA or SA)
:param uncertainty_multiplier:
Value to... | 0.000822 |
def load_driftbif(n, l, m=2, classification=True, kappa_3=0.3, seed=False):
"""
Simulates n time-series with l time steps each for the m-dimensional velocity of a dissipative soliton
classification=True:
target 0 means tau<=1/0.3, Dissipative Soliton with Brownian motion (purely noise driven)
targe... | 0.004829 |
def date_added(self, date_added):
"""
Updates the security labels date_added
Args:
date_added: Converted to %Y-%m-%dT%H:%M:%SZ date format
"""
date_added = self._utils.format_datetime(date_added, date_format='%Y-%m-%dT%H:%M:%SZ')
self._data['dateAdded'] = da... | 0.006329 |
def delete_namespaced_limit_range(self, name, namespace, **kwargs):
"""
delete a LimitRange
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_namespaced_limit_range(name, namespace, as... | 0.003864 |
def remove_members_in_score_range_in(
self, leaderboard_name, min_score, max_score):
'''
Remove members from the named leaderboard in a given score range.
@param leaderboard_name [String] Name of the leaderboard.
@param min_score [float] Minimum score.
@param max_sco... | 0.004158 |
def combine_parallel_data(self, aliases=None):
"""Combine a number of data files together.
Treat `self.filename` as a file prefix, and combine the data from all
of the data files starting with that prefix plus a dot.
If `aliases` is provided, it's a `PathAliases` object that is used to... | 0.001717 |
def get_urls(self):
"""Add our dashboard view to the admin urlconf. Deleted the default index."""
from django.conf.urls import patterns, url
from views import DashboardWelcomeView
urls = super(AdminMixin, self).get_urls()
del urls[0]
custom_url = patterns(
''... | 0.008869 |
def _update_positions(self):
"""
updates the positions of the colorbars and labels
"""
self._colorbar.pos = self._pos
self._border.pos = self._pos
if self._orientation == "right" or self._orientation == "left":
self._label.rotation = -90
x, y = self... | 0.00122 |
def create(parameter_names, parameter_types, return_type):
"""Returns a signature object ensuring order of parameter names and types.
:param parameter_names: A list of ordered parameter names
:type parameter_names: list[str]
:param parameter_types: A dictionary of parameter names to typ... | 0.006192 |
def send(self, target, nick, msg, msgtype, ignore_length=False, filters=None):
"""Send a message.
Records the message in the log.
"""
if not isinstance(msg, str):
raise Exception("Trying to send a %s to irc, only strings allowed." % type(msg).__name__)
if filters is... | 0.002737 |
def Boyko_Kruzhilin(m, rhog, rhol, kl, mul, Cpl, D, x):
r'''Calculates heat transfer coefficient for condensation
of a pure chemical inside a vertical tube or tube bundle, as presented in
[2]_ according to [1]_.
.. math::
h_f = h_{LO}\left[1 + x\left(\frac{\rho_L}{\rho_G} - 1\right)\right]^{0.5... | 0.001026 |
def resolve(self, method, path):
"""Resolve a request to a route handler.
Arguments:
method (str): HTTP method, e.g. GET, POST, etc. (type: str)
path (str): Request path
Returns:
tuple or None: A tuple of three items:
1. Route handler (callable)
... | 0.003003 |
def clone(self):
""" This method clones AttributeMap object.
Returns AttributeMap object that has the same values with the
original one.
"""
cloned_filters = [f.clone() for f in self.filters]
return self.__class__(cloned_filters, self.attr_type, self.attr_value) | 0.00641 |
def copy(self):
"""
Returns a copy of the state.
"""
if self._global_condition is not None:
raise SimStateError("global condition was not cleared before state.copy().")
c_plugins = self._copy_plugins()
state = SimState(project=self.project, arch=self.arch, p... | 0.005369 |
def typed_node_from_id(id: str) -> TypedNode:
"""
Get typed node from id
:param id: id as curie
:return: TypedNode object
"""
filter_out_types = [
'cliqueLeader',
'Class',
'Node',
'Individual',
'quality',
'sequence feature'
]
node = next(g... | 0.004405 |
def kill(self):
"""
Delete my persistent file (i.e. pickle file), if it exists.
"""
if os.path.isfile(self.filename):
os.remove(self.filename)
return | 0.00995 |
def convert_values(self, matchdict: Dict[str, str]) -> Dict[str, Any]:
""" convert values of ``matchdict``
with converter this object has."""
converted = {}
for varname, value in matchdict.items():
converter = self.converters[varname]
converted[varname] = convert... | 0.00565 |
def make_three_color(self, upper_percentile=100, lower_percentile=0):
"""
Load the configured input channel images and create a three color image
:param upper_percentile: pixels above this percentile are suppressed
:param lower_percentile: pixels below this percentile are suppressed
... | 0.005942 |
def log_env_info():
"""
Prints information about execution environment.
"""
logging.info('Collecting environment information...')
env_info = torch.utils.collect_env.get_pretty_env_info()
logging.info(f'{env_info}') | 0.004202 |
def do_disable_unsol(self, line):
"""Perform the function DISABLE_UNSOLICITED. Command syntax is: disable_unsol"""
headers = [opendnp3.Header().AllObjects(60, 2),
opendnp3.Header().AllObjects(60, 3),
opendnp3.Header().AllObjects(60, 4)]
self.application.mast... | 0.008475 |
def _get_ancestors_of(self, obs_nodes_list):
"""
Returns a list of all ancestors of all the observed nodes.
Parameters
----------
obs_nodes_list: string, list-type
name of all the observed nodes
"""
if not obs_nodes_list:
return set()
... | 0.005348 |
def cmd_status(args):
'''show status'''
if len(args) == 0:
mpstate.status.show(sys.stdout, pattern=None)
else:
for pattern in args:
mpstate.status.show(sys.stdout, pattern=pattern) | 0.004545 |
def _process_custom_unitary(self, node):
"""Process a custom unitary node."""
name = node.name
if node.arguments is not None:
args = self._process_node(node.arguments)
else:
args = []
bits = [self._process_bit_id(node_element)
for node_elem... | 0.002055 |
def pformat(arg, width=79, height=24, compact=True):
"""Return pretty formatted representation of object as string.
Whitespace might be altered.
"""
if height is None or height < 1:
height = 1024
if width is None or width < 1:
width = 256
npopt = numpy.get_printoptions()
n... | 0.000662 |
def resolve_function(self):
"""Resolve the selenium function that will be use to find the element
"""
selector_type = self._effective_selector_type
# NAME
if selector_type == 'name':
return ('find_elements_by_name', 'NAME')
# XPATH
elif selector_type... | 0.001748 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.