text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def toc(self):
"""
Returns table of contents as a block_token.List instance.
"""
from mistletoe.block_token import List
def get_indent(level):
if self.omit_title:
level -= 1
return ' ' * 4 * (level - 1)
def build_list_item(heading)... | 0.005338 |
def is_git_file(cls, path, name):
"""Determine if file is known by git."""
os.chdir(path)
p = subprocess.Popen(['git', 'ls-files', '--error-unmatch', name],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.wait()
return p.returncode == 0 | 0.006515 |
def l2traceroute_input_protocolType_IP_l4_dest_port(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
l2traceroute = ET.Element("l2traceroute")
config = l2traceroute
input = ET.SubElement(l2traceroute, "input")
protocolType = ET.SubElement(... | 0.003378 |
def match(self, sampling_req):
"""
Determines whether or not this sampling rule applies to the incoming
request based on some of the request's parameters.
Any ``None`` parameter provided will be considered an implicit match.
"""
if sampling_req is None:
return... | 0.003175 |
def read_playlist_file(self, stationFile=''):
""" Read a csv file
Returns: number
x - number of stations or
-1 - playlist is malformed
-2 - playlist not found
"""
prev_file = self.stations_file
prev_format = self.new_... | 0.003257 |
def toxlsx(tbl, filename, sheet=None, encoding=None):
"""
Write a table to a new Excel .xlsx file.
"""
import openpyxl
if encoding is None:
encoding = locale.getpreferredencoding()
wb = openpyxl.Workbook(write_only=True)
ws = wb.create_sheet(title=sheet)
for row in tbl:
... | 0.002801 |
def get_pulls(self, state=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, base=github.GithubObject.NotSet, head=github.GithubObject.NotSet):
"""
:calls: `GET /repos/:owner/:repo/pulls <http://developer.github.com/v3/pulls>`_
:param state: string... | 0.00575 |
def stash(self, storage, url):
"""Stores the uploaded file in a temporary storage location."""
result = {}
if self.is_valid():
upload = self.cleaned_data['upload']
name = storage.save(upload.name, upload)
result['filename'] = os.path.basename(name)
... | 0.00369 |
def put(self, url, params=None, headers=None, content=None, form_content=None):
# type: (str, Optional[Dict[str, str]], Optional[Dict[str, str]], Any, Optional[Dict[str, Any]]) -> ClientRequest
"""Create a PUT request object.
:param str url: The request URL.
:param dict params: Request ... | 0.009294 |
def query(database, query, **client_args):
'''
Execute a query.
database
Name of the database to query on.
query
InfluxQL query string.
'''
client = _client(**client_args)
_result = client.query(query, database=database)
if isinstance(_result, collections.Sequence):
... | 0.004202 |
def get_indexed_node(manager, prop, value, node_type='Node', lookup_func='CONTAINS', legacy=True):
"""
:param manager: Neo4jDBSessionManager
:param prop: Indexed property
:param value: Indexed value
:param node_type: Label used for index
:param lookup_func: STARTS WITH | CONTAINS | ENDS WITH
... | 0.002062 |
def get_regularization_penalty(self) -> Union[float, torch.Tensor]:
"""
Computes the regularization penalty for the model.
Returns 0 if the model was not configured to use regularization.
"""
if self._regularizer is None:
return 0.0
else:
return se... | 0.005865 |
def to_half(b:Collection[Tensor])->Collection[Tensor]:
"Recursively map lists of tensors in `b ` to FP16."
if is_listy(b): return [to_half(o) for o in b]
return b.half() if b.dtype not in [torch.int64, torch.int32, torch.int16] else b | 0.020325 |
def remove_token(self, *, payer_id, credit_card_token_id):
"""
This feature allows you to delete a tokenized credit card register.
Args:
payer_id:
credit_card_token_id:
Returns:
"""
payload = {
"language": self.client.language.value,... | 0.002591 |
def acctran(tree, character, feature=PARS_STATES):
"""
ACCTRAN (accelerated transformation) (Farris, 1970) aims at reducing the number of ambiguities
in the parsimonious result. ACCTRAN forces the state changes to be performed as close to the root as possible,
and therefore prioritises the reverse mutat... | 0.004313 |
def stop():
''' Stop KodeDrive daemon. '''
output, err = cli_syncthing_adapter.sys(exit=True)
click.echo("%s" % output, err=err) | 0.02963 |
def InputSplines(seq_length, n_bases=10, name=None, **kwargs):
"""Input placeholder for array returned by `encodeSplines`
Wrapper for: `keras.layers.Input((seq_length, n_bases), name=name, **kwargs)`
"""
return Input((seq_length, n_bases), name=name, **kwargs) | 0.00722 |
def from_offset(cls, chunk_type, stream_rdr, offset):
"""
Return a _pHYsChunk instance containing the image resolution
extracted from the pHYs chunk in *stream* at *offset*.
"""
horz_px_per_unit = stream_rdr.read_long(offset)
vert_px_per_unit = stream_rdr.read_long(offset... | 0.004098 |
def name(self):
"""Get the name associated with these credentials"""
return self.inquire(name=True, lifetime=False,
usage=False, mechs=False).name | 0.010526 |
def get_output(self, buildroot_id):
"""
Build the 'output' section of the metadata.
:return: list, Output instances
"""
def add_buildroot_id(output):
logfile, metadata = output
metadata.update({'buildroot_id': buildroot_id})
return Output(fil... | 0.001695 |
def directory_duplicates(directory, hash_type='md5', **kwargs):
"""
Find all duplicates in a directory. Will return a list, in that list
are lists of duplicate files.
.. code: python
dups = reusables.directory_duplicates('C:\\Users\\Me\\Pictures')
print(len(dups))
# 56
... | 0.00088 |
def init_poolmanager(self, connections, maxsize, block=DEFAULT_POOLBLOCK, **pool_kwargs):
"""Initializes a urllib3 PoolManager.
This method should not be called from user code, and is only
exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
... | 0.004193 |
def build_swagger_12_endpoints(resource_listing, api_declarations):
"""
:param resource_listing: JSON representing a Swagger 1.2 resource listing
:type resource_listing: dict
:param api_declarations: JSON representing Swagger 1.2 api declarations
:type api_declarations: dict
:rtype: iterable of ... | 0.001575 |
def parse_yaml(self, y):
'''Parse a YAML specification of a condition into this object.'''
self.sequence = int(y['sequence'])
self.target_component = \
TargetExecutionContext().parse_yaml(y['targetComponent'])
if RTS_EXT_NS_YAML + 'properties' in y:
for p in y... | 0.005396 |
def render_to_console(self, message: str, **kwargs):
"""
Renders the specified message to the console using Jinja2 template
rendering with the kwargs as render variables. The message will also
be dedented prior to rendering in the same fashion as other Cauldron
template rendering... | 0.003356 |
def artifacts(self):
"""
Property for accessing artifact manager of the current job.
:return: instance of :class:`yagocd.resources.artifact.ArtifactManager`
:rtype: yagocd.resources.artifact.ArtifactManager
"""
return ArtifactManager(
session=self._session,
... | 0.00365 |
def name(self):
"""Table name used in requests.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_table_name]
:end-before: [END bigtable_table_name]
.. note::
This property will not change if ``table_id`` does not, but ... | 0.002463 |
def _read_file(self, filename):
"""
read a Python object from a cache file.
Reads a pickled object from disk and returns it.
:param filename: Name of the file that should be read.
:type filename: str
:rtype: object
"""
if self.__compression:
... | 0.004246 |
def cursor(self):
"""
Create a new ``Cursor`` instance associated with this ``Connection``
:return: A new ``Cursor`` instance
"""
self._assert_valid()
c = Cursor(self.impl.cursor())
self.cursors.add(c)
return c | 0.007273 |
def get_splice_data():
"""
Load the mushroom dataset, split it into X and y, and then call the label encoder to get an integer y column.
:return:
"""
df = pd.read_csv('source_data/splice/splice.csv')
X = df.reindex(columns=[x for x in df.columns.values if x != 'class'])
X['dna'] = X['dna']... | 0.002882 |
def check_inclusions(item, included=[], excluded=[]):
"""Everything passes if both are empty, otherwise, we have to check if \
empty or is present."""
if (len(included) == 0):
if len(excluded) == 0 or item not in excluded:
return True
else:
return False
else:
... | 0.002597 |
def _recursive_terminate_without_psutil(process):
"""Terminate a process and its descendants.
"""
try:
_recursive_terminate(process.pid)
except OSError as e:
warnings.warn("Failed to kill subprocesses on this platform. Please"
"install psutil: https://github.com/gia... | 0.002033 |
def calculate(self, **state):
"""
Calculate the density at the specified temperature, pressure, and
composition.
:param T: [K] temperature
:param P: [Pa] pressure
:param x: [mole fraction] dictionary of compounds and mole fractions
:returns: [kg/m3] density
... | 0.002751 |
def get_object(self):
"""Implements the GetObjectMixin interface and calls
:meth:`DBObjectMixin.get_query`. Using this mixin requires usage of
a response handler capable of serializing SQLAlchemy query result objects.
:returns: Typically a SQLALchemy Query result.
:rtype: mixed... | 0.004975 |
async def start_serving(self,
connection_config: ConnectionConfig,
loop: Optional[asyncio.AbstractEventLoop] = None) -> None:
"""
Start serving this :class:`~lahja.endpoint.Endpoint` so that it can receive events. Await
until the :class:`~l... | 0.012931 |
def _x_credentials_parser(credentials, data):
"""
We need to override this method to fix Facebooks naming deviation.
"""
# Facebook returns "expires" instead of "expires_in".
credentials.expire_in = data.get('expires')
if data.get('token_type') == 'bearer':
... | 0.004484 |
def set_popup_menu(self, menu):
'''set a popup menu on the frame'''
self.popup_menu = menu
self.in_queue.put(MPImagePopupMenu(menu)) | 0.012821 |
def main(argv=None):
'''TEST ONLY: this is called if run from command line'''
parser = argparse.ArgumentParser()
parser.add_argument('-i','--input_file', required=True)
parser.add_argument('--input_file_format', default='sequence')
parser.add_argument('--input_data_type', default='json')
parser... | 0.00875 |
def _compare_vector(arr1, arr2, rel_tol):
"""
Compares two vectors (python lists) for approximate equality.
Each array contains floats or strings convertible to floats
This function returns True if both arrays are of the same length
and each value is within the given relative tolerance.
"""
... | 0.001267 |
def iter_transform(filename, key):
"""Generate encrypted file with given key.
This generator function reads the file
in chunks and encrypts them using AES-CTR,
with the specified key.
:param filename: The name of the file to encrypt.
:type filename: str
:param key: The key used to encrypt ... | 0.001464 |
def _get_ngrams(n, text):
"""Calculates n-grams.
Args:
n: which n-grams to calculate
text: An array of tokens
Returns:
A set of n-grams
"""
ngram_set = set()
text_length = len(text)
max_index_ngram_start = text_length - n
for i in range(max_index_ngram_start + 1):
ngram_set.add(tuple(t... | 0.01983 |
def _ssl_login(self):
"""
Authenticate to the /ssllogin endpoint with Client SSL authentication.
:returns: deferred that when fired returns a dict from sslLogin
"""
method = treq.post
agent = self._ssl_agent()
return self._request_login(method, agent=agent) | 0.006369 |
def rm_filesystems(name, device, config='/etc/filesystems'):
'''
.. versionadded:: 2018.3.3
Remove the mount point from the filesystems
CLI Example:
.. code-block:: bash
salt '*' mount.rm_filesystems /mnt/foo /dev/sdg
'''
modified = False
view_lines = []
if 'AIX' not in ... | 0.002143 |
def base_path(main_path, fmt):
"""Given a path and options for a format (ext, suffix, prefix), return the corresponding base path"""
if not fmt:
return os.path.splitext(main_path)[0]
fmt = long_form_one_format(fmt)
fmt_ext = fmt['extension']
suffix = fmt.get('suffix')
prefix = fmt.get('... | 0.003836 |
def merged_series(cls, *series, **kwargs):
'''Merge ``series`` and return the results without storing data
in the backend server.'''
router, backend = cls.check_router(None, *series)
if backend:
target = router.register(cls(), backend)
router.session().add(target)
... | 0.003717 |
def _call(self, target, method, target_class=None, single_result=True, raw=False, files=None, **kwargs):
"""
Low-level call to HasOffers API.
:param target_class: type of resulting object/objects.
"""
if target_class is None:
target_class = target
params = pre... | 0.005566 |
def compare(referenceOnto, somegraph):
"""
Desc
"""
spy1 = Ontology(referenceOnto)
spy2 = Ontology(somegraph)
class_comparison = {}
for x in spy2.allclasses:
if x not in spy1.allclasses:
class_comparison[x] = False
else:
class_comparison[x] = True
prop_comparison = {}
for x in spy2.allinferredprop... | 0.052083 |
def process_command_thread(self, request):
"""Worker thread to process a command.
"""
command, data = request
if multi_thread_enabled():
try:
self.process_command(command, data)
except Exception as e:
_logger.exception(str(e))
... | 0.00545 |
def random_draft(card_class: CardClass, exclude=[]):
"""
Return a deck of 30 random cards for the \a card_class
"""
from . import cards
from .deck import Deck
deck = []
collection = []
# hero = card_class.default_hero
for card in cards.db.keys():
if card in exclude:
continue
cls = cards.db[card]
if ... | 0.036635 |
def upgrade():
"""Upgrade database."""
# Variant types:
def created():
"""Return instance of a column."""
return sa.Column(
'created',
sa.DateTime().with_variant(mysql.DATETIME(fsp=6), 'mysql'),
nullable=False
)
def updated():
"""Retur... | 0.000157 |
def recentDF(token='', version=''):
'''https://iexcloud.io/docs/api/#stats-recent
Args:
token (string); Access token
version (string); API version
Returns:
DataFrame: result
'''
df = pd.DataFrame(recent(token, version))
_toDatetime(df)
_reindex(df, 'date')
retur... | 0.003086 |
def fetch(url, body=None, headers=None):
"""Invoke the fetch method on the default fetcher. Most users
should need only this method.
@raises Exception: any exceptions that may be raised by the default fetcher
"""
fetcher = getDefaultFetcher()
return fetcher.fetch(url, body, headers) | 0.003247 |
def check(self, results_id):
"""Check for results of a membership request.
:param str results_id: the ID of a membership request
:return: successfully created memberships
:rtype: :class:`list`
:raises groupy.exceptions.ResultsNotReady: if the results are not ready
:raise... | 0.002646 |
def handle_template(bot_or_project, name, target=None, **options):
"""
Copy either a bot layout template or a Trading-Bots project
layout template into the specified directory.
:param bot_or_project: The string 'bot' or 'project'.
:param name: The name of the bot or project.
:param target: The d... | 0.0008 |
def get_freesurfer_cmap(vis_type):
"""Provides different colormaps for different visualization types."""
if vis_type in ('cortical_volumetric', 'cortical_contour'):
LUT = get_freesurfer_cortical_LUT()
cmap = ListedColormap(LUT)
elif vis_type in ('labels_volumetric', 'labels_contour'... | 0.003759 |
def start_capture(self, port_number, output_file, data_link_type="DLT_EN10MB"):
"""
Starts a packet capture.
:param port_number: allocated port number
:param output_file: PCAP destination file for the capture
:param data_link_type: PCAP data link type (DLT_*), default is DLT_EN1... | 0.00733 |
def make_doc_id_range(doc_id):
'''Construct a tuple(begin, end) of one-tuple kvlayer keys from a
hexdigest doc_id.
'''
assert len(doc_id) == 32, 'expecting 32 hex string, not: %r' % doc_id
bin_docid = base64.b16decode(doc_id.upper())
doc_id_range = ((bin_docid,), (bin_docid,))
return doc_id... | 0.003067 |
def decode_ulid(value: str) -> bytes:
"""
Decode the given Base32 encoded :class:`~str` instance to :class:`~bytes`.
.. note:: This uses an optimized strategy from the `NUlid` project for decoding ULID
strings specifically and is not meant for arbitrary decoding.
:param value: String to decode... | 0.003925 |
def create_from_response_pdu(resp_pdu):
""" Create instance from response PDU.
:param resp_pdu: Byte array with request PDU.
:return: Instance of :class:`WriteSingleCoil`.
"""
write_single_coil = WriteSingleCoil()
address, value = struct.unpack('>HH', resp_pdu[1:5])
... | 0.004149 |
def apply_to_with_tz(self, dttm, timezone):
"""We make sure that after truncating we use the correct timezone,
even if we 'jump' over a daylight saving time switch.
I.e. if we apply "@d" to `Sun Oct 30 04:30:00 CET 2016` (1477798200)
we want to have `Sun Oct 30 00:00:00 CEST 2016` (1477... | 0.003145 |
def via(self, *args):
"""
Creates an empty error to record in the stack
trace
"""
error = None
if len(self.errors) > 0:
error = self._err("via", *args)
return error | 0.008621 |
def product(target, prop1, prop2, **kwargs):
r"""
Calculates the product of multiple property values
Parameters
----------
target : OpenPNM Object
The object which this model is associated with. This controls the
length of the calculated array, and also provides access to other
... | 0.001272 |
def police_priority_map_exceed_map_pri6_exceed(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
police_priority_map = ET.SubElement(config, "police-priority-map", xmlns="urn:brocade.com:mgmt:brocade-policer")
name_key = ET.SubElement(police_priority_map, ... | 0.004608 |
def get_broadcast(self, broadcast_guid, **kwargs):
'''
Get a specific broadcast by guid
'''
params = kwargs
broadcast = self._call('broadcasts/%s' % broadcast_guid,
params=params, content_type='application/json')
return Broadcast(broadcast) | 0.01 |
def edit( plugins, parent = None, default = None, modal = True ):
"""
Prompts the user to edit the config settings for the inputed config \
plugins.
:param plugins | [<XConfigPlugin>, ..]
parent | <QWidget>
default | <XConfigPlugin> ... | 0.025 |
def init_widget(self):
""" Initialize the underlying widget.
This reads all items declared in the enamldef block for this node
and sets only the values that have been specified. All other values
will be left as default. Doing it this way makes atom to only create
the properties ... | 0.002016 |
def import_from_xml(self, xml):
'''
Standard imports for all types of object
These must fail gracefully, skip if not found
'''
self._import_orgid(xml)
self._import_parents_from_xml(xml)
self._import_instances_from_xml(xml)
self._import_common_name(xml)
... | 0.005195 |
def reset(self):
"""
Process everything all over again.
"""
self.indexCount = 0
indexDir = self.store.newDirectory(self.indexDirectory)
if indexDir.exists():
indexDir.remove()
for src in self.getSources():
src.removeReliableListener(self)
... | 0.005249 |
def extend(self, values):
"""
Extend the list by appending all elements from the *values*. Raises a
ValueError if the sort order would be violated.
"""
_maxes, _lists, _load = self._maxes, self._lists, self._load
if not isinstance(values, list):
values = list... | 0.001991 |
def _format_notes(self, record):
"""
Extracts notes from a record and reformats them in a simplified format.
"""
notes = []
if "notes" in record:
for note in record["notes"]:
self._append_note_dict_to_list(notes, "general", note)
if "language... | 0.003128 |
def execs(root=None):
'''
.. versionadded:: 2014.7.0
Return a list of all files specified as ``ExecStart`` for all services.
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
salt '*' service.execs
'''
ret = {}
for service in get_all(roo... | 0.002045 |
def yield_module_imports(root, checks=string_imports()):
"""
Gather all require and define calls from unbundled JavaScript source
files and yield all module names. The imports can either be of the
CommonJS or AMD syntax.
"""
if not isinstance(root, asttypes.Node):
raise TypeError('prov... | 0.001779 |
def _Region1(T, P):
"""Basic equation for region 1
Parameters
----------
T : float
Temperature, [K]
P : float
Pressure, [MPa]
Returns
-------
prop : dict
Dict with calculated properties. The available properties are:
* v: Specific volume, [m³/kg]
... | 0.000577 |
def resolve_out(self, ins):
"""
Determine which stream the output is synchronised with. If the incoming streams have different sync values, then
it is unknown what synchronisation the outgoing stream should have.
:param ins: dictionary of the incoming streams' sync values
:ret... | 0.009091 |
def to_timestamp(dt):
"""Convert a datetime object to a unix timestamp.
Note that unlike a typical unix timestamp, this is seconds since 1970
*local time*, not UTC.
If the passed in object is already a timestamp, then that value is
simply returned unmodified.
"""
if isinstance(dt, int):
... | 0.002288 |
def load_method(path,method,class_name = None,instance_creator = None):
'''
Returns an instance of the method specified.
Args :
path : The path to the module contianing the method or function.
method : The name of the function.
class_name ... | 0.022422 |
def gx_coords(node):
"""
Given a KML DOM node, grab its <gx:coord> and <gx:timestamp><when>subnodes, and convert them into a dictionary with the keys and values
- ``'coordinates'``: list of lists of float coordinates
- ``'times'``: list of timestamps corresponding to the coordinates
"""
els = ... | 0.00346 |
async def xinfo_consumers(self, name: str, group: str) -> list:
"""
[NOTICE] Not officially released yet
XINFO command is an observability interface that can be used
with sub-commands in order to get information
about streams or consumer groups.
:param name: name of the... | 0.004329 |
def translate_point(self, point):
""" Translate world coordinates and return screen coordinates. Respects zoom level
Will be returned as tuple.
:rtype: tuple
"""
mx, my = self.get_center_offset()
if self._zoom_level == 1.0:
return point[0] + mx, point[1] + ... | 0.008811 |
def facet_freq_plot(freq_csv, caller):
"""Prepare a facet plot of frequencies stratified by variant type and status (TP, FP, FN).
Makes a nice plot with the output from validate.freq_summary
"""
out_file = "%s.png" % os.path.splitext(freq_csv)[0]
plt.ioff()
sns.set(style='dark')
df = pd.rea... | 0.002717 |
def select_as_multiple(self, keys, where=None, selector=None, columns=None,
start=None, stop=None, iterator=False,
chunksize=None, auto_close=False, **kwargs):
""" Retrieve pandas objects from multiple tables
Parameters
----------
ke... | 0.001222 |
def qteAbort(self, msgObj):
"""
Restore the original cursor position because the user hit abort.
"""
self.qteWidget.setCursorPosition(*self.cursorPosOrig)
self.qteMain.qtesigAbort.disconnect(self.qteAbort) | 0.008163 |
def _read_channel(stream, num, name, ctype, epoch, start, end,
scaled=True, series_class=TimeSeries):
"""Read a channel from a specific frame in a stream
"""
data = _get_frdata(stream, num, name, ctype=ctype)
return read_frdata(data, epoch, start, end,
scaled=sca... | 0.002849 |
def get_queryset(self):
"""
Retrieve the author by his username and
build a queryset of his published entries.
"""
self.author = get_object_or_404(
Author, **{Author.USERNAME_FIELD: self.kwargs['username']})
return self.author.entries_published() | 0.006536 |
def get(self, bucket=None, versions=missing, uploads=missing):
"""Get list of objects in the bucket.
:param bucket: A :class:`invenio_files_rest.models.Bucket` instance.
:returns: The Flask response.
"""
if uploads is not missing:
return self.multipart_listuploads(bu... | 0.005089 |
def insert(self, name, index, value):
"""Insert a value at the passed index in the named header."""
return self._sequence[name].insert(index, value) | 0.012195 |
def parse_package_json():
"""
Extract the JSPM configuration from package.json.
"""
with open(locate_package_json()) as pjson:
data = json.loads(pjson.read())
return data | 0.005051 |
def height(self):
"""Returns the player's height (in inches).
:returns: An int representing a player's height in inches.
"""
doc = self.get_main_doc()
raw = doc('span[itemprop="height"]').text()
try:
feet, inches = map(int, raw.split('-'))
return f... | 0.005155 |
def create(self, **kwargs):
"""Custom create method to accommodate different endpoint behavior."""
self._check_create_parameters(**kwargs)
if kwargs['extractFromAllItems'] is False:
self._meta_data['minimum_additional_parameters'] = {
'extractFromRegularExpression', '... | 0.004566 |
def send_image(self, sender, receiver_type, receiver_id, media_id):
"""
发送图片消息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param sender: 发送人
:param receiver_type: 接收人类型:single|group,分别表示:单聊|群聊
:param receiver_id: 接收人的值,为userid|chatid,分别表示:成员... | 0.002677 |
def HuntIDToInt(hunt_id):
"""Convert hunt id string to an integer."""
# TODO(user): This code is only needed for a brief period of time when we
# allow running new rel-db flows with old aff4-based hunts. In this scenario
# parent_hunt_id is effectively not used, but it has to be an
# integer. Stripping "H:" f... | 0.017391 |
def ticker(self, pair, ignore_invalid=0):
"""
This method provides all the information about currently active pairs, such as: the maximum price,
the minimum price, average price, trade volume, trade volume in currency, the last trade, Buy and Sell price.
All information is provided over ... | 0.010274 |
def redefine_position(self, position):
"""Redefines the current position to the new position.
:param position: The new position.
"""
cmd = 'MOVE', [Float, Integer]
self._write(cmd, position, 2) | 0.008511 |
def instance():
"""Returns a global `IOLoop` instance.
Most applications have a single, global `IOLoop` running on the
main thread. Use this method to get this instance from
another thread. To get the current thread's `IOLoop`, use `current()`.
"""
if not hasattr(IOLoo... | 0.003552 |
def posterior_samples_f(self, X, size=10, full_cov=True, **predict_kwargs):
"""
Samples the posterior TP at the points X.
:param X: The points at which to take the samples.
:type X: np.ndarray (Nnew x self.input_dim)
:param size: the number of a posteriori samples.
:type... | 0.00358 |
def create_from_targets(self,list_targs):
"""
Adds new targets to the span that are defined in a list
@type list_targs: list
@param list_targs: list of Ctargets
"""
for this_target in list_targs:
self.node.append(this_target.get_node()) | 0.010135 |
def merge_runs(data, digits=None):
"""
Merge duplicate sequential values. This differs from unique_ordered
in that values can occur in multiple places in the sequence, but
only consecutive repeats are removed
Parameters
-----------
data: (n,) float or int
Returns
--------
merge... | 0.001258 |
def threshold_otsu(image, multiplier=1.0):
"""Return image thresholded using Otsu's method.
"""
otsu_value = skimage.filters.threshold_otsu(image)
return image > otsu_value * multiplier | 0.004975 |
def show(self, commits=None, encoding='utf-8'):
"""Show the data of a set of commits.
The method returns the output of Git show command for a
set of commits using the following options:
git show --raw --numstat --pretty=fuller --decorate=full
--parents -M -C -c [<co... | 0.001349 |
def ext_xsect(scatterer, h_pol=True):
"""Extinction cross section for the current setup, with polarization.
Args:
scatterer: a Scatterer instance.
h_pol: If True (default), use horizontal polarization.
If False, use vertical polarization.
Returns:
The extinction cross s... | 0.005709 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.