text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _write_single_sample(self, sample):
"""
:type sample: Sample
"""
bytes = sample.extras.get("responseHeadersSize", 0) + 2 + sample.extras.get("responseBodySize", 0)
message = sample.error_msg
if not message:
message = sample.extras.get("responseMessage")
... | 0.003257 |
def setup_cmd_parser(cls):
"""Returns the Git argument parser."""
parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES,
from_date=True,
to_date=True)
# Optional arguments
group = parser.... | 0.003171 |
def _new_multipart_upload(self, bucket_name, object_name,
metadata=None, sse=None):
"""
Initialize new multipart upload request.
:param bucket_name: Bucket name of the new multipart request.
:param object_name: Object name of the new multipart request.
... | 0.003161 |
def savepoint(self):
"""
Copies the last displayed image.
"""
if self._last_image:
self._savepoints.append(self._last_image)
self._last_image = None | 0.009804 |
def ensure_tuple(tuple_or_mixed, *, cls=None):
"""
If it's not a tuple, let's make a tuple of one item.
Otherwise, not changed.
:param tuple_or_mixed:
:return: tuple
"""
if cls is None:
cls = tuple
if isinstance(tuple_or_mixed, cls):
return tuple_or_mixed
if tuple... | 0.001927 |
def set_config(path):
"""
Set configuration for current session.
"""
logging.info("LOADING FROM: {}".format(path))
session.config = load_config(path)
return session.config | 0.005128 |
def QA_util_random_with_topic(topic='Acc', lens=8):
"""
生成account随机值
Acc+4数字id+4位大小写随机
"""
_list = [chr(i) for i in range(65,
91)] + [chr(i) for i in range(97,
123)
... | 0.004494 |
def get_package_hashes(filename):
"""Provides hash of given filename.
Args:
filename (str): Name of file to hash
Returns:
(str): sha256 hash
"""
log.debug('Getting package hashes')
filename = os.path.abspath(filename)
with open(filename, 'rb') as f:
data = f.read(... | 0.002278 |
def wait_for_event(event):
"""
Wraps a win32 event into a `Future` and wait for it.
"""
f = Future()
def ready():
get_event_loop().remove_win32_handle(event)
f.set_result(None)
get_event_loop().add_win32_handle(event, ready)
return f | 0.00722 |
def _tune(self, args):
"""
propose connection tuning parameters
This method proposes a set of connection configuration values
to the client. The client can accept and/or adjust these.
PARAMETERS:
channel_max: short
proposed maximum channels
... | 0.001112 |
def get_airport_stats(self, iata, page=1, limit=100):
"""Retrieve the performance statistics at an airport
Given the IATA code of an airport, this method returns the performance statistics for the airport.
Args:
iata (str): The IATA code for an airport, e.g. HYD
page (i... | 0.004873 |
def split_block_by_row_length(block, split_row_length):
'''
Splits the block by finding all rows with less consequetive, non-empty rows than the
min_row_length input.
'''
split_blocks = []
current_block = []
for row in block:
if row_content_length(row) <= split_row_length:
... | 0.003226 |
def do_use(self, region):
"""
Switch the AWS region
> use us-west-1
> use us-east-1
"""
if self._local_endpoint is not None:
host, port = self._local_endpoint # pylint: disable=W0633
self.engine.connect(
region, session=self.sess... | 0.006637 |
def set_type(self, value):
"""Setter for type attribute"""
if value not in self.types_available:
log = "Sources field 'type' should be in one of %s" % (
self.types_available
)
raise MalFormattedSource(log)
self._type = value | 0.006667 |
def construct_asset_path(self, asset_path, css_path, output_filename, variant=None):
"""Return a rewritten asset URL for a stylesheet"""
public_path = self.absolute_path(asset_path, os.path.dirname(css_path).replace('\\', '/'))
if self.embeddable(public_path, variant):
return "__EMBE... | 0.008264 |
def _start_ubridge_capture(self, adapter_number, output_file):
"""
Start a packet capture in uBridge.
:param adapter_number: adapter number
:param output_file: PCAP destination file for the capture
"""
vnet = "ethernet{}.vnet".format(adapter_number)
if vnet not ... | 0.006596 |
def process(self, data=None, **kwargs):
"""Process the provided data and invoke :meth:`Handler.handle` method for this
Handler class.
:params data: The data being processed.
:returns: self
:rtype: :class:`Handler`
.. code-block:: python
def post(self, *args... | 0.004754 |
def record_patch(rec, diff):
"""Return the JSON-compatible structure that results from applying the
changes in `diff` to the record `rec`. The parameters must be structures
compatible with json.dumps *or* strings compatible with json.loads. Note
that by design, `old == record_patch(new, record_diff(old,... | 0.002326 |
def router(self):
"""
Property returning the router at the top of the middleware
chain's stack (the last item in the list). If the list is empty
OR the item is not an instance of growler.Router, one is created
and added to the middleware chain, matching all requests.
"""
... | 0.00363 |
def create(cls, name, user=None, network_element=None, domain_name=None,
zone=None, executable=None):
"""
Create a match expression
:param str name: name of match expression
:param str user: name of user or user group
:param Element network_element: valid network ... | 0.003731 |
def set_shape(self, id, new_shape):
"""Copies the turtle data from the old shape buffer to the new"""
old_shape = self.id_to_shape[id]
old_buffer = self.get_buffer(old_shape)
model, color = old_buffer.get(id)
new_data = self._create_turtle(id, new_shape, model, color)
old... | 0.004963 |
def expireat(self, key, timestamp):
""":meth:`~tredis.RedisClient.expireat` has the same effect and
semantic as :meth:`~tredis.RedisClient.expire`, but instead of
specifying the number of seconds representing the TTL (time to live),
it takes an absolute Unix timestamp (seconds since Janu... | 0.002227 |
def parse_message(self):
"""results in an OmapiMessage"""
parser = parse_chain(self.parse_net32int, # authid
lambda *_: self.parse_net32int(), # authlen
lambda *_: self.parse_net32int(), # opcode
lambda *_: self.parse_net32int(), # handle
lambda *_: self.parse_net32int(), # tid
... | 0.035994 |
async def get_user(self, username, secret_key=None):
"""Get a user by name.
:param str username: Username
:param str secret_key: Issued by juju when add or reset user
password
:returns: A :class:`~juju.user.User` instance
"""
client_facade = client.UserManage... | 0.00308 |
def incrby(self, fmt, offset, increment, overflow=None):
"""
Increment a bitfield by a given amount.
:param fmt: format-string for the bitfield being updated, e.g. u8 for
an unsigned 8-bit integer.
:param int offset: offset (in number of bits).
:param int increment: ... | 0.00271 |
def hdrmap(xmethod, dmethod, opt):
"""Return ``hdrmap`` argument for ``.IterStatsConfig`` initialiser.
"""
hdr = {'Itn': 'Iter', 'Fnc': 'ObjFun', 'DFid': 'DFid',
u('ℓ1'): 'RegL1', 'Cnstr': 'Cnstr'}
if xmethod == 'admm':
hdr.update({'r_X': 'XPrRsdl', 's_X': 'XDlRsdl', u('ρ_X'): 'XRho'... | 0.0011 |
def _fields_common(self):
"""Returns a dictionary of fields and values that are common to all events
for which fields dictionaries are created.
"""
result = {}
if not self.testmode:
result["__reponame__"] = self.repo.repo.full_name
result["__repodesc__"] =... | 0.004695 |
def open_relative(self, url, *args, **kwargs):
"""Like :func:`open`, but ``url`` can be relative to the currently
visited page.
"""
return self.open(self.absolute_url(url), *args, **kwargs) | 0.00905 |
def load(cls, path, base=None):
'''Return a list of the tasks stored in a file'''
base = base or os.getcwd()
absolute = os.path.abspath(path)
parent = os.path.dirname(absolute)
name, _, _ = os.path.basename(absolute).rpartition('.py')
fobj, path, description = imp.find_mo... | 0.002517 |
def skeleton(files, metadata, sqlite_extensions):
"Generate a skeleton metadata.json file for specified SQLite databases"
if os.path.exists(metadata):
click.secho(
"File {} already exists, will not over-write".format(metadata),
bg="red",
fg="white",
bold=T... | 0.000579 |
def file_contents_safe(self, sentry_unit, file_name,
max_wait=60, fatal=False):
"""Get file contents from a sentry unit. Wrap amulet file_contents
with retry logic to address races where a file checks as existing,
but no longer exists by the time file_contents is call... | 0.002588 |
async def update(self, query, *, dc=None):
"""Updates existing prepared query
Parameters:
Query (Object): Query definition
dc (str): Specify datacenter that will be used.
Defaults to the agent's local datacenter.
Returns:
bool: ``True`` ... | 0.003546 |
def index(self):
""" Display NIPAP version info
"""
c.pynipap_version = pynipap.__version__
try:
c.nipapd_version = pynipap.nipapd_version()
except:
c.nipapd_version = 'unknown'
c.nipap_db_version = pynipap.nipap_db_version()
return rende... | 0.008876 |
def get_path(element):
"""
Convert an OSM way element into the format for a networkx graph path.
Parameters
----------
element : dict
an OSM way element
Returns
-------
dict
"""
path = {}
path['osmid'] = element['id']
# remove any consecutive duplicate element... | 0.001541 |
def _clean_text(self, branch):
"""
Remove text from node if same text exists in its children.
Apply string formatter if set.
"""
if branch.text and self.input_text_formatter:
branch.text = self.input_text_formatter(branch.text)
try:
... | 0.003356 |
def npz_generator(npz_path):
"""Generate data from an npz file."""
npz_data = np.load(npz_path)
X = npz_data['X']
# Y is a binary maxtrix with shape=(n, k), each y will have shape=(k,)
y = npz_data['Y']
n = X.shape[0]
while True:
i = np.random.randint(0, n)
yield {'X': X[i]... | 0.003012 |
def get_sql_for_new_models(apps=None, using=DEFAULT_DB_ALIAS):
"""
Unashamedly copied and tweaked from django.core.management.commands.syncdb
"""
connection = connections[using]
# Get a list of already installed *models* so that references work right.
tables = connection.introspection.table... | 0.004246 |
async def init():
"""Create a connection to the Redis server."""
global redis_conn # pylint: disable=global-statement,invalid-name
conn = await aioredis.create_connection(
'redis://{}:{}'.format(
SETTINGS.get('FLOW_EXECUTOR', {}).get('REDIS_CONNECTION', {}).get('host', 'localhost'),
... | 0.007207 |
def post_status(
app,
user,
status,
visibility='public',
media_ids=None,
sensitive=False,
spoiler_text=None,
in_reply_to_id=None
):
"""
Posts a new status.
https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#posting-a-new-status
"""
# Idempote... | 0.001304 |
def set_fen(self, fen: str) -> None:
"""
Parses a FEN and sets the position from it.
:raises: :exc:`ValueError` if the FEN string is invalid.
"""
parts = fen.split()
# Board part.
try:
board_part = parts.pop(0)
except IndexError:
... | 0.003691 |
def _slowIsSegmentActive(self, seg, timeStep):
"""
A segment is active if it has >= activationThreshold connected
synapses that are active due to infActiveState.
"""
numSyn = seg.size()
numActiveSyns = 0
for synIdx in xrange(numSyn):
if seg.getPermanence(synIdx) < self.connectedPerm:... | 0.008292 |
def add_user_to_group(self, username, groupname, raise_on_error=False):
"""Add a user to a group
:param username: The username to assign to the group
:param groupname: The group name into which to assign the user
:return: True on success, False on failure.
"""
data = {
... | 0.004172 |
def pipe(wrapped):
"""
Decorator to create an SPL operator from a function.
A pipe SPL operator with a single input port and a single
output port. For each tuple on the input port the
function is called passing the contents of the tuple.
SPL attributes from the tuple are passed by position... | 0.004043 |
def from_binary(self, d):
"""Given a binary payload d, update the appropriate payload fields of
the message.
"""
p = MsgEphemerisGPSDepF._parser.parse(d)
for n in self.__class__.__slots__:
setattr(self, n, getattr(p, n)) | 0.008097 |
def restore_bucket(self, table_name):
"""Restore bucket from SQL
"""
if table_name.startswith(self.__prefix):
return table_name.replace(self.__prefix, '', 1)
return None | 0.00939 |
def add_external_ref(self, eid, etype, value):
"""Add an external reference.
:param str eid: Name of the external reference.
:param str etype: Type of the external reference, has to be in
``['iso12620', 'ecv', 'cve_id', 'lexen_id', 'resource_url']``.
:param str value: Value ... | 0.003431 |
def retire_asset_ddo(self, did):
"""
Retire asset ddo of Aquarius.
:param did: Asset DID string
:return: API response (depends on implementation)
"""
response = self.requests_session.delete(f'{self.url}/{did}', headers=self._headers)
if response.status_code == 20... | 0.006024 |
def folder_cls_from_folder_name(cls, folder_name, locale):
"""Returns the folder class that matches a localized folder name.
locale is a string, e.g. 'da_DK'
"""
for folder_cls in cls.WELLKNOWN_FOLDERS + NON_DELETEABLE_FOLDERS:
if folder_name.lower() in folder_cls.localized_... | 0.005089 |
def get_all_response(self, sort_order=None, sort_target='key',
keys_only=False):
"""Get all keys currently stored in etcd."""
range_request = self._build_get_range_request(
key=b'\0',
range_end=b'\0',
sort_order=sort_order,
sort_ta... | 0.005357 |
def make_carrier_tone(freq, db, dur, samplerate, caldb=100, calv=0.1):
"""
Produce a pure tone signal
:param freq: Frequency of the tone to be produced (Hz)
:type freq: int
:param db: Intensity of the tone in dB SPL
:type db: int
:param dur: duration (seconds)
:type dur: float
:para... | 0.003425 |
def add_resources_to_registry():
"""
Add resources to the deform registry
"""
from deform.widget import default_resource_registry
default_resource_registry.set_js_resources("jqueryui", None, None)
default_resource_registry.set_js_resources("datetimepicker", None, None)
default_resource_regi... | 0.000997 |
def pack_command(self, *args):
"""
Pack a series of arguments into a value SSDB command
"""
# the client might have included 1 or more literal arguments in
# the command name, e.g., 'CONFIG GET'. The SSDB server expects
# these arguments to be sent separately, so split th... | 0.003185 |
def info(self, event=None, *args, **kw):
"""
Process event and call :meth:`logging.Logger.info` with the result.
"""
if not self._logger.isEnabledFor(logging.INFO):
return
kw = self._add_base_info(kw)
kw['level'] = "info"
return self._proxy_to_logger(... | 0.005764 |
def set_edge_attr(self, n, m, attr, value):
'''
API: set_edge_attr(self, n, m, attr, value)
Description:
Sets attr attribute of edge (n,m) to value.
Input:
n: Source node name.
m: Sink node name.
attr: Attribute of edge to set.
valu... | 0.006868 |
def mem_ds(res, extent, srs=None, dtype=gdal.GDT_Float32):
"""Create a new GDAL Dataset in memory
Useful for various applications that require a Dataset
"""
#These round down to int
#dst_ns = int((extent[2] - extent[0])/res)
#dst_nl = int((extent[3] - extent[1])/res)
#This should pad by 1 p... | 0.008065 |
def compute_Pi_L(self, CDR3_seq, Pi_V, max_V_align):
"""Compute Pi_L.
This function returns the Pi array from the model factors of the V genomic
contributions, P(V)*P(delV|V), and the VD (N1) insertions,
first_nt_bias_insVD(m_1)PinsVD(\ell_{VD})\prod_{i=2}^{\ell_{VD}}Rvd(m_i|m_{i-1... | 0.013237 |
def partial_match(self, path, filter_path):
'''Partially match a path and a filter_path with wildcards.
This function will return True if this path partially match a filter path.
This is used for walking through directories with multiple level wildcard.
'''
if not path or not filter_path:
... | 0.007778 |
def resolve_dependencies(nodes):
""" Figure out which order the nodes in the graph can be executed
in to satisfy all requirements. """
done = set()
while True:
if len(done) == len(nodes):
break
for node in nodes:
if node.name not in done:
match = d... | 0.001706 |
def writeGlyph(self,
name,
unicodes=None,
location=None,
masters=None,
note=None,
mute=False,
):
""" Add a new glyph to the current instance.
* name: the glyph name. Required.
* unicodes: unicode values f... | 0.005738 |
def lattice(lattice, filename, directory, render, view, **kwargs):
"""Return graphviz source for visualizing the lattice graph."""
dot = graphviz.Digraph(
name=lattice.__class__.__name__,
comment=repr(lattice),
filename=filename,
directory=directory,
node_attr=dict(shape=... | 0.005181 |
def parse_keyvalue(parser, event, node): #pylint: disable=unused-argument
"""Parse CIM/CML KEYVALUE element and return key value based on
VALUETYPE or TYPE (future) information
"""
valuetype = _get_required_attribute(node, 'VALUETYPE')
# TODO 2/16 KS: Type attribute not used. Extend to use. Ty... | 0.001613 |
def run(
self, server=None, host=None, port=None, enable_pretty_logging=True
):
"""
运行 WeRoBot。
:param server: 传递给 Bottle 框架 run 方法的参数,详情见\
`bottle 文档 <https://bottlepy.org/docs/dev/deployment.html#switching-the-server-backend>`_
:param host: 运行时绑定的主机地址
:para... | 0.004571 |
def get_inference_input():
"""Set up placeholders for input features/labels.
Returns the feature, output tensors that get passed into model_fn."""
return (tf.placeholder(tf.float32,
[None, go.N, go.N, features_lib.NEW_FEATURES_PLANES],
name='pos_tensor'... | 0.004283 |
def _get_s3_files(local_dir, file_info, params):
"""Retrieve s3 files to local directory, handling STORMSeq inputs.
"""
assert len(file_info) == 1
files = file_info.values()[0]
fnames = []
for k in ["1", "2"]:
if files[k] not in fnames:
fnames.append(files[k])
out = []
... | 0.001616 |
def impose_legend_limit(limit=30, axes="gca", **kwargs):
"""
This will erase all but, say, 30 of the legend entries and remake the legend.
You'll probably have to move it back into your favorite position at this point.
"""
if axes=="gca": axes = _pylab.gca()
# make these axes current
_pylab... | 0.021173 |
def get_srtm_dir(self):
""" The default path to store files. """
# Local cache path:
result = ""
if 'HOME' in mod_os.environ:
result = mod_os.sep.join([mod_os.environ['HOME'], '.cache', 'srtm'])
elif 'HOMEPATH' in mod_os.environ:
result = mod_os.sep.join([... | 0.008518 |
def to_json(self, incl_uniqueid=False):
"""
Convert the ParameterSet to a json-compatible dictionary
:return: list of dictionaries
"""
lst = []
for context in _contexts:
lst += [v.to_json(incl_uniqueid=incl_uniqueid)
for v in self.filter(c... | 0.00409 |
def list_priority_class(self, **kwargs):
"""
list or watch objects of kind PriorityClass
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_priority_class(async_req=True)
>>> resu... | 0.001986 |
def handle(self, *args, **options):
"""
dump fields permissions for a user
"""
def get_user(username):
try:
return User.objects.get(username=username)
except ObjectDoesNotExist as e:
raise CommandError("This user doesn't exist in t... | 0.007893 |
def _GetCurrentControlSet(self, key_path_suffix):
"""Virtual key callback to determine the current control set.
Args:
key_path_suffix (str): current control set Windows Registry key path
suffix with leading path separator.
Returns:
WinRegistryKey: the current control set Windows Regi... | 0.005975 |
def get_state_actions(self, state, **kwargs):
"""
Sends kill signals to running containers.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client, map, and configuration... | 0.005367 |
def _s3am_with_retry(job, num_cores, file_path, s3_url, mode='upload', s3_key_path=None):
"""
Run s3am with 3 retries
:param toil.job.Job job: Toil job that is calling this function
:param int num_cores: Number of cores to pass to upload/download slots
:param str file_path: Full path to the file
... | 0.00382 |
def method2png(output, mx, raw=False):
"""
Export method to a png file format
:param output: output filename
:type output: string
:param mx: specify the MethodAnalysis object
:type mx: :class:`MethodAnalysis` object
:param raw: use directly a dot raw buffer
:type raw: string
"""
... | 0.002375 |
def is_among(value, *possibilities):
"""
Ensure that the method that has been used for the request is one
of the expected ones (e.g., GET or POST).
"""
for possibility in possibilities:
if value == possibility:
return True
raise Exception('A different request value was encoun... | 0.005556 |
def get_shelveset_work_items(self, shelveset_id):
"""GetShelvesetWorkItems.
Get work items associated with a shelveset.
:param str shelveset_id: Shelveset's unique ID
:rtype: [AssociatedWorkItem]
"""
query_parameters = {}
if shelveset_id is not None:
q... | 0.00672 |
def to_json(self):
"""Convert the Design Day to a dictionary."""
return {
'name': self.name,
'day_type': self.day_type,
'location': self.location.to_json(),
'dry_bulb_condition': self.dry_bulb_condition.to_json(),
'humidity_condition': self.hum... | 0.004211 |
def node_definitions(id_fetcher, type_resolver=None, id_resolver=None):
'''
Given a function to map from an ID to an underlying object, and a function
to map from an underlying object to the concrete GraphQLObjectType it
corresponds to, constructs a `Node` interface that objects can implement,
and a... | 0.000735 |
def actions(self, req_action):
"""Send a `sc_pb.RequestAction`, which may include multiple actions."""
if FLAGS.sc2_log_actions:
for action in req_action.actions:
sys.stderr.write(str(action))
sys.stderr.flush()
return self._client.send(action=req_action) | 0.006897 |
def _plugin_targets(self, compiler):
"""Returns a map from plugin name to the targets that build that plugin."""
if compiler == 'javac':
plugin_cls = JavacPlugin
elif compiler == 'scalac':
plugin_cls = ScalacPlugin
else:
raise TaskError('Unknown JVM compiler: {}'.format(compiler))
... | 0.010941 |
def shape(self):
"""get the implied, 2D shape of self
Returns
-------
tuple : tuple
length 2 tuple of ints
"""
if self.__x is not None:
if self.isdiagonal:
return (max(self.__x.shape), max(self.__x.shape))
if len(self.... | 0.004301 |
def _tr_decode(self, msg):
"""TR: Thermostat data response."""
return {'thermostat_index': int(msg[4:6])-1, 'mode': int(msg[6]),
'hold': msg[7] == '1', 'fan': int(msg[8]),
'current_temp': int(msg[9:11]), 'heat_setpoint': int(msg[11:13]),
'cool_setpoint': i... | 0.008242 |
def add_user(self, attrs):
"""add a user"""
ldap_client = self._bind()
# encoding crap
attrs_srt = self.attrs_pretreatment(attrs)
attrs_srt[self._byte_p2('objectClass')] = self.objectclasses
# construct is DN
dn = \
self._byte_p2(self.dn_user_attr) + ... | 0.002055 |
def monitor(self, operation='', **kw):
"""
:returns: a new Monitor instance
"""
mon = self._monitor(operation, hdf5=self.datastore.hdf5)
self._monitor.calc_id = mon.calc_id = self.datastore.calc_id
vars(mon).update(kw)
return mon | 0.007018 |
def project(self, q, parent=False):
""" Figure out which attributes should be returned for the current
level of the query. """
if self.parent:
print (self.parent.var, self.predicate, self.var)
q = q.project(self.var, append=True)
if parent and self.parent:
... | 0.005119 |
def check_package(self, package, package_dir):
"""Check namespace packages' __init__ for declare_namespace"""
try:
return self.packages_checked[package]
except KeyError:
pass
init_py = orig.build_py.check_package(self, package, package_dir)
self.packages_... | 0.001741 |
def update(self):
"""Updates an instance within a project.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_update_instance]
:end-before: [END bigtable_update_instance]
.. note::
Updates any or all of the following values:... | 0.001387 |
def scan_to_best_match(fname, motifs, ncpus=None, genome=None, score=False):
"""Scan a FASTA file with motifs.
Scan a FASTA file and return a dictionary with the best match per motif.
Parameters
----------
fname : str
Filename of a sequence file in FASTA format.
motifs : list
... | 0.003788 |
def _GetFlowArgsHelpAsString(self, flow_cls):
"""Get a string description of the calling prototype for this flow."""
output = [
" Call Spec:",
" %s" % self._GetCallingPrototypeAsString(flow_cls), ""
]
arg_list = sorted(
iteritems(self._GetArgsDescription(flow_cls.args_type)),... | 0.005312 |
def handle_annotation_list(self, line: str, position: int, tokens: ParseResults) -> ParseResults:
"""Handle statements like ``DEFINE ANNOTATION X AS LIST {"Y","Z", ...}``.
:raises: RedefinedAnnotationError
"""
annotation = tokens['name']
self.raise_for_redefined_annotation(line,... | 0.009238 |
def append_all_agent_batch_to_update_buffer(self, key_list=None, batch_size=None, training_length=None):
"""
Appends the buffer of all agents to the update buffer.
:param key_list: The fields that must be added. If None: all fields will be appended.
:param batch_size: The number of eleme... | 0.011182 |
def resume(profile_process='worker'):
"""
Resume paused profiling.
Parameters
----------
profile_process : string
whether to profile kvstore `server` or `worker`.
server can only be profiled when kvstore is of type dist.
if this is not passed, defaults to `worker`
"""
... | 0.001761 |
def _create_function(name, doc=""):
"""Create a PySpark function by its name"""
def _(col):
sc = SparkContext._active_spark_context
jc = getattr(sc._jvm.functions, name)(col._jc if isinstance(col, Column) else col)
return Column(jc)
_.__name__ = name
_.__doc__ = doc
return _ | 0.00627 |
def safe_py_code(code):
'''
Check a string to see if it has any potentially unsafe routines which
could be executed via python, this routine is used to improve the
safety of modules suct as virtualenv
'''
bads = (
'import',
';',
'subprocess',
'eval... | 0.002028 |
def baseline_or_audit(self, allow_deletion=False, audit_only=False):
"""Baseline synchonization or audit.
Both functions implemented in this routine because audit is a prerequisite
for a baseline sync. In the case of baseline sync the last timestamp seen
is recorded as client state.
... | 0.00204 |
def tf_step(self, time, variables, **kwargs):
"""
Creates the TensorFlow operations for performing an optimization step.
Args:
time: Time tensor.
variables: List of variables to optimize.
**kwargs: Additional arguments passed on to the internal optimizer.
... | 0.002461 |
def create_status(self, sha, state, target_url=None, description=None,
context='default'):
"""Create a status object on a commit.
:param str sha: (required), SHA of the commit to create the status on
:param str state: (required), state of the test; only the following
... | 0.002558 |
def gen_token_range(self, start_id, stop_id):
"""
returns a list of all token IDs in the given, left-closed,
right-open interval (i.e. includes start_id, but excludes stop_id)
>>> gen_token_range('T0', 'T1')
['T0']
>>> gen_token_range('T1', 'T5')
['T1', 'T2', 'T... | 0.006122 |
def sso_entry(request):
""" Entrypoint view for SSO. Gathers the parameters from the HTTP request, stores them in the session
and redirects the requester to the login_process view.
"""
if request.method == 'POST':
passed_data = request.POST
binding = BINDING_HTTP_POST
else:
... | 0.002944 |
def plot_skyreg(header, data, **kwargs):
""" Plot sky region defined by header and data
header : FITS header
data : Data array
"""
kwargs.setdefault('cmap','binary')
fig = plt.figure()
ax = pywcsgrid2.subplot(111, header=header)
ax.set_ticklabel_type("dms")
im = ax.imshow(data, ori... | 0.008869 |
def generate_bond_subgraphs_from_break(bond_graph, atom1, atom2):
"""Splits the bond graph between two atoms to producing subgraphs.
Notes
-----
This will not work if there are cycles in the bond graph.
Parameters
----------
bond_graph: networkx.Graph
Graph of covalent bond network... | 0.002339 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.