text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def ctxtUseOptions(self, options):
"""Applies the options to the parser context """
ret = libxml2mod.xmlCtxtUseOptions(self._o, options)
return ret | 0.011696 |
def _create_axes(hist: HistogramBase, vega: dict, kwargs: dict):
"""Create axes in the figure."""
xlabel = kwargs.pop("xlabel", hist.axis_names[0])
ylabel = kwargs.pop("ylabel", hist.axis_names[1] if len(hist.axis_names) >= 2 else None)
vega["axes"] = [
{"orient": "bottom", "scale": "xscale", "t... | 0.00495 |
def hub_history(self):
"""Get the Hub's history
Just like the Client, the Hub has a history, which is a list of msg_ids.
This will contain the history of all clients, and, depending on configuration,
may contain history across multiple cluster sessions.
Any msg_id returned here... | 0.004619 |
def authenticate_multi(self, msg: Dict, signatures: Dict[str, str],
threshold: Optional[int] = None):
"""
:param msg:
:param signatures: A mapping from identifiers to signatures.
:param threshold: The number of successful signature verification
required... | 0.007519 |
def __read_device(self):
"""Read the state of the gamepad."""
state = XinputState()
res = self.manager.xinput.XInputGetState(
self.__device_number, ctypes.byref(state))
if res == XINPUT_ERROR_SUCCESS:
return state
if res != XINPUT_ERROR_DEVICE_NOT_CONNECTE... | 0.003711 |
def copyData(self, source):
"""
Subclasses may override this method.
If so, they should call the super.
"""
for attr in self.copyAttributes:
selfValue = getattr(self, attr)
sourceValue = getattr(source, attr)
if isinstance(selfValue, BaseObject... | 0.004577 |
def transacted(func):
"""
Return a callable which will invoke C{func} in a transaction using the
C{store} attribute of the first parameter passed to it. Typically this is
used to create Item methods which are automatically run in a transaction.
The attributes of the returned callable will resemble... | 0.001727 |
def local_machine():
"""Option to do something on local machine."""
common_conf()
env.machine = 'local'
env.pg_admin_role = settings.LOCAL_PG_ADMIN_ROLE
env.db_backup_dir = settings.DJANGO_PROJECT_ROOT
env.media_backup_dir = settings.DJANGO_PROJECT_ROOT
# Not sure what this is good for. Not... | 0.001779 |
def get_resolved_config(
egrc_path,
examples_dir,
custom_dir,
use_color,
pager_cmd,
squeeze,
debug=True,
):
"""
Create a Config namedtuple. Passed in values will override defaults.
This function is responsible for producing a Config that is correct for the
passed in argument... | 0.000318 |
def _create(self):
"""Create new callback resampler."""
from samplerate.lowlevel import ffi, src_callback_new, src_delete
from samplerate.exceptions import ResamplingError
state, handle, error = src_callback_new(
self._callback, self._converter_type.value, self._channels)
... | 0.004357 |
def psetex(self, key, time, value):
"""
Set the value of ``key`` to ``value`` that expires in ``time``
milliseconds. ``time`` can be represented by an integer or a Python
timedelta object.
"""
return self.set(key, value, px=time) | 0.00722 |
def _get_provider_session(self, session_name):
"""Returns the requested provider session.
Instantiates a new one if the named session is not already known.
"""
agent_key = self._get_agent_key()
if session_name in self._provider_sessions[agent_key]:
return self._prov... | 0.005253 |
def _expand_variables(self, config, hostname ):
"""
Return a dict of config options with expanded substitutions
for a given hostname.
Please refer to man ssh_config(5) for the parameters that
are replaced.
@param config: the config for the hostname
@type hostnam... | 0.004355 |
def as_list(self, key):
"""
A convenience method which fetches the specified value, guaranteeing
that it is a list.
>>> a = ConfigObj()
>>> a['a'] = 1
>>> a.as_list('a')
[1]
>>> a['a'] = (1,)
>>> a.as_list('a')
[1]
>>> a['a'] = [1]... | 0.004 |
def gpib_command(library, session, data):
"""Write GPIB command bytes on the bus.
Corresponds to viGpibCommand function of the VISA library.
:param library: the visa library wrapped by ctypes.
:param session: Unique logical identifier to a session.
:param data: data tor write.
:type data: byte... | 0.001548 |
def get(name, defval=None):
'''
Return an object from the embedded synapse data folder.
Example:
for tld in syanpse.data.get('iana.tlds'):
dostuff(tld)
NOTE: Files are named synapse/data/<name>.mpk
'''
with s_datfile.openDatFile('synapse.data/%s.mpk' % name) as fd:
... | 0.002849 |
def _get_csrf_token(self):
"""Return the CSRF Token of easyname login form."""
from bs4 import BeautifulSoup
home_response = self.session.get(self.URLS['login'])
self._log('Home', home_response)
assert home_response.status_code == 200, \
'Could not load Easyname login... | 0.003268 |
def interp_qa_v1(self):
"""Calculate the lake outflow based on linear interpolation.
Required control parameters:
|N|
|llake_control.Q|
Required derived parameters:
|llake_derived.TOY|
|llake_derived.VQ|
Required aide sequence:
|llake_aides.VQ|
Calculated aide seque... | 0.000272 |
def write_shas_to_shastore(sha_dict):
"""
Writes a sha1 dictionary stored in memory to
the .shastore file
"""
if sys.version_info[0] < 3:
fn_open = open
else:
fn_open = io.open
with fn_open(".shastore", "w") as fh:
fh.write("---\n")
fh.write('sake version: {}\... | 0.002294 |
def _mount_devicemapper(self, identifier):
"""
Devicemapper mount backend.
"""
info = self.client.info()
# cid is the contaienr_id of the temp container
cid = self._identifier_as_cid(identifier)
cinfo = self.client.inspect_container(cid)
dm_dev_name, d... | 0.001664 |
def is_value_in(constants_group, value):
"""
Checks whether value can be found in the given constants group, which in
turn, should be a Django-like choices tuple.
"""
for const_value, label in constants_group:
if const_value == value:
return True
return False | 0.0033 |
def login(self, email=None, password=None):
"""
Interactive login using the `cloudgenix.API` object. This function is more robust and handles SAML and MSP accounts.
Expects interactive capability. if this is not available, use `cloudenix.API.post.login` directly.
**Parameters:**:
... | 0.003324 |
def map_vals(func, dict_):
"""
applies a function to each of the keys in a dictionary
Args:
func (callable): a function or indexable object
dict_ (dict): a dictionary
Returns:
newdict: transformed dictionary
CommandLine:
python -m ubelt.util_dict map_vals
Exam... | 0.000906 |
def _create_wcs (fitsheader):
"""For compatibility between astropy and pywcs."""
wcsmodule = _load_wcs_module ()
is_pywcs = hasattr (wcsmodule, 'UnitConverter')
wcs = wcsmodule.WCS (fitsheader)
wcs.wcs.set ()
wcs.wcs.fix () # I'm interested in MJD computation via datfix()
if hasattr (wcs, ... | 0.020501 |
def get_serializer_class(configuration_model):
""" Returns a ConfigurationModel serializer class for the supplied configuration_model. """
class AutoConfigModelSerializer(ModelSerializer):
"""Serializer class for configuration models."""
class Meta(object):
"""Meta information for A... | 0.005083 |
def _write(self, frame):
"""
Write a YubiKeyFrame to the USB HID.
Includes polling for YubiKey readiness before each write.
"""
for data in frame.to_feature_reports(debug=self.debug):
debug_str = None
if self.debug:
(data, debug_str) = dat... | 0.003914 |
def logger_focus(self,i,focus_shift=16):
"""
focuses the logger on an index 12 entries below i
@param: i -> index to focus on
"""
if self.logger.GetItemCount()-1 > i+focus_shift:
i += focus_shift
else:
i = self.logger.GetItemCount()-1
self.... | 0.01194 |
def create(
name,
attributes=None,
region=None,
key=None,
keyid=None,
profile=None,
):
'''
Create an SQS queue.
CLI Example:
.. code-block:: bash
salt myminion boto_sqs.create myqueue region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, pr... | 0.001543 |
def _newton_refine(s, nodes1, t, nodes2):
r"""Apply one step of 2D Newton's method.
.. note::
There is also a Fortran implementation of this function, which
will be used if it can be built.
We want to use Newton's method on the function
.. math::
F(s, t) = B_1(s) - B_2(t)
... | 0.000086 |
def start_flask_service(self):
"""Define Flask parameter server service.
This HTTP server can do two things: get the current model
parameters and update model parameters. After registering
the `parameters` and `update` routes, the service will
get started.
"""
a... | 0.001212 |
def _crossings(self):
"""
counts (inefficently but at least accurately) the number of
crossing edges between layer l and l+dirv.
P[i][j] counts the number of crossings from j-th edge of vertex i.
The total count of crossings is the sum of flattened P:
x = sum(sum(P,[]))
... | 0.013373 |
def _encode_time(self, value):
"""Convert datetime to base64 or plaintext string"""
if self._kp.version >= (4, 0):
diff_seconds = int(
(
self._datetime_to_utc(value) -
datetime(
year=1,
m... | 0.003012 |
def GetDevicePath(device_handle):
"""Obtains the unique path for the device.
Args:
device_handle: reference to the device
Returns:
A unique path for the device, obtained from the IO Registry
"""
# Obtain device path from IO Registry
io_service_obj = iokit.IOHIDDeviceGetService(device_handle)
st... | 0.014315 |
def _get_form_or_formset(self, request, obj, **kwargs):
"""
Generic code shared by get_form and get_formset.
"""
if self.exclude is None:
exclude = []
else:
exclude = list(self.exclude)
exclude.extend(self.get_readonly_fields(request, obj))
... | 0.003405 |
def find_sinks(obj):
"""
Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, ctx):
...
is not... | 0.008065 |
def create_ospf_profile():
"""
An OSPF Profile contains administrative distance and redistribution settings. An
OSPF Profile is applied at the engine level.
When creating an OSPF Profile, you must reference a OSPFDomainSetting.
An OSPFDomainSetting holds the settings of the area border router (AB... | 0.009259 |
def subsystem_closure_iter(cls):
"""Iterate over the transitive closure of subsystem dependencies of this Optionable.
:rtype: :class:`collections.Iterator` of :class:`SubsystemDependency`
:raises: :class:`pants.subsystem.subsystem_client_mixin.SubsystemClientMixin.CycleException`
if a dependen... | 0.012291 |
def kdot(x, y, K=2):
"""Algorithm 5.10. Dot product algorithm in K-fold working precision,
K >= 3.
"""
xx = x.reshape(-1, x.shape[-1])
yy = y.reshape(y.shape[0], -1)
xx = numpy.ascontiguousarray(xx)
yy = numpy.ascontiguousarray(yy)
r = _accupy.kdot_helper(xx, yy).reshape((-1,) + x.shap... | 0.002725 |
def _reduce_by_ngram(self, data, ngram):
"""Lowers the counts of all n-grams in `data` that are
substrings of `ngram` by `ngram`\'s count.
Modifies `data` in place.
:param data: row data dictionary for the current text
:type data: `dict`
:param ngram: n-gram being reduc... | 0.002497 |
def get_field_resolver(
self, field_resolver: GraphQLFieldResolver
) -> GraphQLFieldResolver:
"""Wrap the provided resolver with the middleware.
Returns a function that chains the middleware functions with the provided
resolver function.
"""
if self._middleware_resol... | 0.005674 |
def apply_integer_offsets(image2d, offx, offy):
"""Apply global (integer) offsets to image.
Parameters
----------
image2d : numpy array
Input image
offx : int
Offset in the X direction (must be integer).
offy : int
Offset in the Y direction (must be integer).
Return... | 0.004057 |
def info(request, message, extra_tags='', fail_silently=False, async=False):
"""Adds a message with the ``INFO`` level."""
if ASYNC and async:
messages.info(_get_user(request), message)
else:
add_message(request, constants.INFO, message, extra_tags=extra_tags,
fail_silent... | 0.008902 |
def nodes(self, unreported=2, with_status=False, **kwargs):
"""Query for nodes by either name or query. If both aren't
provided this will return a list of all nodes. This method
also fetches the nodes status and event counts of the latest
report from puppetdb.
:param with_status... | 0.000897 |
def run(): # pylint: disable=too-many-branches
"""
Main thread runner for all Duts.
:return: Nothing
"""
Dut._logger.debug("Start DUT communication", extra={'type': '<->'})
while Dut._run:
Dut._sem.acquire()
try:
dut = Dut._signal... | 0.00215 |
def create(observation_data,
user_id='user_id', item_id='item_id', target=None,
user_data=None, item_data=None,
nearest_items=None,
similarity_type='jaccard',
threshold=0.001,
only_top_k=64,
verbose=True,
target_memory_usage = 8*102... | 0.002029 |
def count_missing(self, axis=None):
"""Count missing genotypes.
Parameters
----------
axis : int, optional
Axis over which to count, or None to perform overall count.
"""
b = self.is_missing()
return np.sum(b, axis=axis) | 0.006897 |
def _get_mu_tensor(self):
"""Get the min mu which minimize the surrogate.
Returns:
The mu_t.
"""
root = self._get_cubic_root()
dr = self._h_max / self._h_min
mu = tf.maximum(
root**2, ((tf.sqrt(dr) - 1) / (tf.sqrt(dr) + 1))**2)
return mu | 0.003571 |
def risk_score(self, domains):
"""Performs Umbrella risk score analysis on the input domains
Args:
domains: an enumerable of domains
Returns:
An enumerable of associated domain risk scores
"""
api_name = 'opendns-risk_score'
fmt_url_path = u'domai... | 0.004975 |
def parse_lxml(self, file, encoding=None, target_class=HTMLParserTarget,
parser_type='html'):
'''Return an iterator of elements found in the document.
Args:
file: A file object containing the document.
encoding (str): The encoding of the document.
... | 0.001519 |
def get_person(people_id):
''' Return a single person '''
result = _get(people_id, settings.PEOPLE)
return People(result.content) | 0.007092 |
def header(self, text, level, raw=None):
"""Rendering header/heading tags like ``<h1>`` ``<h2>``.
:param text: rendered text content for the header.
:param level: a number for the header level, for example: 1.
:param raw: raw text content of the header.
"""
return '\n{0}... | 0.004773 |
def CopyNote(self, part, measure_id, new_note):
'''
handles copying the latest note into the measure note list.
done at end of note loading to make sure staff_id is right as staff id could be encountered
any point during the note tag
:param part: the part class to copy it into... | 0.002608 |
def get_address_transactions(self, address_id, **params):
"""https://developers.coinbase.com/api/v2#list-address39s-transactions"""
return self.api_client.get_address_transactions(self.id, address_id, **params) | 0.017699 |
def list_changes(self):
"""
Return a list of modified records.
This is only applicable for attached tables.
Returns:
A list of `(row_index, record)` tuples of modified records
Raises:
:class:`delphin.exceptions.ItsdbError`: when called on a
... | 0.00354 |
def TryCompile( self, text, extension):
"""Compiles the program given in text to an env.Object, using extension
as file extension (e.g. '.c'). Returns 1, if compilation was
successful, 0 otherwise. The target is saved in self.lastTarget (for
further processing).
"""
retur... | 0.00813 |
def is_data_diverging(data_container):
"""
We want to use this to check whether the data are diverging or not.
This is a simple check, can be made much more sophisticated.
:param data_container: A generic container of data points.
:type data_container: `iterable`
"""
assert infer_data_type... | 0.001295 |
def validate_profile_exists(self):
"""Validate the provided profiles name exists."""
if self.args.profile_name not in self.profiles:
self.handle_error('Could not find profile "{}"'.format(self.args.profile_name)) | 0.012448 |
def pnlSingle(
self, account: str = '', modelCode: str = '',
conId: int = 0) -> List[PnLSingle]:
"""
List of subscribed :class:`.PnLSingle` objects (profit and loss for
single positions).
The :class:`.PnLSingle` objects are kept live updated.
Args:
... | 0.002649 |
def prepare_editable_requirement(
self,
req, # type: InstallRequirement
require_hashes, # type: bool
use_user_site, # type: bool
finder # type: PackageFinder
):
# type: (...) -> DistAbstraction
"""Prepare an editable requirement
"""
assert ... | 0.003378 |
def add_license(key, description, safety_checks=True,
service_instance=None):
'''
Adds a license to the vCenter or ESXi host
key
License key.
description
License description added in as a label.
safety_checks
Specify whether to perform safety check or to sk... | 0.001355 |
def raw_cron(user):
'''
Return the contents of the user's crontab
CLI Example:
.. code-block:: bash
salt '*' cron.raw_cron root
'''
if _check_instance_uid_match(user) or __grains__.get('os_family') in ('Solaris', 'AIX'):
cmd = 'crontab -l'
# Preserve line endings
... | 0.002568 |
def is_related_to(item, app_id, app_ver=None):
"""Return True if the item relates to the given app_id (and app_ver, if passed)."""
versionRange = item.get('versionRange')
if not versionRange:
return True
for vR in versionRange:
if not vR.get('targetApplication'):
return True... | 0.004587 |
def read_file(self, file_path):
''' Read a configuration file and return configuration data '''
getLogger().info("Loading app config from {} file: {}".format(self.__mode, file_path))
if self.__mode == AppConfig.JSON:
return json.loads(FileHelper.read(file_path), object_pairs_hook=Ord... | 0.007984 |
def _func_args_from_dict(self, d):
"""Given a Python dictionary, creates a string representing arguments
for invoking a function. All arguments with a value of None are
ignored."""
filtered_d = self.filter_out_none_valued_keys(d)
return ', '.join(['%s=%s' % (k, v) for k, v in fil... | 0.005935 |
def cyclic_rainbow(script, direction='sphere', start_pt=(0, 0, 0),
amplitude=255 / 2, center=255 / 2, freq=0.8,
phase=(0, 120, 240, 0), alpha=False):
""" Color mesh vertices in a repeating sinusiodal rainbow pattern
Sine wave follows the following equation for each color c... | 0.000261 |
def update_case(self, case_obj):
"""Update a case in the database
The following will be updated:
- collaborators: If new collaborators these will be added to the old ones
- analysis_date: Is updated to the new date
- analyses: The new analysis date will be added to o... | 0.001537 |
def exists(self, dataset_id):
""" Check if a dataset exists in Google BigQuery
Parameters
----------
dataset_id : str
Name of dataset to be verified
Returns
-------
boolean
true if dataset exists, otherwise false
"""
from ... | 0.00335 |
def xisabs(filename):
""" Cross-platform version of `os.path.isabs()`
Returns True if `filename` is absolute on
Linux, OS X or Windows.
"""
if filename.startswith(b'/'): # Linux/Unix
return True
elif filename.startswith(b'\\'): # Windows
return True
elif re.match(b'\\w:[\\\\/]', filen... | 0.019126 |
def mouse_event(dwFlags: int, dx: int, dy: int, dwData: int, dwExtraInfo: int) -> None:
"""mouse_event from Win32."""
ctypes.windll.user32.mouse_event(dwFlags, dx, dy, dwData, dwExtraInfo) | 0.010204 |
def write_to(self, group):
"""Write stored items to the given HDF5 group.
We assume that self.create() has been called.
"""
# The HDF5 group where to write data
items_group = group[self.name]
nitems = items_group.shape[0]
items_group.resize((nitems + len(self.d... | 0.005435 |
def to_map_with_default(value, default_value):
"""
Converts value into map object or returns default when conversion is not possible
:param value: the value to convert.
:param default_value: the default value.
:return: map object or emptu map when conversion is not supported.
... | 0.00885 |
def Fierz_to_Bern_chrom(C, dd, parameters):
"""From Fierz to chromomagnetic Bern basis for Class V.
dd should be of the form 'sb', 'ds' etc."""
e = sqrt(4 * pi * parameters['alpha_e'])
gs = sqrt(4 * pi * parameters['alpha_s'])
if dd == 'sb' or dd == 'db':
mq = parameters['m_b']
elif dd =... | 0.013025 |
def _process_member(self, member, parent, string):
"""Extracts all the member info from the regex match; returns a ValueElements."""
#The modifiers regex is very greedy so we have some cleaning up to do
#to extract the mods.
modifiers = member.group("modifiers")
dimension = None
... | 0.010944 |
def arping(net, timeout=2, cache=0, verbose=None, **kargs):
"""Send ARP who-has requests to determine which hosts are up
arping(net, [cache=0,] [iface=conf.iface,] [verbose=conf.verb]) -> None
Set cache=True if you want arping to modify internal ARP-Cache"""
if verbose is None:
verbose = conf.verb
a... | 0.008368 |
def diff(self, diff):
""" Serialize to a dictionary. """
if diff is None:
return None
return dict(
toVol=diff.toUUID,
fromVol=diff.fromUUID,
size=diff.size,
sizeIsEstimated=diff.sizeIsEstimated,
) | 0.006944 |
def load_file(self, filename):
"""
load file which contains yaml configuration entries.and merge it by
current instance
:param files: files to load and merge into existing configuration
instance
:type files: list
"""
if not path.exists(file... | 0.00409 |
def _set_objective_bank_view(self, session):
"""Sets the underlying objective_bank view to match current view"""
if self._objective_bank_view == FEDERATED:
try:
session.use_federated_objective_bank_view()
except AttributeError:
pass
else:
... | 0.004444 |
def check_output(self, cmd):
"""Calls a command through SSH and returns its output.
"""
ret, output = self._call(cmd, True)
if ret != 0: # pragma: no cover
raise RemoteCommandFailure(command=cmd, ret=ret)
logger.debug("Output: %r", output)
return output | 0.006369 |
def current(self):
# type: () -> Hub
"""Returns the current instance of the hub."""
rv = _local.get(None)
if rv is None:
rv = Hub(GLOBAL_HUB)
_local.set(rv)
return rv | 0.013043 |
def rfc2426(self):
"""RFC2426-encode the field content.
:return: the field in the RFC 2426 format.
:returntype: `str`"""
return rfc2425encode("label",u"\n".join(self.lines),
{"type":",".join(self.type)}) | 0.019841 |
def put_intent(self, intent_id, intent_json):
"""Send a put request to update the intent with intent_id"""
endpoint = self._intent_uri(intent_id)
return self._put(endpoint, intent_json) | 0.009569 |
def update(self, campaign_id, search_channels, nonsearch_channels, outside_discount, nick=None):
'''xxxxx.xxxxx.campaign.platform.update
===================================
取得一个推广计划的投放平台设置'''
request = TOPRequest('xxxxx.xxxxx.campaign.platform.update')
request['campaign_id'] = ca... | 0.016713 |
def _print_single_file(self, path, apps_models):
"""
Print apps_models which contains a list of 2-tuples containing apps and their models
into a single file.
"""
if path:
outfile = codecs.open(path, 'w', encoding='utf-8')
self._print = lambda s: outfile.wr... | 0.005484 |
def _get_users_of_group(config, group):
""" Utility to query fas for users of a group. """
if not group:
return set()
fas = fmn.rules.utils.get_fas(config)
return fmn.rules.utils.get_user_of_group(config, fas, group) | 0.004167 |
def detach(gandi, resource, background, force):
"""Detach an ip from it's currently attached vm.
resource can be an ip id or ip.
"""
if not force:
proceed = click.confirm('Are you sure you want to detach ip %s?' %
resource)
if not proceed:
ret... | 0.002632 |
def resetVector(x1, x2):
"""
Copies the contents of vector x1 into vector x2.
@param x1 (array) binary vector to be copied
@param x2 (array) binary vector where x1 is copied
"""
size = len(x1)
for i in range(size):
x2[i] = x1[i] | 0.016194 |
def add(self, **args):
"""Handles the 'a' command.
:args: Arguments supplied to the 'a' command.
"""
kwargs = self.getKwargs(args)
if kwargs:
self.model.add(**kwargs) | 0.009091 |
def p_rule(self, rule):
'''rule : GUIDELINE
| REGULATION'''
if len(rule[1]) == 4:
# This is a guideline
rule[0] = Guideline(rule[1][1], rule[1][2], rule[1][3])
else:
# This is a regulation
indentsize = rule[1][0]
number ... | 0.002313 |
def restore_from_cluster_snapshot(ClusterIdentifier=None, SnapshotIdentifier=None, SnapshotClusterIdentifier=None, Port=None, AvailabilityZone=None, AllowVersionUpgrade=None, ClusterSubnetGroupName=None, PubliclyAccessible=None, OwnerAccount=None, HsmClientCertificateIdentifier=None, HsmConfigurationIdentifier=None, El... | 0.003796 |
def run_hybrid(wf, selector, workers):
"""
Returns the result of evaluating the workflow; runs through several
supplied workers in as many threads.
:param wf:
Workflow to compute
:type wf: :py:class:`Workflow` or :py:class:`PromisedObject`
:param selector:
A function selecting ... | 0.001706 |
def remove(attributes, properties):
"""Returns a property sets which include all the elements
in 'properties' that do not have attributes listed in 'attributes'."""
if isinstance(attributes, basestring):
attributes = [attributes]
assert is_iterable_typed(attributes, basestring)
assert is_ite... | 0.001443 |
def add(self, *dic):
'''add a config to StartCalendarInterval.
Args:
*dic (dict): dictionary with format {'Day': 12, 'Hour': 34} Avaliable keys are Month, Day, Weekday, Hour, Minute. *Note the uppercase.* You can use gen(), genMix() to generate complex config dictionary.
'''
... | 0.003968 |
def qteRunMacro(self, macroName: str, widgetObj: QtGui.QWidget=None,
keysequence: QtmacsKeysequence=None):
"""
Queue a previously registered macro for execution once the
event loop is idle.
The reason for queuing macros in the first place, instead of
running ... | 0.005529 |
def listen(self, port=None):
"""Start listening for incoming connections.
A request handler must have already been specified with
``TChannel.host``.
:param port:
An explicit port to listen on. This is unnecessary when advertising
on Hyperbahn.
:returns:... | 0.001098 |
def admin_view_url(admin_site: AdminSite,
obj,
view_type: str = "change",
current_app: str = None) -> str:
"""
Get a Django admin site URL for an object.
"""
app_name = obj._meta.app_label.lower()
model_name = obj._meta.object_name.lower()
... | 0.001821 |
def grab_selenium_chromedriver(redownload=False):
r"""
Automatically download selenium chrome driver if needed
CommandLine:
python -m utool.util_grabdata --test-grab_selenium_chromedriver:1
Example:
>>> # DISABLE_DOCTEST
>>> ut.grab_selenium_chromedriver()
>>> import se... | 0.002233 |
def _write_metrics(self, iteration:int, last_metrics:MetricsList, start_idx:int=2)->None:
"Writes training metrics to Tensorboard."
recorder = self.learn.recorder
for i, name in enumerate(recorder.names[start_idx:]):
if last_metrics is None or len(last_metrics) < i+1: return
... | 0.024775 |
def make_event_filter(self):
"""Create a new event filter."""
event_filter = EventFilter(
self.event_name,
self.event,
self.filters,
from_block=self.from_block,
to_block=self.to_block
)
event_filter.set_poll_interval(0.5)
... | 0.005865 |
def prepare_question_encoder(inputs, hparams):
"""Prepare question encoder.
Args:
inputs: a Tensor.
hparams: run hyperparameters
Returns:
encoder_input: a Tensor, bottom of encoder stack
encoder_self_attention_bias: a bias tensor for use in encoder self-attention
"""
encoder_input = inputs
... | 0.012168 |
def get_adjacency_matrix(df_connected):
'''
Return matrix where $a_{i,j} = 1$ indicates polygon $i$ is connected to
polygon $j$.
Also, return mapping (and reverse mapping) from original keys in
`df_connected` to zero-based integer index used for matrix rows and
columns.
'''
sorted_path_... | 0.00114 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.