text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _get_smma(cls, df, column, windows):
""" get smoothed moving average.
:param df: data
:param windows: range
:return: result series
"""
window = cls.get_only_one_positive_int(windows)
column_name = '{}_{}_smma'.format(column, window)
smma = df... | 0.004132 |
def element_as_json_with_filter(name, _filter):
"""
Get specified element json data by name with filter.
Filter can be any valid element type.
:param name: name of element
:param _filter: element filter, host, network, tcp_service,
network_elements, services, services_and_applic... | 0.001815 |
def treeAggregate(self, zeroValue, seqOp, combOp, depth=2):
"""
Aggregates the elements of this RDD in a multi-level tree
pattern.
:param depth: suggested depth of the tree (default: 2)
>>> add = lambda x, y: x + y
>>> rdd = sc.parallelize([-5, -4, -3, -2, -1, 1, 2, 3, ... | 0.002212 |
def _minimize_in_graph(build_loss_fn, num_steps=200, optimizer=None):
"""Run an optimizer within the graph to minimize a loss function."""
optimizer = tf.compat.v1.train.AdamOptimizer(
0.1) if optimizer is None else optimizer
def train_loop_body(step):
train_op = optimizer.minimize(
build_loss_... | 0.00885 |
def portable_hash(x):
"""
This function returns consistent hash code for builtin types, especially
for None and tuple with None.
The algorithm is similar to that one used by CPython 2.7
>>> portable_hash(None)
0
>>> portable_hash((None, 1)) & 0xffffffff
219750521
"""
if sys.ve... | 0.002594 |
def fir_remez_bpf(f_stop1, f_pass1, f_pass2, f_stop2, d_pass, d_stop,
fs = 1.0, N_bump=5):
"""
Design an FIR bandpass filter using remez with order
determination. The filter order is determined based on
f_stop1 Hz, f_pass1 Hz, f_pass2 Hz, f_stop2 Hz, and the
desired passba... | 0.010613 |
def scheduled_snapshot(name, prefix, recursive=True, schedule=None):
'''
maintain a set of snapshots based on a schedule
name : string
name of filesystem or volume
prefix : string
prefix for the snapshots
e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm'
... | 0.005134 |
def match(self, regexp, flags=None):
"""compile the given regexp, cache the reg, and call match_reg()."""
try:
reg = _regexp_cache[(regexp, flags)]
except KeyError:
if flags:
reg = re.compile(regexp, flags)
else:
reg = re.compi... | 0.004819 |
def remove_empty_tags(self, tags=None):
"""
Tags whose value is set to None shall be removed from tags.
:param tags: Tags which are to be processed.
If None, tags found in self._requirements are used.
:return: If tags is not None, returns dict with processed tags. Else returns No... | 0.004587 |
def scale_gaussian_prior(name, z, logscale_factor=3.0, trainable=True):
"""Returns N(s^i * z^i, std^i) where s^i and std^i are pre-component.
s^i is a learnable parameter with identity initialization.
std^i is optionally learnable with identity initialization.
Args:
name: variable scope.
z: input_tens... | 0.002904 |
def get_office365edu_prod_subs(netid):
"""
Return a restclients.models.uwnetid.Subscription objects
on the given uwnetid
"""
subs = get_netid_subscriptions(netid,
Subscription.SUBS_CODE_OFFICE_365)
if subs is not None:
for subscription in subs:
... | 0.002132 |
def vocab_convert(vocab, standard, key=''):
"""
Converts MagIC database terms (method codes, geologic_types, etc) to other standards.
May not be comprehensive for each standard. Terms added to standards as people need them
and may not be up-to-date.
'key' can be used to distinguish vocab terms that... | 0.000949 |
def authorize_security_group(
self, group_name=None, group_id=None, source_group_name="", source_group_owner_id="",
ip_protocol="", from_port="", to_port="", cidr_ip=""):
"""
There are two ways to use C{authorize_security_group}:
1) associate an existing group (source group) ... | 0.001352 |
def add_boolean(self, b):
"""
Add a boolean value to the stream.
:param bool b: boolean value to add
"""
if b:
self.packet.write(one_byte)
else:
self.packet.write(zero_byte)
return self | 0.007519 |
def Element(self, elem, **params):
"""Ensure that the input element is immutable by the transformation. Returns a single element."""
res = self.__call__(deepcopy(elem), **params)
if len(res) > 0:
return res[0]
else:
return None | 0.014085 |
def include_many(gset, elems, truth_value=True):
"""Do whatever it takes to make ``elem in gset`` true for each elem in ``elems``.
See :func:`include`.
"""
extend = getattr(gset, 'extend', None)
if extend is not None:
extend(elems)
elif hasattr(gset, '__setitem__'):
gset.upd... | 0.00611 |
def curve_points(self, beginframe, endframe, framestep, birthframe, startframe, stopframe, deathframe,
filternone=True, noiseframe=None):
"""
returns a list of frames from startframe to stopframe, in steps of framestepj
warning: the list of points may include "None" elements... | 0.008036 |
def save(cls, network=None, phases=[], filename='', delim=' | '):
r"""
Save all the pore and throat property data on the Network (and
optionally on any Phases objects) to CSV files.
Parameters
----------
network : OpenPNM Network
The Network containing the da... | 0.001817 |
def sign(self, pkey, digest):
"""
Sign the certificate with this key and digest type.
:param pkey: The key to sign with.
:type pkey: :py:class:`PKey`
:param digest: The name of the message digest to use.
:type digest: :py:class:`bytes`
:return: :py:data:`None`
... | 0.002301 |
def gzipped(fn):
"""
Decorator used to pack data returned from the Bottle function to GZIP.
The decorator adds GZIP compression only if the browser accepts GZIP in
it's ``Accept-Encoding`` headers. In that case, also the correct
``Content-Encoding`` is used.
"""
def gzipped_wrapper(*args, *... | 0.001558 |
def _request(self, method, path, server=None, **kwargs):
"""Execute a request to the cluster
A server is selected from the server pool.
"""
while True:
next_server = server or self._get_server()
try:
response = self.server_pool[next_server].reques... | 0.001369 |
def get_cert_builder(expires):
"""Get a basic X509 cert builder object.
Parameters
----------
expires : datetime
When this certificate will expire.
"""
now = datetime.utcnow().replace(second=0, microsecond=0)
if expires is None:
expires = get_expires(expires, now=now)
... | 0.001704 |
def plot_correlation(self, on, x_col=None, plot_type="jointplot", stat_func=pearsonr, show_stat_func=True, plot_kwargs={}, **kwargs):
"""Plot the correlation between two variables.
Parameters
----------
on : list or dict of functions or strings
See `cohort.load.as_dataframe`... | 0.00295 |
def get_netki_names(self, fetch=False):
"""Return the Account's NetkiNames object, populating it if fetch is True."""
return NetkiNames(self.resource.netki_names, self.client, populate=fetch) | 0.019324 |
def create_section(self, attribute, name=None):
'''create a section based on key, value recipe pairs,
This is used for files or label
Parameters
==========
attribute: the name of the data section, either labels or files
name: the name to write to the recipe file (e.g., %name).
... | 0.003428 |
def nodes_ali(c_obj):
"""Get node objects from AliCloud."""
ali_nodes = []
try:
ali_nodes = c_obj.list_nodes()
except BaseHTTPError as e:
abort_err("\r HTTP Error with AliCloud: {}".format(e))
ali_nodes = adj_nodes_ali(ali_nodes)
return ali_nodes | 0.003497 |
def dpll_satisfiable(s):
"""Check satisfiability of a propositional sentence.
This differs from the book code in two ways: (1) it returns a model
rather than True when it succeeds; this is more useful. (2) The
function find_pure_symbol is passed a list of unknown clauses, rather
than a list of all c... | 0.001721 |
def height_min(self, height_min):
"""Set the minimum height of the widget
Parameters
----------
height_min: float
the minimum height of the widget
"""
if height_min is None:
self._height_limits[0] = 0
return
height_min = floa... | 0.004545 |
def search_pattern(self, value):
"""
Setter for **self.__search_pattern** attribute.
:param value: Attribute value.
:type value: unicode
"""
if value is not None:
assert type(value) in (unicode, QString), \
"'{0}' attribute: '{1}' type is not... | 0.007229 |
def create_issue(self, title, body, labels=None):
"""Creates a new issue in Github.
:params title: title of the issue to be created
:params body: body of the issue to be created
:params labels: (optional) list of labels for the issue
:returns: newly created issue
:rtype:... | 0.003656 |
def _is_num_param(names, values, to_float=False):
"""
Return numbers from inputs or raise VdtParamError.
Lets ``None`` pass through.
Pass in keyword argument ``to_float=True`` to
use float for the conversion rather than int.
>>> _is_num_param(('', ''), (0, 1.0))
[0, 1]
>>> _is_num_para... | 0.001031 |
def populationStability(vectors, numSamples=None):
"""
Returns the stability for the population averaged over multiple time steps
Parameters:
-----------------------------------------------
vectors: the vectors for which the stability is calculated
numSamples the number of time steps where ... | 0.011952 |
def ELBND(w, e, function="max"):
"""
This function estimates Error and Learning Based Novelty Detection measure
from given data.
**Args:**
* `w` : history of adaptive parameters of an adaptive model (2d array),
every row represents parameters in given time index.
* `e` : error of adapti... | 0.007622 |
def get_provider_name(driver):
"""
Return the provider name from the driver class
:param driver: obj
:return: str
"""
kls = driver.__class__.__name__
for d, prop in DRIVERS.items():
if prop[1] == kls:
return d
return None | 0.003663 |
def load_object_from_string(fqcn):
"""Converts "." delimited strings to a python object.
Given a "." delimited string representing the full path to an object
(function, class, variable) inside a module, return that object. Example:
load_object_from_string("os.path.basename")
load_object_from_stri... | 0.001603 |
def apply_acl(self, equipments, vlan, environment, network):
'''Apply the file acl in equipments
:param equipments: list of equipments
:param vlan: Vvlan
:param environment: Environment
:param network: v4 or v6
:raise Exception: Failed to apply acl
:return: Tru... | 0.00289 |
def data_from_query(self, cmd):
"""
Callback for .execute_command() for DELETE/GET/HEAD requests
"""
res = None
ckey = "%s /%s" % (self.command, cmd)
if not isinstance(self._query_params, dict):
self._query_params = {}
if ckey in _NCMD:
... | 0.002219 |
def IEEEContext(bitwidth):
"""
Return IEEE 754-2008 context for a given bit width.
The IEEE 754 standard specifies binary interchange formats with bitwidths
16, 32, 64, 128, and all multiples of 32 greater than 128. This function
returns the context corresponding to the interchange format for the ... | 0.000687 |
def to_dict(self):
"""Converts extensible attributes into the format suitable for NIOS."""
return {name: {'value': self._process_value(str, value)}
for name, value in self._ea_dict.items()
if not (value is None or value == "" or value == [])} | 0.006897 |
def __store_callable(self, o, method_name, member):
"""
Stores a callable member to the private __store__
:param mixed o: Any callable (function or method)
:param str method_name: The name of the attribute
:param mixed member: A reference to the member
"""
self.... | 0.019667 |
def calc_measurement_error(self, tangents):
'''
formula for measurement error
sqrt ( (sum(1, n, (k_i - <k>)**2) / (n*(n-1)))
'''
if len(tangents) < 2:
return 0.0
avg_tan = float(sum(tangents) / len(tangents))
numerator = float()
for i in tang... | 0.004396 |
def object2code(key, code):
"""Returns code for widget from dict object"""
if key in ["xscale", "yscale"]:
if code == "log":
code = True
else:
code = False
else:
code = unicode(code)
return code | 0.003831 |
def read(self):
"""Reads record from current position in reader.
Returns:
original bytes stored in a single record.
"""
data = None
while True:
last_offset = self.tell()
try:
(chunk, record_type) = self.__try_read_record()
if record_type == _RECORD_TYPE_NONE:
... | 0.007817 |
def global_horizontal_illuminance(self, value=999999.0):
""" Corresponds to IDD Field `global_horizontal_illuminance`
will be missing if >= 999900
Args:
value (float): value for IDD Field `global_horizontal_illuminance`
Unit: lux
value >= 0.0
... | 0.001832 |
def mouse_up(self, evt, wx_obj=None):
"Release the selected object (pass a wx_obj if the event was captured)"
self.resizing = False
if self.current:
wx_obj = self.current
if self.parent.wx_obj.HasCapture():
self.parent.wx_obj.ReleaseMouse()
se... | 0.00477 |
def run(self, postfunc=lambda: None):
"""Run the jobs.
postfunc() will be invoked after the jobs has run. It will be
invoked even if the jobs are interrupted by a keyboard
interrupt (well, in fact by a signal such as either SIGINT,
SIGTERM or SIGHUP). The execution of postfunc()... | 0.003484 |
def get_access_token(self, request):
"""
Get the access token based on a request.
Returns None if no authentication details were provided. Raises
AuthenticationFailed if the token is incorrect.
"""
header = authentication.get_authorization_header(request)
if not ... | 0.003464 |
def check_format(self, sm_format):
"""
Return ``True`` if the given sync map format is allowed,
and ``False`` otherwise.
:param sm_format: the sync map format to be checked
:type sm_format: Unicode string
:rtype: bool
"""
if sm_format not in SyncMapForma... | 0.005119 |
def mac_address_table_static_mac_address(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
mac_address_table = ET.SubElement(config, "mac-address-table", xmlns="urn:brocade.com:mgmt:brocade-mac-address-table")
static = ET.SubElement(mac_address_table, "sta... | 0.002757 |
def add_signal_receiver(self, callback_fn, signal, user_arg):
"""
Add a signal receiver callback with user argument
See also :py:meth:`remove_signal_receiver`,
:py:exc:`.ConnSignalNameNotRecognisedException`
:param func callback_fn:
User-defined callback function to... | 0.001857 |
def _do_logon(self):
"""
Log on, unconditionally. This can be used to re-logon.
This requires credentials to be provided.
Raises:
:exc:`~zhmcclient.ClientAuthError`
:exc:`~zhmcclient.ServerAuthError`
:exc:`~zhmcclient.ConnectionError`
:exc:`~zhmc... | 0.001696 |
def is_estimator(model):
"""
Determines if a model is an estimator using issubclass and isinstance.
Parameters
----------
estimator : class or instance
The object to test if it is a Scikit-Learn clusterer, especially a
Scikit-Learn estimator or Yellowbrick visualizer
"""
if ... | 0.002294 |
def config(self, config_text, plane):
"""Apply config."""
NO_CONFIGURATION_CHANGE = re.compile("No configuration changes to commit")
CONFIGURATION_FAILED = re.compile("show configuration failed")
CONFIGURATION_INCONSITENCY = re.compile("No configuration commits for this SDR will be allow... | 0.006656 |
def expand_state_definition(source, loc, tokens):
"""
Parse action to convert statemachine to corresponding Python classes and methods
"""
indent = " " * (pp.col(loc, source) - 1)
statedef = []
# build list of states
states = set()
fromTo = {}
for tn in tokens.transitions:
s... | 0.002672 |
def _forObject(self, obj):
"""
Create a new `Router` instance, with it's own set of routes, for
``obj``.
"""
router = type(self)()
router._routes = list(self._routes)
router._self = obj
return router | 0.007605 |
def mask_image(image: SpatialImage, mask: np.ndarray, data_type: type = None
) -> np.ndarray:
"""Mask image after optionally casting its type.
Parameters
----------
image
Image to mask. Can include time as the last dimension.
mask
Mask to apply. Must have the same sha... | 0.001189 |
def create_question(self, question, type=None, **kwargs):
"""
Returns a Question of specified type.
"""
if not type:
return Question(question, **kwargs)
if type == "choice":
return ChoiceQuestion(question, **kwargs)
if type == "confirmation":
... | 0.005319 |
def create_mssql_pyodbc(username, password, host, port, database, **kwargs): # pragma: no cover
"""
create an engine connected to a mssql database using pyodbc.
"""
return create_engine(
_create_mssql_pyodbc(username, password, host, port, database),
**kwargs
) | 0.006711 |
def getOutputColumn(self, columnAlias):
"""Returns a Column."""
result = None
for column in self.__outputColumns:
if column.getColumnAlias() == columnAlias:
result = column
break
return result | 0.007463 |
def format_template(template, content):
"""Render a given pystache template
with given content"""
import pystache
result = u""
if True: # try:
result = pystache.render(template, content, string_encoding='utf-8')
# except (ValueError, KeyError) as e:
# print("Templating error: %s... | 0.002632 |
def report_raw_metrics(self, metrics, results, tags):
'''
For all the metrics that are specified as oid,
the conf oid is going to exactly match or be a prefix of the oid sent back by the device
Use the instance configuration to find the name to give to the metric
Submit the resu... | 0.003203 |
def parse_case(config):
"""Parse case information from config or PED files.
Args:
config (dict): case config with detailed information
Returns:
dict: parsed case data
"""
if 'owner' not in config:
raise ConfigError("A case has to have a owner")
if 'family' not in confi... | 0.001722 |
def attention_builder(name, head_num, activation, history_only, trainable=True):
"""Get multi-head self-attention builder.
:param name: Prefix of names for internal layers.
:param head_num: Number of heads in multi-head self-attention.
:param activation: Activation for multi-head self-attention.
:p... | 0.002833 |
def delete_role(self, name):
"""
Delete a role by name.
@param name: Role name
@return: The deleted ApiRole object
"""
return roles.delete_role(self._get_resource_root(), self.name, name,
self._get_cluster_name()) | 0.00813 |
def isSame(self, other: HdlStatement) -> bool:
"""
Doc on parent class :meth:`HdlStatement.isSame`
"""
if self is other:
return True
if self.rank != other.rank:
return False
if isinstance(other, SwitchContainer) \
and isSameHVal(s... | 0.002725 |
def detect(self, volume_system, vstype='detect'):
"""Finds and mounts all volumes based on mmls."""
try:
cmd = ['mmls']
if volume_system.parent.offset:
cmd.extend(['-o', str(volume_system.parent.offset // volume_system.disk.block_size)])
if vstype in ... | 0.003108 |
def FormatProblem(self, d=None):
"""Return a text string describing the problem.
Args:
d: map returned by GetDictToFormat with with formatting added
"""
if not d:
d = self.GetDictToFormat()
output_error_text = self.__class__.ERROR_TEXT % d
if ('reason' in d) and d['reason']:
... | 0.009709 |
def typify(value, type_hint=None):
"""Take a primitive value, usually a string, and try to make a more relevant type out of it.
An optional type_hint will try to coerce the value to that type.
Args:
value (Any): Usually a string, not a sequence
type_hint (type or Tuple[type]):
Examples... | 0.001508 |
def findItemAndIndexPath(self, path, startIndex=None):
""" Searches all the model recursively (starting at startIndex) for an item where
item.nodePath == path.
Returns list of (item, itemIndex) tuples from the start index to that node.
Raises IndexError if the item cannot be... | 0.005085 |
def run_rpc_differ():
"""The script starts here."""
args = parse_arguments()
# Set up DEBUG logging if needed
if args.debug:
log.setLevel(logging.DEBUG)
elif args.verbose:
log.setLevel(logging.INFO)
# Create the storage directory if it doesn't exist already.
try:
st... | 0.000168 |
def get_traffic(self):
"""
Retrieves the traffic for the repositories of the given organization.
"""
print 'Getting traffic.'
#Uses the developer API. Note this could change.
headers = {'Accept': 'application/vnd.github.spiderman-preview', 'Authorization': 'token ' + self... | 0.007641 |
def _add_auth(self):
"""
Add Auth configuration to the Swagger file, if necessary
"""
if not self.auth:
return
if self.auth and not self.definition_body:
raise InvalidResourceException(self.logical_id,
"Auth wor... | 0.004765 |
def _pys2row_heights(self, line):
"""Updates row_heights in code_array"""
# Split with maxsplit 3
split_line = self._split_tidy(line)
key = row, tab = self._get_key(*split_line[:2])
height = float(split_line[2])
shape = self.code_array.shape
try:
if... | 0.004367 |
def _write_continue(self, value):
"""
Write history text into the header
"""
self._FITS.write_continue(self._ext+1, str(value)) | 0.012579 |
def get_client(client_id):
"""Load the client.
Needed for grant_type client_credentials.
Add support for OAuth client_credentials access type, with user
inactivation support.
:param client_id: The client ID.
:returns: The client instance or ``None``.
"""
client = Client.query.get(clie... | 0.002591 |
def embed_check_integer_casting_closed(x,
target_dtype,
assert_nonnegative=True,
assert_positive=False,
name="embed_check_casting_closed"):
"""Ensures integers re... | 0.005006 |
def show_refund(self, refund_id):
"""Shows an existing refund transaction."""
request = self._get('transactions/refunds/' + str(refund_id))
return self.responder(request) | 0.010309 |
def __fetch_route53_zones(self):
"""Return a list of all DNS zones hosted in Route53
Returns:
:obj:`list` of `dict`
"""
done = False
marker = None
zones = {}
route53 = self.session.client('route53')
try:
while not done:
... | 0.002292 |
def generate_view(ase):
# type: (blobxfer.models.azure.StorageEntity) ->
# Tuple[LocalPathView, int]
"""Generate local path view and total size required
:param blobxfer.models.azure.StorageEntity ase: Storage Entity
:rtype: tuple
:return: (local path view, allocatio... | 0.004415 |
def Sun_Mishima(m, D, rhol, rhog, mul, kl, Hvap, sigma, q=None, Te=None):
r'''Calculates heat transfer coefficient for film boiling of saturated
fluid in any orientation of flow. Correlation
is as shown in [1]_, and also reviewed in [2]_ and [3]_.
Either the heat flux or excess temperature is requi... | 0.005359 |
def _parse_qualified_list(value):
"""
Parse a header value, returning a sorted list of values based upon
the quality rules specified in https://tools.ietf.org/html/rfc7231 for
the Accept-* headers.
:param str value: The value to parse into a list
:rtype: list
"""
found_wildcard = False... | 0.000856 |
def url_to_image(url, flag=cv2.IMREAD_COLOR):
""" download the image, convert it to a NumPy array, and then read
it into OpenCV format """
resp = urlopen(url)
image = np.asarray(bytearray(resp.read()), dtype="uint8")
image = cv2.imdecode(image, flag)
return image | 0.003484 |
def nx_ensure_agraph_color(graph):
""" changes colors to hex strings on graph attrs """
from plottool import color_funcs
import plottool as pt
#import six
def _fix_agraph_color(data):
try:
orig_color = data.get('color', None)
alpha = data.get('alpha', None)
... | 0.002732 |
def makenode(clss, symbol, *nexts):
""" Stores the symbol in an AST instance,
and left and right to the given ones
"""
result = clss(symbol)
for i in nexts:
if i is None:
continue
if not isinstance(i, clss):
raise NotAnAstEr... | 0.005222 |
def display(path_html="mapper_visualization_output.html"):
""" Displays a html file inside a Jupyter Notebook output cell.
.. note::
Must run ``KeplerMapper.visualize`` first to generate html. This function will then render that output from a file saved to disk.
..... | 0.007038 |
def adduser(username, password=None, shell='/bin/bash',
system_user=False, primary_group=None,
secondary_groups=None, uid=None, home_dir=None):
"""Add a user to the system.
Will log but otherwise succeed if the user already exists.
:param str username: Username to create
:param... | 0.00049 |
def set_device(self, device_name):
"""
Set the device before the next fprop to create a new graph on the
specified device.
"""
device_name = unify_device_name(device_name)
self.device_name = device_name
for layer in self.layers:
layer.device_name = device_name | 0.006803 |
def savepysyn(self,wave,flux,fname,units=None):
""" Cannot ever use the .writefits() method, because the array is
frequently just sampled at the synphot waveset; plus, writefits
is smart and does things like tapering."""
if units is None:
ytype='throughput'
units=... | 0.027816 |
def wavfile_to_examples(wav_file):
"""Convenience wrapper around waveform_to_examples() for a common WAV format.
Args:
wav_file: String path to a file, or a file-like object. The file
is assumed to contain WAV audio data with signed 16-bit PCM samples.
Returns:
See waveform_to_examples.
"""
from... | 0.012478 |
def sync(self, vault_client, opt):
"""Synchronizes the context to the Vault server. This
has the effect of updating every resource which is
in the context and has changes pending."""
active_mounts = []
for audit_log in self.logs():
audit_log.sync(vault_client)
... | 0.001128 |
def setupEnvironment(self, cmd):
""" Turn all build properties into environment variables """
shell.ShellCommand.setupEnvironment(self, cmd)
env = {}
for k, v in self.build.getProperties().properties.items():
env[str(k)] = str(v[0])
if cmd.args['env'] is None:
... | 0.005249 |
def esinw2per0(ecc, esinw):
"""
TODO: add documentation
"""
return ConstraintParameter(ecc._bundle, "esinw2per0({}, {})".format(_get_expr(ecc), _get_expr(esinw))) | 0.011236 |
def get_asset_state(self, asset_id, **kwargs):
""" Returns the asset information associated with a specific asset ID.
:param asset_id:
an asset identifier (the transaction ID of the RegistTransaction when the asset is
registered)
:type asset_id: str
:return: dict... | 0.008097 |
def _delete_fw_fab_dev(self, tenant_id, drvr_name, fw_dict):
"""Deletes the Firewall.
This routine calls the fabric class to delete the fabric when
a firewall is deleted. It also calls the device manager to
unconfigure the device. It updates the database with the final
result.
... | 0.001477 |
def clear_info(self):
"""Clear the device info."""
self._version_text = None
self._inventory_text = None
self._users_text = None
self.os_version = None
self.os_type = None
self.family = None
self.platform = None
self.udi = None
# self.is_co... | 0.005141 |
def escape(t):
"""HTML-escape the text in `t`."""
return (t
# Convert HTML special chars into HTML entities.
.replace("&", "&").replace("<", "<").replace(">", ">")
.replace("'", "'").replace('"', """)
# Convert runs of spaces: "......" -> " ... | 0.003597 |
def _split_runs_on_parameters(runs):
"""Finds runs containing parameterized gates and splits them into sequential
runs excluding the parameterized gates.
"""
def _is_dagnode_parameterized(node):
return any(isinstance(param, Parameter) for param in node.op.params)
out = []
for run in ru... | 0.003752 |
def fmt_filename(text):
"""File name formatter.
Remove all file system forbidden char from text.
**中文文档**
移除文件系统中不允许的字符。
"""
forbidden_char = ["\\", "/", ":", "*", "?", "|", "<", ">", '"']
for char in forbidden_char:
text = text.replace(char, "")
return text | 0.006623 |
def refresh_db(root=None, **kwargs):
'''
Just run a ``pacman -Sy``, return a dict::
{'<database name>': Bool}
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
'''
# Remove rtag file to keep multiple refreshes from happening in pkg states
salt.utils.pkg.clear_rtag... | 0.000765 |
def namedb_get_history( cur, history_id, offset=None, count=None, reverse=False ):
"""
Get all of the history for a name or namespace.
Returns a dict keyed by block heights, paired to lists of changes (see namedb_history_extract)
"""
# get history in increasing order by block_id and then vtxindex
... | 0.021097 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.