text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _rest_format_section(stream, section, options, doc=None):
"""format an options section using as ReST formatted output"""
if section:
print("%s\n%s" % (section, "'" * len(section)), file=stream)
if doc:
print(normalize_text(doc, line_len=79, indent=""), file=stream)
print(file=str... | 0.002548 |
def raise_enter_downtime_log_entry(self):
"""Raise CONTACT DOWNTIME ALERT entry (info level)
Format is : "CONTACT DOWNTIME ALERT: *get_name()*;STARTED;
Contact has entered a period of scheduled downtime"
Example : "CONTACT DOWNTIME ALERT: test_contact;STARTED;
... | 0.00468 |
def save_config(self, config_path=None):
"""Save configuration to the specified path, or self.config_path"""
if config_path is None:
config_path = self.config_path
else:
self.config_path = config_path
with open(config_path, 'w') as f:
self.config.writ... | 0.006173 |
async def browse(self, device):
"""
Launch file manager on the mount path of the specified device.
:param device: device object, block device path or mount path
:returns: whether the program was successfully launched.
"""
device = self._find_device(device)
if not... | 0.002601 |
async def items(self, *, wan=None):
"""Returns the members as seen by the local serf agent
Parameters:
wan (bool): List of WAN members instead of the LAN members
Returns:
Collection: List of cluster's members
This endpoint returns an object like::
[... | 0.001789 |
def apply_product_config(config):
"""Apply config values that are keyed by `cot_product`.
This modifies the passed in configuration.
Args:
config dict: the config to apply cot_product keying too
Returns: dict
"""
cot_product = config['cot_product']
for key in config:
if ... | 0.0048 |
def cos_distance(t1, t2, epsilon=1e-12, name=None):
"""Cos distance between t1 and t2 and caps the gradient of the Square Root.
Args:
t1: A tensor
t2: A tensor that can be multiplied by t1.
epsilon: A lower bound value for the distance. The square root is used as
the normalizer.
name: Optiona... | 0.004011 |
def __SendChunk(self, start, additional_headers=None):
"""Send the specified chunk."""
self.EnsureInitialized()
no_log_body = self.total_size is None
request = http_wrapper.Request(url=self.url, http_method='PUT')
if self.__gzip_encoded:
request.headers['Content-Encod... | 0.000719 |
def request(self):
""" Returns an OAuth2 Session to be used to make requests.
Returns None if a token hasn't yet been received."""
headers = {'Accept': 'application/json'}
# Use API Key if possible
if self.api_key:
headers['X-API-KEY'] = self.api_key
ret... | 0.006838 |
async def set_volume(self, vol: int):
""" Sets the player's volume (150% or 1000% limit imposed by lavalink depending on the version). """
if self._lavalink._server_version <= 2:
self.volume = max(min(vol, 150), 0)
else:
self.volume = max(min(vol, 1000), 0)
... | 0.009901 |
def load_new_checkpoint_when_available(
self, sess, current_checkpoint, sleep_seconds=10):
"""Waits for a new checkpoint to be available and then loads it.
Args:
sess: The current session.
current_checkpoint: The current checkpoint or None to just load the next
one.
sleep_second... | 0.004494 |
def update_value(self, uid, **kwargs):
"""
Updates contact's custom field value.
Returns :class:`Contact` object contains id and link to Contact.
:Example:
client.custom_fields.update_value(uid=1900901, contact_id=192012, value="abc")
:param int uid: The unique ... | 0.006369 |
def remove_artifacts_from_biom_table(table_filename,
fasta_filename,
ref_fp,
biom_table_dir,
ref_db_fp,
threads=1,
... | 0.001991 |
def populate_data_sharing_consent(apps, schema_editor):
"""
Populates the ``DataSharingConsent`` model with the ``enterprise`` application's consent data.
Consent data from the ``enterprise`` application come from the ``EnterpriseCourseEnrollment`` model.
"""
DataSharingConsent = apps.get_model('co... | 0.00504 |
def item_afdeling_adapter(obj, request):
"""
Adapter for rendering an object of
:class: `crabpy.gateway.capakey.Afdeling` to json.
"""
return {
'id': obj.id,
'naam': obj.naam,
'gemeente': {
'id': obj.gemeente.id,
'naam': obj.gemeente.naam
},
... | 0.002513 |
def entry_index(request, limit=0, template='djournal/entry_index.html'):
'''Returns a reponse of a fixed number of entries; all of them, by default. '''
entries = Entry.public.all()
if limit > 0:
entries = entries[:limit]
context = {
'entries': entries,
}
return render_to_res... | 0.004796 |
def get_df(self, data_file):
"""
读取历史财务数据文件,并返回pandas结果 , 类似gpcw20171231.zip格式,具体字段含义参考
https://github.com/rainx/pytdx/issues/133
:param data_file: 数据文件地址, 数据文件类型可以为 .zip 文件,也可以为解压后的 .dat
:return: pandas DataFrame格式的历史财务数据
"""
crawler = QAHistoryFinancialCrawle... | 0.004415 |
def get_full_time_interval(self):
"""Give the full time interval of the file. Note that the real interval
can be longer because the sound file attached can be longer.
:returns: Tuple of the form: ``(min_time, max_time)``.
"""
return (0, 0) if not self.timeslots else\
... | 0.005249 |
def ListProfilers(self):
"""Lists information about the available profilers."""
table_view = views.ViewsFactory.GetTableView(
self._views_format_type, column_names=['Name', 'Description'],
title='Profilers')
profilers_information = sorted(
profiling.ProfilingArgumentsHelper.PROFILER... | 0.004158 |
def implementation(self,
commands_module: arg(short_option='-m') = DEFAULT_COMMANDS_MODULE,
config_file: arg(short_option='-f') = None,
# Globals
globals_: arg(
container=dict,
... | 0.003562 |
def setOverlayWidthInMeters(self, ulOverlayHandle, fWidthInMeters):
"""Sets the width of the overlay quad in meters. By default overlays are rendered on a quad that is 1 meter across"""
fn = self.function_table.setOverlayWidthInMeters
result = fn(ulOverlayHandle, fWidthInMeters)
return ... | 0.009202 |
def subscribe(self, *, create_task=True, **params):
"""Subscribes to the Docker events channel. Use the keyword argument
create_task=False to prevent automatically spawning the background
tasks that listen to the events.
This function returns a ChannelSubscriber object.
"""
... | 0.00432 |
def load_training_rasters(response_raster, explanatory_rasters, selected=None):
"""
Parameters
----------
response_raster : Path to GDAL raster containing responses
explanatory_rasters : List of Paths to GDAL rasters containing explanatory variables
Returns
-------
train_xs : Array of e... | 0.001929 |
def create_file_from_text(self, share_name, directory_name, file_name,
text, encoding='utf-8', content_settings=None,
metadata=None, timeout=None):
'''
Creates a new file from str/unicode, or updates the content of an
existing file, with aut... | 0.004127 |
def get_elasticsearch_info():
"""Check Elasticsearch connection."""
from elasticsearch import (
Elasticsearch,
ConnectionError as ESConnectionError
)
if hasattr(settings, 'ELASTICSEARCH_URL'):
url = settings.ELASTICSEARCH_URL
else:
return {"status": NO_CONFIG}
sta... | 0.001429 |
def _filter_statements(statements, agents):
"""Return INDRA Statements which have Agents in the given list.
Only statements are returned in which all appearing Agents as in the
agents list.
Parameters
----------
statements : list[indra.statements.Statement]
A list of INDRA Statements t... | 0.002469 |
def _fill_from_default(self, default_job_config):
"""Merge this job config with a default job config.
The keys in this object take precedence over the keys in the default
config. The merge is done at the top-level as well as for keys one
level below the job type.
Arguments:
... | 0.002315 |
def check_int_arg_is_in_range(value, name, gte_value, lte_value=None):
"""
Check that variable with name 'name' >= gte_value and optionally <= lte_value
:param value: variable value
:param name: variable name
:param errors: list of error tuples (error_id, value)
:param gte_value: greater than or... | 0.003137 |
def mksls(src, dst=None):
'''
Convert a preseed file to an SLS file
'''
ps_opts = {}
with salt.utils.files.fopen(src, 'r') as fh_:
for line in fh_:
line = salt.utils.stringutils.to_unicode(line)
if line.startswith('#'):
continue
if not line... | 0.002758 |
def assign_objective_requisite(self, objective_id, requisite_objective_id):
"""Creates a requirement dependency between two ``Objectives``.
arg: objective_id (osid.id.Id): the ``Id`` of the dependent
``Objective``
arg: requisite_objective_id (osid.id.Id): the ``Id`` of the... | 0.003415 |
def normalize_weight(self, samples):
"""normalize weight
Parameters
----------
samples: list
a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix,
representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}}
... | 0.007289 |
def get_default_blocks(self, top=False):
"""
Return a list of column default block tuples (URL, verbose name).
Used for quick add block buttons.
"""
default_blocks = []
for block_model, block_name in self.glitter_page.default_blocks:
block = apps.get_model(b... | 0.00224 |
def on(device):
'''
Turns on the quota system
CLI Example:
.. code-block:: bash
salt '*' quota.on
'''
cmd = 'quotaon {0}'.format(device)
__salt__['cmd.run'](cmd, python_shell=False)
return True | 0.004237 |
def node_link_graph(data, directed=False, attrs=_attrs):
"""Return graph from node-link data format.
Parameters
----------
data : dict
node-link formatted graph data
directed : bool
If True, and direction not specified in data, return a directed graph.
attrs : dict
A d... | 0.000695 |
def _load_defaults(inventory_path=None, roles=None, extra_vars=None, tags=None,
basedir=False):
"""Load common defaults data structures.
For factorization purpose."""
extra_vars = extra_vars or {}
tags = tags or []
loader = DataLoader()
if basedir:
loader.set_basedir... | 0.000441 |
def _create():
"""Globally called function for creating the isotope/element API."""
def creator(group):
"""Helper function applied to each symbol group of the raw isotope table."""
symbol = group['symbol'].values[0]
try: # Ghosts and custom atoms don't necessarily have an abundance fr... | 0.002302 |
def get_url(url, catch_exception=False):
"""
:param str|unicode url: URL to open
:param bool catch_exception: If <True> catches all exceptions and returns <False>
"""
return _get_url(url, catch_exception, urlopen=urllib2.urlopen) | 0.008032 |
def work(self, socket, call, args, kwargs, topics=()):
"""Calls a function and send results to the collector. It supports
all of function actions. A function could return, yield, raise any
packable objects.
"""
task_id = uuid4_bytes()
reply_socket, topics = self.replier... | 0.002013 |
def run(self):
"""The thread function. Calls `self.run()` and if it raises
an exception, stores it in self.exc_info and exc_queue
"""
logger.debug("{0}: entering thread".format(self.name))
while True:
try:
self.event_dispatcher.loop()
excep... | 0.009054 |
def upgrade():
"""Upgrade database."""
op.create_table(
'workflows_workflow',
sa.Column(
'uuid',
UUIDType,
primary_key=True,
nullable=False,
default=uuid.uuid4()
),
sa.Column(
'name',
sa.String(25... | 0.000303 |
def by_id(self, region, encrypted_summoner_id):
"""
Get a summoner by summoner ID.
:param string region: The region to execute this request on
:param string encrypted_summoner_id: Summoner ID
:returns: SummonerDTO: represents a summoner
"""
... | 0.005859 |
def transfer_domain(DomainName=None, IdnLangCode=None, DurationInYears=None, Nameservers=None, AuthCode=None, AutoRenew=None, AdminContact=None, RegistrantContact=None, TechContact=None, PrivacyProtectAdminContact=None, PrivacyProtectRegistrantContact=None, PrivacyProtectTechContact=None):
"""
This operation tr... | 0.003958 |
def assess_products(model, reaction, flux_coefficient_cutoff=0.001,
solver=None):
"""Assesses whether the model has the capacity to absorb the products of
a reaction at a given flux rate.
Useful for identifying which components might be blocking a reaction
from achieving a specific ... | 0.000697 |
def distances_from_parent(self, leaves=True, internal=True, unlabeled=False):
'''Generator over the node-to-parent distances of this ``Tree``; (node,distance) tuples
Args:
``terminal`` (``bool``): ``True`` to include leaves, otherwise ``False``
``internal`` (``bool``): ``True``... | 0.00786 |
def from_hoy(cls, hoy, leap_year=False):
"""Create Ladybug Datetime from an hour of the year.
Args:
hoy: A float value 0 <= and < 8760
"""
return cls.from_moy(round(hoy * 60), leap_year) | 0.008658 |
def iter_items(self, depth: int = 1):
'''
get items from directory.
'''
if depth is not None and not isinstance(depth, int):
raise TypeError
def itor(root, d):
if d is not None:
d -= 1
if d < 0:
return
... | 0.004823 |
def initialize(self):
"""Initializes all components of the :class:`.NeuralNet` and
returns self.
"""
self.initialize_virtual_params()
self.initialize_callbacks()
self.initialize_criterion()
self.initialize_module()
self.initialize_optimizer()
self... | 0.005063 |
def _set_cell_attr(self, selection, table, attr):
"""Sets cell attr for key cell and mark grid content as changed
Parameters
----------
attr: dict
\tContains cell attribute keys
\tkeys in ["borderwidth_bottom", "borderwidth_right",
\t"bordercolor_bottom", "borde... | 0.002478 |
def get_grade_entries_by_ids(self, grade_entry_ids):
"""Gets a ``GradeEntryList`` corresponding to the given ``IdList``.
arg: grade_entry_ids (osid.id.IdList): the list of ``Ids`` to
retrieve
return: (osid.grading.GradeEntryList) - the returned
``GradeEntry`` ... | 0.002452 |
def unmarshaller(self, typed=True):
"""
Get the appropriate XML decoder.
@return: Either the (basic|typed) unmarshaller.
@rtype: L{UmxTyped}
"""
if typed:
return UmxEncoded(self.schema())
else:
return RPC.unmarshaller(self, typed) | 0.006452 |
def append_to_multiple(self, d, value, selector, data_columns=None,
axes=None, dropna=False, **kwargs):
"""
Append to multiple tables
Parameters
----------
d : a dict of table_name to table_columns, None is acceptable as the
values of one n... | 0.000989 |
def reverse(self):
"reverse *IN PLACE*"
leftblock = self.left
rightblock = self.right
leftindex = self.leftndx
rightindex = self.rightndx
for i in range(self.length // 2):
# Validate that pointers haven't met in the middle
assert leftblock != right... | 0.002058 |
def bodypart_types(self, method, input=True):
"""
Get a list of I{parameter definitions} (pdef) defined for the specified
method.
Each I{pdef} is a tuple (I{name}, L{xsd.sxbase.SchemaObject})
@param method: A service method.
@type method: I{service.Method}
@param ... | 0.001606 |
def _replaceRenamedPairMembers(kerning, leftRename, rightRename):
"""
Populate the renamed pair members into the kerning.
"""
renamedKerning = {}
for (left, right), value in kerning.items():
left = leftRename.get(left, left)
right = rightRename.get(right, right)
renamedKernin... | 0.002717 |
def get(self, file_id, session=None):
"""Get a file from GridFS by ``"_id"``.
Returns an instance of :class:`~gridfs.grid_file.GridOut`,
which provides a file-like interface for reading.
:Parameters:
- `file_id`: ``"_id"`` of the file to get
- `session` (optional): ... | 0.003086 |
def _start_transport(self, chain_state: ChainState):
""" Initialize the transport and related facilities.
Note:
The transport must not be started before the node has caught up
with the blockchain through `AlarmTask.first_run()`. This
synchronization includes the on-c... | 0.003125 |
def import_query(self, query, target_dir, append=False, file_type="text",
split_by=None, direct=None, driver=None, extra_import_options=None):
"""
Imports a specific query from the rdbms to hdfs
:param query: Free format query to run
:param target_dir: HDFS destinat... | 0.003497 |
def description(self, description):
"""
Updates the security labels description.
Args:
description:
"""
self._data['description'] = description
request = self._base_request
request['description'] = description
return self._tc_requests.update(r... | 0.005797 |
def _str_to_datetime(self, str_value):
"""Parses a `YYYY-MM-DD` string into a datetime object."""
try:
ldt = [int(f) for f in str_value.split('-')]
dt = datetime.datetime(*ldt)
except (ValueError, TypeError):
return None
return dt | 0.006711 |
def search(self,
response_format = None,
key = None,
**kwargs):
"""
Calls the API and returns a dictionary of the search results
:param response_format: the format that the API uses for its response,
inc... | 0.022371 |
def check_covariance_Kgrad_x(covar, relchange=1E-5, threshold=1E-2, check_diag=True):
"""
check_covariance_Kgrad_x(ACovarianceFunction covar, limix::mfloat_t relchange=1E-5, limix::mfloat_t threshold=1E-2, bool check_diag=True) -> bool
Parameters
----------
covar: limix::ACovari... | 0.005804 |
def help_center_article_comment_votes(self, article_id, comment_id, locale=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/help_center/votes#list-votes"
api_path = "/api/v2/help_center/articles/{article_id}/comments/{comment_id}/votes.json"
api_path = api_path.format(article_id=art... | 0.012658 |
def logs(self, **kwargs):
"""
Get log stream for the service.
Note: This method works only for services with the ``json-file``
or ``journald`` logging drivers.
Args:
details (bool): Show extra details provided to logs.
Default: ``False``
f... | 0.001612 |
def build_item_features(self, data, normalize=True):
"""
Build a item features matrix out of an iterable of the form
(item id, [list of feature names]) or (item id, {feature name: feature weight}).
Parameters
----------
data: iterable of the form
(item id, [... | 0.002956 |
def was_into_check(self) -> bool:
"""
Checks if the king of the other side is attacked. Such a position is not
valid and could only be reached by an illegal move.
"""
king = self.king(not self.turn)
return king is not None and self.is_attacked_by(self.turn, king) | 0.009646 |
def duplicate_txn_id(ipn_obj):
"""
Returns True if a record with this transaction id exists and its
payment_status has not changed.
This function has been completely changed from its previous implementation
where it used to specifically only check for a Pending->Completed
transition.
"""
... | 0.001309 |
def active(self):
"""
Return the currently active :class:`~opentracing.Scope` which
can be used to access the currently active
:attr:`Scope.span`.
:return: the :class:`~opentracing.Scope` that is active,
or ``None`` if not available.
"""
task = self.... | 0.004405 |
def _adorn_eof_error(self, e):
"""
Used by subclasses to provide additional information in the case of a
failed connection.
"""
if self.eof_error_hint:
e.args = ('%s\n\n%s' % (e.args[0], self.eof_error_hint),) | 0.007663 |
def ssh_client(host):
"""Start an ssh client.
:param host: the host
:type host: str
:returns: ssh client
:rtype: Paramiko client
"""
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host)
return ssh | 0.003484 |
def smallest(self):
'''
Find smallest item after removing deleted items from front of heap.
'''
if len(self) == 0:
raise IndexError, "smallest of empty priorityDictionary"
heap = self.__heap
while heap[0][1] not in self or self[heap[0][1]] != heap[0][0]:
... | 0.005869 |
def stat(package, graph):
"""Print download statistics for a package.
\b
Example:
pypi stat requests
"""
client = requests.Session()
for name_or_url in package:
package = get_package(name_or_url, client)
if not package:
secho(u'Invalid name or URL: "{name}"'... | 0.000576 |
def pCOH(self):
"""Partial coherence.
.. math:: \mathrm{pCOH}_{ij}(f) = \\frac{G_{ij}(f)}
{\sqrt{G_{ii}(f) G_{jj}(f)}}
References
----------
P. J. Franaszczuk, K. J. Blinowska, M. Kowalczyk. The application of
parametric m... | 0.006768 |
def bz2_decompress_stream(src):
"""Decompress data from `src`.
Args:
src (iterable): iterable that yields blocks of compressed data
Yields:
blocks of uncompressed data
"""
dec = bz2.BZ2Decompressor()
for block in src:
decoded = dec.decompress(block)
if decoded:... | 0.00289 |
def from_archive(archive_filename, py_interpreter=sys.executable):
"""extract metadata from a given sdist archive file
:param archive_filename: a sdist archive file
:param py_interpreter: The full path to the used python interpreter
:returns: a json blob with metadata
"""
with _extract_to_tempdir(... | 0.002326 |
def f_dc_power(effective_irradiance, cell_temp, module):
"""
Calculate DC power using Sandia Performance model
:param effective_irradiance: effective irradiance [suns]
:param cell_temp: PV cell temperature [degC]
:param module: PV module dictionary or pandas data frame
:returns: i_sc, i_mp, v_o... | 0.001949 |
def TexSoup(tex_code):
r"""
At a high-level, parses provided Tex into a navigable, searchable structure.
This is accomplished in two steps:
1. Tex is parsed, cleaned, and packaged.
2. Structure fed to TexNodes for a searchable, coder-friendly interface.
:param Union[str,iterable] tex_code: the... | 0.001078 |
def get_listening(self, listen=['0.0.0.0']):
"""Returns a list of addresses SSH can list on
Turns input into a sensible list of IPs SSH can listen on. Input
must be a python list of interface names, IPs and/or CIDRs.
:param listen: list of IPs, CIDRs, interface names
:returns:... | 0.002073 |
def get_current_time(self):
"""
Get current time
:return: datetime.time
"""
hms = [int(self.get_current_controller_value(i)) for i in range(406, 409)]
return datetime.time(*hms) | 0.013274 |
def _set_drop_monitor(self, v, load=False):
"""
Setter method for drop_monitor, mapped from YANG variable /interface/ethernet/qos/drop_monitor (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_drop_monitor is considered as a private
method. Backends looking... | 0.00576 |
def _upgrade_broker(broker):
"""
Extract the poller state from Broker and replace it with the industrial
strength poller for this OS. Must run on the Broker thread.
"""
# This function is deadly! The act of calling start_receive() generates log
# messages which must be silenced as the upgrade pr... | 0.000799 |
def validate_v3_svc_catalog_endpoint_data(self, expected, actual):
"""Validate the keystone v3 catalog endpoint data.
Validate a list of dictinaries that make up the keystone v3 service
catalogue.
It is in the form of:
{u'identity': [{u'id': u'48346b01c6804b298cdd7349aadb732e... | 0.000601 |
def getUsersWithinEnterpriseGroup(self,
groupName,
searchFilter=None,
maxCount=10):
"""
This operation returns the users that are currently assigned to the
enterprise group within th... | 0.007576 |
def _handle_error(self, response, body):
"""
Handle raising the correct exception, depending on the error. Many
errors share the same HTTP response code, meaning we have to get really
kludgey and do string searches to figure out what went wrong.
"""
boto.log.error('%s %s'... | 0.000881 |
def get_volumes(self):
"""
Return a list of all Volumes in this Storage Pool
"""
vols = [self.find_volume(name) for name in self.virsp.listVolumes()]
return vols | 0.00995 |
def from_bytes(cls, bitstream, decode_payload=True):
r'''
Parse the given packet and update properties accordingly
>>> data_hex = ('c033d3c10000000745c0005835400000'
... 'ff06094a254d38204d45d1a30016f597'
... 'a1c3c7406718bf1b50180ff0793f0000'
...... | 0.001118 |
def losing_abbr(self):
"""
Returns a ``string`` of the losing team's abbreviation, such as 'LAD'
for the Los Angeles Dodgers.
"""
if self.winner == HOME:
return utils._parse_abbreviation(self._away_name)
return utils._parse_abbreviation(self._home_name) | 0.00639 |
def from_hive_file(cls, fname, *args, **kwargs):
"""
Open a local JSON hive file and initialize from the hive contained
in that file, paying attention to the version keyword argument.
"""
version = kwargs.pop('version', None)
require = kwargs.pop('require_https', True)
... | 0.005076 |
def ManifestTools(**kargs):
""" Get tools that exist in the manifest """
path_dirs = PathDirs(**kargs)
manifest = join(path_dirs.meta_dir, 'plugin_manifest.cfg')
template = Template(template=manifest)
tools = template.sections()
return tools[1] | 0.003731 |
def validate(cls, code, prefix):
'''
Validates an octoDNS geo code making sure that it is a valid and
corresponding:
* continent
* continent & country
* continent, country, & province
'''
reasons = []
pieces = code.split('-')
n... | 0.002144 |
def range_fltr(dem, rangelim):
"""Range filter (helper function)
"""
print('Excluding values outside of range: {0:f} to {1:f}'.format(*rangelim))
out = np.ma.masked_outside(dem, *rangelim)
out.set_fill_value(dem.fill_value)
return out | 0.007752 |
def require(self, product_type):
"""Schedules the tasks that produce product_type to be executed before the requesting task.
There must be at least one task that produces the required product type, or the
dependencies will not be satisfied.
:API: public
"""
self._dependencies.add(product_type)... | 0.00813 |
def http_sa_http_server_shutdown(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
http_sa = ET.SubElement(config, "http-sa", xmlns="urn:brocade.com:mgmt:brocade-http")
http = ET.SubElement(http_sa, "http")
server = ET.SubElement(http, "server")
... | 0.006508 |
def purge_dict(idict):
"""Remove null items from a dictionary """
odict = {}
for key, val in idict.items():
if is_null(val):
continue
odict[key] = val
return odict | 0.004831 |
def remove_interval(self, time):
"""Remove an interval, if no interval is found nothing happens.
:param int time: Time of the interval.
:raises TierTypeException: If the tier is not a IntervalTier.
"""
if self.tier_type != 'IntervalTier':
raise Exception('Tiertype mu... | 0.004367 |
def Size(self):
"""
Get the total size in bytes of the object.
Returns:
int: size.
"""
s = super(Block, self).Size() + GetVarSize(self.Transactions)
return s | 0.009174 |
def recover_all(lbn, profile='default'):
'''
Set the all the workers in lbn to recover and activate them if they are not
CLI Examples:
.. code-block:: bash
salt '*' modjk.recover_all loadbalancer1
salt '*' modjk.recover_all loadbalancer1 other-profile
'''
ret = {}
config ... | 0.001222 |
def pstdev(data, mu=None):
"""Return the square root of the population variance.
See ``pvariance`` for arguments and other details.
"""
var = pvariance(data, mu)
try:
return var.sqrt()
except AttributeError:
return math.sqrt(var) | 0.00369 |
def apply(self, key, value, prompt=None,
on_load=lambda a: a, on_save=lambda a: a):
"""Applies a setting value to a key, if the value is not `None`.
Returns without prompting if either of the following:
* `value` is not `None`
* already present in the dictionary
... | 0.00625 |
def _has_requirements(self):
"""Returns True if the workflow needs a requirements section.
Returns:
bool: True if the workflow needs a requirements section, False
otherwise.
"""
self._closed()
return any([self.has_workflow_step, self.has_scatter_requ... | 0.005348 |
def mark_rewrite(self, *names):
"""Mark import names as needing to be re-written.
The named module or package as well as any nested modules will
be re-written on import.
"""
already_imported = set(names).intersection(set(sys.modules))
if already_imported:
for... | 0.00404 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.