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
dependency
dict
requirement
dict
tests
listlengths
1
5
indent
int64
2
12
prompt
stringlengths
358
22.1k
target_function_prompt
stringlengths
15
74.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 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/python-benedict/benedict/utils/type_util.py import pathlib import re from datetime import datetime from decimal import Decimal regex = re.compile("").__class__ uu...
def is_json_serializable(val):
feedparser.urls.convert_to_idn
function
Text-Processing/feedparser
Text-Processing/feedparser/feedparser/urls.py
[ 61, 61 ]
[ 66, 83 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/feedparser/feedparser/html.py # lines: 195-206 # def handle_charref(self, ref): # """ # :type ref: str # :rtype: None # """ # ...
def convert_to_idn(url): """Convert a URL to IDN notation"""
mistune.toc.add_toc_hook
function
Text-Processing/mistune
Text-Processing/mistune/src/mistune/toc.py
[ 4, 4 ]
[ 23, 44 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/mistune/src/mistune/util.py # lines: 22-36 # def escape_url(link: str): # """Escape URL for safety.""" # safe = ( # ':/?#@' # gen-delims - '...
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)...
mistune.plugins.table.table_in_quote
function
Text-Processing/mistune
Text-Processing/mistune/src/mistune/plugins/table.py
[ 170, 170 ]
[ 172, 173 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/mistune/src/mistune/helpers.py # lines: 41-50 # def unescape_char(text): # return _ESCAPE_CHAR_RE.sub(r'\1', text) # def parse_link_text(src, pos): # level = ...
def table_in_quote(md): """Enable table plugin in block quotes."""
mistune.plugins.table.table_in_list
function
Text-Processing/mistune
Text-Processing/mistune/src/mistune/plugins/table.py
[ 176, 176 ]
[ 178, 179 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/mistune/src/mistune/helpers.py # lines: 26-40 # BLOCK_TAGS = ( # 'address', 'article', 'aside', 'base', 'basefont', 'blockquote', # 'body', 'caption', 'center...
def table_in_list(md): """Enable table plugin in list."""
xmnlp.utils.parallel_handler
function
Text-Processing/xmnlp
Text-Processing/xmnlp/xmnlp/utils/__init__.py
[ 90, 92 ]
[ 101, 107 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/PyLaTeX/pylatex/lists.py # lines: 1-15 # # -*- coding: utf-8 -*- # """ # This module implements the classes that deal with LaTeX lists. # These lists are specifically...
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]] """
parsel.utils.shorten
function
Text-Processing/parsel
Text-Processing/parsel/parsel/utils.py
[ 87, 87 ]
[ 89, 95 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/natasha/natasha/extractors.py # lines: 51-59 # def find(self, text): # matches = list(self(text)) # if not matches: # return # ...
def shorten(text: str, width: int, suffix: str = "...") -> str: """Truncate the given text to fit in the given width."""
parsel.xpathfuncs.set_xpathfunc
function
Text-Processing/parsel
Text-Processing/parsel/parsel/xpathfuncs.py
[ 13, 13 ]
[ 27, 31 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/parsel/parsel/xpathfuncs.py import re from typing import Any, Callable, Optional from lxml import etree from w3lib.html import HTML5_WHITESPACE regex = f"[{HTM...
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...
dominate.dom_tag._get_thread_context
function
Text-Processing/dominate
Text-Processing/dominate/dominate/dom_tag.py
[ 47, 47 ]
[ 48, 51 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/dominate/dominate/util.py # lines: 117-130 # def __init__(self, func, *args, **kwargs): # super(lazy, self).__init__() # self.func = func # self.args ...
def _get_thread_context():
dominate.util.system
function
Text-Processing/dominate
Text-Processing/dominate/dominate/util.py
[ 45, 45 ]
[ 49, 52 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/dominate/dominate/dom_tag.py # lines: 41-55 # class dom_tag(object): # is_single = False # Tag does not require matching end tag (ex. <hr/>) # is_pretty = True ...
def system(cmd, data=None): ''' pipes the output of a program '''
dominate.util.url_unescape
function
Text-Processing/dominate
Text-Processing/dominate/dominate/util.py
[ 118, 118 ]
[ 119, 120 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/dominate/dominate/dom_tag.py # lines: 147-161 # if isinstance(obj, basestring): # obj = util.escape(obj) # self.children.append(obj) # eli...
def url_unescape(data):
rows.fields.DatetimeField.serialize
method
Text-Processing/rows
Text-Processing/rows/rows/fields.py
[ 390, 390 ]
[ 391, 394 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/natasha/natasha/norm.py # lines: 29-43 # def feats_match(a, b): # return ( # a.get(GENDER) == b.get(GENDER) # and a.get(NUMBER) == b.get(NUMBER) #...
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...
rows.fields.Field.serialize
method
Text-Processing/rows
Text-Processing/rows/rows/fields.py
[ 77, 77 ]
[ 84, 86 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/natasha/natasha/norm.py # lines: 29-43 # def feats_match(a, b): # return ( # a.get(GENDER) == b.get(GENDER) # and a.get(NUMBER) == b.get(NUMBER) #...
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)...
rows.fields.EmailField.serialize
method
Text-Processing/rows
Text-Processing/rows/rows/fields.py
[ 438, 438 ]
[ 439, 442 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/natasha/natasha/norm.py # lines: 83-91 # def syntax_normalize(vocab, tokens): # ids = set(select_inflectable(tokens)) # words = inflect_words(vocab, tokens, i...
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):
rows.fields.as_string
function
Text-Processing/rows
Text-Processing/rows/rows/fields.py
[ 478, 478 ]
[ 479, 484 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/natasha/natasha/norm.py # lines: 29-43 # def feats_match(a, b): # return ( # a.get(GENDER) == b.get(GENDER) # and a.get(NUMBER) == b.get(NUMBER) #...
def as_string(value):
rows.fields.get_items
function
Text-Processing/rows
Text-Processing/rows/rows/fields.py
[ 506, 506 ]
[ 513, 515 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "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
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/natasha/natasha/norm.py # lines: 14-28 # def recover_spaces(words, tokens): # offset = None # parts = [] # for index, (word, token) in enumerate(zip(words...
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). """
pycorrector.proper_corrector.load_dict_file
function
Text-Processing/pycorrector
Text-Processing/pycorrector/pycorrector/proper_corrector.py
[ 31, 31 ]
[ 37, 52 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "Arguments": ":param path: String. The file path from which the dictionary is to be loaded.\n:return: Dictionary. The loaded dictionary from the file. If the file is not found, an empty dictionary is returned.", "Functionality": "Load a dictionary from the given file path. It reads the file line by line and creat...
[ "tests/ner_error_test.py::test_common_error" ]
4
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/pycorrector/pycorrector/utils/tokenizer.py # lines: 109-119 # class Tokenizer(object): # def __init__(self, dict_path='', custom_word_freq_dict=None, custom_confu...
def load_dict_file(path): """ 加载词典 :param path: :return: """
natasha.span.envelop_spans
function
Text-Processing/natasha
Text-Processing/natasha/natasha/span.py
[ 23, 23 ]
[ 24, 37 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "Arguments": ":param spans: List of spans. The spans to be enveloped.\n:param envelopes: List of envelopes. The envelopes used to envelop the spans.\n:return: Yield the chunk of spans for each envelope.", "Functionality": "This function envelops the spans based on the given envelopes. It iterates through the span...
[ "tests/test_span.py::test_envelope_spans" ]
4
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Text-Processing/natasha/natasha/record.py # lines: 1-12 # from collections import OrderedDict # def parse_annotation(annotation): # type = annotation or str # repeatable = Fa...
def envelop_spans(spans, envelopes):
googleapiclient._helpers.parse_unique_urlencoded
function
Internet/google-api-python-client
Internet/google-api-python-client/googleapiclient/_helpers.py
[ 141, 141 ]
[ 153, 163 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "Arguments": ":param content: string. URL-encoded key-value pairs.\n:return: dict. The key-value pairs from the input content.\nRaises:\nValueError: if one of the keys is repeated.", "Functionality": "This function parses unique key-value parameters from URL-encoded content. It first parses the URL-encoded conten...
[ "tests/test__helpers.py::Test_parse_unique_urlencoded::test_without_repeats", "tests/test__helpers.py::Test_parse_unique_urlencoded::test_with_repeats" ]
4
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Internet/Authlib/authlib/oauth2/rfc7523/validator.py # lines: 1-15 # import time # import logging # from authlib.jose import jwt, JoseError, JWTClaims # from ..rfc6749 import TokenMi...
def parse_unique_urlencoded(content): """Parses unique key-value parameters from urlencoded content. Args: content: string, URL-encoded key-value pairs. Returns: dict, The key-value pairs from ``content``. Raises: ValueError: if one of the keys is repeated. """
jinja2.async_utils.auto_aiter
function
Internet/Jinja2
Internet/Jinja2/src/jinja2/async_utils.py
[ 70, 72 ]
[ 73, 78 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "Arguments": ":param iterable: Union of AsyncIterable and Iterable. The input iterable from which the iterator is created.\n:return: AsyncIterator. The created asynchronous iterator.", "Functionality": "This function creates an asynchronous iterator from the given iterable. It checks if the iterable has an __aite...
[ "tests/test_async.py::test_async_iteration_in_templates_extended" ]
4
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Internet/Jinja2/src/jinja2/utils.py # lines: 444-454 # def select_autoescape( # enabled_extensions: t.Collection[str] = ("html", "htm", "xml"), # disabled_extensions: t.Colle...
def auto_aiter( iterable: "t.Union[t.AsyncIterable[V], t.Iterable[V]]", ) -> "t.AsyncIterator[V]":
jinja2.utils.consume
function
Internet/Jinja2
Internet/Jinja2/src/jinja2/utils.py
[ 112, 112 ]
[ 114, 115 ]
{ "cross_file": [], "intra_class": [], "intra_file": [] }
{ "Arguments": ":param iterable: Iterable. The iterable to be consumed.\n:return: No return values.", "Functionality": "This function consumes an iterable without doing anything with it. It iterates through the given iterable and does nothing with the elements." }
[ "tests/test_utils.py::test_consume" ]
4
You are a Python programmer working with a repository. Here is all the context you may find useful to complete the function: # file path: Internet/Jinja2/src/jinja2/compiler.py # lines: 93-107 # generator = environment.code_generator_class( # environment, name, filename, stream, defer_init, optimized # ...
def consume(iterable: t.Iterable[t.Any]) -> None: """Consumes an iterable without doing anything with it."""
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
6