text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def new_type(cls, **kwargs) -> typing.Type:
"""Create a user defined type.
The new type will contain all attributes of the `cls` type passed in.
Any attribute's value can be overwritten using kwargs.
:param kwargs: Can include any attribute defined in
the provided user defined type.
"""
... | 0.002392 |
def update_status(self, id_number, new_value):
"""
Update a status name
:type id_number: int
:param id_number: status ID number
:type new_value: str
:param new_value: The new status name
:rtype: dict
:return: an empty dictionary
"""
data... | 0.004484 |
def _get_owner_cover_photo_upload_server(session, group_id, crop_x=0, crop_y=0, crop_x2=795, crop_y2=200):
"""
https://vk.com/dev/photos.getOwnerCoverPhotoUploadServer
"""
group_id = abs(group_id)
response = session.fetch("photos.getOwnerCoverPhotoUploadServer", group_id=group_id... | 0.009456 |
def _body(self, full_path, environ, file_like):
"""Return an iterator over the body of the response."""
magic = self._match_magic(full_path)
if magic is not None:
return [_encode(s, self.encoding) for s in magic.body(environ,
... | 0.004107 |
def url_to_attrs_dict(url, url_attr):
"""
Sanitize url dict as used in django-bootstrap3 settings.
"""
result = dict()
# If url is not a string, it should be a dict
if isinstance(url, six.string_types):
url_value = url
else:
try:
url_value = url["url"]
exc... | 0.002635 |
def interpret(self):
"""
Main interpreter loop.
"""
self.print_menu()
while True:
try:
event = input()
if event == 'q':
return
event = int(event)
event = self.model.events[event-1]
... | 0.004484 |
def __find_variant(self, value):
"""Find the messages.Variant type that describes this value.
Args:
value: The value whose variant type is being determined.
Returns:
The messages.Variant value that best describes value's type,
or None if it's a type we don't know ... | 0.001355 |
def get_trips(self, authentication_info, start, end):
"""Get trips for this device between start and end."""
import requests
if (authentication_info is None or
not authentication_info.is_valid()):
return []
data_url = "https://api.ritassist.nl/api/trips/GetTrips... | 0.005682 |
def set_flow_node_ref_list(self, value):
"""
Setter for 'flow_node_ref' field.
:param value - a new value of 'flow_node_ref' field. Must be a list of String objects (ID of referenced nodes).
"""
if value is None or not isinstance(value, list):
raise TypeError("FlowNod... | 0.006689 |
def InitPrivateKey(self):
"""Makes sure this client has a private key set.
It first tries to load an RSA key from the certificate.
If no certificate is found, or it is invalid, we make a new random RSA key,
and store it as our certificate.
Returns:
An RSA key - either from the certificate o... | 0.004057 |
def process_credentials_elements(cred_tree):
""" Receive an XML object with the credentials to run
a scan against a given target.
@param:
<credentials>
<credential type="up" service="ssh" port="22">
<username>scanuser</username>
<password>mypass</passwo... | 0.001347 |
def subtree_leaf_positions(subtree):
"""Return tree positions of all leaves of a subtree."""
relative_leaf_positions = subtree.treepositions('leaves')
subtree_root_pos = subtree.treeposition()
absolute_leaf_positions = []
for rel_leaf_pos in relative_leaf_positions:
absolute_leaf_positions.a... | 0.005076 |
def urban_lookup(word):
'''
Return a Urban Dictionary definition for a word or None if no result was
found.
'''
url = "http://api.urbandictionary.com/v0/define"
params = dict(term=word)
resp = requests.get(url, params=params)
resp.raise_for_status()
res = resp.json()
if not res['list']:
return
return res['... | 0.037901 |
def get_segment_summary_times(scienceFile, segmentName):
"""
This function will find the times for which the segment_summary is set
for the flag given by segmentName.
Parameters
-----------
scienceFile : SegFile
The segment file that we want to use to determine this.
segmentName : s... | 0.004032 |
def delete_maintenance_window(self, id, **kwargs): # noqa: E501
"""Delete a specific maintenance window # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete... | 0.002141 |
def present(name,
host='localhost',
password=None,
password_hash=None,
allow_passwordless=False,
unix_socket=False,
password_column=None,
**connection_args):
'''
Ensure that the named user is present with the specified propertie... | 0.000918 |
def version():
""" Print the current version and exit. """
from topydo.lib.Version import VERSION, LICENSE
print("topydo {}\n".format(VERSION))
print(LICENSE)
sys.exit(0) | 0.005263 |
def _scan_pages_for_same(self, progress_cb=_stub_progress):
"""! @brief Read the full page data to determine if it is unchanged.
When this function exits, the same flag will be set to either True or False for
every page. In addition, sectors that need at least one page programmed will h... | 0.009125 |
def _convert_filetime_to_timestamp(filetime):
"""
Windows returns times as 64-bit unsigned longs that are the number
of hundreds of nanoseconds since Jan 1 1601. This converts it to
a datetime object.
:param filetime:
A FILETIME struct object
:return:
An integer unix timestamp
... | 0.001613 |
def add_mount(self,
volume_mount):
"""
Args:
volume_mount (VolumeMount):
"""
self._add_mount(
name=volume_mount.name,
mount_path=volume_mount.mount_path,
sub_path=volume_mount.sub_path,
read_only=volume_mount.r... | 0.008876 |
def _display(self, layout):
"""launch layouts display"""
print(file=self.out)
TextWriter().format(layout, self.out) | 0.014388 |
def fit(self,
X,
vocab=None,
initial_embedding_dict=None,
fixed_initialization=None):
"""Run GloVe and return the new matrix.
Parameters
----------
X : array-like of shape = [n_words, n_words]
The square count matrix.
... | 0.003447 |
def _call(self, x, out=None):
"""Extend ``x`` from the subspace."""
if out is None:
out = self.range.zero()
else:
out.set_zero()
out[self.index] = x
return out | 0.008929 |
def delete(self, instance_id):
'''
Delete a server
'''
nt_ks = self.compute_conn
response = nt_ks.servers.delete(instance_id)
return True | 0.010811 |
def do_bugout(self, args):
"""bugout [ <logger> ] - remove a console logging handler from a logger"""
args = args.split()
if _debug: ConsoleCmd._debug("do_bugout %r", args)
# get the logger name and logger
if args:
loggerName = args[0]
if loggerName in l... | 0.003782 |
def utterances_from_tier(eafob: Eaf, tier_name: str) -> List[Utterance]:
""" Returns utterances found in the given Eaf object in the given tier."""
try:
speaker = eafob.tiers[tier_name][2]["PARTICIPANT"]
except KeyError:
speaker = None # We don't know the name of the speaker.
tier_utte... | 0.002157 |
def run_numerical_categorical_analysis(args, schema_list):
"""Makes the numerical and categorical analysis files.
Args:
args: the command line args
schema_list: python object of the schema json file.
Raises:
ValueError: if schema contains unknown column types.
"""
header = [column['name'] for co... | 0.011092 |
async def _notify_event_internal(self, conn_string, name, event):
"""Notify that an event has occured.
This method will send a notification and ensure that all callbacks
registered for it have completed by the time it returns. In
particular, if the callbacks are awaitable, this method ... | 0.003321 |
def restore_position(self):
"""
restore cursor and scroll position
"""
# restore text cursor position:
self.mark_set(tkinter.INSERT, self.old_text_pos)
# restore scroll position:
self.yview_moveto(self.old_first) | 0.007463 |
def OnInit(self):
"""Initialize by creating the split window with the tree"""
project = compass.CompassProjectParser(sys.argv[1]).parse()
frame = MyFrame(None, -1, 'wxCompass', project)
frame.Show(True)
self.SetTopWindow(frame)
return True | 0.006969 |
def load_env_file():
"""Adds environment variables defined in :any:`ENV_FILE` to os.environ.
Supports bash style comments and variable interpolation.
"""
if not os.path.exists(ENV_FILE):
return
for line in open(ENV_FILE, 'r'):
line = line.strip()
if not line:
... | 0.002928 |
def migrate(self, host, port, key, dest_db, timeout, *,
copy=False, replace=False):
"""Atomically transfer a key from a Redis instance to another one."""
if not isinstance(host, str):
raise TypeError("host argument must be str")
if not isinstance(timeout, int):
... | 0.003052 |
def get_volume(self):
"""Get the current volume."""
self.request(EP_GET_VOLUME)
return 0 if self.last_response is None else self.last_response.get('payload').get('volume') | 0.015385 |
def generate_credential(s):
'''basic_auth_header will return a base64 encoded header object to
:param username: the username
'''
if sys.version_info[0] >= 3:
s = bytes(s, 'utf-8')
credentials = base64.b64encode(s).decode('utf-8')
else:
credentials = base64.b64encode(s)
re... | 0.002976 |
def get_object(self, cont, obj, local_file=None, return_bin=False):
'''
Retrieve a file from Swift
'''
try:
if local_file is None and return_bin is False:
return False
headers, body = self.conn.get_object(cont, obj, resp_chunk_size=65536)
... | 0.004198 |
def iter(context, sequence, limit=10):
"""Iter to list all the jobs events."""
params = {'limit': limit,
'offset': 0}
uri = '%s/%s/%s' % (context.dci_cs_api, RESOURCE, sequence)
while True:
j = context.session.get(uri, params=params).json()
if len(j['jobs_events']):
... | 0.002212 |
def cmp_store_tlv_params(self, intf, tlv_data):
"""Compare and store the received TLV.
Compares the received TLV with stored TLV. Store the new TLV if it is
different.
"""
flag = False
attr_obj = self.get_attr_obj(intf)
remote_evb_mode = self.pub_lldp.get_remote_... | 0.001252 |
def paintEvent(self, event):
""" Reimplemented to paint the background panel.
"""
painter = QtGui.QStylePainter(self)
option = QtGui.QStyleOptionFrame()
option.initFrom(self)
painter.drawPrimitive(QtGui.QStyle.PE_PanelTipLabel, option)
painter.end()
super... | 0.005571 |
def cli(ctx, obj):
"""Show Alerta server and client versions."""
client = obj['client']
click.echo('alerta {}'.format(client.mgmt_status()['version']))
click.echo('alerta client {}'.format(client_version))
click.echo('requests {}'.format(requests_version))
click.echo('click {}'.format(click.__ve... | 0.002907 |
def open_url(absolute_or_relative_url):
"""
Loads a web page in the current browser session.
:param absolgenerateute_or_relative_url:
an absolute url to web page in case of config.base_url is not specified,
otherwise - relative url correspondingly
:Usage:
open_url('http://mydoma... | 0.004184 |
def enable_audio_video_cmd(param, enable):
"""Return command to enable/disable all audio/video streams."""
cmd = 'configManager.cgi?action=setConfig'
formats = [('Extra', 3), ('Main', 4)]
if param == 'Video':
formats.append(('Snap', 3))
for fmt, num in formats:
for i in range(num):
... | 0.002222 |
def convert_examples_to_features(examples, seq_length, tokenizer):
"""Loads a data file into a list of `InputFeature`s."""
features = []
for (ex_index, example) in enumerate(examples):
tokens_a = tokenizer.tokenize(example.text_a)
tokens_b = None
if example.text_b:
toke... | 0.003272 |
def clear(self):
''' Remove all content from the document but do not reset title.
Returns:
None
'''
self._push_all_models_freeze()
try:
while len(self._roots) > 0:
r = next(iter(self._roots))
self.remove_root(r)
fi... | 0.005435 |
def execute(helper, config, args):
"""
Swaps old and new URLs.
If old_environment was active, new_environment will become the active environment
"""
old_env_name = args.old_environment
new_env_name = args.new_environment
# swap C-Names
out("Assuming that {} is the currently active envir... | 0.008174 |
def _postrun(cls, span, obj, **kwargs):
""" Trigger to execute just before closing the span
:param opentracing.span.Span span: the SpanContext instance
:param Any obj: Object to use as context
:param dict kwargs: additional data
"""
span.set_tag("response.status_code", ... | 0.004545 |
def PowercycleNode(r, node, force=False):
"""
Powercycles a node.
@type node: string
@param node: Node name
@type force: bool
@param force: Whether to force the operation
@rtype: string
@return: job id
"""
query = {
"force": force,
}
return r.request("post", "/... | 0.002755 |
def discover_filename(label, scopes=None):
'''
Check the filesystem for the existence of a .plist file matching the job label.
Optionally specify one or more scopes to search (default all).
:param label: string
:param scope: tuple or list or oneOf(USER, USER_ADMIN, DAEMON_ADMIN, USER_OS, DAEMON_OS)... | 0.004601 |
def search_globs(path, patterns):
# type: (str, List[str]) -> bool
""" Test whether the given *path* contains any patterns in *patterns*
Args:
path (str):
A file path to test for matches.
patterns (list[str]):
A list of glob string patterns to test against. If *path*... | 0.000906 |
def recipients(messenger, addresses):
"""Structures recipients data.
:param str|unicode, MessageBase messenger: MessengerBase heir
:param list[str|unicode]|str|unicode addresses: recipients addresses or Django User
model heir instances (NOTE: if supported by a messenger)
:return: list of Recip... | 0.003766 |
def create_parser() -> FileAwareParser:
"""
Create a command line parser
:return: parser
"""
parser = FileAwareParser(description="Clear data from FHIR observation fact table", prog="removefacts",
use_defaults=False)
parser.add_argument("-ss", "--sourcesystem", metav... | 0.006763 |
def send(self, from_, to, subject, text='', html='', cc=[], bcc=[],
headers={}, attachments=[]):
"""
Send an email.
"""
if isinstance(to, string_types):
raise TypeError('"to" parameter must be enumerable')
if text == '' and html == '':
raise V... | 0.004027 |
def build_board_2048():
""" builds a 2048 starting board
Printing Grid
0 0 0 2
0 0 4 0
0 0 0 0
0 0 0 0
"""
grd = Grid(4,4, [2,4])
grd.new_tile()
grd.new_tile()
print(grd)
return grd | 0.014134 |
def F_(self, X):
"""
computes h()
:param X:
:return:
"""
if self._interpol:
if not hasattr(self, '_F_interp'):
if self._lookup:
x = self._x_lookup
F_x = self._f_lookup
else:
... | 0.005714 |
def dump(data, out, ac_parser=None, **options):
"""
Save 'data' to 'out'.
:param data: A mapping object may have configurations data to dump
:param out:
An output file path, a file, a file-like object, :class:`pathlib.Path`
object represents the file or a namedtuple 'anyconfig.globals.I... | 0.00125 |
def add_cert(self, cert):
"""
Adds a trusted certificate to this store.
Adding a certificate with this method adds this certificate as a
*trusted* certificate.
:param X509 cert: The certificate to add to this store.
:raises TypeError: If the certificate is not an :clas... | 0.001845 |
def run(self):
"""Execute the build command."""
module = self.distribution.ext_modules[0]
base_dir = os.path.dirname(__file__)
if base_dir:
os.chdir(base_dir)
exclusions = []
for define in self.define or []:
module.define_macros.append(define)
for library in self.libraries o... | 0.01328 |
def _set_host_table(self, v, load=False):
"""
Setter method for host_table, mapped from YANG variable /isis_state/host_table (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_host_table is considered as a private
method. Backends looking to populate this va... | 0.005609 |
def _collapse_subtree(self, name, recursive=True):
"""Collapse a sub-tree."""
oname = name
children = self._db[name]["children"]
data = self._db[name]["data"]
del_list = []
while (len(children) == 1) and (not data):
del_list.append(name)
name = chi... | 0.002973 |
def fetch_replace_restriction(self, ):
"""Fetch whether unloading is restricted
:returns: True, if unloading is restricted
:rtype: :class:`bool`
:raises: None
"""
inter = self.get_refobjinter()
restricted = self.status() is None
return restricted or inter... | 0.005525 |
def variability_prob(self, whiteness):
"""Use the probability of the spectral variability
to identify clouds over land.
Equation 15 (Zhu and Woodcock, 2012)
Parameters
----------
ndvi: ndarray
ndsi: ndarray
whiteness: ndarray
Output
------
... | 0.005164 |
def _batch_entry_run(self):
"""The inside of ``_batch_entry``'s infinite loop.
Separated out so it can be properly unit tested.
"""
time.sleep(self.secs_between_batches)
with self._batch_lock:
self.process_batches() | 0.007463 |
def _send_scp(self, x, y, p, *args, **kwargs):
"""Determine the best connection to use to send an SCP packet and use
it to transmit.
This internal version of the method is identical to send_scp except it
has positional arguments for x, y and p.
See the arguments for
:py... | 0.002315 |
async def on_command_error(self, context, exception):
"""|coro|
The default command error handler provided by the bot.
By default this prints to ``sys.stderr`` however it could be
overridden to have a different implementation.
This only fires if you do not specify any listener... | 0.004756 |
def _generate_examples(self, num_examples, data_path, label_path):
"""Generate MNIST examples as dicts.
Args:
num_examples (int): The number of example.
data_path (str): Path to the data files
label_path (str): Path to the labels
Yields:
Generator yielding the next examples
"""... | 0.003063 |
def stop_server( working_dir, clean=False, kill=False ):
"""
Stop the blockstackd server.
"""
timeout = 1.0
dead = False
for i in xrange(0, 5):
# try to kill the main supervisor
pid_file = get_pidfile_path(working_dir)
if not os.path.exists(pid_file):
dead =... | 0.007772 |
def get_conn(filename):
"""Returns new sqlite3.Connection object with _dict_factory() as row factory"""
conn = sqlite3.connect(filename)
conn.row_factory = _dict_factory
return conn | 0.00995 |
def _significand(self):
"""Return the significand of self, as a BigFloat.
If self is a nonzero finite number, return a BigFloat m
with the same precision as self, such that
0.5 <= m < 1. and
self = +/-m * 2**e
for some exponent e.
If self is zero, infinity... | 0.003521 |
def is_zh(ch):
"""return True if ch is Chinese character.
full-width puncts/latins are not counted in.
"""
x = ord(ch)
# CJK Radicals Supplement and Kangxi radicals
if 0x2e80 <= x <= 0x2fef:
return True
# CJK Unified Ideographs Extension A
elif 0x3400 <= x <= 0x4dbf:
retu... | 0.00161 |
def _port_postfix(self):
"""
Returns empty string for the default port and ':port' otherwise
"""
port = self.real_connection.port
default_port = {'https': 443, 'http': 80}[self._protocol]
return ':{}'.format(port) if port != default_port else '' | 0.006826 |
def to_float(s, default=0.0, allow_nan=False):
"""
Return input converted into a float. If failed, then return ``default``.
Note that, by default, ``allow_nan=False``, so ``to_float`` will not return
``nan``, ``inf``, or ``-inf``.
Examples::
>>> to_float('1.5')
1.5
>>> to_... | 0.001164 |
def unicode(self, b, encoding=None):
"""
Convert a byte string to unicode, using string_encoding and decode_errors.
Arguments:
b: a byte string.
encoding: the name of an encoding. Defaults to the string_encoding
attribute for this instance.
Raises:
... | 0.003559 |
def avail_sizes(call=None):
'''
Return a list of sizes available from the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function, or with the --list-sizes option'
)
compconn = get_conn(cl... | 0.00134 |
def plugins(cls, enabled=True):
"""
Returns the plugins for the given class.
:param enabled | <bool> || None
:return [<Plugin>, ..]
"""
cls.loadPlugins()
plugs = getattr(cls, '_%s__plugins' % cls.__name__, {}).values()
if enabled... | 0.009524 |
def plot_bargraph(
self,
rank="auto",
normalize="auto",
top_n="auto",
threshold="auto",
title=None,
xlabel=None,
ylabel=None,
tooltip=None,
return_chart=False,
haxis=None,
legend="auto",
label=None,
):
""... | 0.003903 |
def _sign_block(self, block):
""" The block should be complete and the final
signature from the publishing validator (this validator) needs to
be added.
"""
block_header = block.block_header
header_bytes = block_header.SerializeToString()
signature = self._identit... | 0.004914 |
def process_msg(self, msg):
"""Process messages from the event stream."""
jmsg = json.loads(msg)
msgtype = jmsg['MessageType']
msgdata = jmsg['Data']
_LOGGER.debug('New websocket message recieved of type: %s', msgtype)
if msgtype == 'Sessions':
self._sessions... | 0.0048 |
def cancel(self, campaign_id):
"""
Cancel a Regular or Plain-Text Campaign after you send, before all of
your recipients receive it. This feature is included with MailChimp
Pro.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
... | 0.006536 |
def get_network_by_id(self, net_id):
"""Return a network with that id or None."""
for elem in self.networks:
if elem.id == net_id:
return elem
return None | 0.009662 |
def is_subdomain(domain): # pragma: no cover
"""
Check if the given domain is a subdomain.
:param domain: The domain we are checking.
:type domain: str
:return: The subdomain state.
:rtype: bool
.. warning::
If an empty or a non-string :code:`domain` is given, we return :code:`No... | 0.002994 |
def mk_path_str(stmt,
with_prefixes=False,
prefix_onchange=False,
prefix_to_module=False,
resolve_top_prefix_to_module=False):
"""Returns the XPath path of the node.
with_prefixes indicates whether or not to prefix every node.
prefix_onchange ... | 0.001499 |
def run_preassembly(stmts_in, **kwargs):
"""Run preassembly on a list of statements.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to preassemble.
return_toplevel : Optional[bool]
If True, only the top-level statements are returned. If False,... | 0.000663 |
def _plt_gogrouped(self, goids, go2color_usr, **kws):
"""Plot grouped GO IDs."""
fout_img = self.get_outfile(kws['outfile'], goids)
sections = read_sections(kws['sections'], exclude_ungrouped=True)
# print ("KWWSSSSSSSS", kws)
# kws_plt = {k:v for k, v in kws.items if k in self.k... | 0.004633 |
def get_lib_ffi_resource(module_name, libpath, c_hdr):
'''
module_name-->str: module name to retrieve resource
libpath-->str: shared library filename with optional path
c_hdr-->str: C-style header definitions for functions to wrap
Returns-->(ffi, lib)
Use this method when you are loading a pack... | 0.001812 |
def get_amount_arrears_balance(self, billing_cycle):
"""Get the balance of to_account at the end of billing_cycle"""
return self.to_account.balance(
transaction__date__lt=billing_cycle.date_range.lower,
) | 0.008333 |
def __convertChannelMask(self, channelsArray):
"""convert channelsArray to bitmask format
Args:
channelsArray: channel array (i.e. [21, 22])
Returns:
bitmask format corresponding to a given channel array
"""
maskSet = 0
for eachChannel in channe... | 0.004684 |
def _generate_trials(self, unresolved_spec, output_path=""):
"""Generates Trial objects with the variant generation process.
Uses a fixed point iteration to resolve variants. All trials
should be able to be generated at once.
See also: `ray.tune.suggest.variant_generator`.
Yie... | 0.002004 |
def parse_operations(self):
"""
Flatten routes into a path -> method -> route structure
"""
resource_defs = {
getmeta(resources.Error).resource_name: resource_definition(resources.Error),
getmeta(resources.Listing).resource_name: resource_definition(resources.List... | 0.004082 |
def do_connected(self, args):
'''Find a connected component from positive labels on an item.'''
connected = self.label_store.connected_component(args.content_id)
for label in connected:
self.stdout.write('{0}\n'.format(label)) | 0.007634 |
def _merge_skyline(self, skylineq, segment):
"""
Arguments:
skylineq (collections.deque):
segment (HSegment):
"""
if len(skylineq) == 0:
skylineq.append(segment)
return
if skylineq[-1].top == segment.top:
s = skylineq[-... | 0.004515 |
def union(seq1=(), *seqs):
r"""Return the set union of `seq1` and `seqs`, duplicates removed, order random.
Examples:
>>> union()
[]
>>> union([1,2,3])
[1, 2, 3]
>>> union([1,2,3], {1:2, 5:1})
[1, 2, 3, 5]
>>> union((1,2,3), ['a'], "bcd")
['a', 1, 2, 3, 'd', 'b', 'c']
>>> un... | 0.005988 |
def intersect_keys(keys, reffile, cache=False, clean_accs=False):
"""Extract SeqRecords from the index by matching keys.
keys - an iterable of sequence identifiers/accessions to select
reffile - name of a FASTA file to extract the specified sequences from
cache - save an index of the reference FASTA se... | 0.000548 |
def response(self, model=None, code=HTTPStatus.OK, description=None, **kwargs):
"""
Endpoint response OpenAPI documentation decorator.
It automatically documents HTTPError%(code)d responses with relevant
schemas.
Arguments:
model (flask_marshmallow.Schema) - it can ... | 0.0015 |
def update_model(self, url, text):
""" Update prediction model with a page by given url and text content.
Return a list of item duplicates (for testing purposes).
"""
min_hash = get_min_hash(text, self.too_common_shingles, self.num_perm)
item_url = canonicalize_url(url)
i... | 0.000892 |
async def async_send(self, request, **kwargs):
"""Prepare and send request object according to configuration.
:param ClientRequest request: The request object to be sent.
:param dict headers: Any headers to add to the request.
:param content: Any body data to add to the request.
... | 0.003563 |
def set_mounted(unitname: str, mounted: bool, swallow_exc: bool = False):
""" Mount or unmount a unit.
Worker for the contextlibs
:param unitname: The systemd unit for the mount to affect. This probably
should be one of :py:attr:`_SYSROOT_INACTIVE_UNIT` or
:py:att... | 0.000803 |
def load_ndarray_file(nd_bytes):
"""Load ndarray file and return as list of numpy array.
Parameters
----------
nd_bytes : str or bytes
The internal ndarray bytes
Returns
-------
out : dict of str to numpy array or list of numpy array
The output list or dict, depending on wh... | 0.002716 |
def exit_with_error(self, error, **kwargs):
"""Report an error and exit.
This raises a SystemExit exception to ask the interpreter to quit.
Parameters
----------
error: string
The error to report before quitting.
"""
self.error(error, **kwargs)
... | 0.005764 |
def ToLatLng(self):
"""
Returns that latitude and longitude that this point represents
under a spherical Earth model.
"""
rad_lat = math.atan2(self.z, math.sqrt(self.x * self.x + self.y * self.y))
rad_lng = math.atan2(self.y, self.x)
return (rad_lat * 180.0 / math.pi, rad_lng * 180.0 / math.... | 0.003096 |
def fromsegwizard(file, coltype = int, strict = True):
"""
Read a segmentlist from the file object file containing a segwizard
compatible segment list. Parsing stops on the first line that
cannot be parsed (which is consumed). The segmentlist will be
created with segment whose boundaries are of type coltype, whi... | 0.027839 |
def nodes_on_wire(self, wire, only_ops=False):
"""
Iterator for nodes that affect a given wire
Args:
wire (tuple(Register, index)): the wire to be looked at.
only_ops (bool): True if only the ops nodes are wanted
otherwise all nodes are returned.
... | 0.003834 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.