text stringlengths 81 112k |
|---|
This will install all dependencies into the current working
directory for the specific Python package from the selected
JavaScript package manager; this requires that this package
manager's package definition file to be properly generated
first, otherwise the process will be aborted.
... |
Calls the package manager with the arguments.
Returns decoded output of stdout and stderr; decoding determine
by locale.
def run(self, args=(), env={}):
"""
Calls the package manager with the arguments.
Returns decoded output of stdout and stderr; decoding determine
by... |
On win32, the subprocess module can only reliably resolve the
target binary if it's actually a binary; as for a Node.js script
it seems to only work iff shell=True was specified, presenting
a security risk. Resolve the target manually through which will
account for that.
The kw argument is the key... |
Default initialization loop.
def _init_entry_points(self, entry_points):
"""
Default initialization loop.
"""
logger.debug(
"registering %d entry points for registry '%s'",
len(entry_points), self.registry_name,
)
for entry_point in entry_points:... |
Store the records in a way that permit lookup by package
def store_records_for_package(self, entry_point, records):
"""
Store the records in a way that permit lookup by package
"""
# If provided records already exist in the module mapping list,
# it likely means that a package ... |
Register a lone entry_point
Will raise ImportError if the entry_point leads to an invalid
import.
def register_entry_point(self, entry_point):
"""
Register a lone entry_point
Will raise ImportError if the entry_point leads to an invalid
import.
"""
mod... |
Private method that registers an entry_point with a provided
module.
def _register_entry_point_module(self, entry_point, module):
"""
Private method that registers an entry_point with a provided
module.
"""
records_map = self._map_entry_point_module(entry_point, module)... |
Get a record by name
def get_record(self, name):
"""
Get a record by name
"""
result = {}
result.update(self.records.get(name, {}))
return result |
Get all records identified by package.
def get_records_for_package(self, package_name):
"""
Get all records identified by package.
"""
names = self.package_module_map.get(package_name, [])
result = {}
for name in names:
result.update(self.get_record(name))
... |
Subclasses should override to specify the default suffix, as the
invocation is done without a suffix.
def resolve_parent_registry_name(self, registry_name, suffix):
"""
Subclasses should override to specify the default suffix, as the
invocation is done without a suffix.
"""
... |
Get a record for the registered name, which will be a set of
matching desired "module names" for the given path.
def get_record(self, name):
"""
Get a record for the registered name, which will be a set of
matching desired "module names" for the given path.
"""
return s... |
Get all records identified by package.
def get_records_for_package(self, package_name):
"""
Get all records identified by package.
"""
result = []
result.extend(self.package_module_map.get(package_name))
return result |
Figure out which binary this will execute.
Returns None if the binary is not found.
def which(self):
"""
Figure out which binary this will execute.
Returns None if the binary is not found.
"""
if self.binary is None:
return None
return which(self.... |
Find all node_modules directories configured to be accessible
through this driver instance.
This is typically used for adding the direct instance, and does
not traverse the parent directories like what Node.js does.
Returns a list of directories that contain a 'node_modules'
di... |
Which with node_path and node_modules
def which_with_node_modules(self):
"""
Which with node_path and node_modules
"""
if self.binary is None:
return None
# first, log down the pedantic things...
if isdir(self.join_cwd(NODE_MODULES)):
logger.deb... |
Attempt to locate and set the paths to the binary with the
working directory defined for this instance.
def _set_env_path_with_node_modules(self):
"""
Attempt to locate and set the paths to the binary with the
working directory defined for this instance.
"""
modcls_name... |
Executes the binary using stdin and args with environment
variables.
Returns a tuple of stdout, stderr. Format determined by the
input text (either str or bytes), and the encoding of str will
be determined by the locale this module was imported in.
def _exec(self, binary, stdin='', ar... |
Call json.dump with the attributes of this instance as
arguments.
def dump(self, blob, stream):
"""
Call json.dump with the attributes of this instance as
arguments.
"""
json.dump(
blob, stream, indent=self.indent, sort_keys=True,
separators=self... |
Call json.dumps with the attributes of this instance as
arguments.
def dumps(self, blob):
"""
Call json.dumps with the attributes of this instance as
arguments.
"""
return json.dumps(
blob, indent=self.indent, sort_keys=True,
separators=self.sepa... |
Join the path with the current working directory. If it is
specified for this instance of the object it will be used,
otherwise rely on the global value.
def join_cwd(self, path=None):
"""
Join the path with the current working directory. If it is
specified for this instance o... |
This is called by the Toolchain for modnames that contain a '!'
as that signifies a loaderplugin syntax. This will be used by
the toolchain (which will also be supplied as the first argument)
to resolve the copy target, which must be a path relative to the
spec[WORKING_DIR].
If... |
A helper method for unwrapping the loaderplugin fragment out of
the provided value (typically a modname) and return it.
Note that the filter chaining is very implementation specific to
each and every loader plugin and their specific toolchain, so
this default implementation is not going... |
Transforms an unicode string into a UTF-8 equivalent.
:param obj: object to transform into it's UTF-8 equivalent
:return: the UTF-8 equivalent of the string
def _unicode_handler(obj):
"""
Transforms an unicode string into a UTF-8 equivalent.
:param obj: object to transform into it's UTF-8 equival... |
Encodes the data, creating a JSON structure from an instance from the
domain model.
:param entity: the instance to encode
:return: a JSON structure created from the received data
def encode(self, entity):
"""
Encodes the data, creating a JSON structure from an instance from the... |
IPI Base Number field.
An IPI Base Number code written on a field follows the Pattern
C-NNNNNNNNN-M. This being:
- C: header, a character.
- N: numeric value.
- M: control digit.
So, for example, an IPI Base Number code field can contain I-000000229-7.
:param name: name for the field
... |
IPI Name Number field.
An IPI Name Number is composed of eleven digits.
So, for example, an IPI Name Number code field can contain 00014107338.
:param name: name for the field
:return: a parser for the IPI Name Number field
def ipi_name_number(name=None):
"""
IPI Name Number field.
An I... |
ISWC field.
A ISWC code written on a field follows the Pattern TNNNNNNNNNC.
This being:
- T: header, it is always T.
- N: numeric value.
- C: control digit.
So, for example, an ISWC code field can contain T0345246801.
:param name: name for the field
:return: a parser for the ISWC fiel... |
Creates the grammar for a Numeric (N) field storing a percentage and
accepting only the specified number of characters.
It is possible to set the maximum allowed value. By default this is 100
(for 100%), and if modified it is expected to be reduced, not increased.
The three first digits will be for th... |
Makes sure the received value is a percentage. Otherwise an exception is
thrown.
:param value: the value to check
def _assert_is_percentage(value, maximum=100):
"""
Makes sure the received value is a percentage. Otherwise an exception is
thrown.
:param value: the value to check
"""
i... |
Creates the grammar for an EAN 13 code.
These are the codes on thirteen digits barcodes.
:param name: name for the field
:return: grammar for an EAN 13 field
def ean_13(name=None):
"""
Creates the grammar for an EAN 13 code.
These are the codes on thirteen digits barcodes.
:param name: ... |
Creates the grammar for an ISRC code.
ISRC stands for International Standard Recording Code, which is the
standard ISO 3901. This stores information identifying a particular
recording.
:param name: name for the field
:return: grammar for an ISRC field
def isrc(name=None):
"""
Creates the ... |
Creates the grammar for a short ISRC code.
ISRC stands for International Standard Recording Code, which is the
standard ISO 3901. This stores information identifying a particular
recording.
This variant contain no separator for the parts, and follows the pattern:
CCXXXYYNNNNN
Where each code ... |
Creates the grammar for a V-ISAN code.
This is a variation on the ISAN (International Standard Audiovisual Number)
:param name: name for the field
:return: grammar for an ISRC field
def visan(name=None):
"""
Creates the grammar for a V-ISAN code.
This is a variation on the ISAN (Internationa... |
Creates the grammar for an Audio Visual Key code.
This is a variation on the ISAN (International Standard Audiovisual Number)
:param name: name for the field
:return: grammar for an ISRC field
def audio_visual_key(name=None):
"""
Creates the grammar for an Audio Visual Key code.
This is a va... |
Creates the grammar for a date and time field, which is a combination of
the Date (D) and Time or Duration field (T).
This field requires first a Date, and then a Time, without any space in
between.
:param name: name for the field
:return: grammar for a Date and Time field
def date_time(name=None... |
Lookup field which transforms the result into an integer.
:param values: values allowed
:param name: name for the field
:return: grammar for the lookup field
def lookup_int(values, name=None):
"""
Lookup field which transforms the result into an integer.
:param values: values allowed
:par... |
Extract a specific argument from a specific function name.
Arguments:
text
The source text.
f_name
The name of the function
f_argn
The argument position
f_argt
The argument type from calmjs.parse.asttypes;
default: calmjs.parse.asttypes.String
def extract_f... |
This yields only strings within the lists provided in the argument
list at the specified position from a function call.
Originally, this was implemented for yield a list of module names to
be imported as represented by this given node, which must be of the
FunctionCall type.
def yield_amd_require_stri... |
Yield just a string argument from position of the function call.
def yield_string_argument(node, pos):
"""
Yield just a string argument from position of the function call.
"""
if not isinstance(node.args.items[pos], asttypes.String):
return
yield to_str(node.args.items[pos]) |
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.
def yield_module_imports(root, checks=string_imports()):
"""
Gather all require and define calls from unbundled JavaScript source
files an... |
Yield all nodes that provide an import
def yield_module_imports_nodes(root, checks=import_nodes()):
"""
Yield all nodes that provide an import
"""
if not isinstance(root, asttypes.Node):
raise TypeError('provided root must be a node')
for child in yield_function(root, deep_filter):
... |
custom type for file made w/ buildFastaIndex, fai for ones made with samtools
def open_fasta_index(self):
"""
custom type for file made w/ buildFastaIndex, fai for ones made with samtools
"""
index = self.fasta_index
try:
handle = open(index, 'rb')
except (IO... |
chromosome is entered relative to the file it was built with, so it can be 'chr11' or '11',
start/end are coordinates, which default to python style [0,1) internally. So positions should be
entered with (1,1) indexing. This can be changed with the indexing keyword.
The default is for everything ... |
For a given child module registry, attempt to resolve the lineage.
Return an iterator, yielding from parent down to the input registry,
inclusive of the input registry.
def resolve_child_module_registries_lineage(registry):
"""
For a given child module registry, attempt to resolve the lineage.
Re... |
!!!!MODIFICATION POSITION IS 0 BASED!!!!!!
Modifications are stored internally as a tuple with this format:
(amino acid modified, index in peptide of amino acid, modification type, modification mass)
ie (M, 7, Oxidation, 15.9...)
such as: M35(o) for an oxidized methionine at residue 35
... |
Given a module name and a distribution, attempt to resolve the
actual path to the module.
def resource_filename_mod_dist(module_name, dist):
"""
Given a module name and a distribution, attempt to resolve the
actual path to the module.
"""
try:
return pkg_resources.resource_filename(
... |
If a given package declares a namespace and also provide submodules
nested at that namespace level, and for whatever reason that module
is needed, Python's import mechanism will not have a path associated
with that module. However, if given an entry_point, this path can
be resolved through its distribu... |
JavaScript styled module location listing generator.
Arguments:
module
The Python module to start fetching from.
entry_point
This is the original entry point that has a distribution
reference such that the resource_filename API call may be used
to locate the actual resourc... |
Crude, local registration decorator for a crude local registry of
all utilities local to this module.
def register(util_type, registry=_utils):
"""
Crude, local registration decorator for a crude local registry of
all utilities local to this module.
"""
def marker(f):
mark = util_type ... |
Provides the raw __path__. Incompatible with PEP 302-based import
hooks and incompatible with zip_safe packages.
Deprecated. Will be removed by calmjs-4.0.
def modpath_all(module, entry_point):
"""
Provides the raw __path__. Incompatible with PEP 302-based import
hooks and incompatible with zip... |
Provides the raw __path__. Incompatible with PEP 302-based import
hooks and incompatible with zip_safe packages.
Deprecated. Will be removed by calmjs-4.0.
def modpath_last(module, entry_point):
"""
Provides the raw __path__. Incompatible with PEP 302-based import
hooks and incompatible with zi... |
Goes through pkg_resources for compliance with various PEPs.
This one accepts a module as argument.
def modpath_pkg_resources(module, entry_point):
"""
Goes through pkg_resources for compliance with various PEPs.
This one accepts a module as argument.
"""
result = []
try:
path = ... |
General mapper
Loads components from the micro registry.
def mapper(module, entry_point,
modpath='pkg_resources', globber='root', modname='es6',
fext=JS_EXT, registry=_utils):
"""
General mapper
Loads components from the micro registry.
"""
modname_f = modname if callab... |
Default mapper using python style globber
Finds the latest path declared for the module at hand and extract
a list of importable JS modules using the es6 module import format.
def mapper_python(module, entry_point, globber='root', fext=JS_EXT):
"""
Default mapper using python style globber
Finds ... |
Returns the code in a printable form, filling with zeros if needed.
:return: the ID code in a printable form
def _printable_id_code(self):
"""
Returns the code in a printable form, filling with zeros if needed.
:return: the ID code in a printable form
"""
code = str(se... |
Returns the code in a printable form, separating it into groups of
three characters using a point between them.
:return: the ID code in a printable form
def _printable_id_code(self):
"""
Returns the code in a printable form, separating it into groups of
three characters using a... |
Standard write, for standard sources part of the original file.
def write(self, s):
"""
Standard write, for standard sources part of the original file.
"""
lines = s.splitlines(True)
for line in lines:
self.current_mapping.append(
(self.generated_col... |
Discard from original file.
def discard(self, s):
"""
Discard from original file.
"""
lines = s.splitlines(True)
for line in lines:
if line[-1] not in '\r\n':
if not self.warn:
logger.warning(
'partial line... |
Write string that are not part of the original file.
def write_padding(self, s):
"""
Write string that are not part of the original file.
"""
lines = s.splitlines(True)
for line in lines:
self.stream.write(line)
if line[-1] in '\r\n':
sel... |
Same as ``babel.numbers.format_currency``, but has ``force_frac``
argument instead of ``currency_digits``.
If the ``force_frac`` argument is given, the argument is passed down to
``pattern.apply``.
def format_currency(number, currency, format, locale=babel.numbers.LC_NUMERIC,
force_fra... |
Wrapped so we can test in tests/test_examples.py
def run(unihan_options={}):
"""Wrapped so we can test in tests/test_examples.py"""
print("This example prints variant character data.")
c = Cihai()
if not c.unihan.is_bootstrapped: # download and install Unihan to db
c.unihan.bootstrap(unihan_o... |
No-op to reflect db info.
This is available as a method so the database can be reflected
outside initialization (such bootstrapping unihan during CLI usage).
def reflect_db(self):
"""
No-op to reflect db info.
This is available as a method so the database can be reflected
... |
Translates from ASCIIMathML (an easy to type and highly readable way to
represent math formulas) into MathML (a w3c standard directly displayable by
some web browsers).
The function `parse()` generates a tree of elements:
>>> import asciimathml
>>> asciimathml.parse('sqrt 2')
<Element math at b76fb28c>
T... |
Decorator for tracing the parser.
Use it to decorate functions with signature:
string -> (string, nodes)
and a trace of the progress made by the parser will be printed to stderr.
Currently parse_exprs(), parse_expr() and parse_m() have the right signature.
def trace_parser(p):
"""
Decorat... |
prob is a ndarray representing a probability distribution.
index is a number between 0 and and the number of symbols ( len(prob)-1 )
return the probability distribution if the element at 'index' was no longer available
def remove_symbol_from_dist(dist, index):
'''
prob is a ndarray representing a proba... |
change every response in x that matches 'index' by randomly sampling from prob
def change_response(x, prob, index):
'''
change every response in x that matches 'index' by randomly sampling from prob
'''
#pdb.set_trace()
N = (x==index).sum()
#x[x==index]=9
x[x==index] = dist.sample(N) |
Make a toy example where x is uniformly distributed with N bits and y
follows x but with symbol dependent noise.
x=0 -> y=0
x=1 -> y=1 + e
x=2 -> y=2 + 2*e
...
x=n -> y=n + n*e
where by n*e I am saying that the noise grows
def toy_example():
"""
Make a toy example where x is uniform... |
for each symbol in x, change x such that there are no more of such symbols
(replacing by a random distribution with the same proba of all other symbols)
and compute mi(new_x, y)
def differentiate_mi(x, y):
'''
for each symbol in x, change x such that there are no more of such symbols
(replacing by ... |
generate a random number in [0,1) and return the index into self.prob
such that self.prob[index] <= random_number but self.prob[index+1] > random_number
implementation note: the problem is identical to finding the index into self.cumsum
where the random number should be inserted to keep the arr... |
Return the prefix for the log message. Template for Formatter.
:param: record: :py:class:`logging.LogRecord` object. this is passed in
from inside the :py:meth:`logging.Formatter.format` record.
def default_log_template(self, record):
"""Return the prefix for the log message. Template for Formatter.
... |
Combine two dictionary-like objects.
Notes
-----
Code from https://github.com/pypa/warehouse
Copyright 2013 Donald Stufft
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at... |
Expand configuration XDG variables, environmental variables, and tildes.
Parameters
----------
d : dict
config information
dirs : appdirs.AppDirs
XDG application mapping
Notes
-----
*Environmentable variables* are expanded via :py:func:`os.path.expandvars`.
So ``${PWD}`... |
Download, extract and import unihan to database.
def bootstrap_unihan(metadata, options={}):
"""Download, extract and import unihan to database."""
options = merge_dict(UNIHAN_ETL_DEFAULT_OPTIONS.copy(), options)
p = unihan.Packager(options)
p.download()
data = p.export()
table = create_unihan... |
Return True if cihai is correctly bootstrapped.
def is_bootstrapped(metadata):
"""Return True if cihai is correctly bootstrapped."""
fields = UNIHAN_FIELDS + DEFAULT_COLUMNS
if TABLE_NAME in metadata.tables.keys():
table = metadata.tables[TABLE_NAME]
if set(fields) == set(c.name for c in t... |
Create table and return :class:`sqlalchemy.Table`.
Parameters
----------
columns : list
columns for table, e.g. ``['kDefinition', 'kCantonese']``
metadata : :class:`sqlalchemy.schema.MetaData`
Instance of sqlalchemy metadata
Returns
-------
:class:`sqlalchemy.schema.Table`... |
compute the nem-py address from the public one
def get_address(pk, main_net=True, prefix=None):
""" compute the nem-py address from the public one """
if isinstance(pk, str):
pk = unhexlify(pk.encode())
assert len(pk) == 32, 'PK is 32bytes {}'.format(len(pk))
k = keccak_256(pk).digest()
rip... |
Return character information from datasets.
Parameters
----------
char : str
character / string to lookup
Returns
-------
:class:`sqlalchemy.orm.query.Query` :
list of matches
def lookup_char(self, char):
"""Return character information ... |
Return QuerySet of objects from SQLAlchemy of results.
Parameters
----------
hints: list of str
strings to lookup
Returns
-------
:class:`sqlalchemy.orm.query.Query` :
reverse matches
def reverse_char(self, hints):
"""Return QuerySet of ... |
Returns list of characters with information for certain fields.
Parameters
----------
*fields : list of str
fields for which information should be available
Returns
-------
:class:`sqlalchemy.orm.query.Query` :
list of matches
def with_fields(se... |
given a probability distribution (prob) or an interable of symbols (data) compute and
return its continuous entropy.
inputs:
------
data: samples by dimensions ndarray
prob: iterable with probabilities
method: 'nearest-neighbors', 'gaussian', or 'bin'
bins... |
compute and return the mutual information between x and y
inputs:
-------
x, y: numpy arrays of shape samples x dimension
method: 'nearest-neighbors', 'gaussian', or 'bin'
units: 'bits' or 'nats'
output:
-------
mi: float
Notes:
------
... |
compute the conditional entropy H(X|Y).
method: 'nearest-neighbors', 'gaussian', or 'bin'
if 'bin' need to provide bins_y, and bins_xy
units: 'bits' or 'nats'
def cond_entropy(x, y, bins_y=None, bins_xy=None, method='nearest-neighbors', units='bits'):
'''
compute the condition... |
given a probability distribution (prob) or an interable of symbols (data) compute and
return its entropy
inputs:
------
data: iterable of symbols
prob: iterable with probabilities
tol: if prob is given, 'entropy' checks that the sum is about 1.
... |
Return a dict mapping symbols to probability.
input:
-----
symbols: iterable of hashable items
works well if symbols is a zip of iterables
def symbols_to_prob(symbols):
'''
Return a dict mapping symbols to probability.
input:
-----
symbols: itera... |
Combine different symbols into a 'super'-symbol
args can be an iterable of iterables that support hashing
see example for 2D ndarray input
usage:
1) combine two symbols, each a number into just one symbol
x = numpy.random.randint(0,4,1000)
y = numpy.random.randint(0,2,1000)
... |
compute and return the mutual information between x and y
inputs:
-------
x, y: iterables of hashable items
output:
-------
mi: float
Notes:
------
if you are trying to mix several symbols together as in mi(x, (y0,y1,...)), try
info[p] = _info.mi(x, info... |
compute and return the mutual information between x and y given z, I(x, y | z)
inputs:
-------
x, y, z: iterables with discrete symbols
output:
-------
mi: float
implementation notes:
---------------------
I(x, y | z) = H(x | z) - H(x | y, z)
... |
Decompose the information between all X and y according to the chain rule and return all the terms in the chain rule.
Inputs:
-------
X: iterable of iterables. You should be able to compute [mi(x, y) for x in X]
y: iterable of symbols
output:
-------
ndarray:... |
Compute the KL divergence between distributions P and Q
P and Q should be dictionaries linking symbols to probabilities.
the keys to P and Q should be the same.
def KL_divergence(P,Q):
'''
Compute the KL divergence between distributions P and Q
P and Q should be dictionaries linking symbo... |
bin signal x using 'binsN' bin. If minX, maxX are None, they default to the full
range of the signal. If they are not None, everything above maxX gets assigned to
binsN-1 and everything below minX gets assigned to 0, this is effectively the same
as clipping x before passing it to 'bin'
input:
-----... |
Determine the URL corresponding to Python object
Notes
-----
From https://github.com/numpy/numpy/blob/v1.15.1/doc/source/conf.py, 7c49cfa
on Jul 31. License BSD-3. https://github.com/numpy/numpy/blob/v1.15.1/LICENSE.txt
def linkcode_resolve(domain, info): # NOQA: C901
"""
Determine the URL co... |
$= z^{-1} \mod q$, for z != 0
def inv(z):
"""$= z^{-1} \mod q$, for z != 0"""
# Adapted from curve25519_athlon.c in djb's Curve25519.
z = qdiv(z)
z2 = z * z % PRIME # 2
z9 = pow2(z2, 2) * z % PRIME # 9
z11 = z9 * z2 % PRIME # 11
z2_5_0 = (z11*z11) % PRIME * z9 % PRIME # 31 == 2^5 - 2^0
... |
Implements scalarmult(B, e) more efficiently.
def scalarmult_B(e):
"""
Implements scalarmult(B, e) more efficiently.
"""
# scalarmult(B, l) is the identity
e %= L
P = IDENT
for i in range(253):
if e & 1:
P = edwards_add(P=P, Q=Bpow[i])
e //= 2
assert e == 0, ... |
given a value y, recover the preimage x
def recover(y):
""" given a value y, recover the preimage x """
p = (y*y - 1) * inverse(D*y*y + 1)
x = powmod(p, (PRIME+3) // 8, PRIME)
if (x*x - p) % PRIME != 0:
i = powmod(2, (PRIME-1) // 4, PRIME)
x = (x*i) % PRIME
if x % 2 != 0:
x ... |
Execute rubberband
Parameters
----------
y : np.ndarray [shape=(n,) or (n, c)]
Audio time series, either single or multichannel
sr : int > 0
sampling rate of y
**kwargs
keyword arguments to rubberband
Returns
-------
y_mod : np.ndarray [shape=(n,) or (n, c)]
... |
Apply a time stretch of `rate` to an audio time series.
This uses the `tempo` form for rubberband, so the
higher the rate, the faster the playback.
Parameters
----------
y : np.ndarray [shape=(n,) or (n, c)]
Audio time series, either single or multichannel
sr : int > 0
Sampli... |
Apply a timemap stretch to an audio time series.
A timemap stretch allows non-linear time-stretching by mapping source to
target sample frame numbers for fixed time points within the audio data.
This uses the `time` and `timemap` form for rubberband.
Parameters
----------
y : np.ndarray [shap... |
Apply a pitch shift to an audio time series.
Parameters
----------
y : np.ndarray [shape=(n,) or (n, c)]
Audio time series, either single or multichannel
sr : int > 0
Sampling rate of `y`
n_steps : float
Shift by `n_steps` semitones.
rbargs
Additional keyword ... |
Convert GB kuten / quwei form (94 zones * 94 points) to GB2312-1980 /
ISO-2022-CN hex (internal representation)
def kuten_to_gb2312(kuten):
"""
Convert GB kuten / quwei form (94 zones * 94 points) to GB2312-1980 /
ISO-2022-CN hex (internal representation)
"""
zone, point = int(kuten[:2]), int(k... |
Convert GB2312-1980 hex (internal representation) to EUC-CN hex (the
"external encoding")
def gb2312_to_euc(gb2312hex):
"""
Convert GB2312-1980 hex (internal representation) to EUC-CN hex (the
"external encoding")
"""
hi, lo = int(gb2312hex[:2], 16), int(gb2312hex[2:], 16)
hi, lo = hexd(hi ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.