text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def getsourcelines(object):
"""Return a list of source lines and starting line number for an object.
The argument may be a module, class, method, function, traceback, frame,
or code object. The source code is returned as a list of the lines
corresponding to the object and the line number indicates whe... | 0.005119 |
def XMPP_display(self,*arg):
""" For XMPP Demo
輸出到 XMPP 之樣式。
"""
MA = ''
for i in arg:
MAs = '- MA%02s: %.2f %s(%s)\n' % (
unicode(i),
self.MA(i),
self.MAC(i),
unicode(self.MA_serial(i)[0])
)
MA = MA + MAs
vol = '- Volume: %s %s(%s)' % (
... | 0.004433 |
def as_completed(objects, count=None, timeout=None):
"""Wait for one or more waitable objects, yielding them as they become
ready.
This is the iterator/generator version of :func:`wait`.
"""
for obj in objects:
if not hasattr(obj, 'add_done_callback'):
raise TypeError('Expecting... | 0.001443 |
def reassign_log_entry_to_log(self, log_entry_id, from_log_id, to_log_id):
"""Moves a ``LogEntry`` from one ``Log`` to another.
Mappings to other ``Logs`` are unaffected.
arg: log_entry_id (osid.id.Id): the ``Id`` of the
``LogEntry``
arg: from_log_id (osid.id.Id):... | 0.002198 |
def _eta_from_phi(self):
"""Update `eta` using current `phi`."""
self.eta = scipy.ndarray(N_NT - 1, dtype='float')
etaprod = 1.0
for w in range(N_NT - 1):
self.eta[w] = 1.0 - self.phi[w] / etaprod
etaprod *= self.eta[w]
_checkParam('eta', self.eta, self.PA... | 0.005764 |
def after_install(options, home_dir):
# --- CUT here ---
"""
called after virtualenv was created and pip/setuptools installed.
Now we installed requirement libs/packages.
"""
if options.install_type==INST_PYPI:
requirements=NORMAL_INSTALLATION
elif options.install_type==INST_GIT:
... | 0.010616 |
def _adjustSectionAlignment(self, value, fileAlignment, sectionAlignment):
"""
Align a value to C{SectionAligment}.
@type value: int
@param value: The value to be aligned.
@type fileAlignment: int
@param fileAlignment: The value to be used as C{FileAlig... | 0.009202 |
def get_upcoming_events(self):
"""Retreives a list of Notification_Occurrence_Events that have not ended yet
:return: SoftLayer_Notification_Occurrence_Event
"""
mask = "mask[id, subject, startDate, endDate, statusCode, acknowledgedFlag, impactedResourceCount, updateCount]"
_fil... | 0.006748 |
def __search_files(self, files):
"""
Searches in given files.
:param files: Files.
:type files: list
"""
for file in files:
if self.__interrupt:
return
if not foundations.common.path_exists(file):
continue
... | 0.006361 |
def registration_success(self, stanza):
"""Handle registration success.
[client only]
Clean up registration stuff, change state to "registered" and initialize
authentication.
:Parameters:
- `stanza`: the stanza received.
:Types:
- `stanza`: `pyx... | 0.004621 |
def cmd_msg(self, args):
'''control behaviour of the module'''
if len(args) == 0:
print(self.usage())
txt = ' '.join(args)
self.master.mav.statustext_send(mavutil.mavlink.MAV_SEVERITY_NOTICE,
txt) | 0.007143 |
def backward(self, diff_x, influences, activations, **kwargs):
"""
Backward pass through the network, including update.
Parameters
----------
diff_x : numpy array
A matrix containing the differences between the input and neurons.
influences : numpy array
... | 0.001794 |
def resizeAllSections(header, sectionSize):
""" Sets all sections (columns or rows) of a header to the same section size.
:param header: a QHeaderView
:param sectionSize: the new size of the header section in pixels
"""
for idx in range(header.length()):
header.resizeSection(idx, se... | 0.006061 |
def get_cert_serial(cert_file):
'''
Get the serial number of a certificate file
cert_file
The certificate file to find the serial for
CLI Example:
.. code-block:: bash
salt '*' certutil.get_cert_serial <certificate name>
'''
cmd = "certutil.exe -silent -verify {0}".format... | 0.001698 |
def getyrdoy(date):
"""Return a tuple of year, day of year for a supplied datetime object."""
try:
doy = date.toordinal()-datetime(date.year,1,1).toordinal()+1
except AttributeError:
raise AttributeError("Must supply a pandas datetime object or " +
"equivalent")... | 0.008333 |
def add_text_item(self, collection_uri, name, metadata, text, title=None):
"""Add a new item to a collection containing a single
text document.
The full text of the text document is specified as the text
argument and will be stored with the same name as the
item and a .txt exten... | 0.004254 |
def subvolume_get_default(path):
'''
Get the default subvolume of the filesystem path
path
Mount point for the subvolume
CLI Example:
.. code-block:: bash
salt '*' btrfs.subvolume_get_default /var/volumes/tmp
'''
cmd = ['btrfs', 'subvolume', 'get-default', path]
res... | 0.001267 |
def _calc_snr(volume,
mask,
dilation=5,
reference_tr=None,
):
""" Calculate the the SNR of a volume
Calculates the Signal to Noise Ratio, the mean of brain voxels
divided by the standard deviation across non-brain voxels. Specify a TR
value to cal... | 0.000416 |
def copy_dir(bucket_name, src_path, dest_path,
aws_access_key_id=None, aws_secret_access_key=None,
aws_profile=None,
surrogate_key=None, cache_control=None,
surrogate_control=None,
create_directory_redirect_object=True):
"""Copy objects from one direc... | 0.000175 |
def plural(text):
"""
>>> plural('activity')
'activities'
"""
aberrant = {
'knife': 'knives',
'self': 'selves',
'elf': 'elves',
'life': 'lives',
'hoof': 'hooves',
'leaf': 'leaves',
'echo': 'echoes',
'embargo': 'embargoes',
... | 0.001206 |
def set(self, data, size):
"""
Set chunk data from user-supplied data; truncate if too large. Data may
be null. Returns actual size of chunk
"""
return lib.zchunk_set(self._as_parameter_, data, size) | 0.008658 |
def serialize(self, config):
"""
:param config:
:type config: yowsup.config.base.config.Config
:return:
:rtype: bytes
"""
for transform in self._transforms:
config = transform.transform(config)
return config | 0.007067 |
def convert(gr, raw_node):
"""
Convert raw node information to a Node or Leaf instance.
This is passed to the parser driver which calls it whenever a reduction of a
grammar rule produces a new complete node, so that the tree is build
strictly bottom-up.
"""
type, value, context, children = ... | 0.003086 |
def produce_csv_output(filehandle: TextIO,
fields: Sequence[str],
values: Iterable[str]) -> None:
"""
Produce CSV output, without using ``csv.writer``, so the log can be used
for lots of things.
- ... eh? What was I talking about?
- POOR; DEPRECATED.
... | 0.001931 |
def straight_line(title, length=100, linestyle="=", pad=0):
"""Return a fixed-length straight line with some text at the center.
Usage Example::
>>> StringTemplate.straight_line("Hello world!", 20, "-", 1)
--- Hello world! ---
"""
text = "{:%... | 0.009685 |
def delete_relay(self, relayid, data):
"""Delete relay settings"""
return self.api_call(
ENDPOINTS['relays']['delete'],
dict(relayid=relayid),
body=data) | 0.009756 |
def get_configured_hdfs_client():
"""
This is a helper that fetches the configuration value for 'client' in
the [hdfs] section. It will return the client that retains backwards
compatibility when 'client' isn't configured.
"""
config = hdfs()
custom = config.client
conf_usinf_snakebite =... | 0.001506 |
def remove_droplets(self, droplet_ids):
"""
Unassign a LoadBalancer.
Args:
droplet_ids (obj:`list` of `int`): A list of Droplet IDs
"""
return self.get_data(
"load_balancers/%s/droplets/" % self.id,
type=DELETE,
params={"droplet_id... | 0.00578 |
def _setup_cgroup_memory_limit(self, memlimit, cgroups, pid_to_kill):
"""Start memory-limit handler.
@return None or the memory-limit handler for calling cancel()
"""
if memlimit is not None:
try:
oomThread = oomhandler.KillProcessOnOomThread(
... | 0.004016 |
def api_key(value=None):
"""Set or get the API key.
Also set via environment variable GRAPHISTRY_API_KEY."""
if value is None:
return PyGraphistry._config['api_key']
# setter
if value is not PyGraphistry._config['api_key']:
PyGraphistry._config['api_key'... | 0.005155 |
def get_lb_conn(dd_driver=None):
'''
Return a load-balancer conn object
'''
vm_ = get_configured_provider()
region = config.get_cloud_config_value(
'region', vm_, __opts__
)
user_id = config.get_cloud_config_value(
'user_id', vm_, __opts__
)
key = config.get_cloud_co... | 0.003448 |
def mask_brain(volume,
template_name=None,
mask_threshold=None,
mask_self=True,
):
""" Mask the simulated volume
This creates a mask specifying the approximate likelihood that a voxel is
part of the brain. All values are bounded to the range of 0 t... | 0.000204 |
def set_data(self, data):
"""Set data."""
if data != self.editor.model.get_data():
self.editor.set_data(data)
self.editor.adjust_columns() | 0.010989 |
def calculate(seqnon, mapcol, nmask, tests):
""" groups together several numba compiled funcs """
## create empty matrices
#LOGGER.info("tests[0] %s", tests[0])
#LOGGER.info('seqnon[[tests[0]]] %s', seqnon[[tests[0]]])
mats = chunk_to_matrices(seqnon, mapcol, nmask)
## empty svdscores for each... | 0.008531 |
def register(id, url=None):
"""Register a UUID key in the global S3 bucket."""
bucket = registration_s3_bucket()
key = registration_key(id)
obj = bucket.Object(key)
obj.put(Body=url or "missing")
return _generate_s3_url(bucket, key) | 0.003906 |
def convert_multiPlanesRupture(self, node):
"""
Convert a multiPlanesRupture node.
:param node: the rupture node
"""
mag, rake, hypocenter = self.get_mag_rake_hypo(node)
with context(self.fname, node):
surfaces = list(node.getnodes('planarSurface'))
r... | 0.003759 |
def logout(self, request):
"Logs out user and redirects them to Nexus home"
from django.contrib.auth import logout
logout(request)
return HttpResponseRedirect(reverse('nexus:index', current_app=self.name)) | 0.012552 |
def send_event(self, name, *args, **kwargs):
""" Send an event to the native handler. This call is queued and
batched.
Parameters
----------
name : str
The event name to be processed by MainActivity.processMessages.
*args: args
The arguments requ... | 0.002804 |
def print_variables_info(self, output_file=sys.stdout):
"""Print variables information in human readble format."""
table = (' name | type size \n' +
'---------+-------------------------\n')
for name, var_info in list(self.variables.items()):
table +=... | 0.006593 |
def write_metadata(self, fp):
"""Adds data to the metadata that's written.
Parameters
----------
fp : pycbc.inference.io.BaseInferenceFile instance
The inference file to write to.
"""
super(BaseDataModel, self).write_metadata(fp)
fp.write_stilde(self.... | 0.006154 |
def unpack(self, source: IO):
"""
Read the Field from the file-like object `fio`.
.. note::
Advanced usage only. You will typically never need to call this
method as it will be called for you when loading a ClassFile.
:param source: Any file-like object providi... | 0.005859 |
def map_sections(fun, neurites, neurite_type=NeuriteType.all, iterator_type=Tree.ipreorder):
'''Map `fun` to all the sections in a collection of neurites'''
return map(fun, iter_sections(neurites,
iterator_type=iterator_type,
neurite_filter=is_... | 0.005882 |
def show(self):
"""Show the circuit expression in an IPython notebook."""
# noinspection PyPackageRequirements
from IPython.display import Image, display
fname = self.render()
display(Image(filename=fname)) | 0.008065 |
def start(self):
"""Start the consumer. This starts a listen loop on a zmq.PULL socket,
calling ``self.handle`` on each incoming request and pushing the response
on a zmq.PUSH socket back to the producer."""
if not self.initialized:
raise Exception("Consumer not initialized ... | 0.004027 |
def _write_file_network(data, filename):
'''
Writes a file to disk
'''
with salt.utils.files.fopen(filename, 'w') as fp_:
fp_.write(salt.utils.stringutils.to_str(data)) | 0.005208 |
def get_manager(self, osid=None, impl_class_name=None, version=None):
"""Finds, loads and instantiates providers of OSID managers.
Providers must conform to an OsidManager interface. The
interfaces are defined in the OSID enumeration. For all OSID
requests, an instance of ``OsidManager`... | 0.002707 |
def get_web_element(self, element):
"""Return the web element from a page element or its locator
:param element: either a WebElement, PageElement or element locator as a tuple (locator_type, locator_value)
:returns: WebElement object
"""
from toolium.pageelements.page_element im... | 0.00431 |
def _doClobber(self):
"""Remove the work directory"""
rc = yield self.runRmdir(self.workdir, timeout=self.timeout)
if rc != RC_SUCCESS:
raise RuntimeError("Failed to delete directory")
return rc | 0.008403 |
async def addreaction(self, ctx, *, reactor=""):
"""Interactively adds a custom reaction"""
if not reactor:
await self.bot.say("What should I react to?")
response = await self.bot.wait_for_message(author=ctx.message.author)
reactor = response.content
data = s... | 0.005461 |
def get_default_recipients(self):
''' Overrides EmailRecipientMixin '''
return [x.registration.customer.email for x in self.eventregistration_set.filter(cancelled=False)] | 0.016129 |
def wait_for_a_future(futures, print_traceback=False):
"""
Return the next future that completes. If a KeyboardInterrupt is
received, then the entire process is exited immediately. See
wait_for_all_futures for more notes.
"""
while True:
try:
future = next(concurrent.future... | 0.00304 |
def build_image_path(self, src):
"""\
This method will take an image path and build
out the absolute path to that image
* using the initial url we crawled
so we can find a link to the image
if they use relative urls like ../myimage.jpg
"""
o = urlparse... | 0.004032 |
def get_list(self, terms, limit=0, sort=False, ranks=None):
"""
Get the specified cards from the stack.
:arg term:
The search term. Can be a card full name, value, suit,
abbreviation, or stack indice.
:arg int limit:
The number of items to retrieve fo... | 0.004819 |
def send_response(self, transaction):
"""
Handles the Blocks option in a outgoing response.
:type transaction: Transaction
:param transaction: the transaction that owns the response
:rtype : Transaction
:return: the edited transaction
"""
host, port = tra... | 0.003708 |
async def change_url(self, url: str, description: str = None):
""" change the url of that attachment
|methcoro|
Args:
url: url you want to change
description: *optional* description for your attachment
Raises:
ValueError: url must not be None
... | 0.004854 |
def _disconnected(self, uri):
"""Disconnected callback from Crazyflie API"""
self.param_updater.close()
self.is_updated = False
# Clear all values from the previous Crazyflie
self.toc = Toc()
self.values = {} | 0.007813 |
def hup_hook(signal_or_callable=signal.SIGTERM, verbose=False):
"""
Register a signal handler for `signal.SIGHUP` that checks for modified
files and only acts if at least one modified file is found.
@type signal_or_callable: str, int or callable
@param signal_or_callable: You can pass either a sign... | 0.003418 |
def read_reference_resource_list(self, ref_sitemap, name='reference'):
"""Read reference resource list and return the ResourceList object.
The name parameter is used just in output messages to say what type
of resource list is being read.
"""
rl = ResourceList()
self.log... | 0.00153 |
def _conditional(Xnew, feat, kern, f, *, full_cov=False, full_output_cov=False, q_sqrt=None, white=False):
"""
Multi-output GP with fully correlated inducing variables.
The inducing variables are shaped in the same way as evaluations of K, to allow a default
inducing point scheme for multi-output kernel... | 0.005332 |
def dense_dropconnect(inputs,
output_size,
dropconnect_dropout=0.0,
name="dense_dropconnect",
**kwargs):
"""Dense layer with dropconnect."""
if dropconnect_dropout != 0.0:
tf.logging.info("Applying dropconnect as the kernel... | 0.007619 |
def duplicate(cls, other):
"""Create a copy of the layer."""
return cls(other.soil_type, other.thickness, other.shear_vel) | 0.014493 |
def get_level_fmt(self, level):
"""Get format for log level."""
key = None
if level == logging.DEBUG:
key = 'debug'
elif level == logging.INFO:
key = 'info'
elif level == logging.WARNING:
key = 'warning'
elif level == logging.ERROR:
... | 0.004338 |
def create_sequences(colors, vte_fix=False):
"""Create the escape sequences."""
alpha = colors["alpha"]
# Colors 0-15.
sequences = [set_color(index, colors["colors"]["color%s" % index])
for index in range(16)]
# Special colors.
# Source: https://goo.gl/KcoQgP
# 10 = foregr... | 0.000829 |
def calculate_size(name, expected, updated):
""" Calculates the request payload size"""
data_size = 0
data_size += calculate_size_str(name)
data_size += LONG_SIZE_IN_BYTES
data_size += LONG_SIZE_IN_BYTES
return data_size | 0.004098 |
def mass_inform(self, msg):
"""Send an inform message to all clients.
Parameters
----------
msg : Message object
The inform message to send.
"""
assert (msg.mtype == Message.INFORM)
self._server.mass_send_message_from_thread(msg) | 0.006689 |
def download(self, chunk_size=1024):
"""Download attachment
Args:
chunk_size (int): Byte-size of chunked download request stream
Returns:
BytesIO: Stream ready for reading containing the attachment file contents
"""
stream = BytesIO()
response =... | 0.005068 |
def catch_exceptions(*exceptions):
"""Catch all exceptions provided as arguments, and raise CloudApiException instead."""
def wrap(fn):
@functools.wraps(fn)
def wrapped_f(*args, **kwargs):
try:
return fn(*args, **kwargs)
except exceptions:
... | 0.004342 |
def from_json(self, data, deref=False):
"""Decode the string from JSON to return the original object (if
`deref` is true. Uses the `json.loads` function with `self.decode`
as object_hook.
:param data:
JSON encoded string.
:type data: str
:param deref:
... | 0.004246 |
def fraction_correct_fuzzy_linear_create_vector(z, z_cutoff, z_fuzzy_range):
'''A helper function for fraction_correct_fuzzy_linear.'''
assert(z_fuzzy_range * 2 < z_cutoff)
if (z == None or numpy.isnan(z)): # todo: and ignore_null_values: # If we are missing values then we either discount the case or consi... | 0.008296 |
def is_new_namespace_preorder( self, namespace_id_hash, lastblock=None ):
"""
Given a namespace preorder hash, determine whether or not is is unseen before.
"""
if lastblock is None:
lastblock = self.lastblock
preorder = namedb_get_namespace_preorder( self.db, names... | 0.022624 |
def remove_page(self, route):
"""Remove a proxied page from the Web UI.
Parameters
----------
route : str
The route for the proxied page. Must be a valid path *segment* in a
url (e.g. ``foo`` in ``/foo/bar/baz``). Routes must be unique
across the appl... | 0.004556 |
def get_cached_moderated_reddits(self):
"""Return a cached dictionary of the user's moderated reddits.
This list is used internally. Consider using the `get_my_moderation`
function instead.
"""
if self._mod_subs is None:
self._mod_subs = {'mod': self.reddit_session.... | 0.003922 |
def do_execute(self):
"""
The actual execution of the actor.
:return: None if successful, otherwise error message
:rtype: str
"""
result = None
cont = self.input.payload
serialization.write_all(
str(self.resolve_option("output")),
... | 0.005025 |
def _transform_list_args(self, args):
# type: (dict) -> None
"""Transforms all list arguments from json-server to model-resource ones.
This modifies the given arguments.
"""
if '_limit' in args:
args['limit'] = int(args['_limit'])
del args['_limit']
... | 0.003328 |
def to_dict(self, remove_nones=False):
"""Return the dict representation of the instance.
Args:
remove_nones (bool, optional): Optionally remove dictionary
elements when their value is `None`.
Returns:
dict: a dict representation of the `DidlObject`.
... | 0.001791 |
def load_file(self, filename):
"""Load config from a YAML file."""
filename = os.path.abspath(filename)
with open(filename) as f:
self.load_dict(yaml.load(f))
self._loaded_files.append(filename) | 0.008333 |
def query_phenomizer(usr, pwd, *hpo_terms):
"""
Query the phenomizer web tool
Arguments:
usr (str): A username for phenomizer
pwd (str): A password for phenomizer
hpo_terms (list): A list with hpo terms
Returns:
raw_answer : The raw result from phenomizer
"... | 0.014891 |
def getConnectorStats(self):
"""Return dictionary of Connector Stats for Apache Tomcat Server.
@return: Nested dictionary of Connector Stats.
"""
if self._statusxml is None:
self.initStats()
connnodes = self._statusxml.findall('connector')
co... | 0.004373 |
def list_all_files(i):
"""
Input: {
path - top level path
(file_name) - search for a specific file name
(pattern) - return only files with this pattern
(path_ext) - path extension (needed for recursion)
... | 0.029815 |
def read_interactions(path, comments="#", directed=False, delimiter=None,
nodetype=None, timestamptype=None, encoding='utf-8', keys=False):
"""Read a DyNetx graph from interaction list format.
Parameters
----------
path : basestring
The desired output filenam... | 0.00813 |
def get_signed_url(self, params):
'''Returns a Premier account signed url.'''
params['client'] = self.client_id
url_params = {'protocol': self.protocol, 'domain': self.domain,
'service': self.service, 'params': urlencode(params)}
secret = base... | 0.004132 |
def enhance_function_signatures(spec_dict: Mapping[str, Any]) -> Mapping[str, Any]:
"""Enhance function signatures
Add required and optional objects to signatures objects for semantic validation
support.
Args:
spec_dict (Mapping[str, Any]): bel specification dictionary
Returns:
Ma... | 0.002831 |
def Sample(self, task, status):
"""Takes a sample of the status of a task for profiling.
Args:
task (Task): a task.
status (str): status.
"""
sample_time = time.time()
sample = '{0:f}\t{1:s}\t{2:s}\n'.format(
sample_time, task.identifier, status)
self._WritesString(sample) | 0.003145 |
def smart_search_prefix(self, auth, query_str, search_options=None, extra_query=None):
""" Perform a smart search on prefix list.
* `auth` [BaseAuth]
AAA options.
* `query_str` [string]
Search string
* `search_options` [options_dict]
... | 0.002429 |
def _seconds_to_section_split(record, sections):
"""
Finds the seconds to the next section from the datetime of a record.
"""
next_section = sections[
bisect_right(sections, _find_weektime(record.datetime))] * 60
return next_section - _find_weektime(record.datetime, time_type='sec') | 0.003205 |
def extract_jtl_string_pairs_from_text_file(results_dict, file_path):
""" Extracts all string pairs matching the JTL pattern from given text file.
This can be used as an "extract_func" argument in the extract_string_pairs_in_directory method.
Args:
results_dict (dict): The dict to add the the stri... | 0.006472 |
def natsort_key(s, number_type=int, signed=False, exp=False):
"""\
Key to sort strings and numbers naturally, not lexicographically.
It also has basic support for version numbers.
For use in passing to the :py:func:`sorted` builtin or
:py:meth:`sort` attribute of lists.
Use natsort_key just lik... | 0.002365 |
def create_schema(host):
"""
Create exchanges, queues and route them.
Args:
host (str): One of the possible hosts.
"""
connection = create_blocking_connection(host)
channel = connection.channel()
exchange = settings.get_amqp_settings()[host]["exchange"]
channel.exchange_declare... | 0.000861 |
def email(self, to, msg):
"""
Quickly send an email from a default address. Calls :py:meth:`gmail_email`.
* *stored credential name: GMAIL_EMAIL*
:param string to: The email address to send the email to.
:param msg: The content of the email. See :py:meth:`gmail_... | 0.013129 |
def _compute_fixed_point_ig(T, v, max_iter, verbose, print_skip, is_approx_fp,
*args, **kwargs):
"""
Implement the imitation game algorithm by McLennan and Tourky (2006)
for computing an approximate fixed point of `T`.
Parameters
----------
is_approx_fp : callable
... | 0.000234 |
def split_call(lines, open_paren_line=0):
"""Returns a 2-tuple where the first element is the list of lines from the
first open paren in lines to the matching closed paren. The second element
is all remaining lines in a list."""
num_open = 0
num_closed = 0
for i, line in enumerate(lines):
... | 0.005181 |
def local_bifurcation_angles(neurites, neurite_type=NeuriteType.all):
'''Get a list of local bifurcation angles in a collection of neurites'''
return map_sections(_bifurcationfunc.local_bifurcation_angle,
neurites,
neurite_type=neurite_type,
... | 0.002778 |
def setMaximum(self, maximum):
"""setter to _maximum.
Args:
maximum (int or long): new _maximum value
"""
if not isinstance(maximum, int):
raise TypeError("Argument is not of type int or long")
self._maximum = maximum | 0.007092 |
def empty(cls):
"""
Returns an empty set. An empty set is unbounded and only contain the
empty set.
>>> intrange.empty() in intrange.empty()
True
It is unbounded but the boundaries are not infinite. Its boundaries are
returned as ``None``. Every set cont... | 0.004464 |
def remover(self, id_tipo_acesso):
"""Removes access type by its identifier.
:param id_tipo_acesso: Access type identifier.
:return: None
:raise TipoAcessoError: Access type associated with equipment, cannot be removed.
:raise InvalidParameterError: Protocol value is invalid o... | 0.003476 |
def add_to_group(self, group_path):
"""Add a device to a group, if the group doesn't exist it is created
:param group_path: Path or "name" of the group
"""
if self.get_group_path() != group_path:
post_data = ADD_GROUP_TEMPLATE.format(connectware_id=self.get_connectware_id()... | 0.00578 |
def next(self):
"""Move to the next token in the token stream."""
self.current_token = next(self.token_stream, None)
if self.current_token is None:
self.token_span = self.token_span[1], self.token_span[1]
raise self.error('Unexpected end of input')
self.token_span... | 0.005464 |
def CODECOPY(self, mem_offset, code_offset, size):
"""Copy code running in current environment to memory"""
self._allocate(mem_offset, size)
GCOPY = 3 # cost to copy one 32 byte word
copyfee = self.safe_mul(GCOPY, Operators.UDIV(self.safe_add(size, 31), 32))
self._co... | 0.003888 |
def setUserKeyCredentials(self, username, public_key=None, private_key=None):
"""Set these properties in ``disk.0.os.credentials``."""
self.setCredentialValues(username=username, public_key=public_key, private_key=private_key) | 0.012346 |
def get_field_class(qs, field_name):
"""
Given a queryset and a field name, it will return the field's class
"""
try:
return qs.model._meta.get_field(field_name).__class__.__name__
# while annotating, it's possible that field does not exists.
except FieldDoesNotExist:
return None | 0.003125 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.