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 | weaviate__weaviate-python-client | weaviate/collections/data/sync.py | {
"start": 362,
"end": 822
} | class ____(Generic[Properties], _DataCollectionExecutor[ConnectionSync]):
def with_data_model(self, data_model: Type[TProperties]) -> "_DataCollection[TProperties]":
_check_properties_generic(data_model)
return _DataCollection[TProperties](
self._connection,
self.name,
... | _DataCollection |
python | docker__docker-py | docker/api/volume.py | {
"start": 31,
"end": 5119
} | class ____:
def volumes(self, filters=None):
"""
List volumes currently registered by the docker daemon. Similar to the
``docker volume ls`` command.
Args:
filters (dict): Server-side list filtering options.
Returns:
(dict): Dictionary with list of v... | VolumeApiMixin |
python | huggingface__transformers | src/transformers/models/instructblip/modeling_instructblip.py | {
"start": 20905,
"end": 21633
} | class ____(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
def forward(sel... | InstructBlipQFormerSelfOutput |
python | django__django | tests/i18n/forms.py | {
"start": 396,
"end": 496
} | class ____(forms.Form):
date_field = forms.DateField(widget=forms.SelectDateWidget)
| SelectDateForm |
python | openai__openai-python | src/openai/cli/_api/chat/completions.py | {
"start": 2541,
"end": 2619
} | class ____(NamedTuple):
role: ChatCompletionRole
content: str
| CLIMessage |
python | tensorflow__tensorflow | tensorflow/python/data/experimental/ops/prefetching_ops.py | {
"start": 3567,
"end": 9750
} | class ____(dataset_ops.UnaryUnchangedStructureDataset):
"""A `Dataset` that copies elements to another device."""
def __init__(self, input_dataset, target_device, source_device="/cpu:0"):
"""Constructs a _CopyToDeviceDataset.
Args:
input_dataset: `Dataset` to be copied
target_device: The name ... | _CopyToDeviceDataset |
python | apache__airflow | providers/amazon/src/airflow/providers/amazon/aws/hooks/glue.py | {
"start": 21194,
"end": 26139
} | class ____(AwsBaseHook):
"""
Interact with AWS Glue Data Quality.
Provide thick wrapper around :external+boto3:py:class:`boto3.client("glue") <Glue.Client>`.
Additional arguments (such as ``aws_conn_id``) may be specified and
are passed down to the underlying AwsBaseHook.
.. seealso::
... | GlueDataQualityHook |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/methodOverride4.py | {
"start": 561,
"end": 746
} | class ____(BaseA[_TSource]):
def method1(
self, mapper: Callable[[_TSource, _T2], _TResult], other: BaseA[_T2]
) -> BaseA[_TResult]:
return SubclassA2()
| SubclassA1 |
python | ansible__ansible | lib/ansible/modules/hostname.py | {
"start": 24242,
"end": 24369
} | class ____(Hostname):
platform = 'Linux'
distribution = 'Cumulus-linux'
strategy_class = FileStrategy
| CumulusHostname |
python | getsentry__sentry | src/sentry/sentry_metrics/consumers/indexer/tags_validator.py | {
"start": 810,
"end": 965
} | class ____(TagsValidator):
"""
The release health pipeline has the same limits as the default tags limit enforcer.
"""
| ReleaseHealthTagsValidator |
python | coleifer__peewee | tests/regressions.py | {
"start": 48799,
"end": 50326
} | class ____(ModelTestCase):
requires = [FKF_A, FKF_B]
def test_query_with_model_instance_param(self):
a1 = FKF_A.create(key='k1')
a2 = FKF_A.create(key='k2')
b1 = FKF_B.create(fk_a_1=a1, fk_a_2=a1)
b2 = FKF_B.create(fk_a_1=a2, fk_a_2=a2)
# Ensure that UPDATE works as exp... | TestQueryWithModelInstanceParam |
python | run-llama__llama_index | llama-index-integrations/postprocessor/llama-index-postprocessor-ibm/tests/test_ibm.py | {
"start": 73,
"end": 1405
} | class ____:
TEST_URL = "https://us-south.ml.cloud.ibm.com"
TEST_APIKEY = "test_apikey"
TEST_PROJECT_ID = "test_project_id"
TEST_MODEL = "test_rerank_model"
def test_initialization(self) -> None:
with pytest.raises(ValueError, match=r"^Did not find"):
_ = WatsonxRerank(model_id=... | TestWasonxRerank |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/orm/exc.py | {
"start": 5520,
"end": 5641
} | class ____(sa_exc.InvalidRequestError):
"""Mapping operation was requested on an unknown column."""
| UnmappedColumnError |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/distributions/special_math_test.py | {
"start": 12735,
"end": 13374
} | class ____(test.TestCase):
def testErfInvValues(self):
with self.cached_session():
if not special:
return
x = np.linspace(0., 1.0, 50).astype(np.float64)
expected_x = special.erfinv(x)
x = special_math.erfinv(x)
self.assertAllClose(expected_x, self.evaluate(x), atol=0.)
... | ErfInvTest |
python | python-attrs__attrs | typing-examples/mypy.py | {
"start": 7293,
"end": 7599
} | class ____:
a: list[int] = attr.ib(default=attr.Factory(list))
b: list[Any] = attr.ib(default=attr.Factory(list, False))
c: list[int] = attr.ib(default=attr.Factory((lambda s: s.a), True))
attr.asdict(FactoryTest(), tuple_keys=True)
# Check match_args stub
@attr.s(match_args=False)
| FactoryTest |
python | tensorflow__tensorflow | tensorflow/tools/graph_transforms/python/transform_graph_test.py | {
"start": 1025,
"end": 3153
} | class ____(test.TestCase):
# This test constructs a graph with a relu op that's not used by the normal
# inference path, and then tests that the strip_unused transform removes it as
# expected.
def testTransformGraph(self):
input_graph_def = graph_pb2.GraphDef()
const_op1 = input_graph_def.node.add()
... | TransformGraphTest |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/paramInference2.py | {
"start": 608,
"end": 743
} | class ____:
def method1(self, fn: Callable[P, R], *args: P.args, **kwargs: P.kwargs) -> R:
return fn(*args, **kwargs)
| Parent2 |
python | gevent__gevent | src/greentest/3.10/test_socket.py | {
"start": 198363,
"end": 198619
} | class ____(FileObjectClassTestCase):
"""Tests for socket.makefile() in text mode (rather than binary)"""
read_mode = 'r'
read_msg = MSG.decode('utf-8')
write_mode = 'wb'
write_msg = MSG
newline = ''
| UnicodeReadFileObjectClassTestCase |
python | pypa__warehouse | warehouse/sessions.py | {
"start": 2002,
"end": 6914
} | class ____(dict):
_csrf_token_key = "_csrf_token"
_flash_key = "_flash_messages"
_totp_secret_key = "_totp_secret"
_webauthn_challenge_key = "_webauthn_challenge"
_reauth_timestamp_key = "_reauth_timestamp"
_password_timestamp_key = "_password_timestamp"
# A number of our methods need to be... | Session |
python | huggingface__transformers | src/transformers/models/canine/configuration_canine.py | {
"start": 792,
"end": 6584
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`CanineModel`]. It is used to instantiate an
CANINE model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar config... | CanineConfig |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/definitions/definitions_class.py | {
"start": 5151,
"end": 12165
} | class ____(NamedTuple):
jobs: Iterable[Union[JobDefinition, UnresolvedAssetJobDefinition]]
schedules: Iterable[Union[ScheduleDefinition, UnresolvedPartitionedAssetScheduleDefinition]]
sensors: Iterable[SensorDefinition]
def _io_manager_needs_replacement(job: JobDefinition, resource_defs: Mapping[str, Any]... | _AttachedObjects |
python | huggingface__transformers | src/transformers/models/rt_detr_v2/configuration_rt_detr_v2.py | {
"start": 1399,
"end": 18858
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`RTDetrV2Model`]. It is used to instantiate a
RT-DETR model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar conf... | RTDetrV2Config |
python | django__django | tests/db_functions/math/test_log.py | {
"start": 180,
"end": 1858
} | class ____(TestCase):
def test_null(self):
IntegerModel.objects.create(big=100)
obj = IntegerModel.objects.annotate(
null_log_small=Log("small", "normal"),
null_log_normal=Log("normal", "big"),
null_log_big=Log("big", "normal"),
).first()
self.asse... | LogTests |
python | numba__numba | numba/tests/test_datamodel.py | {
"start": 757,
"end": 820
} | class ____(test_factory()):
fe_type = types.uint32
| TestUInt32 |
python | getsentry__sentry | src/sentry/snuba/query_subscriptions/consumer.py | {
"start": 7299,
"end": 7355
} | class ____(InvalidMessageError):
pass
| InvalidSchemaError |
python | pandas-dev__pandas | pandas/tests/api/test_api.py | {
"start": 937,
"end": 5879
} | class ____(Base):
# these are optionally imported based on testing
# & need to be ignored
ignored = ["tests", "locale", "conftest", "_version_meson"]
# top-level sub-packages
public_lib = [
"api",
"arrays",
"options",
"test",
"testing",
"errors",
... | TestPDApi |
python | bokeh__bokeh | src/bokeh/models/glyphs.py | {
"start": 3619,
"end": 5342
} | class ____(XYGlyph, LineGlyph, FillGlyph, HatchGlyph):
''' Base class for glyphs that are simple markers with line and
fill properties, located at an (x, y) location with a specified
size.
See :class:`~bokeh.models.glyphs.Scatter` for an overview
of all the builtin marker types.
.. note::
... | Marker |
python | great-expectations__great_expectations | great_expectations/expectations/core/expect_column_proportion_of_non_null_values_to_be_between.py | {
"start": 2807,
"end": 17884
} | class ____(ColumnAggregateExpectation):
__doc__ = f"""{EXPECTATION_SHORT_DESCRIPTION}
For example, in a column containing [1, 2, None, 3, None, None, 4, 4, 4, 4], there are \
7 non-null values and 10 total values for a proportion of 0.7.
ExpectColumnProportionOfNonNullValuesToBeBetween is a \
Colu... | ExpectColumnProportionOfNonNullValuesToBeBetween |
python | celery__celery | t/unit/worker/test_control.py | {
"start": 3287,
"end": 28525
} | class ____:
def setup_method(self):
self.panel = self.create_panel(consumer=Consumer(self.app))
@self.app.task(name='c.unittest.mytask', rate_limit=200, shared=False)
def mytask():
pass
self.mytask = mytask
def create_state(self, **kwargs):
kwargs.setdefaul... | test_ControlPanel |
python | numpy__numpy | numpy/_core/tests/test_multiarray.py | {
"start": 67216,
"end": 70340
} | class ____:
def test_test_interning(self):
a0 = np.bool(0)
b0 = np.bool(False)
assert_(a0 is b0)
a1 = np.bool(1)
b1 = np.bool(True)
assert_(a1 is b1)
assert_(np.array([True])[0] is a1)
assert_(np.array(True)[()] is a1)
def test_sum(self):
... | TestBool |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 1056322,
"end": 1059541
} | class ____(sgqlc.types.Type, Node):
"""A GitHub App."""
__schema__ = github_schema
__field_names__ = (
"created_at",
"database_id",
"description",
"ip_allow_list_entries",
"logo_background_color",
"logo_url",
"name",
"slug",
"updated_a... | App |
python | PyCQA__pylint | tests/functional/c/ctor_arguments.py | {
"start": 269,
"end": 399
} | class ____:
def __init__(self, first_argument, second_argument, third_argument):
"""three arguments function"""
| Class3Arg |
python | django__django | tests/queries/tests.py | {
"start": 178170,
"end": 178537
} | class ____(SimpleTestCase):
def test_invalid_values(self):
msg = "Field 'id' expected a number but got 'abc'."
with self.assertRaisesMessage(ValueError, msg):
Annotation.objects.filter(tag="abc")
with self.assertRaisesMessage(ValueError, msg):
Annotation.objects.filte... | TestInvalidValuesRelation |
python | fastai__fastai | fastai/text/models/core.py | {
"start": 2380,
"end": 3897
} | class ____(nn.Sequential):
"A sequential module that passes the reset call to its children."
def reset(self):
for c in self.children(): getcallable(c, 'reset')()
# %% ../../../nbs/33_text.models.core.ipynb 12
def get_language_model(
arch, # Function or class that can generate a language model archi... | SequentialRNN |
python | rq__rq | rq/scheduler.py | {
"start": 854,
"end": 8360
} | class ____:
# STARTED: scheduler has been started but sleeping
# WORKING: scheduler is in the midst of scheduling jobs
# STOPPED: scheduler is in stopped condition
Status = SchedulerStatus
def __init__(
self,
queues,
connection: Redis,
interval=1,
logging_le... | RQScheduler |
python | django-import-export__django-import-export | import_export/formats/base_formats.py | {
"start": 373,
"end": 1436
} | class ____:
def get_title(self):
return type(self)
def create_dataset(self, in_stream):
"""
Create dataset from given string.
"""
raise NotImplementedError()
def export_data(self, dataset, **kwargs):
"""
Returns format representation for given datase... | Format |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/sql/schema.py | {
"start": 197795,
"end": 204933
} | class ____(
DialectKWArgs, ColumnCollectionMixin, HasConditionalDDL, SchemaItem
):
"""A table-level INDEX.
Defines a composite (one or more column) INDEX.
E.g.::
sometable = Table(
"sometable",
metadata,
Column("name", String(50)),
Column("addre... | Index |
python | ray-project__ray | python/ray/dashboard/modules/aggregator/publisher/ray_event_publisher.py | {
"start": 1441,
"end": 9919
} | class ____(RayEventPublisherInterface):
"""RayEvents publisher that publishes batches of events to a destination by running a worker loop.
The worker loop continuously pulls batches from the event buffer and publishes them to the destination.
"""
def __init__(
self,
name: str,
... | RayEventPublisher |
python | django__django | tests/syndication_tests/feeds.py | {
"start": 2429,
"end": 2609
} | class ____(TestRss2Feed):
@common_decorator
def item_description(self, item):
return f"Overridden item description: {item.title}"
| TestRss2FeedWithWrongDecoratedMethod |
python | run-llama__llama_index | llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/repository/github_client.py | {
"start": 4735,
"end": 18913
} | class ____:
"""
An asynchronous client for interacting with the Github API.
This client is used for making API requests to Github.
It provides methods for accessing the Github API endpoints.
The client supports two authentication methods:
1. Personal Access Token (PAT) - passed as github_token ... | GithubClient |
python | apache__airflow | airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py | {
"start": 29725,
"end": 32171
} | class ____(TestBackfillEndpoint):
def test_pause_backfill(self, session, test_client):
(dag,) = self._create_dag_models()
from_date = timezone.utcnow()
to_date = timezone.utcnow()
backfill = Backfill(dag_id=dag.dag_id, from_date=from_date, to_date=to_date)
session.add(backfil... | TestPauseBackfill |
python | pytorch__pytorch | torch/_dynamo/polyfills/pytree.py | {
"start": 4127,
"end": 4370
} | class ____(str):
__slots__ = ()
def __new__(cls) -> Self:
return super().__new__(cls, "*")
def __repr__(self) -> str:
return "*" # no quotes
_asterisk = _Asterisk()
del _Asterisk
@dataclass(frozen=True)
| _Asterisk |
python | kamyu104__LeetCode-Solutions | Python/number-of-1-bits.py | {
"start": 197,
"end": 728
} | class ____(object):
# @param n, an integer
# @return an integer
def hammingWeight(self, n):
n = (n & 0x55555555) + ((n >> 1) & 0x55555555)
n = (n & 0x33333333) + ((n >> 2) & 0x33333333)
n = (n & 0x0F0F0F0F) + ((n >> 4) & 0x0F0F0F0F)
n = (n & 0x00FF00FF) + ((n >> 8) & 0x00FF00... | Solution |
python | dagster-io__dagster | python_modules/libraries/dagster-tableau/dagster_tableau_tests/test_component.py | {
"start": 3742,
"end": 5495
} | class ____(TestTranslation):
"""Test translation of asset attributes for Tableau components."""
def test_translation(
self,
workspace_data,
attributes: Mapping[str, Any],
assertion: Callable[[AssetSpec], bool],
key_modifier: Optional[Callable[[AssetKey], AssetKey]],
... | TestTableauTranslation |
python | getsentry__sentry | tests/acceptance/test_project_keys.py | {
"start": 221,
"end": 1364
} | class ____(AcceptanceTestCase, SnubaTestCase):
def setUp(self) -> None:
super().setUp()
self.user = self.create_user("foo@example.com")
self.org = self.create_organization(name="Rowdy Tiger", owner=None)
self.team = self.create_team(organization=self.org, name="Mariachi Band")
... | ProjectKeysTest |
python | dagster-io__dagster | examples/docs_snippets/docs_snippets/concepts/ops_jobs_graphs/jobs_from_graphs.py | {
"start": 70,
"end": 644
} | class ____(dg.ConfigurableResource):
def ping_server(self): ...
@dg.op
def interact_with_server(server: Server):
server.ping_server()
@dg.graph
def do_stuff():
interact_with_server()
# end_define_graph
# start_define_jobs
import dagster as dg
prod_server = dg.ResourceDefinition.mock_resource()
local... | Server |
python | langchain-ai__langchain | libs/langchain/langchain_classic/output_parsers/boolean.py | {
"start": 72,
"end": 1763
} | class ____(BaseOutputParser[bool]):
"""Parse the output of an LLM call to a boolean."""
true_val: str = "YES"
"""The string value that should be parsed as True."""
false_val: str = "NO"
"""The string value that should be parsed as False."""
def parse(self, text: str) -> bool:
"""Parse ... | BooleanOutputParser |
python | pytorch__pytorch | torch/_dynamo/output_graph.py | {
"start": 6444,
"end": 7342
} | class ____:
def __init__(self) -> None:
self.cache: dict[VariableTrackerCacheKey, VariableTracker] = {}
def lookup(self, value: Any, source: Source) -> Optional[VariableTracker]:
key = VariableTrackerCacheKey(id(value), source)
if key not in self.cache:
return None
r... | VariableTrackerCache |
python | walkccc__LeetCode | solutions/2144. Minimum Cost of Buying Candies With Discount/2144.py | {
"start": 0,
"end": 114
} | class ____:
def minimumCost(self, cost: list[int]) -> int:
return sum(cost) - sum(sorted(cost)[-3::-3])
| Solution |
python | ansible__ansible | test/units/executor/module_common/test_module_common.py | {
"start": 2790,
"end": 4546
} | class ____:
"""Note: We may want to change the API of this function in the future. It isn't a great API"""
def test_no_interpreter_set(self, templar):
# normally this would return /usr/bin/python, but so long as we're defaulting to auto python discovery, we'll get
# an InterpreterDiscoveryRequi... | TestGetShebang |
python | pytorch__pytorch | test/torch_np/numpy_tests/linalg/test_linalg.py | {
"start": 44643,
"end": 51604
} | class ____(_TestNormBase):
def test_empty(self):
assert_equal(norm([]), 0.0)
assert_equal(norm(array([], dtype=self.dt)), 0.0)
assert_equal(norm(atleast_2d(array([], dtype=self.dt))), 0.0)
def test_vector_return_type(self):
a = np.array([1, 0, 1])
exact_types = "Bbhil" ... | _TestNormGeneral |
python | pytorch__pytorch | test/export/test_sparse.py | {
"start": 2020,
"end": 9228
} | class ____(TestCase):
def setUp(self):
super().setUp()
def assertEqualMeta(self, x, y):
self.assertIsInstance(x, FakeTensor)
self.assertIsInstance(y, torch.Tensor)
# Convert expected value to meta for comparison.
y = y.to("meta")
self.assertEqual(x, y, exact_lay... | TestSparseProp |
python | ray-project__ray | rllib/examples/envs/classes/multi_agent/pettingzoo_chess.py | {
"start": 232,
"end": 6917
} | class ____(MultiAgentEnv):
"""An interface to the PettingZoo MARL environment library.
See: https://github.com/Farama-Foundation/PettingZoo
Inherits from MultiAgentEnv and exposes a given AEC
(actor-environment-cycle) game from the PettingZoo project via the
MultiAgentEnv public API.
Note that t... | MultiAgentChess |
python | pytorch__pytorch | test/ao/sparsity/test_scheduler.py | {
"start": 237,
"end": 475
} | class ____(BaseScheduler):
def get_sl(self):
if self.last_epoch > 0:
return [group["sparsity_level"] * 0.5 for group in self.sparsifier.groups]
else:
return list(self.base_sl)
| ImplementedScheduler |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-zendesk-support/unit_tests/integrations/zs_responses/post_votes_response_builder.py | {
"start": 357,
"end": 774
} | class ____(HttpResponseBuilder):
@classmethod
def posts_votes_response(cls, request_without_cursor_for_pagination: Optional[HttpRequest] = None) -> "PostsVotesResponseBuilder":
return cls(
find_template("votes", __file__),
FieldPath("votes"),
CursorBasedPaginationStra... | PostsVotesResponseBuilder |
python | falconry__falcon | tests/test_recipes.py | {
"start": 4150,
"end": 5029
} | class ____:
class MediaEcho:
def on_post(self, req, resp):
resp.content_type = req.content_type
resp.media = req.get_media()
def test_text_plain_basic(self, util):
recipe = util.load_module('examples/recipes/plain_text_main.py')
app = falcon.App()
app.re... | TestTextPlainHandler |
python | pytorch__pytorch | torch/_inductor/template_heuristics/triton.py | {
"start": 66046,
"end": 67318
} | class ____(TMATemplateConfigMixin):
def _get_template_configs_impl(
self,
kernel_inputs: KernelInputs,
op_name: str,
) -> Generator[dict[str, Any], None, None]:
"""
Generate TMA template configs by calling super and adding TMA-specific options.
"""
base_op... | BlackwellTMATemplateConfigMixin |
python | scipy__scipy | scipy/sparse/linalg/_special_sparse_arrays.py | {
"start": 30268,
"end": 34361
} | class ____:
"""
Construct the Mikota pair of matrices in various formats and
eigenvalues of the generalized eigenproblem with them.
The Mikota pair of matrices [1, 2]_ models a vibration problem
of a linear mass-spring system with the ends attached where
the stiffness of the springs and the mas... | MikotaPair |
python | plotly__plotly.py | plotly/graph_objs/treemap/_stream.py | {
"start": 233,
"end": 3511
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "treemap"
_path_str = "treemap.stream"
_valid_props = {"maxpoints", "token"}
@property
def maxpoints(self):
"""
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50... | Stream |
python | pydantic__pydantic | .github/actions/people/people.py | {
"start": 5607,
"end": 5689
} | class ____(BaseModel):
"""Represents a GitHub label."""
name: str
| LabelNode |
python | joke2k__faker | faker/providers/date_time/vi_VN/__init__.py | {
"start": 46,
"end": 960
} | class ____(DateTimeProvider):
# Source: https://vi.wikipedia.org/wiki/%C4%90%E1%BB%8Bnh_d%E1%BA%A1ng_ng%C3%A0y_v%C3%A0_gi%E1%BB%9D_%E1%BB%9F_Vi%E1%BB%87t_Nam # NOQA
DAY_NAMES = {
"0": "Chủ Nhật",
"1": "Thứ Hai",
"2": "Thứ Ba",
"3": "Thứ Tư",
"4": "Thứ Năm",
"5": ... | Provider |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py | {
"start": 1727,
"end": 20345
} | class ____(GoogleBaseHook):
"""
Hook for interacting with Google Cloud Vertex AI Feature Store.
This hook provides an interface to manage Feature Store resources in Vertex AI,
including feature views and their synchronization operations. It handles authentication
and provides methods for common Fea... | FeatureStoreHook |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_background06.py | {
"start": 315,
"end": 1075
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("background06.xlsx")
self.ignore_elements = {"xl/worksheets/sheet1.xml": ["<pageSetup"]}
def test_create_file(self):
"""Test the cr... | TestCompareXLSXFiles |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/typeNarrowingIsinstance1.py | {
"start": 6356,
"end": 6934
} | class ____(Base15[int]):
value: int
def func15(x: Base15[T]):
if isinstance(x, Child15):
# This should generate an error. It's here just to ensure that
# this code branch isn't marked unreachable.
reveal_type(x, expected_text="Never")
reveal_type(x, expected_text="Child15")
... | Child15 |
python | django-extensions__django-extensions | tests/testapp/models.py | {
"start": 2840,
"end": 3833
} | class ____(models.Model):
"""
django-extensions from version 3.0 officially supports only Django 2.2+ which
introduced Meta.constraints and suggests using it instead of Meta.unique_together
this is left only to ensure compatibility with Meta.unique_together
"""
uniq_field = UniqField(
m... | PostWithUniqFieldCompat |
python | PyCQA__pylint | tests/functional/u/unpacking/unpacking_non_sequence.py | {
"start": 2030,
"end": 2558
} | class ____:
""" Check unpacking as instance attributes. """
def test(self):
""" test unpacking in instance attributes. """
self.a, self.b = 1, 2
self.a, self.b = {1: 2, 2: 3}
self.a, self.b = "xy"
self.a, c = "xy"
c, self.a = good_unpacking()
self.a, sel... | ClassUnpacking |
python | tensorflow__tensorflow | tensorflow/python/autograph/pyct/origin_info_test.py | {
"start": 1150,
"end": 11507
} | class ____(test.TestCase):
def test_create_source_map(self):
source = """
def test_fn(x):
return x + 1
"""
source = textwrap.dedent(source)
node = parser.parse(source)
fake_origin = origin_info.OriginInfo(
loc=origin_info.Location('fake_filename', 3, 7),
function_n... | OriginInfoTest |
python | scrapy__scrapy | scrapy/utils/log.py | {
"start": 1077,
"end": 6315
} | class ____(logging.Filter):
"""Keep only top level loggers' name (direct children from root) from
records.
This filter will replace Scrapy loggers' names with 'scrapy'. This mimics
the old Scrapy log behaviour and helps shortening long names.
Since it can't be set for just one logger (it won't pro... | TopLevelFormatter |
python | numpy__numpy | benchmarks/benchmarks/bench_manipulate.py | {
"start": 1993,
"end": 2159
} | class ____(ConcatenateStackArrays):
# Large number of small arrays to test GIL (non-)release
params = [[(1, 1)], [1000, 100000], TYPES1]
| ConcatenateNestedArrays |
python | google__pytype | pytype/rewrite/output_test.py | {
"start": 718,
"end": 2260
} | class ____(OutputTestBase):
def test_constant(self):
cls = self.make_value("""
class C:
X = 0
""")
pytd_cls = self.ctx.pytd_converter.to_pytd_def(cls)
self.assertPytdEqual(
pytd_cls,
"""
class C:
X: ClassVar[int]
""",
)
def test_method(self):
... | ClassToPytdDefTest |
python | astropy__astropy | astropy/io/votable/converters.py | {
"start": 25130,
"end": 27424
} | class ____(Numeric):
"""
The base class for all the integral datatypes.
"""
default = 0
def __init__(self, field, config=None, pos=None):
Numeric.__init__(self, field, config, pos)
def parse(self, value, config=None, pos=None):
if config is None:
config = {}
... | Integer |
python | pyca__cryptography | tests/hazmat/primitives/test_cmac.py | {
"start": 1155,
"end": 6635
} | class ____:
@pytest.mark.supported(
only_if=lambda backend: backend.cmac_algorithm_supported(
AES(fake_key)
),
skip_message="Does not support CMAC.",
)
@pytest.mark.parametrize("params", vectors_aes)
def test_aes_generate(self, backend, params):
key = params["... | TestCMAC |
python | kamyu104__LeetCode-Solutions | Python/make-array-non-decreasing-or-non-increasing.py | {
"start": 63,
"end": 646
} | class ____(object):
def convertArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
def f(nums):
result = 0
max_heap = []
for x in nums:
if max_heap and x < -max_heap[0]:
result += -heapq.heappop(... | Solution |
python | PrefectHQ__prefect | src/integrations/prefect-databricks/prefect_databricks/models/jobs.py | {
"start": 48317,
"end": 49342
} | class ____(BaseModel):
"""
See source code for the fields' description.
The result and lifecycle state of the run.
"""
model_config = ConfigDict(extra="allow", frozen=True)
life_cycle_state: Optional[RunLifeCycleState] = Field(
None,
description=(
"A description of... | RunState |
python | django-mptt__django-mptt | mptt/models.py | {
"start": 1163,
"end": 1550
} | class ____(property):
def __init__(self, name, bases=(), members=None):
if members is None:
members = {}
return super().__init__(
members.get("__get__"),
members.get("__set__"),
members.get("__delete__"),
members.get("__doc__"),
)
... | classpropertytype |
python | django__django | tests/migrations/test_migrations_no_default/0001_initial.py | {
"start": 43,
"end": 664
} | class ____(migrations.Migration):
dependencies = []
operations = [
migrations.CreateModel(
name="SillyModel",
fields=[
(
"id",
models.BigAutoField(
verbose_name="ID",
serializ... | Migration |
python | scipy__scipy | benchmarks/benchmarks/go_benchmark_functions/go_funcs_M.py | {
"start": 15782,
"end": 17340
} | class ____(Benchmark):
r"""
Mishra 9 objective function.
This class defines the Mishra 9 [1]_ global optimization problem. This
is a multimodal minimization problem defined as follows:
.. math::
f_{\text{Mishra09}}({x}) = \left[ ab^2c + abc^2 + b^2
+ (x_1 + x_2 - x_3)^2 \right]^2
... | Mishra09 |
python | fluentpython__example-code | 06-dp-1class-func/strategy_best3.py | {
"start": 1625,
"end": 2540
} | class ____: # the Context
def __init__(self, customer, cart, promotion=None):
self.customer = customer
self.cart = list(cart)
self.promotion = promotion
def total(self):
if not hasattr(self, '__total'):
self.__total = sum(item.total() for item in self.cart)
... | Order |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pyupgrade/UP049_1.py | {
"start": 1139,
"end": 1161
} | class ____[_T, T]: ...
| C |
python | huggingface__transformers | src/transformers/models/qwen2_moe/modular_qwen2_moe.py | {
"start": 10241,
"end": 10637
} | class ____(MixtralForCausalLM, GenerationMixin):
_tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}
_tp_plan = {"lm_head": "colwise_rep"}
_pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
def __init__(self, config):
super().__init__(config)
self.num_experts = con... | Qwen2MoeForCausalLM |
python | pennersr__django-allauth | allauth/socialaccount/providers/coinbase/views.py | {
"start": 181,
"end": 1032
} | class ____(OAuth2Adapter):
provider_id = "coinbase"
@property
def authorize_url(self):
return "https://www.coinbase.com/oauth/authorize"
@property
def access_token_url(self):
return "https://www.coinbase.com/oauth/token"
@property
def profile_url(self):
return "htt... | CoinbaseOAuth2Adapter |
python | huggingface__transformers | src/transformers/models/longformer/modeling_longformer.py | {
"start": 75897,
"end": 81078
} | class ____(LongformerPreTrainedModel):
_tied_weights_keys = {
"lm_head.decoder.weight": "longformer.embeddings.word_embeddings.weight",
"lm_head.decoder.bias": "lm_head.bias",
}
def __init__(self, config):
super().__init__(config)
self.longformer = LongformerModel(config, a... | LongformerForMaskedLM |
python | FactoryBoy__factory_boy | tests/test_django.py | {
"start": 2707,
"end": 2855
} | class ____(factory.django.DjangoModelFactory):
class Meta:
model = models.WithFile
afile = factory.django.FileField()
| WithFileFactory |
python | pytorch__pytorch | test/dynamo/test_autograd_function.py | {
"start": 18174,
"end": 35851
} | class ____(torch.nn.Module):
def forward(self, L_x_: "f32[]", L_z_: "f32[]", L_weird_b: "f32[]", L_weird_c: "f32[]"):
l_x_ = L_x_
l_z_ = L_z_
l_weird_b = L_weird_b
l_weird_c = L_weird_c
fwd_body_0 = self.fwd_body_0
bwd_body_0 = self.bwd_body_0
autograd_functi... | GraphModule |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/nn_ops/fractional_avg_pool_op_test.py | {
"start": 14703,
"end": 24945
} | class ____(test.TestCase):
"""Tests for FractionalAvgPoolGrad.
Two types of tests for FractionalAvgPoolGrad.
1) Test fractional_avg_pool_grad() directly.
This type of test relies on gen_nn_ops.avg_pool_grad() returns the
correct result. For example:
* input_tensor_shape = (1, 10, 10, 1)
* window_si... | FractionalAvgPoolGradTest |
python | pydata__xarray | xarray/backends/common.py | {
"start": 8409,
"end": 9048
} | class ____(NdimSizeLenMixin, indexing.ExplicitlyIndexed):
__slots__ = ()
async def async_getitem(self, key: indexing.ExplicitIndexer) -> np.typing.ArrayLike:
raise NotImplementedError("Backend does not support asynchronous loading")
def get_duck_array(self, dtype: np.typing.DTypeLike | None = None... | BackendArray |
python | django__django | django/core/validators.py | {
"start": 597,
"end": 2250
} | class ____:
regex = ""
message = _("Enter a valid value.")
code = "invalid"
inverse_match = False
flags = 0
def __init__(
self, regex=None, message=None, code=None, inverse_match=None, flags=None
):
if regex is not None:
self.regex = regex
if message is n... | RegexValidator |
python | explosion__spaCy | spacy/cli/init_config.py | {
"start": 765,
"end": 10423
} | class ____:
"""
Default values for initialization. Dedicated class to allow synchronized default values for init_config_cli() and
init_config(), i.e. initialization calls via CLI respectively Python.
"""
lang = "en"
pipeline = SimpleFrozenList(["tagger", "parser", "ner"])
optimize = Optimiz... | InitValues |
python | apache__airflow | airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_parsing.py | {
"start": 1443,
"end": 4052
} | class ____:
@staticmethod
def clear_db():
clear_db_dag_parsing_requests()
@pytest.fixture(autouse=True)
def setup(self, session) -> None:
self.clear_db()
clear_db_logs()
def test_201_and_400_requests(self, url_safe_serializer, session, test_client):
parse_and_sync_t... | TestDagParsingEndpoint |
python | ray-project__ray | python/ray/tests/test_autoscaler.py | {
"start": 6315,
"end": 10155
} | class ____(MockAutoscaler):
def update_nodes(self):
raise AssertionError(
"Node updaters are disabled. This method should not be accessed!"
)
SMALL_CLUSTER = {
"cluster_name": "default",
"idle_timeout_minutes": 5,
"max_workers": 2,
"provider": {
"type": "mock",
... | NoUpdaterMockAutoscaler |
python | ray-project__ray | rllib/execution/segment_tree.py | {
"start": 6381,
"end": 7765
} | class ____(SegmentTree):
"""A SegmentTree with the reduction `operation`=operator.add."""
def __init__(self, capacity: int):
super(SumSegmentTree, self).__init__(capacity=capacity, operation=operator.add)
def sum(self, start: int = 0, end: Optional[Any] = None) -> Any:
"""Returns the sum o... | SumSegmentTree |
python | facebook__pyre-check | tools/generate_taint_models/tests/test_functions.py | {
"start": 573,
"end": 618
} | class ____(TestClass):
pass
| TestChildClassA |
python | pytorch__pytorch | torch/_functorch/_aot_autograd/subclass_parametrization.py | {
"start": 369,
"end": 638
} | class ____:
start_idx: int
num_tensors: int
class_type: Any
attrs: dict[str, "SubclassCreationMeta"]
metadata: Any
outer_size: Iterable[Union[None, int, torch.SymInt]]
outer_stride: Iterable[Union[None, int, torch.SymInt]]
| SubclassCreationMeta |
python | PyCQA__pylint | tests/functional/p/protocol_classes.py | {
"start": 474,
"end": 540
} | class ____: #pylint:disable=too-few-public-methods
pass
| Protocol |
python | getsentry__sentry | src/sentry/incidents/models/alert_rule.py | {
"start": 11920,
"end": 12684
} | class ____(abc.ABC):
"""A factory for action handlers tied to a specific incident service.
The factory's builder method is augmented with metadata about which service it is
for and which target types that service supports.
"""
def __init__(
self,
slug: str,
service_type: Ac... | ActionHandlerFactory |
python | redis__redis-py | tests/test_asyncio/test_encoding.py | {
"start": 2470,
"end": 2945
} | class ____:
async def test_ignore(self, create_redis):
r = await create_redis(decode_responses=True, encoding_errors="ignore")
await r.set("a", b"foo\xff")
assert await r.get("a") == "foo"
async def test_replace(self, create_redis):
r = await create_redis(decode_responses=True, ... | TestEncodingErrors |
python | geekcomputers__Python | Flappy Bird - created with tkinter/Background.py | {
"start": 109,
"end": 6162
} | class ____(Canvas):
"""
Classe para gerar um plano de fundo animado
"""
__background = []
__stop = False
def __init__(self, tk_instance, *geometry, fp="background.png", animation_speed=50):
# Verifica se o parâmetro tk_instance é uma instância de Tk
if not isinstance(tk_instanc... | Background |
python | kamyu104__LeetCode-Solutions | Python/best-time-to-buy-and-sell-stock-with-cooldown.py | {
"start": 30,
"end": 798
} | class ____(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
if not prices:
return 0
buy, sell, coolDown = [0] * 2, [0] * 2, [0] * 2
buy[0] = -prices[0]
for i in xrange(1, len(prices)):
# Bought b... | Solution |
python | dagster-io__dagster | python_modules/dagster-graphql/dagster_graphql/schema/external.py | {
"start": 2476,
"end": 2685
} | class ____(graphene.ObjectType):
name = graphene.NonNull(graphene.String)
version = graphene.NonNull(graphene.String)
class Meta:
name = "DagsterLibraryVersion"
| GrapheneDagsterLibraryVersion |
python | django-haystack__django-haystack | test_haystack/core/models.py | {
"start": 2102,
"end": 2234
} | class ____(models.Model):
score = models.CharField(max_length=10)
def __str__(self):
return self.score
| ScoreMockModel |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.