text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def smart_unicode(string, encoding='utf-8', strings_only=False, errors='strict'):
"""
Returns a unicode object representing 's'. Treats bytestrings using the
'encoding' codec.
If strings_only is True, don't convert (some) non-string-like objects.
"""
# if isinstance(s, Promise):
# # The... | 0.004444 |
def set_proxy(self, proxy_account, account=None, **kwargs):
""" Set a specific proxy for account
:param bitshares.account.Account proxy_account: Account to be
proxied
:param str account: (optional) the account to allow access
to (defaults to ``default... | 0.001757 |
def password_input(*args, **kwargs):
'''
Get a password
'''
password_input = wtforms.PasswordField(*args, **kwargs)
password_input.input_type = 'password'
return password_input | 0.005 |
def matches(self, *args, **kwargs):
"""Test if a request matches a :ref:`message spec <message spec>`.
Returns ``True`` or ``False``.
"""
request = make_prototype_request(*args, **kwargs)
if self._prototype.opcode not in (None, request.opcode):
return False
i... | 0.00278 |
def namespace_lower(self, namespace):
"""
Return a copy with only the keys from a given namespace, lower-cased.
The keys in the returned dict will be transformed to lower case after
filtering, so they can be easily passed as keyword arguments to other
functions. This is just syn... | 0.001947 |
def _update_event(self, event_index, event_state, event_type, event_value,
proc_list, proc_desc, peak_time):
"""Update an event in the list"""
if event_state == "OK" or event_state == "CAREFUL":
# Reset the automatic process sort key
self.reset_process_sort(... | 0.003623 |
def highlight(self, **kwargs):
"""
kwargs:
style: css
highlight_time: int; default: .3
"""
self.debug_log("Highlighting element")
style = kwargs.get('style')
highlight_time = kwargs.get('highlight_time', .3)
driver = self._el... | 0.001963 |
def _move_group_helper(self, group):
"""A helper to move the chidren of a group."""
for i in group.children:
self.groups.remove(i)
i.level = group.level + 1
self.groups.insert(self.groups.index(group) + 1, i)
if i.children:
self._move_grou... | 0.006042 |
def profileit(path=None):
"""cProfile decorator to profile a function
:param path: output file path
:type path: str
:return: Function
"""
def inner(func):
@wraps(func)
def wrapper(*args, **kwargs):
prof = cProfile.Profile()
retval = prof.runcall(func, *a... | 0.001692 |
def unfinished_objects(self):
'''
Leaves only versions of those objects that has some version with
`_end == None` or with `_end > right cutoff`.
'''
mask = self._end_isnull
if self._rbound is not None:
mask = mask | (self._end > self._rbound)
oids = se... | 0.00489 |
def tag_and_stem(text):
"""
Returns a list of (stem, tag, token) triples:
- stem: the word's uninflected form
- tag: the word's part of speech
- token: the original word, so we can reconstruct it later
"""
tokens = tokenize(text)
tagged = nltk.pos_tag(tokens)
out = []
for token,... | 0.002336 |
def get_from_ident(self, ident):
"""
Take a string as returned by get_ident and return a job,
based on the class representation and the job's pk from the ident
"""
model_repr, job_pk = ident.split(':', 1)
klass = import_class(model_repr)
return klass.get(job_pk) | 0.006289 |
def split(self, delimiter=None):
"""Same as string.split(), but retains literal/expandable structure.
Returns:
List of `EscapedString`.
"""
result = []
strings = self.strings[:]
current = None
while strings:
is_literal, value = strings[0]... | 0.002 |
def index(self, index, field, value):
"Search for records matching a value in an index service"
params = {
"q": value,
# search index has '_' instead of '-' in field names ..
"q.options": "{fields:['%s']}" % (field.replace('-', '_'))
}
response = self... | 0.003333 |
def start(self):
"""Indicate that we are performing work in a thread.
:returns: multiprocessing job object
"""
if self.run is True:
self.job = multiprocessing.Process(target=self.indicator)
self.job.start()
return self.job | 0.006849 |
def to_redshift(self, name, df, drop_if_exists=False, chunk_size=10000,
AWS_ACCESS_KEY=None, AWS_SECRET_KEY=None, s3=None,
print_sql=False, bucket_location=None, s3_bucket=None):
"""
Upload a dataframe to redshift via s3.
Parameters
----------
... | 0.002758 |
def _update_table(data):
"""Add new jobs to the priority table and update the build system if required.
data - it is a list of dictionaries that describe a job type
returns the number of new, failed and updated jobs
"""
jp_index, priority, expiration_date = _initialize_values()
total_jobs = le... | 0.003603 |
def _query(self, sql, *args):
""" Executes the specified `sql` query and returns the cursor """
if not self._con:
logger.debug(("Open MBTiles file '%s'") % self.filename)
self._con = sqlite3.connect(self.filename)
self._cur = self._con.cursor()
sql = ' '.join(sql.split())... | 0.024834 |
def delete(self, article_attachment):
"""
This function completely wipes attachment from Zendesk Helpdesk article.
:param article_attachment: :class:`ArticleAttachment` object or numeric article attachment id.
:return: status_code == 204 on success
"""
return HelpdeskAtt... | 0.012853 |
def register(class_=None, **kwargs):
"""Registers a dataset with segment specific hyperparameters.
When passing keyword arguments to `register`, they are checked to be valid
keyword arguments for the registered Dataset class constructor and are
saved in the registry. Registered keyword arguments can be... | 0.000816 |
def get_as_html(self) -> str:
"""
Returns the table object as an HTML string.
:return: HTML representation of the table.
"""
table_string = self._get_pretty_table().get_html_string()
title = ('{:^' + str(len(table_string.splitlines()[0])) + '}').format(self.title)
... | 0.007916 |
def logoPNG(symbol, token='', version=''):
'''This is a helper function, but the google APIs url is standardized.
https://iexcloud.io/docs/api/#logo
8am UTC daily
Args:
symbol (string); Ticker to request
token (string); Access token
version (string); API version
Returns:
... | 0.002012 |
def get_instance_health(name, region=None, key=None, keyid=None, profile=None, instances=None):
'''
Get a list of instances and their health state
CLI example:
.. code-block:: bash
salt myminion boto_elb.get_instance_health myelb
salt myminion boto_elb.get_instance_health myelb region... | 0.003096 |
def add_indicator(self, indicator_data):
"""Add an indicator to Batch Job.
.. code-block:: javascript
{
"type": "File",
"rating": 5.00,
"confidence": 50,
"summary": "53c3609411c83f363e051d455ade78a7
... | 0.002006 |
def format_file_path(filepath):
"""Formats a path as absolute and with the correct platform separator."""
try:
is_windows_network_mount = WINDOWS_NETWORK_MOUNT_PATTERN.match(filepath)
filepath = os.path.realpath(os.path.abspath(filepath))
filepath = re.sub(BACKSLASH_REPLACE_PATTERN, '/'... | 0.004121 |
def check_signature(self, timestamp, nonce, signature):
"""
根据时间戳和生成签名的字符串 (nonce) 检查签名。
:param timestamp: 时间戳
:param nonce: 生成签名的随机字符串
:param signature: 要检查的签名
:return: 如果签名合法将返回 ``True``,不合法将返回 ``False``
"""
return check_signature(
self.conf... | 0.005405 |
def DeleteUserDefinedFunction(self, udf_link, options=None):
"""Deletes a user defined function.
:param str udf_link:
The link to the user defined function.
:param dict options:
The request options for the request.
:return:
The deleted UDF.
:... | 0.002732 |
def slot_add_nio_binding(self, slot_number, port_number, nio):
"""
Adds a slot NIO binding.
:param slot_number: slot number
:param port_number: port number
:param nio: NIO instance to add to the slot/port
"""
try:
adapter = self._slots[slot_number]
... | 0.006765 |
def update_parameters(parameters, grads, learning_rate=1.2):
"""
Updates parameters using the gradient descent update rule given above
Arguments:
parameters -- python dictionary containing your parameters
grads -- python dictionary containing your gradients
Returns:
parameters -- python di... | 0.001018 |
def remove_history(self, i=None):
"""
Remove a history item from the bundle by index.
You can toggle whether history is recorded using
* :meth:`enable_history`
* :meth:`disable_history`
:parameter int i: integer for indexing (can be positive or
nega... | 0.002886 |
def get_line_number(line_map, offset):
"""Find a line number, given a line map and a character offset."""
for lineno, line_offset in enumerate(line_map, start=1):
if line_offset > offset:
return lineno
return -1 | 0.004115 |
def plot(self,
resolution_constant_regions=20,
resolution_smooth_regions=200):
"""
Return arrays x, y for plotting the piecewise constant function.
Just the minimum number of straight lines are returned if
``eps=0``, otherwise `resolution_constant_regions` plott... | 0.004192 |
def expand_gallery(generator, metadata):
""" Expand a gallery tag to include all of the files in a specific directory under IMAGE_PATH
:param pelican: The pelican instance
:return: None
"""
if "gallery" not in metadata or metadata['gallery'] is None:
return # If no gallery specified, we do... | 0.003927 |
def source_from_cache(path):
"""Given the path to a .pyc. file, return the path to its .py file.
The .pyc file does not need to exist; this simply returns the path to
the .py file calculated to correspond to the .pyc file. If path does
not conform to PEP 3147/488 format, ValueError will be raised. If
... | 0.001896 |
def visit(spht, node):
"""Append opening tags to document body list.
:param sphinx.writers.html.SmartyPantsHTMLTranslator spht: Object to modify.
:param sphinxcontrib.imgur.nodes.ImgurJavaScriptNode node: This class' instance.
"""
html_attrs_bq = {'async': '', 'src': '//s.imgur.... | 0.011494 |
def name(anon, obj, field, val):
"""
Generates a random full name (using first name and last name)
"""
return anon.faker.name(field=field) | 0.006494 |
def removeSpacePadding(str, blocksize=AES_blocksize):
'Remove padding with spaces'
pad_len = 0
for char in str[::-1]: # str[::-1] reverses string
if char == ' ':
pad_len += 1
else:
break
str = str[:-pad_len]
return str | 0.017361 |
def fw_policy_create(self, data, fw_name=None, cache=False):
"""Top level policy create routine. """
LOG.debug("FW Policy Debug")
self._fw_policy_create(fw_name, data, cache) | 0.010101 |
def _norm(self, string):
"""Extended normalization: normalize by list of norm-characers, split
by character "/"."""
nstring = norm(string)
if "/" in string:
s, t = string.split('/')
nstring = t
return self.normalize(nstring) | 0.006944 |
def get_vertex_surrounding_multicolor(graph, vertex):
"""
Loops over all edges that are incident to supplied vertex and accumulates all colors,
that are present in those edges
"""
result = Multicolor()
for edge in graph.get_edges_by_vertex(vertex):
result += edge.multicolor
return r... | 0.006154 |
def _set_if_type(self, v, load=False):
"""
Setter method for if_type, mapped from YANG variable /mpls_state/dynamic_bypass/dynamic_bypass_interface/if_type (mpls-if-type)
If this variable is read-only (config: false) in the
source YANG file, then _set_if_type is considered as a private
method. Backe... | 0.004419 |
def _validate_integer(name, val, min_val=0):
"""
Checks whether the 'name' parameter for parsing is either
an integer OR float that can SAFELY be cast to an integer
without losing accuracy. Raises a ValueError if that is
not the case.
Parameters
----------
name : string
Paramete... | 0.001099 |
def get_stoplist(language):
"""Returns an built-in stop-list for the language as a set of words."""
file_path = os.path.join("stoplists", "%s.txt" % language)
try:
stopwords = pkgutil.get_data("justext", file_path)
except IOError:
raise ValueError(
"Stoplist for language '%s'... | 0.003442 |
def _get_attributes(self, path):
"""
:param path: filepath within fast5
:return: dictionary of attributes found at ``path``
:rtype dict
"""
path_grp = self.handle[path]
path_attr = path_grp.attrs
return dict(path_attr) | 0.007092 |
def make_even_size(x):
"""Pad x to be even-sized on axis 1 and 2, but only if necessary."""
x_shape = x.get_shape().as_list()
assert len(x_shape) > 2, "Only 3+-dimensional tensors supported."
shape = [dim if dim is not None else -1 for dim in x_shape]
new_shape = x_shape # To make sure constant shapes remain... | 0.014837 |
def _save_or_delete_workflow(self):
"""
Calls the real save method if we pass the beggining of the wf
"""
if not self.current.task_type.startswith('Start'):
if self.current.task_name.startswith('End') and not self.are_we_in_subprocess():
self.wf_state['finishe... | 0.008419 |
def capabilities(self):
"""Returns the list of system capabilities.
:return: A ``list`` of capabilities.
"""
response = self.get(PATH_CAPABILITIES)
return _load_atom(response, MATCH_ENTRY_CONTENT).capabilities | 0.008 |
def bottom(self, N, mask=NotSpecified, groupby=NotSpecified):
"""
Construct a Filter matching the bottom N asset values of self each day.
If ``groupby`` is supplied, returns a Filter matching the bottom N
asset values for each group.
Parameters
----------
N : in... | 0.002105 |
def get_index_list(shape, j):
"""
index_list = get_index_list(shape, j)
:Arguments:
shape: a tuple
j: an integer
Assumes index j is from a ravelled version of an array
with specified shape, returns the corresponding
non-ravelled index tuple as a list.
"""
r = range(len... | 0.001497 |
def list_wallet_names(api_key, is_hd_wallet=False, coin_symbol='btc'):
''' Get all the wallets belonging to an API key '''
assert is_valid_coin_symbol(coin_symbol), coin_symbol
assert api_key
params = {'token': api_key}
kwargs = dict(wallets='hd' if is_hd_wallet else '')
url = make_url(coin_sy... | 0.004474 |
def _get_ipv6_info(cls, ip_address: str) -> tuple:
'''Extract the flow info and control id.'''
results = socket.getaddrinfo(
ip_address, 0, proto=socket.IPPROTO_TCP,
flags=socket.AI_NUMERICHOST)
flow_info = results[0][4][2]
control_id = results[0][4][3]
... | 0.005747 |
def parse_gptl(file_path, var_list):
"""
Read a GPTL timing file and extract some data.
Args:
file_path: the path to the GPTL timing file
var_list: a list of strings to look for in the file
Returns:
A dict containing key-value pairs of the livvkit
and the times associat... | 0.00292 |
def ParseNumericOption(self, options, name, base=10, default_value=None):
"""Parses a numeric option.
If the option is not set the default value is returned.
Args:
options (argparse.Namespace): command line arguments.
name (str): name of the numeric option.
base (Optional[int]): base of ... | 0.005814 |
def write_string(value, buff, byteorder='big'):
"""Write a string to a file-like object."""
data = value.encode('utf-8')
write_numeric(USHORT, len(data), buff, byteorder)
buff.write(data) | 0.004831 |
def resolve_label(self, label):
"""
Resolves a label for this module only. If the label refers to another
module, an exception is raised.
@type label: str
@param label: Label to resolve.
@rtype: int
@return: Memory address pointed to by the label.
@ra... | 0.00099 |
def bulkWrite(self, endpoint, buffer, timeout = 100):
r"""Perform a bulk write request to the endpoint specified.
Arguments:
endpoint: endpoint number.
buffer: sequence data buffer to write.
This parameter can be any sequence type.
... | 0.007984 |
def scan(self, data, dlen=None):
'''
Scan a data block for matching signatures.
@data - A string of data to scan.
@dlen - If specified, signatures at offsets larger than dlen will be ignored.
Returns a list of SignatureResult objects.
'''
results = []
ma... | 0.004977 |
def calculate_Y(sub_network,skip_pre=False):
"""Calculate bus admittance matrices for AC sub-networks."""
if not skip_pre:
calculate_dependent_values(sub_network.network)
if sub_network.network.sub_networks.at[sub_network.name,"carrier"] != "AC":
logger.warning("Non-AC networks not support... | 0.017041 |
def apply(self, q, bindings, ordering, distinct=None):
""" Sort on a set of field specifications of the type (ref, direction)
in order of the submitted list. """
info = []
for (ref, direction) in self.parse(ordering):
info.append((ref, direction))
table, column = ... | 0.001855 |
def get_suite_token(self, suite_id, suite_secret, suite_ticket):
"""
获取第三方应用凭证
https://work.weixin.qq.com/api/doc#90001/90143/9060
:param suite_id: 以ww或wx开头应用id(对应于旧的以tj开头的套件id)
:param suite_secret: 应用secret
:param suite_ticket: 企业微信后台推送的ticket
:return: 返回的 JSO... | 0.003478 |
def _get_param_names(cls):
"""Get parameter names for the estimator"""
# fetch the constructor or the original constructor before
# deprecation wrapping if any
init = getattr(cls.__init__, 'deprecated_original', cls.__init__)
if init is object.__init__:
# No explicit ... | 0.002162 |
def tidy(args):
"""
%prog tidy fastafile
Trim terminal Ns, normalize gap sizes and remove small components.
"""
p = OptionParser(tidy.__doc__)
p.add_option("--gapsize", dest="gapsize", default=0, type="int",
help="Set all gaps to the same size [default: %default]")
p.add_option(... | 0.002003 |
def get_entity_propnames(entity):
""" Get entity property names
:param entity: Entity
:type entity: sqlalchemy.ext.declarative.api.DeclarativeMeta
:returns: Set of entity property names
:rtype: set
"""
ins = entity if isinstance(entity, InstanceState) else inspect(entity)
... | 0.002232 |
def repo_def_matches_reality(juicer_def, pulp_def):
"""Compare a juicer repo def with a given pulp definition. Compute and
return the update necessary to make `pulp_def` match `juicer_def`.
`juicer_def` - A JuicerRepo() object representing a juicer repository
`pulp_def` - A PulpRepo() object representi... | 0.00464 |
def get_functions_overridden_by(self, function):
'''
Return the list of functions overriden by the function
Args:
(core.Function)
Returns:
list(core.Function)
'''
candidates = [c.functions_not_inherited for c in self.inheritance]
candi... | 0.006438 |
def RemoveClientKeyword(self, client_id, keyword, cursor=None):
"""Removes the association of a particular client to a keyword."""
cursor.execute(
"DELETE FROM client_keywords "
"WHERE client_id = %s AND keyword_hash = %s",
[db_utils.ClientIDToInt(client_id),
mysql_utils.Hash(ke... | 0.003049 |
def searchNsByHref(self, doc, href):
"""Search a Ns aliasing a given URI. Recurse on the parents
until it finds the defined namespace or return None
otherwise. """
if doc is None: doc__o = None
else: doc__o = doc._o
ret = libxml2mod.xmlSearchNsByHref(doc__o, self._o,... | 0.013393 |
def get_line_style(line):
"""Get the style dictionary for matplotlib line objects"""
style = {}
style['alpha'] = line.get_alpha()
if style['alpha'] is None:
style['alpha'] = 1
style['color'] = color_to_hex(line.get_color())
style['linewidth'] = line.get_linewidth()
style['dasharray']... | 0.002506 |
def loads(s, separator=DEFAULT, index_separator=DEFAULT, cls=dict, list_cls=list):
'''Loads an object from a string.
:param s: An object to parse
:type s: bytes or str
:param separator: The separator between key and value. Defaults to u'|' or b'|', depending on the types.
:param index_separator: T... | 0.005682 |
def block_start(self, previous_block):
"""Returns an ordered list of batches to inject at the beginning of the
block. Can also return None if no batches should be injected.
Args:
previous_block (Block): The previous block.
Returns:
A list of batches to inject.
... | 0.002353 |
def match_bitwidth(*args, **opt):
""" Matches the bitwidth of all of the input arguments with zero or sign extend
:param args: WireVectors of which to match bitwidths
:param opt: Optional keyword argument 'signed=True' (defaults to False)
:return: tuple of args in order with extended bits
Example ... | 0.004212 |
def pssm_array2pwm_array(arr, background_probs=DEFAULT_BASE_BACKGROUND):
"""Convert pssm array to pwm array
"""
b = background_probs2array(background_probs)
b = b.reshape([1, 4, 1])
return (np.exp(arr) * b).astype(arr.dtype) | 0.004098 |
def rendaku_merge_pairs(lpair, rpair):
"""Merge lpair < rpair while applying semi-irregular rendaku rules"""
ltext, lnum = lpair
rtext, rnum = rpair
if lnum > rnum:
raise ValueError
if rpair == ("ひゃく", 100):
if lpair == ("さん", 3):
rtext = "びゃく"
elif lpair == ("ろく... | 0.000835 |
def get_cluster_plan(self):
"""Fetch cluster plan from zookeeper."""
_log.info('Fetching current cluster-topology from Zookeeper...')
cluster_layout = self.get_topics(fetch_partition_state=False)
# Re-format cluster-layout
partitions = [
{
'topic': to... | 0.00436 |
def cublasCtpsv(handle, uplo, trans, diag, n, AP, x, incx):
"""
Solve complex triangular-packed system with one right-hand side.
"""
status = _libcublas.cublasCtpsv_v2(handle,
_CUBLAS_FILL_MODE[uplo],
_CUBLAS_OP[tra... | 0.0125 |
def get(self, tag, default=None):
"""Get a metadata value.
Each metadata value is referenced by a ``tag`` -- a short
string such as ``'xlen'`` or ``'audit'``. In the sidecar file
these tag names are prepended with ``'Xmp.pyctools.'``, which
corresponds to a custom namespace in t... | 0.003241 |
def get(self, url, params):
"""
Issues a GET request against the API, properly formatting the params
:param url: a string, the url you are requesting
:param params: a dict, the key-value of all the paramaters needed
in the request
:returns: a dict parsed o... | 0.004412 |
def newNsProp(self, node, name, value):
"""Create a new property tagged with a namespace and carried
by a node. """
if node is None: node__o = None
else: node__o = node._o
ret = libxml2mod.xmlNewNsProp(node__o, self._o, name, value)
if ret is None:raise treeError('xmlN... | 0.015228 |
def get_accepted_features(features, proposed_feature):
"""Deselect candidate features from list of all features
Args:
features (List[Feature]): collection of all features in the ballet
project: both accepted features and candidate ones that have not
been accepted
propose... | 0.000798 |
def igetattr(self, attrname, context=None):
"""Infer the possible values of the given attribute on the slice.
:param attrname: The name of the attribute to infer.
:type attrname: str
:returns: The inferred possible values.
:rtype: iterable(NodeNG)
"""
if attrnam... | 0.003185 |
def MRA(biomf, sampleIDs=None, transform=None):
"""
Calculate the mean relative abundance percentage.
:type biomf: A BIOM file.
:param biomf: OTU table format.
:type sampleIDs: list
:param sampleIDs: A list of sample id's from BIOM format OTU table.
:param transform: Mathematical function... | 0.004566 |
def fix_filename(filename, suffix=''):
"""
e.g.
fix_filename('icon.png', '_40x40')
return
icon_40x40.png
"""
if suffix:
f, ext = os.path.splitext(filename)
return f+suffix+ext
else:
return filename | 0.010601 |
def flatFieldFromCloseDistance(imgs, bg_imgs=None):
'''
Average multiple images of a homogeneous device
imaged directly in front the camera lens.
if [bg_imgs] are not given, background level is extracted
from 1% of the cumulative intensity distribution
of the averaged [imgs]
... | 0.001404 |
def _parse_key_from_substring(substring) -> str:
'''
Returns the key in the expected string "N:12.3", where "N" is the
key, and "12.3" is a floating point value
'''
try:
return substring.split(':')[0]
except (ValueError, IndexError, TypeError, AttributeError):
log.exception('Unex... | 0.002016 |
def request(self, path, data=None, headers=None, method=None):
"""Performs a HTTP request to the Go server
Args:
path (str): The full path on the Go server to request.
This includes any query string attributes.
data (str, dict, bool, optional): If any data is present thi... | 0.003413 |
def get_prep_value(self, value):
"""
We need to accomodate queries where a single email,
or list of email addresses is supplied as arguments. For example:
- Email.objects.filter(to='mail@example.com')
- Email.objects.filter(to=['one@example.com', 'two@example.com'])
"""
... | 0.004274 |
def _proxy(self):
"""
Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
:returns: CountryContext for this CountryInstance
:rtype: twilio.rest.voice.v1.dialing_permissions.country.... | 0.009881 |
def table(self, table, columns, types, constraints='', pk='', new_table=False):
"""
Rearrange, add or delete columns from database **table** with desired ordered list of **columns** and corresponding data **types**.
Parameters
----------
table: sequence
The name of t... | 0.005914 |
def get_command_line_key_for_unknown_config_file_setting(self, key):
"""Compute a commandline arg key to be used for a config file setting
that doesn't correspond to any defined configargparse arg (and so
doesn't have a user-specified commandline arg key).
Args:
key: The con... | 0.003717 |
def get_password_authentication_key(self, username, password, server_b_value, salt):
"""
Calculates the final hkdf based on computed S value, and computed U value and the key
:param {String} username Username.
:param {String} password Password.
:param {Long integer} server_b_valu... | 0.004992 |
def get_formatted_stack_frame(
project: 'projects.Project',
error_stack: bool = True
) -> list:
"""
Returns a list of the stack frames formatted for user display that has
been enriched by the project-specific data.
:param project:
The currently open project used to enrich t... | 0.004 |
def parse(self, extent, desc_tag):
# type: (int, UDFTag) -> None
'''
Parse the passed in data into a UDF Terminating Descriptor.
Parameters:
extent - The extent that this descriptor currently lives at.
desc_tag - A UDFTag object that represents the Descriptor Tag.
... | 0.006612 |
def print_cm(cm, labels, hide_zeroes=False, hide_diagonal=False, hide_threshold=None):
"""pretty print for confusion matrixes"""
columnwidth = max([len(x) for x in labels] + [5]) # 5 is value length
empty_cell = " " * columnwidth
# Print header
print(" " + empty_cell, end=" ")
for label in l... | 0.002105 |
def __update_clusters(self, medoids):
"""!
@brief Forms cluster in line with specified medoids by calculation distance from each point to medoids.
"""
self.__belong = [0] * len(self.__pointer_data)
self.__clusters = [[] for i in range(len(medoids))]
... | 0.010338 |
def calculate_integral(self, T1, T2, method):
r'''Method to calculate the integral of a property with respect to
temperature, using a specified method. Uses SciPy's `quad` function
to perform the integral, with no options.
This method can be overwritten by subclasses who may per... | 0.004137 |
def _fingerprint_dirs(self, dirpaths, topdown=True, onerror=None, followlinks=False):
"""Returns a fingerprint of the given file directories and all their sub contents.
This assumes that the file directories are of reasonable size
to cause memory or performance issues.
"""
# Note that we don't sort... | 0.009975 |
def parse(pem_str):
# type: (bytes) -> List[AbstractPEMObject]
"""
Extract PEM objects from *pem_str*.
:param pem_str: String to parse.
:type pem_str: bytes
:return: list of :ref:`pem-objects`
"""
return [
_PEM_TO_CLASS[match.group(1)](match.group(0))
for match in _PEM_R... | 0.002899 |
def distance(self, other):
"""Distance to another point on the sphere"""
return math.acos(self._pos3d.dot(other.vector)) | 0.014706 |
def file_open(self, fn):
"""Yields the opening text of a file section in multipart HTTP.
Parameters
----------
fn : str
Filename for the file being opened and added to the HTTP body
"""
yield b'--'
yield self.boundary.encode()
yield CRLF
... | 0.00431 |
def list_passwords(kwargs=None, call=None):
'''
List all password on the account
.. versionadded:: 2015.8.0
'''
response = _query('support', 'password/list')
ret = {}
for item in response['list']:
if 'server' in item:
server = item['server']['name']
if serve... | 0.002387 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.