text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _candidates_from_grid(self, n=1000):
"""Get unused candidates from the grid or parameters."""
used_vectors = set(tuple(v) for v in self.X)
# if every point has been used before, gridding is done.
grid_size = self.grid_width ** len(self.tunables)
if len(used_vectors) == grid_... | 0.003289 |
def slug(request, url):
"""Look up a page by url (which is a tree of slugs)"""
page = None
if url:
for slug in url.split('/'):
if not slug:
continue
try:
page = Page.objects.get(slug=slug, parent=page)
except Page.DoesNotExist:
... | 0.001016 |
def _get_future_devices(self, context):
"""Return a generator yielding new devices."""
monitor = Monitor.from_netlink(context)
monitor.filter_by("hidraw")
monitor.start()
self._scanning_log_message()
for device in iter(monitor.poll, None):
if device.action ==... | 0.003077 |
def run_tag_from_session_and_metric(session_name, metric_name):
"""Returns a (run,tag) tuple storing the evaluations of the specified metric.
Args:
session_name: str.
metric_name: MetricName protobuffer.
Returns: (run, tag) tuple.
"""
assert isinstance(session_name, six.string_types)
assert isinsta... | 0.015515 |
def stdlib_list(version=None):
"""
Given a ``version``, return a ``list`` of names of the Python Standard
Libraries for that version. These names are obtained from the Sphinx inventory
file (used in :py:mod:`sphinx.ext.intersphinx`).
:param str|None version: The version (as a string) whose list of ... | 0.005423 |
def _get_stack_info_for_trace(
self,
frames,
library_frame_context_lines=None,
in_app_frame_context_lines=None,
with_locals=True,
locals_processor_func=None,
):
"""Overrideable in derived clients to add frames/info, e.g. templates"""
return stacks.get_... | 0.005755 |
def add_pyobj(self, py_obj, **kwargs):
"""Adds a picklable Python object as a file to IPFS.
.. deprecated:: 0.4.2
The ``*_pyobj`` APIs allow for arbitrary code execution if abused.
Either switch to :meth:`~ipfsapi.Client.add_json` or use
``client.add_bytes(pickle.dumps(... | 0.002028 |
def set_error_pages(self, codes_map=None, common_prefix=None):
"""Add an error pages for managed 403, 404, 500 responses.
Shortcut for ``.set_error_page()``.
:param dict codes_map: Status code mapped into an html filepath or
just a filename if common_prefix is used.
If... | 0.003293 |
def objectprep(self):
"""
If the script is being run as part of a pipeline, create and populate the objects for the current analysis
"""
for sample in self.metadata:
setattr(sample, self.analysistype, GenObject())
# Set the destination folder
sample[se... | 0.005319 |
def load_stream(self, key, binary=False):
"""
Return a managed file-like object from which the calling code can read
previously-serialized data.
:param key:
:return: A managed stream-like object
"""
value = self.load_value(key, binary=binary)
yield io.Byt... | 0.005479 |
def full(self, asvector=False):
"""Returns full array (uncompressed).
.. warning::
TT compression allows to keep in memory tensors much larger than ones PC can handle in
raw format. Therefore this function is quite unsafe; use it at your own risk.
:returns: numpy.ndarray -... | 0.00501 |
def _hashes_match(self, a, b):
"""Constant time comparison of bytes for py3, strings for py2"""
if len(a) != len(b):
return False
diff = 0
if six.PY2:
a = bytearray(a)
b = bytearray(b)
for x, y in zip(a, b):
diff |= x ^ y
re... | 0.006006 |
def delete_app_id(self, app_id, mount_point='app-id'):
"""DELETE /auth/<mount_point>/map/app-id/<app_id>
:param app_id:
:type app_id:
:param mount_point:
:type mount_point:
:return:
:rtype:
"""
return self._adapter.delete('/v1/auth/{0}/map/app-id/... | 0.008499 |
def parse_fields(text, name_prefix=None, version=None, encoding_chars=None, validation_level=None,
references=None, force_varies=False):
"""
Parse the given ER7-encoded fields and return a list of :class:`hl7apy.core.Field`.
:type text: ``str``
:param text: the ER7-encoded string conta... | 0.005259 |
def step(self, action):
"""
Apply sequence of actions to sequence of environments
actions -> (observations, rewards, news)
where 'news' is a boolean vector indicating whether each element is new.
"""
obs, rews, news, infos = self.env.step(action)
self.ret = self... | 0.006525 |
def index(self, i):
"""xrangeobject.index(value, [start, [stop]]) -> integer --
return index of value.
Raise ValueError if the value is not present.
"""
if self.count(i) == 0:
raise ValueError("{} is not in range".format(i))
return (i - self._start) // self._s... | 0.006192 |
def _to_java(self):
"""
Transfer this instance to a Java CrossValidator. Used for ML persistence.
:return: Java object equivalent to this instance.
"""
estimator, epms, evaluator = super(CrossValidator, self)._to_java_impl()
_java_obj = JavaParams._new_java_obj("org.ap... | 0.006784 |
def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_video_note(
# receiver, self.media, disable_notific... | 0.006349 |
def pack_into_dict(fmt, names, buf, offset, data, **kwargs):
"""Same as :func:`~bitstruct.pack_into()`, but data is read from a
dictionary.
See :func:`~bitstruct.pack_dict()` for details on `names`.
"""
return CompiledFormatDict(fmt, names).pack_into(buf,
... | 0.002183 |
def strip_fields(self):
"""Clear any fields listed in field_list."""
for tag in self.record.keys():
if tag in self.fields_list:
record_delete_fields(self.record, tag) | 0.009524 |
def initial_annotate_kwargs():
"""Return default parameters passed to Axes.annotate to create labels."""
return dict(
xycoords="data", textcoords="data",
rotation=90, horizontalalignment="center", verticalalignment="center",
arrowprops=dict(arrowstyle="-", relpos=(0.5, 0.0))
) | 0.003195 |
def setGamepadFocusOverlay(self, ulNewFocusOverlay):
"""Sets the current Gamepad focus overlay"""
fn = self.function_table.setGamepadFocusOverlay
result = fn(ulNewFocusOverlay)
return result | 0.008969 |
def get_violation_if_found(self, node, lint_context):
""" Returns a violation if the node is invalid. """
if self.is_valid(node, lint_context):
return None
return self.create_violation_report(node, lint_context) | 0.008065 |
def payload_set(self, value):
"""
Set the message payload (and update header)
:param value: New payload value
:type value: unicode
:rtype: None
"""
self._payload = value
self._header.payload_length = len(self._payload) | 0.007067 |
def current_user(self):
"""
.. versionadded:: 0.6.0
Requires SMC version >= 6.4
Return the currently logged on API Client user element.
:raises UnsupportedEntryPoint: Current user is only supported with SMC
version >= 6.4
:rtype: Element
... | 0.007282 |
def _handle_tag_definebutton2(self):
"""Handle the DefineButton2 tag."""
obj = _make_object("DefineButton2")
obj.ButtonId = unpack_ui16(self._src)
bc = BitConsumer(self._src)
bc.ReservedFlags = bc.u_get(7)
bc.TrackAsMenu = bc.u_get(1)
obj.ActionOffset = unpack_u... | 0.000739 |
def option(self, url, headers=None, kwargs=None):
"""Make a OPTION request.
To make a OPTION request pass, ``url``
:param url: ``str``
:param headers: ``dict``
:param kwargs: ``dict``
"""
return self._request(
method='option',
url=url,
... | 0.005236 |
def _patch_vm_uuid(self):
"""
Fix the VM uuid in the case of linked clone
"""
if os.path.exists(self._linked_vbox_file()):
try:
tree = ET.parse(self._linked_vbox_file())
except ET.ParseError:
raise VirtualBoxError("Cannot modify Vir... | 0.009202 |
def drain(self, ignore_daemonsets=False, delete_local_storage=False, force=False):
"""
Removes all K8sPods from this K8sNode,
and prevents additional K8sPods from being scheduled.
:param ignore_daemonsets: a boolean.
If false, will fail if a K8sDaemonSet-manage... | 0.008754 |
def __reorganize(self):
"""
Reorganize the keys into their proper section order for the NOAA output file
DO NOT parse data tables (paleoData or chronData). We will do those separately.
:param str key:
:param any value:
:return none:
"""
logger_lpd_noaa.inf... | 0.004346 |
def apply_line_types(network):
"""Calculate line electrical parameters x, r, b, g from standard
types.
"""
lines_with_types_b = network.lines.type != ""
if lines_with_types_b.zsum() == 0:
return
missing_types = (pd.Index(network.lines.loc[lines_with_types_b, 'type'].unique())
... | 0.00679 |
def next(self):
"""
Returns the next row from the Instances object.
:return: the next Instance object
:rtype: Instance
"""
if self.row < self.data.num_instances:
index = self.row
self.row += 1
return self.data.get_instance(index)
... | 0.005525 |
def fcoe_fcoe_fabric_map_fcoe_fcf_map_fcf_map_fcf_rbid(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
fcoe = ET.SubElement(config, "fcoe", xmlns="urn:brocade.com:mgmt:brocade-fcoe")
fcoe_fabric_map = ET.SubElement(fcoe, "fcoe-fabric-map")
fcoe_f... | 0.004449 |
def _str_extract_frame(arr, pat, flags=0):
"""
For each subject string in the Series, extract groups from the
first match of regular expression pat. This function is called from
str_extract(expand=True), and always returns a DataFrame.
"""
from pandas import DataFrame
regex = re.compile(pa... | 0.001198 |
def write_single_register(self, reg_addr, reg_value):
"""Modbus function WRITE_SINGLE_REGISTER (0x06)
:param reg_addr: register address (0 to 65535)
:type reg_addr: int
:param reg_value: register value to write
:type reg_value: int
:returns: True if write ok or None if f... | 0.001263 |
def add_author(self, author, file_as=None, role=None, uid='creator'):
"Add author for this document"
self.add_metadata('DC', 'creator', author, {'id': uid})
if file_as:
self.add_metadata(None, 'meta', file_as, {'refines': '#' + uid,
... | 0.004484 |
def local_accuracy(X, y, model_generator, method_name):
""" Local Accuracy
transform = "identity"
sort_order = 2
"""
def score_map(true, pred):
""" Converts local accuracy from % of standard deviation to numerical scores for coloring.
"""
v = min(1.0, np.std(pred - true) / ... | 0.004521 |
async def validate(state, holdout_glob):
"""Validate the trained model against holdout games.
Args:
state: the RL loop State instance.
holdout_glob: a glob that matches holdout games.
"""
if not glob.glob(holdout_glob):
print('Glob "{}" didn\'t match any files, skipping validation'.format(
... | 0.009242 |
def clean(ctx):
"""Clean previously built package artifacts.
"""
ctx.run(f"python setup.py clean")
dist = ROOT.joinpath("dist")
print(f"[clean] Removing {dist}")
if dist.exists():
shutil.rmtree(str(dist)) | 0.004237 |
def _copy_settings_file(source, destination, name):
"""
Copy a file from the repo to the user's home directory.
"""
if os.path.exists(destination):
try:
ch = six.moves.input(
'File %s already exists, overwrite? y/[n]):' % destination)
if ch not in ('Y', '... | 0.001555 |
def parse_dict(value):
"""Parse a dict value from the tox config.
.. code-block: ini
[travis]
python =
2.7: py27, docs
3.5: py{35,36}
With this config, the value of ``python`` would be parsed
by this function, and would return::
{
'2.7': 'p... | 0.00177 |
def char_offsets_to_xpaths(html, char_offsets):
'''Converts HTML and a sequence of char offsets to xpath offsets.
Returns a generator of :class:`streamcorpus.XpathRange` objects
in correspondences with the sequence of ``char_offsets`` given.
Namely, each ``XpathRange`` should address precisely the same... | 0.000264 |
def post(self, request, *args, **kwargs):
""" Handles POST requests. """
return self.disapprove(request, *args, **kwargs) | 0.014599 |
def listen(self, addr=None):
"""Wait for a connection/reconnection from a DCC peer.
Returns the DCCConnection object.
The local IP address and port are available as
self.localaddress and self.localport. After connection from a
peer, the peer address and port are available as
... | 0.002203 |
def listen(identifier):
"""
Launch a listener and return the compactor context.
"""
context = Context()
process = WebProcess(identifier)
context.spawn(process)
log.info("Launching PID %s", process.pid)
return process, context | 0.028571 |
def turn_off(self, channel, callback=None):
"""
Turn off switch.
:return: None
"""
if callback is None:
def callb():
"""No-op"""
pass
callback = callb
message = velbus.SwitchRelayOffMessage(self._address)
me... | 0.004988 |
def _access_user_info(self):
"""
Vimeo requires the user ID to access the user info endpoint, so we need
to make two requests: one to get user ID and second to get user info.
"""
response = super(Vimeo, self)._access_user_info()
uid = response.data.get('oauth', {}).get('u... | 0.00404 |
def _string_to_int(s, state, region, base, signed, read_length=None):
"""
reads values from s and generates the symbolic number that it would equal
the first char is either a number in the given base, or the result is 0
expression indicates whether or not it was successful
"""
... | 0.004178 |
def _to_key_val_pairs(defs):
""" Helper to split strings, lists and dicts into (current, value) tuples for accumulation """
if isinstance(defs, STRING_TYPES):
# Convert 'a' to [('a', None)], or 'a.b.c' to [('a', 'b.c')]
return [defs.split('.', 1) if '.' in defs else (defs, None)]
else:
... | 0.009682 |
def getServiceJobsToStart(self, maxWait):
"""
:param float maxWait: Time in seconds to wait to get a job before returning.
:return: a tuple of (serviceJobStoreID, memory, cores, disk, ..) representing
a service job to start.
:rtype: toil.job.ServiceJobNode
"""
try... | 0.00692 |
def create_image(self, instance_id, image_name, tag_list=None):
'''
method for imaging an instance on AWS EC2
:param instance_id: string with AWS id of running instance
:param image_name: string with name to give new image
:param tag_list: [optional] list of resources tags ... | 0.004931 |
def __getDBNameForVersion(cls, dbVersion):
""" Generates the ClientJobs database name for the given version of the
database
Parameters:
----------------------------------------------------------------
dbVersion: ClientJobs database version number
retval: the ClientJobs database na... | 0.002401 |
def _copy(self, axis=True, attr=True, data=False):
"""Create a new instance of Data, but does not copy the data
necessarily.
Parameters
----------
axis : bool, optional
deep copy the axes (default: True)
attr : bool, optional
deep copy the attribu... | 0.001287 |
def update_keyboard_mapping(conn, e):
"""
Whenever the keyboard mapping is changed, this function needs to be called
to update xpybutil's internal representing of the current keysym table.
Indeed, xpybutil will do this for you automatically.
Moreover, if something is changed that affects the curren... | 0.00091 |
def get_fact_by_id(self, fact_id):
""" Obtains fact data by it's id.
As the fact is unique, it returns a tuple like:
(activity_id, start_time, end_time, description).
If there is no fact with id == fact_id, a NoHamsterData
exception will be raise
"""
columns = '... | 0.003195 |
def newBuild(self, requests):
"""Create a new Build instance.
@param requests: a list of buildrequest dictionaries describing what is
to be built
"""
b = self.buildClass(requests)
b.useProgress = self.useProgress
b.workdir = self.workdir
b.setStepFactorie... | 0.005714 |
def login(self):
"""
Logs into Reddit in order to display a personalised front page.
"""
data = {'user': self.options['username'], 'passwd':
self.options['password'], 'api_type': 'json'}
response = self.client.post('http://www.reddit.com/api/login', data=data)
... | 0.007712 |
def generate_snapshot(self, filename='snapshot.zip'):
"""
Generate and retrieve a policy snapshot from the engine
This is blocking as file is downloaded
:param str filename: name of file to save file to, including directory
path
:raises EngineCommandFailed: snapshot ... | 0.002865 |
def load_friends(self):
"""Fetches the MAL user friends page and sets the current user's friends attributes.
:rtype: :class:`.User`
:return: Current user object.
"""
user_friends = self.session.session.get(u'http://myanimelist.net/profile/' + utilities.urlencode(self.username) + u'/friends').text
... | 0.007371 |
def get_exptime(self, img):
"""Obtain EXPTIME"""
header = self.get_header(img)
if 'EXPTIME' in header.keys():
etime = header['EXPTIME']
elif 'EXPOSED' in header.keys():
etime = header['EXPOSED']
else:
etime = 1.0
return etime | 0.006452 |
def RegisterTextKey(cls, key, atomid):
"""Register a text key.
If the key you need to register is a simple one-to-one mapping
of MP4 atom name to EasyMP4Tags key, then you can use this
function::
EasyMP4Tags.RegisterTextKey("artist", "\xa9ART")
"""
def gette... | 0.003604 |
def get_url_authcode_flow_user(client_id, redirect_uri, display="page", scope=None, state=None):
"""Authorization Code Flow for User Access Token
Use Authorization Code Flow to run VK API methods from the server side of an application.
Access token received this way is not bound to an ip address but set of... | 0.0043 |
def create(self, argv):
"""Create a search job."""
opts = cmdline(argv, FLAGS_CREATE)
if len(opts.args) != 1:
error("Command requires a search expression", 2)
query = opts.args[0]
job = self.service.jobs.create(opts.args[0], **opts.kwargs)
print(job.sid) | 0.006369 |
def find_undeclared_variables(ast):
"""Returns a set of all variables in the AST that will be looked up from
the context at runtime. Because at compile time it's not known which
variables will be used depending on the path the execution takes at
runtime, all variables are returned.
>>> from jinja2... | 0.001043 |
def get_token(self):
"""Performs Neurio API token authentication using provided key and secret.
Note:
This method is generally not called by hand; rather it is usually
called as-needed by a Neurio Client object.
Returns:
string: the access token
"""
if self.__token is not None:
... | 0.004065 |
def send_explode(self):
"""
In earlier versions of the game, sending this caused your cells
to split into lots of small cells and die.
"""
self.send_struct('<B', 20)
self.player.own_ids.clear()
self.player.cells_changed()
self.ingame = False
self.s... | 0.005882 |
def storeServiceSpecialCase(st, pups):
"""
Adapt a store to L{IServiceCollection}.
@param st: The L{Store} to adapt.
@param pups: A list of L{IServiceCollection} powerups on C{st}.
@return: An L{IServiceCollection} which has all of C{pups} as children.
"""
if st.parent is not None:
... | 0.000709 |
def get_resource_cache(resourceid):
"""
Get a cached dictionary related to an individual resourceid.
:param resourceid: String resource id.
:return: dict
"""
if not resourceid:
raise ResourceInitError("Resource id missing")
if not DutInformationList._... | 0.004405 |
def _generateAlias(self):
"""Return an unused auth level alias"""
for i in range(1000):
alias = 'cust%d' % (i, )
if alias not in self.auth_level_aliases:
return alias
raise RuntimeError('Could not find an unused alias (tried 1000!)') | 0.006711 |
def to_fastq_str(self):
"""
:return: string representation of this NGS read in FastQ format
"""
return "@" + self.name + "\n" + self.sequenceData +\
"\n" + "+" + self.name + "\n" + self.seq_qual | 0.004525 |
def answerReceived(self, value, originalValue,
originalSender, originalTarget):
"""
An answer was received. Dispatch to the appropriate answer responder,
i.e. a method on this object exposed with L{answerMethod.expose}.
@see IDeliveryConsequence.answerReceived
... | 0.004224 |
def load_history(self):
"""Load upgrade history from database table.
If upgrade table does not exists, the history is assumed to be empty.
"""
if not self.history:
query = Upgrade.query.order_by(desc(Upgrade.applied))
for u in query.all():
self.h... | 0.00495 |
def run_bottleneck_on_image(sess, image_data, image_data_tensor,
decoded_image_tensor, resized_input_tensor,
bottleneck_tensor):
"""Runs inference on an image to extract the 'bottleneck' summary layer.
Args:
sess: Current active TensorFlow Session.
im... | 0.007168 |
def cylrec(r, lon, z):
"""
Convert from cylindrical to rectangular coordinates.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/cylrec_c.html
:param r: Distance of a point from z axis.
:type r: float
:param lon: Angle (radians) of a point from xZ plane.
:type lon: float
:param ... | 0.001468 |
def getsig_by_symbol_name(self, name: str) -> Signature:
""" Retrieve the unique Signature of a symbol.
Fail if the Signature is not unique
"""
subscope = self.get_by_symbol_name(name)
if len(subscope) != 1:
raise KeyError("%s have multiple candidates in scope" % name... | 0.005305 |
def cleanUpPparse(outputpath, rawfilename, mgf=False):
"""Delete temporary files generated by pparse, including the filetypes
".csv", ".ms1", ".ms2", ".xtract", the files "pParsePlusLog.txt" and
"pParse.para" and optionally also the ".mgf" file generated by pParse.
.. warning:
When the paramet... | 0.000554 |
def _TTA(learn:Learner, beta:float=0.4, scale:float=1.35, ds_type:DatasetType=DatasetType.Valid, with_loss:bool=False) -> Tensors:
"Applies TTA to predict on `ds_type` dataset."
preds,y = learn.get_preds(ds_type)
all_preds = list(learn.tta_only(scale=scale, ds_type=ds_type))
avg_preds = torch.stack(all_... | 0.036392 |
def populate_resource_columns(item_dict):
"""Operates on item_dict
Promotes the resource_name and resource_type fields to the
top-level of the serialization so they can be printed as columns.
Also makes a copies name field to type, which is a default column."""
item_dict['type']... | 0.00197 |
def getMetrics(self):
"""
Gets the current metric values
:returns: (dict) where each key is the metric-name, and the values are
it scalar value. Same as the output of
:meth:`~nupic.frameworks.opf.prediction_metrics_manager.MetricsManager.update`
"""
result = {}
f... | 0.010504 |
def course_discovery(request):
"""
Search for courses
Args:
request (required) - django request object
Returns:
http json response with the following fields
"took" - how many seconds the operation took
"total" - how many results were found
"max_score... | 0.002527 |
def _get_thumbnail_filename(filename, append_text="-thumbnail"):
"""
Returns a thumbnail version of the file name.
"""
name, ext = os.path.splitext(filename)
return ''.join([name, append_text, ext]) | 0.004587 |
def add(self, name, assumer, valuation, template_types, template_dests, template_start_standards, template_start_fees, template_add_standards, template_add_fees, session):
'''taobao.delivery.template.add 新增运费模板
新增运费模板'''
request = TOPRequest('taobao.delivery.template.add')
reque... | 0.004619 |
def show_network(self):
"""!
@brief Shows connections in the network. It supports only 2-d and 3-d representation.
"""
if ( (self._ccore_network_pointer is not None) and (self._osc_conn is None) ):
self._osc_conn = sync_connectivity_matrix(self._ccore... | 0.023125 |
def list_mapped_classes():
"""
Returns all the rdfclasses that have and associated elasticsearch
mapping
Args:
None
"""
cls_dict = {key: value
for key, value in MODULE.rdfclass.__dict__.items()
if not isinst... | 0.001828 |
def _prepare_atoms(topology, compute_cycles=False):
"""Compute cycles and add white-/blacklists to atoms."""
atom1 = next(topology.atoms())
has_whitelists = hasattr(atom1, 'whitelist')
has_cycles = hasattr(atom1, 'cycles')
compute_cycles = compute_cycles and not has_cycles
if compute_cycles or ... | 0.001056 |
def build_blast_cmd(self, fname, dbname):
"""Return BLASTN command"""
return self.funcs.blastn_func(fname, dbname, self.outdir, self.exes.blast_exe) | 0.018293 |
def _cnf(lexer, varname):
"""Return a DIMACS CNF."""
_expect_token(lexer, {KW_p})
_expect_token(lexer, {KW_cnf})
nvars = _expect_token(lexer, {IntegerToken}).value
nclauses = _expect_token(lexer, {IntegerToken}).value
return _cnf_formula(lexer, varname, nvars, nclauses) | 0.003401 |
def populate_resource_list(self):
"""Populate the list resource list.
"""
minimum_needs = self.minimum_needs.get_full_needs()
for full_resource in minimum_needs["resources"]:
self.add_resource(full_resource)
self.provenance.setText(minimum_needs["provenance"]) | 0.00641 |
def makeThumbnail(cls, inputFile, person, format, smaller):
"""
Make a thumbnail of a mugshot image and store it on disk.
@param inputFile: The image to thumbnail.
@type inputFile: C{file}
@param person: The person this mugshot thumbnail is associated with.
@type person... | 0.00177 |
def save_x509s(self, x509s):
"""Saves the x509 objects to the paths known by this bundle"""
for file_type in TLSFileType:
if file_type.value in x509s:
x509 = x509s[file_type.value]
if file_type is not TLSFileType.CA:
# persist this key or ... | 0.004274 |
def add_cylinder(self, name, position, sizes, mass, precision=[10, 10]):
""" Add Cylinder """
self._create_pure_shape(2, 239, sizes, mass, precision)
self.set_object_position("Cylinder", position)
self.change_object_name("Cylinder", name) | 0.007407 |
def setSignalHeaders(self, signalHeaders):
"""
Sets the parameter for all signals
Parameters
----------
signalHeaders : array_like
containing dict with
'label' : str
channel label (string, <= 16 characters, must be unique)
... | 0.003759 |
def parse_xml_node(self, node):
'''Parse an xml.dom Node object representing a configuration set into
this object.
'''
self.id = node.getAttributeNS(RTS_NS, 'id')
self._config_data = []
for d in node.getElementsByTagNameNS(RTS_NS, 'ConfigurationData'):
self._... | 0.005038 |
def window(self, window):
"""
This method does the following:
1. Switches to the given window (it can be located by window instance/lambda/string).
2. Executes the given block (within window located at previous step).
3. Switches back (this step will be invoked even if exception... | 0.006873 |
def transform(source):
'''Used to convert the source code, making use of known transformers.
"transformers" are modules which must contain a function
transform_source(source)
which returns a tranformed source.
Some transformers (for example, those found in the standard library
... | 0.000532 |
def sign_attribute_query(self, statement, **kwargs):
"""Sign a SAML attribute query.
See sign_statement() for the kwargs.
:param statement: The statement to be signed
:return: The signed statement
"""
return self.sign_statement(
statement, class_name(sam... | 0.005698 |
def hashing_trick(X_in, hashing_method='md5', N=2, cols=None, make_copy=False):
"""A basic hashing implementation with configurable dimensionality/precision
Performs the hashing trick on a pandas dataframe, `X`, using the hashing method from hashlib
identified by `hashing_method`. The number o... | 0.002636 |
def get_records(self, start_time, end_time, msgid=1,
number=10000):
"""
获取客服聊天记录
:param start_time: 查询开始时间,UNIX 时间戳
:param end_time: 查询结束时间,UNIX 时间戳,每次查询不能跨日查询
:param msgid: 消息id顺序从小到大,从1开始
:param number: 每次获取条数,最多10000条
:return: 返回的 JSON 数据包... | 0.003378 |
def _populate(self, json):
"""
A helper method that, given a JSON object representing this object,
assigns values based on the properties dict and the attributes of
its Properties.
"""
if not json:
return
# hide the raw JSON away in case someone needs... | 0.004589 |
def is_tuple(node):
"""Does the node represent a tuple literal?"""
if isinstance(node, Node) and node.children == [LParen(), RParen()]:
return True
return (isinstance(node, Node)
and len(node.children) == 3
and isinstance(node.children[0], Leaf)
and isinstance(nod... | 0.002058 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.