text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _get_next_node(self, time_qualifier):
""" Method goes to the top of the tree and traverses from
there in search of the next suitable node for processing
to the level defined by the given time_qualifier
:param time_qualifier: defines target level of the tree
:r... | 0.005525 |
def extract_ranges(row, ranges: ColRanges) -> List[Text]:
"""
Extracts a list of ranges from a row:
- If the range is an int, just get the data at this index
- If the range is a tuple of two ints, use them as indices in a slice
- If the range is an int then a None, start the slice at the int and go... | 0.001656 |
def init(self, conn):
"""
Create the version table and run the base script on an empty database.
:param conn: a DB API 2 connection
"""
base = self.read_scripts()[0]['fname']
logging.info('Creating the initial schema from %s', base)
apply_sql_script(conn, os.pat... | 0.005141 |
def download(url, filename, overwrite = False):
''' Downloads a file via HTTP. '''
from requests import get
from os.path import exists
debug('Downloading ' + unicode(url) + '...')
data = get(url)
if data.status_code == 200:
if not exists(filename) or overwrite:
f = open(filename, 'wb')
f.write(data.cont... | 0.041096 |
def _pot_quat(self):
"""Returns the orientation of the pot."""
return T.convert_quat(self.sim.data.body_xquat[self.cube_body_id], to="xyzw") | 0.019231 |
def check_password(self, username, password, properties):
"""Check the password validity.
Used by plain-text authentication mechanisms.
Default implementation: retrieve a "plain" password for the `username`
and `realm` using `self.get_password` and compare it with the password
... | 0.002315 |
def connect_with_username_and_password(cls, url=None, username=None,
password=None):
"""
Returns an object that makes requests to the API, authenticated with
a short-lived token retrieved from username and password. If username
or password is n... | 0.002508 |
def add_listener_policy(self, json_data):
"""Attaches listerner policies to an ELB
Args:
json_data (json): return data from ELB upsert
"""
env = boto3.session.Session(profile_name=self.env, region_name=self.region)
elbclient = env.client('elb')
# create stic... | 0.002778 |
def make_importfrom_alias(queue, body, context, name):
"""
Make an ast.alias node for the names list of an ast.ImportFrom.
Parameters
----------
queue : deque
Instruction Queue
body : list
Current body.
context : DecompilationContext
name : str
Expected name of t... | 0.00107 |
def make_main_index(struct, selection='"Protein"', ndx='main.ndx', oldndx=None):
"""Make index file with the special groups.
This routine adds the group __main__ and the group __environment__
to the end of the index file. __main__ contains what the user
defines as the *central* and *most important* par... | 0.004935 |
def duplicate(self, name):
"""
.. versionadded:: 0.5.8
Requires SMC version >= 6.3.2
Duplicate this element. This is a shortcut method that will make
a direct copy of the element under the new name and type.
:param str name: name for the duplicated e... | 0.005634 |
def persist(self, container: Container, image: str) -> None:
"""
Persists the state of a given container to a BugZoo image on this
server.
Parameters:
container: the container to persist.
image: the name of the Docker image that should be created.
Raises... | 0.001271 |
def configure(screen_name=None, config_file=None, app=None, **kwargs):
"""
Set up a config dictionary using a bots.yaml config file and optional keyword args.
Args:
screen_name (str): screen_name of user to search for in config file
config_file (str): Path to read for the config file
... | 0.004044 |
def get_context_data(self, **kwargs):
"""This adds into the context of breeding_type and sets it to Active."""
context = super(BreedingList, self).get_context_data(**kwargs)
context['breeding_type'] = "Active"
return context | 0.018797 |
def HWProcess(cls, proc: HWProcess, ctx: ResourceContext) -> None:
"""
Gues resource usage by HWProcess
"""
seen = ctx.seen
for stm in proc.statements:
encl = stm._enclosed_for
full_ev_dep = stm._is_completly_event_dependent
now_ev_dep = stm._n... | 0.001514 |
def get_vault_ids_by_authorization(self, authorization_id):
"""Gets the list of ``Vault`` ``Ids`` mapped to an ``Authorization``.
arg: authorization_id (osid.id.Id): ``Id`` of an
``Authorization``
return: (osid.id.IdList) - list of vault ``Ids``
raise: NotFound - ``... | 0.002606 |
def set_description(self, id, **kwargs): # noqa: E501
"""Set description associated with a specific source # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.set... | 0.002186 |
def match_url(self, url, options=None):
"""
Return if this rule matches the URL.
What to do if rule is matched is up to developer. Most likely
``.is_exception`` attribute should be taken in account.
"""
options = options or {}
for optname in self.options:
... | 0.002561 |
def close_positions_order(self):
"""平仓单
Raises:
RuntimeError -- if ACCOUNT.RUNNING_ENVIRONMENT is NOT TZERO
Returns:
list -- list with order
"""
order_list = []
time = '{} 15:00:00'.format(self.date)
if self.running_environment == RUNNIN... | 0.001835 |
def pick(options, title=None, indicator='*', default_index=0, multi_select=False, min_selection_count=0, options_map_func=None):
"""Construct and start a :class:`Picker <Picker>`.
Usage::
>>> from pick import pick
>>> title = 'Please choose an option: '
>>> options = ['option1', 'option2', '... | 0.005714 |
def _git_config(cwd, user, password, output_encoding=None):
'''
Helper to retrieve git config options
'''
contextkey = 'git.config.' + cwd
if contextkey not in __context__:
git_dir = rev_parse(cwd,
opts=['--git-dir'],
user=user,
... | 0.001435 |
def encoder(nef, z_dim, batch_size, no_bias=True, fix_gamma=True, eps=1e-5 + 1e-12):
'''The encoder is a CNN which takes 32x32 image as input
generates the 100 dimensional shape embedding as a sample from normal distribution
using predicted meand and variance
'''
BatchNorm = mx.sym.BatchNorm
da... | 0.012958 |
def _new_mem_buf(buffer=None):
"""
Allocate a new OpenSSL memory BIO.
Arrange for the garbage collector to clean it up automatically.
:param buffer: None or some bytes to use to put into the BIO so that they
can be read out.
"""
if buffer is None:
bio = _lib.BIO_new(_lib.BIO_s_... | 0.001475 |
def Decode(self, attribute, value):
"""Decode the value to the required type."""
required_type = self._attribute_types.get(attribute, "bytes")
if required_type == "integer":
return rdf_structs.SignedVarintReader(value, 0)[0]
elif required_type == "unsigned_integer":
return rdf_structs.Varint... | 0.011342 |
def zdivide(x, y):
"""
Return `x`/`y`, with 0 instead of NaN where `y` is 0.
Parameters
----------
x : array_like
Numerator
y : array_like
Denominator
Returns
-------
z : ndarray
Quotient `x`/`y`
"""
# See https://stackoverflow.com/a/37977222
return n... | 0.002688 |
def validate(self, value):
""" Always returns a Python boolean. """
value = super(Boolean, self).validate(value)
if value is not None:
value = bool(value)
return value | 0.00939 |
def Response(
cls, body,
method=None,
uri=None,
adding_headers=None,
forcing_headers=None,
status=200,
streaming=False,
**kw):
"""
shortcut to create an :py:class:`~httpretty.core.Entry` that takes the body a... | 0.004831 |
def dispos(dra0, decd0, dra, decd):
"""Compute distance and position angle solving a spherical
triangle (no approximations).
Source/credit: Skycat
Author: A.P. Martinez
Parameters
----------
dra0 : float
Center RA in decimal degrees.
decd0 : float
Center DEC in decimal... | 0.001312 |
def show_banner(ctx, param, value):
"""Shows dynaconf awesome banner"""
if not value or ctx.resilient_parsing:
return
set_settings()
click.echo(settings.dynaconf_banner)
click.echo("Learn more at: http://github.com/rochacbruno/dynaconf")
ctx.exit() | 0.003571 |
def get_video_modes(monitor):
"""
Returns the available video modes for the specified monitor.
Wrapper for:
const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
"""
count_value = ctypes.c_int(0)
count = ctypes.pointer(count_value)
result = _glfw.glfwGetVideoModes(... | 0.002331 |
def selection_range(self):
"""
Returns the selected lines boundaries (start line, end line)
:return: tuple(int, int)
"""
editor = self._editor
doc = editor.document()
start = doc.findBlock(
editor.textCursor().selectionStart()).blockNumber()
e... | 0.003165 |
def paxos_instance(self):
"""
Returns instance of PaxosInstance (protocol implementation).
"""
# Construct instance with the constant attributes.
instance = PaxosInstance(self.network_uid, self.quorum_size)
# Set the variable attributes from the aggregate.
for na... | 0.003135 |
def variants(self, case_id, skip=0, count=1000, filters=None):
"""Fetch variants for a case."""
filters = filters or {}
logger.debug("Fetching case with case_id: {0}".format(case_id))
case_obj = self.case(case_id)
plugin, case_id = self.select_plugin(case_obj)
self.filter... | 0.00241 |
def merge_true_table():
"""Merge all true table into single excel file.
"""
writer = pd.ExcelWriter("True Table.xlsx")
for p in Path(__file__).parent.select_by_ext(".csv"):
df = pd.read_csv(p.abspath, index_col=0)
df.to_excel(writer, p.fname, index=True)
writer.save() | 0.003289 |
def convert_predict_response(pred, serving_bundle):
"""Converts a PredictResponse to ClassificationResponse or RegressionResponse.
Args:
pred: PredictResponse to convert.
serving_bundle: A `ServingBundle` object that contains the information about
the serving request that the response was generated b... | 0.012673 |
def _add_new_labels(self, sentences):
'''
Adds new sentences to the internal indexing of the model.
Args:
sentences (list): LabeledSentences for each doc to be added
Returns:
int: number of sentences added to the model
'''
sentence_no = -1
... | 0.004195 |
def find_templates():
"""
Load python modules from templates directory and get templates list
:return: list of tuples (pairs):
[(compiled regex, lambda regex_match: return message_data)]
"""
templates = []
templates_directory = (inspect.getsourcefile(lambda: 0).rstrip('__init__.py'... | 0.002999 |
def fetch_raw_data(sql, connection, geometry):
"""
Fetch the coastdat2 from the database, adapt it to the local time zone
and create a time index.
"""
tmp_dc = {}
weather_df = pd.DataFrame(
connection.execute(sql).fetchall(), columns=[
'gid', 'geom_point', 'geom_polygon', 'da... | 0.000647 |
def init_app(application):
"""
Initialise an application
Set up whitenoise to handle static files.
"""
config = {k: v for k, v in application.config.items() if k in SCHEMA}
kwargs = {'autorefresh': application.debug}
kwargs.update((k[11:].lower(), v) for k, v in config.items())
insta... | 0.00158 |
def get_url_args(url):
""" Returns a dictionary from a URL params """
url_data = urllib.parse.urlparse(url)
arg_dict = urllib.parse.parse_qs(url_data.query)
return arg_dict | 0.005319 |
def assignees(self):
"""
Gets the task assignees
"""
if not self.can_update():
self._tcex.handle_error(910, [self.type])
for a in self.tc_requests.assignees(self.api_type, self.api_sub_type, self.unique_id):
yield a | 0.010714 |
def migration(resource, version, previous_version=''):
"""Register a migration function"""
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
migrated = func(*args, **kwargs)
return migrated
m = Migration(wrapper, resource, version, previous_version... | 0.002618 |
def move_dirty_lock_file(dirty_lock_file, sm_path):
""" Move the dirt_lock file to the sm_path and thereby is not found by auto recovery of backup anymore """
if dirty_lock_file is not None \
and not dirty_lock_file == os.path.join(sm_path, dirty_lock_file.split(os.sep)[-1]):
logger.debug("M... | 0.010204 |
def _validate_xtext(xtext):
"""If input token contains ASCII non-printables, register a defect."""
non_printables = _non_printable_finder(xtext)
if non_printables:
xtext.defects.append(errors.NonPrintableDefect(non_printables))
if utils._has_surrogates(xtext):
xtext.defects.append(error... | 0.002475 |
def get_center_of_mass(self):
"""
Get a tuple (x,y) that is the center of mass. The center of mass is not
necessarily the same as the center of the bounding box. Imagine a black
square and a single dot wide outside of the square.
"""
xsum, ysum, counter = 0., 0., 0
... | 0.003724 |
def define_help_flags():
"""Registers help flags. Idempotent."""
# Use a global to ensure idempotence.
global _define_help_flags_called
if not _define_help_flags_called:
flags.DEFINE_flag(HelpFlag())
flags.DEFINE_flag(HelpshortFlag()) # alias for --help
flags.DEFINE_flag(HelpfullFlag())
flags.... | 0.013055 |
def format_all(format_string, env):
""" Format the input string using each possible combination of lists
in the provided environment. Returns a list of formated strings.
"""
prepared_env = parse_pattern(format_string, env, lambda x, y: [FormatWrapper(x, z) for z in y])
# Generate each possible ... | 0.003466 |
def start(self, container, **kwargs):
"""
Identical to :meth:`docker.api.container.ContainerApiMixin.start` with additional logging.
"""
self.push_log("Starting container '{0}'.".format(container))
super(DockerFabricClient, self).start(container, **kwargs) | 0.010135 |
def dcdict2rdfpy(dc_dict):
"""Convert a DC dictionary into an RDF Python object."""
ark_prefix = 'ark: ark:'
uri = URIRef('')
# Create the RDF Python object.
rdf_py = ConjunctiveGraph()
# Set DC namespace definition.
DC = Namespace('http://purl.org/dc/elements/1.1/')
# Get the ark for th... | 0.001393 |
def tick(self):
"""Return the time cost string as expect."""
string = self.passed
if self.rounding:
string = round(string)
if self.readable:
string = self.readable(string)
return string | 0.008032 |
def side_by_side(left, right):
r"""Put two boxes next to each other.
Assumes that all lines in the boxes are the same width.
Example:
>>> left = 'A \nC '
>>> right = 'B\nD'
>>> print(side_by_side(left, right))
A B
C D
<BLANKLINE>
"""
left_lines = lis... | 0.001255 |
def _load_cytoBand(filename):
""" Load UCSC cytoBand table.
Parameters
----------
filename : str
path to cytoBand file
Returns
-------
df : pandas.DataFrame
cytoBand table if loading was successful, else None
References
-... | 0.002478 |
def sent_folder(self):
""" Shortcut to get SentItems Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='SentItems',
folder_id=OutlookWellKnowFolderNames
.SENT.value) | 0.006289 |
def _count_words(self, to_lower=True, delimiters=["\r", "\v", "\n", "\f", "\t", " "]):
"""
This returns an SArray with, for each input string, a dict from the unique,
delimited substrings to their number of occurrences within the original
string.
The SArray must be of type strin... | 0.003974 |
def resolve_available_slots(self, worksheet_template, type='a'):
"""Returns the available slots from the current worksheet that fits
with the layout defined in the worksheet_template and type of analysis
passed in.
Allowed type of analyses are:
'a' (routine analysis)
... | 0.001695 |
def _add_form_fields(obj, lines):
"""Improve the documentation of a Django Form class.
This highlights the available fields in the form.
"""
lines.append("**Form fields:**")
lines.append("")
for name, field in obj.base_fields.items():
field_type = "{}.{}".format(field.__class__.__module... | 0.003317 |
def dateof(tag_name, tags):
"""Given a list of tags, returns the datetime of the tag with the given name; Otherwise None."""
for tag in tags:
if tag['name'] == tag_name:
commit = read_url(tag['commit']['url'])
return parse_timestamp(commit['commit']['committer']['date'])
retu... | 0.006116 |
def parse_instant_time(slot):
""" Parse a slot into an InstantTime object.
Sample response:
{
"entity": "snips/datetime",
"range": {
"end": 36,
"start": 28
},
"rawValue": "tomorrow",
"slotName": "weatherForecastStartDate... | 0.002012 |
def shorten(string, max_length=80, trailing_chars=3):
''' trims the 'string' argument down to 'max_length' to make previews to long string values '''
assert type(string).__name__ in {'str', 'unicode'}, 'shorten needs string to be a string, not {}'.format(type(string))
assert type(max_length) == int, 'shorte... | 0.008122 |
def set_baudrate(self, baudrate):
'''set baudrate'''
try:
self.port.setBaudrate(baudrate)
except Exception:
# for pySerial 3.0, which doesn't have setBaudrate()
self.port.baudrate = baudrate | 0.008 |
def get_energies(rootdir, reanalyze, verbose, detailed, sort, fmt):
"""
Doc string.
"""
if verbose:
logformat = "%(relativeCreated)d msecs : %(message)s"
logging.basicConfig(level=logging.INFO, format=logformat)
if not detailed:
drone = SimpleVaspToComputedEntryDrone(inc_str... | 0.000438 |
def record_set(self, train, labels=None, channel="train"):
"""Build a :class:`~RecordSet` from a numpy :class:`~ndarray` matrix and label vector.
For the 2D ``ndarray`` ``train``, each row is converted to a :class:`~Record` object.
The vector is stored in the "values" entry of the ``features`` ... | 0.00782 |
def create(self, name, plugin_name, plugin_version,
cluster_template_id=None, default_image_id=None,
is_transient=None, description=None, cluster_configs=None,
node_groups=None, user_keypair_id=None,
anti_affinity=None, net_id=None, count=None,
... | 0.008502 |
def kill_all():
"""When polysh quits, we kill all the remote shells we started"""
for i in dispatchers.all_instances():
try:
os.kill(-i.pid, signal.SIGKILL)
except OSError:
# The process was already dead, no problem
pass | 0.003571 |
def PopupGetFolder(message, title=None, default_path='', no_window=False, size=(None, None), button_color=None,
background_color=None, text_color=None, icon=DEFAULT_WINDOW_ICON, font=None, no_titlebar=False,
grab_anywhere=False, keep_on_top=False, location=(None, None), initial_fol... | 0.005394 |
def getLocationRepresentation(self):
"""
Get the full population representation of the location layer.
"""
activeCells = np.array([], dtype="uint32")
totalPrevCells = 0
for module in self.L6aModules:
activeCells = np.append(activeCells,
module.getActiveCells(... | 0.007317 |
def get(self, sid):
"""
Constructs a InstalledAddOnExtensionContext
:param sid: The unique Extension Sid
:returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext
:rtype: twilio.rest.preview.marketplace.installed_add_on... | 0.007042 |
def _get_min_distance_numpy(element):
"""
NumPy based implementation of get_min_distance
"""
xys = element.array([0, 1])
with warnings.catch_warnings():
warnings.filterwarnings('ignore', r'invalid value encountered in')
xys = xys.astype('float32').view(np.complex64)
distances... | 0.003984 |
def convert(html):
"""converts an html string to markdown while preserving unsupported markup."""
bs = BeautifulSoup(html, 'html.parser')
_markdownify(bs)
ret = unicode(bs).replace(u'\xa0', ' ')
ret = re.sub(r'\n{3,}', r'\n\n', ret)
# ! FIXME: hack
ret = re.sub(r'<<<FLOATING LINK: (.+)>>>'... | 0.027576 |
def next_frame_ae_tiny():
"""Conv autoencoder, tiny set for testing."""
hparams = next_frame_tiny()
hparams.bottom["inputs"] = modalities.video_bitwise_bottom
hparams.top["inputs"] = modalities.video_top
hparams.batch_size = 8
hparams.dropout = 0.4
return hparams | 0.028881 |
def is_redundant_multiplicon(self, value):
""" Returns True if the passed multiplicon ID is redundant, False
otherwise.
- value, (int) multiplicon ID
"""
if not hasattr(self, '_redundant_multiplicon_cache'):
sql = '''SELECT id FROM multiplicons WHERE is_redun... | 0.003049 |
def get_meta(catid, sig):
'''
Get metadata of dataset via ID.
'''
meta_base = './static/dataset_list'
if os.path.exists(meta_base):
pass
else:
return False
pp_data = {'logo': '', 'kind': '9'}
for wroot, wdirs, wfiles in os.walk(meta_base):
for wdir in wdirs:
... | 0.001667 |
def doubleclick(self, window_name, object_name):
"""
Double click on the object
@param window_name: Window name to look for, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to look for, either fu... | 0.00398 |
def get_self_host(request_data):
"""
Returns the current host.
:param request_data: The request as a dict
:type: dict
:return: The current host
:rtype: string
"""
if 'http_host' in request_data:
current_host = request_data['http_host']
... | 0.002334 |
def render_bash_options(self):
"""Rendering Bash options."""
options = ''
if self.config.debug:
options += "set -x\n"
if self.config.strict:
options += "set -euo pipefail\n"
return options | 0.007937 |
def iter_subclasses(class_):
"""Iterate over all the subclasses (and subclasses thereof, etc.)
of given class.
:param class_: Class to yield the subclasses of
:return: Iterable of subclasses, sub-subclasses, etc. of ``class_``
"""
ensure_class(class_)
classes = set()
def descend(class... | 0.001818 |
def date_asn_block(self, ip, announce_date=None):
"""
Get the ASN and the IP Block announcing the IP at a specific date.
:param ip: IP address to search for
:param announce_date: Date of the announcement
:rtype: tuple
.. code-block:: python
... | 0.003012 |
def load_sources(self, sources):
"""Delete all sources in the ROI and load the input source list."""
self.clear()
for s in sources:
if isinstance(s, dict):
s = Model.create_from_dict(s)
self.load_source(s, build_index=False)
self._build_src_inde... | 0.006192 |
def get_client(self, destination_params, job_id, **kwargs):
"""Build a client given specific destination parameters and job_id."""
destination_params = _parse_destination_params(destination_params)
destination_params.update(**kwargs)
job_manager_interface_class = self.job_manager_interfa... | 0.007764 |
def _compute_asset_lifetimes(self, country_codes):
"""
Compute and cache a recarray of asset lifetimes.
"""
equities_cols = self.equities.c
if country_codes:
buf = np.array(
tuple(
sa.select((
equities_cols.s... | 0.001438 |
def _tostream(self, stream, skipprepack= False):
'''
Convert the struct into a bytes stream. This is the standard way to convert a NamedStruct to bytes.
:param stream: a list of bytes to get the result
:param skipprepack: if True, the prepack stage is skipped. For parse... | 0.011923 |
def translate_basic(usercode):
""" Translate a basic color name to color with explanation. """
codenum = get_code_num(codes['fore'][usercode])
colorcode = codeformat(codenum)
msg = 'Name: {:>10}, Number: {:>3}, EscapeCode: {!r}'.format(
usercode,
codenum,
colorcode
)
if d... | 0.002584 |
def detect(self):
"""Detect the IP address."""
if self.opts_family == AF_INET6:
kind = IPV6_PUBLIC
else: # 'INET':
kind = IPV4
theip = None
try:
theip = detect_ip(kind)
except GetIpException:
LOG.exception("socket detector ... | 0.004988 |
def save_to_tomodir(self, directory):
"""Save the tomodir instance to a directory structure.
Note
----
Test cases:
* modeling only
* inversion only
* modeling and inversion
"""
self.create_tomodir(directory)
self.grid.save_... | 0.001021 |
def close_room(self, room, namespace):
"""Remove all participants from a room."""
try:
for sid in self.get_participants(namespace, room):
self.leave_room(sid, namespace, room)
except KeyError:
pass | 0.007663 |
def pull(self, remote="origin", ref=None):
"""Do a git pull of `ref` from `remote`."""
return git_pull(self.repo_dir, remote=remote, ref=ref) | 0.012739 |
def table2matrix(table):
"""convert a table to a list of lists - a 2D matrix"""
if not is_simpletable(table):
raise NotSimpleTable("Not able read a cell in the table as a string")
rows = []
for tr in table('tr'):
row = []
for td in tr('td'):
td = tdbr2EOL(td) # conve... | 0.003839 |
def compute_indel_length(fs_df):
"""Computes the indel length accounting for wether it is an insertion or
deletion.
Parameters
----------
fs_df : pd.DataFrame
mutation input as dataframe only containing indel mutations
Returns
-------
indel_len : pd.Series
length of ind... | 0.010526 |
def has_succeed(self):
""" Check if the connection has succeed
Returns:
Returns True if connection has succeed.
False otherwise.
"""
status_code = self._response.status_code
if status_code in [HTTP_CODE_ZERO, HTTP_CODE_SUCCESS, HTTP_CODE_CRE... | 0.005089 |
def register_options(cls, register):
"""Register an option to make capturing snapshots optional.
This class is intended to be extended by Jvm resolvers (coursier and ivy), and the option name should reflect that.
"""
super(JvmResolverBase, cls).register_options(register)
# TODO This flag should be d... | 0.008915 |
def create_mapping(record, keys):
"""Create a field mapping for use in API updates and creates.
Args:
record (BaseModel): Record that should be mapped.
keys (list[str]): Fields that should be mapped as keys.
Returns:
dict: Dictionary with keys:
... | 0.002116 |
def dismiss(self, targets, exit_when=None, sleep_interval=0.5, appearance_timeout=20, timeout=120):
"""
Automatically dismiss the target objects
Args:
targets (:obj:`list`): list of poco objects to be dropped
exit_when: termination condition, default is None which means ... | 0.004673 |
def find_one(cls, filter=None, *args, **kwargs):
"""
Returns one document dict if one passes the filter.
Returns None otherwise.
"""
return cls.collection.find_one(filter, *args, **kwargs) | 0.008772 |
def convert_to_pypi_version(version):
"""
Convert a git tag version string into something compatible with `PEP-440 <https://www.python.org/dev/peps/pep-0440/>`_.
:param version: The input version string, normally directly out of git describe.
:return: PEP-440 version string
Usage::
>>> conv... | 0.006032 |
def _get_auto_increment_info(self, table):
"""figure out the the autoincrement value for the given table"""
query = ''
seq_table = ''
seq_column = ''
seq_name = ''
find_query = "\n".join([
"SELECT",
" t.relname as related_table,",
" a... | 0.008625 |
def summary_by_datacenter(self):
"""Summary of the networks on the account, grouped by data center.
The resultant dictionary is primarily useful for statistical purposes.
It contains count information rather than raw data. If you want raw
information, see the :func:`list_vlans` method i... | 0.001336 |
def is_contradictory(self, other):
"""
Two lists are contradictory if the shorter one is not a prefix of the
other. (Very strict definition -- could be generalized to subsequence)
"""
if other.size() > self.size():
return other.is_contradictory(self)
# ensure ... | 0.004646 |
def stop(self, timeout=None):
"""
Send the GET request required to stop the scan
If timeout is not specified we just send the request and return. When
it is the method will wait for (at most) :timeout: seconds until the
scan changes it's status/stops. If the timeout is reached t... | 0.001812 |
def get_firmware_manifest(self, manifest_id):
"""Get manifest with provided manifest_id.
:param str manifest_id: ID of manifest to retrieve (Required)
:return: FirmwareManifest
"""
api = self._get_api(update_service.DefaultApi)
return FirmwareManifest(api.firmware_manife... | 0.008403 |
def _update_evaluated_individuals_(self, result_score_list, eval_individuals_str, operator_counts, stats_dicts):
"""Update self.evaluated_individuals_ and error message during pipeline evaluation.
Parameters
----------
result_score_list: list
A list of CV scores for evaluate... | 0.007042 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.