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 | huggingface__transformers | src/transformers/models/granitemoe/configuration_granitemoe.py | {
"start": 1171,
"end": 9299
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`GraniteMoeModel`]. It is used to instantiate an GraniteMoe
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a simila... | GraniteMoeConfig |
python | ray-project__ray | rllib/examples/envs/classes/multi_agent/double_row_corridor_env.py | {
"start": 194,
"end": 4930
} | class ____(MultiAgentEnv):
"""A MultiAgentEnv with a single, global observation space for all agents.
There are two agents in this grid-world-style environment, `agent_0` and `agent_1`.
The grid has two-rows and multiple columns and agents must, each
separately, reach their individual goal position to ... | DoubleRowCorridorEnv |
python | readthedocs__readthedocs.org | readthedocs/proxito/constants.py | {
"start": 46,
"end": 274
} | class ____(Enum):
http_to_https = auto()
to_canonical_domain = auto()
subproject_to_main_domain = auto()
# Application defined redirect.
system = auto()
# User defined redirect.
user = auto()
| RedirectType |
python | PrefectHQ__prefect | tests/deployment/test_steps.py | {
"start": 8892,
"end": 24268
} | class ____:
@pytest.mark.usefixtures("clean_asserting_events_client")
async def test_run_steps_emits_pull_step_events(
self, monkeypatch: pytest.MonkeyPatch
):
from prefect.events.clients import AssertingEventsClient
flow_run_id = str(uuid.uuid4())
monkeypatch.setenv("PREFEC... | TestRunSteps |
python | huggingface__transformers | src/transformers/models/mgp_str/modeling_mgp_str.py | {
"start": 10519,
"end": 11759
} | class ____(nn.Module):
def __init__(self, config: MgpstrConfig):
super().__init__()
self.token_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.tokenLearner = nn.Sequential(
nn.Conv2d(config.hidden_size, config.hidden_size, kernel_size=(1, 1), stride=1, gro... | MgpstrA3Module |
python | getsentry__sentry | src/sentry/apidocs/parameters.py | {
"start": 16814,
"end": 17080
} | class ____:
SENTRY_APP_ID_OR_SLUG = OpenApiParameter(
name="sentry_app_id_or_slug",
location="path",
required=True,
many=False,
type=str,
description="The ID or slug of the custom integration.",
)
| SentryAppParams |
python | run-llama__llama_index | llama-index-packs/llama-index-packs-nebulagraph-query-engine/llama_index/packs/nebulagraph_query_engine/base.py | {
"start": 613,
"end": 910
} | class ____(str, Enum):
"""NebulaGraph query engine type."""
KG_KEYWORD = "keyword"
KG_HYBRID = "hybrid"
RAW_VECTOR = "vector"
RAW_VECTOR_KG_COMBO = "vector_kg"
KG_QE = "KnowledgeGraphQueryEngine"
KG_RAG_RETRIEVER = "KnowledgeGraphRAGRetriever"
| NebulaGraphQueryEngineType |
python | huggingface__transformers | src/transformers/models/bert_japanese/tokenization_bert_japanese.py | {
"start": 22920,
"end": 24278
} | class ____:
"""Runs Character tokenization."""
def __init__(self, vocab, unk_token, normalize_text=True):
"""
Constructs a CharacterTokenizer.
Args:
**vocab**:
Vocabulary object.
**unk_token**: str
A special symbol for out-of-voca... | CharacterTokenizer |
python | faif__python-patterns | patterns/other/graph_search.py | {
"start": 54,
"end": 4905
} | class ____:
"""Graph search emulation in python, from source
http://www.python.org/doc/essays/graphs/
dfs stands for Depth First Search
bfs stands for Breadth First Search"""
def __init__(self, graph: Dict[str, List[str]]) -> None:
self.graph = graph
def find_path_dfs(
self, s... | GraphSearch |
python | huggingface__transformers | tests/models/siglip2/test_image_processing_siglip2.py | {
"start": 1137,
"end": 3564
} | class ____:
def __init__(
self,
parent,
batch_size=7,
num_channels=3,
image_size=18,
min_resolution=30,
max_resolution=400,
do_resize=True,
size=None,
do_rescale=True,
rescale_factor=1 / 255,
do_normalize=True,
i... | Siglip2ImageProcessingTester |
python | getsentry__sentry | tests/acceptance/test_organization_uptime.py | {
"start": 225,
"end": 5089
} | class ____(AcceptanceTestCase):
def setUp(self) -> None:
super().setUp()
self.uptime_path = f"/organizations/{self.organization.slug}/insights/uptime/"
self.team = self.create_team(organization=self.organization, name="Uptime Team")
self.project = self.create_project(
or... | OrganizationUptimeTest |
python | ray-project__ray | python/ray/dashboard/modules/tests/test_agent.py | {
"start": 520,
"end": 1423
} | class ____(dashboard_utils.DashboardAgentModule):
def __init__(self, dashboard_agent):
super().__init__(dashboard_agent)
@staticmethod
def is_minimal_module():
return False
@routes.get("/test/http_get_from_agent")
async def get_url(self, req) -> aiohttp.web.Response:
url = ... | TestAgent |
python | crytic__slither | slither/vyper_parsing/variables/event_variable.py | {
"start": 184,
"end": 879
} | class ____:
def __init__(self, variable: EventVariable, variable_data: AnnAssign):
self._variable = variable
self._variable.name = variable_data.target.id
if (
isinstance(variable_data.annotation, Call)
and variable_data.annotation.func.id == "indexed"
):
... | EventVariableVyper |
python | pytorch__pytorch | torch/ao/quantization/observer.py | {
"start": 64757,
"end": 65286
} | class ____(Granularity):
"""
Represents per-axis granularity in quantization.
This granularity type calculates different quantization parameters
along a specified axis of the tensor.
For example if the input tensor is shape [8, 16] and axis=0, then
the quantization parameters are calculated fo... | PerAxis |
python | langchain-ai__langchain | libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py | {
"start": 46420,
"end": 48490
} | class ____:
"""Test edge cases and error conditions."""
def test_middleware_modifies_request(self) -> None:
"""Test middleware that modifies the request before execution."""
modified_messages = []
class RequestModifyingMiddleware(AgentMiddleware):
def wrap_model_call(self, ... | TestEdgeCases |
python | kamyu104__LeetCode-Solutions | Python/shortest-distance-after-road-addition-queries-i.py | {
"start": 39,
"end": 888
} | class ____(object):
def shortestDistanceAfterQueries(self, n, queries):
"""
:type n: int
:type queries: List[List[int]]
:rtype: List[int]
"""
def bfs(u, v):
adj[u].append(v)
q = [u]
while q:
new_q = []
... | Solution |
python | pennersr__django-allauth | allauth/socialaccount/providers/box/provider.py | {
"start": 265,
"end": 640
} | class ____(OAuth2Provider):
id = "box"
name = "Box"
account_class = BoxOAuth2Account
oauth2_adapter_class = BoxOAuth2Adapter
def extract_uid(self, data):
return data["id"]
def extract_common_fields(self, data):
return dict(name=data.get("display_name"), email=data.get("email"))... | BoxOAuth2Provider |
python | pypa__setuptools | setuptools/tests/test_editable_install.py | {
"start": 8873,
"end": 14238
} | class ____:
def test_namespace_package_importable(self, venv, tmp_path, editable_opts):
"""
Installing two packages sharing the same namespace, one installed
normally using pip and the other installed in editable mode
should allow importing both packages.
"""
pkg_A = ... | TestPep420Namespaces |
python | jazzband__django-simple-history | runtests.py | {
"start": 739,
"end": 5363
} | class ____:
def __contains__(self, item):
return True
def __getitem__(self, item):
return None
DATABASE_NAME_TO_DATABASE_SETTINGS = {
"sqlite3": {
"default": {
"ENGINE": "django.db.backends.sqlite3",
},
"other": {"ENGINE": "django.db.backends.sqlite3"},... | DisableMigrations |
python | readthedocs__readthedocs.org | readthedocs/organizations/views/base.py | {
"start": 3048,
"end": 4269
} | class ____(OrganizationMixin):
"""
Add team query and instance methods for team related views.
This extends the :py:cls:`OrganizationMixin` to provide both teams and
organizations to the team views. Team forms are passed in the organization
determined from the organization url kwarg.
"""
d... | OrganizationTeamMixin |
python | dask__dask | dask/bag/tests/test_bag.py | {
"start": 43216,
"end": 54625
} | class ____(int):
def __eq__(self, other):
assert isinstance(other, StrictReal)
return self.real == other.real
def __ne__(self, other):
assert isinstance(other, StrictReal)
return self.real != other.real
def test_reduction_with_non_comparable_objects():
b = db.from_sequence... | StrictReal |
python | numba__numba | numba/cuda/cudadecl.py | {
"start": 16175,
"end": 16418
} | class ____(AttributeTemplate):
key = dim3
def resolve_x(self, mod):
return types.int32
def resolve_y(self, mod):
return types.int32
def resolve_z(self, mod):
return types.int32
@register_attr
| Dim3_attrs |
python | skorch-dev__skorch | skorch/tests/test_utils.py | {
"start": 275,
"end": 4525
} | class ____:
@pytest.fixture
def to_tensor(self):
from skorch.utils import to_tensor
return to_tensor
@pytest.mark.skipif(not torch.cuda.is_available(), reason="no cuda device")
def test_device_setting_cuda(self, to_tensor):
x = np.ones((2, 3, 4))
t = to_tensor(x, device=... | TestToTensor |
python | sqlalchemy__sqlalchemy | test/orm/test_eager_relations.py | {
"start": 191036,
"end": 193351
} | class ____(
fixtures.DeclarativeMappedTest, testing.AssertsCompiledSQL
):
__dialect__ = "default"
@classmethod
def setup_classes(cls):
Base = cls.DeclarativeBasic
class PersistentObject(Base):
__tablename__ = "persistent"
id = Column(
Integer, pr... | CyclicalInheritingEagerTestTwo |
python | astropy__astropy | astropy/cosmology/_src/tests/io/test_ecsv.py | {
"start": 7844,
"end": 8260
} | class ____(ReadWriteDirectTestBase, ReadWriteECSVTestMixin):
"""
Directly test ``read/write_ecsv``.
These are not public API and are discouraged from use, in favor of
``Cosmology.read/write(..., format="ascii.ecsv")``, but should be
tested regardless b/c they are used internally.
"""
def se... | TestReadWriteECSV |
python | django__django | tests/select_related_regress/models.py | {
"start": 2151,
"end": 2208
} | class ____(Parent):
value = models.IntegerField()
| Child |
python | huggingface__transformers | src/transformers/models/sam3_tracker_video/modular_sam3_tracker_video.py | {
"start": 3819,
"end": 17844
} | class ____(PreTrainedConfig):
r"""
[`Sam3TrackerVideoConfig`] is the configuration class to store the configuration of a [`Sam3TrackerVideoModel`]. It is used to instantiate a
SAM3 tracker video model according to the specified arguments, defining the memory attention, memory encoder, and image encoder
... | Sam3TrackerVideoConfig |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/protocol1.py | {
"start": 1439,
"end": 1684
} | class ____:
def do(self, x: int | None):
pass
def use_protocol1(a: Abstract1[int]):
a.do(1)
use_protocol1(Concrete1())
# This should generate an error because TypeVars cannot
# be defined in both Protocol and Generic.
| Concrete1 |
python | readthedocs__readthedocs.org | readthedocs/builds/managers.py | {
"start": 4115,
"end": 4583
} | class ____(models.Manager):
def register_match(self, rule, version, max_registers=15):
created = self.create(
rule=rule,
match_arg=rule.get_match_arg(),
action=rule.action,
version_name=version.verbose_name,
version_type=version.type,
)
... | AutomationRuleMatchManager |
python | getsentry__sentry | src/sentry/monitors/validators.py | {
"start": 22104,
"end": 22210
} | class ____(serializers.Serializer):
trace_id = serializers.UUIDField(format="hex")
| TraceContextValidator |
python | wandb__wandb | wandb/vendor/pygments/lexers/fortran.py | {
"start": 492,
"end": 8544
} | class ____(RegexLexer):
"""
Lexer for FORTRAN 90 code.
.. versionadded:: 0.10
"""
name = 'Fortran'
aliases = ['fortran']
filenames = ['*.f03', '*.f90', '*.F03', '*.F90']
mimetypes = ['text/x-fortran']
flags = re.IGNORECASE | re.MULTILINE
# Data Types: INTEGER, REAL, COMPLEX, LO... | FortranLexer |
python | protocolbuffers__protobuf | python/google/protobuf/internal/proto_text_test.py | {
"start": 608,
"end": 1137
} | class ____(unittest.TestCase):
def test_simple_serialize(self, message_module):
msg = message_module.TestAllTypes()
msg.optional_int32 = 101
expected = 'optional_int32: 101\n'
self.assertEqual(expected, proto_text.serialize(msg))
def test_simpor_parse(self, message_module):
text = 'optional_in... | ProtoTextTest |
python | dagster-io__dagster | python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py | {
"start": 101754,
"end": 102758
} | class ____(GeneratedAirbyteSource):
@public
def __init__(
self, name: str, api_key: str, client_secret: str, country_code: str, start_date: str
):
"""Airbyte Source for Search Metrics.
Documentation can be found at https://docs.airbyte.com/integrations/sources/search-metrics
... | SearchMetricsSource |
python | huggingface__transformers | tests/models/mimi/test_modeling_mimi.py | {
"start": 13418,
"end": 20359
} | class ____(unittest.TestCase):
def test_integration_using_cache_decode(self):
expected_rmse = {
"8": 0.0018785292,
"32": 0.0012330565,
}
librispeech_dummy = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
model_id = "ky... | MimiIntegrationTest |
python | run-llama__llama_index | llama-index-integrations/storage/index_store/llama-index-storage-index-store-firestore/llama_index/storage/index_store/firestore/base.py | {
"start": 179,
"end": 1494
} | class ____(KVIndexStore):
"""
Firestore Index store.
Args:
firestore_kvstore (FirestoreKVStore): Firestore key-value store
namespace (str): namespace for the index store
"""
def __init__(
self,
firestore_kvstore: FirestoreKVStore,
namespace: Optional[str] =... | FirestoreIndexStore |
python | kubernetes-client__python | kubernetes/client/models/v1_host_ip.py | {
"start": 383,
"end": 3476
} | 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... | V1HostIP |
python | more-itertools__more-itertools | tests/test_recipes.py | {
"start": 13326,
"end": 13626
} | class ____(TestCase):
def test_justseen(self):
u = mi.unique_justseen('AAAABBBCCDABB')
self.assertEqual(list('ABCDAB'), list(u))
def test_custom_key(self):
u = mi.unique_justseen('AABCcAD', str.lower)
self.assertEqual(list('ABCAD'), list(u))
| UniqueJustseenTests |
python | encode__django-rest-framework | rest_framework/fields.py | {
"start": 68701,
"end": 70221
} | class ____(Field):
"""
A generic field that can be used against an arbitrary model field.
This is used by `ModelSerializer` when dealing with custom model fields,
that do not have a serializer field to be mapped to.
"""
default_error_messages = {
'max_length': _('Ensure this field has n... | ModelField |
python | mlflow__mlflow | mlflow/langchain/output_parsers.py | {
"start": 809,
"end": 1599
} | class ____(BaseTransformOutputParser[dict[str, Any]]):
"""
OutputParser that wraps the string output into a dictionary representation of a
:py:class:`ChatCompletionResponse`
"""
@classmethod
def is_lc_serializable(cls) -> bool:
"""Return whether this class is serializable."""
re... | ChatCompletionsOutputParser |
python | pola-rs__polars | py-polars/src/polars/io/iceberg/_utils.py | {
"start": 11178,
"end": 14387
} | class ____:
def __init__(
self,
table: Table,
projected_filter_schema: pyiceberg.schema.Schema,
) -> None:
import pyiceberg.schema
from pyiceberg.io.pyarrow import schema_to_pyarrow
import polars as pl
import polars._utils.logging
verbose = polar... | IcebergStatisticsLoader |
python | sanic-org__sanic | sanic/exceptions.py | {
"start": 13297,
"end": 14769
} | class ____(HTTPException):
"""408 Request Timeout
The Web server (running the Web site) thinks that there has been too
long an interval of time between 1) the establishment of an IP
connection (socket) between the client and the server and
2) the receipt of any data on that socket, so the server ha... | RequestTimeout |
python | tensorflow__tensorflow | tensorflow/python/distribute/vars_test.py | {
"start": 28183,
"end": 49579
} | class ____(test.TestCase, parameterized.TestCase):
@combinations.generate(strategy_and_run_tf_function_combinations())
def testAssign(self, distribution, experimental_run_tf_function):
def assign(fn, v, update_value, cross_replica):
update_fn = lambda: getattr(v, fn)(update_value)
if cross_replica... | OnReadVariableSyncTest |
python | dagster-io__dagster | python_modules/dagster-pipes/dagster_pipes/__init__.py | {
"start": 47572,
"end": 48749
} | class ____(PipesBlobStoreMessageWriterChannel):
"""Message writer channel for writing messages by periodically writing message chunks to an
AzureBlobStorage container.
Args:
client (Any): An azure.storage.blob.BlobServiceClient object.
bucket (str): The name of the AzureBlobStorage cont... | PipesAzureBlobStorageMessageWriterChannel |
python | spack__spack | lib/spack/spack/vendor/macholib/mach_o.py | {
"start": 31938,
"end": 32033
} | class ____(Structure):
_fields_ = ()
def describe(self):
return {}
| ident_command |
python | ray-project__ray | release/nightly_tests/dataset/sort_benchmark.py | {
"start": 406,
"end": 6004
} | class ____(Datasource):
"""An example datasource that generates rows with random int64 keys and a
row of the given byte size.
Examples:
>>> source = RandomIntRowDatasource()
>>> ray.data.read_datasource(source, n=10, row_size_bytes=2).take()
... {'c_0': 1717767200176864416, 'c_1': b... | RandomIntRowDatasource |
python | getsentry__sentry | src/sentry/search/eap/types.py | {
"start": 2746,
"end": 2912
} | class ____:
span: list[str] | None
log: list[str] | None
metric: list[str] | None
MetricType = Literal["counter", "gauge", "distribution"]
| AdditionalQueries |
python | getsentry__sentry | src/sentry/plugins/bases/tag.py | {
"start": 160,
"end": 595
} | class ____(Plugin2):
tag: ClassVar[str]
project_default_enabled = True
def get_tag_values(self, event) -> list[str]:
"""
Must return a list of values.
>>> get_tag_pairs(event)
[tag1, tag2, tag3]
"""
raise NotImplementedError
def get_tags(self, event, **... | TagPlugin |
python | matplotlib__matplotlib | lib/mpl_toolkits/axisartist/floating_axes.py | {
"start": 557,
"end": 659
} | class ____(
grid_helper_curvelinear.FloatingAxisArtistHelper):
pass
| FloatingAxisArtistHelper |
python | pydantic__pydantic | tests/mypy/modules/covariant_typevar.py | {
"start": 104,
"end": 153
} | class ____(BaseModel, Generic[T]):
value: T
| Foo |
python | openai__openai-python | src/openai/types/batch.py | {
"start": 388,
"end": 544
} | class ____(BaseModel):
data: Optional[List[BatchError]] = None
object: Optional[str] = None
"""The object type, which is always `list`."""
| Errors |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 354610,
"end": 354955
} | class ____(sgqlc.types.Type):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = ("contexts",)
contexts = sgqlc.types.Field(
sgqlc.types.non_null(
sgqlc.types.list_of(sgqlc.types.non_null("HovercardContext"))
),
graphql_name=... | Hovercard |
python | getsentry__sentry | src/sentry/ratelimits/leaky_bucket.py | {
"start": 840,
"end": 7861
} | class ____:
NAMESPACE = "leaky_bucket_limiter"
class LimitExceeded(Exception):
def __init__(self, info: LeakyBucketLimitInfo) -> None:
self.info = info
def __init__(self, burst_limit: int, drip_rate: int, key: str | None = None) -> None:
cluster_key = settings.SENTRY_RATE_LIMIT... | LeakyBucketRateLimiter |
python | EpistasisLab__tpot | tpot/builtin_modules/arithmetictransformer.py | {
"start": 10801,
"end": 11483
} | class ____(TransformerMixin, BaseEstimator):
def __init__(self):
"""
A transformer that takes checks if all elements in a row are less than or equal to 0.
"""
pass
def fit(self, X, y=None):
return self
def transform(self, X):
transformed_X = np.array(self.tr... | LETransformer |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/constructor15.py | {
"start": 777,
"end": 892
} | class ____(Generic[_M, _N]):
def __new__(cls, m: _M, n: _N) -> Self: ...
d: D[Literal[3], Literal[4]] = D(3, 4)
| D |
python | getsentry__sentry | src/sentry/api/serializers/rest_framework/release.py | {
"start": 1907,
"end": 3183
} | class ____(serializers.Serializer):
ref = serializers.CharField(
max_length=MAX_VERSION_LENGTH,
required=False,
allow_null=True,
allow_blank=True,
help_text="An optional commit reference. This is useful if a tagged version has been provided.",
)
url = serializers.URLF... | ReleaseSerializer |
python | pypa__warehouse | tests/unit/email/test_init.py | {
"start": 111606,
"end": 120197
} | class ____:
def test_collaborator_added_email(
self, pyramid_request, pyramid_config, monkeypatch
):
stub_user = pretend.stub(
id="id_1",
username="username",
name="",
email="email@example.com",
primary_email=pretend.stub(email="email@e... | TestCollaboratorAddedEmail |
python | encode__django-rest-framework | tests/test_filters.py | {
"start": 1583,
"end": 2415
} | class ____(TestCase):
def setUp(self):
self.original_coreapi = filters.coreapi
filters.coreapi = True # mock it, because not None value needed
self.filter_backend = filters.BaseFilterBackend()
def tearDown(self):
filters.coreapi = self.original_coreapi
def test_filter_quer... | BaseFilterTests |
python | numba__numba | numba/core/environment.py | {
"start": 62,
"end": 1639
} | class ____(_dynfunc.Environment):
"""Stores globals and constant pyobjects for runtime.
It is often needed to convert b/w nopython objects and pyobjects.
"""
__slots__ = ('env_name', '__weakref__')
# A weak-value dictionary to store live environment with env_name as the
# key.
_memo = weakr... | Environment |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/low_priority_provider/package.py | {
"start": 217,
"end": 577
} | class ____(Package):
"""Provides multiple virtuals but is low in the priority of clingo"""
homepage = "http://www.example.com"
url = "http://www.example.com/a-1.0.tar.gz"
version("1.0", md5="0123456789abcdef0123456789abcdef")
# A low priority provider that provides both these specs together
p... | LowPriorityProvider |
python | run-llama__llama_index | llama-index-integrations/readers/llama-index-readers-sec-filings/llama_index/readers/sec_filings/utils.py | {
"start": 891,
"end": 6613
} | class ____(Exception):
pass
def form_request_payload(
ticker_or_cik: str,
filing_types: List[str],
start_date: str,
end_date: str,
start_index: int,
query: str,
) -> dict:
return {
"dateRange": "custom",
"startdt": start_date,
"enddt": end_date,
"entityN... | EdgarSearchApiError |
python | getsentry__sentry | src/sentry/api/serializers/models/project.py | {
"start": 34662,
"end": 35235
} | class ____(TypedDict):
id: str
name: str
slug: str
shortName: str
type: str
canDisable: bool
isTestable: bool
hasConfiguration: bool
metadata: dict
contexts: list[str]
status: str
assets: list
doc: str
firstPartyAlternative: Any
deprecationDate: Any
altIsS... | Plugin |
python | readthedocs__readthedocs.org | readthedocs/domains/apps.py | {
"start": 71,
"end": 264
} | class ____(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "readthedocs.domains"
def ready(self):
import readthedocs.domains.tasks # noqa
| DomainsConfig |
python | crytic__slither | slither/vyper_parsing/ast/types.py | {
"start": 123,
"end": 181
} | class ____:
src: str
node_id: int
@dataclass
| ASTNode |
python | scipy__scipy | scipy/integrate/_ode.py | {
"start": 37676,
"end": 40275
} | class ____(vode):
runner = getattr(_vode, 'zvode', None)
supports_run_relax = 1
supports_step = 1
scalar = complex
__class_getitem__ = None
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Override state array sizes for ZVODE (53 doubles vs 51 for VODE)... | zvode |
python | cython__cython | Cython/Compiler/ExprNodes.py | {
"start": 480504,
"end": 489019
} | class ____(ExprNode):
"""
Used when a pointer of base_type is cast to a memoryviewslice with that
base type. i.e.
<int[:M:1, :N]> p
creates a fortran-contiguous cython.array.
We leave the type set to object so coercions to object are more efficient
and less work. Acquiring a memoryvie... | CythonArrayNode |
python | huggingface__transformers | src/transformers/models/ernie/modeling_ernie.py | {
"start": 36944,
"end": 37387
} | class ____(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = ErnieLMPredictionHead(config)
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
prediction_scores = self.predictions(sequence_output)
return prediction_scores
@auto_docstri... | ErnieOnlyMLMHead |
python | pypa__warehouse | warehouse/admin/views/users.py | {
"start": 2556,
"end": 3054
} | class ____(wtforms.Form):
email = wtforms.fields.EmailField(validators=[wtforms.validators.InputRequired()])
primary = wtforms.fields.BooleanField()
verified = wtforms.fields.BooleanField()
public = wtforms.fields.BooleanField()
unverify_reason = wtforms.fields.StringField(render_kw={"readonly": Tru... | EmailForm |
python | encode__django-rest-framework | tests/test_fields.py | {
"start": 67215,
"end": 67782
} | class ____(FieldValues):
"""
Valid and invalid values for a `Choice` field that uses an integer type,
instead of a char type.
"""
valid_inputs = {
'1': 1,
3: 3,
}
invalid_inputs = {
5: ['"5" is not a valid choice.'],
'abc': ['"abc" is not a valid choice.']
... | TestChoiceFieldWithType |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/dev_build_test_install_phases/package.py | {
"start": 217,
"end": 709
} | class ____(Package):
homepage = "example.com"
url = "fake.com"
version("0.0.0", sha256="0123456789abcdef0123456789abcdef")
phases = ["one", "two", "three", "install"]
def one(self, spec, prefix):
print("One locomoco")
def two(self, spec, prefix):
print("Two locomoco")
de... | DevBuildTestInstallPhases |
python | donnemartin__interactive-coding-challenges | graphs_trees/min_heap/min_heap.py | {
"start": 46,
"end": 2192
} | class ____(object):
def __init__(self):
self.array = []
def __len__(self):
return len(self.array)
def extract_min(self):
if not self.array:
return None
if len(self.array) == 1:
return self.array.pop(0)
minimum = self.array[0]
# Move ... | MinHeap |
python | numba__numba | numba/cuda/simulator/kernelapi.py | {
"start": 1075,
"end": 1191
} | class ____:
'''
CUDA Cooperative Groups
'''
def this_grid(self):
return GridGroup()
| FakeCUDACg |
python | wandb__wandb | wandb/apis/public/registries/_members.py | {
"start": 1020,
"end": 1931
} | class ____(ArtifactsBase, arbitrary_types_allowed=True):
kind: Literal[MemberKind.ENTITY] = MemberKind.ENTITY
team: Team
role: Union[MemberRole, str] # noqa: UP007
MemberOrId = Union[User, Team, UserMember, TeamMember, str]
"""Type hint for a registry member argument that accepts a User, Team, or their ... | TeamMember |
python | pytorch__pytorch | test/torch_np/numpy_tests/core/test_shape_base.py | {
"start": 4736,
"end": 6332
} | class ____(TestCase):
def test_non_iterable(self):
assert_raises(TypeError, hstack, 1)
def test_empty_input(self):
assert_raises(ValueError, hstack, ())
def test_0D_array(self):
a = array(1)
b = array(2)
res = hstack([a, b])
desired = array([1, 2])
a... | TestHstack |
python | huggingface__transformers | tests/models/bartpho/test_tokenization_bartpho.py | {
"start": 915,
"end": 3235
} | class ____(TokenizerTesterMixin, unittest.TestCase):
from_pretrained_id = "vinai/bartpho-syllable"
tokenizer_class = BartphoTokenizer
test_rust_tokenizer = False
test_sentencepiece = True
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.special_tokens_map = {"unk_token... | BartphoTokenizerTest |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/managed_kafka.py | {
"start": 45046,
"end": 48929
} | class ____(ManagedKafkaBaseOperator):
"""
Update the properties of a single consumer group.
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
:param location: Required. The ID of the Google Cloud region that the service belongs to.
:param cluster_id: Requi... | ManagedKafkaUpdateConsumerGroupOperator |
python | allegroai__clearml | clearml/backend_api/services/v2_20/tasks.py | {
"start": 258069,
"end": 259925
} | class ____(Response):
"""
Response of tasks.failed endpoint.
:param updated: Number of tasks updated (0 or 1)
:type updated: int
:param fields: Updated fields names and values
:type fields: dict
"""
_service = "tasks"
_action = "failed"
_version = "2.20"
_schema = {
... | FailedResponse |
python | kamyu104__LeetCode-Solutions | Python/sliding-window-median.py | {
"start": 2589,
"end": 3908
} | class ____(object):
def medianSlidingWindow(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[float]
"""
def lazy_delete(heap, to_remove, sign):
while heap and sign*heap[0] in to_remove:
to_remove[sign*heap[0]] -= 1
... | Solution3 |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py | {
"start": 13873,
"end": 13993
} | class ____(AdsInsights):
breakdowns = ["dma"]
action_breakdowns = ["action_type"]
| AdsInsightsDemographicsDMARegion |
python | getsentry__sentry | src/sentry/search/events/fields.py | {
"start": 86645,
"end": 88159
} | class ____(NamedTuple):
field: str
instance: DiscoverFunction
arguments: Mapping[str, NormalizedArg]
def resolve_datetime64(
raw_value: datetime | str | float | None, precision: int = 6
) -> Function | None:
"""
This is normally handled by the snuba-sdk but it assumes that the underlying
t... | FunctionDetails |
python | modin-project__modin | modin/core/io/column_stores/parquet_dispatcher.py | {
"start": 6124,
"end": 7461
} | class ____(ColumnStoreDataset):
def _init_dataset(self): # noqa: GL08
from pyarrow.parquet import ParquetDataset
return ParquetDataset(self.fs_path, filesystem=self.fs)
@property
def pandas_metadata(self):
return self.dataset.schema.pandas_metadata
@property
def columns(s... | PyArrowDataset |
python | numba__numba | numba/core/typing/builtins.py | {
"start": 7600,
"end": 7784
} | class ____(ConcreteTemplate):
_tys = machine_ints + sorted(types.real_domain)
cases = [signature(types.UniTuple(ty, 2), ty, ty) for ty in _tys]
@infer_global(operator.pow)
| DivMod |
python | huggingface__transformers | src/transformers/models/gemma3/modeling_gemma3.py | {
"start": 5810,
"end": 6486
} | class ____(nn.Module):
def __init__(self, dim: int, eps: float = 1e-6):
super().__init__()
self.eps = eps
self.weight = nn.Parameter(torch.zeros(dim))
def _norm(self, x):
return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
def forward(self, x):
output... | Gemma3RMSNorm |
python | pytorch__pytorch | test/jit/test_await.py | {
"start": 305,
"end": 12260
} | class ____(JitTestCase):
def test_await_python(self):
def foo(x: int) -> int:
return x + 13
aw: Await[int] = torch.jit._awaitable(foo, 13)
self.assertTrue(aw.fn()(*aw.args()) == torch.jit._awaitable_wait(aw))
nw = torch.jit._awaitable_nowait(33)
self.assertTrue(n... | TestAwait |
python | weaviate__weaviate-python-client | weaviate/collections/classes/config_vector_index.py | {
"start": 7198,
"end": 7377
} | class ____(_QuantizerConfigCreate):
cache: Optional[bool]
rescoreLimit: Optional[int]
@staticmethod
def quantizer_name() -> str:
return "bq"
| _BQConfigCreate |
python | davidhalter__jedi | jedi/inference/compiled/value.py | {
"start": 14194,
"end": 14615
} | class ____(AbstractNameDefinition):
"""
Accessing some names will raise an exception. To avoid not having any
completions, just give Jedi the option to return this object. It infers to
nothing.
"""
def __init__(self, inference_state, name):
self.parent_context = inference_state.builtins_... | EmptyCompiledName |
python | kamyu104__LeetCode-Solutions | Python/design-twitter.py | {
"start": 281,
"end": 3777
} | class ____(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.__number_of_most_recent_tweets = 10
self.__followings = collections.defaultdict(set)
self.__messages = collections.defaultdict(list)
self.__time = 0
def postTweet(s... | Twitter |
python | keon__algorithms | tests/test_maths.py | {
"start": 3242,
"end": 4866
} | class ____(unittest.TestCase):
"""[summary]
Test for the file gcd.py
Arguments:
unittest {[type]} -- [description]
"""
def test_gcd(self):
self.assertEqual(4, gcd(8, 12))
self.assertEqual(1, gcd(13, 17))
def test_gcd_non_integer_input(self):
with pytest.raises(... | TestGcd |
python | joke2k__faker | tests/providers/test_company.py | {
"start": 8989,
"end": 9549
} | class ____:
"""Test hu_HU company provider methods"""
def test_company_suffix(self, faker, num_samples):
for _ in range(num_samples):
suffix = faker.company_suffix()
assert isinstance(suffix, str)
assert suffix in HuHuCompanyProvider.company_suffixes
def test_co... | TestHuHu |
python | tensorflow__tensorflow | tensorflow/python/keras/layers/legacy_rnn/rnn_cell_impl.py | {
"start": 25488,
"end": 26034
} | class ____(_LSTMStateTuple):
"""Tuple used by LSTM Cells for `state_size`, `zero_state`, and output state.
Stores two elements: `(c, h)`, in that order. Where `c` is the hidden state
and `h` is the output.
Only used when `state_is_tuple=True`.
"""
__slots__ = ()
@property
def dtype(self):
(c, h) ... | LSTMStateTuple |
python | getsentry__sentry | src/sentry/models/artifactbundle.py | {
"start": 856,
"end": 1396
} | class ____(Enum):
SOURCE = 1
MINIFIED_SOURCE = 2
SOURCE_MAP = 3
INDEXED_RAM_BUNDLE = 4
@classmethod
def choices(cls) -> list[tuple[int, str]]:
return [(key.value, key.name) for key in cls]
@classmethod
def from_lowercase_key(cls, lowercase_key: str | None) -> SourceFileType | N... | SourceFileType |
python | ansible__ansible | lib/ansible/utils/collection_loader/_collection_finder.py | {
"start": 36214,
"end": 38057
} | class ____:
def __init__(self, fullname, path_list):
self._redirect = None
split_name = fullname.split('.')
toplevel_pkg = split_name[0]
module_to_load = split_name[-1]
if toplevel_pkg != 'ansible':
raise ImportError('not interested')
builtin_meta = _ge... | _AnsibleInternalRedirectLoader |
python | huggingface__transformers | tests/models/prophetnet/test_modeling_prophetnet.py | {
"start": 40770,
"end": 41873
} | class ____(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
all_model_classes = (ProphetNetDecoder, ProphetNetForCausalLM) if is_torch_available() else ()
test_resize_embeddings = False
is_encoder_decoder = False
def setUp(self):
self.model_tester = ProphetNetStandaloneDecoderModel... | ProphetNetStandaloneDecoderModelTest |
python | pytorch__pytorch | test/functorch/test_aotdispatch.py | {
"start": 221778,
"end": 246566
} | class ____(AOTTestCase):
@unittest.skipIf(not USE_NETWORKX, "networkx not available")
def test_recompute_partitioning(self):
def fn(a, b):
return torch.sin(torch.sin(a)) + b
# Reference calculation
ref_a = torch.rand(10, 10, requires_grad=True)
ref_b = torch.rand(10,... | TestPartitioning |
python | bottlepy__bottle | bottle.py | {
"start": 122828,
"end": 127198
} | class ____:
def __init__(
self,
stream,
boundary,
content_length=-1,
disk_limit=2 ** 30,
mem_limit=2 ** 20,
memfile_limit=2 ** 18,
buffer_size=2 ** 16,
charset="latin1",
):
self.stream = stream
self.boundary = boundary
... | _MultipartParser |
python | PrefectHQ__prefect | src/prefect/server/schemas/responses.py | {
"start": 3779,
"end": 4848
} | class ____(PrefectBaseModel):
"""Represents a history of aggregation states over an interval"""
interval_start: DateTime = Field(
default=..., description="The start date of the interval."
)
interval_end: DateTime = Field(
default=..., description="The end date of the interval."
)
... | HistoryResponse |
python | crytic__slither | slither/core/expressions/unary_operation.py | {
"start": 468,
"end": 3209
} | class ____(Enum):
BANG = 0 # !
TILD = 1 # ~
DELETE = 2 # delete
PLUSPLUS_PRE = 3 # ++
MINUSMINUS_PRE = 4 # --
PLUSPLUS_POST = 5 # ++
MINUSMINUS_POST = 6 # --
PLUS_PRE = 7 # for stuff like uint(+1)
MINUS_PRE = 8 # for stuff like uint(-1)
@staticmethod
def get_type(op... | UnaryOperationType |
python | cherrypy__cherrypy | cherrypy/_cptools.py | {
"start": 1703,
"end": 5002
} | class ____(object):
"""A registered function for use with CherryPy request-processing hooks.
help(tool.callable) should give you more information about this
Tool.
"""
namespace = 'tools'
def __init__(self, point, callable, name=None, priority=50):
"""Initialize a CherryPy tool instanc... | Tool |
python | huggingface__transformers | src/transformers/models/big_bird/modeling_big_bird.py | {
"start": 5337,
"end": 9379
} | class ____(nn.Module):
def __init__(self, config, layer_idx=None):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0 and not hasattr(config, "embedding_size"):
raise ValueError(
f"The hidden size ({config.hidden_size}) is not a multiple of the num... | BigBirdSelfAttention |
python | FactoryBoy__factory_boy | tests/test_base.py | {
"start": 991,
"end": 2728
} | class ____(unittest.TestCase):
def test_factory_for_optional(self):
"""Ensure that model= is optional for abstract=True."""
class TestObjectFactory(base.Factory):
class Meta:
abstract = True
self.assertTrue(TestObjectFactory._meta.abstract)
self.assertIsN... | AbstractFactoryTestCase |
python | google__pytype | pytype/errors/error_printer.py | {
"start": 493,
"end": 567
} | class ____:
expected: str
actual: str
error_details: list[str]
| BadCall |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.