text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def pixel(self, func:PixelFunc, *args, **kwargs)->'ImagePoints':
"Equivalent to `self = func_flow(self)`."
self = func(self, *args, **kwargs)
self.transformed=True
return self | 0.024155 |
def down(self, migration_id):
"""Rollback to migration."""
if not self.check_directory():
return
for migration in self.get_migrations_to_down(migration_id):
logger.info('Rollback migration %s' % migration.filename)
migration_module = self.load_migration_file... | 0.003344 |
def early_warning(iterable, name='this generator'):
''' This function logs an early warning that the generator is empty.
This is handy for times when you're manually playing with generators and
would appreciate the console warning you ahead of time that your generator
is now empty, instead of being sur... | 0.002899 |
def authenticate(self, reauth=False):
"""
Authenticate with the API and return an authentication token.
"""
auth_url = BASE_URL + "/rest/user"
payload = {'email': self.email, 'password': self.password}
arequest = requests.get(auth_url, params=payload)
status = are... | 0.00369 |
def EnableFreeAPIKeyRateLimit(self):
"""Configures Rate limiting for queries to VirusTotal.
The default rate limit for free VirusTotal API keys is 4 requests per
minute.
"""
self._analyzer.hashes_per_batch = 4
self._analyzer.wait_after_analysis = 60
self._analysis_queue_timeout = self._anal... | 0.002874 |
def _create_sequences(self):
'''Get all of the Sequences - Rosetta, ATOM, SEQRES, FASTA, UniParc.'''
# Create the Rosetta sequences and the maps from the Rosetta sequences to the ATOM sequences
try:
self.pdb.construct_pdb_to_rosetta_residue_map(self.rosetta_scripts_path, rosetta_dat... | 0.006254 |
def read(cls, proto):
"""
Reads deserialized data from proto object
:param proto: (DynamicStructBuilder) Proto object
:returns: (:class:`Connections`) instance
"""
#pylint: disable=W0212
protoCells = proto.cells
connections = cls(len(protoCells))
for cellIdx, protoCell in enumera... | 0.010142 |
def start(self):
"""Start this Tracer.
Return a Python function suitable for use with sys.settrace().
"""
self.thread = threading.currentThread()
sys.settrace(self._trace)
return self._trace | 0.008333 |
def restart_agent(self, agent_id, **kwargs):
'''tells the host agent running in this agency to restart the agent.'''
host_medium = self.get_medium('host_agent')
agent = host_medium.get_agent()
d = host_medium.get_document(agent_id)
# This is done like this on purpose, we want to ... | 0.003643 |
def _RegisterFlowProcessingHandler(self, handler):
"""Registers a handler to receive flow processing messages."""
self.flow_handler_stop = False
self.flow_handler_thread = threading.Thread(
name="flow_processing_handler",
target=self._HandleFlowProcessingRequestLoop,
args=(handler,))... | 0.0025 |
def truncate(self, size=0):
"""
Truncates the stream to the specified length.
@param size: The length of the stream, in bytes.
@type size: C{int}
"""
if size == 0:
self._buffer = StringIO()
self._len_changed = True
return
cur... | 0.003876 |
def from_KENT(
filepaths,
name=None,
ignore=["wm"],
delay_tolerance=0.1,
frequency_tolerance=0.5,
parent=None,
verbose=True,
) -> Data:
"""Create data object from KENT file(s).
Parameters
----------
filepaths : path-like or list of path-like
Filepath(s).
Can ... | 0.00213 |
def expool(name):
"""
Confirm the existence of a kernel variable in the kernel pool.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/expool_c.html
:param name: Name of the variable whose value is to be returned.
:type name: str
:return: True when the variable is in the pool.
:rtype... | 0.002096 |
def ingest(self):
"""
*ingest the contents of the directory of yaml files into a database*
**Return:**
- None
**Usage:**
To import an entire directory of yaml files into a database, use the following:
.. code-block:: python
from fundament... | 0.006352 |
def package_depends_on(self, name_a, name_b):
"""Returns dependency information about two packages:
0: A does not depend, directly or indirectly, on B;
1: A depends indirectly on B;
2: A depends directly on B.
"""
assert self._context
if self._depende... | 0.002594 |
def connected():
'''
List all connected minions on a salt-master
'''
opts = salt.config.master_config(__opts__['conf_file'])
if opts.get('con_cache'):
cache_cli = CacheCli(opts)
minions = cache_cli.get_cached()
else:
minions = list(salt.utils.minions.CkMinions(opts).conn... | 0.002849 |
def ULT(self, o):
"""
Unsigned less than.
:param o: The other operand
:return: TrueResult(), FalseResult(), or MaybeResult()
"""
unsigned_bounds_1 = self._unsigned_bounds()
unsigned_bounds_2 = o._unsigned_bounds()
ret = []
for lb_1, ub_1 in unsi... | 0.002389 |
def from_dict_hook(data):
"""Decode internal objects encoded using `to_dict_hook`.
This automatically imports the class defined in the `_type` metadata field,
and calls the `from_dict` method hook to instantiate an object of that
class.
Note:
Because this function will do automatic module ... | 0.001252 |
def send_to_room(self, message, room_name):
""" Sends a given message to a given room """
room = self.get_room(room_name)
if room is not None:
room.send_message(message) | 0.009479 |
def append(self, future):
"""Append an object to the linked list.
Args:
future (PlasmaObjectFuture): A PlasmaObjectFuture instance.
"""
future.prev = self.tail
if self.tail is None:
assert self.head is None
self.head = future
else:
... | 0.004167 |
def iphexval(ip):
'''
Retrieve the hexadecimal representation of an IP address
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt '*' network.iphexval 10.0.0.1
'''
a = ip.split('.')
hexval = ['%02X' % int(x) for x in a] # pylint: disable=E1321
return ''.j... | 0.003021 |
def get(self, robj, r=None, pr=None, timeout=None, basic_quorum=None,
notfound_ok=None, head_only=False):
"""
Fetches an object.
"""
raise NotImplementedError | 0.014851 |
def gradient(self, style=LINEAR, w=1.0, h=1.0, name=""):
"""Creates a gradient layer.
Creates a gradient layer, that is usually used
together with the mask() function.
All the image functions work on gradients,
so they can easily be flipped, rotated, scaled, invert... | 0.013315 |
def verify_email_for_object(self, email, content_object, email_field_name='email'):
"""
Create an email confirmation for `content_object` and send a confirmation mail.
The email will be directly saved to `content_object.email_field_name` when `is_primary` and `skip_verify` both are true.
... | 0.005693 |
def transformNull(requestContext, seriesList, default=0, referenceSeries=None):
"""
Takes a metric or wildcard seriesList and replaces null values with
the value specified by `default`. The value 0 used if not specified.
The optional referenceSeries, if specified, is a metric or wildcard
series lis... | 0.000568 |
def checkOnline(self, userId):
"""
检查用户在线状态 方法 方法
@param userId:用户 Id,最大长度 64 字节。是用户在 App 中的唯一标识码,必须保证在同一个 App 内不重复,重复的用户 Id 将被当作是同一用户。(必传)
@return code:返回码,200 为正常。
@return status:在线状态,1为在线,0为不在线。
@return errorMessage:错误信息。
"""
desc = {
"nam... | 0.008902 |
def AddObject(self, path, interface, properties, methods):
'''Add a new D-Bus object to the mock
path: D-Bus object path
interface: Primary D-Bus interface name of this object (where
properties and methods will be put on)
properties: A property_name (string) → value m... | 0.001934 |
def _get_pltdag_ancesters(self, hdrgo, usrgos, desc=""):
"""Get GoSubDag containing hdrgo and all usrgos and their ancesters."""
go_srcs = usrgos.union([hdrgo])
gosubdag = GoSubDag(go_srcs,
self.gosubdag.get_go2obj(go_srcs),
relationships=s... | 0.002805 |
def deconv_stride2_multistep(x,
nbr_steps,
output_filters,
name=None,
reuse=None):
"""Use a deconvolution to upsample x by 2**`nbr_steps`.
Args:
x: a `Tensor` with shape `[batch, spatial, depth]`... | 0.007712 |
def make_gitlab_blueprint(
client_id=None,
client_secret=None,
scope=None,
redirect_url=None,
redirect_to=None,
login_url=None,
authorized_url=None,
session_class=None,
storage=None,
hostname="gitlab.com",
):
"""
Make a blueprint for authenticating with GitLab using OAuth... | 0.001647 |
def _item_sources(self):
"""List of places to look-up items for key-completion"""
return [self.data_vars, self.coords, {d: self[d] for d in self.dims},
LevelCoordinatesSource(self)] | 0.00939 |
def is_sub_plate(self, other):
"""
Determines if this plate is a sub-plate of another plate -
i.e. has the same meta data but a restricted set of values
:param other: The other plate
:return: True if this plate is a sub-plate of the other plate
"""
if all(v in se... | 0.006061 |
def weight_noise(noise_rate, learning_rate, var_list):
"""Apply weight noise to vars in var_list."""
if not noise_rate:
return [tf.no_op()]
tf.logging.info("Applying weight noise scaled by learning rate, "
"noise_rate: %0.5f", noise_rate)
noise_ops = []
for v in var_list:
with tf.... | 0.01791 |
def nameTuple(s: Influence) -> Tuple[str, str]:
""" Returns a 2-tuple consisting of the top groundings of the subj and obj
of an Influence statement. """
return top_grounding(s.subj), top_grounding(s.obj) | 0.00463 |
def scale(data, zero_center=True, max_value=None, copy=False) -> Optional[AnnData]:
"""Scale data to unit variance and zero mean.
.. note::
Variables (genes) that do not display any variation (are constant across
all observations) are retained and set to 0 during this operation. In
the ... | 0.004088 |
def read_dataset(fid, key):
"""Read dataset"""
dsid = DSET_NAMES[key.name]
dset = fid["/PWLR/" + dsid]
if dset.ndim == 3:
dims = ['y', 'x', 'level']
else:
dims = ['y', 'x']
data = xr.DataArray(da.from_array(dset.value, chunks=CHUNK_SIZE),
name=key.name, di... | 0.002083 |
def htmlCtxtReadFile(self, filename, encoding, options):
"""parse an XML file from the filesystem or the network. This
reuses the existing @ctxt parser context """
ret = libxml2mod.htmlCtxtReadFile(self._o, filename, encoding, options)
if ret is None:raise treeError('htmlCtxtReadFile(... | 0.010417 |
def parseCmdline(rh):
"""
Parse the request command input.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error
"""
rh.printSysLog("Enter cmdVM.parseCmdline")
if rh.totalParms >= 2:
rh.userid = rh.reques... | 0.002104 |
def btc_is_singlesig_segwit(privkey_info):
"""
Is the given key bundle a p2sh-p2wpkh key bundle?
"""
try:
jsonschema.validate(privkey_info, PRIVKEY_MULTISIG_SCHEMA)
if len(privkey_info['private_keys']) > 1:
return False
return privkey_info.get('segwit', False)
ex... | 0.002762 |
def fetch_logs(self, unique_id, logs, directory, pattern=constants.FILTER_NAME_ALLOW_NONE):
""" Copies logs from the remote host that the process is running on to the provided directory
:Parameter unique_id the unique_id of the process in question
:Parameter logs a list of logs given by absolute path from ... | 0.007163 |
def authenticate_redirect(
self,
callback_uri: str = None,
ax_attrs: List[str] = ["name", "email", "language", "username"],
) -> None:
"""Redirects to the authentication URL for this service.
After authentication, the service will redirect back to the given
callback ... | 0.002525 |
def add_parent(self, parent):
"""
Adds self as child of parent, then adds parent.
"""
parent.add_child(self)
self.parent = parent
return parent | 0.010471 |
def css(self, mapping=None):
'''Update the css dictionary if ``mapping`` is a dictionary, otherwise
return the css value at ``mapping``.
If ``mapping`` is not given, return the whole ``css`` dictionary
if available.
'''
css = self._css
if mapping is None:
... | 0.003478 |
def iso_to_gregorian(iso_year, iso_week, iso_day):
"Gregorian calendar date for the given ISO year, week and day"
year_start = iso_year_start(iso_year)
return year_start + datetime.timedelta(days=iso_day - 1, weeks=iso_week - 1) | 0.008333 |
def info():
'''
Return configuration and status information about the marathon instance.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.info
'''
response = salt.utils.http.query(
"{0}/v2/info".format(_base_url()),
decode_type='json',
decode=... | 0.002786 |
def propose(self, template_address, account):
"""
Propose a new template.
:param template_address: Address of the template contract, str
:param account: account proposing the template, Account
:return: bool
"""
try:
proposed = self._keeper.template_ma... | 0.005682 |
def generic_var(self, key, value=None):
"""
Stores generic variables in the session prepending it with _GENERIC_VAR_KEY_PREFIX.
"""
return self._get_or_set('{0}{1}'.format(self._GENERIC_VAR_KEY_PREFIX, key), value) | 0.01626 |
def arsh(self, num):
"""Arithmetically right shift the farray by *num* places.
The *num* argument must be a non-negative ``int``.
The carry-in will be the value of the most significant bit.
Returns a new farray.
"""
if num < 0 or num > self.size:
raise Valu... | 0.002782 |
def addresses(self):
"""
Return a new raw REST interface to address resources
:rtype: :py:class:`ns1.rest.ipam.Adresses`
"""
import ns1.rest.ipam
return ns1.rest.ipam.Addresses(self.config) | 0.008403 |
def findViewByIdOrRaise(self, viewId, root="ROOT", viewFilter=None):
'''
Finds the View or raise a ViewNotFoundException.
@type viewId: str
@param viewId: the ID of the view to find
@type root: str
@type root: View
@param root: the root node of the tree where the... | 0.005693 |
def publish_server_heartbeat_failed(self, connection_id, duration, reply):
"""Publish a ServerHeartbeatFailedEvent to all server heartbeat
listeners.
:Parameters:
- `connection_id`: The address (host/port pair) of the connection.
- `duration`: The execution time of the event i... | 0.002878 |
def _osx_platform_data():
'''
Additional data for macOS systems
Returns: A dictionary containing values for the following:
- model_name
- boot_rom_version
- smc_version
- system_serialnumber
'''
cmd = 'system_profiler SPHardwareDataType'
hardware = __salt__['cmd.r... | 0.000965 |
def get_object_params(self):
"""Returns all of the parameters which should be used to create/update
an object.
* Omits any parameters not defined in the schema
* Omits any null parameters if they were not explicitly specified
"""
return {name: value for (name, value) in s... | 0.003656 |
def saveSettings(self):
""" Saves the persistent settings. Only saves the profile.
"""
try:
self.saveProfile()
except Exception as ex:
# Continue, even if saving the settings fails.
logger.warn(ex)
if DEBUGGING:
raise
... | 0.00542 |
def _options(self):
"""
Returns a raw options object
:rtype: dict
"""
if self._options_cache is None:
target_url = self.client.get_url(self._URL_KEY, 'OPTIONS', 'options')
r = self.client.request('OPTIONS', target_url)
self._options_cache = r.... | 0.00831 |
def verify(self, signature):
"""Verifies the signature against the current cryptographic verifier state.
:param bytes signature: The signature to verify
"""
prehashed_digest = self._hasher.finalize()
self.key.verify(
signature=signature,
data=prehashed_di... | 0.009434 |
def internal_get_goids_or_sections(self):
"""Return GO IDs, Sections/GOs, or None."""
if self.goids_fin:
chk_goids(self.goids_fin, "read_goids")
return {'goids' : self.goids_fin}
else:
# Convert dict into 2D list retaining original section order
se... | 0.007143 |
def cli( # pylint: disable=too-many-arguments
ctx, target, config, c, commits, extra_path, ignore, msg_filename,
verbose, silent, debug,
):
""" Git lint tool, checks your git commit messages for styling issues """
try:
if debug:
logging.getLogger("gitlint").setLevel(logging... | 0.003067 |
def newnews(self, pattern, timestamp):
"""NEWNEWS command.
Retrieves a list of message-ids for articles created since the specified
timestamp for newsgroups with names that match the given pattern. See
newnews_gen() for more details.
See <http://tools.ietf.org/html/rfc3977#sect... | 0.004777 |
def _run(self, cmd):
'''
Internal function for running commands. Used by the uninstall function.
Args:
cmd (str, list): The command to run
Returns:
str: The stdout of the command
'''
if isinstance(cmd, six.string_types):
cmd = salt.u... | 0.002591 |
def wait_for_ilo_after_reset(ilo_object):
"""Continuously polls for iLO to come up after reset."""
is_ilo_up_after_reset = lambda: ilo_object.get_product_name() is not None
is_ilo_up_after_reset.__name__ = 'is_ilo_up_after_reset'
wait_for_operation_to_complete(
is_ilo_up_after_reset,
f... | 0.004796 |
def certificate(self):
"""
Retrieves the certificate used to sign the bounce message.
TODO: Cache the certificate based on the cert URL so we don't have to
retrieve it for each bounce message. *We would need to do it in a
secure way so that the cert couldn't be overwritten in th... | 0.003286 |
def exists(self, table_id):
""" Check if a table exists in Google BigQuery
Parameters
----------
table : str
Name of table to be verified
Returns
-------
boolean
true if table exists, otherwise false
"""
from google.api_co... | 0.00316 |
def absolutify(url):
"""Takes a URL and prepends the SITE_URL"""
site_url = getattr(settings, 'SITE_URL', False)
# If we don't define it explicitly
if not site_url:
protocol = settings.PROTOCOL
hostname = settings.DOMAIN
port = settings.PORT
if (protocol, port) in (('htt... | 0.00189 |
def get_following(self, auth_secret):
"""Get the following list of a logged-in user.
Parameters
----------
auth_secret: str
The authentication secret of the logged-in user.
Returns
-------
bool
True if the following list is successfully o... | 0.004253 |
def get(cls):
"""
Execute the logic behind the Syntax handling.
:return: The syntax status.
:rtype: str
"""
if PyFunceble.INTERN["to_test_type"] == "domain":
# We are testing for domain or ip.
if Check().is_domain_valid() or Check().is_ip_valid(... | 0.003724 |
def open(self,
mode='r',
encoding: typing.Union[list, tuple, set, str, typing.
Callable] = 'auto'):
"""
:param mode: the same as the argument `mode` of `builtins.open`
:param encoding: similar to the argument `encoding` of `builtins.o... | 0.007097 |
def yield_typed(obj_or_cls):
"""
Generator that yields typed object names of the class (or object's class).
Args:
obj_or_cls (object): Class object or instance of class
Returns:
name (array): Names of class attributes that are strongly typed
"""
if not isinstance(obj_or_cls, ty... | 0.004202 |
def _extract_submission(self, filename):
"""Extracts submission and moves it into self._extracted_submission_dir."""
# verify filesize
file_size = os.path.getsize(filename)
if file_size > MAX_SUBMISSION_SIZE_ZIPPED:
logging.error('Submission archive size %d is exceeding limit %d',
... | 0.005914 |
def fetch(self, end=values.unset, start=values.unset):
"""
Fetch a UsageInstance
:param unicode end: The end
:param unicode start: The start
:returns: Fetched UsageInstance
:rtype: twilio.rest.preview.wireless.sim.usage.UsageInstance
"""
params = values.... | 0.005319 |
def get_file_mode(self):
# type: () -> int
'''
Get the POSIX file mode bits for this Rock Ridge entry.
Parameters:
None.
Returns:
The POSIX file mode bits for this Rock Ridge entry.
'''
if not self._initialized:
raise pycdlibexceptio... | 0.007267 |
def update_assessment_offered(self, assessment_offered_form):
"""Updates an existing assessment offered.
arg: assessment_offered_form
(osid.assessment.AssessmentOfferedForm): the form
containing the elements to be updated
raise: IllegalState - ``assessment_of... | 0.004241 |
def create_new_account(data_dir, password, **geth_kwargs):
"""Creates a new Ethereum account on geth.
This is useful for testing when you want to stress
interaction (transfers) between Ethereum accounts.
This command communicates with ``geth`` command over
terminal interaction. It creates keystore... | 0.000679 |
def group_transfer_message(self):
"""
将 message 群发到多客服系统
:return: 符合微信服务器要求的 XML 响应数据
"""
self._check_parse()
response = GroupTransferReply(message=self.__message).render()
return self._encrypt_response(response) | 0.007463 |
def _register_endpoints(self, backend_names):
"""
See super class satosa.frontends.base.FrontendModule#register_endpoints
Endpoints have the format
{base}/{backend}/{co_name}/{binding path}
For example the HTTP-Redirect binding request path will have the
format
... | 0.000608 |
def _skew_symmetric_translation(pos_A_in_B):
"""
Helper function to get a skew symmetric translation matrix for converting quantities
between frames.
"""
return np.array(
[
0.,
-pos_A_in_B[2],
pos_A_in_B[1],
pos_A_in_B[2],
0.,
... | 0.004494 |
def __String_to_BitList(self, data):
"""Turn the string data, into a list of bits (1, 0)'s"""
if isinstance(data[0], str):
# Turn the strings into integers. Python 3 uses a bytes
# class, which already has this behaviour.
data = [ord(c) for c in data]
l = len(data) * 8
result = [0] * l
pos = 0
for ... | 0.044025 |
def _add_user_to_file(file_id, service, user_email,
perm_type='user', role='writer'):
"""
Grants the given set of permissions for a given file_id. service is an
already-credentialed Google Drive service instance.
"""
new_permission = {
'value': user_email,
'type... | 0.001675 |
def activate_component(self, name):
"""
Activates given Component.
:param name: Component name.
:type name: unicode
:return: Method success.
:rtype: bool
"""
if not name in self.__engine.components_manager.components:
raise manager.exceptions... | 0.005706 |
def update(old, new, collection, sneaky_update_filter=None):
"""
update an existing object with a new one, only saving it and
setting updated_at if something has changed
old
old object
new
new object
collection
collection to save changed o... | 0.000693 |
def get_top_gainers(self, as_json=False):
"""
:return: a list of dictionaries containing top gainers of the day
"""
url = self.top_gainer_url
req = Request(url, None, self.headers)
# this can raise HTTPError and URLError
res = self.opener.open(req)
# for p... | 0.004518 |
def read_apply(lib, symbol, func, chunk_range=None):
"""
Apply `func` to each chunk in lib.symbol
Parameters
----------
lib: arctic library
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
allows you to subset the chunks by range
... | 0.002217 |
def prepare(self):
"""When connecting start the next connection step and schedule
next `prepare` call, when connected return `HandlerReady()`
"""
with self._lock:
if self._socket:
self._socket.listen(SOMAXCONN)
self._socket.setblocking(False)
... | 0.005682 |
def already_downloaded(track, title, filename):
"""
Returns True if the file has already been downloaded
"""
global arguments
already_downloaded = False
if os.path.isfile(filename):
already_downloaded = True
if arguments['--flac'] and can_convert(filename) \
... | 0.003003 |
def return_input_paths(job, work_dir, ids, *args):
"""
Returns the paths of files from the FileStore
Input1: Toil job instance
Input2: Working directory
Input3: jobstore id dictionary
Input4: names of files to be returned from the jobstore
Returns: path(s) to the file(s) requested -- unpac... | 0.002774 |
def first(self):
"""
Return the first element.
"""
if self.mode == 'local':
return self.values[0]
if self.mode == 'spark':
return self.values.first().toarray() | 0.008929 |
def add_current_user_is_applied_representation(func):
""" Used to decorate Serializer.to_representation method.
It sets the field "current_user_is_applied" if the user is applied to the project
"""
@wraps(func)
def _impl(self, instance):
# We pop current_user_is_applied field to avoid AttributeError o... | 0.016082 |
def collect_overwrites_for_sid(self,
group,
dates,
requested_qtr_data,
last_per_qtr,
sid_idx,
columns,
... | 0.003215 |
def _read_depth_image(self):
""" Reads a depth image from the device """
# read raw uint16 buffer
im_arr = self._depth_stream.read_frame()
raw_buf = im_arr.get_buffer_as_uint16()
buf_array = np.array([raw_buf[i] for i in range(PrimesenseSensor.DEPTH_IM_WIDTH * PrimesenseSensor.DE... | 0.005063 |
def _get_encodings():
"""
Just a simple function to return the system encoding (defaults to utf-8)
"""
stdout_encoding = sys.stdout.encoding if sys.stdout.encoding else 'utf-8'
stderr_encoding = sys.stderr.encoding if sys.stderr.encoding else 'utf-8'
return stdout_encoding, stderr_encoding | 0.003185 |
def experiments(auth, label=None, project=None, subject=None):
'''
Retrieve Experiment tuples for experiments returned by this function.
Example:
>>> import yaxil
>>> auth = yaxil.XnatAuth(url='...', username='...', password='...')
>>> yaxil.experiment(auth, 'AB1234C')
E... | 0.005052 |
def update_oath_hotp_c(self, entry, new_c):
"""
Update the OATH-HOTP counter value for `entry' in the database.
Use SQL statement to ensure we only ever increase the counter.
"""
key = entry.data["key"]
c = self.conn.cursor()
c.execute("UPDATE oath SET oath_c = ?... | 0.004454 |
def extend(self, other):
"""
Appends the segmentlists from other to the corresponding
segmentlists in self, adding new segmentslists to self as
needed.
"""
for key, value in other.iteritems():
if key not in self:
self[key] = _shallowcopy(value)
else:
self[key].extend(value) | 0.04 |
def do_dimension_name_list(mc, args):
'''List names of metric dimensions.'''
fields = {}
if args.metric_name:
fields['metric_name'] = args.metric_name
if args.limit:
fields['limit'] = args.limit
if args.offset:
fields['offset'] = args.offset
if args.tenant_id:
fie... | 0.0012 |
def set_final_value(self, description_type, value):
"""Set the value for the given description type.
in description_type type :class:`VirtualSystemDescriptionType`
in value type str
"""
types, _, _, vbox_values, extra_config = self.get_description()
# find offset to de... | 0.001892 |
def minimize(self, model, session=None, var_list=None, feed_dict=None, maxiter=1000,
disp=False, initialize=False, anchor=True, step_callback=None, **kwargs):
"""
Minimizes objective function of the model.
:param model: GPflow model with objective tensor.
:param session... | 0.007501 |
def get_connection_status(self, connection_id):
"""
Get status of the connection during Role enforcement.
"""
with self._connections_lock:
try:
connection_info = self._connections[connection_id]
return connection_info.status
except ... | 0.005602 |
def KIC(N, rho, k):
r"""Kullback information criterion
.. math:: KIC(k) = log(\rho_k) + 3 \frac{k+1}{N}
:validation: double checked versus octave.
"""
from numpy import log, array
res = log(rho) + 3. * (k+1.) /float(N)
return res | 0.007722 |
def db_from_dataframes(
db_filename,
dataframes,
primary_keys={},
indices={},
subdir=None,
overwrite=False,
version=1):
"""
Create a sqlite3 database from a collection of DataFrame objects
Parameters
----------
db_filename : str
Name o... | 0.000814 |
def trace_memory_usage(self, frame, event, arg):
"""Callback for sys.settrace"""
if event in ('line', 'return') and frame.f_code in self.code_map:
lineno = frame.f_lineno
if event == 'return':
lineno += 1
entry = self.code_map[frame.f_c... | 0.006787 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.