language
stringclasses
1 value
repo
stringclasses
346 values
path
stringlengths
6
201
class_span
dict
source
stringlengths
21
2.38M
target
stringlengths
1
96
python
google__pytype
pytype_extensions/test_pytype_extensions.py
{ "start": 5173, "end": 5654 }
class ____(test_base.BaseTest): _PYI_DEP = None @classmethod def setUpClass(cls): super().setUpClass() deps = [('foo.pyi', cls._PYI_DEP)] cls.Check = _WrapWithDeps(cls.Check, deps) cls.CheckWithErrors = _WrapWithDeps(cls.CheckWithErrors, deps) cls.Infer = _WrapWithDeps(cls.Infer, deps) c...
PyiCodeTest
python
kamyu104__LeetCode-Solutions
Python/search-suggestions-system.py
{ "start": 711, "end": 1508 }
class ____(object): def suggestedProducts(self, products, searchWord): """ :type products: List[str] :type searchWord: str :rtype: List[List[str]] """ trie = TrieNode() for i in xrange(len(products)): trie.insert(products, i) result = [[] f...
Solution
python
jschneier__django-storages
storages/backends/s3.py
{ "start": 10881, "end": 26761 }
class ____(CompressStorageMixin, BaseStorage): """ Amazon Simple Storage Service using Boto3 This storage backend supports opening files in read or write mode and supports streaming(buffering) data in chunks to S3 when writing. """ default_content_type = "application/octet-stream" # If...
S3Storage
python
Netflix__metaflow
metaflow/plugins/argo/argo_workflows.py
{ "start": 197607, "end": 198942 }
class ____(object): # https://argoproj.github.io/argo-workflows/fields/#metadata def __init__(self): tree = lambda: defaultdict(tree) self.payload = tree() def annotation(self, key, value): self.payload["annotations"][key] = str(value) return self def annotations(self,...
Metadata
python
ansible__ansible
lib/ansible/executor/module_common.py
{ "start": 24659, "end": 28282 }
class ____(ModuleUtilLocatorBase): def __init__(self, fq_name_parts, is_ambiguous=False, child_is_redirected=False, is_optional=False): super(CollectionModuleUtilLocator, self).__init__(fq_name_parts, is_ambiguous, child_is_redirected, is_optional) if fq_name_parts[0] != 'ansible_collections': ...
CollectionModuleUtilLocator
python
jina-ai__jina
jina/clients/mixin.py
{ "start": 6886, "end": 7605 }
class ____: """The Profile Mixin for Client and Flow to expose `profile` API""" async def profiling(self, show_table: bool = True) -> Dict[str, float]: """Profiling a single query's roundtrip including network and computation latency. Results is summarized in a Dict. :param show_table: whether...
AsyncProfileMixin
python
huggingface__transformers
src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
{ "start": 96621, "end": 102290 }
class ____(SeamlessM4Tv2PreTrainedModel, GenerationMixin): _keys_to_ignore_on_load_missing = [ "vocoder", "speech_encoder", "text_encoder", "text_decoder", ] _tied_weights_keys = {"lm_head.weight": "model.decoder.embed_tokens.weight"} # Copied from transformers.models.se...
SeamlessM4Tv2TextToUnitForConditionalGeneration
python
aio-libs__aiohttp
aiohttp/web_exceptions.py
{ "start": 4762, "end": 4868 }
class ____(HTTPException): """Base class for exceptions with status codes in the 200s."""
HTTPSuccessful
python
google__pytype
pytype/overlays/named_tuple.py
{ "start": 19804, "end": 20276 }
class ____: """Construct dict abstract classes for namedtuple members.""" def __init__(self, ctx): self.ctx = ctx self.dict_cls = ctx.convert.lookup_value("builtins", "dict") def make(self, typ): # Normally, we would use abstract_utils.K and abstract_utils.V, but # collections.pyi doesn't confor...
_DictBuilder
python
weaviate__weaviate-python-client
weaviate/collections/batch/client.py
{ "start": 4419, "end": 8019 }
class ____(_BatchBaseNew): def add_object( self, collection: str, properties: Optional[WeaviateProperties] = None, references: Optional[ReferenceInputs] = None, uuid: Optional[UUID] = None, vector: Optional[VECTORS] = None, tenant: Optional[Union[str, Tenant]]...
_BatchClientNew
python
PyCQA__pylint
tests/functional/n/no/no_method_argument_py38.py
{ "start": 55, "end": 521 }
class ____: def __init__(self, obj, /): self.obj = obj # regression tests for no-method-argument getting reported # instead of no-self-argument def varargs(*args): """A method without a self argument but with *args.""" def kwargs(**kwargs): """A method without a self argume...
Cls
python
plotly__plotly.py
plotly/graph_objs/treemap/_hoverlabel.py
{ "start": 233, "end": 11241 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "treemap" _path_str = "treemap.hoverlabel" _valid_props = { "align", "alignsrc", "bgcolor", "bgcolorsrc", "bordercolor", "bordercolorsrc", "font", "namelength", "namelengthsrc", ...
Hoverlabel
python
scrapy__scrapy
scrapy/core/downloader/handlers/http11.py
{ "start": 1869, "end": 2119 }
class ____(TypedDict): txresponse: TxResponse body: bytes flags: list[str] | None certificate: ssl.Certificate | None ip_address: ipaddress.IPv4Address | ipaddress.IPv6Address | None failure: NotRequired[Failure | None]
_ResultT
python
rapidsai__cudf
python/cudf/cudf/core/udf/strings_typing.py
{ "start": 6423, "end": 6599 }
class ____(AbstractTemplate): key = "StringView.count" def generic(self, args, kws): return nb_signature(size_type, string_view, recvr=self.this)
StringViewCount
python
crytic__slither
slither/core/solidity_types/type_alias.py
{ "start": 1168, "end": 1550 }
class ____(TypeAlias, TopLevel): def __init__(self, underlying_type: ElementaryType, name: str, scope: "FileScope") -> None: super().__init__(underlying_type, name) self.file_scope: "FileScope" = scope # operators redefined self.operators: Dict[str, "FunctionTopLevel"] = {} def ...
TypeAliasTopLevel
python
pandas-dev__pandas
asv_bench/benchmarks/indexing.py
{ "start": 5759, "end": 6971 }
class ____: params = [ (np.int64, np.uint64, np.float64), ("unique_monotonic_inc", "nonunique_monotonic_inc"), ] param_names = ["dtype", "index_structure"] def setup(self, dtype, index_structure): N = 10**5 indices = { "unique_monotonic_inc": Index(range(N), ...
DataFrameNumericIndexing
python
getsentry__sentry
src/sentry/sentry_metrics/indexer/base.py
{ "start": 653, "end": 806 }
class ____(NamedTuple): is_global: bool OrgId = int KR = TypeVar("KR", bound="KeyResult") UR = TypeVar("UR", bound="UseCaseKeyResult")
FetchTypeExt
python
dagster-io__dagster
python_modules/dagster/dagster/_core/snap/mode.py
{ "start": 2766, "end": 3868 }
class ____( NamedTuple( "_ResourceDefSnap", [ ("name", str), ("description", Optional[str]), ("config_field_snap", Optional[ConfigFieldSnap]), ], ) ): def __new__( cls, name: str, description: Optional[str], config_field_snap: Optional[Conf...
ResourceDefSnap
python
pytorch__pytorch
test/test_serialization.py
{ "start": 3614, "end": 3664 }
class ____: class Nested: pass
ClassAMock
python
aimacode__aima-python
agents.py
{ "start": 27709, "end": 27838 }
class ____(Thing): def __eq__(self, rhs): """All Gold are equal""" return rhs.__class__ == Gold pass
Gold
python
pennersr__django-allauth
allauth/idp/oidc/views.py
{ "start": 4284, "end": 9885 }
class ____(FormView): form_class = AuthorizationForm template_name = "idp/oidc/authorization_form." + account_settings.TEMPLATE_EXTENSION def get(self, request, *args, **kwargs): response = self._login_required(request) if response: return response orequest = extract_par...
AuthorizationView
python
chroma-core__chroma
chromadb/utils/embedding_functions/voyageai_embedding_function.py
{ "start": 249, "end": 4884 }
class ____(EmbeddingFunction[Documents]): """ This class is used to generate embeddings for a list of texts using the VoyageAI API. """ def __init__( self, api_key: Optional[str] = None, model_name: str = "voyage-large-2", api_key_env_var: str = "CHROMA_VOYAGE_API_KEY", ...
VoyageAIEmbeddingFunction
python
sphinx-doc__sphinx
sphinx/config.py
{ "start": 6204, "end": 34643 }
class ____: r"""Configuration file abstraction. The Config object makes the values of all config options available as attributes. It is exposed via the :py:class:`~sphinx.application.Sphinx`\ ``.config`` and :py:class:`sphinx.environment.BuildEnvironment`\ ``.config`` attributes. For example, ...
Config
python
pypa__virtualenv
tasks/make_zipapp.py
{ "start": 3473, "end": 11545 }
class ____: def __init__(self, into) -> None: if into.exists(): shutil.rmtree(into) into.mkdir(parents=True) self.into = into self.collected = defaultdict(lambda: defaultdict(dict)) self.pip_cmd = [str(Path(sys.executable).parent / "pip")] self._cmd = [*se...
WheelDownloader
python
PrefectHQ__prefect
src/integrations/prefect-snowflake/prefect_snowflake/credentials.py
{ "start": 1193, "end": 15050 }
class ____(CredentialsBlock): """ Block used to manage authentication with Snowflake. Args: account (str): The snowflake account name. user (str): The user name used to authenticate. password (SecretStr): The password used to authenticate. private_key (SecretStr): The PEM us...
SnowflakeCredentials
python
pytorch__pytorch
torch/_inductor/codegen/triton.py
{ "start": 79143, "end": 220892 }
class ____(SIMDKernel[TritonCSEVariable]): """A class to represent a triton kernel and helpers to generate triton kernel programmatically """ overrides = TritonKernelOverrides # type: ignore[assignment] helper_functions: HelperFunctions kexpr: Callable[[sympy.Expr], str] = texpr allow_bloc...
TritonKernel
python
sympy__sympy
sympy/functions/combinatorial/numbers.py
{ "start": 10023, "end": 11534 }
class ____(DefinedFunction): """ Lucas numbers Lucas numbers satisfy a recurrence relation similar to that of the Fibonacci sequence, in which each term is the sum of the preceding two. They are generated by choosing the initial values `L_0 = 2` and `L_1 = 1`. * ``lucas(n)`` gives the `n^{...
lucas
python
walkccc__LeetCode
solutions/2513. Minimize the Maximum of Two Arrays/2513.py
{ "start": 0, "end": 755 }
class ____: def minimizeSet( self, divisor1: int, divisor2: int, uniqueCnt1: int, uniqueCnt2: int, ) -> int: divisorLcm = math.lcm(divisor1, divisor2) l = 0 r = 2**31 - 1 def isPossible(m: int) -> bool: """ Returns True if we can take uniqueCnt1 integers fr...
Solution
python
doocs__leetcode
solution/0200-0299/0275.H-Index II/Solution.py
{ "start": 0, "end": 330 }
class ____: def hIndex(self, citations: List[int]) -> int: n = len(citations) left, right = 0, n while left < right: mid = (left + right + 1) >> 1 if citations[n - mid] >= mid: left = mid else: right = mid - 1 return...
Solution
python
kamyu104__LeetCode-Solutions
Python/subarrays-distinct-element-sum-of-squares-i.py
{ "start": 6289, "end": 6680 }
class ____(object): def sumCounts(self, nums): """ :type nums: List[int] :rtype: int """ MOD = 10**9+7 result = 0 for i in xrange(len(nums)): lookup = set() for j in reversed(xrange(i+1)): lookup.add(nums[j]) ...
Solution3
python
marshmallow-code__marshmallow
src/marshmallow/validate.py
{ "start": 15054, "end": 15933 }
class ____(Validator): """Validator which succeeds if the ``value`` passed to it is equal to ``comparable``. :param comparable: The object to compare to. :param error: Error message to raise in case of a validation error. Can be interpolated with `{input}` and `{other}`. """ default_me...
Equal
python
google__pytype
pytype/tests/test_typevar2.py
{ "start": 28505, "end": 31992 }
class ____(test_base.BaseTest): """Tests for TypeVar in Python 3.""" def test_use_constraints_from_pyi(self): with test_utils.Tempdir() as d: d.create_file( "foo.pyi", """ from typing import AnyStr, TypeVar T = TypeVar("T", int, float) def f(x: T) -> T: ... ...
TypeVarTestPy3
python
keras-team__keras
keras/src/layers/core/wrapper_test.py
{ "start": 290, "end": 2589 }
class ____(testing.TestCase): @pytest.mark.requires_trainable_backend def test_wrapper_basics(self): self.run_layer_test( ExampleWrapper, init_kwargs={ "layer": layers.Dense(2), }, input_shape=(2, 3), expected_output_shape=(2, 2...
WrapperTest
python
pytorch__pytorch
torch/_inductor/runtime/triton_heuristics.py
{ "start": 143860, "end": 144510 }
class ____(ComboKernelGrid): def combo_x_grid( self, xnumels: list[int | str], no_x_dims: list[bool], meta: dict[str, int], ) -> str: assert len(xnumels) == len(no_x_dims) num_kernels = self.inductor_meta["combo_grid_meta"]["num_kernels"] exprs = [x for x,...
RoundRobinComboKernelGrid
python
urllib3__urllib3
test/test_response.py
{ "start": 4594, "end": 53630 }
class ____: def test_cache_content(self) -> None: r = HTTPResponse(b"foo") assert r._body == b"foo" assert r.data == b"foo" assert r._body == b"foo" def test_cache_content_preload_false(self) -> None: fp = BytesIO(b"foo") r = HTTPResponse(fp, preload_content=Fals...
TestResponse
python
PyCQA__pylint
tests/functional/t/too/too_few_public_methods_excluded.py
{ "start": 161, "end": 336 }
class ____(Control): """This class inherits from a class that doesn't have enough methods, and its parent is excluded via config, so it doesn't raise."""
InheritedInModule
python
modin-project__modin
modin/experimental/core/io/sql/utils.py
{ "start": 7413, "end": 7526 }
class ____(Exception): """Exception that should be raised if invalid query statement was found."""
InvalidQuery
python
fastapi__sqlmodel
docs_src/tutorial/fastapi/relationships/tutorial001.py
{ "start": 1256, "end": 1334 }
class ____(HeroPublic): team: Optional[TeamPublic] = None
HeroPublicWithTeam
python
kamyu104__LeetCode-Solutions
Python/count-beautiful-substrings-i.py
{ "start": 976, "end": 1486 }
class ____(object): def beautifulSubstrings(self, s, k): """ :type s: str :type k: int :rtype: int """ VOWELS = set("aeiou") result = 0 for i in xrange(len(s)): c = v = 0 for j in xrange(i, len(s)): if s[j] in VO...
Solution2
python
matplotlib__matplotlib
lib/mpl_toolkits/mplot3d/art3d.py
{ "start": 2620, "end": 6591 }
class ____(mtext.Text): """ Text object with 3D position and direction. Parameters ---------- x, y, z : float The position of the text. text : str The text string to display. zdir : {'x', 'y', 'z', None, 3-tuple} The direction of the text. See `.get_dir_vector` for a...
Text3D
python
kubernetes-client__python
kubernetes/client/models/events_v1_event_series.py
{ "start": 383, "end": 5001 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
EventsV1EventSeries
python
huggingface__transformers
tests/models/beit/test_modeling_beit.py
{ "start": 14802, "end": 21417 }
class ____(unittest.TestCase): @cached_property def default_image_processor(self): return BeitImageProcessor.from_pretrained("microsoft/beit-base-patch16-224") if is_vision_available() else None @slow def test_inference_masked_image_modeling_head(self): model = BeitForMaskedImageModelin...
BeitModelIntegrationTest
python
getsentry__sentry
tests/sentry/newsletter/test_base.py
{ "start": 190, "end": 1124 }
class ____(TestCase): def test_defaults(self) -> None: assert newsletter.DEFAULT_LISTS == newsletter.get_default_list_ids() assert newsletter.DEFAULT_LIST_ID == newsletter.get_default_list_id() def test_update_subscription(self) -> None: user = self.create_user("subscriber@example.com")...
BaseNewsletterTest
python
python-openxml__python-docx
src/docx/image/exceptions.py
{ "start": 162, "end": 281 }
class ____(Exception): """EOF was unexpectedly encountered while reading an image stream."""
UnexpectedEndOfFileError
python
realpython__materials
hashtable/06_insertion_order/hashtable.py
{ "start": 137, "end": 3454 }
class ____: @classmethod def from_dict(cls, dictionary, capacity=None): hash_table = cls(capacity or len(dictionary)) for key, value in dictionary.items(): hash_table[key] = value return hash_table def __init__(self, capacity=8, load_factor_threshold=0.6): if cap...
HashTable
python
scrapy__scrapy
tests/test_cmdline_crawl_with_pipeline/__init__.py
{ "start": 117, "end": 956 }
class ____: def _execute(self, spname): args = (sys.executable, "-m", "scrapy.cmdline", "crawl", spname) cwd = Path(__file__).resolve().parent proc = Popen(args, stdout=PIPE, stderr=PIPE, cwd=cwd) _, stderr = proc.communicate() return proc.returncode, stderr def test_ope...
TestCmdlineCrawlPipeline
python
getsentry__sentry
tests/sentry/notifications/api/endpoints/test_user_notification_details.py
{ "start": 101, "end": 286 }
class ____(APITestCase): endpoint = "sentry-api-0-user-notifications" def setUp(self) -> None: self.login_as(self.user) @control_silo_test
UserNotificationDetailsTestBase
python
pyqtgraph__pyqtgraph
pyqtgraph/graphicsItems/ErrorBarItem.py
{ "start": 157, "end": 5472 }
class ____(GraphicsObject): def __init__(self, **opts): """ All keyword arguments are passed to setData(). """ GraphicsObject.__init__(self) self.opts = dict( x=None, y=None, height=None, width=None, top=None, ...
ErrorBarItem
python
google__jax
tests/lax_test.py
{ "start": 163874, "end": 164537 }
class ____: # handlers @staticmethod def physical_element_aval(dtype) -> core.ShapedArray: return core.ShapedArray((2,), jnp.dtype('uint32')) @staticmethod def result_handler(sticky_device, aval): def handler(_, buf): buf.aval = core.ShapedArray(buf.shape, buf.dtype) return FooArray(aval...
FooTyRules
python
facelessuser__pymdown-extensions
tools/collapse_code.py
{ "start": 2620, "end": 3436 }
class ____(BlocksExtension): """Admonition Blocks Extension.""" def __init__(self, *args, **kwargs): """Initialize.""" self.config = { 'expand_text': ['Expand', "Set the text for the expand button."], 'collapse_text': ['Collapse', "Set the text for the collapse button."...
CollapseCodeExtension
python
django__django
tests/schema/models.py
{ "start": 1747, "end": 2034 }
class ____(models.Model): author = models.ForeignKey(Author, models.CASCADE) title = models.CharField(max_length=100, db_index=True) pub_date = models.DateTimeField() # tags = models.ManyToManyField("Tag", related_name="books") class Meta: apps = new_apps
Book
python
gevent__gevent
src/greentest/3.10/test_signal.py
{ "start": 4190, "end": 6238 }
class ____(unittest.TestCase): def test_valid_signals(self): s = signal.valid_signals() self.assertIsInstance(s, set) self.assertGreaterEqual(len(s), 6) self.assertIn(signal.Signals.SIGINT, s) self.assertNotIn(0, s) self.assertNotIn(signal.NSIG, s) self.asser...
WindowsSignalTests
python
pyinstaller__pyinstaller
bootloader/waflib/Tools/c.py
{ "start": 1184, "end": 1220 }
class ____(stlink_task): pass
cstlib
python
kamyu104__LeetCode-Solutions
Python/maximize-sum-of-at-most-k-distinct-elements.py
{ "start": 61, "end": 329 }
class ____(object): def maxKDistinct(self, nums, k): """ :type nums: List[int] :type k: int :rtype: List[int] """ return heapq.nlargest(k, set(nums)) # Time: O(nlogk) # Space: O(k) import heapq # heap, sort
Solution
python
Textualize__rich
rich/markdown.py
{ "start": 10766, "end": 12448 }
class ____(TextElement): """An item in a list.""" style_name = "markdown.item" def __init__(self) -> None: self.elements: Renderables = Renderables() def on_child_close(self, context: MarkdownContext, child: MarkdownElement) -> bool: self.elements.append(child) return False ...
ListItem
python
run-llama__llama_index
llama-index-core/llama_index/core/evaluation/retrieval/metrics.py
{ "start": 14877, "end": 17593 }
class ____(BaseRetrievalMetric): """Cohere rerank relevancy metric.""" metric_name: ClassVar[str] = "cohere_rerank_relevancy" model: str = Field(description="Cohere model name.") _client: Any = PrivateAttr() def __init__( self, model: str = "rerank-english-v2.0", api_key: ...
CohereRerankRelevancyMetric
python
ray-project__ray
python/ray/data/_internal/datasource/csv_datasource.py
{ "start": 225, "end": 2778 }
class ____(FileBasedDatasource): """CSV datasource, for reading and writing CSV files.""" _FILE_EXTENSIONS = [ "csv", "csv.gz", # gzip-compressed files "csv.br", # Brotli-compressed files "csv.zst", # Zstandard-compressed files "csv.lz4", # lz4-compressed files ]...
CSVDatasource
python
pypa__pipenv
pipenv/vendor/click/core.py
{ "start": 4897, "end": 31503 }
class ____: """The context is a special internal object that holds state relevant for the script execution at every single level. It's normally invisible to commands unless they opt-in to getting access to it. The context is useful as it can pass internal objects around and can control special exe...
Context
python
skorch-dev__skorch
examples/word_language_model/model.py
{ "start": 59, "end": 2560 }
class ____(nn.Module): """Container module with an encoder, a recurrent module, and a decoder.""" def __init__(self, rnn_type, ntoken, ninp, nhid, nlayers, dropout=0.5, tie_weights=False): super(RNNModel, self).__init__() self.drop = nn.Dropout(dropout) self.encoder = nn.Embedding(ntoke...
RNNModel
python
huggingface__transformers
src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py
{ "start": 29675, "end": 38277 }
class ____(Qwen2VLForConditionalGeneration): # Reference: fix gemma3 grad acc #37208 accepts_loss_kwargs = False def forward( self, input_ids: Optional[torch.LongTensor] = None, attention_mask: Optional[torch.Tensor] = None, position_ids: Optional[torch.LongTensor] = None, ...
Qwen2_5_VLForConditionalGeneration
python
numpy__numpy
numpy/f2py/symbolic.py
{ "start": 2830, "end": 3397 }
class ____(Enum): """ Used as Expr.tostring precedence argument. """ ATOM = 0 POWER = 1 UNARY = 2 PRODUCT = 3 SUM = 4 LT = 6 EQ = 7 LAND = 11 LOR = 12 TERNARY = 13 ASSIGN = 14 TUPLE = 15 NONE = 100 integer_types = (int,) number_types = (int, float) def...
Precedence
python
oauthlib__oauthlib
tests/test_common.py
{ "start": 1920, "end": 3070 }
class ____(TestCase): def test_extract_params_dict(self): self.assertCountEqual(extract_params(PARAMS_DICT), PARAMS_TWOTUPLE) def test_extract_params_twotuple(self): self.assertCountEqual(extract_params(PARAMS_TWOTUPLE), PARAMS_TWOTUPLE) def test_extract_params_formencoded(self): ...
ParameterTest
python
pandas-dev__pandas
pandas/tests/series/test_formats.py
{ "start": 264, "end": 8878 }
class ____: def test_multilevel_name_print_0(self): # GH#55415 None does not get printed, but 0 does # (matching DataFrame and flat index behavior) mi = pd.MultiIndex.from_product([range(2, 3), range(3, 4)], names=[0, None]) ser = Series(1.5, index=mi) res = repr(ser) ...
TestSeriesRepr
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-text-embeddings-inference/llama_index/embeddings/text_embeddings_inference/base.py
{ "start": 413, "end": 5361 }
class ____(BaseEmbedding): base_url: str = Field( default=DEFAULT_URL, description="Base URL for the text embeddings service.", ) query_instruction: Optional[str] = Field( description="Instruction to prepend to query text." ) text_instruction: Optional[str] = Field( d...
TextEmbeddingsInference
python
huggingface__transformers
src/transformers/models/splinter/modeling_splinter.py
{ "start": 20003, "end": 25340 }
class ____(SplinterPreTrainedModel): def __init__(self, config): super().__init__(config) self.splinter = SplinterModel(config) self.splinter_qass = QuestionAwareSpanSelectionHead(config) self.question_token_id = config.question_token_id # Initialize weights and apply final...
SplinterForQuestionAnswering
python
tensorflow__tensorflow
tensorflow/python/eager/core.py
{ "start": 2258, "end": 2744 }
class ____(Exception): """Exception class to handle use of symbolic tensors when executing eagerly. `keras.Input()` creates symbolic tensors (in a FuncGraph managed by the Keras backend) while in eager execution. This exception is used to identify this case (raised in `convert_to_tensor` cause generated functi...
_SymbolicException
python
django__django
tests/indexes/models.py
{ "start": 1563, "end": 1678 }
class ____(models.Model): headline = models.CharField(max_length=100) body = models.TextField()
IndexedArticle2
python
keras-team__keras
keras/src/metrics/correlation_metrics_test.py
{ "start": 237, "end": 3234 }
class ____(testing.TestCase): def _get_data(self): # Sample data for testing y_true = np.array( [[0, 1, 0.5], [1, 1, 0.2], [1, 1, 0.1], [0.1, 0.7, 0.0]], dtype="float32", ) y_pred = np.array( [[0.1, 0.9, 0.5], [1, 0.9, 0.2], [0.2, 0.8, 0], [0.3, 0....
CorrelationsTest
python
getsentry__sentry
src/sentry/lang/native/symbolicator.py
{ "start": 1146, "end": 1586 }
class ____(Enum): """The order in which stack frames are sent to and returned from Symbolicator.""" # Caller frames come before callee frames. This is the # order in which stack frames are stored in events. caller_first = "caller_first" # Callee frames come before caller frames. This is the ...
FrameOrder
python
PyCQA__isort
isort/exceptions.py
{ "start": 6217, "end": 6498 }
class ____(ISortError): """Raised when isort encounters an encoding error while trying to read a file""" def __init__(self, filename: str | Path): super().__init__(f"Unknown or unsupported encoding in {filename}") self.filename = filename
UnsupportedEncoding
python
pypa__pip
src/pip/_vendor/urllib3/util/queue.py
{ "start": 228, "end": 498 }
class ____(queue.Queue): def _init(self, _): self.queue = collections.deque() def _qsize(self, len=len): return len(self.queue) def _put(self, item): self.queue.append(item) def _get(self): return self.queue.pop()
LifoQueue
python
plotly__plotly.py
plotly/graph_objs/layout/ternary/_baxis.py
{ "start": 235, "end": 53738 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.ternary" _path_str = "layout.ternary.baxis" _valid_props = { "color", "dtick", "exponentformat", "gridcolor", "griddash", "gridwidth", "hoverformat", "labelalias", "layer"...
Baxis
python
ray-project__ray
doc/source/custom_directives.py
{ "start": 14663, "end": 15079 }
class ____(ExampleEnum): RAY_TEAM = "Maintained by the Ray Team" COMMUNITY = "Contributed by the Ray Community" @property def tag(self): if self == Contributor.RAY_TEAM: return "ray-team" return "community" @classmethod def formatted_name(cls): return "All E...
Contributor
python
numpy__numpy
numpy/_core/tests/test_stringdtype.py
{ "start": 7880, "end": 50192 }
class ____: def test_unicode_casts(self, dtype, strings): arr = np.array(strings, dtype=np.str_).astype(dtype) expected = np.array(strings, dtype=dtype) assert_array_equal(arr, expected) arr_as_U8 = expected.astype("U8") assert_array_equal(arr_as_U8, np.array(strings, dtype=...
TestStringLikeCasts
python
PrefectHQ__prefect
tests/server/orchestration/api/ui/test_task_runs.py
{ "start": 10626, "end": 11821 }
class ____: async def test_read_task_run( self, flow_run: orm_models.FlowRun, task_run: orm_models.TaskRun, client: AsyncClient, ): response = await client.get(f"/ui/task_runs/{task_run.id}") assert response.status_code == status.HTTP_200_OK assert respons...
TestReadTaskRun
python
numba__numba
numba/cuda/tests/cudapy/test_record_dtype.py
{ "start": 9106, "end": 18769 }
class ____(CUDATestCase): # These tests mirror those from # numba.tests.test_record_dtype.TestNestedArrays added in PR # #7359: https://github.com/numba/numba/pull/7359 # The code cannot be shared between the two classes without modification, # as the CUDA test implementations need to be launched ...
TestNestedArrays
python
viewflow__viewflow
tests/workflow/test_fields__token.py
{ "start": 204, "end": 792 }
class ____(TestCase): # noqa: D101 def test_crud(self): obj = TokenTestModel.objects.create(token=Token('start')) self.assertEqual(obj.token, Token('start')) obj = TokenTestModel.objects.get() self.assertEqual(obj.token, Token('start')) obj = TokenTestModel.objects.filter(...
Test
python
airbytehq__airbyte
airbyte-integrations/connectors/source-zenloop/source_zenloop/source.py
{ "start": 346, "end": 469 }
class ____(YamlDeclarativeSource): def __init__(self): super().__init__(path_to_yaml="manifest.yaml")
SourceZenloop
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-wordlift/llama_index/vector_stores/wordlift/metadata_filters_to_filters.py
{ "start": 159, "end": 3298 }
class ____: @staticmethod def metadata_filters_to_filters(metadata_filters: MetadataFilters): # Return an empty list if there are no filters. if ( not hasattr(metadata_filters, "filters") or len(metadata_filters.filters) == 0 ): return [] # On...
MetadataFiltersToFilters
python
getsentry__sentry
src/sentry/integrations/source_code_management/metrics.py
{ "start": 1514, "end": 2362 }
class ____(IntegrationEventLifecycleMetric): """ An instance to be recorded of an SCM integration feature call. """ interaction_type: SCMIntegrationInteractionType provider_key: str integration_id: int | None = None organization_id: int | None = None def get_integration_domain(self) ->...
SCMIntegrationInteractionEvent
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 118561, "end": 118872 }
class ____(BaseModel): vector_data: Optional[Dict[str, "VectorDataConfig"]] = Field(default={}, description="") sparse_vector_data: Optional[Dict[str, "SparseVectorDataConfig"]] = Field(default=None, description="") payload_storage_type: "PayloadStorageType" = Field(..., description="")
SegmentConfig
python
sphinx-doc__sphinx
sphinx/domains/cpp/_ast.py
{ "start": 68295, "end": 69804 }
class ____(ASTBase): def __init__( self, arg: ASTTypeWithInit | ASTTemplateParamConstrainedTypeWithInit, ellipsis: bool = False, ) -> None: self.arg = arg self.ellipsis = ellipsis def __eq__(self, other: object) -> bool: if not isinstance(other, ASTFunctionPa...
ASTFunctionParameter
python
kamyu104__LeetCode-Solutions
Python/find-closest-number-to-zero.py
{ "start": 37, "end": 226 }
class ____(object): def findClosestNumber(self, nums): """ :type nums: List[int] :rtype: int """ return max(nums, key=lambda x:(-abs(x), x))
Solution
python
huggingface__transformers
src/transformers/models/sew/modular_sew.py
{ "start": 18218, "end": 18390 }
class ____(Wav2Vec2ForSequenceClassification): pass __all__ = ["SEWForCTC", "SEWForSequenceClassification", "SEWModel", "SEWPreTrainedModel"]
SEWForSequenceClassification
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/engine/result.py
{ "start": 28295, "end": 29128 }
class ____: __slots__ = () _metadata: ResultMetaData # used mainly to share documentation on the keys method. def keys(self) -> RMKeyView: """Return an iterable view which yields the string keys that would be represented by each :class:`_engine.Row`. The keys can represent the...
_WithKeys
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pie/PIE807.py
{ "start": 159, "end": 302 }
class ____(BaseTable): foo = fields.ListField(default=lambda: []) # PIE807 bar = fields.ListField(default=lambda: {}) # PIE807
FooTable
python
ray-project__ray
rllib/core/testing/testing_learner.py
{ "start": 1830, "end": 2464 }
class ____(Learner): @override(Learner) def after_gradient_based_update(self, *, timesteps): # This is to check if in the multi-gpu case, the weights across workers are # the same. It is really only needed during testing. if self.config.report_mean_weights: for module_id in s...
BaseTestingLearner
python
conda__conda
conda/auxlib/entity.py
{ "start": 23505, "end": 25516 }
class ____(type): @staticmethod def __get_entity_subclasses(bases): try: return [base for base in bases if issubclass(base, Entity) and base is not Entity] except NameError: # NameError: global name 'Entity' is not defined return () def __new__(mcs, name...
EntityType
python
spyder-ide__spyder
spyder/plugins/toolbar/container.py
{ "start": 1335, "end": 1593 }
class ____(QAction): """Wrapper class around QAction that allows to set/get an identifier.""" @property def action_id(self): return self._action_id @action_id.setter def action_id(self, act): self._action_id = act
QActionID
python
ray-project__ray
python/ray/_private/thirdparty/pynvml/pynvml.py
{ "start": 63380, "end": 63553 }
class ____(_PrintableStructure): _fields_ = [ ('version', c_uint), ('placementId', c_uint), ] VgpuPlacementId_v1 = 0x1000008
c_nvmlVgpuPlacementId_v1_t
python
readthedocs__readthedocs.org
readthedocs/config/models.py
{ "start": 789, "end": 864 }
class ____(ConfigBaseModel): version: str full_version: str
BuildTool
python
MongoEngine__mongoengine
mongoengine/fields.py
{ "start": 66448, "end": 69916 }
class ____(GridFSProxy): """Proxy for ImageField""" def put(self, file_obj, **kwargs): """ Insert a image in database applying field properties (size, thumbnail_size) """ field = self.instance._fields[self.key] # Handle nested fields if hasattr(field, "fi...
ImageGridFsProxy
python
getsentry__sentry
src/sentry/discover/endpoints/discover_key_transactions.py
{ "start": 964, "end": 1188 }
class ____(OrganizationPermission): scope_map = { "GET": ["org:read"], "POST": ["org:read"], "PUT": ["org:read"], "DELETE": ["org:read"], } @region_silo_endpoint
KeyTransactionPermission
python
airbytehq__airbyte
airbyte-integrations/connectors/source-outbrain-amplify/source_outbrain_amplify/source.py
{ "start": 47302, "end": 52141 }
class ____(AbstractSource): def check_connection(self, logger, config) -> Tuple[bool, any]: url_base = OutbrainAmplifyStream.url_base auth = OutbrainAmplifyAuthenticator(url_base=url_base, config=config) try: auth.get_auth_header() marketer_stream = Marketers(authenti...
SourceOutbrainAmplify
python
pennersr__django-allauth
allauth/idp/oidc/adapter.py
{ "start": 612, "end": 4548 }
class ____(BaseAdapter): """The adapter class allows you to override various functionality of the ``allauth.idp.oidc`` app. To do so, point ``settings.IDP_OIDC_ADAPTER`` to your own class that derives from ``DefaultOIDCAdapter`` and override the behavior by altering the implementation of the methods ac...
DefaultOIDCAdapter
python
sqlalchemy__sqlalchemy
test/ext/test_associationproxy.py
{ "start": 28915, "end": 29543 }
class ____(_CollectionOperations): collection_class = ObjectCollection def test_basic(self): Parent = self.classes.Parent self.session = fixture_session() p = Parent("p1") self.assert_(len(list(p.children)) == 0) p.children.append("child") self.assert_(len(lis...
CustomObjectTest
python
jina-ai__jina
tests/integration/docarray_v2/test_issues.py
{ "start": 295, "end": 347 }
class ____(BaseDoc): nested: Nested2Doc
Nested1Doc
python
conda__conda
conda/models/match_spec.py
{ "start": 34431, "end": 34778 }
class ____(_StrMatchMixin, MatchInterface): __slots__ = ("_raw_value",) def __init__(self, value): super().__init__(value) def match(self, other): try: _other_val = other._raw_value except AttributeError: _other_val = str(other) return self._raw_valu...
ExactStrMatch
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/clsregistry.py
{ "start": 12722, "end": 18274 }
class ____: __slots__ = ( "cls", "prop", "arg", "fallback", "_dict", "_resolvers", "tables_only", ) cls: Type[Any] prop: RelationshipProperty[Any] fallback: Mapping[str, Any] arg: str tables_only: bool _resolvers: Tuple[Callable[[s...
_class_resolver
python
django__django
tests/view_tests/tests/test_debug.py
{ "start": 83627, "end": 84993 }
class ____(SimpleTestCase): def test_sensitive_variables_not_called(self): msg = ( "sensitive_variables() must be called to use it as a decorator, " "e.g., use @sensitive_variables(), not @sensitive_variables." ) with self.assertRaisesMessage(TypeError, msg): ...
DecoratorsTests