text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def custom(cls, customgrouper):
"""Custom grouping from a given implementation of ICustomGrouping
:param customgrouper: The ICustomGrouping implemention to use
"""
if customgrouper is None:
raise TypeError("Argument to custom() must be ICustomGrouping instance or classpath")
if not isinstance... | 0.009917 |
async def remove(self, von_wallet: Wallet) -> None:
"""
Remove serialized wallet if it exists. Raise WalletState if wallet is open.
:param von_wallet: (closed) wallet to remove
"""
LOGGER.debug('WalletManager.remove >>> wallet %s', von_wallet)
await von_wallet.remove()... | 0.008108 |
def ask(type, payload):
"""
Publish a message with the specified action_type and payload over the
event system. Useful for debugging.
"""
async def _produce():
# notify the user that we were successful
print("Dispatching action with type {}...".format(type))
# fire an... | 0.001294 |
def put_mapping(self, using=None, **kwargs):
"""
Register specific mapping definition for a specific type.
Any additional keyword arguments will be passed to
``Elasticsearch.indices.put_mapping`` unchanged.
"""
return self._get_connection(using).indices.put_mapping(index... | 0.008772 |
def list_functions(region=None, key=None, keyid=None, profile=None):
'''
List all Lambda functions visible in the current scope.
CLI Example:
.. code-block:: bash
salt myminion boto_lambda.list_functions
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
... | 0.002242 |
def execute_transactions(conn, statements: Iterable):
"""Execute several statements each as a single DB transaction."""
with conn.cursor() as cursor:
for statement in statements:
try:
cursor.execute(statement)
conn.commit()
except psycopg2.Program... | 0.002762 |
def is_normal(self, k):
'''
lmap.is_normal(k) yields True if k is a key in the given lazy map lmap that is neither lazy
nor a formerly-lazy memoized key.
'''
v = ps.PMap.__getitem__(self, k)
if not isinstance(v, (types.FunctionType, partial)) or [] != getargspec_py27like(... | 0.010283 |
def create(cls, scheduled_analysis, tags=None, json_report_objects=None, raw_report_objects=None, additional_metadata=None, analysis_date=None):
"""
Create a new report.
For convenience :func:`~mass_api_client.resources.scheduled_analysis.ScheduledAnalysis.create_report`
of class :class... | 0.008276 |
def base_prompt(self, prompt):
"""Extract the base prompt pattern."""
if prompt is None:
return None
if not self.device.is_target:
return prompt
pattern = pattern_manager.pattern(self.platform, "prompt_dynamic", compiled=False)
pattern = pattern.format(pro... | 0.004777 |
def connect_get_namespaced_pod_exec(self, name, namespace, **kwargs):
"""
connect GET requests to exec of Pod
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.connect_get_namespaced_pod_exec... | 0.006952 |
def to_dict(self):
'Convert a structure into a Python dictionary.'
fsa = dict()
for key in self._integer_members:
fsa[key] = getattr(self, key)
ra = [ self.RegisterArea[index] for index in compat.xrange(0, SIZE_OF_80387_REGISTERS) ]
ra = tuple(ra)
fsa['Registe... | 0.014245 |
def get_global_state(self):
"""
获取全局状态
:return: (ret, data)
ret == RET_OK data为包含全局状态的字典,含义如下
ret != RET_OK data为错误描述字符串
===================== =========== ==============================================================
key ... | 0.00349 |
def plot_pseudosections(self, column, filename=None, return_fig=False):
"""Create a multi-plot with one pseudosection for each frequency.
Parameters
----------
column : string
which column to plot
filename : None|string
output filename. If set to None, do... | 0.001595 |
def sandbag(
adata,
annotation,
gene_names,
sample_names,
fraction=0.65,
filter_genes=None,
filter_samples=None):
"""Generate pairs of genes [Scialdone15]_ [Fechtner18]_.
Calculates the pairs of genes serving as marker pairs for each phase,
based on a... | 0.006806 |
def dump_age(age=None):
"""Formats the duration as a base-10 integer.
:param age: should be an integer number of seconds,
a :class:`datetime.timedelta` object, or,
if the age is unknown, `None` (default).
"""
if age is None:
return
if isinstance(age, timedelt... | 0.001669 |
def validatepubkey(pub):
'''
Returns input key if it's a valid hex public key, or False
otherwise.
Input must be hex string, not bytes or integer/long or anything
else.
'''
try:
pub = hexstrlify(unhexlify(pub))
except:
return False
if len(pub) == 130:
if pub... | 0.003497 |
def get_dh_params_length(server_handshake_bytes):
"""
Determines the length of the DH params from the ServerKeyExchange
:param server_handshake_bytes:
A byte string of the handshake data received from the server
:return:
None or an integer of the bit size of the DH parameters
"""
... | 0.003563 |
def download_segmentation_image_file(self, mapobject_type_name,
plate_name, well_name, well_pos_y, well_pos_x, tpoint, zplane, align,
directory):
'''Downloads a segmentation image and writes it to a *PNG* file on disk.
Parameters
----------
mapobject_type_name: s... | 0.004008 |
def gtf(args):
"""
%prog gtf gffile
Convert gff to gtf file. In gtf, only exon/CDS features are important. The
first 8 columns are the same as gff, but in the attributes field, we need to
specify "gene_id" and "transcript_id".
"""
p = OptionParser(gtf.__doc__)
opts, args = p.parse_args(... | 0.002138 |
def _check_proto(self, path):
'''
Make sure that this path is intended for the salt master and trim it
'''
if not path.startswith('salt://'):
raise MinionError('Unsupported path: {0}'.format(path))
file_path, saltenv = salt.utils.url.parse(path)
return file_pa... | 0.006211 |
def postMetricsPointsByID(self, id, value, **kwargs):
'''Add a metric point to a given metric.
:param id: Metric ID
:param value: Value to plot on the metric graph
:param timestamp: Unix timestamp of the point was measured
:return: :class:`Response <Response>` object
:rt... | 0.004386 |
def small_mind_image_recognition():
"""!
@brief Trains network using letters 'M', 'I', 'N', 'D' and recognize each of them with and without noise.
"""
images = [];
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_M;
images += IMAGE_SYMBOL_SAMPLES.LIST_IMAGES_SYMBOL_I;
images +=... | 0.020747 |
def _enqueue_init_updates(self):
"""Enqueues current routes to be shared with this peer."""
assert self.state.bgp_state == const.BGP_FSM_ESTABLISHED
if self.is_mbgp_cap_valid(RF_RTC_UC):
# Enqueues all best-RTC_NLRIs to be sent as initial update to this
# peer.
... | 0.003053 |
def deserialize(self, value, **kwargs): #pylint: disable=unused-argument
"""Deserialize input value to valid Property value
This method uses the Property :code:`deserializer` if available.
Otherwise, it uses :code:`from_json`. Any keyword arguments are
... | 0.006421 |
def get(self, sid):
"""
Constructs a OutgoingCallerIdContext
:param sid: The unique string that identifies the resource
:returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext
:rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdCo... | 0.011236 |
def generateExpectedList(numUniqueFeatures, numLocationsPerObject, maxNumObjects):
"""
Metric: How unique is each object's most unique feature? Calculate the
expected number of occurrences of an object's most unique feature.
"""
# We're choosing a location, checking its feature, and checking how many
# *oth... | 0.011862 |
def registIssue(self, CorpNum, statement, Memo=None, UserID=None):
""" 즉시발행
args
CorpNum : 팝빌회원 사업자번호
statement : 등록할 전자명세서 object. made with Statement(...)
Memo : 즉시발행메모
UserID : 팝빌회원 아이디
return
처리... | 0.00545 |
def deduplicate(directories: List[str], recursive: bool,
dummy_run: bool) -> None:
"""
De-duplicate files within one or more directories. Remove files
that are identical to ones already considered.
Args:
directories: list of directories to process
recursive: process subd... | 0.000181 |
def qemu_path(self, qemu_path):
"""
Sets the QEMU binary path this QEMU VM.
:param qemu_path: QEMU path
"""
if qemu_path and os.pathsep not in qemu_path:
if sys.platform.startswith("win") and ".exe" not in qemu_path.lower():
qemu_path += "w.exe"
... | 0.005495 |
def get_literals(self):
"""
Return a list of all the literals contained in this expression.
Include recursively subexpressions symbols.
This includes duplicates.
"""
if self.isliteral:
return [self]
if not self.args:
return []
retur... | 0.007538 |
def style_factory(self, style_name):
"""Retrieve the specified pygments style.
If the specified style is not found, the vim style is returned.
:type style_name: str
:param style_name: The pygments style name.
:rtype: :class:`pygments.style.StyleMeta`
:return: Pygments ... | 0.001395 |
def set_service_value(self, service_id, set_name, parameter_name, value):
"""Set a variable on the vera device.
This will call the Vera api to change device state.
"""
payload = {
'id': 'lu_action',
'action': 'Set' + set_name,
'serviceId': service_id,... | 0.007181 |
def simxSetObjectIntParameter(clientID, objectHandle, parameterID, parameterValue, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
return c_SetObjectIntParameter(clientID, objectHandle, parameterID, parameterValue, operationMode) | 0.012987 |
def delete_data_disk(self, service_name, deployment_name, role_name, lun, delete_vhd=False):
'''
Removes the specified data disk from a virtual machine.
service_name:
The name of the service.
deployment_name:
The name of the deployment.
role_name:
... | 0.004348 |
def get_name_dictionary_extractor(name_trie):
"""Method for creating default name dictionary extractor"""
return DictionaryExtractor()\
.set_trie(name_trie)\
.set_pre_filter(VALID_TOKEN_RE.match)\
.set_pre_process(lambda x: x.lower())\
.set_metadata({'extractor': 'dig_name_dicti... | 0.002959 |
def try_next(self):
"""Advance the cursor without blocking indefinitely.
This method returns the next change document without waiting
indefinitely for the next change. For example::
with db.collection.watch() as stream:
while stream.alive:
change... | 0.000878 |
def derive_identity_arf(name, arf):
"""Create an "identity" ARF that has uniform sensitivity.
*name*
The name of the ARF object to be created; passed to Sherpa.
*arf*
An existing ARF object on which to base this one.
Returns:
A new ARF1D object that has a uniform spectral response vec... | 0.002582 |
def fin_session(self):
""" Finalize current session
:return: None
"""
self.__prompt_show = False
self.__history.add(self.row())
self.exec(self.row()) | 0.049383 |
def queue_file_io_task(self, fileobj, data, offset):
"""Queue IO write for submission to the IO executor.
This method accepts an IO executor and information about the
downloaded data, and handles submitting this to the IO executor.
This method may defer submission to the IO executor if... | 0.004107 |
def init():
"""Initialize the pipeline in maya so everything works
Init environment and load plugins.
This also creates the initial Jukebox Menu entry.
:returns: None
:rtype: None
:raises: None
"""
main.init_environment()
pluginpath = os.pathsep.join((os.environ.get('JUKEBOX_PLUGIN... | 0.003148 |
def shutdown(self):
"""
Shuts down the TLS session and then shuts down the underlying socket
:raises:
OSError - when an error is returned by the OS crypto library
"""
if self._context_handle_pointer is None:
return
out_buffers = None
try... | 0.001871 |
def _update_attribute_details(self, **update_props):
""" Update operation for ISO Attribute Details metadata: write to "MD_Metadata/featureType" """
tree_to_update = update_props['tree_to_update']
xpath = self._data_map['_attr_citation']
# Cannot write to remote file: remove the featur... | 0.008 |
def draw(self, texture, pos=(0.0, 0.0), scale=(1.0, 1.0)):
"""
Draw texture using a fullscreen quad.
By default this will conver the entire screen.
:param pos: (tuple) offset x, y
:param scale: (tuple) scale x, y
"""
if not self.initialized:
... | 0.002778 |
def parse_doctype(cls, file, encoding=None):
'''Get the doctype from the document.
Returns:
str, None
'''
if encoding:
lxml_encoding = to_lxml_encoding(encoding) or 'latin1'
else:
lxml_encoding = encoding
try:
parser = lxm... | 0.00314 |
def realpath_with_context(path, context):
"""
Convert a path into its realpath:
* For relative path: use :attr:`context.workdir` as root directory
* For absolute path: Pass-through without any changes.
:param path: Filepath to convert (as string).
:param context: Behave context object (wit... | 0.001736 |
def skip(self, sched_rule_id):
"""Skip a schedule rule (watering time)."""
path = 'schedulerule/skip'
payload = {'id': sched_rule_id}
return self.rachio.put(path, payload) | 0.009852 |
def open_archive(fs_url, archive):
"""Open an archive on a filesystem.
This function tries to mimick the behaviour of `fs.open_fs` as closely
as possible: it accepts either a FS URL or a filesystem instance, and
will close all resources it had to open.
Arguments:
fs_url (FS or text_type): ... | 0.000801 |
def default_privileges_grant(name,
object_name,
object_type,
defprivileges=None,
grant_option=None,
prepend='public',
maintenance_db=None,
user=None,
host=None,
port=None,
password=None,
runas=None):
'''
.. versionadded:: 20... | 0.006048 |
def image_load_time(self):
"""
Returns aggregate image load time for all pages.
"""
load_times = self.get_load_times('image')
return round(mean(load_times), self.decimal_precision) | 0.009091 |
def next_blob(self):
"""Get the next frame from file"""
blob_file = self.blob_file
try:
preamble = DAQPreamble(file_obj=blob_file)
except struct.error:
raise StopIteration
try:
data_type = DATA_TYPES[preamble.data_type]
except KeyError... | 0.001747 |
def __send_message(self, operation):
"""Send a getmore message and handle the response.
"""
def kill():
self.__killed = True
self.__end_session(True)
client = self.__collection.database.client
try:
response = client._run_operation_with_respons... | 0.001355 |
def parse_esmtp_extensions(message):
"""
Parses the response given by an ESMTP server after a *EHLO* command.
The response is parsed to build:
- A dict of supported ESMTP extensions (with parameters, if any).
- A list of supported authentication methods.
Returns:
... | 0.002144 |
def _parse_response(self, response):
"""
Parse http raw respone into python
dictionary object.
:param str response: http response
:returns: response dict
:rtype: dict
"""
response_dict = {}
for line in response.splitlines():
k... | 0.007109 |
def upload_stream(stream, server, account, projname, language=None,
username=None, password=None,
append=False, stage=False):
"""
Given a file-like object containing a JSON stream, upload it to
Luminoso with the given account name and project name.
"""
client = Lu... | 0.000604 |
def parse_litezip(path):
"""Parse a litezip file structure to a data structure given the path
to the litezip directory.
"""
struct = [parse_collection(path)]
struct.extend([parse_module(x) for x in path.iterdir()
if x.is_dir() and x.name.startswith('m')])
return tuple(sorted(... | 0.003049 |
def flatten_container(self, container):
"""
Accepts a chronos container and pulls out the nested values into the top level
"""
for names in ARG_MAP.values():
if names[TransformationTypes.CHRONOS.value]['name'] and \
'.' in names[TransformationTypes... | 0.006542 |
def combine(self, other_sequence):
"""
If this sequence is the prefix of another sequence, combine
them into a single VariantSequence object. If the other sequence
is contained in this one, then add its reads to this VariantSequence.
Also tries to flip the order (e.g. this sequen... | 0.001322 |
def unpack(self, buff=None, offset=0):
"""Unpack *buff* into this object.
This method will convert a binary data into a readable value according
to the attribute format.
Args:
buff (bytes): Binary buffer.
offset (int): Where to begin unpacking.
Raises:
... | 0.003846 |
def setup_once(initfn):
"""
call class instance method for initial setup ::
class B(object):
def init(self, a):
print 'init call:', a
@setup_once(init)
def mycall(self, a):
print 'real call:', a
b = B()
b.mycall(222)... | 0.001068 |
def register_pivot_wavelength(self, telescope, band, wlen):
"""Register precomputed pivot wavelengths."""
if (telescope, band) in self._pivot_wavelengths:
raise AlreadyDefinedError('pivot wavelength for %s/%s already '
'defined', telescope, band)
... | 0.007092 |
def _kmeans_run(X, n_clusters, max_iter, tol):
""" Run a single trial of k-means clustering
on dataset X, and given number of clusters
"""
membs = np.empty(shape=X.shape[0], dtype=int)
centers = _kmeans_init(X, n_clusters)
sse_last = 9999.9
n_iter = 0
for it in range(1,max_iter):
... | 0.004717 |
def get_bucket_notification_config(self, bucket):
"""
Get the notification configuration of a bucket.
@param bucket: The name of the bucket.
@return: A C{Deferred} that will request the bucket's notification
configuration.
"""
details = self._details(
... | 0.005367 |
def _remove(self, timer):
"""Remove timer from heap lock and presence are assumed"""
assert timer.timer_heap == self
del self.timers[timer]
assert timer in self.heap
self.heap.remove(timer)
heapq.heapify(self.heap) | 0.007634 |
def get_session(config=None, config_file=None, debug=None, http_adapter_kwargs=None):
"""Return a new :class:`ArchiveSession` object. The :class:`ArchiveSession`
object is the main interface to the ``internetarchive`` lib. It allows you to
persist certain parameters across tasks.
:type config: dict
... | 0.004573 |
def get_cited_dois(arxiv_id):
"""
Get the DOIs of the papers cited in a .bbl file.
.. note::
Bulk download of sources from arXiv is not permitted by their API. \
You should have a look at http://arxiv.org/help/bulk_data_s3.
:param arxiv_id: The arXiv id (e.g. ``1401.2910`` or ... | 0.001399 |
def update_position(self, time,
xs, ys, zs, vxs, vys, vzs,
ethetas, elongans, eincls,
ds=None, Fs=None,
ignore_effects=False,
component_com_x=None,
**kwargs):
"""
... | 0.006394 |
def find_cookies_for_class(cookies_file, class_name):
"""
Return a RequestsCookieJar containing the cookies for
.coursera.org and class.coursera.org found in the given cookies_file.
"""
path = "/" + class_name
def cookies_filter(c):
return c.domain == ".coursera.org" \
or (... | 0.001815 |
def bootstrap_indexes(data, n_samples=10000):
"""
Given data points data, where axis 0 is considered to delineate points, return
an generator for sets of bootstrap indexes. This can be used as a list
of bootstrap indexes (with list(bootstrap_indexes(data))) as well.
"""
for _ in xrange(n_samples):
y... | 0.002703 |
def get_hosts_from_file(filename,
default_protocol='telnet',
default_domain='',
remove_duplicates=False,
encoding='utf-8'):
"""
Reads a list of hostnames from the file with the given name.
:type filename: strin... | 0.000723 |
def encode(self, value):
"""
Return a bytestring representation of the value
"""
if isinstance(value, Token):
return b(value.value)
if isinstance(value, bytes):
return value
elif isinstance(value, (int, long)):
value = b(str(val... | 0.006536 |
def t(self, point):
'''
:point: Point subclass
:return: float
If :point: is collinear, determine the 't' coefficient of
the parametric equation:
xyz = A<xyz> + t ( B<xyz> - A<xyz> )
if t < 0, point is less than A and B on the line
if t >= 0 and <= 1, po... | 0.002759 |
def activate(admin=True, browser=True, name='admin', reflect_all=False):
"""Activate each pre-registered model or generate the model classes and
(possibly) register them for the admin.
:param bool admin: should we generate the admin interface?
:param bool browser: should we open the browser for the use... | 0.000729 |
def django(line):
'''
>>> import pprint
>>> input_line1 = '[23/Aug/2017 11:35:25] INFO [app.middleware_log_req:50]View func called:{"exception": null,"processing_time": 0.00011801719665527344, "url": "<url>",host": "localhost", "user": "testing", "post_contents": "", "method": "POST" }'
>>> output_line1... | 0.004952 |
async def set_lock(self, resource, lock_identifier, lock_timeout):
"""
Lock this instance and set lock expiration time to lock_timeout
:param resource: redis key to set
:param lock_identifier: uniquie id of lock
:param lock_timeout: timeout for lock in seconds
:raises: Lo... | 0.001284 |
def init(script=sys.argv[0], base='lib', append=True, ignore=['/','/usr'], realpath=False, pythonpath=False, throw=False):
"""
Parameters:
* `script`: Path to script file. Default is currently running script file
* `base`: Name of base module directory to add to sys.path. Default is "lib".
... | 0.009922 |
def to_json(self, validate=False, pretty_print=True, data_path=None):
"""Convert data to JSON
Parameters
----------
data_path : string
If not None, then data is written to a separate file at the
specified path. Note that the ``url`` attribute if the data must
... | 0.002999 |
def get_entity(self,entity_id):
"""
Returns the entity object for the given entity identifier
@type entity_id: string
@param entity_id: the token identifier
@rtype: L{Centity}
@return: the entity object
"""
entity_node = self.map_entity_id_to_node.get(en... | 0.009227 |
def parse(self, limit=None):
"""
Override Source.parse()
Args:
:param limit (int, optional) limit the number of rows processed
Returns:
:return None
"""
if limit is not None:
LOG.info("Only parsing first %d rows", limit)
ensemb... | 0.006729 |
def get_metric(
self, name: str,
labels: Union[Dict[str, str], None] = None) -> Metric:
"""Return a metric, optionally configured with labels."""
metric = self._metrics[name]
if labels:
return metric.labels(**labels)
return metric | 0.006689 |
def anonymize_column(self, col):
"""Map the values of column to new ones of the same type.
It replaces the values from others generated using `faker`. It will however,
keep the original distribution. That mean that the generated `probability_map` for both
will have the same values, but ... | 0.004535 |
def mac(address='', interface='', vlan=0, **kwargs): # pylint: disable=unused-argument
'''
Returns the MAC Address Table on the device.
:param address: MAC address to filter on
:param interface: Interface name to filter on
:param vlan: VLAN identifier
:return: A list of dictio... | 0.002102 |
def process_request():
"""
Retrieve a CameraStatus, Event or FileRecord from the request, based on the supplied type and ID. If the type is
'cached_request' then the ID must be specified in 'cached_request_id' - if this ID is not for an entity in the
cache this method will return None an... | 0.007779 |
def scan_video(path):
"""Scan a video from a `path`.
:param str path: existing path to the video.
:return: the scanned video.
:rtype: :class:`~subliminal.video.Video`
"""
# check for non-existing path
if not os.path.exists(path):
raise ValueError('Path does not exist')
# check... | 0.001712 |
def inventory(self, choices=None):
""" Return a dictionary of the inventory items and status """
status = (True, None)
if not choices:
return (False, 'No choices made')
try:
# choices: repos, tools, images, built, running, enabled
items = {'repos': [],... | 0.000669 |
def _set_lsp_frr_priority(self, v, load=False):
"""
Setter method for lsp_frr_priority, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/lsp/lsp_frr/lsp_frr_priority (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_lsp_frr_priority is consid... | 0.005155 |
def info(vm, info_type='all', key='uuid'):
'''
Lookup info on running kvm
vm : string
vm to be targeted
info_type : string [all|block|blockstats|chardev|cpus|kvm|pci|spice|version|vnc]
info type to return
key : string [uuid|alias|hostname]
value type of 'vm' parameter
C... | 0.002869 |
def get_configured_consensus_module(block_id, state_view):
"""Returns the consensus_module based on the consensus module set by
the "sawtooth_settings" transaction family.
Args:
block_id (str): the block id associated with the current state_view
state_view (:obj:`StateVi... | 0.002186 |
def get_raw(self):
"""Get a list with information about the file.
The returned list contains name, size, last_modified and location.
"""
return [self.name, self.size, self.last_modified, self.location] | 0.008547 |
def single_qubit_op_to_framed_phase_form(
mat: np.ndarray) -> Tuple[np.ndarray, complex, complex]:
"""Decomposes a 2x2 unitary M into U^-1 * diag(1, r) * U * diag(g, g).
U translates the rotation axis of M to the Z axis.
g fixes a global phase factor difference caused by the translation.
r's ph... | 0.000933 |
def create_insert_dict_string(self, tblname, d, PKfields=[], fields=None, check_existing = False):
'''The main function of the insert_dict functions.
This creates and returns the SQL query and parameters used by the other functions but does not insert any data into the database.
Simple fu... | 0.00896 |
def httpretty_callback(request, uri, headers):
"""httpretty request handler.
converts a call intercepted by httpretty to
the stack-in-a-box infrastructure
:param request: request object
:param uri: the uri of the request
:param headers: headers for the response
:returns: tuple - (int, dic... | 0.001073 |
def matrix(fasta_path: 'path to tictax annotated fasta input',
scafstats_path: 'path to BBMap scaftstats file'):
'''
Generate taxonomic count matrix from tictax classified contigs
'''
records = SeqIO.parse(fasta_path, 'fasta')
df = tictax.matrix(records, scafstats_path)
df.to_csv(sys.... | 0.003058 |
def start_file_logger(self, name, log_file_level=logging.DEBUG, log_file_path='./'):
"""Start file logging."""
log_file_path = os.path.expanduser(log_file_path) / '{}.log'.format(name)
logdir = log_file_path.parent
try:
logdir.mkdir(parents=True, exist_ok=True)
... | 0.006346 |
def get_parameter_or_create(name, shape=None, initializer=None, need_grad=True,
as_need_grad=None):
"""
Returns an existing parameter variable with the provided name.
If a variable with the provided name does not exist,
a new variable with the provided name is returned.
... | 0.002894 |
def defaults(self):
"""Return default metadata."""
return dict(
access_right='open',
description=self.description,
license='other-open',
publication_date=self.release['published_at'][:10],
related_identifiers=list(self.related_identifiers),
... | 0.004695 |
def _encode_request(self, request):
"""Encode a request object"""
obj = request_to_dict(request, self.spider)
return self.serializer.dumps(obj) | 0.011976 |
def addFreetextAnnot(self, rect, text, fontsize=12, fontname=None, color=None, rotate=0):
"""Add a 'FreeText' annotation in rectangle 'rect'."""
CheckParent(self)
val = _fitz.Page_addFreetextAnnot(self, rect, text, fontsize, fontname, color, rotate)
if not val: return
val.thiso... | 0.011628 |
def terminate(self):
"""Terminate all connections in the pool."""
if self._closed:
return
self._check_init()
for ch in self._holders:
ch.terminate()
self._closed = True | 0.008621 |
async def submit_request(pool_handle: int,
request_json: str) -> str:
"""
Publishes request message to validator pool (no signing, unlike sign_and_submit_request).
The request is sent to the validator pool as is. It's assumed that it's already prepared.
:param pool_handle: pool... | 0.00326 |
def multiply(self, other, out=None):
"""Return ``out = self * other``.
If ``out`` is provided, the result is written to it.
See Also
--------
LinearSpace.multiply
"""
return self.space.multiply(self, other, out=out) | 0.007326 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.