text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def get_completed_task(self, task, timeout=-1):
"""
Waits until the task is completed and returns the task resource.
Args:
task: TaskResource
timeout: Timeout in seconds
Returns:
dict: TaskResource
"""
self.__wait_task_completion(task... | 0.00554 |
def add_legend(self, labels=None, **kwargs):
"""Specify legend for a plot.
Adds labels and basic legend specifications for specific plot.
For the optional Args, refer to
https://matplotlib.org/api/_as_gen/matplotlib.pyplot.legend.html
for more information.
# TODO: Add ... | 0.001031 |
def threshold_absolute(W, thr, copy=True):
'''
This function thresholds the connectivity matrix by absolute weight
magnitude. All weights below the given threshold, and all weights
on the main diagonal (self-self connections) are set to 0.
If copy is not set, this function will *modify W in place.*... | 0.001233 |
def search_image(self, search_term):
"""
Search for a specific image by providing a search term (mainly used with ec2's community and public images)
:param search_term: Search term to be used when searching for images's names containing this term.
:returns: A list of all images, whose n... | 0.009724 |
def handle_block(
mediator_state: MediatorTransferState,
state_change: Block,
channelidentifiers_to_channels: ChannelMap,
pseudo_random_generator: random.Random,
) -> TransitionResult[MediatorTransferState]:
""" After Raiden learns about a new block this function must be called to
... | 0.000691 |
def load(cls, webfinger, pypump):
""" Load JSON from disk into store object """
filename = cls.get_filename()
if os.path.isfile(filename):
data = open(filename).read()
data = json.loads(data)
store = cls(data, filename=filename)
else:
stor... | 0.004988 |
def screenshot(self, filename=None, transparent_background=None,
return_img=None, window_size=None):
"""
Takes screenshot at current camera position
Parameters
----------
filename : str, optional
Location to write image to. If None, no image is wr... | 0.001722 |
def get_assessments_metadata(self):
"""Gets the metadata for the assessments.
return: (osid.Metadata) - metadata for the assessments
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.learning.ActivityForm.get_assets_metadata_te... | 0.007968 |
def convert2hdf5(platform_name):
"""Retrieve original RSR data and convert to internal hdf5 format"""
import h5py
ahi = AhiRSR(platform_name)
filename = os.path.join(ahi.output_dir,
"rsr_ahi_{platform}.h5".format(platform=platform_name))
with h5py.File(filename, "w") a... | 0.001546 |
def event_loop(self):
""" Run the event loop once. """
if hasattr(self.loop, '._run_once'):
self.loop._thread_id = threading.get_ident()
try:
self.loop._run_once()
finally:
self.loop._thread_id = None
else:
self.loop... | 0.005236 |
def get_level(self, level=2):
"""Get all nodes that are exactly this far away."""
if level == 1:
for child in self.children.values(): yield child
else:
for child in self.children.values():
for node in child.get_level(level-1): yield node | 0.013289 |
def make_bound(self, for_instance):
"""
Create a new :ref:`bound field class <api-aioxmpp.forms-bound-fields>`
or return an existing one for the given form object.
:param for_instance: The form instance to which the bound field should
be bound.
If n... | 0.002116 |
def avail_images(call=None):
'''
Get list of available images
CLI Example:
.. code-block:: bash
salt-cloud --list-images
Can use a custom URL for images. Default is:
.. code-block:: yaml
image_url: images.joyent.com/images
'''
if call == 'action':
raise Salt... | 0.002611 |
def add_package(self, package):
"""
Add a package to this project
"""
self._data.setdefault('packages', {})
self._data['packages'][package.name] = package.source
for package in package.deploy_packages:
self.add_package(package)
self._save() | 0.009404 |
def get_all_tags(image_name, branch=None):
"""
GET /v1/repositories/<namespace>/<repository_name>/tags
:param image_name: The docker image name
:param branch: The branch to filter by
:return: A list of Version instances, latest first
"""
try:
return get_all_tags_no_auth(image_name, ... | 0.002433 |
def from_unit_cube(self, x):
"""
Used by multinest
:param x: 0 < x < 1
:param lower_bound:
:param upper_bound:
:return:
"""
mu = self.mu.value
sigma = self.sigma.value
sqrt_two = 1.414213562
if x < 1e-16 or (1 - x) < 1e-16:
... | 0.004556 |
def how_long(length=4, choices=len(words), speed=1000 * 1000 * 1000 * 1000,
optimism=2):
"""
How long might it take to guess a password?
@param length: the number of words that we're going to choose.
@type length: L{int}
@param choice: the number of words we might choose between.
... | 0.001245 |
def members(self):
"""获取小组所有成员的信息列表"""
all_members = []
for page in range(1, self.max_page() + 1):
all_members.extend(self.single_page_members(page))
return all_members | 0.009434 |
def rotate_grid_from_profile(self, grid_elliptical):
""" Rotate a grid of elliptical (y,x) coordinates from the reference frame of the profile back to the \
unrotated coordinate grid reference frame (coordinates are not shifted back to their original centre).
This routine is used after computin... | 0.009288 |
def set_components(self):
"""
Sets the Components Model nodes.
"""
node_flags = attributes_flags = int(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
root_node = umbra.ui.nodes.DefaultNode(name="InvisibleRootNode")
paths = {}
for path in self.__engine.components_manag... | 0.006592 |
def soap_fault(message=None, actor=None, code=None, detail=None):
""" Create a SOAP Fault message
:param message: Human readable error message
:param actor: Who discovered the error
:param code: Error code
:param detail: More specific error message
:return: A SOAP Fault message as a string
... | 0.001239 |
def start_session(self,
causal_consistency=True,
default_transaction_options=None):
"""Start a logical session.
This method takes the same parameters as
:class:`~pymongo.client_session.SessionOptions`. See the
:mod:`~pymongo.client_session` mo... | 0.003956 |
def mod(ctx, number, divisor):
"""
Returns the remainder after number is divided by divisor
"""
number = conversions.to_decimal(number, ctx)
divisor = conversions.to_decimal(divisor, ctx)
return number - divisor * _int(ctx, number / divisor) | 0.003774 |
def OnGoToCell(self, event):
"""Shift a given cell into view"""
row, col, tab = event.key
try:
self.grid.actions.cursor = row, col, tab
except ValueError:
msg = _("Cell {key} outside grid shape {shape}").format(
key=event.key, shape=self.grid.co... | 0.003534 |
def api_key(self, api_key):
"""
Sets the api_key of this GlobalSignCredentials.
Unique ID for API client (provided by GlobalSign).
:param api_key: The api_key of this GlobalSignCredentials.
:type: str
"""
if api_key is None:
raise ValueError("Invalid... | 0.007194 |
def threadpool(num_workers=None):
"""Apply stutils.mapreduce.map to the given function"""
def decorator(func):
@functools.wraps(func)
def wrapper(data):
return mapreduce.map(func, data, num_workers)
return wrapper
return decorator | 0.003597 |
def get_detailed_update(self, uid, uuid):
"""Returns the update object for the ID"""
r = requests.get(api_url+'users/'+str(uid)+'/update/'+str(uuid)+'/', headers=self.headers)
print(request_status(r))
r.raise_for_status()
return Update(r.json()) | 0.03876 |
def get_datacenter(conn):
'''
Return the datacenter from the config provider datacenter ID
'''
datacenter_id = get_datacenter_id()
for item in conn.list_datacenters()['items']:
if item['id'] == datacenter_id:
return item
raise SaltCloudNotFound(
'The specified datac... | 0.002475 |
def css(self):
"""Returns
-------
str
The CSS.
"""
css_list = [DEFAULT_MARK_CSS]
for aes in self.aesthetics:
css_list.extend(get_mark_css(aes, self.values[aes]))
#print('\n'.join(css_list))
return '\n'.join(css_list) | 0.009868 |
def display_callback(self, cpu_cycles, op_address, address, value):
""" called via memory write_byte_middleware """
self.display.write_byte(cpu_cycles, op_address, address, value)
return value | 0.009259 |
def install_required(f):
""" Return an exception if the namespace is not already installed """
@wraps(f)
def wrapped(self, *args, **kwargs):
if self.directory.new:
raise SprinterException("Namespace %s is not yet installed!" % self.namespace)
return f(self, *args, **kwargs)
... | 0.005988 |
def on_aborted(self):
"""Device authentication aborted.
Triggered when device authentication was aborted (either with `DeviceOAuthPoller.stop()`
or via the "poll" event)
"""
print('Authentication aborted')
# Authentication aborted
self.is_authenticating.acquire... | 0.007371 |
def stop(config, container, timeout=10, *args, **kwargs):
'''
Stop a running container
:type container: string
:param container: The container id to stop
:type timeout: int
:param timeout: Wait for a timeout to let the container exit gracefully
before killing it
:rtype: dict
:... | 0.001813 |
def write(self, f):
""" Write namespace as INI file.
:param f: File object or path to file.
"""
if isinstance(f, str):
f = io.open(f, 'w', encoding='utf-8')
if not hasattr(f, 'read'):
raise AttributeError("Wrong type of file: {0}".format(type(f)))
... | 0.003289 |
def get_observations(params: Dict) -> Dict[str, Any]:
"""Search observations, see: http://api.inaturalist.org/v1/docs/#!/Observations/get_observations.
Returns the parsed JSON returned by iNaturalist (observations in r['results'], a list of dicts)
"""
r = make_inaturalist_api_get_call('observations', ... | 0.008475 |
def parse_output(self, s):
'''
Example output:
AVR Memory Usage
----------------
Device: atmega2561
Program: 4168 bytes (1.6% Full)
(.text + .data + .bootloader)
Data: 72 bytes (0.9% Full)
(.data + .bss + .noinit)
'''
... | 0.002291 |
def build_date(self):
"""
get build date.
:return: build date. None if not found
"""
# pylint: disable=len-as-condition
if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
return self.dutinformation.get(0).build.date
re... | 0.009119 |
def _send_api_message(self, message):
"""Send a Slack message via the chat.postMessage api.
:param message: a dict of kwargs to be passed to slacker.
"""
self.slack.chat.post_message(**message)
self.log.debug("sent api message %r", message) | 0.007092 |
def append(self, lines):
"""
Args:
lines (list): List of line strings to append to the end of the editor
"""
if isinstance(lines, list):
self._lines = self._lines + lines
elif isinstance(lines, str):
lines = lines.split('\n')
self._... | 0.009009 |
def start_agent(self, cfgin=True):
"""
CLI interface to start 12-factor service
"""
default_conf = {
"threads": {
"result": {
"number": 0,
"function": None
},
"worker": {
... | 0.001268 |
async def is_pull_request(context, task):
"""Determine if a task is a pull-request-like task (restricted privs).
This goes further than checking ``tasks_for``. We may or may not want
to keep this.
This checks for the following things::
* ``task.extra.env.tasks_for`` == "github-pull-request"
... | 0.004318 |
def get(self, vlr_type):
""" Returns the list of vlrs of the requested type
Always returns a list even if there is only one VLR of type vlr_type.
>>> import pylas
>>> las = pylas.read("pylastests/extrabytes.las")
>>> las.vlrs
[<ExtraBytesVlr(extra bytes structs: 5)>]
... | 0.001963 |
def encode_content(self, robj, rpb_content):
"""
Fills an RpbContent message with the appropriate data and
metadata from a RiakObject.
:param robj: a RiakObject
:type robj: RiakObject
:param rpb_content: the protobuf message to fill
:type rpb_content: riak.pb.ria... | 0.001211 |
def search_records(self, record_type, name=None, data=None):
"""
Returns a list of all records configured for this domain that match
the supplied search criteria.
"""
return self.manager.search_records(self, record_type=record_type,
name=name, data=data) | 0.009677 |
def is_instance_of(obj, class_or_intf_name):
"""
Checks whether the Java object implements the specified interface or is a subclass of the superclass.
:param obj: the Java object to check
:type obj: JB_Object
:param class_or_intf_name: the superclass or interface to check, dot notation or with forw... | 0.002686 |
def _run_program(name, *args, **kwargs):
"""Runs program name with the arguments of *args
:param shell: if true, runs the command in the shell
:type shell: bool
:param return_object: if true, returns a CommandOutput object
:type return_object: bool
:param ro: same as return_object
:type r... | 0.003911 |
def find_recipes(folders, pattern=None, base=None):
'''find recipes will use a list of base folders, files,
or patterns over a subset of content to find recipe files
(indicated by Starting with Singularity
Parameters
==========
base: if defined, consider folders recursively ... | 0.004019 |
def explore_show_summary(self, list, index=False,
expected=None, context=None):
"""Show summary of one capability document.
Given a capability document or index (in list, index True if it is an
index), write out a simply textual summary of the document with all
... | 0.001431 |
def repl_command(fxn):
"""
Decorator for cmd methods
Parses arguments from the arg string and passes them to the method as *args
and **kwargs.
"""
@functools.wraps(fxn)
def wrapper(self, arglist):
"""Wraps the command method"""
args = []
kwargs = {}
if argl... | 0.001626 |
def otp(ctx, access_code):
"""
Manage OTP Application.
The YubiKey provides two keyboard-based slots which can each be configured
with a credential. Several credential types are supported.
A slot configuration may be write-protected with an access code. This
prevents the configuration to be ov... | 0.000715 |
async def connect(self, conn_id, connection_string):
"""Asynchronously connect to a device
Args:
conn_id (int): A unique identifer that will refer to this connection
connection_string (string): A DeviceAdapter specific string that can be used to connect to
a devi... | 0.006861 |
def add(self, (s, p, o), context, quoted=False):
"""
Adds a triple to the store.
>>> from rdflib.term import URIRef
>>> from rdflib.namespace import RDF
>>> subject = URIRef('http://zoowizard.org/resource/Artis')
>>> object = URIRef('http://schema.org/Zoo')
>>> ... | 0.002389 |
def NumExpr(ex, signature=(), **kwargs):
"""
Compile an expression built using E.<variable> variables to a function.
ex can also be specified as a string "2*a+3*b".
The order of the input variables and their types can be specified using the
signature parameter, which is a list of (name, type) pair... | 0.001718 |
def getSwapStats(self, dev):
"""Returns I/O stats for swap partition.
@param dev: Device name for swap partition.
@return: Dict of stats.
"""
if self._swapList is None:
self._initSwapInfo()
if dev in self._swapList:
return self.ge... | 0.010753 |
def dentategyrus(adjusted=True):
"""Dentate Gyrus dataset from Hochgerner et al. (2018).
Dentate gyrus is part of the hippocampus involved in learning, episodic memory formation and spatial coding.
It is measured using 10X Genomics Chromium and described in Hochgerner et al. (2018).
The data consists o... | 0.006711 |
def _get_objects(self, o_type):
"""Get an object list from the scheduler
Returns None if the required object type (`o_type`) is not known or an exception is raised.
Else returns the objects list
:param o_type: searched object type
:type o_type: str
:return: objects list... | 0.006766 |
def startfile(fpath, verbose=True): # nocover
"""
Uses default program defined by the system to open a file.
This is done via `os.startfile` on windows, `open` on mac, and `xdg-open`
on linux.
Args:
fpath (PathLike): a file to open using the program associated with the
files ex... | 0.000685 |
def Decrypt(self, data):
"""A convenience method which pads and decrypts at once."""
decryptor = self.GetDecryptor()
try:
padded_data = decryptor.update(data) + decryptor.finalize()
return self.UnPad(padded_data)
except ValueError as e:
raise CipherError(e) | 0.013699 |
def to_naf(self):
"""
Converts the coreference layer to NAF
"""
if self.type == 'KAF':
for node_coref in self.__get_corefs_nodes():
node_coref.set('id',node_coref.get('coid'))
del node_coref.attrib['coid'] | 0.010676 |
def get_appdir(self, portable_path=None, folder=None, create=False):
'''
path = uac_bypass(file)
This function will only operate when your program is installed
check the is_installed function for details
Moves working data to another folder. The idea is to get around
se... | 0.00304 |
def _default_to_pandas(self, op, *args, **kwargs):
"""Helper method to use default pandas function"""
empty_self_str = "" if not self.empty else " for empty DataFrame"
ErrorMessage.default_to_pandas(
"`{}.{}`{}".format(
self.__name__,
op if isins... | 0.002859 |
def getArrays(self, attr=None, specfiles=None, sort=False, reverse=False,
selector=None, defaultValue=None):
"""Return a condensed array of data selected from :class:`Si` instances
from ``self.sic`` for fast and convenient data processing.
:param attr: list of :class:`Si` item... | 0.002907 |
def new(cls, nsptagname, val):
"""
Return a new ``CT_String`` element with tagname *nsptagname* and
``val`` attribute set to *val*.
"""
elm = OxmlElement(nsptagname)
elm.val = val
return elm | 0.00813 |
def normalize_layout(layout, min_percentile=1, max_percentile=99, relative_margin=0.1):
"""Removes outliers and scales layout to between [0,1]."""
# compute percentiles
mins = np.percentile(layout, min_percentile, axis=(0))
maxs = np.percentile(layout, max_percentile, axis=(0))
# add margins
m... | 0.00313 |
def _get_profile(self, profile_id):
'''Return the profile with the received ID as a dict'''
profile_metadata = self._registry.get(profile_id)
if not profile_metadata:
return
path = self._get_absolute_path(profile_metadata.get('schema_path'))
if path and os.path.isfil... | 0.00404 |
def kld(p1, p2):
"""Compute Kullback-Leibler divergence between p1 and p2.
It assumes that p1 and p2 are already normalized that each of them sums to 1.
"""
return np.sum(np.where(p1 != 0, p1 * np.log(p1 / p2), 0)) | 0.008547 |
def query(cls, index_name=None, filter_builder=None,
scan_index_forward=None, limit=None, **key_conditions):
"""High level query API.
:param key_filter: key conditions of the query.
:type key_filter: :class:`collections.Mapping`
:param filter_builder: filter expression bui... | 0.003797 |
def rmrf(items, verbose=True):
"Silently remove a list of directories or files"
if isinstance(items, str):
items = [items]
for item in items:
if verbose:
print("Removing {}".format(item))
shutil.rmtree(item, ignore_errors=True)
# rmtree doesn't remove bare files
... | 0.002433 |
def _check_delete(self):
'''Check project delete'''
now = time.time()
for project in list(itervalues(self.projects)):
if project.db_status != 'STOP':
continue
if now - project.updatetime < self.DELETE_TIME:
continue
if 'delete' ... | 0.002646 |
def source_group_receiver(self, sender, source, signal, **kwargs):
"""
Relay source group signals to the appropriate spec strategy.
"""
from imagekit.cachefiles import ImageCacheFile
source_group = sender
# Ignore signals from unregistered groups.
if source_gro... | 0.009067 |
def Ge(self):
"""
Result of US from the SVD decomposition G = USVᵀ.
"""
from scipy.linalg import svd
from numpy_sugar.linalg import ddot
U, S, _ = svd(self._G, full_matrices=False, check_finite=False)
if U.shape[1] < self._G.shape[1]:
return ddot(U, ... | 0.005797 |
def do_describe(self, line):
"describe [-c] {tablename}..."
args = self.getargs(line)
if '-c' in args:
create_info = True
args.remove('-c')
else:
create_info = False
if not args:
if self.table:
args = [self.table.n... | 0.003182 |
def as_dict(self):
"""
A JSON serializable dict representation of an object.
"""
d = {"@module": self.__class__.__module__,
"@class": self.__class__.__name__}
try:
parent_module = self.__class__.__module__.split('.')[0]
module_version = impor... | 0.00102 |
def register_opener(suffix, opener=None):
"""
Register a callback that opens an archive with the specified *suffix*.
The object returned by the *opener* must implement the #tarfile.Tarfile
interface, more specifically the following methods:
- `add(filename, arcname) -> None`
- `getnames() -> list of str`
... | 0.006883 |
def new_session(self):
"""Establish a new session."""
body = yield from self._fetch_json(URL_LOGIN, self._new_session_data)
self.sma_sid = jmespath.search('result.sid', body)
if self.sma_sid:
return True
msg = 'Could not start session, %s, got {}'.format(body)
... | 0.003241 |
def build_parser(parser):
"""
Generate a subparser
"""
parser.add_argument(
'sequence_file',
type=FileType('r'),
help="""Input fastq file. A fasta-format file may also be provided
if --input-qual is also specified.""")
parser.add_argument(
'--input-qual',
... | 0.000398 |
def add(self, data):
"""
Adds a new data node to the front list. The provided data will be
encapsulated into a new instance of LinkedListNode class and linked
list pointers will be updated, as well as list's size.
:param data: the data to be inserted in the new list node
... | 0.003012 |
def _get_accounts_client(accounts_url, email, password):
"""
Create an Accounts Service API client and log in using provided email and password
:param accounts_url: Accounts Service URL
:param email: Login Email
:param password: Login Password
:return: Accounts Service API Client
"""
cli... | 0.003812 |
def contained_segments_matrix(segments):
"""
givens a n*n matrix m, n=len(segments), in which m[i,j] means
segments[i] is contained inside segments[j]
"""
x1, y1 = segments[:, 0], segments[:, 1]
x2, y2 = x1 + segments[:, 2], y1 + segments[:, 3]
n = len(segments)
x1so, x2so, y1so, y2so =... | 0.00402 |
def update_workspace(self,
workspace_id,
name=None,
description=None,
language=None,
metadata=None,
learning_opt_out=None,
system_settings=None,
... | 0.00765 |
def focusIn(self, event=None):
"""Select all text (if applicable) on taking focus"""
try:
# doScroll returns false if the call was ignored because the
# last call also came from this widget. That avoids unwanted
# scrolls and text selection when the focus moves in an... | 0.004196 |
def start_workflow(self, workflow_name, delayed=False, **kwargs):
"""Run the workflow specified on the object.
:param workflow_name: name of workflow to run
:type workflow_name: str
:param delayed: should the workflow run asynchronously?
:type delayed: bool
:return: UU... | 0.003165 |
def do_filetype(self, line):
"""filetype FILE
Prints the type of file (dir or file). This function is primarily
for testing.
"""
if len(line) == 0:
print_err("Must provide a filename")
return
filename = resolve_path(line)
mode = auto... | 0.003268 |
def render_remarks_tag(self, ar):
"""Renders a remarks image icon
"""
if not ar.getRemarks():
return ""
uid = api.get_uid(ar)
url = ar.absolute_url()
title = ar.Title()
tooltip = _("Remarks of {}").format(title)
# Note: The 'href' is picked u... | 0.00304 |
def write(self, data):
"""Send raw bytes to the instrument.
:param data: bytes to be sent to the instrument
:type data: bytes
"""
begin, end, size = 0, 0, len(data)
bytes_sent = 0
raw_write = super(USBRawDevice, self).write
while not end > size:
... | 0.004357 |
def calculate_local_order_parameter(self, oscillatory_network, start_iteration = None, stop_iteration = None):
"""!
@brief Calculates local order parameter.
@details Local order parameter or so-called level of local or partial synchronization is calculated by following expression:
... | 0.018458 |
def make_hone_cache_wrapper(inner_func, maxsize, maxage, finder,
store_partials):
""" Keeps a cache of requests we've already made and use that for
generating results if possible. If the user asked for a root prior
to this call we can use it to skip a new lookup using `finder`. ... | 0.001117 |
def create(self):
"""Create tracking collection.
Does nothing if tracking collection already exists.
"""
if self._track is None:
self._track = self.db[self.tracking_collection_name] | 0.008889 |
def from_bytes(cls, bitstream, decode_payload=True):
'''
Parse the given packet and update properties accordingly
'''
packet = cls()
# Convert to ConstBitStream (if not already provided)
if not isinstance(bitstream, ConstBitStream):
if isinstance(bitstream, B... | 0.00062 |
def schema_create(dbname, name, owner=None,
user=None,
db_user=None, db_password=None,
db_host=None, db_port=None):
'''
Creates a Postgres schema.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_create dbname name owner='owner' ... | 0.000857 |
def save_outputs(outputs, output_fpath):
"""
Save model outputs in an Excel file.
:param outputs:
Model outputs.
:type outputs: dict
:param output_fpath:
Output file path.
:type output_fpath: str
"""
df = pd.DataFrame(outputs)
with pd.ExcelWriter(output_fpath) as wr... | 0.002833 |
def ajax_editable_boolean(attr, short_description):
"""
Convenience function: Assign the return value of this method to a variable
of your ModelAdmin class and put the variable name into list_display.
Example::
class MyTreeEditor(TreeEditor):
list_display = ('__unicode__', 'active_... | 0.001616 |
def get_rich_events(self, item):
"""
Get the enriched events related to a module
"""
module = item['data']
if not item['data']['releases']:
return []
for release in item['data']['releases']:
event = self.get_rich_item(item)
# Update sp... | 0.00316 |
def cut(self,
cutter,
target,
sr=None):
"""
The cut operation is performed on a geometry service resource.
This operation splits the target polyline or polygon where it's
crossed by the cutter polyline.
Inputs:
cutter - p... | 0.00838 |
def server_receives_binary_from(self, name=None, timeout=None, connection=None, label=None):
"""Receive raw binary message. Returns message, ip, and port.
If server `name` is not given, uses the latest server. Optional message
`label` is shown on logs.
Examples:
| ${binary} | $... | 0.005398 |
def _visit_recur(self, item):
"""
Recursively visits children of item.
:param item: object: project, folder or file we will add to upload_items if necessary.
"""
if item.kind == KindType.file_str:
if item.need_to_send:
self.add_upload_item(item.path)
... | 0.005059 |
def on_task_status(self, task):
'''Called when a status pack is arrived'''
try:
procesok = task['track']['process']['ok']
if not self.projects[task['project']].task_queue.done(task['taskid']):
logging.error('not processing pack: %(project)s:%(taskid)s %(url)s', ta... | 0.004664 |
def validate_metadata(self, metadata):
"""
Validate that the metadata of your ddo is valid.
:param metadata: conforming to the Metadata accepted by Ocean Protocol, dict
:return: bool
"""
response = self.requests_session.post(
f'{self.url}/validate',
... | 0.005272 |
def envdict2listdict(envdict):
"""Dict --> Dict of lists"""
sep = os.path.pathsep
for key in envdict:
if sep in envdict[key]:
envdict[key] = [path.strip() for path in envdict[key].split(sep)]
return envdict | 0.004032 |
def normalize(expr):
"""Pass through n-ary expressions, and eliminate empty branches.
Variadic and binary expressions recursively visit all their children.
If all children are eliminated then the parent expression is also
eliminated:
(& [removed] [removed]) => [removed]
If only one child is ... | 0.001148 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.