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/classes/config_vectorizers.py | {
"start": 6730,
"end": 6867
} | class ____(_ConfigCreateModel):
vectorizer: Union[Vectorizers, _EnumLikeStr] = Field(default=..., exclude=True)
| _VectorizerConfigCreate |
python | tensorflow__tensorflow | tensorflow/python/ops/numpy_ops/np_random_test.py | {
"start": 5339,
"end": 7496
} | class ____(test.TestCase):
def assertNotAllClose(self, a, b, **kwargs):
try:
self.assertAllClose(a, b, **kwargs)
except AssertionError:
return
raise AssertionError(
'The two values are close at all %d elements' % np_array_ops.size(a)
)
def testDistribution(self):
def run_t... | RandNDistriutionTest |
python | huggingface__transformers | src/transformers/models/kyutai_speech_to_text/modeling_kyutai_speech_to_text.py | {
"start": 10577,
"end": 11197
} | class ____(nn.Module):
def __init__(self, input_dim, output_dim, num_codebooks, use_flexible_linear=False):
super().__init__()
self.use_flexible_linear = use_flexible_linear
if not use_flexible_linear:
self.linear = nn.Linear(input_dim, output_dim, bias=False)
else:
... | KyutaiSpeechToTextLinear |
python | scipy__scipy | scipy/optimize/tests/test_chandrupatla.py | {
"start": 20348,
"end": 38639
} | class ____:
def f(self, q, p):
return special.ndtr(q) - p
@pytest.mark.parametrize('p', [0.6, np.linspace(-0.05, 1.05, 10)])
def test_basic(self, p, xp):
# Invert distribution CDF and compare against distribution `ppf`
a, b = xp.asarray(-5.), xp.asarray(5.)
res = find_root(... | TestFindRoot |
python | apache__airflow | airflow-core/src/airflow/exceptions.py | {
"start": 5894,
"end": 6120
} | class ____(NamedTuple):
"""Information about a single error in a file."""
line_no: int | None
message: str
def __str__(self):
return f"{self.message}. Line number: s{str(self.line_no)},"
| FileSyntaxError |
python | sqlalchemy__sqlalchemy | test/orm/test_deferred.py | {
"start": 90065,
"end": 94054
} | class ____(fixtures.MappedTest):
@classmethod
def define_tables(cls, metadata):
Table(
"thing",
metadata,
Column(
"id", Integer, primary_key=True, test_needs_autoincrement=True
),
Column("name", String(20)),
)
T... | DeferredPopulationTest |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/splice_t/package.py | {
"start": 217,
"end": 806
} | class ____(Package):
"""Simple package with one optional dependency"""
homepage = "http://www.example.com"
url = "http://www.example.com/splice-t-1.0.tar.gz"
version("1.0", md5="0123456789abcdef0123456789abcdef")
depends_on("splice-h")
depends_on("splice-z")
def install(self, spec, prefi... | SpliceT |
python | getsentry__sentry | src/sentry/sentry_apps/utils/webhooks.py | {
"start": 99,
"end": 275
} | class ____(SentryAppActionType):
ASSIGNED = "assigned"
CREATED = "created"
IGNORED = "ignored"
RESOLVED = "resolved"
UNRESOLVED = "unresolved"
| IssueActionType |
python | getsentry__sentry | tests/sentry/models/test_dynamicsampling.py | {
"start": 1020,
"end": 13204
} | class ____(TestCase):
def setUp(self) -> None:
super().setUp()
self.second_project = self.create_project()
self.second_organization = self.create_organization(owner=self.user)
self.third_project = self.create_project(organization=self.second_organization)
def test_update_or_crea... | TestCustomDynamicSamplingRuleProject |
python | wandb__wandb | wandb/apis/public/artifacts.py | {
"start": 2174,
"end": 3593
} | class ____(RelayPaginator["ArtifactAliasFragment", str]):
"""An internal iterator of collection alias names.
<!-- lazydoc-ignore-init: internal -->
"""
QUERY: ClassVar[Document | None] = None
last_response: Connection[ArtifactAliasFragment] | None
def __init__(self, client: Client, collection... | _ArtifactCollectionAliases |
python | pytorch__pytorch | torch/ao/nn/intrinsic/modules/fused.py | {
"start": 6097,
"end": 6805
} | class ____(_FusedModule):
r"""This is a sequential container which calls the Conv 3d, Batch Norm 3d, and ReLU modules.
During quantization this will be replaced with the corresponding fused module."""
def __init__(self, conv, bn, relu):
assert (
type_before_parametrizations(conv) == Con... | ConvBnReLU3d |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/definitions/input.py | {
"start": 16162,
"end": 20510
} | class ____(
NamedTuple(
"_In",
[
("dagster_type", PublicAttr[Union[DagsterType, type[NoValueSentinel]]]),
("description", PublicAttr[Optional[str]]),
("default_value", PublicAttr[Any]),
("metadata", PublicAttr[Optional[Mapping[str, Any]]]),
... | In |
python | numba__numba | numba/core/typing/builtins.py | {
"start": 31989,
"end": 32260
} | class ____(AbstractTemplate):
def generic(self, args, kws):
assert not kws
if len(args) == 1:
it = args[0]
if isinstance(it, types.IterableType):
return signature(it.iterator_type, *args)
@infer_global(next)
| Iter |
python | graphql-python__graphene | graphene/relay/tests/test_mutation.py | {
"start": 291,
"end": 403
} | class ____(ObjectType):
# class Meta:
# interfaces = (Node, )
id = ID()
name = String()
| MyNode |
python | walkccc__LeetCode | solutions/416. Partition Equal Subset Sum/416-2.py | {
"start": 0,
"end": 474
} | class ____:
def canPartition(self, nums: list[int]) -> bool:
summ = sum(nums)
if summ % 2 == 1:
return False
return self.knapsack_(nums, summ // 2)
def knapsack_(self, nums: list[int], subsetSum: int) -> bool:
# dp[i] := True if i can be formed by nums so far
dp = [False] * (subsetSum + 1... | Solution |
python | django-extensions__django-extensions | tests/management/commands/test_describe_form.py | {
"start": 1668,
"end": 2223
} | class ____(forms.Form):
title = forms.CharField(label='Title', max_length=50)"""
call_command("describe_form", "testapp.NonEditableModel", stdout=self.out)
self.assertIn(expected_result, self.out.getvalue())
def test_should_print_form_with_fields_for_TestModel(self):
not_expected = ""... | NonEditableModelForm |
python | apache__airflow | task-sdk/src/airflow/sdk/api/client.py | {
"start": 13155,
"end": 13993
} | class ____:
__slots__ = ("client",)
def __init__(self, client: Client):
self.client = client
def get(self, conn_id: str) -> ConnectionResponse | ErrorResponse:
"""Get a connection from the API server."""
try:
resp = self.client.get(f"connections/{conn_id}")
exce... | ConnectionOperations |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/definitions/declarative_automation/operands/operands.py | {
"start": 11905,
"end": 12719
} | class ____(SubsetAutomationCondition[AssetCheckKey]):
passed: bool
@property
def name(self) -> str:
return "check_passed" if self.passed else "check_failed"
async def compute_subset( # pyright: ignore[reportIncompatibleMethodOverride]
self, context: AutomationContext[AssetCheckKey]
... | CheckResultCondition |
python | huggingface__transformers | src/transformers/models/cohere2_vision/modeling_cohere2_vision.py | {
"start": 1772,
"end": 3656
} | class ____(nn.Module):
def __init__(self, config: Cohere2VisionConfig):
super().__init__()
self.config = config
self.downsample_factor = config.downsample_factor
self.intermediate_size = config.alignment_intermediate_size
self.linear_1 = nn.Linear(
config.vision_c... | Cohere2VisionMultiModalProjector |
python | django__django | tests/cache/tests.py | {
"start": 62342,
"end": 64060
} | class ____(BaseMemcachedTests, TestCase):
base_params = PyLibMCCache_params
# libmemcached manages its own connections.
should_disconnect_on_close = False
@property
def incr_decr_type_error(self):
return cache._lib.ClientError
@override_settings(
CACHES=caches_setting_for_tests... | PyLibMCCacheTests |
python | scrapy__scrapy | tests/test_utils_asyncio.py | {
"start": 469,
"end": 730
} | class ____:
def test_is_asyncio_available(self, reactor_pytest: str) -> None:
# the result should depend only on the pytest --reactor argument
assert is_asyncio_available() == (reactor_pytest == "asyncio")
@pytest.mark.only_asyncio
| TestAsyncio |
python | falconry__falcon | falcon/errors.py | {
"start": 12285,
"end": 15117
} | class ____(HTTPError):
"""403 Forbidden.
The server understood the request but refuses to authorize it.
A server that wishes to make public why the request has been
forbidden can describe that reason in the response payload (if any).
If authentication credentials were provided in the request, the... | HTTPForbidden |
python | huggingface__transformers | src/transformers/models/owlv2/modular_owlv2.py | {
"start": 1214,
"end": 8161
} | class ____(OwlViTImageProcessorFast):
resample = PILImageResampling.BILINEAR
image_mean = OPENAI_CLIP_MEAN
image_std = OPENAI_CLIP_STD
size = {"height": 960, "width": 960}
rescale_factor = 1 / 255
do_resize = True
do_rescale = True
do_normalize = True
do_pad = True
crop_size = No... | Owlv2ImageProcessorFast |
python | fluentpython__example-code | attic/functions/strkeydict2.py | {
"start": 932,
"end": 1870
} | class ____(collections.UserDict): # <1>
def __init__(self, args, normalize=str, **kwargs):
super().__init__(self, *args, **kwargs)
self.normalize = normalize
def __missing__(self, key): # <2>
if self.normalize(key) == key:
raise KeyError(key)
return self[self.norm... | StrKeyDict |
python | tensorflow__tensorflow | tensorflow/python/debug/lib/debug_v2_ops_test.py | {
"start": 11376,
"end": 31250
} | class ____(test_util.TensorFlowTestCase):
@test_util.run_in_graph_and_eager_modes
def testDebugNumericSummaryV2OpReduceInfNanThreeSlots(self):
def debug_summary(x):
return self.evaluate(
gen_debug_ops.debug_numeric_summary_v2(
x,
tensor_debug_mode=(
... | DebugNumericSummaryV2Test |
python | PyCQA__pylint | tests/functional/u/used/used_before_assignment_class_nested_under_function.py | {
"start": 288,
"end": 336
} | class ____:
"""Module-level class"""
| ModuleClass |
python | allegroai__clearml | clearml/backend_api/session/response.py | {
"start": 363,
"end": 544
} | class ____(jsonmodels.models.Base):
name = jsonmodels.fields.StringField()
requested_version = FloatOrStringField()
actual_version = FloatOrStringField()
| _ResponseEndpoint |
python | pytorch__pytorch | torch/nn/modules/loss.py | {
"start": 50448,
"end": 52571
} | class ____(_Loss):
r"""Creates a criterion that optimizes a two-class classification
logistic loss between input tensor :math:`x` and target tensor :math:`y`
(containing 1 or -1).
.. math::
\text{loss}(x, y) = \sum_i \frac{\log(1 + \exp(-y[i]*x[i]))}{\text{x.nelement}()}
Args:
size... | SoftMarginLoss |
python | ray-project__ray | python/ray/autoscaler/_private/gcp/node.py | {
"start": 5888,
"end": 6911
} | class ____(GCPNode):
"""Abstraction around tpu nodes"""
# https://cloud.google.com/tpu/docs/reference/rest/v2alpha1/projects.locations.nodes#State
NON_TERMINATED_STATUSES = {"CREATING", "STARTING", "RESTARTING", "READY"}
RUNNING_STATUSES = {"READY"}
STATUS_FIELD = "state"
def get_labels(self)... | GCPTPUNode |
python | PrefectHQ__prefect | src/integrations/prefect-snowflake/prefect_snowflake/database.py | {
"start": 682,
"end": 46191
} | class ____(DatabaseBlock):
"""
Block used to manage connections with Snowflake.
Upon instantiating, a connection is created and maintained for the life of
the object until the close method is called.
It is recommended to use this block as a context manager, which will automatically
close the e... | SnowflakeConnector |
python | tornadoweb__tornado | tornado/test/httpclient_test.py | {
"start": 1087,
"end": 1282
} | class ____(RequestHandler):
def post(self):
self.finish(
"Post arg1: %s, arg2: %s"
% (self.get_argument("arg1"), self.get_argument("arg2"))
)
| PostHandler |
python | donnemartin__interactive-coding-challenges | linked_lists/delete_mid/test_delete_mid.py | {
"start": 18,
"end": 1402
} | class ____(unittest.TestCase):
def test_delete_node(self):
print('Test: Empty list, null node to delete')
linked_list = MyLinkedList(None)
linked_list.delete_node(None)
self.assertEqual(linked_list.get_all_data(), [])
print('Test: One node')
head = Node(2)
l... | TestDeleteNode |
python | joke2k__faker | faker/providers/ssn/en_US/__init__.py | {
"start": 67,
"end": 6848
} | class ____(BaseProvider):
INVALID_SSN_TYPE = "INVALID_SSN"
SSN_TYPE = "SSN"
ITIN_TYPE = "ITIN"
EIN_TYPE = "EIN"
def itin(self) -> str:
"""Generate a random United States Individual Taxpayer Identification Number (ITIN).
An United States Individual Taxpayer Identification Number
... | Provider |
python | celery__celery | celery/backends/azureblockblob.py | {
"start": 719,
"end": 6071
} | class ____(KeyValueStoreBackend):
"""Azure Storage Block Blob backend for Celery."""
def __init__(self,
url=None,
container_name=None,
*args,
**kwargs):
"""
Supported URL formats:
azureblockblob://CONNECTION_STRING
... | AzureBlockBlobBackend |
python | tornadoweb__tornado | tornado/test/util_test.py | {
"start": 7660,
"end": 8793
} | class ____(unittest.TestCase):
def setUp(self):
def function(x, y, callback=None, z=None):
pass
self.replacer = ArgReplacer(function, "callback")
def test_omitted(self):
args = (1, 2)
kwargs: Dict[str, Any] = dict()
self.assertIsNone(self.replacer.get_old_va... | ArgReplacerTest |
python | realpython__materials | python-protocol/adder_v4.py | {
"start": 76,
"end": 144
} | class ____(Protocol[T]):
def add(self, x: T, y: T) -> T: ...
| Adder |
python | pydantic__pydantic | pydantic/v1/types.py | {
"start": 16357,
"end": 19299
} | class ____(list): # type: ignore
# Needed for pydantic to detect that this is a list
__origin__ = list
__args__: Tuple[Type[T], ...] # type: ignore
min_items: Optional[int] = None
max_items: Optional[int] = None
unique_items: Optional[bool] = None
item_type: Type[T] # type: ignore
@... | ConstrainedList |
python | PyCQA__pylint | tests/functional/u/used/used_before_assignment_typing.py | {
"start": 6646,
"end": 6785
} | class ____(NamedTuple):
"""Note: current false negative if outer() called before this declaration."""
field: int
outer()
| MyNamedTuple |
python | astropy__astropy | astropy/uncertainty/tests/test_distribution.py | {
"start": 21801,
"end": 22435
} | class ____(StructuredDtypeBase):
@classmethod
def setup_class(cls):
super().setup_class()
cls.unit = u.Unit("km, m")
cls.d_unit = cls.unit
def test_init_via_structured_samples(self):
distribution = self.distribution << self.unit
d = Distribution(distribution)
... | TestStructuredQuantityDistributionInit |
python | great-expectations__great_expectations | tests/data_context/abstract_data_context/test_data_docs_config_crud.py | {
"start": 2768,
"end": 5213
} | class ____:
@pytest.mark.unit
def test_update_data_docs_site(
self,
ephemeral_context_with_defaults: EphemeralDataContext,
new_site_config: dict,
):
# Add a new site
new_site_name = "my_new_site"
ephemeral_context_with_defaults.add_data_docs_site(
... | TestUpdateDataDocsSite |
python | Lightning-AI__lightning | tests/tests_pytorch/helpers/advanced_models.py | {
"start": 7364,
"end": 8824
} | class ____(LightningModule):
def __init__(self):
super().__init__()
self.batch_size = 10
self.in_features = 10
self.out_features = 5
self.hidden_dim = 20
self.automatic_optimization = False
self.truncated_bptt_steps = 10
self.rnn = nn.LSTM(self.in_f... | TBPTTModule |
python | numpy__numpy | numpy/_core/tests/test_multiarray.py | {
"start": 21614,
"end": 25711
} | class ____:
def test_assignment_broadcasting(self):
a = np.arange(6).reshape(2, 3)
# Broadcasting the input to the output
a[...] = np.arange(3)
assert_equal(a, [[0, 1, 2], [0, 1, 2]])
a[...] = np.arange(2).reshape(2, 1)
assert_equal(a, [[0, 0, 0], [1, 1, 1]])
... | TestAssignment |
python | weaviate__weaviate-python-client | weaviate/util.py | {
"start": 16110,
"end": 25019
} | class ____:
def __init__(self, major: int, minor: int, patch: int) -> None:
self.major = major
self.minor = minor
self.patch = patch
def __eq__(self, other: object) -> bool:
if not isinstance(other, _ServerVersion):
return NotImplemented
return self.major == ... | _ServerVersion |
python | pypa__warehouse | warehouse/accounts/forms.py | {
"start": 2772,
"end": 3042
} | class ____:
username = wtforms.StringField(
validators=[
wtforms.validators.InputRequired(),
PreventNullBytesValidator(),
_check_for_email_in_username,
_check_for_existing_username,
],
)
| UsernameMixin |
python | ansible__ansible | lib/ansible/parsing/yaml/objects.py | {
"start": 389,
"end": 653
} | class ____(dict):
"""Backwards compatibility type."""
def __new__(cls, value=_UNSET, /, **kwargs):
if value is _UNSET:
return dict(**kwargs)
return _datatag.AnsibleTagHelper.tag_copy(value, dict(value, **kwargs))
| _AnsibleMapping |
python | ray-project__ray | doc/source/serve/doc_code/fault_tolerance/replica_health_check.py | {
"start": 190,
"end": 679
} | class ____:
def __init__(self, db_addr: str):
self._my_db_connection = connect_to_db(db_addr)
def __call__(self, request):
return self._do_something_cool()
# Called by Serve to check the replica's health.
def check_health(self):
if not self._my_db_connection.is_connected():
... | MyDeployment |
python | openai__openai-python | src/openai/types/beta/realtime/input_audio_buffer_cleared_event.py | {
"start": 206,
"end": 429
} | class ____(BaseModel):
event_id: str
"""The unique ID of the server event."""
type: Literal["input_audio_buffer.cleared"]
"""The event type, must be `input_audio_buffer.cleared`."""
| InputAudioBufferClearedEvent |
python | sympy__sympy | sympy/concrete/products.py | {
"start": 635,
"end": 18456
} | class ____(ExprWithIntLimits):
r"""
Represents unevaluated products.
Explanation
===========
``Product`` represents a finite or infinite product, with the first
argument being the general form of terms in the series, and the second
argument being ``(dummy_variable, start, end)``, with ``du... | Product |
python | cython__cython | Cython/Compiler/AnalysedTreeTransforms.py | {
"start": 293,
"end": 3786
} | class ____(ScopeTrackingTransform):
# Handles autotestdict directive
excludelist = ['__cinit__', '__dealloc__', '__richcmp__',
'__nonzero__', '__bool__',
'__len__', '__contains__']
def visit_ModuleNode(self, node):
if node.is_pxd:
return node
... | AutoTestDictTransform |
python | getsentry__sentry | src/sentry/apidocs/examples/project_examples.py | {
"start": 14090,
"end": 17934
} | class ____:
CLIENT_KEY_RESPONSE = [
OpenApiExample(
"Client key with rate limiting",
value=KEY_RATE_LIMIT,
status_codes=["200", "201"],
response_only=True,
),
]
DETAILED_PROJECT = [
OpenApiExample(
"Get detailed view about ... | ProjectExamples |
python | pandas-dev__pandas | pandas/tests/frame/indexing/test_xs.py | {
"start": 3991,
"end": 13520
} | class ____:
def test_xs_doc_example(self):
# TODO: more descriptive name
# based on example in advanced.rst
arrays = [
["bar", "bar", "baz", "baz", "foo", "foo", "qux", "qux"],
["one", "two", "one", "two", "one", "two", "one", "two"],
]
tuples = list(z... | TestXSWithMultiIndex |
python | joke2k__faker | faker/providers/date_time/es/__init__.py | {
"start": 46,
"end": 777
} | class ____(DateTimeProvider):
DAY_NAMES = {
"0": "domingo",
"1": "lunes",
"2": "martes",
"3": "miércoles",
"4": "jueves",
"5": "viernes",
"6": "sábado",
}
MONTH_NAMES = {
"01": "enero",
"02": "febrero",
"03": "marzo",
"... | Provider |
python | numba__numba | numba/tests/test_record_dtype.py | {
"start": 37322,
"end": 41430
} | class ____(TestCase):
def setUp(self):
self.value = 2
a_dtype = np.dtype([('a', 'f8')])
ab_dtype = np.dtype([('a', 'f8'), ('b', 'f8')])
self.a_rec1 = np.array([1], dtype=a_dtype)[0]
self.a_rec2 = np.array([2], dtype=a_dtype)[0]
self.ab_rec1 = np.array([(self.value, 3)... | TestSubtyping |
python | pydata__xarray | xarray/tests/test_plugins.py | {
"start": 937,
"end": 10026
} | class ____(common.BackendEntrypoint):
def open_dataset(self, filename_or_obj, *, decoder): # type: ignore[override]
pass
@pytest.fixture
def dummy_duplicated_entrypoints():
specs = [
["engine1", "xarray.tests.test_plugins:backend_1", "xarray.backends"],
["engine1", "xarray.tests.test_... | DummyBackendEntrypoint2 |
python | encode__django-rest-framework | rest_framework/authtoken/migrations/0002_auto_20160226_1747.py | {
"start": 76,
"end": 994
} | class ____(migrations.Migration):
dependencies = [
('authtoken', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='token',
options={'verbose_name_plural': 'Tokens', 'verbose_name': 'Token'},
),
migrations.AlterField(
m... | Migration |
python | apache__airflow | providers/google/tests/unit/google/marketing_platform/operators/test_search_ads.py | {
"start": 5527,
"end": 6569
} | class ____:
@mock.patch(
"airflow.providers.google.marketing_platform.operators.search_ads.GoogleSearchAdsReportingHook"
)
@mock.patch("airflow.providers.google.marketing_platform.operators.search_ads.BaseOperator")
def test_execute(self, mock_base_op, hook_mock):
customs_columns = [
... | TestGoogleSearchAdsListCustomColumnsOperator |
python | sphinx-doc__sphinx | sphinx/pycode/parser.py | {
"start": 4553,
"end": 5959
} | class ____:
def __init__(self, buffers: list[str]) -> None:
lines = iter(buffers)
self.buffers = buffers
self.tokens = tokenize.generate_tokens(lambda: next(lines))
self.current: Token | None = None
self.previous: Token | None = None
def get_line(self, lineno: int) -> st... | TokenProcessor |
python | keras-team__keras | keras/src/layers/core/embedding.py | {
"start": 418,
"end": 21326
} | class ____(Layer):
"""Turns nonnegative integers (indexes) into dense vectors of fixed size.
e.g. `[[4], [20]] -> [[0.25, 0.1], [0.6, -0.2]]`
This layer can only be used on nonnegative integer inputs of a fixed range.
Example:
>>> model = keras.Sequential()
>>> model.add(keras.layers.Embeddi... | Embedding |
python | graphql-python__graphene | graphene/relay/tests/test_custom_global_id.py | {
"start": 2491,
"end": 4706
} | class ____:
def setup_method(self):
self.user_list = [
{"id": "my global primary key in clear 1", "name": "First"},
{"id": "my global primary key in clear 2", "name": "Second"},
{"id": "my global primary key in clear 3", "name": "Third"},
{"id": "my global pri... | TestSimpleGlobalID |
python | xlwings__xlwings | xlwings/_xlwindows.py | {
"start": 24202,
"end": 28016
} | class ____(base_classes.Book):
def __init__(self, xl):
self.xl = xl
@property
def api(self):
return self.xl
def json(self):
raise NotImplementedError()
@property
def name(self):
return self.xl.Name
@property
def sheets(self):
return Sheets(xl=s... | Book |
python | apache__airflow | providers/apache/druid/tests/unit/apache/druid/hooks/test_druid.py | {
"start": 16121,
"end": 21102
} | class ____:
def setup_method(self):
self.cur = MagicMock(rowcount=0)
self.conn = conn = MagicMock()
self.conn.host = "host"
self.conn.port = "1000"
self.conn.schema = None
self.conn.conn_type = "druid"
self.conn.extra_dejson = {"endpoint": "druid/v2/sql"}
... | TestDruidDbApiHook |
python | skorch-dev__skorch | skorch/tests/callbacks/test_logging.py | {
"start": 15265,
"end": 22499
} | class ____:
@pytest.fixture
def print_log_cls(self):
from skorch.callbacks import PrintLog
keys_ignored = ['dur', 'event_odd']
return partial(PrintLog, sink=Mock(), keys_ignored=keys_ignored)
@pytest.fixture
def print_log(self, print_log_cls):
return print_log_cls().init... | TestPrintLog |
python | rapidsai__cudf | python/cudf_polars/cudf_polars/experimental/base.py | {
"start": 4186,
"end": 4337
} | class ____(NamedTuple):
"""Pair of table-source and column-name information."""
table_source: DataSourceInfo
column_name: str
| DataSourcePair |
python | pytorch__pytorch | test/dynamo/cpython/3_13/seq_tests.py | {
"start": 3604,
"end": 3668
} | class ____(list):
def __iter__(self):
yield 1
| LyingList |
python | dask__distributed | distributed/shuffle/tests/test_merge.py | {
"start": 14213,
"end": 16652
} | class ____(_ShuffleRunManager):
seen: set[ShuffleId]
block_get_or_create: asyncio.Event
blocking_get_or_create: asyncio.Event
def __init__(self, *args: Any, **kwargs: Any):
super().__init__(*args, **kwargs)
self.seen = set()
self.limit = 1
self.blocking_get_or_create = a... | LimitedGetOrCreateShuffleRunManager |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_chart_data_labels32.py | {
"start": 315,
"end": 1980
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("chart_data_labels32.xlsx")
def test_create_file(self):
"""Test the creation of a simple XlsxWriter file."""
workbook = Workbook(se... | TestCompareXLSXFiles |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/execution/plan/inputs.py | {
"start": 22534,
"end": 24722
} | class ____(IHaveNew):
"""This step input source models being directly downstream of a step with dynamic output.
Once that step completes successfully, this will resolve once per DynamicOutput.
"""
step_output_handle: StepOutputHandle
# deprecated, preserved for back-compat
node_handle: NodeHand... | FromPendingDynamicStepOutput |
python | keras-team__keras | keras/src/ops/numpy.py | {
"start": 219078,
"end": 220095
} | class ____(Operation):
def call(self, x1, x2):
return backend.numpy.true_divide(x1, x2)
def compute_output_spec(self, x1, x2):
x1_shape = getattr(x1, "shape", [])
x2_shape = getattr(x2, "shape", [])
output_shape = broadcast_shapes(x1_shape, x2_shape)
output_dtype = dtype... | TrueDivide |
python | pandas-dev__pandas | pandas/core/computation/pytables.py | {
"start": 2456,
"end": 2743
} | class ____(Term):
def __init__(self, name, env: PyTablesScope, side=None, encoding=None) -> None:
assert isinstance(env, PyTablesScope), type(env)
super().__init__(name, env, side=side, encoding=encoding)
def _resolve_name(self):
return self._name
| Constant |
python | cython__cython | Tools/make_dataclass_tests.py | {
"start": 9293,
"end": 9833
} | class ____(ast.NodeVisitor):
found = False
def visit_Name(self, node):
if node.id == "dataclass":
self.found = True
return self.generic_visit(node)
def generic_visit(self, node):
if self.found:
return # skip
return super().generic_visit(node)
def ... | DataclassInDecorators |
python | streamlit__streamlit | lib/streamlit/testing/v1/element_tree.py | {
"start": 44614,
"end": 53014
} | class ____:
"""A container of other elements.
Elements within a Block can be inspected and interacted with. This follows
the same syntax as inspecting and interacting within an ``AppTest`` object.
For all container classes, parameters of the original element can be
obtained as properties. For exam... | Block |
python | apache__airflow | dev/breeze/src/airflow_breeze/utils/selective_checks.py | {
"start": 5133,
"end": 16055
} | class ____(dict[T, list[str]]):
def __hash__(self):
return hash(frozenset(self))
CI_FILE_GROUP_MATCHES: HashableDict[FileGroupForCi] = HashableDict(
{
FileGroupForCi.ENVIRONMENT_FILES: [
r"^.github/workflows",
r"^dev/breeze",
r"^dev/.*\.py$",
r"^... | HashableDict |
python | ray-project__ray | python/ray/autoscaler/v2/sdk.py | {
"start": 396,
"end": 3928
} | class ____(NamedTuple):
resources: dict
label_selector: dict
def request_cluster_resources(
gcs_address: str,
to_request: List[dict],
timeout: int = DEFAULT_RPC_TIMEOUT_S,
):
"""Request resources from the autoscaler.
This will add a cluster resource constraint to GCS. GCS will asynchronou... | ResourceRequest |
python | bokeh__bokeh | src/bokeh/model/model.py | {
"start": 2836,
"end": 21865
} | class ____(HasProps, HasDocumentRef, PropertyCallbackManager, EventCallbackManager):
''' Base class for all objects stored in Bokeh |Document| instances.
'''
# a canonical order for positional args that can be
# used for any functions derived from this class
_args = ()
_extra_kws = {}
@... | Model |
python | mlflow__mlflow | mlflow/store/jobs/abstract_store.py | {
"start": 231,
"end": 4116
} | class ____(ABC):
"""
Abstract class that defines API interfaces for storing Job metadata.
"""
@abstractmethod
def create_job(self, function_fullname: str, params: str, timeout: float | None = None) -> Job:
"""
Create a new job with the specified function and parameters.
Arg... | AbstractJobStore |
python | sympy__sympy | sympy/matrices/expressions/permutation.py | {
"start": 4352,
"end": 8050
} | class ____(MatrixExpr):
r"""Symbolic representation for permuting matrix rows or columns.
Parameters
==========
perm : Permutation, PermutationMatrix
The permutation to use for permuting the matrix.
The permutation can be resized to the suitable one,
axis : 0 or 1
The axis... | MatrixPermute |
python | pytorch__pytorch | torch/testing/_internal/common_quantization.py | {
"start": 52336,
"end": 54607
} | class ____(QuantizationTestCase):
def _create_quantized_model(self, model_class: type[torch.nn.Module], **kwargs):
# Creates quantized model for testing mobile script modules
qengine = "qnnpack"
with override_quantized_engine(qengine):
# FIXME(rec): shouldn't qconfig be passed to... | QuantizationLiteTestCase |
python | pytorch__pytorch | torch/_inductor/ir.py | {
"start": 303885,
"end": 307686
} | class ____(MutableBox):
"""
StorageBox allow in-place mutation of Tensors
"""
def is_input_buffer(self) -> bool:
if isinstance(self.data, (InputBuffer, ReinterpretView)):
return self.data.get_name() in V.graph.graph_inputs
return False
def is_module_buffer(self) -> bool... | StorageBox |
python | django__django | tests/template_tests/syntax_tests/test_static.py | {
"start": 3963,
"end": 4411
} | class ____(SimpleTestCase):
def test_repr(self):
static_node = StaticNode(varname="named-var", path="named-path")
self.assertEqual(
repr(static_node),
"StaticNode(varname='named-var', path='named-path')",
)
static_node = StaticNode(path="named-path")
s... | StaticNodeTests |
python | getsentry__sentry | src/sentry_plugins/opsgenie/plugin.py | {
"start": 1365,
"end": 3929
} | class ____(CorePluginMixin, notify.NotificationPlugin):
author = "Sentry Team"
author_url = "https://github.com/getsentry"
title = "Opsgenie"
slug = "opsgenie"
description = DESCRIPTION
conf_key = "opsgenie"
version = sentry.VERSION
project_conf_form = OpsGenieOptionsForm
required_fi... | OpsGeniePlugin |
python | tiangolo__fastapi | scripts/notify_translations.py | {
"start": 2206,
"end": 2265
} | class ____(BaseModel):
edges: List[CommentsEdge]
| Comments |
python | huggingface__transformers | src/transformers/models/swinv2/modeling_swinv2.py | {
"start": 33180,
"end": 35326
} | class ____(GradientCheckpointingLayer):
def __init__(
self, config, dim, input_resolution, depth, num_heads, drop_path, downsample, pretrained_window_size=0
):
super().__init__()
self.config = config
self.dim = dim
blocks = []
for i in range(depth):
bl... | Swinv2Stage |
python | scrapy__scrapy | tests/test_utils_trackref.py | {
"start": 131,
"end": 174
} | class ____(trackref.object_ref):
pass
| Foo |
python | python-openxml__python-docx | src/docx/styles/style.py | {
"start": 5131,
"end": 6141
} | class ____(BaseStyle):
"""A character style.
A character style is applied to a |Run| object and primarily provides character-
level formatting via the |Font| object in its :attr:`.font` property.
"""
@property
def base_style(self):
"""Style object this style inherits from or |None| if ... | CharacterStyle |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/typeParams1.py | {
"start": 568,
"end": 607
} | class ____[T](list["T"]):
pass
| ClassG |
python | boto__boto3 | boto3/docs/docstring.py | {
"start": 1042,
"end": 1178
} | class ____(LazyLoadedDocstring):
def _write_docstring(self, *args, **kwargs):
document_action(*args, **kwargs)
| ActionDocstring |
python | getsentry__sentry | tests/sentry/integrations/vsts/test_repository.py | {
"start": 599,
"end": 4748
} | class ____(TestCase):
def setUp(self) -> None:
self.base_url = "https://visualstudio.com/"
self.vsts_external_id = "654321"
@cached_property
def provider(self):
return VstsRepositoryProvider("integrations:vsts")
@responses.activate
def test_compare_commits(self) -> None:
... | VisualStudioRepositoryProviderTest |
python | huggingface__transformers | src/transformers/models/mbart/modeling_mbart.py | {
"start": 53133,
"end": 59703
} | class ____(MBartPreTrainedModel):
def __init__(self, config: MBartConfig, **kwargs):
super().__init__(config, **kwargs)
self.model = MBartModel(config)
self.classification_head = MBartClassificationHead(
config.d_model,
config.d_model,
config.num_labels,
... | MBartForSequenceClassification |
python | huggingface__transformers | src/transformers/models/prompt_depth_anything/modular_prompt_depth_anything.py | {
"start": 1240,
"end": 1337
} | class ____(DepthAnythingConfig):
model_type = "prompt_depth_anything"
| PromptDepthAnythingConfig |
python | pandas-dev__pandas | asv_bench/benchmarks/io/csv.py | {
"start": 18527,
"end": 18813
} | class ____(StringIORewind):
def setup(self):
count_elem = 100_000
data = "a,b\n" + "1,2\n" * count_elem
self.StringIO_input = StringIO(data)
def time_read_csv_index_col(self):
read_csv(self.data(self.StringIO_input), index_col="a")
| ReadCSVIndexCol |
python | astropy__astropy | astropy/io/votable/exceptions.py | {
"start": 28127,
"end": 28566
} | class ____(VOTableSpecWarning):
"""
The ``name`` and ``value`` attributes are required on all ``INFO``
elements.
**References:** `1.1
<http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC54>`__,
`1.2
<http://www.ivoa.net/documents/VOTable/20091130/REC-VOTable-1.2... | W35 |
python | jina-ai__jina | tests/unit/orchestrate/flow/flow-orchestrate/test_flow_docarray_return.py | {
"start": 154,
"end": 2181
} | class ____(Executor):
@requests
def add_text(self, docs, **kwargs):
docs[0].text = 'Hello World!'
def test_simple_docarray_return():
f = Flow().add(uses=SimplExecutor)
with f:
docs = f.post(on='/index', inputs=[Document()])
assert docs[0].text == 'Hello World!'
def test_flatten_d... | SimplExecutor |
python | huggingface__transformers | src/transformers/models/glm4v_moe/modular_glm4v_moe.py | {
"start": 22468,
"end": 22540
} | class ____(Glm4vVisionModel):
pass
@auto_docstring
| Glm4vMoeVisionModel |
python | streamlit__streamlit | lib/tests/streamlit/components/v2/test_bidi_presentation.py | {
"start": 1283,
"end": 8966
} | class ____:
def __init__(self) -> None:
self._new_widget_state = _FakeWStates()
def test_bidi_presenter_merges_events_when_present() -> None:
"""Test that the presenter correctly merges event payloads into the base state."""
ss = _FakeSession()
agg_id = "$$_internal__wid__events"
presenter... | _FakeSession |
python | great-expectations__great_expectations | contrib/experimental/great_expectations_experimental/expectations/expect_foreign_keys_in_column_a_to_exist_in_column_b.py | {
"start": 1749,
"end": 9980
} | class ____(ColumnMapExpectation):
"""Expect foreign keys in a column to exist in another specified column.
Ensure that values in the column of interest (ColumnA) are in a valueset provided as a dataframe (df parameter) + column (column_B parameter) or as a list of elements supported by pandas.DataFrame() (e.g.... | ExpectForeignKeysInColumnAToExistInColumnB |
python | scipy__scipy | scipy/linalg/tests/test_special_matrices.py | {
"start": 791,
"end": 2214
} | class ____:
def test_basic(self):
y = toeplitz([1, 2, 3])
assert_array_equal(y, [[1, 2, 3], [2, 1, 2], [3, 2, 1]])
y = toeplitz([1, 2, 3], [1, 4, 5])
assert_array_equal(y, [[1, 4, 5], [2, 1, 4], [3, 2, 1]])
def test_complex_01(self):
data = (1.0 + arange(3.0)) * (1.0 + ... | TestToeplitz |
python | scipy__scipy | scipy/sparse/tests/test_base.py | {
"start": 221578,
"end": 221658
} | class ____(TestCSRNonCanonical, TestCSRMatrix):
pass
| TestCSRNonCanonicalMatrix |
python | great-expectations__great_expectations | tests/integration/metrics/column/test_values_not_match_regex_values.py | {
"start": 823,
"end": 3342
} | class ____:
@parameterize_batch_for_data_sources(
data_source_configs=SQL_DATA_SOURCES_EXCEPT_SNOWFLAKE,
data=DATA_FRAME,
)
def test_partial_match_characters(self, batch_for_datasource: Batch) -> None:
metric = ColumnValuesNotMatchRegexValues(column=COLUMN_NAME, regex="ab")
m... | TestColumnValuesNotMatchRegexValues |
python | django__django | tests/expressions/models.py | {
"start": 1783,
"end": 2237
} | class ____(models.Model):
name = models.CharField(max_length=24)
assigned = models.DateField()
completed = models.DateField()
estimated_time = models.DurationField()
start = models.DateTimeField()
end = models.DateTimeField()
scalar = models.IntegerField(null=True)
class Meta:
d... | Experiment |
python | astropy__astropy | astropy/units/tests/test_format.py | {
"start": 11987,
"end": 12472
} | class ____(RoundtripBase):
format_ = u_format.Generic
@pytest.mark.parametrize(
"unit",
[
unit
for unit in u.__dict__.values()
if (isinstance(unit, UnitBase) and not isinstance(unit, PrefixUnit))
],
ids=str,
)
def test_roundtrip(self, ... | TestRoundtripGeneric |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.