text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _save_cookies(requests_cookiejar, filename):
"""Save cookies to a file."""
with open(filename, 'wb') as handle:
pickle.dump(requests_cookiejar, handle) | 0.005848 |
def instance_from_physical_vector(self, physical_vector):
"""
Creates a ModelInstance, which has an attribute and class instance corresponding to every PriorModel \
attributed to this instance.
This method takes as input a physical vector of parameter values, thus omitting the use of pr... | 0.005924 |
def cut_across_axis(self, dim, minval=None, maxval=None):
'''
Cut the mesh by a plane, discarding vertices that lie behind that
plane. Or cut the mesh by two parallel planes, discarding vertices
that lie outside them.
The region to keep is defined by an axis of perpendicularity,... | 0.001867 |
async def start(self, remoteCaps, remotePort):
"""
Start the transport.
"""
if not self.__started:
self.__started = True
self.__state = 'connecting'
self._remote_port = remotePort
# configure logging
if logger.isEnabledFor(logg... | 0.00346 |
def _check_year(year, month, error, error_msg):
"""Checks that the year is within 50 years from now."""
if year not in xrange((now.year - 50), (now.year + 51)):
year = now.year
month = now.month
error = error_msg
return year, month, error | 0.00365 |
def __perform_rest_call(self, requestURL, params=None, headers=None, restType='GET', body=None):
"""Returns the JSON representation of the response if the response
status was ok, returns ``None`` otherwise.
"""
auth, headers = self.__prepare_gprest_call(requestURL, params=params, hea... | 0.008395 |
def readrows(self):
"""Using the BroLogReader this method yields each row of the log file
replacing timestamps, looping and emitting rows based on EPS rate
"""
# Loop forever or until max_rows is reached
num_rows = 0
while True:
# Yield the rows from the ... | 0.002915 |
def generate_boto3_response(operation):
"""The decorator to convert an XML response to JSON, if the request is
determined to be from boto3. Pass the API action as a parameter.
"""
def _boto3_request(method):
@wraps(method)
def f(self, *args, **kwargs):
rendered = method(self... | 0.003226 |
def save(self, fname):
"""Save the report"""
with open(fname, 'wb') as f:
f.write(encode(self.text)) | 0.015625 |
def scale(self, factor, inplace=True):
""" Multiplies all branch lengths by factor. """
if not inplace:
t = self.copy()
else:
t = self
t._tree.scale_edges(factor)
t._dirty = True
return t | 0.007722 |
def write_unchecked_data(self, offsets, data):
# type: (Descriptor, Offsets, bytes) -> None
"""Write unchecked data to disk
:param Descriptor self: this
:param Offsets offsets: download offsets
:param bytes data: data
"""
self.write_data(offsets, data)
unc... | 0.004412 |
def schedule_contact_downtime(self, contact, start_time, end_time, author, comment):
"""Schedule contact downtime
Format of the line that triggers function call::
SCHEDULE_CONTACT_DOWNTIME;<contact_name>;<start_time>;<end_time>;<author>;<comment>
:param contact: contact to put in downt... | 0.003122 |
def _get_type(self, value):
"""Get the data type for *value*."""
if value is None:
return type(None)
elif type(value) in int_types:
return int
elif type(value) in float_types:
return float
elif isinstance(value, binary_type):
return... | 0.005333 |
async def section_name(self, sec_name=None):
"""
Section name
:param sec_name:
:return:
"""
if self.writing:
fvalue = sec_name.encode('ascii')
await x.dump_uint(self.iobj, len(fvalue), 1)
await self.iobj.awrite(bytearray(fvalue))
... | 0.003883 |
def upload(self, env, cart, callback=None):
"""
Nothing special happens here. This method recieves a
destination repo, and a payload of `cart` which will be
uploaded into the target repo.
Preparation: To use this method you must pre-process your
cart: Remotes must be fet... | 0.00457 |
def seek_previous_line(self):
"""
Seek previous line relative to the current file position.
:return: Position of the line or -1 if previous line was not found.
"""
where = self.file.tell()
offset = 0
while True:
if offset == where:
br... | 0.002402 |
def base64url_decode(input):
"""Helper method to base64url_decode a string.
Args:
input (str): A base64url_encoded string to decode.
"""
rem = len(input) % 4
if rem > 0:
input += b'=' * (4 - rem)
return base64.urlsafe_b64decode(input) | 0.003597 |
def is_never_accessible(self):
""" Returns true if the course/task is never accessible """
return self._val[0] == datetime.max and self._val[1] == datetime.max | 0.011429 |
def _one_diagonal_capture_square(self, capture_square, position):
"""
Adds specified diagonal as a capture move if it is one
"""
if self.contains_opposite_color_piece(capture_square, position):
if self.would_move_be_promotion():
for move in self.create_promot... | 0.006279 |
def _set_route(self, ip_dest, next_hop, **kwargs):
"""Configure a static route
Args:
ip_dest (string): The ip address of the destination in the
form of A.B.C.D/E
next_hop (string): The next hop interface or ip address
**kwargs['next_hop_ip'] (string):... | 0.001412 |
def credit_note_pdf(self, credit_note_it):
"""
Opens a pdf of a credit note
:param credit_note_it: the credit note id
:return: dict
"""
return self._create_get_request(resource=CREDIT_NOTES, billomat_id=credit_note_it, command=PDF) | 0.010714 |
def java_timestamp(timestamp=True):
"""
.. versionadded:: 0.2.0
Returns a timestamp in the format produced by |date_tostring|_, e.g.::
Mon Sep 02 14:00:54 EDT 2016
If ``timestamp`` is `True` (the default), the current date & time is
returned.
If ``timestamp`` is `None` or `False`, an... | 0.000642 |
def get_filter_item(name: str, operation: bytes, value: bytes) -> bytes:
"""
A field could be found for this term, try to get filter string for it.
"""
assert isinstance(name, str)
assert isinstance(value, bytes)
if operation is None:
return filter_format(b"(%s=%s)", [name, value])
e... | 0.001957 |
def unbounded(self):
"""
Get whether this node is unbounded I{(a collection)}
@return: True if unbounded, else False.
@rtype: boolean
"""
max = self.max
if max is None:
max = '1'
if max.isdigit():
return (int(max) > 1)
else:... | 0.005587 |
def process_url(url, key):
"""
Yields DOE CODE records from a DOE CODE .json URL response
Converts a DOE CODE API .json URL response into DOE CODE projects
"""
logger.debug('Fetching DOE CODE JSON: %s', url)
if key is None:
raise ValueError('DOE CODE API Key value is missing!')
re... | 0.002045 |
def _get_src_file_path(self, markdown_file_path: Path) -> Path:
'''Translate the path of Markdown file that is located inside the temporary working directory
into the path of the corresponding Markdown file that is located inside the source directory
of Foliant project.
:param markdown_... | 0.006267 |
def get_tc_device(self):
"""
Return a device name that associated network communication direction.
"""
if self.direction == TrafficDirection.OUTGOING:
return self.device
if self.direction == TrafficDirection.INCOMING:
return self.ifb_device
rais... | 0.006928 |
def sample_cluster(sources, srcfilter, num_ses, param):
"""
Yields ruptures generated by a cluster of sources.
:param sources:
A sequence of sources of the same group
:param num_ses:
Number of stochastic event sets
:param param:
a dictionary of additional parameters includin... | 0.000292 |
def ajax_login_required(view_func):
"""Handle non-authenticated users differently if it is an AJAX request."""
@wraps(view_func, assigned=available_attrs(view_func))
def _wrapped_view(request, *args, **kwargs):
if request.is_ajax():
if request.user.is_authenticated():
re... | 0.001443 |
def _make_sql_params(self,kw):
"""Make a list of strings to pass to an SQL statement
from the dictionary kw with Python types"""
vals = []
for k,v in kw.iteritems():
vals.append('%s=%s' %(k,self._conv(v)))
return vals | 0.021818 |
def _collect_layer_output_min_max(mod, data, include_layer=None,
max_num_examples=None, logger=None):
"""Collect min and max values from layer outputs and save them in
a dictionary mapped by layer names.
"""
collector = _LayerOutputMinMaxCollector(include_layer=include_... | 0.006224 |
def add_validation_message(self, message):
"""
Adds a message to the messages dict
:param message:
"""
if message.file not in self.messages:
self.messages[message.file] = []
self.messages[message.file].append(message) | 0.007194 |
def rexponweib(alpha, k, loc=0, scale=1, size=None):
"""
Random exponentiated Weibull variates.
"""
q = np.random.uniform(size=size)
r = flib.exponweib_ppf(q, alpha, k)
return loc + r * scale | 0.00463 |
def replace(self, new_node):
"""Replace a node after first checking integrity of node stack."""
cur_node = self.cur_node
nodestack = self.nodestack
cur = nodestack.pop()
prev = nodestack[-1]
index = prev[-1] - 1
oldnode, name = prev[-2][index]
assert cur[0... | 0.003419 |
def read_block_data(self, cmd, length):
"""
Read a block of bytes from the bus from the specified command register
Amount of bytes read in is defined by length
"""
results = self.bus.read_i2c_block_data(self.address, cmd, length)
self.log.debug(
"read_block_da... | 0.004049 |
def get_pager_spec(self):
""" Find the best pager settings for this command. If the user has
specified overrides in the INI config file we prefer those. """
self_config = self.get_config()
pagercmd = self_config.get('pager')
istty = self_config.getboolean('pager_istty')
... | 0.003339 |
def _mid(pt1, pt2):
"""
(Point, Point) -> Point
Return the point that lies in between the two input points.
"""
(x0, y0), (x1, y1) = pt1, pt2
return 0.5 * (x0 + x1), 0.5 * (y0 + y1) | 0.004878 |
def wait_lock(path, lock_fn=None, timeout=5, sleep=0.1, time_start=None):
'''
Obtain a write lock. If one exists, wait for it to release first
'''
if not isinstance(path, six.string_types):
raise FileLockError('path must be a string')
if lock_fn is None:
lock_fn = path + '.w'
if ... | 0.000392 |
def to_bioul(tag_sequence: List[str], encoding: str = "IOB1") -> List[str]:
"""
Given a tag sequence encoded with IOB1 labels, recode to BIOUL.
In the IOB1 scheme, I is a token inside a span, O is a token outside
a span and B is the beginning of span immediately following another
span of the same t... | 0.000988 |
def _scheduling_block_ids(num_blocks, start_id, project):
"""Generate Scheduling Block instance ID"""
for i in range(num_blocks):
_root = '{}-{}'.format(strftime("%Y%m%d", gmtime()), project)
yield '{}-sb{:03d}'.format(_root, i + start_id), \
'{}-sbi{:03d}'.format(_root, i + start_... | 0.003096 |
def run(*args, **kwargs):
"""Execute a command.
Command can be passed as several arguments, each being a string
or a list of strings; lists are flattened.
If opts.verbose is True, output of the command is shown.
If the command exits with non-zero, print an error message and exit.
If keyward arg... | 0.002582 |
def sql_fingerprint(query, hide_columns=True):
"""
Simplify a query, taking away exact values and fields selected.
Imperfect but better than super explicit, value-dependent queries.
"""
parsed_query = parse(query)[0]
sql_recursively_simplify(parsed_query, hide_columns=hide_columns)
return s... | 0.002976 |
def _dispatcher(self, connection, event):
"""
Dispatch events to on_<event.type> method, if present.
"""
log.debug("_dispatcher: %s", event.type)
def do_nothing(connection, event):
return None
method = getattr(self, "on_" + event.type, do_nothing)
met... | 0.005848 |
def get_instance(self, payload):
"""
Build an instance of DependentPhoneNumberInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberInstance
:rtype: twilio.rest.api.v2010.account.ad... | 0.006645 |
def expectation(self, diag_hermitian: bk.TensorLike,
trials: int = None) -> bk.BKTensor:
"""Return the expectation of a measurement. Since we can only measure
our computer in the computational basis, we only require the diagonal
of the Hermitian in that basis.
If the... | 0.003831 |
def concretize(self):
"""
Transforms the SFA into a DFA
Args:
None
Returns:
DFA: The generated DFA
"""
dfa = DFA(self.alphabet)
for state in self.states:
for arc in state.arcs:
for char in arc.guard:
... | 0.003914 |
def openParametersDialog(params, title=None):
'''
Opens a dialog to enter parameters.
Parameters are passed as a list of Parameter objects
Returns a dict with param names as keys and param values as values
Returns None if the dialog was cancelled
'''
QApplication.setOverrideCursor(QCursor(Qt... | 0.002198 |
def _put_attributes_using_post(self, domain_or_name, item_name, attributes,
replace=True, expected_value=None):
"""
Monkey-patched version of SDBConnection.put_attributes that uses POST instead of GET
The GET version is subject to the URL length limit which kicks in before th... | 0.004435 |
def rotate_slaves(self):
"Round-robin slave balancer"
slaves = self.sentinel_manager.discover_slaves(self.service_name)
if slaves:
if self.slave_rr_counter is None:
self.slave_rr_counter = random.randint(0, len(slaves) - 1)
for _ in xrange(len(slaves)):
... | 0.002717 |
def vcpkg_dir():
""" Figure out where vcpkg is installed.
vcpkg-exported is populated in some flavors of FB internal builds.
C:/tools/vcpkg is the appveyor location.
C:/open/vcpkg is my local location.
"""
for p in ["vcpkg-exported", "C:/tools/vcpkg", "C:/open/vcpkg"]:
if os.path.isdir(p... | 0.002488 |
def start(self, test_connection=True):
"""Starts connection to server if not existent.
NO-OP if connection is already established.
Makes ping-pong test as well if desired.
"""
if self._context is None:
self._logger.debug('Starting Client')
self._context ... | 0.004246 |
def gen_dist_diff(
networkA,
networkB,
techs=None,
snapshot=0,
n_cols=3,
gen_size=0.2,
filename=None,
buscmap=plt.cm.jet):
"""
Difference in generation distribution
Green/Yellow/Red colors mean that the generation at a location
is bigger wi... | 0.003064 |
def add_user_actions(self, actions=(), version='v1.0'):
"""
回传数据
https://wximg.qq.com/wxp/pdftool/get.html?id=rkalQXDBM&pa=39
:param actions: 用户行为源类型
:param version: 版本号 v1.0
"""
return self._post(
'user_actions/add',
params={'version': v... | 0.005319 |
def tagAttributes_while(fdef_master_list,root):
'''Tag each node under root with the appropriate depth. '''
depth = 0
current = root
untagged_nodes = [root]
while untagged_nodes:
current = untagged_nodes.pop()
for x in fdef_master_list:
if jsName(x.path,x.name) == current... | 0.004762 |
def ystep(self):
r"""Minimise Augmented Lagrangian with respect to
:math:`\mathbf{y}`.
"""
self.Y = sp.prox_l1l2(self.AX + self.U, (self.lmbda/self.rho)*self.wl1,
(self.mu/self.rho), axis=self.cri.axisC)
cbpdn.GenericConvBPDN.ystep(self) | 0.009772 |
def get_fun(fun):
'''
Return a dict of the last function called for all minions
'''
serv = _get_serv(ret=None)
minions = _get_list(serv, 'minions')
returns = serv.get_multi(minions, key_prefix='{0}:'.format(fun))
# returns = {minion: return, minion: return, ...}
ret = {}
for minion, ... | 0.002404 |
def _pyfftw_empty_aligned(shape, dtype, order='C', n=None):
"""Patched version of :func:`sporco.linalg.`."""
return cp.empty(shape, dtype, order) | 0.006494 |
def itin(self):
"""Generate a random United States Individual Taxpayer Identification Number (ITIN).
An United States Individual Taxpayer Identification Number
(ITIN) is a tax processing number issued by the Internal
Revenue Service. It is a nine-digit number that always begins
... | 0.003872 |
def filter_data(d, x, model="lms", **kwargs):
"""
Function that filter data with selected adaptive filter.
**Args:**
* `d` : desired value (1 dimensional array)
* `x` : input matrix (2-dimensional array). Rows are samples, columns are
input arrays.
**Kwargs:**
* An... | 0.004516 |
def iodp_samples(samp_file, output_samp_file=None, output_dir_path='.',
input_dir_path='', data_model_num=3):
"""
Convert IODP samples data file into MagIC samples file.
Default is to overwrite samples.txt in your working directory.
Parameters
----------
samp_file : str
... | 0.000922 |
def scrape(self, request, response, link_type=None):
'''Iterate the scrapers, returning the first of the results.'''
for scraper in self._document_scrapers:
scrape_result = scraper.scrape(request, response, link_type)
if scrape_result is None:
continue
... | 0.005115 |
def filter(self, **params):
"""Stream statuses/filter
:param \*\*params: Parameters to send with your stream request
Accepted params found at:
https://developer.twitter.com/en/docs/tweets/filter-realtime/api-reference/post-statuses-filter
"""
url = 'https://stream.twitt... | 0.008811 |
def GetFileEntryByPathSpec(self, path_spec):
"""Retrieves a file entry for a path specification.
Args:
path_spec (PathSpec): path specification.
Returns:
BDEFileEntry: file entry or None.
"""
return bde_file_entry.BDEFileEntry(
self._resolver_context, self, path_spec, is_root=T... | 0.002933 |
def handle(self, **kwargs):
"""
Simply re-saves all objects from models listed in settings.TIMELINE_MODELS. Since the timeline
app is now following these models, it will register each item as it is re-saved. The purpose of this
script is to register content in your database that existed prior to... | 0.012771 |
def stat_container(self, container):
"""Stat container metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon).
"""
LOG.debug('stat_container() with %s is success.', self.driver)
return self.driver.stat_container(con... | 0.006116 |
def _init_random_centroids(self):
"""Initialize the centroids as k random samples of X (k = n_clusters)
"""
self.centroids = self._X[np.random.choice(list(range(self._X.shape[0])), size=self.n_clusters), :] | 0.013043 |
def feature_burstness(corpus, featureset_name, feature, k=5, normalize=True,
s=1.1, gamma=1., **slice_kwargs):
"""
Estimate burstness profile for a feature over the ``'date'`` axis.
Parameters
----------
corpus : :class:`.Corpus`
feature : str
Name of featureset in... | 0.001417 |
def remove_child(self, child):
"""
Remove a child from this node.
"""
assert child in self.children
self.children.remove(child)
self.index.pop(child.tax_id)
if child.parent is self:
child.parent = None
if child.index is self.index:
... | 0.003552 |
def create(cls, cash_register_id, description, status, amount_total,
monetary_account_id=None, allow_amount_higher=None,
allow_amount_lower=None, want_tip=None, minimum_age=None,
require_address=None, redirect_url=None, visibility=None,
expiration=None, tab_at... | 0.002566 |
def get_print_rect(self, grid_rect):
"""Returns wx.Rect that is correctly positioned on the print canvas"""
grid = self.grid
rect_x = grid_rect.x - \
grid.GetScrollPos(wx.HORIZONTAL) * grid.GetScrollLineX()
rect_y = grid_rect.y - \
grid.GetScrollPos(wx.VERTICAL)... | 0.004773 |
def peek_pointers_in_data(self, data, peekSize = 16, peekStep = 1):
"""
Tries to guess which values in the given data are valid pointers,
and reads some data from them.
@type data: str
@param data: Binary data to find pointers in.
@type peekSize: int
@param pe... | 0.006912 |
def _make_tmp_path(self, remote_user=None):
"""
Create a temporary subdirectory as a child of the temporary directory
managed by the remote interpreter.
"""
LOG.debug('_make_tmp_path(remote_user=%r)', remote_user)
path = self._generate_tmp_path()
LOG.debug('Tempor... | 0.004184 |
def lastCall(self): #pylint: disable=invalid-name
"""
Return: SpyCall object for this spy's most recent call
"""
last_index = len(super(SinonSpy, self)._get_wrapper().call_list) - 1
return self.getCall(last_index) | 0.01581 |
def gene_variants(self, query=None,
category='snv', variant_type=['clinical'],
nr_of_variants=50, skip=0):
"""Return all variants seen in a given gene.
If skip not equal to 0 skip the first n variants.
Arguments:
query(dict): A dictionary with ... | 0.006289 |
def replace_grist (features, new_grist):
""" Replaces the grist of a string by a new one.
Returns the string with the new grist.
"""
assert is_iterable_typed(features, basestring) or isinstance(features, basestring)
assert isinstance(new_grist, basestring)
# this function is used a lot in th... | 0.005286 |
def debug(self, nest_level=1):
"""
Show the binary data and parsed data in a tree structure
"""
prefix = ' ' * nest_level
# This interacts with Any and moves the tag, implicit, explicit, _header,
# contents, _footer to the parsed value so duplicate data isn't present
... | 0.003836 |
def load_commands(self, obj):
"""
Load commands defined on an arbitrary object.
All functions decorated with the :func:`subparse.command` decorator
attached the specified object will be loaded. The object may
be a dictionary, an arbitrary python object, or a dotted path.
... | 0.002286 |
def p_const_expression_floatnum(self, p):
'const_expression : floatnumber'
p[0] = FloatConst(p[1], lineno=p.lineno(1))
p.set_lineno(0, p.lineno(1)) | 0.011696 |
def update(self, request, *args, **kwargs):
"""Update an entity.
Original queryset produces a temporary database table whose rows
cannot be selected for an update. As a workaround, we patch
get_queryset function to return only Entity objects without
additional data that is not n... | 0.002535 |
def _decoder(self):
"""Transliterate a string from English to the target language."""
if self.target_lang == 'en':
return Transliterator._dummy_coder
else:
weights = load_transliteration_table(self.target_lang)
decoder_weights = weights["decoder"]
return Transliterator._transliterate... | 0.014535 |
def ensure_future(fut, *, loop=None):
"""
Wraps asyncio.async()/asyncio.ensure_future() depending on the python version
:param fut: The awaitable, future, or coroutine to wrap
:param loop: The loop to run in
:return: The wrapped future
"""
if sys.version_info < (3, 4, 4):
# This is t... | 0.004219 |
def get_runconfig(path=None, root=None, db=None):
"""Load the main configuration files and accounts file.
Debprecated. Use load()
"""
return load(path, root=root, db=db) | 0.005348 |
def parse_attrlist(str_, avs_sep=":", vs_sep=",", as_sep=";"):
"""
Simple parser to parse expressions in the form of
[ATTR1:VAL0,VAL1,...;ATTR2:VAL0,VAL2,..].
:param str_: input string
:param avs_sep: char to separate attribute and values
:param vs_sep: char to separate values
:param as_s... | 0.001984 |
def get_file(self, file_path, mode="r"):
"""
provide File object specified via 'file_path'
:param file_path: str, path to the file
:param mode: str, mode used when opening the file
:return: File instance
"""
return open(self.cont_path(file_path), mode=mode) | 0.00639 |
def alpha1_carbonate(pH):
"""Calculate the fraction of total carbonates in bicarbonate form (HCO3-)
:param pH: pH of the system
:type pH: float
:return: Fraction of carbonates in bicarbonate form (HCO3-)
:rtype: float
:Examples:
>>> from aguaclara.research.environmental_processes_analysi... | 0.003503 |
def from_file(cls, file_path, compressed=False, encoded=False):
"""Create a content object from a file path."""
file_id = '.'.join(path.basename(file_path).split('.')[:-1])
file_format = file_path.split('.')[-1]
content = cls(file_id, file_format, compressed, encoded)
content.fil... | 0.004878 |
def build_event_out(self, event_out):
"""
Build event out code.
@param event_out: event out object
@type event_out: lems.model.dynamics.EventOut
@return: Generated event out code
@rtype: string
"""
event_out_code = ['if "{0}" in self.event_out_callbacks... | 0.007722 |
def clicked(self, event):
"""
Call if an element of this plottype is clicked.
Implement in sub class.
"""
group = event.artist._mt_group
indices = event.ind
# double click only supported on 1.2 or later
major, minor, _ = mpl_version.split('.')
if... | 0.000968 |
def varYSizeGaussianFilter(arr, stdyrange, stdx=0,
modex='wrap', modey='reflect'):
'''
applies gaussian_filter on input array
but allowing variable ksize in y
stdyrange(int) -> maximum ksize - ksizes will increase from 0 to given value
stdyrange(tuple,list) -> ... | 0.016476 |
def package_assets(example_path):
"""
Generates pseudo-packages for the examples directory.
"""
examples(example_path, force=True, root=__file__)
for root, dirs, files in os.walk(example_path):
walker(root, dirs+files)
setup_args['packages'] += packages
for p, exts in extensions.item... | 0.002564 |
def query_image_metadata(self, image, metadata_type=""):
'''**Description**
Find the image with the tag <image> and return its metadata.
**Arguments**
- image: Input image can be in the following formats: registry/repo:tag
- metadata_type: The metadata type can be on... | 0.008711 |
def validate(table, constraints=None, header=None):
"""
Validate a `table` against a set of `constraints` and/or an expected
`header`, e.g.::
>>> import petl as etl
>>> # define some validation constraints
... header = ('foo', 'bar', 'baz')
>>> constraints = [
... ... | 0.000297 |
def _read_routine_metadata(self):
"""
Returns the metadata of stored routines.
:rtype: dict
"""
metadata = {}
if os.path.isfile(self._metadata_filename):
with open(self._metadata_filename, 'r') as file:
metadata = json.load(file)
retu... | 0.006042 |
def create_random_ind_full(self, depth=0):
"Random individual using full method"
lst = []
self._create_random_ind_full(depth=depth, output=lst)
return lst | 0.010753 |
def set_splash_message(self, text):
"""Sets the text in the bottom of the Splash screen."""
self.splash_text = text
self._show_message(text)
self.timer_ellipsis.start(500) | 0.009662 |
def find_slots(cls):
"""Return a set of all slots for a given class and its parents"""
slots = set()
for c in cls.__mro__:
cslots = getattr(c, "__slots__", tuple())
if not cslots:
continue
elif isinstance(cslots, (bstr, ustr)):
cslots = (cslots,)
sl... | 0.002809 |
def update_group_color(self, lights: list) -> None:
"""Update group colors based on light states.
deCONZ group updates don't contain any information about the current
state of the lights in the group. This method updates the color
properties of the group to the current color of the ligh... | 0.001786 |
def sinogram_as_radon(uSin, align=True):
r"""Compute the phase from a complex wave field sinogram
This step is essential when using the ray approximation before
computation of the refractive index with the inverse Radon
transform.
Parameters
----------
uSin: 2d or 3d complex ndarray
... | 0.000742 |
def values(self, multi=False):
# type: (bool) -> Iterator[Any]
"""
Yield the last value on every key list.
:param multi: If set to `True` the iterator returned will have a pair
for each value of each key. Otherwise it will only
contain pairs ... | 0.005474 |
def read(self):
'''Read some number of messages'''
found = Client.read(self)
# Redistribute our ready state if necessary
if self.needs_distribute_ready():
self.distribute_ready()
# Finally, return all the results we've read
return found | 0.006711 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.