text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def request_signature(self, stringtosign):
"""
Construct a signature by making an RFC2104 HMAC-SHA1
of the following and converting it to Base64 UTF-8 encoded string.
"""
digest = hmac.new(
self.secret_key.encode(ENCODING),
stringtosign.encode(ENCODING),
... | 0.005051 |
def p_state_action_constraint_section(self, p):
'''state_action_constraint_section : STATE_ACTION_CONSTRAINTS LCURLY state_cons_list RCURLY SEMI
| STATE_ACTION_CONSTRAINTS LCURLY RCURLY SEMI'''
if len(p) == 6:
p[0] = ('constraints', p[3])
el... | 0.009302 |
def get(self, addresses):
"""Returns the value in this context, or None, for each address in
addresses. Useful for gets on the context manager.
Args:
addresses (list of str): The addresses to return values for, if
within this context.
Returns:
re... | 0.003367 |
def all_as_list():
'''
returns a list of all defined containers
'''
as_dict = all_as_dict()
containers = as_dict['Running'] + as_dict['Frozen'] + as_dict['Stopped']
containers_list = []
for i in containers:
i = i.replace(' (auto)', '')
containers_list.append(i)
... | 0.005831 |
def get_instance(self, payload):
"""
Build an instance of TollFreeInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance
:rtype: twilio.rest.api.v2010.account.available_phone_number.t... | 0.007143 |
def log(self, session):
"""Logs training progress."""
logging.info('Train [%s/%d], step %d (%.3f sec) %.1f '
'global steps/s, %.1f local steps/s', self.task.type,
self.task.index, self.global_step,
(self.now - self.start_time),
(self.global_ste... | 0.001439 |
def peek_64(library, session, address):
"""Read an 64-bit value from the specified address.
Corresponds to viPeek64 function of the VISA library.
:param library: the visa library wrapped by ctypes.
:param session: Unique logical identifier to a session.
:param address: Source address to read the v... | 0.001739 |
def list_models(filename):
""" Lists all models in given filename.
Parameters
----------
filename: str
path to filename, where the model has been stored.
Returns
-------
obj: dict
A mapping by name and a comprehensive description like this:
{model_name: {'repr' : 's... | 0.004024 |
def _make_node(self, singular, plural, variables, plural_expr,
vars_referenced, num_called_num):
"""Generates a useful node from the data provided."""
# no variables referenced? no need to escape for old style
# gettext invocations only if there are vars.
if not vars_... | 0.001521 |
def wrap_guess_content_type(func_, *args, **kwargs):
"""
guesses the content type with libmagic if available
:param func_:
:param args:
:param kwargs:
:return:
"""
assert isinstance(args[0], dict)
if not args[0].get(CONTENTTYPE_FIELD, None):
content = args[0].get(CONTENT_FIEL... | 0.001773 |
def get_pub_abbreviation(pubstring, numBest=5, exact=None):
"""
Get ADS journal abbreviation ("bibstem") candidates for a given publication name.
* 'exact': if True results will only be returned if an exact match was found
* 'numBest': maximum number of guesses to return
A list of tuples will be ret... | 0.006832 |
def request(self, action, params=None, action_token_type=None,
upload_info=None, headers=None):
"""Perform request to MediaFire API
action -- "category/name" of method to call
params -- dict of parameters or query string
action_token_type -- action token to use: None, "u... | 0.00133 |
def fmap_info(metadata, img, config, layout):
"""
Generate a paragraph describing field map acquisition information.
Parameters
----------
metadata : :obj:`dict`
Data from the json file associated with the field map, in dictionary
form.
img : :obj:`nibabel.Nifti1Image`
T... | 0.000928 |
def search_dependencies(self):
"""Returns a list of modules that this executable needs in order to run
properly. This includes special kind declarations for precision or derived
types, but not dependency executable calls.
"""
#It is understood that this executable's module is obv... | 0.00813 |
def index(self, i, length=None):
"""Return an integer index or None"""
if self.begin <= i <= self.end:
index = i - self.BEGIN - self.offset
if length is None:
length = self.full_range()
else:
length = min(length, self.full_range())
... | 0.005249 |
def set(self, n=None, ftype=None, colfac=None, lmfac=None, fid=0):
"""Set selected properties of the fitserver instance.
All unset properties remain the same (in the :meth:`init` method all
properties are (re-)initialized). Like in the constructor, the number
of unknowns to be solved fo... | 0.001153 |
def copy(self, dest, src):
"""Copy element from sequence, member from mapping.
:param dest: the destination
:type dest: Pointer
:param src: the source
:type src: Pointer
:return: resolved document
:rtype: Target
"""
doc = fragment = deepcopy(self.... | 0.004202 |
def _dir_exists(db, user_id, db_dirname):
"""
Internal implementation of dir_exists.
Expects a db-style path name.
"""
return db.execute(
select(
[func.count(directories.c.name)],
).where(
and_(
directories.c.user_id == user_id,
... | 0.0025 |
def SocketWriter(host, port, af=None, st=None):
""" Writes messages to a socket/host. """
import socket
if af is None:
af = socket.AF_INET
if st is None:
st = socket.SOCK_STREAM
message = '({0}): {1}'
s = socket.socket(af, st)
s.connect(host, port)
try:
while True... | 0.002375 |
def GetParserPluginsInformation(cls, parser_filter_expression=None):
"""Retrieves the parser plugins information.
Args:
parser_filter_expression (Optional[str]): parser filter expression,
where None represents all parsers and plugins.
Returns:
list[tuple[str, str]]: pairs of parser p... | 0.006402 |
def parse(file_path, convert_neg_666=True, rid=None, cid=None,
ridx=None, cidx=None, row_meta_only=False, col_meta_only=False, make_multiindex=False):
"""
The main method.
Args:
- file_path (string): full path to gct(x) file you want to parse
- convert_neg_666 (bool): whether to c... | 0.003023 |
def random_polygon(segments=8, radius=1.0):
"""
Generate a random polygon with a maximum number of sides and approximate radius.
Parameters
---------
segments: int, the maximum number of sides the random polygon will have
radius: float, the approximate radius of the polygon desired
Retur... | 0.003597 |
def as_html(self, path=""):
"""
Return a rendering of the current state in HTML.
"""
if path not in self.top_level_links:
raise StateError("Unknown path")
header = """
<html>
<head>
<title>VPC-router state</title>
</he... | 0.003019 |
def total_bytes_processed(self):
"""Return total bytes processed from job statistics, if present.
See:
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#statistics.query.totalBytesProcessed
:rtype: int or None
:returns: total bytes processed by the job, or None if j... | 0.003802 |
def setup(self, environ):
'''Called once to setup the list of wsgi middleware.'''
json_handler = Root().putSubHandler('calc', Calculator())
middleware = wsgi.Router('/', post=json_handler,
accept_content_types=JSON_CONTENT_TYPES)
response = [wsgi.GZipMidd... | 0.003802 |
def run(self, cmd, target=None, lock_name=None, shell=None, nofail=False, clean=False, follow=None, container=None):
"""
The primary workhorse function of PipelineManager, this runs a command.
This is the command execution function, which enforces
race-free file-locking, enables restar... | 0.004181 |
def _in(field, value, document):
"""
Returns True if document[field] is in the interable value. If the
supplied value is not an iterable, then a MalformedQueryException is raised
"""
try:
values = iter(value)
except TypeError:
raise MalformedQueryException("'$in' must accept an i... | 0.002653 |
def from_serializable_data(cls, data, check_fks=True, strict_fks=False):
"""
Build an instance of this model from the JSON-like structure passed in,
recursing into related objects as required.
If check_fks is true, it will check whether referenced foreign keys still
exist in the ... | 0.004883 |
def groups(self):
"""Method returns a list of all goup paths
Examples
--------
>>> for group in h5f.groups():
print(group)
'/'
'/dataset1'
'/dataset1/data1'
'/dataset1/data2'
"""
HiisiHDF._clear_cach... | 0.010917 |
def set_size(self, size):
'''
Size is only set the first time it is called
Size that is set is returned
'''
if self.size is None:
self.size = size
return size
else:
return self.size | 0.007519 |
def contains_content_items(self, request, pk, course_run_ids, program_uuids):
"""
Return whether or not the specified content is available to the EnterpriseCustomer.
Multiple course_run_ids and/or program_uuids query parameters can be sent to this view to check
for their existence in th... | 0.007414 |
def perform(action_name, container, **kwargs):
"""
Performs an action on the given container map and configuration.
:param action_name: Name of the action (e.g. ``update``).
:param container: Container configuration name.
:param kwargs: Keyword arguments for the action implementation.
"""
c... | 0.002577 |
def H(self, H):
"""
Set the enthalpy of the package to the specified value, and
recalculate it's temperature.
:param H: The new enthalpy value. [kWh]
"""
self._H = H
self._T = self._calculate_T(H) | 0.007874 |
def rasterize(self,
pitch,
origin,
resolution=None,
fill=True,
width=None,
**kwargs):
"""
Rasterize a Path2D object into a boolean image ("mode 1").
Parameters
------------
... | 0.007744 |
def get_icon(name, aspix=False, asicon=False):
"""Return the real file path to the given icon name
If aspix is True return as QtGui.QPixmap, if asicon is True return as QtGui.QIcon.
:param name: the name of the icon
:type name: str
:param aspix: If True, return a QtGui.QPixmap.
:type aspix: boo... | 0.003348 |
def o3(df):
"""
Calculs réglementaires pour l'ozone
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de RI sur 1H: 180u... | 0.002924 |
def GetDateRange(self):
"""Returns a tuple of (earliest, latest) dates on which the service periods
in the schedule define service, in YYYYMMDD form.
"""
(minvalue, maxvalue, minorigin, maxorigin) = self.GetDateRangeWithOrigins()
return (minvalue, maxvalue) | 0.00361 |
def get_number_of_particles():
"""
Queries the ``dynac.short`` file for the number of particles used in the
simulation.
"""
with open('dynac.short') as f:
data_str = ''.join(line for line in f.readlines())
num_of_parts = int(data_str.split('Simulation with')[1].strip().split()[0])
... | 0.005865 |
def get_works(self):
"""Returns a list of the names of all works in the corpus.
:rtype: `list` of `str`
"""
return [os.path.split(filepath)[1] for filepath in
glob.glob(os.path.join(self._path, '*'))
if os.path.isdir(filepath)] | 0.006826 |
def get_gallery_file(self, file_id, output_file_path=None, scope='content/read'):
"""
Get a file in the Mxit user's gallery
User authentication required with the following scope: 'content/read'
"""
data = _get(
token=self.oauth.get_user_token(scope),
uri='... | 0.005725 |
def open(name=None, fileobj=None, closefd=True):
"""
Use all decompressor possible to make the stream
"""
return Guesser().open(name=name, fileobj=fileobj, closefd=closefd) | 0.005319 |
def default_bitcoind_opts(config_file=None, prefix=False):
"""
Get our default bitcoind options, such as from a config file,
or from sane defaults
"""
default_bitcoin_opts = virtualchain.get_bitcoind_config(config_file=config_file)
# drop dict values that are None
default_bitcoin_opts = {k... | 0.005607 |
def pathname(self):
"""
Path name is a recursive representation parent path name plus the name
which was assigned to this object by its parent. In other words, it is
stack of parent name where top is always parent's original name:
`parent.pathname + parent.childname` and stop con... | 0.004021 |
def _extract_table(table_data, current, pc, ts, tt):
"""
Use the given table data to create a time series entry for each column in the table.
:param dict table_data: Table data
:param dict current: LiPD root data
:param str pc: paleoData or chronData
:param list ts: Time series (so far)
:pa... | 0.003693 |
def hide_routemap_holder_route_map_content_set_distance_dist_rms(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
hide_routemap_holder = ET.SubElement(config, "hide-routemap-holder", xmlns="urn:brocade.com:mgmt:brocade-ip-policy")
route_map = ET.SubElemen... | 0.003929 |
def send_mail(subject, message, from_email, recipient_list, html_message='',
scheduled_time=None, headers=None, priority=PRIORITY.medium):
"""
Add a new message to the mail queue. This is a replacement for Django's
``send_mail`` core email method.
"""
subject = force_text(subject)
... | 0.002361 |
def do_gate(self, gate: Gate) -> 'AbstractQuantumSimulator':
"""
Perform a gate.
:return: ``self`` to support method chaining.
"""
unitary = lifted_gate(gate=gate, n_qubits=self.n_qubits)
self.density = unitary.dot(self.density).dot(np.conj(unitary).T)
return sel... | 0.006231 |
def getProperty(self, prop, *args, **kwargs):
"""
Get the value of a property. See the corresponding method for the
required arguments. For example, for the property _NET_WM_STATE, look
for :meth:`getWmState`
"""
f = self.__getAttrs.get(prop)
if not f:
... | 0.004808 |
def Interpolate(time, mask, y):
'''
Masks certain elements in the array `y` and linearly
interpolates over them, returning an array `y'` of the
same length.
:param array_like time: The time array
:param array_like mask: The indices to be interpolated over
:param array_like y: The dependent ... | 0.001311 |
def get_info(self):
"""
Return plugin information.
"""
return {
self.get_plugin_name() : {
"version" : self.get_version(),
"params" : {
"file" : self.conf['file']
},
"stats" : {
... | 0.01487 |
def visitEqualityExpression(self, ctx):
"""
expression: expression (EQ | NEQ) expression
"""
arg1, arg2 = conversions.to_same(self.visit(ctx.expression(0)), self.visit(ctx.expression(1)), self._eval_context)
if isinstance(arg1, str):
# string equality is case-insensi... | 0.006237 |
def fire_update_event(self, *args, **kwargs):
"""Trigger the method tied to _on_update"""
for _handler in self._on_update:
_handler(*args, **kwargs) | 0.011364 |
def right_click_zijderveld(self, event):
"""
toggles between zoom and pan effects for the zijderveld on right
click
Parameters
----------
event : the wx.MouseEvent that triggered the call of this function
Alters
------
zijderveld_setting, toolbar... | 0.00246 |
def right(X, i):
"""Compute the orthogonal matrix Q_{\geq i} as defined in [1]."""
if i > X.d-1:
return np.ones([1, 1])
answ = np.ones([1, 1])
cores = tt.tensor.to_list(X)
for dim in xrange(X.d-1, i-1, -1):
answ = np.tensordot(cores[dim], answ, 1)
answ = reshape(answ, (X.r[i], -1... | 0.005882 |
def _magic(header, footer, mime, ext=None):
""" Discover what type of file it is based on the incoming string """
if not header:
raise ValueError("Input was empty")
info = _identify_all(header, footer, ext)[0]
if mime:
return info.mime_type
return info.extension if not \
isin... | 0.002695 |
def log(logger=None, start_message='Starting...', end_message='Done...'):
"""
Basic log decorator
Can be used as :
- @log (with default logger)
- @log(mylogger)
- @log(start_message='Hello !", logger=mylogger, end_message='Bye !')
"""
def actual_log(f, real_logger=logger):
logger... | 0.002545 |
def start(self):
"""
Try to init the main sub-components (:func:`~responsebot.utils.handler_utils.discover_handler_classes`, \
:func:`~responsebot.utils.auth_utils.auth`, :class:`~responsebot.responsebot_stream.ResponseBotStream`, etc.)
"""
logging.info('ResponseBot started')
... | 0.006856 |
def flatten(iterable, map2iter=None):
"""recursively flatten nested objects"""
if map2iter and isinstance(iterable):
iterable = map2iter(iterable)
for item in iterable:
if isinstance(item, str) or not isinstance(item, abc.Iterable):
yield item
else:
yield fro... | 0.002899 |
def calling_code(f, f_name=None, raise_for_missing=True):
"""Return the code string for calling a function. """
import inspect
from ambry.dbexceptions import ConfigurationError
if inspect.isclass(f):
try:
args = inspect.getargspec(f.__init__).args
except TypeError as e:
... | 0.00297 |
def _use_rev_b_archive(self, records, offset):
'''
return True if weather station returns Rev.B archives
'''
# if pre-determined, return result
if type(self._ARCHIVE_REV_B) is bool:
return self._ARCHIVE_REV_B
# assume, B and check 'RecType' field
data ... | 0.00321 |
def urlparse(url):
"""Parse the URL in a Python2/3 independent fashion.
:param str url: The URL to parse
:rtype: Parsed
"""
value = 'http%s' % url[5:] if url[:5] == 'postgresql' else url
parsed = _urlparse.urlparse(value)
path, query = parsed.path, parsed.query
hostname = parsed.hostna... | 0.001406 |
def _filesystem(self, **kwargs):
"""Returns a :class:`FileSystemCache` instance"""
kwargs.update(dict(
threshold=self._config('threshold', 500),
))
return FileSystemCache(self._config('dir', None), **kwargs) | 0.007968 |
def create_milestone(self, title, state=None, description=None,
due_on=None):
"""Create a milestone for this repository.
:param str title: (required), title of the milestone
:param str state: (optional), state of the milestone, accepted
values: ('open', 'clo... | 0.002885 |
def strip_doc_string(proto): # type: (google.protobuf.message.Message) -> None
"""
Empties `doc_string` field on any nested protobuf messages
"""
assert isinstance(proto, google.protobuf.message.Message)
for descriptor in proto.DESCRIPTOR.fields:
if descriptor.name == 'doc_string':
... | 0.001449 |
def get_zones(self, q=None, **kwargs):
"""Returns a list of zones across all of the user's accounts.
Keyword Arguments:
q -- The search parameters, in a dict. Valid keys are:
name - substring match of the zone name
zone_type - one of:
PRIMARY
... | 0.004386 |
def _perform_merge(self, other):
"""
Merges the longer string
"""
if len(other.value) > len(self.value):
self.value = other.value[:]
return True | 0.010204 |
def allowCommission(self):
"""start commissioner candidate petition process
Returns:
True: successful to start commissioner candidate petition process
False: fail to start commissioner candidate petition process
"""
print '%s call allowCommission' % self.port
... | 0.005875 |
def filter_dict(d, cb):
"""
Filter a dictionary based on passed function.
:param d: The dictionary to be filtered
:param cb: A function which is called back for each k, v pair of the dictionary. Should return Truthy or Falsey
:return: The filtered dictionary (new instance)
"""
return {k: v... | 0.005634 |
def loop_misc(self):
"""Misc loop."""
self.check_keepalive()
if self.last_retry_check + 1 < time.time():
pass
return NC.ERR_SUCCESS | 0.017045 |
def sort_layout(thread, listfile, column=0):
"""
Sort the syntelog table according to chromomomal positions. First orient the
contents against threadbed, then for contents not in threadbed, insert to
the nearest neighbor.
"""
from jcvi.formats.base import DictFile
outfile = listfile.rsplit(... | 0.003273 |
def delegators(self, account):
"""
Returns a list of pairs of delegator names given **account** a
representative and its balance
.. version 8.0 required
:param account: Account to return delegators for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`... | 0.002833 |
def vr60baro(msg):
"""Vertical rate from barometric measurement, this value may be very noisy.
Args:
msg (String): 28 bytes hexadecimal message (BDS60) string
Returns:
int: vertical rate in feet/minutes
"""
d = hex2bin(data(msg))
if d[34] == '0':
return None
sign ... | 0.001733 |
async def query_pathings(self, zipped_list: List[List[Union[Unit, Point2, Point3]]]) -> List[Union[float, int]]:
""" Usage: await self.query_pathings([[unit1, target2], [unit2, target2]])
-> returns [distance1, distance2]
Caution: returns 0 when path not found
Might merge this function w... | 0.004731 |
def assist(self):
"""Send a voice request to the Assistant and playback the response.
Returns: True if conversation should continue.
"""
continue_conversation = False
device_actions_futures = []
self.conversation_stream.start_recording()
logging.info('Recording ... | 0.00059 |
def _diff_stack(self, stack, **kwargs):
"""Handles the diffing a stack in CloudFormation vs our config"""
if self.cancel.wait(0):
return INTERRUPTED
if not build.should_submit(stack):
return NotSubmittedStatus()
if not build.should_update(stack):
ret... | 0.000861 |
def IsFileRequired(self, filename):
"""Returns true if a file is required by GTFS, false otherwise.
Unknown files are, by definition, not required"""
if filename not in self._file_mapping:
return False
mapping = self._file_mapping[filename]
return mapping['required'] | 0.006826 |
def min_mean_cycle(graph, weight, start=0):
"""Minimum mean cycle by Karp
:param graph: directed graph in listlist or listdict format
:param weight: in matrix format or same listdict graph
:param int start: vertex that should be contained in cycle
:returns: cycle as vertex list, average arc weights... | 0.001127 |
def get_int_noerr(self, arg):
"""Eval arg and it is an integer return the value. Otherwise
return None"""
if self.curframe:
g = self.curframe.f_globals
l = self.curframe.f_locals
else:
g = globals()
l = locals()
pass
try... | 0.008565 |
def validate_request(request, schema):
"""
Request validation does the following steps.
1. validate that the path matches one of the defined paths in the schema.
2. validate that the request method conforms to a supported methods for the given path.
3. validate that the request parameters ... | 0.002641 |
def _DecodeUnrecognizedFields(message, pair_type):
"""Process unrecognized fields in message."""
new_values = []
codec = _ProtoJsonApiTools.Get()
for unknown_field in message.all_unrecognized_fields():
# TODO(craigcitro): Consider validating the variant if
# the assignment below doesn't ... | 0.000881 |
def eval(self, expr, lineno=0, show_errors=True):
"""Evaluate a single statement."""
self.lineno = lineno
self.error = []
self.start_time = time.time()
try:
node = self.parse(expr)
except:
errmsg = exc_info()[1]
if len(self.error) > 0:
... | 0.005333 |
def get_setting(setting):
""" Get the specified django setting, or it's default value """
defaults = {
# The context to use for rendering fields
'TEMPLATE_FIELD_CONTEXT': {},
# When this is False, don't do any TemplateField rendering
'TEMPLATE_FIELD_RENDER': True
}
try:
... | 0.001961 |
def update_scope_of_processing(self, process_name, uow, start_timeperiod, end_timeperiod):
"""method reads collection and refine slice upper bound for processing"""
source_collection_name = uow.source
last_object_id = self.ds.lowest_primary_key(source_collection_name, start_timeperiod, end_timep... | 0.01059 |
def fastaAlignmentWrite(columnAlignment, names, seqNo, fastaFile,
filter=lambda x : True):
"""
Writes out column alignment to given file multi-fasta format
"""
fastaFile = open(fastaFile, 'w')
columnAlignment = [ i for i in columnAlignment if filter(i) ]
for seq in xrange... | 0.007859 |
def create_configmap(
name,
namespace,
data,
source=None,
template=None,
saltenv='base',
**kwargs):
'''
Creates the kubernetes configmap as defined by the user.
CLI Examples::
salt 'minion1' kubernetes.create_configmap \
settings ... | 0.001421 |
def delete_index(self, attr):
"""Deletes an index from the Table. Can be used to drop and rebuild an index,
or to convert a non-unique index to a unique index, or vice versa.
@param attr: name of an indexed attribute
@type attr: string
"""
if attr in self._index... | 0.008511 |
def is_all_field_none(self):
"""
:rtype: bool
"""
if self._id_ is not None:
return False
if self._created is not None:
return False
if self._updated is not None:
return False
if self._type_ is not None:
return Fa... | 0.003731 |
def correctGrid(self, img, grid):
'''
grid -> array of polylines=((p0x,p0y),(p1x,p1y),,,)
'''
self.img = imread(img)
h = self.homography # TODO: cleanup only needed to get newBorder attr.
if self.opts['do_correctIntensity']:
self.img = self.img / s... | 0.000594 |
def set_motor_force(self, motor_name, force):
""" Sets the maximum force or torque that a joint can exert. """
self.call_remote_api('simxSetJointForce',
self.get_object_handle(motor_name),
force,
sending=True) | 0.00639 |
def generate_slug(obj, text, tail_number=0):
from panya.models import ModelBase
"""
Returns a new unique slug. Object must provide a SlugField called slug.
URL friendly slugs are generated using django.template.defaultfilters' slugify.
Numbers are added to the end of slugs for uniqueness.
"""
... | 0.008523 |
def to_json(self, fp=None, default=_json_default, **kwargs):
"""
Represent the current `TLObject` as JSON.
If ``fp`` is given, the JSON will be dumped to said
file pointer, otherwise a JSON string will be returned.
Note that bytes and datetimes cannot be represented
in ... | 0.003226 |
def load_dataset(self, dataset, verbose=True):
"""
Load a directory of gnt files. Yields the image and label in tuples.
:param dataset: The directory to load.
:return: Yields (Pillow.Image.Image, label) pairs.
"""
assert self.get_dataset(dataset) is True, "Datasets aren'... | 0.005533 |
def components(self, obj, fmt=None, comm=True, **kwargs):
"""
Returns data and metadata dictionaries containing HTML and JS
components to include render in app, notebook, or standalone
document. Depending on the backend the fmt defines the format
embedded in the HTML, e.g. png or... | 0.001972 |
def load(self, table: str):
"""Set the main dataframe from a table's data
:param table: table name
:type table: str
:example: ``ds.load("mytable")``
"""
if self._check_db() is False:
return
if table not in self.db.tables:
self.warning("Th... | 0.002954 |
def concat(
df,
*,
columns: List[str],
new_column: str,
sep: str = None
):
"""
Concatenate `columns` element-wise
See [pandas doc](
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.str.cat.html) for more information
---
### Parame... | 0.005044 |
def translate_symbol(self, in_symbol: str) -> str:
""" translate the incoming symbol into locally-used """
# read all mappings from the db
if not self.symbol_maps:
self.__load_symbol_maps()
# translate the incoming symbol
result = self.symbol_maps[in_symbol] if in_sym... | 0.007874 |
def getFiltersFromArgs(kwargs):
'''
getFiltersFromArgs - Returns a dictionary of each filter type, and the corrosponding field/value
@param kwargs <dict> - Dictionary of filter arguments
@return - Dictionary of each filter type (minus the ones that are optimized into others), each contain... | 0.009027 |
def profile_match(adapter, profiles, hard_threshold=0.95, soft_threshold=0.9):
"""
given a dict of profiles, searches through all the samples in the DB
for a match. If a matching sample is found an exception is raised,
and the variants will not be loaded into the database.
Args:
... | 0.004459 |
def async_task(self, func):
"""
Execute handler as task and return None.
Use this decorator for slow handlers (with timeouts)
.. code-block:: python3
@dp.message_handler(commands=['command'])
@dp.async_task
async def cmd_with_timeout(message: types.M... | 0.001794 |
def schedule_play(self, call_params):
"""REST Schedule playing something on a call Helper
"""
path = '/' + self.api_version + '/SchedulePlay/'
method = 'POST'
return self.request(path, method, call_params) | 0.008163 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.