text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _ephem_convert_to_seconds_and_microseconds(date):
# utility from unreleased PyEphem 3.6.7.1
"""Converts a PyEphem date into seconds"""
microseconds = int(round(24 * 60 * 60 * 1000000 * date))
seconds, microseconds = divmod(microseconds, 1000000)
seconds -= 2209032000 # difference between epoch ... | 0.002688 |
def unsurt(surt):
"""
# Simple surt
>>> unsurt('com,example)/')
'example.com/'
# Broken surt
>>> unsurt('com,example)')
'com,example)'
# Long surt
>>> unsurt('suffix,domain,sub,subsub,another,subdomain)/path/file/\
index.html?a=b?c=)/')
'subdomain.another.subsub.sub.domain.suff... | 0.001585 |
def beamcenterx(self) -> ErrorValue:
"""X (column) coordinate of the beam center, pixel units, 0-based."""
try:
return ErrorValue(self._data['geometry']['beamposy'],
self._data['geometry']['beamposy.err'])
except KeyError:
return ErrorValue(s... | 0.005141 |
def merge_stylesheets(Class, fn, *cssfns):
"""merge the given CSS files, in order, into a single stylesheet. First listed takes priority.
"""
stylesheet = Class(fn=fn)
for cssfn in cssfns:
css = Class(fn=cssfn)
for sel in sorted(css.styles.keys()):
... | 0.007599 |
def get_instructions(self, cm, size, insn, idx):
"""
:param cm: a ClassManager object
:type cm: :class:`ClassManager` object
:param size: the total size of the buffer
:type size: int
:param insn: a raw buffer where are the instructions
:typ... | 0.002575 |
def execution_minutes_for_session(self, session_label):
"""
Given a session label, return the execution minutes for that session.
Parameters
----------
session_label: pd.Timestamp (midnight UTC)
A session label whose session's minutes are desired.
Returns
... | 0.00267 |
def is_cdl(filename):
'''
Quick check for .cdl ascii file
Example:
netcdf sample_file {
dimensions:
name_strlen = 7 ;
time = 96 ;
variables:
float lat ;
lat:units = "degrees_north" ;
lat:standard_name = "latitude" ;... | 0.001346 |
def get_object_closure(subject, object_category=None, **kwargs):
"""
Find all terms used to annotate subject plus ancestors
"""
results = search_associations(subject=subject,
object_category=object_category,
select_fields=[],
... | 0.001733 |
def read_projection_from_fits(fitsfile, extname=None):
"""
Load a WCS or HPX projection.
"""
f = fits.open(fitsfile)
nhdu = len(f)
# Try and get the energy bounds
try:
ebins = find_and_read_ebins(f)
except:
ebins = None
if extname is None:
# If there is an im... | 0.002185 |
def cable_to_text(cable, include_header):
"""\
Returns the header/content of the cable as text.
"""
if include_header:
return u'\n\n'.join(cable.header, cable.content)
return cable.content | 0.00463 |
def asyncPipeStrreplace(context=None, _INPUT=None, conf=None, **kwargs):
"""A string module that asynchronously replaces text. Loopable.
Parameters
----------
context : pipe2py.Context object
_INPUT : twisted Deferred iterable of items or strings
conf : {
'RULE': [
{
... | 0.001168 |
def _mangle_sentences_from_file(input_file):
"""Write participle phrase file"""
try:
with open(input_file, 'r') as f:
# final sentence may not be a complete sentence, save and prepend to next chunk
leftovers = ''
sentence_no = 0
for chunk in read_in_chunks... | 0.006676 |
def agp(args):
"""
%prog agp tpffile certificatefile agpfile
Build agpfile from overlap certificates.
Tiling Path File (tpf) is a file that lists the component and the gaps.
It is a three-column file similar to below, also see jcvi.formats.agp.tpf():
telomere chr1 na
AC229737.8 ... | 0.001546 |
def to_dict(self):
"""
For backwards compatibility
"""
plain_dict = dict()
for k, v in self.items():
if self.__fields__[k].is_list:
if isinstance(self.__fields__[k], ViewModelField):
plain_dict[k] = tuple(vt.to_dict() for vt in v)
... | 0.003086 |
def _GetDateValuesWithEpoch(self, number_of_days, date_time_epoch):
"""Determines date values.
Args:
number_of_days (int): number of days since epoch.
date_time_epoch (DateTimeEpoch): date and time of the epoch.
Returns:
tuple[int, int, int]: year, month, day of month.
"""
retur... | 0.002227 |
def start(self):
'''Starts measuring time, and prints the bar at 0%.
It returns self so you can use it like this:
>>> pbar = ProgressBar().start()
>>> for i in range(100):
... # do something
... pbar.update(i+1)
...
>>> pbar.finish()
'''
... | 0.005168 |
def execute(self, *args, **options):
'''Placing this in execute because then subclass handle() don't have to call super'''
if options['verbose']:
options['verbosity'] = 3
if options['quiet']:
options['verbosity'] = 0
self.verbosity = options.get('verbosity', 1)
... | 0.008357 |
def btc_tx_sign_all_unsigned_inputs(private_key_info, prev_outputs, unsigned_tx_hex, scriptsig_type=None, segwit=None, **blockchain_opts):
"""
Sign all unsigned inputs with a given key.
Use the given outputs to fund them.
@private_key_info: either a hex private key, or a dict with 'private_keys' and 'r... | 0.00698 |
def register_custom_type(
self, cls: type, marshaller: Optional[Callable[[Any], Any]] = default_marshaller,
unmarshaller: Union[Callable[[Any, Any], None],
Callable[[Any], Any], None] = default_unmarshaller, *,
typename: str = None, wrap_state: bool = ... | 0.005991 |
def virsh_version(self,
host_list=None,
remote_user=None,
remote_pass=None,
sudo=False,
sudo_user=None,
sudo_pass=None):
'''
Get the virsh version
'''
host_... | 0.007126 |
def create(graph, label_field,
threshold=1e-3,
weight_field='',
self_weight=1.0,
undirected=False,
max_iterations=None,
_single_precision=False,
_distributed='auto',
verbose=True):
"""
Given a weighted graph with observed cl... | 0.001069 |
def get_qpimage_raw(self, idx):
"""Return QPImage without background correction"""
ds = self._get_dataset(idx)
qpi = ds.get_qpimage_raw()
qpi["identifier"] = self.get_identifier(idx)
return qpi | 0.008584 |
def _dens(self,R,z,phi=0.,t=0.):
"""
NAME:
_dens
PURPOSE:
evaluate the density for this potential
INPUT:
R - Galactocentric cylindrical radius
z - vertical height
phi - azimuth
t - time
OUTPUT:
the densi... | 0.030803 |
def create(self, repo_slug=None, key=None, label=None):
""" Associate an ssh key with your repo and return it.
"""
key = '%s' % key
repo_slug = repo_slug or self.bitbucket.repo_slug or ''
url = self.bitbucket.url('SET_DEPLOY_KEY',
username=self.bi... | 0.003091 |
def neighbours(healpix_index, nside, order='ring'):
"""
Find all the HEALPix pixels that are the neighbours of a HEALPix pixel
Parameters
----------
healpix_index : `~numpy.ndarray`
Array of HEALPix pixels
nside : int
Number of pixels along the side of each of the 12 top-level H... | 0.003902 |
def new_dataset(args):
"""
lexibank new-dataset OUTDIR [ID]
"""
if not args.args:
raise ParserError('you must specify an existing directory')
outdir = Path(args.args.pop(0))
if not outdir.exists():
raise ParserError('you must specify an existing directory')
id_pattern = re.c... | 0.00275 |
def int(self, item, default=None):
""" Return value of key as an int
:param item: key of value to transform
:param default: value to return if item does not exist
:return: int of value
"""
try:
item = self.__getattr__(item)
except AttributeError as er... | 0.004587 |
def is_bit_mask(enumeration, potential_mask):
"""
A utility function that checks if the provided value is a composite bit
mask of enumeration values in the specified enumeration class.
Args:
enumeration (class): One of the mask enumeration classes found in this
file. These include:
... | 0.000854 |
def from_inline(cls: Type[CertificationType], version: int, currency: str, blockhash: Optional[str],
inline: str) -> CertificationType:
"""
Return Certification instance from inline document
Only self.pubkey_to is populated.
You must populate self.identity with an Id... | 0.005263 |
def auth_list(**kwargs):
"""
Shows available authorization groups.
"""
ctx = Context(**kwargs)
ctx.execute_action('auth:group:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | 0.004444 |
def assume_script(self) -> 'Language':
"""
Fill in the script if it's missing, and if it can be assumed from the
language subtag. This is the opposite of `simplify_script`.
>>> Language.make(language='en').assume_script()
Language.make(language='en', script='Latn')
>>> ... | 0.002085 |
def issue(self, CorpNum, MgtKeyType, MgtKey, Memo=None, EmailSubject=None, ForceIssue=False, UserID=None):
""" ๋ฐํ
args
CorpNum : ํ์ ์ฌ์
์ ๋ฒํธ
MgtKeyType : ๊ด๋ฆฌ๋ฒํธ ์ ํ one of ['SELL','BUY','TRUSTEE']
MgtKey : ํํธ๋ ๊ด๋ฆฌ๋ฒํธ
Memo : ์ฒ๋ฆฌ ๋ฉ๋ชจ
... | 0.006019 |
def normalize(self):
"Return my probabilities; must be down to one variable."
assert len(self.vars) == 1
return ProbDist(self.vars[0],
dict((k, v) for ((k,), v) in self.cpt.items())) | 0.008696 |
def _maybe_numeric_slice(df, slice_, include_bool=False):
"""
want nice defaults for background_gradient that don't break
with non-numeric data. But if slice_ is passed go with that.
"""
if slice_ is None:
dtypes = [np.number]
if include_bool:
dtypes.append(bool)
... | 0.002488 |
def check_ns_run_members(run):
"""Check nested sampling run member keys and values.
Parameters
----------
run: dict
nested sampling run to check.
Raises
------
AssertionError
if run does not have expected properties.
"""
run_keys = list(run.keys())
# Mandatory k... | 0.000809 |
def scale_axes_from_data(self):
"""Restrict data limits for Y-axis based on what you can see
"""
# get tight limits for X-axis
if self.args.xmin is None:
self.args.xmin = min(fs.xspan[0] for fs in self.spectra)
if self.args.xmax is None:
self.args.xmax = m... | 0.002743 |
def show_fibrechannel_interface_info_output_show_fibrechannel_interface_show_fibrechannel_info_port_interface(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
show_fibrechannel_interface_info = ET.Element("show_fibrechannel_interface_info")
config = show_... | 0.006926 |
def _append(self, menu):
'''append this menu item to a menu'''
menu.Append(self.id(), self.name, self.description) | 0.015385 |
def _gen(self, optimized, splitstring):
"""Generates a new random object generated from the nonterminal
Args:
optimized (bool): mode of operation - if enabled not all
CNF rules are included (mitigate O(n^3))
splitstring (bool): A boolean for enabling o... | 0.003147 |
def plot_ecg_pan_tompkins_steps(time, orig_ecg, pre_process_ecg, sampling_rate, titles):
"""
-----
Brief
-----
With this plotting function it will be possible to plot simultaneously (in pairs) "Original"/
"Filtered"/"Differentiated"/"Rectified"/"Integrated" ECG signals used at "Pan-Tompkins R Pe... | 0.006743 |
def read_status(self, num_bytes=2):
"""Read up to 24 bits (num_bytes) of SPI flash status register contents
via RDSR, RDSR2, RDSR3 commands
Not all SPI flash supports all three commands. The upper 1 or 2
bytes may be 0xFF.
"""
SPIFLASH_RDSR = 0x05
SPIFLASH_RDSR2... | 0.006711 |
def calcPeptideMass(peptide, **kwargs):
"""Calculate the mass of a peptide.
:param aaMass: A dictionary with the monoisotopic masses of amino acid
residues, by default :attr:`maspy.constants.aaMass`
:param aaModMass: A dictionary with the monoisotopic mass changes of
modications, by default... | 0.001122 |
def upload_file(target_filepath, metadata, access_token, base_url=OH_BASE_URL,
remote_file_info=None, project_member_id=None,
max_bytes=MAX_FILE_DEFAULT):
"""
Upload a file from a local filepath using the "direct upload" API.
To learn more about this API endpoint see:
* h... | 0.000614 |
def coverageInfo(self):
"""
Return information about the bases found at each location in our title
sequence.
@return: A C{dict} whose keys are C{int} subject offsets and whose
values are unsorted lists of (score, base) 2-tuples, giving all the
bases from reads th... | 0.002478 |
def __struct_params_s(obj, separator=', ', f=repr, fmt='%s = %s'):
"""method wrapper for printing all elements of a struct"""
s = separator.join([__single_param(obj, n, f, fmt) for n in dir(obj) if __inc_param(obj, n)])
return s | 0.008333 |
def get_cancer_types(cancer_filter=None):
"""Return a list of cancer types, optionally filtered.
Parameters
----------
cancer_filter : Optional[str]
A string used to filter cancer types. Its value is the name or
part of the name of a type of cancer. Example: "melanoma",
"pancrea... | 0.001233 |
def _set_replicator(self, v, load=False):
"""
Setter method for replicator, mapped from YANG variable /tunnel_settings/system/tunnel/replicator (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_replicator is considered as a private
method. Backends looking ... | 0.005672 |
def run_direct(self, **kwargs):
"""
Run the motor at the duty cycle specified by `duty_cycle_sp`.
Unlike other run commands, changing `duty_cycle_sp` while running *will*
take effect immediately.
"""
for key in kwargs:
setattr(self, key, kwargs[key])
s... | 0.008403 |
def df_quantile(df, nb=100):
"""Returns the nb quantiles for datas in a dataframe
"""
quantiles = np.linspace(0, 1., nb)
res = pd.DataFrame()
for q in quantiles:
res = res.append(df.quantile(q), ignore_index=True)
return res | 0.003906 |
def calc_gradient_norm_for_replicates(self,
replicates='bootstrap',
ridge=None,
constrained_pos=None,
weights=None):
"""
Calculate the E... | 0.001688 |
def newDocPI(self, name, content):
"""Creation of a processing instruction element. """
ret = libxml2mod.xmlNewDocPI(self._o, name, content)
if ret is None:raise treeError('xmlNewDocPI() failed')
__tmp = xmlNode(_obj=ret)
return __tmp | 0.014599 |
def obfn_g1(self, Y1):
r"""Compute :math:`g_1(\mathbf{y_1})` component of ADMM objective
function.
"""
return np.linalg.norm((self.Pcn(Y1) - Y1)) | 0.011236 |
async def _dataobject_update_detect(self, _initialkeys, _savedresult):
"""
Coroutine that wait for retrieved value update notification
"""
def expr(newvalues, updatedvalues):
if any(v.getkey() in _initialkeys for v in updatedvalues if v is not None):
return Tr... | 0.007082 |
def has_basis_notes(family, data_dir=None):
'''Check if notes exist for a given basis set
Returns True if they exist, false otherwise
'''
file_path = _basis_notes_path(family, data_dir)
return os.path.isfile(file_path) | 0.004167 |
def get_list(self, size=100, startIndex=0, searchText="", sortProperty="", sortOrder='ASC', status='Active,Pending'):
"""
Request service locations
Returns
-------
dict
"""
url = urljoin(BASEURL, "sites", "list")
params = {
'api_key': self.t... | 0.004274 |
def create(self, **kwargs):
"""
Creates a new statement matching the keyword arguments specified.
Returns the created statement.
"""
Statement = self.get_model('statement')
Tag = self.get_model('tag')
session = self.Session()
tags = set(kwargs.pop('tags'... | 0.003331 |
def file_or_token(value):
"""
If value is a file path and the file exists its contents are stripped and returned,
otherwise value is returned.
"""
if isfile(value):
with open(value) as fd:
return fd.read().strip()
if any(char in value for char in '/\\.'):
# This char... | 0.004193 |
def prepare_array(data, masked=True, nodata=0, dtype="int16"):
"""
Turn input data into a proper array for further usage.
Outut array is always 3-dimensional with the given data type. If the output
is masked, the fill_value corresponds to the given nodata value and the
nodata value will be burned i... | 0.001269 |
def _newRepresentation(self, index, newIndex):
"""
Return a new representation for newIndex that overlaps with the
representation at index by exactly w-1 bits
"""
newRepresentation = self.bucketMap[index].copy()
# Choose the bit we will replace in this representation. We need to shift
# thi... | 0.005359 |
def delete_port_binding(self, port, host):
"""Enqueue port binding delete"""
if not self.get_instance_type(port):
return
for pb_key in self._get_binding_keys(port, host):
pb_res = MechResource(pb_key, a_const.PORT_BINDING_RESOURCE,
a_cons... | 0.005348 |
def connect_engine(self):
"""
Establish a connection to the database.
Provides simple error handling for fatal errors.
Returns:
True, if we could establish a connection, else False.
"""
try:
self.connection = self.engine.connect()
ret... | 0.003922 |
def __branch_point_dfs_recursive(u, large_n, b, stem, dfs_data):
"""A recursive implementation of the BranchPtDFS function, as defined on page 14 of the paper."""
first_vertex = dfs_data['adj'][u][0]
large_w = wt(u, first_vertex, dfs_data)
if large_w % 2 == 0:
large_w += 1
v_I = 0
v_II =... | 0.005 |
def get_help(obj, env, subcmds):
"""Interpolate complete help doc of given object
Assumption that given object as a specific interface:
obj.__doc__ is the basic help object.
obj.get_actions_titles() returns the subcommand if any.
"""
doc = txt.dedent(obj.__doc__ or "")
env = env.copy() ... | 0.000899 |
def to_transfac(self):
"""Return motif formatted in TRANSFAC format
Returns
-------
m : str
String of motif in TRANSFAC format.
"""
m = "%s\t%s\t%s\n" % ("DE", self.id, "unknown")
for i, (row, cons) in enumerate(zip(self.pfm, self.to_consensus... | 0.009029 |
def delete_asset_content(self, asset_content_id=None):
"""Deletes content from an ``Asset``.
arg: asset_content_id (osid.id.Id): the ``Id`` of the
``AssetContent``
raise: NotFound - ``asset_content_id`` is not found
raise: NullArgument - ``asset_content_id`` is ``nu... | 0.002944 |
def init_layout(self):
""" Create the widget in the layout pass after the child widget has
been created and intialized. We do this so the child widget does not
attempt to use this proxy widget as its parent and because
repositioning must be done after the widget is set.
"""
... | 0.003295 |
def track_execution(cmd, project, experiment, **kwargs):
"""Guard the execution of the given command.
The given command (`cmd`) will be executed inside a database context.
As soon as you leave the context we will commit the transaction.
Any necessary modifications to the database can be identified insi... | 0.001361 |
def urlopen(link):
"""Return urllib2 urlopen
"""
try:
return urllib2.urlopen(link)
except urllib2.URLError:
pass
except ValueError:
return ""
except KeyboardInterrupt:
print("")
raise SystemExit() | 0.003846 |
def open(self):
"""Open the device."""
self._serial.port = self._port
self._serial.baudrate = self._baud
self._serial.timeout = self._timeout
self._serial.open()
self._serial.flushInput()
self._serial.flushOutput() | 0.007407 |
def NewFromJSON(data):
"""
Create a new SharedFile instance from a JSON dict.
Args:
data (dict): JSON dictionary representing a SharedFile.
Returns:
A SharedFile instance.
"""
return SharedFile(
sharekey=data.get('sharekey', None),
... | 0.001789 |
def parse_args(arguments, wrapper_kwargs={}):
"""
MMI Runner
"""
# make a socket that replies to message with the grid
# if we are running mpi we want to know the rank
args = {}
positional = [
'engine',
'configfile',
]
for key in positional:
args[key] = argum... | 0.001256 |
def dailymotion_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
"""Downloads Dailymotion videos by URL.
"""
html = get_content(rebuilt_url(url))
info = json.loads(match1(html, r'qualities":({.+?}),"'))
title = match1(html, r'"video_title"\s*:\s*"([^"]+)"') or \
mat... | 0.0125 |
def login(self, username=None, password=None,
section='default'):
"""
Created the passport with ``username`` and ``password`` and log in.
If either ``username`` or ``password`` is None or omitted, the
credentials file will be parsed.
:param str username: username t... | 0.002048 |
def runtime(self):
"""Transitional property providing access to the new timer
mechanism. This will be removed in the future.
"""
warnings.warn("admm.ADMM.runtime attribute has been replaced by "
"an upgraded timer class: please see the documentation "
... | 0.004 |
def calc_flooddischarge_v1(self):
"""Calculate the discharge during and after a flood event based on an
|anntools.SeasonalANN| describing the relationship(s) between discharge
and water stage.
Required control parameter:
|WaterLevel2FloodDischarge|
Required derived parameter:
|dam_deri... | 0.000232 |
def under_attack(col, queens):
"""Checks if queen is under attack
:param col: Column number
:param queens: list of queens
:return: True iff queen is under attack
"""
left = right = col
for _, column in reversed(queens):
left, right = left - 1, right +... | 0.004808 |
def record(*a, **kw):
"""
Are you tired of typing class declarations that look like this::
class StuffInfo:
def __init__(self, a=None, b=None, c=None, d=None, e=None,
f=None, g=None, h=None, i=None, j=None):
self.a = a
self.b = b
... | 0.000392 |
def at(self, p):
"""
Returns the set of all intervals that contain p.
Completes in O(m + log n) time, where:
* n = size of the tree
* m = number of matches
:rtype: set of Interval
"""
root = self.top_node
if not root:
return set()
... | 0.005525 |
def add_reactions(self, reaction_list):
"""Add reactions to the model.
Reactions with identifiers identical to a reaction already in the
model are ignored.
The change is reverted upon exit when using the model as a context.
Parameters
----------
reaction_list :... | 0.000685 |
def add(self, variable, range_):
"""
Add a new low and high bound for a variable.
As it is flow insensitive, it compares it with old values and update it
if needed.
"""
if variable not in self.result:
self.result[variable] = range_
else:
s... | 0.004819 |
def get_noalt_contigs(data):
"""Retrieve contigs without alternatives as defined in bwa *.alts files.
If no alt files present (when we're not aligning with bwa), work around
with standard set of alts based on hg38 -- anything with HLA, _alt or
_decoy in the name.
"""
alts = set([])
alt_file... | 0.004028 |
def check_appt(self, complex: str, house: str, appt: str) -> bool:
"""
Check if given appartment exists in the rumetr database
"""
self.check_house(complex, house)
if '%s__%s__%s' % (complex, house, appt) in self._checked_appts:
return True
try:
s... | 0.004969 |
def register_types(name, *types):
"""
Register a short name for one or more content types.
"""
type_names.setdefault(name, set())
for t in types:
# Redirecting the type
if t in media_types:
type_names[media_types[t]].discard(t)
# Save the mapping
media_t... | 0.002732 |
def indicator_associations_types(
self, indicator_type, api_entity=None, api_branch=None, params=None
):
"""
Gets the indicator association from a Indicator/Group/Victim
Args:
indicator_type:
api_entity:
api_branch:
params:
Re... | 0.003464 |
def clear_zone_conditions(self):
"""stub"""
if (self.get_zone_conditions_metadata().is_read_only() or
self.get_zone_conditions_metadata().is_required()):
raise NoAccess()
self.my_osid_object_form._my_map['zoneConditions'] = \
self._zone_conditions_metadata... | 0.005747 |
def _CopyDateTimeFromStringISO8601(self, time_string):
"""Copies a date and time from an ISO 8601 date and time string.
Args:
time_string (str): time value formatted as:
hh:mm:ss.######[+-]##:##
Where # are numeric digits ranging from 0 to 9 and the seconds
fraction can be ... | 0.003917 |
def _HandleMetadataUpdate(
self, metadata_key='', recursive=True, wait=True, timeout=None,
retry=True):
"""Wait for a successful metadata response.
Args:
metadata_key: string, the metadata key to watch for changes.
recursive: bool, True if we should recursively watch for metadata change... | 0.007428 |
def Reset(self):
"""Reset the lexer to process a new data feed."""
# The first state
self.state = "INITIAL"
self.state_stack = []
# The buffer we are parsing now
self.buffer = ""
self.error = 0
self.verbose = 0
# The index into the buffer where we are currently pointing
self.pr... | 0.002762 |
def object_emitter(target, source, env, parent_emitter):
"""Sets up the PCH dependencies for an object file."""
validate_vars(env)
parent_emitter(target, source, env)
# Add a dependency, but only if the target (e.g. 'Source1.obj')
# doesn't correspond to the pre-compiled header ('Source1.pch').
... | 0.001074 |
def download(fname, input_dir, dl_dir=None):
"""Download the resource from the storage."""
try:
manager = _get_storage_manager(fname)
except ValueError:
return fname
return manager.download(fname, input_dir, dl_dir) | 0.004049 |
def log_calls(func):
'''Decorator to log function calls.'''
def wrapper(*args, **kargs):
callStr = "%s(%s)" % (func.__name__, ", ".join([repr(p) for p in args] + ["%s=%s" % (k, repr(v)) for (k, v) in list(kargs.items())]))
debug(">> %s", callStr)
ret = func(*args, **kargs)
debug("<< %s: %s", callStr... | 0.013736 |
def put_worker(func, from_idx, to_idx, params, out_q):
"""
put worker
"""
succ, fail = func(from_idx, to_idx, params)
return out_q.put({'succ': succ, 'fail': fail}) | 0.005435 |
def exec_command(
client, container, command, interactive=True, stdout=None, stderr=None, stdin=None):
"""
Run provided command via exec API in provided container.
This is just a wrapper for PseudoTerminal(client, container).exec_command()
"""
exec_id = exec_create(client, container, comman... | 0.005566 |
def neighborhood_cortical_magnification(mesh, coordinates):
'''
neighborhood_cortical_magnification(mesh, visual_coordinates) yields a list of neighborhood-
based cortical magnification values for the vertices in the given mesh if their visual field
coordinates are given by the visual_coordinates matrix... | 0.010794 |
def get_filename(self, renew=False):
"""Get the filename of this content.
If the file name doesn't already exist, we created it as {id}.{format}.
"""
if self._fname is None or renew:
self._fname = '%s.%s' % (self._id, self._format)
return self._fname | 0.006601 |
def from_df(cls, path, df:DataFrame, dep_var:str, valid_idx:Collection[int], procs:OptTabTfms=None,
cat_names:OptStrList=None, cont_names:OptStrList=None, classes:Collection=None,
test_df=None, bs:int=64, val_bs:int=None, num_workers:int=defaults.cpus, dl_tfms:Optional[Collection[Callab... | 0.042507 |
def get_processed_hotkeys(hotkeys=None):
"""
Process passed dict with key combinations or the HOTKEYS dict from
settings.
"""
hotkeys = hotkeys or ks_settings.HOTKEYS
processed_hotkeys = AutoVivification()
if not hotkeys:
return processed_hotkeys
for combination in hotkeys:
... | 0.004819 |
def build_parallel(parallel_mode, quiet=True, processes=4,
user_modules=None, dispatcher_options=None):
"""initializes `Parallel`
Parameters
----------
parallel_mode : str
"multiprocessing" (default), "htcondor" or "subprocess"
quiet : bool, optional
if True, prog... | 0.001814 |
def to_pascal_case(s):
"""Transform underscore separated string to pascal case
"""
return re.sub(r'(?!^)_([a-zA-Z])', lambda m: m.group(1).upper(), s.capitalize()) | 0.011364 |
def transitions(self, return_matrix=True):
"""Returns the routing probabilities for each vertex in the
graph.
Parameters
----------
return_matrix : bool (optional, the default is ``True``)
Specifies whether an :class:`~numpy.ndarray` is returned.
If ``Fal... | 0.000869 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.