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
pandas-dev__pandas
pandas/tests/series/accessors/test_cat_accessor.py
{ "start": 371, "end": 9646 }
class ____: @pytest.mark.parametrize( "method", [ lambda x: x.cat.set_categories([1, 2, 3]), lambda x: x.cat.reorder_categories([2, 3, 1], ordered=True), lambda x: x.cat.rename_categories([1, 2, 3]), lambda x: x.cat.remove_unused_categories(), ...
TestCatAccessor
python
huggingface__transformers
tests/models/csm/test_modeling_csm.py
{ "start": 1411, "end": 4485 }
class ____: def __init__( self, parent, ignore_index=-100, batch_size=3, seq_length=7, is_training=True, depth_decoder_config={ "num_codebooks": 10, "backbone_hidden_size": 64, "vocab_size": 6, "hidden_size": 64,...
CsmModelTester
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 212433, "end": 213616 }
class ____(GeneratedAirbyteSource): @public def __init__( self, name: str, site: str, site_api_key: str, start_date: str, product_catalog: str ): """Airbyte Source for Chargebee. Documentation can be found at https://apidocs.chargebee.com/docs/api Args: name (st...
ChargebeeSource
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_bootstrap63.py
{ "start": 306, "end": 1534 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("bootstrap63.xlsx") def test_create_file(self): """Test the creation of an XlsxWriter file with default title.""" workbook = Workb...
TestCompareXLSXFiles
python
django__django
tests/admin_views/test_actions.py
{ "start": 19377, "end": 21385 }
class ____(TestCase): @classmethod def setUpTestData(cls): cls.s1 = ExternalSubscriber.objects.create( name="John Doe", email="john@example.org" ) cls.s2 = Subscriber.objects.create( name="Max Mustermann", email="max@example.org" ) cls.user = User....
AdminActionsPermissionTests
python
huggingface__transformers
src/transformers/models/glm4v/modular_glm4v.py
{ "start": 62671, "end": 70726 }
class ____(Qwen2_5_VLForConditionalGeneration): _checkpoint_conversion_mapping = {} def forward( self, input_ids: Optional[torch.LongTensor] = None, attention_mask: Optional[torch.Tensor] = None, position_ids: Optional[torch.LongTensor] = None, past_key_values: Optional[...
Glm4vForConditionalGeneration
python
kamyu104__LeetCode-Solutions
Python/diagonal-traverse-ii.py
{ "start": 71, "end": 688 }
class ____(object): def findDiagonalOrder(self, nums): """ :type nums: List[List[int]] :rtype: List[int] """ result, dq, col = [], collections.deque(), 0 for i in xrange(len(nums)+max(itertools.imap(len, nums))-1): new_dq = collections.deque() ...
Solution
python
ansible__ansible
test/lib/ansible_test/_internal/commands/sanity/__init__.py
{ "start": 25577, "end": 25664 }
class ____(TestMessage): """Single sanity test message for one file."""
SanityMessage
python
sanic-org__sanic
sanic/mixins/static.py
{ "start": 854, "end": 6768 }
class ____(BaseMixin, metaclass=SanicMeta): def __init__(self, *args, **kwargs) -> None: self._future_statics: set[FutureStatic] = set() def _apply_static(self, static: FutureStatic) -> Route: raise NotImplementedError # noqa def static( self, uri: str, file_or_dir...
StaticMixin
python
hynek__structlog
tests/test_twisted.py
{ "start": 1436, "end": 2520 }
class ____: def test_msg(self): """ log.msg renders correctly. """ bl = build_bl() assert "foo=42 event='event'" == bl.msg("event", foo=42) def test_errVanilla(self): """ log.err renders correctly if no failure is attached. """ bl = build...
TestBoundLogger
python
networkx__networkx
networkx/algorithms/flow/networksimplex.py
{ "start": 243, "end": 25098 }
class ____: def __init__( self, G, multigraph, demand="demand", capacity="capacity", weight="weight" ): # Number all nodes and edges and hereafter reference them using ONLY their numbers self.node_list = list(G) # nodes self.node_indices = {u: i for i, u in enumerate(self.node_l...
_DataEssentialsAndFunctions
python
spyder-ide__spyder
spyder/plugins/updatemanager/workers.py
{ "start": 2151, "end": 2280 }
class ____: """Enum with the different update types.""" Major = "major" Minor = "minor" Micro = "micro"
UpdateType
python
apache__airflow
providers/common/sql/tests/unit/common/sql/operators/test_sql.py
{ "start": 2654, "end": 4592 }
class ____: def _construct_operator(self, **kwargs): dag = DAG( "test_dag", schedule=None, start_date=datetime.datetime(2017, 1, 1), render_template_as_native_obj=True, ) return BaseSQLOperator( task_id="test_task", conn...
TestBaseSQLOperator
python
scrapy__scrapy
scrapy/core/http2/protocol.py
{ "start": 1645, "end": 2026 }
class ____(H2Error): def __init__( self, remote_ip_address: IPv4Address | IPv6Address | None, event: ConnectionTerminated, ) -> None: self.remote_ip_address = remote_ip_address self.terminate_event = event def __str__(self) -> str: return f"Received GOAWAY fr...
RemoteTerminatedConnection
python
PyCQA__pylint
tests/functional/u/unnecessary/unnecessary_dunder_call.py
{ "start": 2924, "end": 3704 }
class ____: @classmethod def get_first_subclass(cls): for subklass in cls.__subclasses__(): return subklass return object # Test no lint raised for attributes. my_instance_name = x.__class__.__name__ my_pkg_version = pkg.__version__ # Allow use of dunder methods on non instantiated...
Base
python
openai__openai-python
src/openai/types/responses/response_function_web_search_param.py
{ "start": 821, "end": 1000 }
class ____(TypedDict, total=False): type: Required[Literal["open_page"]] """The action type.""" url: Required[str] """The URL opened by the model."""
ActionOpenPage
python
Textualize__textual
tests/snapshot_tests/snapshot_apps/focus_component_class.py
{ "start": 210, "end": 680 }
class ____(Widget, can_focus=True): COMPONENT_CLASSES = {"tester--text"} DEFAULT_CSS = """ Tester { height: auto; } Tester:focus > .tester--text { background: red; } """ def __init__(self, n: int) -> None: self.n = n super().__init__() def rend...
Tester
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-vectorx/tests/test_vector_stores_vectorx.py
{ "start": 3678, "end": 5400 }
class ____(VectorXTestSetup): def setUp(self): self.embed_model = HuggingFaceEmbedding( model_name="sentence-transformers/all-MiniLM-L6-v2", device="cpu" ) def test_create_vector_store_from_params(self): vector_store = VectorXVectorStore.from_params( api_token=se...
TestVectorXVectorStore
python
huggingface__transformers
src/transformers/models/dinov2/modeling_dinov2.py
{ "start": 15889, "end": 16741 }
class ____(nn.Module): def __init__(self, config: Dinov2Config): super().__init__() self.config = config self.layer = nn.ModuleList([Dinov2Layer(config) for _ in range(config.num_hidden_layers)]) self.gradient_checkpointing = False def forward(self, hidden_states: torch.Tensor, ...
Dinov2Encoder
python
facelessuser__soupsieve
tests/test_level2/test_hover.py
{ "start": 49, "end": 554 }
class ____(util.TestCase): """Test hover selector.""" def test_hover(self): """Test hover.""" markup = """ <div> <p>Some text <span id="1" class="foo:bar:foobar"> in a paragraph</span>. <a id="2" class="bar" href="http://google.com">Link</a> <a id="3">Placeholde...
TestHover
python
kamyu104__LeetCode-Solutions
Python/maximum-number-of-accepted-invitations.py
{ "start": 5925, "end": 6954 }
class ____(object): def maximumInvitations(self, grid): """ :type grid: List[List[int]] :rtype: int """ def augment(adj, u, lookup, match): for v in adj[u]: if v in lookup: continue lookup.add(v) ...
Solution3
python
getsentry__sentry
src/sentry/feedback/endpoints/organization_feedback_categories.py
{ "start": 2046, "end": 2342 }
class ____(TypedDict): """Corresponds to GenerateFeedbackLabelGroupsRequest in Seer.""" labels: list[str] # Providing the LLM context so it knows what labels are used in the same context and are direct children feedbacks_context: list[LabelGroupFeedbacksContext]
LabelGroupsRequest
python
doocs__leetcode
solution/3100-3199/3155.Maximum Number of Upgradable Servers/Solution.py
{ "start": 0, "end": 327 }
class ____: def maxUpgrades( self, count: List[int], upgrade: List[int], sell: List[int], money: List[int] ) -> List[int]: ans = [] for cnt, cost, income, cash in zip(count, upgrade, sell, money): ans.append(min(cnt, (cnt * income + cash) // (cost + income))) return a...
Solution
python
spyder-ide__spyder
spyder/plugins/ipythonconsole/widgets/debugging.py
{ "start": 984, "end": 1456 }
class ____(IPython3Lexer): # Detect !cmd command and highlight them tokens = IPython3Lexer.tokens spyder_tokens = [ (r'(!)(\w+)(.*\n)', bygroups(Operator, Keyword, using(Python3Lexer))), (r'(%)(\w+)(.*\n)', bygroups(Operator, Keyword, using(Python3Lexer))), (r'(?s)(\s*)(%%profile)([^...
SpyderIPy3Lexer
python
getsentry__sentry
tests/sentry/sentry_apps/api/endpoints/test_sentry_app_installation_external_issue_actions.py
{ "start": 181, "end": 2984 }
class ____(APITestCase): def setUp(self) -> None: self.superuser = self.create_user(email="a@example.com", is_superuser=True) self.user = self.create_user(email="boop@example.com") self.org = self.create_organization(owner=self.user) self.project = self.create_project(organization=se...
SentryAppInstallationExternalIssuesEndpointTest
python
huggingface__transformers
src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
{ "start": 51299, "end": 54992 }
class ____(nn.Module): def __init__(self, config, seed=None): super().__init__() self.config = config self.seed = seed self.attention_type = config.attention_type if self.attention_type == "original_full": self.self = BigBirdPegasusSelfAttention(config) ...
BigBirdPegasusEncoderAttention
python
dask__dask
dask/dataframe/dask_expr/_groupby.py
{ "start": 40736, "end": 42123 }
class ____(Expr, GroupByBase): _parameters = [ "frame", "cum_raw", "cum_last", "meta", "aggregate", "initial", "columns", ] @functools.cached_property def _meta(self): return self.meta def _divisions(self): return self.frame.d...
GroupByCumulativeFinalizer
python
anthropics__anthropic-sdk-python
src/anthropic/resources/beta/beta.py
{ "start": 4032, "end": 4685 }
class ____: def __init__(self, beta: AsyncBeta) -> None: self._beta = beta @cached_property def models(self) -> AsyncModelsWithRawResponse: return AsyncModelsWithRawResponse(self._beta.models) @cached_property def messages(self) -> AsyncMessagesWithRawResponse: return Async...
AsyncBetaWithRawResponse
python
getsentry__sentry
tests/sentry/seer/explorer/test_tools.py
{ "start": 68980, "end": 74389 }
class ____(APITransactionTestCase, SnubaTestCase, OurLogTestCase): def setUp(self) -> None: super().setUp() self.login_as(user=self.user) self.ten_mins_ago = before_now(minutes=10) self.nine_mins_ago = before_now(minutes=9) self.trace_id = uuid.uuid4().hex # Create l...
TestLogsTraceQuery
python
pytest-dev__pytest-django
pytest_django_test/app/models.py
{ "start": 168, "end": 249 }
class ____(models.Model): name: str = models.CharField(max_length=100)
SecondItem
python
ApeWorX__ape
src/ape/managers/project.py
{ "start": 41819, "end": 62558 }
class ____(BaseManager): """ Manage dependencies for an Ape project. Note: Every project gets its own dependency-set (DependencyManager). """ # Class-level cache _cache: dict[DependencyAPI, Dependency] = {} def __init__(self, project: Optional["ProjectManager"] = None): self.projec...
DependencyManager
python
plotly__plotly.py
plotly/graph_objs/layout/_newshape.py
{ "start": 235, "end": 17830 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout" _path_str = "layout.newshape" _valid_props = { "drawdirection", "fillcolor", "fillrule", "label", "layer", "legend", "legendgroup", "legendgrouptitle", "legendrank", ...
Newshape
python
ray-project__ray
python/ray/util/queue.py
{ "start": 262, "end": 326 }
class ____(queue.Full): pass @PublicAPI(stability="beta")
Full
python
pyinstaller__pyinstaller
PyInstaller/building/makespec.py
{ "start": 2082, "end": 4602 }
class ____(argparse.Action): """ A command line option which takes multiple source:dest pairs. """ def __init__(self, *args, default=None, metavar=None, **kwargs): super().__init__(*args, default=[], metavar='SOURCE:DEST', **kwargs) def __call__(self, parser, namespace, value, option_string...
SourceDestAction
python
airbytehq__airbyte
airbyte-ci/connectors/metadata_service/lib/metadata_service/validators/metadata_validator.py
{ "start": 546, "end": 14102 }
class ____: docs_path: str prerelease_tag: Optional[str] = None disable_dockerhub_checks: bool = False ValidationResult = Tuple[bool, Optional[Union[ValidationError, str]]] Validator = Callable[[ConnectorMetadataDefinitionV0, ValidatorOptions], ValidationResult] _SOURCE_DECLARATIVE_MANIFEST_DEFINITION_ID...
ValidatorOptions
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/declarative_automation/automation_condition_evaluator.py
{ "start": 1232, "end": 9622 }
class ____: def __init__( self, *, entity_keys: AbstractSet[EntityKey], instance: DagsterInstance, asset_graph: BaseAssetGraph, cursor: AssetDaemonCursor, emit_backfills: bool, evaluation_id: int, default_condition: Optional[AutomationCondition...
AutomationConditionEvaluator
python
pydantic__pydantic
pydantic/_internal/_validate_call.py
{ "start": 1862, "end": 5321 }
class ____: """This is a wrapper around a function that validates the arguments passed to it, and optionally the return value.""" __slots__ = ( 'function', 'validate_return', 'schema_type', 'module', 'qualname', 'ns_resolver', 'config_wrapper', '_...
ValidateCallWrapper
python
pennersr__django-allauth
allauth/socialaccount/providers/edx/views.py
{ "start": 228, "end": 1709 }
class ____(OAuth2Adapter): provider_id = "edx" provider_default_url = "https://edx.org" settings = app_settings.PROVIDERS.get(provider_id, {}) provider_base_url = settings.get("EDX_URL", provider_default_url) access_token_url = "{0}/oauth2/access_token".format(provider_base_url) authorize_url ...
EdxOAuth2Adapter
python
getsentry__sentry
fixtures/safe_migrations_apps/bad_flow_delete_pending_with_fk_constraints_app/migrations/0002_delete_without_pending.py
{ "start": 190, "end": 501 }
class ____(CheckedMigration): atomic = False dependencies = [ ("bad_flow_delete_pending_with_fk_constraints_app", "0001_initial"), ] operations = [ SafeDeleteModel( name="TestTable", deletion_action=DeletionAction.MOVE_TO_PENDING, ), ]
Migration
python
pytorch__pytorch
tools/test/test_upload_test_stats.py
{ "start": 134, "end": 697 }
class ____(unittest.TestCase): @unittest.skipIf( IN_CI, "don't run in CI as this does a lot of network calls and uses up GH API rate limit", ) def test_existing_job(self) -> None: """Run on a known-good job and make sure we don't error and get basically okay results.""" test_...
TestUploadTestStats
python
Farama-Foundation__Gymnasium
gymnasium/envs/mujoco/swimmer_v5.py
{ "start": 182, "end": 15390 }
class ____(MujocoEnv, utils.EzPickle): r""" ## Description This environment corresponds to the Swimmer environment described in Rémi Coulom's PhD thesis ["Reinforcement Learning Using Neural Networks, with Applications to Motor Control"](https://tel.archives-ouvertes.fr/tel-00003985/document). The envir...
SwimmerEnv
python
Textualize__textual
docs/examples/widgets/input.py
{ "start": 79, "end": 295 }
class ____(App): def compose(self) -> ComposeResult: yield Input(placeholder="First Name") yield Input(placeholder="Last Name") if __name__ == "__main__": app = InputApp() app.run()
InputApp
python
huggingface__transformers
tests/models/vitmatte/test_modeling_vitmatte.py
{ "start": 4357, "end": 9259 }
class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): """ Here we also overwrite some of the tests of test_modeling_common.py, as VitMatte does not use input_ids, inputs_embeds, attention_mask and seq_length. """ all_model_classes = (VitMatteForImageMatting,) if is_torch_available()...
VitMatteModelTest
python
milvus-io__pymilvus
pymilvus/grpc_gen/milvus_pb2_grpc.py
{ "start": 1007, "end": 35707 }
class ____(object): """Missing associated documentation comment in .proto file.""" def __init__(self, channel): """Constructor. Args: channel: A grpc.Channel. """ self.CreateCollection = channel.unary_unary( '/milvus.proto.milvus.MilvusService/Create...
MilvusServiceStub
python
kamyu104__LeetCode-Solutions
Python/symmetric-tree.py
{ "start": 154, "end": 299 }
class ____(object): def __init__(self, x): self.val = x self.left = None self.right = None # Iterative solution
TreeNode
python
ray-project__ray
rllib/offline/input_reader.py
{ "start": 3815, "end": 4855 }
class ____(threading.Thread): """Thread that feeds a TF queue from a InputReader.""" def __init__( self, input_reader: InputReader, queue: "tf1.FIFOQueue", keys: List[str], dtypes: "tf.dtypes.DType", ): threading.Thread.__init__(self) self.sess = tf1....
_QueueRunner
python
matplotlib__matplotlib
lib/matplotlib/tests/test_image.py
{ "start": 41332, "end": 63109 }
class ____(np.ndarray): def __new__(cls, input_array, units): obj = np.asarray(input_array).view(cls) obj.units = units return obj def __array_finalize__(self, obj): self.units = getattr(obj, "units", None) def __getitem__(self, item): units = getattr(self, "units",...
QuantityND
python
sqlalchemy__sqlalchemy
test/sql/test_compare.py
{ "start": 5242, "end": 5312 }
class ____(TypeDecorator): cache_ok = True impl = String
MyType1
python
django__django
tests/migrations2/test_migrations_2_first/0002_second.py
{ "start": 43, "end": 433 }
class ____(migrations.Migration): dependencies = [("migrations2", "0001_initial")] operations = [ migrations.CreateModel( "Bookstore", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=255)), ("slug...
Migration
python
google__jax
jax/_src/callback.py
{ "start": 15367, "end": 15427 }
class ____(effects.Effect): __str__ = lambda _: "IO"
IOEffect
python
scipy__scipy
scipy/fft/tests/test_helper.py
{ "start": 14718, "end": 17814 }
class ____: def test_definition(self, xp): x = xp.asarray([0., 1, 2, 3, 4, -4, -3, -2, -1]) y = xp.asarray([-4., -3, -2, -1, 0, 1, 2, 3, 4]) xp_assert_close(fft.fftshift(x), y) xp_assert_close(fft.ifftshift(y), x) x = xp.asarray([0., 1, 2, 3, 4, -5, -4, -3, -2, -1]) ...
TestFFTShift
python
ansible__ansible
lib/ansible/utils/_junit_xml.py
{ "start": 1721, "end": 3605 }
class ____: """An individual test case.""" name: str assertions: int | None = None classname: str | None = None status: str | None = None time: decimal.Decimal | None = None errors: list[TestError] = dataclasses.field(default_factory=list) failures: list[TestFailure] = dataclasses.fiel...
TestCase
python
getsentry__sentry
src/sentry/middleware/integrations/tasks.py
{ "start": 875, "end": 3549 }
class ____(ABC): request_payload: dict[str, Any] response_url: str @property @abstractmethod def log_code(self) -> str: raise NotImplementedError def log_message(self, tag: str) -> str: return f"{self.log_code}.{tag}" def dispatch(self, region_names: Iterable[str]) -> Resp...
_AsyncRegionDispatcher
python
django__django
tests/generic_views/test_base.py
{ "start": 416, "end": 576 }
class ____(View): """ A simple view with a docstring. """ def get(self, request): return HttpResponse("This is a simple view")
SimpleView
python
huggingface__transformers
tests/models/fnet/test_modeling_fnet.py
{ "start": 1854, "end": 8961 }
class ____: def __init__( self, parent, batch_size=13, seq_length=7, is_training=True, use_token_type_ids=True, use_labels=True, vocab_size=99, hidden_size=32, num_hidden_layers=2, intermediate_size=37, hidden_act="gelu"...
FNetModelTester
python
tensorflow__tensorflow
tensorflow/python/ops/parallel_for/xla_control_flow_ops_test.py
{ "start": 4907, "end": 8015 }
class ____(PForTestCase): def setUp(self): self._enabled = control_flow_v2_toggles.control_flow_v2_enabled() control_flow_v2_toggles.enable_control_flow_v2() super(WhileV2Test, self).setUp() def tearDown(self): if not self._enabled: control_flow_v2_toggles.disable_control_flow_v2() super...
WhileV2Test
python
PyCQA__pylint
tests/functional/r/regression/regression_issue_4633.py
{ "start": 264, "end": 341 }
class ____(mock.spam): def __init__(self): self.queue = Queue()
Ham
python
scipy__scipy
scipy/spatial/tests/test_qhull.py
{ "start": 30398, "end": 38273 }
class ____: @pytest.mark.parametrize("qhull_opts, extra_pts", [ # option Qz (default for SciPy) will add # an extra point at infinity ("Qbb Qc Qz", 1), ("Qbb Qc", 0), ]) @pytest.mark.parametrize("n_pts", [50, 100]) @pytest.mark.parametrize("ndim", [2, 3]) def test_po...
TestVoronoi
python
python-openxml__python-docx
src/docx/shared.py
{ "start": 3170, "end": 4194 }
class ____(Tuple[int, int, int]): """Immutable value object defining a particular RGB color.""" def __new__(cls, r: int, g: int, b: int): msg = "RGBColor() takes three integer values 0-255" for val in (r, g, b): if not isinstance(val, int): # pyright: ignore[reportUnnecessaryIsInst...
RGBColor
python
kamyu104__LeetCode-Solutions
Python/find-the-last-marked-nodes-in-tree.py
{ "start": 4611, "end": 6446 }
class ____(object): def lastMarkedNodes(self, edges): """ :type edges: List[List[int]] :rtype: List[int] """ def increase(x): return (x[0]+1, x[1]) def iter_dfs1(): dp = [[(0, u)]*2 for u in xrange(len(adj))] stk = [(1, (0, -1))] ...
Solution4
python
getsentry__sentry
src/sentry/replays/lib/new_query/conditions.py
{ "start": 5523, "end": 6772 }
class ____(GenericBase): """Non-empty string scalar condition class.""" @staticmethod def visit_eq(expression: Expression, value: str) -> Condition: return StringScalar.visit_eq(expression, value) @staticmethod def visit_neq(expression: Expression, value: str) -> Condition: return ...
NonEmptyStringScalar
python
numba__numba
versioneer.py
{ "start": 65126, "end": 83607 }
class ____(Exception): """The project root directory is unknown or missing key files.""" def get_versions(verbose=False): """Get the project version from whatever source is available. Returns dict with two keys: 'version' and 'full'. """ if "versioneer" in sys.modules: # see the discussio...
VersioneerBadRootError
python
mlflow__mlflow
tests/pytorch/test_pytorch_model_export.py
{ "start": 4877, "end": 46375 }
class ____(get_subclassed_model_definition()): """ A custom PyTorch model class defined in the test module scope. This is a subclass of ``torch.nn.Module``. """ @pytest.fixture(scope="module") def module_scoped_subclassed_model(data): """ A custom PyTorch model inheriting from ``torch.nn.Modul...
ModuleScopedSubclassedModel
python
getsentry__sentry
src/sentry/seer/autofix/utils.py
{ "start": 2130, "end": 2301 }
class ____(BaseModel): description: str repo_provider: str repo_full_name: str branch_name: str | None = None pr_url: str | None = None
CodingAgentResult
python
astropy__astropy
astropy/utils/masked/tests/test_function_helpers.py
{ "start": 45569, "end": 46959 }
class ____: # More elaborate tests done in test_masked.py @classmethod def setup_class(cls): cls.ma = Masked(np.arange(3), mask=[True, False, False]) def test_array2string(self): out0 = np.array2string(self.ma) assert out0 == "[— 1 2]" # Arguments are interpreted as usua...
TestStringFunctions
python
sqlalchemy__sqlalchemy
test/orm/inheritance/test_relationship.py
{ "start": 76222, "end": 82192 }
class ____( fixtures.DeclarativeMappedTest, testing.AssertsCompiledSQL ): """test long join paths with a joined-inh in the middle, where we go multiple times across the same joined-inh to the same target but with other classes in the middle. E.g. test [ticket:2908] """ run_setup_mappers = "onc...
JoinAcrossJoinedInhMultiPath
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI034.py
{ "start": 11576, "end": 11796 }
class ____(django.db.models.base.ModelBase): def __new__(cls, name: str, bases: tuple[Any, ...], attrs: dict[str, Any], **kwargs: Any) -> MetaclassInWhichSelfCannotBeUsed6: ...
MetaclassInWhichSelfCannotBeUsed6
python
PyCQA__pylint
pylint/pyreverse/dot_printer.py
{ "start": 1678, "end": 6661 }
class ____(Printer): DEFAULT_COLOR = "black" def __init__( self, title: str, layout: Layout | None = None, use_automatic_namespace: bool | None = None, ): layout = layout or Layout.BOTTOM_TO_TOP self.charset = "utf-8" super().__init__(title, layout, u...
DotPrinter
python
ray-project__ray
python/ray/train/backend.py
{ "start": 375, "end": 724 }
class ____: """Parent class for configurations of training backend.""" @property def backend_cls(self): return Backend @property def train_func_context(self): return nullcontext def _repr_html_(self) -> str: return make_table_html_repr(obj=self, title=type(self).__name...
BackendConfig
python
huggingface__transformers
tests/models/deberta_v2/test_modeling_deberta_v2.py
{ "start": 9433, "end": 12095 }
class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = ( ( DebertaV2Model, DebertaV2ForMaskedLM, DebertaV2ForSequenceClassification, DebertaV2ForTokenClassification, DebertaV2ForQuestionAnswering, Debe...
DebertaV2ModelTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 37974, "end": 38370 }
class ____(sgqlc.types.Enum): """The possible default commit titles for merges. Enumeration Choices: * `MERGE_MESSAGE`: Default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name). * `PR_TITLE`: Default to the pull request's title. """ __schema__ = ...
MergeCommitTitle
python
doocs__leetcode
solution/0100-0199/0199.Binary Tree Right Side View/Solution.py
{ "start": 192, "end": 649 }
class ____: def rightSideView(self, root: Optional[TreeNode]) -> List[int]: ans = [] if root is None: return ans q = deque([root]) while q: ans.append(q[0].val) for _ in range(len(q)): node = q.popleft() if node.righ...
Solution
python
rq__rq
tests/fixtures.py
{ "start": 3107, "end": 3185 }
class ____: def __call__(self): return "I'm callable"
CallableObject
python
numba__numba
numba/core/generators.py
{ "start": 205, "end": 1489 }
class ____(FunctionDescriptor): """ The descriptor for a generator's next function. """ __slots__ = () @classmethod def from_generator_fndesc(cls, func_ir, fndesc, gentype, mangler): """ Build a GeneratorDescriptor for the generator returned by the function described by ...
GeneratorDescriptor
python
getsentry__sentry
tests/sentry/integrations/slack/test_link_identity.py
{ "start": 611, "end": 1973 }
class ____(TestCase): def setUp(self) -> None: super().setUp() self.login_as(self.user) self.external_id = "new-slack-id" self.channel_id = "my-channel" self.response_url = "http://example.slack.com/response_url" self.integration = install_slack(self.organization) ...
SlackIntegrationLinkIdentityTestBase
python
doocs__leetcode
solution/0000-0099/0043.Multiply Strings/Solution.py
{ "start": 0, "end": 564 }
class ____: def multiply(self, num1: str, num2: str) -> str: if num1 == "0" or num2 == "0": return "0" m, n = len(num1), len(num2) arr = [0] * (m + n) for i in range(m - 1, -1, -1): a = int(num1[i]) for j in range(n - 1, -1, -1): b ...
Solution
python
pytorch__pytorch
torch/cuda/__init__.py
{ "start": 19366, "end": 19964 }
class ____: r"""Context-manager that changes the selected device. Args: device (torch.device or int): device index to select. It's a no-op if this argument is a negative integer or ``None``. """ def __init__(self, device: Any): self.idx = _get_device_index(device, optional=...
device
python
facebook__pyre-check
client/background_tasks.py
{ "start": 597, "end": 713 }
class ____(abc.ABC): @abc.abstractmethod async def run(self) -> None: raise NotImplementedError()
Task
python
pola-rs__polars
py-polars/tests/unit/io/database/test_read.py
{ "start": 3921, "end": 44861 }
class ____(NamedTuple): """Clarify exception test params.""" read_method: str query: str | list[str] protocol: Any errclass: type[Exception] errmsg: str engine: str | None = None execute_options: dict[str, Any] | None = None pre_execution_query: str | list[str] | None = None kwa...
ExceptionTestParams
python
kamyu104__LeetCode-Solutions
Python/my-calendar-iii.py
{ "start": 915, "end": 1784 }
class ____(object): def __init__(self): self.__books = [] def book(self, start, end): """ :type start: int :type end: int :rtype: int """ i = bisect.bisect_left(self.__books, (start, 1)) if i < len(self.__books) and self.__books[i][0] == start: ...
MyCalendarThree2
python
more-itertools__more-itertools
tests/test_more.py
{ "start": 66743, "end": 67883 }
class ____(TestCase): """Tests for ``zip_offset()``""" def test_shortest(self): a_1 = [0, 1, 2, 3] a_2 = [0, 1, 2, 3, 4, 5] a_3 = [0, 1, 2, 3, 4, 5, 6, 7] actual = list( mi.zip_offset(a_1, a_2, a_3, offsets=(-1, 0, 1), fillvalue='') ) expected = [('',...
ZipOffsetTest
python
google__pytype
pytype/pytd/pytd.py
{ "start": 11911, "end": 11994 }
class ____(Node): """ParamSpec.kwargs special form.""" name: str
ParamSpecKwargs
python
huggingface__transformers
src/transformers/models/grounding_dino/modeling_grounding_dino.py
{ "start": 66393, "end": 67148 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.max_text_len = config.max_text_len def forward( self, vision_hidden_state: torch.FloatTensor, text_hidden_state: torch.FloatTensor, text_token_mask: torch.BoolTensor, ) -> torch.FloatT...
GroundingDinoContrastiveEmbedding
python
ray-project__ray
python/ray/serve/tests/unit/test_constants_utils.py
{ "start": 1154, "end": 2916 }
class ____: def test_parse_latency_buckets(self): # Test valid inputs with different formats assert parse_latency_buckets("1,2,3", []) == [1.0, 2.0, 3.0] assert parse_latency_buckets("1,2,3,4 ", []) == [1.0, 2.0, 3.0, 4.0] assert parse_latency_buckets(" 1,2,3,4,5", []) == [1.0, 2.0,...
TestParseLatencyBuckets
python
pandas-dev__pandas
pandas/core/arrays/numpy_.py
{ "start": 1352, "end": 20247 }
class ____( OpsMixin, NDArrayBackedExtensionArray, ObjectStringArrayMixin, ): """ A pandas ExtensionArray for NumPy data. This is mostly for internal compatibility, and is not especially useful on its own. Parameters ---------- values : ndarray The NumPy ndarray to wrap...
NumpyExtensionArray
python
pytorch__pytorch
test/test_binary_ufuncs.py
{ "start": 1844, "end": 185213 }
class ____(TestCase): # Generic tests for elementwise binary (AKA binary universal (u) functions (funcs)) # TODO: below contiguous tensor results are compared with a variety of noncontiguous results. # It would be interesting to have the lhs and rhs have different discontinuities. # Helper for compar...
TestBinaryUfuncs
python
numba__numba
numba/core/utils.py
{ "start": 13066, "end": 18981 }
class ____(object): def __init__(self, func, records, loop): self.func = func self.loop = loop self.records = np.array(records) / loop self.best = np.min(self.records) def __repr__(self): name = getattr(self.func, "__name__", self.func) args = (name, self.loop, s...
BenchmarkResult
python
getsentry__sentry
tests/sentry/issues/escalating/test_escalating.py
{ "start": 2906, "end": 10093 }
class ____( BaseGroupCounts, PerformanceIssueTestCase, SearchIssueTestMixin, ): """Test that querying Snuba for the hourly counts for groups works as expected.""" def _create_hourly_bucket(self, count: int, event: Event | GroupEvent) -> GroupsCountResponse: """It simplifies writing the expe...
HistoricGroupCounts
python
wandb__wandb
wandb/automations/_generated/fragments.py
{ "start": 2954, "end": 3149 }
class ____(GQLResult): typename__: Typename[Literal["QueueJobTriggeredAction"]] = "QueueJobTriggeredAction" queue: Optional[QueueJobActionFieldsQueue] template: str
QueueJobActionFields
python
pytorch__pytorch
test/test_fx_passes.py
{ "start": 14246, "end": 14654 }
class ____: @staticmethod def forward(x): val = torch.neg(x) return torch.add(val, val) @staticmethod def pattern(a): return torch.neg(a) test_cases = [ # match_output, match_placeholder, num_matches TestCase(False, False, 1), TestCase(True, False, 0...
SingleNodePattern
python
jmcnamara__XlsxWriter
xlsxwriter/exceptions.py
{ "start": 1115, "end": 1203 }
class ____(XlsxFileError): """Unsupported image file format."""
UnsupportedImageFormat
python
apache__airflow
task-sdk/tests/task_sdk/bases/test_sensor.py
{ "start": 2660, "end": 24679 }
class ____: @pytest.fixture def make_sensor(self): """Create a DummySensor""" def _make_sensor(return_value, task_id=SENSOR_OP, **kwargs): poke_interval = "poke_interval" timeout = "timeout" if poke_interval not in kwargs: kwargs[poke_interva...
TestBaseSensor
python
run-llama__llama_index
llama-index-packs/llama-index-packs-zephyr-query-engine/llama_index/packs/zephyr_query_engine/base.py
{ "start": 352, "end": 3279 }
class ____(BaseLlamaPack): def __init__(self, documents: List[Document]) -> None: """Init params.""" try: import torch from transformers import BitsAndBytesConfig except ImportError: raise ImportError( "Dependencies missing, run " ...
ZephyrQueryEnginePack
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocolExplicit1.py
{ "start": 1312, "end": 1358 }
class ____(Mixin, Protocol6): pass
Concrete6
python
readthedocs__readthedocs.org
readthedocs/core/admin.py
{ "start": 1119, "end": 2323 }
class ____(admin.SimpleListFilter): """Filter users based on project properties.""" parameter_name = "project_state" title = _("user projects") PROJECT_ACTIVE = "active" PROJECT_BUILT = "built" PROJECT_RECENT = "recent" def lookups(self, request, model_admin): return ( ...
UserProjectFilter
python
fluentpython__example-code
20-descriptor/descriptorkinds_dump.py
{ "start": 4399, "end": 4669 }
class ____: # <2> """a.k.a. data descriptor or enforced descriptor""" def __get__(self, instance, owner): print_args('get', self, instance, owner) # <3> def __set__(self, instance, value): print_args('set', self, instance, value)
Overriding
python
huggingface__transformers
src/transformers/models/qwen3_next/modeling_qwen3_next.py
{ "start": 16087, "end": 26183 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config: Qwen3NextConfig, layer_idx: int): super().__init__() self.config = config self.layer_idx = layer_idx self.head_dim = getattr(config, "head_dim", config.hidden_si...
Qwen3NextAttention
python
walkccc__LeetCode
solutions/2829. Determine the Minimum Sum of a k-avoiding Array/2829.py
{ "start": 0, "end": 658 }
class ____: def minimumSum(self, n: int, k: int) -> int: # These are the unique pairs that sum up to k: # (1, k - 1), (2, k - 2), ..., (ceil(k // 2), floor(k // 2)). # Our optimal strategy is to select 1, 2, ..., floor(k // 2), and then # choose k, k + 1, ... if necessary, as selecting any number in t...
Solution
python
apache__airflow
dev/stats/calculate_statistics_provider_testing_issues.py
{ "start": 2032, "end": 6850 }
class ____: issue_number: int title: str num_providers: int num_issues: int tested_issues: int url: str users_involved: set[str] users_commented: set[str] def percent_tested(self) -> int: return 100 * self.tested_issues // self.num_issues def num_involved_users_who_comm...
Stats
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pyupgrade/UP007.py
{ "start": 1084, "end": 1371 }
class ____(Protocol[*_B0]): def __iter__(self) -> Iterator[Union[*_B0]]: ... # Regression test for: https://github.com/astral-sh/ruff/issues/8609 def f(x: Union[int, str, bytes]) -> None: ... # Regression test for https://github.com/astral-sh/ruff/issues/14132
Collection