text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def verify_checksum(message, previous_csum=0):
"""Verify checksum for incoming message.
:param message: incoming message
:param previous_csum: accumulated checksum value
:return return True if message checksum type is None
or checksum is correct
"""
if message.message_type in CHECKSUM_MSG_... | 0.001698 |
def apply(self, doc):
"""
Generate MentionCaptions from a Document by parsing all of its Captions.
:param doc: The ``Document`` to parse.
:type doc: ``Document``
:raises TypeError: If the input doc is not of type ``Document``.
"""
if not isinstance(doc, Document)... | 0.007435 |
async def popen_uci(command: Union[str, List[str]], *, setpgrp: bool = False, loop=None, **popen_args: Any) -> Tuple[asyncio.SubprocessTransport, UciProtocol]:
"""
Spawns and initializes an UCI engine.
:param command: Path of the engine executable, or a list including the
path and arguments.
:p... | 0.004812 |
def pause(self):
"""Pauses the stream."""
res = librtmp.RTMP_Pause(self.client.rtmp, 1)
if res < 1:
raise RTMPError("Failed to pause") | 0.011696 |
def apply_panes_settings(self):
"""Update dockwidgets features settings"""
for plugin in (self.widgetlist + self.thirdparty_plugins):
features = plugin.FEATURES
if CONF.get('main', 'vertical_dockwidget_titlebars'):
features = features | QDockWidget.DockWidget... | 0.004695 |
def get_new_document(self, cursor_pos=None):
"""
Create a `Document` instance that contains the resulting text.
"""
lines = []
# Original text, before cursor.
if self.original_document.text_before_cursor:
lines.append(self.original_document.text_before_cursor... | 0.002304 |
def process_response(self, request, response):
"""
Forces the HTTP ``Vary`` header onto requests to avoid having responses
cached across subdomains.
"""
if getattr(settings, 'FORCE_VARY_ON_HOST', True):
patch_vary_headers(response, ('Host',))
return response | 0.00627 |
def request(self, method, path, contents, headers, decode_json=False,
stream=False, query=None, cdn=False):
"""
See :py:func:`swiftly.client.client.Client.request`
"""
if query:
path += '?' + '&'.join(
('%s=%s' % (quote(k), quote(v)) if v else ... | 0.001534 |
def resample(self, sampling_rate, inplace=False, kind='linear'):
'''Resample the Variable to the specified sampling rate.
Parameters
----------
sampling_rate : :obj:`int`, :obj:`float`
Target sampling rate (in Hz).
inplace : :obj:`bool`, optional
If True,... | 0.002105 |
def uniqueTags(tagList):
'''
uniqueTags - Returns the unique tags in tagList.
@param tagList list<AdvancedTag> : A list of tag objects.
'''
ret = []
alreadyAdded = set()
for tag in tagList:
myUid = tag.getUid()
if myUid in alreadyAdded:
contin... | 0.005319 |
def run_nose(self, params):
"""
:type params: Params
"""
thread.set_index(params.thread_index)
log.debug("[%s] Starting nose iterations: %s", params.worker_index, params)
assert isinstance(params.tests, list)
# argv.extend(['--with-apiritif', '--nocapture', '--exe... | 0.00534 |
def set_config(config, overwrite=False):
'''
Updates the global configuration.
:param config: Can be a dictionary containing configuration, or a string
which represents a (relative) configuration filename.
'''
if config is None:
config = get_conf_path_from_env()
# m... | 0.001215 |
def index(in_cram, config):
"""Ensure CRAM file has a .crai index file.
"""
out_file = in_cram + ".crai"
if not utils.file_uptodate(out_file, in_cram):
with file_transaction(config, in_cram + ".crai") as tx_out_file:
tx_in_file = os.path.splitext(tx_out_file)[0]
utils.sym... | 0.002083 |
def away(dev, away_end, temperature):
""" Enables or disables the away mode. """
if away_end:
click.echo("Setting away until %s, temperature: %s" % (away_end, temperature))
else:
click.echo("Disabling away mode")
dev.set_away(away_end, temperature) | 0.007143 |
def calculate_trans(thickness_cm: np.float, miu_per_cm: np.array):
"""calculate the transmission signal using the formula
transmission = exp( - thickness_cm * atoms_per_cm3 * 1e-24 * sigma_b)
Parameters:
===========
thickness: float (in cm)
atoms_per_cm3: float (number of atoms per cm3 of elem... | 0.001876 |
def _iterable_to_varargs_method(func):
"""decorator to convert a method taking a iterable to a *args one"""
def wrapped(self, *args, **kwargs):
return func(self, args, **kwargs)
return wrapped | 0.004717 |
def config_dict_to_string(dictionary):
"""
Convert a given config dictionary ::
dictionary[key_1] = value_1
dictionary[key_2] = value_2
...
dictionary[key_n] = value_n
into the corresponding string ::
key_1=value_1|key_2=value_2|...|key_n=value_n
:param dict d... | 0.001582 |
def set_seh_chain_pointer(self, value):
"""
Change the pointer to the first structured exception handler block.
@type value: int
@param value: Value of the remote pointer to the first block of the
structured exception handlers linked list. To disable SEH set the
... | 0.007884 |
def plugin_for(cls, model):
'''
Find and return a plugin for this model. Uses inheritance to find a model where the plugin is registered.
'''
logger.debug("Getting a plugin for: %s", model)
if not issubclass(model, Model):
return
if model in cls.plugins:
... | 0.006479 |
def account_unblock(self, id):
"""
Unblock a user.
Returns a `relationship dict`_ containing the updated relationship to the user.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}/unblock'.format(str(id))
return self.__api_request('POST', url) | 0.009709 |
def wordnet_annotations(self):
"""The list of wordnet annotations of ``words`` layer."""
if not self.is_tagged(WORDNET):
self.tag_wordnet()
return [[a[WORDNET] for a in analysis] for analysis in self.analysis] | 0.008163 |
def _move_node_file(path, old_id, new_id):
"""
Move the files from a node when changing his id
:param path: Path of the project
:param old_id: ID before change
:param new_id: New node UUID
"""
root = os.path.join(path, "project-files")
if os.path.exists(root):
for dirname in os.... | 0.001639 |
def ssh_key_info_from_key_data(key_id, priv_key=None):
"""Get/load SSH key info necessary for signing.
@param key_id {str} Either a private ssh key fingerprint, e.g.
'b3:f0:a1:6c:18:3b:42:63:fd:6e:57:42:74:17:d4:bc', or the path to
an ssh private key file (like ssh's IdentityFile config option)... | 0.000778 |
def genweights(p,q,dt,error=None , n=False):
"""
;+
; GENWEIGTHS : return optimal weigthing coefficients from Powell and Leben 2004<br />
; translated from Matlab genweigths.m program to IDL<br /><br />
;
; Reference : Powell, B. S., et R. R. Leben (2004), An Optimal Filter for <br... | 0.031517 |
def slot_enable_nio(self, slot_number, port_number):
"""
Enables a slot NIO binding.
:param slot_number: slot number
:param port_number: port number
"""
is_running = yield from self.is_running()
if is_running: # running router
yield from self._hyper... | 0.007673 |
def visit_FunctionDef(self, node, **kwargs):
"""
Handles function definitions within code.
Process a function's docstring, keeping well aware of the function's
context and whether or not it's part of an interface definition.
"""
if self.options.debug:
stderr.... | 0.001996 |
def tag_name(cls, tag):
"""return the name of the tag, with the namespace removed"""
while isinstance(tag, etree._Element):
tag = tag.tag
return tag.split('}')[-1] | 0.009852 |
def can_create_book_with_record_types(self, book_record_types):
"""Tests if this user can create a single ``Book`` using the desired record types.
While ``CommentingManager.getBookRecordTypes()`` can be used to
examine which records are supported, this method tests which
record(s) are r... | 0.003079 |
def get_sec_overview(self):
"""
Generate the "overview" section of the report.
"""
logger.debug("Calculating Overview metrics.")
data_path = os.path.join(self.data_dir, "overview")
if not os.path.exists(data_path):
os.makedirs(data_path)
overview_co... | 0.002035 |
def load(cls, sc, path):
"""
Load a model from the given path.
"""
model = cls._load_java(sc, path)
wrapper =\
sc._jvm.org.apache.spark.mllib.api.python.PowerIterationClusteringModelWrapper(model)
return PowerIterationClusteringModel(wrapper) | 0.009934 |
def query_by_string(self, query, fields=None, limit=10, sampling=None):
"""
Returns raw rows that matches the given query string
:arg query: query string to be run against Kibana log messages (ex. @message:"^PHP Fatal").
:type fields list[str] or None
:arg limit: the number of r... | 0.004815 |
def add_preset(self, name, desc="", note=""):
"""Add a new command line preset for the current options with the
specified name.
:param name: the name of the new preset
:returns: True on success or False otherwise
"""
policy = self.policy
if policy.fin... | 0.001929 |
def _generate(self, item, *args):
""" wraps execution of specific methods."""
if item in self.done:
return
# verbose output with location.
if self.generate_locations and item.location:
print("# %s:%d" % item.location, file=self.stream)
if self.generate_com... | 0.003314 |
def _set_scores(self):
"""
Compute anomaly scores for the time series by sliding both lagging window and future window.
"""
anom_scores = {}
self._generate_SAX()
self._construct_all_SAX_chunk_dict()
length = self.time_series_length
lws = self.lag_window_si... | 0.005747 |
def get_firewalls(self):
"""Returns a list of all firewalls on the account.
:returns: A list of firewalls on the current account.
"""
mask = ('firewallNetworkComponents,'
'networkVlanFirewall,'
'dedicatedFirewallFlag,'
'firewallGuestNetwo... | 0.003367 |
def GetChunk(time, breakpoints, b, mask=[]):
'''
Returns the indices corresponding to a given light curve chunk.
:param int b: The index of the chunk to return
'''
M = np.delete(np.arange(len(time)), mask, axis=0)
if b > 0:
res = M[(M > breakpoints[b - 1]) & (M <= breakpoints[b])]
... | 0.002646 |
def is_bound(method):
"""
Decorator that asserts the model instance is bound.
Requires:
1. an ``id`` attribute
2. a ``url`` attribute
2. a manager set
"""
@functools.wraps(method)
def wrapper(self, *args, **kwargs):
if not self._is_bound:
raise ValueError("%r mus... | 0.004598 |
def select(self, Class, set=None, recursive=True, ignore=True):
"""See :meth:`AbstractElement.select`"""
if self.mode == Mode.MEMORY:
for t in self.data:
if Class.__name__ == 'Text':
yield t
else:
for e in t.select(Clas... | 0.013298 |
def tags(self):
"""The tags property.
Returns:
(hash). the property value. (defaults to: {})
"""
if 'tags' in self._values:
return self._values['tags']
self._values['tags'] = copy.deepcopy(self._defaults['tags'])
return self._values['tags'... | 0.009346 |
def setModified(self, isModified: bool):
"""
Set the modified state to ``isModified``.
From a programmer's perspective this method does the same as
the native ``QsciScintilla`` method but also ensures that the
undo framework knows when the document state was changed.
|A... | 0.002928 |
def SCAS(cpu, dest, src):
"""
Scans String.
Compares the byte, word, or double word specified with the memory operand
with the value in the AL, AX, EAX, or RAX register, and sets the status flags
according to the results. The memory operand address is read from either
th... | 0.003279 |
def allconcat(self, x, mesh_axis, concat_axis, stack=False):
"""Grouped allconcat (like MPI allgather followed by concat).
TODO(noam): inefficient - replace with a XLA allconcat when available
Args:
x: a LaidOutTensor
mesh_axis: an integer - the mesh axis along which to group
concat_axis... | 0.003756 |
def schedule(self, callback, *args, **kwargs):
"""Schedule the callback to be called asynchronously in a thread pool.
Args:
callback (Callable): The function to call.
args: Positional arguments passed to the function.
kwargs: Key-word arguments passed to the function... | 0.004706 |
def load_headers(fsns:List[int]):
"""Load header files
"""
ip = get_ipython()
ip.user_ns['_headers'] = {}
for type_ in ['raw', 'processed']:
print("Loading %d headers (%s)" % (len(fsns), type_), flush=True)
processed = type_ == 'processed'
headers = []
for f in fsns:
... | 0.004975 |
def param_particle_pos(self, ind):
""" Get position of one or more particles """
ind = self._vps(listify(ind))
return [self._i2p(i, j) for i in ind for j in ['z', 'y', 'x']] | 0.010152 |
def get_smartplug_by_name(self, name):
"""Retrieves a smartplug object by its name
:param name: The name of the smartplug to return
:return: A smartplug object
"""
return next((plug for plug in self.smartplugs
if plug.name.lower() == name.lower()), None) | 0.006329 |
def trilaterate_v(self, P1, P2, P3, r1, r2, r3):
r'''
Find whether 3 spheres intersect
'''
temp1 = P2-P1
e_x = temp1/np.linalg.norm(temp1, axis=1)[:, np.newaxis]
temp2 = P3-P1
i = self._my_dot(e_x, temp2)[:, np.newaxis]
temp3 = temp2 - i*e_x
e_y = ... | 0.00312 |
def stream_file(self, project, path):
"""
Read file of a project and stream it
:param project: A project object
:param path: The path of the file in the project
:returns: A file stream
"""
# Due to Python 3.4 limitation we can't use with and asyncio
# ht... | 0.00507 |
def perform_command(self):
"""
Perform command and return the appropriate exit code.
:rtype: int
"""
if len(self.actual_arguments) < 2:
return self.print_help()
text_format = gf.safe_unicode(self.actual_arguments[0])
if text_format == u"list":
... | 0.003156 |
def remove_comments(code):
"""Remove C-style comment from GLSL code string."""
pattern = r"(\".*?\"|\'.*?\')|(/\*.*?\*/|//[^\r\n]*\n)"
# first group captures quoted strings (double or single)
# second group captures comments (//single-line or /* multi-line */)
regex = re.compile(pattern, re.MULTILI... | 0.001311 |
def connect_command(self):
'''
Generates a JSON string with the params to be used
when sending CONNECT to the server.
->> CONNECT {"verbose": false, "pedantic": false, "lang": "python2" }
'''
options = {
"verbose": self.options["verbose"],
"ped... | 0.002433 |
def convert_bbox_from_albumentations(bbox, target_format, rows, cols, check_validity=False):
"""Convert a bounding box from the format used by albumentations to a format, specified in `target_format`.
Args:
bbox (list): bounding box with coordinates in the format used by albumentations
target_f... | 0.005747 |
def max_diff(dset1,dset2):
'''calculates maximal voxel-wise difference in datasets (in %)
Useful for checking if datasets have the same data. For example, if the maximum difference is
< 1.0%, they're probably the same dataset'''
for dset in [dset1,dset2]:
if not os.path.exists(dset):
... | 0.010816 |
def tk_to_dagcircuit(circ:Circuit,_qreg_name:str="q") -> DAGCircuit :
"""
Convert a :math:`\\mathrm{t|ket}\\rangle` :py:class:`Circuit` to a :py:class:`qiskit.DAGCircuit` . Requires
that the circuit only conatins :py:class:`OpType` s from the qelib set.
:param circ: A circuit to be converted
... | 0.017643 |
def ensureModelData(self,obj):
"""
Ensures that the given ``obj`` has been initialized to be used with this model.
If the object is found to not be initialized, it will be initialized.
"""
if not hasattr(obj,"_modeldata"):
self.create(obj,cache=True)
... | 0.016985 |
def add(self, album, objects, object_type=None, **kwds):
"""
Endpoint: /album/<id>/<type>/add.json
Add objects (eg. Photos) to an album.
The objects are a list of either IDs or Trovebox objects.
If Trovebox objects are used, the object type is inferred
automatically.
... | 0.004184 |
def run(path, timer=False, repeat=3, number=10000, precision=2):
"""
Extracts and runs the '@cyther' code from the given file 'path' name
"""
code = extractAtCyther(path)
if not code:
output = "There was no '@cyther' code collected from the " \
"file '{}'\n".format(path)
... | 0.001014 |
def _apply_missings(self, res, include_missing=False):
"""Return ndarray with missing and insertions as specified.
The return value is the result of the following operations on *res*,
which is a raw cube value array (raw meaning it has shape of original
cube response).
* Remove... | 0.002176 |
def convert_dict(d, cls=AttrDict): # not used
'''
recursively convert a normal Mapping `d` and it's values to a specified type
(defaults to AttrDict)
'''
for k, v in d.items():
if isinstance(v, Mapping):
d[k] = convert_dict(v)
elif isinstance(v, list):
for i, ... | 0.006787 |
def string(s, salt=None):
"""
获取一个字符串的 MD5 值
:param:
* s: (string) 需要进行 hash 的字符串
* salt: (string) 随机字符串,默认为 None
:return:
* result: (string) 32 位小写 MD5 值
"""
m = hashlib.md5()
s = s.encode('utf-8') + salt.encode('utf-8') if sa... | 0.006977 |
def DropPrivileges():
"""Attempt to drop privileges if required."""
if config.CONFIG["Server.username"]:
try:
os.setuid(pwd.getpwnam(config.CONFIG["Server.username"]).pw_uid)
except (KeyError, OSError):
logging.exception("Unable to switch to user %s",
config.CONFIG["Serve... | 0.017391 |
def from_yaml(data):
"""
Interpolate the provided data and return a dict.
Currently, this is used to reinterpolate the `molecule.yml` inside an
Ansible playbook. If there were any interpolation errors, they would
have been found and raised earlier.
:return: dict
"""
molecule_env_file ... | 0.001645 |
def normalize_build_spec(self, build_spec):
"""
Convert a build spec into a list of Command tuples.
After running this command, self.build_cmds should hold all
the commands that should be run on the disk in self.disk_path.
Args:
build_spec (dict): The buildspec part ... | 0.00319 |
def acquire(self, resources, prop_name):
""" Starting with self, walk until you find prop or None """
# Instance
custom_prop = getattr(self.props, prop_name, None)
if custom_prop:
return custom_prop
# Parents...can't use acquire as have to keep going on acquireds
... | 0.001912 |
def wake(self, channel):
"""Causes the bot to resume operation in the channel.
Usage:
!wake [channel name] - unignore the specified channel (or current if none specified)
"""
self.log.info('Waking up in %s', channel)
self._bot.dispatcher.unignore(channel)
self.se... | 0.008021 |
def normalize(array, min_value=0., max_value=1.):
"""Normalizes the numpy array to (min_value, max_value)
Args:
array: The numpy array
min_value: The min value in normalized array (Default value = 0)
max_value: The max value in normalized array (Default value = 1)
Returns:
... | 0.001739 |
def filter_arrange_nodes(nodes: List[ast.stmt], max_line_number: int) -> List[ast.stmt]:
"""
Finds all nodes that are before the ``max_line_number`` and are not
docstrings or ``pass``.
"""
return [
node for node in nodes if node.lineno < max_line_number and not isinstance(node, ast.Pass)
... | 0.009926 |
def get_geometry(self):
"""A convenience function to get the geometry variables.
Returns:
A tuple containing (thet0, thet, phi0, phi, alpha, beta).
See the Scatterer class documentation for a description of these
angles.
"""
return (self.thet0, self.t... | 0.010499 |
def disease_term(self, disease_identifier):
"""Return a disease term
Checks if the identifier is a disease number or a id
Args:
disease_identifier(str)
Returns:
disease_obj(dict)
"""
query = {}
try:
disease_identifier = int(d... | 0.00381 |
def add_entry(self, **kw):
"""
Add an entry to an AccessList. Use the supported arguments
for the inheriting class for keyword arguments.
:raises UpdateElementFailed: failure to modify with reason
:return: None
"""
self.data.setdefault('entries', []).append(
... | 0.005479 |
def get_default_wrapper(cls):
"""Returns the default (first) driver wrapper
:returns: default driver wrapper
:rtype: toolium.driver_wrapper.DriverWrapper
"""
if cls.is_empty():
# Create a new driver wrapper if the pool is empty
from toolium.driver_wrapper... | 0.004914 |
def task_failure_handler(task_id=None, exception=None,
traceback=None, args=None, **kwargs):
"""Task failure handler"""
# TODO: find a better way to acces workdir/archive/image
task_report = {'task_id': task_id,
'exception': exception,
'tracebac... | 0.001838 |
def read_table(self, table_name, index_col=None, coerce_float=True,
parse_dates=None, columns=None, schema=None,
chunksize=None):
"""Read SQL database table into a DataFrame.
Parameters
----------
table_name : string
Name of SQL table in... | 0.00189 |
def doc(self):
"""Docstring of property on target or override specified on PV-object."""
return self._pv.doc or inspect.getdoc(
getattr(type(self._target), self._pv.property, None)) or '' | 0.013953 |
def validate_params(valid_options, params):
"""
Helps us validate the parameters for the request
:param valid_options: a list of strings of valid options for the
api request
:param params: a dict, the key-value store which we really only care about
the key w... | 0.004322 |
def workers(profile='default'):
'''
Return a list of member workers and their status
CLI Examples:
.. code-block:: bash
salt '*' modjk.workers
salt '*' modjk.workers other-profile
'''
config = get_running(profile)
lbn = config['worker.list'].split(',')
worker_list = [... | 0.001263 |
def _entries_sorted(self):
""":return: list of entries, in a sorted fashion, first by path, then by stage"""
return sorted(self.entries.values(), key=lambda e: (e.path, e.stage)) | 0.015464 |
def _parser_exit(parser: argparse.ArgumentParser, proc: "DirectoryListProcessor", _=0,
message: Optional[str]=None) -> None:
"""
Override the default exit in the parser.
:param parser:
:param _: exit code. Unused because we don't exit
:param message: Optional message
"""
if... | 0.009662 |
def get_trunk_interfaces(auth, url, devid=None, devip=None):
"""Function takes devId as input to RESTFULL call to HP IMC platform
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
... | 0.002269 |
def token_required(view_func):
"""
Decorator which ensures that one of the WATCHMAN_TOKENS is provided if set.
WATCHMAN_TOKEN_NAME can also be set if the token GET parameter must be
customized.
"""
def _parse_auth_header(auth_header):
"""
Parse the `Authorization` header
... | 0.002237 |
def _html_link_cells(self):
"""
This will return a new table with cell linked with their columns
that have <Link> in the name
:return:
"""
new_table = self.copy()
for row in new_table:
for c in new_table.columns:
link = '%s <Link>' % c
... | 0.003752 |
def requests_view(request, requestType):
'''
Generic request view. Parameters:
request is the HTTP request
requestType is URL name of a RequestType.
e.g. "food", "maintenance", "network", "site"
'''
userProfile = UserProfile.objects.get(user=request.user)
request_type = ... | 0.002649 |
def build_gemini_query(self, query, extra_info):
"""Append sql to a gemini query
Args:
query(str): The gemini query
extra_info(str): The text that should be added
Return:
extended_query(str)
"""
if 'WHERE' in query:
return "{0} AN... | 0.004684 |
def texture_cube(self, size, components, data=None, *, alignment=1, dtype='f1') -> 'TextureCube':
'''
Create a :py:class:`TextureCube` object.
Args:
size (tuple): The width, height of the texture. Each side of the cube will have this size.
components (int... | 0.005394 |
def add_sample(self,
metricId,
timestamp,
value,
metricType=None,
host=None,
sparseDataStrategy='None',
unit='',
tags=None,
min=None,
... | 0.005375 |
def write(self, auth, resource, value, options={}, defer=False):
""" Writes a single value to the resource specified.
Args:
auth: cik for authentication.
resource: resource to write to.
value: value to write
options: options.
"""
return se... | 0.005291 |
def _get_and_write_fp(self, iso_path, outfp, blocksize):
# type: (bytes, BinaryIO, int) -> None
'''
An internal method to fetch a single file from the ISO and write it out
to the file object.
Parameters:
iso_path - The absolute path to the file to get data from.
... | 0.005682 |
def _extract_packages(self):
"""
Extract a package in a new temporary directory.
"""
self.path_unpacked = mkdtemp(prefix="scoap3_package_",
dir=CFG_TMPSHAREDDIR)
for path in self.retrieved_packages_unpacked:
scoap3utils_extract_pac... | 0.005025 |
def click_link_text(self, link_text, timeout=settings.SMALL_TIMEOUT):
""" This method clicks link text on a page """
# If using phantomjs, might need to extract and open the link directly
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeo... | 0.000615 |
def linehexdump(x, onlyasc=0, onlyhex=0, dump=False):
"""Build an equivalent view of hexdump() on a single line
Note that setting both onlyasc and onlyhex to 1 results in a empty output
:param x: a Packet
:param onlyasc: 1 to display only the ascii view
:param onlyhex: 1 to display only the hexade... | 0.001792 |
def pushtx(tx_hex, coin_symbol='btc', api_key=None):
'''
Takes a signed transaction hex binary (and coin_symbol) and broadcasts it to the bitcoin network.
'''
assert is_valid_coin_symbol(coin_symbol)
assert api_key, 'api_key required'
url = _get_pushtx_url(coin_symbol=coin_symbol)
logger.... | 0.005848 |
def _st_decode(self, msg):
"""ST: Temperature update."""
group = int(msg[4:5])
temperature = int(msg[7:10])
if group == 0:
temperature -= 60
elif group == 1:
temperature -= 40
return {'group': group, 'device': int(msg[5:7])-1,
'temp... | 0.005848 |
def _has_streamhandler(logger, level=None, fmt=LOG_FORMAT,
stream=DEFAULT_STREAM):
"""Check the named logger for an appropriate existing StreamHandler.
This only returns True if a StreamHandler that exaclty matches
our specification is found. If other StreamHandlers are seen,
we ... | 0.001059 |
def emit_metadata_for_region_py(self, region, region_filename, module_prefix):
"""Emit Python code generating the metadata for the given region"""
terrobj = self.territory[region]
with open(region_filename, "w") as outfile:
prnt(_REGION_METADATA_PROLOG % {'region': terrobj.identifier... | 0.008811 |
def revoke(self, auth, codetype, code, defer=False):
""" Given an activation code, the associated entity is revoked after which the activation
code can no longer be used.
Args:
auth: Takes the owner's cik
codetype: The type of code to revoke (client | share)
... | 0.006479 |
async def refresh_token(loader, client_configuration=None, interval=60):
"""Refresh token if necessary, updates the token in client configurarion
:param loader: KubeConfigLoader returned by load_kube_config
:param client_configuration: The kubernetes.client.Configuration to
set configs to.
... | 0.001479 |
def backpropagate_2d(uSin, angles, res, nm, lD=0, coords=None,
weight_angles=True,
onlyreal=False, padding=True, padval=0,
count=None, max_count=None, verbose=0):
r"""2D backpropagation with the Fourier diffraction theorem
Two-dimensional diffracti... | 0.00009 |
def value_to_single_key_strokes(value):
"""Convert value to a list of key strokes
>>> value_to_single_key_strokes(123)
['1', '2', '3']
>>> value_to_single_key_strokes('123')
['1', '2', '3']
>>> value_to_single_key_strokes([1, 2, 3])
['1', '2', '3']
>>> value_to_single_key_strokes(['1', '... | 0.001362 |
def join(self, experiment, genometric_predicate, output="LEFT", joinBy=None,
refName="REF", expName="EXP", left_on=None, right_on=None):
"""
*Wrapper of* ``JOIN``
The JOIN operator takes in input two datasets, respectively known as anchor
(the first/left one) and experiment... | 0.008168 |
def handle(self, pkt, raddress, rport):
"""Handle the packet in response to an RRQ to the server."""
if not self.context.tidport:
self.context.tidport = rport
log.info("Set remote port for session to %s" % rport)
# Now check the packet type and dispatch it properly.
... | 0.002135 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.