text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def getAllSensors(self):
"""
Retrieve all the user's own sensors by iterating over the SensorsGet function
@return (list) - Array of sensors
"""
j = 0
sensors = []
parameters = {'page':0, 'per_page':1000, 'owned':1}
while True... | 0.01054 |
def list(self, request, project):
''' Routing to /api/project/{project}/seta/job-priorities/
This API can potentially have these consumers:
* Buildbot
* build_system_type=buildbot
* priority=5
* format=json
* TaskCluster (Gecko decision ... | 0.004005 |
def _set_name(self, name):
"""
Sets the name of this asset.
:param name: The name of the asset
:type name: str
"""
if self._is_identifier_quoted(name):
self._quoted = True
name = self._trim_quotes(name)
if "." in name:
parts =... | 0.004619 |
def attach_zoom(ax, scaling=2.0):
"""
Attach an event handler that supports zooming within a plot using
the mouse scroll wheel.
Parameters
----------
ax : :class:`matplotlib.axes.Axes` object
Axes to which event handling is to be attached
scaling : float, optional (default 2.0)
... | 0.000289 |
def uri(self, context=None):
"""
:param dict context:
keys that were missing in the static context given in
constructor to resolve the butcket name.
"""
if context is None:
context = self.context
else:
ctx = copy.deepcopy(self.context)
... | 0.004695 |
def image(self):
""" Read the loaded DICOM image data """
if self._image is None:
self._image = Image(self.fname)
return self._image | 0.011905 |
def query(self, sql_query, return_as="dataframe"):
"""
Execute a raw SQL query against the the SQL DB.
Args:
sql_query (str): A raw SQL query to execute.
Kwargs:
return_as (str): Specify what type of object should be
returned. The following are accep... | 0.001456 |
def output_selector_schema(config_cls):
'''
A decorator for a annotating a function that can take the selected properties
of a ``config_value`` and an instance of a custom type and materialize it.
Args:
config_cls (Selector):
'''
config_type = resolve_config_cls_arg(config_cls)
chec... | 0.002915 |
def get_file_copy_job(cls, id, api=None):
"""
Retrieve file copy async job
:param id: Async job identifier
:param api: Api instance
:return:
"""
id = Transform.to_async_job(id)
api = api if api else cls._API
async_job = api.get(
url=cl... | 0.004717 |
def register_magics(store_name='_ampl_cells', ampl_object=None):
"""
Register jupyter notebook magics ``%%ampl`` and ``%%ampl_eval``.
Args:
store_name: Name of the store where ``%%ampl cells`` will be stored.
ampl_object: Object used to evaluate ``%%ampl_eval`` cells.
"""
from IPyth... | 0.00185 |
def automain(module, *, args=(), kwargs=None):
'''
This decorator automatically invokes a function if the module is being run
as the "__main__" module. Optionally, provide args or kwargs with which to
call the function. If `module` is "__main__", the function is called, and
the program is `sys.exit`... | 0.000818 |
def pretty_diff(self, mail_a, mail_b):
""" Returns a verbose unified diff between two mails' normalized body.
"""
return ''.join(unified_diff(
mail_a.body_lines, mail_b.body_lines,
fromfile='Normalized body of {}'.format(mail_a.path),
tofile='Normalized body o... | 0.004008 |
def xpointerEval(self, str):
"""Evaluate the XPath Location Path in the given context. """
ret = libxml2mod.xmlXPtrEval(str, self._o)
if ret is None:raise treeError('xmlXPtrEval() failed')
return xpathObjectRet(ret) | 0.016194 |
def process(self, *args, **kwargs):
"""
args: list of arguments for the `runnable`
kwargs: dictionary of arguments for the `runnable`
"""
try:
timeout_seconds = self.timeout_timedelta.total_seconds()
with timeout(self.run, timeout_seconds) as run:
... | 0.002384 |
def write(self, page, data):
"""Send a WRITE command to store data on the tag.
The *page* argument specifies the offset in multiples of 4
bytes. The *data* argument must be a string or bytearray of
length 4.
Command execution errors raise :exc:`Type2TagCommandError`.
"... | 0.002291 |
def _query(action=None,
command=None,
args=None,
method='GET',
header_dict=None,
data=None,
url='https://api.linode.com/'):
'''
Make a web call to the Linode API.
'''
global LASTCALL
vm_ = get_configured_provider()
ratelimit_slee... | 0.000925 |
def validate_alias(self, name, cmd):
"""Validate an alias and return the its number of arguments."""
if name in self.no_alias:
raise InvalidAliasError("The name %s can't be aliased "
"because it is a keyword or builtin." % name)
if not (isinstance(... | 0.007062 |
def format(self, version=None, wipe=None):
"""Format the tag to make it NDEF compatible or erase content.
The :meth:`format` method is highly dependent on the tag type,
product and present status, for example a tag that has been
made read-only with lock bits can no longer be formatted o... | 0.000961 |
def readline(self, size=None):
"""
Read one entire line from the file. A trailing newline character is
kept in the string (but may be absent when a file ends with an
incomplete line). If the size argument is present and non-negative, it
is a maximum byte count (including the tr... | 0.001335 |
def setParent(self,parent):
"""
Sets the parent of this bone for all entities.
Note that this method must be called before many other methods to ensure internal state has been initialized.
This method also registers this bone as a child of its parent.
"""
... | 0.017949 |
def _write_trans_into_ods(ods, languages, locale_root,
po_files_path, po_filename, start_row):
"""
Write translations from po files into ods one file.
Assumes a directory structure:
<locale_root>/<lang>/<po_files_path>/<filename>.
"""
ods.content.getSheet(0)
for i, ... | 0.000912 |
def serialize_task_id(self):
"""
Create a unique identifier for the current location within the task.
The format is C{b"<task_uuid>@<task_level>"}.
@return: L{bytes} encoding the current location within the task.
"""
return "{}@{}".format(
self._identificati... | 0.004975 |
def registIssue(self, CorpNum, cashbill, Memo, UserID=None):
""" ํ๊ธ์์์ฆ ์ฆ์๋ฐํ
args
CorpNum : ํ๋นํ์ ์ฌ์
์๋ฒํธ
cashbill : ๋ฑ๋กํ ํ๊ธ์์์ฆ object. made with Cashbill(...)
UserID : ํ๋นํ์ ์์ด๋
return
์ฒ๋ฆฌ๊ฒฐ๊ณผ. consist of code and message
... | 0.005587 |
def set_manage_params(
self, chunked_input=None, chunked_output=None, gzip=None, websockets=None, source_method=None,
rtsp=None, proxy_protocol=None):
"""Allows enabling various automatic management mechanics.
* http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.html#http-route... | 0.007292 |
def migrator(state):
"""Tweaks will be lost for Cleverbot and its conversations."""
for tweak in ('tweak1', 'tweak2', 'tweak3'):
del state[0][tweak]
for convo in state[1]:
if tweak in convo:
del convo[tweak]
return state | 0.003623 |
def calculate(self, film, substrate, elasticity_tensor=None,
film_millers=None, substrate_millers=None,
ground_state_energy=0, lowest=False):
"""
Finds all topological matches for the substrate and calculates elastic
strain energy and total energy for the film... | 0.00349 |
def nsorted(to_sort, key=None):
"""Returns a naturally sorted list"""
if key is None:
key_callback = _natural_keys
else:
def key_callback(item):
return _natural_keys(key(item))
return sorted(to_sort, key=key_callback) | 0.003817 |
def get_app_metadata(template_dict):
"""
Get the application metadata from a SAM template.
:param template_dict: SAM template as a dictionary
:type template_dict: dict
:return: Application metadata as defined in the template
:rtype: ApplicationMetadata
:raises ApplicationMetadataNotFoundErr... | 0.004348 |
def remove_item(self, key):
"""
Remove/Delete the url value under the unique key from storage.
"""
self._db.remove(self._urls.key==key) | 0.017964 |
def tuplize_key(obj, key, remove_extra=False):
"""Args"""
paramlen = len(obj.formula.parameters)
if isinstance(key, str):
key = (key,)
elif not isinstance(key, Sequence):
key = (key,)
if not remove_extra:
return key
else:
arglen = len(key)
if arglen:
... | 0.002488 |
def sort_by(self, sb):
"""Sort results"""
self._dataset = self._dataset.sort(key=lambda x: x.pubdate, reverse=True)
return self | 0.013889 |
def get_center(self):
"""
Get the center point of this bounding box.
"""
return Point((self.p1.x+self.p2.x)/2.0, (self.p1.y+self.p2.y)/2.0) | 0.011696 |
def recv_line(self, max_size=None, timeout='default', ending=None):
"""
Recieve until the next newline , default "\\n". The newline string can
be changed by changing ``nc.LINE_ENDING``. The newline will be returned
as part of the string.
Aliases: recvline, readline, read_line, r... | 0.004274 |
def post(self, request, *args, **kwargs):
"""
Returns POST response.
:param request: the request instance.
:rtype: django.http.HttpResponse.
"""
form = None
link_type = int(request.POST.get('link_type', 0))
if link_type == Link.LINK_TYPE_EMAIL:
... | 0.005772 |
def phase_bin_magseries(phases, mags,
binsize=0.005,
minbinelems=7):
'''Bins a phased magnitude/flux time-series using the bin size provided.
Parameters
----------
phases,mags : np.array
The phased magnitude/flux time-series to bin in phase. Non-... | 0.001509 |
def load_creditscoring2(cost_mat_parameters=None):
"""Load and return the credit scoring PAKDD 2009 competition dataset (classification).
The credit scoring is a easily transformable example-dependent cost-sensitive classification dataset.
Parameters
----------
cost_mat_parameters : Dictionary-lik... | 0.004817 |
def any_field_choices(function):
"""
Selection from field.choices
>>> CHOICES = [('YNG', 'Child'), ('OLD', 'Parent')]
>>> result = any_field(models.CharField(max_length=3, choices=CHOICES))
>>> result in ['YNG', 'OLD']
True
"""
def wrapper(field, **kwargs):
if field.ch... | 0.002174 |
def cublasDsymm(handle, side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc):
"""
Matrix-matrix product for real symmetric matrix.
"""
status = _libcublas.cublasDsymm_v2(handle,
_CUBLAS_SIDE_MODE[side],
_CUBLAS_FILL_M... | 0.009404 |
def bytes_check(*args, func=None):
"""Check if arguments are bytes type."""
func = func or inspect.stack()[2][3]
for var in args:
if not isinstance(var, (bytes, collections.abc.ByteString)):
name = type(var).__name__
raise BytesError(
f'Function {func} expecte... | 0.002857 |
def _select(self):
"""
While the client is not marked as closed, performs a socket select
on all PushSession sockets. If any data is received, parses and
forwards it on to the callback function. If the callback is
successful, a PublishMessageReceived message is sent.
""... | 0.001674 |
def remove_vectored_io_slice_suffix_from_name(name, slice):
# type: (str, int) -> str
"""Remove vectored io (stripe) slice suffix from a given name
:param str name: entity name
:param int slice: slice num
:rtype: str
:return: name without suffix
"""
suffix = '.bxslice-{}'.format(slice)
... | 0.002421 |
def stats_blast(self, blast_id=None, start_date=None, end_date=None, options=None):
"""
Retrieve information about a particular blast or aggregated information from all of blasts over a specified date range.
http://docs.sailthru.com/api/stat
"""
options = options or {}
da... | 0.006369 |
def recRemoveTreeFormating(element):
"""Removes whitespace characters, which are leftovers from previous xml
formatting.
:param element: an instance of lxml.etree._Element
str.strip() is applied to the "text" and the "tail" attribute of the
element and recursively to all child elements.
"""
... | 0.001261 |
def calculate_shanten(self, tiles_34, open_sets_34=None, chiitoitsu=True, kokushi=True):
"""
Return the count of tiles before tempai
:param tiles_34: 34 tiles format array
:param open_sets_34: array of array of 34 tiles format
:param chiitoitsu: bool
:param kokushi: bool
... | 0.003434 |
def get_feature_variable_boolean(self, feature_key, variable_key, user_id, attributes=None):
""" Returns value for a certain boolean variable attached to a feature flag.
Args:
feature_key: Key of the feature whose variable's value is being accessed.
variable_key: Key of the variable whose value is ... | 0.005326 |
def get_format_implementation(ext, format_name=None):
"""Return the implementation for the desired format"""
# remove pre-extension if any
ext = '.' + ext.split('.')[-1]
formats_for_extension = []
for fmt in JUPYTEXT_FORMATS:
if fmt.extension == ext:
if fmt.format_name == format... | 0.005285 |
def interleave_keys(a, b):
"""Interleave bits from two sort keys to form a joint sort key.
Examples that are similar in both of the provided keys will have similar
values for the key defined by this function. Useful for tasks with two
text fields like machine translation or natural language inference.
... | 0.002037 |
def load_and_parse(self):
"""Load and parse archives in a list of projects. Returns a dict
that maps unique ids onto ParsedNodes"""
archives = []
to_return = {}
for name, project in self.all_projects.items():
archives = archives + self.parse_archives_from_project... | 0.001741 |
def addToLayout(self, analysis, position=None):
""" Adds the analysis passed in to the worksheet's layout
"""
# TODO Redux
layout = self.getLayout()
container_uid = self.get_container_for(analysis)
if IRequestAnalysis.providedBy(analysis) and \
not IDuplic... | 0.001642 |
def _parse_logline_timestamp(t):
"""Parses a logline timestamp into a tuple.
Args:
t: Timestamp in logline format.
Returns:
An iterable of date and time elements in the order of month, day, hour,
minute, second, microsecond.
"""
date, time = t.split(' ')
month, day = da... | 0.002353 |
def render_summary(self, include_title=True):
"""Render the traceback for the interactive console."""
title = ''
description = ''
frames = []
classes = ['traceback']
if not self.frames:
classes.append('noframe-traceback')
if include_title:
... | 0.00332 |
def destroy(self):
"""Undo the effects of initdb.
Destroy all evidence of this DBMS, including its backing files.
"""
self.stop()
if self.base_pathname is not None:
self._robust_remove(self.base_pathname) | 0.007782 |
def _set_implied_name(self):
"Allow the name of this handler to default to the function name."
if getattr(self, 'name', None) is None:
self.name = self.func.__name__
self.name = self.name.lower() | 0.029412 |
def is_replaceable(self, refobj):
"""Return whether the given reference of the refobject is replaceable or
if it should just get deleted and loaded again.
This will call :meth:`ReftypeInterface.is_replaceable`.
:param refobj: the refobject to query
:type refobj: refobj
... | 0.005882 |
def beep(self, duration, frequency):
"""Generates a beep.
:param duration: The duration in seconds, in the range 0.1 to 5.
:param frequency: The frequency in Hz, in the range 500 to 5000.
"""
cmd = 'BEEP', [Float(min=0.1, max=5.0), Integer(min=500, max=5000)]
self._writ... | 0.005764 |
def list_dir_abspath(path):
"""
Return a list absolute file paths.
see mkdir_p os.listdir.
"""
return map(lambda f: os.path.join(path, f), os.listdir(path)) | 0.00565 |
def list(self):
"""
List all VMware VMs
"""
try:
return (yield from self._vmware_manager.list_vms())
except VMwareError as e:
raise GNS3VMError("Could not list VMware VMs: {}".format(str(e))) | 0.007843 |
def transform_file_output(result):
""" Transform to convert SDK file/dir list output to something that
more clearly distinguishes between files and directories. """
from collections import OrderedDict
new_result = []
iterable = result if isinstance(result, list) else result.get('items', result)
... | 0.004484 |
def move_to_placeholder(self, placeholder, sort_order=None):
"""
.. versionadded: 1.0.2 Move the entire queryset to a new object.
Returns a queryset with the newly created objects.
"""
qs = self.all() # Get clone
for item in qs:
# Change the item directly in... | 0.004016 |
def loads(s, **kwargs):
'''
.. versionadded:: 2018.3.0
Wraps json.loads and prevents a traceback in the event that a bytestring is
passed to the function. (Python < 3.6 cannot load bytestrings)
You can pass an alternate json module (loaded via import_json() above)
using the _json_module argume... | 0.002886 |
def list_command(endpoint_id):
"""
Executor for `globus endpoint permission list`
"""
client = get_client()
rules = client.endpoint_acl_list(endpoint_id)
resolved_ids = LazyIdentityMap(
x["principal"] for x in rules if x["principal_type"] == "identity"
)
def principal_str(rule... | 0.001074 |
def _store_generic_inference_results(self,
results_dict,
all_params,
all_names):
"""
Store the model inference values that are common to all choice models.
This includes thi... | 0.000914 |
def cancel(self):
"""https://developers.coinbase.com/api/v2#cancel-request-money"""
response = self.api_client._post(self.resource_path, 'cancel')
return self.api_client._make_api_object(response, APIObject) | 0.008658 |
def clock_filter(self, reroot='least-squares', n_iqd=None, plot=False):
'''
Labels outlier branches that don't seem to follow a molecular clock
and excludes them from subsequent molecular clock estimation and
the timetree propagation.
Parameters
----------
reroo... | 0.011989 |
def parse_args(argv=()):
"""Parse command line arguments, and return a dict.
"""
_p, _args, argv = base_argparser(argv)
config_files = []
if not _args.no_config: # process config files
# extra config file specified with --config <fname> has highest precedence
if _args.config:
... | 0.006156 |
def games(years, months=None, days=None, home=None, away=None):
"""Return a list of lists of games for multiple days.
If home and away are the same team, it will return all games for that team.
"""
# put in data if months and days are not specified
if months is None:
months = list(range(1, ... | 0.000907 |
def get_file_lines(file_name):
"""Return a list of non-empty lines from `file_path`."""
file_path = path.join(path.dirname(path.abspath(__file__)), file_name)
with open(file_path) as file_obj:
return [line for line in file_obj.read().splitlines() if line] | 0.003636 |
def get_execution(self, id_execution, access_token=None, user_id=None):
"""
Get a execution, by its id
"""
if access_token:
self.req.credential.set_token(access_token)
if user_id:
self.req.credential.set_user_id(user_id)
if not self.check_credentia... | 0.00349 |
def collect(self):
"""
Collect interrupt data
"""
if not os.access(self.PROC, os.R_OK):
return False
# Open PROC file
file = open(self.PROC, 'r')
# Get data
cpuCount = None
for line in file:
if not cpuCount:
... | 0.000924 |
def _parse_vertex_tuple(s):
"""Parse vertex indices in '/' separated form (like 'i/j/k', 'i//k' ...)."""
vt = [0, 0, 0]
for i, c in enumerate(s.split('/')):
if c:
vt[i] = int(c)
return tuple(vt) | 0.028302 |
def get_bgcolor(self, index):
"""Background color depending on value."""
column = index.column()
if not self.bgcolor_enabled:
return
value = self.get_value(index.row(), column)
if self.max_min_col[column] is None or isna(value):
color = QColor(BACKG... | 0.001686 |
def RunScript(self, script):
'''
Actuate on the vehicle through a script. The script is a sequence of
commands. Each command is a sequence with the first element as the
command name and the remaining values as parameters.
The script is executed asynchronously by a timer with a p... | 0.001166 |
def inner_contains(self, time_point):
"""
Returns ``True`` if this interval contains the given time point,
excluding its extrema (begin and end).
:param time_point: the time point to test
:type time_point: :class:`~aeneas.exacttiming.TimeValue`
:rtype: bool
"""
... | 0.003899 |
def fill_subparser(subparser):
"""Sets up a subparser to download the binarized MNIST dataset files.
The binarized MNIST dataset files
(`binarized_mnist_{train,valid,test}.amat`) are downloaded from
Hugo Larochelle's website [HUGO].
.. [HUGO] http://www.cs.toronto.edu/~larocheh/public/datasets/
... | 0.001149 |
def shadow_calc(data):
"""่ฎก็ฎไธไธๅฝฑ็บฟ
Arguments:
data {DataStruct.slice} -- ่พๅ
ฅ็ๆฏไธไธช่กๆ
ๅ็
Returns:
up_shadow {float} -- ไธๅฝฑ็บฟ
down_shdow {float} -- ไธๅฝฑ็บฟ
entity {float} -- ๅฎไฝ้จๅ
date {str} -- ๆถ้ด
code {str} -- ไปฃ็
"""
up_shadow = abs(data.high - (max(data.open, da... | 0.00133 |
def get_user_info(self, token):
"""
Retrieves the user info from the OAuth provider.
Arguments:
token (str): OAuth2 access token.
Returns:
dict
Raises:
UserInfoRetrievalFailed: Retrieval of user info from the remote server failed.
""... | 0.004812 |
def beacon(config):
'''
Emit the load averages of this host.
Specify thresholds for each load average
and only emit a beacon if any of them are
exceeded.
`onchangeonly`: when `onchangeonly` is True the beacon will fire
events only when the load average pass one threshold. Otherwise, it wi... | 0.00082 |
def _ass_refresh_attrs(self, cached_ass, file_ass):
"""Completely refreshes cached assistant from file.
Args:
cached_ass: an assistant from cache hierarchy
(for format see Cache class docstring)
file_ass: the respective assistant from filesystem hierarchy... | 0.00448 |
def set_state(self, state, brightness=None,
color_kelvin=None, color_xy=None,
color_hue_saturation=None):
"""
:param state: a boolean of true (on) or false ('off')
:param brightness: a float from 0 to 1 to set the brightness of
this bulb
:pa... | 0.004042 |
def getctime(self, path):
"""Returns the creation time of the fake file.
Args:
path: the path to fake file.
Returns:
(int, float) the creation time of the fake file in number of
seconds since the epoch.
Raises:
OSError: if the file d... | 0.003802 |
def bulk_query(self, query, *multiparams):
"""Bulk insert or update."""
self._conn.execute(text(query), *multiparams) | 0.014925 |
def poll(self, conn):
"""Poll DB socket and process async tasks."""
while 1:
state = conn.poll()
if state == psycopg2.extensions.POLL_OK:
while conn.notifies:
notify = conn.notifies.pop()
self.logger.info(
... | 0.000854 |
def get_placeholder_formats_list(self, format_string):
"""
Parses the format_string and returns a list of tuples
(placeholder, format).
"""
placeholders = []
# Tokenize the format string and process them
for token in self.tokens(format_string):
if toke... | 0.006637 |
def process_individual_command(self, words):
"""
process the individual lines like this:
#PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
29303 root 20 0 35300 2580 1664 R 3.9 0.0 0:00.02 top
11 root RT 0 0 0 0 S 1.9 0.0 0:18.87 migration/2
3702... | 0.007571 |
def pkg_config_header_strings(pkg_libraries):
""" Returns a list of header strings that could be passed to a compiler
"""
_, _, header_dirs = pkg_config(pkg_libraries)
header_strings = []
for header_dir in header_dirs:
header_strings.append("-I" + header_dir)
return header_strings | 0.003165 |
def serialize_md_inst(self, md_inst, md_class):
"""Serialize object ``md_inst`` by transforming it into an
``lxml.etree._ElementTree``. If it already is such, return it. If not,
make sure it is the correct type and return the output of calling
``seriaize()`` on it.
"""
va... | 0.00428 |
def download_options(dataset, node, entityids, api_key=None):
"""
The use of the download options request is to discover the different download
options for each scene. Some download options may exist but still be unavailable
due to disk usage and many other factors. If a download is unavailable
it m... | 0.010786 |
def get_all_cards(self, timeout: int=None):
"""Get a list of all the cards in the game
Parameters
----------
timeout: Optional[int] = None
Custom timeout that overwrites Client.timeout
"""
url = self.api.CARDS
return self._get_model(url, timeout=timeo... | 0.012384 |
def dealias_image(alias):
'''Remove an image alias.'''
with Session() as session:
try:
result = session.Image.dealiasImage(alias)
except Exception as e:
print_error(e)
sys.exit(1)
if result['ok']:
print("alias {0} removed.".format(alias))
... | 0.00274 |
def error_removed_option(message: str):
""" Takes a message and returns a callback that raises NoSuchOption
if the value is not None. The message is used as an argument to NoSuchOption. """
def f(_, param, value):
if value is not None:
raise click.NoSuchOption(
f'--{para... | 0.006977 |
def protocols(self):
"""
:rtype: dict[int, list of ProtocolAnalyzer]
"""
result = {}
for i, group in enumerate(self.rootItem.children):
result[i] = [child.protocol for child in group.children]
return result | 0.007491 |
def encode_offset_fetch_request(cls, client_id, correlation_id,
group, payloads):
"""
Encode some OffsetFetchRequest structs
:param bytes client_id: string
:param int correlation_id: int
:param bytes group: string, the consumer group you are f... | 0.003887 |
def emit_event(self, event_name, event_body):
"""
Publishes an event of type ``event_name`` to all subscribers, having the body
``event_body``. The event is pushed through all available event transports.
The event body must be a Python object that can be represented as a JSON.
... | 0.007386 |
def parse_uri(self, uri=None):
'''
parses and cleans up possible uri inputs, return instance of rdflib.term.URIRef
Args:
uri (rdflib.term.URIRef,str): input URI
Returns:
rdflib.term.URIRef
'''
# no uri provided, assume root
if not uri:
return rdflib.term.URIRef(self.root)
# string uri prov... | 0.036785 |
def logs(self, build_id, follow=False, build_json=None, wait_if_missing=False):
"""
provide logs from build
:param build_id: str
:param follow: bool, fetch logs as they come?
:param build_json: dict, to save one get-build query
:param wait_if_missing: bool, if build does... | 0.001546 |
def value_and_grad(fun, x):
"""Returns a function that returns both value and gradient. Suitable for use
in scipy.optimize"""
vjp, ans = _make_vjp(fun, x)
if not vspace(ans).size == 1:
raise TypeError("value_and_grad only applies to real scalar-output "
"functions. Try ja... | 0.004608 |
def get_environment(config, stage):
"""Find default environment name in stage."""
stage_data = get_stage_data(stage, config.get('stages', {}))
if not stage_data:
sys.exit(NO_STAGE_DATA.format(stage))
try:
return stage_data['environment']
except KeyError:
sys.exit(NO_ENV_IN_ST... | 0.002959 |
def extract_ngram_filter(pos_seq, regex=SimpleNP, minlen=1, maxlen=8):
"""The "FilterFSA" method in Handler et al. 2016.
Returns token position spans of valid ngrams."""
ss = coarse_tag_str(pos_seq)
def gen():
for s in xrange(len(ss)):
for n in xrange(minlen, 1 + min(maxlen, len(ss) - s)):
e = s + n
s... | 0.029126 |
def _show_interpreter_prompt_for_reply(self, msg):
""" Reimplemented for IPython-style prompts.
"""
# Update the old prompt number if necessary.
content = msg['content']
# abort replies do not have any keys:
if content['status'] == 'aborted':
if self._previous... | 0.001167 |
def _update(dashboard, profile):
'''Update a specific dashboard.'''
payload = {
'dashboard': dashboard,
'overwrite': True
}
request_url = "{0}/api/dashboards/db".format(profile.get('grafana_url'))
response = requests.post(
request_url,
headers={
"Authoriza... | 0.002268 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.