text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def setDocumentedBy(self, documented_pid, documenting_pid):
"""Add a CiTO, the Citation Typing Ontology, triple asserting that
``documented_pid`` isDocumentedBy ``documenting_pid``.
Adds assertion: ``documented_pid cito:isDocumentedBy documenting_pid``
Args:
documented_pid: s... | 0.002688 |
def generate_search_space(code_dir):
"""Generate search space from Python source code.
Return a serializable search space object.
code_dir: directory path of source files (str)
"""
search_space = {}
if code_dir.endswith(slash):
code_dir = code_dir[:-1]
for subdir, _, files in o... | 0.002208 |
def _get_slot(self):
"Returns the next coordinates for a preview"
x = y = 10
for k, p in self.previews.items():
y += p.height() + self.padding
return x, y | 0.01005 |
def apply_sql(self, ex, values, lockref):
"""call the stmt in tree with values subbed on the tables in t_d.
ex is a parsed statement returned by parse_expression.
values is the tuple of %s replacements.
lockref can be anything as long as it stays the same; it's used for assigning tranaction ownershi... | 0.036079 |
def _print_checker_doc(checker_name, info, stream=None):
"""Helper method for print_full_documentation.
Also used by doc/exts/pylint_extensions.py.
"""
if not stream:
stream = sys.stdout
doc = info.get("doc")
module = info.get("module")
msgs = info.g... | 0.001753 |
def fetch_top_tracks_of_artist(self, artist_id, terr=KKBOXTerritory.TAIWAN):
'''
Fetcher top tracks belong to an artist by given ID.
:param artist_id: the artist ID.
:type artist_id: str
:param terr: the current territory.
:return: API response.
:rtype: dict
... | 0.00626 |
def get_assets_by_ids(self, asset_ids=None):
"""Gets an ``AssetList`` corresponding to the given ``IdList``.
In plenary mode, the returned list contains all of the assets
specified in the ``Id`` list, in the order of the list,
including duplicates, or an error results if an ``Id`` in th... | 0.001108 |
def is_capable(cls, requested_capability):
"""Returns true if the requested capability is supported by this plugin
"""
for c in requested_capability:
if not c in cls.capability:
return False
return True | 0.01145 |
def iterate(t_table, wordlist, stanzas, schemes, rprobs, maxsteps):
"""
Iterate EM and return final probabilities
"""
data_probs = numpy.zeros(len(stanzas))
old_data_probs = None
probs = None
num_words = len(wordlist)
ctr = 0
for ctr in range(maxsteps):
logging.info("Iterati... | 0.001096 |
def precipitable_water(dewpt, pressure, bottom=None, top=None):
r"""Calculate precipitable water through the depth of a sounding.
Formula used is:
.. math:: -\frac{1}{\rho_l g} \int\limits_{p_\text{bottom}}^{p_\text{top}} r dp
from [Salby1996]_, p. 28.
Parameters
----------
dewpt : `pin... | 0.005122 |
def send(r, pool=None, stream=False):
"""Sends the request object using the specified pool. If a pool isn't
specified this method blocks. Pools are useful because you can specify size
and can hence limit concurrency."""
if pool is not None:
return pool.spawn(r.send, stream=stream)
return ge... | 0.002833 |
def exportTable(self, login, tableName, exportDir):
"""
Parameters:
- login
- tableName
- exportDir
"""
self.send_exportTable(login, tableName, exportDir)
self.recv_exportTable() | 0.004695 |
def complete_automaton(self):
"""
Adds missing transition states such that δ(q, u) is defined
for every state q and any u ∈ S
"""
self.term_state = object()
self.Q.add(self.term_state)
for tv in self.Q:
for u in self.S:
try:
... | 0.005597 |
async def stop(self):
"""
Permanently stops the :class:`RTCRtpTransceiver`.
"""
await self.__receiver.stop()
await self.__sender.stop()
self.__stopped = True | 0.009756 |
def score_wu(CIJ, s):
'''
The s-core is the largest subnetwork comprising nodes of strength at
least s. This function computes the s-core for a given weighted
undirected connection matrix. Computation is analogous to the more
widely used k-core, but is based on node strengths instead of node
deg... | 0.00088 |
def validate_vertex_field_directive_interactions(parent_location, vertex_field_name, directives):
"""Ensure that the specified vertex field directives are not mutually disallowed."""
fold_directive = directives.get('fold', None)
optional_directive = directives.get('optional', None)
output_source_directi... | 0.008845 |
def _map_arguments(self, args):
"""Map from the top-level arguments to the arguments provided to
the indiviudal links """
comp_file = args.get('comp', None)
datafile = args.get('data', None)
if is_null(comp_file):
return
if is_null(datafile):
retur... | 0.002907 |
def run(self, background=False):
"""Runs `on_startup`, `main` and `on_shutdown`, blocking until finished, unless background is set."""
if self.__bgthread:
raise Exception('run has already been called (since last stop)')
self.__shutdown.clear()
if background:
self.... | 0.007782 |
def rpc(self, address, rpc_id, *args, **kwargs):
"""Immediately dispatch an RPC inside this EmulatedDevice.
This function is meant to be used for testing purposes as well as by
tiles inside a complex EmulatedDevice subclass that need to
communicate with each other. It should only be ca... | 0.002304 |
def delete(name, dry_run, verbose):
"""Delete a collection."""
collection = Collection.query.filter_by(name=name).one()
if verbose:
tr = LeftAligned(traverse=AttributeTraversal())
click.secho(tr(collection), fg='red')
db.session.delete(collection) | 0.003584 |
def read_configuration(key, path=None, default=None, single_config=False, fallback_to_env=True):
"""
Read configuration from a file, Docker config or secret or from the environment variables.
:param key: the configuration key
:param path: the path of the configuration file (regular file or Docker confi... | 0.006867 |
def yeardoy2datetime(yeardate: int,
utsec: Union[float, int] = None) -> datetime.datetime:
"""
Inputs:
yd: yyyyddd four digit year, 3 digit day of year (INTEGER 7 digits)
outputs:
t: datetime
http://stackoverflow.com/questions/2427555/python-question-year-and-day-of-year-t... | 0.002844 |
def get_weight(self, weight=operator.attrgetter('weight')):
"""
:param weight: source weight function
:returns: total weight of the source model
"""
return sum(weight(src) for src in self.get_sources()) | 0.008264 |
def total_accessibility(in_rsa, path=True):
"""Parses rsa file for the total surface accessibility data.
Parameters
----------
in_rsa : str
Path to naccess rsa file.
path : bool
Indicates if in_rsa is a path or a string.
Returns
-------
dssp_residues : 5-tuple(float)
... | 0.001229 |
def incompletedIssuesEstimateSum(self, board_id, sprint_id):
"""Return the total incompleted points this sprint."""
return self._get_json('rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s' % (board_id, sprint_id),
base=self.AGILE_BASE_URL)['contents']['incompletedIssues... | 0.011696 |
async def get_devices(self, covers_only: bool = True) -> list:
"""Get a list of all devices associated with the account."""
from .device import MyQDevice
_LOGGER.debug('Retrieving list of devices')
devices_resp = await self._request('get', DEVICE_LIST_ENDPOINT)
# print(json.dump... | 0.001847 |
def kdists(matrix, k=7, ix=None):
""" Returns the k-th nearest distances, row-wise, as a column vector """
ix = ix or kindex(matrix, k)
return matrix[ix][np.newaxis].T | 0.005556 |
def columns_in_formula(formula):
"""
Returns the names of all the columns used in a patsy formula.
Parameters
----------
formula : str, iterable, or dict
Any formula construction supported by ``str_model_expression``.
Returns
-------
columns : list of str
"""
if formul... | 0.000853 |
def emit(self, signal, message='__nomessagetoken__'):
"""Emit a signal to the frontend.
:param str signal: name of the signal
:param message: message to send
:returns: return value from frontend emit function
:rtype: tornado.concurrent.Future
"""
# call pre-emit ... | 0.003328 |
def _install_iana_config(cls):
"""
Download `iana-domains-db.json` if not present.
"""
# We initiate the link to the iana configuration.
# It is not hard coded because this method is called only if we
# are sure that the configuration file exist.
iana_link = PyFu... | 0.002885 |
def dump(data, stream=None, **kwargs):
"""
Serialize YAMLDict into a YAML stream.
If stream is None, return the produced string instead.
"""
return yaml.dump_all(
[data],
stream=stream,
Dumper=YAMLDictDumper,
**kwargs
) | 0.003636 |
def config_get(config, *path, default=None):
"""Get a configuration option following a path through the config
Example usage:
>>> config_get(config,
'problem', 'problem_type_details', 'scorer',
default='accuracy')
Args:
config (dict): config d... | 0.001515 |
def get_time_interval(start_time, end_time):
"""
获取两个unix时间戳之间的时间间隔
:param:
* start_time: (int) 开始时间,unix 时间戳
* end_time: (int) 结束时间,unix 时间戳
:return:
* interval_dict: (dict) 时间间隔字典
举例如下::
print('--- get_time_interval demo ---')
import time
start = ... | 0.003333 |
def assims(self, mot):
""" Cherche si la chaîne a peut subir une assimilation, renvoie cette chaîne éventuellement assimilée.
:param mot: Mot pour lequel on doit vérifier des assimilations
:type mot: str
:return: Mot assimilé
:rtype: str
"""
for replaced, replace... | 0.006073 |
def toggle_pawn_cfg(self):
"""Show or hide the pop-over where you can configure the dummy pawn"""
if self.app.manager.current == 'pawncfg':
dummything = self.app.dummything
self.ids.thingtab.remove_widget(dummything)
dummything.clear()
if self.app.pawncfg.... | 0.002315 |
def collect(self_or_cls, files, drop=[], metadata=True):
"""
Given a list or NdMapping type containing file paths return a
Layout of Collators, which can be called to load a given set
of files using the current Importer.
If supplied as a list each file is expected to disambiguat... | 0.000819 |
def flag_forgotten_entries(session, today=None):
"""Flag any entries from previous days where users forgot to sign
out.
:param session: SQLAlchemy session through which to access the database.
:param today: (optional) The current date as a `datetime.date` object. Used for testing.
""" # noqa
to... | 0.00271 |
def writeToken(self):
"""
Store details of the current connection in the named file.
This can be used by :meth:`readToken` to re-authenticate at a later time.
"""
# Write token file privately.
with os.fdopen(os.open(self.tokenFile, os.O_WRONLY | os.O_CREAT, 0o600), "w") ... | 0.007702 |
def update(self, response, **kwargs):
'''
If a record matching the instance already exists in the database, update
it, else create a new record.
'''
response_cls = self._get_instance(**kwargs)
if response_cls:
setattr(response_cls, self.column, self.accessor(r... | 0.006342 |
def dotplot(adata, var_names, groupby=None, use_raw=None, log=False, num_categories=7,
expression_cutoff=0., mean_only_expressed=False, color_map='Reds', dot_max=None,
dot_min=None, figsize=None, dendrogram=False, gene_symbols=None,
var_group_positions=None, standard_scale=None, smal... | 0.003338 |
def insertPDF(self, docsrc, from_page=-1, to_page=-1, start_at=-1, rotate=-1, links=1):
"""Copy page range ['from', 'to'] of source PDF, starting as page number 'start_at'."""
if self.isClosed or self.isEncrypted:
raise ValueError("operation illegal for closed / encrypted doc")
if id... | 0.014342 |
def main():
"""Main function for SPEAD receiver module."""
# Check command line arguments.
if len(sys.argv) < 2:
raise RuntimeError('Usage: python3 async_recv.py <json config>')
# Set up logging.
sip_logging.init_logger(show_thread=True)
# Load SPEAD configuration from JSON file.
#... | 0.001792 |
def write(self, model:nn.Module, iteration:int, tbwriter:SummaryWriter, name:str='model')->None:
"Writes model histograms to Tensorboard."
request = HistogramTBRequest(model=model, iteration=iteration, tbwriter=tbwriter, name=name)
asyncTBWriter.request_write(request) | 0.037671 |
def segment(f, output, target_duration, mpegts):
"""Segment command."""
try:
target_duration = int(target_duration)
except ValueError:
exit('Error: Invalid target duration.')
try:
mpegts = int(mpegts)
except ValueError:
exit('Error: Invalid MPEGTS value.')
WebVT... | 0.00266 |
def read(self, amount: int=-1) -> bytes:
'''Read data.'''
assert self._state == ConnectionState.created, \
'Expect conn created. Got {}.'.format(self._state)
data = yield from \
self.run_network_operation(
self.reader.read(amount),
close_t... | 0.01023 |
def command_for_all_connections(self, cb):
"""Invoke the callback with a command-object for each connection."""
for connection in self.__master.connections:
cb(connection.command) | 0.009615 |
def transform(self, X=None, y=None):
"""
Transform an image using an Affine transform with the given
rotation parameters. Return the transform if X=None.
Arguments
---------
X : ANTsImage
Image to transform
y : ANTsImage (optional)
Anot... | 0.001756 |
def add_file_recursive(self, filename, trim=False):
"""Add a file and all its recursive dependencies to the graph.
Args:
filename: The name of the file.
trim: Whether to trim the dependencies of builtin and system files.
"""
assert not self.final, 'Trying to mutate ... | 0.002069 |
def get_base_indentation(code, include_start=False):
"""Heuristically extracts the base indentation from the provided code.
Finds the smallest indentation following a newline not at the end of the
string.
"""
new_line_indentation = re_new_line_indentation[include_start].finditer(code)
new_line_... | 0.004065 |
def update(self, message):
"""
Updates the states in the primary AlarmDecoder object based on
the LRR message provided.
:param message: LRR message object
:type message: :py:class:`~alarmdecoder.messages.LRRMessage`
"""
# Firmware version < 2.2a.8.6
if me... | 0.002394 |
def open_imports(self, options, loaded_schemata):
"""
Instruct all contained L{sxbasic.Import} children to import all of
their referenced schemas. The imported schema contents are I{merged}
in.
@param options: An options dictionary.
@type options: L{options.Options}
... | 0.002721 |
def ShlexSplit(string):
"""A wrapper for `shlex.split` that works with unicode objects.
Args:
string: A unicode string to split.
Returns:
A list of unicode strings representing parts of the input string.
"""
precondition.AssertType(string, Text)
if PY2:
string = string.encode("utf-8")
part... | 0.012367 |
def load_plume_package(package, plume_dir, accept_defaults):
"""Loads a canari package into Plume."""
from canari.commands.load_plume_package import load_plume_package
load_plume_package(package, plume_dir, accept_defaults) | 0.004255 |
def check_password(raw_password, enc_password):
"""
Returns a boolean of whether the raw_password was correct. Handles
encryption formats behind the scenes.
"""
l = enc_password.split('$')
#only password of built-in user can split to 3
if len(l)==3:
algo, salt, hsh = l
... | 0.00978 |
def execute(self, lst):
'''
execute - Execute the series of filters, in order, on the provided list.
@param lst <list/ A QueryableList type> - The list to filter. If you already know the types of items within
the list, you can pick a QueryableList implementing class to g... | 0.00626 |
def _validate_none_or_type(t):
"""
Create a validator that checks if a setting is either None or a given type.
Args:
t: The type to assert.
Returns:
callable: A callable that will validate a setting for that type.
"""
def _validate(setting):
"""
Check the settin... | 0.0013 |
def setCellUser(self, iden):
'''
Switch to another user (admin only).
This API allows remote admin/service accounts
to impersonate a user. Used mostly by services
that manage their own authentication/sessions.
'''
if not self.user.admin:
mesg = 'setC... | 0.003604 |
def _get_login_page(self):
"""Go to the login page."""
try:
raw_res = yield from self._session.get(HOME_URL,
timeout=self._timeout)
except OSError:
raise PyHydroQuebecError("Can not connect to login page")
# Get l... | 0.002714 |
def get_and_cache_account(self, addr):
"""Gets and caches an account for an addres, creates blank if not
found.
:param addr:
:return:
"""
if addr in self.cache:
return self.cache[addr]
rlpdata = self.secure_trie.get(addr)
if (
rlp... | 0.002751 |
def oauth_request(self):
""" Makes a oauth connection """
# get tokens from server and make a dict of them.
self._server_tokens = self.request_token()
self.store["oauth-request-token"] = self._server_tokens["token"]
self.store["oauth-request-secret"] = self._server_tokens["token... | 0.005566 |
def set_dword_at_rva(self, rva, dword):
"""Set the double word value at the file offset corresponding to the given RVA."""
return self.set_bytes_at_rva(rva, self.get_data_from_dword(dword)) | 0.014634 |
def router_fabric_virtual_gateway_address_family_ipv4_gateway_mac_address(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
router = ET.SubElement(config, "router", xmlns="urn:brocade.com:mgmt:brocade-common-def")
fabric_virtual_gateway = ET.SubElement(rou... | 0.007782 |
def get_typecast(self):
"""Returns the typecast or ``None`` of this object as a string."""
midx, marker = self.token_next_by(m=(T.Punctuation, '::'))
nidx, next_ = self.token_next(midx, skip_ws=False)
return next_.value if next_ else None | 0.007407 |
def delete_roles(apps, schema_editor):
"""Delete the enterprise roles."""
SystemWideEnterpriseRole = apps.get_model('enterprise', 'SystemWideEnterpriseRole')
SystemWideEnterpriseRole.objects.filter(
name__in=[ENTERPRISE_OPERATOR_ROLE]
).delete() | 0.007435 |
def _resolve_lookup(self, context):
"""
Performs resolution of a real variable (i.e. not a literal) against the
given context.
As indicated by the method's name, this method is an implementation
detail and shouldn't be called by external code. Use Variable.resolve()
inst... | 0.00697 |
def kgen(filename='POSCAR', directory=None, make_folders=False, symprec=0.01,
kpts_per_split=None, ibzkpt=None, spg=None, density=60,
mode='bradcrack', cart_coords=False, kpt_list=None, labels=None):
"""Generate KPOINTS files for VASP band structure calculations.
This script provides a wrappe... | 0.000186 |
def enable_travis(token, slug, log):
"""
Enable Travis automatically for the given repo.
this need to have access to the GitHub token.
"""
# Done with github directly. Login to travis
travis = TravisPy.github_auth(token, uri='https://api.travis-ci.org')
user = travis.user()
log.info('... | 0.005068 |
def get_field_template(self, bound_field, template_name=None):
"""
Uses a special field template for widget with multiple inputs. It only
applies if no other template than the default one has been defined.
"""
template_name = super().get_field_template(bound_field, template_name)... | 0.003367 |
def patch_namespaced_event(self, name, namespace, body, **kwargs):
"""
partially update the specified Event
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.patch_namespaced_event(name, name... | 0.004436 |
def _get_environ_vars(self):
# type: () -> Iterable[Tuple[str, str]]
"""Returns a generator with all environmental vars with prefix PIP_"""
for key, val in os.environ.items():
should_be_yielded = (
key.startswith("PIP_") and
key[4:].lower() not in self... | 0.006993 |
def generate_fieldvalues(self, count=1):
"""Returns a mapping of '<fieldname>-<count>' to the default value
of the field or the field value of the source AR
"""
ar_context = self.get_ar()
# mapping of UID index to AR objects {1: <AR1>, 2: <AR2> ...}
copy_from = self.get_... | 0.001409 |
def get_channel_id(turn_context: TurnContext) -> str:
"""Get the Channel Id from the current Activity on the Turn Context.
Args:
turn_context (TurnContext): The Turn Context to retrieve the Activity's Channel Id from.
Returns:
str: The Channel Id from the Turn Context's... | 0.006198 |
def _linear_decorelate_color(t):
"""Multiply input by sqrt of emperical (ImageNet) color correlation matrix.
If you interpret t's innermost dimension as describing colors in a
decorrelated version of the color space (which is a very natural way to
describe colors -- see discussion in Feature Visualization ar... | 0.014472 |
def padding_oracle_decrypt(oracle, ciphertext, known_prefix=b'', known_suffix=b'', block_size=128,
alphabet=None, pool=None, block_pool=None, progress=None):
"""
Decrypt ciphertext using an oracle function that returns ``True`` if the
provided ciphertext is correctly PKCS#7 padded... | 0.002265 |
def make_chains_with_names(sentences):
'''
assemble in-doc coref chains by mapping equiv_id to tokens and
their cleansed name strings
:param sentences: iterator over token generators
:returns dict:
keys are equiv_ids,
values are tuple(concatentated name string, list of tokens)
'... | 0.006906 |
def occurrence(self, file_name=None, path=None, date=None):
"""Add a file Occurrence.
Args:
file_name (str, optional): The file name for this occurrence.
path (str, optional): The file path for this occurrence.
date (str, optional): The datetime expression for this o... | 0.002903 |
def _loop(self, barrier):
"""Actual thread"""
if sys.platform != "win32":
self.loop = asyncio.new_event_loop()
else:
self.loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(self.loop)
barrier.wait()
try:
self.loop.run_forever()
... | 0.00542 |
def diff(models, filename, pytest_args, exclusive, skip, solver,
experimental, custom_tests, custom_config):
"""
Take a snapshot of all the supplied models and generate a diff report.
MODELS: List of paths to two or more model files.
"""
if not any(a.startswith("--tb") for a in pytest_args... | 0.000337 |
def parameter_group_exists(name, tags=None, region=None, key=None, keyid=None,
profile=None):
'''
Check to see if an RDS parameter group exists.
CLI example::
salt myminion boto_rds.parameter_group_exists myparametergroup \
region=us-east-1
'''
co... | 0.001328 |
def register_game(game_name, game_mode="NoFrameskip-v4"):
"""Create and register problems for the game.
Args:
game_name: str, one of the games in ATARI_GAMES, e.g. "bank_heist".
game_mode: the frame skip and sticky keys config.
Raises:
ValueError: if game_name or game_mode are wrong.
"""
if game... | 0.010417 |
def get_block_height(height, api_code=None):
"""Get an array of blocks at the specified height.
:param int height: block height to look up
:param str api_code: Blockchain.info API code (optional)
:return: an array of :class:`Block` objects
"""
resource = 'block-height/{0}?format=json'.format(h... | 0.001873 |
def walk_preorder(self):
"""Iterates the program tree starting from this object, going down."""
yield self
for child in self._children():
for descendant in child.walk_preorder():
yield descendant | 0.008097 |
def read_passive_target(self, card_baud=PN532_MIFARE_ISO14443A, timeout_sec=1):
"""Wait for a MiFare card to be available and return its UID when found.
Will wait up to timeout_sec seconds and return None if no card is found,
otherwise a bytearray with the UID of the found card is returned.
... | 0.004686 |
def _try_inject_s3_credentials(url):
"""
Inject aws credentials into s3 url as s3://[aws_id]:[aws_key]:[bucket/][objectkey]
If s3 url already contains secret key/id pairs, just return as is.
"""
assert url.startswith('s3://')
path = url[5:]
# Check if the path already contains credentials
... | 0.006849 |
def nl_wait_for_ack(sk):
"""Wait for ACK.
https://github.com/thom311/libnl/blob/libnl3_2_25/lib/nl.c#L1058
Waits until an ACK is received for the latest not yet acknowledged Netlink message.
Positional arguments:
sk -- Netlink socket (nl_sock class instance).
Returns:
Number of received ... | 0.003876 |
def get_client(site=None):
"""Get a citrination client"""
if 'CITRINATION_API_KEY' not in environ:
raise ValueError("'CITRINATION_API_KEY' is not set as an environment variable")
if not site:
site = environ.get("CITRINATION_SITE", "https://citrination.com")
return CitrinationClient(envir... | 0.005682 |
def changed(self, thresh=0.05, idx=True):
"""
Changed features.
{threshdoc}
"""
ind = self.data[self.pval_column] <= thresh
if idx:
return ind
return self[ind] | 0.008772 |
def visitShapeOr(self, ctx: ShExDocParser.ShapeOrContext):
""" shapeOr: shapeAnd (KW_OR shapeAnd)* """
if len(ctx.shapeAnd()) > 1:
self.expr = ShapeOr(id=self.label, shapeExprs=[])
for sa in ctx.shapeAnd():
sep = ShexShapeExpressionParser(self.context)
... | 0.004484 |
def delete(self, removealien=True):
"""Delete the current entity.
This will also call :meth:`RefobjInterface.get_children_to_delete` and
delete these children first by calling :meth:`Reftrack.delete`.
To delete the content it will call :meth:`RefobjInterface.delete`.
Then the re... | 0.003303 |
def query(self, query, time_precision='s', chunked=False):
"""Query data from the influxdb v0.8 database.
:param time_precision: [Optional, default 's'] Either 's', 'm', 'ms'
or 'u'.
:param chunked: [Optional, default=False] True if the data shall be
retrieved in chunks,... | 0.004367 |
def to_header(self):
"""Convert the etags set into a HTTP header string."""
if self.star_tag:
return "*"
return ", ".join(
['"%s"' % x for x in self._strong] + ['W/"%s"' % x for x in self._weak]
) | 0.011905 |
def _merge_a_into_b(self, a, b):
"""Merge config dictionary a into config dictionary b, clobbering the
options in b whenever they are also specified in a.
"""
from easydict import EasyDict as edict
if type(a) is not edict:
return
for k, v in a.items():
... | 0.002402 |
def _call_member(obj, name, failfast=True, *args, **kwargs):
""" Calls the specified method, property or attribute of the given object
Parameters
----------
obj : object
The object that will be used
name : str
Name of method, property or attribute
failfast : bool
If True... | 0.00271 |
def init_config(self, app):
"""Initialize configuration.
:param app: The Flask application.
"""
try:
pkg_resources.get_distribution('celery')
app.config.setdefault(
"ACCOUNTS_USE_CELERY", not (app.debug or app.testing))
except pkg_resource... | 0.001122 |
def save(self, data, xparent=None):
"""
Parses the element from XML to Python.
:param data | <variant>
xparent | <xml.etree.ElementTree.Element> || None
:return <xml.etree.ElementTree.Element>
"""
if xparent is not None:
... | 0.008163 |
def select(self, model):
"""Select nodes according to the input selector.
This can ALWAYS return multiple root elements.
"""
res = []
def doSelect(value, pre, remaining):
if not remaining:
res.append((pre, value))
else:
# For the other selectors to work, value must be a... | 0.009738 |
def sync_one(self, aws_syncr, amazon, role):
"""Make sure this role exists and has only what policies we want it to have"""
trust_document = role.trust.document
attached_policies = role.attached_policies
permission_document = role.permission.document
policy_name = "syncr_policy_{... | 0.005896 |
def get_address(self):
"""
Returns sensors I2C address.
"""
LOGGER.debug("Reading RPS01A sensor's address.",)
return self.bus.read_byte_data(self.address, self.address_reg) | 0.013825 |
def model_export(model, file_name, repo=None):
"""
Args:
model: the model to be exported (may be None if repo is not None)
file_name: the output file name
repo: the model repo (alternative to model input) to be exported
Returns:
Nothing
"""
with codecs.open(file_name... | 0.002532 |
def hist_axis_func(axis_type: enum.Enum) -> Callable[[Hist], Axis]:
""" Wrapper to retrieve the axis of a given histogram.
This can be convenient outside of just projections, so it's made available in the API.
Args:
axis_type: The type of axis to retrieve.
Returns:
Callable to retrieve... | 0.004095 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.