text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def add_cluster_field(self, description):
''' Adds a field or a list of fields to the cluster result array. Has to be defined as a numpy dtype entry, e.g.: ('parameter', '<i4') '''
if isinstance(description, list):
for item in description:
if len(item) != 2:
... | 0.007246 |
def called_with(self, *args, **kwargs):
"""
Before evaluating subsequent predicates, calls :attr:`subject` with given arguments (but unlike a direct call,
catches and transforms any exceptions that arise during the call).
"""
self._args = args
self._kwargs = kwargs
... | 0.007772 |
def tokenize(self, untokenized_string: str, model=None):
"""Alias for tokenize_sentences()—NLTK's PlaintextCorpusReader needs a
function called tokenize in functions used as a parameter for sentence
tokenization.
:type untokenized_string: str
:param untokenized_string: A string ... | 0.003534 |
def uncomplete(self):
"""Mark the task uncomplete.
>>> from pytodoist import todoist
>>> user = todoist.login('john.doe@gmail.com', 'password')
>>> project = user.get_project('PyTodoist')
>>> task = project.add_task('Install PyTodoist')
>>> task.uncomplete()
"""
... | 0.003922 |
def typechecked(memb):
"""Decorator applicable to functions, methods, properties,
classes or modules (by explicit call).
If applied on a module, memb must be a module or a module name contained in sys.modules.
See pytypes.set_global_typechecked_decorator to apply this on all modules.
Asserts compati... | 0.004362 |
def name2unicode(name):
"""Converts Adobe glyph names to Unicode numbers."""
if name in glyphname2unicode:
return glyphname2unicode[name]
m = STRIP_NAME.search(name)
if not m:
raise KeyError(name)
return unichr(int(m.group(0))) | 0.003802 |
def sortInternals(self):
'''
Sort all internal lists (``class_like``, ``namespaces``, ``variables``, etc)
mostly how doxygen would, alphabetical but also hierarchical (e.g. structs
appear before classes in listings). Some internal lists are just sorted, and
some are deep sorted ... | 0.006012 |
def _buildArgs(f, self=None, kwargs={}):
"""
Get the default arguments from the function and assign as instance vars.
Return a list of 3-tuples with (name, description, defaultValue) for each
argument to the function.
Assigns all arguments to the function as instance variables of TMRegion.
If the argume... | 0.014807 |
def calculate_activation(self, datapoint):
"""
Only for a single datapoint
"""
activations = datapoint * self.dendrites
activations = self.nonlinearity(activations)
return activations.sum() | 0.004673 |
def db_wb020(self, value=None):
""" Corresponds to IDD Field `db_wb020`
mean coincident dry-bulb temperature to
Wet-bulb temperature corresponding to 2.0% annual cumulative frequency of occurrence
Args:
value (float): value for IDD Field `db_wb020`
Unit: C
... | 0.003623 |
def remember_order(self):
"""Verify that subsequent :func:`fudge.Fake.expects` are called in the right order.
For example::
>>> import fudge
>>> db = fudge.Fake('db').remember_order().expects('insert').expects('update')
>>> db.update()
Traceback (most re... | 0.005323 |
def get_cursor(cls):
"""Return a message list cursor that returns sqlite3.Row objects"""
db = SqliteConnection.get()
db.row_factory = sqlite3.Row
return db.cursor() | 0.010204 |
def decrypt_ascii(self, ascii_string, key=None, digest="hex"):
"""
Receive ascii string and return decrypted data.
Avaiable digests:
hex: Hexadecimal
base64: Base 64
hqx: hexbin4
"""
digests = {"hex": binascii.a2b_hex,
"base... | 0.003185 |
def get_innerclasses(self):
"""
sequence of JavaInnerClassInfo instances describing the inner
classes of this class definition
reference: http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.6
""" # noqa
buff = self.get_attribute("InnerClasses")
... | 0.004202 |
def scatter_group(ax, key, imask, adata, Y, projection='2d', size=3, alpha=None):
"""Scatter of group using representation of data Y.
"""
mask = adata.obs[key].cat.categories[imask] == adata.obs[key].values
color = adata.uns[key + '_colors'][imask]
if not isinstance(color[0], str):
from matp... | 0.003359 |
def download_experiment(self, experiment_id):
"""
download_experiment:
"""
req = self.query_records_no_auth('experiment',
query='download/'+experiment_id)
if req.status_code == 404:
print "Sorry, no experiment matching id #... | 0.001474 |
def serialize(self, o):
'''
Returns a safe serializable object that can be serialized into JSON.
@param o Python object to serialize
'''
if isinstance(o, (list, tuple)):
return [self.serialize(i) for i in o]
if isinstance(o, dict):
return {k: self... | 0.00381 |
def _rdf2dot_reduced(g, stream):
"""
A reduced dot graph.
Adapted from original source:
https://rdflib.readthedocs.io/en/stable/_modules/rdflib/tools/rdf2dot.html
"""
import cgi
import collections
import rdflib
from rdflib.tools.rdf2dot import LABEL_PROPERTIES, NODECOLOR
type... | 0.000625 |
def _create_set_property_msg(self, prop, cmd, val):
"""Create an extended message to set a property.
Create an extended message with:
cmd1: 0x2e
cmd2: 0x00
flags: Direct Extended
d1: group
d2: cmd
d3: val
d4 - d14: 0x00... | 0.001635 |
def _join_url(self, base, url, admin_forwarder=False):
"""
overrides `urlparse.urljoin` since it removes base url path
https://docs.python.org/2/library/urlparse.html#urlparse.urljoin
"""
if admin_forwarder:
return base + url
else:
return urljoin(b... | 0.006079 |
def query(self, dataset_key, query, query_type="sql", parameters=None):
"""Query an existing dataset
:param dataset_key: Dataset identifier, in the form of owner/id or of
a url
:type dataset_key: str
:param query: SQL or SPARQL query
:type query: str
:param q... | 0.000724 |
def do(cmdline, runas=None, env=None):
'''
Execute a ruby command with rbenv's shims from the user or the system
CLI Example:
.. code-block:: bash
salt '*' rbenv.do 'gem list bundler'
salt '*' rbenv.do 'gem list bundler' deploy
'''
if not cmdline:
# This is a positiona... | 0.001337 |
def check_publication_state(publication_id):
"""Check the publication's current state."""
with db_connect() as db_conn:
with db_conn.cursor() as cursor:
cursor.execute("""\
SELECT "state", "state_messages"
FROM publications
WHERE id = %s""", (publication_id,))
publication_state, ... | 0.002433 |
def add_scripts_to_package():
"""
Update the "scripts" parameter of the setup_arguments with any scripts
found in the "scripts" directory.
:return:
"""
global setup_arguments
if os.path.isdir('scripts'):
setup_arguments['scripts'] = [
os.path.join('scripts', f) for f in ... | 0.002849 |
def set(self, attribute, specification, exact=False):
"""Set the named attribute from the specification given by the user.
The value actually set may be different."""
assert isinstance(attribute, basestring)
assert isinstance(exact, (int, bool))
if __debug__ and not exact:
... | 0.00448 |
def split_args(line):
"""Version of shlex.split that silently accept incomplete strings.
Parameters
----------
line : str
The string to split
Returns
-------
[str]
The line split in separated arguments
"""
lex = shlex.shlex(line, posix=True)
lex.whitespace_split... | 0.001656 |
def shutit_method_scope(func):
"""Notifies the ShutIt object whenever we call a shutit module method.
This allows setting values for the 'scope' of a function.
"""
def wrapper(self, shutit):
"""Wrapper to call a shutit module method, notifying the ShutIt object.
"""
ret = func(self, shutit)
return ret
retu... | 0.030303 |
def _execFilters(self, type, msg):
""" Execute Registered Filters """
for filter in self.FILTERS:
msg = filter(type, msg)
return msg | 0.011905 |
def _parse_date_default_value(property_name, default_value_string):
"""Parse and return the default value for a date property."""
# OrientDB doesn't use ISO-8601 datetime format, so we have to parse it manually
# and then turn it into a python datetime object. strptime() will raise an exception
# if the... | 0.007547 |
def remove_line(self, section):
"""Base implementation just pops the item from collection.
Re-implements to add global behaviour
"""
self.beginResetModel()
self.collection.pop(section)
self.endResetModel() | 0.007905 |
def run(self, N=1):
'''Run the chain and store the history of visited points into
the member variable ``self.samples``. Returns the number of
accepted points during the run.
.. seealso::
:py:class:`pypmc.tools.History`
:param N:
An int which defines the... | 0.005952 |
def enable(self):
"""
Enables WinQuad setting
"""
nquad = self.nquad.value()
for label, xsll, xsul, xslr, xsur, ys, nx, ny in \
zip(self.label[:nquad], self.xsll[:nquad], self.xsul[:nquad],
self.xslr[:nquad], self.xsur[:nquad], self.ys[:nquad],... | 0.001949 |
def get_body(self, environ=None):
"""Get the request body."""
body = dict(
status=self.code,
message=self.get_description(environ),
)
if self.errors:
body['errors'] = self.errors
return json.dumps(body) | 0.007143 |
def gen_experiment_id(n=10):
"""Generate a random string with n characters.
Parameters
----------
n : int
The length of the string to be generated.
Returns
-------
:obj:`str`
A string with only alphabetic characters.
"""
chrs = 'abcdefghijklmnopqrstuvwxyz'
inds... | 0.007407 |
def format(self, fmt):
"""Returns string representing the items specified in the format string
The format string can contain:
.. code::
d - drive letter
p - path
n - name
x - extension
z - file size
t - file time in secon... | 0.005718 |
def validate_backup(configuration, backup_data):
"""Celery task.
It will extract the backup archive into a unique folder
in the temporary directory specified in the configuration.
Once extracted, a Docker container will be started and will
start a restoration procedure. The worker will wait for the... | 0.000805 |
def add_name_variant(self, name):
"""Add name variant.
Args:
:param name: name variant for the current author.
:type name: string
"""
self._ensure_field('name', {})
self.obj['name'].setdefault('name_variants', []).append(name) | 0.006873 |
def _eq__(self, other):
"""
Compare the current place object to another passed to the comparison
method. The two place objects must have the same identification, even
if some of their attributes might be different.
@param other: a ``Place`` instance to compare with the current ... | 0.003521 |
def get_relationship(self, attribute):
"""
Returns the domain relationship object for the given resource
attribute.
"""
rel = self.__relationships.get(attribute.entity_attr)
if rel is None:
rel = LazyDomainRelationship(self, attribute,
... | 0.007984 |
def _find_package(c):
"""
Try to find 'the' One True Package for this project.
Mostly for obtaining the ``_version`` file within it.
Uses the ``packaging.package`` config setting if defined. If not defined,
fallback is to look for a single top-level Python package (directory
containing ``__ini... | 0.000784 |
def update_release(self, release, project, release_id):
"""UpdateRelease.
[Preview API] Update a complete release object.
:param :class:`<Release> <azure.devops.v5_1.release.models.Release>` release: Release object for update.
:param str project: Project ID or project name
:param... | 0.005314 |
def density(G, t=None):
r"""Return the density of a graph at timestamp t.
The density for undirected graphs is
.. math::
d = \frac{2m}{n(n-1)},
and for directed graphs is
.. math::
d = \frac{m}{n(n-1)},
where `n` is the number of nodes and `m` is th... | 0.001988 |
def _disallow_state(self, state):
"""Disallow states that are not useful to continue simulating."""
disallow_methods = (self._is_duplicate_board,
self._is_impossible_by_count)
for disallow_method in disallow_methods:
if disallow_method(state):
... | 0.005618 |
def flushall(self, asynchronous=False):
"""
Delete all keys in all databases on the current host.
``asynchronous`` indicates whether the operation is
executed asynchronously by the server.
"""
args = []
if asynchronous:
args.append(Token.get_token('AS... | 0.005249 |
def new_device(device_json, abode):
"""Create new device object for the given type."""
type_tag = device_json.get('type_tag')
if not type_tag:
raise AbodeException((ERROR.UNABLE_TO_MAP_DEVICE))
generic_type = CONST.get_generic_type(type_tag.lower())
device_json['generic_type'] = generic_ty... | 0.000854 |
def analyze(self, scratch, **kwargs):
"""Run and return the results from the Animation plugin."""
results = Counter()
for script in self.iter_scripts(scratch):
gen = self.iter_blocks(script.blocks)
name = 'start'
level = None
while name != '':
... | 0.003527 |
def libvlc_audio_output_list_get(p_instance):
'''Gets the list of available audio output modules.
@param p_instance: libvlc instance.
@return: list of available audio outputs. It must be freed it with In case of error, NULL is returned.
'''
f = _Cfunctions.get('libvlc_audio_output_list_get', None) o... | 0.006342 |
def parse(readDataInstance):
"""
Returns a new L{TLSDirectory64} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object containing data to create a new L{TLSDirectory64} object.
@rtype: L{TLSDirectory64}
@return: A new ... | 0.007134 |
def record(self):
# type: () -> bytes
'''
A method to generate the string representing this Directory Record.
Parameters:
None.
Returns:
String representing this Directory Record.
'''
if not self._initialized:
raise pycdlibexception.... | 0.003621 |
def _keynat(string):
"""A natural sort helper function for sort() and sorted()
without using regular expression.
"""
r = []
for c in string:
if c.isdigit():
if r and isinstance(r[-1], int):
r[-1] = r[-1] * 10 + int(c)
else:
r.append(int... | 0.002604 |
def _decode_subelements(self):
"""Decode the stanza subelements."""
for child in self._element:
if child.tag == self._subject_tag:
self._subject = child.text
elif child.tag == self._body_tag:
self._body = child.text
elif child.tag == se... | 0.005305 |
def loads(self, src):
""" Compile css from scss string.
"""
assert isinstance(src, (unicode_, bytes_))
nodes = self.scan(src.strip())
self.parse(nodes)
return ''.join(map(str, nodes)) | 0.008658 |
def _pad(string, size):
"""
'Pad' a string with leading zeroes to fit the given size, truncating
if necessary.
"""
strlen = len(string)
if strlen == size:
return string
if strlen < size:
return _padding[0:size-strlen] + string
return string[-size:] | 0.003378 |
def to_raw_xml(source):
""" Convert various representations of an XML structure to a normal XML string.
Args:
source -- The source object to be converted - ET.Element, dict or string.
Returns:
A rew xml string matching the source object.
>>> to_raw_xml("<content/>")
... | 0.005081 |
def generated_key(key):
"""Create the proper generated key value"""
key_name = key['name']
if key['method'] == 'uuid':
LOG.debug("Setting %s to a uuid", key_name)
return str(uuid4())
elif key['method'] == 'words':
LOG.debug("Setting %s to random words", key_name)
return r... | 0.001414 |
def windowed_tajima_d(pos, ac, size=None, start=None, stop=None,
step=None, windows=None, min_sites=3):
"""Calculate the value of Tajima's D in windows over a single
chromosome/contig.
Parameters
----------
pos : array_like, int, shape (n_items,)
Variant positions, usi... | 0.000515 |
def is_virtual_environment(path):
"""Check if a given path is a virtual environment's root.
This is done by checking if the directory contains a Python executable in
its bin/Scripts directory. Not technically correct, but good enough for
general usage.
"""
if not path.is_dir():
return F... | 0.00152 |
def ensure_connectable(self, nailgun):
"""Ensures that a nailgun client is connectable or raises NailgunError."""
attempt_count = 1
while 1:
try:
with closing(nailgun.try_connect()) as sock:
logger.debug('Verified new ng server is connectable at {}'.format(sock.getpeername()))
... | 0.017341 |
def _set_dot1x(self, v, load=False):
"""
Setter method for dot1x, mapped from YANG variable /interface/tengigabitethernet/dot1x (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_dot1x is considered as a private
method. Backends looking to populate this vari... | 0.005429 |
def union(self, *dstreams):
"""
Create a unified DStream from multiple DStreams of the same
type and same slide duration.
"""
if not dstreams:
raise ValueError("should have at least one DStream to union")
if len(dstreams) == 1:
return dstreams[0]
... | 0.003236 |
def _set_auditpol_data(option, value):
'''
Helper function that updates the current applied settings to match what has
just been set in the audit.csv files. We're doing it this way instead of
running `gpupdate`
Args:
option (str): The name of the option to set
value (str): The value... | 0.001217 |
def run_list_error_summary(run_list, estimator_list, estimator_names,
n_simulate, **kwargs):
"""Wrapper which runs run_list_error_values then applies error_values
summary to the resulting dataframe. See the docstrings for those two
funcions for more details and for descriptions of... | 0.001148 |
def get_composition_admin_session_for_repository(self, repository_id=None):
"""Gets a composiiton administrative session for the given
repository.
arg: repository_id (osid.id.Id): the Id of the repository
return: (osid.repository.CompositionAdminSession) - a
Compositi... | 0.00207 |
def _wrap_results(result, dtype, fill_value=None):
""" wrap our results if needed """
if is_datetime64_dtype(dtype) or is_datetime64tz_dtype(dtype):
if fill_value is None:
# GH#24293
fill_value = iNaT
if not isinstance(result, np.ndarray):
tz = getattr(dtype,... | 0.000943 |
def create(self, name, description, **attrs):
"""
Create a new :class:`Project`
:param name: name of the :class:`Project`
:param description: description of the :class:`Project`
:param attrs: optional attributes for :class:`Project`
"""
attrs.update({'name': name... | 0.005013 |
def _maximization(X, posterior, force_weights=None):
"""Estimate new centers, weights, and concentrations from
Parameters
----------
posterior : array, [n_centers, n_examples]
The posterior matrix from the expectation step.
force_weights : None or array, [n_centers, ]
If None is pa... | 0.00049 |
def _find_name_version_sep(egg_info, canonical_name):
# type: (str, str) -> int
"""Find the separator's index based on the package's canonical name.
`egg_info` must be an egg info string for the given package, and
`canonical_name` must be the package's canonical name.
This function is needed since... | 0.000964 |
def basename(self):
'''Return the name of the file with the '.fasta' or 'fq.gz' etc
removed'''
return os.path.basename(self.read_file)[:-len(self._get_extension(self.read_file))] | 0.014851 |
def split_into_segments(data):
"""Slices JPEG meta data into a list from JPEG binary data.
"""
if data[0:2] != b"\xff\xd8":
raise InvalidImageDataError("Given data isn't JPEG.")
head = 2
segments = [b"\xff\xd8"]
while 1:
if data[head: head + 2] == b"\xff\xda":
segmen... | 0.001433 |
def p_Notifications(self, p):
"""Notifications : Notifications ',' Notification
| Notification"""
n = len(p)
if n == 4:
p[0] = ('Notifications', p[1][1] + [p[3]])
elif n == 2:
p[0] = ('Notifications', [p[1]]) | 0.00692 |
def isscan(self, key, *, match=None, count=None):
"""Incrementally iterate set elements using async for.
Usage example:
>>> async for val in redis.isscan(key, match='something*'):
... print('Matched:', val)
"""
return _ScanIter(lambda cur: self.sscan(key, cur,
... | 0.004566 |
def redo(self, *args):
"""Generate listing of images that user can save."""
if not self.gui_up:
return
mod_only = self.w.modified_only.get_state()
treedict = Bunch.caselessDict()
self.treeview.clear()
self.w.status.set_text('')
channel = self.fv.get_... | 0.001118 |
def get_vectors_loss(ops, docs, prediction, objective="L2"):
"""Compute a mean-squared error loss between the documents' vectors and
the prediction.
Note that this is ripe for customization! We could compute the vectors
in some other word, e.g. with an LSTM language model, or use some other
type of... | 0.001047 |
def get_wsgi_filter(self, name=None, defaults=None):
"""Reads the configuration soruce and finds and loads a WSGI filter
defined by the filter entry with the name ``name`` per the PasteDeploy
configuration format and loading mechanism.
:param name: The named WSGI filter to find, load an... | 0.002257 |
def get_log_form(self, *args, **kwargs):
"""Pass through to provider LogAdminSession.get_log_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.get_bin_form_for_update_template
# This method might be a bit sketchy. Time will tell.
if isin... | 0.003854 |
def _temporary_filenames(total):
"""Context manager to create temporary files and remove them after use."""
temp_files = [_get_temporary_filename('optimage-') for i in range(total)]
yield temp_files
for temp_file in temp_files:
try:
os.remove(temp_file)
except OSError:
... | 0.002212 |
def append(self, data, **keys):
"""
Append new rows to a table HDU
parameters
----------
data: ndarray or list of arrays
A numerical python array with fields (recarray) or a list of
arrays. Should have the same fields as the existing table. If only
... | 0.002941 |
def new(self, filename=None):
"""start a session an independent process"""
path = (self.exec_path,)
if self.exec_path.filetype() in ('py', 'pyw', 'pyz', self.FTYPE):
# get the absolute path to the python-executable
p = find_executable("python")
path = (p... | 0.003373 |
def _flow_check_handler_internal(self):
"""Periodic handler to check if installed flows are present.
This handler runs periodically to check if installed flows are present.
This function cannot detect and delete the stale flows, if present.
It requires more complexity to delete stale fl... | 0.001138 |
def sanitize_for_archive(url, headers, payload):
"""Sanitize payload of a HTTP request by removing the token information
before storing/retrieving archived items
:param: url: HTTP url request
:param: headers: HTTP headers request
:param: payload: HTTP payload request
:r... | 0.003413 |
def filter_somaticsniper(job, tumor_bam, somaticsniper_output, tumor_pileup, univ_options,
somaticsniper_options):
"""
Filter SomaticSniper calls.
:param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq
:param toil.fileStore.FileID somaticsniper_output: SomaticSniper outpu... | 0.004836 |
def __normalize_grades(self):
"""
Adjust the grades list.
If a grade has been set, set All to false
"""
if 'grades' in self and self['grades']['All'] is True:
for grade in self['grades']:
if grade != 'All' and self['grades'][grade] is True:
... | 0.005195 |
def _on_rpc_done(self, future):
"""Triggered whenever the underlying RPC terminates without recovery.
This is typically triggered from one of two threads: the background
consumer thread (when calling ``recv()`` produces a non-recoverable
error) or the grpc management thread (when cancel... | 0.003452 |
def extract(args):
"""
%prog extract gffile
--contigs: Extract particular contig(s) from the gff file. If multiple contigs are
involved, use "," to separate, e.g. "contig_12,contig_150"; or provide a file
with multiple contig IDs, one per line
--names: Process particular ID(s) from the gff file... | 0.00597 |
def abort(self, err):
"""Abort all of the control blocks in the queue."""
if _debug: IOQueue._debug("abort %r", err)
# send aborts to all of the members
try:
for iocb in self.queue:
iocb.ioQueue = None
iocb.abort(err)
# flush the ... | 0.006173 |
def __insert_branch(u, v, dfs_data):
"""Embeds a branch Bu(v) (as described on page 22 of the paper). Returns whether the embedding was successful."""
w = L1(v, dfs_data)
d_u = D(u, dfs_data)
d_w = D(w, dfs_data)
# Embed uw
successful = __embed_frond(u, w, dfs_data)
if not successful:
... | 0.006441 |
def update_probes(self, progress):
"""
update the probe tree
"""
new_values = self.read_probes.probes_values
probe_count = len(self.read_probes.probes)
if probe_count > self.tree_probes.topLevelItemCount():
# when run for the first time, there are no probes i... | 0.004241 |
def check_success(self, device_id, sent_cmd1, sent_cmd2):
"""Check if last command succeeded by checking buffer"""
device_id = device_id.upper()
self.logger.info('check_success: for device %s cmd1 %s cmd2 %s',
device_id, sent_cmd1, sent_cmd2)
sleep(2)
s... | 0.005519 |
def volume(self):
"""The volume of the unit cell
The actual definition of the volume depends on the number of active
directions:
* num_active == 0 -- always -1
* num_active == 1 -- length of the cell vector
* num_active == 2 -- surface of the parall... | 0.003764 |
def _write_avg_gradient(self)->None:
"Writes the average of the gradients to Tensorboard."
avg_gradient = sum(x.data.mean() for x in self.gradients)/len(self.gradients)
self._add_gradient_scalar('avg_gradient', scalar_value=avg_gradient) | 0.015326 |
def _isCompatible(self, other, reporter):
"""
This is the environment implementation of
:meth:`BaseGlyph.isCompatible`.
Subclasses may override this method.
"""
glyph1 = self
glyph2 = other
# contour count
if len(self.contours) != len(glyph2.conto... | 0.001673 |
def set_community_names(communities):
'''
Manage the SNMP accepted community names and their permissions.
.. note::
Settings managed by Group Policy will always take precedence over those
set using the SNMP interface. Therefore if this function finds Group
Policy settings it will ra... | 0.000909 |
def report_by_type_stats(sect, stats, _):
"""make a report of
* percentage of different types documented
* percentage of different types with a bad name
"""
# percentage of different types documented and/or with a bad name
nice_stats = {}
for node_type in ("module", "class", "method", "func... | 0.001265 |
def get_verse(self, v=1):
"""Get a specific verse."""
verse_count = len(self.verses)
if v - 1 < verse_count:
return self.verses[v - 1] | 0.011765 |
def match(string, patterns):
"""Given a string return true if it matches the supplied list of
patterns.
Parameters
----------
string : str
The string to be matched.
patterns : None or [pattern, ...]
The series of regular expressions to attempt to match.
"""
if patterns i... | 0.002242 |
def inHouseJoy(self):
""" Returns if the object is in its house of joy. """
house = self.house()
return props.object.houseJoy[self.obj.id] == house.id | 0.011494 |
def load_and_validate_keys(authorized_keys):
"""
Loads authorized_keys as taken by :any:`instance_create`,
:any:`disk_create` or :any:`rebuild`, and loads in any keys from any files
provided.
:param authorized_keys: A list of keys or paths to keys, or a single key
:returns: A list of raw keys
... | 0.003687 |
def parse(self, data: RawMessage) -> Message:
"""\
Parses a binary protobuf message into a Message object.
"""
try:
return self.receiver.parse(data)
except KeyError as err:
raise UnknownCommandError from err
except DecodeError as err:
r... | 0.00551 |
def token_load(self, line_number, tokens):
self.line_number = line_number
assert tokens[-1] == 0x00, "line code %s doesn't ends with \\x00: %s" % (
repr(tokens), repr(tokens[-1])
)
"""
NOTE: The BASIC interpreter changed REM shortcut and ELSE
internaly:
... | 0.005701 |
def tupled_argmax(a):
"""
Argmax that returns an index tuple. Note that `numpy.argmax` will return a
scalar index as if you had flattened the array.
Parameters
----------
a : array_like
Input array.
Returns
-------
index : tuple
Tuple of index, even if `a` is one-di... | 0.001451 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.