text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def read_vcf(input,
fields=None,
exclude_fields=None,
rename_fields=None,
types=None,
numbers=None,
alt_number=DEFAULT_ALT_NUMBER,
fills=None,
region=None,
tabix='tabix',
samples=None,
... | 0.000686 |
def initialize(self):
'''Calling this function initializes the printer.
Args:
None
Returns:
None
Raises:
None
'''
self.fonttype = self.font_types['bitmap']
self.send(chr(27)+chr(64)) | 0.010753 |
def toPandas(self, df):
"""
This is similar to the Spark DataFrame built-in toPandas() method, but it handles
MLlib Vector columns differently. It converts MLlib Vectors into rows of
scipy.sparse.csr_matrix, which is generally friendlier for PyData tools like scikit-learn.
.. n... | 0.006032 |
def circular_pores(target, pore_diameter='pore.diameter',
throat_diameter='throat.diameter',
throat_centroid='throat.centroid'):
r"""
Calculate the coordinates of throat endpoints, assuming circular pores.
This model accounts for the overlapping lens between pores and t... | 0.000672 |
def import_by_path(path):
"""Append the path to sys.path, then attempt to import module with
path's basename, finally making certain to remove appended path.
http://stackoverflow.com/questions/1096216/override-namespace-in-python"""
sys.path.append(os.path.dirname(path))
try:
return __imp... | 0.002137 |
def freeze():
"""Combine all dependencies for the Agent's static environment."""
echo_waiting('Verifying collected packages...')
catalog, errors = make_catalog()
if errors:
for error in errors:
echo_failure(error)
abort()
static_file = get_agent_requirements()
echo_... | 0.001761 |
def index_search(right_eigenvectors):
"""Find simplex structure in eigenvectors to begin PCCA+.
Parameters
----------
right_eigenvectors : ndarray
Right eigenvectors of transition matrix
Returns
-------
index : ndarray
Indices of simplex
"""
num_micro, num_eigen ... | 0.00295 |
def save_model(self, request, obj, form, change):
"""Set special model attribute to user for reference after save"""
obj._history_user = request.user
super(SimpleHistoryAdmin, self).save_model(request, obj, form, change) | 0.008197 |
def message_from_binary_file(fp, *args, **kws):
"""Read a binary file and parse its contents into a Message object model.
Optional _class and strict are passed to the Parser constructor.
"""
from future.backports.email.parser import BytesParser
return BytesParser(*args, **kws).parse(fp) | 0.003247 |
def getAsKmlGrid(self, tableName, rasterId=1, rasterIdFieldName='id', rasterFieldName='raster', documentName='default', alpha=1.0, noDataValue=0, discreet=False):
"""
Creates a KML file with each cell in the raster represented by a polygon. The result is a vector grid representation of the raster.
... | 0.003461 |
def get_comics(self, *args, **kwargs):
"""
Returns a full ComicDataWrapper object for this creator.
/creators/{creatorId}/comics
:returns: ComicDataWrapper -- A new request to API. Contains full results set.
"""
from .comic import Comic, ComicDataWrappe... | 0.012469 |
def _n_onset_midi(patterns):
"""Computes the number of onset_midi objects in a pattern
Parameters
----------
patterns :
A list of patterns using the format returned by
:func:`mir_eval.io.load_patterns()`
Returns
-------
n_onsets : int
Number of onsets within the pat... | 0.002463 |
def isEmpty(cls, datatype=None):
"""Method to test if the general pasteboard is empty or not with respect
to the type of object you want.
Parameters: datatype (defaults to strings)
Returns: Boolean True (empty) / False (has contents); Raises
exception (passes any raised... | 0.002212 |
def load_reviews(self):
"""Fetches the MAL user reviews page and sets the current user's reviews attributes.
:rtype: :class:`.User`
:return: Current user object.
"""
page = 0
# collect all reviews over all pages.
review_collection = []
while True:
user_reviews = self.session.sess... | 0.010449 |
def load_plugin(plugin_name):
"""
Given a plugin name, load plugin cls from plugin directory.
Will throw an exception if no plugin can be found.
"""
plugin_cls = plugin_map.get(plugin_name, None)
if not plugin_cls:
try:
plugin_module_name, plugin_cls_name = plugin_name.split(... | 0.00095 |
def from_functions(functions) -> 'Pipeline':
"""Build a pipeline from a list of functions.
:param functions: A list of functions or names of functions
:type functions: iter[((pybel.BELGraph) -> pybel.BELGraph) or ((pybel.BELGraph) -> None) or str]
Example with function:
>>> fr... | 0.003325 |
def atoms_string_from_file(filename):
"""
Reads atomic shells from file such as feff.inp or ATOMS file
The lines are arranged as follows:
x y z ipot Atom Symbol Distance Number
with distance being the shell radius and ipot an integer identifying
the potential u... | 0.002153 |
def ncontains(self, column, value):
"""
Set the main dataframe instance to rows that do not
contains a string value in a column
"""
df = self.df[self.df[column].str.contains(value) == False]
if df is None:
self.err("Can not select contained data")
... | 0.008646 |
def _prep_non_framed(self):
"""Prepare the opening data for a non-framed message."""
try:
plaintext_length = self.stream_length
self.__unframed_plaintext_cache = self.source_stream
except NotSupportedError:
# We need to know the plaintext length before we can ... | 0.003155 |
def post(self, request, *args, **kwargs):
""" Post a service request (requires authentication) """
service_code = request.data['service_code']
if service_code not in SERVICES.keys():
return Response({ 'detail': _('Service not found') }, status=404)
serializers = {
... | 0.008117 |
def run():
"""
Run the composition of csv_file_consumer and information tap
with the csv files in the input directory, and collect
the results from each file and merge them together,
printing both kinds of results.
"""
data_items = [
[u"mushroom", u"fungus"],
[u"tomato", u"f... | 0.001031 |
def accumulate_items(items, reduce_each=False):
""" :return: item pairs as key: val, with vals under duplicate keys accumulated under each """
if not items:
return {}
accumulated = defaultdict(list)
for key, val in items:
accumulated[key].append(val)
if not reduce_each:
re... | 0.004762 |
def _graph_wrap(func, graph):
"""Constructs function encapsulated in the graph."""
@wraps(func)
def _wrapped(*args, **kwargs):
with graph.as_default():
return func(*args, **kwargs)
return _wrapped | 0.00431 |
def remove_fact(self, fact_id):
"""Remove fact from storage by it's ID"""
self.start_transaction()
fact = self.__get_fact(fact_id)
if fact:
self.__remove_fact(fact_id)
self.facts_changed()
self.end_transaction() | 0.007273 |
def Cplm(self):
r'''Liquid-phase heat capacity of the mixture at its current
temperature and composition, in units of [J/mol/K]. For calculation of
this property at other temperatures or compositions, or specifying
manually the method used to calculate it, and more - see the object
... | 0.004298 |
def iterShapeRecords(self):
"""Returns a generator of combination geometry/attribute records for
all records in a shapefile."""
for shape, record in izip(self.iterShapes(), self.iterRecords()):
yield ShapeRecord(shape=shape, record=record) | 0.007168 |
def verifyCode(self, sessionId, code):
"""
验证码验证方法 方法
@param sessionId:短信验证码唯一标识,在发送短信验证码方法,返回值中获取。(必传)
@param code:短信验证码内容。(必传)
@return code:返回码,200 为正常。
@return success:true 验证成功,false 验证失败。
@return errorMessage:错误信息。
"""
desc = {
... | 0.007583 |
def GroupsSensorsGet(self, group_id, parameters):
"""
Retrieve sensors shared within the group.
@param group_id (int) - Id of the group to retrieve sensors from
@param parameters (dictionary) - Additional parameters for the call
@r... | 0.012579 |
def wrap_deepmind(env, episode_life=True, clip_rewards=True, frame_stack=False, scale=False):
"""Configure environment for DeepMind-style Atari.
"""
if episode_life:
env = EpisodicLifeEnv(env)
if 'FIRE' in env.unwrapped.get_action_meanings():
env = FireResetEnv(env)
env = WarpFrame(e... | 0.00404 |
def rename(self, new_name_or_name_dict=None, **names):
"""Returns a new DataArray with renamed coordinates or a new name.
Parameters
----------
new_name_or_name_dict : str or dict-like, optional
If the argument is dict-like, it it used as a mapping from old
names... | 0.001663 |
def add_edge(self, vertex1, vertex2, multicolor, merge=True, data=None):
""" Creates a new :class:`bg.edge.BGEdge` object from supplied information and adds it to current instance of :class:`BreakpointGraph`.
Proxies a call to :meth:`BreakpointGraph._BreakpointGraph__add_bgedge` method.
:param... | 0.007477 |
def ep(self, exc: Exception) -> bool:
"""Return False if the exception had not been handled gracefully"""
if not isinstance(exc, ConnectionAbortedError):
return False
if len(exc.args) != 2:
return False
origin, reason = exc.args
logging.getLogger(__name... | 0.005525 |
def umask(self, new_mask):
"""Change the current umask.
Args:
new_mask: (int) The new umask value.
Returns:
The old umask.
Raises:
TypeError: if new_mask is of an invalid type.
"""
if not is_int_type(new_mask):
raise Type... | 0.004357 |
async def set(self, key, value):
"""
Set the given string key to the given value in the network.
"""
if not check_dht_value_type(value):
raise TypeError(
"Value must be of type int, float, bool, str, or bytes"
)
log.info("setting '%s' = '%s... | 0.004728 |
def update_dismiss_variant(self, institute, case, user, link, variant,
dismiss_variant):
"""Create an event for updating the manual dismiss variant entry
This function will create a event and update the dismiss variant
field of the variant.
Arguments:... | 0.003906 |
def auto_app_authorize(self, account=None, flush=True, bailout=False):
"""
Like authorize(), but instead of just waiting for a user or
password prompt, it automatically initiates the authorization
procedure by sending a driver-specific command.
In the case of devices that unders... | 0.002679 |
def mission_current_send(self, seq, force_mavlink1=False):
'''
Message that announces the sequence number of the current active
mission item. The MAV will fly towards this mission
item.
seq : Sequence (uint16_t)
... | 0.009238 |
def action_log_delete(sender, instance, **kwargs):
"""
Signal receiver that creates a log entry when a model instance is deleted from the database.
Direct use is discouraged, connect your model through :py:func:`actionslog.registry.register` instead.
"""
if instance.pk is not None:
changes ... | 0.005618 |
def _write_APSR(self, apsr):
"""Auxiliary function - Writes flags from a full APSR (only 4 msb used)"""
V = Operators.EXTRACT(apsr, 28, 1)
C = Operators.EXTRACT(apsr, 29, 1)
Z = Operators.EXTRACT(apsr, 30, 1)
N = Operators.EXTRACT(apsr, 31, 1)
self.write('APSR_V', V)
... | 0.007282 |
def sg_transpose(tensor, opt):
r"""Permutes the dimensions according to `opt.perm`.
See `tf.transpose()` in tensorflow.
Args:
tensor: A `Tensor` (automatically given by chain).
opt:
perm: A permutation of the dimensions of `tensor`. The target shape.
name: If provided, replace ... | 0.002033 |
def init_handler(self):
""" Check self options. """
assert self.options.get('host') and self.options.get('port'), "Invalid options"
assert self.options.get('to'), 'Recipients list is empty. SMTP disabled.'
if not isinstance(self.options['to'], (list, tuple)):
self.options['to... | 0.011594 |
def iterqueue(self, limit=None, infinite=False):
"""Infinite iterator yielding pending messages, by using
synchronous direct access to the queue (``basic_get``).
:meth:`iterqueue` is used where synchronous functionality is more
important than performance. If you can, use :meth:`itercons... | 0.00184 |
def _render_value(self, val, context, delimiters=None):
"""
Render an arbitrary value.
"""
if not is_string(val):
# In case the template is an integer, for example.
val = self.to_str(val)
if type(val) is not unicode:
val = self.literal(val)
... | 0.005405 |
def stop_proxy(self):
"""Stop the mitmproxy
"""
self.runner.info_log("Stopping proxy...")
if hasattr(self, 'proxy_pid'):
try:
kill_by_pid(self.proxy_pid)
except psutil.NoSuchProcess:
pass | 0.00722 |
def restore_db_cluster_from_snapshot(AvailabilityZones=None, DBClusterIdentifier=None, SnapshotIdentifier=None, Engine=None, EngineVersion=None, Port=None, DBSubnetGroupName=None, DatabaseName=None, OptionGroupName=None, VpcSecurityGroupIds=None, Tags=None, KmsKeyId=None, EnableIAMDatabaseAuthentication=None):
"""
... | 0.005841 |
def tcp_ping(
task: Task, ports: List[int], timeout: int = 2, host: Optional[str] = None
) -> Result:
"""
Tests connection to a tcp port and tries to establish a three way
handshake. To be used for network discovery or testing.
Arguments:
ports (list of int): tcp ports to ping
timeo... | 0.001447 |
def data(self):
"""Return File Occurrence data."""
if self._children:
for child in self._children:
self._action_data.setdefault('children', []).append(child.data)
return self._action_data | 0.008368 |
def summult(list1, list2):
"""
Multiplies elements in list1 and list2, element by element, and
returns the sum of all resulting multiplications. Must provide equal
length lists.
Usage: lsummult(list1,list2)
"""
if len(list1) != len(list2):
raise ValueError("Lists not equal length in summult.")
s... | 0.002439 |
def _extract_functions(resources):
"""
Extracts and returns function information from the given dictionary of SAM/CloudFormation resources. This
method supports functions defined with AWS::Serverless::Function and AWS::Lambda::Function
:param dict resources: Dictionary of SAM/CloudForma... | 0.006438 |
def to_json(self):
"""
:return: str
"""
json_dict = self.to_json_basic()
json_dict['channel'] = self.channel
json_dict['disable_inhibit_forced'] = self.disable_inhibit_forced
json_dict['status'] = self.status
json_dict['led_status'] = self.led_status
... | 0.004988 |
def delete_secret_versions(self, path, versions, mount_point=DEFAULT_MOUNT_POINT):
"""Issue a soft delete of the specified versions of the secret.
This marks the versions as deleted and will stop them from being returned from reads,
but the underlying data will not be removed. A delete can be u... | 0.005792 |
def get_inventory(self):
"""Retrieve inventory of system
Retrieve inventory of the targeted system. This frequently includes
serial numbers, sometimes hardware addresses, sometimes memory modules
This function will retrieve whatever the underlying platform provides
and apply so... | 0.001887 |
def _print(self, ms, style="TIP"):
""" abstraction for managing color printing """
styles1 = {'IMPORTANT': Style.BRIGHT,
'TIP': Style.DIM,
'URI': Style.BRIGHT,
'TEXT': Fore.GREEN,
'MAGENTA': Fore.MAGENTA,
'BLU... | 0.004847 |
def convert_notebooks():
"""
Converts IPython Notebooks to proper .rst files and moves static
content to the _static directory.
"""
convert_status = call(['ipython', 'nbconvert', '--to', 'rst', '*.ipynb'])
if convert_status != 0:
raise SystemError('Conversion failed! Status was %s' % con... | 0.000439 |
def __validate_simple_subfield(self, parameter, field, segment_list,
_segment_index=0):
"""Verifies that a proposed subfield actually exists and is a simple field.
Here, simple means it is not a MessageField (nested).
Args:
parameter: String; the '.' delimited name o... | 0.003245 |
def clear(self):
"""
Cleans up the manager. The manager can't be used after this method has
been called
"""
# Cancel timer
self.__cancel_timer()
self.__timer = None
self.__timer_args = None
self.__still_valid = False
self._value = None
... | 0.005495 |
def get_unit_name(self):
"""Returns the name of the unit for this GPS scale
Note that this returns a simply-pluralised version of the name.
"""
if not self.unit:
return None
name = sorted(self.unit.names, key=len)[-1]
return '%ss' % name | 0.006711 |
def connect(self, **kwargs):
''' Connect to an InfluxDB instance
Connects to an InfluxDB instance and switches to a given database.
If the database doesn't exist it is created first via :func:`create`.
**Configuration Parameters**
host
The host for the connection. Pa... | 0.001682 |
def set_coalesce(devname, **kwargs):
'''
Changes the coalescing settings of the specified network device
CLI Example:
.. code-block:: bash
salt '*' ethtool.set_coalesce <devname> [adaptive_rx=on|off] [adaptive_tx=on|off] [rx_usecs=N] [rx_frames=N]
[rx_usecs_irq=N] [rx_frames_irq=N... | 0.003597 |
def deleteLogEntries(self, del_entries, save=True):
"""Deletes given list of entries from the log. Some entries' index.html files may be updated to reflect changes in prev/next links. If save=True, re-saves the log itself."""
prev_valid = prev_deleted = None
# fix Next/Prev links in remaining en... | 0.002261 |
def distance(lat1, lon1, lat2, lon2, H=0):
"""
Compute spherical distance from spherical coordinates.
For two locations in spherical coordinates
(1, theta, phi) and (1, theta', phi')
cosine( arc length ) =
sin phi sin phi' cos(theta-theta') + cos phi cos phi'
distance = rho * arc length
... | 0.00406 |
def get_function(self, dbName, funcName):
"""
Parameters:
- dbName
- funcName
"""
self.send_get_function(dbName, funcName)
return self.recv_get_function() | 0.005435 |
def _inject_config_source(self, source_filename, files_to_inject):
"""
Inject existing environmental config with namespace sourcing.
Returns a tuple of the first file name and path found.
"""
# src_path = os.path.join(self.directory.root_dir, source_filename)
# src_exec =... | 0.004337 |
def create(self, input_package_path, output_package_path, **kwargs):
"""Create an archived GraftM package
Parameters
----------
input_package_path: str
path to gpkg to be archived
output_pacakge_path: str
output package path
kwargs:
fo... | 0.005495 |
def clean_all_trash_pages_from_all_spaces(confluence):
"""
Main function for retrieve space keys and provide space for cleaner
:param confluence:
:return:
"""
limit = 50
flag = True
i = 0
while flag:
space_lists = confluence.get_all_spaces(start=i * limit, limit=limit)
... | 0.003086 |
def plot_before_after_filter(signal, sr, band_begin, band_end, order=1, x_lim=[], y_lim=[],
orientation="hor", show_plot=False, file_name=None):
"""
-----
Brief
-----
The use of the current function is very useful for comparing two power spectrum's (before and
after ... | 0.00565 |
def transpose(self, method):
"""
Transpose bounding box (flip or rotate in 90 degree steps)
:param method: One of :py:attr:`PIL.Image.FLIP_LEFT_RIGHT`,
:py:attr:`PIL.Image.FLIP_TOP_BOTTOM`, :py:attr:`PIL.Image.ROTATE_90`,
:py:attr:`PIL.Image.ROTATE_180`, :py:attr:`PIL.Image.R... | 0.001846 |
def collect(self):
"""
Take a list of metrics, filter all metrics based on hostname, and metric_type
For each metric, merge the corresponding csv files into one,update corresponding properties such as csv_column_map.
Users can specify functions: raw, count (qps), sum (aggregated value), avg (averaged va... | 0.014158 |
def reduce_in_chunks(fn, iterable, initializer, chunk_size=0):
"""
Reduce the given list of items by splitting it into chunks
of the given size and passing each chunk through the reducer
"""
if len(iterable) == 0:
return initializer
if chunk_size == 0:
chunk_size = len(iterable)
... | 0.002604 |
def read_file(self, filename):
"""
:raises IOError: passed from any file operations that fail.
"""
self.pack = {}
with open(filename, "r") as f:
for line in f:
line = line.strip()
if (len(line) == 0) or (line[0] == "#"):
... | 0.006623 |
def tradeBreakDF(symbol=None, token='', version=''):
'''Trade break messages are sent when an execution on IEX is broken on that same trading day. Trade breaks are rare and only affect applications that rely upon IEX execution based data.
https://iexcloud.io/docs/api/#deep-trade-break
Args:
symbo... | 0.003466 |
def _pystmark_call(self, method, *args, **kwargs):
''' Wraps a call to the pystmark Simple API, adding configured
settings
'''
kwargs = self._apply_config(**kwargs)
return method(*args, **kwargs) | 0.008511 |
def add_contact(self, phone_number: str, first_name: str, last_name: str=None, on_success: callable=None):
"""
Add contact by phone number and name (last_name is optional).
:param phone: Valid phone number for contact.
:param first_name: First name to use.
:param last_name: Last ... | 0.016598 |
def getParameter(self, parameterName, index=-1):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameter`.
Get the value of a parameter. Most parameters are handled automatically by
:class:`~nupic.bindings.regions.PyRegion.PyRegion`'s parameter get mechanism. The
ones that need... | 0.009191 |
def get_task_def_files_from_xml(self, sourcefilesTag, base_dir):
"""Get the task-definition files from the XML definition. Task-definition files are files
for which we create a run (typically an input file or a YAML task definition).
"""
sourcefiles = []
# get included sourcefil... | 0.004745 |
def apply_inheritance(self):
""" For all items and templates inherit properties and custom
variables.
:return: None
"""
super(Services, self).apply_inheritance()
# add_item only ensure we can build a key for services later (after explode)
for item in list(se... | 0.007937 |
def navdatapush(self):
"""
Pushes the current :referenceframe: out to clients.
:return:
"""
try:
self.fireEvent(referenceframe({
'data': self.referenceframe, 'ages': self.referenceages
}), "navdata")
self.intervalcount += 1
... | 0.001927 |
def format(self, typedval):
'Return displayable string of `typedval` according to `Column.fmtstr`'
if typedval is None:
return None
if isinstance(typedval, (list, tuple)):
return '[%s]' % len(typedval)
if isinstance(typedval, dict):
return '{%s}' % le... | 0.005758 |
def _read_wrapper(data):
"""Ensure unicode always returned on read."""
# Paramiko (strangely) in PY3 returns an int here.
if isinstance(data, int):
data = chr(data)
# Ensure unicode
return py23_compat.text_type(data) | 0.007463 |
def _update_session_expiration(self):
"""
Updates a redis item to expire later since it has been interacted with
recently
"""
session_time = oz.settings["session_time"]
if session_time:
self.redis().expire(self._session_key, session_time) | 0.006667 |
def get(self, key, default=miss):
"""Return the value for given key if it exists."""
if key not in self._dict:
return default
# invokes __getitem__, which updates the item
return self[key] | 0.008584 |
def get_checks_paths(checks_paths=None):
"""
Get path to checks.
:param checks_paths: list of str, directories where the checks are present
:return: list of str (absolute path of directory with checks)
"""
p = os.path.join(__file__, os.pardir, os.pardir, os.pardir, "checks")
p = os.path.abs... | 0.00211 |
async def configure(ssid: str,
securityType: SECURITY_TYPES,
psk: Optional[str] = None,
hidden: bool = False,
eapConfig: Optional[Dict[str, Any]] = None,
upRetries: int = 2) -> Tuple[bool, str]:
""" Configure a conne... | 0.000385 |
def get_logging_level():
'''get_logging_level will configure a logging to standard out based on the user's
selected level, which should be in an environment variable called
MESSAGELEVEL. if MESSAGELEVEL is not set, the maximum level
(5) is assumed (all messages).
'''
level = os.environ.get("MESS... | 0.002053 |
def run(self, line):
"""
Extract words from tweet
1. Remove non-ascii characters
2. Split line into individual words
3. Clean up puncuation characters
"""
words = []
for word in self.clean_unicode(line.lower()).split():
if word.starts... | 0.005607 |
def get_issue_classes(self,backend = None,enabled = True,sort = None,**kwargs):
"""
Retrieves the issue classes for a given backend
:param backend: A backend to use. If None, the default backend will be used
:param enabled: Whether to retrieve enabled or disabled issue classes.
... | 0.020457 |
def read(file_name, file_contents=None, on_demand=False):
'''
Loads an arbitrary file type (xlsx, xls, or csv like) and returns
a list of 2D tables. For csv files this will be a list of one table,
but excel formats can have many tables/worksheets.
TODO:
Add wrapper which can be closed/exite... | 0.005117 |
def normalize(self):
'''re-normalise a rotation matrix'''
error = self.a * self.b
t0 = self.a - (self.b * (0.5 * error))
t1 = self.b - (self.a * (0.5 * error))
t2 = t0 % t1
self.a = t0 * (1.0 / t0.length())
self.b = t1 * (1.0 / t1.length())
self.c = t2 * (... | 0.005917 |
def save(self, sync_only=False):
"""
:param sync_only:
:type: bool
"""
entity = datastore.Entity(key=self._key)
entity["last_accessed"] = self.last_accessed
# todo: restore sync only
entity["data"] = self._data
if self.expires:
entity... | 0.005263 |
def main():
""" Entry point for the package, as defined in setup.py. """
# Log info and above to console
logging.basicConfig(
format='%(levelname)s: %(message)s', level=logging.INFO)
# Get command line input/output arguments
msg = 'Instantly deploy static HTML sites to S3 at the command li... | 0.001395 |
def reset(db, aid, episode):
"""Reset episode count for anime."""
params = {
'aid': aid,
'type': get_eptype(db, 'regular').id,
'watched': 1,
'number': episode,
}
with db:
cur = db.cursor()
cur.execute(
"""UPDATE episode SET user_watched=:watche... | 0.00156 |
def get(self, label, default=None):
"""
Returns value occupying requested label, default to specified
missing value if not present. Analogous to dict.get
Parameters
----------
label : object
Label value looking for
default : object, optional
... | 0.003436 |
def suggest(alias, max=3, cutoff=0.5):
""" Suggest a list of aliases which are similar enough
"""
aliases = matchers.keys()
similar = get_close_matches(alias, aliases, n=max, cutoff=cutoff)
return similar | 0.004425 |
def _ss(data, c=None):
"""Return sum of square deviations of sequence data.
If ``c`` is None, the mean is calculated in one pass, and the deviations
from the mean are calculated in a second pass. Otherwise, deviations are
calculated from ``c`` as given. Use the second case with care, as it can
lead... | 0.002967 |
def add_subject_path(path, index=None):
'''
add_subject_path(path) will add the given path to the list of subject directories in which to
search for HCP subjects. The optional argument index may be given to specify the precedence of
this path when searching for a new subject; the default, 0, always ... | 0.006653 |
def reward(self, action):
"""
Reward function for the task.
The sparse reward is 0 if the peg is outside the hole, and 1 if it's inside.
We enforce that it's inside at an appropriate angle (cos(theta) > 0.95).
The dense reward has four components.
Reaching: in [0, ... | 0.004662 |
def pickle_load(cls, filepath, spectator_mode=True, remove_lock=False):
"""
Loads the object from a pickle file and performs initial setup.
Args:
filepath: Filename or directory name. It filepath is a directory, we
scan the directory tree starting from filepath and w... | 0.004292 |
def is_number_type_geographical(num_type, country_code):
"""Tests whether a phone number has a geographical association,
as represented by its type and the country it belongs to.
This version of isNumberGeographical exists since calculating the phone
number type is expensive; if we have already done th... | 0.001695 |
def expansion_max_H(self):
""""Return the maximum distance between expansions for the largest
allowable H/S ratio.
:returns: Maximum expansion distance
:rtype: float * meter
Examples
--------
exp_dist_max(20*u.L/u.s, 40*u.cm, 37000, 25*u.degC, 2*u.m)
0.375... | 0.007576 |
def abort(self, signum):
""" Run all abort tasks, then all exit tasks, then exit with error
return status"""
self.log.info('Signal handler received abort request')
self._abort(signum)
self._exit(signum)
os._exit(1) | 0.007634 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.