text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def get_etree_layout_as_dict(layout_tree):
"""
Convert something that looks like this:
<layout>
<item>
<name>color</name>
<value>red</value>
</item>
<item>
<name>shapefile</name>
<value>blah.shp</value>
</item>
</layout>
... | 0.003538 |
def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion):
"""Operation: Add Permission to User Role."""
assert wait_for_completion is True # synchronous operation
user_role_oid = uri_parms[0]
user_role_uri = '/api/user-roles/' + user_role_oid
... | 0.002088 |
def assertJsonContains(jsonStr=None, key=None, message=None):
"""
Assert that jsonStr contains key.
:param jsonStr: Json as string
:param key: Key to look for
:param message: Failure message
:raises: TestStepFail if key is not in jsonStr or
if loading jsonStr to a dictionary fails or if jso... | 0.006029 |
def invalidate(self, cls, id_field, id_val):
"""
Invalidate the cache for a given Mongo object by deleting the cached
data and the cache flag.
"""
cache_key, flag_key = self.get_keys(cls, id_field, id_val)
pipeline = self.redis.pipeline()
pipeline.delete(cache_ke... | 0.005222 |
def _fill_array_from_list(the_list, the_array):
"""Fill an `array` from a `list`"""
for i, val in enumerate(the_list):
the_array[i] = val
return the_array | 0.010526 |
def get_options(self):
"""
A hook to override the flattened list of all options used to generate
option names and defaults.
"""
return reduce(
list.__add__,
[list(option_list) for option_list in self.get_option_lists()],
[]) | 0.009709 |
def wait_for_text(self, text, selector="html", by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" The shorter version of wait_for_text_visible() """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
... | 0.007371 |
def return_reply(*types, **options):
"""Decorator for returning replies from request handler methods.
The method being decorated should return an iterable of result
values. If the first value is 'ok', the decorator will check the
remaining values against the specified list of types (if any).
If the... | 0.000729 |
def get(cls, community_id, record_uuid):
"""Get an inclusion request."""
return cls.query.filter_by(
id_record=record_uuid, id_community=community_id
).one_or_none() | 0.00995 |
def command(self, name=None):
"""A decorator to add subcommands.
"""
def decorator(f):
self.add_command(f, name)
return f
return decorator | 0.010309 |
def process_data_events(self, to_tuple=False, auto_decode=True):
"""Consume inbound messages.
:param bool to_tuple: Should incoming messages be converted to a
tuple before delivery.
:param bool auto_decode: Auto-decode strings when possible.
:raises AMQPCh... | 0.001767 |
def dumps(self):
"""Return a dictionnary of current tables"""
return {table_name: getattr(self, table_name).dumps() for table_name in self.TABLES} | 0.018519 |
def merge(iterables, key=None, reverse=False):
'''Merge multiple sorted inputs into a single sorted output.
Similar to sorted(itertools.chain(*iterables)) but returns a generator,
does not pull the data into memory all at once, and assumes that each of
the input streams is already sorted (smallest to l... | 0.000802 |
def set_euk_hmm(self, args):
'Set the hmm used by graftM to cross check for euks.'
if hasattr(args, 'euk_hmm_file'):
pass
elif not hasattr(args, 'euk_hmm_file'):
# set to path based on the location of bin/graftM, which has
# a more stable relative path to the ... | 0.008772 |
def sub_hmm(self, states):
r""" Returns HMM on a subset of states
Returns the HMM restricted to the selected subset of states.
Will raise exception if the hidden transition matrix cannot be normalized on this subset
"""
# restrict initial distribution
pi_sub = self._Pi[... | 0.004813 |
def create_disk(name, size):
'''
Create a VMM disk with the specified `name` and `size`.
size:
Size in megabytes, or use a specifier such as M, G, T.
CLI Example:
.. code-block:: bash
salt '*' vmctl.create_disk /path/to/disk.img size=10G
'''
ret = False
cmd = 'vmctl c... | 0.001314 |
def download_file(file_id, file_name):
'''Download a file from UPLOAD_FOLDER'''
extracted_out_dir = os.path.join(app.config['UPLOAD_FOLDER'], file_id)
return send_file(os.path.join(extracted_out_dir, file_name)) | 0.004484 |
def is_callable(self):
"""The fake can be called.
This is useful for when you stub out a function
as opposed to a class. For example::
>>> import fudge
>>> remove = Fake('os.remove').is_callable()
>>> remove('some/path')
"""
self._callable ... | 0.005141 |
def _exclude_ipv4_networks(self, networks, networks_to_exclude):
"""
Exclude the list of networks from another list of networks
and return a flat list of new networks.
:param networks: List of IPv4 networks to exclude from
:param networks_to_exclude: List of IPv4 networks to exc... | 0.001107 |
def config_managed(name, value, force_password=False):
'''
Manage a LXD Server config setting.
name :
The name of the config key.
value :
Its value.
force_password : False
Set this to True if you want to set the password on every run.
As we can't retrieve the pass... | 0.000495 |
def eval_hook(self, name: str, ctx: list) -> Node:
"""Evaluate the hook by its name"""
if name not in self.__class__._hooks:
# TODO: don't always throw error, could have return True by default
self.diagnostic.notify(
error.Severity.ERROR,
"Unknown ... | 0.002928 |
def convert_namespaces_ast(
ast,
api_url: str = None,
namespace_targets: Mapping[str, List[str]] = None,
canonicalize: bool = False,
decanonicalize: bool = False,
):
"""Recursively convert namespaces of BEL Entities in BEL AST using API endpoint
Canonicalization and decanonicalization is de... | 0.002444 |
def update(check, enter_parameters, version):
"""
Update package with latest template. Must be inside of the project
folder to run.
Using "-e" will prompt for re-entering the template parameters again
even if the project is up to date.
Use "-v" to update to a particular version of a template.
... | 0.002924 |
def alloc_seg(self, net_id):
"""Allocates the segmentation ID. """
segmentation_id = self.service_segs.allocate_segmentation_id(
net_id, source=fw_const.FW_CONST)
return segmentation_id | 0.00905 |
def handle_read_value(self, buff, start, end):
'''
handle read of the value based on the expected length
:param buff:
:param start:
:param end:
'''
segmenttype = self._state[1].value.segmenttype
value = None
eventtype = None
ft... | 0.005831 |
def reset(self, indices=None):
"""Reset the batch of environments.
Args:
indices: The batch indices of the environments to reset; defaults to all.
Returns:
Batch tensor of the new observations.
"""
if indices is None:
indices = tf.range(len(self._batch_env))
observ_dtype = se... | 0.004734 |
def context_from_module(module):
"""
Given a module, create a context from all of the top level annotated
symbols in that module.
"""
con = find_all(module)
if hasattr(module, "__doc__"):
setattr(con, "__doc__", module.__doc__)
name = module.__name__
if hasattr(module, "_name_... | 0.002151 |
def _Open(self, path_spec, mode='rb'):
"""Opens the file system object defined by path specification.
Args:
path_spec (PathSpec): path specification.
mode (Optional[str]): file access mode. The default is 'rb' which
represents read-only binary.
Raises:
AccessError: if the acces... | 0.006883 |
def reload(cls, args):
"""Reload NApps code."""
LOG.info('Reloading NApps...')
mgr = NAppsManager()
try:
if args['all']:
mgr.reload(None)
else:
napps = args['<napp>']
mgr.reload(napps)
LOG.info('\tReloa... | 0.00361 |
async def remember_ticket(self, request, ticket):
"""Called to store the ticket data for a request.
Ticket data is stored in the aiohttp_session object
Args:
request: aiohttp Request object.
ticket: String like object representing the ticket to be stored.
"""
... | 0.004938 |
def _parse_pairwise_input(indices1, indices2, MDlogger, fname=''):
r"""For input of pairwise type (distances, inverse distances, contacts) checks the
type of input the user gave and reformats it so that :py:func:`DistanceFeature`,
:py:func:`InverseDistanceFeature`, and ContactFeature can work.
... | 0.00384 |
def _chip_erase_program(self, progress_cb=_stub_progress):
"""! @brief Program by first performing an erase all."""
LOG.debug("%i of %i pages have erased data", len(self.page_list) - self.chip_erase_count, len(self.page_list))
progress_cb(0.0)
progress = 0
self.flash.init(self.f... | 0.005203 |
def main(depth_file, json_dict, cutoff, sample_id):
"""
Function that handles the inputs required to parse depth files from bowtie
and dumps a dict to a json file that can be imported into pATLAS.
Parameters
----------
depth_file: str
the path to depth file for each sample
json_dic... | 0.000547 |
def extract_left_hand_side(target):
"""Extract the left hand side variable from a target.
Removes list indexes, stars and other left hand side elements.
"""
left_hand_side = _get_names(target, '')
left_hand_side.replace('*', '')
if '[' in left_hand_side:
index = left_hand_side.index('[... | 0.002571 |
def new_bundle(self, name: str, created_at: dt.datetime=None) -> models.Bundle:
"""Create a new file bundle."""
new_bundle = self.Bundle(name=name, created_at=created_at)
return new_bundle | 0.018868 |
def read(self, timeout=None):
'''
Read from the transport. If no data is available, should return None.
The timeout is ignored as this returns only data that has already
been buffered locally.
'''
# NOTE: copying over this comment from Connection, because there is
... | 0.001363 |
def import_legislators(src):
"""
Read the legislators from the csv files into a single Dataframe. Intended
for importing new data.
"""
logger.info("Importing Legislators From: {0}".format(src))
current = pd.read_csv("{0}/{1}/legislators-current.csv".format(
src, LEGISLATOR_DIR))
hist... | 0.002092 |
def series_with_slh(self, other):
"""Series product with another :class:`SLH` object
Args:
other (SLH): An upstream SLH circuit.
Returns:
SLH: The combined system.
"""
new_S = self.S * other.S
new_L = self.S * other.L + self.L
def ImAdjo... | 0.003115 |
def conduit_lengths(target, throat_endpoints='throat.endpoints',
throat_length='throat.length'):
r"""
Calculate conduit lengths. A conduit is defined as half pore + throat
+ half pore.
Parameters
----------
target : OpenPNM Object
The object which this model is assoc... | 0.000532 |
def handle_message_registered(self, msg_data, host):
"""Processes messages that have been delivered by a registered client.
Args:
msg (string): The raw packet data delivered from the listener. This
data will be unserialized and then processed based on the packet's
meth... | 0.002366 |
def get_atoms(self, inc_alt_states=False):
"""Returns all atoms in the `Monomer`.
Parameters
----------
inc_alt_states : bool, optional
If `True`, will return `Atoms` for alternate states.
"""
if inc_alt_states:
return itertools.chain(*[x[1].value... | 0.007444 |
def double(window, config):
"""Double theme
==================
= Header =
==================
= items =
==================
= footer =
==================
"""
cordx = round(config.get('cordx', 0))
color = config.get('color', red)
icon = config.get('... | 0.000693 |
def ensure_dir_exists(f, fullpath=False):
"""
Ensure the existence of the (parent) directory of f
"""
if fullpath is False:
# Get parent directory
d = os.path.dirname(f)
else:
# Create the full path
d = f
if not os.path.exists(d):
os.makedirs(d) | 0.003236 |
def cli(env, abuse, address1, address2, city, company, country, firstname,
lastname, postal, public, state):
"""Edit the RWhois data on the account."""
mgr = SoftLayer.NetworkManager(env.client)
update = {
'abuse_email': abuse,
'address1': address1,
'address2': address2,
... | 0.001107 |
def rectwidth(self):
"""Calculate :ref:`pysynphot-formula-rectw`.
Returns
-------
ans : float
Bandpass rectangular width.
"""
mywaveunits = self.waveunits.name
self.convert('angstroms')
wave = self.wave
thru = self.throughput
... | 0.003854 |
def check(self, message, ecc, k=None):
'''Check if there's any error in a message+ecc. Can be used before decoding, in addition to hashes to detect if the message was tampered, or after decoding to check that the message was fully recovered.'''
if not k: k = self.k
message, _ = self.pad(message,... | 0.007924 |
def getFormTemplate(self):
"""Returns the current samplinground rendered with the template
specified in the request (param 'template').
Moves the iterator to the next samplinground available.
"""
templates_dir = self._TEMPLATES_DIR
embedt = self.request.get('templ... | 0.004655 |
def sepconv_relu_sepconv(inputs,
filter_size,
output_size,
first_kernel_size=(1, 1),
second_kernel_size=(1, 1),
padding="LEFT",
nonpadding_mask=None,
... | 0.006757 |
def from_start_and_end(cls, start, end, sequence, phos_3_prime=False):
"""Creates a DNA duplex from a start and end point.
Parameters
----------
start: [float, float, float]
Start of the build axis.
end: [float, float, float]
End o... | 0.00295 |
def stderr_output(cmd):
"""Wraps the execution of check_output in a way that
ignores stderr when not in debug mode"""
handle, gpg_stderr = stderr_handle()
try:
output = subprocess.check_output(cmd, stderr=gpg_stderr) # nosec
if handle:
handle.close()
return str(pol... | 0.001783 |
def _do_main(self, commands):
"""
:type commands: list of VSCtlCommand
"""
self._reset()
self._init_schema_helper()
self._run_prerequisites(commands)
idl_ = idl.Idl(self.remote, self.schema_helper)
seqno = idl_.change_seqno
while True:
... | 0.00312 |
def __parse_json_data(self, data):
"""Process Json data
:@param data
:@type data: json/dict
:throws TypeError
"""
if isinstance(data, dict) or isinstance(data, list):
self._raw_data = data
self._json_data = copy.deepcopy(self._raw_data)
e... | 0.005249 |
def get_next(self):
"""Return the next set of objects in a list"""
url = self._get_link('next')
resource = self.object_type.get_resource_class(self.client)
resp = resource.perform_api_call(resource.REST_READ, url)
return List(resp, self.object_type, self.client) | 0.006623 |
def set_or_edit_conditional_breakpoint(self):
"""Set conditional breakpoint"""
if self.data:
editor = self.get_current_editor()
editor.debugger.toogle_breakpoint(edit_condition=True) | 0.00885 |
def wait_fds(fd_events, inmask=1, outmask=2, timeout=None):
"""wait for the first of a number of file descriptors to have activity
.. note:: this method can block
it will return once there is relevant activity on the file descriptors,
or the timeout expires
:param fd_events:
two-t... | 0.000366 |
def associate_flavor(self, flavor, body):
"""Associate a Neutron service flavor with a profile."""
return self.post(self.flavor_profile_bindings_path %
(flavor), body=body) | 0.00939 |
def data_read_write(data_path_in, data_path_out, format_type, **kwargs):
"""
General function to read, format, and write data.
Parameters
----------
data_path_in : str
Path to the file that will be read
data_path_out : str
Path of the file that will be output
format_type : s... | 0.000571 |
def from_properties(cls, angle, axis, invert):
"""Initialize a rotation based on the properties"""
norm = np.linalg.norm(axis)
if norm > 0:
x = axis[0] / norm
y = axis[1] / norm
z = axis[2] / norm
c = np.cos(angle)
s = np.sin(angle)
... | 0.007776 |
def frequency(self):
"""0 means unknown"""
assert self.parsed_frames, "no frame parsed yet"
f_index = self._fixed_header_key[4]
try:
return _FREQS[f_index]
except IndexError:
return 0 | 0.008032 |
def left_brake(self):
"""allows left motor to coast to a stop"""
self.board.digital_write(L_CTRL_1, 1)
self.board.digital_write(L_CTRL_2, 1)
self.board.analog_write(PWM_L, 0) | 0.009709 |
def get_view_root(view_name: str) -> XmlNode:
'''Parses xml file and return root XmlNode'''
try:
path = join(deps.views_folder, '{0}.{1}'.format(view_name, deps.view_ext))
parser = Parser()
if path not in _XML_CACHE:
with open(path, 'rb') as xml_file:
_XML_CAC... | 0.00451 |
def adapt(self, d, x):
"""
Adapt weights according one desired value and its input.
**Args:**
* `d` : desired value (float)
* `x` : input array (1-dimensional array)
"""
# create input matrix and target vector
self.x_mem[:,1:] = self.x_mem[:,:-1]
... | 0.006485 |
def element_for_value(cls, attrname, value):
"""Serialize the given value into an XML `Element` with the
given tag name, returning it.
The value argument may be:
* a `Resource` instance
* a `Money` instance
* a `datetime.datetime` instance
* a string, integer, or... | 0.003028 |
def plot2d(self, c_poly='default', alpha=1, cmap='default', ret=False,
title=' ', colorbar=False, cbar_label=''):
"""
Generates a 2D plot for the z=0 Surface projection.
:param c_poly: Polygons color.
:type c_poly: matplotlib color
:param alpha: Op... | 0.007353 |
def _as_json_dumps(self, indent: str=' ', **kwargs) -> str:
""" Convert to a stringified json object.
This is the same as _as_json with the exception that it isn't
a property, meaning that we can actually pass arguments...
:param indent: indent argument to dumps
:param kwargs:... | 0.008386 |
def add_fields(self, *args):
"""
This method only works for extensible fields. It allows to add values without precising their fields' names
or indexes.
Parameters
----------
args: field values
"""
if not self.is_extensible():
raise TypeError(... | 0.005474 |
def variantSetsGenerator(self, request):
"""
Returns a generator over the (variantSet, nextPageToken) pairs defined
by the specified request.
"""
dataset = self.getDataRepository().getDataset(request.dataset_id)
return self._topLevelObjectGenerator(
request, d... | 0.005141 |
def sectionOutZip(self,zipcontainer,zipdir='',figtype='png'):
"""Prepares section for zip output
"""
from io import StringIO, BytesIO
text = self.p if not self.settings['doubleslashnewline'] else self.p.replace('//','\n')
zipcontainer.writestr(
zipdir+'section.txt',
... | 0.023451 |
def get_route_templates(self):
"""
Generate Openshift route templates or playbook tasks. Each port on a service definition found in container.yml
represents an externally exposed port.
"""
def _get_published_ports(service_config):
result = []
for port in s... | 0.002236 |
def compile(definition, handlers={}):
"""
Generates validation function for validating JSON schema passed in ``definition``.
Example:
.. code-block:: python
import fastjsonschema
validate = fastjsonschema.compile({'type': 'string'})
validate('hello')
This implementation s... | 0.002339 |
def PUT(self, rest_path_list, **kwargs):
"""Send a PUT request with optional streaming multipart encoding. See
requests.sessions.request for optional parameters. See post() for parameters.
:returns: Response object
"""
fields = kwargs.pop("fields", None)
if fields is no... | 0.00818 |
def flip(args):
"""
%prog flip fastafile
Go through each FASTA record, check against Genbank file and determines
whether or not to flip the sequence. This is useful before updates of the
sequences to make sure the same orientation is used.
"""
p = OptionParser(flip.__doc__)
opts, args =... | 0.001093 |
def rotate_sites(self, indices=None, theta=0, axis=None, anchor=None,
to_unit_cell=True):
"""
Rotate specific sites by some angle around vector at anchor.
Args:
indices (list): List of site indices on which to perform the
translation.
... | 0.002849 |
def post(self, endpoint='', url='', data=None, use_api_key=False, omit_api_version=False):
"""Perform a post to an API endpoint.
:param string endpoint: Target endpoint. (Optional).
:param string url: Override the endpoint and provide the full url (eg for pagination). (Optional).
:param... | 0.008929 |
def calculate_splus_scross(nmax, mc, dl, F, e, t, l0, gamma, gammadot, inc):
"""
Calculate splus and scross summed over all harmonics.
This waveform differs slightly from that in Taylor et al (2015)
in that it includes the time dependence of the advance of periastron.
:param nmax: Total numbe... | 0.009234 |
def write_configs(self):
"""Generate the configurations needed for pipes."""
utils.banner("Generating Configs")
if not self.runway_dir:
app_configs = configs.process_git_configs(git_short=self.git_short)
else:
app_configs = configs.process_runway_configs(runway_di... | 0.008439 |
def add_event(self,
source,
reference,
event_title,
event_type,
method='',
description='',
bucket_list=[],
campaign='',
confidence='',
date=... | 0.004547 |
def walk_perimeter(self, startx, starty):
"""
Starting at a point on the perimeter of a region, 'walk' the perimeter to return
to the starting point. Record the path taken.
Parameters
----------
startx, starty : int
The starting location. Assumed to be on the... | 0.002872 |
def _explain(self, tree):
""" Set up the engine to do a dry run of a query """
self._explaining = True
self._call_list = []
old_call = self.connection.call
def fake_call(command, **kwargs):
""" Replacement for connection.call that logs args """
if command... | 0.002625 |
def get_details_from_inst_literal(self, institute_literal, institution_id, institution_instance_id, paper_key):
"""
This method parses the institute literal to get the following
1. Department naame
2. Country
3. University name
4. ZIP, STATE AND CITY (Only if the country ... | 0.002985 |
def get_sources(self, kind='all'):
"""
Extract the sources contained in the source models by optionally
filtering and splitting them, depending on the passed parameter.
"""
assert kind in ('all', 'indep', 'mutex'), kind
sources = []
for sm in self.source_models:
... | 0.00319 |
def _parse_s3_config(config_file_name, config_format='boto', profile=None):
"""
Parses a config file for s3 credentials. Can currently
parse boto, s3cmd.conf and AWS SDK config formats
:param config_file_name: path to the config file
:type config_file_name: str
:param config_format: config type... | 0.000504 |
def create(point_list=None, dimensions=None, axis=0, sel_axis=None):
""" Creates a kd-tree from a list of points
All points in the list must be of the same dimensionality.
If no point_list is given, an empty tree is created. The number of
dimensions has to be given instead.
If both a point_list a... | 0.002784 |
def validate_generations(self):
'''
Make sure that the descendent depth is valid.
'''
nodes = self.arc_root_node.get_descendants()
for node in nodes:
logger.debug("Checking parent for node of type %s" % node.arc_element_type)
parent = ArcElementNode.object... | 0.008869 |
def orchestrate(mods,
saltenv='base',
test=None,
exclude=None,
pillar=None,
pillarenv=None):
'''
.. versionadded:: 2016.11.0
Execute the orchestrate runner from a masterless minion.
.. seealso:: More Orchestrate documentat... | 0.001036 |
def CreateSourceType(cls, type_indicator, attributes):
"""Creates a source type.
Args:
type_indicator (str): source type indicator.
attributes (dict[str, object]): source type attributes.
Returns:
SourceType: a source type.
Raises:
FormatError: if the type indicator is not set... | 0.003236 |
def _build_dictionary(self, results):
"""
Build model dictionary keyed by the relation's foreign key.
:param results: The results
:type results: Collection
:rtype: dict
"""
foreign = self._first_key
dictionary = {}
for result in results:
... | 0.003984 |
def _delete(self, tx_id):
"""Delete a transaction. Read documentation about CRAB model in https://blog.bigchaindb.com/crab-create-retrieve-append-burn-b9f6d111f460.
:param tx_id: transaction id
:return:
"""
txs = self.driver.instance.transactions.get(asset_id=self.get_asset_id(t... | 0.003864 |
def group(self):
"""Yield a group from the iterable"""
yield self.current
# start enumerate at 1 because we already yielded the last saved item
for num, item in enumerate(self.iterator, 1):
self.current = item
if num == self.limit:
break
... | 0.005263 |
def upd_textures(self, *args):
"""Create one :class:`SwatchButton` for each texture"""
if self.canvas is None:
Clock.schedule_once(self.upd_textures, 0)
return
for name in list(self.swatches.keys()):
if name not in self.atlas.textures:
self.rem... | 0.002191 |
def created(self):
'return datetime.datetime'
return dateutil.parser.parse(str(self.f.latestRevision.created)) | 0.015873 |
def components_to_df(components, id_func=None):
"""
Convert components to a join table with columns id1, id2
Args:
components: A collection of components, each of which is a set of vertex ids.
If a dictionary, then the key is the id for the component. Otherwise,
the component... | 0.004655 |
def _update_sig(self, m, key):
"""
Sign 'm' with the PrivKey 'key' and update our own 'sig_val'.
Note that, even when 'sig_alg' is not None, we use the signature scheme
of the PrivKey (neither do we care to compare the both of them).
"""
if self.sig_alg is None:
... | 0.002695 |
def worker_task(work_item, config):
"""The celery task which performs a single mutation and runs a test suite.
This runs `cosmic-ray worker` in a subprocess and returns the results,
passing `config` to it via stdin.
Args:
work_item: A dict describing a WorkItem.
config: The configurati... | 0.001462 |
def get_data_from_sources(patton_config: PattonRunningConfig,
dependency_or_banner: str = "dependency") \
-> List[str]:
"""This function try to get data from different sources:
- command line arguments
- from external input file
- from stdin
Return a list with the... | 0.000402 |
def get_base_branch():
# type: () -> str
""" Return the base branch for the current branch.
This function will first try to guess the base branch and if it can't it
will let the user choose the branch from the list of all local branches.
Returns:
str: The name of the branch the current bra... | 0.001795 |
def format(self, *args, **kwargs):
"""Return a formatted version, using substitutions from args and kwargs.
The substitutions are identified by braces ('{' and '}').
"""
return self.__class__(super(ColorStr, self).format(*args, **kwargs), keep_tags=True) | 0.013937 |
def frange(stop, start=None, step=1.0):
"""A :func:`range` clone for float-based ranges.
>>> frange(5)
[0.0, 1.0, 2.0, 3.0, 4.0]
>>> frange(6, step=1.25)
[0.0, 1.25, 2.5, 3.75, 5.0]
>>> frange(100.5, 101.5, 0.25)
[100.5, 100.75, 101.0, 101.25]
>>> frange(5, 0)
[]
>>> frange(5, 0... | 0.001252 |
def _load_json_config(self):
"""Load the configuration file in JSON format
:rtype: dict
"""
try:
return json.loads(self._read_config())
except ValueError as error:
raise ValueError(
'Could not read configuration file: {}'.format(error)) | 0.006289 |
def _updateType(self):
"""Make sure that the class behaves like the data structure that it
is, so that we don't get a ListFile trying to represent a dict."""
data = self._data()
# Change type if needed
if isinstance(data, dict) and isinstance(self, ListFile):
self.__c... | 0.004515 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.