partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | run_trace | Run module tracing. | docs/support/trace_support.py | def run_trace(
mname,
fname,
module_prefix,
callable_names,
no_print,
module_exclude=None,
callable_exclude=None,
debug=False,
):
"""Run module tracing."""
# pylint: disable=R0913
module_exclude = [] if module_exclude is None else module_exclude
callable_exclude = [] if c... | def run_trace(
mname,
fname,
module_prefix,
callable_names,
no_print,
module_exclude=None,
callable_exclude=None,
debug=False,
):
"""Run module tracing."""
# pylint: disable=R0913
module_exclude = [] if module_exclude is None else module_exclude
callable_exclude = [] if c... | [
"Run",
"module",
"tracing",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/trace_support.py#L51-L108 | [
"def",
"run_trace",
"(",
"mname",
",",
"fname",
",",
"module_prefix",
",",
"callable_names",
",",
"no_print",
",",
"module_exclude",
"=",
"None",
",",
"callable_exclude",
"=",
"None",
",",
"debug",
"=",
"False",
",",
")",
":",
"# pylint: disable=R0913",
"modul... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | YOURLSAPIMixin.shorten | Shorten URL with optional keyword and title.
Parameters:
url: URL to shorten.
keyword: Optionally choose keyword for short URL, otherwise automatic.
title: Optionally choose title, otherwise taken from web page.
Returns:
ShortenedURL: Shortened URL and a... | yourls/core.py | def shorten(self, url, keyword=None, title=None):
"""Shorten URL with optional keyword and title.
Parameters:
url: URL to shorten.
keyword: Optionally choose keyword for short URL, otherwise automatic.
title: Optionally choose title, otherwise taken from web page.
... | def shorten(self, url, keyword=None, title=None):
"""Shorten URL with optional keyword and title.
Parameters:
url: URL to shorten.
keyword: Optionally choose keyword for short URL, otherwise automatic.
title: Optionally choose title, otherwise taken from web page.
... | [
"Shorten",
"URL",
"with",
"optional",
"keyword",
"and",
"title",
"."
] | RazerM/yourls-python | python | https://github.com/RazerM/yourls-python/blob/716845562a2bbb430de3c379c9481b195e451ccf/yourls/core.py#L38-L81 | [
"def",
"shorten",
"(",
"self",
",",
"url",
",",
"keyword",
"=",
"None",
",",
"title",
"=",
"None",
")",
":",
"data",
"=",
"dict",
"(",
"action",
"=",
"'shorturl'",
",",
"url",
"=",
"url",
",",
"keyword",
"=",
"keyword",
",",
"title",
"=",
"title",
... | 716845562a2bbb430de3c379c9481b195e451ccf |
test | YOURLSAPIMixin.expand | Expand short URL or keyword to long URL.
Parameters:
short: Short URL (``http://example.com/abc``) or keyword (abc).
:return: Expanded/long URL, e.g.
``https://www.youtube.com/watch?v=dQw4w9WgXcQ``
Raises:
~yourls.exceptions.YOURLSHTTPError: HTTP error... | yourls/core.py | def expand(self, short):
"""Expand short URL or keyword to long URL.
Parameters:
short: Short URL (``http://example.com/abc``) or keyword (abc).
:return: Expanded/long URL, e.g.
``https://www.youtube.com/watch?v=dQw4w9WgXcQ``
Raises:
~yourls.ex... | def expand(self, short):
"""Expand short URL or keyword to long URL.
Parameters:
short: Short URL (``http://example.com/abc``) or keyword (abc).
:return: Expanded/long URL, e.g.
``https://www.youtube.com/watch?v=dQw4w9WgXcQ``
Raises:
~yourls.ex... | [
"Expand",
"short",
"URL",
"or",
"keyword",
"to",
"long",
"URL",
"."
] | RazerM/yourls-python | python | https://github.com/RazerM/yourls-python/blob/716845562a2bbb430de3c379c9481b195e451ccf/yourls/core.py#L83-L100 | [
"def",
"expand",
"(",
"self",
",",
"short",
")",
":",
"data",
"=",
"dict",
"(",
"action",
"=",
"'expand'",
",",
"shorturl",
"=",
"short",
")",
"jsondata",
"=",
"self",
".",
"_api_request",
"(",
"params",
"=",
"data",
")",
"return",
"jsondata",
"[",
"... | 716845562a2bbb430de3c379c9481b195e451ccf |
test | YOURLSAPIMixin.url_stats | Get stats for short URL or keyword.
Parameters:
short: Short URL (http://example.com/abc) or keyword (abc).
Returns:
ShortenedURL: Shortened URL and associated data.
Raises:
~yourls.exceptions.YOURLSHTTPError: HTTP error with response from
Y... | yourls/core.py | def url_stats(self, short):
"""Get stats for short URL or keyword.
Parameters:
short: Short URL (http://example.com/abc) or keyword (abc).
Returns:
ShortenedURL: Shortened URL and associated data.
Raises:
~yourls.exceptions.YOURLSHTTPError: HTTP err... | def url_stats(self, short):
"""Get stats for short URL or keyword.
Parameters:
short: Short URL (http://example.com/abc) or keyword (abc).
Returns:
ShortenedURL: Shortened URL and associated data.
Raises:
~yourls.exceptions.YOURLSHTTPError: HTTP err... | [
"Get",
"stats",
"for",
"short",
"URL",
"or",
"keyword",
"."
] | RazerM/yourls-python | python | https://github.com/RazerM/yourls-python/blob/716845562a2bbb430de3c379c9481b195e451ccf/yourls/core.py#L102-L119 | [
"def",
"url_stats",
"(",
"self",
",",
"short",
")",
":",
"data",
"=",
"dict",
"(",
"action",
"=",
"'url-stats'",
",",
"shorturl",
"=",
"short",
")",
"jsondata",
"=",
"self",
".",
"_api_request",
"(",
"params",
"=",
"data",
")",
"return",
"_json_to_shorte... | 716845562a2bbb430de3c379c9481b195e451ccf |
test | YOURLSAPIMixin.stats | Get stats about links.
Parameters:
filter: 'top', 'bottom', 'rand', or 'last'.
limit: Number of links to return from filter.
start: Optional start number.
Returns:
Tuple containing list of ShortenedURLs and DBStats.
Example:
.. code... | yourls/core.py | def stats(self, filter, limit, start=None):
"""Get stats about links.
Parameters:
filter: 'top', 'bottom', 'rand', or 'last'.
limit: Number of links to return from filter.
start: Optional start number.
Returns:
Tuple containing list of ShortenedU... | def stats(self, filter, limit, start=None):
"""Get stats about links.
Parameters:
filter: 'top', 'bottom', 'rand', or 'last'.
limit: Number of links to return from filter.
start: Optional start number.
Returns:
Tuple containing list of ShortenedU... | [
"Get",
"stats",
"about",
"links",
"."
] | RazerM/yourls-python | python | https://github.com/RazerM/yourls-python/blob/716845562a2bbb430de3c379c9481b195e451ccf/yourls/core.py#L121-L164 | [
"def",
"stats",
"(",
"self",
",",
"filter",
",",
"limit",
",",
"start",
"=",
"None",
")",
":",
"# Normalise random to rand, even though it's accepted by API.",
"if",
"filter",
"==",
"'random'",
":",
"filter",
"=",
"'rand'",
"valid_filters",
"=",
"(",
"'top'",
",... | 716845562a2bbb430de3c379c9481b195e451ccf |
test | YOURLSAPIMixin.db_stats | Get database statistics.
Returns:
DBStats: Total clicks and links statistics.
Raises:
requests.exceptions.HTTPError: Generic HTTP Error | yourls/core.py | def db_stats(self):
"""Get database statistics.
Returns:
DBStats: Total clicks and links statistics.
Raises:
requests.exceptions.HTTPError: Generic HTTP Error
"""
data = dict(action='db-stats')
jsondata = self._api_request(params=data)
s... | def db_stats(self):
"""Get database statistics.
Returns:
DBStats: Total clicks and links statistics.
Raises:
requests.exceptions.HTTPError: Generic HTTP Error
"""
data = dict(action='db-stats')
jsondata = self._api_request(params=data)
s... | [
"Get",
"database",
"statistics",
"."
] | RazerM/yourls-python | python | https://github.com/RazerM/yourls-python/blob/716845562a2bbb430de3c379c9481b195e451ccf/yourls/core.py#L166-L181 | [
"def",
"db_stats",
"(",
"self",
")",
":",
"data",
"=",
"dict",
"(",
"action",
"=",
"'db-stats'",
")",
"jsondata",
"=",
"self",
".",
"_api_request",
"(",
"params",
"=",
"data",
")",
"stats",
"=",
"DBStats",
"(",
"total_clicks",
"=",
"int",
"(",
"jsondat... | 716845562a2bbb430de3c379c9481b195e451ccf |
test | ste | r"""
Echo terminal output.
Print STDOUT resulting from a given Bash shell command (relative to the
package :code:`pypkg` directory) formatted in reStructuredText
:param command: Bash shell command, relative to
:bash:`${PMISC_DIR}/pypkg`
:type command: string
:param ninden... | docs/support/term_echo.py | def ste(command, nindent, mdir, fpointer):
r"""
Echo terminal output.
Print STDOUT resulting from a given Bash shell command (relative to the
package :code:`pypkg` directory) formatted in reStructuredText
:param command: Bash shell command, relative to
:bash:`${PMISC_DIR}/pypkg... | def ste(command, nindent, mdir, fpointer):
r"""
Echo terminal output.
Print STDOUT resulting from a given Bash shell command (relative to the
package :code:`pypkg` directory) formatted in reStructuredText
:param command: Bash shell command, relative to
:bash:`${PMISC_DIR}/pypkg... | [
"r",
"Echo",
"terminal",
"output",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/term_echo.py#L15-L65 | [
"def",
"ste",
"(",
"command",
",",
"nindent",
",",
"mdir",
",",
"fpointer",
")",
":",
"term_echo",
"(",
"\"${{PMISC_DIR}}{sep}pypkg{sep}{cmd}\"",
".",
"format",
"(",
"sep",
"=",
"os",
".",
"path",
".",
"sep",
",",
"cmd",
"=",
"command",
")",
",",
"ninden... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | term_echo | Print STDOUT resulting from a Bash shell command formatted in reStructuredText.
:param command: Bash shell command
:type command: string
:param nindent: Indentation level
:type nindent: integer
:param env: Environment variable replacement dictionary. The Bash
command is pre-proc... | docs/support/term_echo.py | def term_echo(command, nindent=0, env=None, fpointer=None, cols=60):
"""
Print STDOUT resulting from a Bash shell command formatted in reStructuredText.
:param command: Bash shell command
:type command: string
:param nindent: Indentation level
:type nindent: integer
:param env: Environm... | def term_echo(command, nindent=0, env=None, fpointer=None, cols=60):
"""
Print STDOUT resulting from a Bash shell command formatted in reStructuredText.
:param command: Bash shell command
:type command: string
:param nindent: Indentation level
:type nindent: integer
:param env: Environm... | [
"Print",
"STDOUT",
"resulting",
"from",
"a",
"Bash",
"shell",
"command",
"formatted",
"in",
"reStructuredText",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/term_echo.py#L68-L124 | [
"def",
"term_echo",
"(",
"command",
",",
"nindent",
"=",
"0",
",",
"env",
"=",
"None",
",",
"fpointer",
"=",
"None",
",",
"cols",
"=",
"60",
")",
":",
"# pylint: disable=R0204",
"# Set argparse width so that output does not need horizontal scroll",
"# bar in narrow wi... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | Command.log | Small log helper | systemjs/management/commands/systemjs_bundle.py | def log(self, msg, level=2):
"""
Small log helper
"""
if self.verbosity >= level:
self.stdout.write(msg) | def log(self, msg, level=2):
"""
Small log helper
"""
if self.verbosity >= level:
self.stdout.write(msg) | [
"Small",
"log",
"helper"
] | sergei-maertens/django-systemjs | python | https://github.com/sergei-maertens/django-systemjs/blob/efd4a3862a39d9771609a25a5556f36023cf6e5c/systemjs/management/commands/systemjs_bundle.py#L26-L31 | [
"def",
"log",
"(",
"self",
",",
"msg",
",",
"level",
"=",
"2",
")",
":",
"if",
"self",
".",
"verbosity",
">=",
"level",
":",
"self",
".",
"stdout",
".",
"write",
"(",
"msg",
")"
] | efd4a3862a39d9771609a25a5556f36023cf6e5c |
test | cached | alternative to reify and property decorators. caches the value when it's
generated. It cashes it as instance._name_of_the_property. | libaaron/libaaron.py | def cached(method) -> property:
"""alternative to reify and property decorators. caches the value when it's
generated. It cashes it as instance._name_of_the_property.
"""
name = "_" + method.__name__
@property
def wrapper(self):
try:
return getattr(self, name)
except... | def cached(method) -> property:
"""alternative to reify and property decorators. caches the value when it's
generated. It cashes it as instance._name_of_the_property.
"""
name = "_" + method.__name__
@property
def wrapper(self):
try:
return getattr(self, name)
except... | [
"alternative",
"to",
"reify",
"and",
"property",
"decorators",
".",
"caches",
"the",
"value",
"when",
"it",
"s",
"generated",
".",
"It",
"cashes",
"it",
"as",
"instance",
".",
"_name_of_the_property",
"."
] | ninjaaron/libaaron | python | https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L42-L57 | [
"def",
"cached",
"(",
"method",
")",
"->",
"property",
":",
"name",
"=",
"\"_\"",
"+",
"method",
".",
"__name__",
"@",
"property",
"def",
"wrapper",
"(",
"self",
")",
":",
"try",
":",
"return",
"getattr",
"(",
"self",
",",
"name",
")",
"except",
"Att... | a2ee417b784ca72c89c05bddb2e3e815a6b95154 |
test | chunkiter | break an iterable into chunks and yield those chunks as lists
until there's nothing left to yeild. | libaaron/libaaron.py | def chunkiter(iterable, chunksize):
"""break an iterable into chunks and yield those chunks as lists
until there's nothing left to yeild.
"""
iterator = iter(iterable)
for chunk in iter(lambda: list(itertools.islice(iterator, chunksize)), []):
yield chunk | def chunkiter(iterable, chunksize):
"""break an iterable into chunks and yield those chunks as lists
until there's nothing left to yeild.
"""
iterator = iter(iterable)
for chunk in iter(lambda: list(itertools.islice(iterator, chunksize)), []):
yield chunk | [
"break",
"an",
"iterable",
"into",
"chunks",
"and",
"yield",
"those",
"chunks",
"as",
"lists",
"until",
"there",
"s",
"nothing",
"left",
"to",
"yeild",
"."
] | ninjaaron/libaaron | python | https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L66-L72 | [
"def",
"chunkiter",
"(",
"iterable",
",",
"chunksize",
")",
":",
"iterator",
"=",
"iter",
"(",
"iterable",
")",
"for",
"chunk",
"in",
"iter",
"(",
"lambda",
":",
"list",
"(",
"itertools",
".",
"islice",
"(",
"iterator",
",",
"chunksize",
")",
")",
",",... | a2ee417b784ca72c89c05bddb2e3e815a6b95154 |
test | chunkprocess | take a function that taks an iterable as the first argument.
return a wrapper that will break an iterable into chunks using
chunkiter and run each chunk in function, yielding the value of each
function call as an iterator. | libaaron/libaaron.py | def chunkprocess(func):
"""take a function that taks an iterable as the first argument.
return a wrapper that will break an iterable into chunks using
chunkiter and run each chunk in function, yielding the value of each
function call as an iterator.
"""
@functools.wraps(func)
def wrapper(it... | def chunkprocess(func):
"""take a function that taks an iterable as the first argument.
return a wrapper that will break an iterable into chunks using
chunkiter and run each chunk in function, yielding the value of each
function call as an iterator.
"""
@functools.wraps(func)
def wrapper(it... | [
"take",
"a",
"function",
"that",
"taks",
"an",
"iterable",
"as",
"the",
"first",
"argument",
".",
"return",
"a",
"wrapper",
"that",
"will",
"break",
"an",
"iterable",
"into",
"chunks",
"using",
"chunkiter",
"and",
"run",
"each",
"chunk",
"in",
"function",
... | ninjaaron/libaaron | python | https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L75-L87 | [
"def",
"chunkprocess",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"iterable",
",",
"chunksize",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"chunk",
"in",
"chunkiter",
"(",
"iterabl... | a2ee417b784ca72c89c05bddb2e3e815a6b95154 |
test | flatten | recursively flatten nested objects | libaaron/libaaron.py | def flatten(iterable, map2iter=None):
"""recursively flatten nested objects"""
if map2iter and isinstance(iterable):
iterable = map2iter(iterable)
for item in iterable:
if isinstance(item, str) or not isinstance(item, abc.Iterable):
yield item
else:
yield fro... | def flatten(iterable, map2iter=None):
"""recursively flatten nested objects"""
if map2iter and isinstance(iterable):
iterable = map2iter(iterable)
for item in iterable:
if isinstance(item, str) or not isinstance(item, abc.Iterable):
yield item
else:
yield fro... | [
"recursively",
"flatten",
"nested",
"objects"
] | ninjaaron/libaaron | python | https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L112-L121 | [
"def",
"flatten",
"(",
"iterable",
",",
"map2iter",
"=",
"None",
")",
":",
"if",
"map2iter",
"and",
"isinstance",
"(",
"iterable",
")",
":",
"iterable",
"=",
"map2iter",
"(",
"iterable",
")",
"for",
"item",
"in",
"iterable",
":",
"if",
"isinstance",
"(",... | a2ee417b784ca72c89c05bddb2e3e815a6b95154 |
test | deepupdate | update one dictionary from another recursively. Only individual
values will be overwritten--not entire branches of nested
dictionaries. | libaaron/libaaron.py | def deepupdate(
mapping: abc.MutableMapping, other: abc.Mapping, listextend=False
):
"""update one dictionary from another recursively. Only individual
values will be overwritten--not entire branches of nested
dictionaries.
"""
def inner(other, previouskeys):
"""previouskeys is a tuple ... | def deepupdate(
mapping: abc.MutableMapping, other: abc.Mapping, listextend=False
):
"""update one dictionary from another recursively. Only individual
values will be overwritten--not entire branches of nested
dictionaries.
"""
def inner(other, previouskeys):
"""previouskeys is a tuple ... | [
"update",
"one",
"dictionary",
"from",
"another",
"recursively",
".",
"Only",
"individual",
"values",
"will",
"be",
"overwritten",
"--",
"not",
"entire",
"branches",
"of",
"nested",
"dictionaries",
"."
] | ninjaaron/libaaron | python | https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L124-L155 | [
"def",
"deepupdate",
"(",
"mapping",
":",
"abc",
".",
"MutableMapping",
",",
"other",
":",
"abc",
".",
"Mapping",
",",
"listextend",
"=",
"False",
")",
":",
"def",
"inner",
"(",
"other",
",",
"previouskeys",
")",
":",
"\"\"\"previouskeys is a tuple that stores... | a2ee417b784ca72c89c05bddb2e3e815a6b95154 |
test | quietinterrupt | add a handler for SIGINT that optionally prints a given message.
For stopping scripts without having to see the stacktrace. | libaaron/libaaron.py | def quietinterrupt(msg=None):
"""add a handler for SIGINT that optionally prints a given message.
For stopping scripts without having to see the stacktrace.
"""
def handler():
if msg:
print(msg, file=sys.stderr)
sys.exit(1)
signal.signal(signal.SIGINT, handler) | def quietinterrupt(msg=None):
"""add a handler for SIGINT that optionally prints a given message.
For stopping scripts without having to see the stacktrace.
"""
def handler():
if msg:
print(msg, file=sys.stderr)
sys.exit(1)
signal.signal(signal.SIGINT, handler) | [
"add",
"a",
"handler",
"for",
"SIGINT",
"that",
"optionally",
"prints",
"a",
"given",
"message",
".",
"For",
"stopping",
"scripts",
"without",
"having",
"to",
"see",
"the",
"stacktrace",
"."
] | ninjaaron/libaaron | python | https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L158-L168 | [
"def",
"quietinterrupt",
"(",
"msg",
"=",
"None",
")",
":",
"def",
"handler",
"(",
")",
":",
"if",
"msg",
":",
"print",
"(",
"msg",
",",
"file",
"=",
"sys",
".",
"stderr",
")",
"sys",
".",
"exit",
"(",
"1",
")",
"signal",
".",
"signal",
"(",
"s... | a2ee417b784ca72c89c05bddb2e3e815a6b95154 |
test | printtsv | stupidly print an iterable of iterables in TSV format | libaaron/libaaron.py | def printtsv(table, sep="\t", file=sys.stdout):
"""stupidly print an iterable of iterables in TSV format"""
for record in table:
print(*record, sep=sep, file=file) | def printtsv(table, sep="\t", file=sys.stdout):
"""stupidly print an iterable of iterables in TSV format"""
for record in table:
print(*record, sep=sep, file=file) | [
"stupidly",
"print",
"an",
"iterable",
"of",
"iterables",
"in",
"TSV",
"format"
] | ninjaaron/libaaron | python | https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L236-L239 | [
"def",
"printtsv",
"(",
"table",
",",
"sep",
"=",
"\"\\t\"",
",",
"file",
"=",
"sys",
".",
"stdout",
")",
":",
"for",
"record",
"in",
"table",
":",
"print",
"(",
"*",
"record",
",",
"sep",
"=",
"sep",
",",
"file",
"=",
"file",
")"
] | a2ee417b784ca72c89c05bddb2e3e815a6b95154 |
test | mkdummy | Make a placeholder object that uses its own name for its repr | libaaron/libaaron.py | def mkdummy(name, **attrs):
"""Make a placeholder object that uses its own name for its repr"""
return type(
name, (), dict(__repr__=(lambda self: "<%s>" % name), **attrs)
)() | def mkdummy(name, **attrs):
"""Make a placeholder object that uses its own name for its repr"""
return type(
name, (), dict(__repr__=(lambda self: "<%s>" % name), **attrs)
)() | [
"Make",
"a",
"placeholder",
"object",
"that",
"uses",
"its",
"own",
"name",
"for",
"its",
"repr"
] | ninjaaron/libaaron | python | https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L242-L246 | [
"def",
"mkdummy",
"(",
"name",
",",
"*",
"*",
"attrs",
")",
":",
"return",
"type",
"(",
"name",
",",
"(",
")",
",",
"dict",
"(",
"__repr__",
"=",
"(",
"lambda",
"self",
":",
"\"<%s>\"",
"%",
"name",
")",
",",
"*",
"*",
"attrs",
")",
")",
"(",
... | a2ee417b784ca72c89c05bddb2e3e815a6b95154 |
test | pipe | pipe(value, f, g, h) == h(g(f(value))) | libaaron/libaaron.py | def pipe(value, *functions, funcs=None):
"""pipe(value, f, g, h) == h(g(f(value)))"""
if funcs:
functions = funcs
for function in functions:
value = function(value)
return value | def pipe(value, *functions, funcs=None):
"""pipe(value, f, g, h) == h(g(f(value)))"""
if funcs:
functions = funcs
for function in functions:
value = function(value)
return value | [
"pipe",
"(",
"value",
"f",
"g",
"h",
")",
"==",
"h",
"(",
"g",
"(",
"f",
"(",
"value",
")))"
] | ninjaaron/libaaron | python | https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L249-L255 | [
"def",
"pipe",
"(",
"value",
",",
"*",
"functions",
",",
"funcs",
"=",
"None",
")",
":",
"if",
"funcs",
":",
"functions",
"=",
"funcs",
"for",
"function",
"in",
"functions",
":",
"value",
"=",
"function",
"(",
"value",
")",
"return",
"value"
] | a2ee417b784ca72c89c05bddb2e3e815a6b95154 |
test | pipeline | like pipe, but curried:
pipline(f, g, h)(*args, **kwargs) == h(g(f(*args, **kwargs))) | libaaron/libaaron.py | def pipeline(*functions, funcs=None):
"""like pipe, but curried:
pipline(f, g, h)(*args, **kwargs) == h(g(f(*args, **kwargs)))
"""
if funcs:
functions = funcs
head, *tail = functions
return lambda *args, **kwargs: pipe(head(*args, **kwargs), funcs=tail) | def pipeline(*functions, funcs=None):
"""like pipe, but curried:
pipline(f, g, h)(*args, **kwargs) == h(g(f(*args, **kwargs)))
"""
if funcs:
functions = funcs
head, *tail = functions
return lambda *args, **kwargs: pipe(head(*args, **kwargs), funcs=tail) | [
"like",
"pipe",
"but",
"curried",
":"
] | ninjaaron/libaaron | python | https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L258-L266 | [
"def",
"pipeline",
"(",
"*",
"functions",
",",
"funcs",
"=",
"None",
")",
":",
"if",
"funcs",
":",
"functions",
"=",
"funcs",
"head",
",",
"",
"*",
"tail",
"=",
"functions",
"return",
"lambda",
"*",
"args",
",",
"*",
"*",
"kwargs",
":",
"pipe",
"("... | a2ee417b784ca72c89c05bddb2e3e815a6b95154 |
test | PBytes.human_readable | returns the size of size as a tuple of:
(number, single-letter-unit)
If the decimal flag is set to true, units 1000 is used as the
divisor, rather than 1024. | libaaron/libaaron.py | def human_readable(self, decimal=False):
"""returns the size of size as a tuple of:
(number, single-letter-unit)
If the decimal flag is set to true, units 1000 is used as the
divisor, rather than 1024.
"""
divisor = 1000 if decimal else 1024
number = int(sel... | def human_readable(self, decimal=False):
"""returns the size of size as a tuple of:
(number, single-letter-unit)
If the decimal flag is set to true, units 1000 is used as the
divisor, rather than 1024.
"""
divisor = 1000 if decimal else 1024
number = int(sel... | [
"returns",
"the",
"size",
"of",
"size",
"as",
"a",
"tuple",
"of",
":"
] | ninjaaron/libaaron | python | https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L194-L209 | [
"def",
"human_readable",
"(",
"self",
",",
"decimal",
"=",
"False",
")",
":",
"divisor",
"=",
"1000",
"if",
"decimal",
"else",
"1024",
"number",
"=",
"int",
"(",
"self",
")",
"unit",
"=",
"\"\"",
"for",
"unit",
"in",
"self",
".",
"units",
":",
"if",
... | a2ee417b784ca72c89c05bddb2e3e815a6b95154 |
test | PBytes.from_str | attempt to parse a size in bytes from a human-readable string. | libaaron/libaaron.py | def from_str(cls, human_readable_str, decimal=False, bits=False):
"""attempt to parse a size in bytes from a human-readable string."""
divisor = 1000 if decimal else 1024
num = []
c = ""
for c in human_readable_str:
if c not in cls.digits:
break
... | def from_str(cls, human_readable_str, decimal=False, bits=False):
"""attempt to parse a size in bytes from a human-readable string."""
divisor = 1000 if decimal else 1024
num = []
c = ""
for c in human_readable_str:
if c not in cls.digits:
break
... | [
"attempt",
"to",
"parse",
"a",
"size",
"in",
"bytes",
"from",
"a",
"human",
"-",
"readable",
"string",
"."
] | ninjaaron/libaaron | python | https://github.com/ninjaaron/libaaron/blob/a2ee417b784ca72c89c05bddb2e3e815a6b95154/libaaron/libaaron.py#L212-L228 | [
"def",
"from_str",
"(",
"cls",
",",
"human_readable_str",
",",
"decimal",
"=",
"False",
",",
"bits",
"=",
"False",
")",
":",
"divisor",
"=",
"1000",
"if",
"decimal",
"else",
"1024",
"num",
"=",
"[",
"]",
"c",
"=",
"\"\"",
"for",
"c",
"in",
"human_rea... | a2ee417b784ca72c89c05bddb2e3e815a6b95154 |
test | cli | Command line interface for YOURLS.
Configuration parameters can be passed as switches or stored in .yourls or
~/.yourls.
If your YOURLS server requires authentication, please provide one of the
following:
\b
• apiurl and signature
• apiurl, username, and password
Configuration file f... | yourls/__main__.py | def cli(ctx, apiurl, signature, username, password):
"""Command line interface for YOURLS.
Configuration parameters can be passed as switches or stored in .yourls or
~/.yourls.
If your YOURLS server requires authentication, please provide one of the
following:
\b
• apiurl and signature
... | def cli(ctx, apiurl, signature, username, password):
"""Command line interface for YOURLS.
Configuration parameters can be passed as switches or stored in .yourls or
~/.yourls.
If your YOURLS server requires authentication, please provide one of the
following:
\b
• apiurl and signature
... | [
"Command",
"line",
"interface",
"for",
"YOURLS",
"."
] | RazerM/yourls-python | python | https://github.com/RazerM/yourls-python/blob/716845562a2bbb430de3c379c9481b195e451ccf/yourls/__main__.py#L105-L134 | [
"def",
"cli",
"(",
"ctx",
",",
"apiurl",
",",
"signature",
",",
"username",
",",
"password",
")",
":",
"if",
"apiurl",
"is",
"None",
":",
"raise",
"click",
".",
"UsageError",
"(",
"\"apiurl missing. See 'yourls --help'\"",
")",
"auth_params",
"=",
"dict",
"(... | 716845562a2bbb430de3c379c9481b195e451ccf |
test | trace_module | Trace eng wave module exceptions. | docs/support/trace_ex_eng_wave_core.py | def trace_module(no_print=True):
"""Trace eng wave module exceptions."""
mname = "wave_core"
fname = "peng"
module_prefix = "peng.{0}.Waveform.".format(mname)
callable_names = ("__init__",)
return docs.support.trace_support.run_trace(
mname, fname, module_prefix, callable_names, no_print... | def trace_module(no_print=True):
"""Trace eng wave module exceptions."""
mname = "wave_core"
fname = "peng"
module_prefix = "peng.{0}.Waveform.".format(mname)
callable_names = ("__init__",)
return docs.support.trace_support.run_trace(
mname, fname, module_prefix, callable_names, no_print... | [
"Trace",
"eng",
"wave",
"module",
"exceptions",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/trace_ex_eng_wave_core.py#L9-L17 | [
"def",
"trace_module",
"(",
"no_print",
"=",
"True",
")",
":",
"mname",
"=",
"\"wave_core\"",
"fname",
"=",
"\"peng\"",
"module_prefix",
"=",
"\"peng.{0}.Waveform.\"",
".",
"format",
"(",
"mname",
")",
"callable_names",
"=",
"(",
"\"__init__\"",
",",
")",
"ret... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | def_links | Define Sphinx requirements links. | docs/support/requirements_to_rst.py | def def_links(mobj):
"""Define Sphinx requirements links."""
fdict = json_load(os.path.join("data", "requirements.json"))
sdeps = sorted(fdict.keys())
olines = []
for item in sdeps:
olines.append(
".. _{name}: {url}\n".format(
name=fdict[item]["name"], url=fdict[i... | def def_links(mobj):
"""Define Sphinx requirements links."""
fdict = json_load(os.path.join("data", "requirements.json"))
sdeps = sorted(fdict.keys())
olines = []
for item in sdeps:
olines.append(
".. _{name}: {url}\n".format(
name=fdict[item]["name"], url=fdict[i... | [
"Define",
"Sphinx",
"requirements",
"links",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/requirements_to_rst.py#L22-L37 | [
"def",
"def_links",
"(",
"mobj",
")",
":",
"fdict",
"=",
"json_load",
"(",
"os",
".",
"path",
".",
"join",
"(",
"\"data\"",
",",
"\"requirements.json\"",
")",
")",
"sdeps",
"=",
"sorted",
"(",
"fdict",
".",
"keys",
"(",
")",
")",
"olines",
"=",
"[",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | make_common_entry | Generate Python interpreter version entries for 2.x or 3.x series. | docs/support/requirements_to_rst.py | def make_common_entry(plist, pyver, suffix, req_ver):
"""Generate Python interpreter version entries for 2.x or 3.x series."""
prefix = "Python {pyver}.x{suffix}".format(pyver=pyver, suffix=suffix)
plist.append("{prefix}{ver}".format(prefix=prefix, ver=ops_to_words(req_ver))) | def make_common_entry(plist, pyver, suffix, req_ver):
"""Generate Python interpreter version entries for 2.x or 3.x series."""
prefix = "Python {pyver}.x{suffix}".format(pyver=pyver, suffix=suffix)
plist.append("{prefix}{ver}".format(prefix=prefix, ver=ops_to_words(req_ver))) | [
"Generate",
"Python",
"interpreter",
"version",
"entries",
"for",
"2",
".",
"x",
"or",
"3",
".",
"x",
"series",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/requirements_to_rst.py#L40-L43 | [
"def",
"make_common_entry",
"(",
"plist",
",",
"pyver",
",",
"suffix",
",",
"req_ver",
")",
":",
"prefix",
"=",
"\"Python {pyver}.x{suffix}\"",
".",
"format",
"(",
"pyver",
"=",
"pyver",
",",
"suffix",
"=",
"suffix",
")",
"plist",
".",
"append",
"(",
"\"{p... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | make_multi_entry | Generate Python interpreter version entries. | docs/support/requirements_to_rst.py | def make_multi_entry(plist, pkg_pyvers, ver_dict):
"""Generate Python interpreter version entries."""
for pyver in pkg_pyvers:
pver = pyver[2] + "." + pyver[3:]
plist.append("Python {0}: {1}".format(pver, ops_to_words(ver_dict[pyver]))) | def make_multi_entry(plist, pkg_pyvers, ver_dict):
"""Generate Python interpreter version entries."""
for pyver in pkg_pyvers:
pver = pyver[2] + "." + pyver[3:]
plist.append("Python {0}: {1}".format(pver, ops_to_words(ver_dict[pyver]))) | [
"Generate",
"Python",
"interpreter",
"version",
"entries",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/requirements_to_rst.py#L46-L50 | [
"def",
"make_multi_entry",
"(",
"plist",
",",
"pkg_pyvers",
",",
"ver_dict",
")",
":",
"for",
"pyver",
"in",
"pkg_pyvers",
":",
"pver",
"=",
"pyver",
"[",
"2",
"]",
"+",
"\".\"",
"+",
"pyver",
"[",
"3",
":",
"]",
"plist",
".",
"append",
"(",
"\"Pytho... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | op_to_words | Translate >=, ==, <= to words. | docs/support/requirements_to_rst.py | def op_to_words(item):
"""Translate >=, ==, <= to words."""
sdicts = [
{"==": ""},
{">=": " or newer"},
{">": "newer than "},
{"<=": " or older"},
{"<": "older than "},
{"!=": "except "},
]
for sdict in sdicts:
prefix = list(sdict.keys())[0]
... | def op_to_words(item):
"""Translate >=, ==, <= to words."""
sdicts = [
{"==": ""},
{">=": " or newer"},
{">": "newer than "},
{"<=": " or older"},
{"<": "older than "},
{"!=": "except "},
]
for sdict in sdicts:
prefix = list(sdict.keys())[0]
... | [
"Translate",
">",
"=",
"==",
"<",
"=",
"to",
"words",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/requirements_to_rst.py#L53-L74 | [
"def",
"op_to_words",
"(",
"item",
")",
":",
"sdicts",
"=",
"[",
"{",
"\"==\"",
":",
"\"\"",
"}",
",",
"{",
"\">=\"",
":",
"\" or newer\"",
"}",
",",
"{",
"\">\"",
":",
"\"newer than \"",
"}",
",",
"{",
"\"<=\"",
":",
"\" or older\"",
"}",
",",
"{",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | ops_to_words | Translate requirement specification to words. | docs/support/requirements_to_rst.py | def ops_to_words(item):
"""Translate requirement specification to words."""
unsupp_ops = ["~=", "==="]
# Ordered for "pleasant" word specification
supp_ops = [">=", ">", "==", "<=", "<", "!="]
tokens = sorted(item.split(","), reverse=True)
actual_tokens = []
for req in tokens:
for o... | def ops_to_words(item):
"""Translate requirement specification to words."""
unsupp_ops = ["~=", "==="]
# Ordered for "pleasant" word specification
supp_ops = [">=", ">", "==", "<=", "<", "!="]
tokens = sorted(item.split(","), reverse=True)
actual_tokens = []
for req in tokens:
for o... | [
"Translate",
"requirement",
"specification",
"to",
"words",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/requirements_to_rst.py#L77-L102 | [
"def",
"ops_to_words",
"(",
"item",
")",
":",
"unsupp_ops",
"=",
"[",
"\"~=\"",
",",
"\"===\"",
"]",
"# Ordered for \"pleasant\" word specification",
"supp_ops",
"=",
"[",
"\">=\"",
",",
"\">\"",
",",
"\"==\"",
",",
"\"<=\"",
",",
"\"<\"",
",",
"\"!=\"",
"]",... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | proc_requirements | Get requirements in reStructuredText format. | docs/support/requirements_to_rst.py | def proc_requirements(mobj):
"""Get requirements in reStructuredText format."""
pyvers = ["py{0}".format(item.replace(".", "")) for item in get_supported_interps()]
py2vers = sorted([item for item in pyvers if item.startswith("py2")])
py3vers = sorted([item for item in pyvers if item.startswith("py3")])... | def proc_requirements(mobj):
"""Get requirements in reStructuredText format."""
pyvers = ["py{0}".format(item.replace(".", "")) for item in get_supported_interps()]
py2vers = sorted([item for item in pyvers if item.startswith("py2")])
py3vers = sorted([item for item in pyvers if item.startswith("py3")])... | [
"Get",
"requirements",
"in",
"reStructuredText",
"format",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/requirements_to_rst.py#L105-L207 | [
"def",
"proc_requirements",
"(",
"mobj",
")",
":",
"pyvers",
"=",
"[",
"\"py{0}\"",
".",
"format",
"(",
"item",
".",
"replace",
"(",
"\".\"",
",",
"\"\"",
")",
")",
"for",
"item",
"in",
"get_supported_interps",
"(",
")",
"]",
"py2vers",
"=",
"sorted",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _make_version | Generate version string from tuple (almost entirely from coveragepy). | peng/pkgdata.py | def _make_version(major, minor, micro, level, serial):
"""Generate version string from tuple (almost entirely from coveragepy)."""
level_dict = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}
if level not in level_dict:
raise RuntimeError("Invalid release level")
version = "{0:d}.{1:... | def _make_version(major, minor, micro, level, serial):
"""Generate version string from tuple (almost entirely from coveragepy)."""
level_dict = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}
if level not in level_dict:
raise RuntimeError("Invalid release level")
version = "{0:d}.{1:... | [
"Generate",
"version",
"string",
"from",
"tuple",
"(",
"almost",
"entirely",
"from",
"coveragepy",
")",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/pkgdata.py#L121-L131 | [
"def",
"_make_version",
"(",
"major",
",",
"minor",
",",
"micro",
",",
"level",
",",
"serial",
")",
":",
"level_dict",
"=",
"{",
"\"alpha\"",
":",
"\"a\"",
",",
"\"beta\"",
":",
"\"b\"",
",",
"\"candidate\"",
":",
"\"rc\"",
",",
"\"final\"",
":",
"\"\"",... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _chunk_noise | Chunk input noise data into valid Touchstone file rows. | peng/touchstone.py | def _chunk_noise(noise):
"""Chunk input noise data into valid Touchstone file rows."""
data = zip(
noise["freq"],
noise["nf"],
np.abs(noise["rc"]),
np.angle(noise["rc"]),
noise["res"],
)
for freq, nf, rcmag, rcangle, res in data:
yield freq, nf, rcmag, rca... | def _chunk_noise(noise):
"""Chunk input noise data into valid Touchstone file rows."""
data = zip(
noise["freq"],
noise["nf"],
np.abs(noise["rc"]),
np.angle(noise["rc"]),
noise["res"],
)
for freq, nf, rcmag, rcangle, res in data:
yield freq, nf, rcmag, rca... | [
"Chunk",
"input",
"noise",
"data",
"into",
"valid",
"Touchstone",
"file",
"rows",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/touchstone.py#L40-L50 | [
"def",
"_chunk_noise",
"(",
"noise",
")",
":",
"data",
"=",
"zip",
"(",
"noise",
"[",
"\"freq\"",
"]",
",",
"noise",
"[",
"\"nf\"",
"]",
",",
"np",
".",
"abs",
"(",
"noise",
"[",
"\"rc\"",
"]",
")",
",",
"np",
".",
"angle",
"(",
"noise",
"[",
"... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _chunk_pars | Chunk input data into valid Touchstone file rows. | peng/touchstone.py | def _chunk_pars(freq_vector, data_matrix, pformat):
"""Chunk input data into valid Touchstone file rows."""
pformat = pformat.upper()
length = 4
for freq, data in zip(freq_vector, data_matrix):
data = data.flatten()
for index in range(0, data.size, length):
fpoint = [freq] if... | def _chunk_pars(freq_vector, data_matrix, pformat):
"""Chunk input data into valid Touchstone file rows."""
pformat = pformat.upper()
length = 4
for freq, data in zip(freq_vector, data_matrix):
data = data.flatten()
for index in range(0, data.size, length):
fpoint = [freq] if... | [
"Chunk",
"input",
"data",
"into",
"valid",
"Touchstone",
"file",
"rows",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/touchstone.py#L53-L75 | [
"def",
"_chunk_pars",
"(",
"freq_vector",
",",
"data_matrix",
",",
"pformat",
")",
":",
"pformat",
"=",
"pformat",
".",
"upper",
"(",
")",
"length",
"=",
"4",
"for",
"freq",
",",
"data",
"in",
"zip",
"(",
"freq_vector",
",",
"data_matrix",
")",
":",
"d... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | read_touchstone | r"""
Read a `Touchstone <https://ibis.org/connector/touchstone_spec11.pdf>`_ file.
According to the specification a data line can have at most values for four
complex parameters (plus potentially the frequency point), however this
function is able to process malformed files as long as they have the
... | peng/touchstone.py | def read_touchstone(fname):
r"""
Read a `Touchstone <https://ibis.org/connector/touchstone_spec11.pdf>`_ file.
According to the specification a data line can have at most values for four
complex parameters (plus potentially the frequency point), however this
function is able to process malformed fi... | def read_touchstone(fname):
r"""
Read a `Touchstone <https://ibis.org/connector/touchstone_spec11.pdf>`_ file.
According to the specification a data line can have at most values for four
complex parameters (plus potentially the frequency point), however this
function is able to process malformed fi... | [
"r",
"Read",
"a",
"Touchstone",
"<https",
":",
"//",
"ibis",
".",
"org",
"/",
"connector",
"/",
"touchstone_spec11",
".",
"pdf",
">",
"_",
"file",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/touchstone.py#L79-L278 | [
"def",
"read_touchstone",
"(",
"fname",
")",
":",
"# pylint: disable=R0912,R0915,W0702",
"# Exceptions definitions",
"exnports",
"=",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"RuntimeError",
",",
"\"File *[fname]* does not have a valid extension\"",
")",
"exnoopt",
"=",
"... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | write_touchstone | r"""
Write a `Touchstone`_ file.
Parameter data is first resized to an :code:`points` x :code:`nports` x
:code:`nports` where :code:`points` represents the number of frequency
points and :code:`nports` represents the number of ports in the file; then
parameter data is written to file in scientific ... | peng/touchstone.py | def write_touchstone(fname, options, data, noise=None, frac_length=10, exp_length=2):
r"""
Write a `Touchstone`_ file.
Parameter data is first resized to an :code:`points` x :code:`nports` x
:code:`nports` where :code:`points` represents the number of frequency
points and :code:`nports` represents ... | def write_touchstone(fname, options, data, noise=None, frac_length=10, exp_length=2):
r"""
Write a `Touchstone`_ file.
Parameter data is first resized to an :code:`points` x :code:`nports` x
:code:`nports` where :code:`points` represents the number of frequency
points and :code:`nports` represents ... | [
"r",
"Write",
"a",
"Touchstone",
"_",
"file",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/touchstone.py#L289-L395 | [
"def",
"write_touchstone",
"(",
"fname",
",",
"options",
",",
"data",
",",
"noise",
"=",
"None",
",",
"frac_length",
"=",
"10",
",",
"exp_length",
"=",
"2",
")",
":",
"# pylint: disable=R0913",
"# Exceptions definitions",
"exnports",
"=",
"pexdoc",
".",
"exh",... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _bound_waveform | Add independent variable vector bounds if they are not in vector. | peng/wave_functions.py | def _bound_waveform(wave, indep_min, indep_max):
"""Add independent variable vector bounds if they are not in vector."""
indep_min, indep_max = _validate_min_max(wave, indep_min, indep_max)
indep_vector = copy.copy(wave._indep_vector)
if (
isinstance(indep_min, float) or isinstance(indep_max, fl... | def _bound_waveform(wave, indep_min, indep_max):
"""Add independent variable vector bounds if they are not in vector."""
indep_min, indep_max = _validate_min_max(wave, indep_min, indep_max)
indep_vector = copy.copy(wave._indep_vector)
if (
isinstance(indep_min, float) or isinstance(indep_max, fl... | [
"Add",
"independent",
"variable",
"vector",
"bounds",
"if",
"they",
"are",
"not",
"in",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L48-L64 | [
"def",
"_bound_waveform",
"(",
"wave",
",",
"indep_min",
",",
"indep_max",
")",
":",
"indep_min",
",",
"indep_max",
"=",
"_validate_min_max",
"(",
"wave",
",",
"indep_min",
",",
"indep_max",
")",
"indep_vector",
"=",
"copy",
".",
"copy",
"(",
"wave",
".",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _build_units | Build unit math operations. | peng/wave_functions.py | def _build_units(indep_units, dep_units, op):
"""Build unit math operations."""
if (not dep_units) and (not indep_units):
return ""
if dep_units and (not indep_units):
return dep_units
if (not dep_units) and indep_units:
return (
remove_extra_delims("1{0}({1})".format... | def _build_units(indep_units, dep_units, op):
"""Build unit math operations."""
if (not dep_units) and (not indep_units):
return ""
if dep_units and (not indep_units):
return dep_units
if (not dep_units) and indep_units:
return (
remove_extra_delims("1{0}({1})".format... | [
"Build",
"unit",
"math",
"operations",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L67-L79 | [
"def",
"_build_units",
"(",
"indep_units",
",",
"dep_units",
",",
"op",
")",
":",
"if",
"(",
"not",
"dep_units",
")",
"and",
"(",
"not",
"indep_units",
")",
":",
"return",
"\"\"",
"if",
"dep_units",
"and",
"(",
"not",
"indep_units",
")",
":",
"return",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _operation | Perform generic operation on a waveform object. | peng/wave_functions.py | def _operation(wave, desc, units, fpointer):
"""Perform generic operation on a waveform object."""
ret = copy.copy(wave)
ret.dep_units = units
ret.dep_name = "{0}({1})".format(desc, ret.dep_name)
ret._dep_vector = fpointer(ret._dep_vector)
return ret | def _operation(wave, desc, units, fpointer):
"""Perform generic operation on a waveform object."""
ret = copy.copy(wave)
ret.dep_units = units
ret.dep_name = "{0}({1})".format(desc, ret.dep_name)
ret._dep_vector = fpointer(ret._dep_vector)
return ret | [
"Perform",
"generic",
"operation",
"on",
"a",
"waveform",
"object",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L82-L88 | [
"def",
"_operation",
"(",
"wave",
",",
"desc",
",",
"units",
",",
"fpointer",
")",
":",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")",
"ret",
".",
"dep_units",
"=",
"units",
"ret",
".",
"dep_name",
"=",
"\"{0}({1})\"",
".",
"format",
"(",
"desc",... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _running_area | Calculate running area under curve. | peng/wave_functions.py | def _running_area(indep_vector, dep_vector):
"""Calculate running area under curve."""
rect_height = np.minimum(dep_vector[:-1], dep_vector[1:])
rect_base = np.diff(indep_vector)
rect_area = np.multiply(rect_height, rect_base)
triang_height = np.abs(np.diff(dep_vector))
triang_area = 0.5 * np.mu... | def _running_area(indep_vector, dep_vector):
"""Calculate running area under curve."""
rect_height = np.minimum(dep_vector[:-1], dep_vector[1:])
rect_base = np.diff(indep_vector)
rect_area = np.multiply(rect_height, rect_base)
triang_height = np.abs(np.diff(dep_vector))
triang_area = 0.5 * np.mu... | [
"Calculate",
"running",
"area",
"under",
"curve",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L91-L98 | [
"def",
"_running_area",
"(",
"indep_vector",
",",
"dep_vector",
")",
":",
"rect_height",
"=",
"np",
".",
"minimum",
"(",
"dep_vector",
"[",
":",
"-",
"1",
"]",
",",
"dep_vector",
"[",
"1",
":",
"]",
")",
"rect_base",
"=",
"np",
".",
"diff",
"(",
"ind... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _validate_min_max | Validate min and max bounds are within waveform's independent variable vector. | peng/wave_functions.py | def _validate_min_max(wave, indep_min, indep_max):
"""Validate min and max bounds are within waveform's independent variable vector."""
imin, imax = False, False
if indep_min is None:
indep_min = wave._indep_vector[0]
imin = True
if indep_max is None:
indep_max = wave._indep_vect... | def _validate_min_max(wave, indep_min, indep_max):
"""Validate min and max bounds are within waveform's independent variable vector."""
imin, imax = False, False
if indep_min is None:
indep_min = wave._indep_vector[0]
imin = True
if indep_max is None:
indep_max = wave._indep_vect... | [
"Validate",
"min",
"and",
"max",
"bounds",
"are",
"within",
"waveform",
"s",
"independent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L101-L130 | [
"def",
"_validate_min_max",
"(",
"wave",
",",
"indep_min",
",",
"indep_max",
")",
":",
"imin",
",",
"imax",
"=",
"False",
",",
"False",
"if",
"indep_min",
"is",
"None",
":",
"indep_min",
"=",
"wave",
".",
"_indep_vector",
"[",
"0",
"]",
"imin",
"=",
"T... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | acos | r"""
Return the arc cosine of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. peng.wave_fu... | peng/wave_functions.py | def acos(wave):
r"""
Return the arc cosine of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for... | def acos(wave):
r"""
Return the arc cosine of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for... | [
"r",
"Return",
"the",
"arc",
"cosine",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L134-L159 | [
"def",
"acos",
"(",
"wave",
")",
":",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"ValueError",
",",
"\"Math domain error\"",
",",
"bool",
"(",
"(",
"min",
"(",
"wave",
".",
"_dep_vector",
")",
"<",
"-",
"1",
")",
"or",
"(",
"max",
"(",
"wave",
".",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | acosh | r"""
Return the hyperbolic arc cosine of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. p... | peng/wave_functions.py | def acosh(wave):
r"""
Return the hyperbolic arc cosine of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions docum... | def acosh(wave):
r"""
Return the hyperbolic arc cosine of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions docum... | [
"r",
"Return",
"the",
"hyperbolic",
"arc",
"cosine",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L163-L184 | [
"def",
"acosh",
"(",
"wave",
")",
":",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"ValueError",
",",
"\"Math domain error\"",
",",
"bool",
"(",
"min",
"(",
"wave",
".",
"_dep_vector",
")",
"<",
"1",
")",
")",
"return",
"_operation",
"(",
"wave",
",",
"... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | asin | r"""
Return the arc sine of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. peng.wave_func... | peng/wave_functions.py | def asin(wave):
r"""
Return the arc sine of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
... | def asin(wave):
r"""
Return the arc sine of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
... | [
"r",
"Return",
"the",
"arc",
"sine",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L188-L213 | [
"def",
"asin",
"(",
"wave",
")",
":",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"ValueError",
",",
"\"Math domain error\"",
",",
"bool",
"(",
"(",
"min",
"(",
"wave",
".",
"_dep_vector",
")",
"<",
"-",
"1",
")",
"or",
"(",
"max",
"(",
"wave",
".",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | atanh | r"""
Return the hyperbolic arc tangent of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. ... | peng/wave_functions.py | def atanh(wave):
r"""
Return the hyperbolic arc tangent of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions docu... | def atanh(wave):
r"""
Return the hyperbolic arc tangent of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions docu... | [
"r",
"Return",
"the",
"hyperbolic",
"arc",
"tangent",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L259-L284 | [
"def",
"atanh",
"(",
"wave",
")",
":",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"ValueError",
",",
"\"Math domain error\"",
",",
"bool",
"(",
"(",
"min",
"(",
"wave",
".",
"_dep_vector",
")",
"<",
"-",
"1",
")",
"or",
"(",
"max",
"(",
"wave",
".",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | average | r"""
Return the running average of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of computation
:type indep_min: integer or float
:param indep_max: Independent vector stop point of com... | peng/wave_functions.py | def average(wave, indep_min=None, indep_max=None):
r"""
Return the running average of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of computation
:type indep_min: integer or float
... | def average(wave, indep_min=None, indep_max=None):
r"""
Return the running average of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of computation
:type indep_min: integer or float
... | [
"r",
"Return",
"the",
"running",
"average",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L290-L329 | [
"def",
"average",
"(",
"wave",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")",
"_bound_waveform",
"(",
"ret",
",",
"indep_min",
",",
"indep_max",
")",
"area",
"=",
"_running_are... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | db | r"""
Return a waveform's dependent variable vector expressed in decibels.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for peng.wave_funct... | peng/wave_functions.py | def db(wave):
r"""
Return a waveform's dependent variable vector expressed in decibels.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation f... | def db(wave):
r"""
Return a waveform's dependent variable vector expressed in decibels.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation f... | [
"r",
"Return",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"expressed",
"in",
"decibels",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L395-L421 | [
"def",
"db",
"(",
"wave",
")",
":",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"ValueError",
",",
"\"Math domain error\"",
",",
"bool",
"(",
"(",
"np",
".",
"min",
"(",
"np",
".",
"abs",
"(",
"wave",
".",
"_dep_vector",
")",
")",
"<=",
"0",
")",
")... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | derivative | r"""
Return the numerical derivative of a waveform's dependent variable vector.
The method used is the `backwards differences
<https://en.wikipedia.org/wiki/
Finite_difference#Forward.2C_backward.2C_and_central_differences>`_ method
:param wave: Waveform
:type wave: :py:class:`peng.eng.Wavefo... | peng/wave_functions.py | def derivative(wave, indep_min=None, indep_max=None):
r"""
Return the numerical derivative of a waveform's dependent variable vector.
The method used is the `backwards differences
<https://en.wikipedia.org/wiki/
Finite_difference#Forward.2C_backward.2C_and_central_differences>`_ method
:param ... | def derivative(wave, indep_min=None, indep_max=None):
r"""
Return the numerical derivative of a waveform's dependent variable vector.
The method used is the `backwards differences
<https://en.wikipedia.org/wiki/
Finite_difference#Forward.2C_backward.2C_and_central_differences>`_ method
:param ... | [
"r",
"Return",
"the",
"numerical",
"derivative",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L427-L471 | [
"def",
"derivative",
"(",
"wave",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")",
"_bound_waveform",
"(",
"ret",
",",
"indep_min",
",",
"indep_max",
")",
"delta_indep",
"=",
"np... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | fft | r"""
Return the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less than the size of the independent variable vector
the waveform ... | peng/wave_functions.py | def fft(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less than the size of ... | def fft(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less than the size of ... | [
"r",
"Return",
"the",
"Fast",
"Fourier",
"Transform",
"of",
"a",
"waveform",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L500-L562 | [
"def",
"fft",
"(",
"wave",
",",
"npoints",
"=",
"None",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")",
"_bound_waveform",
"(",
"ret",
",",
"indep_min",
",",
"indep_max",
")",... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | fftdb | r"""
Return the Fast Fourier Transform of a waveform.
The dependent variable vector of the returned waveform is expressed in decibels
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is le... | peng/wave_functions.py | def fftdb(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the Fast Fourier Transform of a waveform.
The dependent variable vector of the returned waveform is expressed in decibels
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of point... | def fftdb(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the Fast Fourier Transform of a waveform.
The dependent variable vector of the returned waveform is expressed in decibels
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of point... | [
"r",
"Return",
"the",
"Fast",
"Fourier",
"Transform",
"of",
"a",
"waveform",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L571-L615 | [
"def",
"fftdb",
"(",
"wave",
",",
"npoints",
"=",
"None",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"return",
"db",
"(",
"fft",
"(",
"wave",
",",
"npoints",
",",
"indep_min",
",",
"indep_max",
")",
")"
] | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | ffti | r"""
Return the imaginary part of the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less than the size of the independent variable vector
... | peng/wave_functions.py | def ffti(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the imaginary part of the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is... | def ffti(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the imaginary part of the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is... | [
"r",
"Return",
"the",
"imaginary",
"part",
"of",
"the",
"Fast",
"Fourier",
"Transform",
"of",
"a",
"waveform",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L624-L666 | [
"def",
"ffti",
"(",
"wave",
",",
"npoints",
"=",
"None",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"return",
"imag",
"(",
"fft",
"(",
"wave",
",",
"npoints",
",",
"indep_min",
",",
"indep_max",
")",
")"
] | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | fftm | r"""
Return the magnitude of the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less than the size of the independent variable vector
... | peng/wave_functions.py | def fftm(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the magnitude of the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less... | def fftm(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the magnitude of the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less... | [
"r",
"Return",
"the",
"magnitude",
"of",
"the",
"Fast",
"Fourier",
"Transform",
"of",
"a",
"waveform",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L675-L717 | [
"def",
"fftm",
"(",
"wave",
",",
"npoints",
"=",
"None",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"return",
"abs",
"(",
"fft",
"(",
"wave",
",",
"npoints",
",",
"indep_min",
",",
"indep_max",
")",
")"
] | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | fftp | r"""
Return the phase of the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less than the size of the independent variable vector
... | peng/wave_functions.py | def fftp(wave, npoints=None, indep_min=None, indep_max=None, unwrap=True, rad=True):
r"""
Return the phase of the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
... | def fftp(wave, npoints=None, indep_min=None, indep_max=None, unwrap=True, rad=True):
r"""
Return the phase of the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
... | [
"r",
"Return",
"the",
"phase",
"of",
"the",
"Fast",
"Fourier",
"Transform",
"of",
"a",
"waveform",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L728-L782 | [
"def",
"fftp",
"(",
"wave",
",",
"npoints",
"=",
"None",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
",",
"unwrap",
"=",
"True",
",",
"rad",
"=",
"True",
")",
":",
"return",
"phase",
"(",
"fft",
"(",
"wave",
",",
"npoints",
",",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | fftr | r"""
Return the real part of the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less than the size of the independent variable vector
... | peng/wave_functions.py | def fftr(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the real part of the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less... | def fftr(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the real part of the Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less... | [
"r",
"Return",
"the",
"real",
"part",
"of",
"the",
"Fast",
"Fourier",
"Transform",
"of",
"a",
"waveform",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L791-L833 | [
"def",
"fftr",
"(",
"wave",
",",
"npoints",
"=",
"None",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"return",
"real",
"(",
"fft",
"(",
"wave",
",",
"npoints",
",",
"indep_min",
",",
"indep_max",
")",
")"
] | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | find | r"""
Return the independent variable point associated with a dependent variable point.
If the dependent variable point is not in the dependent variable vector the
independent variable vector point is obtained by linear interpolation
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
... | peng/wave_functions.py | def find(wave, dep_var, der=None, inst=1, indep_min=None, indep_max=None):
r"""
Return the independent variable point associated with a dependent variable point.
If the dependent variable point is not in the dependent variable vector the
independent variable vector point is obtained by linear interpola... | def find(wave, dep_var, der=None, inst=1, indep_min=None, indep_max=None):
r"""
Return the independent variable point associated with a dependent variable point.
If the dependent variable point is not in the dependent variable vector the
independent variable vector point is obtained by linear interpola... | [
"r",
"Return",
"the",
"independent",
"variable",
"point",
"associated",
"with",
"a",
"dependent",
"variable",
"point",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L844-L960 | [
"def",
"find",
"(",
"wave",
",",
"dep_var",
",",
"der",
"=",
"None",
",",
"inst",
"=",
"1",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"# pylint: disable=C0325,R0914,W0613",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")"... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | ifftdb | r"""
Return the inverse Fast Fourier Transform of a waveform.
The dependent variable vector of the returned waveform is expressed in decibels
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
... | peng/wave_functions.py | def ifftdb(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the inverse Fast Fourier Transform of a waveform.
The dependent variable vector of the returned waveform is expressed in decibels
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number... | def ifftdb(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the inverse Fast Fourier Transform of a waveform.
The dependent variable vector of the returned waveform is expressed in decibels
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number... | [
"r",
"Return",
"the",
"inverse",
"Fast",
"Fourier",
"Transform",
"of",
"a",
"waveform",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1062-L1106 | [
"def",
"ifftdb",
"(",
"wave",
",",
"npoints",
"=",
"None",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"return",
"db",
"(",
"ifft",
"(",
"wave",
",",
"npoints",
",",
"indep_min",
",",
"indep_max",
")",
")"
] | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | iffti | r"""
Return the imaginary part of the inverse Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less than the size of the independent variable vector
... | peng/wave_functions.py | def iffti(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the imaginary part of the inverse Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
... | def iffti(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the imaginary part of the inverse Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
... | [
"r",
"Return",
"the",
"imaginary",
"part",
"of",
"the",
"inverse",
"Fast",
"Fourier",
"Transform",
"of",
"a",
"waveform",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1115-L1157 | [
"def",
"iffti",
"(",
"wave",
",",
"npoints",
"=",
"None",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"return",
"imag",
"(",
"ifft",
"(",
"wave",
",",
"npoints",
",",
"indep_min",
",",
"indep_max",
")",
")"
] | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | ifftm | r"""
Return the magnitude of the inverse Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less than the size of the independent variable vector
... | peng/wave_functions.py | def ifftm(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the magnitude of the inverse Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
... | def ifftm(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the magnitude of the inverse Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
... | [
"r",
"Return",
"the",
"magnitude",
"of",
"the",
"inverse",
"Fast",
"Fourier",
"Transform",
"of",
"a",
"waveform",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1166-L1208 | [
"def",
"ifftm",
"(",
"wave",
",",
"npoints",
"=",
"None",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"return",
"abs",
"(",
"ifft",
"(",
"wave",
",",
"npoints",
",",
"indep_min",
",",
"indep_max",
")",
")"
] | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | ifftp | r"""
Return the phase of the inverse Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less than the size of the independent variable vector
... | peng/wave_functions.py | def ifftp(wave, npoints=None, indep_min=None, indep_max=None, unwrap=True, rad=True):
r"""
Return the phase of the inverse Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**... | def ifftp(wave, npoints=None, indep_min=None, indep_max=None, unwrap=True, rad=True):
r"""
Return the phase of the inverse Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**... | [
"r",
"Return",
"the",
"phase",
"of",
"the",
"inverse",
"Fast",
"Fourier",
"Transform",
"of",
"a",
"waveform",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1219-L1273 | [
"def",
"ifftp",
"(",
"wave",
",",
"npoints",
"=",
"None",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
",",
"unwrap",
"=",
"True",
",",
"rad",
"=",
"True",
")",
":",
"return",
"phase",
"(",
"ifft",
"(",
"wave",
",",
"npoints",
",",... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | ifftr | r"""
Return the real part of the inverse Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
is less than the size of the independent variable vector
... | peng/wave_functions.py | def ifftr(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the real part of the inverse Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
... | def ifftr(wave, npoints=None, indep_min=None, indep_max=None):
r"""
Return the real part of the inverse Fast Fourier Transform of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param npoints: Number of points to use in the transform. If **npoints**
... | [
"r",
"Return",
"the",
"real",
"part",
"of",
"the",
"inverse",
"Fast",
"Fourier",
"Transform",
"of",
"a",
"waveform",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1282-L1324 | [
"def",
"ifftr",
"(",
"wave",
",",
"npoints",
"=",
"None",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"return",
"real",
"(",
"ifft",
"(",
"wave",
",",
"npoints",
",",
"indep_min",
",",
"indep_max",
")",
")"
] | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | integral | r"""
Return the running integral of a waveform's dependent variable vector.
The method used is the `trapezoidal
<https://en.wikipedia.org/wiki/Trapezoidal_rule>`_ method
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of comput... | peng/wave_functions.py | def integral(wave, indep_min=None, indep_max=None):
r"""
Return the running integral of a waveform's dependent variable vector.
The method used is the `trapezoidal
<https://en.wikipedia.org/wiki/Trapezoidal_rule>`_ method
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:p... | def integral(wave, indep_min=None, indep_max=None):
r"""
Return the running integral of a waveform's dependent variable vector.
The method used is the `trapezoidal
<https://en.wikipedia.org/wiki/Trapezoidal_rule>`_ method
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:p... | [
"r",
"Return",
"the",
"running",
"integral",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1351-L1390 | [
"def",
"integral",
"(",
"wave",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")",
"_bound_waveform",
"(",
"ret",
",",
"indep_min",
",",
"indep_max",
")",
"ret",
".",
"_dep_vector"... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | group_delay | r"""
Return the group delay of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]
.. Auto-generated exceptions documentation for
.. peng.wave_functions.group_de... | peng/wave_functions.py | def group_delay(wave):
r"""
Return the group delay of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]
.. Auto-generated exceptions documentation for
.. p... | def group_delay(wave):
r"""
Return the group delay of a waveform.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc(raised=True)) ]]]
.. Auto-generated exceptions documentation for
.. p... | [
"r",
"Return",
"the",
"group",
"delay",
"of",
"a",
"waveform",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1394-L1414 | [
"def",
"group_delay",
"(",
"wave",
")",
":",
"ret",
"=",
"-",
"derivative",
"(",
"phase",
"(",
"wave",
",",
"unwrap",
"=",
"True",
")",
"/",
"(",
"2",
"*",
"math",
".",
"pi",
")",
")",
"ret",
".",
"dep_name",
"=",
"\"group_delay({0})\"",
".",
"form... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | log | r"""
Return the natural logarithm of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for peng.wave_fu... | peng/wave_functions.py | def log(wave):
r"""
Return the natural logarithm of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentati... | def log(wave):
r"""
Return the natural logarithm of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentati... | [
"r",
"Return",
"the",
"natural",
"logarithm",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1418-L1440 | [
"def",
"log",
"(",
"wave",
")",
":",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"ValueError",
",",
"\"Math domain error\"",
",",
"bool",
"(",
"(",
"min",
"(",
"wave",
".",
"_dep_vector",
")",
"<=",
"0",
")",
")",
")",
"return",
"_operation",
"(",
"wave... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | naverage | r"""
Return the numerical average of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of computation
:type indep_min: integer or float
:param indep_max: Independent vector stop point of c... | peng/wave_functions.py | def naverage(wave, indep_min=None, indep_max=None):
r"""
Return the numerical average of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of computation
:type indep_min: integer or float
... | def naverage(wave, indep_min=None, indep_max=None):
r"""
Return the numerical average of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of computation
:type indep_min: integer or float
... | [
"r",
"Return",
"the",
"numerical",
"average",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1473-L1507 | [
"def",
"naverage",
"(",
"wave",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")",
"_bound_waveform",
"(",
"ret",
",",
"indep_min",
",",
"indep_max",
")",
"delta_x",
"=",
"ret",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | nintegral | r"""
Return the numerical integral of a waveform's dependent variable vector.
The method used is the `trapezoidal
<https://en.wikipedia.org/wiki/Trapezoidal_rule>`_ method
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of comp... | peng/wave_functions.py | def nintegral(wave, indep_min=None, indep_max=None):
r"""
Return the numerical integral of a waveform's dependent variable vector.
The method used is the `trapezoidal
<https://en.wikipedia.org/wiki/Trapezoidal_rule>`_ method
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
... | def nintegral(wave, indep_min=None, indep_max=None):
r"""
Return the numerical integral of a waveform's dependent variable vector.
The method used is the `trapezoidal
<https://en.wikipedia.org/wiki/Trapezoidal_rule>`_ method
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
... | [
"r",
"Return",
"the",
"numerical",
"integral",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1513-L1549 | [
"def",
"nintegral",
"(",
"wave",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")",
"_bound_waveform",
"(",
"ret",
",",
"indep_min",
",",
"indep_max",
")",
"return",
"np",
".",
"... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | nmax | r"""
Return the maximum of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of computation
:type indep_min: integer or float
:param indep_max: Independent vector stop point of computation... | peng/wave_functions.py | def nmax(wave, indep_min=None, indep_max=None):
r"""
Return the maximum of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of computation
:type indep_min: integer or float
:param ind... | def nmax(wave, indep_min=None, indep_max=None):
r"""
Return the maximum of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of computation
:type indep_min: integer or float
:param ind... | [
"r",
"Return",
"the",
"maximum",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1555-L1588 | [
"def",
"nmax",
"(",
"wave",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")",
"_bound_waveform",
"(",
"ret",
",",
"indep_min",
",",
"indep_max",
")",
"return",
"np",
".",
"max",... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | nmin | r"""
Return the minimum of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of computation
:type indep_min: integer or float
:param indep_max: Independent vector stop point of computation... | peng/wave_functions.py | def nmin(wave, indep_min=None, indep_max=None):
r"""
Return the minimum of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of computation
:type indep_min: integer or float
:param ind... | def nmin(wave, indep_min=None, indep_max=None):
r"""
Return the minimum of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param indep_min: Independent vector start point of computation
:type indep_min: integer or float
:param ind... | [
"r",
"Return",
"the",
"minimum",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1594-L1627 | [
"def",
"nmin",
"(",
"wave",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
")",
":",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")",
"_bound_waveform",
"(",
"ret",
",",
"indep_min",
",",
"indep_max",
")",
"return",
"np",
".",
"min",... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | phase | r"""
Return the phase of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param unwrap: Flag that indicates whether phase should change phase shifts
to their :code:`2*pi` complement (True) or not (False)
:type unwrap: boo... | peng/wave_functions.py | def phase(wave, unwrap=True, rad=True):
r"""
Return the phase of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param unwrap: Flag that indicates whether phase should change phase shifts
to their :code:`2*pi` complement ... | def phase(wave, unwrap=True, rad=True):
r"""
Return the phase of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param unwrap: Flag that indicates whether phase should change phase shifts
to their :code:`2*pi` complement ... | [
"r",
"Return",
"the",
"phase",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1631-L1669 | [
"def",
"phase",
"(",
"wave",
",",
"unwrap",
"=",
"True",
",",
"rad",
"=",
"True",
")",
":",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")",
"ret",
".",
"dep_units",
"=",
"\"rad\"",
"if",
"rad",
"else",
"\"deg\"",
"ret",
".",
"dep_name",
"=",
"... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | round | r"""
Round a waveform's dependent variable vector to a given number of decimal places.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param decimals: Number of decimals to round to
:type decimals: integer
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_e... | peng/wave_functions.py | def round(wave, decimals=0):
r"""
Round a waveform's dependent variable vector to a given number of decimal places.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param decimals: Number of decimals to round to
:type decimals: integer
:rtype: :py:class:`peng.eng.Wavefor... | def round(wave, decimals=0):
r"""
Round a waveform's dependent variable vector to a given number of decimal places.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param decimals: Number of decimals to round to
:type decimals: integer
:rtype: :py:class:`peng.eng.Wavefor... | [
"r",
"Round",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"to",
"a",
"given",
"number",
"of",
"decimal",
"places",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1694-L1726 | [
"def",
"round",
"(",
"wave",
",",
"decimals",
"=",
"0",
")",
":",
"# pylint: disable=W0622",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"TypeError",
",",
"\"Cannot convert complex to integer\"",
",",
"wave",
".",
"_dep_vector",
".",
"dtype",
".",
"name",
".",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | sqrt | r"""
Return the square root of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. peng.wave_f... | peng/wave_functions.py | def sqrt(wave):
r"""
Return the square root of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation fo... | def sqrt(wave):
r"""
Return the square root of a waveform's dependent variable vector.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation fo... | [
"r",
"Return",
"the",
"square",
"root",
"of",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1771-L1789 | [
"def",
"sqrt",
"(",
"wave",
")",
":",
"dep_units",
"=",
"\"{0}**0.5\"",
".",
"format",
"(",
"wave",
".",
"dep_units",
")",
"return",
"_operation",
"(",
"wave",
",",
"\"sqrt\"",
",",
"dep_units",
",",
"np",
".",
"sqrt",
")"
] | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | subwave | r"""
Return a waveform that is a sub-set of a waveform, potentially re-sampled.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param dep_name: Independent variable name
:type dep_name: `NonNullString <https://pexdoc.readthedocs.io/en/stable/
ptypes.htm... | peng/wave_functions.py | def subwave(wave, dep_name=None, indep_min=None, indep_max=None, indep_step=None):
r"""
Return a waveform that is a sub-set of a waveform, potentially re-sampled.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param dep_name: Independent variable name
:type dep_name: `Non... | def subwave(wave, dep_name=None, indep_min=None, indep_max=None, indep_step=None):
r"""
Return a waveform that is a sub-set of a waveform, potentially re-sampled.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param dep_name: Independent variable name
:type dep_name: `Non... | [
"r",
"Return",
"a",
"waveform",
"that",
"is",
"a",
"sub",
"-",
"set",
"of",
"a",
"waveform",
"potentially",
"re",
"-",
"sampled",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1799-L1860 | [
"def",
"subwave",
"(",
"wave",
",",
"dep_name",
"=",
"None",
",",
"indep_min",
"=",
"None",
",",
"indep_max",
"=",
"None",
",",
"indep_step",
"=",
"None",
")",
":",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")",
"if",
"dep_name",
"is",
"not",
"... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | wcomplex | r"""
Convert a waveform's dependent variable vector to complex.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. peng.wave_function... | peng/wave_functions.py | def wcomplex(wave):
r"""
Convert a waveform's dependent variable vector to complex.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
... | def wcomplex(wave):
r"""
Convert a waveform's dependent variable vector to complex.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
... | [
"r",
"Convert",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"to",
"complex",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1905-L1924 | [
"def",
"wcomplex",
"(",
"wave",
")",
":",
"ret",
"=",
"copy",
".",
"copy",
"(",
"wave",
")",
"ret",
".",
"_dep_vector",
"=",
"ret",
".",
"_dep_vector",
".",
"astype",
"(",
"np",
".",
"complex",
")",
"return",
"ret"
] | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | wfloat | r"""
Convert a waveform's dependent variable vector to float.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. peng.wave_functions.... | peng/wave_functions.py | def wfloat(wave):
r"""
Convert a waveform's dependent variable vector to float.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.... | def wfloat(wave):
r"""
Convert a waveform's dependent variable vector to float.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.... | [
"r",
"Convert",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"to",
"float",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1928-L1955 | [
"def",
"wfloat",
"(",
"wave",
")",
":",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"TypeError",
",",
"\"Cannot convert complex to float\"",
",",
"wave",
".",
"_dep_vector",
".",
"dtype",
".",
"name",
".",
"startswith",
"(",
"\"complex\"",
")",
",",
")",
"ret... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | wint | r"""
Convert a waveform's dependent variable vector to integer.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. peng.wave_function... | peng/wave_functions.py | def wint(wave):
r"""
Convert a waveform's dependent variable vector to integer.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.... | def wint(wave):
r"""
Convert a waveform's dependent variable vector to integer.
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:rtype: :py:class:`peng.eng.Waveform`
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.... | [
"r",
"Convert",
"a",
"waveform",
"s",
"dependent",
"variable",
"vector",
"to",
"integer",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1959-L1986 | [
"def",
"wint",
"(",
"wave",
")",
":",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"TypeError",
",",
"\"Cannot convert complex to integer\"",
",",
"wave",
".",
"_dep_vector",
".",
"dtype",
".",
"name",
".",
"startswith",
"(",
"\"complex\"",
")",
",",
")",
"ret... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | wvalue | r"""
Return the dependent variable value at a given independent variable point.
If the independent variable point is not in the independent variable vector
the dependent variable value is obtained by linear interpolation
:param wave: Waveform
:type wave: :py:class:`peng.eng.Waveform`
:param ... | peng/wave_functions.py | def wvalue(wave, indep_var):
r"""
Return the dependent variable value at a given independent variable point.
If the independent variable point is not in the independent variable vector
the dependent variable value is obtained by linear interpolation
:param wave: Waveform
:type wave: :py:class... | def wvalue(wave, indep_var):
r"""
Return the dependent variable value at a given independent variable point.
If the independent variable point is not in the independent variable vector
the dependent variable value is obtained by linear interpolation
:param wave: Waveform
:type wave: :py:class... | [
"r",
"Return",
"the",
"dependent",
"variable",
"value",
"at",
"a",
"given",
"independent",
"variable",
"point",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1990-L2038 | [
"def",
"wvalue",
"(",
"wave",
",",
"indep_var",
")",
":",
"close_min",
"=",
"np",
".",
"isclose",
"(",
"indep_var",
",",
"wave",
".",
"_indep_vector",
"[",
"0",
"]",
",",
"FP_RTOL",
",",
"FP_ATOL",
")",
"close_max",
"=",
"np",
".",
"isclose",
"(",
"i... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | SystemFinder.find | Only allow lookups for jspm_packages.
# TODO: figure out the 'jspm_packages' dir from packag.json. | systemjs/finders.py | def find(self, path, all=False):
"""
Only allow lookups for jspm_packages.
# TODO: figure out the 'jspm_packages' dir from packag.json.
"""
bits = path.split('/')
dirs_to_serve = ['jspm_packages', settings.SYSTEMJS_OUTPUT_DIR]
if not bits or bits[0] not in dirs_t... | def find(self, path, all=False):
"""
Only allow lookups for jspm_packages.
# TODO: figure out the 'jspm_packages' dir from packag.json.
"""
bits = path.split('/')
dirs_to_serve = ['jspm_packages', settings.SYSTEMJS_OUTPUT_DIR]
if not bits or bits[0] not in dirs_t... | [
"Only",
"allow",
"lookups",
"for",
"jspm_packages",
"."
] | sergei-maertens/django-systemjs | python | https://github.com/sergei-maertens/django-systemjs/blob/efd4a3862a39d9771609a25a5556f36023cf6e5c/systemjs/finders.py#L17-L27 | [
"def",
"find",
"(",
"self",
",",
"path",
",",
"all",
"=",
"False",
")",
":",
"bits",
"=",
"path",
".",
"split",
"(",
"'/'",
")",
"dirs_to_serve",
"=",
"[",
"'jspm_packages'",
",",
"settings",
".",
"SYSTEMJS_OUTPUT_DIR",
"]",
"if",
"not",
"bits",
"or",
... | efd4a3862a39d9771609a25a5556f36023cf6e5c |
test | get_short_desc | Get first sentence of first paragraph of long description. | setup.py | def get_short_desc(long_desc):
"""Get first sentence of first paragraph of long description."""
found = False
olines = []
for line in [item.rstrip() for item in long_desc.split("\n")]:
if found and (((not line) and (not olines)) or (line and olines)):
olines.append(line)
elif... | def get_short_desc(long_desc):
"""Get first sentence of first paragraph of long description."""
found = False
olines = []
for line in [item.rstrip() for item in long_desc.split("\n")]:
if found and (((not line) and (not olines)) or (line and olines)):
olines.append(line)
elif... | [
"Get",
"first",
"sentence",
"of",
"first",
"paragraph",
"of",
"long",
"description",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/setup.py#L69-L79 | [
"def",
"get_short_desc",
"(",
"long_desc",
")",
":",
"found",
"=",
"False",
"olines",
"=",
"[",
"]",
"for",
"line",
"in",
"[",
"item",
".",
"rstrip",
"(",
")",
"for",
"item",
"in",
"long_desc",
".",
"split",
"(",
"\"\\n\"",
")",
"]",
":",
"if",
"fo... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | TemplateDiscoveryMixin.find_apps | Crawls the (specified) template files and extracts the apps.
If `templates` is specified, the template loader is used and the template
is tokenized to extract the SystemImportNode. An empty context is used
to resolve the node variables. | systemjs/management/commands/_mixins.py | def find_apps(self, templates=None):
"""
Crawls the (specified) template files and extracts the apps.
If `templates` is specified, the template loader is used and the template
is tokenized to extract the SystemImportNode. An empty context is used
to resolve the node variables.
... | def find_apps(self, templates=None):
"""
Crawls the (specified) template files and extracts the apps.
If `templates` is specified, the template loader is used and the template
is tokenized to extract the SystemImportNode. An empty context is used
to resolve the node variables.
... | [
"Crawls",
"the",
"(",
"specified",
")",
"template",
"files",
"and",
"extracts",
"the",
"apps",
"."
] | sergei-maertens/django-systemjs | python | https://github.com/sergei-maertens/django-systemjs/blob/efd4a3862a39d9771609a25a5556f36023cf6e5c/systemjs/management/commands/_mixins.py#L75-L118 | [
"def",
"find_apps",
"(",
"self",
",",
"templates",
"=",
"None",
")",
":",
"all_apps",
"=",
"OrderedDict",
"(",
")",
"if",
"not",
"templates",
":",
"all_files",
"=",
"self",
".",
"discover_templates",
"(",
")",
"for",
"tpl_name",
",",
"fp",
"in",
"all_fil... | efd4a3862a39d9771609a25a5556f36023cf6e5c |
test | SystemImportNode.render | Build the filepath by appending the extension. | systemjs/templatetags/system_tags.py | def render(self, context):
"""
Build the filepath by appending the extension.
"""
module_path = self.path.resolve(context)
if not settings.SYSTEMJS_ENABLED:
if settings.SYSTEMJS_DEFAULT_JS_EXTENSIONS:
name, ext = posixpath.splitext(module_path)
... | def render(self, context):
"""
Build the filepath by appending the extension.
"""
module_path = self.path.resolve(context)
if not settings.SYSTEMJS_ENABLED:
if settings.SYSTEMJS_DEFAULT_JS_EXTENSIONS:
name, ext = posixpath.splitext(module_path)
... | [
"Build",
"the",
"filepath",
"by",
"appending",
"the",
"extension",
"."
] | sergei-maertens/django-systemjs | python | https://github.com/sergei-maertens/django-systemjs/blob/efd4a3862a39d9771609a25a5556f36023cf6e5c/systemjs/templatetags/system_tags.py#L27-L56 | [
"def",
"render",
"(",
"self",
",",
"context",
")",
":",
"module_path",
"=",
"self",
".",
"path",
".",
"resolve",
"(",
"context",
")",
"if",
"not",
"settings",
".",
"SYSTEMJS_ENABLED",
":",
"if",
"settings",
".",
"SYSTEMJS_DEFAULT_JS_EXTENSIONS",
":",
"name",... | efd4a3862a39d9771609a25a5556f36023cf6e5c |
test | engineering_notation_number | r"""
Validate if an object is an :ref:`EngineeringNotationNumber` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
contract is attached to
... | docs/support/ptypes.py | def engineering_notation_number(obj):
r"""
Validate if an object is an :ref:`EngineeringNotationNumber` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argu... | def engineering_notation_number(obj):
r"""
Validate if an object is an :ref:`EngineeringNotationNumber` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argu... | [
"r",
"Validate",
"if",
"an",
"object",
"is",
"an",
":",
"ref",
":",
"EngineeringNotationNumber",
"pseudo",
"-",
"type",
"object",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/ptypes.py#L72-L93 | [
"def",
"engineering_notation_number",
"(",
"obj",
")",
":",
"try",
":",
"obj",
"=",
"obj",
".",
"rstrip",
"(",
")",
"float",
"(",
"obj",
"[",
":",
"-",
"1",
"]",
"if",
"obj",
"[",
"-",
"1",
"]",
"in",
"_SUFFIX_TUPLE",
"else",
"obj",
")",
"return",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | touchstone_data | r"""
Validate if an object is an :ref:`TouchstoneData` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
contract is attached to
:rtype: No... | docs/support/ptypes.py | def touchstone_data(obj):
r"""
Validate if an object is an :ref:`TouchstoneData` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
contract ... | def touchstone_data(obj):
r"""
Validate if an object is an :ref:`TouchstoneData` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
contract ... | [
"r",
"Validate",
"if",
"an",
"object",
"is",
"an",
":",
"ref",
":",
"TouchstoneData",
"pseudo",
"-",
"type",
"object",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/ptypes.py#L171-L202 | [
"def",
"touchstone_data",
"(",
"obj",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"obj",
",",
"dict",
")",
")",
"or",
"(",
"isinstance",
"(",
"obj",
",",
"dict",
")",
"and",
"(",
"sorted",
"(",
"obj",
".",
"keys",
"(",
")",
")",
"!=",
"sorted"... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | touchstone_noise_data | r"""
Validate if an object is an :ref:`TouchstoneNoiseData` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
contract is attached to
:rtyp... | docs/support/ptypes.py | def touchstone_noise_data(obj):
r"""
Validate if an object is an :ref:`TouchstoneNoiseData` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
... | def touchstone_noise_data(obj):
r"""
Validate if an object is an :ref:`TouchstoneNoiseData` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
... | [
"r",
"Validate",
"if",
"an",
"object",
"is",
"an",
":",
"ref",
":",
"TouchstoneNoiseData",
"pseudo",
"-",
"type",
"object",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/ptypes.py#L206-L244 | [
"def",
"touchstone_noise_data",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"dict",
")",
"and",
"(",
"not",
"obj",
")",
":",
"return",
"None",
"if",
"(",
"not",
"isinstance",
"(",
"obj",
",",
"dict",
")",
")",
"or",
"(",
"isinstance",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | touchstone_options | r"""
Validate if an object is an :ref:`TouchstoneOptions` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
contract is attached to
:rtype:... | docs/support/ptypes.py | def touchstone_options(obj):
r"""
Validate if an object is an :ref:`TouchstoneOptions` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
con... | def touchstone_options(obj):
r"""
Validate if an object is an :ref:`TouchstoneOptions` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
con... | [
"r",
"Validate",
"if",
"an",
"object",
"is",
"an",
":",
"ref",
":",
"TouchstoneOptions",
"pseudo",
"-",
"type",
"object",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/ptypes.py#L248-L273 | [
"def",
"touchstone_options",
"(",
"obj",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"obj",
",",
"dict",
")",
")",
"or",
"(",
"isinstance",
"(",
"obj",
",",
"dict",
")",
"and",
"(",
"sorted",
"(",
"obj",
".",
"keys",
"(",
")",
")",
"!=",
"sort... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | wave_interp_option | r"""
Validate if an object is a :ref:`WaveInterpOption` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
contract is attached to
:rtype: N... | docs/support/ptypes.py | def wave_interp_option(obj):
r"""
Validate if an object is a :ref:`WaveInterpOption` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
contr... | def wave_interp_option(obj):
r"""
Validate if an object is a :ref:`WaveInterpOption` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
contr... | [
"r",
"Validate",
"if",
"an",
"object",
"is",
"a",
":",
"ref",
":",
"WaveInterpOption",
"pseudo",
"-",
"type",
"object",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/ptypes.py#L277-L295 | [
"def",
"wave_interp_option",
"(",
"obj",
")",
":",
"exdesc",
"=",
"pexdoc",
".",
"pcontracts",
".",
"get_exdesc",
"(",
")",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"str",
")",
":",
"raise",
"ValueError",
"(",
"exdesc",
")",
"if",
"obj",
".",
"upper... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | wave_vectors | r"""
Validate if an object is a :ref:`WaveVectors` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
contract is attached to
:rtype: None | docs/support/ptypes.py | def wave_vectors(obj):
r"""
Validate if an object is a :ref:`WaveVectors` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
contract is atta... | def wave_vectors(obj):
r"""
Validate if an object is a :ref:`WaveVectors` pseudo-type object.
:param obj: Object
:type obj: any
:raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The
token \*[argument_name]\* is replaced by the name of the argument the
contract is atta... | [
"r",
"Validate",
"if",
"an",
"object",
"is",
"a",
":",
"ref",
":",
"WaveVectors",
"pseudo",
"-",
"type",
"object",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/ptypes.py#L321-L343 | [
"def",
"wave_vectors",
"(",
"obj",
")",
":",
"exdesc",
"=",
"pexdoc",
".",
"pcontracts",
".",
"get_exdesc",
"(",
")",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"list",
")",
"or",
"(",
"isinstance",
"(",
"obj",
",",
"list",
")",
"and",
"not",
"obj",... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _build_expr | Build mathematical expression from hierarchical list. | peng/functions.py | def _build_expr(tokens, higher_oplevel=-1, ldelim="(", rdelim=")"):
"""Build mathematical expression from hierarchical list."""
# Numbers
if isinstance(tokens, str):
return tokens
# Unary operators
if len(tokens) == 2:
return "".join(tokens)
# Multi-term operators
oplevel = _... | def _build_expr(tokens, higher_oplevel=-1, ldelim="(", rdelim=")"):
"""Build mathematical expression from hierarchical list."""
# Numbers
if isinstance(tokens, str):
return tokens
# Unary operators
if len(tokens) == 2:
return "".join(tokens)
# Multi-term operators
oplevel = _... | [
"Build",
"mathematical",
"expression",
"from",
"hierarchical",
"list",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L85-L105 | [
"def",
"_build_expr",
"(",
"tokens",
",",
"higher_oplevel",
"=",
"-",
"1",
",",
"ldelim",
"=",
"\"(\"",
",",
"rdelim",
"=",
"\")\"",
")",
":",
"# Numbers",
"if",
"isinstance",
"(",
"tokens",
",",
"str",
")",
":",
"return",
"tokens",
"# Unary operators",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _next_rdelim | Return position of next matching closing delimiter. | peng/functions.py | def _next_rdelim(items, pos):
"""Return position of next matching closing delimiter."""
for num, item in enumerate(items):
if item > pos:
break
else:
raise RuntimeError("Mismatched delimiters")
del items[num]
return item | def _next_rdelim(items, pos):
"""Return position of next matching closing delimiter."""
for num, item in enumerate(items):
if item > pos:
break
else:
raise RuntimeError("Mismatched delimiters")
del items[num]
return item | [
"Return",
"position",
"of",
"next",
"matching",
"closing",
"delimiter",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L128-L136 | [
"def",
"_next_rdelim",
"(",
"items",
",",
"pos",
")",
":",
"for",
"num",
",",
"item",
"in",
"enumerate",
"(",
"items",
")",
":",
"if",
"item",
">",
"pos",
":",
"break",
"else",
":",
"raise",
"RuntimeError",
"(",
"\"Mismatched delimiters\"",
")",
"del",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _get_functions | Parse function calls. | peng/functions.py | def _get_functions(expr, ldelim="(", rdelim=")"):
"""Parse function calls."""
tpars = _pair_delims(expr, ldelim=ldelim, rdelim=rdelim)
alphas = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
fchars = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789" "_"
tfuncs = []
... | def _get_functions(expr, ldelim="(", rdelim=")"):
"""Parse function calls."""
tpars = _pair_delims(expr, ldelim=ldelim, rdelim=rdelim)
alphas = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
fchars = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789" "_"
tfuncs = []
... | [
"Parse",
"function",
"calls",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L139-L164 | [
"def",
"_get_functions",
"(",
"expr",
",",
"ldelim",
"=",
"\"(\"",
",",
"rdelim",
"=",
"\")\"",
")",
":",
"tpars",
"=",
"_pair_delims",
"(",
"expr",
",",
"ldelim",
"=",
"ldelim",
",",
"rdelim",
"=",
"rdelim",
")",
"alphas",
"=",
"\"abcdefghijklmnopqrstuvwx... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _pair_delims | Pair delimiters. | peng/functions.py | def _pair_delims(expr, ldelim="(", rdelim=")"):
"""Pair delimiters."""
# Find where remaining delimiters are
lindex = reversed([num for num, item in enumerate(expr) if item == ldelim])
rindex = [num for num, item in enumerate(expr) if item == rdelim]
# Pair remaining delimiters
return [(lpos, _n... | def _pair_delims(expr, ldelim="(", rdelim=")"):
"""Pair delimiters."""
# Find where remaining delimiters are
lindex = reversed([num for num, item in enumerate(expr) if item == ldelim])
rindex = [num for num, item in enumerate(expr) if item == rdelim]
# Pair remaining delimiters
return [(lpos, _n... | [
"Pair",
"delimiters",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L167-L173 | [
"def",
"_pair_delims",
"(",
"expr",
",",
"ldelim",
"=",
"\"(\"",
",",
"rdelim",
"=",
"\")\"",
")",
":",
"# Find where remaining delimiters are",
"lindex",
"=",
"reversed",
"(",
"[",
"num",
"for",
"num",
",",
"item",
"in",
"enumerate",
"(",
"expr",
")",
"if... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _parse_expr | Parse mathematical expression using PyParsing. | peng/functions.py | def _parse_expr(text, ldelim="(", rdelim=")"):
"""Parse mathematical expression using PyParsing."""
var = pyparsing.Word(pyparsing.alphas + "_", pyparsing.alphanums + "_")
point = pyparsing.Literal(".")
exp = pyparsing.CaselessLiteral("E")
number = pyparsing.Combine(
pyparsing.Word("+-" + py... | def _parse_expr(text, ldelim="(", rdelim=")"):
"""Parse mathematical expression using PyParsing."""
var = pyparsing.Word(pyparsing.alphas + "_", pyparsing.alphanums + "_")
point = pyparsing.Literal(".")
exp = pyparsing.CaselessLiteral("E")
number = pyparsing.Combine(
pyparsing.Word("+-" + py... | [
"Parse",
"mathematical",
"expression",
"using",
"PyParsing",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L176-L203 | [
"def",
"_parse_expr",
"(",
"text",
",",
"ldelim",
"=",
"\"(\"",
",",
"rdelim",
"=",
"\")\"",
")",
":",
"var",
"=",
"pyparsing",
".",
"Word",
"(",
"pyparsing",
".",
"alphas",
"+",
"\"_\"",
",",
"pyparsing",
".",
"alphanums",
"+",
"\"_\"",
")",
"point",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _remove_consecutive_delims | Remove consecutive delimiters. | peng/functions.py | def _remove_consecutive_delims(expr, ldelim="(", rdelim=")"):
"""Remove consecutive delimiters."""
tpars = _pair_delims(expr, ldelim=ldelim, rdelim=rdelim)
# Flag superfluous delimiters
ddelim = []
for ctuple, ntuple in zip(tpars, tpars[1:]):
if ctuple == (ntuple[0] - 1, ntuple[1] + 1):
... | def _remove_consecutive_delims(expr, ldelim="(", rdelim=")"):
"""Remove consecutive delimiters."""
tpars = _pair_delims(expr, ldelim=ldelim, rdelim=rdelim)
# Flag superfluous delimiters
ddelim = []
for ctuple, ntuple in zip(tpars, tpars[1:]):
if ctuple == (ntuple[0] - 1, ntuple[1] + 1):
... | [
"Remove",
"consecutive",
"delimiters",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L206-L219 | [
"def",
"_remove_consecutive_delims",
"(",
"expr",
",",
"ldelim",
"=",
"\"(\"",
",",
"rdelim",
"=",
"\")\"",
")",
":",
"tpars",
"=",
"_pair_delims",
"(",
"expr",
",",
"ldelim",
"=",
"ldelim",
",",
"rdelim",
"=",
"rdelim",
")",
"# Flag superfluous delimiters",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _remove_extra_delims | Remove unnecessary delimiters (parenthesis, brackets, etc.).
Internal function that can be recursed | peng/functions.py | def _remove_extra_delims(expr, ldelim="(", rdelim=")", fcount=None):
"""
Remove unnecessary delimiters (parenthesis, brackets, etc.).
Internal function that can be recursed
"""
if not expr.strip():
return ""
fcount = [0] if fcount is None else fcount
tfuncs = _get_functions(expr, ld... | def _remove_extra_delims(expr, ldelim="(", rdelim=")", fcount=None):
"""
Remove unnecessary delimiters (parenthesis, brackets, etc.).
Internal function that can be recursed
"""
if not expr.strip():
return ""
fcount = [0] if fcount is None else fcount
tfuncs = _get_functions(expr, ld... | [
"Remove",
"unnecessary",
"delimiters",
"(",
"parenthesis",
"brackets",
"etc",
".",
")",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L222-L249 | [
"def",
"_remove_extra_delims",
"(",
"expr",
",",
"ldelim",
"=",
"\"(\"",
",",
"rdelim",
"=",
"\")\"",
",",
"fcount",
"=",
"None",
")",
":",
"if",
"not",
"expr",
".",
"strip",
"(",
")",
":",
"return",
"\"\"",
"fcount",
"=",
"[",
"0",
"]",
"if",
"fco... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _split_every | Return list of the words in the string, using count of a separator as delimiter.
:param text: String to split
:type text: string
:param sep: Separator
:type sep: string
:param count: Number of separators to use as delimiter
:type count: integer
:param lstrip: Flag that indicates wheth... | peng/functions.py | def _split_every(text, sep, count, lstrip=False, rstrip=False):
"""
Return list of the words in the string, using count of a separator as delimiter.
:param text: String to split
:type text: string
:param sep: Separator
:type sep: string
:param count: Number of separators to use as delim... | def _split_every(text, sep, count, lstrip=False, rstrip=False):
"""
Return list of the words in the string, using count of a separator as delimiter.
:param text: String to split
:type text: string
:param sep: Separator
:type sep: string
:param count: Number of separators to use as delim... | [
"Return",
"list",
"of",
"the",
"words",
"in",
"the",
"string",
"using",
"count",
"of",
"a",
"separator",
"as",
"delimiter",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L252-L281 | [
"def",
"_split_every",
"(",
"text",
",",
"sep",
",",
"count",
",",
"lstrip",
"=",
"False",
",",
"rstrip",
"=",
"False",
")",
":",
"ltr",
"=",
"\"_rl \"",
"[",
"2",
"*",
"lstrip",
"+",
"rstrip",
"]",
".",
"strip",
"(",
")",
"func",
"=",
"lambda",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | _to_eng_tuple | Return tuple with mantissa and exponent of number formatted in engineering notation.
:param number: Number
:type number: integer or float
:rtype: tuple | peng/functions.py | def _to_eng_tuple(number):
"""
Return tuple with mantissa and exponent of number formatted in engineering notation.
:param number: Number
:type number: integer or float
:rtype: tuple
"""
# pylint: disable=W0141
# Helper function: split integer and fractional part of mantissa
# + ... | def _to_eng_tuple(number):
"""
Return tuple with mantissa and exponent of number formatted in engineering notation.
:param number: Number
:type number: integer or float
:rtype: tuple
"""
# pylint: disable=W0141
# Helper function: split integer and fractional part of mantissa
# + ... | [
"Return",
"tuple",
"with",
"mantissa",
"and",
"exponent",
"of",
"number",
"formatted",
"in",
"engineering",
"notation",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L284-L305 | [
"def",
"_to_eng_tuple",
"(",
"number",
")",
":",
"# pylint: disable=W0141",
"# Helper function: split integer and fractional part of mantissa",
"# + ljust ensures that integer part in engineering notation has",
"# at most 3 digits (say if number given is 1E4)",
"# + rstrip ensures that ther... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | no_exp | r"""
Convert number to string guaranteeing result is not in scientific notation.
:param number: Number to convert
:type number: integer or float
:rtype: string
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for peng.functions.no_exp
:rai... | peng/functions.py | def no_exp(number):
r"""
Convert number to string guaranteeing result is not in scientific notation.
:param number: Number to convert
:type number: integer or float
:rtype: string
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for peng.fu... | def no_exp(number):
r"""
Convert number to string guaranteeing result is not in scientific notation.
:param number: Number to convert
:type number: integer or float
:rtype: string
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for peng.fu... | [
"r",
"Convert",
"number",
"to",
"string",
"guaranteeing",
"result",
"is",
"not",
"in",
"scientific",
"notation",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L309-L337 | [
"def",
"no_exp",
"(",
"number",
")",
":",
"mant",
",",
"exp",
"=",
"to_scientific_tuple",
"(",
"number",
")",
"if",
"not",
"exp",
":",
"return",
"str",
"(",
"number",
")",
"floating_mant",
"=",
"\".\"",
"in",
"mant",
"mant",
"=",
"mant",
".",
"replace"... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | peng | r"""
Convert a number to engineering notation.
The absolute value of the number (if it is not exactly zero) is bounded to
the interval [1E-24, 1E+24)
:param number: Number to convert
:type number: integer or float
:param frac_length: Number of digits of fractional part
:type frac_length... | peng/functions.py | def peng(number, frac_length, rjust=True):
r"""
Convert a number to engineering notation.
The absolute value of the number (if it is not exactly zero) is bounded to
the interval [1E-24, 1E+24)
:param number: Number to convert
:type number: integer or float
:param frac_length: Number of d... | def peng(number, frac_length, rjust=True):
r"""
Convert a number to engineering notation.
The absolute value of the number (if it is not exactly zero) is bounded to
the interval [1E-24, 1E+24)
:param number: Number to convert
:type number: integer or float
:param frac_length: Number of d... | [
"r",
"Convert",
"a",
"number",
"to",
"engineering",
"notation",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L343-L480 | [
"def",
"peng",
"(",
"number",
",",
"frac_length",
",",
"rjust",
"=",
"True",
")",
":",
"# The decimal module has a to_eng_string() function, but it does not seem",
"# to work well in all cases. For example:",
"# >>> decimal.Decimal('34.5712233E8').to_eng_string()",
"# '3.45712233E+9'",... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | peng_float | r"""
Return floating point equivalent of a number represented in engineering notation.
:param snum: Number
:type snum: :ref:`EngineeringNotationNumber`
:rtype: string
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. peng.functions.pe... | peng/functions.py | def peng_float(snum):
r"""
Return floating point equivalent of a number represented in engineering notation.
:param snum: Number
:type snum: :ref:`EngineeringNotationNumber`
:rtype: string
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation fo... | def peng_float(snum):
r"""
Return floating point equivalent of a number represented in engineering notation.
:param snum: Number
:type snum: :ref:`EngineeringNotationNumber`
:rtype: string
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation fo... | [
"r",
"Return",
"floating",
"point",
"equivalent",
"of",
"a",
"number",
"represented",
"in",
"engineering",
"notation",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L484-L511 | [
"def",
"peng_float",
"(",
"snum",
")",
":",
"# This can be coded as peng_mant(snum)*(peng_power(snum)[1]), but the",
"# \"function unrolling\" is about 4x faster",
"snum",
"=",
"snum",
".",
"rstrip",
"(",
")",
"power",
"=",
"_SUFFIX_POWER_DICT",
"[",
"\" \"",
"if",
"snum",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | peng_frac | r"""
Return the fractional part of a number represented in engineering notation.
:param snum: Number
:type snum: :ref:`EngineeringNotationNumber`
:rtype: integer
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. peng.functions.peng_fr... | peng/functions.py | def peng_frac(snum):
r"""
Return the fractional part of a number represented in engineering notation.
:param snum: Number
:type snum: :ref:`EngineeringNotationNumber`
:rtype: integer
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
... | def peng_frac(snum):
r"""
Return the fractional part of a number represented in engineering notation.
:param snum: Number
:type snum: :ref:`EngineeringNotationNumber`
:rtype: integer
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
... | [
"r",
"Return",
"the",
"fractional",
"part",
"of",
"a",
"number",
"represented",
"in",
"engineering",
"notation",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L515-L542 | [
"def",
"peng_frac",
"(",
"snum",
")",
":",
"snum",
"=",
"snum",
".",
"rstrip",
"(",
")",
"pindex",
"=",
"snum",
".",
"find",
"(",
"\".\"",
")",
"if",
"pindex",
"==",
"-",
"1",
":",
"return",
"0",
"return",
"int",
"(",
"snum",
"[",
"pindex",
"+",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | peng_mant | r"""
Return the mantissa of a number represented in engineering notation.
:param snum: Number
:type snum: :ref:`EngineeringNotationNumber`
:rtype: float
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. peng.functions.peng_mant
:... | peng/functions.py | def peng_mant(snum):
r"""
Return the mantissa of a number represented in engineering notation.
:param snum: Number
:type snum: :ref:`EngineeringNotationNumber`
:rtype: float
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. peng.f... | def peng_mant(snum):
r"""
Return the mantissa of a number represented in engineering notation.
:param snum: Number
:type snum: :ref:`EngineeringNotationNumber`
:rtype: float
.. [[[cog cog.out(exobj_eng.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. peng.f... | [
"r",
"Return",
"the",
"mantissa",
"of",
"a",
"number",
"represented",
"in",
"engineering",
"notation",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L571-L595 | [
"def",
"peng_mant",
"(",
"snum",
")",
":",
"snum",
"=",
"snum",
".",
"rstrip",
"(",
")",
"return",
"float",
"(",
"snum",
"if",
"snum",
"[",
"-",
"1",
"]",
".",
"isdigit",
"(",
")",
"else",
"snum",
"[",
":",
"-",
"1",
"]",
")"
] | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | peng_power | r"""
Return engineering suffix and its floating point equivalent of a number.
:py:func:`peng.peng` lists the correspondence between suffix and floating
point exponent.
:param snum: Number
:type snum: :ref:`EngineeringNotationNumber`
:rtype: named tuple in which the first item is the engineer... | peng/functions.py | def peng_power(snum):
r"""
Return engineering suffix and its floating point equivalent of a number.
:py:func:`peng.peng` lists the correspondence between suffix and floating
point exponent.
:param snum: Number
:type snum: :ref:`EngineeringNotationNumber`
:rtype: named tuple in which the ... | def peng_power(snum):
r"""
Return engineering suffix and its floating point equivalent of a number.
:py:func:`peng.peng` lists the correspondence between suffix and floating
point exponent.
:param snum: Number
:type snum: :ref:`EngineeringNotationNumber`
:rtype: named tuple in which the ... | [
"r",
"Return",
"engineering",
"suffix",
"and",
"its",
"floating",
"point",
"equivalent",
"of",
"a",
"number",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L599-L629 | [
"def",
"peng_power",
"(",
"snum",
")",
":",
"suffix",
"=",
"\" \"",
"if",
"snum",
"[",
"-",
"1",
"]",
".",
"isdigit",
"(",
")",
"else",
"snum",
"[",
"-",
"1",
"]",
"return",
"EngPower",
"(",
"suffix",
",",
"_SUFFIX_POWER_DICT",
"[",
"suffix",
"]",
... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | peng_suffix_math | r"""
Return engineering suffix from a starting suffix and an number of suffixes offset.
:param suffix: Engineering suffix
:type suffix: :ref:`EngineeringNotationSuffix`
:param offset: Engineering suffix offset
:type offset: integer
:rtype: string
.. [[[cog cog.out(exobj_eng.get_sphinx_... | peng/functions.py | def peng_suffix_math(suffix, offset):
r"""
Return engineering suffix from a starting suffix and an number of suffixes offset.
:param suffix: Engineering suffix
:type suffix: :ref:`EngineeringNotationSuffix`
:param offset: Engineering suffix offset
:type offset: integer
:rtype: string
... | def peng_suffix_math(suffix, offset):
r"""
Return engineering suffix from a starting suffix and an number of suffixes offset.
:param suffix: Engineering suffix
:type suffix: :ref:`EngineeringNotationSuffix`
:param offset: Engineering suffix offset
:type offset: integer
:rtype: string
... | [
"r",
"Return",
"engineering",
"suffix",
"from",
"a",
"starting",
"suffix",
"and",
"an",
"number",
"of",
"suffixes",
"offset",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L661-L697 | [
"def",
"peng_suffix_math",
"(",
"suffix",
",",
"offset",
")",
":",
"# pylint: disable=W0212",
"eobj",
"=",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"ValueError",
",",
"\"Argument `offset` is not valid\"",
")",
"try",
":",
"return",
"_POWER_TO_SUFFIX_DICT",
"[",
"_... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
test | remove_extra_delims | r"""
Remove unnecessary delimiters in mathematical expressions.
Delimiters (parenthesis, brackets, etc.) may be removed either because
there are multiple consecutive delimiters enclosing a single expressions or
because the delimiters are implied by operator precedence rules. Function
names must sta... | peng/functions.py | def remove_extra_delims(expr, ldelim="(", rdelim=")"):
r"""
Remove unnecessary delimiters in mathematical expressions.
Delimiters (parenthesis, brackets, etc.) may be removed either because
there are multiple consecutive delimiters enclosing a single expressions or
because the delimiters are implie... | def remove_extra_delims(expr, ldelim="(", rdelim=")"):
r"""
Remove unnecessary delimiters in mathematical expressions.
Delimiters (parenthesis, brackets, etc.) may be removed either because
there are multiple consecutive delimiters enclosing a single expressions or
because the delimiters are implie... | [
"r",
"Remove",
"unnecessary",
"delimiters",
"in",
"mathematical",
"expressions",
"."
] | pmacosta/peng | python | https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/functions.py#L700-L761 | [
"def",
"remove_extra_delims",
"(",
"expr",
",",
"ldelim",
"=",
"\"(\"",
",",
"rdelim",
"=",
"\")\"",
")",
":",
"op_group",
"=",
"\"\"",
"for",
"item1",
"in",
"_OP_PREC",
":",
"if",
"isinstance",
"(",
"item1",
",",
"list",
")",
":",
"for",
"item2",
"in"... | 976935377adaa3de26fc5677aceb2cdfbd6f93a7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.