text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _fromData(cls, header, tflags, data):
"""Construct this ID3 frame from raw string data.
Raises:
ID3JunkFrameError in case parsing failed
NotImplementedError in case parsing isn't implemented
ID3EncryptionUnsupportedError in case the frame is encrypted.
"""
... | 0.000795 |
def validate_structure(reference_intervals, reference_labels,
estimated_intervals, estimated_labels):
"""Checks that the input annotations to a structure estimation metric (i.e.
one that takes in both segment boundaries and their labels) look like valid
segment times and labels, and t... | 0.000476 |
def length_prepend(byte_string):
'''
bytes -> bytes
'''
length = tx.VarInt(len(byte_string))
return length.to_bytes() + byte_string | 0.006623 |
def delete(self, name=None):
"Delete the shelve data file."
logger.info('clearing shelve data')
self.close()
for path in Path(self.create_path.parent, self.create_path.name), \
Path(self.create_path.parent, self.create_path.name + '.db'):
logger.debug(f'clearing {... | 0.006881 |
def release_api_class(self):
"""Github Release API class."""
cls = current_app.config['GITHUB_RELEASE_CLASS']
if isinstance(cls, string_types):
cls = import_string(cls)
assert issubclass(cls, GitHubRelease)
return cls | 0.007435 |
def checkattr(metacls, attr, value):
"""
Only allow class attributes that are instances of
rootpy.types.Column, ROOT.TObject, or ROOT.ObjectProxy
"""
if not isinstance(value, (
types.MethodType,
types.FunctionType,
classmethod,
... | 0.00155 |
def raw_p_sha1(secret, seed, sizes=()):
"""
Derive one or more keys from secret and seed.
(See specs part 6, 6.7.5 and RFC 2246 - TLS v1.0)
Lengths of keys will match sizes argument
Source: https://github.com/FreeOpcUa/python-opcua
key_sizes = (signature_key_size, symmetric_key_size, 16)
(s... | 0.001346 |
async def setup_streamer(self):
"""Sets up basic defaults for the streamer"""
self.streamer.volume = self.volume / 100
self.streamer.start()
self.pause_time = None
self.vclient_starttime = self.vclient.loop.time()
# Cache next song
self.logger.debug("Caching nex... | 0.004662 |
def command(self):
'''Command used to launch this application module'''
cmd = self.config.get('command', None)
if cmd is None:
return
cmd = cmd[platform]
return cmd['path'], cmd['args'] | 0.008368 |
def orient_undirected_graph(self, data, umg, alg='HC'):
"""Orient the undirected graph using GNN and apply CGNN to improve the graph.
Args:
data (pandas.DataFrame): Observational data on which causal
discovery has to be performed.
umg (nx.Graph): Graph that provid... | 0.005376 |
def get_package_update_list(package_name, version):
"""
Return update information of a package from a given version
:param package_name: string
:param version: string
:return: dict
"""
package_version = semantic_version.Version.coerce(version)
# Get package and version data from pypi
... | 0.003239 |
def editComment(self, repo_user, repo_name, comment_id, body):
"""
PATCH /repos/:owner/:repo/pulls/comments/:id
:param comment_id: The ID of the comment to edit
:param body: The new body of the comment.
"""
return self.api.makeRequest(
["repos", repo_user, re... | 0.004535 |
def merge_entity(self, table_name, entity, if_match='*', timeout=None):
'''
Updates an existing entity by merging the entity's properties. Throws
if the entity does not exist.
This operation does not replace the existing entity as the update_entity
operation does. A pr... | 0.00859 |
def enrich(self, column1, column2):
""" This class splits those commits where column1 and column2
values are different
:param column1: column to compare to column2
:param column2: column to compare to column1
:type column1: string
:type column2: string
:returns:... | 0.001714 |
def user_cache_dir(appname):
# type: (str) -> str
r"""
Return full path to the user-specific cache dir for this application.
"appname" is the name of application.
Typical user cache directories are:
macOS: ~/Library/Caches/<AppName>
Unix: ~/.cache/<AppName> (XDG defa... | 0.000574 |
def write_preferences_file(self):
"""
Write json preferences file to (platform specific) user data directory,
or PmagPy directory if appdirs module is missing.
"""
user_data_dir = find_pmag_dir.find_user_data_dir("thellier_gui")
if not os.path.exists(user_data_dir):
... | 0.00487 |
def getTrackedDeviceIndexForControllerRole(self, unDeviceType):
"""Returns the device index associated with a specific role, for example the left hand or the right hand. This function is deprecated in favor of the new IVRInput system."""
fn = self.function_table.getTrackedDeviceIndexForControllerRole
... | 0.008021 |
def _call_connection_lost_and_clean_up(self, exc):
"""
Clean up all resources and call the protocols connection lost method.
"""
self._state = _State.CLOSED
try:
self._protocol.connection_lost(exc)
finally:
self._rawsock.close()
if sel... | 0.003781 |
def topic_inject(self, topic_name, _msg_content=None, **kwargs):
"""
Injecting message into topic. if _msg_content, we inject it directly. if not, we use all extra kwargs
:param topic_name: name of the topic
:param _msg_content: optional message content
:param kwargs: each extra ... | 0.008467 |
def get_integer_index(
miller_index: bool, round_dp: int = 4, verbose: bool = True
) -> Tuple[int, int, int]:
"""
Attempt to convert a vector of floats to whole numbers.
Args:
miller_index (list of float): A list miller indexes.
round_dp (int, optional): The number of decimal places to ... | 0.000496 |
def determine_target_roots(self, goal_name):
"""Helper for tasks that scan for default target roots.
:param string goal_name: The goal name to use for any warning emissions.
"""
if not self.context.target_roots:
print('WARNING: No targets were matched in goal `{}`.'.format(goal_name), file=sys.st... | 0.008977 |
def upload_as_zip(name, filename):
"""
Upload an IPList as a zip file. Useful when IPList is very large.
This is the default upload format for IPLists.
:param str name: name of IPList
:param str filename: name of zip file to upload, full path
:return: None
"""
location = list(IPList.obj... | 0.002315 |
def gen_input_add(sig_dic):
'''
Adding for HTML Input control.
'''
if sig_dic['en'] == 'tag_file_download':
html_str = HTML_TPL_DICT['input_add_download'].format(
sig_en=sig_dic['en'],
sig_zh=sig_dic['zh'],
sig_dic=sig_dic['dic'][1],
sig_type=sig_d... | 0.00173 |
def get(self, count, offset=0, _options=None):
'''
Fetch all Plaid institutions, using /institutions/all.
:param int count: Number of institutions to fetch.
:param int offset: Number of institutions to skip.
'''
options = _options or {}
retur... | 0.004329 |
def string_sanitize(string, tab_width=8):
r"""
strips, and replaces non-printable characters
:param tab_width: number of spaces to replace tabs with. Read from
`globals.tabwidth` setting if `None`
:type tab_width: int or `None`
>>> string_sanitize(' foo\rbar ', 8)
' fooba... | 0.000868 |
def run(self):
"""Connect to SABnzbd and get the data."""
try:
answer = urlopen(self.url + "&mode=queue").read().decode()
except (HTTPError, URLError) as error:
self.output = {
"full_text": str(error.reason),
"color": "#FF0000"
... | 0.001736 |
def xfrange(start, stop, step=1, maxSize=-1):
"""
Returns a generator that yields the frames from start to stop, inclusive.
In other words it adds or subtracts a frame, as necessary, to return the
stop value as well, if the stepped range would touch that value.
Args:
start (int):
st... | 0.000971 |
def git_add_commit_push_all_repos(cat):
"""Add all files in each data repository tree, commit, push.
Creates a commit message based on the current catalog version info.
If either the `git add` or `git push` commands fail, an error will be
raised. Currently, if `commit` fails an error *WILL NOT* be ra... | 0.000867 |
def check_compliance(self, function):
"""
Checks if a given `function` complies with this specification. If an
inconsistency is detected a :py:exc:`MethodValidationError` exception
is raised.
.. note::
This method will not work as expected when `function` is an unbou... | 0.001689 |
def wait_for_page_to_load(self):
"""Wait for the page to load."""
self.wait.until(lambda _: self.loaded)
self.pm.hook.pypom_after_wait_for_page_to_load(page=self)
return self | 0.009709 |
def process_file(filename: str,
filetypes: List[str],
move_to: str,
delete_if_not_specified_file_type: bool,
show_zip_output: bool) -> None:
"""
Deals with an OpenXML, including if it is potentially corrupted.
Args:
filename: filen... | 0.000549 |
def write_users(dburl):
"""Write users to the DB."""
data = {
'username': 'admin',
'realname': 'Website Administrator',
'email': 'coil@example.com',
'password':
r'$bcrypt-sha256$2a,12$NNtd2TC9mZO6.EvLwEwlLO$axojD34/iE8x'
r'QitQnCCOGPhofgmjNdq',
}
... | 0.001653 |
def get_id(self):
'''
:returns: Object ID of associated app
:rtype: string
Returns the object ID of the app that the handler is currently
associated with.
'''
if self._dxid is not None:
return self._dxid
else:
return 'app-' + self.... | 0.005797 |
def read_short(source, offset):
"""Reads a number from a byte array.
:param bytes source: Source byte string
:param int offset: Point in byte string to start reading
:returns: Read number and offset at point after read data
:rtype: tuple of ints
:raises: SerializationError if unable to unpack
... | 0.001842 |
def get_quotation_kline(self, symbol, period, limit=None, _async=False):
"""
获取etf净值
:param symbol: etf名称
:param period: K线类型
:param limit: 获取数量
:param _async:
:return:
"""
params = {}
path = '/quotation/market/history/kline'
params... | 0.004132 |
def show_plot(plot, width=PREVIEW_WIDTH, height=PREVIEW_HEIGHT):
"""Preview a plot in a jupyter notebook.
Args:
plot (list): the plot to display (list of layers)
width (int): the width of the preview
height (int): the height of the preview
Returns:
An object that render... | 0.004819 |
def create(self, healthCheckNotification, instance, ipAddressResourceId, name, notificationContacts, rules,
loadBalancerClassOfServiceID=1, *args, **kwargs):
"""
:type healthCheckNotification: bool
:type instance: list[Instance]
:type ipAddressResourceId: list[int]
... | 0.005 |
def _expectation(p, rbf_kern, feat1, lin_kern, feat2, nghp=None):
"""
Compute the expectation:
expectation[n] = <Ka_{Z1, x_n} Kb_{x_n, Z2}>_p(x_n)
- K_lin_{.,.} :: RBF kernel
- K_rbf_{.,.} :: Linear kernel
Different Z1 and Z2 are handled if p is diagonal and K_lin and K_rbf have disjoint... | 0.006177 |
def make_long_description():
"""
Generate the reST long_description for setup() from source files.
Returns the generated long_description as a unicode string.
"""
readme_path = README_PATH
# Remove our HTML comments because PyPI does not allow it.
# See the setup.py docstring for more inf... | 0.000912 |
def copy_assets(self, assets_path):
"""Banana banana
"""
if not os.path.exists(assets_path):
os.mkdir(assets_path)
extra_files = self._get_extra_files()
for ex_files in Formatter.get_extra_files_signal(self):
extra_files.extend(ex_files)
for src... | 0.00295 |
def __collapse_stranded(s, proc_strands, names=False, verbose=False):
"""
Get the union of a set of genomic intervals.
given a list of genomic intervals with chromosome, start, end and strand
fields, collapse those intervals with strand in the set <proc_strands>
into a set of non-overlapping intervals. Other... | 0.008488 |
def flexion(self, x, y, kwargs, diff=0.000001):
"""
third derivatives (flexion)
:param x: x-position (preferentially arcsec)
:type x: numpy array
:param y: y-position (preferentially arcsec)
:type y: numpy array
:param kwargs: list of keyword arguments of lens mo... | 0.003311 |
def _secured_storage_parameters(self):
"""
Updates storage parameters with unsecure mode.
Returns:
dict: Updated storage_parameters.
"""
parameters = self._storage_parameters or dict()
# Handles unsecure mode
if self._unsecure:
parameters... | 0.004866 |
def nmap(nmap_args, ips):
"""
Start an nmap process with the given args on the given ips.
"""
config = Config()
arguments = ['nmap', '-Pn']
arguments.extend(ips)
arguments.extend(nmap_args)
output_file = ''
now = datetime.datetime.now()
if not '-oA' in nmap_args:
outp... | 0.002079 |
def resolve_group_names(self, r, target_group_ids, groups):
"""Resolve any security group names to the corresponding group ids
With the context of a given network attached resource.
"""
names = self.get_group_names(target_group_ids)
if not names:
return target_group_... | 0.001526 |
def encode_basic_auth(username, password):
"""
Encode basic auth credentials.
"""
return "Basic {}".format(
b64encode(
"{}:{}".format(
username,
password,
).encode("utf-8")
).decode("utf-8")
) | 0.003509 |
def series(self, sid, recycle_id=None, head=None, tail=None,
datetime=True):
"""
Create data Series
Parameters
----------
sid : str
recycle_id : optional
head : int | pandas.Timestamp, optional
Start of the interval
default ... | 0.003298 |
def calculate_dates(self, dt):
"""
Given a date, find that day's open and period end (open + offset).
"""
period_start, period_close = self.cal.open_and_close_for_session(
self.cal.minute_to_session_label(dt),
)
# Align the market open and close times here wi... | 0.002878 |
def compute_symm_block_tridiag_covariances(H_diag, H_upper_diag):
"""
use the info smoother to solve a symmetric block tridiagonal system
"""
T, D, _ = H_diag.shape
assert H_diag.ndim == 3 and H_diag.shape[2] == D
assert H_upper_diag.shape == (T - 1, D, D)
J_init = J_11 = J_22 = np.zeros((D... | 0.001479 |
def send(self,message,message_type,topic=''):
"""
Send the message on the socket.
Args:
- message: the message to publish
- message_type: the type of message being sent
- topic: the topic on which to send the message. Defaults to ''.
"""
... | 0.007919 |
def can_create_asset_content(self, asset_id=None):
"""Tests if this user can create content for ``Assets``.
A return of true does not guarantee successful authorization. A
return of false indicates that it is known creating an ``Asset``
will result in a ``PermissionDenied``. This is int... | 0.003067 |
def upgrade():
"""Upgrade database."""
op.create_table(
'crawler_job',
sa.Column('id', sa.Integer, primary_key=True, autoincrement=True),
sa.Column('job_id', UUIDType, index=True),
sa.Column('spider', sa.String(255), index=True),
sa.Column('workflow', sa.String(255), inde... | 0.000894 |
def logical_or_expr(self):
"""
logical_or_expr: logical_and_expr ('or' logical_and_expr)*
"""
node = self.logical_and_expr()
while self.token.nature == Nature.OR:
token = self.token
self._process(Nature.OR)
node = BinaryOperation(left=node, o... | 0.007895 |
def draw(self):
"""
Render and draw the world and robots.
"""
from calysto.display import display, clear_output
canvas = self.render()
clear_output(wait=True)
display(canvas) | 0.008696 |
def delete_namespaced_horizontal_pod_autoscaler(self, name, namespace, **kwargs):
"""
delete a HorizontalPodAutoscaler
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_namespaced_hori... | 0.00412 |
def last(iterable, default=None):
"""Try to get the last iterable item by successive iteration on it.
:param Iterable iterable: iterable to iterate on. Must provide the method
__iter__.
:param default: default value to get if input iterable is empty.
:raises TypeError: if iterable is not an ite... | 0.001567 |
def handle(self, signum, handler):
"""Set a function to run when the given signal is recieved.
Multiple handlers may be assigned to a single signal. The order of
handlers does not need to be preserved.
'signum' must be an integer representing a signal.
'handler' must be a call... | 0.002577 |
def transform_aglistener_output(result):
'''
Transforms the result of Availability Group Listener to eliminate unnecessary parameters.
'''
from collections import OrderedDict
from msrestazure.tools import parse_resource_id
try:
resource_group = getattr(result, 'resource_group', None) or ... | 0.00363 |
def read_rels(archive):
"""Read relationships for a workbook"""
xml_source = archive.read(ARC_WORKBOOK_RELS)
tree = fromstring(xml_source)
for element in safe_iterator(tree, '{%s}Relationship' % PKG_REL_NS):
rId = element.get('Id')
pth = element.get("Target")
typ = element.get('T... | 0.005272 |
def apply_operation_to(self, path):
"""Add `a:lnTo` element to *path* for this line segment.
Returns the `a:lnTo` element newly added to the path.
"""
return path.add_lnTo(
self._x - self._freeform_builder.shape_offset_x,
self._y - self._freeform_builder.shape_of... | 0.005952 |
def full_exec_request_actions(actions, func=None, render_func=None):
"""Full process to execute before, during and after actions.
If func is specified, it will be called after exec_request_actions()
unless a ContextExitException was raised. If render_func is specified,
it will be called after exec_reque... | 0.001119 |
def dispatch(self, block = False, timeout = None):
"""Get the next event from the queue and pass it to
the appropriate handlers.
:Parameters:
- `block`: wait for event if the queue is empty
- `timeout`: maximum time, in seconds, to wait if `block` is `True`
:Type... | 0.005118 |
def vcfunpackinfo(table, *keys):
"""
Unpack the INFO field into separate fields. E.g.::
>>> import petl as etl
>>> # activate bio extensions
... import petlx.bio
>>> table1 = (
... etl
... .fromvcf('fixture/sample.vcf', samples=None)
... .vcfu... | 0.003073 |
def _status(self):
"""Update the resource dictionary with job statuses."""
job_id_list = ' '.join(self.resources.keys())
cmd = "condor_q {0} -af:jr JobStatus".format(job_id_list)
retcode, stdout, stderr = super().execute_wait(cmd)
"""
Example output:
$ condor_q ... | 0.003125 |
def journal_history(self):
"""List of named tuples of authored publications in the form
(sourcetitle, abbreviation, type, issn). issn is only given
for journals. abbreviation and issn may be None.
"""
jour = namedtuple('Journal', 'sourcetitle abbreviation type issn')
pa... | 0.003067 |
def condense_duplicates(self):
"""Condense duplicate points using a transformation matrix.
This is useful if you have multiple non-transformed points at the same
location or multiple transformed points that use the same quadrature
points.
Won't change the GP if ... | 0.004042 |
def clear(self):
"""Clear output of one climate variable
"""
# mark this task as incomplete
self.mark_incomplete()
# Delete the indicator metadata, this also deletes values by cascading.
for suffix in list(CLIMATE_SEASON_SUFFIXES.values()):
try:
... | 0.004049 |
def get_frames(self):
"""Rectify and return current frames from cameras."""
frames = super(CalibratedPair, self).get_frames()
return self.calibration.rectify(frames) | 0.010582 |
def compress_file(filepath, compression="gz"):
"""
Compresses a file with the correct extension. Functions like standard
Unix command line gzip and bzip2 in the sense that the original
uncompressed files are not retained.
Args:
filepath (str): Path to file.
compression (str): A comp... | 0.001259 |
def peers(**kwargs): # pylint: disable=unused-argument
'''
Returns a list the NTP peers configured on the network device.
:return: configured NTP peers as list.
CLI Example:
.. code-block:: bash
salt '*' ntp.peers
Example output:
.. code-block:: python
[
... | 0.001271 |
def get_vulnerabilities(self, teams=None, applications=None, channel_types=None, start_date=None, end_date=None,
generic_severities=None, generic_vulnerabilities=None, number_merged=None,
number_vulnerabilities=None, parameter=None, path=None, show_open=None, show... | 0.005542 |
def Delete(self, n = 1, dl = 0):
"""删除键n次
"""
self.Delay(dl)
self.keyboard.tap_key(self.keyboard.delete_key, n) | 0.041958 |
def _get_sysv_services(root, systemd_services=None):
'''
Use os.listdir() and os.access() to get all the initscripts
'''
initscript_path = _root(INITSCRIPT_PATH, root)
try:
sysv_services = os.listdir(initscript_path)
except OSError as exc:
if exc.errno == errno.ENOENT:
... | 0.000786 |
def add_coord(self, x, y):
""" Adds a coord to the polyline and creates another circle
"""
x = x*self.x_factor
y = y*self.y_factor
self.plotData.add_coord(x, y)
self.circles_list.append(gui.SvgCircle(x, y, self.circle_radius))
self.append(self.circles_list[-1])
... | 0.004396 |
def sphere_analytical_gaussian(dr, a, alpha=0.2765):
"""
Analytically calculate the sphere's functional form by convolving the
Heavyside function with first order approximation to the sinc, a Gaussian.
The alpha parameters controls the width of the approximation -- should be
1, but is fit to be roug... | 0.003367 |
def index_data(self, data, index_name, doc_type):
"""Take an arbitrary dictionary of data and index it with ELS.
Args:
data: data to be Indexed. Should be a dictionary.
index_name: Name of the index.
doc_type: The type of the document.
Raises:
Ru... | 0.00358 |
def create_user(uid=None, username=None, password=None, priv=None):
'''
Create a CIMC user with username and password.
Args:
uid(int): The user ID slot to create the user account in.
username(str): The name of the user.
password(str): The clear text password of the user.
... | 0.004323 |
def _fmix(self, T, rho, A):
r"""Specific Helmholtz energy of air-water interaction
Parameters
----------
T : float
Temperature, [K]
rho : float
Density, [kg/m³]
A : float
Mass fraction of dry air in humid air, [kg/kg]
Returns
... | 0.003115 |
def rfc2426(self):
"""RFC2426-encode the field content.
:return: the field in the RFC 2426 format.
:returntype: `str`"""
return rfc2425encode("n",u';'.join(quote_semicolon(val) for val in
(self.family,self.given,self.middle,self.prefix,self.suffix))) | 0.026756 |
def is_running(process):
'''
Check if process is running.
Check if the given process name is running or not.
Note:
On a Linux system, kernel threads (like ``kthreadd`` etc.)
are excluded.
Args:
process (str): The name of the process.
Returns:
bool: Is the process running?
'''
if os.name == 'nt'... | 0.031283 |
def match_descendant_objective_id(self, objective_id=None, match=None):
"""Sets the objective ``Id`` for this query to match objectives that have the specified objective as a descendant.
arg: objective_id (osid.id.Id): an objective ``Id``
arg: match (boolean): ``true`` for a positive matc... | 0.004615 |
def get_course(self, courseid):
""" Return the course """
try:
course = self.course_factory.get_course(courseid)
except:
raise web.notfound()
return course | 0.014151 |
def publish(self, message, exchange=None):
"""
Publish a :class:`fedora_messaging.message.Message` to an `exchange`_
on the message broker. This call will survive connection failures and try
until it succeeds or is canceled.
Args:
message (message.Message): The messa... | 0.00716 |
def assign_did(self, did):
"""
assign the DID as the key id, if the DID does not have a '#value'
at the end, then automatically add a new key value
"""
if re.match('^#.*', self._id):
self._id = did + self._id
if re.match('^#.*', self._owner):
self.... | 0.00578 |
def getTrustForJID(self, bare_jid):
"""
All-in-one trust information for all devices of a bare jid.
The result is structured like this:
{
"active" : { device: int => trust_info }
"inactive" : { device: int => trust_info }
}
where trust_info is ... | 0.006977 |
def graph_from_file(filename, bidirectional=False, simplify=True,
retain_all=False, name='unnamed'):
"""
Create a networkx graph from OSM data in an XML file.
Parameters
----------
filename : string
the name of a file containing OSM XML data
bidirectional : bool
... | 0.00173 |
def size(self, filename: str) -> int:
'''Get size of file.
Coroutine.
'''
yield from self._control_stream.write_command(Command('SIZE', filename))
reply = yield from self._control_stream.read_reply()
self.raise_if_not_match('File size', ReplyCodes.file_status, reply)
... | 0.007126 |
def open_url_in_browser(url, browsername=None, fallback=False):
r"""
Opens a url in the specified or default browser
Args:
url (str): web url
CommandLine:
python -m utool.util_grabdata --test-open_url_in_browser
Example:
>>> # DISABLE_DOCTEST
>>> # SCRIPT
>... | 0.002699 |
def batchseeds(args):
"""
%prog batchseeds folder
Extract seed metrics for each image in a directory.
"""
from jcvi.formats.pdf import cat
xargs = args[1:]
p = OptionParser(batchseeds.__doc__)
opts, args, iopts = add_seeds_options(p, args)
if len(args) != 1:
sys.exit(not p... | 0.001809 |
def do_copy(self, subcmd, opts, *args):
"""Duplicate something in working copy or repository, remembering history.
usage:
copy SRC DST
SRC and DST can each be either a working copy (WC) path or URL:
WC -> WC: copy and schedule for addition (with history)
... | 0.006088 |
def music_info(songid):
"""
Get music info from baidu music api
"""
if isinstance(songid, list):
songid = ','.join(songid)
data = {
"hq": 1,
"songIds": songid
}
res = requests.post(MUSIC_INFO_URL, data=data)
info = res.json()
music_data = info["data"]
son... | 0.001506 |
def section_exists(self, section):
"""
Checks if given section exists.
Usage::
>>> content = ["[Section A]\\n", "; Comment.\\n", "Attribute 1 = \\"Value A\\"\\n", "\\n", \
"[Section B]\\n", "Attribute 2 = \\"Value B\\"\\n"]
>>> sections_file_parser = SectionsFileParser(... | 0.004583 |
def getServiceNamesToTraceIds(self, time_stamp, service_name, rpc_name):
"""
Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired
with the lists of every trace Ids (list<i64>) from the server to client.
The three arguments specify epoch time in micro... | 0.004559 |
def reparentAll(self):
'''
Fixes some of the parental relationships lost in parsing the Breathe graph.
File relationships are recovered in
:func:`~exhale.graph.ExhaleRoot.fileRefDiscovery`. This method simply calls in
this order:
1. :func:`~exhale.graph.ExhaleRoot.repar... | 0.004283 |
def run_multiple_processes(args_list: List[List[str]],
die_on_failure: bool = True) -> None:
"""
Fire up multiple processes, and wait for them to finihs.
Args:
args_list: command arguments for each process
die_on_failure: see :func:`wait_for_processes`
"""
... | 0.002141 |
def find_info(name=None):
"""Find the needed city server information."""
if not name:
return list(servers.keys())
name = name.lower()
if name in servers:
info = servers[name]
else:
raise CityNotFound("Could not find the specified city: %s" % name)
return info | 0.006494 |
def ticket_audits_list(self, cursor=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/ticket_audits#list-all-ticket-audits"
api_path = "/api/v2/ticket_audits.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del k... | 0.006061 |
def convert_durations(metric):
"""
Convert session duration metrics from seconds to milliseconds.
"""
if metric[0] == 'avgSessionDuration' and metric[1]:
new_metric = (metric[0], metric[1] * 1000)
else:
new_metric = metric
return new_metric | 0.003571 |
def calc_equivalent_modulus(self):
"""Calculates the equivalent laminate properties.
The following attributes are calculated:
e1, e2, g12, nu12, nu21
"""
AI = np.matrix(self.ABD, dtype=np.float64).I
a11, a12, a22, a33 = AI[0,0], AI[0,1], AI[1,1], AI[2,2]
sel... | 0.012632 |
def cache_train(self):
"""
Loads the data for this classifier from a cache file
:return: whether or not we were successful
:rtype: bool
"""
filename = self.get_cache_location()
if not os.path.exists(filename):
return False
categories = pickl... | 0.0032 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.