text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _reorderForPreference(themeList, preferredThemeName):
"""
Re-order the input themeList according to the preferred theme.
Returns None.
"""
for theme in themeList:
if preferredThemeName == theme.themeName:
themeList.remove(theme)
themeList.insert(0, theme)
... | 0.003021 |
def write_page(buf, xfer_offset):
"""Writes a single page. This routine assumes that memory has already
been erased.
"""
xfer_base = 0x08000000
# Set mem write address
set_address(xfer_base+xfer_offset)
# Send DNLOAD with fw data
__dev.ctrl_transfer(0x21, __DFU_DNLOAD, 2, __DFU_INTERF... | 0.00292 |
def upload(self, *args, **kwargs):
"""Runs command on every job in the run."""
for job in self.jobs:
job.upload(*args, **kwargs) | 0.014085 |
def timeout_two_stage(
retries: int,
timeout1: int,
timeout2: int,
) -> Iterable[int]:
""" Timeouts generator with a two stage strategy
Timeouts start spaced by `timeout1`, after `retries` increase
to `timeout2` which is repeated indefinitely.
"""
for _ in range(retries):
... | 0.002639 |
def com_daltonmaag_check_required_fields(ufo_font):
"""Check that required fields are present in the UFO fontinfo.
ufo2ft requires these info fields to compile a font binary:
unitsPerEm, ascender, descender, xHeight, capHeight and familyName.
"""
recommended_fields = []
for field in [
"unitsPe... | 0.010989 |
def _proxy(self):
"""
Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
:returns: CertificateContext for this CertificateInstance
:rtype: twilio.rest.preview.deployed_devices.flee... | 0.008091 |
def register(type, parser, composer, **meta):
"""Registers a parser and composer of a format.
You can use this method to overwrite existing formats.
:param type: The unique name of the format
:param parser: The method to parse data as the format
:param composer: The method to compose data as the f... | 0.002155 |
def set_type(self):
"""
Set the node type
"""
if self.device_info['type'] == 'Router':
self.node['type'] = self.device_info['model'].upper()
else:
self.node['type'] = self.device_info['type'] | 0.007843 |
def sg_ctc(tensor, opt):
r"""Computes the CTC (Connectionist Temporal Classification) Loss between `tensor` and `target`.
Args:
tensor: A 3-D `float Tensor`.
opt:
target: A `Tensor` with the same length in the first dimension as the `tensor`. Labels. ( Dense tensor )
name: A `string... | 0.004292 |
def find_faces(self, image, draw_box=False):
"""Uses a haarcascade to detect faces inside an image.
Args:
image: The image.
draw_box: If True, the image will be marked with a rectangle.
Return:
The faces as returned by OpenCV's detectMultiScale method for
... | 0.002571 |
def _negotiate_value(response):
"""Extracts the gssapi authentication token from the appropriate header"""
if hasattr(_negotiate_value, 'regex'):
regex = _negotiate_value.regex
else:
# There's no need to re-compile this EVERY time it is called. Compile
# it once and you won't have th... | 0.004525 |
def phon2dB(loudness=None):
"""
Loudness in phons to Sound Pressure Level (SPL) in dB using the
ISO/FDIS 226:2003 model.
This function needs Scipy, as ``scipy.interpolate.UnivariateSpline``
objects are used as interpolators.
Parameters
----------
loudness :
The loudness value in phons to be conver... | 0.008102 |
def ID_colored_tube(color):
"""Look up the inner diameter of Ismatec 3-stop tubing given its color code.
:param color: Color of the 3-stop tubing
:type color: string
:returns: Inner diameter of the 3-stop tubing (mm)
:rtype: float
:Examples:
>>> from aguaclara.research.peristaltic_pump i... | 0.003436 |
def resize(self, shape, format=None):
""" Set the render-buffer size and format
Parameters
----------
shape : tuple of integers
New shape in yx order. A render buffer is always 2D. For
symmetry with the texture class, a 3-element tuple can also
be giv... | 0.002737 |
def datetime_str_to_timestamp(datetime_str):
'''
'2018-01-01 00:00:00' (str) --> 1514736000
:param str datetime_str: datetime string
:return: unix timestamp (int) or None
:rtype: int or None
'''
try:
dtf = DTFormat()
struct_time = time.st... | 0.006742 |
def add_prefix(self, ncname: str) -> None:
""" Look up ncname and add it to the prefix map if necessary
@param ncname: name to add
"""
if ncname not in self.prefixmap:
uri = cu.expand_uri(ncname + ':', self.curi_maps)
if uri and '://' in uri:
self... | 0.005814 |
def var(self):
"""
Compute the variance across images.
"""
return self._constructor(self.values.var(axis=0, keepdims=True)) | 0.012903 |
def find_shadowed(self, extra=()):
"""Find all the shadowed names. extra is an iterable of variables
that may be defined with `add_special` which may occour scoped.
"""
i = self.identifiers
return (i.declared | i.outer_undeclared) & \
(i.declared_locally | i.decla... | 0.007595 |
def create_feature_array(text, n_pad=21):
"""
Create feature array of character and surrounding characters
"""
n = len(text)
n_pad_2 = int((n_pad - 1)/2)
text_pad = [' '] * n_pad_2 + [t for t in text] + [' '] * n_pad_2
x_char, x_type = [], []
for i in range(n_pad_2, n_pad_2 + n):
... | 0.002427 |
def _lemmatise_roman_numerals(self, form, pos=False, get_lemma_object=False):
""" Lemmatise un mot f si c'est un nombre romain
:param form: Mot à lemmatiser
:param pos: Récupère la POS
:param get_lemma_object: Retrieve Lemma object instead of string representation of lemma
"""
... | 0.005821 |
def match(self, package):
"""Match ``package`` with the requirement.
:param package: Package to test with the requirement.
:type package: package expression string or :class:`Package`
:returns: ``True`` if ``package`` satisfies the requirement.
:rtype: bool
"""
... | 0.002119 |
def date(self, proxy, how='median', n=500):
"""Date a proxy record
Parameters
----------
proxy : ProxyRecord
how : str
How to perform the dating. 'median' returns the average of the MCMC ensemble. 'ensemble' returns a 'n'
randomly selected members of the ... | 0.00554 |
def build_grad_matrices(V, points):
"""Build the sparse m-by-n matrices that map a coefficient set for a function in V
to the values of dx and dy at a number m of points.
"""
# See <https://www.allanswered.com/post/lkbkm/#zxqgk>
mesh = V.mesh()
bbt = BoundingBoxTree()
bbt.build(mesh)
do... | 0.001652 |
def pipupdate():
"""
Update all currently installed pip packages
"""
packages = [d for d in pkg_resources.working_set]
subprocess.call('pip install --upgrade ' + ' '.join(packages)) | 0.00495 |
def extend_access_token(self, app_id, app_secret):
"""
Extends the expiration time of a valid OAuth access token. See
<https://developers.facebook.com/roadmap/offline-access-removal/
#extend_token>
"""
args = {
"client_id": app_id,
"client_secret"... | 0.00293 |
def client_ident(self):
"""
Return the client identifier as included in many command replies.
"""
return irc.client.NickMask.from_params(
self.nick, self.user,
self.server.servername) | 0.008368 |
def _setup_amplification(self, fle):
"""
If amplification data is specified then reads into memory and updates
the required rupture and site parameters
"""
self.amplification = AmplificationTable(fle["Amplification"],
self.m_w,
... | 0.002364 |
def pvariance(self):
'返回DataStruct.price的方差 variance'
res = self.price.groupby(level=1
).apply(lambda x: statistics.pvariance(x))
res.name = 'pvariance'
return res | 0.013216 |
def get_page_objects_by_type(context, object_type):
"""
**Arguments**
``object_type``
object type
:return selected objects
"""
try:
objects = context['page']['content'][object_type]
except KeyError:
raise template.TemplateSyntaxError('wrong content type: {0:>s}'.for... | 0.005618 |
def get_file_ids(object):
"""Get the exposure for a particular line in the meausre table"""
import MOPdbaccess
mysql = MOPdbaccess.connect('cfeps','cfhls',dbSystem='MYSQL')
cfeps=mysql.cursor()
sql="SELECT file_id FROM measure WHERE provisional LIKE %s"
cfeps.execute(sql,(object, ))
file_ids... | 0.019444 |
def rtt_read(self, buffer_index, num_bytes):
"""Reads data from the RTT buffer.
This method will read at most num_bytes bytes from the specified
RTT buffer. The data is automatically removed from the RTT buffer.
If there are not num_bytes bytes waiting in the RTT buffer, the
ent... | 0.003067 |
def get_template(self, template_name):
"""
Trying to get a compiled template given a template name
:param template_name: The template name.
:raises: - TemplateDoesNotExist if no such template exists.
- TemplateSyntaxError if we couldn't compile the
t... | 0.002845 |
def yml_dump(data, stream, yml_fnc=yml_fnc, **options):
"""An wrapper of yaml.safe_dump and yaml.dump.
:param data: Some data to dump
:param stream: a file or file-like object to dump YAML data
"""
_is_dict = anyconfig.utils.is_dict_like(data)
if options.get("ac_safe", False):
options ... | 0.001198 |
def check_grammar(self, ok_start_symbols = set(),
out=sys.stderr):
'''
Check grammar for:
- unused left-hand side nonterminals that are neither start symbols
or listed in ok_start_symbols
- unused right-hand side nonterminals, i.e. not tokens
- ... | 0.00409 |
def recognise(self):
"""
Recognise the PLL case of Cube.
"""
result = ""
for side in "LFRB":
for square in self.cube.get_face(side)[0]:
for _side in "LFRB":
if square.colour == self.cube[_side].colour:
result... | 0.005249 |
def _cursor_position_changed(self):
""" Updates the tip based on user cursor movement.
"""
cursor = self._text_edit.textCursor()
if cursor.position() <= self._start_position:
self.hide()
else:
position, commas = self._find_parenthesis(self._start_position ... | 0.005222 |
def model(self, *args, **kwargs):
"""
Piority of Arguments: Arguments passed in `kwargs` has the most piority, 'param' key in `kwargs` has less
piority than `kwargs` and dictionary arguments in `args` have the least piority. Other arguments are ignored.
Argument List:
model -... | 0.003063 |
def confusion_matrix(links_true, links_pred, total=None):
"""Compute the confusion matrix.
The confusion matrix is of the following form:
+----------------------+-----------------------+----------------------+
| | Predicted Positives | Predicted Negatives |
+===============... | 0.000469 |
def build_gtapp(appname, dry_run, **kwargs):
"""Build an object that can run ScienceTools application
Parameters
----------
appname : str
Name of the application (e.g., gtbin)
dry_run : bool
Print command but do not run it
kwargs : arguments used to invoke the application
... | 0.001776 |
def _handle_status(self, key, value):
"""Parse a status code from the attached GnuPG process.
:raises: :exc:`~exceptions.ValueError` if the status message is unknown.
"""
if key in (
'NO_SECKEY',
'BEGIN_DECRYPTION',
'DECRYPTION_FAILED',
... | 0.003697 |
def _apply_mask(self):
"""Applies the passed-in mask to the convolution matrix.
Returns:
w: A copy of the convolution matrix that has had the mask applied.
Raises:
base.IncompatibleShapeError: If the mask shape has more dimensions than
the weight matrix.
base.IncompatibleShapeE... | 0.00306 |
def list_dms (archive, compression, cmd, verbosity, interactive):
"""List a DMS archive."""
check_archive_ext(archive)
return [cmd, 'v', archive] | 0.012739 |
def get_enterprise_customer_from_catalog_id(catalog_id):
"""
Get the enterprise customer id given an enterprise customer catalog id.
"""
try:
return str(EnterpriseCustomerCatalog.objects.get(pk=catalog_id).enterprise_customer.uuid)
except EnterpriseCustomerCatalog.DoesNotExist:
retur... | 0.006135 |
def add_material(self, material):
"""Add a material to the mesh, IF it's not already present."""
if self.has_material(material):
return
self.materials.append(material) | 0.009804 |
def ca_exists(ca_name, cacert_path=None, ca_filename=None):
'''
Verify whether a Certificate Authority (CA) already exists
ca_name
name of the CA
cacert_path
absolute path to ca certificates root directory
ca_filename
alternative filename for the CA
.. versionadded:... | 0.001151 |
def variables(self):
"""
Returns :class:`Variables` instance.
"""
return Variables([(k, self._unescape(k, v), sl) for k, v, sl in self._nodes_to_values()]) | 0.016043 |
def subscribe(self, request, *args, **kwargs):
""" Performs the subscribe action. """
self.object = self.get_object()
self.object.subscribers.add(request.user)
messages.success(self.request, self.success_message)
return HttpResponseRedirect(self.get_success_url()) | 0.006579 |
def _createValueObjects(self, valueList, varList, mapTable, indexMap, contaminant, replaceParamFile):
"""
Populate GSSHAPY MTValue and MTIndex Objects Method
"""
def assign_values_to_table(value_list, layer_id):
for i, value in enumerate(value_list):
value = v... | 0.002933 |
def create_custom_menu(self, menu_data, matchrule):
"""
创建个性化菜单::
button = [
{
"type":"click",
"name":"今日歌曲",
"key":"V1001_TODAY_MUSIC"
},
{
"name":"菜单",
... | 0.001297 |
def setPositionLinkedTo(self, widgets):
"""
Sets the widget that this popup will be linked to for positional
changes.
:param widgets | <QWidget> || [<QWidget>, ..]
"""
if type(widgets) in (list, set, tuple):
new_widgets = list(widgets)
... | 0.006557 |
def build_portfolio(self, cash, max_per_note=25, min_percent=0, max_percent=20, filters=None, automatically_invest=False, do_not_clear_staging=False):
"""
Returns a list of loan notes that are diversified by your min/max percent request and filters.
One way to invest in these loan notes, is to s... | 0.004038 |
def remove_pipe(self, name):
"""Remove a component from the pipeline.
name (unicode): Name of the component to remove.
RETURNS (tuple): A `(name, component)` tuple of the removed component.
DOCS: https://spacy.io/api/language#remove_pipe
"""
if name not in self.pipe_nam... | 0.006424 |
def start(self, exit_on_stop=True, secondary_wait=0, reconnect=False):
"""
If the DistributedEvaluator is in primary mode, starts the manager
process and returns. In this case, the ``exit_on_stop`` argument will
be ignored.
If the DistributedEvaluator is in secondary mode, it con... | 0.0036 |
def mirror(self, handler, path_from, path_to, log_files=False):
"""Recursively mirror the contents of "path_from" into "path_to".
"handler" should be self.mirror_to_local_no_recursion or
self.mirror_to_remote_no_recursion to represent which way the files are
moving.
"""
... | 0.008333 |
def parse(cls, prefix):
"""
Extracts informations from `prefix`.
:param prefix: prefix with format ``<servername>|<nick>['!'<user>]['@'<host>]``.
:type prefix: unicode
:return: extracted informations (nickname or host, mode, username, host).
:rtype: tuple(str, str, str, ... | 0.005376 |
def _check_api_limits(gh_session, api_required=250, sleep_time=15):
"""
Simplified check for API limits
If necessary, spin in place waiting for API to reset before returning.
See: https://developer.github.com/v3/#rate-limiting
"""
api_rates = gh_session.rate_limit()
api_remaining = api_ra... | 0.001311 |
def create_asset_content(self, asset_content_form=None):
"""Creates new ``AssetContent`` for a given asset.
arg: asset_content_form (osid.repository.AssetContentForm):
the form for this ``AssetContent``
return: (osid.repository.AssetContent) - the new
``AssetC... | 0.002042 |
def close(self):
"""Close subscription.
"""
if self._S is not None:
# after .close() self._event should never be called
self._S.close()
self._S = None
self._Q.Signal(None)
self._T.Wait() | 0.007407 |
def erase_sector(self, address):
"""!
@brief Erase one sector.
@exception FlashEraseFailure
"""
assert self._active_operation == self.Operation.ERASE
# update core register to execute the erase_sector subroutine
result = self._call_function_and_wait(self... | 0.009579 |
def filer_has_permission(context, item, action):
"""Does the current user (taken from the request in the context) have
permission to do the given action on the given item.
"""
permission_method_name = 'has_{action}_permission'.format(action=action)
permission_method = getattr(item, permission_metho... | 0.001748 |
def publish(self, user_id, wifi_fingerprint, action='track', location_id='', port=1883):
'''
a method to publish wifi fingerprint data to a mosquitto server
:param user_id: string with id of user
:param wifi_fingerprint: list of dictionaries with wifi fields mac and rss... | 0.008008 |
def sleep(self, unique_id, delay, configs=None):
""" Pauses the process for the specified delay and then resumes it
:Parameter unique_id: the name of the process
:Parameter delay: delay time in seconds
"""
self.pause(unique_id, configs)
time.sleep(delay)
self.resume(unique_id, configs) | 0.003175 |
def add_time_dependent_effects(self, ts):
"""
Given a timeseries, apply a model to it.
Parameters
----------
ts:
Time series of i.i.d. observations as a Numpy array
returns the time series with added time-dependent effects as a Numpy array.
... | 0.012658 |
def add_updates(self, messages: Iterable[CachedMessage],
expunged: Iterable[int]) -> None:
"""Update the messages in the selected mailboxes. The ``messages``
should include non-expunged messages in the mailbox that should be
checked for updates. The ``expunged`` argument is t... | 0.002459 |
def request_comments(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/requests#listing-comments"
api_path = "/api/v2/requests/{id}/comments.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | 0.011111 |
def generateFeatureGroups(fgiContainer, linkageGroups, matchArr, timeKey,
massKey, logMassKey, massScalingFactor):
""" #TODO: docstring
:param fgiContainer:
:param linkageGroups:
:returns: a list of ids of the newly generated :class:`Fgi`
"""
#Generate feature groups ... | 0.001885 |
def cli_decrypt(context, key):
"""
Decrypts context.io_manager's stdin and sends that to
context.io_manager's stdout.
See :py:mod:`swiftly.cli.decrypt` for context usage information.
See :py:class:`CLIDecrypt` for more information.
"""
with context.io_manager.with_stdout() as stdout:
... | 0.001418 |
def signum(signame):
"""
Determine the signal from its name. These forms are supported:
signal object (needed for python >= 3.5)
integer signal number
text signal number
SIGNAME (signal name in upper case)
signame (signal name in lower case)
NAME (name withou... | 0.000823 |
def default_link_tag(item):
"""
Create an A-HREF tag that points to another page.
"""
text = item["value"]
target_url = item["href"]
if not item["href"] or item["type"] in ("span", "current_page"):
if item["attrs"]:
text = make_html_tag("span"... | 0.006508 |
def delete_backend(backend):
'''delete a backend, and update the secrets file
'''
settings = read_client_secrets()
if backend in settings:
del settings[backend]
# If the backend was the active client, remove too
if 'SREGISTRY_CLIENT' in settings:
if settings['SREGIST... | 0.004739 |
def readline(self):
"""Readline wrapper to force readline() to return str objects."""
line = self.fd.__class__.readline(self.fd)
if isinstance(line, bytes):
line = line.decode()
return line | 0.008584 |
def sort(self, field, direction="asc"):
"""
Adds sort criteria.
"""
if not isinstance(field, basestring):
raise ValueError("Field should be a string")
if direction not in ["asc", "desc"]:
raise ValueError("Sort direction should be `asc` or `desc`")
... | 0.005571 |
def push_app(self, content, content_url=None):
'''Push a notification to a Pushed application.
Param: content -> content of Pushed notification message
content_url (optional) -> enrich message with URL
Returns Shipment ID as string
'''
parameters = {
'... | 0.004329 |
def decorate_with_checker(func: CallableT) -> CallableT:
"""Decorate the function with a checker that verifies the preconditions and postconditions."""
assert not hasattr(func, "__preconditions__"), \
"Expected func to have no list of preconditions (there should be only a single contract checker per fun... | 0.004781 |
def get_status(self, batch_id):
"""Returns the status enum for a batch.
Args:
batch_id (str): The id of the batch to get the status for
Returns:
int: The status enum
"""
with self._lock:
if self._batch_committed(batch_id):
ret... | 0.00346 |
def set_m_vol(self, vol=None, relative=False):
'''
Set the music volume. If @vol != None, It will be changed to it (or by
it, if @relative is True.)
'''
if vol != None:
if relative:
vol += self.m_vol
self.m_vol = min(max(vol, 0), 1)
... | 0.011019 |
def order_verification(self, institute, case, user, link, variant):
"""Create an event for a variant verification for a variant
and an event for a variant verification for a case
Arguments:
institute (dict): A Institute object
case (dict): Case object
user (d... | 0.003854 |
def tree_probe(self, **kwargs):
"""
Perform an os walk down a file system tree, starting from
a **kwargs identified 'root', and return lists of files and
directories found.
kwargs:
root = '/some/path'
return {
'status': True,
'l... | 0.012352 |
def delete(data, id, medium, credentials):
"""Deletes the [medium] with the given id and data from the user's [medium]List.
:param data The data for the [medium] to delete.
:param id The id of the data to delete.
:param medium Anime or manga (tokens.Medium.ANIME or tokens.Medium.MANGA).
:raise... | 0.004728 |
def bytes2uuid(b):
""" Return standard human-friendly UUID. """
if b.strip(chr(0)) == '':
return None
s = b.encode('hex')
return "%s-%s-%s-%s-%s" % (s[0:8], s[8:12], s[12:16], s[16:20], s[20:]) | 0.004587 |
def _int2farray(ftype, num, length=None):
"""Convert a signed integer to an farray."""
if num < 0:
req_length = clog2(abs(num)) + 1
objs = _uint2objs(ftype, 2**req_length + num)
else:
req_length = clog2(num + 1) + 1
objs = _uint2objs(ftype, num, req_length)
if length:
... | 0.001631 |
def find_autorest_generated_folder(module_prefix="azure"):
"""Find all Autorest generated code in that module prefix.
This actually looks for a "models" package only (not file). We could be smarter if necessary.
"""
_LOGGER.info(f"Looking for Autorest generated package in {module_prefix}")
# Manual... | 0.00311 |
def check_token(self, renew=True):
"""
Checks the exp attribute of the access_token and either refreshes
the tokens by calling the renew_access_tokens method or does nothing
:param renew: bool indicating whether to refresh on expiration
:return: bool indicating whether access_tok... | 0.002516 |
def create_remote_subnet(self, account_id, identifier, cidr):
"""Creates a remote subnet on the given account.
:param string account_id: The account identifier.
:param string identifier: The network identifier of the remote subnet.
:param string cidr: The CIDR value of the remote subnet... | 0.003503 |
def send_file(self, fakeid, fid, type):
"""
向特定用户发送媒体文件
:param fakeid: 用户 UID (即 fakeid)
:param fid: 文件 ID
:param type: 文件类型 (2: 图片, 3: 音频, 15: 视频)
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
:raises ValueError: 参数出错, 错误原因直接打印异常即可 (常见错误内容: ``system ... | 0.002186 |
def multireport(args):
"""
%prog multireport layoutfile
Generate several Ks value distributions in the same figure. If the layout
file is missing then a template file listing all ks files will be written.
The layout file contains the Ks file, number of components, colors, and labels:
# Ks fil... | 0.002027 |
def is_used(self, regs, i, top=None):
""" Checks whether any of the given regs are required from the given point
to the end or not.
"""
if i < 0:
i = 0
if self.lock:
return True
regs = list(regs) # make a copy
if top is None:
... | 0.003783 |
def follow(self, object):
'''follow an object on the map'''
state = self.state
(px,py) = state.panel.pixmapper(object.latlon)
ratio = 0.25
if (px > ratio*state.width and
px < (1.0-ratio)*state.width and
py > ratio*state.height and
py < (1.0-rat... | 0.00639 |
def get_attribute_names(self):
"""Retrieves the names of all attributes.
Returns:
list[str]: attribute names.
"""
attribute_names = []
for attribute_name in iter(self.__dict__.keys()):
# Not using startswith to improve performance.
if attribute_name[0] == '_':
continue
... | 0.010309 |
def get_intent_name(handler_input):
# type: (HandlerInput) -> AnyStr
"""Return the name of the intent request.
The method retrieves the intent ``name`` from the input request, only if
the input request is an
:py:class:`ask_sdk_model.intent_request.IntentRequest`. If the input
is not an IntentRe... | 0.001182 |
def _purge_expired(self):
"""
Remove all expired entries from the cache.
"""
time_horizon = time.time() - self._keep_time
new_cache = {}
for (k, v) in self._cache.items():
if v.timestamp > time_horizon:
new_cache[k] = v
self._cache = ne... | 0.006116 |
def get_field_values_as_list(self,field):
'''
:param str field: The name of the field for which to pull in values.
Will parse the query results (must be ungrouped) and return all values of 'field' as a list. Note that these are not unique values. Example::
>>> r.get_field_values_as... | 0.00641 |
def open_file(self, file):
"""
Adds a file to the list (and move it to the top of the list if the
file already exists)
:param file: file path to add the list of recent files.
"""
files = self.get_recent_files()
try:
files.remove(file)
except ... | 0.003891 |
def _expand_spatial_bounds_to_fit_axes(bounds, ax_width, ax_height):
"""
Parameters
----------
bounds: dict
ax_width: float
ax_height: float
Returns
-------
spatial_bounds
"""
b = bounds
height_meters = util.wgs84_distance(b['lat_min'], b['lon_min'], b['lat_max'], b['lon... | 0.004159 |
def from_json(self, json_text):
"""Deserialize a JSON object into this object. This method will
check that the JSON object has the required keys and will set each
of the keys in that JSON object as an instance attribute of this
object.
:param json_text: the JSON text or object ... | 0.004995 |
def _request(self, method, url, query_or_data=None, **kwargs):
"""
Wrapper for the HTTP requests,
rate limit backoff is handled here,
responses are processed with ResourceBuilder.
"""
if query_or_data is None:
query_or_data = {}
request_method = geta... | 0.003222 |
def ensure_stacker_compat_config(config_filename):
"""Ensure config file can be loaded by Stacker."""
try:
with open(config_filename, 'r') as stream:
yaml.safe_load(stream)
except yaml.constructor.ConstructorError as yaml_error:
if yaml_error.problem.startswith(
'... | 0.001179 |
def read_option_value_from_nibble(nibble, pos, values):
"""
Calculates the value used in the extended option fields.
:param nibble: the 4-bit option header value.
:return: the value calculated from the nibble and the extended option value.
"""
if nibble <= 12:
... | 0.003891 |
def analyze_frames(cls, workdir):
'''generate draft from recorded frames'''
record = cls(None, workdir)
obj = {}
with open(os.path.join(workdir, 'frames', 'frames.json')) as f:
obj = json.load(f)
record.device_info = obj['device']
record.frames = obj['f... | 0.005263 |
def _get_envelopes_centroid(envelopes):
"""
Returns the centroid of an inputted geometry column. Not currently in use, as this is now handled by this
library's CRS wrapper directly. Light wrapper over ``_get_envelopes_min_maxes``.
Parameters
----------
envelopes : GeoSeries
The envelope... | 0.006568 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.