text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def display_for_value(value, request=None):
"""
Converts humanized value
examples:
boolean True/Talse ==> Yes/No
objects ==> object display name with link if current user has permissions to see the object
datetime ==> in localized format
"""
from is_core.utils.compatibility ... | 0.004878 |
def _get_template_from_string(self, ostmpl):
'''
Get a jinja2 template object from a string.
:param ostmpl: OSConfigTemplate to use as a data source.
'''
self._get_tmpl_env()
template = self._tmpl_env.from_string(ostmpl.config_template)
log('Loaded a template from... | 0.004695 |
def send_to_databox_header(self, destination_databox):
"""
Sends all the information currently in the tree to the supplied
databox's header, in alphabetical order. If the entries already
exists, just updates them.
"""
k, d = self.get_dictionary()
destination_datab... | 0.008772 |
def _detect(self):
""" Detect state variables that could be const
"""
results = []
all_info = ''
all_variables = [c.state_variables for c in self.slither.contracts]
all_variables = set([item for sublist in all_variables for item in sublist])
all_non_constant_elem... | 0.007366 |
def convert(ctype, img, palette_img, dither=False):
"""Convert an image to palette type.
Parameters
----------
ctype : `int`
Conversion type.
img : `PIL.Image`
Image to convert.
palette_img : `PIL.Image`
Palette source image.
dither : `bool`, optional
Enable ... | 0.0012 |
def create_translation_field(translated_field, language):
"""
Takes the original field, a given language, a decider model and return a
Field class for model.
"""
cls_name = translated_field.__class__.__name__
if not isinstance(translated_field, tuple(SUPPORTED_FIELDS.keys())):
raise Imp... | 0.00318 |
def sync(self, sync_item, client=None, clientId=None):
""" Adds specified sync item for the client. It's always easier to use methods defined directly in the media
objects, e.g. :func:`plexapi.video.Video.sync`, :func:`plexapi.audio.Audio.sync`.
Parameters:
client (:clas... | 0.007122 |
def attribute(self):
""" Attribute that serves as a reference getter
"""
refs = re.findall(
"\@([a-zA-Z:]+)=\\\?[\'\"]\$"+str(self.refsDecl.count("$"))+"\\\?[\'\"]",
self.refsDecl
)
return refs[-1] | 0.02682 |
def get_state(cls, clz):
"""
Retrieve the state of a given Class.
:param clz: types.ClassType
:return: Class state.
:rtype: dict
"""
if clz not in cls.__shared_state:
cls.__shared_state[clz] = (
clz.init_state() if hasattr(clz, "init_s... | 0.005168 |
def find_root(self):
""" Traverse parent refs to top. """
cmd = self
while cmd.parent:
cmd = cmd.parent
return cmd | 0.012658 |
def wait(self, cmd, raise_on_error=True):
"""
Execute command and wait for it to finish. Proceed with caution because
if you run a command that causes a prompt this will hang
"""
_, stdout, stderr = self.exec_command(cmd)
stdout.channel.recv_exit_status()
output =... | 0.003497 |
def get_entity(
self, entity_type, entity_id, history_index=-1, connected=True):
"""Return an object instance for the given entity_type and id.
By default the object state matches the most recent state from
Juju. To get an instance of the object in an older state, pass
histo... | 0.002227 |
def reclat(rectan):
"""
Convert from rectangular coordinates to latitudinal coordinates.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/reclat_c.html
:param rectan: Rectangular coordinates of a point.
:type rectan: 3-Element Array of floats
:return: Distance from the origin, Longitude... | 0.002849 |
def _on_closed(self):
"""Invoked by connections when they are closed."""
self._connected.clear()
if not self._closing:
if self._on_close_callback:
self._on_close_callback()
else:
raise exceptions.ConnectionError('closed') | 0.006645 |
def get_sample_value(self, name, labels=None):
"""Returns the sample value, or None if not found.
This is inefficient, and intended only for use in unittests.
"""
if labels is None:
labels = {}
for metric in self.collect():
for s in metric.samples:
... | 0.004695 |
def _qqplot_bar(M=1000000, alphaLevel = 0.05, distr = 'log10'):
"""calculate theoretical expectations for qqplot"""
mRange=10**(sp.arange(sp.log10(0.5),sp.log10(M-0.5)+0.1,0.1));#should be exp or 10**?
numPts=len(mRange);
betaalphaLevel=sp.zeros(numPts);#down in the plot
betaOneMinusalphaLevel=sp.zeros(numPts);#up... | 0.093117 |
def convert_cmd_scl(self, scl, cmd):
"""wrapping command in "scl enable" call and adds proper PATH
"""
# load default SCL prefix to PATH
prefix = self.policy.get_default_scl_prefix()
# read prefix from /etc/scl/prefixes/${scl} and strip trailing '\n'
try:
pref... | 0.002387 |
def is_complete(self):
""" Checks the job's output or log file to determing if
the completion criteria was met.
"""
qstat = self._grep_qstat('complete')
comp = self._grep_status('complete')
if qstat and comp:
return True
return False | 0.006645 |
def toposort(data):
"""
Dependencies are expressed as a dictionary whose keys are items
and whose values are a set of dependent items. Output is a list of
sets in topological order. The first set consists of items with no
dependences, each subsequent set consists of items that depend upon
items ... | 0.002449 |
def arg(self):
"""
Repetition argument.
"""
if self._arg == '-':
return -1
result = int(self._arg or 1)
# Don't exceed a million.
if int(result) >= 1000000:
result = 1
return result | 0.007353 |
def _add_static_handlers(self, handlers):
"""
Creates and adds the handles needed for serving static files.
:param handlers:
"""
for url, path in self.static_dirs:
handlers.append((url.rstrip("/") + "/(.*)", StaticFileHandler, {"path": path})) | 0.010135 |
def get_multi_generation(self, tables, db='default'):
"""Takes a list of table names and returns an aggregate
value for the generation"""
generations = []
for table in tables:
generations.append(self.get_single_generation(table, db))
key = self.keygen.gen_multi_key(ge... | 0.004732 |
def default_weight(element):
"""Return weight of formula element.
This implements the default weight proposed for MapMaker.
"""
if element in (Atom.N, Atom.O, Atom.P):
return 0.4
elif isinstance(element, Radical):
return 40.0
return 1.0 | 0.00361 |
def get_objective_lookup_session(self):
"""Gets the OsidSession associated with the objective lookup
service.
return: (osid.learning.ObjectiveLookupSession) - an
ObjectiveLookupSession
raise: OperationFailed - unable to complete request
raise: Unimplemented - s... | 0.002294 |
def padded_blurred_image_2d_from_padded_image_1d_and_psf(self, padded_image_1d, psf):
"""Compute a 2D padded blurred image from a 1D padded image.
Parameters
----------
padded_image_1d : ndarray
A 1D unmasked image which is blurred with the PSF.
psf : ndarray
... | 0.008726 |
def most_seen_creators_card(event_kind=None, num=10):
"""
Displays a card showing the Creators that are associated with the most Events.
"""
object_list = most_seen_creators(event_kind=event_kind, num=num)
object_list = chartify(object_list, 'num_events', cutoff=1)
return {
'card_title... | 0.004684 |
def check_syntax(code):
"""Return True if syntax is okay."""
try:
return compile(code, '<string>', 'exec', dont_inherit=True)
except (SyntaxError, TypeError, ValueError):
return False | 0.004739 |
def _get_ipv4_addrs(self):
"""
Returns the IPv4 addresses associated with this NIC. If no IPv4
addresses are used, then empty dictionary is returned.
"""
addrs = self._get_addrs()
ipv4addrs = addrs.get(netifaces.AF_INET)
if not ipv4addrs:
return {}
... | 0.005814 |
def affine_transform(x, transform_matrix, channel_index=2, fill_mode='nearest', cval=0., order=1):
"""Return transformed images by given an affine matrix in Scipy format (x is height).
Parameters
----------
x : numpy.array
An image with dimension of [row, col, channel] (default).
transform_... | 0.00396 |
def _copy_content(self, origin, dstPath):
"""copy the content of origin into dstPath
Due to concurrency problem, the content will be first
copied to a temporary file alongside `dstPath` and
then atomically moved to `dstPath`
"""
if hasattr(origin, 'read'):
... | 0.004478 |
def __get_issue_reactions(self, issue_number, total_count):
"""Get issue reactions"""
reactions = []
if total_count == 0:
return reactions
group_reactions = self.client.issue_reactions(issue_number)
for raw_reactions in group_reactions:
for reaction i... | 0.006 |
def command_msg(housecode, command):
"""Create an X10 message to send the house code and a command code."""
house_byte = 0
if isinstance(housecode, str):
house_byte = insteonplm.utils.housecode_to_byte(housecode) << 4
elif isinstance(housecode, int) and housecode < 16:
... | 0.004376 |
def take(self, idxs):
""" Takes a subset of rows """
import utool as ut
if False:
key_to_list = ut.odict([
(key, ut.take(val, idxs))
for key, val in six.iteritems(self._key_to_list)
])
else:
import numpy as np
... | 0.003072 |
def SendSerializedMessage(self, message):
"""
Send the `message` to the remote client.
Args:
message (neo.Network.Message):
"""
try:
ba = Helper.ToArray(message)
ba2 = binascii.unhexlify(ba)
self.bytes_out += len(ba2)
s... | 0.004525 |
def _other_endian(typ):
"""Return the type with the 'other' byte order. Simple types like
c_int and so on already have __ctype_be__ and __ctype_le__
attributes which contain the types, for more complicated types
only arrays are supported.
"""
try:
return getattr(typ, _OTHER_ENDIAN)
... | 0.001938 |
def get_assigned_name(frame):
"""
Checks the bytecode of *frame* to find the name of the variable a result is
being assigned to and returns that name. Returns the full left operand of the
assignment. Raises a #ValueError if the variable name could not be retrieved
from the bytecode (eg. if an unpack sequence ... | 0.01179 |
def delay_off(self):
"""
The `timer` trigger will periodically change the LED brightness between
0 and the current brightness setting. The `off` time can
be specified via `delay_off` attribute in milliseconds.
"""
# Workaround for ev3dev/ev3dev#225.
# 'delay_on' ... | 0.003464 |
def tf_step(self, time, variables, source_variables, **kwargs):
"""
Creates the TensorFlow operations for performing an optimization step.
Args:
time: Time tensor.
variables: List of variables to optimize.
source_variables: List of source variables to synchro... | 0.0044 |
def _add_element(self, element, parent_node):
"""
add an element (i.e. a unit/connective/discourse or modifier)
to the docgraph.
"""
if element.tag == 'unit':
element_node_id = element.attrib['id']+':'+element.attrib['type']
node_layers = {self.ns, self.ns... | 0.002473 |
def cli(ctx, dname, site):
"""
Launches a MySQL CLI session for the database of the specified IPS installation.
"""
assert isinstance(ctx, Context)
log = logging.getLogger('ipsv.mysql')
dname = domain_parse(dname).hostname
domain = Session.query(Domain).filter(Domain.name == dname).first()
... | 0.003284 |
def rpc_chain_sync(server_state, new_block_height, finish_time):
"""
Flush the global RPC server cache, and tell the rpc server that we've
reached the given block height at the given time.
"""
rpc_srv = server_state['rpc']
if rpc_srv is not None:
rpc_srv.cache_flush()
rpc_srv.set... | 0.002865 |
def _handle_read_chunk(self):
"""Some data can be read"""
new_data = b''
buffer_length = len(self.read_buffer)
try:
while buffer_length < self.MAX_BUFFER_SIZE:
try:
piece = self.recv(4096)
except OSError as e:
... | 0.001797 |
def ellipse(map_axis, centerlon, centerlat, major_axis, minor_axis, angle, n=360, filled=False, **kwargs):
"""
This function enables general error ellipses to be drawn on the cartopy projection of the input map axis
using a center and a set of major and minor axes and a rotation angle east of north.
(Ad... | 0.002931 |
def get_field_by_name(self, name):
"""
the field member matching name, or None if no such field is found
"""
for f in self.fields:
if f.get_name() == name:
return f
return None | 0.008163 |
def update(self, iterable):
"""Update the list by adding all elements from *iterable*."""
_lists = self._lists
_maxes = self._maxes
values = sorted(iterable)
if _maxes:
if len(values) * 4 >= self._len:
values.extend(chain.from_iterable(_lists))
... | 0.002611 |
def tiff_header(read_buffer):
"""
Interpret the uuid raw data as a tiff header.
"""
# First 8 should be (73, 73, 42, 8) or (77, 77, 42, 8)
data = struct.unpack('BB', read_buffer[0:2])
if data[0] == 73 and data[1] == 73:
# little endian
endian = '<'
elif data[0] == 77 and data... | 0.001064 |
def token_setter(remote, token, secret='', token_type='', extra_data=None,
user=None):
"""Set token for user.
:param remote: The remote application.
:param token: The token to set.
:param token_type: The token type. (Default: ``''``)
:param extra_data: Extra information. (Default: ... | 0.000824 |
def get_cmd_line(self):
"""
Return the full command line that will be used when this node
is run by DAGman.
"""
cmd = ""
cmd_list = self.get_cmd_tuple_list()
for argument in cmd_list:
cmd += ' '.join(argument) + " "
return cmd | 0.007519 |
def real_name(magic_func):
""" Find the real name of the magic.
"""
magic_name = magic_func.__name__
if magic_name.startswith('magic_'):
magic_name = magic_name[len('magic_'):]
return getattr(magic_func, 'argcmd_name', magic_name) | 0.003876 |
def tempo_account_associate_with_jira_project(self, account_id, project_id,
default_account=False,
link_type='MANUAL'):
"""
The AccountLinkBean for associate Account with project
Adds a link to an... | 0.003546 |
def generate_graph(self):
"""
Generate the graph; return a 2-tuple of strings, script to place in the
head of the HTML document and div content for the graph itself.
:return: 2-tuple (script, div)
:rtype: tuple
"""
logger.debug('Generating graph for %s', self._gr... | 0.000836 |
def to_fmt(self):
"""
Return an Fmt representation for pretty-printing
"""
qual = "evalctx"
lseval = []
block = fmt.block(":\n", "", fmt.tab(lseval))
txt = fmt.sep(" ", [qual, block])
lseval.append(self._sig.to_fmt())
if len(self.resolution) > 0:
lsb = []
for k in sor... | 0.000855 |
def get_mysql_credentials(cfg_file):
"""Get the credentials and database name from options in config file."""
try:
parser = ConfigParser.ConfigParser()
cfg_fp = open(cfg_file)
parser.readfp(cfg_fp)
cfg_fp.close()
except ConfigParser.NoOptionError:
cfg_fp.close()
... | 0.000631 |
def ncVarAttributes(ncVar):
""" Returns the attributes of ncdf variable
"""
try:
return ncVar.__dict__
except Exception as ex:
# Due to some internal error netCDF4 may raise an AttributeError or KeyError,
# depending on its version.
logger.warn("Unable to read the attribu... | 0.004914 |
def _process_pheno_enviro(self, limit=None):
"""
The pheno_environment.txt (became pheno_environment_fish.txt?)
file ties experimental conditions
to an environment ID.
An environment ID may have one or more associated conditions.
Condition groups present:
* chemic... | 0.000936 |
def grouper_nofill_str(n, iterable):
"""
Take a sequence and break it up into chunks of the specified size.
The last chunk may be smaller than size.
This works very similar to grouper_nofill, except
it works with strings as well.
>>> tuple(grouper_nofill_str(3, 'foobarbaz'))
('foo', 'bar', 'baz')
You can sti... | 0.028081 |
async def read_reply(self):
"""
Reads a reply from the server.
Raises:
ConnectionResetError: If the connection with the server is lost
(we can't read any response anymore). Or if the server
replies without a proper return code.
Returns:
... | 0.001109 |
def set_email(self, email, _vars=None, lists=None, templates=None, verified=0, optout=None, send=None, send_vars=None):
"""
DEPRECATED!
Update information about one of your users, including adding and removing the user from lists.
http://docs.sailthru.com/api/email
"""
_v... | 0.004657 |
def upload_marcxml(self, marcxml, mode):
"""
Uploads a record to the server
Parameters:
marcxml - *str* the XML to upload.
mode - *str* the mode to use for the upload.
"-i" insert new records
"-r" replace existing records
... | 0.006452 |
def expand(data):
'''Generates configuration sets based on the YAML input contents
For an introduction to the YAML mark-up, just search the net. Here is one of
its references: https://en.wikipedia.org/wiki/YAML
A configuration set corresponds to settings for **all** variables in the
input template that need... | 0.00409 |
def to_qasm(self,
header: Optional[str] = None,
precision: int = 10,
qubit_order: ops.QubitOrderOrList = ops.QubitOrder.DEFAULT,
) -> str:
"""Returns QASM equivalent to the circuit.
Args:
header: A multi-line string that is pla... | 0.008955 |
def _get_key(args, kwargs, remove_callback):
"""Calculate the cache key, using weak references where possible."""
# Use tuples, because lists are not hashable.
weak_args = tuple(_try_weakref(arg, remove_callback) for arg in args)
# Use a tuple of (key, values) pairs, because dict is not hashable.
# ... | 0.001862 |
def _new_pool(self, scheme, host, port):
"""
Create a new :class:`ConnectionPool` based on host, port and scheme.
This method is used to actually create the connection pools handed out
by :meth:`connection_from_url` and companion methods. It is intended
to be overridden for cust... | 0.003155 |
def create_config(name=None,
subvolume=None,
fstype=None,
template=None,
extra_opts=None):
'''
Creates a new Snapper configuration
name
Name of the new Snapper configuration.
subvolume
Path to the related subvolume.... | 0.003505 |
def start(name, vmid=None, call=None):
'''
Start a node.
CLI Example:
.. code-block:: bash
salt-cloud -a start mymachine
'''
if call != 'action':
raise SaltCloudSystemExit(
'The start action must be called with -a or --action.'
)
log.debug('Start: %s (... | 0.001563 |
def iterrows(self, workbook=None):
"""
Yield rows as lists of data.
The data is exactly as it is in the source pandas DataFrames and
any formulas are not resolved.
"""
resolved_tables = []
max_height = 0
max_width = 0
# while yielding rows __form... | 0.001812 |
def serialize_parameters(self):
"""
Get the parameter data in its serialized form.
Data is serialized by each parameter's :meth:`Parameter.serialize`
implementation.
:return: serialized parameter data in the form: ``{<name>: <serial data>, ...}``
:rtype: :class:`dict`
... | 0.004255 |
def read_and_hash(fname, **kw):
'''
Read and and addhash each frame.
'''
return [addhash(frame, **kw) for frame in read(fname, **kw)]; | 0.013333 |
def nvrtcCreateProgram(self, src, name, headers, include_names):
"""
Creates and returns a new NVRTC program object.
"""
res = c_void_p()
headers_array = (c_char_p * len(headers))()
headers_array[:] = encode_str_list(headers)
include_names_array = (c_char_p * len(... | 0.004011 |
def nx_delete_edge_attr(graph, name, edges=None):
"""
Removes an attributes from specific edges in the graph
Doctest:
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> G = nx.karate_club_graph()
>>> nx.set_edge_attributes(G, name='spam', values='eggs')
... | 0.00041 |
def post_dissection(self, m):
"""
First we update the client DHParams. Then, we try to update the server
DHParams generated during Server*DHParams building, with the shared
secret. Finally, we derive the session keys and update the context.
"""
s = self.tls_session
... | 0.00226 |
def uuid1(node=None, clock_seq=None):
"""Generate a UUID from a host ID, sequence number, and the current time.
If 'node' is not given, getnode() is used to obtain the hardware
address. If 'clock_seq' is given, it is used as the sequence number;
otherwise a random 14-bit sequence number is chosen."""
... | 0.001954 |
def fdf(self, x):
"""Calculate the value of the functional for the specified arguments,
and the derivatives with respect to the parameters (taking any
specified mask into account).
:param x: the value(s) to evaluate at
"""
x = self._flatten(x)
n = 1
if has... | 0.002853 |
def transform(self, dataset):
"""
Apply the transformer to the images in "inputCol" and store the transformed result
into "outputCols"
"""
self._transfer_params_to_java()
return callBigDlFunc(self.bigdl_type, "dlImageTransform", self.value, dataset) | 0.013468 |
def import_name(module_spec, name=None):
""" Import identifier C{name} from module C{module_spec}.
If name is omitted, C{module_spec} must contain the name after the
module path, delimited by a colon (like a setuptools entry-point).
@param module_spec: Fully qualified module name, e.g. C{x... | 0.001883 |
def get_identifier(self):
"""
For methods this is the return type, the name and the (non-pretty)
argument descriptor. For fields it is simply the name.
The return-type of methods is attached to the identifier when
it is a bridge method, which can technically allow two methods
... | 0.002706 |
def at(self, *loci):
'''
Return a new PileupCollection instance including only pileups for
the specified loci.
'''
loci = [to_locus(obj) for obj in loci]
single_position_loci = []
for locus in loci:
for position in locus.positions:
sin... | 0.005263 |
def add_parameter(self, field_name, param_name, param_value):
"""
Add a parameter to a field into script_fields
The ScriptFields object will be returned, so calls to this can be chained.
"""
try:
self.fields[field_name]['params'][param_name] = param_value
exc... | 0.008403 |
def matches_pattern(self, other):
"""Return if the current message matches a message template.
Compare the current message to a template message to test matches
to a pattern.
"""
properties = self._message_properties()
ismatch = False
if isinstance(other, Message... | 0.002445 |
def nodes(self, node=None):
'''walks through tree and yields each node'''
if node is None:
for root in self.stack:
yield from self.nodes(root)
else:
yield node
if node.is_container():
for child in node.children:
... | 0.005682 |
def dmag(self,band):
"""
Difference in magnitude between primary and secondary stars
:param band:
Photometric bandpass.
"""
mag2 = self.stars['{}_mag_B'.format(band)]
mag1 = self.stars['{}_mag_A'.format(band)]
return mag2-mag1 | 0.010135 |
def write_users(arguments):
"""Write users to the DB."""
import coil.init
u = coil.utils.ask("Redis URL", "redis://localhost:6379/0")
return coil.init.write_users(u) | 0.005525 |
def mk_simple_association(m, r_simp):
'''
Create a pyxtuml association from a simple association in BridgePoint.
'''
r_rel = one(r_simp).R_REL[206]()
r_form = one(r_simp).R_FORM[208]()
r_part = one(r_simp).R_PART[207]()
r_rgo = one(r_form).R_RGO[205]()
r_rto = one(r_part).R_RTO[204... | 0.004027 |
def run_command(cmd, redirect_output=True, check_exit_code=True):
"""
Runs a command in an out-of-process shell, returning the
output of that command. Working directory is ROOT.
"""
if redirect_output:
stdout = subprocess.PIPE
else:
stdout = None
proc = subprocess.Popen(cmd,... | 0.001905 |
def duplicate_node(self, node, x, y, z):
"""
Duplicate a node
:param node: Node instance
:param x: X position
:param y: Y position
:param z: Z position
:returns: New node
"""
if node.status != "stopped" and not node.is_always_running():
... | 0.002307 |
def url_fix(s, charset='utf-8'):
r"""Sometimes you get an URL by a user that just isn't a real URL because
it contains unsafe characters like ' ' and so on. This function can fix
some of the problems in a similar way browsers handle data entered by the
user:
>>> url_fix(u'http://de.wikipedia.org/wi... | 0.002358 |
def exclude(self, d, item):
""" check metadata for excluded items """
try:
md = d.__metadata__
pmd = getattr(md, '__print__', None)
if pmd is None:
return False
excludes = getattr(pmd, 'excludes', [])
return ( item[0] in exclude... | 0.015873 |
def generate_start_command(server, options_override=None, standalone=False):
"""
Check if we need to use numactl if we are running on a NUMA box.
10gen recommends using numactl on NUMA. For more info, see
http://www.mongodb.org/display/DOCS/NUMA
"""
command = []
if mongod_ne... | 0.001309 |
def getcwd(cls):
"""
Provide a context dependent current working directory. This method
will return the directory currently holding the lock.
"""
if not hasattr(cls._tl, "cwd"):
cls._tl.cwd = os.getcwd()
return cls._tl.cwd | 0.007092 |
def declare_selfvars(self):
"""
A block to declare self variables
"""
self._dictErr = {
'inputDirFail' : {
'action' : 'trying to check on the input directory, ',
'error' : 'directory not found. This is a *required* input',
... | 0.019904 |
def show_approx(self, numfmt='%.3g'):
"""Show the probabilities rounded and sorted by key, for the
sake of portable doctests."""
return ', '.join([('%s: ' + numfmt) % (v, p)
for (v, p) in sorted(self.prob.items())]) | 0.007547 |
def _get_points_for_series(self, series):
"""Return generator of dict from columns and values of a series.
:param series: One series
:return: Generator of dicts
"""
for point in series.get('values', []):
yield self.point_from_cols_vals(
series['column... | 0.005556 |
def numdiff2(f, x0, dv=1e-8):
'''Returns the derivative of f w.r.t. to multidimensional vector x0
If x0 is of dimension R1 x ... x Rd dimension of f is assumed to be
in the form S1 x ... x Sf x Rn. The last dimension corresponds to various
observations. The value returned is of dimension :
S1 x ... x Sf x R1 x ... ... | 0.00875 |
def _get_default_account(self):
"""
Get the ID of an account you can use to access projects.
"""
newclient = self.__class__(self.session, self.root_url)
account_info = newclient.get('/accounts/')
if account_info['default_account'] is not None:
return account_i... | 0.002721 |
def delete(self, callback=None, errback=None):
"""
Delete the monitor
"""
return self._rest.delete(self.data['id'], callback=callback, errback=errback) | 0.016393 |
def initialize_dictionaries(self, p_set):
"""
Initialize dictionaries with the textual inputs in the PredictorSet object
p_set - PredictorSet object that has had data fed in
"""
success = False
if not (hasattr(p_set, '_type')):
error_message = "needs to be an ... | 0.00815 |
def sys_check_for_event(
mask: int, k: Optional[Key], m: Optional[Mouse]
) -> int:
"""Check for and return an event.
Args:
mask (int): :any:`Event types` to wait for.
k (Optional[Key]): A tcod.Key instance which might be updated with
an event. Can be None.
... | 0.001447 |
def change_score_for_member_in(self, leaderboard_name, member, delta, member_data=None):
'''
Change the score for a member in the named leaderboard by a delta which can be positive or negative.
@param leaderboard_name [String] Name of the leaderboard.
@param member [String] Member name.... | 0.005112 |
def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):
"""Generates a non-guessable OAuth token
OAuth (1 and 2) does not specify the format of tokens except that they
should be strings of random characters. Tokens should not be guessable
and entropy when generating the random characters is i... | 0.001969 |
def parse(self, data):
"""Parse a 17 bytes packet in the Wind format and return a
dictionary containing the data extracted. An example of a return value
would be:
.. code-block:: python
{
'id': "0x2EB2",
'packet_length': 16,
'... | 0.000844 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.