text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def complete_rule(rule, cmd):
'''complete using one rule'''
global rline_mpstate
rule_components = rule.split(' ')
# complete the empty string (e.g "graph <TAB><TAB>")
if len(cmd) == 0:
return rule_expand(rule_components[0], "")
# check it matches so far
for i in range(len(cmd)-1)... | 0.001919 |
def fetch(self, category=CATEGORY_EVENT, from_date=DEFAULT_DATETIME, to_date=None,
filter_classified=False):
"""Fetch the events from the server.
This method fetches those events of a group stored on the server
that were updated since the given date. Data comments and rsvps
... | 0.004897 |
def show_error_dialog(message: str, details: str=None):
"""
Convenience method for showing an error dialog.
"""
# TODO: i18n
message_box = QMessageBox(
QMessageBox.Critical,
"Error",
message,
QMessageBox.Ok,
None
... | 0.009547 |
def from_pycode(cls, co):
"""Create a Code object from a python code object.
Parameters
----------
co : CodeType
The python code object.
Returns
-------
code : Code
The codetransformer Code object.
"""
# Make it sparse to ... | 0.000703 |
def add_new_reset_method(obj):
"""
Attach a new `reset()` method to `obj` which resets the internal
seed generator of `obj` and then resets each of its constituent
field generators found in `obj.field_gens`.
"""
#
# Create and assign automatically generated reset() method
#
def ne... | 0.002725 |
def get_identities(self, identity=None, attrs=None):
""" Get identities matching name and attrs
of the user, as a list
:param: zobjects.Identity or identity name (string)
:param: attrs dict of attributes to return only identities matching
:returns: list of zobjects.Identity
... | 0.001296 |
def disable(self):
"""
Disable the button, if in non-expert mode.
"""
w.ActButton.disable(self)
g = get_root(self).globals
if self._expert:
self.config(bg=g.COL['start'])
else:
self.config(bg=g.COL['startD']) | 0.006944 |
def qos_map_cos_traffic_class_cos5(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
qos = ET.SubElement(config, "qos", xmlns="urn:brocade.com:mgmt:brocade-qos")
map = ET.SubElement(qos, "map")
cos_traffic_class = ET.SubElement(map, "cos-traffic-cl... | 0.004886 |
def descape(self, string, defs=None):
"""Decodes html entities from a given string"""
if defs is None:
defs = html_entities.entitydefs
f = lambda m: defs[m.group(1)] if len(m.groups()) > 0 else m.group(0)
return self.html_entity_re.sub(f, string) | 0.010345 |
def all_label_values(self, label_list_ids=None):
"""
Return a set of all label-values occurring in this corpus.
Args:
label_list_ids (list): If not None, only labels from label-lists with an id contained in this list
are considered.
Return... | 0.006849 |
def configure_modrpaf(self):
"""
Installs the mod-rpaf Apache module.
https://github.com/gnif/mod_rpaf
"""
r = self.local_renderer
if r.env.modrpaf_enabled:
self.install_packages()
self.enable_mod('rpaf')
else:
if self.last_man... | 0.005168 |
def _get_new_msgstrs(po_file_path, msgids):
"""
Write new msgids which appeared in po files with empty msgstrs values
and metadata. Look for all new msgids which are diffed with msgids list
provided as an argument.
"""
po_file = polib.pofile(po_file_path)
msgstrs = {}
for entry in po_f... | 0.002326 |
def drop_reserved_params(params):
""" Drops reserved params """
from nefertari import RESERVED_PARAMS
params = params.copy()
for reserved_param in RESERVED_PARAMS:
if reserved_param in params:
params.pop(reserved_param)
return params | 0.003663 |
def verify(self, windowSize=None):
"""Verify that this protocol model is valid. Return 0 if sucessful,
a failure message otherwise
:param windowSize: acquistion window size (seconds), to check against duration, check is not performed is None provided
:type windowSize: float
:ret... | 0.004138 |
def Validate(self, value, **_):
"""Check that value is a valid enum."""
if value is None:
return
return rdfvalue.RDFBool(super(ProtoBoolean, self).Validate(value)) | 0.010989 |
def get_repo_info(repo_name, profile='github', ignore_cache=False):
'''
Return information for a given repo.
.. versionadded:: 2016.11.0
repo_name
The name of the repository.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. co... | 0.001302 |
def _instruction_to_superop(cls, instruction):
"""Convert a QuantumCircuit or Instruction to a SuperOp."""
# Convert circuit to an instruction
if isinstance(instruction, QuantumCircuit):
instruction = instruction.to_instruction()
# Initialize an identity superoperator of the ... | 0.004193 |
def make_func_declaration(func_name, lineno, type_=None):
""" This will return a node with the symbol as a function.
"""
return symbols.FUNCDECL.make_node(func_name, lineno, type_=type_) | 0.005051 |
def account_unpin(self, id):
"""
Unpin / un-endorse a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/unpin'.format(str(id))
return self.__api_request('POST', url) | 0.009494 |
def _get_merge_rules(properties, path=None):
"""
Yields merge rules as key-value pairs, in which the first element is a JSON path as a tuple, and the second element
is a list of merge properties whose values are `true`.
"""
if path is None:
path = ()
for key, value in properties.items()... | 0.00487 |
def convert_random_normal(node, **kwargs):
"""Map MXNet's random_normal operator attributes to onnx's RandomNormal
operator and return the created node.
"""
name, input_nodes, attrs = get_inputs(node, kwargs)
# Converting to float32
mean = float(attrs.get("loc", 0))
scale = float(attrs.get(... | 0.002841 |
def decode(data):
"Decodes a syncsafe integer"
value = 0
for b in data:
if b > 127: # iTunes bug
raise ValueError("Invalid syncsafe integer")
value <<= 7
value += b
return value | 0.007634 |
def before_request(self, request, method, url, headers):
"""Performs credential-specific before request logic.
Args:
request (Any): Unused. JWT credentials do not need to make an
HTTP request to refresh.
method (str): The request's HTTP method.
url (s... | 0.002275 |
def default(self, line):
"""Overriding default to get access to any argparse commands we have specified."""
if any((line.startswith(x) for x in self.argparse_names())):
try:
args = self.argparser.parse_args(shlex.split(line))
except Exception: # intentionally ca... | 0.008316 |
def _match_by_norm_func(l1, l2, norm_fn, dist_fn, thresh):
"""Matches elements in l1 and l2 using normalization functions.
Splits the elements in each list into buckets given by the normalization
function. If the same normalization value points to a bucket from the
first list and a bucket from the seco... | 0.000426 |
def whitespace_before_comment(logical_line, tokens):
r"""Separate inline comments by at least two spaces.
An inline comment is a comment on the same line as a statement. Inline
comments should be separated by at least two spaces from the statement.
They should start with a # and a single space.
E... | 0.00057 |
def getGroup(self, networkId, groupNodeId, verbose=None):
"""
Returns the group specified by the `groupNodeId` and `networkId` parameters.
:param networkId: SUID of the Network
:param groupNodeId: SUID of the Node representing the Group
:param verbose: print more
:retur... | 0.009381 |
def generate_sha1(string, salt=None):
"""
Generates a sha1 hash for supplied string. Doesn't need to be very secure
because it's not used for password checking. We got Django for that.
:param string:
The string that needs to be encrypted.
:param salt:
Optionally define your own sal... | 0.004622 |
def get_current_client(self):
"""Return the currently selected notebook."""
try:
client = self.tabwidget.currentWidget()
except AttributeError:
client = None
if client is not None:
return client | 0.007435 |
def _transpile_circuit(circuit_config_tuple):
"""Select a PassManager and run a single circuit through it.
Args:
circuit_config_tuple (tuple):
circuit (QuantumCircuit): circuit to transpile
transpile_config (TranspileConfig): configuration dictating how to transpile
Returns... | 0.002799 |
def boxplot(neurons, feature, new_fig=True, subplot=False):
'''
Plot a histogram of the selected feature for the population of neurons.
Plots x-axis versus y-axis on a scatter|histogram|binned values plot.
More information about the plot and how it works.
Parameters
----------
neurons : li... | 0.001124 |
def double_centre(matrix, square_input=True):
""" Double-centres the input matrix: From each element: Subtract the row
mean Subtract the column mean Add the grand mean Divide by -2 Method
from: Torgerson, W S (1952). Multidimensional scaling: I. Theory and
method. Alternatively M = -0.5 * (I - 1/n)D[^2]... | 0.001647 |
def clearView(self, fillColor = 0 ):
"""!
\~english
Clear up canvas with view size
@param fillColor: a color value
@note
The fillColor value range depends on the setting of _buffer_color_mode.
* If it is SS_COLOR_MODE_MONO ("1") monochrome mode, it can on... | 0.017284 |
def jhk_to_sdssr(jmag,hmag,kmag):
'''Converts given J, H, Ks mags to an SDSS r magnitude value.
Parameters
----------
jmag,hmag,kmag : float
2MASS J, H, Ks mags of the object.
Returns
-------
float
The converted SDSS r band magnitude.
'''
return convert_constant... | 0.010163 |
def locateChild(self, context, segments):
"""
Return a statically defined child or a child defined by a site root
plugin or an avatar from guard.
"""
request = IRequest(context)
webViewer = IWebViewer(self.store, None)
childAndSegments = self.siteProduceResource(r... | 0.006682 |
def UNEXPOSED(self, _cursor_type):
"""
Handles unexposed types.
Returns the canonical type instead.
"""
_decl = _cursor_type.get_declaration()
name = self.get_unique_name(_decl) # _cursor)
if self.is_registered(name):
obj = self.get_registered(name)
... | 0.005076 |
def getCurrentStrDatetime():
"""
Generating the current Datetime with a given format
Returns:
--------
string: The string of a date.
"""
# Generating current time
i = datetime.datetime.now()
strTime = "%s-%s-%s_%sh%sm" % (i.year, i.month, i.day, i.hour, i.minute)
return strT... | 0.003096 |
def terminate(self, force=False):
"""This forces a child process to terminate."""
if not self.isalive():
return True
self.kill(signal.SIGINT)
time.sleep(self.delayafterterminate)
if not self.isalive():
return True
if force:
self.kill(si... | 0.004065 |
def set_priority(self, name, vrid, value=None, disable=False,
default=False, run=True):
"""Set the primary_ip property of the vrrp
Args:
name (string): The interface to configure.
vrid (integer): The vrid number for the vrrp to be managed.
value ... | 0.001905 |
def _extrapolate_cols(self, data, first=True, last=True):
"""Extrapolate the column of data, to get the first and last together
with the data.
"""
if first:
pos = self.col_indices[:2]
first_column = _linear_extrapolate(pos,
... | 0.001754 |
def get(self, columns=None):
"""
Execute the query as a "select" statement.
:type columns: list
:rtype: orator.Collection
"""
if columns is None:
columns = ["*"]
if self._query.get_query().columns:
columns = []
select = self._ge... | 0.003344 |
def _set_slm(self, v, load=False):
"""
Setter method for slm, mapped from YANG variable /cfm_state/slm (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_slm is considered as a private
method. Backends looking to populate this variable should
do so via c... | 0.005451 |
def write_ndef(self, ndef, slot=1):
"""
Write an NDEF tag configuration to the YubiKey NEO.
"""
if not self.capabilities.have_nfc_ndef(slot):
raise yubikey_base.YubiKeyVersionError("NDEF slot %i unsupported in %s" % (slot, self))
return self._device._write_config(nde... | 0.008798 |
def c_transform_entropic(b, M, reg, beta):
'''
The goal is to recover u from the c-transform.
The function computes the c_transform of a dual variable from the other
dual variable:
.. math::
u = v^{c,reg} = -reg \sum_j exp((v - M)/reg) b_j
Where :
- M is the (ns,nt) metric cost m... | 0.00105 |
def load(self, context):
"""Returns the debugger plugin, if possible.
Args:
context: The TBContext flags including `add_arguments`.
Returns:
A DebuggerPlugin instance or None if it couldn't be loaded.
"""
if not (context.flags.debugger_data_server_grpc_port > 0 or
context.f... | 0.012247 |
def findLastCharIndexMatching(text, func):
""" Return index of last character in string for which func(char) evaluates to True. """
for i in range(len(text) - 1, -1, -1):
if func(text[i]):
return i | 0.013699 |
def get_string_from_data(self, offset, data):
"""Get an ASCII string from within the data."""
# OC Patch
b = None
try:
b = data[offset]
except IndexError:
return ''
s = ''
while ord(b):
s += b
... | 0.012931 |
def _pop_entities(self, limit=50):
"""
returns up to limit entities and pops them off the list
"""
pop = self.data['entities'][:limit]
del self.data['entities'][:limit]
return pop | 0.008811 |
def check_if_alive(self):
"""Check if the content is available on the host server. Returns `True` if available, else `False`.
This method is `lazy`-evaluated or only executes when called.
:rtype: bool
"""
try:
from urllib2 import urlopen, URLError, HTTPError
... | 0.00441 |
def mk_pools(things, keyfnc=lambda x: x):
"Indexes a thing by the keyfnc to construct pools of things."
pools = {}
sthings = sorted(things, key=keyfnc)
for key, thingz in groupby(sthings, key=keyfnc):
pools.setdefault(key, []).extend(list(thingz))
return pools | 0.003472 |
def simple_predictive_sample(self, M_c, X_L, X_D, Y, Q, seed, n=1):
"""Sample values from predictive distribution of the given latent state.
:param Y: A list of constraints to apply when sampling. Each constraint
is a triplet of (r, d, v): r is the row index, d is the column
in... | 0.00452 |
def predict_mhci_binding(job, peptfile, allele, peplen, univ_options,
mhci_options):
"""
This module will predict MHC:peptide binding for peptides in the files created in node XX to
ALLELE. ALLELE represents an MHCI allele.
This module corresponds to node 18 on the tree
""... | 0.00439 |
def post(self):
"""Create a new role"""
self.reqparse.add_argument('name', type=str, required=True)
self.reqparse.add_argument('color', type=str, required=True)
args = self.reqparse.parse_args()
role = Role()
role.name = args['name']
role.color = args['color']
... | 0.00722 |
def event_listen(self, timeout=None, raise_on_disconnect=True):
'''Does not return until PulseLoopStop
gets raised in event callback or timeout passes.
timeout should be in seconds (float),
0 for non-blocking poll and None (default) for no timeout.
raise_on_disconnect causes PulseDisconnected exceptions... | 0.026446 |
def broadcast(*sinks_):
"""The |broadcast| decorator creates a |push| object that receives a
message by ``yield`` and then sends this message on to all the given sinks.
.. |broadcast| replace:: :py:func:`broadcast`
"""
@push
def bc():
sinks = [s() for s in sinks_]
while True:
... | 0.002427 |
def rebuild( self ):
"""
Clears out all the child widgets from this widget and creates the
widget that best matches the column properties for this edit.
"""
plugins.init()
self.blockSignals(True)
self.setUpdatesEnabled(False)
#... | 0.015606 |
def sun_events(latitude, longitude, date, timezone=0, zenith=None):
"""Convenience function for calculating sunrise and sunset.
Civil twilight starts/ends when the Sun's centre is 6 degrees below
the horizon.
Nautical twilight starts/ends when the Sun's centre is 12 degrees
below the horizon.
... | 0.001018 |
def lookup_explicit(self, args, kwargs):
'''
Lookup the function that will be called with a given set of arguments,
or raise DispatchError. Requires explicit tuple/dict grouping of
arguments (see DispatchGroup.lookup for a function-like interface).
'''
for bind_args, call... | 0.007362 |
def _parse_config(self, ssh_config):
'''
This lame parser does not parse the full grammar of an ssh config
file. It makes assumptions that are (hopefully) correct for the output
of `vagrant ssh-config [vm-name]`. Specifically it assumes that there
is only one Host section, the ... | 0.001714 |
def virtual(opts, virtualname, filename):
'''
Returns the __virtual__.
'''
if ((HAS_NAPALM and NAPALM_MAJOR >= 2) or HAS_NAPALM_BASE) and (is_proxy(opts) or is_minion(opts)):
return virtualname
else:
return (
False,
(
'"{vname}"" {filename} can... | 0.003643 |
def from_tibiadata(cls, content):
"""
Parses a TibiaData response into a House object.
Parameters
----------
content: :class:`str`
The JSON content of the TibiaData response.
Returns
-------
:class:`House`
The house contained in t... | 0.002247 |
def run_flag_hw(in_prefix, in_type, out_prefix, base_dir, options):
"""Runs step12 (flag HW).
:param in_prefix: the prefix of the input files.
:param in_type: the type of the input files.
:param out_prefix: the output prefix.
:param base_dir: the output directory.
:param options: the options ne... | 0.000198 |
def follow_shortlinks(shortlinks):
"""Follow redirects in list of shortlinks, return dict of resulting URLs"""
links_followed = {}
for shortlink in shortlinks:
url = shortlink
request_result = requests.get(url)
redirect_history = request_result.history
# history might look li... | 0.001451 |
def watch(self):
"""True if the MessageHandler is being watched."""
return bool(lib.EnvGetDefmessageHandlerWatch(
self._env, self._cls, self._idx)) | 0.011429 |
def _GetTimeElementsTuple(self, timestamp):
"""Retrieves a time elements tuple from the timestamp.
A Symantec log timestamp consist of six hexadecimal octets, that represent:
First octet: Number of years since 1970
Second octet: Month, where January is represented by 0
Third octet: Day of the... | 0.001767 |
def get_service_certificate(self, service_name, thumbalgorithm, thumbprint):
'''
Returns the public data for the specified X.509 certificate associated
with a hosted service.
service_name:
Name of the hosted service.
thumbalgorithm:
The algorithm for the ... | 0.002336 |
def equipped(self):
""" Returns a dict of classes that have the item equipped and in what slot """
equipped = self._item.get("equipped", [])
# WORKAROUND: 0 is probably an off-by-one error
# WORKAROUND: 65535 actually serves a purpose (according to Valve)
return dict([(eq["class... | 0.01 |
def calcparams_cec(self, effective_irradiance, temp_cell, **kwargs):
"""
Use the :py:func:`calcparams_cec` function, the input
parameters and ``self.module_parameters`` to calculate the
module currents and resistances.
Parameters
----------
effective_irradiance :... | 0.001978 |
def signal_wrapper(f):
"""Decorator converts function's arguments from dbus types to python."""
@wraps(f)
def wrapper(*args, **kwds):
args = map(convert, args)
kwds = {convert(k): convert(v) for k, v in kwds.items()}
return f(*args, **kwds)
return wrapper | 0.00339 |
def variational_expectations(self, Fmu, Fvar, Y, epsilon=None):
r"""
Compute the expected log density of the data, given a Gaussian
distribution for the function values.
if
q(f) = N(Fmu, Fvar) - Fmu: N x D Fvar: N x D
and this object represents
p(y|f)... | 0.003515 |
def ubridge_delete_bridge(self, name):
"""
:params name: Delete the bridge with this name
"""
if self.ubridge:
yield from self._ubridge_send("bridge delete {name}".format(name=name)) | 0.013274 |
def parse(self, data):
# type: (bytes) -> None
'''
Parse the passed in data into a UDF Partition Header Descriptor.
Parameters:
data - The data to parse.
Returns:
Nothing.
'''
if self._initialized:
raise pycdlibexception.PyCdlibInter... | 0.00653 |
async def revoke_cred(self, rr_id: str, cr_id) -> int:
"""
Revoke credential that input revocation registry identifier and
credential revocation identifier specify.
Return (epoch seconds) time of revocation.
Raise AbsentTails if no tails file is available for input
revo... | 0.003684 |
def setattr(self, name, val):
"""
Change the attribute value of the UI element. Not all attributes can be casted to text. If changing the
immutable attributes or attributes which do not exist, the InvalidOperationException exception is raised.
Args:
name: attribute name
... | 0.008097 |
def add_to_tor(self, protocol):
'''
Returns a Deferred which fires with 'self' after at least one
descriptor has been uploaded. Errback if no descriptor upload
succeeds.
'''
upload_d = _await_descriptor_upload(protocol, self, progress=None, await_all_uploads=False)
... | 0.003239 |
def _delete(self, pos, idx):
"""Delete the item at the given (pos, idx).
Combines lists that are less than half the load level.
Updates the index when the sublist length is more than half the load
level. This requires decrementing the nodes in a traversal from the leaf
node to ... | 0.002217 |
def unmangle_code_names(self, co, classname):
"""Remove __ from the end of _name_ if it starts with __classname__
return the "unmangled" name.
"""
if classname:
classname = '_' + classname.lstrip('_') + '__'
free = [ self.unmangle_name(name, classname)
... | 0.010376 |
def factor_aug(z, DPhival, G, A):
M, N = G.shape
P, N = A.shape
"""Multiplier for inequality constraints"""
l = z[N+P:N+P+M]
"""Slacks"""
s = z[N+P+M:]
"""Sigma matrix"""
SIG = diags(l/s, 0)
"""Condensed system"""
if issparse(DPhival):
if not issparse(A):
... | 0.008708 |
def register_layer(self, layer):
"""
Register the layer so that it's param will be trained.
But the output of the layer will not be stacked.
"""
if type(layer) == Block:
layer.fix()
self.parameter_count += layer.parameter_count
self.parameters.extend(l... | 0.002148 |
def hsll(wnd, res=20, neighbors=2):
"""
Highest Side Lobe Level (dB).
Parameters
----------
res :
Zero-padding factor. 1 for no zero-padding, 2 for twice the length, etc..
neighbors :
Number of neighbors needed by ``get_peaks`` to define a peak.
"""
spectrum = dB20(rfft(wnd, res * len(wnd)))
... | 0.011655 |
def number_check(check, return_number=True):
"""
Function to verify item entered is a number
Args:
check: Thing to check for a number
return_number: Set to True it returns a number value, set to False returns True or False
Returns: Check return_number for return options
"""
try... | 0.004215 |
def connect(
self,
funds: typing.TokenAmount,
initial_channel_target: int = 3,
joinable_funds_target: float = 0.4,
):
"""Connect to the network.
Subsequent calls to `connect` are allowed, but will only affect the spendable
funds and the connec... | 0.004224 |
def search(ctx, tags, prefix=None):
'''
List all archives matching tag search criteria
'''
_generate_api(ctx)
for i, match in enumerate(ctx.obj.api.search(*tags, prefix=prefix)):
click.echo(match, nl=False)
print('') | 0.003922 |
def remove_zero_normals(self):
"""Removes normal vectors with a zero magnitude.
Note
----
This returns nothing and updates the NormalCloud in-place.
"""
points_of_interest = np.where(np.linalg.norm(self._data, axis=0) != 0.0)[0]
self._data = self._data[:, points_... | 0.009036 |
def on_separate_dimensions(self):
"""
Checks whether the kernels in the combination act on disjoint subsets
of dimensions. Currently, it is hard to asses whether two slice objects
will overlap, so this will always return False.
:return: Boolean indicator.
"""
if n... | 0.002415 |
def write(self, addr, data):
'''Write to dummy memory
Parameters
----------
addr : int
The register address.
data : list, tuple
Data (byte array) to be written.
Returns
-------
nothing
'''
logger.debug(
... | 0.005941 |
def read_text_file(filename):
# type: (str) -> str
"""Return the contents of *filename*.
Try to decode the file contents with utf-8, the preferred system encoding
(e.g., cp1252 on some Windows machines), and latin1, in that order.
Decoding a byte string with latin1 will never raise an error. In the... | 0.001188 |
def _parseParams(self):
"""
Parse parameters from their string HTML representation to dictionary.
Result is saved to the :attr:`params` property.
"""
# check if there are any parameters
if " " not in self._element or "=" not in self._element:
return
... | 0.001269 |
def get_corrected_commands(command):
"""Returns generator with sorted and unique corrected commands.
:type command: thefuck.types.Command
:rtype: Iterable[thefuck.types.CorrectedCommand]
"""
corrected_commands = (
corrected for rule in get_rules()
if rule.is_match(command)
... | 0.002364 |
def build_chain(self, **kwargs):
"""
Builds a new patterns chain
:param pattern:
:type pattern:
:param kwargs:
:type kwargs:
:return:
:rtype:
"""
set_defaults(self._chain_defaults, kwargs)
set_defaults(self._defaults, kwargs)
... | 0.005698 |
def read(cls, source, *args, **kwargs):
"""Read data into a `TimeSeries`
Arguments and keywords depend on the output format, see the
online documentation for full details for each format, the parameters
below are common to most formats.
Parameters
----------
sou... | 0.001202 |
def _set_guard(self, v, load=False):
"""
Setter method for guard, mapped from YANG variable /interface/port_channel/spanning_tree/guard (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_guard is considered as a private
method. Backends looking to populate t... | 0.005467 |
def get_plain_image_as_widget(self):
"""Used for generating thumbnails. Does not include overlaid
graphics.
"""
arr = self.getwin_array(order=self.rgb_order)
# convert numpy array to native image widget
image_w = self._get_wimage(arr)
return image_w | 0.006515 |
def status_mute(self, id):
"""
Mute notifications for a status.
Returns a `toot dict`_ with the now muted status
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/mute'.format(str(id))
return self.__api_request('POST', url) | 0.006944 |
def SetCursorPos(x: int, y: int) -> bool:
"""
SetCursorPos from Win32.
Set mouse cursor to point x, y.
x: int.
y: int.
Return bool, True if succeed otherwise False.
"""
return bool(ctypes.windll.user32.SetCursorPos(x, y)) | 0.003953 |
def extend_selection():
"""Checks is the selection is to be extended
The selection is to be extended, if a special modifier key (typically <Ctrl>) is being pressed.
:return: If to extend the selection
:rtype: True
"""
from rafcon.gui.singleton import main_window_controller
currently_presse... | 0.008013 |
def decompose_code(code):
"""
Decomposes a MARC "code" into tag, ind1, ind2, subcode
"""
code = "%-6s" % code
ind1 = code[3:4]
if ind1 == " ": ind1 = "_"
ind2 = code[4:5]
if ind2 == " ": ind2 = "_"
subcode = code[5:6]
if subcode == " ": subcode = None
return (code[0:3], ind1,... | 0.01194 |
def cache_meta(request, cache_key, start_index=0):
"""Inspect request for objects in _ultracache and set appropriate entries
in Django's cache."""
path = request.get_full_path()
# todo: cache headers on the request since they never change during the
# request.
# Reduce headers to the subset as... | 0.000523 |
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
"""
Actual modifier function
:param request: request
:param nodes: complete list of nodes
:param namespace: Menu namespace
:param root_id: eventual root_id
:param post_cut: flag for modifi... | 0.003456 |
def create_event(self, institute, case, user, link, category, verb,
subject, level='specific', variant=None, content=None,
panel=None):
"""Create a Event with the parameters given.
Arguments:
institute (dict): A institute
case (dict): A ... | 0.002786 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.