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 | mlflow__mlflow | mlflow/store/tracking/dbmodels/models.py | {
"start": 61084,
"end": 63077
} | class ____(Base):
"""
DB model for storing scorer version information. These are recorded in
``scorer_versions`` table.
"""
__tablename__ = "scorer_versions"
scorer_id = Column(
String(36), ForeignKey("scorers.scorer_id", ondelete="CASCADE"), nullable=False
)
"""
Scorer ID:... | SqlScorerVersion |
python | python-poetry__poetry | tests/repositories/fixtures/distribution_hashes.py | {
"start": 277,
"end": 14366
} | class ____:
sha256: str = ""
md5: str = ""
KNOWN_DISTRIBUTION_HASHES = {
"SQLAlchemy-1.2.12.tar.gz": DistributionHash(
"b5a127599b3f27847fba6119de0fcb70832a8041b103701a708b7c7d044faa38",
"4a2617b5254748828d09349fc4eff6bd",
),
"Twisted-18.9.0.tar.bz2": DistributionHash(
"433... | DistributionHash |
python | numba__numba | numba/tests/test_mixed_tuple_unroller.py | {
"start": 48347,
"end": 57418
} | class ____(TestCase):
def test_invalid_use_of_unroller(self):
@njit
def foo():
x = (10, 20)
r = 0
for a in literal_unroll(x, x):
r += a
return r
with self.assertRaises(errors.UnsupportedError) as raises:
foo()
... | TestMore |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/storage/dagster_run.py | {
"start": 24408,
"end": 24545
} | class ____(NamedTuple):
tag_key: str
tag_values: list[str]
bucket_limit: Optional[int]
@public
@record(kw_only=False)
| TagBucket |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 1585734,
"end": 1585904
} | class ____(sgqlc.types.Union):
"""Types that can represent a repository ruleset bypass actor."""
__schema__ = github_schema
__types__ = (App, Team)
| BypassActor |
python | jazzband__django-waffle | waffle/migrations/0001_initial.py | {
"start": 105,
"end": 4472
} | class ____(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Flag',
fields=[
('id', models.AutoField(verbose_name='ID', ... | Migration |
python | h5py__h5py | h5py/tests/test_datatype.py | {
"start": 470,
"end": 1091
} | class ____(TestCase):
"""
Feature: repr() works sensibly on datatype objects
"""
def test_repr(self):
""" repr() on datatype objects """
name = make_name()
self.f[name] = np.dtype('S10')
dt = self.f[name]
self.assertIsInstance(repr(dt), str)
if is_ma... | TestCreation |
python | getsentry__sentry | src/sentry/monitors/types.py | {
"start": 905,
"end": 1086
} | class ____(TypedDict):
"""
See `CheckinItem` for definition
"""
ts: str
partition: int
message: CheckIn
payload: CheckinPayload
@dataclass
| CheckinItemData |
python | django__django | tests/validation/models.py | {
"start": 5677,
"end": 6107
} | class ____(models.Model):
name = models.CharField(max_length=255)
color = models.CharField(max_length=32)
rank = models.IntegerField()
class Meta:
constraints = [
models.UniqueConstraint(
fields=["name", "color"], name="name_color_uniq_validation"
),
... | UniqueConstraintProduct |
python | huggingface__transformers | tests/models/superpoint/test_modeling_superpoint.py | {
"start": 4095,
"end": 9483
} | class ____(ModelTesterMixin, unittest.TestCase):
all_model_classes = (SuperPointForKeypointDetection,) if is_torch_available() else ()
test_resize_embeddings = False
has_attentions = False
from_pretrained_id = "magic-leap-community/superpoint"
def setUp(self):
self.model_tester = SuperPoin... | SuperPointModelTest |
python | kamyu104__LeetCode-Solutions | Python/encode-and-decode-tinyurl.py | {
"start": 45,
"end": 1044
} | class ____(object):
def __init__(self):
self.__random_length = 6
self.__tiny_url = "http://tinyurl.com/"
self.__alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
self.__lookup = {}
def encode(self, longUrl):
"""Encodes a URL to a shortened URL.
... | Codec |
python | yandexdataschool__Practical_RL | week04_approx_rl/dqn/atari_wrappers.py | {
"start": 715,
"end": 2593
} | class ____(Wrapper):
def __init__(self, env):
"""Make end-of-life == end-of-episode, but only reset on true game over.
Done by DeepMind for the DQN and co. since it helps value estimation.
"""
super().__init__(env)
self.lives = 0
self.was_real_done = True
def ste... | EpisodicLifeEnv |
python | apache__airflow | task-sdk/src/airflow/sdk/execution_time/comms.py | {
"start": 24823,
"end": 25082
} | class ____(TISkippedDownstreamTasksStatePayload):
"""Update state of downstream tasks within a task instance to 'skipped', while updating current task to success state."""
type: Literal["SkipDownstreamTasks"] = "SkipDownstreamTasks"
| SkipDownstreamTasks |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 112487,
"end": 112982
} | class ____(sgqlc.types.Input):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = ("project_id", "repository_id", "client_mutation_id")
project_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="projectId")
repository_id = sgqlc.types.Field(
... | LinkRepositoryToProjectInput |
python | PrefectHQ__prefect | src/prefect/server/schemas/actions.py | {
"start": 35516,
"end": 37539
} | class ____(ActionBaseModel):
"""Data used by the Prefect REST API to create an artifact."""
key: Optional[ArtifactKey] = Field(
default=None, description="An optional unique reference key for this artifact."
)
type: Optional[str] = Field(
default=None,
description=(
... | ArtifactCreate |
python | scipy__scipy | scipy/sparse/_csr.py | {
"start": 14779,
"end": 18601
} | class ____(spmatrix, _csr_base):
"""
Compressed Sparse Row matrix.
This can be instantiated in several ways:
csr_matrix(D)
where D is a 2-D ndarray
csr_matrix(S)
with another sparse array or matrix S (equivalent to S.tocsr())
csr_matrix((M, N), [dtype])
... | csr_matrix |
python | django__django | tests/get_earliest_or_latest/tests.py | {
"start": 164,
"end": 7223
} | class ____(TestCase):
"""Tests for the earliest() and latest() objects methods"""
@classmethod
def setUpClass(cls):
super().setUpClass()
cls._article_get_latest_by = Article._meta.get_latest_by
def tearDown(self):
Article._meta.get_latest_by = self._article_get_latest_by
d... | EarliestOrLatestTests |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 550519,
"end": 550955
} | class ____(sgqlc.types.Type):
"""An edge in a connection."""
__schema__ = github_schema
__field_names__ = ("cursor", "node")
cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor")
"""A cursor for use in pagination."""
node = sgqlc.types.Field("CreatedPullRequestReviewC... | CreatedPullRequestReviewContributionEdge |
python | walkccc__LeetCode | solutions/2696. Minimum String Length After Removing Substrings/2696.py | {
"start": 0,
"end": 325
} | class ____:
def minLength(self, s: str) -> int:
stack = []
def match(c: str) -> bool:
return stack and stack[-1] == c
for c in s:
if c == 'B' and match('A'):
stack.pop()
elif c == 'D' and match('C'):
stack.pop()
else:
stack.append(c)
return len(stack)... | Solution |
python | uqfoundation__dill | dill/_dill.py | {
"start": 36717,
"end": 91730
} | class ____(dict):
def __ror__(self, a):
return a
_dictproxy_helper_instance = _dictproxy_helper()
__d = {}
try:
# In CPython 3.9 and later, this trick can be used to exploit the
# implementation of the __or__ function of MappingProxyType to get the true
# mapping referenced by the proxy. It may... | _dictproxy_helper |
python | PyCQA__pylint | tests/functional/n/no/no_member_augassign.py | {
"start": 302,
"end": 386
} | class ____:
value: int
obj_b = B()
obj_b.value = 1 + obj_b.value # [no-member]
| B |
python | django__django | django/contrib/gis/db/models/lookups.py | {
"start": 4376,
"end": 4612
} | class ____(GISLookup):
"""
The 'overlaps_above' operator returns true if A's bounding box overlaps or
is above B's bounding box.
"""
lookup_name = "overlaps_above"
@BaseSpatialField.register_lookup
| OverlapsAboveLookup |
python | django__django | tests/model_forms/models.py | {
"start": 13328,
"end": 13659
} | class ____(models.Model):
title = models.CharField(max_length=30)
_should_error = False
def __setattr__(self, key, value):
if self._should_error is True:
raise ValidationError(message={key: "Cannot set attribute"}, code="invalid")
super().__setattr__(key, value)
| StrictAssignmentFieldSpecific |
python | doocs__leetcode | solution/2400-2499/2424.Longest Uploaded Prefix/Solution.py | {
"start": 0,
"end": 404
} | class ____:
def __init__(self, n: int):
self.r = 0
self.s = set()
def upload(self, video: int) -> None:
self.s.add(video)
while self.r + 1 in self.s:
self.r += 1
def longest(self) -> int:
return self.r
# Your LUPrefix object will be instantiated and ca... | LUPrefix |
python | ray-project__ray | python/ray/data/_internal/logical/operators/read_operator.py | {
"start": 551,
"end": 7413
} | class ____(
AbstractMap,
SourceOperator,
LogicalOperatorSupportsProjectionPushdown,
LogicalOperatorSupportsPredicatePushdown,
):
"""Logical operator for read."""
# TODO: make this a frozen dataclass. https://github.com/ray-project/ray/issues/55747
def __init__(
self,
datasou... | Read |
python | mlflow__mlflow | mlflow/cli/__init__.py | {
"start": 1463,
"end": 37666
} | class ____(click.Group):
def get_command(self, ctx, cmd_name):
# `mlflow ui` is an alias for `mlflow server`
cmd_name = "server" if cmd_name == "ui" else cmd_name
return super().get_command(ctx, cmd_name)
def _load_env_file(ctx: click.Context, param: click.Parameter, value: str | None) -> ... | AliasedGroup |
python | anthropics__anthropic-sdk-python | src/anthropic/resources/beta/messages/messages.py | {
"start": 78307,
"end": 153637
} | class ____(AsyncAPIResource):
@cached_property
def batches(self) -> AsyncBatches:
return AsyncBatches(self._client)
@cached_property
def with_raw_response(self) -> AsyncMessagesWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
... | AsyncMessages |
python | tensorflow__tensorflow | tensorflow/python/ops/parallel_for/control_flow_ops_test.py | {
"start": 75041,
"end": 75777
} | class ____(PForTestCase):
@test_util.run_v1_only("b/122612051")
def test_dynamic_rnn(self):
pfor_outputs, tf_outputs = create_dynamic_lstm(rnn_cell.BasicRNNCell, 3, 5,
7)
self.run_and_assert_equal(pfor_outputs, tf_outputs)
@test_util.run_v1_only("b/1226... | RNNTest |
python | django__django | tests/admin_scripts/tests.py | {
"start": 96520,
"end": 115353
} | class ____(LiveServerTestCase, AdminScriptTestCase):
available_apps = [
"admin_scripts",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
]
def test_wrong_args(self):
"""
Passing the wrong kinds of arguments outputs an error an... | StartProject |
python | huggingface__transformers | tests/models/gemma3/test_modeling_gemma3.py | {
"start": 20447,
"end": 49630
} | class ____(unittest.TestCase):
def setUp(self):
self.processor = Gemma3Processor.from_pretrained("google/gemma-3-4b-it", padding_side="left")
url = "https://huggingface.co/datasets/hf-internal-testing/fixtures-captioning/resolve/main/cow_beach_1.png"
self.messages = [
{"role": "... | Gemma3IntegrationTest |
python | allegroai__clearml | clearml/model.py | {
"start": 107380,
"end": 107472
} | class ____(object):
def wait(self, *_: Any, **__: Any) -> bool:
return True
| Waitable |
python | numba__numba | numba/core/types/abstract.py | {
"start": 9641,
"end": 9724
} | class ____(Type):
"""
Base class for objects that support len()
"""
| Sized |
python | keon__algorithms | algorithms/linkedlist/add_two_numbers.py | {
"start": 398,
"end": 1792
} | class ____:
def __init__(self, x):
self.val = x
self.next = None
def add_two_numbers(left: Node, right: Node) -> Node:
head = Node(0)
current = head
sum = 0
while left or right:
print("adding: ", left.val, right.val)
sum //= 10
if left:
sum += le... | Node |
python | ray-project__ray | python/ray/tune/tests/_test_trial_runner_callbacks.py | {
"start": 1765,
"end": 2172
} | class ____(RayTrialExecutor):
def __init__(self):
super().__init__()
self.next_future_result = None
def start_trial(self, trial: Trial):
trial.status = Trial.RUNNING
return True
def continue_training(self, trial: Trial):
pass
def get_next_executor_event(self, l... | _MockTrialExecutor |
python | pytorch__pytorch | torch/_inductor/constant_folding.py | {
"start": 2510,
"end": 15243
} | class ____(torch.fx.Interpreter):
def __init__(
self,
gm: torch.fx.GraphModule,
skip_constructors: bool = False,
lifted_constant_names: Optional[list[str]] = None,
skip_folding_node_fn: Optional[Callable[[torch.fx.Node], bool]] = None,
) -> None:
super().__init__(... | ConstantFolder |
python | apache__airflow | task-sdk/tests/task_sdk/definitions/test_dag.py | {
"start": 24145,
"end": 24338
} | class ____(BaseOperator):
"""
An operator that does nothing.
Used to test Dag cycle detection.
"""
def execute(self, context: Context) -> None:
pass
| DoNothingOperator |
python | apache__avro | lang/py/avro/test/test_compatibility.py | {
"start": 14153,
"end": 37754
} | class ____(unittest.TestCase):
def test_simple_schema_promotion(self):
field_alias_reader = parse(
json.dumps(
{
"name": "foo",
"type": "record",
"fields": [{"type": "int", "name": "bar", "aliases": ["f1"]}],
... | TestCompatibility |
python | pandas-dev__pandas | pandas/core/window/expanding.py | {
"start": 727,
"end": 44356
} | class ____(RollingAndExpandingMixin):
"""
Provide expanding window calculations.
An expanding window yields the value of an aggregation statistic with all the data
available up to that point in time.
Parameters
----------
min_periods : int, default 1
Minimum number of observations ... | Expanding |
python | django-extensions__django-extensions | tests/management/commands/test_reset_db.py | {
"start": 6180,
"end": 9436
} | class ____(TestCase):
"""Tests for reset_db command and sqlite3 engine."""
@mock.patch("sys.stdout", new_callable=StringIO)
@mock.patch("django_extensions.management.commands.reset_db.input")
def test_should_cancel_reset_db_if_input_is_different_than_yes(
self, m_input, m_stdout
):
... | ResetDbPostgresqlTests |
python | ipython__ipython | IPython/lib/demo.py | {
"start": 20371,
"end": 21642
} | class ____(Demo):
"""Demo where each line is executed as a separate block.
The input script should be valid Python code.
This class doesn't require any markup at all, and it's meant for simple
scripts (with no nesting or any kind of indentation) which consist of
multiple lines of input to be execu... | LineDemo |
python | huggingface__transformers | tests/models/llava_next_video/test_video_processing_llava_next_video.py | {
"start": 1049,
"end": 3249
} | class ____:
def __init__(
self,
parent,
batch_size=5,
num_frames=8,
num_channels=3,
min_resolution=30,
max_resolution=80,
do_resize=True,
size=None,
do_center_crop=True,
crop_size=None,
do_normalize=True,
image_m... | LlavaNextVideoProcessingTester |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 216606,
"end": 216948
} | class ____(sgqlc.types.Type):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = ("client_mutation_id", "status")
client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId")
status = sgqlc.types.Field("UserStatus", graphql_name="status")... | ChangeUserStatusPayload |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/definitions/metadata/metadata_value.py | {
"start": 22941,
"end": 23528
} | class ____(MetadataValue[str]):
"""Container class for markdown metadata entry data.
Args:
md_str (Optional[str]): The markdown as a string.
"""
md_str: PublicAttr[Optional[str]] = ""
@public
@property
def value(self) -> str:
"""Optional[str]: The wrapped markdown as a str... | MarkdownMetadataValue |
python | pandas-dev__pandas | pandas/tests/test_expressions.py | {
"start": 2114,
"end": 14893
} | class ____:
@staticmethod
def call_op(df, other, flex: bool, opname: str):
if flex:
op = lambda x, y: getattr(x, opname)(y)
op.__name__ = opname
else:
op = getattr(operator, opname)
with option_context("compute.use_numexpr", False):
expect... | TestExpressions |
python | jazzband__django-oauth-toolkit | tests/test_token_view.py | {
"start": 4322,
"end": 8017
} | class ____(TestAuthorizedTokenViews):
"""
Tests for the Authorized Token DeleteView
"""
def test_delete_view_authorization_required(self):
"""
Test that the view redirects to login page if user is not logged-in.
"""
self.token = AccessToken.objects.create(
us... | TestAuthorizedTokenDeleteView |
python | celery__celery | celery/app/registry.py | {
"start": 279,
"end": 2001
} | class ____(dict):
"""Map of registered tasks."""
NotRegistered = NotRegistered
def __missing__(self, key):
raise self.NotRegistered(key)
def register(self, task):
"""Register a task in the task registry.
The task will be automatically instantiated if not already an
in... | TaskRegistry |
python | kamyu104__LeetCode-Solutions | Python/replace-words.py | {
"start": 84,
"end": 783
} | class ____(object):
def replaceWords(self, dictionary, sentence):
"""
:type dictionary: List[str]
:type sentence: str
:rtype: str
"""
_trie = lambda: collections.defaultdict(_trie)
trie = _trie()
for word in dictionary:
reduce(dict.__getite... | Solution |
python | getsentry__sentry | src/sentry/incidents/utils/types.py | {
"start": 122,
"end": 258
} | class ____(TypedDict):
entity: str
subscription_id: str
values: Any
timestamp: datetime
@dataclass
| QuerySubscriptionUpdate |
python | tensorflow__tensorflow | tensorflow/python/ops/linalg/linear_operator_householder.py | {
"start": 1446,
"end": 11311
} | class ____(linear_operator.LinearOperator):
"""`LinearOperator` acting like a [batch] of Householder transformations.
This operator acts like a [batch] of householder reflections with shape
`[B1,...,Bb, N, N]` for some `b >= 0`. The first `b` indices index a
batch member. For every batch index `(i1,...,ib)`,... | LinearOperatorHouseholder |
python | numba__numba | numba/tests/test_interproc.py | {
"start": 236,
"end": 1099
} | class ____(unittest.TestCase):
def test_bar_call_foo(self):
global cfoo
cfoo = jit((int32, int32), nopython=True)(foo)
cbar = jit((int32, int32), nopython=True)(bar)
self.assertEqual(cbar(1, 2), 1 + 2 + 2)
def test_bar_call_foo_compiled_twice(self):
# When a function is... | TestInterProc |
python | huggingface__transformers | src/transformers/models/exaone4/modular_exaone4.py | {
"start": 20910,
"end": 20987
} | class ____(LlamaForTokenClassification):
pass
| Exaone4ForTokenClassification |
python | great-expectations__great_expectations | great_expectations/exceptions/exceptions.py | {
"start": 12339,
"end": 12428
} | class ____(DatasourceInitializationError):
pass
| DatasourceKeyPairAuthBadPassphraseError |
python | pypa__pipenv | pipenv/patched/pip/_vendor/rich/tree.py | {
"start": 380,
"end": 8446
} | class ____(JupyterMixin):
"""A renderable for a tree structure.
Attributes:
ASCII_GUIDES (GuideType): Guide lines used when Console.ascii_only is True.
TREE_GUIDES (List[GuideType, GuideType, GuideType]): Default guide lines.
Args:
label (RenderableType): The renderable or str for ... | Tree |
python | apache__airflow | providers/google/tests/unit/google/cloud/operators/test_managed_kafka.py | {
"start": 14778,
"end": 16180
} | class ____:
@mock.patch(MANAGED_KAFKA_PATH.format("types.ListConsumerGroupsResponse.to_dict"))
@mock.patch(MANAGED_KAFKA_PATH.format("types.ConsumerGroup.to_dict"))
@mock.patch(MANAGED_KAFKA_PATH.format("ManagedKafkaHook"))
def test_execute(self, mock_hook, to_cluster_dict_mock, to_clusters_dict_mock):
... | TestManagedKafkaListConsumerGroupsOperator |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/sql/ddl.py | {
"start": 33290,
"end": 34021
} | class ____(TableDropDDL):
"""Represent a DROP TABLE statement."""
__visit_name__ = "drop_table"
def __init__(self, element: Table, if_exists: bool = False) -> None:
"""Create a :class:`.DropTable` construct.
:param element: a :class:`_schema.Table` that's the subject
of the DROP.... | DropTable |
python | encode__httpx | httpx/_client.py | {
"start": 19412,
"end": 42349
} | class ____(BaseClient):
"""
An HTTP client, with connection pooling, HTTP/2, redirects, cookie persistence, etc.
It can be shared between threads.
Usage:
```python
>>> client = httpx.Client()
>>> response = client.get('https://example.org')
```
**Parameters:**
* **auth** - *... | Client |
python | kamyu104__LeetCode-Solutions | Python/count-lattice-points-inside-a-circle.py | {
"start": 80,
"end": 538
} | class ____(object):
def countLatticePoints(self, circles):
"""
:type circles: List[List[int]]
:rtype: int
"""
lookup = set()
for x, y, r in circles:
for i in xrange(-r, r+1):
for j in xrange(-r, r+1):
if i**2+j**2 <= r**... | Solution |
python | getsentry__sentry | tests/sentry/api/endpoints/test_organization_releases.py | {
"start": 94996,
"end": 98712
} | class ____(ReleaseCommitPatchTest):
@cached_property
def url(self):
return reverse(
"sentry-api-0-organization-releases", kwargs={"organization_id_or_slug": self.org.slug}
)
def test_commits_with_patch_set(self) -> None:
response = self.client.post(
self.url,... | OrganizationReleaseCreateCommitPatch |
python | pytorch__pytorch | test/dynamo/test_higher_order_ops.py | {
"start": 158036,
"end": 160426
} | class ____(torch.nn.Module):
def forward(self, L_x_: "f32[5]"):
l_x_ = L_x_
_saved_tensors_hooks_disable = torch._C._autograd._saved_tensors_hooks_disable("torch.func.{grad, vjp, jacrev, hessian} don't yet support saved tensor hooks. Please open an issue with your use case."); _saved_tensors_hooks... | GraphModule |
python | huggingface__transformers | tests/models/phi4_multimodal/test_modeling_phi4_multimodal.py | {
"start": 9398,
"end": 15196
} | class ____(unittest.TestCase):
checkpoint_path = "microsoft/Phi-4-multimodal-instruct"
revision = "refs/pr/70"
image_url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/australia.jpg"
audio_url = "https://huggingface.co/datasets/raushan-testing-hf/audi... | Phi4MultimodalIntegrationTest |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/conditional_virtual_dependency/package.py | {
"start": 216,
"end": 573
} | class ____(Package):
"""Brings in a virtual dependency if certain conditions are met."""
homepage = "https://dev.null"
version("1.0")
variant("stuff", default=True, description="nope")
variant("mpi", default=False, description="nope")
depends_on("stuff", when="+stuff")
depends_on("mpi", ... | ConditionalVirtualDependency |
python | xlwings__xlwings | xlwings/conversion/standard.py | {
"start": 5309,
"end": 5716
} | class ____:
def __init__(self, options):
self.options = options
def __call__(self, ctx):
if Markdown and isinstance(ctx.source_value, Markdown):
markdown.format_text(
ctx.range, ctx.source_value.text, ctx.source_value.style
)
if "formatter" in sel... | FormatStage |
python | keras-team__keras | keras/src/layers/preprocessing/image_preprocessing/solarization.py | {
"start": 370,
"end": 8015
} | class ____(BaseImagePreprocessingLayer):
"""Applies `(max_value - pixel + min_value)` for each pixel in the image.
When created without `threshold` parameter, the layer performs solarization
to all values. When created with specified `threshold` the layer only
augments pixels that are above the `thresh... | Solarization |
python | scrapy__scrapy | tests/test_downloader_handler_twisted_http2.py | {
"start": 6864,
"end": 6958
} | class ____(H2DownloadHandlerMixin, TestHttpsWrongHostnameBase):
pass
| TestHttps2WrongHostname |
python | astropy__astropy | astropy/io/votable/exceptions.py | {
"start": 32155,
"end": 32837
} | class ____(VOTableSpecWarning):
"""
``VALUES`` elements that reference another element should not have
their own content.
From the VOTable 1.2 spec:
The ``ref`` attribute of a ``VALUES`` element can be used to
avoid a repetition of the domain definition, by referring to a
previ... | W44 |
python | pytorch__pytorch | test/mobile/model_test/nn_ops.py | {
"start": 2874,
"end": 4077
} | class ____(torch.nn.Module):
def __init__(self) -> None:
super().__init__()
self.input1d = torch.randn(1, 4, 50)
self.module1d = nn.ModuleList(
[
nn.ReflectionPad1d(2),
nn.ReplicationPad1d(2),
nn.ConstantPad1d(2, 3.5),
]... | NNPaddingModule |
python | ansible__ansible | lib/ansible/_internal/_ssh/_ssh_agent.py | {
"start": 4300,
"end": 4883
} | class ____(int, VariableSized):
def to_blob(self) -> bytes:
if self < 0:
raise ValueError("negative mpint not allowed")
if not self:
return b""
nbytes = (self.bit_length() + 8) // 8
ret = bytearray(self.to_bytes(length=nbytes, byteorder='big'))
ret[:0]... | mpint |
python | wandb__wandb | wandb/automations/_generated/input_types.py | {
"start": 352,
"end": 819
} | class ____(GQLInput):
entity_name: str = Field(alias="entityName")
url_endpoint: str = Field(alias="urlEndpoint")
name: str = Field(max_length=64, pattern="^[-\\w]+([ ]+[-\\w]+)*$")
secret_ref: Optional[str] = Field(alias="secretRef", default=None)
access_token_ref: Optional[str] = Field(alias="acce... | CreateGenericWebhookIntegrationInput |
python | pytorch__pytorch | torch/fx/experimental/proxy_tensor.py | {
"start": 43659,
"end": 43739
} | class ____:
proxy: _PySymProxyType
value: PySymType
| _SympyExprTrackerValue |
python | tensorflow__tensorflow | tensorflow/python/checkpoint/checkpoint.py | {
"start": 86102,
"end": 114922
} | class ____(autotrackable.AutoTrackable):
"""Manages saving/restoring trackable values to disk.
TensorFlow objects may contain trackable state, such as `tf.Variable`s,
`tf.keras.optimizers.Optimizer` implementations, `tf.data.Dataset` iterators,
`tf.keras.Layer` implementations, or `tf.keras.Model` implementat... | Checkpoint |
python | pytorch__pytorch | torch/fx/experimental/migrate_gradual_types/constraint.py | {
"start": 10451,
"end": 11986
} | class ____(Constraint):
def __init__(
self,
conv_result,
input_var,
c_out,
kernel,
padding,
stride,
dilation,
matching_constraint_vars,
):
"""
:param conv_result: the convolution result
:param input_var: input to con... | CalcConv |
python | apache__airflow | providers/edge3/src/airflow/providers/edge3/worker_api/datamodels_ui.py | {
"start": 1534,
"end": 1669
} | class ____(BaseModel):
"""Worker Collection serializer."""
workers: list[Worker]
total_entries: int
| WorkerCollectionResponse |
python | jina-ai__jina | jina/proto/docarray_v1/pb/jina_pb2_grpc.py | {
"start": 9234,
"end": 10053
} | class ____(object):
"""*
jina streaming gRPC service.
"""
@staticmethod
def Call(
request_iterator,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
tim... | JinaRPC |
python | huggingface__transformers | tests/models/bark/test_modeling_bark.py | {
"start": 36328,
"end": 48323
} | class ____(unittest.TestCase):
@cached_property
def model(self):
return BarkModel.from_pretrained("suno/bark", revision="refs/pr/25", trust_remote_code=True).to(torch_device)
@cached_property
def processor(self):
return BarkProcessor.from_pretrained("suno/bark")
@cached_property
... | BarkModelIntegrationTests |
python | pypa__setuptools | setuptools/tests/test_manifest.py | {
"start": 3967,
"end": 9266
} | class ____(TempDirTestCase):
def setup_method(self, method):
super().setup_method(method)
f = open(os.path.join(self.temp_dir, 'setup.py'), 'w', encoding="utf-8")
f.write(SETUP_PY)
f.close()
"""
Create a file tree like:
- LICENSE
- README.rst
... | TestManifestTest |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/orm/util.py | {
"start": 21850,
"end": 29042
} | class ____(
inspection.Inspectable["AliasedInsp[_O]"], ORMColumnsClauseRole[_O]
):
r"""Represents an "aliased" form of a mapped class for usage with Query.
The ORM equivalent of a :func:`~sqlalchemy.sql.expression.alias`
construct, this object mimics the mapped class using a
``__getattr__`` scheme ... | AliasedClass |
python | apache__airflow | providers/standard/src/airflow/providers/standard/operators/trigger_dagrun.py | {
"start": 4034,
"end": 19358
} | class ____(BaseOperator):
"""
Triggers a DAG run for a specified DAG ID.
Note that if database isolation mode is enabled, not all features are supported.
:param trigger_dag_id: The ``dag_id`` of the DAG to trigger (templated).
:param trigger_run_id: The run ID to use for the triggered DAG run (tem... | TriggerDagRunOperator |
python | explosion__spaCy | setup.py | {
"start": 3001,
"end": 3398
} | class ____:
def build_options(self):
for e in self.extensions:
e.extra_compile_args += COMPILE_OPTIONS.get(
self.compiler.compiler_type, COMPILE_OPTIONS["other"]
)
for e in self.extensions:
e.extra_link_args += LINK_OPTIONS.get(
sel... | build_ext_options |
python | lazyprogrammer__machine_learning_examples | unsupervised_class2/xwing.py | {
"start": 1238,
"end": 3879
} | class ____(object):
def __init__(self, hidden_layer_sizes):
self.hidden_layer_sizes = hidden_layer_sizes
def fit(self, X, learning_rate=0.5, mu=0.99, epochs=50, batch_sz=100, show_fig=False):
# cast hyperparams
learning_rate = np.float32(learning_rate)
mu = np.float32(mu)
... | DeepAutoEncoder |
python | huggingface__transformers | src/transformers/models/clap/processing_clap.py | {
"start": 768,
"end": 1495
} | class ____(ProcessorMixin):
r"""
Constructs a CLAP processor which wraps a CLAP feature extractor and a RoBerta tokenizer into a single processor.
[`ClapProcessor`] offers all the functionalities of [`ClapFeatureExtractor`] and [`RobertaTokenizerFast`]. See the
[`~ClapProcessor.__call__`] and [`~ClapPr... | ClapProcessor |
python | scipy__scipy | scipy/optimize/_nonlin.py | {
"start": 31694,
"end": 35949
} | class ____(GenericBroyden):
"""
Find a root of a function, using (extended) Anderson mixing.
The Jacobian is formed by for a 'best' solution in the space
spanned by last `M` vectors. As a result, only a MxM matrix
inversions and MxN multiplications are required. [Ey]_
Parameters
----------... | Anderson |
python | ray-project__ray | python/ray/air/integrations/wandb.py | {
"start": 17129,
"end": 29081
} | class ____(LoggerCallback):
"""WandbLoggerCallback
Weights and biases (https://www.wandb.ai/) is a tool for experiment
tracking, model optimization, and dataset versioning. This Ray Tune
``LoggerCallback`` sends metrics to Wandb for automatic tracking and
visualization.
Example:
.. te... | WandbLoggerCallback |
python | apache__airflow | airflow-core/src/airflow/api_fastapi/auth/middlewares/refresh_token.py | {
"start": 1293,
"end": 3099
} | class ____(BaseHTTPMiddleware):
"""
Middleware to handle JWT token refresh.
This middleware:
1. Extracts JWT token from cookies and build the user from the token
2. Calls ``refresh_user`` method from auth manager with the user
3. If ``refresh_user`` returns a user, generate a JWT token based up... | JWTRefreshMiddleware |
python | joke2k__faker | faker/providers/person/es_CL/__init__.py | {
"start": 141,
"end": 58496
} | class ____(PersonProvider):
formats_male = OrderedDict(
[
("{{given_name_male}} {{last_name}} {{last_name}}", 0.55),
("{{first_name_male}} {{last_name}} {{last_name}}", 0.25),
("{{first_name_male}} {{last_name}}", 0.17),
("{{given_name_male}} {{last_name}}-{{l... | Provider |
python | weaviate__weaviate-python-client | weaviate/collections/classes/grpc.py | {
"start": 19386,
"end": 19466
} | class ____(_QueryReference):
target_collection: str
| _QueryReferenceMultiTarget |
python | Farama-Foundation__Gymnasium | gymnasium/envs/phys2d/cartpole.py | {
"start": 8796,
"end": 9890
} | class ____(FunctionalJaxVectorEnv, EzPickle):
"""Jax-based implementation of the vectorized CartPole environment."""
metadata = {
"render_modes": ["rgb_array"],
"render_fps": 50,
"jax": True,
"autoreset_mode": AutoresetMode.NEXT_STEP,
}
def __init__(
self,
... | CartPoleJaxVectorEnv |
python | numba__numba | numba/core/types/misc.py | {
"start": 3455,
"end": 3825
} | class ____(Type):
"""
Pointer to a Numba "meminfo" (i.e. the information for a managed
piece of memory).
"""
mutable = True
def __init__(self, dtype):
self.dtype = dtype
name = "memory-managed *%s" % dtype
super(MemInfoPointer, self).__init__(name)
@property
def... | MemInfoPointer |
python | walkccc__LeetCode | solutions/1659. Maximize Grid Happiness/1659.py | {
"start": 0,
"end": 2113
} | class ____:
def getMaxGridHappiness(
self,
m: int,
n: int,
introvertsCount: int,
extrovertsCount: int,
) -> int:
def getPlacementCost(
i: int,
j: int,
inMask: int,
exMask: int,
diff: int,
) -> int:
"""Calculates the cost based on le... | Solution |
python | getsentry__sentry | src/sentry/api/bases/organization.py | {
"start": 6225,
"end": 6440
} | class ____(OrganizationPermission):
scope_map = {
"GET": ["org:read"],
"POST": ["org:admin"],
"PUT": ["org:admin"],
"DELETE": ["org:admin"],
}
| OrganizationAuthProviderPermission |
python | ray-project__ray | python/ray/llm/_internal/common/utils/cloud_utils.py | {
"start": 11289,
"end": 16164
} | class ____:
"""A cache that works with both sync and async fetch functions.
The purpose of this data structure is to cache the result of a function call
usually used to fetch a value from a cloud object store.
The idea is this:
- Cloud operations are expensive
- In LoRA specifically, we would ... | CloudObjectCache |
python | pytorch__pytorch | torch/_inductor/pattern_matcher.py | {
"start": 28823,
"end": 28893
} | class ____(_TargetExprVarArgs):
op = "call_method"
| CallMethodVarArgs |
python | mahmoud__boltons | boltons/socketutils.py | {
"start": 25631,
"end": 26146
} | class ____(socket.timeout, Error):
"""Inheriting from :exc:`socket.timeout`, Timeout is used to indicate
when a socket operation did not complete within the time
specified. Raised from any of :class:`BufferedSocket`'s ``recv``
methods.
"""
def __init__(self, timeout, extra=""):
msg = 'so... | Timeout |
python | ApeWorX__ape | src/ape/api/providers.py | {
"start": 7160,
"end": 32211
} | class ____(BaseInterfaceModel):
"""
An abstraction of a connection to a network in an ecosystem. Example ``ProviderAPI``
implementations include the `ape-infura <https://github.com/ApeWorX/ape-infura>`__
plugin or the `ape-hardhat <https://github.com/ApeWorX/ape-hardhat>`__ plugin.
"""
# TODO: ... | ProviderAPI |
python | altair-viz__altair | altair/vegalite/v6/schema/core.py | {
"start": 1557053,
"end": 1557263
} | class ____(SingleTimeUnit):
"""UtcSingleTimeUnit schema wrapper."""
_schema = {"$ref": "#/definitions/UtcSingleTimeUnit"}
def __init__(self, *args):
super().__init__(*args)
| UtcSingleTimeUnit |
python | pytorch__pytorch | torch/_inductor/compiler_bisector.py | {
"start": 511,
"end": 2401
} | class ____(BinarySubsystem):
name: str = field(init=False)
config_name: str
config_field: str
config_value: object
def __post_init__(self) -> None:
self.name = f"{self.config_name}_{self.config_field}"
# Dictionary of backend -> subsystems
BACKENDS: dict[str, list[Subsystem]] = {
# ru... | ConfigChange |
python | getsentry__sentry | tests/sentry/middleware/test_access_log_middleware.py | {
"start": 12185,
"end": 12408
} | class ____(LogCaptureAPITestCase):
endpoint = "dummy-fail-endpoint"
def test_access_log_fail(self) -> None:
self.get_error_response(status_code=500)
self.assert_access_log_recorded()
| TestAccessLogFail |
python | tensorflow__tensorflow | tensorflow/python/autograph/pyct/static_analysis/reaching_fndefs.py | {
"start": 1232,
"end": 2161
} | class ____(object):
"""Abstraction for the state of the CFG walk for reaching definition analysis.
This is a value type. Only implements the strictly necessary operators.
Attributes:
value: Dict[qual_names.QN, Set[Definition, ...]], the defined symbols and
their possible definitions
"""
def __i... | _NodeState |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/typeNarrowingIsinstance6.py | {
"start": 1097,
"end": 1137
} | class ____(Generic[_T2]):
pass
| ParentB |
python | keras-team__keras | keras/src/ops/image.py | {
"start": 20209,
"end": 25505
} | class ____(Operation):
def __init__(
self,
size,
strides=None,
dilation_rate=1,
padding="valid",
data_format=None,
*,
name=None,
):
super().__init__(name=name)
if isinstance(size, int):
size = (size, size)
self.s... | ExtractPatches |
python | gevent__gevent | src/gevent/tests/test__greenlet.py | {
"start": 27555,
"end": 27673
} | class ____(TestKill):
def _start_greenlet(self, g):
g.start_later(timing.LARGE_TICK)
| TestKillAfterStartLater |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.