text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def defaults_scope(**kwargs):
"""Creates a scope for the defaults that are used in a `with` block.
Note: `defaults_scope` supports nesting where later defaults can be
overridden. Also, an explicitly given keyword argument on a method always
takes precedence.
In addition to setting defaults for some methods,... | 0.010759 |
def extract_all(self, directory=".", members=None):
"""Extract all member from the archive to the specified working
directory.
"""
if self.handle:
self.handle.extractall(path=directory, members=members) | 0.00813 |
def merged_pex(cls, path, pex_info, interpreter, pexes, interpeter_constraints=None):
"""Yields a pex builder at path with the given pexes already merged.
:rtype: :class:`pex.pex_builder.PEXBuilder`
"""
pex_paths = [pex.path() for pex in pexes if pex]
if pex_paths:
pex_info = pex_info.copy()
... | 0.012214 |
def module_broadcast(m, broadcast_fn, *args, **kwargs):
""" Call given function in all submodules with given parameters """
apply_leaf(m, lambda x: module_apply_broadcast(x, broadcast_fn, args, kwargs)) | 0.009524 |
def trackjobs(func, results, spacer):
"""
Blocks and prints progress for just the func being requested from a list
of submitted engine jobs. Returns whether any of the jobs failed.
func = str
results = dict of asyncs
"""
## TODO: try to insert a better way to break on KBD here.
LOGGER.... | 0.004241 |
def create(gandi, fqdn, name, type, value, ttl):
"""Create new record entry for a domain.
multiple value parameters can be provided.
"""
domains = gandi.dns.list()
domains = [domain['fqdn'] for domain in domains]
if fqdn not in domains:
gandi.echo('Sorry domain %s does not exist' % fqdn... | 0.001946 |
def shape_list(x):
"""Return list of dims, statically where possible."""
x = tf.convert_to_tensor(x)
# If unknown rank, return dynamic shape
if x.get_shape().dims is None:
return tf.shape(x)
static = x.get_shape().as_list()
shape = tf.shape(x)
ret = []
for i, dim in enumerate(static):
if dim ... | 0.028796 |
def render(source, target, context, owner='root', group='root',
perms=0o444, templates_dir=None, encoding='UTF-8',
template_loader=None, config_template=None):
"""
Render a template.
The `source` path, if not absolute, is relative to the `templates_dir`.
The `target` path should ... | 0.000693 |
def square(left, top, length, filled=False, thickness=1):
"""Returns a generator that produces (x, y) tuples for a square.
This function is an alias for the rectangle() function, with `length` passed for both the
`width` and `height` parameters.
The `left` and `top` arguments are the x and y coordinate... | 0.004355 |
def dashboard(request):
"""Shows the latest results for each source"""
sources = (models.Source.objects.all().prefetch_related('metric_set')
.order_by('name'))
metrics = SortedDict([(src, src.metric_set.all()) for src in sources])
no_source_metrics = models.Metr... | 0.001433 |
def diffusion_stencil_2d(epsilon=1.0, theta=0.0, type='FE'):
"""Rotated Anisotropic diffusion in 2d of the form.
-div Q A Q^T grad u
Q = [cos(theta) -sin(theta)]
[sin(theta) cos(theta)]
A = [1 0 ]
[0 eps ]
Parameters
----------
epsilon : fl... | 0.00029 |
def view_rest_retry(self, url=None):
"""
View current rest retry settings in the `requests.Session()` object
**Parameters:**
- **url:** URL to use to determine retry methods for. Defaults to 'https://'
**Returns:** Dict, Key header, value is header value.
"""
... | 0.006993 |
def _get_options(ret=None):
'''
Get the redis options from salt.
'''
attrs = {'host': 'host',
'port': 'port',
'unix_socket_path': 'unix_socket_path',
'db': 'db',
'password': 'password',
'cluster_mode': 'cluster_mode',
'startup... | 0.001426 |
def remove(image):
"""Remove an image to the GUI img library."""
path = os.path.join(IMG_DIR, image)
if os.path.isfile(path):
os.remove(path) | 0.006211 |
def traceplot(trace: sample_types, labels: List[Union[str, Tuple[str, str]]] = None, ax: Any = None,
x0: int = 0) -> Any:
"""
Plot samples values.
:param trace: result of MCMC run
:param labels: labels of vertices to be plotted. if None, all vertices are plotted.
:param ax: Matplotli... | 0.003717 |
def redraw_tiles(self, surface):
""" redraw the visible portion of the buffer -- it is slow.
"""
# TODO/BUG: Redraw animated tiles correctly. They are getting reset here
logger.warning('pyscroll buffer redraw')
self._clear_surface(self._buffer)
self._tile_queue = self.da... | 0.007444 |
def TableArgsMeta(table_args):
'''Declarative metaclass automatically adding (merging) __table_args__ to
mapped classes. Example:
Meta = TableArgsMeta({
'mysql_engine': 'InnoDB',
'mysql_default charset': 'utf8',
}
Base = declarative_base(name='Base', metaclass=M... | 0.00105 |
def import_(module_name, name):
"""Imports an object by a relative module path::
Profiler = import_('profiling.profiler', 'Profiler')
"""
module = importlib.import_module(module_name, __package__)
return getattr(module, name) | 0.004 |
def get_listing_calendar(self, listing_id, starting_date=datetime.datetime.now(), calendar_months=6):
"""
Get host availability calendar for a given listing
"""
params = {
'_format': 'host_calendar_detailed'
}
starting_date_str = starting_date.strftime("%Y-%m... | 0.006279 |
def compact_name(self, hashsize=6):
"""Compact representation of all simulation parameters
"""
# this can be made more robust for ID > 9 (double digit)
s = self.compact_name_core(hashsize, t_max=True)
s += "_ID%d-%d" % (self.ID, self.EID)
return s | 0.00678 |
def random_model(ctx, model_class_name):
"""
Get a random model identifier by class name. For example::
# db/fixtures/Category.yml
{% for i in range(0, 10) %}
category{{ i }}:
name: {{ faker.name() }}
{% endfor %}
# db/fixtures/Post.yml
a_blog_post:
... | 0.002151 |
def get(self, media_id):
"""
获取永久素材
详情请参考
http://mp.weixin.qq.com/wiki/4/b3546879f07623cb30df9ca0e420a5d0.html
:param media_id: 素材的 media_id
:return: 图文素材返回图文列表,其它类型为素材的内容
"""
def _processor(res):
if isinstance(res, dict):
if '... | 0.003145 |
def construct_operation_validators(api_path, path_definition, operation_definition, context):
"""
- consumes (did the request conform to the content types this api consumes)
- produces (did the response conform to the content types this endpoint produces)
- parameters (did the parameters of this request... | 0.001805 |
def get_function_help(function: str, bel_spec: BELSpec):
"""Get function_help given function name
This will get the function summary template (argument summary in signature)
and the argument help listing.
"""
function_long = bel_spec["functions"]["to_long"].get(function)
function_help = []
... | 0.003846 |
def index_open(self, index):
'''
Opens the speicified index.
http://www.elasticsearch.org/guide/reference/api/admin-indices-open-close.html
> ElasticSearch().index_open('my_index')
'''
request = self.session
url = 'http://%s:%s/%s/_open' % (self.host, self.port, ... | 0.007653 |
def write_file(self, molecule, inpfile):
"""
Write an ADF input file.
Parameters
----------
molecule : Molecule
The molecule for this task.
inpfile : str
The name where the input file will be saved.
"""
mol_blocks = []
at... | 0.001899 |
def parseExtensionArgs(self, ax_args):
"""Given attribute exchange arguments, populate this FetchRequest.
@param ax_args: Attribute Exchange arguments from the request.
As returned from L{Message.getArgs<openid.message.Message.getArgs>}.
@type ax_args: dict
@raises KeyError... | 0.001191 |
def delete(self, obj):
"""
Returns
object: full copy of new obj
"""
full = deepcopy(obj)
frag = full
parts, last = self.parts[:-1], self.parts[-1]
for part in parts:
if isinstance(frag, dict):
frag = frag[part]
e... | 0.0032 |
def solve(
solver, mzn, *dzn_files, data=None, include=None, stdlib_dir=None,
globals_dir=None, allow_multiple_assignments=False, output_mode='item',
timeout=None, two_pass=None, pre_passes=None, output_objective=False,
non_unique=False, all_solutions=False, num_solutions=None,
free_search=False, pa... | 0.000229 |
def interactive(renderer):
"""
Parse user input, dump to stdout, rinse and repeat.
Python REPL style.
"""
_import_readline()
_print_heading(renderer)
contents = []
more = False
while True:
try:
prompt, more = ('... ', True) if more else ('>>> ', True)
... | 0.001695 |
def _check_for_duplicates(xs, attr, check_fn=None):
"""Identify and raise errors on duplicate items.
"""
dups = []
for key, vals in itertools.groupby(x[attr] for x in xs):
if len(list(vals)) > 1:
dups.append(key)
if len(dups) > 0:
psamples = []
for x in xs:
... | 0.003759 |
def verify(institute_id, case_name, variant_id, variant_category, order):
"""Start procedure to validate variant using other techniques."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
variant_obj = store.variant(variant_id)
user_obj = store.user(current_user.email)
... | 0.006944 |
def download_url(job, url, work_dir='.', name=None, s3_key_path=None, cghub_key_path=None):
"""
Downloads URL, can pass in file://, http://, s3://, or ftp://, gnos://cghub/analysisID, or gnos:///analysisID
If downloading S3 URLs, the S3AM binary must be on the PATH
:param toil.job.Job job: Toil job tha... | 0.005084 |
def set(self, field, clusters, value, add_to_stack=True):
"""Set the value of one of several clusters."""
# Add the field if it doesn't exist.
if field not in self._fields:
self.add_field(field)
assert field in self._fields
clusters = _as_list(clusters)
for c... | 0.002315 |
def hue(p):
"""
Returns the saturation of a pixel.
Gray pixels have saturation 0.
:param p: A tuple of (R,G,B) values
:return: A saturation value between 0 and 360
"""
min_c = min(p)
max_c = max(p)
d = float(max_c - min_c)
if d == 0:
return 0
if max_c == p[0]:
... | 0.001996 |
def set_query_on_table_metaclass(model: object, session: Session):
"""
Ensures that the given database model (`DeclarativeMeta`) has a `query` property through
which the user can easily query the corresponding database table.
Database object models derived from Flask-SQLAlchemy's `... | 0.008055 |
def rename_fmapm(bids_base, basename):
'''
Rename magnitude fieldmap file to BIDS specification
'''
files = dict()
for ext in ['nii.gz', 'json']:
for echo in [1, 2]:
fname = '{0}_e{1}.{2}'.format(basename, echo, ext)
src = os.path.join(bids_base, 'fmap', fname)
... | 0.001546 |
def do_execute_direct(self, code: str, silent: bool = False) -> [str, dict]:
"""
This is the main method that takes code from the Jupyter cell and submits it to the SAS server
:param code: code from the cell
:param silent:
:return: str with either the log or list
"""
... | 0.004564 |
def t_fold_end(self, t):
r'\n+\ *'
column = find_column(t)
indent = self.indent_stack[-1]
if column < indent:
rollback_lexpos(t)
if column <= indent:
t.lexer.pop_state()
t.type = 'B_FOLD_END'
if column > indent:
t.type = 'SC... | 0.005848 |
def role_assignment_path(cls, project, incident, role_assignment):
"""Return a fully-qualified role_assignment string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/roleAssignments/{role_assignment}",
project=project,
inciden... | 0.007772 |
def parse_info(wininfo_name, egginfo_name):
"""Extract metadata from filenames.
Extracts the 4 metadataitems needed (name, version, pyversion, arch) from
the installer filename and the name of the egg-info directory embedded in
the zipfile (if any).
The egginfo filename has the format::
... | 0.00172 |
def remote_file_size(self, remote_cmd="", remote_file=None):
"""Get the file size of the remote file."""
if remote_file is None:
if self.direction == "put":
remote_file = self.dest_file
elif self.direction == "get":
remote_file = self.source_file
... | 0.004926 |
def shift_right(self, times=1):
"""
Finds Location shifted right by 1
:rtype: Location
"""
try:
return Location(self._rank, self._file + times)
except IndexError as e:
raise IndexError(e) | 0.007692 |
def set_user_name(self, uid, name):
"""Set user name
:param uid: user number [1:16]
:param name: username (limit of 16bytes)
"""
data = [uid]
if len(name) > 16:
raise Exception('name must be less than or = 16 chars')
name = name.ljust(16, "\x00")
... | 0.004525 |
def _ParsePathSpecification(
self, knowledge_base, searcher, file_system, path_specification,
path_separator):
"""Parses a file system for a preprocessing attribute.
Args:
knowledge_base (KnowledgeBase): to fill with preprocessing information.
searcher (dfvfs.FileSystemSearcher): file s... | 0.004515 |
def original(self):
"""(:class:`Image`) The original image. It could be :const:`None`
if there are no stored images yet.
"""
images = self.query._original_images(**self.identity_map)
if images:
return images[0] | 0.007576 |
def get_xyz(self, list_of_names=None):
"""Get xyz coordinates for these electrodes
Parameters
----------
list_of_names : list of str
list of electrode names to use
Returns
-------
list of tuples of 3 floats (x, y, z)
list of xyz coordinat... | 0.003505 |
def save_state(self):
"""Store the options into the user's stored session info.
.. versionadded: 4.3.0
"""
settings = QtCore.QSettings()
settings.setValue(
'inasafe/useDefaultTemplates',
self.default_template_radio.isChecked())
settings.setValue(
... | 0.003781 |
def get_part_filenames(num_parts=None, start_num=0):
"""Get numbered PART.html filenames."""
if num_parts is None:
num_parts = get_num_part_files()
return ['PART{0}.html'.format(i) for i in range(start_num+1, num_parts+1)] | 0.004132 |
def from_xx(cls, xx):
"""
Create a new Language instance from a ISO639 string
:param xx: ISO639 as string
:return: Language instance with instance.xx() == xx if xx is valid else instance of UnknownLanguage
"""
xx = str(xx).lower()
if xx is 'unknown':
r... | 0.005566 |
def from_lab(l, a, b, alpha=1.0, wref=_DEFAULT_WREF):
"""Create a new instance based on the specifed CIE-LAB values.
Parameters:
:l:
The L component [0...100]
:a:
The a component [-1...1]
:b:
The a component [-1...1]
:alpha:
The color transparency [0...1]... | 0.004132 |
def is_filter_selected(self, selection_id, value):
"""
Compares whether the 'selection_id' parameter value saved in the
cookie is the same value as the "value" parameter.
:param selection_id: a string as a dashboard_cookie key.
:param value: The value to compare against the valu... | 0.004115 |
def sonify_clicks(audio, clicks, out_file, fs, offset=0):
"""Sonifies the estimated times into the output file.
Parameters
----------
audio: np.array
Audio samples of the input track.
clicks: np.array
Click positions in seconds.
out_file: str
Path to the output file.
... | 0.00084 |
def stop(name, call=None):
'''
Stop a node
'''
if call != 'action':
raise SaltCloudSystemExit(
'The stop action must be called with -a or --action.'
)
log.info('Stopping node %s', name)
instance_id = _get_node(name)['instanceId']
__utils__['cloud.fire_event'](
... | 0.001164 |
def apply_T6(word):
'''If a VVV-sequence contains a long vowel, there is a syllable boundary
between it and the third vowel, e.g. [kor.ke.aa], [yh.ti.öön], [ruu.an],
[mää.yt.te].'''
WORD = word
offset = 0
for vvv in vvv_sequences(WORD):
seq = vvv.group(2)
j = 2 if is_long(seq[:2... | 0.001828 |
def get_anki_phrases_english(limit=None):
""" Return all the English phrases in the Anki translation flashcards
>>> len(get_anki_phrases_english(limit=100)) > 700
True
"""
texts = set()
for lang in ANKI_LANGUAGES:
df = get_data(lang)
phrases = df.eng.str.strip().values
... | 0.004566 |
def diff(args):
"""
%prog diff afasta bfasta
print out whether the records in two fasta files are the same
"""
from jcvi.utils.table import banner
p = OptionParser(diff.__doc__)
p.add_option("--ignore_case", default=False, action="store_true",
help="ignore case when comparing s... | 0.007266 |
def check_pointers(parser, codedir=None, mfilter=None, recursive=False):
"""Checks the modules in the specified code parser to see if they
have common, but subtle, pointer bugs in:
1. subroutines with a parameter of intent(out) and user-derived type
must* set *all* members of that parameter or they w... | 0.005816 |
def parse_url_or_log(url, encoding='utf-8'):
'''Parse and return a URLInfo.
This function logs a warning if the URL cannot be parsed and returns
None.
'''
try:
url_info = URLInfo.parse(url, encoding=encoding)
except ValueError as error:
_logger.warning(__(
_('Unable ... | 0.002222 |
def deleteICM(uuid: str):
""" Deletes an ICM"""
_metadata = ICMMetadata.query.filter_by(id=uuid).first()
db.session.delete(_metadata)
db.session.commit()
return ("", 204) | 0.005263 |
def get_effective_course_roles_in_account(self, account_id):
"""
List all course roles available to an account, for the passed Canvas
account ID, including course roles inherited from parent accounts.
"""
course_roles = []
params = {"show_inherited": "1"}
for role... | 0.004008 |
def _extract_image(self, raw_image):
"""
Extract unequally-sized image bands.
Parameters
----------
raw_image : reference to openjpeg ImageType instance
The image structure initialized with image characteristics.
Returns
-------
list or ndarr... | 0.000913 |
def pods(namespace='default', **kwargs):
'''
Return a list of kubernetes pods defined in the namespace
CLI Examples::
salt '*' kubernetes.pods
salt '*' kubernetes.pods namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernetes.client.CoreV1Api()
... | 0.002398 |
def somethingFound(self,data,mode="phonefy"):
'''
Verifying if something was found. Note that this method needed to be rewritten as in Spoj we need to look for a text which APPEARS instead of looking for a text that does NOT appear.
:param data: Data where the self.notFo... | 0.014493 |
def is_profile_in_legacy_format(profile):
"""
Is a given profile JSON object in legacy format?
"""
if isinstance(profile, dict):
pass
elif isinstance(profile, (str, unicode)):
try:
profile = json.loads(profile)
except ValueError:
return False
else:... | 0.001205 |
def flatpages_link_list(request):
"""
Returns a HttpResponse whose content is a Javascript file representing a
list of links to flatpages.
"""
from django.contrib.flatpages.models import FlatPage
link_list = [(page.title, page.url) for page in FlatPage.objects.all()]
return render_to_link_li... | 0.003003 |
def set_effect(self, effect_name: str):
"""Sets the color change program of the light."""
try:
effect_index = self._light_effect_list.index(effect_name)
except ValueError:
LOG.error("Trying to set unknown light effect")
return False
return self.setVal... | 0.007752 |
def _get_genesplicer(data):
"""
This is a plugin for the Ensembl Variant Effect Predictor (VEP) that
runs GeneSplicer (https://ccb.jhu.edu/software/genesplicer/) to get splice site predictions.
https://github.com/Ensembl/VEP_plugins/blob/master/GeneSplicer.pm
"""
genesplicer_exec = os.path.real... | 0.01108 |
def get_service(name):
"""
Get the service descriptor for the given service name.
@see: L{start_service}, L{stop_service},
L{pause_service}, L{resume_service}
@type name: str
@param name: Service unique name. You can get this value from the
C{ServiceNam... | 0.007021 |
def stored_messages_archive(context, num_elements=10):
"""
Renders a list of archived messages for the current user
"""
if "user" in context:
user = context["user"]
if user.is_authenticated():
qs = MessageArchive.objects.select_related("message").filter(user=user)
... | 0.004684 |
def _do_analysis_cross_validation(self):
"""
Find the best model (fit) based on cross-valiation (leave one out)
"""
assert len(self.df) < 15, "Cross-validation is not implemented if your sample contains more than 15 datapoints"
# initialization: first model is the mean, but com... | 0.003447 |
def scrape_all_files(self):
"""
Generator that yields one by one the return value for self.read_dcm
for each file within this set
"""
try:
for dcmf in self.items:
yield self.read_dcm(dcmf)
except IOError as ioe:
raise IOError('Error... | 0.008152 |
def eparOptionFactory(master, statusBar, param, defaultParam,
doScroll, fieldWidths,
plugIn=None, editedCallbackObj=None,
helpCallbackObj=None, mainGuiObj=None,
defaultsVerb="Default", bg=None, indent=False,
fl... | 0.000822 |
def ReleaseProcessedFlow(self, flow_obj, cursor=None):
"""Releases a flow that the worker was processing to the database."""
update_query = """
UPDATE flows
LEFT OUTER JOIN (
SELECT client_id, flow_id, needs_processing
FROM flow_requests
WHERE
client_id = %(client_id)s AND
... | 0.000444 |
def _ensure_authed(self, ptype, message):
"""
Checks message type against current auth state.
If server mode, and auth has not succeeded, and the message is of a
post-auth type (channel open or global request) an appropriate error
response Message is crafted and returned to call... | 0.001186 |
def get_default_env(self):
"""
Vanilla Ansible local commands execute with an environment inherited
from WorkerProcess, we must emulate that.
"""
return dict_diff(
old=ansible_mitogen.process.MuxProcess.original_env,
new=os.environ,
) | 0.006536 |
def _get_path_to_jar(cls, coursier_cache_path, pants_jar_path_base, jar_path):
"""
Create the path to the jar that will live in .pants.d
:param coursier_cache_path: coursier cache location
:param pants_jar_path_base: location under pants workdir to store the hardlink to the coursier cache
:para... | 0.013978 |
def convertVectorColumnsToML(dataset, *cols):
"""
Converts vector columns in an input DataFrame from the
:py:class:`pyspark.mllib.linalg.Vector` type to the new
:py:class:`pyspark.ml.linalg.Vector` type under the `spark.ml`
package.
:param dataset:
input datase... | 0.001889 |
def function_call_action(self, text, loc, fun):
"""Code executed after recognising the whole function call"""
exshared.setpos(loc, text)
if DEBUG > 0:
print("FUN_CALL:",fun)
if DEBUG == 2: self.symtab.display()
if DEBUG > 2: return
#check number... | 0.010244 |
def get_cluster_config(
cluster_type,
cluster_name=None,
kafka_topology_base_path=None,
):
"""Return the cluster configuration.
Use the local cluster if cluster_name is not specified.
:param cluster_type: the type of the cluster
:type cluster_type: string
:param cluster_name: the name o... | 0.000836 |
def fetch_sender_txs(self):
"""
Fetch all sender txs via JSON-RPC,
and merge them into our block data.
Try backing off (up to 5 times) if we fail
to fetch transactions via JSONRPC
Return True on success
Raise on error
"""
# fetch remaini... | 0.008023 |
def field2pattern(self, field, **kwargs):
"""Return the dictionary of OpenAPI field attributes for a set of
:class:`Range <marshmallow.validators.Regexp>` validators.
:param Field field: A marshmallow field.
:rtype: dict
"""
regex_validators = (
v
... | 0.003555 |
def get_operations(self,
indices: Sequence[LogicalIndex],
qubits: Sequence[ops.Qid]
) -> ops.OP_TREE:
"""Gets the logical operations to apply to qubits.""" | 0.021552 |
def find_loader(self, fullname):
"""Try to find a loader for the specified module, or the namespace
package portions. Returns (loader, list-of-portions).
This method is deprecated. Use find_spec() instead.
"""
spec = self.find_spec(fullname)
if spec is None:
... | 0.004988 |
def _make_tensor_fixed(name, data_type, dims, vals, raw=False):
'''
Make a TensorProto with specified arguments. If raw is False, this
function will choose the corresponding proto field to store the
values based on data_type. If raw is True, use "raw_data" proto
field to store the values, and value... | 0.001161 |
def add_text_content_type(application, content_type, default_encoding,
dumps, loads):
"""
Add handler for a text content type.
:param tornado.web.Application application: the application to modify
:param str content_type: the content type to add
:param str default_encoding... | 0.001018 |
def reverse_lookup(self, state, path):
"""
Returns a chrome URL for a given path, given the current package depth
in an error bundle.
State may either be an error bundle or the actual package stack.
"""
# Make sure the path starts with a forward slash.
if not pa... | 0.000986 |
def order_delete(backend, kitchen, order_id):
"""
Delete one order or all orders in a kitchen
"""
use_kitchen = Backend.get_kitchen_name_soft(kitchen)
print use_kitchen
if use_kitchen is None and order_id is None:
raise click.ClickException('You must specify either a kitchen or an order_... | 0.007802 |
def get_im(self, force_update=False):
"""Get the influence map for the model, generating it if necessary.
Parameters
----------
force_update : bool
Whether to generate the influence map when the function is called.
If False, returns the previously generated influ... | 0.001518 |
def update_ticket(self, tid, tickets=None):
"""If the customer should be granted an electronic ticket as a result
of a successful payment, the merchant may (at any time) PUT ticket
information to this endpoint. There is an ordered list of tickets; the
merchant may PUT several times to up... | 0.001925 |
def search(query='', keywords=[], registry=None):
''' generator of objects returned by the search endpoint (both modules and
targets).
Query is a full-text search (description, name, keywords), keywords
search only the module/target description keywords lists.
If both parameters ar... | 0.001946 |
def _connect(self):
""" Returns an aggregator connection. """
with self._lock:
if self._aggregator:
try:
return self._pool_connect(self._aggregator)
except PoolConnectionException:
self._aggregator = None
if... | 0.002358 |
def num_columns(self):
"""Number of columns displayed."""
if self.term.is_a_tty:
return self.term.width // self.hint_width
return 1 | 0.011976 |
def create(self, username, **kwargs):
"""
Create a user in Keycloak
http://www.keycloak.org/docs-api/3.4/rest-api/index.html#_users_resource
:param str username:
:param object credentials: (optional)
:param str first_name: (optional)
:param str last_name: (optio... | 0.002286 |
def storage_accounts(self):
"""Instance depends on the API version:
* 2015-06-15: :class:`StorageAccountsOperations<azure.mgmt.storage.v2015_06_15.operations.StorageAccountsOperations>`
* 2016-01-01: :class:`StorageAccountsOperations<azure.mgmt.storage.v2016_01_01.operations.StorageAccoun... | 0.007877 |
def new_config_event(self):
"""Called by the event loop when new config is available.
"""
try:
self.on_set_config()
except Exception as ex:
self.logger.exception(ex)
raise StopIteration() | 0.007813 |
def visit_DictComp(self, node: ast.DictComp) -> Any:
"""Compile the dictionary comprehension as a function and call it."""
result = self._execute_comprehension(node=node)
for generator in node.generators:
self.visit(generator.iter)
self.recomputed_values[node] = result
... | 0.005935 |
def json_2_company(json_obj):
"""
transform JSON obj coming from Ariane to ariane_clip3 object
:param json_obj: the JSON obj coming from Ariane
:return: ariane_clip3 Company object
"""
LOGGER.debug("Company.json_2_company")
return Company(cmpid=json_obj['companyID... | 0.00346 |
def validate_properties(self):
"""Validates that the required properties for this Resource have been populated, and that all properties have
valid values.
:returns: True if all properties are valid
:rtype: bool
:raises TypeError: if any properties are invalid
"""
... | 0.006024 |
def execute(self):
"""
Execute all of the saved commands and return results.
"""
try:
for key, value in self._watched_keys.items():
if self.mock_redis.redis.get(self.mock_redis._encode(key)) != value:
raise WatchError("Watched variable chan... | 0.006993 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.