Dataset Viewer
Auto-converted to Parquet Duplicate
namespace
stringlengths
12
102
type
stringclasses
2 values
project_path
stringclasses
115 values
completion_path
stringlengths
20
110
signature_position
listlengths
2
2
body_position
listlengths
2
2
requirement
dict
tests
listlengths
1
5
indent
int64
2
12
anchor_name
stringlengths
18
115
anchor_text
dict
import_statements
listlengths
0
140
target_function_prompt
stringlengths
15
74.4k
prompt
stringlengths
308
842k
target_function_name
stringlengths
2
63
target_source
stringlengths
12
89
example
stringlengths
0
23.4k
benedict.utils.type_util.is_json_serializable
function
Text-Processing/python-benedict
Text-Processing/python-benedict/benedict/utils/type_util.py
[ 53, 53 ]
[ 54, 55 ]
{ "Arguments": ":param val: Any. The input value to be checked for JSON serializability.\n:return: Bool. True if the input value is JSON serializable, False otherwise.", "Functionality": "Check if the input value is JSON serializable. It checks if the input value is of the JSON serializable types." }
[ "tests/utils/test_type_util.py::type_util_test_case::test_is_json_serializable" ]
4
is_json_serializable@python-benedict/benedict/utils/type_util.py
{ "code": "def is_json_serializable(val):\n json_types = (type(None), bool, dict, float, int, list, str, tuple)\n return isinstance(val, json_types)", "description": "DOCSTRING", "file_path": "python-benedict/benedict/utils/type_util.py", "incoming_calls": [], "name": "is_json_serializable", "signatur...
[ "from datetime import datetime", "import re", "from decimal import Decimal", "import pathlib" ]
def is_json_serializable(val):
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #CURRENT FILE python-benedict/benedict/utils/type_util.py from datetime import datetime import re from decimal import Decimal import pathlib regex = re.compile("").__class__ def is_bool(val): ...
is_json_serializable
python-benedict/benedict/utils/type_util.py
feedparser.urls.convert_to_idn
function
Text-Processing/feedparser
Text-Processing/feedparser/feedparser/urls.py
[ 61, 61 ]
[ 66, 83 ]
{ "Arguments": ":param url: String. The URL to be converted to IDN notation.\n:return: String. The URL in IDN notation.", "Functionality": "Convert a URL to IDN notation. It checks if the host can be encoded in ASCII. If not, it converts the host to IDN form." }
[ "tests/runtests.py::TestConvertToIdn::test_port", "tests/runtests.py::TestConvertToIdn::test_idn", "tests/runtests.py::TestConvertToIdn::test_control" ]
4
convert_to_idn@feedparser/feedparser/urls.py
{ "code": "def convert_to_idn(url):\n \"\"\"Convert a URL to IDN notation\"\"\"\n # this function should only be called with a unicode string\n # strategy: if the host cannot be encoded in ascii, then\n # it'll be necessary to encode it in idn form\n parts = list(urllib.parse.urlsplit(url))\n try:\n...
[ "from .html import _BaseHTMLProcessor", "import re", "import urllib.parse" ]
def convert_to_idn(url): """Convert a URL to IDN notation"""
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #CURRENT FILE feedparser/feedparser/urls.py from .html import _BaseHTMLProcessor import re import urllib.parse class RelativeURIResolver(_BaseHTMLProcessor): relative_uris = { ('a',...
convert_to_idn
feedparser/feedparser/urls.py
def get(url, etag=None, modified=None, agent=None, referrer=None, handlers=None, request_headers=None, result=None): if handlers is None: handlers = [] elif not isinstance(handlers, list): handlers = [handlers] if request_headers is None: request_headers = {} # Deal with the fee...
mistune.toc.add_toc_hook
function
Text-Processing/mistune
Text-Processing/mistune/src/mistune/toc.py
[ 4, 4 ]
[ 23, 44 ]
{ "Arguments": ":param md: Markdown instance. The instance of the Markdown class.\n:param min_level: Integer. The minimum heading level to include in the TOC.\n:param max_level: Integer. The maximum heading level to include in the TOC.\n:param heading_id: Function. A function to generate heading_id.\n:return: No retu...
[ "tests/test_hooks.py::TestTocHook::test_customize_heading_id_func" ]
4
add_toc_hook@mistune/src/mistune/toc.py
{ "code": "def add_toc_hook(md, min_level=1, max_level=3, heading_id=None):\n \"\"\"Add a hook to save toc items into ``state.env``. This is\n usually helpful for doc generator::\n\n import mistune\n from mistune.toc import add_toc_hook, render_toc_ul\n\n md = mistune.create_markdown(...)\n...
[ "from .util import striptags" ]
def add_toc_hook(md, min_level=1, max_level=3, heading_id=None): """Add a hook to save toc items into ``state.env``. This is usually helpful for doc generator:: import mistune from mistune.toc import add_toc_hook, render_toc_ul md = mistune.create_markdown(...) add_toc_hook(md)...
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #FILE mistune/src/mistune/util.py #CURRENT FILE mistune/src/mistune/toc.py from .util import striptags def normalize_toc_item(md, token): text = token['text'] tokens = md.inline(text, ...
add_toc_hook
mistune/src/mistune/toc.py
def toc_hook(md, state): headings = [] for tok in state.tokens: if tok['type'] == 'heading': level = tok['attrs']['level'] if min_level <= level <= max_level: headings.append(tok) toc_items = [] for i, tok in enumerate(hea...
mistune.plugins.table.table_in_quote
function
Text-Processing/mistune
Text-Processing/mistune/src/mistune/plugins/table.py
[ 170, 170 ]
[ 172, 173 ]
{ "Arguments": ":param md: Markdown. The Markdown instance.\n:return: No return values.", "Functionality": "This function enables the table plugin in block quotes by inserting rules for table and nptable before the paragraph in the block quote rules." }
[ "tests/test_plugins.py::TestExtraPlugins::test_table_in_quote" ]
4
table_in_quote@mistune/src/mistune/plugins/table.py
{ "code": "def table_in_quote(md):\n \"\"\"Enable table plugin in block quotes.\"\"\"\n md.block.insert_rule(md.block.block_quote_rules, 'table', before='paragraph')\n md.block.insert_rule(md.block.block_quote_rules, 'nptable', before='paragraph')", "description": "Enable table plugin in block quotes.", ...
[ "from ..helpers import PREVENT_BACKSLASH", "import re" ]
def table_in_quote(md): """Enable table plugin in block quotes."""
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #FILE mistune/src/mistune/helpers.py PREVENT_BACKSLASH = "(?<!\\)(?:\\\\)*" #CURRENT FILE mistune/src/mistune/plugins/table.py from ..helpers import PREVENT_BACKSLASH import re CELL_SPLIT = r...
table_in_quote
mistune/src/mistune/plugins/table.py
mistune.plugins.table.table_in_list
function
Text-Processing/mistune
Text-Processing/mistune/src/mistune/plugins/table.py
[ 176, 176 ]
[ 178, 179 ]
{ "Arguments": ":param md: Markdown. The Markdown instance to enable the table plugin in the list.\n:return: No return values.", "Functionality": "This function enables the table plugin in the list. It inserts the table and nptable rules before the paragraph rule in the list." }
[ "tests/test_plugins.py::TestExtraPlugins::test_table_in_list" ]
4
table_in_list@mistune/src/mistune/plugins/table.py
{ "code": "def table_in_list(md):\n \"\"\"Enable table plugin in list.\"\"\"\n md.block.insert_rule(md.block.list_rules, 'table', before='paragraph')\n md.block.insert_rule(md.block.list_rules, 'nptable', before='paragraph')", "description": "Enable table plugin in list.", "file_path": "mistune/src/mistu...
[ "from ..helpers import PREVENT_BACKSLASH", "import re" ]
def table_in_list(md): """Enable table plugin in list."""
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #CURRENT FILE mistune/src/mistune/plugins/table.py from ..helpers import PREVENT_BACKSLASH import re CELL_SPLIT = re.compile(r' *' + PREVENT_BACKSLASH + r'\| *') NP_TABLE_PATTERN = "^ {0,3}(?P<...
table_in_list
mistune/src/mistune/plugins/table.py
xmnlp.utils.parallel_handler
function
Text-Processing/xmnlp
Text-Processing/xmnlp/xmnlp/utils/__init__.py
[ 90, 92 ]
[ 101, 107 ]
{ "Arguments": ":param callback: Callable. The callback function to be applied to the list of texts.\n:param texts: List[str]. The list of texts to be processed.\n:param n_jobs: int. The pool size of threads. Defaults to 2.\n:param kwargs: Any additional keyword arguments to be passed to the callback function.\n:retu...
[ "tests/test_xmnlp.py::test_radical_parallel", "tests/test_xmnlp.py::test_pinyin_parallel" ]
4
parallel_handler@xmnlp/xmnlp/utils/__init__.py
{ "code": "def parallel_handler(callback: Callable, texts: List[str], n_jobs: int = 2, **kwargs) -> Generator[\n List[Any], None, None\n]:\n \"\"\"parallel handler\n Args:\n callback: callback function\n texts: List[str]\n n_jobs: int, pool size of threads\n Return:\n Generator[List[st...
[ "from typing import Any", "from typing import Callable", "from typing import Generator", "from typing import List", "import numpy", "import re", "from functools import partial", "import concurrent.futures", "import os" ]
def parallel_handler(callback: Callable, texts: List[str], n_jobs: int = 2, **kwargs) -> Generator[ List[Any], None, None ]: """parallel handler Args: callback: callback function texts: List[str] n_jobs: int, pool size of threads Return: Generator[List[str]] """
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #FILE PyLaTeX/pylatex/lists.py #CURRENT FILE xmnlp/xmnlp/utils/__init__.py from typing import Any from typing import Callable from typing import Generator from typing import List import numpy i...
parallel_handler
xmnlp/xmnlp/utils/__init__.py
parsel.utils.shorten
function
Text-Processing/parsel
Text-Processing/parsel/parsel/utils.py
[ 87, 87 ]
[ 89, 95 ]
{ "Arguments": ":param text: String. The input text to be shortened.\n:param width: Integer. The width to which the text should be shortened.\n:param suffix: String. The suffix to be added at the end of the shortened text. Defaults to \"...\".\n:return: String. The shortened text.", "Functionality": "Shorten the gi...
[ "tests/test_utils.py::test_shorten" ]
4
shorten@parsel/parsel/utils.py
{ "code": "def shorten(text: str, width: int, suffix: str = \"...\") -> str:\n \"\"\"Truncate the given text to fit in the given width.\"\"\"\n if len(text) <= width:\n return text\n if width > len(suffix):\n return text[: width - len(suffix)] + suffix\n if width >= 0:\n return suffix...
[ "from typing import Any", "from typing import Iterable", "from typing import Iterator", "from typing import List", "from typing import Match", "from typing import Pattern", "from typing import Union", "from typing import cast", "import re", "from w3lib.html import replace_entities" ]
def shorten(text: str, width: int, suffix: str = "...") -> str: """Truncate the given text to fit in the given width."""
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #FILE PyLaTeX/pylatex/lists.py #FILE natasha/natasha/extractors.py #CURRENT FILE parsel/parsel/utils.py from typing import Any from typing import Iterable from typing import Iterator from typi...
shorten
parsel/parsel/utils.py
def __str__(self) -> str: data = repr(shorten(self.get(), width=40)) return f"<{type(self).__name__} query={self._expr!r} data={data}>"
parsel.xpathfuncs.set_xpathfunc
function
Text-Processing/parsel
Text-Processing/parsel/parsel/xpathfuncs.py
[ 13, 13 ]
[ 27, 31 ]
{ "Arguments": ":param fname: String. The identifier under which the function will be registered.\n:param func: Callable. The function to be registered. If None, the extension function will be removed.\n:return: No return values.", "Functionality": "This function registers a custom extension function to use in XPat...
[ "tests/test_xpathfuncs.py::XPathFuncsTestCase::test_set_xpathfunc" ]
4
set_xpathfunc@parsel/parsel/xpathfuncs.py
{ "code": "def set_xpathfunc(fname: str, func: Optional[Callable]) -> None: # type: ignore[type-arg]\n \"\"\"Register a custom extension function to use in XPath expressions.\n\n The function ``func`` registered under ``fname`` identifier will be called\n for every matching node, being passed a ``context`` ...
[ "from typing import Any", "from typing import Callable", "from typing import Optional", "import re", "from lxml import etree", "from w3lib.html import HTML5_WHITESPACE" ]
def set_xpathfunc(fname: str, func: Optional[Callable]) -> None: # type: ignore[type-arg] """Register a custom extension function to use in XPath expressions. The function ``func`` registered under ``fname`` identifier will be called for every matching node, being passed a ``context`` parameter as well as...
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #CURRENT FILE parsel/parsel/xpathfuncs.py from typing import Any from typing import Callable from typing import Optional import re from lxml import etree from w3lib.html import HTML5_WHITESPACE ...
set_xpathfunc
parsel/parsel/xpathfuncs.py
def setup() -> None: set_xpathfunc("has-class", has_class)
dominate.dom_tag._get_thread_context
function
Text-Processing/dominate
Text-Processing/dominate/dominate/dom_tag.py
[ 47, 47 ]
[ 48, 51 ]
{ "Arguments": ":param: No input parameters.\n:return: Integer. The hash value of the current thread context.", "Functionality": "This function returns the hash value of the current thread context. It first creates a list of the current thread and greenlet (if available) and then returns the hash value of the tuple...
[ "tests/test_dom_tag.py::test___get_thread_context" ]
2
_get_thread_context@dominate/dominate/dom_tag.py
{ "code": "def _get_thread_context():\n context = [threading.current_thread()]\n if greenlet:\n context.append(greenlet.getcurrent())\n return hash(tuple(context))", "description": "DOCSTRING", "file_path": "dominate/dominate/dom_tag.py", "incoming_calls": [ "get_current@dominate/dominate/dom_tag.py",...
[ "from . import util", "from collections import defaultdict", "from collections import namedtuple", "from collections.abc import Callable", "from functools import wraps", "import copy", "import greenlet", "import numbers", "import threading" ]
def _get_thread_context():
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #FILE dominate/dominate/util.py str_escape = escape #CURRENT FILE dominate/dominate/dom_tag.py from . import util from collections import defaultdict from collections import namedtuple from co...
_get_thread_context
dominate/dominate/dom_tag.py
def get_current(default=_get_current_none): ''' get the current tag being used as a with context or decorated function. if no context is active, raises ValueError, or returns the default, if provided ''' h = _get_thread_context() ctx = dom_tag._with_contexts.get(h, None) if ctx: return ctx[-1].tag i...
dominate.util.system
function
Text-Processing/dominate
Text-Processing/dominate/dominate/util.py
[ 45, 45 ]
[ 49, 52 ]
{ "Arguments": ":param cmd: String. The system command to be executed.\n:param data: Bytes. Optional input data to be passed to the command.\n:return: String. The output of the system command as a decoded string.", "Functionality": "This function runs a system command and returns the output as a string. It uses the...
[ "tests/test_utils.py::test_system" ]
2
system@dominate/dominate/util.py
{ "code": "def system(cmd, data=None):\n '''\n pipes the output of a program\n '''\n import subprocess\n s = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE)\n out, err = s.communicate(data)\n return out.decode('utf8')", "description": "pipes the output of a program", "file_...
[ "from .dom_tag import dom_tag", "import re" ]
def system(cmd, data=None): ''' pipes the output of a program '''
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #FILE dominate/dominate/dom_tag.py #CURRENT FILE dominate/dominate/util.py from .dom_tag import dom_tag import re class container(dom_tag): ''' Contains multiple elements, but does not add...
system
dominate/dominate/util.py
def test_system(): d = div() d += util.system('echo Hello World') assert d.render().replace('\r\n', '\n') == '<div>Hello World\n</div>'
dominate.util.url_unescape
function
Text-Processing/dominate
Text-Processing/dominate/dominate/util.py
[ 118, 118 ]
[ 119, 120 ]
{ "Arguments": ":param data: String. The URL-encoded string to be unescaped.\n:return: String. The unescaped string.", "Functionality": "This function takes a string as input and unescapes any URL-encoded characters in the string." }
[ "tests/test_utils.py::test_url" ]
2
url_unescape@dominate/dominate/util.py
{ "code": "def url_unescape(data):\n return re.sub('%([0-9a-fA-F]{2})',\n lambda m: unichr(int(m.group(1), 16)), data)", "description": "DOCSTRING", "file_path": "dominate/dominate/util.py", "incoming_calls": [ "test_url@dominate/tests/test_utils.py" ], "name": "url_unescape", "signature": "def ur...
[ "from .dom_tag import dom_tag", "import re" ]
def url_unescape(data):
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #CURRENT FILE dominate/dominate/util.py from .dom_tag import dom_tag import re class container(dom_tag): ''' Contains multiple elements, but does not add a level ''' is_inline = True ...
url_unescape
dominate/dominate/util.py
def test_url(): assert util.url_escape('hi there?') == 'hi%20there%3F' assert util.url_unescape('hi%20there%3f') == 'hi there?'
rows.fields.DatetimeField.serialize
method
Text-Processing/rows
Text-Processing/rows/rows/fields.py
[ 390, 390 ]
[ 391, 394 ]
{ "Arguments": ":param cls: Class. The class instance.\n:param value: Datetime. The datetime value to be serialized.\n:param *args: Additional positional arguments.\n:param **kwargs: Additional keyword arguments.\n:return: String. The serialized datetime value in ISO 8601 format.", "Functionality": "Serialize the g...
[ "tests/tests_fields.py::FieldsTestCase::test_DatetimeField" ]
8
DatetimeField.serialize@rows/rows/fields.py
{ "code": "def serialize(cls, value, *args, **kwargs):\n if value is None:\n return \"\"\n\n return six.text_type(value.isoformat())", "description": "DOCSTRING", "file_path": "rows/rows/fields.py", "incoming_calls": [], "name": "serialize", "signature": "def serialize(cls, value, *...
[ "from base64 import b64decode", "from base64 import b64encode", "import datetime", "import json", "import re", "from __future__ import unicode_literals", "from collections import OrderedDict", "from collections import defaultdict", "from decimal import Decimal", "from decimal import InvalidOperati...
class DatetimeField(Field): """Field class to represent date-time Is not locale-aware (does not need to be) """ TYPE = (datetime.datetime,) DATETIME_REGEXP = re.compile( "^([0-9]{4})-([0-9]{2})-([0-9]{2})[ T]" "([0-9]{2}):([0-9]{2}):([0-9]{2})$" ) @classmethod def serialize(cl...
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #FILE natasha/natasha/norm.py #CURRENT FILE rows/rows/fields.py from base64 import b64decode from base64 import b64encode import datetime import json import re from __future__ import unicode_li...
serialize
rows/rows/fields.py
rows.fields.Field.serialize
method
Text-Processing/rows
Text-Processing/rows/rows/fields.py
[ 77, 77 ]
[ 84, 86 ]
{ "Arguments": ":param cls: Class. The class instance.\n:param value: Any. The value to be serialized.\n:param *args: Tuple. Additional positional arguments.\n:param **kwargs: Dictionary. Additional keyword arguments.\n:return: Any. The serialized value.", "Functionality": "This function serializes a value to be ex...
[ "tests/tests_fields.py::FieldsTestCase::test_Field", "tests/tests_fields.py::FieldsTestCase::test_TextField" ]
8
Field.serialize@rows/rows/fields.py
{ "code": "def serialize(cls, value, *args, **kwargs):\n \"\"\"Serialize a value to be exported\n\n `cls.serialize` should always return an unicode value, except for\n BinaryField\n \"\"\"\n\n if value is None:\n value = \"\"\n return value", "description": "Seri...
[ "from base64 import b64decode", "from base64 import b64encode", "import datetime", "import json", "import re", "from __future__ import unicode_literals", "from collections import OrderedDict", "from collections import defaultdict", "from decimal import Decimal", "from decimal import InvalidOperati...
class Field(object): """Base Field class - all fields should inherit from this As the fallback for all other field types are the BinaryField, this Field actually implements what is expected in the BinaryField """ TYPE = (type(None),) @classmethod def serialize(cls, value, *args, **kwargs)...
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #CURRENT FILE rows/rows/fields.py from base64 import b64decode from base64 import b64encode import datetime import json import re from __future__ import unicode_literals from collections import ...
serialize
rows/rows/fields.py
rows.fields.EmailField.serialize
method
Text-Processing/rows
Text-Processing/rows/rows/fields.py
[ 438, 438 ]
[ 439, 442 ]
{ "Arguments": ":param cls: Class. The class itself.\n:param value: Any. The value to be serialized.\n:param *args: Tuple. Additional positional arguments.\n:param **kwargs: Dictionary. Additional keyword arguments.\n:return: String. The serialized value.", "Functionality": "Serialize the value of the email field. ...
[ "tests/tests_fields.py::FieldsTestCase::test_EmailField" ]
8
EmailField.serialize@rows/rows/fields.py
{ "code": "def serialize(cls, value, *args, **kwargs):\n if value is None:\n return \"\"\n\n return six.text_type(value)", "description": "DOCSTRING", "file_path": "rows/rows/fields.py", "incoming_calls": [], "name": "serialize", "signature": "def serialize(cls, value, *args, **kwar...
[ "from base64 import b64decode", "from base64 import b64encode", "import datetime", "import json", "import re", "from __future__ import unicode_literals", "from collections import OrderedDict", "from collections import defaultdict", "from decimal import Decimal", "from decimal import InvalidOperati...
class EmailField(TextField): """Field class to represent e-mail addresses Is not locale-aware (does not need to be) """ EMAIL_REGEXP = re.compile( r"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]+$", flags=re.IGNORECASE ) @classmethod def serialize(cls, value, *args, **kwargs):
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #FILE natasha/natasha/norm.py #CURRENT FILE rows/rows/fields.py from base64 import b64decode from base64 import b64encode import datetime import json import re from __future__ import unicode_li...
serialize
rows/rows/fields.py
rows.fields.as_string
function
Text-Processing/rows
Text-Processing/rows/rows/fields.py
[ 478, 478 ]
[ 479, 484 ]
{ "Arguments": ":param value: Any. The input value to be converted to a string.\n:return: String. The input value converted to a string.", "Functionality": "Convert the input value to a string. If the input value is already a string, it returns the input value. If the input value is a binary type, it raises a Value...
[ "tests/tests_fields.py::FieldsFunctionsTestCase::test_as_string" ]
4
as_string@rows/rows/fields.py
{ "code": "def as_string(value):\n if isinstance(value, six.binary_type):\n raise ValueError(\"Binary is not supported\")\n elif isinstance(value, six.text_type):\n return value\n else:\n return six.text_type(value)", "description": "DOCSTRING", "file_path": "rows/rows/fields.py", ...
[ "from base64 import b64decode", "from base64 import b64encode", "import datetime", "import json", "import re", "from __future__ import unicode_literals", "from collections import OrderedDict", "from collections import defaultdict", "from decimal import Decimal", "from decimal import InvalidOperati...
def as_string(value):
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #FILE natasha/natasha/norm.py #CURRENT FILE rows/rows/fields.py from base64 import b64decode from base64 import b64encode import datetime import json import re from __future__ import unicode_li...
as_string
rows/rows/fields.py
def is_null(value): if value is None: return True elif type(value) is six.binary_type: value = value.strip().lower() return not value or value in NULL_BYTES else: value_str = as_string(value).strip().lower() return not value_str or value_str in NULL
rows.fields.get_items
function
Text-Processing/rows
Text-Processing/rows/rows/fields.py
[ 506, 506 ]
[ 513, 515 ]
{ "Arguments": ":param indexes: Tuple. The indexes of the object to be fetched.\n:return: Lambda function. A callable that fetches the given indexes of an object.", "Functionality": "This function returns a callable that fetches the given indexes of an object. It always returns a tuple even when len(indexes) == 1. ...
[ "tests/tests_fields.py::FieldsFunctionsTestCase::test_get_items" ]
4
get_items@rows/rows/fields.py
{ "code": "def get_items(*indexes):\n \"\"\"Return a callable that fetches the given indexes of an object\n Always return a tuple even when len(indexes) == 1.\n\n Similar to `operator.itemgetter`, but will insert `None` when the object\n does not have the desired index (instead of raising IndexError).\n ...
[ "from base64 import b64decode", "from base64 import b64encode", "import datetime", "import json", "import re", "from __future__ import unicode_literals", "from collections import OrderedDict", "from collections import defaultdict", "from decimal import Decimal", "from decimal import InvalidOperati...
def get_items(*indexes): """Return a callable that fetches the given indexes of an object Always return a tuple even when len(indexes) == 1. Similar to `operator.itemgetter`, but will insert `None` when the object does not have the desired index (instead of raising IndexError). """
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: #CURRENT FILE rows/rows/fields.py from base64 import b64decode from base64 import b64encode import datetime import json import re from __future__ import unicode_literals from collections import ...
get_items
rows/rows/fields.py
def get_item(d, keys): items = get_items(d, keys) return items[-1] if items else (None, None, None)
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
5