text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def to_dict(self):
""" to_dict: puts data in format CC expects
Args: None
Returns: dict of channel data
"""
return {
"title": self.title,
"language" : self.language,
"description": self.description,
"node_id": self.get_node_... | 0.005338 |
def fitlin_clipped(xy,uv,verbose=False,mode='rscale',nclip=3,reject=3):
""" Perform a clipped fit based on the number of iterations and rejection limit
(in sigma) specified by the user. This will more closely replicate the results
obtained by 'geomap' using 'maxiter' and 'reject' parameters.
"""... | 0.019802 |
def _install_wrappers(self):
"""
Install our PluginLoader monkey patches and update global variables
with references to the real functions.
"""
global action_loader__get
action_loader__get = ansible_mitogen.loaders.action_loader.get
ansible_mitogen.loaders.action_... | 0.004082 |
def get_matches(lf, candidate_set, match_values=[1, -1]):
"""Return a list of candidates that are matched by a particular LF.
A simple helper function to see how many matches (non-zero by default) an
LF gets.
:param lf: The labeling function to apply to the candidate_set
:param candidate_set: The ... | 0.00137 |
def parse_lines(lines: [str], units: Units, use_na: bool = True) -> [dict]: # type: ignore
"""
Returns a list of parsed line dictionaries
"""
parsed_lines = []
prob = ''
while lines:
raw_line = lines[0].strip()
line = core.sanitize_line(raw_line)
# Remove prob from the b... | 0.004174 |
def cache_set(key, value, timeout=None, refreshed=False):
"""
Wrapper for ``cache.set``. Stores the cache entry packed with
the desired cache expiry time. When the entry is retrieved from
cache, the packed expiry time is also checked, and if past,
the stale cache entry is stored again with an expiry... | 0.001142 |
def express_route_cross_connection_peerings(self):
"""Instance depends on the API version:
* 2018-02-01: :class:`ExpressRouteCrossConnectionPeeringsOperations<azure.mgmt.network.v2018_02_01.operations.ExpressRouteCrossConnectionPeeringsOperations>`
* 2018-04-01: :class:`ExpressRouteCrossC... | 0.006853 |
def subscribe_to_ticker(self, pair, **kwargs):
"""Subscribe to the passed pair's ticker channel.
:param pair: str, Symbol pair to request data for
:param kwargs:
:return:
"""
identifier = ('ticker', pair)
self._subscribe('ticker', identifier, symbol=pair, **kwarg... | 0.006211 |
def _convertTZ(self):
"""Will convert UTC datetimes to the current local timezone"""
tz = timezone.get_current_timezone()
dtstart = self['DTSTART']
dtend = self['DTEND']
if dtstart.zone() == "UTC":
dtstart.dt = dtstart.dt.astimezone(tz)
if dtend.zone() == "U... | 0.008086 |
def move_recursive(self, dest_path):
"""See DAVResource.move_recursive() """
if self.provider.readonly:
raise DAVError(HTTP_FORBIDDEN)
fpDest = self.provider._loc_to_file_path(dest_path, self.environ)
assert not util.is_equal_or_child_uri(self.path, dest_path)
assert ... | 0.002225 |
def date_utc(self) -> datetime:
"""Timestamp when the post was created (UTC)."""
return datetime.utcfromtimestamp(self._node["date"] if "date" in self._node else self._node["taken_at_timestamp"]) | 0.014218 |
def translate(self):
"""
Create all translations objects for this Translatable instance.
@rtype: list of Translation objects
@return: Returns a list of translations objects
"""
translations = []
for lang in settings.LANGUAGES:
# do not create an trans... | 0.002573 |
def _hack_namedtuple(cls):
""" Make class generated by namedtuple picklable """
name = cls.__name__
fields = cls._fields
def __reduce__(self):
return (_restore, (name, fields, tuple(self)))
cls.__reduce__ = __reduce__
cls._is_namedtuple_ = True
return cls | 0.003425 |
def register(op_name):
"""Register operators"""
def wrapper(func):
"""Helper function to map functions"""
try:
import onnx as _
MXNetGraph.registry_[op_name] = func
except ImportError:
pass
return func
... | 0.005935 |
def global_request(self, kind, data=None, wait=True):
"""
Make a global request to the remote host. These are normally
extensions to the SSH2 protocol.
:param str kind: name of the request.
:param tuple data:
an optional tuple containing additional data to attach to... | 0.0015 |
def getIndividual(self, id_):
"""
Returns the Individual with the specified id, or raises
a IndividualNotFoundException otherwise.
"""
if id_ not in self._individualIdMap:
raise exceptions.IndividualNotFoundException(id_)
return self._individualIdMap[id_] | 0.006349 |
def bounds_tree(triangles):
"""
Given a list of triangles, create an r-tree for broad- phase
collision detection
Parameters
---------
triangles : (n, 3, 3) float
Triangles in space
Returns
---------
tree : rtree.Rtree
One node per triangle
"""
triangles = np.asa... | 0.001414 |
def to_phonetics(self):
"""
Transcribing words in verse helps find alliteration.
"""
if len(self.long_lines) == 0:
logger.error("No text was imported")
self.syllabified_text = []
else:
transcriber = Transcriber(DIPHTHONGS_IPA, DIPHTHONGS_IPA_cl... | 0.004625 |
def dump(self, filename):
"""Dump the grammar tables to a pickle file."""
f = open(filename, "wb")
pickle.dump(self.__dict__, f, 2)
f.close() | 0.011561 |
def get_pytwis(epilog):
"""Connect to the Redis database and return the Pytwis instance.
Parameters
----------
epilog: str
An epilog string which will be displayed by ArgumentParser.
Returns
-------
pytwis: A Pytwis instance.
prompt: str
The prompt string which contains... | 0.004503 |
def init_from_storage_write_to_datastore(self):
"""Init list of sumibssions from Storage and saves them to Datastore.
Should be called only once (typically by master) during evaluation of
the competition.
"""
# Load submissions
self._attacks = self._load_submissions_from_datastore_dir(
... | 0.001603 |
def printableType(val, name=None, parent=None):
"""
Tries to make a nice type string for a value.
Can also pass in a Printable parent object
"""
import numpy as np
if parent is not None and hasattr(parent, 'customPrintableType'):
# Hack for non - trivial preference types
_typestr... | 0.001195 |
def find_by_reference_ids(reference_ids, _connection=None, page_size=100,
page_number=0, sort_by=enums.DEFAULT_SORT_BY,
sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos identified by a list of reference ids
"""
if not isinstance(reference_ids, (list, tuple)):
... | 0.006024 |
def _slice(self, slicer):
""" return a slice of my values """
# slice the category
# return same dims as we currently have
if isinstance(slicer, tuple) and len(slicer) == 2:
if not com.is_null_slice(slicer[0]):
raise AssertionError("invalid slicing for a 1-n... | 0.004505 |
def _update(self, datapoints):
"""
This method store in the datapoints in the current database.
:datapoints: is a list of tupple with the epoch timestamp and value
[(1368977629,10)]
"""
if len(datapoints) == 1:
timestamp, value = datapoints[0]
... | 0.004525 |
def add_static(self, prefix, path, **kwargs):
"""
:param prefix: URL prefix
:param path: file directory
:param kwargs:
:return:
"""
self.statics.append((prefix, path, kwargs),) | 0.008621 |
def reprovision_and_retry(func):
"""
Wraps the `errback` callback of the API functions, automatically trying to
re-provision if the app ID can not be found during the operation. If that's
unsuccessful, it will raise the UnknownAppID error.
"""
@functools.wraps(func)
def wrapper(*a, **kw):
errback = kw... | 0.017003 |
def handle_namespace_url(self, line: str, position: int, tokens: ParseResults) -> ParseResults:
"""Handle statements like ``DEFINE NAMESPACE X AS URL "Y"``.
:raises: RedefinedNamespaceError
:raises: pybel.resources.exc.ResourceError
"""
namespace = tokens['name']
self.ra... | 0.004603 |
def get(self, request, *args, **kwargs):
"""
Handles GET requests and instantiates blank versions of the form and its inline formsets.
"""
# Prepare base
if 'pk' in kwargs:
self.object = self.get_object()
else:
self.object = None
form_clas... | 0.002516 |
def assign(pid_type, pid_value, status, object_type, object_uuid, overwrite):
"""Assign persistent identifier."""
from .models import PersistentIdentifier
obj = PersistentIdentifier.get(pid_type, pid_value)
if status is not None:
obj.status = status
obj.assign(object_type, object_uuid, overw... | 0.002591 |
def load_track(self, track):
"""
Load a track. Corresponds to the igv.js Browser function loadTrack (see https://github.com/igvteam/igv.js/wiki/Browser-Control-2.0#loadtrack).
:param track: A dictionary specifying track options. See https://github.com/igvteam/igv.js/wiki/Tracks-2.0.
... | 0.008451 |
def preprocess_async(train_dataset, output_dir, eval_dataset=None, checkpoint=None, cloud=None):
"""Preprocess data. Produce output that can be used by training efficiently.
Args:
train_dataset: training data source to preprocess. Can be CsvDataset or BigQueryDataSet.
If eval_dataset is None, the pipel... | 0.010766 |
def ecdsa_private_key(privkey_str=None, compressed=None):
"""
Make a private key, but enforce the following rule:
* unless the key's hex encoding specifically ends in '01', treat it as uncompressed.
"""
if compressed is None:
compressed = False
if privkey_str is not None:
... | 0.004237 |
def _validate_status(self):
"""Validates Status information. Raises errors for required
properties."""
if not self.id:
msg = "No 'id' in Status for request '{}'"
raise ValidationError(msg.format(self.url))
if not self.status:
msg = "No 'status' in Sta... | 0.000791 |
def _send_offset_fetch_request(self, partitions):
"""Fetch the committed offsets for a set of partitions.
This is a non-blocking call. The returned future can be polled to get
the actual offsets returned from the broker.
Arguments:
partitions (list of TopicPartition): the p... | 0.001523 |
def t_NUMBER(self, t):
r'(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?(kb|gb|mb|tb|pb|Kb|Gb|Mb|Tb|Pb)?'
if re.match(r'^(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?(kb|gb|mb|tb|pb|Kb|Gb|Mb|Tb|Pb)?$',t.value):
multiplyer = 1
try:
suffix = (t.value[-2:]).lower()
if suffix... | 0.006356 |
def declaration_files(decl_or_decls):
"""
Returns set of files
Every declaration is declared in some file. This function returns set, that
contains all file names of declarations.
:param decl_or_decls: reference to list of declaration's or single
declaration
:type decl_or_decls: :class... | 0.001709 |
def log(self, n=None, template=None):
"""
Run the repository log command
Returns:
str: output of log command (``bzr log -l <n>``)
"""
cmd = ['bzr', 'log']
if n:
cmd.append('-l%d' % n)
return self.sh(cmd, shell=False) | 0.006734 |
def p_single_line_if(p):
""" if_inline : if_then_part statements %prec ID
| if_then_part co_statements_co %prec NEWLINE
| if_then_part statements_co %prec NEWLINE
| if_then_part co_statements %prec ID
"""
cond_ = p[1]
stat_ = p[2]
p[0] = make_sen... | 0.00274 |
def refresh(cls):
"""This gets called by the refresh function (see the top level
__init__).
"""
# clear the old values in _flag_map
try:
del cls._flag_map["t"]
except KeyError:
pass
try:
del cls._flag_map["-"]
except Ke... | 0.003521 |
def wait_for_newchannel(
raiden: 'RaidenService',
payment_network_id: PaymentNetworkID,
token_address: TokenAddress,
partner_address: Address,
retry_timeout: float,
) -> None:
"""Wait until the channel with partner_address is registered.
Note:
This does not time ... | 0.001269 |
def _ensure_managed_repos_dir_exists():
"""
Our exports file will be invalid if this folder doesn't exist, and the NFS server
will not run correctly.
"""
if not os.path.exists(constants.REPOS_DIR):
os.makedirs(constants.REPOS_DIR) | 0.007752 |
def sync_object(src_obj, dest_repo, export_context='migrate',
overwrite=False, show_progress=False,
requires_auth=False, omit_checksums=False,
verify=False):
'''Copy an object from one repository to another using the Fedora
export functionality.
:param src_ob... | 0.003892 |
def _extract_modifier(x, i, attrs):
"""Extracts the */+/! modifier in front of the Cite at index 'i' of the
element list 'x'. The modifier is stored in 'attrs'. Returns the updated
index 'i'."""
global _cleveref_tex_flag # pylint: disable=global-statement
assert x[i]['t'] == 'Cite'
assert i... | 0.001101 |
def build_image_path(self, src):
"""\
This method will take an image path and build
out the absolute path to that image
* using the initial url we crawled
so we can find a link to the image
if they use relative urls like ../myimage.jpg
"""
o = urlparse... | 0.004124 |
def collate_fonts_data(fonts_data):
"""Collate individual fonts data into a single glyph data list."""
glyphs = {}
for family in fonts_data:
for glyph in family:
if glyph['unicode'] not in glyphs:
glyphs[glyph['unicode']] = glyph
else:
c = gly... | 0.002188 |
def get_relation(self, relation, **kwargs):
"""
Generic method to load the relation from any resource.
Query the client with the object's known parameters
and try to retrieve the provided relation type. This
is not meant to be used directly by a client, it's more
a helpe... | 0.006263 |
def datedif(ctx, start_date, end_date, unit):
"""
Calculates the number of days, months, or years between two dates.
"""
start_date = conversions.to_date(start_date, ctx)
end_date = conversions.to_date(end_date, ctx)
unit = conversions.to_string(unit, ctx).lower()
if start_date > end_date:
... | 0.001044 |
def _is_word_type(token_type):
"""Return true if this is a word-type token."""
return token_type in [TokenType.Word,
TokenType.QuotedLiteral,
TokenType.UnquotedLiteral,
TokenType.Number,
TokenType.Deref] | 0.003175 |
def _run_done_callbacks(self):
''' Run the callbacks and remove the callbacks from the internal
List so they do not get run again if done is notified more than once.
'''
with self._callbacks_lock:
for callback in self._done_callbacks:
try:
... | 0.006983 |
def inputPoint(self):
"""
Returns a scene space point that the connection \
will draw to as its input target. If the connection \
has a node defined, then it will calculate the input \
point based on the position of the node, factoring in \
preference for input location ... | 0.001062 |
def wait_for_compilation_job(self, job, poll=5):
"""Wait for an Amazon SageMaker Neo compilation job to complete.
Args:
job (str): Name of the compilation job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value fr... | 0.004831 |
def add(self, name, desc, func=None, args=None, krgs=None):
"""Add a menu entry."""
self.entries.append(MenuEntry(name, desc, func, args or [], krgs or {})) | 0.017442 |
def read_files(project, ext):
""" Reads files inside the input project directory. """
project_path = os.path.join(os.path.dirname(__file__), project)
file_list = os.listdir(project_path)
flist = []
flist_path = []
for f in file_list:
f_path = os.path.join(project_path, f)
if os.p... | 0.002037 |
def effect_has_complete_transcript(effect):
"""
Parameters
----------
effect : subclass of MutationEffect
Returns True if effect has transcript and that transcript has complete CDS
"""
return apply_to_transcript_if_exists(
effect=effect,
fn=lambda t: t.complete,
defa... | 0.00303 |
def _combined_wildcards_iter(flatterm: Iterator[TermAtom]) -> Iterator[TermAtom]:
"""Combine consecutive wildcards in a flatterm into a single one."""
last_wildcard = None # type: Optional[Wildcard]
for term in flatterm:
if isinstance(term, Wildcard) and not isinstance(term, SymbolW... | 0.005252 |
def targets(tgt, tgt_type='glob', **kwargs):
'''
Return the targets from the directory of flat yaml files,
checks opts for location.
'''
roster_dir = __opts__.get('roster_dir', '/etc/salt/roster.d')
# Match the targets before rendering to avoid opening files unnecessarily.
raw = dict.fromkey... | 0.005214 |
def delete_long_poll_channel(self, **kwargs): # noqa: E501
"""Delete notification Long Poll channel # noqa: E501
To delete a notification Long Poll channel. This is required to change the channel from Long Poll to a callback. You should not make a GET `/v2/notification/pull` call for 2 minutes after ... | 0.001423 |
def weighted_mean(data, weights=None):
"""Calculate the weighted mean of a list."""
if weights is None:
return mean(data)
total_weight = float(sum(weights))
weights = [weight / total_weight for weight in weights]
w_mean = 0
for i, weight in enumerate(weights):
w_mean += weight * ... | 0.002899 |
def _add_token_span_to_document(self, span_element):
"""
adds an <intro>, <act> or <conclu> token span to the document.
"""
for token in span_element.text.split():
token_id = self._add_token_to_document(token)
if span_element.tag == 'act': # doc can have 0+ acts
... | 0.00316 |
def get_plate_stock(self, plate_code):
"""
获取特定板块下的股票列表
:param plate_code: 板块代码, string, 例如,”SH.BK0001”,”SH.BK0002”,先利用获取子版块列表函数获取子版块代码
:return: (ret, data)
ret == RET_OK 返回pd dataframe数据,data.DataFrame数据, 数据列格式如下
ret != RET_OK 返回错误字符串
... | 0.00334 |
def get_intersection(bbox1, bbox2):
"""
:param bbox1: (page, width, height, top, left, bottom, right)
:param bbox2: (page, width, height, top, left, bottom, right)
:return: intersection if bboxes are in the same page and intersect
"""
intersection = []
page_1, page_width, page_height, top_1,... | 0.002176 |
def get_filter(self, **filter_kwargs):
"""
Returns a list of Q objects that can be passed
to an queryset for filtering.
Default implementation returns a Q
object for `base_filter_kwargs` and any
passed in keyword arguments.
"""
filter_kwargs.update(self.b... | 0.004662 |
def align(self, input_path, output_path, directions, pipeline,
filter_minimum):
'''align - Takes input path to fasta of unaligned reads, aligns them to
a HMM, and returns the aligned reads in the output path
Parameters
----------
input_path : str
output_pa... | 0.003896 |
def _convert_latitude(self, latitude):
"""Convert from latitude to the y position in overall map."""
return int((180 - (180 / pi * log(tan(
pi / 4 + latitude * pi / 360)))) * (2 ** self._zoom) * self._size / 360) | 0.0125 |
def main(_):
"""Run the sample attack"""
# Images for inception classifier are normalized to be in [-1, 1] interval,
# eps is a difference between pixels so it should be in [0, 2] interval.
# Renormalizing epsilon from [0, 255] to [0, 2].
eps = 2.0 * FLAGS.max_epsilon / 255.0
alpha = 2.0 * FLAGS.iter_alpha ... | 0.007162 |
def get(self, name, section=None, fallback=False):
"""
Returns a previously registered preference
:param section: The section name under which the preference is registered
:type section: str.
:param name: The name of the preference. You can use dotted notation 'section.name' if ... | 0.004971 |
def get_app_hostname():
"""Return hostname of a running Endpoints service.
Returns hostname of an running Endpoints API. It can be 1) "localhost:PORT"
if running on development server, or 2) "app_id.appspot.com" if running on
external app engine prod, or "app_id.googleplex.com" if running as Google
first-par... | 0.011136 |
async def handle_jobs(job_handler, host, port, *, loop):
"""
Connects to the remote master and continuously receives calls, executes
them, then returns a response until interrupted.
"""
try:
try:
reader, writer = await asyncio.open_connection(host, port, loop=loop)
exce... | 0.001907 |
def change_password(ctx):
"""Change password of an existing user"""
username, passhash = _get_credentials(ctx.obj['username'],
ctx.obj['password'],
ctx.obj['db'])
change_user = ctx.obj['db'].objectmodels['user'].find_one({... | 0.001961 |
def plot_phased_magseries(times,
mags,
period,
epoch='min',
fitknotfrac=0.01,
errs=None,
magsarefluxes=False,
normto='globalmedian',
... | 0.002896 |
def _delete(self, *args, **kwargs):
"""
A wrapper for deleting things
:returns: The response of your delete
:rtype: dict
"""
response = requests.delete(*args, **kwargs)
response.raise_for_status() | 0.007905 |
def _cast_value(value, _type):
"""
cast value to _type
"""
if _type.upper() == 'FLOAT64':
return float64(value)
elif _type.upper() == 'FLOAT32':
return float32(value)
elif _type.upper() == 'INT32':
return int32(value)
elif _type.upper() == 'UINT16':
return uin... | 0.002008 |
def dry_run(self, context=None, query_params=None):
"""Dry run a query, to check the validity of the query and return some useful statistics.
Args:
context: an optional Context object providing project_id and credentials. If a specific
project id or credentials are unspecified, the default ones... | 0.006903 |
def get_default_for(prop, value):
""" Ensures complex property types have the correct default values """
prop = prop.strip('_') # Handle alternate props (leading underscores)
val = reduce_value(value) # Filtering of value happens here
if prop in _COMPLEX_LISTS:
return wrap_value(val)
... | 0.002336 |
def shutdown(name, wait=False, reboot=False):
'''
graceful shutdown sent to the container
:param wait: should we wait for the shutdown to complete?
:param reboot: reboot a container, ignores wait
'''
if not exists(name):
raise ContainerNotExists("The container (%s) does not exist!... | 0.004107 |
def set(self, instance, value, **kwargs):
"""writes the value to the same named field on the proxy object
"""
# Retrieve the proxy object
proxy_object = self.get_proxy(instance)
# Return None if we could not find a proxied object, e.g. through
# the proxy expression 'con... | 0.003075 |
def match_trailer(self, tokens, item):
"""Matches typedefs and as patterns."""
internal_assert(len(tokens) > 1 and len(tokens) % 2 == 1, "invalid trailer match tokens", tokens)
match, trailers = tokens[0], tokens[1:]
for i in range(0, len(trailers), 2):
op, arg = trailers[i],... | 0.005889 |
def NotificationsDelete(self, notification_id):
"""
Delete a notification from CommonSense.
@param notification_id (int) - Notification id of the notification to delete.
@return (bool) - Boolean indicating whether NotificationsDelete was succes... | 0.012635 |
def is_dark_font_color(color_scheme):
"""Check if the font color used in the color scheme is dark."""
color_scheme = get_color_scheme(color_scheme)
font_color, fon_fw, fon_fs = color_scheme['normal']
return dark_color(font_color) | 0.004082 |
def hasattr(self, attr, ns=None):
"""attr -- attribute
ns -- optional namespace, None means unprefixed attribute.
"""
if not self.__attributes:
self.setAttributeDictionary()
if ns:
return self.__attributes.get(ns,{}).has_key(attr)
return self._... | 0.017391 |
def _create_empty_array(self, frames, always_2d, dtype):
"""Create an empty array with appropriate shape."""
import numpy as np
if always_2d or self.channels > 1:
shape = frames, self.channels
else:
shape = frames,
return np.empty(shape, dtype, order='C') | 0.00627 |
def healthy(self, url):
'''determine if a resource is healthy based on an accepted response (200)
or redirect (301)
Parameters
==========
url: the URL to check status for, based on the status_code of HEAD
'''
response = requests.get(url)
status_code = response.status_code
... | 0.006608 |
def p_speed_unit(self, p):
'speed_unit : INFORMATION_UNIT PER duration'
logger.debug(
'speed unit = information unit %s per duration %s', p[1], p[3])
p[0] = (p[1], p[3]) | 0.009756 |
def update_item(self, item):
"""Update state of an item in the cache.
Update item's state and remove the item from the cache
if its new state is 'purged'
:Parameters:
- `item`: item to update.
:Types:
- `item`: `CacheItem`
:return: new state of ... | 0.002778 |
def addFailure(self, result):
"""Add a failure to the result."""
result.addFailure(self, (Exception, Exception(), None))
# Since TAP will not provide assertion data, clean up the assertion
# section so it is not so spaced out.
test, err = result.failures[-1]
result.failur... | 0.0059 |
def get_local_songs(
filepaths, include_filters=None, exclude_filters=None, all_includes=False, all_excludes=False,
exclude_patterns=None, max_depth=float('inf')):
"""Load songs from local filepaths.
Parameters:
filepaths (list or str): Filepath(s) to search for music files.
include_filters (list): A ... | 0.020954 |
def encode(self):
"""Encode this record into binary, suitable for embedded into an update script.
This function just adds the required record header and copies the raw data
we were passed in verbatim since we don't know what it means
Returns:
bytearary: The binary version o... | 0.010169 |
def toggle_mute(self, controller, zone):
""" Toggle mute on/off for a zone
Note: Not tested (acambitsis) """
send_msg = self.create_send_message("F0 @cc 00 7F 00 @zz @kk 05 02 02 00 00 F1 40 00 00 00 0D 00 01",
controller, zone)
self.send_data... | 0.008197 |
def parse_filter(self, filters):
""" This method process the filters """
for filter_type in filters:
if filter_type == 'or' or filter_type == 'and':
conditions = []
for field in filters[filter_type]:
if self.is_field_allowed(field):
... | 0.00627 |
def get_return_line_item_by_id(cls, return_line_item_id, **kwargs):
"""Find ReturnLineItem
Return single instance of ReturnLineItem by its ID.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.g... | 0.006116 |
def smilin(smiles, transforms=[figueras.sssr, aromaticity.aromatize]):
"""(smiles)->molecule
Convert a smiles string into a molecule representation"""
builder = BuildMol()
tokenize(smiles, builder)
mol = builder.mol
for transform in transforms:
mol = transform(mol)
... | 0.007547 |
def get_translations(self, locale):
"""
Get translation dictionary
Returns a dictionary for locale or raises an exception if such can't
be located. If a dictionary for locale was previously loaded returns
that, otherwise goes through registered locations and merges any
fo... | 0.001361 |
def render_settingsLink(self, ctx, data):
"""
Add the URL of the settings page to the given tag.
@see L{xmantissa.webnav.settingsLink}
"""
return settingsLink(
self.translator, self.pageComponents.settings, ctx.tag) | 0.007463 |
def dropStudyFromISA(studyNum, pathToISATABFile):
"""
This function removes a study from an ISA file
Typically, you should use the exploreISA function to check the contents
of the ISA file and retrieve the study number you are interested in!
Warning: this function deletes the given study and all its... | 0.006897 |
def normalize_query(query_string,
findterms=re.compile(r'"([^"]+)"|(\S+)').findall,
normspace=re.compile(r'\s{2,}').sub):
"""
Split the query string into individual keywords, discarding spaces
and grouping quoted words together.
>>> normalize_query(' some random... | 0.003861 |
def run(self, refant=[], antsel=[], uvrange='', fluxname='', fluxname_full='', band='', spw0='', spw1='', flaglist=[]):
""" Run calibration pipeline. Assumes L-band.
refant is list of antenna name strings (e.g., ['ea10']). default is to calculate based on distance from array center.
antsel is li... | 0.001525 |
def relation(self, node):
"""
Translate a relation node into SQLQuery.
:param node: a treebrd node
:return: a SQLQuery object for the tree rooted at node
"""
return self.query(select_block=str(node.attributes),
from_block=node.name) | 0.006536 |
def dedupFasta(reads):
"""
Remove sequence duplicates (based on sequence) from FASTA.
@param reads: a C{dark.reads.Reads} instance.
@return: a generator of C{dark.reads.Read} instances with no duplicates.
"""
seen = set()
add = seen.add
for read in reads:
hash_ = md5(read.sequen... | 0.002358 |
def crop(self, bbox):
"""
Crop away all vertices and edges that lie outside of the given bbox.
The edge counts as inside.
Returns: new PrecomputedSkeleton
"""
skeleton = self.clone()
bbox = Bbox.create(bbox)
if skeleton.empty():
return skeleton
nodes_valid_mask = np.array(
... | 0.010515 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.