sequence stringlengths 546 16.2k | code stringlengths 108 19.3k |
|---|---|
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:put_file; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, identifier:self; 5, identifier:file; 6, identifier:object_type; 7, identifier:object_id; 8, identifier:width; 9, identifier:height; 10, identifier:mimetype; 11, iden... | def put_file(self, file, object_type, object_id, width, height, mimetype,
reproducible):
"""Puts the ``file`` of the image.
:param file: the image file to put
:type file: file-like object, :class:`file`
:param object_type: the object type of the image to put
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_original_images; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 10; 7, 46; 7, 180; 8, expression_statement; 8, 9; 9, comment; 10, function_definition; 10, 11; 10, 12; ... | def _original_images(self, **kwargs):
"""A list of the original images.
:returns: A list of the original images.
:rtype: :class:`typing.Sequence`\ [:class:`Image`]
"""
def test(image):
if not image.original:
return False
for filter, value... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:from_file; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, identifier:file; 6, default_parameter; 6, 7; 6, 8; 7, identifier:store; 8, identifier:current_store; 9, default_parameter; 9, 10; 9, 11; 10, identifier:extra_args;... | def from_file(self, file, store=current_store,
extra_args=None, extra_kwargs=None):
"""Stores the ``file`` for the image into the ``store``.
:param file: the readable file of the image
:type file: file-like object, :class:`file`
:param store: the storage to store the f... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:copy_modules; 3, parameters; 3, 4; 3, 7; 3, 10; 4, default_parameter; 4, 5; 4, 6; 5, identifier:filespath; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:modules_path; 9, None; 10, default_parameter; 10, 11; 10, 12; 11, identifier:ve... | def copy_modules(filespath=None, modules_path=None, verbose=None):
''' Copy over the tree module files into your path '''
# find or define a modules path
if not modules_path:
modulepath = os.getenv("MODULEPATH")
if not modulepath:
modules_path = input('Enter the root path for yo... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:_repr_html_; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:indices; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:iops; 10, None; 11, default_parameter; 11... | def _repr_html_(self, indices=None, iops=None, lx=None, li=None, lls=None):
"""Representation of the parameter in html for notebook display."""
filter_ = self._current_slice_
vals = self.flat
if indices is None: indices = self._indices(filter_)
if iops is None:
ravi =... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 22; 2, function_name:optimize_restarts; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:num_restarts; 7, integer:10; 8, default_parameter; 8, 9; 8, 10; 9, identifier:robust; 10, False... | def optimize_restarts(self, num_restarts=10, robust=False, verbose=True, parallel=False, num_processes=None, **kwargs):
"""
Perform random restarts of the model, and set the model to the best
seen solution.
If the robust flag is set, exceptions raised during optimizations will
b... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:optimizer_array; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 44; 5, 106; 5, 128; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 30; 9, boolean_operator:or; 9, 10; 9, 21; 10, comparison_operator:is; 10... | def optimizer_array(self):
"""
Array for the optimizer to work on.
This array always lives in the space for the optimizer.
Thus, it is untransformed, going from Transformations.
Setting this array, will make sure the transformed parameters for this model
will be set acco... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_parse_content; 3, parameters; 3, 4; 4, identifier:fh; 5, block; 5, 6; 5, 8; 5, 15; 5, 19; 5, 327; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:content; 11, call; 11, 12; ... | def _parse_content(fh):
"""Parse the content of a script to find marked dependencies."""
content = iter(fh)
deps = {}
for line in content:
# quickly discard most of the lines
if 'fades' not in line:
continue
# discard other string with 'fades' that isn't a comment
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_parse_docstring; 3, parameters; 3, 4; 4, identifier:fh; 5, block; 5, 6; 5, 8; 5, 19; 5, 53; 5, 73; 5, 139; 5, 146; 5, 161; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:fi... | def _parse_docstring(fh):
"""Parse the docstrings of a script to find marked dependencies."""
find_fades = re.compile(r'\b(fades)\b:').search
for line in fh:
if line.startswith("'"):
quote = "'"
break
if line.startswith('"'):
quote = '"'
break... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_venv_match; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:installed; 6, identifier:requirements; 7, block; 7, 8; 7, 10; 7, 21; 7, 25; 7, 140; 7, 141; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; 10,... | def _venv_match(self, installed, requirements):
"""Return True if what is installed satisfies the requirements.
This method has multiple exit-points, but only for False (because
if *anything* is not satisified, the venv is no good). Only after
all was checked, and it didn't exit, the ve... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 32; 2, function_name:encrypt; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 4, identifier:content; 5, default_parameter; 5, 6; 5, 7; 6, identifier:salt; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:key; 10, None; 11... | def encrypt(content, salt=None, key=None,
private_key=None, dh=None, auth_secret=None,
keyid=None, keylabel="P-256",
rs=4096, version="aes128gcm"):
"""
Encrypt a data block
:param content: block of data to encrypt
:type content: str
:param salt: Encryption salt
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_format_ase2clusgeo; 3, parameters; 3, 4; 3, 5; 4, identifier:obj; 5, default_parameter; 5, 6; 5, 7; 6, identifier:all_atomtypes; 7, None; 8, block; 8, 9; 8, 11; 8, 12; 8, 19; 8, 44; 8, 56; 8, 60; 8, 64; 8, 111; 8, 115; 8, 122; 8, 124; 8, 137; ... | def _format_ase2clusgeo(obj, all_atomtypes=None):
""" Takes an ase Atoms object and returns numpy arrays and integers
which are read by the internal clusgeo. Apos is currently a flattened
out numpy array
Args:
obj():
all_atomtypes():
sort():
"""
#atoms metadata
total... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 22; 2, function_name:zmax; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 13; 3, 16; 3, 19; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:return_times; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:func; 10, attribute; 10, 11; 10, 12; 11, i... | def zmax(self, return_times=False, func=np.mean,
interp_kwargs=None, minimize_kwargs=None,
approximate=False):
"""
Estimate the maximum ``z`` height of the orbit by identifying local
maxima in the absolute value of the ``z`` position and interpolating
between ti... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:align_circulation_with_z; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:circulation; 7, None; 8, block; 8, 9; 8, 11; 8, 24; 8, 34; 8, 40; 8, 46; 8, 82; 8, 107; 8, 139; 8, 147; 8, 155; 8, 297; 9, ... | def align_circulation_with_z(self, circulation=None):
"""
If the input orbit is a tube orbit, this function aligns the circulation
axis with the z axis and returns a copy.
Parameters
----------
circulation : array_like (optional)
Array of bits that specify th... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 32; 2, function_name:fast_lyapunov_max; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 4, identifier:w0; 5, identifier:hamiltonian; 6, identifier:dt; 7, identifier:n_steps; 8, default_parameter; 8, 9; 8, 10; 9, identi... | def fast_lyapunov_max(w0, hamiltonian, dt, n_steps, d0=1e-5,
n_steps_per_pullback=10, noffset_orbits=2, t1=0.,
atol=1E-10, rtol=1E-10, nmax=0, return_orbit=True):
"""
Compute the maximum Lyapunov exponent using a C-implemented estimator
that uses the DOPRI853 inte... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:estimate_dt_n_steps; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 3, 16; 4, identifier:w0; 5, identifier:hamiltonian; 6, identifier:n_periods; 7, identifier:n_steps_per_period; 8, default_parameter; 8, 9; 8, 10; 9, identifier:dE_thresho... | def estimate_dt_n_steps(w0, hamiltonian, n_periods, n_steps_per_period,
dE_threshold=1E-9, func=np.nanmax,
**integrate_kwargs):
"""
Estimate the timestep and number of steps to integrate an orbit for
given its initial conditions and a potential object.
Pa... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 27; 2, function_name:plot_projections; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 19; 3, 22; 3, 25; 4, identifier:x; 5, default_parameter; 5, 6; 5, 7; 6, identifier:relative_to; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:autolim; 10, True; 11... | def plot_projections(x, relative_to=None, autolim=True, axes=None,
subplots_kwargs=dict(), labels=None, plot_function=None,
**kwargs):
"""
Given N-dimensional quantity, ``x``, make a figure containing 2D projections
of all combinations of the axes.
Parameters
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 29; 2, function_name:compute_coeffs; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 4, identifier:density_func; 5, identifier:nmax; 6, identifier:lmax; 7, identifier:M; 8, identifier:r_s; 9, default_parameter; 9, 10; 9... | def compute_coeffs(density_func, nmax, lmax, M, r_s, args=(),
skip_odd=False, skip_even=False, skip_m=False,
S_only=False, progress=False, **nquad_opts):
"""
Compute the expansion coefficients for representing the input density function using a basis
function expansion.... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:compute_coeffs_discrete; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:xyz; 5, identifier:mass; 6, identifier:nmax; 7, identifier:lmax; 8, identifier:r_s; 9, default_parameter; 9, 10; 9, 11; 10, identifi... | def compute_coeffs_discrete(xyz, mass, nmax, lmax, r_s,
skip_odd=False, skip_even=False, skip_m=False,
compute_var=False):
"""
Compute the expansion coefficients for representing the density distribution of input points
as a basis function expansion. T... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:to_coord_frame; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:frame; 6, default_parameter; 6, 7; 6, 8; 7, identifier:galactocentric_frame; 8, None; 9, dictionary_splat_pattern; 9, 10; 10, identifier:kwargs; 11, block... | def to_coord_frame(self, frame, galactocentric_frame=None, **kwargs):
"""
Transform the orbit from Galactocentric, cartesian coordinates to
Heliocentric coordinates in the specified Astropy coordinate frame.
Parameters
----------
frame : :class:`~astropy.coordinates.Base... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_plot_prepare; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:components; 6, identifier:units; 7, block; 7, 8; 7, 10; 7, 11; 7, 24; 7, 31; 7, 32; 7, 69; 7, 73; 7, 77; 7, 235; 8, expression_statement; 8, 9; 9, comment; 10, co... | def _plot_prepare(self, components, units):
"""
Prepare the ``PhaseSpacePosition`` or subclass for passing to a plotting
routine to plot all projections of the object.
"""
# components to plot
if components is None:
components = self.pos.components
n_... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:recommend; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:client_data; 6, identifier:limit; 7, default_parameter; 7, 8; 7, 9; 8, identifier:extra_data; 9, dictionary; 10, block; 10, 11; 10, 13; 10, 23; 10, 24; 10, 25;... | def recommend(self, client_data, limit, extra_data={}):
"""
Hybrid recommendations simply select half recommendations from
the ensemble recommender, and half from the curated one.
Duplicate recommendations are accomodated by rank ordering
by weight.
"""
preinsta... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:_recommend; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:client_data; 6, identifier:limit; 7, default_parameter; 7, 8; 7, 9; 8, identifier:extra_data; 9, dictionary; 10, block; 10, 11; 10, 13; 10, 22; 10, 32; 10, 33... | def _recommend(self, client_data, limit, extra_data={}):
"""
Ensemble recommendations are aggregated from individual
recommenders. The ensemble recommender applies a weight to
the recommendation outputs of each recommender to reorder the
recommendations to be a better fit.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_build_features_caches; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 20; 5, 32; 5, 45; 5, 54; 5, 55; 5, 73; 5, 103; 5, 104; 5, 125; 5, 164; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assign... | def _build_features_caches(self):
"""This function build two feature cache matrices.
That's the self.categorical_features and
self.continuous_features attributes.
One matrix is for the continuous features and the other is for
the categorical features. This is needed to speed up... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:pdos_select; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:atoms; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:spin; 10, None; 11, default_parameter; 11, 12; 11,... | def pdos_select( self, atoms=None, spin=None, l=None, m=None ):
"""
Returns a subset of the projected density of states array.
Args:
atoms (int or list(int)): Atom numbers to include in the selection. Atom numbers count from 1.
Default is to selec... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_describe; 3, parameters; 3, 4; 3, 5; 4, identifier:node; 5, identifier:parent; 6, block; 6, 7; 6, 9; 6, 16; 6, 26; 6, 215; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 15; 11, pattern_l... | def _describe(node, parent):
"""Generate lines describing the given `node` tuple.
This is the recursive back-end that powers ``describe()``. With its
extra ``parent`` parameter, this routine remembers the nearest
non-placeholder ancestor so that it can compare it against the
actual value of the ``... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:resample; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 23; 5, 24; 5, 30; 5, 36; 5, 37; 5, 38; 5, 65; 5, 66; 5, 87; 5, 88; 5, 89; 5, 90; 5, 91; 5, 92; 5, 104; 5, 112; 5, 120; 5, 121; 5, 146; 5, 147; 5, 148; 5, 176; 5, 177; 5... | def resample(self):
"""
Forces the updater to perform a resampling step immediately.
"""
if self.just_resampled:
warnings.warn(
"Resampling without additional data; this may not perform as "
"desired.",
ResamplerWarning
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:expected_information_gain; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:expparams; 6, block; 6, 7; 6, 9; 6, 10; 6, 11; 6, 12; 6, 13; 6, 19; 6, 65; 6, 66; 6, 86; 6, 87; 6, 88; 6, 89; 6, 113; 6, 137; 6, 173; 6, 187; 6, 209; 6, 210... | def expected_information_gain(self, expparams):
r"""
Calculates the expected information gain for each hypothetical experiment.
:param expparams: The experiments at which to compute expected
information gain.
:type expparams: :class:`~numpy.ndarray` of dtype given by the cur... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:iter_actions; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 10; 5, 14; 5, 15; 5, 16; 5, 33; 5, 42; 5, 43; 5, 47; 5, 61; 5, 207; 5, 208; 5, 222; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, comment; 10, exp... | def iter_actions(self):
"""Yield the service's actions with their arguments.
Yields:
`Action`: the next action.
Each action is an Action namedtuple, consisting of action_name
(a string), in_args (a list of Argument namedtuples consisting of name
and argtype), and ou... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:parse_event_xml; 3, parameters; 3, 4; 4, identifier:xml_event; 5, block; 5, 6; 5, 8; 5, 12; 5, 21; 5, 22; 5, 23; 5, 32; 5, 309; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifie... | def parse_event_xml(xml_event):
"""Parse the body of a UPnP event.
Args:
xml_event (bytes): bytes containing the body of the event encoded
with utf-8.
Returns:
dict: A dict with keys representing the evented variables. The
relevant value will usually be a string rep... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_restore_coordinator; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 10; 5, 11; 5, 21; 5, 41; 5, 42; 5, 48; 5, 49; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, comment; 10, comment; 11, expression_statement... | def _restore_coordinator(self):
"""Do the coordinator-only part of the restore."""
# Start by ensuring that the speaker is paused as we don't want
# things all rolling back when we are changing them, as this could
# include things like audio
transport_info = self.device.get_curre... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort_loading_order; 3, parameters; 3, 4; 4, identifier:step_files; 5, block; 5, 6; 5, 8; 5, 12; 5, 16; 5, 20; 5, 124; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:tools; 1... | def sort_loading_order(step_files):
"""Sort step files into correct loading order.
The correct loading order is first tools, then workflows without
subworkflows, and then workflows with subworkflows. This order is
required to avoid error messages when a working directory is used.
"""
tools = []... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:add_input; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 10; 7, 16; 7, 57; 7, 61; 7, 67; 7, 83; 7, 99; 7, 113; 7, 122; 7, 215; 7, 221; 7, 238; 7, 239; 7, 252; 7, 253; ... | def add_input(self, **kwargs):
"""Add workflow input.
Args:
kwargs (dict): A dict with a `name: type` item
and optionally a `default: value` item, where name is the
name (id) of the workflow input (e.g., `dir_in`) and type is
the type of the i... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:to_obj; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:wd; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:pack; 10, False; 11, default_parameter; 11, 12; 11, 13; 12, iden... | def to_obj(self, wd=False, pack=False, relpath=None):
"""Return the created workflow as a dict.
The dict can be written to a yaml file.
Returns:
A yaml-compatible dict representing the workflow.
"""
self._closed()
obj = CommentedMap()
obj['cwlVersio... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:to_script; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:wf_name; 7, string:'wf'; 8, block; 8, 9; 8, 11; 8, 17; 8, 21; 8, 22; 8, 23; 8, 24; 8, 25; 8, 26; 8, 27; 8, 28; 8, 29; 8, 30; 8, 31; 8, 32;... | def to_script(self, wf_name='wf'):
"""Generated and print the scriptcwl script for the currunt workflow.
Args:
wf_name (str): string used for the WorkflowGenerator object in the
generated script (default: ``wf``).
"""
self._closed()
script = []
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 27; 2, function_name:save; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 4, identifier:self; 5, identifier:fname; 6, default_parameter; 6, 7; 6, 8; 7, identifier:mode; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:validate... | def save(self, fname, mode=None, validate=True, encoding='utf-8',
wd=False, inline=False, relative=False, pack=False):
"""Save the workflow to file.
Save the workflow to a CWL file that can be run with a CWL runner.
Args:
fname (str): file to save the workflow to.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_snodas_ds; 3, parameters; 3, 4; 3, 5; 4, identifier:dem_dt; 5, default_parameter; 5, 6; 5, 7; 6, identifier:code; 7, integer:1036; 8, block; 8, 9; 8, 11; 8, 14; 8, 17; 8, 21; 8, 25; 8, 37; 8, 55; 8, 56; 8, 108; 8, 346; 9, expression_stateme... | def get_snodas_ds(dem_dt, code=1036):
"""Function to fetch and process SNODAS snow depth products for input datetime
http://nsidc.org/data/docs/noaa/g02158_snodas_snow_cover_model/index.html
Product codes:
1036 is snow depth
1034 is SWE
filename format: us_ssmv11036tS__T0001TTNATS2015042205HP... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:get_modscag_fn_list; 3, parameters; 3, 4; 3, 5; 3, 13; 4, identifier:dem_dt; 5, default_parameter; 5, 6; 5, 7; 6, identifier:tile_list; 7, tuple; 7, 8; 7, 9; 7, 10; 7, 11; 7, 12; 8, string:'h08v04'; 9, string:'h09v04'; 10, string:'h10v04'; 11,... | def get_modscag_fn_list(dem_dt, tile_list=('h08v04', 'h09v04', 'h10v04', 'h08v05', 'h09v05'), pad_days=7):
"""Function to fetch and process MODSCAG fractional snow cover products for input datetime
Products are tiled in MODIS sinusoidal projection
example url: https://snow-data.jpl.nasa.gov/modscag-histor... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:_decode_record; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:s; 6, default_parameter; 6, 7; 6, 8; 7, identifier:line; 8, integer:0; 9, block; 9, 10; 9, 12; 9, 21; 9, 27; 9, 95; 9, 101; 9, 116; 9, 128; 9, 134; 9, 149; 9, 15... | def _decode_record(self, s, line=0):
'''Decode one record of HEX file.
@param s line with HEX record.
@param line line number (for error messages).
@raise EndOfFile if EOF record encountered.
'''
s = s.rstrip('\r\n')
if not s:
return ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:_get_start_end; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:end; 10, None; 11, default_parameter; 11, 12; 11, 13; ... | def _get_start_end(self, start=None, end=None, size=None):
"""Return default values for start and end if they are None.
If this IntelHex object is empty then it's error to
invoke this method with both start and end as None.
"""
if (start,end) == (None,None) and self._buf == {}:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:dump; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:tofile; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:width; 10, integer:16; 11, default_parameter; 11, 12; 11, 13; 1... | def dump(self, tofile=None, width=16, withpadding=False):
"""Dump object content to specified file object or to stdout if None.
Format is a hexdump with some header information at the beginning,
addresses on the left, and data on right.
@param tofile file-like object to dump t... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:add_recipe_folder; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:recipe_folder; 6, default_parameter; 6, 7; 6, 8; 7, identifier:whitelist; 8, None; 9, block; 9, 10; 9, 12; 9, 24; 9, 33; 9, 96; 10, expression_statement; 10, ... | def add_recipe_folder(self, recipe_folder, whitelist=None):
"""Add all recipes inside a folder to this RecipeManager with an optional whitelist.
Args:
recipe_folder (str): The path to the folder of recipes to add.
whitelist (list): Only include files whose os.basename() matches ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:run; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:include_reset; 7, True; 8, default_parameter; 8, 9; 8, 10; 9, identifier:accelerated; 10, True; 11, block; 11, 12; 11, 14; 11, 22; 11, 33... | def run(self, include_reset=True, accelerated=True):
"""Run this sensor graph until a stop condition is hit.
Multiple calls to this function are useful only if
there has been some change in the stop conditions that would
cause the second call to not exit immediately.
Args:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_convert_default_value; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:default; 6, block; 6, 7; 6, 9; 6, 16; 6, 47; 6, 75; 6, 87; 6, 101; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 13; 10, comparison_ope... | def _convert_default_value(self, default):
"""Convert the passed default value to binary.
The default value (if passed) may be specified as either a `bytes`
object or a python int or list of ints. If an int or list of ints is
passed, it is converted to binary. Otherwise, the raw binar... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:latch; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 28; 5, 29; 5, 30; 5, 43; 5, 57; 5, 106; 5, 127; 5, 139; 5, 173; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 17; 9, comparison_operator:==; 9, 10; ... | def latch(self):
"""Convert the current value inside this config descriptor to a python object.
The conversion proceeds by mapping the given type name to a native
python class and performing the conversion. You can override what
python object is used as the destination class by passing... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_contents_dir; 3, parameters; 3, 4; 4, identifier:node; 5, block; 5, 6; 5, 8; 5, 12; 5, 48; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:contents; 11, list:[]; 12, for_... | def get_contents_dir(node):
"""Return content signatures and names of all our children
separated by new-lines. Ensure that the nodes are sorted."""
contents = []
for n in sorted(node.children(), key=lambda t: t.name):
contents.append('%s %s\n' % (n.get_csig(), n.name))
return ''.join(content... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:prepare; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 45; 5, 82; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 14; 9, comparison_operator:is; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifie... | def prepare(self):
"""Prepare for this Node to be built.
This is called after the Taskmaster has decided that the Node
is out-of-date and must be rebuilt, but before actually calling
the method to build the Node.
This default implementation checks that explicit or implicit
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:scan; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 10; 5, 11; 5, 19; 5, 25; 5, 33; 5, 39; 5, 48; 5, 56; 5, 64; 5, 65; 5, 141; 5, 142; 5, 153; 5, 154; 5, 155; 5, 163; 6, expression_statement; 6, 7; 7, comment; 8, comme... | def scan(self):
"""Scan this node's dependents for implicit dependencies."""
# Don't bother scanning non-derived files, because we don't
# care what their dependencies are.
# Don't scan again, if we already have scanned.
if self.implicit is not None:
return
se... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_binfo; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 18; 5, 26; 5, 32; 5, 40; 5, 46; 5, 79; 5, 113; 5, 119; 5, 141; 5, 157; 5, 165; 5, 185; 5, 195; 5, 215; 6, expression_statement; 6, 7; 7, comment; 8, try_statement; 8, ... | def get_binfo(self):
"""
Fetch a node's build information.
node - the node whose sources will be collected
cache - alternate node to use for the signature cache
returns - the build signature
This no longer handles the recursive descent of the
node's children's s... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:main; 3, parameters; 3, 4; 4, default_parameter; 4, 5; 4, 6; 5, identifier:argv; 6, None; 7, block; 7, 8; 7, 10; 7, 25; 7, 32; 7, 38; 7, 44; 7, 48; 7, 56; 7, 91; 7, 98; 7, 106; 7, 114; 7, 122; 7, 128; 7, 136; 7, 154; 7, 158; 7, 222; 7, 223; 7, ... | def main(argv=None):
"""Run the iotile shell tool.
You can optionally pass the arguments that should be run
in the argv parameter. If nothing is passed, the args
are pulled from sys.argv.
The return value of this function is the return value
of the shell command.
"""
if argv is None:... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:DialectAddToEnv; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:env; 5, identifier:dialect; 6, identifier:suffixes; 7, identifier:ppsuffixes; 8, default_parameter; 8, 9; 8, 10; 9, identifier:support_module; 10, integer:0; 11, block... | def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module = 0):
"""Add dialect specific construction variables."""
ComputeFortranSuffixes(suffixes, ppsuffixes)
fscan = SCons.Scanner.Fortran.FortranScan("%sPATH" % dialect)
for suffix in suffixes + ppsuffixes:
SCons.Tool.SourceFileS... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:MergeFlags; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:args; 6, default_parameter; 6, 7; 6, 8; 7, identifier:unique; 8, integer:1; 9, default_parameter; 9, 10; 9, 11; 10, identifier:dict; 11, None; 12, block; 12, ... | def MergeFlags(self, args, unique=1, dict=None):
"""
Merge the dict in args into the construction variables of this
env, or the passed-in dict. If args is not a dict, it is
converted into a dict using ParseFlags. If unique is not set,
the flags are appended rather than merged.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:Append; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kw; 7, block; 7, 8; 7, 10; 7, 17; 7, 330; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, 11; 11, assignment; 11, 1... | def Append(self, **kw):
"""Append values to existing construction variables
in an Environment.
"""
kw = copy_non_reserved_keywords(kw)
for key, val in kw.items():
# It would be easier on the eyes to write this using
# "continue" statements whenever we fini... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:ParseDepends; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:filename; 6, default_parameter; 6, 7; 6, 8; 7, identifier:must_exist; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:only_one; 11, integer:0; 1... | def ParseDepends(self, filename, must_exist=None, only_one=0):
"""
Parse a mkdep-style file for explicit dependencies. This is
completely abusable, and should be unnecessary in the "normal"
case of proper SCons configuration, but it may help make
the transition from a Make hiera... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:Prepend; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kw; 7, block; 7, 8; 7, 10; 7, 17; 7, 213; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, 11; 11, assignment; 11, ... | def Prepend(self, **kw):
"""Prepend values to existing construction variables
in an Environment.
"""
kw = copy_non_reserved_keywords(kw)
for key, val in kw.items():
# It would be easier on the eyes to write this using
# "continue" statements whenever we fi... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:PrependUnique; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:delete_existing; 7, integer:0; 8, dictionary_splat_pattern; 8, 9; 9, identifier:kw; 10, block; 10, 11; 10, 13; 10, 20; 10, 276;... | def PrependUnique(self, delete_existing=0, **kw):
"""Prepend values to existing construction variables
in an Environment, if they're not already there.
If delete_existing is 1, removes existing values first, so
values move to front.
"""
kw = copy_non_reserved_keywords(kw)... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:wait_idle; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:timeout; 7, float:1.0; 8, block; 8, 9; 8, 11; 8, 85; 8, 104; 8, 113; 9, expression_statement; 9, 10; 10, comment; 11, function_definition;... | def wait_idle(self, timeout=1.0):
"""Wait until the rpc queue is empty.
This method may be called either from within the event loop or from
outside of it. If it is called outside of the event loop it will
block the calling thread until the rpc queue is temporarily empty.
If it... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_process_long_opt; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:rargs; 6, identifier:values; 7, block; 7, 8; 7, 10; 7, 19; 7, 20; 7, 21; 7, 60; 7, 106; 7, 114; 7, 289; 8, expression_statement; 8, 9; 9, comment; 10, express... | def _process_long_opt(self, rargs, values):
"""
SCons-specific processing of long options.
This is copied directly from the normal
optparse._process_long_opt() method, except that, if configured
to do so, we catch the exception thrown when an unknown option
is encountere... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:Tag; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 9; 4, identifier:env; 5, identifier:target; 6, identifier:source; 7, list_splat_pattern; 7, 8; 8, identifier:more_tags; 9, dictionary_splat_pattern; 9, 10; 10, identifier:kw_tags; 11, block; 11, 1... | def Tag(env, target, source, *more_tags, **kw_tags):
""" Tag a file with the given arguments, just sets the accordingly named
attribute on the file object.
TODO: FIXME
"""
if not target:
target=source
first_tag=None
else:
first_tag=source
if first_tag:
kw_ta... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:find_vc_pdir; 3, parameters; 3, 4; 4, identifier:msvc_version; 5, block; 5, 6; 5, 8; 5, 12; 5, 37; 5, 207; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:root; 11, string:'S... | def find_vc_pdir(msvc_version):
"""Try to find the product directory for the given
version.
Note
----
If for some reason the requested version could not be found, an
exception which inherits from VisualCException will be raised."""
root = 'Software\\'
try:
hkeys = _VCVER_TO_PROD... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:allocate_stream; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, identifier:stream_type; 6, default_parameter; 6, 7; 6, 8; 7, identifier:stream_id; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:previous; 11, ... | def allocate_stream(self, stream_type, stream_id=None, previous=None, attach=False):
"""Allocate a new stream of the given type.
The stream is allocated with an incremental ID starting at
StreamAllocator.StartingID. The returned data stream can always
be used to to attach a NodeInput t... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:find_products; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:product_type; 6, block; 6, 7; 6, 9; 6, 28; 6, 85; 6, 98; 6, 109; 6, 128; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 25; 10, boolean_operator:... | def find_products(self, product_type):
"""Search for products of a given type.
Search through the products declared by this IOTile component and
return only those matching the given type. If the product is described
by the path to a file, a complete normalized path will be returned.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:add_node; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:node_descriptor; 6, block; 6, 7; 6, 9; 6, 37; 6, 50; 6, 54; 6, 194; 6, 195; 6, 196; 6, 197; 6, 228; 6, 229; 6, 238; 6, 251; 6, 259; 7, expression_statement; 7, 8; 8, comment... | def add_node(self, node_descriptor):
"""Add a node to the sensor graph based on the description given.
The node_descriptor must follow the sensor graph DSL and describe
a node whose input nodes already exist.
Args:
node_descriptor (str): A description of the node to be adde... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:check_streamers; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:blacklist; 7, None; 8, block; 8, 9; 8, 11; 8, 15; 8, 21; 8, 164; 9, expression_statement; 9, 10; 10, comment; 11, expression_stateme... | def check_streamers(self, blacklist=None):
"""Check if any streamers are ready to produce a report.
You can limit what streamers are checked by passing a set-like
object into blacklist.
This method is the primary way to see when you should poll a given
streamer for its next rep... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort_nodes; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 28; 5, 32; 5, 71; 5, 72; 5, 73; 5, 80; 5, 94; 5, 95; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identi... | def sort_nodes(self):
"""Topologically sort all of our nodes.
Topologically sorting our nodes makes nodes that are inputs to other
nodes come first in the list of nodes. This is important to do before
programming a sensorgraph into an embedded device whose engine assumes
a topo... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:mark_typed_list; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:name; 6, identifier:type_object; 7, block; 7, 8; 7, 10; 7, 25; 7, 40; 7, 82; 7, 105; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; 10, 17... | def mark_typed_list(self, name, type_object):
"""Mark a property as containing serializable objects of a given type.
This convenience method allows you to avoid having to call
``mark_complex()`` whenever you need to serialize a list of objects.
This method requires that all members of t... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:mark_typed_map; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:name; 6, identifier:type_object; 7, block; 7, 8; 7, 10; 7, 25; 7, 40; 7, 90; 7, 121; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; 10, 17;... | def mark_typed_map(self, name, type_object):
"""Mark a property as containing a map str to serializable object.
This convenience method allows you to avoid having to call
``mark_complex()`` whenever you need to serialize a dict of objects.
This method requires that all members of the gi... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:mark_typed_object; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:name; 6, identifier:type_object; 7, block; 7, 8; 7, 10; 7, 25; 7, 40; 7, 58; 7, 77; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; 10, 1... | def mark_typed_object(self, name, type_object):
"""Mark a property as containing a serializable object.
This convenience method allows you to avoid having to call
``mark_complex()`` whenever you need to serialize a complex object.
This method requires that property ``name`` be a single ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:scan; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:node; 5, identifier:env; 6, default_parameter; 6, 7; 6, 8; 7, identifier:libpath; 8, tuple; 9, block; 9, 10; 9, 12; 9, 26; 9, 34; 9, 66; 9, 98; 9, 102; 9, 131; 9, 135; 9, 147; 9, 157; 9, 165;... | def scan(node, env, libpath = ()):
"""
This scanner scans program files for static-library
dependencies. It will search the LIBPATH environment variable
for libraries specified in the LIBS variable, returning any
files it finds as dependencies.
"""
try:
libs = env['LIBS']
except... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:render_recursive_template; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 4, identifier:template_folder; 5, identifier:info; 6, identifier:out_folder; 7, default_parameter; 7, 8; 7, 9; 8, identifier:preserve; 9, None; 10, default_parameter; 10,... | def render_recursive_template(template_folder, info, out_folder, preserve=None, dry_run=False):
"""Copy a directory tree rendering all templates found within.
This function inspects all of the files in template_folder recursively. If
any file ends .tpl, it is rendered using render_template and the .tpl
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:Update; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:env; 6, default_parameter; 6, 7; 6, 8; 7, identifier:args; 8, None; 9, block; 9, 10; 9, 12; 9, 16; 9, 17; 9, 41; 9, 42; 9, 141; 9, 142; 9, 153; 9, 212; 9, 213; 9, 214; 9... | def Update(self, env, args=None):
"""
Update an environment with the option variables.
env - the environment to update.
"""
values = {}
# first set the defaults:
for option in self.options:
if not option.default is None:
values[optio... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:GenerateHelpText; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:env; 6, default_parameter; 6, 7; 6, 8; 7, identifier:sort; 8, None; 9, block; 9, 10; 9, 12; 9, 75; 9, 132; 9, 146; 10, expression_statement; 10, 11; 11, commen... | def GenerateHelpText(self, env, sort=None):
"""
Generate the help text for the options.
env - an environment that is used to get the current values
of the options.
cmp - Either a function as follows: The specific sort function should take two arguments and return -1, 0 or ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:render_tree; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 13; 4, identifier:root; 5, identifier:child_func; 6, default_parameter; 6, 7; 6, 8; 7, identifier:prune; 8, integer:0; 9, default_parameter; 9, 10; 9, 11; 10, identifier:margin; 11, list:[... | def render_tree(root, child_func, prune=0, margin=[0], visited=None):
"""
Render a tree of nodes into an ASCII tree view.
:Parameters:
- `root`: the root node of the tree
- `child_func`: the function called to get the children of a node
- `prune`: don't visit the same nod... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:print_tree; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 16; 4, identifier:root; 5, identifier:child_func; 6, default_parameter; 6, 7; 6, 8; 7, identifier:prune; 8, integer:0; 9, default_parameter; 9, 10; 9, 11; 10, identifier:showtags; 11... | def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited=None):
"""
Print a tree of nodes. This is like render_tree, except it prints
lines directly instead of creating a string representation in memory,
so that huge trees can be printed.
:Parameters:
- `root` - the ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:unique; 3, parameters; 3, 4; 4, identifier:s; 5, block; 5, 6; 5, 8; 5, 15; 5, 22; 5, 23; 5, 24; 5, 25; 5, 26; 5, 30; 5, 58; 5, 60; 5, 61; 5, 62; 5, 63; 5, 64; 5, 65; 5, 66; 5, 67; 5, 139; 5, 141; 5, 142; 5, 146; 5, 162; 6, expression_statement;... | def unique(s):
"""Return a list of the elements in s, but without duplicates.
For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3],
unique("abcabc") some permutation of ["a", "b", "c"], and
unique(([1, 2], [2, 3], [1, 2])) some permutation of
[[2, 3], [1, 2]].
For best speed, all ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:setup_client; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:client_id; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:user_data; 10, None; 11, default_parameter; 1... | def setup_client(self, client_id=None, user_data=None, scan=True, broadcast=False):
"""Setup a newly connected client.
``client_id`` must be unique among all connected clients. If it is
passed as None, a random client_id will be generated as a string and
returned.
This method ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_parse_conn_string; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:conn_string; 6, block; 6, 7; 6, 9; 6, 13; 6, 15; 6, 51; 6, 65; 6, 78; 6, 87; 6, 245; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10,... | def _parse_conn_string(self, conn_string):
"""Parse a connection string passed from 'debug -c' or 'connect_direct'
Returns True if any settings changed in the debug port, which
would require a jlink disconnection """
disconnection_required = False
"""If device not in con... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:main; 3, parameters; 3, 4; 4, default_parameter; 4, 5; 4, 6; 5, identifier:argv; 6, None; 7, block; 7, 8; 7, 10; 7, 25; 7, 31; 7, 42; 7, 64; 7, 70; 7, 99; 7, 108; 7, 135; 7, 147; 7, 159; 7, 163; 7, 171; 7, 278; 7, 286; 7, 292; 7, 309; 7, 319; 8... | def main(argv=None):
"""Main entry point for iotile-ship recipe runner.
This is the iotile-ship command line program.
Args:
argv (list of str): An optional set of command line
parameters. If not passed, these are taken from
sys.argv.
"""
if argv is None:
a... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:assign_utc; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:reading_id; 6, default_parameter; 6, 7; 6, 8; 7, identifier:uptime; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:prefer; 11, string:"before"; 1... | def assign_utc(self, reading_id, uptime=None, prefer="before"):
"""Assign a utc datetime to a reading id.
This method will return an object with assignment information or None
if a utc value cannot be assigned. The assignment object returned
contains a utc property that has the asssign... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_text_contents; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, try_statement; 8, 9; 8, 21; 8, 35; 9, block; 9, 10; 10, expression_statement; 10, 11; 11, assignment; 11, 12; 11, 13... | def get_text_contents(self):
"""Fetch the decoded text contents of a Unicode encoded Entry.
Since this should return the text contents from the file
system, we check to see into what sort of subclass we should
morph this Entry."""
try:
self = self.disambiguate(must_e... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:_lookup; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:p; 6, identifier:directory; 7, identifier:fsclass; 8, default_parameter; 8, 9; 8, 10; 9, identifier:create; 10, integer:1; 11, block; 11, 12; 11, 14; 11, 3... | def _lookup(self, p, directory, fsclass, create=1):
"""
The generic entry point for Node lookup with user-supplied data.
This translates arbitrary input into a canonical Node.FS object
of the specified fsclass. The general approach for strings is
to turn it into a fully normali... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:_glob1; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, identifier:pattern; 6, default_parameter; 6, 7; 6, 8; 7, identifier:ondisk; 8, True; 9, default_parameter; 9, 10; 9, 11; 10, identifier:source; 11, False; 12, default... | def _glob1(self, pattern, ondisk=True, source=False, strings=False):
"""
Globs for and returns a list of entry names matching a single
pattern in this directory.
This searches any repositories and source directories for
corresponding entries and returns a Node (or string) relati... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:release_target_info; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 21; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 19; 9, parenthesized_expression; 9, 10; 10, boolean_operator:or; 10, 11; 10, 14; 11,... | def release_target_info(self):
"""Called just after this node has been marked
up-to-date or was built completely.
This is where we try to release as many target node infos
as possible for clean builds and update runs, in order
to minimize the overall memory consumption.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:find_file; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:filename; 6, identifier:paths; 7, default_parameter; 7, 8; 7, 9; 8, identifier:verbose; 9, None; 10, block; 10, 11; 10, 13; 10, 23; 10, 60; 10, 106; 10, 119; 1... | def find_file(self, filename, paths, verbose=None):
"""
Find a node corresponding to either a derived file or a file that exists already.
Only the first file found is returned, and none is returned if no file is found.
filename: A filename to find
paths: A list of directory pat... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:build_report; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:self; 5, identifier:device_id; 6, default_parameter; 6, 7; 6, 8; 7, identifier:max_size; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:device_uptime... | def build_report(self, device_id, max_size=None, device_uptime=0, report_id=None, auth_chain=None):
"""Build a report with all of the readings in this streamer.
This method will produce an IOTileReport subclass and, if necessary,
sign it using the passed authentication chain.
Args:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:scan; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:wait; 7, None; 8, block; 8, 9; 8, 11; 8, 23; 8, 35; 8, 36; 8, 40; 8, 50; 8, 61; 8, 62; 8, 63; 8, 85; 8, 86; 8, 95; 8, 105; 8, 111; 8, 117; 8, 1... | def scan(self, wait=None):
"""Return the devices that have been found for this device adapter.
If the adapter indicates that we need to explicitly tell it to probe for devices, probe now.
By default we return the list of seen devices immediately, however there are two cases where
we wil... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:send_rpc; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:address; 6, identifier:rpc_id; 7, identifier:call_payload; 8, default_parameter; 8, 9; 8, 10; 9, identifier:timeout; 10, float:3.0; 11, block; 11, 12; 11,... | def send_rpc(self, address, rpc_id, call_payload, timeout=3.0):
"""Send an rpc to our connected device.
The device must already be connected and the rpc interface open. This
method will synchronously send an RPC and wait for the response. Any
RPC errors will be raised as exceptions an... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:__xml_scan; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:node; 5, identifier:env; 6, identifier:path; 7, identifier:arg; 8, block; 8, 9; 8, 11; 8, 12; 8, 28; 8, 54; 8, 67; 8, 249; 8, 258; 8, 267; 8, 283; 8, 293; 8, 297; 8, 340; 8, 346; ... | def __xml_scan(node, env, path, arg):
""" Simple XML file scanner, detecting local images and XIncludes as implicit dependencies. """
# Does the node exist yet?
if not os.path.isfile(str(node)):
return []
if env.get('DOCBOOK_SCANENT',''):
# Use simple pattern matching for system ent... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:DocbookMan; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 11; 4, identifier:env; 5, identifier:target; 6, default_parameter; 6, 7; 6, 8; 7, identifier:source; 8, None; 9, list_splat_pattern; 9, 10; 10, identifier:args; 11, dictionary_splat_pattern... | def DocbookMan(env, target, source=None, *args, **kw):
"""
A pseudo-Builder, providing a Docbook toolchain for Man page output.
"""
# Init list of targets/sources
target, source = __extend_targets_sources(target, source)
# Init XSL stylesheet
__init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:Builder; 3, parameters; 3, 4; 4, dictionary_splat_pattern; 4, 5; 5, identifier:kw; 6, block; 6, 7; 6, 9; 6, 13; 6, 135; 6, 229; 6, 237; 6, 251; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 1... | def Builder(**kw):
"""A factory for builder objects."""
composite = None
if 'generator' in kw:
if 'action' in kw:
raise UserError("You must not specify both an action and a generator.")
kw['action'] = SCons.Action.CommandGeneratorAction(kw['generator'], {})
del kw['genera... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_node_errors; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:builder; 5, identifier:env; 6, identifier:tlist; 7, identifier:slist; 8, block; 8, 9; 8, 11; 8, 12; 8, 13; 8, 334; 9, expression_statement; 9, 10; 10, comment; 11, comment; 12, ... | def _node_errors(builder, env, tlist, slist):
"""Validate that the lists of target and source nodes are
legal for this builder and environment. Raise errors or
issue warnings as appropriate.
"""
# First, figure out if there are any errors in the way the targets
# were specified.
for t in t... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_order_pases; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:passes; 6, block; 6, 7; 6, 9; 6, 16; 6, 20; 6, 95; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identif... | def _order_pases(self, passes):
"""Topologically sort optimization passes.
This ensures that the resulting passes are run in order
respecting before/after constraints.
Args:
passes (iterable): An iterable of pass names that should
be included in the optimiza... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:prepare; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 10; 5, 18; 5, 36; 5, 37; 5, 38; 5, 39; 5, 45; 5, 71; 5, 72; 5, 73; 5, 74; 5, 75; 5, 76; 5, 77; 5, 78; 5, 79; 5, 80; 5, 81; 5, 93; 5, 99; 5, 105; 6, expression_statement;... | def prepare(self):
"""
Called just before the task is executed.
This is mainly intended to give the target Nodes a chance to
unlink underlying files and make all necessary directories before
the Action is actually called to build the targets.
"""
global print_pre... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:make_ready_current; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 10; 5, 18; 5, 36; 5, 42; 5, 46; 5, 130; 6, expression_statement; 6, 7; 7, comment; 8, global_statement; 8, 9; 9, identifier:print_prepare; 10, expression_stat... | def make_ready_current(self):
"""
Marks all targets in a task ready for execution if any target
is not current.
This is the default behavior for building only what's necessary.
"""
global print_prepare
T = self.tm.trace
if T: T.write(self.trace_message(u'... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:postprocess; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 16; 5, 34; 5, 35; 5, 36; 5, 37; 5, 38; 5, 39; 5, 40; 5, 49; 5, 57; 5, 61; 5, 116; 5, 193; 5, 248; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement;... | def postprocess(self):
"""
Post-processes a task after it's been executed.
This examines all the targets just built (or not, we don't care
if the build was successful, or even if there was no build
because everything was up-to-date) to see if they have any
waiting parent... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:update_dependency; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:tile; 6, identifier:depinfo; 7, default_parameter; 7, 8; 7, 9; 8, identifier:destdir; 9, None; 10, block; 10, 11; 10, 13; 10, 36; 10, 40; 10, 44; 10, 6... | def update_dependency(self, tile, depinfo, destdir=None):
"""Attempt to install or update a dependency to the latest version.
Args:
tile (IOTile): An IOTile object describing the tile that has the dependency
depinfo (dict): a dictionary from tile.dependencies specifying the depe... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:stop; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 14; 5, 26; 5, 85; 5, 89; 5, 105; 5, 119; 5, 132; 5, 136; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier... | async def stop(self):
"""Stop this task and wait until it and all its subtasks end.
This function will finalize this task either by using the finalizer
function passed during creation or by calling task.cancel() if no
finalizer was passed.
It will then call join() on this task ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:link_cloud; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:username; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:password; 10, None; 11, default_parameter; 11, 12; 11, ... | def link_cloud(self, username=None, password=None, device_id=None):
"""Create and store a token for interacting with the IOTile Cloud API.
You will need to call link_cloud once for each virtualenv that
you create and want to use with any api calls that touch iotile cloud.
Note that this method is call... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:main; 3, parameters; 3, 4; 4, default_parameter; 4, 5; 4, 6; 5, identifier:argv; 6, None; 7, block; 7, 8; 7, 10; 7, 25; 7, 300; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; 10, 14; 11, comparison_operator:is; 11, 12; 11,... | def main(argv=None):
"""Main entry point for iotile sensorgraph simulator.
This is the iotile-sgrun command line program. It takes
an optional set of command line parameters to allow for
testing.
Args:
argv (list of str): An optional set of command line
parameters. If not pas... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_update_pot_file; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:target; 5, identifier:source; 6, identifier:env; 7, block; 7, 8; 7, 10; 7, 13; 7, 16; 7, 20; 7, 29; 7, 30; 7, 31; 7, 41; 7, 49; 7, 57; 7, 68; 7, 69; 7, 70; 7, 87; 7, 88; 7, 98; 7,... | def _update_pot_file(target, source, env):
""" Action function for `POTUpdate` builder """
import re
import os
import SCons.Action
nop = lambda target, source, env: 0
# Save scons cwd and os cwd (NOTE: they may be different. After the job, we
# revert each one to its original state).
sa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.