text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def find_roots( disconnected, index, shared ):
"""Find appropriate "root" objects from which to recurse the hierarchies
Will generate a synthetic root for anything which doesn't have any parents...
"""
log.warn( '%s disconnected objects in %s total objects', len(disconnected), len(index))
natur... | 0.017154 |
def zrem(self, key, *members):
"""Removes the specified members from the sorted set stored at key.
Non existing members are ignored.
An error is returned when key exists and does not hold a sorted set.
.. note::
**Time complexity**: ``O(M*log(N))`` with ``N`` being the num... | 0.002574 |
def clear_highlight(self, src_id, line_start=0, line_end=-1, async_=None,
**kwargs):
"""Clear highlights from the buffer."""
async_ = check_async(async_, kwargs, True)
self.request('nvim_buf_clear_highlight', src_id,
line_start, line_end, async_=async... | 0.009317 |
def _run_popen(command, print_output=False):
"""
subprocess has the most terrible interface ever.
Envoy is an option but too heavyweight for this.
This is a convenience wrapper around subprocess.Popen.
Also, this merges STDOUT and STDERR together, since
there isn't a good way of interleaving th... | 0.001083 |
def set_tunnel(self, host, port):
''' Sets up the host and the port for the HTTP CONNECT Tunnelling.'''
url = host
if port:
url = url + u':' + port
var_host = VARIANT.create_bstr_from_str(url)
var_empty = VARIANT.create_empty()
_WinHttpRequest._SetProxy(
... | 0.005168 |
def get_num_part_files():
"""Get the number of PART.html files currently saved to disk."""
num_parts = 0
for filename in os.listdir(os.getcwd()):
if filename.startswith('PART') and filename.endswith('.html'):
num_parts += 1
return num_parts | 0.003623 |
def completion():
"""Output completion (to be eval'd).
For bash or zsh, add the following to your .bashrc or .zshrc:
eval "$(doitlive completion)"
For fish, add the following to ~/.config/fish/completions/doitlive.fish:
eval (doitlive completion)
"""
shell = env.get("SHELL", None... | 0.001471 |
def set_error_output_file(filename):
"""Sets a file to write out the VTK errors"""
filename = os.path.abspath(os.path.expanduser(filename))
fileOutputWindow = vtk.vtkFileOutputWindow()
fileOutputWindow.SetFileName(filename)
outputWindow = vtk.vtkOutputWindow()
outputWindow.SetInstance(fileOutput... | 0.00271 |
def add_source(self, name, src_dict, free=None, save_source_maps=True,
use_pylike=True, use_single_psf=False):
"""Add a new source to the model. Source properties
(spectrum, spatial model) are set with the src_dict argument.
Parameters
----------
name : str... | 0.001361 |
async def collect_wallets(self, uid):
"""
Asynchronous generator
"""
logging.debug(self.types)
logging.debug(uid)
for coinid in self.types:
logging.debug(coinid)
await asyncio.sleep(0.5)
# Connect to appropriate database
database = self.client[self.collection]
logging.debug(database)
colle... | 0.0368 |
def run_experiment(experiment, roleouts, episodes, in_cloud=False,
dynProfile=None):
""" Runs the given experiment and returns the results.
"""
def run():
if dynProfile is None:
maxsteps = len(experiment.profile) # episode length
else:
maxsteps = dy... | 0.002772 |
def register_ascii_series_io(array_type, format='txt', identify=True,
**defaults):
"""Register ASCII read/write/identify methods for the given array
"""
def _read(filepath, **kwargs):
kwgs = defaults.copy()
kwgs.update(kwargs)
return read_ascii_series(fil... | 0.001282 |
def start_transmit(self, blocking=False):
""" Start transmit on port.
:param blocking: True - wait for traffic end, False - return after traffic start.
"""
self.session.start_transmit(blocking, False, self) | 0.0125 |
def build_subtree_strut(self, result, *args, **kwargs):
"""
Returns a dictionary in form of
{node:Resource, children:{node_id: Resource}}
:param result:
:return:
"""
return self.service.build_subtree_strut(result=result, *args, **kwargs) | 0.006803 |
def _get_minute_message(self, dt, algo, metrics_tracker):
"""
Get a perf message for the given datetime.
"""
rvars = algo.recorded_vars
minute_message = metrics_tracker.handle_minute_close(
dt,
self.data_portal,
)
minute_message['minute_p... | 0.005263 |
def color_code(self, fore=None, back=None, style=None):
""" Return the codes for this style/colors. """
# Map from style type to raw code formatter function.
colorcodes = []
resetcodes = []
userstyles = {'style': style, 'back': back, 'fore': fore}
for stype in userstyles:... | 0.001982 |
def upload(self, local_path):
""" Upload a file to the camera's permanent storage.
:param local_path: Path to file to copy
:type local_path: str/unicode
"""
camerafile_p = ffi.new("CameraFile**")
with open(local_path, 'rb') as fp:
lib.gp_file_new_from_fd(cam... | 0.003367 |
def mousePressEvent( self, event ):
"""
Make sure on a mouse release event that we have a current item. If
no item is current, then our edit item will become current.
:param event | <QMouseReleaseEvent>
"""
item = self.itemAt(event.pos())
... | 0.013093 |
def padded_ds(ll_input, size=(250, 300), resize_method=ResizeMethod.CROP, padding_mode='zeros', **kwargs):
"For a LabelList `ll_input`, resize each image to `size` using `resize_method` and `padding_mode`."
return ll_input.transform(tfms=crop_pad(), size=size, resize_method=resize_method, padding_mode=p... | 0.01506 |
def from_str(cls: Type[BlockUIDType], blockid: str) -> BlockUIDType:
"""
:param blockid: The block id
"""
data = BlockUID.re_block_uid.match(blockid)
if data is None:
raise MalformedDocumentError("BlockUID")
try:
number = int(data.group(1))
... | 0.003509 |
def registerAugmentation(self, *names):
"""Register table extension.
SNMP SMI provides a way to extend already existing SMI table with
another table. This method registers dependent (extending) table
(or type :py:class:`MibTableRow`) to already existing table.
Whenever a row of... | 0.002982 |
def _create_combined_words(words, startindex):
"""
Helper for create_match_bool, used to combine words inside single quotes from a list into a
single string.
:param words: List of words.
:param startindex: Index where search is started.
:return: (str, int) or (None, 0) if no closing quote is fou... | 0.004057 |
def sign(key, qs):
"""Signs the query string using the key."""
sig = derive_signature(key, qs)
return "%s&%s" % (qs, urlencode([("sig", sig)])) | 0.006452 |
def _create_model_by_type(self, type):
"""
Create a new model instance by type.
:rtype: Model
"""
klass = None
for cls in eloquent.orm.model.Model.__subclasses__():
morph_class = cls.__morph_class__ or cls.__name__
if morph_class == type:
... | 0.005195 |
async def is_anonymous(request):
"""Check if user is anonymous.
User is considered anonymous if there is not identity
in request.
"""
identity_policy = request.config_dict.get(IDENTITY_KEY)
if identity_policy is None:
return True
identity = await identity_policy.identify(request)
... | 0.002639 |
def print_data(zone_id, connection):
"""fetch data from database (use zone_id if not empty/None) and print to
console"""
result = connection.execute(
# explicitly pass zone id before related data
select([cast(zone_id.encode('utf-8'), BYTEA), test_table]))
result = result.fetchall()
Z... | 0.004511 |
def item(*args, **kwargs):
'''
Return one or more grains
CLI Example:
.. code-block:: bash
salt '*' grains.item os
salt '*' grains.item os osrelease oscodename
Sanitized CLI Example:
.. code-block:: bash
salt '*' grains.item host sanitize=True
'''
ret = {}
... | 0.001597 |
def _smartos_computenode_data():
'''
Return useful information from a SmartOS compute node
'''
# Provides:
# vms_total
# vms_running
# vms_stopped
# vms_type
# sdc_version
# vm_capable
# vm_hw_virt
grains = {}
# collect vm data
vms = {}
for vm ... | 0.001138 |
def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the RevokeRequestPayload object and decode it
into its constituent parts.
Args:
istream (Stream): A data stream containing encoded object data,
supporting a read metho... | 0.001435 |
def make_xeditable(instance=None, extra_attrs=[], *args, **kwargs):
"""
Converts the contents of the column into an ``<a>`` tag with the required DOM attributes to
power the X-Editable UI.
The following keyword arguments are all optional, but may be provided when pre-calling the
helper, to customiz... | 0.004669 |
def _instantiate_task(api, kwargs):
"""Create a Task object from raw kwargs"""
file_id = kwargs['file_id']
kwargs['file_id'] = file_id if str(file_id).strip() else None
kwargs['cid'] = kwargs['file_id'] or None
kwargs['rate_download'] = kwargs['rateDownload']
kwargs['percent_done'] = kwargs['per... | 0.001058 |
def widgets(self):
'''
List widgets with filter return True for this node (or without filter).
Remove button is prepended if :property:can_remove returns true.
:returns: list of widgets
:rtype: list of namedtuple instances
'''
widgets = []
if self.can_re... | 0.002933 |
def _update_data(self):
"""Update the internal data values."""
_old = self.folds
self.folds = _get_fold_levels(self.editor)
# only update our dropdown lists if the folds have changed.
if self.folds != _old:
self.classes, self.funcs = _split_classes_and_methods(self.f... | 0.00551 |
def to_sa_pair_form(self, sparse=True):
"""
Convert this instance of `DiscreteDP` to SA-pair form
Parameters
----------
sparse : bool, optional(default=True)
Should the `Q` matrix be stored as a sparse matrix?
If true the CSR format is used
Retur... | 0.00216 |
def _build_commands(self, ip_dest, next_hop, **kwargs):
"""Build the EOS command string for ip route interactions.
Args:
ip_dest (string): The ip address of the destination in the
form of A.B.C.D/E
next_hop (string): The next hop interface or ip address
... | 0.001508 |
def list_nodes_select(nodes, selection, call=None):
'''
Return a list of the VMs that are on the provider, with select fields
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_select function must be called '
'with -f or --function.'
)
if 'e... | 0.001271 |
def set_as_object(self, *args):
"""
Sets a new value to map element specified by its index.
When the index is not defined, it resets the entire map value.
This method has double purpose because method overrides are not supported in JavaScript.
:param args: objects to set
... | 0.006579 |
async def services(self, *, dc=None, watch=None, consistency=None):
"""Lists services in a given DC
Parameters:
dc (str): Specify datacenter that will be used.
Defaults to the agent's local datacenter.
watch (Blocking): Do a blocking query
consi... | 0.001878 |
def debug(self, text):
"""
Posts a debug message adding a timestamp and logging level to it for both file and console handlers.
Logger uses a redraw rate because of console flickering. That means it will not draw new messages or progress
at the very time they are being logged but their t... | 0.009682 |
def load_scene(self, item):
"""Load scene from json."""
scene = Scene.from_config(self.pyvlx, item)
self.add(scene) | 0.014388 |
def attribute(self, name):
"""Expression for an input attribute.
An input attribute is an attribute on the input
port of the operator invocation.
Args:
name(str): Name of the attribute.
Returns:
Expression: Expression representing the input a... | 0.007389 |
def compute(self):
"""
Compute a MaxSAT solution. First, the method checks whether or
not the set of hard clauses is satisfiable. If not, the method
returns ``False``. Otherwise, add soft clauses to the oracle and
call the MaxSAT algorithm (see :func:`_compute`).
... | 0.001584 |
def from_stream(klass, stream, header, path=None, use_bgzf=None):
"""Create new :py:class:`Writer` from file
Note that for getting bgzf support, you have to pass in a stream
opened in binary mode. Further, you either have to provide a ``path``
ending in ``".gz"`` or set ``use_bgzf=True... | 0.002043 |
def split(value, dash_ranges=True):
"""Splits """
if isinstance(value, list):
value = [str(v) for v in value]
else:
str_value = str(value)
dash_matches = re.match(pattern='(\d+)\-(\d+)', string=str_value)
if ':' in str_value or ',' in str_value:
... | 0.008119 |
def dataproc(cls, graph, data):
""" example datagetter function, make any local modifications here """
for thing in data:
graph.add_trip(*thing)
raise NotImplementedError('You need to implement this yourlself!') | 0.008097 |
def register_measurements(self, end, rows, between, refresh_presision):
"""Register the measurements if it has measurements and close the configuration, if it hasen't got measurements clean the temporal file on disk.
Keyword arguments:
f -- open memory file
end -- datetime of the moment when the configurati... | 0.024116 |
def strptime(cls, date_string, format):
'string, format -> new datetime parsed from a string (like time.strptime()).'
import _strptime
return _strptime._strptime_datetime(cls, date_string, format) | 0.013636 |
def register_tile(self, hw_type, api_major, api_minor, name, fw_major, fw_minor, fw_patch, exec_major, exec_minor, exec_patch, slot, unique_id):
"""Register a tile with this controller.
This function adds the tile immediately to its internal cache of registered tiles
and queues RPCs to send all... | 0.004769 |
def info(self, text=None):
"""Shows and persists info symbol and text and exits.
Parameters
----------
text : None, optional
Text to be shown alongside info symbol.
Returns
-------
self
"""
return self.stop_and_persist(symbol=LogSymbols... | 0.005831 |
def rollforward(self, date):
"""Roll date forward to nearest start of year"""
if self.onOffset(date):
return date
else:
return date + YearBegin(month=self.month) | 0.009569 |
def update_note(note_id: NoteId, body: Body=None, done: Done=None) -> Note:
"""Update an existing note."""
if note_id != 1:
raise NotFoundError('Note does not exist')
new_note = note.copy()
if body is not None:
new_note['body'] = body
if done is not None:
new_note['done'] = d... | 0.014577 |
def _defaggr(name, type, func):
'Define aggregator `name` that calls func(col, rows)'
func.type=type
func.__name__ = name
return func | 0.013423 |
def output_summary(self, output_stream=sys.stdout):
"""outputs a usage tip and the list of acceptable commands.
This is useful as the output of the 'help' option.
parameters:
output_stream - an open file-like object suitable for use as the
target of a pri... | 0.000557 |
def addApplicationManifest(self, pchApplicationManifestFullPath, bTemporary):
"""
Adds an application manifest to the list to load when building the list of installed applications.
Temporary manifests are not automatically loaded
"""
fn = self.function_table.addApplicationManif... | 0.00978 |
def entrez(db, acc):
"""
search entrez using specified database
and accession
"""
c1 = ['esearch', '-db', db, '-query', acc]
c2 = ['efetch', '-db', 'BioSample', '-format', 'docsum']
p1 = Popen(c1, stdout = PIPE, stderr = PIPE)
p2 = Popen(c2, stdin = p1.stdout, stdout = PIPE, stderr = PIP... | 0.031429 |
def create_dictionary_of_element_from_dictionary(self, property_name, datas):
"""Populate a dictionary of elements
"""
response = {}
if property_name in datas and datas[property_name] is not None and isinstance(datas[property_name], collections.Iterable):
for key, value in da... | 0.00883 |
def wait_until_page_does_not_contain(self, text, timeout=None, error=None):
"""Waits until `text` disappears from current page.
Fails if `timeout` expires before the `text` disappears. See
`introduction` for more information about `timeout` and its
default value.
`error` can be... | 0.003363 |
def islice_extended(iterable, *args):
"""An extension of :func:`itertools.islice` that supports negative values
for *stop*, *start*, and *step*.
>>> iterable = iter('abcdefgh')
>>> list(islice_extended(iterable, -4, -1))
['e', 'f', 'g']
Slices with negative values require some cach... | 0.000266 |
def perform_ops(self):
"""
Performs the stored operations on the database
connection.
"""
with self.db:
with closing(self.db.cursor()) as cursor:
cursor.execute('BEGIN TRANSACTION')
self._perform_ops(cursor) | 0.006873 |
def get_user_orders(self):
"""Return user's orders that are currently open.
:return: User's orders currently open.
:rtype: [dict]
"""
self._log('get user orders')
return self._rest_client.post(
endpoint='/open_orders',
payload={'book': self.name}
... | 0.006079 |
def _set_alarm_entry(self, v, load=False):
"""
Setter method for alarm_entry, mapped from YANG variable /rmon/alarm_entry (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_alarm_entry is considered as a private
method. Backends looking to populate this variable ... | 0.003459 |
def _glob(self, curdir, this, rest):
"""
Handle glob flow.
There are really only a couple of cases:
- File name.
- File name pattern (magic).
- Directory.
- Directory name pattern (magic).
- Extra slashes `////`.
- `globstar` `**`.
"""
... | 0.002205 |
def get_object_ids(model, meteor_ids):
"""Return all object IDs for the given meteor_ids."""
if model is ObjectMapping:
# this doesn't make sense - raise TypeError
raise TypeError("Can't map ObjectMapping instances through self.")
# Django model._meta is now public API -> pylint: disable=W02... | 0.000855 |
def find_by_ref(self, ref_type, ref_id):
"""
Returns an object of type "item", "status" or "task" as a
stream object. This is useful when a new status has been
posted and should be rendered directly in the stream without
reloading the entire stream.
For details, see: htt... | 0.00641 |
def _chunks(iterable, n):
"""
Splits an iterable into chunks of size n.
"""
iterable = iter(iterable)
while True:
# store one line in memory,
# chain it to an iterator on the rest of the chunk
yield chain([next(iterable)], islice(iterable, n-1)) | 0.00346 |
def reset(self):
'''
Reset Stan model and all tracked distributions and parameters.
'''
self.parameters = []
self.transformed_parameters = []
self.expressions = []
self.data = []
self.transformed_data = []
self.X = {}
self.model = []
... | 0.003115 |
def analyzeWeightPruning(args):
"""
Multiprocess function used to analyze the impact of nonzeros and accuracy
after pruning low weights and units with low dutycycle of a pre-trained model.
:param args: tuple with the following arguments:
- experiment path: The experiment results path
... | 0.011935 |
def find_node(self, node, path):
"""Finds a node by the given path from the given node."""
for hash_value in path:
if isinstance(node, LeafStatisticsNode):
break
for stats in node.get_child_keys():
if hash(stats) == hash_value:
... | 0.004556 |
def setup_callables(self):
"""
Setup Callable attributes that belong to this object.
"""
defaults = self.get_default_callables()
for key, value in list(defaults.items()):
self._postponed_callables.setdefault(key, value)
for key in self.callables:
... | 0.004283 |
def up(tag, sql, revision):
""" Upgrade to revision """
alembic_command.upgrade(
config=get_config(),
revision=revision,
sql=sql,
tag=tag
) | 0.005464 |
def parse(self, value):
"""
Parse date
"""
value = super(DateOpt, self).parse(value)
if value is None:
return None
if isinstance(value, str):
value = self.parse_date(value)
if isinstance(value, datetime) and self.date_only:
valu... | 0.005602 |
def com_google_fonts_check_metadata_menu_and_latin(family_metadata):
"""METADATA.pb should contain at least "menu" and "latin" subsets."""
missing = []
for s in ["menu", "latin"]:
if s not in list(family_metadata.subsets):
missing.append(s)
if missing != []:
yield FAIL, ("Subsets \"menu\" and \"l... | 0.013308 |
def read_single_knmi_file(filename):
"""reads a single file of KNMI's meteorological time series
data availability: www.knmi.nl/nederland-nu/klimatologie/uurgegevens
Args:
filename: the file to be opened
Returns:
pandas data frame including time series
"""
hourly_data_obs_raw ... | 0.001218 |
def progress_updater(size, total):
"""Progress reporter for checksum verification."""
current_task.update_state(
state=state('PROGRESS'),
meta=dict(size=size, total=total)
) | 0.004975 |
def db_aws_delete_instance(self, instance_id):
''' Delete AWS DB instance '''
interactive = False
if instance_id is None:
interactive = True
instances = self.db_services.get_db_instances()
instance_list = [dbinst.id for dbinst in instances]
if interactive:
... | 0.007609 |
def create_contact(self, email=None, first_name=None, last_name=None, phone_number=None):
"""
Create a contant which is later passed to payment.
"""
result = {}
if email:
result['email'] = email
if first_name is not None:
result['first_name'] = fir... | 0.005525 |
def rotate_and_detach_tab_labels(self):
"""Rotates tab labels of a given notebook by 90 degrees and makes them detachable.
:param notebook: GTK Notebook container, whose tab labels are to be rotated and made detachable
"""
icons = {'Libraries': constants.SIGN_LIB, 'States Tree': constan... | 0.007882 |
def rename(self, old_file_path, new_file_path, force_replace=False):
"""Renames a FakeFile object at old_file_path to new_file_path,
preserving all properties.
Args:
old_file_path: Path to filesystem object to rename.
new_file_path: Path to where the filesystem object wi... | 0.000598 |
def format_logstash_v0(self, record):
'''
Messages are formatted in logstash's expected format.
'''
host = salt.utils.network.get_fqhostname()
message_dict = {
'@timestamp': self.formatTime(record),
'@fields': {
'levelname': record.levelnam... | 0.001444 |
def get(self, name, ns=None, default=None):
"""
Get the value of an attribute by name.
@param name: The name of the attribute.
@type name: basestring
@param ns: The optional attribute's namespace.
@type ns: (I{prefix}, I{name})
@param default: An optional value t... | 0.002829 |
def BC_0Displacement0Slope(self):
"""
0Displacement0Slope boundary condition for 0 deflection.
This requires that nothing be done to the edges of the solution array,
because the lack of the off-grid terms implies that they go to 0
Here we just turn the cells outside the array into nan, to ensu... | 0.029012 |
def __checkExpiration(self, mtime=None):
'''
__checkExpiration - Check if we have expired
@param mtime <int> - Optional mtime if known, otherwise will be gathered
@return <bool> - True if we did expire, otherwise False
'''
if not self.maxLockAge:... | 0.006515 |
def hist_series(self, by=None, ax=None, grid=True, xlabelsize=None,
xrot=None, ylabelsize=None, yrot=None, figsize=None,
bins=10, **kwds):
"""
Draw histogram of the input series using matplotlib.
Parameters
----------
by : object, optional
If passed, then use... | 0.000331 |
def addSlider2D(
self, sliderfunc, xmin, xmax, value=None, pos=4, s=0.04, title="", c=None, showValue=True
):
"""Add a slider widget which can call an external custom function.
:param sliderfunc: external function to be called by the widget
:param float xmin: lower value
:p... | 0.008516 |
def __print_namespace_help(self, session, namespace, cmd_name=None):
"""
Prints the documentation of all the commands in the given name space,
or only of the given command
:param session: Session Handler
:param namespace: Name space of the command
:param cmd_name: Name o... | 0.002169 |
def rename_nfa_states(nfa: dict, suffix: str):
""" Side effect on input! Renames all the states of the NFA
adding a **suffix**.
It is an utility function to be used to avoid automata to have
states with names in common.
Avoid suffix that can lead to special name like "as", "and",...
:param di... | 0.000761 |
def get_contradiction_summary(graph: BELGraph) -> Iterable[Tuple[BaseEntity, BaseEntity, str]]:
"""Yield triplets of (source node, target node, set of relations) for (source node, target node) pairs
that have multiple, contradictory relations.
"""
for u, v in set(graph.edges()):
relations = {dat... | 0.006608 |
def log(self, *args, **kwargs):
"""Convenience function for printing indenting debug output."""
if self.verbose:
print(' ' * self.depth, *args, **kwargs) | 0.010929 |
def rotate(self, axis, angleDeg):
"""
Rotate geometry.
axis: axis of rotation (array of floats)
angleDeg: rotation angle in degrees
"""
ax = Vector(axis[0], axis[1], axis[2]).unit()
cosAngle = math.cos(math.pi * angleDeg / 180.)
sinAngle = math.sin(m... | 0.001876 |
def __compute_mode_from_string(self, path, mode_string):
"""
Scan a unix-style mode string and apply it to ``path``.
:type mode_string: str
:param mode_string: see ``man chmod`` for details. ``X``, ``s``
and ``t`` modes are not supported. The string should match the
... | 0.000787 |
def clone(self, data=None, shared_data=True, *args, **overrides):
"""Clones the object, overriding data and parameters.
Args:
data: New data replacing the existing data
shared_data (bool, optional): Whether to use existing data
new_type (optional): Type to cast objec... | 0.004338 |
def set_pre_processing_parameters(self, image_input_names = [], is_bgr = False,
red_bias = 0.0, green_bias = 0.0, blue_bias = 0.0, gray_bias = 0.0, image_scale = 1.0):
"""Add pre-processing parameters to the neural network object
Parameters
----------
image_input_names: [str... | 0.011914 |
def check_ntp_status(self, ntp_status_int):
"""
check the NTP status
"""
# convert the ntp_status integer value in a human readable value
ntp_status_string = self.ntp_status.get(ntp_status_int, "unknown")
if ntp_status_string == "unknown":
return unknown, ("N... | 0.006906 |
def _advapi32_interpret_dsa_key_blob(bit_size, public_blob, private_blob):
"""
Takes a CryptoAPI DSS private key blob and converts it into the ASN.1
structures for the public and private keys
:param bit_size:
The integer bit size of the key
:param public_blob:
A byte string of the ... | 0.000571 |
def goes_requires(self, regs):
""" Returns whether any of the goes_to block requires any of
the given registers.
"""
if len(self) and self.mem[-1].inst == 'call' and self.mem[-1].condition_flag is None:
for block in self.calls:
if block.is_used(regs, 0):
... | 0.00607 |
def process_node_search(self, node, q, **kwargs):
'''
API: process_node_search(self, node, q, **kwargs)
Description:
Used by search() method. Process nodes along the search. Should not be
called by user directly.
Input:
node: Name of the node being processed.
... | 0.003339 |
def _create_lacp(self, datapath, port, req):
"""create a LACP packet."""
actor_system = datapath.ports[datapath.ofproto.OFPP_LOCAL].hw_addr
res = slow.lacp(
actor_system_priority=0xffff,
actor_system=actor_system,
actor_key=req.actor_key,
actor_por... | 0.001086 |
def _modify_run_to_states(self, state):
"""
This is a special case. Inside a hierarchy state a step_over is triggered and affects the last child.
In this case the self.run_to_states has to be modified in order to contain the parent of the hierarchy state.
Otherwise the execution won't re... | 0.006879 |
def _broadcast(value, target):
"""Broadcast a value to match the batching dimensions of a target.
If necessary the value is converted into a tensor. Both value and target
should be of the same dtype.
Args:
value: A value to broadcast.
target: A `Tensor` of shape [b1, ..., bn, d].
Returns:
A `Te... | 0.005671 |
def complex_mult(A, B, shifts, start):
""" Generate shift-and-add multiplier that can shift and add multiple bits per clock cycle.
Uses substantially more space than `simple_mult()` but is much faster.
:param WireVector A, B: two input wires for the multiplication
:param int shifts: number of spaces Re... | 0.003108 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.