id
stringlengths
12
102
prompt
stringlengths
242
11.5M
relative_path
stringlengths
12
89
benedict.utils.type_util.is_json_serializable
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: python-benedict/benedict/utils/type_util.py import pathlib import re from datetime import datetime from decimal import Decimal def is_json_s...
python-benedict/benedict/utils/type_util.py
feedparser.urls.convert_to_idn
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: feedparser/feedparser/urls.py import re import urllib.parse from .html import _BaseHTMLProcessor def convert_to_idn(url): """Convert a U...
feedparser/feedparser/urls.py
mistune.toc.add_toc_hook
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE mistune/src/mistune/toc.py def render_toc_ul(toc): """Render a <ul> table of content HTML. The param "toc" should be formatted into this structure:: [ (level, id, text), ] F...
mistune/src/mistune/toc.py
mistune.plugins.table.table_in_quote
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE mistune/src/mistune/plugins/table.py def table_in_list(md): """Enable table plugin in list.""" md.block.insert_rule(md.block.list_rules, 'table', before='paragraph') md.block.insert_rule(md.block.list_...
mistune/src/mistune/plugins/table.py
mistune.plugins.table.table_in_list
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE mistune/src/mistune/plugins/table.py def table_in_quote(md): """Enable table plugin in block quotes.""" md.block.insert_rule(md.block.block_quote_rules, 'table', before='paragraph') md.block.insert_rul...
mistune/src/mistune/plugins/table.py
xmnlp.utils.parallel_handler
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: xmnlp/xmnlp/utils/__init__.py import os import re import concurrent.futures as futures from functools import partial from typing import Any, ...
xmnlp/xmnlp/utils/__init__.py
parsel.utils.shorten
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: parsel/parsel/utils.py import re from typing import Any, Iterable, Iterator, List, Match, Pattern, Union, cast from w3lib.html import replace...
parsel/parsel/utils.py
parsel.xpathfuncs.set_xpathfunc
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE parsel/parsel/xpathfuncs.py def setup() -> None: set_xpathfunc("has-class", has_class) Based on the information above, please complete the function: #CURRENT_FILE: parsel/parsel/xpathfuncs.py import re from...
parsel/parsel/xpathfuncs.py
dominate.dom_tag._get_thread_context
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE dominate/dominate/dom_tag.py def attr(*args, **kwargs): ''' Set attributes on the current active tag context ''' c = get_current() dicts = args + (kwargs,) for d in dicts: for attr, value in d.item...
dominate/dominate/dom_tag.py
dominate.util.system
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: dominate/dominate/util.py import re from .dom_tag import dom_tag import subprocess def system(cmd, data=None): ''' pipes the output of a...
dominate/dominate/util.py
dominate.util.url_unescape
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE dominate/dominate/util.py def unescape(data): ''' unescapes html entities. the opposite of escape. ''' cc = re.compile(r'&(?:(?:#(\d+))|([^;]+));') result = [] m = cc.search(data) while m: resul...
dominate/dominate/util.py
rows.fields.DatetimeField.serialize
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE rows/rows/fields.py def fields(self): possible, skip = self._possible_types, self._skip if possible: # Create a header with placeholder values for each detected column # an...
rows/rows/fields.py
rows.fields.Field.serialize
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE 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 ...
rows/rows/fields.py
rows.fields.EmailField.serialize
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE rows/rows/fields.py def unique_values(values): result = [] for value in values: if not is_null(value) and value not in result: result.append(value) return result # FILE rows/rows/f...
rows/rows/fields.py
rows.fields.as_string
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE rows/rows/fields.py def fields(self): possible, skip = self._possible_types, self._skip if possible: # Create a header with placeholder values for each detected column # an...
rows/rows/fields.py
rows.fields.get_items
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE rows/rows/fields.py def fields(self): possible, skip = self._possible_types, self._skip if possible: # Create a header with placeholder values for each detected column # an...
rows/rows/fields.py
pycorrector.proper_corrector.load_dict_file
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: pycorrector/pycorrector/proper_corrector.py import os from codecs import open import pypinyin from loguru import logger from pycorrector impo...
pycorrector/pycorrector/proper_corrector.py
natasha.span.envelop_spans
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE natasha/natasha/span.py def adapt_spans(spans): for span in spans: yield Span(span.start, span.stop, span.type) # FILE natasha/natasha/span.py class Span(Record): __attributes__ = ['start', 'stop'...
natasha/natasha/span.py
googleapiclient._helpers.parse_unique_urlencoded
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE google-api-python-client/googleapiclient/_helpers.py def _add_query_parameter(url, name, value): """Adds a query parameter to a url. Replaces the current value if it already exists in the URL. Args: ...
google-api-python-client/googleapiclient/_helpers.py
jinja2.async_utils.auto_aiter
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE Jinja2/src/jinja2/async_utils.py async def auto_to_list( value: "t.Union[t.AsyncIterable[V], t.Iterable[V]]", ) -> t.List["V"]: return [x async for x in auto_aiter(value)] # FILE Jinja2/src/jinja2/async_u...
Jinja2/src/jinja2/async_utils.py
jinja2.utils.consume
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE Jinja2/src/jinja2/utils.py class LRUCache: """A simple LRU Cache implementation.""" def __init__(self, capacity: int) -> None: self.capacity = capacity self._mapping: t.Dict[t.Any, t.Any] =...
Jinja2/src/jinja2/utils.py
pycorrector.utils.tokenizer.segment
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE pycorrector/pycorrector/utils/tokenizer.py def split_text_by_maxlen(text, maxlen=512): """ 文本切分为句子,以句子maxlen切分 :param text: str :param maxlen: int, 最大长度 :return: list, (sentence, idx) """ ...
pycorrector/pycorrector/utils/tokenizer.py
jinja2.utils.object_type_repr
You are a Python programmer. Here is all the context you may find useful to complete the function: # LIB typing_extensions.py def final(f): """This decorator can be used to indicate to type checkers that the decorated method cannot be overridden, and decorated class cannot be subclassed. For ex...
Jinja2/src/jinja2/utils.py
jinja2.utils.LRUCache.setdefault
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE Jinja2/src/jinja2/utils.py class Namespace: """A namespace object that can hold arbitrary attributes. It may be initialized from a dictionary or with keyword arguments.""" def __init__(*args: t.Any, *...
Jinja2/src/jinja2/utils.py
sumy.summarizers.sum_basic.SumBasicSummarizer._compute_word_freq
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE sumy/sumy/summarizers/_summarizer.py class AbstractSummarizer(object): def __init__(self, stemmer=null_stemmer): if not callable(stemmer): raise ValueError("Stemmer has to be a callable obj...
sumy/sumy/summarizers/sum_basic.py
sumy.summarizers.sum_basic.SumBasicSummarizer._compute_average_probability_of_words
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE sumy/sumy/summarizers/_summarizer.py class AbstractSummarizer(object): def __init__(self, stemmer=null_stemmer): if not callable(stemmer): raise ValueError("Stemmer has to be a callable obj...
sumy/sumy/summarizers/sum_basic.py
sumy.summarizers.lex_rank.LexRankSummarizer._compute_idf
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE sumy/sumy/summarizers/_summarizer.py class AbstractSummarizer(object): def __init__(self, stemmer=null_stemmer): if not callable(stemmer): raise ValueError("Stemmer has to be a callable obj...
sumy/sumy/summarizers/lex_rank.py
sumy.summarizers.lex_rank.LexRankSummarizer.cosine_similarity
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE sumy/sumy/summarizers/_summarizer.py class AbstractSummarizer(object): def __init__(self, stemmer=null_stemmer): if not callable(stemmer): raise ValueError("Stemmer has to be a callable obj...
sumy/sumy/summarizers/lex_rank.py
sumy.evaluation.rouge._get_ngrams
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE sumy/sumy/evaluation/rouge.py def rouge_n(evaluated_sentences, reference_sentences, n=2): """ Computes ROUGE-N of two text collections of sentences. Sourece: http://research.microsoft.com/en-us/um/peop...
sumy/sumy/evaluation/rouge.py
sumy.evaluation.rouge._split_into_words
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE sumy/sumy/evaluation/rouge.py def rouge_n(evaluated_sentences, reference_sentences, n=2): """ Computes ROUGE-N of two text collections of sentences. Sourece: http://research.microsoft.com/en-us/um/peop...
sumy/sumy/evaluation/rouge.py
falcon.inspect.register_router
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE falcon/falcon/inspect.py def to_string(self, verbose=False, internal=False) -> str: """Return a string representation of this class. Args: verbose (bool, optional): Adds more informati...
falcon/falcon/inspect.py
falcon.inspect.inspect_compiled_router
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE falcon/falcon/inspect.py def inspect_app(app: App) -> 'AppInfo': """Inspects an application. Args: app (falcon.App): The application to inspect. Works with both :class:`falcon.App` and...
falcon/falcon/inspect.py
falcon.inspect._is_internal
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: falcon/falcon/inspect.py from functools import partial import inspect from typing import Callable from typing import Dict from typing import ...
falcon/falcon/inspect.py
falcon.cmd.inspect_app.load_app
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: falcon/falcon/cmd/inspect_app.py import argparse import importlib import os import sys import falcon from falcon.inspect import inspect_app f...
falcon/falcon/cmd/inspect_app.py
falcon.cmd.inspect_app.make_parser
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: falcon/falcon/cmd/inspect_app.py import argparse import importlib import os import sys import falcon from falcon.inspect import inspect_app f...
falcon/falcon/cmd/inspect_app.py
falcon.util.uri.unquote_string
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE falcon/falcon/util/uri.py def parse_query_string(query_string, keep_blank=False, csv=True): """Parse a query string into a dict. Query string parameters are assumed to use standard form-encoding. Only ...
falcon/falcon/util/uri.py
falcon.util.misc.get_argnames
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: falcon/falcon/util/misc.py import datetime import functools import http import inspect import re import unicodedata from falcon import status...
falcon/falcon/util/misc.py
falcon.testing.client._is_asgi_app
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE falcon/falcon/testing/client.py async def _simulate_request_asgi( app, method='GET', path='/', query_string=None, headers=None, content_type=None, body=None, json=None, params=N...
falcon/falcon/testing/client.py
falcon.routing.converters.UUIDConverter.convert
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: falcon/falcon/routing/converters.py import abc from datetime import datetime import uuid class UUIDConverter(BaseConverter): """Converts...
falcon/falcon/routing/converters.py
rest_framework_simplejwt.utils.make_utc
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE djangorestframework-simplejwt/rest_framework_simplejwt/utils.py def aware_utcnow() -> datetime: return make_utc(datetime.utcnow()) # LIB django def is_naive(value): """ Determine if a given datetime.d...
djangorestframework-simplejwt/rest_framework_simplejwt/utils.py
boto.sdb.db.sequence.fib
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE boto/boto/sdb/db/sequence.py def increment_by_one(cv=None, lv=None): if cv is None: return 0 return cv + 1 # FILE boto/boto/sdb/db/sequence.py class Sequence(object): """A simple Sequence usin...
boto/boto/sdb/db/sequence.py
boto.s3.website.RoutingRules.add_rule
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE boto/boto/s3/website.py class WebsiteConfiguration(object): """ Website configuration for a bucket. :ivar suffix: Suffix that is appended to a request that is for a "directory" on the website ...
boto/boto/s3/website.py
boto.cloudfront.distribution.Distribution._canned_policy
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE boto/boto/cloudfront/identity.py class OriginAccessIdentity(object): def __init__(self, connection=None, config=None, id='', s3_user_id='', comment=''): self.connection = connection ...
boto/boto/cloudfront/distribution.py
boto.cloudfront.invalidation.InvalidationBatch.escape
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE boto/boto/resultset.py class ResultSet(list): """ The ResultSet is used to pass results back from the Amazon services to the client. It is light wrapper around Python's :py:class:`list` class, with...
boto/boto/cloudfront/invalidation.py
proxybroker.utils.get_status_code
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE proxybroker/proxybroker/utils.py def parse_headers(headers): headers = headers.decode('utf-8', 'ignore').split('\r\n') _headers = {} _headers.update(parse_status_line(headers.pop(0))) for h in hea...
proxybroker/proxybroker/utils.py
authlib.oauth2.rfc6749.util.scope_to_list
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE Authlib/authlib/oauth2/rfc6749/util.py def list_to_scope(scope): """Convert a list of scopes to a space separated string.""" if isinstance(scope, (set, tuple, list)): return " ".join([to_unicode(s)...
Authlib/authlib/oauth2/rfc6749/util.py
authlib.common.encoding.to_unicode
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE Authlib/authlib/common/encoding.py def base64_to_int(s): data = urlsafe_b64decode(to_bytes(s, charset='ascii')) buf = struct.unpack('%sB' % len(data), data) return int(''.join(["%02x" % byte for byte i...
Authlib/authlib/common/encoding.py
authlib.common.encoding.to_bytes
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE Authlib/authlib/common/encoding.py def int_to_base64(num): if num < 0: raise ValueError('Must be a positive integer') s = num.to_bytes((num.bit_length() + 7) // 8, 'big', signed=False) return ...
Authlib/authlib/common/encoding.py
authlib.common.encoding.urlsafe_b64decode
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE Authlib/authlib/common/encoding.py def int_to_base64(num): if num < 0: raise ValueError('Must be a positive integer') s = num.to_bytes((num.bit_length() + 7) // 8, 'big', signed=False) return ...
Authlib/authlib/common/encoding.py
csvs_to_sqlite.utils.table_exists
You are a Python programmer. Here is all the context you may find useful to complete the function: # LIB six.py def b(s): return s # LIB six.py def u(s): return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape") Based on the information above, please complete the function: #CURRENT_FILE: csvs-to-s...
csvs-to-sqlite/csvs_to_sqlite/utils.py
sqlitedict.SqliteDict.get_tablenames
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE sqlitedict/sqlitedict.py def reraise(tp, value, tb=None): if value is None: value = tp() if value.__traceback__ is not tb: raise value.with_traceback(tb) raise value # FILE sqlitedict/...
sqlitedict/sqlitedict.py
litecli.packages.parseutils.query_starts_with
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE litecli/litecli/packages/parseutils.py def is_destructive(queries): """Returns if any of the queries in *queries* is destructive.""" keywords = ("drop", "shutdown", "delete", "truncate", "alter") retur...
litecli/litecli/packages/parseutils.py
rest_framework.negotiation.DefaultContentNegotiation.filter_renderers
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE djangorestframework/rest_framework/utils/mediatypes.py class _MediaType: def __init__(self, media_type_str): self.orig = '' if (media_type_str is None) else media_type_str self.full_type, self....
djangorestframework/rest_framework/negotiation.py
rest_framework.templatetags.rest_framework.as_string
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE djangorestframework/rest_framework/templatetags/rest_framework.py def format_value(value): if getattr(value, 'is_hyperlink', False): name = str(value.obj) return mark_safe('<a href=%s>%s</a>' %...
djangorestframework/rest_framework/templatetags/rest_framework.py
rest_framework.templatetags.rest_framework.add_nested_class
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE djangorestframework/rest_framework/templatetags/rest_framework.py def items(value): """ Simple filter to return the items of the dict. Useful when the dict may have a key 'items' which is resolved firs...
djangorestframework/rest_framework/templatetags/rest_framework.py
pyramid.session.PickleSerializer.loads
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE pyramid/src/pyramid/interfaces.py class ISession(IDict): """An interface representing a session (a web session object, usually accessed via ``request.session``. Keys and values of a session must be JS...
pyramid/src/pyramid/session.py
pyramid.testing.DummySession.flash
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE pyramid/src/pyramid/interfaces.py class ISession(IDict): """An interface representing a session (a web session object, usually accessed via ``request.session``. Keys and values of a session must be JS...
pyramid/src/pyramid/testing.py
pyramid.testing.DummySession.pop_flash
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE pyramid/src/pyramid/interfaces.py class ISession(IDict): """An interface representing a session (a web session object, usually accessed via ``request.session``. Keys and values of a session must be JS...
pyramid/src/pyramid/testing.py
pyramid.testing.DummySession.peek_flash
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE pyramid/src/pyramid/testing.py class DummySecurityPolicy: """A standin for a :term:`security policy`.""" def __init__( self, userid=None, identity=None, permissive=True, ...
pyramid/src/pyramid/testing.py
pyramid.testing.DummySession.new_csrf_token
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE pyramid/src/pyramid/interfaces.py class ISession(IDict): """An interface representing a session (a web session object, usually accessed via ``request.session``. Keys and values of a session must be JS...
pyramid/src/pyramid/testing.py
pyramid.view.view_defaults
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE pyramid/src/pyramid/view.py class notfound_view_config: """ .. versionadded:: 1.3 An analogue of :class:`pyramid.view.view_config` which registers a :term:`Not Found View` using :meth:`pyramid...
pyramid/src/pyramid/view.py
pyramid.util.bytes_
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE pyramid/src/pyramid/util.py def get_callable_name(name): """ Verifies that the ``name`` is ascii and will raise a ``ConfigurationError`` if it is not. """ try: return ascii_(name) e...
pyramid/src/pyramid/util.py
pyramid.scripts.common.parse_vars
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: pyramid/src/pyramid/scripts/common.py import plaster def parse_vars(args): """ Given variables like ``['a=b', 'c=d']`` turns it into...
pyramid/src/pyramid/scripts/common.py
pyramid.scripts.pviews.PViewsCommand._find_multi_routes
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE pyramid/src/pyramid/traversal.py class ResourceTreeTraverser: """A resource tree traverser that should be used (for speed) when every resource in the tree supplies a ``__name__`` and ``__parent__`` att...
pyramid/src/pyramid/scripts/pviews.py
pyramid.scripts.pserve.PServeCommand.guess_server_url
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE pyramid/src/pyramid/scripts/pserve.py def cherrypy_server_runner( app, global_conf=None, host='127.0.0.1', port=None, ssl_pem=None, protocol_version=None, numthreads=None, server_na...
pyramid/src/pyramid/scripts/pserve.py
aiohappybase._util.pep8_to_camel_case
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE happybase/aiohappybase/_util.py def thrift_type_to_dict(obj: Any) -> Dict[bytes, Any]: """Convert a Thrift data type to a regular dictionary.""" return { camel_case_to_pep8(attr): getattr(obj, attr...
happybase/aiohappybase/_util.py
aiohappybase._util.bytes_increment
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: happybase/aiohappybase/_util.py import re from typing import Dict, List, Any, AnyStr, Optional, TypeVar, Callable def bytes_increment(b: byt...
happybase/aiohappybase/_util.py
mssqlcli.config.ensure_dir_exists
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: mssql-cli/mssqlcli/config.py import os from os.path import expanduser, exists, dirname import shutil import platform from configobj import Co...
mssql-cli/mssqlcli/config.py
mssqlcli.telemetry._user_id_file_is_old
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE mssql-cli/mssqlcli/telemetry.py def start(): _session.start_time = datetime.now() # LIB future class datetime(date): """datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]]) ...
mssql-cli/mssqlcli/telemetry.py
mssqlcli.util.is_command_valid
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE mssql-cli/mssqlcli/util.py def encode(s): try: return s.encode('utf-8') except (AttributeError, SyntaxError): pass return s Based on the information above, please complete the function...
mssql-cli/mssqlcli/util.py
mssqlcli.packages.parseutils.utils.find_prev_keyword
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE mssql-cli/mssqlcli/packages/parseutils/utils.py def last_word(text, include='alphanum_underscore'): r""" Find the last word in a sentence. >>> last_word('abc') 'abc' >>> last_word(' abc') ...
mssql-cli/mssqlcli/packages/parseutils/utils.py
pyramid.util.text_
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE pyramid/src/pyramid/util.py def get_callable_name(name): """ Verifies that the ``name`` is ascii and will raise a ``ConfigurationError`` if it is not. """ try: return ascii_(name) e...
pyramid/src/pyramid/util.py
datasette.filters.where_filters
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE datasette/datasette/filters.py def search_filters(request, database, table, datasette): # ?_search= and _search_colname= async def inner(): where_clauses = [] params = {} human_desc...
datasette/datasette/filters.py
datasette.utils.path_with_added_args
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: datasette/datasette/utils/__init__.py import asyncio from contextlib import contextmanager import click from collections import OrderedDict, ...
datasette/datasette/utils/__init__.py
datasette.utils.path_with_replaced_args
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: datasette/datasette/utils/__init__.py import asyncio from contextlib import contextmanager import click from collections import OrderedDict, ...
datasette/datasette/utils/__init__.py
datasette.utils.format_bytes
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: datasette/datasette/utils/__init__.py import asyncio from contextlib import contextmanager import click from collections import OrderedDict, ...
datasette/datasette/utils/__init__.py
datasette.utils.actor_matches_allow
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE datasette/datasette/utils/__init__.py def display_actor(actor): for key in ("display", "name", "username", "login", "id"): if actor.get(key): return actor[key] return str(actor) # FILE...
datasette/datasette/utils/__init__.py
datasette.utils.resolve_env_secrets
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE datasette/datasette/utils/__init__.py class CustomJSONEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, sqlite3.Row): return tuple(obj) if isinstance(obj, sqlite...
datasette/datasette/utils/__init__.py
datasette.utils.display_actor
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE datasette/datasette/utils/__init__.py class MultiParams: def __init__(self, data): # data is a dictionary of key => [list, of, values] or a list of [["key", "value"]] pairs if isinstance(data, ...
datasette/datasette/utils/__init__.py
datasette.utils.initial_path_for_datasette
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE datasette/datasette/utils/__init__.py class MultiParams: def __init__(self, data): # data is a dictionary of key => [list, of, values] or a list of [["key", "value"]] pairs if isinstance(data, ...
datasette/datasette/utils/__init__.py
datasette.utils.tilde_decode
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE datasette/datasette/utils/__init__.py def path_from_row_pks(row, pks, use_rowid, quote=True): """Generate an optionally tilde-encoded unique identifier for a row from its primary keys.""" if use_rowid:...
datasette/datasette/utils/__init__.py
datasette.utils.resolve_routes
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: datasette/datasette/utils/__init__.py import asyncio from contextlib import contextmanager import click from collections import OrderedDict, ...
datasette/datasette/utils/__init__.py
datasette.utils.truncate_url
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE datasette/datasette/utils/__init__.py def is_url(value): """Must start with http:// or https:// and contain JUST a URL""" if not isinstance(value, str): return False if not value.startswith("ht...
datasette/datasette/utils/__init__.py
kinto.core.authorization.groupfinder
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE kinto/kinto/core/authorization.py class AuthorizationPolicy: """Default authorization class, that leverages the permission backend for shareable resources. """ def permits(self, context, principals...
kinto/kinto/core/authorization.py
kinto.core.utils.json.dumps
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE kinto/kinto/core/utils.py def read_env(key, value): """Read the setting key from environment variables. :param key: the setting name :param value: default value if undefined in environment :return...
kinto/kinto/core/utils.py
kinto.core.utils.json.loads
You are a Python programmer. Here is all the context you may find useful to complete the function: # LIB jsonpatch.py class PatchOperation(object): """A single operation inside a JSON Patch.""" def __init__(self, operation, pointer_cls=JsonPointer): self.pointer_cls = pointer_cls if not operat...
kinto/kinto/core/utils.py
kinto.core.utils.hmac_digest
You are a Python programmer. Here is all the context you may find useful to complete the function: # LIB jsonpatch.py class PatchOperation(object): """A single operation inside a JSON Patch.""" def __init__(self, operation, pointer_cls=JsonPointer): self.pointer_cls = pointer_cls if not operat...
kinto/kinto/core/utils.py
kinto.core.utils.current_service
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE kinto/kinto/core/utils.py def build_request(original, dict_obj): """ Transform a dict object into a :class:`pyramid.request.Request` object. It sets a ``parent`` attribute on the resulting request ass...
kinto/kinto/core/utils.py
kinto.core.utils.prefixed_principals
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE kinto/kinto/core/utils.py def prefixed_userid(request): """In Kinto users ids are prefixed with the policy name that is contained in Pyramid Multiauth. If a custom authn policy is used, without authn_t...
kinto/kinto/core/utils.py
kinto.plugins.accounts.views.on_account_created
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE kinto/kinto/plugins/accounts/views/__init__.py def process_object(self, new, old=None): new = super(Account, self).process_object(new, old) if "data" in self.request.json and "password" in self.re...
kinto/kinto/plugins/accounts/views/__init__.py
kinto.plugins.accounts.utils.hash_password
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: kinto/kinto/plugins/accounts/utils.py import bcrypt from kinto.core import utils def hash_password(password): # Store password safely in...
kinto/kinto/plugins/accounts/utils.py
kinto.views.admin.get_parent_uri
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: kinto/kinto/views/admin.py import collections import itertools import colander from kinto.authorization import RouteFactory from kinto.core i...
kinto/kinto/views/admin.py
alembic.script.write_hooks.register
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: alembic/alembic/script/write_hooks.py from __future__ import annotations import shlex import subprocess import sys from typing import Any fro...
alembic/alembic/script/write_hooks.py
mongo_connector.namespace_config.match_replace_regex
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE mongo-doc-manager/mongo_connector/namespace_config.py def from_namespaces(namespaces): regexes = set() strings = set() for ns in namespaces: if "*" in ns: regexe...
mongo-doc-manager/mongo_connector/namespace_config.py
mongo_connector.namespace_config.namespace_to_regex
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE mongo-doc-manager/mongo_connector/namespace_config.py def lookup(self, plain_src_ns): """Given a plain source namespace, return the corresponding Namespace object, or None if it is not included. ...
mongo-doc-manager/mongo_connector/namespace_config.py
mongo_connector.util.long_to_bson_ts
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE mongo-doc-manager/mongo_connector/util.py def bson_ts_to_long(timestamp): """Convert BSON timestamp into integer. Conversion rule is based from the specs (http://bsonspec.org/#/specification). """...
mongo-doc-manager/mongo_connector/util.py
mongo_connector.doc_managers.formatters.DocumentFlattener.format_document
You are a Python programmer. Here is all the context you may find useful to complete the function: # LIB bson def loads(s: Union[str, bytes, bytearray], *args: Any, **kwargs: Any) -> Any: """Helper function that wraps :func:`json.loads`. Automatically passes the object_hook for BSON type conversion. Rais...
mongo-doc-manager/mongo_connector/doc_managers/formatters.py
bplustree.memory.open_file_in_dir
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: bplustree/bplustree/memory.py import enum import io from logging import getLogger import os import platform from typing import Union, Tuple, ...
bplustree/bplustree/memory.py
bplustree.memory.FileMemory.read_transaction
You are a Python programmer. Here is all the context you may find useful to complete the function: # FILE bplustree/bplustree/memory.py class WAL: def __init__(self, filename: str, page_size: int): self.filename = filename + '-wal' self._fd, self._dir_fd = open_file_in_dir(self.filename) se...
bplustree/bplustree/memory.py
bplustree.utils.pairwise
You are a Python programmer. Here is all the context you may find useful to complete the function: Based on the information above, please complete the function: #CURRENT_FILE: bplustree/bplustree/utils.py import itertools from typing import Iterable def pairwise(iterable: Iterable): """Iterate over elements two...
bplustree/bplustree/utils.py