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 | python-openxml__python-docx | tests/image/test_tiff.py | {
"start": 7912,
"end": 9382
} | class ____:
def it_can_iterate_through_the_directory_entries_in_an_IFD(self, iter_fixture):
(
ifd_parser,
_IfdEntryFactory_,
stream_rdr,
offsets,
expected_entries,
) = iter_fixture
entries = list(ifd_parser.iter_entries())
a... | Describe_IfdParser |
python | anthropics__anthropic-sdk-python | src/anthropic/types/raw_content_block_start_event.py | {
"start": 795,
"end": 929
} | class ____(BaseModel):
content_block: ContentBlock
index: int
type: Literal["content_block_start"]
| RawContentBlockStartEvent |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/refurb/FURB189.py | {
"start": 654,
"end": 891
} | class ____(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Activity state. This is an optional property and if not provided, the state will be Active by
default.
"""
ACTIVE = "Active"
INACTIVE = "Inactive"
| ActivityState |
python | getsentry__sentry | tests/sentry/api/endpoints/test_auth_validate.py | {
"start": 242,
"end": 1956
} | class ____(APITestCase):
def setUp(self) -> None:
super().setUp()
self.user = self.create_user()
self.user.set_password("ThisIsATestPassword1234")
self.user.save()
self.org = self.create_organization(owner=self.user)
self.url = reverse("sentry-api-0-auth-test")
... | AuthenticatedTest |
python | huggingface__transformers | src/transformers/models/yolos/image_processing_yolos.py | {
"start": 2091,
"end": 26869
} | class ____(ImagesKwargs, total=False):
r"""
format (`str`, *optional*, defaults to `AnnotationFormat.COCO_DETECTION`):
Data format of the annotations. One of "coco_detection" or "coco_panoptic".
do_convert_annotations (`bool`, *optional*, defaults to `True`):
Controls whether to convert the ... | YolosImageProcessorKwargs |
python | Textualize__textual | src/textual/events.py | {
"start": 23282,
"end": 23921
} | class ____(Event, bubble=True):
"""Event containing text that was pasted into the Textual application.
This event will only appear when running in a terminal emulator that supports
bracketed paste mode. Textual will enable bracketed pastes when an app starts,
and disable it when the app shuts down.
... | Paste |
python | pypa__warehouse | tests/unit/email/test_init.py | {
"start": 109288,
"end": 111606
} | class ____:
@pytest.fixture
def _team(self, pyramid_user):
self.user = pyramid_user
self.organization_name = "exampleorganization"
self.team_name = "Example Team"
@pytest.mark.usefixtures("_team")
@pytest.mark.parametrize(
("email_template_name", "send_team_email"),
... | TestTeamEmails |
python | pypa__hatch | tests/utils/test_fs.py | {
"start": 88,
"end": 3463
} | class ____:
def test_type(self):
expected_type = type(pathlib.Path())
assert isinstance(Path(), expected_type)
assert issubclass(Path, expected_type)
def test_resolve_relative_non_existent(self, tmp_path):
origin = os.getcwd()
os.chdir(tmp_path)
try:
... | TestPath |
python | milvus-io__pymilvus | tests/test_bulk_writer_validators.py | {
"start": 274,
"end": 2484
} | class ____:
def test_valid_list(self):
"""Test valid list of floats"""
result = float_vector_validator([1.0, 2.0, 3.0], 3)
assert result == [1.0, 2.0, 3.0]
def test_invalid_list_length(self):
"""Test list with wrong dimension"""
with pytest.raises(MilvusException, match=... | TestFloatVectorValidator |
python | prompt-toolkit__python-prompt-toolkit | src/prompt_toolkit/formatted_text/html.py | {
"start": 3835,
"end": 4374
} | class ____(Formatter):
def format_field(self, value: object, format_spec: str) -> str:
return html_escape(format(value, format_spec))
def html_escape(text: object) -> str:
# The string interpolation functions also take integers and other types.
# Convert to string first.
if not isinstance(text... | HTMLFormatter |
python | sympy__sympy | sympy/polys/numberfields/modules.py | {
"start": 27753,
"end": 42205
} | class ____(Module, IntegerPowerable):
"""A submodule of another module."""
def __init__(self, parent, matrix, denom=1, mult_tab=None):
"""
Parameters
==========
parent : :py:class:`~.Module`
The module from which this one is derived.
matrix : :py:class:`~.Do... | Submodule |
python | bokeh__bokeh | src/bokeh/models/text.py | {
"start": 2177,
"end": 2456
} | class ____(MathText):
""" Render mathematical content using `AsciiMath <http://asciimath.org/>`_
notation.
"""
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
| Ascii |
python | huggingface__transformers | tests/models/convbert/test_modeling_convbert.py | {
"start": 1413,
"end": 9762
} | class ____:
def __init__(
self,
parent,
batch_size=13,
seq_length=7,
is_training=True,
use_input_mask=True,
use_token_type_ids=True,
use_labels=True,
vocab_size=99,
hidden_size=32,
num_hidden_layers=2,
num_attention_head... | ConvBertModelTester |
python | weaviate__weaviate-python-client | weaviate/rbac/models.py | {
"start": 2303,
"end": 2392
} | class ____(TypedDict):
name: str
permissions: List[WeaviatePermission]
| WeaviateRole |
python | numba__llvmlite | llvmlite/ir/transforms.py | {
"start": 978,
"end": 1552
} | class ____(CallVisitor):
def __init__(self, orig, repl):
super(ReplaceCalls, self).__init__()
self.orig = orig
self.repl = repl
self.calls = []
def visit_Call(self, instr):
if instr.callee == self.orig:
instr.replace_callee(self.repl)
self.calls.a... | ReplaceCalls |
python | google__jax | jax/_src/pallas/fuser/custom_fusion_lib.py | {
"start": 1776,
"end": 1967
} | class ____(Protocol):
def __call__(
self,
ctx: CustomEvalContext,
*args: Any,
) -> Sequence[Any]:
...
@custom_api_util.register_custom_decorator_type
| CustomEvalRuleFn |
python | realpython__materials | inheritance-and-composition/composition/employees.py | {
"start": 1074,
"end": 1578
} | class ____:
def __init__(self, id, name, address, role, payroll):
self.id = id
self.name = name
self.address = address
self.role = role
self.payroll = payroll
def work(self, hours):
duties = self.role.perform_duties(hours)
print(f"Employee {self.id} - {se... | Employee |
python | getsentry__sentry | src/sentry/logging/handlers.py | {
"start": 5048,
"end": 5638
} | class ____(logging.Handler):
def emit(self, record, logger=None):
"""
Turn something like:
> django.request.Forbidden (CSRF cookie not set.): /account
into:
> django.request.forbidden_csrf_cookie_not_set
and track it as an incremented counter.
"""
... | MetricsLogHandler |
python | ray-project__ray | python/ray/serve/tests/test_fastapi.py | {
"start": 13860,
"end": 31229
} | class ____(BaseModel):
a: str
# https://github.com/ray-project/ray/issues/16757
b: List[str]
def test_fastapi_nested_field_in_response_model(serve_instance):
app = FastAPI()
@app.get("/", response_model=TestModel)
def test_endpoint():
test_model = TestModel(a="a", b=["b"])
re... | TestModel |
python | pypa__warehouse | warehouse/integrations/secrets/utils.py | {
"start": 392,
"end": 2115
} | class ____:
def __init__(
self, name, key_id_header, signature_header, verification_url, api_token=None
):
# The display name of the integrator
self.name = name
# The headers that we expect to be present for each integrator
self.key_id_header = key_id_header
self... | DisclosureOrigin |
python | django-compressor__django-compressor | compressor/tests/test_parsers.py | {
"start": 5026,
"end": 5133
} | class ____(ParserTestCase, CompressorTestCase):
parser_cls = "compressor.parser.HtmlParser"
| HtmlParserTests |
python | pytorch__pytorch | torch/distributed/_tools/mem_tracker.py | {
"start": 3301,
"end": 4639
} | class ____:
"""
A class to store the memory statistics of a module.
Args:
mod_fqn (str): The fully qualified name of the module.
Attributes:
mod_fqn (str): The fully qualified name of the module.
parameter_mem (int): The memory usage of the parameters of the module.
buff... | _ModMemStats |
python | scipy__scipy | scipy/stats/tests/test_hypotests.py | {
"start": 83624,
"end": 88480
} | class ____:
# data with unequal variances
data_same_size = ([24., 23., 31., 51.],
[34., 18., 18., 26.],
[17., 68., 59., 7.])
data_diff_size = ([30., 23., 51.],
[-81., 71., -27., 63.],
[42., 11., 29., 19., 50.],
... | TestGamesHowell |
python | aio-libs__aiohttp | aiohttp/http_parser.py | {
"start": 2140,
"end": 2451
} | class ____(NamedTuple):
version: HttpVersion
code: int
reason: str
headers: CIMultiDictProxy[str]
raw_headers: RawHeaders
should_close: bool
compression: str | None
upgrade: bool
chunked: bool
_MsgT = TypeVar("_MsgT", RawRequestMessage, RawResponseMessage)
| RawResponseMessage |
python | airbytehq__airbyte | airbyte-integrations/connectors/destination-pgvector/destination_pgvector/destination.py | {
"start": 705,
"end": 3320
} | class ____(Destination):
sql_processor: pgvector_processor.PGVectorProcessor
def _init_sql_processor(
self, config: ConfigModel, configured_catalog: Optional[ConfiguredAirbyteCatalog] = None
) -> None:
self.sql_processor = pgvector_processor.PGVectorProcessor(
sql_config=pgvecto... | DestinationPGVector |
python | pandas-dev__pandas | pandas/tests/frame/indexing/test_coercion.py | {
"start": 376,
"end": 5125
} | class ____:
@pytest.mark.parametrize("consolidate", [True, False])
def test_loc_setitem_multiindex_columns(self, consolidate):
# GH#18415 Setting values in a single column preserves dtype,
# while setting them in multiple columns did unwanted cast.
# Note that A here has 2 blocks, belo... | TestDataFrameSetitemCoercion |
python | Pylons__pyramid | tests/test_renderers.py | {
"start": 4674,
"end": 15950
} | class ____(unittest.TestCase):
def setUp(self):
self.config = cleanUp()
def tearDown(self):
cleanUp()
def _makeOne(self, *arg, **kw):
from pyramid.renderers import RendererHelper
return RendererHelper(*arg, **kw)
def test_instance_conforms(self):
from zope.int... | TestRendererHelper |
python | encode__django-rest-framework | tests/test_throttling.py | {
"start": 16288,
"end": 16890
} | class ____(TestCase):
def setUp(self):
self.throttle = AnonRateThrottle()
def test_authenticated_user_not_affected(self):
request = Request(HttpRequest())
user = User.objects.create(username='test')
force_authenticate(request, user)
request.user = user
assert se... | AnonRateThrottleTests |
python | pypa__warehouse | warehouse/organizations/models.py | {
"start": 29609,
"end": 29669
} | class ____(str, enum.Enum):
Member = "Member"
| TeamRoleType |
python | scikit-learn__scikit-learn | sklearn/_loss/loss.py | {
"start": 27603,
"end": 29955
} | class ____(BaseLoss):
"""Half Tweedie deviance loss with log-link, for regression.
Domain:
y_true in real numbers for power <= 0
y_true in non-negative real numbers for 0 < power < 2
y_true in positive real numbers for 2 <= power
y_pred in positive real numbers
power in real numbers
Li... | HalfTweedieLoss |
python | openai__openai-python | src/openai/resources/vector_stores/vector_stores.py | {
"start": 34352,
"end": 35451
} | class ____:
def __init__(self, vector_stores: AsyncVectorStores) -> None:
self._vector_stores = vector_stores
self.create = async_to_streamed_response_wrapper(
vector_stores.create,
)
self.retrieve = async_to_streamed_response_wrapper(
vector_stores.retrieve,... | AsyncVectorStoresWithStreamingResponse |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/array_ops/large_concat_op_test.py | {
"start": 908,
"end": 1580
} | class ____(test.TestCase):
"""Tests that belong in concat_op_test.py, but run over large tensors."""
def testConcatLargeTensors(self):
# CPU-only test, because it fails on GPUs with <= 4GB memory.
with ops.device("/cpu:0"):
a = array_ops.ones([2**31 + 6], dtype=dtypes.int8)
b = array_ops.zeros(... | LargeConcatOpTest |
python | pola-rs__polars | py-polars/src/polars/io/iceberg/dataset.py | {
"start": 19553,
"end": 22251
} | class ____(_ResolvedScanDataBase):
"""Resolved parameters for reading via PyIceberg."""
# We're not interested in inspecting anything for the pyiceberg scan, so
# this class is just a wrapper.
lf: pl.LazyFrame
_snapshot_id_key: str
def to_lazyframe(self) -> pl.LazyFrame:
return self.lf... | _PyIcebergScanData |
python | run-llama__llama_index | llama-index-integrations/storage/index_store/llama-index-storage-index-store-gel/llama_index/storage/index_store/gel/base.py | {
"start": 167,
"end": 685
} | class ____(KVIndexStore):
"""
Gel Index store.
Args:
gel_kvstore (GelKVStore): Gel key-value store
namespace (str): namespace for the index store
"""
def __init__(
self,
gel_kvstore: GelKVStore,
namespace: Optional[str] = None,
collection_suffix: Op... | GelIndexStore |
python | joke2k__faker | faker/providers/bank/fr_FR/__init__.py | {
"start": 42,
"end": 197
} | class ____(BankProvider):
"""Implement bank provider for ``fr_FR`` locale."""
bban_format = "#######################"
country_code = "FR"
| Provider |
python | pandas-dev__pandas | asv_bench/benchmarks/frame_ctor.py | {
"start": 2310,
"end": 2751
} | class ____:
params = [None, 1000]
param_names = ["nrows"]
# Generators get exhausted on use, so run setup before every call
number = 1
repeat = (3, 250, 10)
def setup(self, nrows):
N = 100000
self.gen = ((x, (x * 20), (x * 100)) for x in range(N))
def time_frame_from_recor... | FromRecords |
python | allegroai__clearml | clearml/backend_api/services/v2_23/projects.py | {
"start": 140119,
"end": 141262
} | class ____(Response):
"""
Response of projects.make_public endpoint.
:param updated: Number of projects updated
:type updated: int
"""
_service = "projects"
_action = "make_public"
_version = "2.23"
_schema = {
"definitions": {},
"properties": {
"updated... | MakePublicResponse |
python | mlflow__mlflow | mlflow/openai/model.py | {
"start": 23884,
"end": 31486
} | class ____:
def __init__(self, model):
task = model.pop("task")
if task not in _PYFUNC_SUPPORTED_TASKS:
raise mlflow.MlflowException.invalid_parameter_value(
f"Unsupported task: {task}. Supported tasks: {_PYFUNC_SUPPORTED_TASKS}."
)
self.model = model
... | _OpenAIWrapper |
python | openai__openai-python | src/openai/types/image_edit_params.py | {
"start": 4704,
"end": 5008
} | class ____(ImageEditParamsBase, total=False):
stream: Optional[Literal[False]]
"""Edit the image in streaming mode.
Defaults to `false`. See the
[Image generation guide](https://platform.openai.com/docs/guides/image-generation)
for more information.
"""
| ImageEditParamsNonStreaming |
python | kamyu104__LeetCode-Solutions | Python/count-unguarded-cells-in-the-grid.py | {
"start": 76,
"end": 872
} | class ____(object):
def countUnguarded(self, m, n, guards, walls):
"""
:type m: int
:type n: int
:type guards: List[List[int]]
:type walls: List[List[int]]
:rtype: int
"""
DIRECTIONS = [(0, 1), (1, 0), (0, -1), (-1, 0)]
GREEN, RED, BLOCK = rang... | Solution |
python | django__django | django/db/backends/postgresql/compiler.py | {
"start": 581,
"end": 2310
} | class ____(BaseSQLInsertCompiler):
def assemble_as_sql(self, fields, value_rows):
# Specialize bulk-insertion of literal values through UNNEST to
# reduce the time spent planning the query.
if (
# The optimization is not worth doing if there is a single
# row as it wi... | SQLInsertCompiler |
python | getsentry__sentry | tests/sentry/workflow_engine/endpoints/test_organization_alertrule_detector.py | {
"start": 1590,
"end": 5143
} | class ____(OrganizationAlertRuleDetectorAPITestCase):
def test_get_with_detector_id_filter(self) -> None:
response = self.get_success_response(
self.organization.slug, detector_id=str(self.detector_1.id)
)
assert response.data == serialize(self.alert_rule_detector_1, self.user)
... | OrganizationAlertRuleDetectorIndexGetTest |
python | realpython__materials | python-magic-methods/number.py | {
"start": 0,
"end": 647
} | class ____:
def __init__(self, value):
self.value = value
def __add__(self, other):
print("__add__ called")
if isinstance(other, Number):
return Number(self.value + other.value)
elif isinstance(other, int | float):
return Number(self.value + other)
... | Number |
python | getsentry__sentry | tests/sentry/models/test_commitfilechange.py | {
"start": 194,
"end": 929
} | class ____(TestCase):
def test_get_count_for_commits(self) -> None:
group = self.create_group()
organization_id = group.organization.id
repo = Repository.objects.create(name="example", organization_id=organization_id)
commit = Commit.objects.create(
key="a" * 40,
... | CommitFileChangeTest |
python | getsentry__sentry | tests/acceptance/test_organization_alert_rules.py | {
"start": 393,
"end": 2422
} | class ____(AcceptanceTestCase, SnubaTestCase):
def setUp(self) -> None:
super().setUp()
self.login_as(self.user)
self.path = f"/organizations/{self.organization.slug}/alerts/rules/"
def test_empty_alert_rules(self) -> None:
with self.feature(FEATURE_NAME):
self.brows... | OrganizationAlertRulesListTest |
python | sqlalchemy__sqlalchemy | test/ext/test_mutable.py | {
"start": 33164,
"end": 34518
} | class ____(
_MutableDictTestBase, fixtures.MappedTest
):
@classmethod
def define_tables(cls, metadata):
Table(
"foo",
metadata,
Column(
"id", Integer, primary_key=True, test_needs_autoincrement=True
),
Column("data", PickleT... | MutableAssocWithAttrInheritTest |
python | dagster-io__dagster | examples/docs_snippets/docs_snippets/integrations/tableau/customize_upstream_dependencies.py | {
"start": 625,
"end": 1445
} | class ____(DagsterTableauTranslator):
def get_asset_spec(self, data: TableauTranslatorData) -> dg.AssetSpec:
# We create the default asset spec using super()
default_spec = super().get_asset_spec(data)
# We customize upstream dependencies for the Tableau sheet named `my_tableau_sheet`
... | MyCustomTableauTranslator |
python | Lightning-AI__lightning | tests/tests_pytorch/checkpointing/test_model_checkpoint.py | {
"start": 42385,
"end": 42518
} | class ____(Callback):
def on_train_end(self, trainer, pl_module):
raise RuntimeError("Trouble!")
| TroubledCallbackOnTrainEnd |
python | apache__airflow | kubernetes-tests/tests/kubernetes_tests/test_kubernetes_pod_operator.py | {
"start": 58813,
"end": 60620
} | class ____(BaseK8STest):
@pytest.fixture(autouse=True)
def setup_connections(self, create_connection_without_db):
"""Create kubernetes_default connection"""
connection = Connection(
conn_id="kubernetes_default",
conn_type="kubernetes",
)
create_connection_... | TestKubernetesPodOperator |
python | wandb__wandb | wandb/_pydantic/base.py | {
"start": 1616,
"end": 1754
} | class ____(PydanticCompatMixin, BaseModel):
__doc__ = None # Prevent subclasses from inheriting the BaseModel docstring
| CompatBaseModel |
python | pytorch__pytorch | test/dynamo/test_modules.py | {
"start": 29922,
"end": 30199
} | class ____(torch.nn.Module):
def __init__(self):
super().__init__()
self.layer = torch.nn.Linear(4, 4)
self.step = 10
def forward(self, x: torch.Tensor) -> torch.Tensor:
x = x + 1
return self.layer(x) + self.step
| ModuleWithIntAttr |
python | great-expectations__great_expectations | great_expectations/render/components.py | {
"start": 16528,
"end": 17153
} | class ____(RenderedComponentContent):
def __init__(self, markdown, styling=None, content_block_type="markdown") -> None:
super().__init__(content_block_type=content_block_type, styling=styling)
self.markdown = markdown
@override
def to_json_dict(self) -> dict[str, JSONValues]:
"""Re... | RenderedMarkdownContent |
python | charliermarsh__ruff | crates/ruff_python_formatter/resources/test/fixtures/black/cases/type_params.py | {
"start": 53,
"end": 671
} | class ____[ T ] : pass
def all_in[T : int,U : (bytes, str),* Ts,**P](): pass
def really_long[WhatIsTheLongestTypeVarNameYouCanThinkOfEnoughToMakeBlackSplitThisLine](): pass
def even_longer[WhatIsTheLongestTypeVarNameYouCanThinkOfEnoughToMakeBlackSplitThisLine: WhatIfItHadABound](): pass
def it_gets_worse[What... | C |
python | apache__airflow | providers/google/tests/unit/google/cloud/hooks/test_kubernetes_engine.py | {
"start": 4545,
"end": 5117
} | class ____:
def setup_method(self):
self.gke_hook = GKEHook(location=GKE_ZONE)
@mock.patch(GKE_STRING.format("GKEHook.get_credentials"))
@mock.patch(GKE_STRING.format("ClusterManagerClient"))
def test_gke_cluster_client_creation(self, mock_client, mock_get_creds):
result = self.gke_hook... | TestGKEHookClient |
python | pandas-dev__pandas | asv_bench/benchmarks/gil.py | {
"start": 5390,
"end": 6530
} | class ____:
params = ["median", "mean", "min", "max", "var", "skew", "kurt", "std"]
param_names = ["method"]
def setup(self, method):
win = 100
arr = np.random.rand(100000)
if hasattr(DataFrame, "rolling"):
df = DataFrame(arr).rolling(win)
@run_parallel(num_... | ParallelRolling |
python | huggingface__transformers | src/transformers/models/qwen2_5_omni/configuration_qwen2_5_omni.py | {
"start": 17581,
"end": 22786
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`Qwen2_5OmniThinkerForConditionalGeneration`]. It is used to instantiate an
Qwen2.5-Omni-Thinker model according to the specified arguments, defining the model architecture. Instantiating a configuration
... | Qwen2_5OmniThinkerConfig |
python | encode__django-rest-framework | tests/test_renderers.py | {
"start": 1847,
"end": 2049
} | class ____(BaseRenderer):
media_type = 'mock/renderera'
format = "formata"
def render(self, data, media_type=None, renderer_context=None):
return RENDERER_A_SERIALIZER(data)
| RendererA |
python | pydantic__pydantic | tests/mypy/outputs/mypy-plugin_ini/pydantic_settings.py | {
"start": 65,
"end": 686
} | class ____(BaseSettings):
foo: str
s = Settings()
s = Settings(foo='test', _case_sensitive=True, _env_prefix='test__', _env_file='test')
s = Settings(foo='test', _case_sensitive=1, _env_prefix=2, _env_file=3)
# MYPY: error: Argument "_case_sensitive" to "Settings" has incompatible type "int"; expected "Optional... | Settings |
python | pypa__pip | src/pip/_internal/metadata/importlib/_dists.py | {
"start": 3327,
"end": 8420
} | class ____(BaseDistribution):
def __init__(
self,
dist: importlib.metadata.Distribution,
info_location: BasePath | None,
installed_location: BasePath | None,
) -> None:
self._dist = dist
self._info_location = info_location
self._installed_location = instal... | Distribution |
python | python__mypy | mypy/stubgen.py | {
"start": 14854,
"end": 16135
} | class ____(mypy.mixedtraverser.MixedTraverserVisitor):
"""Find all name references (both local and global)."""
# TODO: Filter out local variable and class attribute references
def __init__(self) -> None:
# Short names of things defined at the top level.
self.refs: set[str] = set()
def... | ReferenceFinder |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 55188,
"end": 55463
} | class ____(sgqlc.types.Enum):
"""Properties by which package file connections can be ordered.
Enumeration Choices:
* `CREATED_AT`: Order package files by creation time
"""
__schema__ = github_schema
__choices__ = ("CREATED_AT",)
| PackageFileOrderField |
python | getsentry__sentry | tests/sentry_plugins/github/endpoints/test_pull_request_event.py | {
"start": 549,
"end": 5332
} | class ____(APITestCase):
def test_opened(self) -> None:
project = self.project # force creation
user = self.create_user(email="alberto@sentry.io")
with assume_test_silo_mode(SiloMode.CONTROL):
UserSocialAuth.objects.create(provider="github", user=user, uid=6752317)
self.... | PullRequestEventWebhook |
python | celery__celery | t/unit/utils/test_collections.py | {
"start": 11755,
"end": 12898
} | class ____:
def test_append_limited(self):
b = BufferMap(10)
for i in range(20):
b.put(i, i)
self.assert_size_and_first(b, 10, 10)
def assert_size_and_first(self, buf, size, expected_first_item):
assert buf.total == size
assert buf._LRUpop() == expected_firs... | test_BufferMap |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/sql/selectable.py | {
"start": 99547,
"end": 101773
} | class ____(AliasedReturnsRows):
"""Represent a subquery of a SELECT.
A :class:`.Subquery` is created by invoking the
:meth:`_expression.SelectBase.subquery` method, or for convenience the
:meth:`_expression.SelectBase.alias` method, on any
:class:`_expression.SelectBase` subclass
which includes... | Subquery |
python | facelessuser__pymdown-extensions | tests/test_extensions/test_tabbed.py | {
"start": 17905,
"end": 20549
} | class ____(util.MdCase):
"""Combine header slug with content tab."""
extension = ['pymdownx.tabbed', 'toc', 'pymdownx.details']
extension_configs = {
'pymdownx.tabbed': {
'slugify': slugify(case='lower'),
'combine_header_slug': True
}
}
def test_combine_head... | TestTabSlugsCombineHeader |
python | getsentry__sentry | src/sentry/dynamic_sampling/types.py | {
"start": 343,
"end": 503
} | class ____(Enum):
"""The type of data being measured for dynamic sampling rebalancing."""
SPANS = "spans"
TRANSACTIONS = "transactions"
| SamplingMeasure |
python | pypa__setuptools | setuptools/_vendor/importlib_metadata/__init__.py | {
"start": 1352,
"end": 2927
} | class ____:
"""
A simple entry point config parser for performance
>>> for item in Sectioned.read(Sectioned._sample):
... print(item)
Pair(name='sec1', value='# comments ignored')
Pair(name='sec1', value='a = 1')
Pair(name='sec1', value='b = 2')
Pair(name='sec2', value='a = 2')
... | Sectioned |
python | ansible__ansible | test/units/module_utils/datatag/test_datatag.py | {
"start": 11028,
"end": 11659
} | class ____:
def pytest_generate_tests(self, metafunc: pytest.Metafunc):
for node, mark in metafunc.definition.iter_markers_with_node("autoparam"):
attrname = mark.args[0]
test_arg_names = set(inspect.signature(metafunc.function).parameters)
argnames, argvalues, id_func = ... | AutoParamSupport |
python | django__django | tests/file_storage/tests.py | {
"start": 1346,
"end": 2246
} | class ____(unittest.TestCase):
def test_deconstruction(self):
path, args, kwargs = temp_storage.deconstruct()
self.assertEqual(path, "django.core.files.storage.FileSystemStorage")
self.assertEqual(args, ())
self.assertEqual(kwargs, {"location": temp_storage_location})
kwargs... | FileSystemStorageTests |
python | huggingface__transformers | src/transformers/models/wavlm/modeling_wavlm.py | {
"start": 56900,
"end": 61140
} | class ____(WavLMPreTrainedModel):
def __init__(self, config):
super().__init__(config)
if hasattr(config, "add_adapter") and config.add_adapter:
raise ValueError(
"Audio frame classification does not support the use of WavLM adapters (config.add_adapter=True)"
... | WavLMForAudioFrameClassification |
python | bokeh__bokeh | src/bokeh/models/glyphs.py | {
"start": 19186,
"end": 21243
} | class ____(Glyph, LineGlyph, FillGlyph, HatchGlyph):
''' Render horizontal tiles on a regular hexagonal grid.
'''
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
__example__ = "examples/reference/model... | HexTile |
python | tensorflow__tensorflow | tensorflow/python/keras/callbacks.py | {
"start": 104246,
"end": 106644
} | class ____(Callback):
"""Callback that streams epoch results to a CSV file.
Supports all values that can be represented as a string,
including 1D iterables such as `np.ndarray`.
Example:
```python
csv_logger = CSVLogger('training.log')
model.fit(X_train, Y_train, callbacks=[csv_logger])
```
Args:
... | CSVLogger |
python | scrapy__scrapy | tests/mockserver/http_resources.py | {
"start": 6764,
"end": 7092
} | class ____(resource.Resource):
def render(self, request):
from twisted.internet import reactor
def response():
request.write(b"chunked ")
request.write(b"content\n")
request.finish()
reactor.callLater(0, response)
return server.NOT_DONE_YET
| ChunkedResource |
python | dagster-io__dagster | helm/dagster/schema/schema/charts/dagster/subschema/daemon.py | {
"start": 1175,
"end": 1347
} | class ____(BaseModel):
queuedRunCoordinator: Optional[QueuedRunCoordinatorConfig] = None
customRunCoordinator: Optional[ConfigurableClass] = None
| RunCoordinatorConfig |
python | google__jax | tests/ffi_test.py | {
"start": 1292,
"end": 13990
} | class ____(jtu.JaxTestCase):
def find_custom_call_in_module(self, module):
for func in module.body.operations:
for block in func.body.blocks:
for op in block.operations:
if op.OPERATION_NAME == "stablehlo.custom_call":
return op
self.fail("No custom_call found in the lower... | FfiTest |
python | fastai__fastai | fastai/layers.py | {
"start": 4270,
"end": 4644
} | class ____(Module):
"Layer that concats `AdaptiveAvgPool1d` and `AdaptiveMaxPool1d`"
def __init__(self, size=None):
self.size = size or 1
self.ap = nn.AdaptiveAvgPool1d(self.size)
self.mp = nn.AdaptiveMaxPool1d(self.size)
def forward(self, x): return torch.cat([self.mp(x), self.ap(x)... | AdaptiveConcatPool1d |
python | getsentry__sentry | src/sentry/auth/email.py | {
"start": 388,
"end": 953
} | class ____(Exception):
def __init__(self, email: str, users: Collection[User]) -> None:
super().__init__(f"Resolved {email!r} to {[user.id for user in users]}")
self.email = email
self.users = tuple(users)
def resolve_email_to_user(email: str, organization: Organization | None = None) -> U... | AmbiguousUserFromEmail |
python | facebookresearch__faiss | faiss/gpu/test/test_cuvs.py | {
"start": 383,
"end": 2766
} | class ____(unittest.TestCase):
def test_large_k_search(self):
k = 10_000
ds = SyntheticDataset(32, 100_000, 100_000, 1000)
res = faiss.StandardGpuResources()
config = faiss.GpuIndexFlatConfig()
config.use_cuvs = True
index_gpu = faiss.GpuIndexFlatL2(res, ds.d, config... | TestBfKnn |
python | RaRe-Technologies__gensim | gensim/test/test_similarity_metrics.py | {
"start": 497,
"end": 2176
} | class ____(unittest.TestCase):
def test_None(self):
# test None
result = matutils.isbow(None)
expected = False
self.assertEqual(expected, result)
def test_bow(self):
# test list words
# one bag of words
potentialbow = [(0, 0.4)]
result = matutils... | TestIsBow |
python | getsentry__sentry | tests/sentry/feedback/endpoints/test_project_user_reports.py | {
"start": 7986,
"end": 18418
} | class ____(APITestCase, SnubaTestCase):
def setUp(self) -> None:
super().setUp()
self.min_ago = before_now(minutes=1).isoformat()
self.hour_ago = before_now(minutes=60).isoformat()
self.project = self.create_project()
self.environment = self.create_environment(project=self.p... | CreateProjectUserReportTest |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/io_ops/reader_ops_test.py | {
"start": 4019,
"end": 9449
} | class ____(test.TestCase):
def _ExpectRead(self, key, value, expected):
k, v = self.evaluate([key, value])
self.assertAllEqual(expected, k)
self.assertAllEqual(expected, v)
@test_util.run_deprecated_v1
def testOneEpoch(self):
reader = io_ops.IdentityReader("test_reader")
work_completed = rea... | IdentityReaderTest |
python | redis__redis-py | redis/commands/timeseries/info.py | {
"start": 66,
"end": 3223
} | class ____:
"""
Hold information and statistics on the time-series.
Can be created using ``tsinfo`` command
https://redis.io/docs/latest/commands/ts.info/
"""
rules = []
labels = []
sourceKey = None
chunk_count = None
memory_usage = None
total_samples = None
retention_ms... | TSInfo |
python | getlogbook__logbook | benchmark/bench_logging_noop_filter.py | {
"start": 183,
"end": 465
} | class ____(Filter):
def filter(self, record):
return False
def run():
out = StringIO()
handler = StreamHandler(out)
handler.addFilter(DisableFilter())
log.addHandler(handler)
for _ in range(500):
log.warning("this is not handled")
| DisableFilter |
python | allegroai__clearml | clearml/backend_api/services/v2_20/models.py | {
"start": 22631,
"end": 23856
} | class ____(Response):
"""
Response of models.add_or_update_metadata endpoint.
:param updated: Number of models updated (0 or 1)
:type updated: int
"""
_service = "models"
_action = "add_or_update_metadata"
_version = "2.20"
_schema = {
"definitions": {},
"properties... | AddOrUpdateMetadataResponse |
python | marshmallow-code__marshmallow | tests/test_registry.py | {
"start": 4724,
"end": 4844
} | class ____(Schema):
id = fields.Integer()
b = fields.Nested("tests.test_registry.BSchema", exclude=("a",))
| ASchema |
python | pytest-dev__pytest | src/_pytest/pytester.py | {
"start": 53993,
"end": 62389
} | class ____:
"""Flexible matching of text.
This is a convenience class to test large texts like the output of
commands.
The constructor takes a list of lines without their trailing newlines, i.e.
``text.splitlines()``.
"""
def __init__(self, lines: list[str]) -> None:
self.lines = ... | LineMatcher |
python | getsentry__sentry | src/sentry/sentry_apps/api/serializers/servicehookproject.py | {
"start": 157,
"end": 363
} | class ____(Serializer):
def serialize(self, obj, attrs, user, **kwargs):
return {
"id": str(obj.id),
"project_id": str(obj.project_id),
}
| ServiceHookProjectSerializer |
python | charliermarsh__ruff | crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring_code_examples_dynamic_line_width.py | {
"start": 6020,
"end": 6880
} | class ____(Abc, Def, Ghi, Jkl, Mno, Pqr, Stu, Vwx, Yz, A1, A2, A3, A4, A5):
def abcdefghijklmnopqrstuvwxyz(self, abc, ddef, ghi, jkl, mno, pqr, stu, vwx, yz, a1, a2, a3, a4):
def abcdefghijklmnopqrstuvwxyz(abc, ddef, ghi, jkl, mno, pqr, stu, vwx, yz, a1, a2, a3, a4):
# For 4 space indents, this ... | Abcdefghijklmopqrstuvwxyz |
python | doocs__leetcode | solution/1800-1899/1885.Count Pairs in Two Arrays/Solution.py | {
"start": 0,
"end": 365
} | class ____:
def countPairs(self, nums1: List[int], nums2: List[int]) -> int:
nums = [a - b for a, b in zip(nums1, nums2)]
nums.sort()
l, r = 0, len(nums) - 1
ans = 0
while l < r:
while l < r and nums[l] + nums[r] <= 0:
l += 1
ans += r -... | Solution |
python | run-llama__llama_index | llama-index-integrations/readers/llama-index-readers-sec-filings/llama_index/readers/sec_filings/sec_filings.py | {
"start": 3201,
"end": 10797
} | class ____:
def __init__(
self,
tickers: List[str],
amount: int,
filing_type: str,
start_date: str = DEFAULT_AFTER_DATE,
end_date: str = DEFAULT_BEFORE_DATE,
sections: List[str] = ["_ALL"],
include_amends: bool = True,
):
"""
_summa... | SECExtractor |
python | huggingface__transformers | src/transformers/models/video_llama_3/image_processing_video_llama_3_fast.py | {
"start": 2949,
"end": 12473
} | class ____(BaseImageProcessorFast):
do_resize = True
resample = PILImageResampling.BICUBIC
size = {"shortest_edge": 56 * 56, "longest_edge": 28 * 28 * 1280}
do_rescale = True
do_normalize = True
image_mean = IMAGENET_STANDARD_MEAN
image_std = IMAGENET_STANDARD_STD
do_convert_rgb = True
... | VideoLlama3ImageProcessorFast |
python | doocs__leetcode | lcof/面试题05. 替换空格/Solution.py | {
"start": 0,
"end": 96
} | class ____:
def replaceSpace(self, s: str) -> str:
return s.replace(' ', '%20')
| Solution |
python | TheAlgorithms__Python | data_structures/linked_list/rotate_to_the_right.py | {
"start": 83,
"end": 4104
} | class ____:
data: int
next_node: Node | None = None
def print_linked_list(head: Node | None) -> None:
"""
Print the entire linked list iteratively.
This function prints the elements of a linked list separated by '->'.
Parameters:
head (Node | None): The head of the li... | Node |
python | facebookresearch__faiss | demos/demo_distributed_kmeans_torch.py | {
"start": 366,
"end": 5427
} | class ____(clustering.DatasetAssign):
"""
There is one instance per worker, each worker has a dataset shard.
The non-master workers do not run through the k-means function, so some
code has run it to keep the workers in sync.
"""
def __init__(self, res, x, rank, nproc):
clustering.Datas... | DatasetAssignDistributedGPU |
python | Pylons__pyramid | src/pyramid/httpexceptions.py | {
"start": 30867,
"end": 31417
} | class ____(HTTPClientError):
"""
subclass of :class:`~HTTPClientError`
This indicates that the server is unable to process the contained
instructions.
May be used to notify the client that their JSON/XML is well formed, but
not correct for the current request.
See RFC4918 section 11 for m... | HTTPUnprocessableEntity |
python | crytic__slither | slither/tools/read_storage/read_storage.py | {
"start": 2742,
"end": 37547
} | class ____:
def __init__(self, contracts: List[Contract], max_depth: int, rpc_info: RpcInfo = None) -> None:
self._checksum_address: Optional[ChecksumAddress] = None
self._contracts: List[Contract] = contracts
self._log: str = ""
self._max_depth: int = max_depth
self._slot_in... | SlitherReadStorage |
python | jina-ai__jina | setup.py | {
"start": 2766,
"end": 2921
} | class ____(develop):
"""Post-installation for development mode."""
def run(self):
develop.run(self)
register_ac()
| PostDevelopCommand |
python | streamlit__streamlit | lib/streamlit/elements/lib/column_types.py | {
"start": 3537,
"end": 3719
} | class ____(TypedDict):
type: Literal["link"]
max_chars: NotRequired[int | None]
validate: NotRequired[str | None]
display_text: NotRequired[str | None]
| LinkColumnConfig |
python | facelessuser__pymdown-extensions | tests/test_extensions/test_blocks/test_general_blocks.py | {
"start": 9402,
"end": 10447
} | class ____(util.MdCase):
"""Test Blocks tab cases."""
extension = ['pymdownx.blocks.admonition']
def test_attributes(self):
"""Test attributes."""
self.check_markdown(
R'''
/// admonition | Title
attrs: {class: some classes, id: an-id, name: some va... | TestAttributes |
python | getsentry__sentry | src/sentry/shared_integrations/exceptions/__init__.py | {
"start": 4223,
"end": 4273
} | class ____(ApiError):
code = 401
| ApiUnauthorized |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.