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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | twitter_bootstrap | valid layouts are:
- default
- search
- inline
- horizontal
{{ form|twitter_bootstrap:"default" }}
{{ form|twitter_bootstrap:"horizontal" }}
{{ form|twitter_bootstrap:"horizontal,[xs,sm,md,lg],[1-12],[1-12]" }} | src/geelweb/django/twitter_bootstrap_form/templatetags/twitter_bootstrap.py | def twitter_bootstrap(element, args=""):
"""
valid layouts are:
- default
- search
- inline
- horizontal
{{ form|twitter_bootstrap:"default" }}
{{ form|twitter_bootstrap:"horizontal" }}
{{ form|twitter_bootstrap:"horizontal,[xs,sm,md,lg],[1-12],[1-12]" }}
"""
element_type = ... | def twitter_bootstrap(element, args=""):
"""
valid layouts are:
- default
- search
- inline
- horizontal
{{ form|twitter_bootstrap:"default" }}
{{ form|twitter_bootstrap:"horizontal" }}
{{ form|twitter_bootstrap:"horizontal,[xs,sm,md,lg],[1-12],[1-12]" }}
"""
element_type = ... | [
"valid",
"layouts",
"are",
":",
"-",
"default",
"-",
"search",
"-",
"inline",
"-",
"horizontal"
] | geelweb/django-twitter-bootstrap-form | python | https://github.com/geelweb/django-twitter-bootstrap-form/blob/371661e0deeac80a36dfe03360f66442c87fd1c5/src/geelweb/django/twitter_bootstrap_form/templatetags/twitter_bootstrap.py#L11-L58 | [
"def",
"twitter_bootstrap",
"(",
"element",
",",
"args",
"=",
"\"\"",
")",
":",
"element_type",
"=",
"element",
".",
"__class__",
".",
"__name__",
".",
"lower",
"(",
")",
"args_list",
"=",
"[",
"arg",
".",
"strip",
"(",
")",
"for",
"arg",
"in",
"args",... | 371661e0deeac80a36dfe03360f66442c87fd1c5 |
valid | Food.breakfast | Say something in the morning | examples/02_food.py | def breakfast(self, message="Breakfast is ready", shout: bool = False):
"""Say something in the morning"""
return self.helper.output(message, shout) | def breakfast(self, message="Breakfast is ready", shout: bool = False):
"""Say something in the morning"""
return self.helper.output(message, shout) | [
"Say",
"something",
"in",
"the",
"morning"
] | yaz/yaz | python | https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/examples/02_food.py#L46-L48 | [
"def",
"breakfast",
"(",
"self",
",",
"message",
"=",
"\"Breakfast is ready\"",
",",
"shout",
":",
"bool",
"=",
"False",
")",
":",
"return",
"self",
".",
"helper",
".",
"output",
"(",
"message",
",",
"shout",
")"
] | 48c842fe053bf9cd6446c4b33fb081c65339aa48 |
valid | Food.lunch | Say something in the afternoon | examples/02_food.py | def lunch(self, message="Time for lunch", shout: bool = False):
"""Say something in the afternoon"""
return self.helper.output(message, shout) | def lunch(self, message="Time for lunch", shout: bool = False):
"""Say something in the afternoon"""
return self.helper.output(message, shout) | [
"Say",
"something",
"in",
"the",
"afternoon"
] | yaz/yaz | python | https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/examples/02_food.py#L51-L53 | [
"def",
"lunch",
"(",
"self",
",",
"message",
"=",
"\"Time for lunch\"",
",",
"shout",
":",
"bool",
"=",
"False",
")",
":",
"return",
"self",
".",
"helper",
".",
"output",
"(",
"message",
",",
"shout",
")"
] | 48c842fe053bf9cd6446c4b33fb081c65339aa48 |
valid | Food.dinner | Say something in the evening | examples/02_food.py | def dinner(self, message="Dinner is served", shout: bool = False):
"""Say something in the evening"""
return self.helper.output(message, shout) | def dinner(self, message="Dinner is served", shout: bool = False):
"""Say something in the evening"""
return self.helper.output(message, shout) | [
"Say",
"something",
"in",
"the",
"evening"
] | yaz/yaz | python | https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/examples/02_food.py#L56-L58 | [
"def",
"dinner",
"(",
"self",
",",
"message",
"=",
"\"Dinner is served\"",
",",
"shout",
":",
"bool",
"=",
"False",
")",
":",
"return",
"self",
".",
"helper",
".",
"output",
"(",
"message",
",",
"shout",
")"
] | 48c842fe053bf9cd6446c4b33fb081c65339aa48 |
valid | main | Command line entrypoint to reduce technote metadata. | lsstprojectmeta/cli/ingestdocs.py | def main():
"""Command line entrypoint to reduce technote metadata.
"""
parser = argparse.ArgumentParser(
description='Discover and ingest metadata from document sources, '
'including lsstdoc-based LaTeX documents and '
'reStructuredText-based technotes. Metad... | def main():
"""Command line entrypoint to reduce technote metadata.
"""
parser = argparse.ArgumentParser(
description='Discover and ingest metadata from document sources, '
'including lsstdoc-based LaTeX documents and '
'reStructuredText-based technotes. Metad... | [
"Command",
"line",
"entrypoint",
"to",
"reduce",
"technote",
"metadata",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/cli/ingestdocs.py#L18-L78 | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Discover and ingest metadata from document sources, '",
"'including lsstdoc-based LaTeX documents and '",
"'reStructuredText-based technotes. Metadata can be '",
"'upserted into... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | process_ltd_doc_products | Run a pipeline to process extract, transform, and load metadata for
multiple LSST the Docs-hosted projects
Parameters
----------
session : `aiohttp.ClientSession`
Your application's aiohttp client session.
See http://aiohttp.readthedocs.io/en/stable/client.html.
product_urls : `list... | lsstprojectmeta/cli/ingestdocs.py | async def process_ltd_doc_products(session, product_urls, github_api_token,
mongo_collection=None):
"""Run a pipeline to process extract, transform, and load metadata for
multiple LSST the Docs-hosted projects
Parameters
----------
session : `aiohttp.ClientSession... | async def process_ltd_doc_products(session, product_urls, github_api_token,
mongo_collection=None):
"""Run a pipeline to process extract, transform, and load metadata for
multiple LSST the Docs-hosted projects
Parameters
----------
session : `aiohttp.ClientSession... | [
"Run",
"a",
"pipeline",
"to",
"process",
"extract",
"transform",
"and",
"load",
"metadata",
"for",
"multiple",
"LSST",
"the",
"Docs",
"-",
"hosted",
"projects"
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/cli/ingestdocs.py#L99-L123 | [
"async",
"def",
"process_ltd_doc_products",
"(",
"session",
",",
"product_urls",
",",
"github_api_token",
",",
"mongo_collection",
"=",
"None",
")",
":",
"tasks",
"=",
"[",
"asyncio",
".",
"ensure_future",
"(",
"process_ltd_doc",
"(",
"session",
",",
"github_api_t... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | process_ltd_doc | Ingest any kind of LSST document hosted on LSST the Docs from its
source.
Parameters
----------
session : `aiohttp.ClientSession`
Your application's aiohttp client session.
See http://aiohttp.readthedocs.io/en/stable/client.html.
github_api_token : `str`
A GitHub personal AP... | lsstprojectmeta/cli/ingestdocs.py | async def process_ltd_doc(session, github_api_token, ltd_product_url,
mongo_collection=None):
"""Ingest any kind of LSST document hosted on LSST the Docs from its
source.
Parameters
----------
session : `aiohttp.ClientSession`
Your application's aiohttp client sess... | async def process_ltd_doc(session, github_api_token, ltd_product_url,
mongo_collection=None):
"""Ingest any kind of LSST document hosted on LSST the Docs from its
source.
Parameters
----------
session : `aiohttp.ClientSession`
Your application's aiohttp client sess... | [
"Ingest",
"any",
"kind",
"of",
"LSST",
"document",
"hosted",
"on",
"LSST",
"the",
"Docs",
"from",
"its",
"source",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/cli/ingestdocs.py#L126-L193 | [
"async",
"def",
"process_ltd_doc",
"(",
"session",
",",
"github_api_token",
",",
"ltd_product_url",
",",
"mongo_collection",
"=",
"None",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"ltd_product_data",
"=",
"await",
"get_ltd_product... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | decorator | Allows a decorator to be called with or without keyword arguments. | yaz/decorator.py | def decorator(decorator_func):
"""Allows a decorator to be called with or without keyword arguments."""
assert callable(decorator_func), type(decorator_func)
def _decorator(func=None, **kwargs):
assert func is None or callable(func), type(func)
if func:
return decorator_func(fun... | def decorator(decorator_func):
"""Allows a decorator to be called with or without keyword arguments."""
assert callable(decorator_func), type(decorator_func)
def _decorator(func=None, **kwargs):
assert func is None or callable(func), type(func)
if func:
return decorator_func(fun... | [
"Allows",
"a",
"decorator",
"to",
"be",
"called",
"with",
"or",
"without",
"keyword",
"arguments",
"."
] | yaz/yaz | python | https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/yaz/decorator.py#L3-L17 | [
"def",
"decorator",
"(",
"decorator_func",
")",
":",
"assert",
"callable",
"(",
"decorator_func",
")",
",",
"type",
"(",
"decorator_func",
")",
"def",
"_decorator",
"(",
"func",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"func",
"is",
"Non... | 48c842fe053bf9cd6446c4b33fb081c65339aa48 |
valid | get_installation_token | Create a GitHub token for an integration installation.
Parameters
----------
installation_id : `int`
Installation ID. This is available in the URL of the integration's
**installation** ID.
integration_jwt : `bytes`
The integration's JSON Web Token (JWT). You can create this with... | lsstprojectmeta/github/auth.py | def get_installation_token(installation_id, integration_jwt):
"""Create a GitHub token for an integration installation.
Parameters
----------
installation_id : `int`
Installation ID. This is available in the URL of the integration's
**installation** ID.
integration_jwt : `bytes`
... | def get_installation_token(installation_id, integration_jwt):
"""Create a GitHub token for an integration installation.
Parameters
----------
installation_id : `int`
Installation ID. This is available in the URL of the integration's
**installation** ID.
integration_jwt : `bytes`
... | [
"Create",
"a",
"GitHub",
"token",
"for",
"an",
"integration",
"installation",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/github/auth.py#L14-L63 | [
"def",
"get_installation_token",
"(",
"installation_id",
",",
"integration_jwt",
")",
":",
"api_root",
"=",
"'https://api.github.com'",
"url",
"=",
"'{root}/installations/{id_:d}/access_tokens'",
".",
"format",
"(",
"api_root",
"=",
"api_root",
",",
"id_",
"=",
"install... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | create_jwt | Create a JSON Web Token to authenticate a GitHub Integration or
installation.
Parameters
----------
integration_id : `int`
Integration ID. This is available from the GitHub integration's
homepage.
private_key_path : `str`
Path to the integration's private key (a ``.pem`` fil... | lsstprojectmeta/github/auth.py | def create_jwt(integration_id, private_key_path):
"""Create a JSON Web Token to authenticate a GitHub Integration or
installation.
Parameters
----------
integration_id : `int`
Integration ID. This is available from the GitHub integration's
homepage.
private_key_path : `str`
... | def create_jwt(integration_id, private_key_path):
"""Create a JSON Web Token to authenticate a GitHub Integration or
installation.
Parameters
----------
integration_id : `int`
Integration ID. This is available from the GitHub integration's
homepage.
private_key_path : `str`
... | [
"Create",
"a",
"JSON",
"Web",
"Token",
"to",
"authenticate",
"a",
"GitHub",
"Integration",
"or",
"installation",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/github/auth.py#L66-L112 | [
"def",
"create_jwt",
"(",
"integration_id",
",",
"private_key_path",
")",
":",
"integration_id",
"=",
"int",
"(",
"integration_id",
")",
"with",
"open",
"(",
"private_key_path",
",",
"'rb'",
")",
"as",
"f",
":",
"cert_bytes",
"=",
"f",
".",
"read",
"(",
")... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | get_macros | r"""Get all macro definitions from TeX source, supporting multiple
declaration patterns.
Parameters
----------
tex_source : `str`
TeX source content.
Returns
-------
macros : `dict`
Keys are macro names (including leading ``\``) and values are the
content (as `str`)... | lsstprojectmeta/tex/scraper.py | def get_macros(tex_source):
r"""Get all macro definitions from TeX source, supporting multiple
declaration patterns.
Parameters
----------
tex_source : `str`
TeX source content.
Returns
-------
macros : `dict`
Keys are macro names (including leading ``\``) and values ar... | def get_macros(tex_source):
r"""Get all macro definitions from TeX source, supporting multiple
declaration patterns.
Parameters
----------
tex_source : `str`
TeX source content.
Returns
-------
macros : `dict`
Keys are macro names (including leading ``\``) and values ar... | [
"r",
"Get",
"all",
"macro",
"definitions",
"from",
"TeX",
"source",
"supporting",
"multiple",
"declaration",
"patterns",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/scraper.py#L18-L49 | [
"def",
"get_macros",
"(",
"tex_source",
")",
":",
"macros",
"=",
"{",
"}",
"macros",
".",
"update",
"(",
"get_def_macros",
"(",
"tex_source",
")",
")",
"macros",
".",
"update",
"(",
"get_newcommand_macros",
"(",
"tex_source",
")",
")",
"return",
"macros"
] | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | get_def_macros | r"""Get all ``\def`` macro definition from TeX source.
Parameters
----------
tex_source : `str`
TeX source content.
Returns
-------
macros : `dict`
Keys are macro names (including leading ``\``) and values are the
content (as `str`) of the macros.
Notes
-----
... | lsstprojectmeta/tex/scraper.py | def get_def_macros(tex_source):
r"""Get all ``\def`` macro definition from TeX source.
Parameters
----------
tex_source : `str`
TeX source content.
Returns
-------
macros : `dict`
Keys are macro names (including leading ``\``) and values are the
content (as `str`) o... | def get_def_macros(tex_source):
r"""Get all ``\def`` macro definition from TeX source.
Parameters
----------
tex_source : `str`
TeX source content.
Returns
-------
macros : `dict`
Keys are macro names (including leading ``\``) and values are the
content (as `str`) o... | [
"r",
"Get",
"all",
"\\",
"def",
"macro",
"definition",
"from",
"TeX",
"source",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/scraper.py#L52-L73 | [
"def",
"get_def_macros",
"(",
"tex_source",
")",
":",
"macros",
"=",
"{",
"}",
"for",
"match",
"in",
"DEF_PATTERN",
".",
"finditer",
"(",
"tex_source",
")",
":",
"macros",
"[",
"match",
".",
"group",
"(",
"'name'",
")",
"]",
"=",
"match",
".",
"group",... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | get_newcommand_macros | r"""Get all ``\newcommand`` macro definition from TeX source.
Parameters
----------
tex_source : `str`
TeX source content.
Returns
-------
macros : `dict`
Keys are macro names (including leading ``\``) and values are the
content (as `str`) of the macros.
Notes
... | lsstprojectmeta/tex/scraper.py | def get_newcommand_macros(tex_source):
r"""Get all ``\newcommand`` macro definition from TeX source.
Parameters
----------
tex_source : `str`
TeX source content.
Returns
-------
macros : `dict`
Keys are macro names (including leading ``\``) and values are the
conten... | def get_newcommand_macros(tex_source):
r"""Get all ``\newcommand`` macro definition from TeX source.
Parameters
----------
tex_source : `str`
TeX source content.
Returns
-------
macros : `dict`
Keys are macro names (including leading ``\``) and values are the
conten... | [
"r",
"Get",
"all",
"\\",
"newcommand",
"macro",
"definition",
"from",
"TeX",
"source",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/scraper.py#L76-L103 | [
"def",
"get_newcommand_macros",
"(",
"tex_source",
")",
":",
"macros",
"=",
"{",
"}",
"command",
"=",
"LatexCommand",
"(",
"'newcommand'",
",",
"{",
"'name'",
":",
"'name'",
",",
"'required'",
":",
"True",
",",
"'bracket'",
":",
"'{'",
"}",
",",
"{",
"'n... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | load | Try to load and return a module
Will add DIRECTORY_NAME to sys.path and tries to import MODULE_NAME.
For example:
load("~/.yaz", "yaz_extension") | yaz/loader.py | def load(directory_name, module_name):
"""Try to load and return a module
Will add DIRECTORY_NAME to sys.path and tries to import MODULE_NAME.
For example:
load("~/.yaz", "yaz_extension")
"""
directory_name = os.path.expanduser(directory_name)
if os.path.isdir(directory_name) and directory... | def load(directory_name, module_name):
"""Try to load and return a module
Will add DIRECTORY_NAME to sys.path and tries to import MODULE_NAME.
For example:
load("~/.yaz", "yaz_extension")
"""
directory_name = os.path.expanduser(directory_name)
if os.path.isdir(directory_name) and directory... | [
"Try",
"to",
"load",
"and",
"return",
"a",
"module"
] | yaz/yaz | python | https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/yaz/loader.py#L8-L23 | [
"def",
"load",
"(",
"directory_name",
",",
"module_name",
")",
":",
"directory_name",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"directory_name",
")",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"directory_name",
")",
"and",
"directory_name",
"not",
... | 48c842fe053bf9cd6446c4b33fb081c65339aa48 |
valid | make_aware | Makes a naive datetime.datetime in a given time zone aware. | open511/utils/timezone.py | def make_aware(value, timezone):
"""
Makes a naive datetime.datetime in a given time zone aware.
"""
if hasattr(timezone, 'localize') and value not in (datetime.datetime.min, datetime.datetime.max):
# available for pytz time zones
return timezone.localize(value, is_dst=None)
else:
... | def make_aware(value, timezone):
"""
Makes a naive datetime.datetime in a given time zone aware.
"""
if hasattr(timezone, 'localize') and value not in (datetime.datetime.min, datetime.datetime.max):
# available for pytz time zones
return timezone.localize(value, is_dst=None)
else:
... | [
"Makes",
"a",
"naive",
"datetime",
".",
"datetime",
"in",
"a",
"given",
"time",
"zone",
"aware",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/timezone.py#L31-L40 | [
"def",
"make_aware",
"(",
"value",
",",
"timezone",
")",
":",
"if",
"hasattr",
"(",
"timezone",
",",
"'localize'",
")",
"and",
"value",
"not",
"in",
"(",
"datetime",
".",
"datetime",
".",
"min",
",",
"datetime",
".",
"datetime",
".",
"max",
")",
":",
... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | make_naive | Makes an aware datetime.datetime naive in a given time zone. | open511/utils/timezone.py | def make_naive(value, timezone):
"""
Makes an aware datetime.datetime naive in a given time zone.
"""
value = value.astimezone(timezone)
if hasattr(timezone, 'normalize'):
# available for pytz time zones
value = timezone.normalize(value)
return value.replace(tzinfo=None) | def make_naive(value, timezone):
"""
Makes an aware datetime.datetime naive in a given time zone.
"""
value = value.astimezone(timezone)
if hasattr(timezone, 'normalize'):
# available for pytz time zones
value = timezone.normalize(value)
return value.replace(tzinfo=None) | [
"Makes",
"an",
"aware",
"datetime",
".",
"datetime",
"naive",
"in",
"a",
"given",
"time",
"zone",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/timezone.py#L43-L51 | [
"def",
"make_naive",
"(",
"value",
",",
"timezone",
")",
":",
"value",
"=",
"value",
".",
"astimezone",
"(",
"timezone",
")",
"if",
"hasattr",
"(",
"timezone",
",",
"'normalize'",
")",
":",
"# available for pytz time zones",
"value",
"=",
"timezone",
".",
"n... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | Schedule.from_element | Return a Schedule object based on an lxml Element for the <schedule>
tag. timezone is a tzinfo object, ideally from pytz. | open511/utils/schedule.py | def from_element(root, timezone):
"""Return a Schedule object based on an lxml Element for the <schedule>
tag. timezone is a tzinfo object, ideally from pytz."""
assert root.tag == 'schedule'
if root.xpath('intervals'):
return _ScheduleIntervals(root, timezone)
elif r... | def from_element(root, timezone):
"""Return a Schedule object based on an lxml Element for the <schedule>
tag. timezone is a tzinfo object, ideally from pytz."""
assert root.tag == 'schedule'
if root.xpath('intervals'):
return _ScheduleIntervals(root, timezone)
elif r... | [
"Return",
"a",
"Schedule",
"object",
"based",
"on",
"an",
"lxml",
"Element",
"for",
"the",
"<schedule",
">",
"tag",
".",
"timezone",
"is",
"a",
"tzinfo",
"object",
"ideally",
"from",
"pytz",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L36-L44 | [
"def",
"from_element",
"(",
"root",
",",
"timezone",
")",
":",
"assert",
"root",
".",
"tag",
"==",
"'schedule'",
"if",
"root",
".",
"xpath",
"(",
"'intervals'",
")",
":",
"return",
"_ScheduleIntervals",
"(",
"root",
",",
"timezone",
")",
"elif",
"root",
... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | Schedule.to_timezone | Converts a datetime to the timezone of this Schedule. | open511/utils/schedule.py | def to_timezone(self, dt):
"""Converts a datetime to the timezone of this Schedule."""
if timezone.is_aware(dt):
return dt.astimezone(self.timezone)
else:
return timezone.make_aware(dt, self.timezone) | def to_timezone(self, dt):
"""Converts a datetime to the timezone of this Schedule."""
if timezone.is_aware(dt):
return dt.astimezone(self.timezone)
else:
return timezone.make_aware(dt, self.timezone) | [
"Converts",
"a",
"datetime",
"to",
"the",
"timezone",
"of",
"this",
"Schedule",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L46-L51 | [
"def",
"to_timezone",
"(",
"self",
",",
"dt",
")",
":",
"if",
"timezone",
".",
"is_aware",
"(",
"dt",
")",
":",
"return",
"dt",
".",
"astimezone",
"(",
"self",
".",
"timezone",
")",
"else",
":",
"return",
"timezone",
".",
"make_aware",
"(",
"dt",
","... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | Schedule.intervals | Returns a list of tuples of start/end datetimes for when the schedule
is active during the provided range. | open511/utils/schedule.py | def intervals(self, range_start=datetime.datetime.min, range_end=datetime.datetime.max):
"""Returns a list of tuples of start/end datetimes for when the schedule
is active during the provided range."""
raise NotImplementedError | def intervals(self, range_start=datetime.datetime.min, range_end=datetime.datetime.max):
"""Returns a list of tuples of start/end datetimes for when the schedule
is active during the provided range."""
raise NotImplementedError | [
"Returns",
"a",
"list",
"of",
"tuples",
"of",
"start",
"/",
"end",
"datetimes",
"for",
"when",
"the",
"schedule",
"is",
"active",
"during",
"the",
"provided",
"range",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L53-L56 | [
"def",
"intervals",
"(",
"self",
",",
"range_start",
"=",
"datetime",
".",
"datetime",
".",
"min",
",",
"range_end",
"=",
"datetime",
".",
"datetime",
".",
"max",
")",
":",
"raise",
"NotImplementedError"
] | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | Schedule.next_interval | Returns the next Period this event is in effect, or None if the event
has no remaining periods. | open511/utils/schedule.py | def next_interval(self, after=None):
"""Returns the next Period this event is in effect, or None if the event
has no remaining periods."""
if after is None:
after = timezone.now()
after = self.to_timezone(after)
return next(self.intervals(range_start=after), None) | def next_interval(self, after=None):
"""Returns the next Period this event is in effect, or None if the event
has no remaining periods."""
if after is None:
after = timezone.now()
after = self.to_timezone(after)
return next(self.intervals(range_start=after), None) | [
"Returns",
"the",
"next",
"Period",
"this",
"event",
"is",
"in",
"effect",
"or",
"None",
"if",
"the",
"event",
"has",
"no",
"remaining",
"periods",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L58-L64 | [
"def",
"next_interval",
"(",
"self",
",",
"after",
"=",
"None",
")",
":",
"if",
"after",
"is",
"None",
":",
"after",
"=",
"timezone",
".",
"now",
"(",
")",
"after",
"=",
"self",
".",
"to_timezone",
"(",
"after",
")",
"return",
"next",
"(",
"self",
... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | Schedule.includes | Does this schedule include the provided time?
query should be a datetime (naive or timezone-aware) | open511/utils/schedule.py | def includes(self, query):
"""Does this schedule include the provided time?
query should be a datetime (naive or timezone-aware)"""
query = self.to_timezone(query)
return any(self.intervals(range_start=query, range_end=query)) | def includes(self, query):
"""Does this schedule include the provided time?
query should be a datetime (naive or timezone-aware)"""
query = self.to_timezone(query)
return any(self.intervals(range_start=query, range_end=query)) | [
"Does",
"this",
"schedule",
"include",
"the",
"provided",
"time?",
"query",
"should",
"be",
"a",
"datetime",
"(",
"naive",
"or",
"timezone",
"-",
"aware",
")"
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L70-L74 | [
"def",
"includes",
"(",
"self",
",",
"query",
")",
":",
"query",
"=",
"self",
".",
"to_timezone",
"(",
"query",
")",
"return",
"any",
"(",
"self",
".",
"intervals",
"(",
"range_start",
"=",
"query",
",",
"range_end",
"=",
"query",
")",
")"
] | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | _ScheduleRecurring.exceptions | A dict of dates -> [Period time tuples] representing exceptions
to the base recurrence pattern. | open511/utils/schedule.py | def exceptions(self):
"""A dict of dates -> [Period time tuples] representing exceptions
to the base recurrence pattern."""
ex = {}
for sd in self.root.xpath('exceptions/exception'):
bits = str(sd.text).split(' ')
date = text_to_date(bits.pop(0))
ex.se... | def exceptions(self):
"""A dict of dates -> [Period time tuples] representing exceptions
to the base recurrence pattern."""
ex = {}
for sd in self.root.xpath('exceptions/exception'):
bits = str(sd.text).split(' ')
date = text_to_date(bits.pop(0))
ex.se... | [
"A",
"dict",
"of",
"dates",
"-",
">",
"[",
"Period",
"time",
"tuples",
"]",
"representing",
"exceptions",
"to",
"the",
"base",
"recurrence",
"pattern",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L121-L132 | [
"def",
"exceptions",
"(",
"self",
")",
":",
"ex",
"=",
"{",
"}",
"for",
"sd",
"in",
"self",
".",
"root",
".",
"xpath",
"(",
"'exceptions/exception'",
")",
":",
"bits",
"=",
"str",
"(",
"sd",
".",
"text",
")",
".",
"split",
"(",
"' '",
")",
"date"... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | _ScheduleRecurring.exception_periods | Returns a list of Period tuples for each period represented in an <exception>
that falls between range_start and range_end. | open511/utils/schedule.py | def exception_periods(self, range_start=datetime.date.min, range_end=datetime.date.max):
"""Returns a list of Period tuples for each period represented in an <exception>
that falls between range_start and range_end."""
periods = []
for exception_date, exception_times in self.exceptions.i... | def exception_periods(self, range_start=datetime.date.min, range_end=datetime.date.max):
"""Returns a list of Period tuples for each period represented in an <exception>
that falls between range_start and range_end."""
periods = []
for exception_date, exception_times in self.exceptions.i... | [
"Returns",
"a",
"list",
"of",
"Period",
"tuples",
"for",
"each",
"period",
"represented",
"in",
"an",
"<exception",
">",
"that",
"falls",
"between",
"range_start",
"and",
"range_end",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L134-L149 | [
"def",
"exception_periods",
"(",
"self",
",",
"range_start",
"=",
"datetime",
".",
"date",
".",
"min",
",",
"range_end",
"=",
"datetime",
".",
"date",
".",
"max",
")",
":",
"periods",
"=",
"[",
"]",
"for",
"exception_date",
",",
"exception_times",
"in",
... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | _ScheduleRecurring.includes | Does this schedule include the provided time?
query should be a datetime (naive or timezone-aware) | open511/utils/schedule.py | def includes(self, query):
"""Does this schedule include the provided time?
query should be a datetime (naive or timezone-aware)"""
query = self.to_timezone(query)
query_date = query.date()
query_time = query.time()
# Is the provided time an exception for this schedule?
... | def includes(self, query):
"""Does this schedule include the provided time?
query should be a datetime (naive or timezone-aware)"""
query = self.to_timezone(query)
query_date = query.date()
query_time = query.time()
# Is the provided time an exception for this schedule?
... | [
"Does",
"this",
"schedule",
"include",
"the",
"provided",
"time?",
"query",
"should",
"be",
"a",
"datetime",
"(",
"naive",
"or",
"timezone",
"-",
"aware",
")"
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L151-L170 | [
"def",
"includes",
"(",
"self",
",",
"query",
")",
":",
"query",
"=",
"self",
".",
"to_timezone",
"(",
"query",
")",
"query_date",
"=",
"query",
".",
"date",
"(",
")",
"query_time",
"=",
"query",
".",
"time",
"(",
")",
"# Is the provided time an exception ... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | _ScheduleRecurring._daily_periods | Returns an iterator of Period tuples for every day this event is in effect, between range_start
and range_end. | open511/utils/schedule.py | def _daily_periods(self, range_start, range_end):
"""Returns an iterator of Period tuples for every day this event is in effect, between range_start
and range_end."""
specific = set(self.exceptions.keys())
return heapq.merge(self.exception_periods(range_start, range_end), *[
... | def _daily_periods(self, range_start, range_end):
"""Returns an iterator of Period tuples for every day this event is in effect, between range_start
and range_end."""
specific = set(self.exceptions.keys())
return heapq.merge(self.exception_periods(range_start, range_end), *[
... | [
"Returns",
"an",
"iterator",
"of",
"Period",
"tuples",
"for",
"every",
"day",
"this",
"event",
"is",
"in",
"effect",
"between",
"range_start",
"and",
"range_end",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L172-L180 | [
"def",
"_daily_periods",
"(",
"self",
",",
"range_start",
",",
"range_end",
")",
":",
"specific",
"=",
"set",
"(",
"self",
".",
"exceptions",
".",
"keys",
"(",
")",
")",
"return",
"heapq",
".",
"merge",
"(",
"self",
".",
"exception_periods",
"(",
"range_... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | _ScheduleRecurring.intervals | Returns an iterator of Period tuples for continuous stretches of time during
which this event is in effect, between range_start and range_end. | open511/utils/schedule.py | def intervals(self, range_start=datetime.datetime.min, range_end=datetime.datetime.max):
"""Returns an iterator of Period tuples for continuous stretches of time during
which this event is in effect, between range_start and range_end."""
# At the moment the algorithm works on periods split by c... | def intervals(self, range_start=datetime.datetime.min, range_end=datetime.datetime.max):
"""Returns an iterator of Period tuples for continuous stretches of time during
which this event is in effect, between range_start and range_end."""
# At the moment the algorithm works on periods split by c... | [
"Returns",
"an",
"iterator",
"of",
"Period",
"tuples",
"for",
"continuous",
"stretches",
"of",
"time",
"during",
"which",
"this",
"event",
"is",
"in",
"effect",
"between",
"range_start",
"and",
"range_end",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L182-L213 | [
"def",
"intervals",
"(",
"self",
",",
"range_start",
"=",
"datetime",
".",
"datetime",
".",
"min",
",",
"range_end",
"=",
"datetime",
".",
"datetime",
".",
"max",
")",
":",
"# At the moment the algorithm works on periods split by calendar day, one at a time,",
"# mergin... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | RecurringScheduleComponent.includes | Does this schedule include the provided time?
query_date and query_time are date and time objects, interpreted
in this schedule's timezone | open511/utils/schedule.py | def includes(self, query_date, query_time=None):
"""Does this schedule include the provided time?
query_date and query_time are date and time objects, interpreted
in this schedule's timezone"""
if self.start_date and query_date < self.start_date:
return False
if self... | def includes(self, query_date, query_time=None):
"""Does this schedule include the provided time?
query_date and query_time are date and time objects, interpreted
in this schedule's timezone"""
if self.start_date and query_date < self.start_date:
return False
if self... | [
"Does",
"this",
"schedule",
"include",
"the",
"provided",
"time?",
"query_date",
"and",
"query_time",
"are",
"date",
"and",
"time",
"objects",
"interpreted",
"in",
"this",
"schedule",
"s",
"timezone"
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L224-L242 | [
"def",
"includes",
"(",
"self",
",",
"query_date",
",",
"query_time",
"=",
"None",
")",
":",
"if",
"self",
".",
"start_date",
"and",
"query_date",
"<",
"self",
".",
"start_date",
":",
"return",
"False",
"if",
"self",
".",
"end_date",
"and",
"query_date",
... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | RecurringScheduleComponent.daily_periods | Returns an iterator of Period tuples for every day this schedule is in effect, between range_start
and range_end. | open511/utils/schedule.py | def daily_periods(self, range_start=datetime.date.min, range_end=datetime.date.max, exclude_dates=tuple()):
"""Returns an iterator of Period tuples for every day this schedule is in effect, between range_start
and range_end."""
tz = self.timezone
period = self.period
weekdays = s... | def daily_periods(self, range_start=datetime.date.min, range_end=datetime.date.max, exclude_dates=tuple()):
"""Returns an iterator of Period tuples for every day this schedule is in effect, between range_start
and range_end."""
tz = self.timezone
period = self.period
weekdays = s... | [
"Returns",
"an",
"iterator",
"of",
"Period",
"tuples",
"for",
"every",
"day",
"this",
"schedule",
"is",
"in",
"effect",
"between",
"range_start",
"and",
"range_end",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L244-L262 | [
"def",
"daily_periods",
"(",
"self",
",",
"range_start",
"=",
"datetime",
".",
"date",
".",
"min",
",",
"range_end",
"=",
"datetime",
".",
"date",
".",
"max",
",",
"exclude_dates",
"=",
"tuple",
"(",
")",
")",
":",
"tz",
"=",
"self",
".",
"timezone",
... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | RecurringScheduleComponent.period | A Period tuple representing the daily start and end time. | open511/utils/schedule.py | def period(self):
"""A Period tuple representing the daily start and end time."""
start_time = self.root.findtext('daily_start_time')
if start_time:
return Period(text_to_time(start_time), text_to_time(self.root.findtext('daily_end_time')))
return Period(datetime.time(0, 0), ... | def period(self):
"""A Period tuple representing the daily start and end time."""
start_time = self.root.findtext('daily_start_time')
if start_time:
return Period(text_to_time(start_time), text_to_time(self.root.findtext('daily_end_time')))
return Period(datetime.time(0, 0), ... | [
"A",
"Period",
"tuple",
"representing",
"the",
"daily",
"start",
"and",
"end",
"time",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L266-L271 | [
"def",
"period",
"(",
"self",
")",
":",
"start_time",
"=",
"self",
".",
"root",
".",
"findtext",
"(",
"'daily_start_time'",
")",
"if",
"start_time",
":",
"return",
"Period",
"(",
"text_to_time",
"(",
"start_time",
")",
",",
"text_to_time",
"(",
"self",
"."... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | RecurringScheduleComponent.weekdays | A set of integers representing the weekdays the schedule recurs on,
with Monday = 0 and Sunday = 6. | open511/utils/schedule.py | def weekdays(self):
"""A set of integers representing the weekdays the schedule recurs on,
with Monday = 0 and Sunday = 6."""
if not self.root.xpath('days'):
return set(range(7))
return set(int(d) - 1 for d in self.root.xpath('days/day/text()')) | def weekdays(self):
"""A set of integers representing the weekdays the schedule recurs on,
with Monday = 0 and Sunday = 6."""
if not self.root.xpath('days'):
return set(range(7))
return set(int(d) - 1 for d in self.root.xpath('days/day/text()')) | [
"A",
"set",
"of",
"integers",
"representing",
"the",
"weekdays",
"the",
"schedule",
"recurs",
"on",
"with",
"Monday",
"=",
"0",
"and",
"Sunday",
"=",
"6",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/utils/schedule.py#L274-L279 | [
"def",
"weekdays",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"root",
".",
"xpath",
"(",
"'days'",
")",
":",
"return",
"set",
"(",
"range",
"(",
"7",
")",
")",
"return",
"set",
"(",
"int",
"(",
"d",
")",
"-",
"1",
"for",
"d",
"in",
"sel... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | temp_db | A context manager that creates a temporary database.
Useful for automated tests.
Parameters
----------
db: object
a preconfigured DB object
name: str, optional
name of the database to be created. (default: globally unique name) | pydba/utils.py | def temp_db(db, name=None):
"""
A context manager that creates a temporary database.
Useful for automated tests.
Parameters
----------
db: object
a preconfigured DB object
name: str, optional
name of the database to be created. (default: globally unique name)
"""
if... | def temp_db(db, name=None):
"""
A context manager that creates a temporary database.
Useful for automated tests.
Parameters
----------
db: object
a preconfigured DB object
name: str, optional
name of the database to be created. (default: globally unique name)
"""
if... | [
"A",
"context",
"manager",
"that",
"creates",
"a",
"temporary",
"database",
"."
] | drkjam/pydba | python | https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/utils.py#L16-L39 | [
"def",
"temp_db",
"(",
"db",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"temp_name",
"(",
")",
"db",
".",
"create",
"(",
"name",
")",
"if",
"not",
"db",
".",
"exists",
"(",
"name",
")",
":",
"raise",
"Data... | 986c4b1315d6b128947c3bc3494513d8e5380ff0 |
valid | _download_text | Asynchronously request a URL and get the encoded text content of the
body.
Parameters
----------
url : `str`
URL to download.
session : `aiohttp.ClientSession`
An open aiohttp session.
Returns
-------
content : `str`
Content downloaded from the URL. | lsstprojectmeta/tex/lsstbib.py | async def _download_text(url, session):
"""Asynchronously request a URL and get the encoded text content of the
body.
Parameters
----------
url : `str`
URL to download.
session : `aiohttp.ClientSession`
An open aiohttp session.
Returns
-------
content : `str`
... | async def _download_text(url, session):
"""Asynchronously request a URL and get the encoded text content of the
body.
Parameters
----------
url : `str`
URL to download.
session : `aiohttp.ClientSession`
An open aiohttp session.
Returns
-------
content : `str`
... | [
"Asynchronously",
"request",
"a",
"URL",
"and",
"get",
"the",
"encoded",
"text",
"content",
"of",
"the",
"body",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstbib.py#L22-L42 | [
"async",
"def",
"_download_text",
"(",
"url",
",",
"session",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"async",
"with",
"session",
".",
"get",
"(",
"url",
")",
"as",
"response",
":",
"# aiohttp decodes the content to a Python... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | _download_lsst_bibtex | Asynchronously download a set of lsst-texmf BibTeX bibliographies from
GitHub.
Parameters
----------
bibtex_names : sequence of `str`
Names of lsst-texmf BibTeX files to download. For example:
.. code-block:: python
['lsst', 'lsst-dm', 'refs', 'books', 'refs_ads']
Retu... | lsstprojectmeta/tex/lsstbib.py | async def _download_lsst_bibtex(bibtex_names):
"""Asynchronously download a set of lsst-texmf BibTeX bibliographies from
GitHub.
Parameters
----------
bibtex_names : sequence of `str`
Names of lsst-texmf BibTeX files to download. For example:
.. code-block:: python
['ls... | async def _download_lsst_bibtex(bibtex_names):
"""Asynchronously download a set of lsst-texmf BibTeX bibliographies from
GitHub.
Parameters
----------
bibtex_names : sequence of `str`
Names of lsst-texmf BibTeX files to download. For example:
.. code-block:: python
['ls... | [
"Asynchronously",
"download",
"a",
"set",
"of",
"lsst",
"-",
"texmf",
"BibTeX",
"bibliographies",
"from",
"GitHub",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstbib.py#L45-L75 | [
"async",
"def",
"_download_lsst_bibtex",
"(",
"bibtex_names",
")",
":",
"blob_url_template",
"=",
"(",
"'https://raw.githubusercontent.com/lsst/lsst-texmf/master/texmf/'",
"'bibtex/bib/{name}.bib'",
")",
"urls",
"=",
"[",
"blob_url_template",
".",
"format",
"(",
"name",
"="... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | get_lsst_bibtex | Get content of lsst-texmf bibliographies.
BibTeX content is downloaded from GitHub (``master`` branch of
https://github.com/lsst/lsst-texmf or retrieved from an in-memory cache.
Parameters
----------
bibtex_filenames : sequence of `str`, optional
List of lsst-texmf BibTeX files to retrieve... | lsstprojectmeta/tex/lsstbib.py | def get_lsst_bibtex(bibtex_filenames=None):
"""Get content of lsst-texmf bibliographies.
BibTeX content is downloaded from GitHub (``master`` branch of
https://github.com/lsst/lsst-texmf or retrieved from an in-memory cache.
Parameters
----------
bibtex_filenames : sequence of `str`, optional
... | def get_lsst_bibtex(bibtex_filenames=None):
"""Get content of lsst-texmf bibliographies.
BibTeX content is downloaded from GitHub (``master`` branch of
https://github.com/lsst/lsst-texmf or retrieved from an in-memory cache.
Parameters
----------
bibtex_filenames : sequence of `str`, optional
... | [
"Get",
"content",
"of",
"lsst",
"-",
"texmf",
"bibliographies",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstbib.py#L78-L130 | [
"def",
"get_lsst_bibtex",
"(",
"bibtex_filenames",
"=",
"None",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"if",
"bibtex_filenames",
"is",
"None",
":",
"# Default lsst-texmf bibliography files",
"bibtex_names",
"=",
"KNOWN_LSSTTEXMF_BI... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | get_bibliography | Make a pybtex BibliographyData instance from standard lsst-texmf
bibliography files and user-supplied bibtex content.
Parameters
----------
lsst_bib_names : sequence of `str`, optional
Names of lsst-texmf BibTeX files to include. For example:
.. code-block:: python
['lsst',... | lsstprojectmeta/tex/lsstbib.py | def get_bibliography(lsst_bib_names=None, bibtex=None):
"""Make a pybtex BibliographyData instance from standard lsst-texmf
bibliography files and user-supplied bibtex content.
Parameters
----------
lsst_bib_names : sequence of `str`, optional
Names of lsst-texmf BibTeX files to include. Fo... | def get_bibliography(lsst_bib_names=None, bibtex=None):
"""Make a pybtex BibliographyData instance from standard lsst-texmf
bibliography files and user-supplied bibtex content.
Parameters
----------
lsst_bib_names : sequence of `str`, optional
Names of lsst-texmf BibTeX files to include. Fo... | [
"Make",
"a",
"pybtex",
"BibliographyData",
"instance",
"from",
"standard",
"lsst",
"-",
"texmf",
"bibliography",
"files",
"and",
"user",
"-",
"supplied",
"bibtex",
"content",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstbib.py#L133-L175 | [
"def",
"get_bibliography",
"(",
"lsst_bib_names",
"=",
"None",
",",
"bibtex",
"=",
"None",
")",
":",
"bibtex_data",
"=",
"get_lsst_bibtex",
"(",
"bibtex_filenames",
"=",
"lsst_bib_names",
")",
"# Parse with pybtex into BibliographyData instances",
"pybtex_data",
"=",
"[... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | get_url_from_entry | Get a usable URL from a pybtex entry.
Parameters
----------
entry : `pybtex.database.Entry`
A pybtex bibliography entry.
Returns
-------
url : `str`
Best available URL from the ``entry``.
Raises
------
NoEntryUrlError
Raised when no URL can be made from the... | lsstprojectmeta/tex/lsstbib.py | def get_url_from_entry(entry):
"""Get a usable URL from a pybtex entry.
Parameters
----------
entry : `pybtex.database.Entry`
A pybtex bibliography entry.
Returns
-------
url : `str`
Best available URL from the ``entry``.
Raises
------
NoEntryUrlError
R... | def get_url_from_entry(entry):
"""Get a usable URL from a pybtex entry.
Parameters
----------
entry : `pybtex.database.Entry`
A pybtex bibliography entry.
Returns
-------
url : `str`
Best available URL from the ``entry``.
Raises
------
NoEntryUrlError
R... | [
"Get",
"a",
"usable",
"URL",
"from",
"a",
"pybtex",
"entry",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstbib.py#L178-L214 | [
"def",
"get_url_from_entry",
"(",
"entry",
")",
":",
"if",
"'url'",
"in",
"entry",
".",
"fields",
":",
"return",
"entry",
".",
"fields",
"[",
"'url'",
"]",
"elif",
"entry",
".",
"type",
".",
"lower",
"(",
")",
"==",
"'docushare'",
":",
"return",
"'http... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | get_authoryear_from_entry | Get and format author-year text from a pybtex entry to emulate
natbib citations.
Parameters
----------
entry : `pybtex.database.Entry`
A pybtex bibliography entry.
parens : `bool`, optional
Whether to add parentheses around the year. Default is `False`.
Returns
-------
... | lsstprojectmeta/tex/lsstbib.py | def get_authoryear_from_entry(entry, paren=False):
"""Get and format author-year text from a pybtex entry to emulate
natbib citations.
Parameters
----------
entry : `pybtex.database.Entry`
A pybtex bibliography entry.
parens : `bool`, optional
Whether to add parentheses around t... | def get_authoryear_from_entry(entry, paren=False):
"""Get and format author-year text from a pybtex entry to emulate
natbib citations.
Parameters
----------
entry : `pybtex.database.Entry`
A pybtex bibliography entry.
parens : `bool`, optional
Whether to add parentheses around t... | [
"Get",
"and",
"format",
"author",
"-",
"year",
"text",
"from",
"a",
"pybtex",
"entry",
"to",
"emulate",
"natbib",
"citations",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/tex/lsstbib.py#L221-L283 | [
"def",
"get_authoryear_from_entry",
"(",
"entry",
",",
"paren",
"=",
"False",
")",
":",
"def",
"_format_last",
"(",
"person",
")",
":",
"\"\"\"Reformat a pybtex Person into a last name.\n\n Joins all parts of a last name and strips \"{}\" wrappers.\n \"\"\"",
"return"... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | process_sphinx_technote | Extract, transform, and load Sphinx-based technote metadata.
Parameters
----------
session : `aiohttp.ClientSession`
Your application's aiohttp client session.
See http://aiohttp.readthedocs.io/en/stable/client.html.
github_api_token : `str`
A GitHub personal API token. See the ... | lsstprojectmeta/lsstdocument/sphinxtechnotes.py | async def process_sphinx_technote(session, github_api_token, ltd_product_data,
mongo_collection=None):
"""Extract, transform, and load Sphinx-based technote metadata.
Parameters
----------
session : `aiohttp.ClientSession`
Your application's aiohttp client sess... | async def process_sphinx_technote(session, github_api_token, ltd_product_data,
mongo_collection=None):
"""Extract, transform, and load Sphinx-based technote metadata.
Parameters
----------
session : `aiohttp.ClientSession`
Your application's aiohttp client sess... | [
"Extract",
"transform",
"and",
"load",
"Sphinx",
"-",
"based",
"technote",
"metadata",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/lsstdocument/sphinxtechnotes.py#L18-L92 | [
"async",
"def",
"process_sphinx_technote",
"(",
"session",
",",
"github_api_token",
",",
"ltd_product_data",
",",
"mongo_collection",
"=",
"None",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"github_url",
"=",
"ltd_product_data",
"[... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | reduce_technote_metadata | Reduce a technote project's metadata from multiple sources into a
single JSON-LD resource.
Parameters
----------
github_url : `str`
URL of the technote's GitHub repository.
metadata : `dict`
The parsed contents of ``metadata.yaml`` found in a technote's
repository.
githu... | lsstprojectmeta/lsstdocument/sphinxtechnotes.py | def reduce_technote_metadata(github_url, metadata, github_data,
ltd_product_data):
"""Reduce a technote project's metadata from multiple sources into a
single JSON-LD resource.
Parameters
----------
github_url : `str`
URL of the technote's GitHub repository.
... | def reduce_technote_metadata(github_url, metadata, github_data,
ltd_product_data):
"""Reduce a technote project's metadata from multiple sources into a
single JSON-LD resource.
Parameters
----------
github_url : `str`
URL of the technote's GitHub repository.
... | [
"Reduce",
"a",
"technote",
"project",
"s",
"metadata",
"from",
"multiple",
"sources",
"into",
"a",
"single",
"JSON",
"-",
"LD",
"resource",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/lsstdocument/sphinxtechnotes.py#L95-L204 | [
"def",
"reduce_technote_metadata",
"(",
"github_url",
",",
"metadata",
",",
"github_data",
",",
"ltd_product_data",
")",
":",
"repo_slug",
"=",
"parse_repo_slug_from_url",
"(",
"github_url",
")",
"# Initialize a schema.org/Report and schema.org/SoftwareSourceCode",
"# linked da... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | download_metadata_yaml | Download the metadata.yaml file from a technote's GitHub repository. | lsstprojectmeta/lsstdocument/sphinxtechnotes.py | async def download_metadata_yaml(session, github_url):
"""Download the metadata.yaml file from a technote's GitHub repository.
"""
metadata_yaml_url = _build_metadata_yaml_url(github_url)
async with session.get(metadata_yaml_url) as response:
response.raise_for_status()
yaml_data = await... | async def download_metadata_yaml(session, github_url):
"""Download the metadata.yaml file from a technote's GitHub repository.
"""
metadata_yaml_url = _build_metadata_yaml_url(github_url)
async with session.get(metadata_yaml_url) as response:
response.raise_for_status()
yaml_data = await... | [
"Download",
"the",
"metadata",
".",
"yaml",
"file",
"from",
"a",
"technote",
"s",
"GitHub",
"repository",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/lsstdocument/sphinxtechnotes.py#L207-L214 | [
"async",
"def",
"download_metadata_yaml",
"(",
"session",
",",
"github_url",
")",
":",
"metadata_yaml_url",
"=",
"_build_metadata_yaml_url",
"(",
"github_url",
")",
"async",
"with",
"session",
".",
"get",
"(",
"metadata_yaml_url",
")",
"as",
"response",
":",
"resp... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | parse_repo_slug_from_url | Get the slug, <owner>/<repo_name>, for a GitHub repository from
its URL.
Parameters
----------
github_url : `str`
URL of a GitHub repository.
Returns
-------
repo_slug : `RepoSlug`
Repository slug with fields ``full``, ``owner``, and ``repo``.
See `RepoSlug` for det... | lsstprojectmeta/github/urls.py | def parse_repo_slug_from_url(github_url):
"""Get the slug, <owner>/<repo_name>, for a GitHub repository from
its URL.
Parameters
----------
github_url : `str`
URL of a GitHub repository.
Returns
-------
repo_slug : `RepoSlug`
Repository slug with fields ``full``, ``owne... | def parse_repo_slug_from_url(github_url):
"""Get the slug, <owner>/<repo_name>, for a GitHub repository from
its URL.
Parameters
----------
github_url : `str`
URL of a GitHub repository.
Returns
-------
repo_slug : `RepoSlug`
Repository slug with fields ``full``, ``owne... | [
"Get",
"the",
"slug",
"<owner",
">",
"/",
"<repo_name",
">",
"for",
"a",
"GitHub",
"repository",
"from",
"its",
"URL",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/github/urls.py#L32-L59 | [
"def",
"parse_repo_slug_from_url",
"(",
"github_url",
")",
":",
"match",
"=",
"GITHUB_SLUG_PATTERN",
".",
"match",
"(",
"github_url",
")",
"if",
"not",
"match",
":",
"message",
"=",
"'Could not parse GitHub slug from {}'",
".",
"format",
"(",
"github_url",
")",
"r... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | make_raw_content_url | Make a raw content (raw.githubusercontent.com) URL to a file.
Parameters
----------
repo_slug : `str` or `RepoSlug`
The repository slug, formatted as either a `str` (``'owner/name'``)
or a `RepoSlug` object (created by `parse_repo_slug_from_url`).
git_ref : `str`
The git ref: a ... | lsstprojectmeta/github/urls.py | def make_raw_content_url(repo_slug, git_ref, file_path):
"""Make a raw content (raw.githubusercontent.com) URL to a file.
Parameters
----------
repo_slug : `str` or `RepoSlug`
The repository slug, formatted as either a `str` (``'owner/name'``)
or a `RepoSlug` object (created by `parse_r... | def make_raw_content_url(repo_slug, git_ref, file_path):
"""Make a raw content (raw.githubusercontent.com) URL to a file.
Parameters
----------
repo_slug : `str` or `RepoSlug`
The repository slug, formatted as either a `str` (``'owner/name'``)
or a `RepoSlug` object (created by `parse_r... | [
"Make",
"a",
"raw",
"content",
"(",
"raw",
".",
"githubusercontent",
".",
"com",
")",
"URL",
"to",
"a",
"file",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/github/urls.py#L62-L87 | [
"def",
"make_raw_content_url",
"(",
"repo_slug",
",",
"git_ref",
",",
"file_path",
")",
":",
"if",
"isinstance",
"(",
"repo_slug",
",",
"RepoSlug",
")",
":",
"slug_str",
"=",
"repo_slug",
".",
"full",
"else",
":",
"slug_str",
"=",
"repo_slug",
"if",
"file_pa... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | DayOneEntry.tz | Return the timezone. If none is set use system timezone | dayonelib/__init__.py | def tz(self):
"""Return the timezone. If none is set use system timezone"""
if not self._tz:
self._tz = tzlocal.get_localzone().zone
return self._tz | def tz(self):
"""Return the timezone. If none is set use system timezone"""
if not self._tz:
self._tz = tzlocal.get_localzone().zone
return self._tz | [
"Return",
"the",
"timezone",
".",
"If",
"none",
"is",
"set",
"use",
"system",
"timezone"
] | underscorephil/dayonelib | python | https://github.com/underscorephil/dayonelib/blob/4df134f601abcb033ec04cf7596f25ee25d44661/dayonelib/__init__.py#L29-L33 | [
"def",
"tz",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_tz",
":",
"self",
".",
"_tz",
"=",
"tzlocal",
".",
"get_localzone",
"(",
")",
".",
"zone",
"return",
"self",
".",
"_tz"
] | 4df134f601abcb033ec04cf7596f25ee25d44661 |
valid | DayOneEntry.add_tag | Add tag(s) to a DayOneEntry | dayonelib/__init__.py | def add_tag(self, _tags):
"""Add tag(s) to a DayOneEntry"""
if isinstance(_tags, list):
for t in _tags:
self.tags.append(t)
else:
self.tags.append(_tags) | def add_tag(self, _tags):
"""Add tag(s) to a DayOneEntry"""
if isinstance(_tags, list):
for t in _tags:
self.tags.append(t)
else:
self.tags.append(_tags) | [
"Add",
"tag",
"(",
"s",
")",
"to",
"a",
"DayOneEntry"
] | underscorephil/dayonelib | python | https://github.com/underscorephil/dayonelib/blob/4df134f601abcb033ec04cf7596f25ee25d44661/dayonelib/__init__.py#L41-L47 | [
"def",
"add_tag",
"(",
"self",
",",
"_tags",
")",
":",
"if",
"isinstance",
"(",
"_tags",
",",
"list",
")",
":",
"for",
"t",
"in",
"_tags",
":",
"self",
".",
"tags",
".",
"append",
"(",
"t",
")",
"else",
":",
"self",
".",
"tags",
".",
"append",
... | 4df134f601abcb033ec04cf7596f25ee25d44661 |
valid | DayOneEntry.time | Convert any timestamp into a datetime and save as _time | dayonelib/__init__.py | def time(self, t):
"""Convert any timestamp into a datetime and save as _time"""
_time = arrow.get(t).format('YYYY-MM-DDTHH:mm:ss')
self._time = datetime.datetime.strptime(_time, '%Y-%m-%dT%H:%M:%S') | def time(self, t):
"""Convert any timestamp into a datetime and save as _time"""
_time = arrow.get(t).format('YYYY-MM-DDTHH:mm:ss')
self._time = datetime.datetime.strptime(_time, '%Y-%m-%dT%H:%M:%S') | [
"Convert",
"any",
"timestamp",
"into",
"a",
"datetime",
"and",
"save",
"as",
"_time"
] | underscorephil/dayonelib | python | https://github.com/underscorephil/dayonelib/blob/4df134f601abcb033ec04cf7596f25ee25d44661/dayonelib/__init__.py#L68-L71 | [
"def",
"time",
"(",
"self",
",",
"t",
")",
":",
"_time",
"=",
"arrow",
".",
"get",
"(",
"t",
")",
".",
"format",
"(",
"'YYYY-MM-DDTHH:mm:ss'",
")",
"self",
".",
"_time",
"=",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"_time",
",",
"'%Y-%m-%d... | 4df134f601abcb033ec04cf7596f25ee25d44661 |
valid | DayOneEntry.as_dict | Return a dict that represents the DayOneEntry | dayonelib/__init__.py | def as_dict(self):
"""Return a dict that represents the DayOneEntry"""
entry_dict = {}
entry_dict['UUID'] = self.uuid
entry_dict['Creation Date'] = self.time
entry_dict['Time Zone'] = self.tz
if self.tags:
entry_dict['Tags'] = self.tags
entry_dict['Ent... | def as_dict(self):
"""Return a dict that represents the DayOneEntry"""
entry_dict = {}
entry_dict['UUID'] = self.uuid
entry_dict['Creation Date'] = self.time
entry_dict['Time Zone'] = self.tz
if self.tags:
entry_dict['Tags'] = self.tags
entry_dict['Ent... | [
"Return",
"a",
"dict",
"that",
"represents",
"the",
"DayOneEntry"
] | underscorephil/dayonelib | python | https://github.com/underscorephil/dayonelib/blob/4df134f601abcb033ec04cf7596f25ee25d44661/dayonelib/__init__.py#L74-L85 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"entry_dict",
"=",
"{",
"}",
"entry_dict",
"[",
"'UUID'",
"]",
"=",
"self",
".",
"uuid",
"entry_dict",
"[",
"'Creation Date'",
"]",
"=",
"self",
".",
"time",
"entry_dict",
"[",
"'Time Zone'",
"]",
"=",
"self",
"... | 4df134f601abcb033ec04cf7596f25ee25d44661 |
valid | DayOne.save | Saves a DayOneEntry as a plist | dayonelib/__init__.py | def save(self, entry, with_location=True, debug=False):
"""Saves a DayOneEntry as a plist"""
entry_dict = {}
if isinstance(entry, DayOneEntry):
# Get a dict of the DayOneEntry
entry_dict = entry.as_dict()
else:
entry_dict = entry
# Set... | def save(self, entry, with_location=True, debug=False):
"""Saves a DayOneEntry as a plist"""
entry_dict = {}
if isinstance(entry, DayOneEntry):
# Get a dict of the DayOneEntry
entry_dict = entry.as_dict()
else:
entry_dict = entry
# Set... | [
"Saves",
"a",
"DayOneEntry",
"as",
"a",
"plist"
] | underscorephil/dayonelib | python | https://github.com/underscorephil/dayonelib/blob/4df134f601abcb033ec04cf7596f25ee25d44661/dayonelib/__init__.py#L112-L140 | [
"def",
"save",
"(",
"self",
",",
"entry",
",",
"with_location",
"=",
"True",
",",
"debug",
"=",
"False",
")",
":",
"entry_dict",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"entry",
",",
"DayOneEntry",
")",
":",
"# Get a dict of the DayOneEntry",
"entry_dict",
... | 4df134f601abcb033ec04cf7596f25ee25d44661 |
valid | DayOne._file_path | Create and return full file path for DayOne entry | dayonelib/__init__.py | def _file_path(self, uid):
"""Create and return full file path for DayOne entry"""
file_name = '%s.doentry' % (uid)
return os.path.join(self.dayone_journal_path, file_name) | def _file_path(self, uid):
"""Create and return full file path for DayOne entry"""
file_name = '%s.doentry' % (uid)
return os.path.join(self.dayone_journal_path, file_name) | [
"Create",
"and",
"return",
"full",
"file",
"path",
"for",
"DayOne",
"entry"
] | underscorephil/dayonelib | python | https://github.com/underscorephil/dayonelib/blob/4df134f601abcb033ec04cf7596f25ee25d44661/dayonelib/__init__.py#L143-L146 | [
"def",
"_file_path",
"(",
"self",
",",
"uid",
")",
":",
"file_name",
"=",
"'%s.doentry'",
"%",
"(",
"uid",
")",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"dayone_journal_path",
",",
"file_name",
")"
] | 4df134f601abcb033ec04cf7596f25ee25d44661 |
valid | Collection.combine | Combine many files into a single file on disk. Defaults to using the 'time' dimension. | pyaxiom/netcdf/grids/collection.py | def combine(self, members, output_file, dimension=None, start_index=None, stop_index=None, stride=None):
""" Combine many files into a single file on disk. Defaults to using the 'time' dimension. """
nco = None
try:
nco = Nco()
except BaseException:
# This is not... | def combine(self, members, output_file, dimension=None, start_index=None, stop_index=None, stride=None):
""" Combine many files into a single file on disk. Defaults to using the 'time' dimension. """
nco = None
try:
nco = Nco()
except BaseException:
# This is not... | [
"Combine",
"many",
"files",
"into",
"a",
"single",
"file",
"on",
"disk",
".",
"Defaults",
"to",
"using",
"the",
"time",
"dimension",
"."
] | axiom-data-science/pyaxiom | python | https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/netcdf/grids/collection.py#L128-L152 | [
"def",
"combine",
"(",
"self",
",",
"members",
",",
"output_file",
",",
"dimension",
"=",
"None",
",",
"start_index",
"=",
"None",
",",
"stop_index",
"=",
"None",
",",
"stride",
"=",
"None",
")",
":",
"nco",
"=",
"None",
"try",
":",
"nco",
"=",
"Nco"... | 7ea7626695abf095df6a67f66e5b3e9ae91b16df |
valid | main | The entry point for a yaz script
This will almost always be called from a python script in
the following manner:
if __name__ == "__main__":
yaz.main()
This function will perform the following steps:
1. It will load any additional python code from
the yaz_extension python m... | yaz/main.py | def main(argv=None, white_list=None, load_yaz_extension=True):
"""The entry point for a yaz script
This will almost always be called from a python script in
the following manner:
if __name__ == "__main__":
yaz.main()
This function will perform the following steps:
1. It will ... | def main(argv=None, white_list=None, load_yaz_extension=True):
"""The entry point for a yaz script
This will almost always be called from a python script in
the following manner:
if __name__ == "__main__":
yaz.main()
This function will perform the following steps:
1. It will ... | [
"The",
"entry",
"point",
"for",
"a",
"yaz",
"script"
] | yaz/yaz | python | https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/yaz/main.py#L11-L89 | [
"def",
"main",
"(",
"argv",
"=",
"None",
",",
"white_list",
"=",
"None",
",",
"load_yaz_extension",
"=",
"True",
")",
":",
"assert",
"argv",
"is",
"None",
"or",
"isinstance",
"(",
"argv",
",",
"list",
")",
",",
"type",
"(",
"argv",
")",
"assert",
"wh... | 48c842fe053bf9cd6446c4b33fb081c65339aa48 |
valid | get_task_tree | Returns a tree of Task instances
The tree is comprised of dictionaries containing strings for
keys and either dictionaries or Task instances for values.
When WHITE_LIST is given, only the tasks and plugins in this
list will become part of the task tree. The WHITE_LIST may
contain either strings, ... | yaz/task.py | def get_task_tree(white_list=None):
"""Returns a tree of Task instances
The tree is comprised of dictionaries containing strings for
keys and either dictionaries or Task instances for values.
When WHITE_LIST is given, only the tasks and plugins in this
list will become part of the task tree. The ... | def get_task_tree(white_list=None):
"""Returns a tree of Task instances
The tree is comprised of dictionaries containing strings for
keys and either dictionaries or Task instances for values.
When WHITE_LIST is given, only the tasks and plugins in this
list will become part of the task tree. The ... | [
"Returns",
"a",
"tree",
"of",
"Task",
"instances"
] | yaz/yaz | python | https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/yaz/task.py#L141-L182 | [
"def",
"get_task_tree",
"(",
"white_list",
"=",
"None",
")",
":",
"assert",
"white_list",
"is",
"None",
"or",
"isinstance",
"(",
"white_list",
",",
"list",
")",
",",
"type",
"(",
"white_list",
")",
"if",
"white_list",
"is",
"not",
"None",
":",
"white_list"... | 48c842fe053bf9cd6446c4b33fb081c65339aa48 |
valid | task | Declare a function or method to be a Yaz task
@yaz.task
def talk(message: str = "Hello World!"):
return message
Or... group multiple tasks together
class Tools(yaz.Plugin):
@yaz.task
def say(self, message: str = "Hello World!"):
return message
@yaz.task(op... | yaz/task.py | def task(func, **config):
"""Declare a function or method to be a Yaz task
@yaz.task
def talk(message: str = "Hello World!"):
return message
Or... group multiple tasks together
class Tools(yaz.Plugin):
@yaz.task
def say(self, message: str = "Hello World!"):
ret... | def task(func, **config):
"""Declare a function or method to be a Yaz task
@yaz.task
def talk(message: str = "Hello World!"):
return message
Or... group multiple tasks together
class Tools(yaz.Plugin):
@yaz.task
def say(self, message: str = "Hello World!"):
ret... | [
"Declare",
"a",
"function",
"or",
"method",
"to",
"be",
"a",
"Yaz",
"task"
] | yaz/yaz | python | https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/yaz/task.py#L186-L211 | [
"def",
"task",
"(",
"func",
",",
"*",
"*",
"config",
")",
":",
"if",
"func",
".",
"__name__",
"==",
"func",
".",
"__qualname__",
":",
"assert",
"not",
"func",
".",
"__qualname__",
"in",
"_task_list",
",",
"\"Can not define the same task \\\"{}\\\" twice\"",
".... | 48c842fe053bf9cd6446c4b33fb081c65339aa48 |
valid | Task.get_parameters | Returns a list of parameters | yaz/task.py | def get_parameters(self):
"""Returns a list of parameters"""
if self.plugin_class is None:
sig = inspect.signature(self.func)
for index, parameter in enumerate(sig.parameters.values()):
if not parameter.kind in [parameter.POSITIONAL_ONLY, parameter.KEYWORD_ONLY, p... | def get_parameters(self):
"""Returns a list of parameters"""
if self.plugin_class is None:
sig = inspect.signature(self.func)
for index, parameter in enumerate(sig.parameters.values()):
if not parameter.kind in [parameter.POSITIONAL_ONLY, parameter.KEYWORD_ONLY, p... | [
"Returns",
"a",
"list",
"of",
"parameters"
] | yaz/yaz | python | https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/yaz/task.py#L85-L128 | [
"def",
"get_parameters",
"(",
"self",
")",
":",
"if",
"self",
".",
"plugin_class",
"is",
"None",
":",
"sig",
"=",
"inspect",
".",
"signature",
"(",
"self",
".",
"func",
")",
"for",
"index",
",",
"parameter",
"in",
"enumerate",
"(",
"sig",
".",
"paramet... | 48c842fe053bf9cd6446c4b33fb081c65339aa48 |
valid | Task.get_configuration | Returns the configuration for KEY | yaz/task.py | def get_configuration(self, key, default=None):
"""Returns the configuration for KEY"""
if key in self.config:
return self.config.get(key)
else:
return default | def get_configuration(self, key, default=None):
"""Returns the configuration for KEY"""
if key in self.config:
return self.config.get(key)
else:
return default | [
"Returns",
"the",
"configuration",
"for",
"KEY"
] | yaz/yaz | python | https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/yaz/task.py#L130-L135 | [
"def",
"get_configuration",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"if",
"key",
"in",
"self",
".",
"config",
":",
"return",
"self",
".",
"config",
".",
"get",
"(",
"key",
")",
"else",
":",
"return",
"default"
] | 48c842fe053bf9cd6446c4b33fb081c65339aa48 |
valid | get_plugin_list | Finds all yaz plugins and returns them in a __qualname__: plugin_class dictionary | yaz/plugin.py | def get_plugin_list():
"""Finds all yaz plugins and returns them in a __qualname__: plugin_class dictionary"""
global _yaz_plugin_classes
def get_recursively(cls, plugin_list):
for plugin in cls.__subclasses__():
if not (plugin.yaz_is_final() or plugin.__qualname__ in _yaz_plugin_classe... | def get_plugin_list():
"""Finds all yaz plugins and returns them in a __qualname__: plugin_class dictionary"""
global _yaz_plugin_classes
def get_recursively(cls, plugin_list):
for plugin in cls.__subclasses__():
if not (plugin.yaz_is_final() or plugin.__qualname__ in _yaz_plugin_classe... | [
"Finds",
"all",
"yaz",
"plugins",
"and",
"returns",
"them",
"in",
"a",
"__qualname__",
":",
"plugin_class",
"dictionary"
] | yaz/yaz | python | https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/yaz/plugin.py#L40-L84 | [
"def",
"get_plugin_list",
"(",
")",
":",
"global",
"_yaz_plugin_classes",
"def",
"get_recursively",
"(",
"cls",
",",
"plugin_list",
")",
":",
"for",
"plugin",
"in",
"cls",
".",
"__subclasses__",
"(",
")",
":",
"if",
"not",
"(",
"plugin",
".",
"yaz_is_final",... | 48c842fe053bf9cd6446c4b33fb081c65339aa48 |
valid | get_plugin_instance | Returns an instance of a fully initialized plugin class
Every plugin class is kept in a plugin cache, effectively making
every plugin into a singleton object.
When a plugin has a yaz.dependency decorator, it will be called
as well, before the instance is returned. | yaz/plugin.py | def get_plugin_instance(plugin_class, *args, **kwargs):
"""Returns an instance of a fully initialized plugin class
Every plugin class is kept in a plugin cache, effectively making
every plugin into a singleton object.
When a plugin has a yaz.dependency decorator, it will be called
as well, before ... | def get_plugin_instance(plugin_class, *args, **kwargs):
"""Returns an instance of a fully initialized plugin class
Every plugin class is kept in a plugin cache, effectively making
every plugin into a singleton object.
When a plugin has a yaz.dependency decorator, it will be called
as well, before ... | [
"Returns",
"an",
"instance",
"of",
"a",
"fully",
"initialized",
"plugin",
"class"
] | yaz/yaz | python | https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/yaz/plugin.py#L87-L118 | [
"def",
"get_plugin_instance",
"(",
"plugin_class",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"issubclass",
"(",
"plugin_class",
",",
"BasePlugin",
")",
",",
"type",
"(",
"plugin_class",
")",
"global",
"_yaz_plugin_instance_cache",
"qualname"... | 48c842fe053bf9cd6446c4b33fb081c65339aa48 |
valid | xml_to_json | Convert an Open511 XML document or document fragment to JSON.
Takes an lxml Element object. Returns a dict ready to be JSON-serialized. | open511/converter/o5json.py | def xml_to_json(root):
"""Convert an Open511 XML document or document fragment to JSON.
Takes an lxml Element object. Returns a dict ready to be JSON-serialized."""
j = {}
if len(root) == 0: # Tag with no children, return str/int
return _maybe_intify(root.text)
if len(root) == 1 and root... | def xml_to_json(root):
"""Convert an Open511 XML document or document fragment to JSON.
Takes an lxml Element object. Returns a dict ready to be JSON-serialized."""
j = {}
if len(root) == 0: # Tag with no children, return str/int
return _maybe_intify(root.text)
if len(root) == 1 and root... | [
"Convert",
"an",
"Open511",
"XML",
"document",
"or",
"document",
"fragment",
"to",
"JSON",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/o5json.py#L9-L63 | [
"def",
"xml_to_json",
"(",
"root",
")",
":",
"j",
"=",
"{",
"}",
"if",
"len",
"(",
"root",
")",
"==",
"0",
":",
"# Tag with no children, return str/int",
"return",
"_maybe_intify",
"(",
"root",
".",
"text",
")",
"if",
"len",
"(",
"root",
")",
"==",
"1"... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | gml_to_geojson | Given an lxml Element of a GML geometry, returns a dict in GeoJSON format. | open511/converter/o5json.py | def gml_to_geojson(el):
"""Given an lxml Element of a GML geometry, returns a dict in GeoJSON format."""
if el.get('srsName') not in ('urn:ogc:def:crs:EPSG::4326', None):
if el.get('srsName') == 'EPSG:4326':
return _gmlv2_to_geojson(el)
else:
raise NotImplementedError("Un... | def gml_to_geojson(el):
"""Given an lxml Element of a GML geometry, returns a dict in GeoJSON format."""
if el.get('srsName') not in ('urn:ogc:def:crs:EPSG::4326', None):
if el.get('srsName') == 'EPSG:4326':
return _gmlv2_to_geojson(el)
else:
raise NotImplementedError("Un... | [
"Given",
"an",
"lxml",
"Element",
"of",
"a",
"GML",
"geometry",
"returns",
"a",
"dict",
"in",
"GeoJSON",
"format",
"."
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/o5json.py#L87-L117 | [
"def",
"gml_to_geojson",
"(",
"el",
")",
":",
"if",
"el",
".",
"get",
"(",
"'srsName'",
")",
"not",
"in",
"(",
"'urn:ogc:def:crs:EPSG::4326'",
",",
"None",
")",
":",
"if",
"el",
".",
"get",
"(",
"'srsName'",
")",
"==",
"'EPSG:4326'",
":",
"return",
"_g... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | _gmlv2_to_geojson | Translates a deprecated GML 2.0 geometry to GeoJSON | open511/converter/o5json.py | def _gmlv2_to_geojson(el):
"""Translates a deprecated GML 2.0 geometry to GeoJSON"""
tag = el.tag.replace('{%s}' % NS_GML, '')
if tag == 'Point':
coordinates = [float(c) for c in el.findtext('{%s}coordinates' % NS_GML).split(',')]
elif tag == 'LineString':
coordinates = [
[fl... | def _gmlv2_to_geojson(el):
"""Translates a deprecated GML 2.0 geometry to GeoJSON"""
tag = el.tag.replace('{%s}' % NS_GML, '')
if tag == 'Point':
coordinates = [float(c) for c in el.findtext('{%s}coordinates' % NS_GML).split(',')]
elif tag == 'LineString':
coordinates = [
[fl... | [
"Translates",
"a",
"deprecated",
"GML",
"2",
".",
"0",
"geometry",
"to",
"GeoJSON"
] | open511/open511 | python | https://github.com/open511/open511/blob/3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8/open511/converter/o5json.py#L119-L154 | [
"def",
"_gmlv2_to_geojson",
"(",
"el",
")",
":",
"tag",
"=",
"el",
".",
"tag",
".",
"replace",
"(",
"'{%s}'",
"%",
"NS_GML",
",",
"''",
")",
"if",
"tag",
"==",
"'Point'",
":",
"coordinates",
"=",
"[",
"float",
"(",
"c",
")",
"for",
"c",
"in",
"el... | 3d573f59d7efa06ff1b5419ea5ff4d90a90b3cf8 |
valid | deparagraph | Panflute filter function that converts content wrapped in a Para to
Plain.
Use this filter with pandoc as::
pandoc [..] --filter=lsstprojectmeta-deparagraph
Only lone paragraphs are affected. Para elements with siblings (like a
second Para) are left unaffected.
This filter is useful for ... | lsstprojectmeta/pandoc/filters/deparagraph.py | def deparagraph(element, doc):
"""Panflute filter function that converts content wrapped in a Para to
Plain.
Use this filter with pandoc as::
pandoc [..] --filter=lsstprojectmeta-deparagraph
Only lone paragraphs are affected. Para elements with siblings (like a
second Para) are left unaff... | def deparagraph(element, doc):
"""Panflute filter function that converts content wrapped in a Para to
Plain.
Use this filter with pandoc as::
pandoc [..] --filter=lsstprojectmeta-deparagraph
Only lone paragraphs are affected. Para elements with siblings (like a
second Para) are left unaff... | [
"Panflute",
"filter",
"function",
"that",
"converts",
"content",
"wrapped",
"in",
"a",
"Para",
"to",
"Plain",
"."
] | lsst-sqre/lsst-projectmeta-kit | python | https://github.com/lsst-sqre/lsst-projectmeta-kit/blob/ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14/lsstprojectmeta/pandoc/filters/deparagraph.py#L8-L35 | [
"def",
"deparagraph",
"(",
"element",
",",
"doc",
")",
":",
"if",
"isinstance",
"(",
"element",
",",
"Para",
")",
":",
"# Check if siblings exist; don't process the paragraph in that case.",
"if",
"element",
".",
"next",
"is",
"not",
"None",
":",
"return",
"elemen... | ac8d4ff65bb93d8fdeb1b46ae6eb5d7414f1ae14 |
valid | all_subclasses | Recursively generate of all the subclasses of class cls. | pyaxiom/utils.py | def all_subclasses(cls):
""" Recursively generate of all the subclasses of class cls. """
for subclass in cls.__subclasses__():
yield subclass
for subc in all_subclasses(subclass):
yield subc | def all_subclasses(cls):
""" Recursively generate of all the subclasses of class cls. """
for subclass in cls.__subclasses__():
yield subclass
for subc in all_subclasses(subclass):
yield subc | [
"Recursively",
"generate",
"of",
"all",
"the",
"subclasses",
"of",
"class",
"cls",
"."
] | axiom-data-science/pyaxiom | python | https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/utils.py#L27-L32 | [
"def",
"all_subclasses",
"(",
"cls",
")",
":",
"for",
"subclass",
"in",
"cls",
".",
"__subclasses__",
"(",
")",
":",
"yield",
"subclass",
"for",
"subc",
"in",
"all_subclasses",
"(",
"subclass",
")",
":",
"yield",
"subc"
] | 7ea7626695abf095df6a67f66e5b3e9ae91b16df |
valid | unique_justseen | List unique elements, preserving order. Remember only the element just seen. | pyaxiom/utils.py | def unique_justseen(iterable, key=None):
"List unique elements, preserving order. Remember only the element just seen."
# unique_justseen('AAAABBBCCDAABBB') --> A B C D A B
# unique_justseen('ABBCcAD', str.lower) --> A B C A D
try:
# PY2 support
from itertools import imap as map
exce... | def unique_justseen(iterable, key=None):
"List unique elements, preserving order. Remember only the element just seen."
# unique_justseen('AAAABBBCCDAABBB') --> A B C D A B
# unique_justseen('ABBCcAD', str.lower) --> A B C A D
try:
# PY2 support
from itertools import imap as map
exce... | [
"List",
"unique",
"elements",
"preserving",
"order",
".",
"Remember",
"only",
"the",
"element",
"just",
"seen",
"."
] | axiom-data-science/pyaxiom | python | https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/utils.py#L35-L45 | [
"def",
"unique_justseen",
"(",
"iterable",
",",
"key",
"=",
"None",
")",
":",
"# unique_justseen('AAAABBBCCDAABBB') --> A B C D A B",
"# unique_justseen('ABBCcAD', str.lower) --> A B C A D",
"try",
":",
"# PY2 support",
"from",
"itertools",
"import",
"imap",
"as",
"map",
"e... | 7ea7626695abf095df6a67f66e5b3e9ae91b16df |
valid | normalize_array | Returns a normalized data array from a NetCDF4 variable. This is mostly
used to normalize string types between py2 and py3. It has no effect on types
other than chars/strings | pyaxiom/utils.py | def normalize_array(var):
"""
Returns a normalized data array from a NetCDF4 variable. This is mostly
used to normalize string types between py2 and py3. It has no effect on types
other than chars/strings
"""
if np.issubdtype(var.dtype, 'S1'):
if var.dtype == str:
# Python 2 ... | def normalize_array(var):
"""
Returns a normalized data array from a NetCDF4 variable. This is mostly
used to normalize string types between py2 and py3. It has no effect on types
other than chars/strings
"""
if np.issubdtype(var.dtype, 'S1'):
if var.dtype == str:
# Python 2 ... | [
"Returns",
"a",
"normalized",
"data",
"array",
"from",
"a",
"NetCDF4",
"variable",
".",
"This",
"is",
"mostly",
"used",
"to",
"normalize",
"string",
"types",
"between",
"py2",
"and",
"py3",
".",
"It",
"has",
"no",
"effect",
"on",
"types",
"other",
"than",
... | axiom-data-science/pyaxiom | python | https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/utils.py#L48-L65 | [
"def",
"normalize_array",
"(",
"var",
")",
":",
"if",
"np",
".",
"issubdtype",
"(",
"var",
".",
"dtype",
",",
"'S1'",
")",
":",
"if",
"var",
".",
"dtype",
"==",
"str",
":",
"# Python 2 on netCDF4 'string' variables needs this.",
"# Python 3 returns false for np.is... | 7ea7626695abf095df6a67f66e5b3e9ae91b16df |
valid | generic_masked | Returns a masked array with anything outside of values masked.
The minv and maxv parameters take precendence over any dict values.
The valid_range attribute takes precendence over the valid_min and
valid_max attributes. | pyaxiom/utils.py | def generic_masked(arr, attrs=None, minv=None, maxv=None, mask_nan=True):
"""
Returns a masked array with anything outside of values masked.
The minv and maxv parameters take precendence over any dict values.
The valid_range attribute takes precendence over the valid_min and
valid_max attributes.
... | def generic_masked(arr, attrs=None, minv=None, maxv=None, mask_nan=True):
"""
Returns a masked array with anything outside of values masked.
The minv and maxv parameters take precendence over any dict values.
The valid_range attribute takes precendence over the valid_min and
valid_max attributes.
... | [
"Returns",
"a",
"masked",
"array",
"with",
"anything",
"outside",
"of",
"values",
"masked",
".",
"The",
"minv",
"and",
"maxv",
"parameters",
"take",
"precendence",
"over",
"any",
"dict",
"values",
".",
"The",
"valid_range",
"attribute",
"takes",
"precendence",
... | axiom-data-science/pyaxiom | python | https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/utils.py#L76-L110 | [
"def",
"generic_masked",
"(",
"arr",
",",
"attrs",
"=",
"None",
",",
"minv",
"=",
"None",
",",
"maxv",
"=",
"None",
",",
"mask_nan",
"=",
"True",
")",
":",
"attrs",
"=",
"attrs",
"or",
"{",
"}",
"if",
"'valid_min'",
"in",
"attrs",
":",
"minv",
"=",... | 7ea7626695abf095df6a67f66e5b3e9ae91b16df |
valid | dictify_urn | By default, this will put the `interval` as part of the `cell_methods`
attribute (NetCDF CF style). To return `interval` as its own key, use
the `combine_interval=False` parameter. | pyaxiom/utils.py | def dictify_urn(urn, combine_interval=True):
"""
By default, this will put the `interval` as part of the `cell_methods`
attribute (NetCDF CF style). To return `interval` as its own key, use
the `combine_interval=False` parameter.
"""
ioos_urn = IoosUrn.from_string(urn)
if ioos_u... | def dictify_urn(urn, combine_interval=True):
"""
By default, this will put the `interval` as part of the `cell_methods`
attribute (NetCDF CF style). To return `interval` as its own key, use
the `combine_interval=False` parameter.
"""
ioos_urn = IoosUrn.from_string(urn)
if ioos_u... | [
"By",
"default",
"this",
"will",
"put",
"the",
"interval",
"as",
"part",
"of",
"the",
"cell_methods",
"attribute",
"(",
"NetCDF",
"CF",
"style",
")",
".",
"To",
"return",
"interval",
"as",
"its",
"own",
"key",
"use",
"the",
"combine_interval",
"=",
"False"... | axiom-data-science/pyaxiom | python | https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/utils.py#L167-L233 | [
"def",
"dictify_urn",
"(",
"urn",
",",
"combine_interval",
"=",
"True",
")",
":",
"ioos_urn",
"=",
"IoosUrn",
".",
"from_string",
"(",
"urn",
")",
"if",
"ioos_urn",
".",
"valid",
"(",
")",
"is",
"False",
":",
"return",
"dict",
"(",
")",
"if",
"ioos_urn... | 7ea7626695abf095df6a67f66e5b3e9ae91b16df |
valid | BasicNumpyEncoder.default | If input object is an ndarray it will be converted into a list | pyaxiom/utils.py | def default(self, obj):
"""If input object is an ndarray it will be converted into a list
"""
if isinstance(obj, np.ndarray):
return obj.tolist()
elif isinstance(obj, np.generic):
return np.asscalar(obj)
# Let the base class default method raise the TypeEr... | def default(self, obj):
"""If input object is an ndarray it will be converted into a list
"""
if isinstance(obj, np.ndarray):
return obj.tolist()
elif isinstance(obj, np.generic):
return np.asscalar(obj)
# Let the base class default method raise the TypeEr... | [
"If",
"input",
"object",
"is",
"an",
"ndarray",
"it",
"will",
"be",
"converted",
"into",
"a",
"list"
] | axiom-data-science/pyaxiom | python | https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/utils.py#L339-L347 | [
"def",
"default",
"(",
"self",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"np",
".",
"ndarray",
")",
":",
"return",
"obj",
".",
"tolist",
"(",
")",
"elif",
"isinstance",
"(",
"obj",
",",
"np",
".",
"generic",
")",
":",
"return",
"... | 7ea7626695abf095df6a67f66e5b3e9ae91b16df |
valid | NumpyEncoder.default | If input object is an ndarray it will be converted into a dict
holding dtype, shape and the data, base64 encoded. | pyaxiom/utils.py | def default(self, obj):
"""If input object is an ndarray it will be converted into a dict
holding dtype, shape and the data, base64 encoded.
"""
if isinstance(obj, np.ndarray):
if obj.flags['C_CONTIGUOUS']:
obj_data = obj.data
else:
... | def default(self, obj):
"""If input object is an ndarray it will be converted into a dict
holding dtype, shape and the data, base64 encoded.
"""
if isinstance(obj, np.ndarray):
if obj.flags['C_CONTIGUOUS']:
obj_data = obj.data
else:
... | [
"If",
"input",
"object",
"is",
"an",
"ndarray",
"it",
"will",
"be",
"converted",
"into",
"a",
"dict",
"holding",
"dtype",
"shape",
"and",
"the",
"data",
"base64",
"encoded",
"."
] | axiom-data-science/pyaxiom | python | https://github.com/axiom-data-science/pyaxiom/blob/7ea7626695abf095df6a67f66e5b3e9ae91b16df/pyaxiom/utils.py#L352-L370 | [
"def",
"default",
"(",
"self",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"np",
".",
"ndarray",
")",
":",
"if",
"obj",
".",
"flags",
"[",
"'C_CONTIGUOUS'",
"]",
":",
"obj_data",
"=",
"obj",
".",
"data",
"else",
":",
"cont_obj",
"=",... | 7ea7626695abf095df6a67f66e5b3e9ae91b16df |
valid | mapfivo | #mapfivo f,i,v,o四元决定 fivo-4-tuple-engine
#map_func diff_func(index,value,*diff_args) | elist/elist.py | def mapfivo(ol,*args,**kwargs):
'''
#mapfivo f,i,v,o四元决定 fivo-4-tuple-engine
#map_func diff_func(index,value,*diff_args)
'''
args = list(args)
lngth = args.__len__()
if(lngth==0):
diff_funcs_arr = kwargs['map_funcs']
diff_args_arr ... | def mapfivo(ol,*args,**kwargs):
'''
#mapfivo f,i,v,o四元决定 fivo-4-tuple-engine
#map_func diff_func(index,value,*diff_args)
'''
args = list(args)
lngth = args.__len__()
if(lngth==0):
diff_funcs_arr = kwargs['map_funcs']
diff_args_arr ... | [
"#mapfivo",
"f",
"i",
"v",
"o四元决定",
"fivo",
"-",
"4",
"-",
"tuple",
"-",
"engine",
"#map_func",
"diff_func",
"(",
"index",
"value",
"*",
"diff_args",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L22-L51 | [
"def",
"mapfivo",
"(",
"ol",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
"=",
"list",
"(",
"args",
")",
"lngth",
"=",
"args",
".",
"__len__",
"(",
")",
"if",
"(",
"lngth",
"==",
"0",
")",
":",
"diff_funcs_arr",
"=",
"kwargs",
"... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | mapfiv | #mapfiv 共享相同的o share common other_args
#map_func diff_func(index,value,*common_args) | elist/elist.py | def mapfiv(ol,map_func_args,**kwargs):
'''
#mapfiv 共享相同的o share common other_args
#map_func diff_func(index,value,*common_args)
'''
lngth = ol.__len__()
diff_funcs_arr = kwargs['map_funcs']
common_args_arr = init(lngth,map_func_args)
rslt... | def mapfiv(ol,map_func_args,**kwargs):
'''
#mapfiv 共享相同的o share common other_args
#map_func diff_func(index,value,*common_args)
'''
lngth = ol.__len__()
diff_funcs_arr = kwargs['map_funcs']
common_args_arr = init(lngth,map_func_args)
rslt... | [
"#mapfiv",
"共享相同的o",
"share",
"common",
"other_args",
"#map_func",
"diff_func",
"(",
"index",
"value",
"*",
"common_args",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L60-L69 | [
"def",
"mapfiv",
"(",
"ol",
",",
"map_func_args",
",",
"*",
"*",
"kwargs",
")",
":",
"lngth",
"=",
"ol",
".",
"__len__",
"(",
")",
"diff_funcs_arr",
"=",
"kwargs",
"[",
"'map_funcs'",
"]",
"common_args_arr",
"=",
"init",
"(",
"lngth",
",",
"map_func_args... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | mapivo | #mapivo 共享相同的f share common map_func
#map_func common_func(index,value,*diff_args) | elist/elist.py | def mapivo(ol,map_func,**kwargs):
'''
#mapivo 共享相同的f share common map_func
#map_func common_func(index,value,*diff_args)
'''
lngth = ol.__len__()
common_funcs_arr = init(lngth,map_func)
diff_args_arr = kwargs['map_func_args_array']
rslt =... | def mapivo(ol,map_func,**kwargs):
'''
#mapivo 共享相同的f share common map_func
#map_func common_func(index,value,*diff_args)
'''
lngth = ol.__len__()
common_funcs_arr = init(lngth,map_func)
diff_args_arr = kwargs['map_func_args_array']
rslt =... | [
"#mapivo",
"共享相同的f",
"share",
"common",
"map_func",
"#map_func",
"common_func",
"(",
"index",
"value",
"*",
"diff_args",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L122-L131 | [
"def",
"mapivo",
"(",
"ol",
",",
"map_func",
",",
"*",
"*",
"kwargs",
")",
":",
"lngth",
"=",
"ol",
".",
"__len__",
"(",
")",
"common_funcs_arr",
"=",
"init",
"(",
"lngth",
",",
"map_func",
")",
"diff_args_arr",
"=",
"kwargs",
"[",
"'map_func_args_array'... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | array_dualmap | from elist.elist import *
ol = ['a','b','c','d']
def index_map_func(index,prefix,suffix):
s = prefix +str(index+97)+ suffix
return(s)
def value_map_func(mapped_index,ele,prefix,suffix):
s = prefix+mapped_index+': ' + str(ele) + suffix
retu... | elist/elist.py | def array_dualmap(ol,value_map_func,**kwargs):
'''
from elist.elist import *
ol = ['a','b','c','d']
def index_map_func(index,prefix,suffix):
s = prefix +str(index+97)+ suffix
return(s)
def value_map_func(mapped_index,ele,prefix,suffix):
s ... | def array_dualmap(ol,value_map_func,**kwargs):
'''
from elist.elist import *
ol = ['a','b','c','d']
def index_map_func(index,prefix,suffix):
s = prefix +str(index+97)+ suffix
return(s)
def value_map_func(mapped_index,ele,prefix,suffix):
s ... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"a",
"b",
"c",
"d",
"]",
"def",
"index_map_func",
"(",
"index",
"prefix",
"suffix",
")",
":",
"s",
"=",
"prefix",
"+",
"str",
"(",
"index",
"+",
"97",
")",
"+",
"suffix",
"return",
"("... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L134-L172 | [
"def",
"array_dualmap",
"(",
"ol",
",",
"value_map_func",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"get_self",
"(",
"obj",
")",
":",
"return",
"(",
"obj",
")",
"if",
"(",
"'index_map_func_args'",
"in",
"kwargs",
")",
":",
"index_map_func_args",
"=",
"kw... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | array_dualmap2 | from elist.elist import *
ol = [1,2,3,4]
refl1 = ['+','+','+','+']
refl2 = [7,7,7,7]
refl3 = ['=','=','=','=']
def index_map_func(index):
s ="<"+str(index)+">"
return(s)
def value_map_func(mapped_index,ele,ref_ele1,ref_ele2,ref_ele3,prefix... | elist/elist.py | def array_dualmap2(*refls,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
refl1 = ['+','+','+','+']
refl2 = [7,7,7,7]
refl3 = ['=','=','=','=']
def index_map_func(index):
s ="<"+str(index)+">"
return(s)
def value_map_fu... | def array_dualmap2(*refls,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
refl1 = ['+','+','+','+']
refl2 = [7,7,7,7]
refl3 = ['=','=','=','=']
def index_map_func(index):
s ="<"+str(index)+">"
return(s)
def value_map_fu... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"refl1",
"=",
"[",
"+",
"+",
"+",
"+",
"]",
"refl2",
"=",
"[",
"7",
"7",
"7",
"7",
"]",
"refl3",
"=",
"[",
"=",
"=",
"=",
"=",
"]",
"def",
"index_map_f... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L175-L214 | [
"def",
"array_dualmap2",
"(",
"*",
"refls",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"get_self",
"(",
"obj",
",",
"*",
"args",
")",
":",
"return",
"(",
"obj",
")",
"if",
"(",
"'value_map_func_args'",
"in",
"kwargs",
")",
":",
"value_map_func_args",
"=... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | mapfi | #mapfi 共享相同的o,v不作为map_func参数
# share common other_args,NOT take value as a param for map_func
#map_func diff_func(index,*common_args) | elist/elist.py | def mapfi(ol,map_func_args,**kwargs):
'''
#mapfi 共享相同的o,v不作为map_func参数
# share common other_args,NOT take value as a param for map_func
#map_func diff_func(index,*common_args)
'''
diff_funcs_arr = kwargs['map_funcs']
lngth = ol.__len__()
rsl... | def mapfi(ol,map_func_args,**kwargs):
'''
#mapfi 共享相同的o,v不作为map_func参数
# share common other_args,NOT take value as a param for map_func
#map_func diff_func(index,*common_args)
'''
diff_funcs_arr = kwargs['map_funcs']
lngth = ol.__len__()
rsl... | [
"#mapfi",
"共享相同的o",
"v不作为map_func参数",
"#",
"share",
"common",
"other_args",
"NOT",
"take",
"value",
"as",
"a",
"param",
"for",
"map_func",
"#map_func",
"diff_func",
"(",
"index",
"*",
"common_args",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L221-L237 | [
"def",
"mapfi",
"(",
"ol",
",",
"map_func_args",
",",
"*",
"*",
"kwargs",
")",
":",
"diff_funcs_arr",
"=",
"kwargs",
"[",
"'map_funcs'",
"]",
"lngth",
"=",
"ol",
".",
"__len__",
"(",
")",
"rslt",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | mapfv | #mapfv 共享相同的o,i不作为map_func参数
# share common other_args,NOT take value as a param for map_func
#map_func diff_func(value,*common_args) | elist/elist.py | def mapfv(ol,map_func_args,*args,**kwargs):
'''
#mapfv 共享相同的o,i不作为map_func参数
# share common other_args,NOT take value as a param for map_func
#map_func diff_func(value,*common_args)
'''
args = list(args)
lngth = args.__len__()
if(lngth == 0)... | def mapfv(ol,map_func_args,*args,**kwargs):
'''
#mapfv 共享相同的o,i不作为map_func参数
# share common other_args,NOT take value as a param for map_func
#map_func diff_func(value,*common_args)
'''
args = list(args)
lngth = args.__len__()
if(lngth == 0)... | [
"#mapfv",
"共享相同的o",
"i不作为map_func参数",
"#",
"share",
"common",
"other_args",
"NOT",
"take",
"value",
"as",
"a",
"param",
"for",
"map_func",
"#map_func",
"diff_func",
"(",
"value",
"*",
"common_args",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L244-L265 | [
"def",
"mapfv",
"(",
"ol",
",",
"map_func_args",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
"=",
"list",
"(",
"args",
")",
"lngth",
"=",
"args",
".",
"__len__",
"(",
")",
"if",
"(",
"lngth",
"==",
"0",
")",
":",
"diff_funcs_arr"... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | mapfo | #mapfo i不作为map_func参数,v不作为map_func参数
# NOT take value as a param for map_func,NOT take index as a param for map_func
#map_func diff_func(*diff_args) | elist/elist.py | def mapfo(ol,**kwargs):
'''
#mapfo i不作为map_func参数,v不作为map_func参数
# NOT take value as a param for map_func,NOT take index as a param for map_func
#map_func diff_func(*diff_args)
'''
diff_args_arr = kwargs['map_func_args_array']
diff_funcs_arr = k... | def mapfo(ol,**kwargs):
'''
#mapfo i不作为map_func参数,v不作为map_func参数
# NOT take value as a param for map_func,NOT take index as a param for map_func
#map_func diff_func(*diff_args)
'''
diff_args_arr = kwargs['map_func_args_array']
diff_funcs_arr = k... | [
"#mapfo",
"i不作为map_func参数",
"v不作为map_func参数",
"#",
"NOT",
"take",
"value",
"as",
"a",
"param",
"for",
"map_func",
"NOT",
"take",
"index",
"as",
"a",
"param",
"for",
"map_func",
"#map_func",
"diff_func",
"(",
"*",
"diff_args",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L279-L296 | [
"def",
"mapfo",
"(",
"ol",
",",
"*",
"*",
"kwargs",
")",
":",
"diff_args_arr",
"=",
"kwargs",
"[",
"'map_func_args_array'",
"]",
"diff_funcs_arr",
"=",
"kwargs",
"[",
"'map_funcs'",
"]",
"lngth",
"=",
"ol",
".",
"__len__",
"(",
")",
"rslt",
"=",
"[",
"... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | mapiv2 | from elist.elist import *
ol = ['a','b','c','d']
#1
def map_func(index,value,*others):
return(value * index + others[0] +others[-1])
mapiv(ol,map_func,'tailA-','tailB')
#2
mapiv2(ol,lambda index,value,other:(value*index+other),['-'])
mapiv2(ol,lambda i... | elist/elist.py | def mapiv2(ol,map_func,*args,**kwargs):
'''
from elist.elist import *
ol = ['a','b','c','d']
#1
def map_func(index,value,*others):
return(value * index + others[0] +others[-1])
mapiv(ol,map_func,'tailA-','tailB')
#2
mapiv2(ol,lambda index,value,oth... | def mapiv2(ol,map_func,*args,**kwargs):
'''
from elist.elist import *
ol = ['a','b','c','d']
#1
def map_func(index,value,*others):
return(value * index + others[0] +others[-1])
mapiv(ol,map_func,'tailA-','tailB')
#2
mapiv2(ol,lambda index,value,oth... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"a",
"b",
"c",
"d",
"]",
"#1",
"def",
"map_func",
"(",
"index",
"value",
"*",
"others",
")",
":",
"return",
"(",
"value",
"*",
"index",
"+",
"others",
"[",
"0",
"]",
"+",
"others",
"... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L320-L346 | [
"def",
"mapiv2",
"(",
"ol",
",",
"map_func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
"=",
"list",
"(",
"args",
")",
"if",
"(",
"args",
".",
"__len__",
"(",
")",
">",
"0",
")",
":",
"map_func_args",
"=",
"args",
"else",
":",... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | mapvo | #mapvo 共享相同的f,i不作为map_func参数
# share common map_func,NOT take index as a param for map_func
# common_func(value,*priv_args) | elist/elist.py | def mapvo(ol,map_func,*args,**kwargs):
'''
#mapvo 共享相同的f,i不作为map_func参数
# share common map_func,NOT take index as a param for map_func
# common_func(value,*priv_args)
'''
lngth = ol.__len__()
args = list(args)
if(args.__len__()==0):
diff_args_arr = ... | def mapvo(ol,map_func,*args,**kwargs):
'''
#mapvo 共享相同的f,i不作为map_func参数
# share common map_func,NOT take index as a param for map_func
# common_func(value,*priv_args)
'''
lngth = ol.__len__()
args = list(args)
if(args.__len__()==0):
diff_args_arr = ... | [
"#mapvo",
"共享相同的f",
"i不作为map_func参数",
"#",
"share",
"common",
"map_func",
"NOT",
"take",
"index",
"as",
"a",
"param",
"for",
"map_func",
"#",
"common_func",
"(",
"value",
"*",
"priv_args",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L380-L400 | [
"def",
"mapvo",
"(",
"ol",
",",
"map_func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"lngth",
"=",
"ol",
".",
"__len__",
"(",
")",
"args",
"=",
"list",
"(",
"args",
")",
"if",
"(",
"args",
".",
"__len__",
"(",
")",
"==",
"0",
")",... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | array_map2 | obseleted just for compatible
from elist.elist import *
ol = [1,2,3,4]
refl1 = ['+','+','+','+']
refl2 = [7,7,7,7]
refl3 = ['=','=','=','=']
def map_func(ele,ref_ele1,ref_ele2,ref_ele3,prefix,suffix):
s = prefix+': ' + str(ele) + str(ref_ele1) + str(ref_ele2) ... | elist/elist.py | def array_map2(*referls,**kwargs):
'''
obseleted just for compatible
from elist.elist import *
ol = [1,2,3,4]
refl1 = ['+','+','+','+']
refl2 = [7,7,7,7]
refl3 = ['=','=','=','=']
def map_func(ele,ref_ele1,ref_ele2,ref_ele3,prefix,suffix):
s = pref... | def array_map2(*referls,**kwargs):
'''
obseleted just for compatible
from elist.elist import *
ol = [1,2,3,4]
refl1 = ['+','+','+','+']
refl2 = [7,7,7,7]
refl3 = ['=','=','=','=']
def map_func(ele,ref_ele1,ref_ele2,ref_ele3,prefix,suffix):
s = pref... | [
"obseleted",
"just",
"for",
"compatible",
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"refl1",
"=",
"[",
"+",
"+",
"+",
"+",
"]",
"refl2",
"=",
"[",
"7",
"7",
"7",
"7",
"]",
"refl3",
"=",
"[",
"=",
... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L404-L436 | [
"def",
"array_map2",
"(",
"*",
"referls",
",",
"*",
"*",
"kwargs",
")",
":",
"map_func",
"=",
"kwargs",
"[",
"'map_func'",
"]",
"if",
"(",
"'map_func_args'",
"in",
"kwargs",
")",
":",
"map_func_args",
"=",
"kwargs",
"[",
"'map_func_args'",
"]",
"else",
"... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | mapi | #mapi v不作为map_func参数,共享相同的f,共享相同的o
# NOT take value as a param for map_func
# share common other_args
# share common map_func
# common_func(index,*common_args) | elist/elist.py | def mapi(ol,map_func,map_func_args=[]):
'''
#mapi v不作为map_func参数,共享相同的f,共享相同的o
# NOT take value as a param for map_func
# share common other_args
# share common map_func
# common_func(index,*common_args)
'''
lngth = ol.__len__()
... | def mapi(ol,map_func,map_func_args=[]):
'''
#mapi v不作为map_func参数,共享相同的f,共享相同的o
# NOT take value as a param for map_func
# share common other_args
# share common map_func
# common_func(index,*common_args)
'''
lngth = ol.__len__()
... | [
"#mapi",
"v不作为map_func参数",
"共享相同的f",
"共享相同的o",
"#",
"NOT",
"take",
"value",
"as",
"a",
"param",
"for",
"map_func",
"#",
"share",
"common",
"other_args",
"#",
"share",
"common",
"map_func",
"#",
"common_func",
"(",
"index",
"*",
"common_args",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L476-L493 | [
"def",
"mapi",
"(",
"ol",
",",
"map_func",
",",
"map_func_args",
"=",
"[",
"]",
")",
":",
"lngth",
"=",
"ol",
".",
"__len__",
"(",
")",
"rslt",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"lngth",
")",
":",
"index",
"=",
"i",
"va... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | mapv | #mapv i不作为map_func参数,共享相同的f,共享相同的o
# NOT take index as a param for map_func
# share common other_args
# share common map_func
# common_func(value,*common_args) | elist/elist.py | def mapv(ol,map_func,map_func_args=[]):
'''
#mapv i不作为map_func参数,共享相同的f,共享相同的o
# NOT take index as a param for map_func
# share common other_args
# share common map_func
# common_func(value,*common_args)
'''
rslt = list(map(lambda ... | def mapv(ol,map_func,map_func_args=[]):
'''
#mapv i不作为map_func参数,共享相同的f,共享相同的o
# NOT take index as a param for map_func
# share common other_args
# share common map_func
# common_func(value,*common_args)
'''
rslt = list(map(lambda ... | [
"#mapv",
"i不作为map_func参数",
"共享相同的f",
"共享相同的o",
"#",
"NOT",
"take",
"index",
"as",
"a",
"param",
"for",
"map_func",
"#",
"share",
"common",
"other_args",
"#",
"share",
"common",
"map_func",
"#",
"common_func",
"(",
"value",
"*",
"common_args",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L503-L513 | [
"def",
"mapv",
"(",
"ol",
",",
"map_func",
",",
"map_func_args",
"=",
"[",
"]",
")",
":",
"rslt",
"=",
"list",
"(",
"map",
"(",
"lambda",
"ele",
":",
"map_func",
"(",
"ele",
",",
"*",
"map_func_args",
")",
",",
"ol",
")",
")",
"return",
"(",
"rsl... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | array_map | obseleted,just for compatible
from elist.elist import *
ol = [1,2,3,4]
def map_func(ele,mul,plus):
return(ele*mul+plus)
array_map(ol,map_func,2,100) | elist/elist.py | def array_map(ol,map_func,*args):
'''
obseleted,just for compatible
from elist.elist import *
ol = [1,2,3,4]
def map_func(ele,mul,plus):
return(ele*mul+plus)
array_map(ol,map_func,2,100)
'''
rslt = list(map(lambda ele:map_func(ele,*args),ol))
return(r... | def array_map(ol,map_func,*args):
'''
obseleted,just for compatible
from elist.elist import *
ol = [1,2,3,4]
def map_func(ele,mul,plus):
return(ele*mul+plus)
array_map(ol,map_func,2,100)
'''
rslt = list(map(lambda ele:map_func(ele,*args),ol))
return(r... | [
"obseleted",
"just",
"for",
"compatible",
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"def",
"map_func",
"(",
"ele",
"mul",
"plus",
")",
":",
"return",
"(",
"ele",
"*",
"mul",
"+",
"plus",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L516-L527 | [
"def",
"array_map",
"(",
"ol",
",",
"map_func",
",",
"*",
"args",
")",
":",
"rslt",
"=",
"list",
"(",
"map",
"(",
"lambda",
"ele",
":",
"map_func",
"(",
"ele",
",",
"*",
"args",
")",
",",
"ol",
")",
")",
"return",
"(",
"rslt",
")"
] | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | mapo | #mapo i不作为map_func参数,v不作为map_func参数,共享相同的f
# NOT take index as a param for map_func
# NOT take value as a param for map_func
# share common map_func
# common_func(*priv_args) | elist/elist.py | def mapo(ol,map_func,*params,**kwargs):
'''
#mapo i不作为map_func参数,v不作为map_func参数,共享相同的f
# NOT take index as a param for map_func
# NOT take value as a param for map_func
# share common map_func
# common_func(*priv_args)
'''
params = ... | def mapo(ol,map_func,*params,**kwargs):
'''
#mapo i不作为map_func参数,v不作为map_func参数,共享相同的f
# NOT take index as a param for map_func
# NOT take value as a param for map_func
# share common map_func
# common_func(*priv_args)
'''
params = ... | [
"#mapo",
"i不作为map_func参数",
"v不作为map_func参数",
"共享相同的f",
"#",
"NOT",
"take",
"index",
"as",
"a",
"param",
"for",
"map_func",
"#",
"NOT",
"take",
"value",
"as",
"a",
"param",
"for",
"map_func",
"#",
"share",
"common",
"map_func",
"#",
"common_func",
"(",
"*",
... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L540-L564 | [
"def",
"mapo",
"(",
"ol",
",",
"map_func",
",",
"*",
"params",
",",
"*",
"*",
"kwargs",
")",
":",
"params",
"=",
"list",
"(",
"params",
")",
"if",
"(",
"params",
".",
"__len__",
"(",
")",
"==",
"0",
")",
":",
"diff_args_arr",
"=",
"kwargs",
"[",
... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | findfivo | #findfivo f,i,v,o四元决定 fivo-4-tuple-engine
#cond_func diff_func(index,value,*diff_args) | elist/elist.py | def findfivo(ol,*args,**kwargs):
'''
#findfivo f,i,v,o四元决定 fivo-4-tuple-engine
#cond_func diff_func(index,value,*diff_args)
'''
args = list(args)
lngth = args.__len__()
if(lngth==0):
diff_funcs_arr = kwargs['cond_funcs']
diff_args_... | def findfivo(ol,*args,**kwargs):
'''
#findfivo f,i,v,o四元决定 fivo-4-tuple-engine
#cond_func diff_func(index,value,*diff_args)
'''
args = list(args)
lngth = args.__len__()
if(lngth==0):
diff_funcs_arr = kwargs['cond_funcs']
diff_args_... | [
"#findfivo",
"f",
"i",
"v",
"o四元决定",
"fivo",
"-",
"4",
"-",
"tuple",
"-",
"engine",
"#cond_func",
"diff_func",
"(",
"index",
"value",
"*",
"diff_args",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L570-L602 | [
"def",
"findfivo",
"(",
"ol",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
"=",
"list",
"(",
"args",
")",
"lngth",
"=",
"args",
".",
"__len__",
"(",
")",
"if",
"(",
"lngth",
"==",
"0",
")",
":",
"diff_funcs_arr",
"=",
"kwargs",
... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | findfiv | #findfiv 共享相同的o share common other_args
#cond_func diff_func(index,value,*common_args) | elist/elist.py | def findfiv(ol,cond_func_args,**kwargs):
'''
#findfiv 共享相同的o share common other_args
#cond_func diff_func(index,value,*common_args)
'''
lngth = ol.__len__()
diff_funcs_arr = kwargs['cond_funcs']
common_args_arr = init(lngth,map_func_args)
... | def findfiv(ol,cond_func_args,**kwargs):
'''
#findfiv 共享相同的o share common other_args
#cond_func diff_func(index,value,*common_args)
'''
lngth = ol.__len__()
diff_funcs_arr = kwargs['cond_funcs']
common_args_arr = init(lngth,map_func_args)
... | [
"#findfiv",
"共享相同的o",
"share",
"common",
"other_args",
"#cond_func",
"diff_func",
"(",
"index",
"value",
"*",
"common_args",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L617-L626 | [
"def",
"findfiv",
"(",
"ol",
",",
"cond_func_args",
",",
"*",
"*",
"kwargs",
")",
":",
"lngth",
"=",
"ol",
".",
"__len__",
"(",
")",
"diff_funcs_arr",
"=",
"kwargs",
"[",
"'cond_funcs'",
"]",
"common_args_arr",
"=",
"init",
"(",
"lngth",
",",
"map_func_a... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | findv | #mapv i不作为map_func参数,共享相同的f,共享相同的o
# NOT take index as a param for map_func
# share common other_args
# share common cond_func
# common_func(value,*common_args) | elist/elist.py | def findv(ol,cond_func,cond_func_args=[]):
'''
#mapv i不作为map_func参数,共享相同的f,共享相同的o
# NOT take index as a param for map_func
# share common other_args
# share common cond_func
# common_func(value,*common_args)
'''
rslt = []
for i... | def findv(ol,cond_func,cond_func_args=[]):
'''
#mapv i不作为map_func参数,共享相同的f,共享相同的o
# NOT take index as a param for map_func
# share common other_args
# share common cond_func
# common_func(value,*common_args)
'''
rslt = []
for i... | [
"#mapv",
"i不作为map_func参数",
"共享相同的f",
"共享相同的o",
"#",
"NOT",
"take",
"index",
"as",
"a",
"param",
"for",
"map_func",
"#",
"share",
"common",
"other_args",
"#",
"share",
"common",
"cond_func",
"#",
"common_func",
"(",
"value",
"*",
"common_args",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L635-L651 | [
"def",
"findv",
"(",
"ol",
",",
"cond_func",
",",
"cond_func_args",
"=",
"[",
"]",
")",
":",
"rslt",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"ol",
".",
"__len__",
"(",
")",
")",
":",
"cond",
"=",
"cond_func",
"(",
"ol",
"[",
"i",
"]",
... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | cond_select_indexes_all | from elist.elist import *
from elist.jprint import pobj
def test_func(ele,x):
cond = (ele > x)
return(cond)
ol = [1,2,3,4,5,6,7]
rslt = cond_select_indexes_all(ol,cond_func = test_func, cond_func_args = [3])
pobj(rslt) | elist/elist.py | def cond_select_indexes_all(ol,**kwargs):
'''
from elist.elist import *
from elist.jprint import pobj
def test_func(ele,x):
cond = (ele > x)
return(cond)
ol = [1,2,3,4,5,6,7]
rslt = cond_select_indexes_all(ol,cond_func = test_func, cond_func_a... | def cond_select_indexes_all(ol,**kwargs):
'''
from elist.elist import *
from elist.jprint import pobj
def test_func(ele,x):
cond = (ele > x)
return(cond)
ol = [1,2,3,4,5,6,7]
rslt = cond_select_indexes_all(ol,cond_func = test_func, cond_func_a... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"from",
"elist",
".",
"jprint",
"import",
"pobj",
"def",
"test_func",
"(",
"ele",
"x",
")",
":",
"cond",
"=",
"(",
"ele",
">",
"x",
")",
"return",
"(",
"cond",
")",
"ol",
"=",
"[",
"1",
"2",
"3",
"4... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L742-L762 | [
"def",
"cond_select_indexes_all",
"(",
"ol",
",",
"*",
"*",
"kwargs",
")",
":",
"cond_func",
"=",
"kwargs",
"[",
"'cond_func'",
"]",
"if",
"(",
"'cond_func_args'",
"in",
"kwargs",
")",
":",
"cond_func_args",
"=",
"kwargs",
"[",
"'cond_func_args'",
"]",
"else... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | cond_select_indexes_all2 | from elist.elist import *
from xdict.jprint import pobj
def test_func(ele,index,x):
cond1 = (ele > x)
cond2 = (index %2 == 0)
cond =(cond1 & cond2)
return(cond)
ol = [1,2,3,4,5,6,7]
rslt = cond_select_indexes_all2(ol,cond_func = test_func,... | elist/elist.py | def cond_select_indexes_all2(ol,**kwargs):
'''
from elist.elist import *
from xdict.jprint import pobj
def test_func(ele,index,x):
cond1 = (ele > x)
cond2 = (index %2 == 0)
cond =(cond1 & cond2)
return(cond)
ol = [1,2,3,4,5,6,7]
... | def cond_select_indexes_all2(ol,**kwargs):
'''
from elist.elist import *
from xdict.jprint import pobj
def test_func(ele,index,x):
cond1 = (ele > x)
cond2 = (index %2 == 0)
cond =(cond1 & cond2)
return(cond)
ol = [1,2,3,4,5,6,7]
... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"from",
"xdict",
".",
"jprint",
"import",
"pobj",
"def",
"test_func",
"(",
"ele",
"index",
"x",
")",
":",
"cond1",
"=",
"(",
"ele",
">",
"x",
")",
"cond2",
"=",
"(",
"index",
"%2",
"==",
"0",
")",
"co... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L765-L787 | [
"def",
"cond_select_indexes_all2",
"(",
"ol",
",",
"*",
"*",
"kwargs",
")",
":",
"cond_func",
"=",
"kwargs",
"[",
"'cond_func'",
"]",
"if",
"(",
"'cond_func_args'",
"in",
"kwargs",
")",
":",
"cond_func_args",
"=",
"kwargs",
"[",
"'cond_func_args'",
"]",
"els... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | select_seqs | from elist.elist import *
ol = ['a','b','c','d']
select_seqs(ol,[1,2]) | elist/elist.py | def select_seqs(ol,seqs):
'''
from elist.elist import *
ol = ['a','b','c','d']
select_seqs(ol,[1,2])
'''
rslt =copy.deepcopy(ol)
rslt = itemgetter(*seqs)(ol)
if(seqs.__len__()==0):
rslt = []
elif(seqs.__len__()==1):
rslt = [rslt]
else:
rslt = l... | def select_seqs(ol,seqs):
'''
from elist.elist import *
ol = ['a','b','c','d']
select_seqs(ol,[1,2])
'''
rslt =copy.deepcopy(ol)
rslt = itemgetter(*seqs)(ol)
if(seqs.__len__()==0):
rslt = []
elif(seqs.__len__()==1):
rslt = [rslt]
else:
rslt = l... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"a",
"b",
"c",
"d",
"]",
"select_seqs",
"(",
"ol",
"[",
"1",
"2",
"]",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L974-L988 | [
"def",
"select_seqs",
"(",
"ol",
",",
"seqs",
")",
":",
"rslt",
"=",
"copy",
".",
"deepcopy",
"(",
"ol",
")",
"rslt",
"=",
"itemgetter",
"(",
"*",
"seqs",
")",
"(",
"ol",
")",
"if",
"(",
"seqs",
".",
"__len__",
"(",
")",
"==",
"0",
")",
":",
... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | append | from elist.elist import *
ol = [1,2,3,4]
ele = 5
id(ol)
append(ol,ele,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
ele = 5
id(ol)
new = append(ol,ele)
new
id(new) | elist/elist.py | def append(ol,ele,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
ele = 5
id(ol)
append(ol,ele,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
ele = 5
id(ol)
new = append(ol,ele)
new
id(new)
''... | def append(ol,ele,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
ele = 5
id(ol)
append(ol,ele,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
ele = 5
id(ol)
new = append(ol,ele)
new
id(new)
''... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"ele",
"=",
"5",
"id",
"(",
"ol",
")",
"append",
"(",
"ol",
"ele",
"mode",
"=",
"original",
")",
"ol",
"id",
"(",
"ol",
")",
"####",
"ol",
"=",
"[",
"1",... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1052-L1079 | [
"def",
"append",
"(",
"ol",
",",
"ele",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"'mode'",
"in",
"kwargs",
")",
":",
"mode",
"=",
"kwargs",
"[",
"\"mode\"",
"]",
"else",
":",
"mode",
"=",
"\"new\"",
"if",
"(",
"mode",
"==",
"\"new\"",
")",
... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | append_some | from elist.elist import *
ol = [1,2,3,4]
id(ol)
append_some(ol,5,6,7,8,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
id(ol)
new = append_some(ol,5,6,7,8)
new
id(new) | elist/elist.py | def append_some(ol,*eles,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
id(ol)
append_some(ol,5,6,7,8,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
id(ol)
new = append_some(ol,5,6,7,8)
new
id(new)
'''
i... | def append_some(ol,*eles,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
id(ol)
append_some(ol,5,6,7,8,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
id(ol)
new = append_some(ol,5,6,7,8)
new
id(new)
'''
i... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"id",
"(",
"ol",
")",
"append_some",
"(",
"ol",
"5",
"6",
"7",
"8",
"mode",
"=",
"original",
")",
"ol",
"id",
"(",
"ol",
")",
"####",
"ol",
"=",
"[",
"1"... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1081-L1100 | [
"def",
"append_some",
"(",
"ol",
",",
"*",
"eles",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"'mode'",
"in",
"kwargs",
")",
":",
"mode",
"=",
"kwargs",
"[",
"\"mode\"",
"]",
"else",
":",
"mode",
"=",
"\"new\"",
"return",
"(",
"extend",
"(",
"... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | prepend | from elist.elist import *
ol = [1,2,3,4]
ele = 5
id(ol)
prepend(ol,ele,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
ele = 5
id(ol)
new = prepend(ol,ele)
new
id(new) | elist/elist.py | def prepend(ol,ele,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
ele = 5
id(ol)
prepend(ol,ele,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
ele = 5
id(ol)
new = prepend(ol,ele)
new
id(new)
... | def prepend(ol,ele,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
ele = 5
id(ol)
prepend(ol,ele,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
ele = 5
id(ol)
new = prepend(ol,ele)
new
id(new)
... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"ele",
"=",
"5",
"id",
"(",
"ol",
")",
"prepend",
"(",
"ol",
"ele",
"mode",
"=",
"original",
")",
"ol",
"id",
"(",
"ol",
")",
"####",
"ol",
"=",
"[",
"1"... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1103-L1135 | [
"def",
"prepend",
"(",
"ol",
",",
"ele",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"'mode'",
"in",
"kwargs",
")",
":",
"mode",
"=",
"kwargs",
"[",
"\"mode\"",
"]",
"else",
":",
"mode",
"=",
"\"new\"",
"if",
"(",
"mode",
"==",
"\"new\"",
")",
... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | prepend_some | from elist.elist import *
ol = [1,2,3,4]
id(ol)
prepend_some(ol,5,6,7,8,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
id(ol)
new = prepend_some(ol,5,6,7,8)
new
id(new)
#####unshift is the same as prepend_some
>>> un... | elist/elist.py | def prepend_some(ol,*eles,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
id(ol)
prepend_some(ol,5,6,7,8,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
id(ol)
new = prepend_some(ol,5,6,7,8)
new
id(new)
##... | def prepend_some(ol,*eles,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
id(ol)
prepend_some(ol,5,6,7,8,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
id(ol)
new = prepend_some(ol,5,6,7,8)
new
id(new)
##... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"id",
"(",
"ol",
")",
"prepend_some",
"(",
"ol",
"5",
"6",
"7",
"8",
"mode",
"=",
"original",
")",
"ol",
"id",
"(",
"ol",
")",
"####",
"ol",
"=",
"[",
"1... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1137-L1159 | [
"def",
"prepend_some",
"(",
"ol",
",",
"*",
"eles",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"'mode'",
"in",
"kwargs",
")",
":",
"mode",
"=",
"kwargs",
"[",
"\"mode\"",
"]",
"else",
":",
"mode",
"=",
"\"new\"",
"return",
"(",
"prextend",
"(",
... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | extend | from elist.elist import *
ol = [1,2,3,4]
nl = [5,6,7,8]
id(ol)
extend(ol,nl,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
nl = [5,6,7,8]
id(ol)
new = extend(ol,nl)
new
id(new) | elist/elist.py | def extend(ol,nl,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
nl = [5,6,7,8]
id(ol)
extend(ol,nl,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
nl = [5,6,7,8]
id(ol)
new = extend(ol,nl)
new
id(... | def extend(ol,nl,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
nl = [5,6,7,8]
id(ol)
extend(ol,nl,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
nl = [5,6,7,8]
id(ol)
new = extend(ol,nl)
new
id(... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"nl",
"=",
"[",
"5",
"6",
"7",
"8",
"]",
"id",
"(",
"ol",
")",
"extend",
"(",
"ol",
"nl",
"mode",
"=",
"original",
")",
"ol",
"id",
"(",
"ol",
")",
"##... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1163-L1191 | [
"def",
"extend",
"(",
"ol",
",",
"nl",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"'mode'",
"in",
"kwargs",
")",
":",
"mode",
"=",
"kwargs",
"[",
"\"mode\"",
"]",
"else",
":",
"mode",
"=",
"\"new\"",
"if",
"(",
"mode",
"==",
"\"new\"",
")",
... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | push | from elist.elist import *
ol=[1,2,3,4]
id(ol)
new = push(ol,5,6,7)
new
id(new)
####
ol=[1,2,3,4]
id(ol)
rslt = push(ol,5,6,7,mode="original")
rslt
id(rslt) | elist/elist.py | def push(ol,*eles,**kwargs):
'''
from elist.elist import *
ol=[1,2,3,4]
id(ol)
new = push(ol,5,6,7)
new
id(new)
####
ol=[1,2,3,4]
id(ol)
rslt = push(ol,5,6,7,mode="original")
rslt
id(rslt)
'''
if('mode' in kwargs... | def push(ol,*eles,**kwargs):
'''
from elist.elist import *
ol=[1,2,3,4]
id(ol)
new = push(ol,5,6,7)
new
id(new)
####
ol=[1,2,3,4]
id(ol)
rslt = push(ol,5,6,7,mode="original")
rslt
id(rslt)
'''
if('mode' in kwargs... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"id",
"(",
"ol",
")",
"new",
"=",
"push",
"(",
"ol",
"5",
"6",
"7",
")",
"new",
"id",
"(",
"new",
")",
"####",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1193-L1213 | [
"def",
"push",
"(",
"ol",
",",
"*",
"eles",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"'mode'",
"in",
"kwargs",
")",
":",
"mode",
"=",
"kwargs",
"[",
"'mode'",
"]",
"else",
":",
"mode",
"=",
"\"new\"",
"eles",
"=",
"list",
"(",
"eles",
")",... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | prextend | from elist.elist import *
ol = [1,2,3,4]
nl = [5,6,7,8]
id(ol)
id(nl)
prextend(ol,nl,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
nl = [5,6,7,8]
id(ol)
id(nl)
new = prextend(ol,nl)
new
id(new) | elist/elist.py | def prextend(ol,nl,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
nl = [5,6,7,8]
id(ol)
id(nl)
prextend(ol,nl,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
nl = [5,6,7,8]
id(ol)
id(nl)
new = pre... | def prextend(ol,nl,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
nl = [5,6,7,8]
id(ol)
id(nl)
prextend(ol,nl,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
nl = [5,6,7,8]
id(ol)
id(nl)
new = pre... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"nl",
"=",
"[",
"5",
"6",
"7",
"8",
"]",
"id",
"(",
"ol",
")",
"id",
"(",
"nl",
")",
"prextend",
"(",
"ol",
"nl",
"mode",
"=",
"original",
")",
"ol",
"... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1215-L1252 | [
"def",
"prextend",
"(",
"ol",
",",
"nl",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"'mode'",
"in",
"kwargs",
")",
":",
"mode",
"=",
"kwargs",
"[",
"\"mode\"",
"]",
"else",
":",
"mode",
"=",
"\"new\"",
"if",
"(",
"mode",
"==",
"\"new\"",
")",
... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | concat | from elist.elist import *
l1 = [1,2,3]
l2 = ["a","b","c"]
l3 = [100,200]
id(l1)
id(l2)
id(l3)
arrays = [l1,l2,l3]
new = concat(arrays)
new
id(new) | elist/elist.py | def concat(*arrays):
'''
from elist.elist import *
l1 = [1,2,3]
l2 = ["a","b","c"]
l3 = [100,200]
id(l1)
id(l2)
id(l3)
arrays = [l1,l2,l3]
new = concat(arrays)
new
id(new)
'''
new = []
length = arrays.__len__()
f... | def concat(*arrays):
'''
from elist.elist import *
l1 = [1,2,3]
l2 = ["a","b","c"]
l3 = [100,200]
id(l1)
id(l2)
id(l3)
arrays = [l1,l2,l3]
new = concat(arrays)
new
id(new)
'''
new = []
length = arrays.__len__()
f... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"l1",
"=",
"[",
"1",
"2",
"3",
"]",
"l2",
"=",
"[",
"a",
"b",
"c",
"]",
"l3",
"=",
"[",
"100",
"200",
"]",
"id",
"(",
"l1",
")",
"id",
"(",
"l2",
")",
"id",
"(",
"l3",
")",
"arrays",
"=",
"[... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1254-L1273 | [
"def",
"concat",
"(",
"*",
"arrays",
")",
":",
"new",
"=",
"[",
"]",
"length",
"=",
"arrays",
".",
"__len__",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"length",
")",
":",
"array",
"=",
"copy",
".",
"deepcopy",
"(",
"arrays",
"[",
"i"... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | cdr | from elist.elist import *
ol=[1,2,3,4]
id(ol)
new = cdr(ol)
new
id(new)
####
ol=[1,2,3,4]
id(ol)
rslt = cdr(ol,mode="original")
rslt
id(rslt) | elist/elist.py | def cdr(ol,**kwargs):
'''
from elist.elist import *
ol=[1,2,3,4]
id(ol)
new = cdr(ol)
new
id(new)
####
ol=[1,2,3,4]
id(ol)
rslt = cdr(ol,mode="original")
rslt
id(rslt)
'''
if('mode' in kwargs):
mode = kwa... | def cdr(ol,**kwargs):
'''
from elist.elist import *
ol=[1,2,3,4]
id(ol)
new = cdr(ol)
new
id(new)
####
ol=[1,2,3,4]
id(ol)
rslt = cdr(ol,mode="original")
rslt
id(rslt)
'''
if('mode' in kwargs):
mode = kwa... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"id",
"(",
"ol",
")",
"new",
"=",
"cdr",
"(",
"ol",
")",
"new",
"id",
"(",
"new",
")",
"####",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"id",
"(",
"o... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1302-L1326 | [
"def",
"cdr",
"(",
"ol",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"'mode'",
"in",
"kwargs",
")",
":",
"mode",
"=",
"kwargs",
"[",
"'mode'",
"]",
"else",
":",
"mode",
"=",
"\"new\"",
"if",
"(",
"mode",
"==",
"\"new\"",
")",
":",
"cpol",
"="... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | cons | from elist.elist import *
ol=[1,2,3,4]
id(ol)
new = cons(5,ol)
new
id(new)
####
ol=[1,2,3,4]
id(ol)
rslt = cons(5,ol,mode="original")
rslt
id(rslt) | elist/elist.py | def cons(head_ele,l,**kwargs):
'''
from elist.elist import *
ol=[1,2,3,4]
id(ol)
new = cons(5,ol)
new
id(new)
####
ol=[1,2,3,4]
id(ol)
rslt = cons(5,ol,mode="original")
rslt
id(rslt)
'''
if('mode' in kwargs):
... | def cons(head_ele,l,**kwargs):
'''
from elist.elist import *
ol=[1,2,3,4]
id(ol)
new = cons(5,ol)
new
id(new)
####
ol=[1,2,3,4]
id(ol)
rslt = cons(5,ol,mode="original")
rslt
id(rslt)
'''
if('mode' in kwargs):
... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"id",
"(",
"ol",
")",
"new",
"=",
"cons",
"(",
"5",
"ol",
")",
"new",
"id",
"(",
"new",
")",
"####",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"id",
"... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1328-L1347 | [
"def",
"cons",
"(",
"head_ele",
",",
"l",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"'mode'",
"in",
"kwargs",
")",
":",
"mode",
"=",
"kwargs",
"[",
"'mode'",
"]",
"else",
":",
"mode",
"=",
"\"new\"",
"return",
"(",
"prepend",
"(",
"l",
",",
... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | uniform_index | uniform_index(0,3)
uniform_index(-1,3)
uniform_index(-4,3)
uniform_index(-3,3)
uniform_index(5,3) | elist/elist.py | def uniform_index(index,length):
'''
uniform_index(0,3)
uniform_index(-1,3)
uniform_index(-4,3)
uniform_index(-3,3)
uniform_index(5,3)
'''
if(index<0):
rl = length+index
if(rl<0):
index = 0
else:
index = rl
elif(inde... | def uniform_index(index,length):
'''
uniform_index(0,3)
uniform_index(-1,3)
uniform_index(-4,3)
uniform_index(-3,3)
uniform_index(5,3)
'''
if(index<0):
rl = length+index
if(rl<0):
index = 0
else:
index = rl
elif(inde... | [
"uniform_index",
"(",
"0",
"3",
")",
"uniform_index",
"(",
"-",
"1",
"3",
")",
"uniform_index",
"(",
"-",
"4",
"3",
")",
"uniform_index",
"(",
"-",
"3",
"3",
")",
"uniform_index",
"(",
"5",
"3",
")"
] | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1349-L1367 | [
"def",
"uniform_index",
"(",
"index",
",",
"length",
")",
":",
"if",
"(",
"index",
"<",
"0",
")",
":",
"rl",
"=",
"length",
"+",
"index",
"if",
"(",
"rl",
"<",
"0",
")",
":",
"index",
"=",
"0",
"else",
":",
"index",
"=",
"rl",
"elif",
"(",
"i... | 8c07b5029bda34ead60ce10335ceb145f209263c |
valid | insert | from elist.elist import *
ol = [1,2,3,4]
ele = 5
id(ol)
insert(ol,2,ele,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
ele = 5
id(ol)
new = insert(ol,2,ele)
new
id(new) | elist/elist.py | def insert(ol,start_index,ele,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
ele = 5
id(ol)
insert(ol,2,ele,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
ele = 5
id(ol)
new = insert(ol,2,ele)
new
... | def insert(ol,start_index,ele,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
ele = 5
id(ol)
insert(ol,2,ele,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
ele = 5
id(ol)
new = insert(ol,2,ele)
new
... | [
"from",
"elist",
".",
"elist",
"import",
"*",
"ol",
"=",
"[",
"1",
"2",
"3",
"4",
"]",
"ele",
"=",
"5",
"id",
"(",
"ol",
")",
"insert",
"(",
"ol",
"2",
"ele",
"mode",
"=",
"original",
")",
"ol",
"id",
"(",
"ol",
")",
"####",
"ol",
"=",
"[",... | ihgazni2/elist | python | https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1369-L1400 | [
"def",
"insert",
"(",
"ol",
",",
"start_index",
",",
"ele",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"'mode'",
"in",
"kwargs",
")",
":",
"mode",
"=",
"kwargs",
"[",
"\"mode\"",
"]",
"else",
":",
"mode",
"=",
"\"new\"",
"if",
"(",
"mode",
"==... | 8c07b5029bda34ead60ce10335ceb145f209263c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.