text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def do_default(value, default_value=u'', boolean=False):
"""If the value is undefined it will return the passed default value,
otherwise the value of the variable:
.. sourcecode:: jinja
{{ my_variable|default('my_variable is not defined') }}
This will output the value of ``my_variable`` if th... | 0.001403 |
def has_source_contents(self, src_id):
"""Checks if some sources exist."""
return bool(rustcall(_lib.lsm_view_has_source_contents,
self._get_ptr(), src_id)) | 0.00995 |
def remove_duplicates(items):
"""
Returns a list without duplicates, keeping elements order
:param items: A list of items
:return: The list without duplicates, in the same order
"""
if items is None:
return items
new_list = []
for item in items:
if item not in new_list:... | 0.002674 |
def patch(import_path, rvalue=UNDEFINED, side_effect=UNDEFINED, ignore=UNDEFINED, callback=UNDEFINED, ctxt=UNDEFINED, subsequent_rvalue=UNDEFINED):
"""
Patches an attribute of a module referenced on import_path with a decorated
version that will use the caliendo cache if rvalue is None. Otherwise it will
... | 0.003955 |
def ambiguous_date_to_date_range(mydate, fmt="%Y-%m-%d", min_max_year=None):
"""parse an abiguous date such as 2017-XX-XX to [2017,2017.999]
Parameters
----------
mydate : str
date string to be parsed
fmt : str
format descriptor. default is %Y-%m-%d
min_max_year : None, optional... | 0.015437 |
def responds(self):
"""
:returns: The frequency with which the user associated with this profile
responds to messages.
"""
contacted_text = self._contacted_xpb.\
get_text_(self.profile_tree).lower()
if 'contacted' not in contacted_text:
... | 0.01039 |
def column_exists(self, tablename: str, column: str) -> bool:
"""Does the column exist?"""
sql = """
SELECT COUNT(*)
FROM information_schema.columns
WHERE table_name=?
AND column_name=?
AND table_schema={}
""".format(self.get_current_sc... | 0.004651 |
def stop_running_tasks(self):
""" Terminate all the running tasks
:return: None
"""
for task in self.__running_registry:
task.stop()
self.__running_registry.clear() | 0.044944 |
def make_plot(self):
"""Make the horizon plot.
"""
self.get_contour_values()
# sets levels of main contour plot
colors1 = ['blue', 'green', 'red', 'purple', 'orange',
'gold', 'magenta']
# set contour value. Default is SNR_CUT.
self.snr_contou... | 0.005146 |
def is_field_remote(model, field_name):
"""Check whether a given model field is a remote field.
A remote field is the inverse of a one-to-many or a
many-to-many relationship.
Arguments:
model: a Django model
field_name: the name of a field
Returns:
True if `field_name` is ... | 0.001712 |
def trunk_update(request, trunk_id, old_trunk, new_trunk):
"""Handle update to a trunk in (at most) three neutron calls.
The JavaScript side should know only about the old and new state of a
trunk. However it should not know anything about how the old and new are
meant to be diffed and sent to neutron.... | 0.0003 |
def create_exception_for_response(
cls,
response_code,
messages,
response_id
):
"""
:type response_code: int
:type messages: list[str]
:type response_id: str
:return: The exception according to the status code.
:rtype: ... | 0.00142 |
def createLists(self):
'''Generate the checklists. Note that:
0,1 = off/on for auto-ticked items
2,3 = off/on for manually ticked items'''
self.beforeAssemblyList = {
'Confirm batteries charged':2,
'No physical damage to airframe':2,
'All electronics present and ... | 0.046296 |
def is_valid(self, field_name: str, value, kg: dict) -> Optional[dict]:
"""
Check if this value is valid for the given name property according to input knowledge graph and ontology.
If is valid, then return a dict with key @id or @value for ObjectProperty or DatatypeProperty.
No schema c... | 0.00342 |
def main():
"""
Upload a vcl file to a fastly service, cloning the current version if
necessary. The uploaded vcl is set as main unless --include is given.
All existing vcl files will be deleted first if --delete is given.
"""
parser = OptionParser(description=
"Upload ... | 0.001225 |
def add(self, name):
'''
Start a new section.
:param name:
:return:
'''
if self.__current_section:
self._flush_content()
self.discard_current(name) | 0.009302 |
def create_user(self, user_name, initial_password):
"""Create a new user with an initial password via provisioning API.
It is not an error, if the user already existed before.
If you get back an error 999, then the provisioning API is not enabled.
:param user_name: name of user to be c... | 0.002094 |
def get_default_version(env):
"""Returns the default version string to use for MSVS.
If no version was requested by the user through the MSVS environment
variable, query all the available visual studios through
get_installed_visual_studios, and take the highest one.
Return
------
version: ... | 0.005348 |
def mangle_agreement(correct_sentence):
"""Given a correct sentence, return a sentence or sentences with a subject
verb agreement error"""
# # Examples
#
# Back in the 1800s, people were much shorter and much stronger.
# This sentence begins with the introductory phrase, 'back in the 1800s'
... | 0.00613 |
def install_missing(name, version=None, source=None):
'''
Instructs Chocolatey to install a package if it doesn't already exist.
.. versionchanged:: 2014.7.0
If the minion has Chocolatey >= 0.9.8.24 installed, this function calls
:mod:`chocolatey.install <salt.modules.chocolatey.install>` i... | 0.001657 |
def has_permission(user, permission_name):
"""Check if a user has a given permission."""
if user and user.is_superuser:
return True
return permission_name in available_perm_names(user) | 0.004878 |
def make_form_or_formset_fields_not_required(form_or_formset):
"""Take a Form or FormSet and set all fields to not required."""
if isinstance(form_or_formset, BaseFormSet):
for single_form in form_or_formset:
make_form_fields_not_required(single_form)
else:
make_form_fields_not_r... | 0.002907 |
def add_warning(self,
exception: BELParserWarning,
context: Optional[Mapping[str, Any]] = None,
) -> None:
"""Add a warning to the internal warning log in the graph, with optional context information.
:param exception: The exception that occur... | 0.010889 |
def _get_xml_value(value):
"""Convert an individual value to an XML string. Calls itself
recursively for dictionaries and lists.
Uses some heuristics to convert the data to XML:
- In dictionaries, the keys become the tag name.
- In lists the tag name is 'child' with an order-attribute givin... | 0.00075 |
def _construct_api_path(self, version):
"""Returns valid base API path based on version given
The base API path for the URL is different depending on UniFi server version.
Default returns correct path for latest known stable working versions.
"""
V2_PATH = 'api/'
... | 0.00639 |
def depth_july_average_ground_temperature(self, value=None):
"""Corresponds to IDD Field `depth_july_average_ground_temperature`
Args:
value (float): value for IDD Field `depth_july_average_ground_temperature`
Unit: C
if `value` is None it will not be checked... | 0.004768 |
def _init_level_set(init_level_set, image_shape):
"""Auxiliary function for initializing level sets with a string.
If `init_level_set` is not a string, it is returned as is.
"""
if isinstance(init_level_set, str):
if init_level_set == 'checkerboard':
res = checkerboard_level_set(ima... | 0.001664 |
def create_option_from_value(tag, value):
"""
Set DHCP option with human friendly value
"""
dhcp_option.parser()
fake_opt = dhcp_option(tag = tag)
for c in dhcp_option.subclasses:
if c.criteria(fake_opt):
if hasattr(c, '_parse_from_value'):
return c(tag = tag,... | 0.014787 |
def _add_unitary_single(self, gate, qubit):
"""Apply an arbitrary 1-qubit unitary matrix.
Args:
gate (matrix_like): a single qubit gate matrix
qubit (int): the qubit to apply gate to
"""
# Compute einsum index string for 1-qubit matrix multiplication
inde... | 0.002729 |
def sanitize_label(text):
"""Remove characters not accepted in labels key
This replaces any non-word characters (alphanumeric or underscore), with
an underscore. It also ensures that the first character is a letter by
prepending with 'key' if necessary, and trims the text to 100 characters.
"""
... | 0.001898 |
def transform_predict(self, X, y):
"""
Apply transforms to the data, and predict with the final estimator.
Unlike predict, this also returns the transformed target
Parameters
----------
X : iterable
Data to predict on. Must fulfill input requirements of first... | 0.002976 |
def delete_session_entity_type(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None):
"""
Deletes the specified session entity type.
Example:
>>> import ... | 0.002335 |
def clone(self, data=None, shared_data=True, new_type=None, *args, **overrides):
"""Clones the object, overriding data and parameters.
Args:
data: New data replacing the existing data
shared_data (bool, optional): Whether to use existing data
new_type (optional): Typ... | 0.005006 |
def playlist_song_add(
self,
song,
playlist,
*,
after=None,
before=None,
index=None,
position=None
):
"""Add a song to a playlist.
Note:
* Provide no optional arguments to add to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Pro... | 0.033179 |
def best_policy(mdp, U):
"""Given an MDP and a utility function U, determine the best policy,
as a mapping from state to action. (Equation 17.4)"""
pi = {}
for s in mdp.states:
pi[s] = argmax(mdp.actions(s), lambda a:expected_utility(a, s, U, mdp))
return pi | 0.006993 |
def conn_is_open(conn):
"""Tests sqlite3 connection, returns T/F"""
if conn is None:
return False
try:
get_table_names(conn)
return True
# # Idea taken from
# # http: // stackoverflow.com / questions / 1981392 / how - to - tell - if -python - sqlite - data... | 0.003774 |
def database_caller_creator(self, name=None):
'''creates a sqlite3 db
returns the related connection object
which will be later used to spawn the cursor
'''
try:
if name:
database = name + '.db'
else:
database = 'sqlite_' +... | 0.006126 |
def is_probably_packed( pe ):
"""Returns True is there is a high likelihood that a file is packed or contains compressed data.
The sections of the PE file will be analyzed, if enough sections
look like containing compressed data and the data makes
up for more than 20% of the total file size, the functi... | 0.006508 |
def new_page(self, page_number, new_chapter, **kwargs):
"""Called by :meth:`render` with the :class:`Chain`s that need more
:class:`Container`s. This method should create a new :class:`Page` which
contains a container associated with `chain`."""
right_template = self.document.get_page_te... | 0.004918 |
def _start_machine(machine, session):
'''
Helper to try and start machines
@param machine:
@type machine: IMachine
@param session:
@type session: ISession
@return:
@rtype: IProgress or None
'''
try:
return machine.launchVMProcess(session, '', '')
except Exception as ... | 0.002591 |
def parse_dunder_all(self):
"""Parse the __all__ definition in a module."""
assert self.current.value == '__all__'
self.consume(tk.NAME)
# More than one __all__ definition means we ignore all __all__.
if self.dunder_all is not None or self.dunder_all_error is not None:
... | 0.002622 |
def collate(binder, ruleset=None, includes=None):
"""Given a ``Binder`` as ``binder``, collate the content into a new set
of models.
Returns the collated binder.
"""
html_formatter = SingleHTMLFormatter(binder, includes)
raw_html = io.BytesIO(bytes(html_formatter))
collated_html = io.BytesI... | 0.001736 |
def write_done(self, addr):
"""Callback when data is received from the Crazyflie"""
if not addr == self._current_addr:
logger.warning(
'Address did not match when adding data to read request!')
return
if len(self._data) > 0:
self._current_addr... | 0.004065 |
def get_many(self, type: Type[T], query: Mapping[str, Any], context: PipelineContext = None) -> Iterable[T]:
"""Gets a query from the data source, which contains a request for multiple objects.
Args:
query: The query being requested (contains a request for multiple objects).
con... | 0.011236 |
def join(self, channel_name):
""" https://api.slack.com/methods/channels.join
"""
self.params.update({
'name': channel_name,
})
return FromUrl('https://slack.com/api/channels.join', self._requests)(data=self.params).post() | 0.010791 |
def init2(
self,
input_tube, # Read task from the input tube.
output_tubes, # Send result on all the output tubes.
num_workers, # Total number of workers in the stage.
disable_result, # Whether to override any result with None.
do_stop_task, # Whether to ... | 0.005566 |
def get_month(self):
"""
Return the month from the database in the format expected by the URL.
"""
year = super(BuildableMonthArchiveView, self).get_year()
month = super(BuildableMonthArchiveView, self).get_month()
fmt = self.get_month_format()
return date(int(yea... | 0.005682 |
def query_handler(cls, identifier, role=None):
'''
Lookup the handler for the giving idetifier (descriptor_type) and role.
In case it was not found return the default.
Logic goes as follows:
- First try to find exact match for identifier and role,
- Try to find match f... | 0.002714 |
def snapshot(self):
"""Snapshot current state."""
self._snapshot = {
'name': self.name,
'volume': self.volume,
'muted': self.muted,
'latency': self.latency
}
_LOGGER.info('took snapshot of current state of %s', self.friendly_name) | 0.009677 |
def connectProcess(connection, processProtocol, commandLine='', env={},
usePTY=None, childFDs=None, *args, **kwargs):
"""Opens a SSHSession channel and connects a ProcessProtocol to it
@param connection: the SSH Connection to open the session channel on
@param processProtocol: the Proces... | 0.002064 |
def _interrupt_read(self):
"""
Read data from device.
"""
data = self._device.read(ENDPOINT, REQ_INT_LEN, timeout=TIMEOUT)
LOGGER.debug('Read data: %r', data)
return data | 0.009174 |
def create(self, opts):
"""Create a conf stanza."""
argv = opts.args
count = len(argv)
# unflagged arguments are conf, stanza, key. In this order
# however, we must have a conf and stanza.
cpres = True if count > 0 else False
spres = True if count > 1 else False... | 0.004 |
def delete_variants(adapter, vcf_obj, case_obj, case_id=None):
"""Delete variants for a case in the database
Args:
adapter(loqusdb.plugins.Adapter)
vcf_obj(iterable(dict))
ind_positions(dict)
case_id(str)
Returns:
nr_deleted (int): Number of deleted variants... | 0.006177 |
def client_authentication_required(self, request, *args, **kwargs):
"""Determine if client authentication is required for current request.
According to the rfc6749, client authentication is required in the
following cases:
Resource Owner Password Credentials Grant: see `Section 4.3.2`_... | 0.001527 |
def save(self):
"""
save or update endpoint to Ariane server
:return:
"""
LOGGER.debug("Endpoint.save")
if self.parent_node is not None:
if self.parent_node.id is None:
self.parent_node.save()
self.parent_node_id = self.parent_node.... | 0.002641 |
def is_protein_or_chemical(agent):
'''Return True if the agent is a protein/protein family or chemical.'''
# Default is True if agent is None
if agent is None:
return True
dbs = set(['UP', 'HGNC', 'CHEBI', 'PFAM-DEF', 'IP', 'INDRA', 'PUBCHEM',
'CHEMBL'])
agent_refs = set(agent... | 0.002439 |
def sni2route(self, sni: SchemaNodeId, sctx: SchemaContext) -> SchemaRoute:
"""Translate schema node identifier to a schema route.
Args:
sni: Schema node identifier (absolute or relative).
sctx: Schema context.
Raises:
ModuleNotRegistered: If `mid` is not re... | 0.003241 |
def c(self):
"""
continue
"""
i,node=self._get_next_eval()
if node.name in self._bpset:
if self.state == RUNNING:
return self._break()
self.state = RUNNING
self._eval(node)
# increment to next node
self.step=i+1
if self.step < len(self._exe_order):
return self.c()
else:
return self... | 0.066667 |
def finishLearning(self):
"""
Perform an internal optimization step that speeds up inference if we know
learning will not be performed anymore. This call may, for example, remove
all potential inputs to each column.
"""
if self._tfdr is None:
raise RuntimeError("Temporal memory has not bee... | 0.008909 |
def _format_value(self, value):
"""
Return formatted string
"""
value, unit = self.py3.format_units(value, unit=self.unit, si=self.si_units)
return self.py3.safe_format(self.format_value, {"value": value, "unit": unit}) | 0.015444 |
def wait_all_futures(self, futures, timeout=None, event_timeout=None):
# type: (Union[List[Future], Future, None], float, float) -> None
"""Services all futures until the list 'futures' are all done
then returns. Calls relevant subscription callbacks as they
come off the queue and raises... | 0.002654 |
def mainswitch_state(sequence_number, state):
"""Create a mainswitch.state message"""
return MessageWriter().string("mainswitch.state").uint64(sequence_number).bool(state).get() | 0.015544 |
def _parse_mode(client, command, actor, args):
"""Parse a mode changes, update states, and dispatch MODE events."""
chantypes = client.server.features.get("CHANTYPES", "#")
channel, _, args = args.partition(" ")
args = args.lstrip(":")
if channel[0] not in chantypes:
# Personal modes
... | 0.000934 |
def sendDtmfTone(self, tones):
""" Send one or more DTMF tones to the remote party (only allowed for an answered call)
Note: this is highly device-dependent, and might not work
:param digits: A str containining one or more DTMF tones to play, e.g. "3" or "\*123#"
:rai... | 0.009721 |
def has_obsgroup_id(self, group_id):
"""
Check for the presence of the given group_id
:param string group_id:
The group ID
:return:
True if we have a :class:`meteorpi_model.ObservationGroup` with this Id, False otherwise
"""
self.con.execute('SELE... | 0.009368 |
def _get_dimension_scales(self, dimension, preserve_domain=False):
"""
Return the list of scales corresponding to a given dimension.
The preserve_domain optional argument specifies whether one should
filter out the scales for which preserve_domain is set to True.
"""
if ... | 0.002288 |
def clean(self, value):
"""
Call the form is_valid to ensure every value supplied is valid
"""
if not value:
raise ValidationError(
'Error found in Form Field: Nothing to validate')
data = dict((bf.name, value[i]) for i, bf in enumerate(self.form))
... | 0.002732 |
def find(self, name: str) -> Optional[ConnectedConsulLockInformation]:
"""
Finds the lock with the key name that matches that given.
:param name: the lock key to match
:return: the found lock
"""
lock = self.consul_client.kv.get(name)[1]
if lock is None:
... | 0.00624 |
def get_waveset(model):
"""Get optimal wavelengths for sampling a given model.
Parameters
----------
model : `~astropy.modeling.Model`
Model.
Returns
-------
waveset : array-like or `None`
Optimal wavelengths. `None` if undefined.
Raises
------
synphot.exceptio... | 0.001534 |
def get_feeds_url(blog_page, root_page):
"""
Get the feeds urls a blog page instance.
It will use an url or another depending if blog_page is the root page.
"""
if root_page == blog_page:
return reverse('blog_page_feed')
else:
blog_path = strip_prefix_and_ending_slash(blog_page.s... | 0.004751 |
def wait_for_task(task, instance_name, task_type, sleep_seconds=1, log_level='debug'):
'''
Waits for a task to be completed.
task
The task to wait for.
instance_name
The name of the ESXi host, vCenter Server, or Virtual Machine that
the task is being run on.
task_type
... | 0.000752 |
def train_crf(ctx, input, output, clusters):
"""Train CRF CEM recognizer."""
click.echo('chemdataextractor.crf.train')
sentences = []
for line in input:
sentence = []
for t in line.split():
token, tag, iob = t.rsplit('/', 2)
sentence.append(((token, tag), iob))
... | 0.002179 |
async def clear_reactions(self):
"""|coro|
Removes all the reactions from the message.
You need the :attr:`~Permissions.manage_messages` permission to use this.
Raises
--------
HTTPException
Removing the reactions failed.
Forbidden
You d... | 0.006424 |
def _prepare_for_submission(self, tempfolder, inputdict):
"""
Create input files.
:param tempfolder: aiida.common.folders.Folder subclass where
the plugin should put all its files.
:param inputdict: dictionary of the input nodes as they would
be r... | 0.002459 |
def get_validate_upload_form_kwargs(self):
"""
Return the keyword arguments for instantiating the form for validating
the upload.
"""
kwargs = {
'storage': self.get_storage(),
'upload_to': self.get_upload_to(),
'content_type_prefix': self.get... | 0.002281 |
def delete_file(self, target, path):
"""Delete a file from a device
:param target: The device(s) to be targeted with this request
:type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances
:param path: The path on the target to the file to d... | 0.00565 |
def tool_classpath_from_products(products, key, scope):
"""Get a classpath for the tool previously registered under key in the given scope.
:param products: The products of the current pants run.
:type products: :class:`pants.goal.products.Products`
:param string key: The key the tool configuration was... | 0.005013 |
def duration(input_filepath):
'''
Show duration in seconds (0 if unavailable).
Parameters
----------
input_filepath : str
Path to audio file.
Returns
-------
duration : float
Duration of audio file in seconds.
If unavailable or empty, returns 0.
'''
vali... | 0.001969 |
def get_period_seconds(period):
"""
return the number of seconds in the specified period
>>> get_period_seconds('day')
86400
>>> get_period_seconds(86400)
86400
>>> get_period_seconds(datetime.timedelta(hours=24))
86400
>>> get_period_seconds('day + os.system("rm -Rf *")')
Traceback (most recent call last):
... | 0.031891 |
def _style_text(text):
"""
Apply some HTML highlighting to the contents.
This can't be done in the
"""
# Escape text and apply some formatting.
# To have really good highlighting, pprint would have to be re-implemented.
text = escape(text)
text = text.replace(' <iterator object>', ... | 0.014603 |
def tictoc(name='tictoc'):
"""
with tictoc('any string or not'):
print 'cool~~~'
cool~~~
2015-12-30 14:39:28,458 [INFO] tictoc Elapsed: 7.10487365723e-05 secs
:param name: str
"""
t = time.time()
yield
logg.info('%s Elapsed: %s secs' % (name, time.time() - t)) | 0.003289 |
def wrapModel(self, model):
"""
Converts application-provided model objects to L{IResource} providers.
"""
res = IResource(model, None)
if res is None:
frag = INavigableFragment(model)
fragmentName = getattr(frag, 'fragmentName', None)
if fragm... | 0.003759 |
def _wet_message_received(self, msg):
"""Report a wet state."""
for callback in self._dry_wet_callbacks:
callback(LeakSensorState.WET)
self._update_subscribers(0x13) | 0.00995 |
def generate_template(context, config, cloudformation):
"""call cloudformation to generate the template (json format).
:param context:
:param config:
:param cloudformation:
:return:
"""
spec = inspect.getargspec(cloudformation.generate_template)[0]
if len(spec) == 0:
return clou... | 0.00361 |
def get_Q(self):
"""Get the model's estimate of Q = \mu P \mu^T
We can then separately extract \mu subject to additional constraints,
e.g. \mu P 1 = diag(O).
"""
Z = self.Z.detach().clone().numpy()
O = self.O.numpy()
I_k = np.eye(self.k)
return O @ Z @ np... | 0.019444 |
def in_domain(self, points):
"""
Returns ``True`` if all of the given points are in the domain,
``False`` otherwise.
:param np.ndarray points: An `np.ndarray` of type `self.dtype`.
:rtype: `bool`
"""
if np.all(np.isreal(points)):
are_greater = np.all... | 0.005871 |
def volume_list(self, search_opts=None):
'''
List all block volumes
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
volumes = nt_ks.volumes.list(search_opts=search_opts)
response = {}
... | 0.002861 |
def submarine(space, smooth=True, taper=20.0):
"""Return a 'submarine' phantom consisting in an ellipsoid and a box.
Parameters
----------
space : `DiscreteLp`
Discretized space in which the phantom is supposed to be created.
smooth : bool, optional
If ``True``, the boundaries are s... | 0.001053 |
def get_gtf_argument_parser(desc, default_field_name='gene'):
"""Return an argument parser with basic options for reading GTF files.
Parameters
----------
desc: str
Description of the ArgumentParser
default_field_name: str, optional
Name of field in GTF file to look for.
Return... | 0.002717 |
def msetnx(self, *args, **kwargs):
"""
Sets key/values based on a mapping if none of the keys are already set.
Mapping can be supplied as a single dictionary argument or as kwargs.
Returns a boolean indicating if the operation was successful.
"""
if args:
if l... | 0.004734 |
def map(self, f_list: List[Callable[[np.ndarray], int]], axis: int = 0, chunksize: int = 1000, selection: np.ndarray = None) -> List[np.ndarray]:
"""
Apply a function along an axis without loading the entire dataset in memory.
Args:
f_list (list of func): Function(s) that takes a numpy ndarray as argument
... | 0.026674 |
def one_line_desc(obj):
"""Get a one line description of a class."""
logger = logging.getLogger(__name__)
try:
doc = ParsedDocstring(obj.__doc__)
return doc.short_desc
except: # pylint:disable=bare-except; We don't want a misbehaving exception to break the program
logger.warni... | 0.007576 |
def latex(self):
"""Gives a latex representation of the assessment."""
output = self.latex_preamble
output += self._repr_latex_()
output += self.latex_post
return output | 0.009569 |
def users_get_presence(self, user_id=None, username=None, **kwargs):
"""Gets the online presence of the a user."""
if user_id:
return self.__call_api_get('users.getPresence', userId=user_id, kwargs=kwargs)
elif username:
return self.__call_api_get('users.getPresence', use... | 0.00907 |
def get_media_descriptions_metadata(self):
"""Gets the metadata for all media descriptions.
return: (osid.Metadata) - metadata for the media descriptions
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._media_descriptions_metadata)
m... | 0.006329 |
def iscsi_resource(self):
"""Property to provide reference to bios iscsi resource instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset.
"""
return iscsi.ISCSIResource(
self._conn, utils.get_subresource_path_by(
... | 0.004762 |
def deactivate():
'''Deactivates an environment by restoring all env vars to a clean state
stored prior to activating environments
'''
if 'CPENV_ACTIVE' not in os.environ or 'CPENV_CLEAN_ENV' not in os.environ:
raise EnvironmentError('Can not deactivate environment...')
utils.restore_env_f... | 0.002786 |
def tag(value):
"""
Add a tag with generated id.
:param value: everything working with the str() function
"""
rdict = load_feedback()
tests = rdict.setdefault("tests", {})
tests["*auto-tag-" + str(hash(str(value)))] = str(value)
save_feedback(rdict) | 0.003559 |
def write_object_to_file(self,
query_results,
filename,
fmt="csv",
coerce_to_timestamp=False,
record_time_added=False):
"""
Write query results to file.
... | 0.003872 |
def cli(wio, get_debug, debug):
'''
Change setting of device.
\b
DOES:
The config command lets you change setting of device through upd.
1. Ensure your device is Configure Mode.
2. Change your computer network to Wio's AP.
\b
EXAMPLE:
wio config --debug [on|off]... | 0.002753 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.