text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def is_child_of(self, parent):
"""Asserts that val is an existing path to a file and that file is a child of parent."""
self.is_file()
if not isinstance(parent, str_types):
raise TypeError('given parent directory arg must be a path')
val_abspath = os.path.abspath(self.val)
... | 0.007233 |
def WaitForReport(self, report_job):
"""Runs a report, then waits (blocks) for the report to finish generating.
Args:
report_job: The report job to wait for. This may be a dictionary or an
instance of the SOAP ReportJob class.
Returns:
The completed report job's ID as a string.
... | 0.008326 |
def scan_results(self, obj):
"""Get the AP list after scanning."""
bsses = []
bsses_summary = self._send_cmd_to_wpas(obj['name'], 'SCAN_RESULTS', True)
bsses_summary = bsses_summary[:-1].split('\n')
if len(bsses_summary) == 1:
return bsses
for l in bsses_sum... | 0.004004 |
def get_vault_form_for_update(self, vault_id):
"""Gets the vault form for updating an existing vault.
A new vault form should be requested for each update
transaction.
arg: vault_id (osid.id.Id): the ``Id`` of the ``Vault``
return: (osid.authorization.VaultForm) - the vault ... | 0.003401 |
def log_transition(self, transition, from_state, instance, *args, **kwargs):
"""Generic transition logging."""
save = kwargs.pop('save', True)
log = kwargs.pop('log', True)
super(Workflow, self).log_transition(
transition, from_state, instance, *args, **kwargs)
if sav... | 0.004535 |
def _t_update_b(self):
r"""
A method to update 'b' array at each time step according to
't_scheme' and the source term value
"""
network = self.project.network
phase = self.project.phases()[self.settings['phase']]
Vi = network['pore.volume']
dt = self.sett... | 0.00201 |
def reset_for_retry(self):
"""Reset self for shard retry."""
self.retries += 1
self.last_work_item = ""
self.active = True
self.result_status = None
self.input_finished = False
self.counters_map = CountersMap()
self.slice_id = 0
self.slice_start_time = None
self.slice_request_id ... | 0.002604 |
def _parse_ranges(ranges):
""" Converts a list of string ranges to a list of [low, high] tuples. """
for txt in ranges:
if '-' in txt:
low, high = txt.split('-')
else:
low, high = txt, txt
yield int(low), int(high) | 0.003704 |
def find_effect_class(self, path) -> Type[Effect]:
"""
Find an effect class by class name or full python path to class
Args:
path (str): effect class name or full python path to effect class
Returns:
Effect class
Raises:
EffectError if no cl... | 0.003663 |
def remove(self, path):
"""Remove the FakeFile object at the specified file path.
Args:
path: Path to file to be removed.
Raises:
OSError: if path points to a directory.
OSError: if path does not exist.
OSError: if removal failed.
"""
... | 0.001208 |
def realtime_learning_curves(runs):
"""
example how to extract a different kind of learning curve.
The x values are now the time the runs finished, not the budget anymore.
We no longer plot the validation loss on the y axis, but now the test accuracy.
This is just to show how to get different information into ... | 0.038388 |
def login(self, username, *, token=None):
"""Log in to Google Music.
Parameters:
username (str, Optional): Your Google Music username.
Used for keeping stored OAuth tokens for multiple accounts separate.
device_id (str, Optional): A mobile device ID or music manager uploader ID.
Default: MAC address ... | 0.027027 |
def _process_counter_example(self, mma, w_string):
""""
Process a counterexample in the Rivest-Schapire way.
Args:
mma (DFA): The hypothesis automaton
w_string (str): The examined string to be consumed
Returns:
None
"""
w_string = self._find_... | 0.003145 |
def start_consuming(self, to_tuple=False, auto_decode=True):
"""Start consuming messages.
:param bool to_tuple: Should incoming messages be converted to a
tuple before delivery.
:param bool auto_decode: Auto-decode strings when possible.
:raises AMQPChanne... | 0.002519 |
def wait_for_simulation_stop(self, timeout=None):
"""Block until the simulation is done or timeout seconds exceeded.
If the simulation stops before timeout, siminfo is returned.
"""
start = datetime.now()
while self.get_is_sim_running():
sleep(0.5)
if tim... | 0.003759 |
def catch(func, *args, **kwargs):
"""
Call the supplied function with the supplied arguments,
catching and returning any exception that it throws.
Arguments:
func: the function to run.
*args: positional arguments to pass into the function.
**kwargs: keyword arguments to pass int... | 0.001748 |
def substitute_globals(config_dict):
"""
Set global variables to values defined in `config_dict`.
Args:
config_dict (dict): dictionary with data, which are used to set \
`globals`.
Note:
`config_dict` have to be dictionary, or it is ignored. Also all
... | 0.00137 |
def get_series_by_name(self, series_name):
"""Perform lookup for series
:param str series_name: series name found within filename
:returns: instance of series
:rtype: object
"""
try:
return self.api.search_series(name=series_name), None
except excepti... | 0.004348 |
def _Rforce(self,R,phi=0.,t=0.):
"""
NAME:
_Rforce
PURPOSE:
evaluate the radial force
INPUT:
R
phi
t
OUTPUT:
F_R(R(,\phi,t))
HISTORY:
2010-07-13 - Written - Bovy (NYU)
"""
return s... | 0.024725 |
def str2chars(strings) -> numpy.ndarray:
"""Return |numpy.ndarray| containing the byte characters (second axis)
of all given strings (first axis).
>>> from hydpy.core.netcdftools import str2chars
>>> str2chars(['zeros', 'ones'])
array([[b'z', b'e', b'r', b'o', b's'],
[b'o', b'n', b'e', b... | 0.001292 |
def add_caption(self, image, caption, colour=None):
""" Add a caption to the image """
if colour is None:
colour = "white"
width, height = image.size
draw = ImageDraw.Draw(image)
draw.font = self.font
draw.font = self.font
draw.text((width // 1... | 0.007557 |
def add(self, handler, priority=10):
"""
Add handler.
:param callable handler: callable handler
:return callable: The handler you added is given back so this can be used as a decorator.
"""
self.container.add_handler(handler, priority=priority)
return handler | 0.009494 |
def _apply(self, ctx: ExtensionContext) -> AugmentedDict:
"""
Replaces any {{env::*}} directives with it's actual environment variable value or a default.
Args:
ctx: The processing context.
Returns:
Returns the altered node key and value.
"""
nod... | 0.00431 |
def generate_salt_cmd(target, module, args=None, kwargs=None):
"""
Generates a command (the arguments) for the `salt` or `salt-ssh` CLI
"""
args = args or []
kwargs = kwargs or {}
target = target or '*'
target = '"%s"' % target
cmd = [target, module]
for arg in args:
cmd.appe... | 0.002381 |
def vol_tehrahedron(poly):
"""volume of a irregular tetrahedron"""
p_a = np.array(poly[0])
p_b = np.array(poly[1])
p_c = np.array(poly[2])
p_d = np.array(poly[3])
return abs(np.dot(
np.subtract(p_a, p_d),
np.cross(
np.subtract(p_b, p_d),
np.subtract(p_c, p... | 0.00303 |
def _collect_dirty_tabs(self, exept=None):
"""
Collects the list of dirty tabs
"""
widgets = []
filenames = []
for i in range(self.count()):
widget = self.widget(i)
try:
if widget.dirty and widget != exept:
widge... | 0.004149 |
def get_nagios_unit_name(relation_name='nrpe-external-master'):
"""
Return the nagios unit name prepended with host_context if needed
:param str relation_name: Name of relation nrpe sub joined to
"""
host_context = get_nagios_hostcontext(relation_name)
if host_context:
unit = "%s:%s" % ... | 0.002488 |
def connect(host=DEFAULT_HOST, port=DEFAULT_PORT, base=DEFAULT_BASE,
chunk_size=multipart.default_chunk_size, **defaults):
"""Create a new :class:`~ipfsapi.Client` instance and connect to the
daemon to validate that its version is supported.
Raises
------
~ipfsapi.exceptions.VersionMism... | 0.001115 |
def line(surf, start, end, color=BLACK, width=1, style=FLAT):
"""Draws an antialiased line on the surface."""
width = round(width, 1)
if width == 1:
# return pygame.draw.aaline(surf, color, start, end)
return gfxdraw.line(surf, *start, *end, color)
start = V2(*start)
end = V2(*end)... | 0.001044 |
def bifurcation_partition(bif_point):
'''Calculate the partition at a bifurcation point
We first ensure that the input point has only two children.
The number of nodes in each child tree is counted. The partition is
defined as the ratio of the largest number to the smallest number.'''
assert len(b... | 0.003578 |
def set_with_conversion(self, variable, value_string):
"""Convert user supplied string to Python type.
Lets user use values such as True, False and integers. All variables can be set
to None, regardless of type. Handle the case where a string is typed by the user
and is not quoted, as a... | 0.003568 |
def main(command_line_arguments=None):
"""Reads score files, computes error measures and plots curves."""
args = command_line_options(command_line_arguments)
# get some colors for plotting
cmap = mpl.cm.get_cmap(name='hsv')
count = len(args.files) + (len(args.baselines) if args.baselines else 0)
colors = ... | 0.019919 |
def handle_endtag(self, tag):
"""Return representation of html end tag."""
if tag in self.mathml_elements:
self.fed.append("</{0}>".format(tag)) | 0.011628 |
def _aggr_mean(inList):
""" Returns mean of non-None elements of the list
"""
aggrSum = 0
nonNone = 0
for elem in inList:
if elem != SENTINEL_VALUE_FOR_MISSING_DATA:
aggrSum += elem
nonNone += 1
if nonNone != 0:
return aggrSum / nonNone
else:
return None | 0.030822 |
def set_input_divide_by_period(holder, period, array):
"""
This function can be declared as a ``set_input`` attribute of a variable.
In this case, the variable will accept inputs on larger periods that its definition period, and the value for the larger period will be divided between its subperiods... | 0.002969 |
def target_range(self):
"""Get the range covered on the target/reference strand
:returns: Genomic range of the target strand
:rtype: GenomicRange
"""
a = self.alignment_ranges
return GenomicRange(a[0][0].chr,a[0][0].start,a[-1][0].end) | 0.011494 |
def write(self, fileobj = sys.stdout, indent = u""):
"""
Recursively write an element and it's children to a file.
"""
fileobj.write(self.start_tag(indent))
fileobj.write(u"\n")
for c in self.childNodes:
if c.tagName not in self.validchildren:
raise ElementError("invalid child %s for %s" % (c.tagName... | 0.037807 |
def save(cls, network, phases=[], filename='', delim=' | ', fill_nans=None):
r"""
Save network and phase data to a single vtp file for visualizing in
Paraview
Parameters
----------
network : OpenPNM Network Object
The Network containing the data to be written... | 0.000509 |
def copy_script(self, filename, id_=-1):
"""Copy a script to the repo's Script subdirectory.
Scripts are copied as files to a path, or, on a "migrated" JSS,
are POSTed to the JSS (pass an id if you wish to associate
the script with an existing Script object).
Args:
... | 0.002315 |
def _extract_symbols(self, symbols, default=None):
"""! @brief Fill 'symbols' field with required flash algo symbols"""
to_ret = {}
for symbol in symbols:
symbolInfo = self.elf.symbol_decoder.get_symbol_for_name(symbol)
if symbolInfo is None:
if default is... | 0.00367 |
def update_col(self, column_name, series):
"""
Add or replace a column in the underlying DataFrame.
Parameters
----------
column_name : str
Column to add or replace.
series : pandas.Series or sequence
Column data.
"""
logger.debug... | 0.004515 |
def create_processors_from_settings(self):
"""
Expects the Django setting "EVENT_TRACKING_PROCESSORS" to be defined and
point to a list of backend engine configurations.
Example::
EVENT_TRACKING_PROCESSORS = [
{
'ENGINE': 'some.arbitrary.... | 0.004167 |
def exclude(self, *fields):
"""
Projection columns which not included in the fields
:param fields: field names
:return: new collection
:rtype: :class:`odps.df.expr.expression.CollectionExpr`
"""
if len(fields) == 1 and isinstance(fields[0], list):
ex... | 0.003958 |
def _process(self, resource=None, data={}):
"""Processes the current transaction
Sends an HTTP request to the PAYDUNYA API server
"""
# use object's data if no data is passed
_data = data or self._data
rsc_url = self.get_rsc_endpoint(resource)
if _data:
... | 0.002275 |
def get_normalized_elevation_array(world):
''' Convert raw elevation into normalized values between 0 and 255,
and return a numpy array of these values '''
e = world.layers['elevation'].data
ocean = world.layers['ocean'].data
mask = numpy.ma.array(e, mask=ocean) # only land
min_elev_land ... | 0.00224 |
async def call(self, method, **params):
"""
Call an Slack Web API method
:param method: Slack Web API method to call
:param params: {str: object} parameters to method
:return: dict()
"""
url = self.SLACK_RPC_PREFIX + method
data = FormData()
data.... | 0.006301 |
def walk(self, top, file_list={}):
"""Walks the walk. nah, seriously: reads the file and stores a hashkey
corresponding to its content."""
for root, dirs, files in os.walk(top, topdown=False):
if os.path.basename(root) in self.ignore_dirs:
# Do not dig in ignored dirs... | 0.002123 |
def Register(self, name, constructor):
"""Registers a new constructor in the factory.
Args:
name: A name associated with given constructor.
constructor: A constructor function that creates instances.
Raises:
ValueError: If there already is a constructor associated with given name.
""... | 0.006645 |
def image_recognition(image, cloud=None, batch=False, api_key=None, version=None, **kwargs):
"""
Given an input image, returns a dictionary of image classifications with associated scores
* Input can be either grayscale or rgb color and should either be a numpy array or nested list format.
* Input data... | 0.006926 |
def _add_query_parameter(url, name, value):
"""Adds a query parameter to a url.
Replaces the current value if it already exists in the URL.
Args:
url: string, url to add the query parameter to.
name: string, query parameter name.
value: string, query parameter value.
Returns:
... | 0.001969 |
def handle_tls_connected_event(self, event):
"""Verify the peer certificate on the `TLSConnectedEvent`.
"""
if self.settings["tls_verify_peer"]:
valid = self.settings["tls_verify_callback"](event.stream,
event.peer_certificate)
... | 0.00566 |
def _inline_tcl_xfer(
self, source_file=None, source_config=None, dest_file=None, file_system=None
):
"""
Use Netmiko InlineFileTransfer (TCL) to transfer file or config to remote device.
Return (status, msg)
status = boolean
msg = details on what happened
""... | 0.005727 |
def delete(self, index, doc_type, id, bulk=False, **query_params):
"""
Delete a typed JSON document from a specific index based on its id.
If bulk is True, the delete operation is put in bulk mode.
"""
if bulk:
cmd = {"delete": {"_index": index, "_type": doc_type,
... | 0.003472 |
def join(self, other):
r"""
Args:
other (?):
CommandLine:
python -m sortedcontainers.sortedlist join2
Example:
>>> from utool.experimental.dynamic_connectivity import * # NOQA
>>> self = EulerTourList([1, 2, 3, 2, 4, 2, 1], load=3)
... | 0.00299 |
def get_operation_root_type(
schema: GraphQLSchema,
operation: Union[OperationDefinitionNode, OperationTypeDefinitionNode],
) -> GraphQLObjectType:
"""Extract the root type of the operation from the schema."""
operation_type = operation.operation
if operation_type == OperationType.QUERY:
que... | 0.004296 |
def check_recommended_global_attributes(self, dataset):
'''
Check the global recommended attributes for 2.0 templates. These go an extra step besides
just checking that they exist.
:param netCDF4.Dataset dataset: An open netCDF dataset
:id = "" ; //................................ | 0.0053 |
def plot_vgp_basemap(mapname, vgp_lon=None, vgp_lat=None, di_block=None, label='', color='k', marker='o', markersize=20, legend='no'):
"""
This function plots a paleomagnetic pole on whatever current map projection
has been set using the basemap plotting library.
Before this function is called, a plot n... | 0.002593 |
def parse(self):
"""Parse show subcommand."""
parser = self.subparser.add_parser(
"show",
help="Show workspace details",
description="Show workspace details.")
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--all', acti... | 0.004566 |
def compute_texptime(imageObjectList):
"""
Add up the exposure time for all the members in
the pattern, since 'drizzle' doesn't have the necessary
information to correctly set this itself.
"""
expnames = []
exptimes = []
start = []
end = []
for img in imageObjectList:
exp... | 0.003901 |
def get(self, key):
"""
Returns the value for the specified key, or None if this map does not contain this key.
**Warning:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode
and equals defined in the key's class.**
... | 0.009331 |
def masses_of_galaxies_within_ellipses_in_units(self, major_axis : dim.Length, unit_mass='angular',
critical_surface_density=None):
"""Compute the total mass of all galaxies in this plane within a ellipse of specified major-axis.
See *galaxy.angular_m... | 0.009033 |
def b58decode(v, length=None):
""" decode v into a string of len bytes."""
if isinstance(v, bytes):
v = v.decode()
for c in v:
if c not in __b58chars:
raise ValueError("invalid Base58 string")
long_value = 0
for (i, c) in enumerate(v[::-1]):
long_value += __b58c... | 0.001235 |
def create_state(self, value: dict = None, *, namespace: str = None):
"""
Creates a new :py:class:`State` object, sharing the same zproc server as this Context.
:param value:
If provided, call ``state.update(value)``.
:param namespace:
Use this as the namespace f... | 0.005714 |
def validate_v_rgbw(value):
"""Validate a V_RGBW value."""
if len(value) != 8:
raise vol.Invalid(
'{} is not eight characters long'.format(value))
return validate_hex(value) | 0.004878 |
def __flags(self):
"""
Internal method. Turns arguments into flags.
"""
flags = []
if self._capture:
flags.append("-capture")
if self._spy:
flags.append("-spy")
if self._dbpath:
flags += ["-db-path", self._dbpath]
fl... | 0.001098 |
def toc(self):
"""
Return a html table of contents
:return:
"""
fails = ""
skips = ""
if len(self.failed()):
faillist = list()
for failure in self.failed():
faillist.append(
"""
<li>
... | 0.001206 |
def _peek_async_request(self, msg_id, msg_name):
"""Peek at the set of callbacks for a request.
Return tuple of Nones if callbacks don't exist.
"""
assert get_thread_ident() == self.ioloop_thread_id
if msg_id is None:
msg_id = self._msg_id_for_name(msg_name)
... | 0.004357 |
def get_session(session_id):
'''
Get information about a session.
.. versionadded:: 2016.11.0
:param session_id: The numeric Id of the session.
:return: A dictionary of session information.
CLI Example:
.. code-block:: bash
salt '*' rdp.get_session session_id
salt '*' r... | 0.001642 |
def _refine_merge(merge, aliases, min_goodness):
"""Remove entries from a merge to generate a valid merge which may be
applied to the routing table.
Parameters
----------
merge : :py:class:`~.Merge`
Initial merge to refine.
aliases : {(key, mask): {(key, mask), ...}, ...}
Map of... | 0.000762 |
def fromCSV(csvfile,out=None,fieldnames=None,fmtparams=None,conv_func={},
empty_to_None=[]):
"""Conversion from CSV to PyDbLite
csvfile : name of the CSV file in the file system
out : path for the new PyDbLite base in the file system
fieldnames : list of field names. If set to None, the fie... | 0.010496 |
def parseFunctionSignatures(self):
"""Search file and namespace node XML contents for function signatures."""
# Keys: string refid of either namespace or file nodes
# Values: list of function objects that should be defined there
parent_to_func = {}
for func in self.functions:
... | 0.004342 |
def flash(self, partition, timeout_ms=None, info_cb=DEFAULT_MESSAGE_CALLBACK):
"""Flashes the last downloaded file to the given partition.
Args:
partition: Partition to flash.
timeout_ms: Optional timeout in milliseconds to wait for it to finish.
info_cb: See Download. Usually no messages.
... | 0.001912 |
def download(url, filename):
"""download and extract file."""
logger.info("Downloading %s", url)
request = urllib2.Request(url)
request.add_header('User-Agent',
'caelum/0.1 +https://github.com/nrcharles/caelum')
opener = urllib2.build_opener()
local_file = open(filename, '... | 0.002525 |
def append_utc_timestamp(self, tag, timestamp=None, precision=3,
header=False):
"""Append a field with a UTCTimestamp value.
:param tag: Integer or string FIX tag number.
:param timestamp: Time value, see below.
:param precision: Number of decimal places: 0,... | 0.002498 |
def get_quota(self):
'Return tuple of (bytes_available, bytes_quota).'
du, ds = op.itemgetter('space_used', 'space_amount')\
((yield super(txBox, self).info_user()))
defer.returnValue((ds - du, ds)) | 0.033816 |
def mousePressEvent(self, event):
"""Folds/unfolds the pressed indicator if any."""
if self._mouse_over_line is not None:
block = self.editor.document().findBlockByNumber(
self._mouse_over_line)
self.toggle_fold_trigger(block) | 0.007092 |
def get_vulnerability_functions_04(fname):
"""
Parse the vulnerability model in NRML 0.4 format.
:param fname:
path of the vulnerability file
:returns:
a dictionary imt, taxonomy -> vulnerability function + vset
"""
categories = dict(assetCategory=set(), lossCategory=set(),
... | 0.000448 |
def _compute_jsonclass(obj):
"""
Compute the content of the __jsonclass__ field for the given object
:param obj: An object
:return: The content of the __jsonclass__ field
"""
# It's not a standard type, so it needs __jsonclass__
module_name = inspect.getmodule(obj).__name__
json_class =... | 0.002088 |
def mix_columns(state):
"""
Transformation in the Cipher that takes all of the columns of the State and
mixes their data (independently of one another) to produce new columns.
"""
state = state.reshape(4, 4, 8)
return fcat(
multiply(MA, state[0]),
multiply(MA, state[1]),
... | 0.002625 |
def run(pipeline_id, verbose, use_cache, dirty, force, concurrency, slave):
"""Run a pipeline by pipeline-id.
pipeline-id supports '%' wildcard for any-suffix matching,
'all' for running all pipelines and
comma-delimited list of pipeline ids"""
exitcode = 0
running = []
progress = ... | 0.0023 |
def temp_url(self, duration=120):
"""Returns a temporary URL for the given key."""
return self.bucket._boto_s3.meta.client.generate_presigned_url(
'get_object',
Params={'Bucket': self.bucket.name, 'Key': self.name},
ExpiresIn=duration
) | 0.006757 |
def cache_finite_samples(f):
'''Decorator to cache audio samples produced by the wrapped generator.'''
cache = {}
def wrap(*args):
key = FRAME_RATE, args
if key not in cache:
cache[key] = [sample for sample in f(*args)]
return (sample for sample in cache[key])
return wrap | 0.035088 |
def is_parameterized(val: Any) -> bool:
"""Returns whether the object is parameterized with any Symbols.
A value is parameterized when it has an `_is_parameterized_` method and
that method returns a truthy value, or if the value is an instance of
sympy.Basic.
Returns:
True if the gate has ... | 0.001279 |
def common_items_ratio(pronac, dt):
"""
Calculates the common items on projects in a cultural segment,
calculates the uncommon items on projects in a cultural segment and
verify if a project is an outlier compared to the other projects
in his segment.
"""
segment_id = get_segment_id(str(pron... | 0.00142 |
def refresh_db(failhard=False, **kwargs): # pylint: disable=unused-argument
'''
Updates the opkg database to latest packages based upon repositories
Returns a dict, with the keys being package databases and the values being
the result of the update attempt. Values can be one of the following:
- `... | 0.000435 |
def _get_options_group(group=None):
"""Get a specific group of options which are allowed."""
#: These expect a hexidecimal keyid as their argument, and can be parsed
#: with :func:`_is_hex`.
hex_options = frozenset(['--check-sigs',
'--default-key',
... | 0.000461 |
def generate_config(output_directory):
""" Generate a dcm2nii configuration file that disable the interactive
mode.
"""
if not op.isdir(output_directory):
os.makedirs(output_directory)
config_file = op.join(output_directory, "config.ini")
open_file = open(config_file, "w")
open_file... | 0.002488 |
def transfer(self, user_id, amount, desc, client_ip=None,
check_name='OPTION_CHECK', real_name=None,
out_trade_no=None, device_info=None):
"""
企业付款接口
:param user_id: 接受收红包的用户在公众号下的 openid
:param amount: 付款金额,单位分
:param desc: 付款说明
:param ... | 0.002497 |
def DetectGce():
"""Determine whether or not we're running on GCE.
This is based on:
https://cloud.google.com/compute/docs/metadata#runninggce
Returns:
True iff we're running on a GCE instance.
"""
metadata_url = 'http://{}'.format(
os.environ.get('GCE_METADATA_ROOT', 'metadata... | 0.001445 |
def get_albums(self, *args, **kwargs):
"""Convenience method for `get_music_library_information`
with ``search_type='albums'``. For details of other arguments,
see `that method
<#soco.music_library.MusicLibrary.get_music_library_information>`_.
"""
args = tuple(['albums'... | 0.004975 |
def freeze(this):
"""
Snapshot current **hierarchy** and cache it into a new poco instance. This new poco instance is a copy from
current poco instance (``self``). The hierarchy of the new poco instance is fixed and immutable. It will be
super fast when calling ``dump`` function from fro... | 0.006631 |
def options_handler(self, sock, cmd, opt):
"Negotiate options"
if cmd == NOP:
self.sendcommand(NOP)
elif cmd == WILL or cmd == WONT:
if self.WILLACK.has_key(opt):
self.sendcommand(self.WILLACK[opt], opt)
else:
self.sendcommand(D... | 0.004244 |
def is_connected(C, directed=True):
r"""Return true, if the input count matrix is completely connected.
Effectively checking if the number of connected components equals one.
Parameters
----------
C : scipy.sparse matrix or numpy ndarray
Count matrix specifying edge weights.
directed : ... | 0.004274 |
def update(self, validate=False):
"""
Update the image's state information by making a call to fetch
the current image attributes from the service.
:type validate: bool
:param validate: By default, if EC2 returns no data about the
image the update method... | 0.002427 |
def compare_sentences(self, str_a, str_b, language):
"""Tokenize two input strings on sentence boundary and return a
matrix of Levenshtein distance ratios.
:param language: str (language name)
:param string_a: str
:param string_b: str
:return: list [[Comparison]]
... | 0.002463 |
def add_callback(self, user_gpio, edge=RISING_EDGE, func=None):
"""
Calls a user supplied function (a callback) whenever the
specified gpio edge is detected.
user_gpio:= 0-31.
edge:= EITHER_EDGE, RISING_EDGE (default), or FALLING_EDGE.
func:= user supplied callback... | 0.001623 |
def get_resources(self):
"""Gets the resource list resulting from a search.
return: (osid.resource.ResourceList) - the resource list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrieved:
... | 0.00409 |
def copy(self, outpoint=None, stack_script=None,
redeem_script=None, sequence=None):
'''
TxIn -> TxIn
'''
return TxIn(
outpoint=outpoint if outpoint is not None else self.outpoint,
stack_script=(stack_script if stack_script is not None
... | 0.005435 |
def forms_invalid(self, form, inlines):
"""
If the form or formsets are invalid, re-render the context data with the
data-filled form and formsets and errors.
"""
return self.render_to_response(self.get_context_data(form=form, inlines=inlines)) | 0.014085 |
def _append_commands(dct, # type: typing.Dict[str, typing.Set[str]]
module_name, # type: str
commands # type:typing.Iterable[_EntryPoint]
):
# type: (...) -> None
"""Append entry point strings representing the given Command objects.
Args:
... | 0.00086 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.