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
apache__airflow
airflow-ctl/src/airflowctl/api/datamodels/generated.py
{ "start": 18481, "end": 18895 }
class ____(BaseModel): """ Pool serializer for post bodies. """ model_config = ConfigDict( extra="forbid", ) name: Annotated[str, Field(max_length=256, title="Name")] slots: Annotated[int, Field(title="Slots")] description: Annotated[str | None, Field(title="Description")] = Non...
PoolBody
python
wandb__wandb
wandb/automations/_validators.py
{ "start": 1194, "end": 4824 }
class ____(str, Enum): """A string enum allowing for case-insensitive lookups by value. May include other internal customizations if needed. Note: This is a bespoke, internal implementation and NOT intended as a backport of `enum.StrEnum` from Python 3.11+. """ def __repr__(self) -> str: ...
LenientStrEnum
python
run-llama__llama_index
llama-index-integrations/memory/llama-index-memory-bedrock-agentcore/tests/test_agentcore_memory.py
{ "start": 16572, "end": 18134 }
class ____: """Integration tests for AgentCoreMemory.""" @pytest.mark.asyncio async def test_full_workflow(self, memory_context, mock_client): """Test a complete workflow with AgentCoreMemory.""" # Setup mock responses mock_client.list_events.return_value = { "events": [...
TestIntegration
python
django__django
tests/gis_tests/layermap/models.py
{ "start": 210, "end": 246 }
class ____(NamedModel): pass
State
python
python__mypy
mypy/test/typefixture.py
{ "start": 15395, "end": 16014 }
class ____(TypeFixture): """Extension of TypeFixture that contains additional generic interface types.""" def __init__(self) -> None: super().__init__() # GF[T] self.gfi = self.make_type_info("GF", typevars=["T"], is_abstract=True) # M1 <: GF[A] self.m1i = self.make...
InterfaceTypeFixture
python
django__django
tests/generic_relations/models.py
{ "start": 3027, "end": 3105 }
class ____(Mineral): tags = GenericRelation(ValuableTaggedItem)
ValuableRock
python
scikit-learn__scikit-learn
sklearn/utils/_param_validation.py
{ "start": 20615, "end": 21881 }
class ____(_Constraint): """Helper constraint for the `missing_values` parameters. Convenience for [ Integral, Interval(Real, None, None, closed="both"), str, # when numeric_only is False None, # when numeric_only is False _NanConstraint(), _PandasNAConstr...
MissingValues
python
scikit-learn__scikit-learn
sklearn/gaussian_process/kernels.py
{ "start": 73959, "end": 79325 }
class ____(Kernel): r"""Dot-Product kernel. The DotProduct kernel is non-stationary and can be obtained from linear regression by putting :math:`N(0, 1)` priors on the coefficients of :math:`x_d (d = 1, . . . , D)` and a prior of :math:`N(0, \sigma_0^2)` on the bias. The DotProduct kernel is invari...
DotProduct
python
django__django
tests/model_inheritance_regress/models.py
{ "start": 3869, "end": 3947 }
class ____(Station): inbound = models.BooleanField(default=False)
BusStation
python
ray-project__ray
rllib/examples/envs/classes/simple_corridor.py
{ "start": 145, "end": 1414 }
class ____(gym.Env): """Example of a custom env in which you have to walk down a corridor. You can configure the length of the corridor via the env config.""" def __init__(self, config=None): config = config or {} self.action_space = Discrete(2) self.observation_space = Box(0.0, 9...
SimpleCorridor
python
pyparsing__pyparsing
examples/bf.py
{ "start": 3294, "end": 4371 }
class ____(Instruction): def __init__(self, tokens): super().__init__(tokens) self.instructions = self.tokens[0][1:-1] def execute(self, bf_engine: BFEngine): while bf_engine.at_ptr: for i in self.instructions: i.execute(bf_engine) # add parse actions to al...
RunInstructionLoop
python
pytorch__pytorch
torch/_dynamo/variables/higher_order_ops.py
{ "start": 69660, "end": 70340 }
class ____(TorchHigherOrderOperatorVariable): """ Wraps torch._functorch.autograd_function.custom_function_call """ def _call_function( self, tx: "InstructionTranslator", args: "list[VariableTracker]", kwargs: "dict[str, VariableTracker]", ) -> "VariableTracker": ...
CustomFunctionHigherOrderOperatorVariable
python
apache__airflow
providers/teradata/src/airflow/providers/teradata/transfers/teradata_to_teradata.py
{ "start": 1141, "end": 3891 }
class ____(BaseOperator): """ Moves data from Teradata source database to Teradata destination database. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:TeradataToTeradataOperator` :param dest_teradata_conn_id: destination T...
TeradataToTeradataOperator
python
keon__algorithms
tests/test_graph.py
{ "start": 3161, "end": 4514 }
class ____(unittest.TestCase): """ Test for the file maximum_flow.py Arguments: unittest {[type]} -- [description] """ def test_ford_fulkerson(self): capacity = [ [0, 10, 10, 0, 0, 0, 0], [0, 0, 2, 0, 4, 8, 0], [0, 0, 0, 0, 0, 9, 0], ...
TestMaximumFlow
python
ray-project__ray
python/ray/llm/tests/serve/cpu/deployments/routers/test_router.py
{ "start": 1692, "end": 6336 }
class ____: @pytest.mark.asyncio @pytest.mark.parametrize("stream_batching_interval_ms", [None, 0, 10000]) @pytest.mark.parametrize("stream", [True, False]) async def test_chat(self, stream_batching_interval_ms, client, stream): """Tests chat streaming with different stream_batching_interval_ms ...
TestOpenAiIngress
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_B.py
{ "start": 20645, "end": 21631 }
class ____(Benchmark): r""" Bukin06 objective function. The Bukin06 [1]_ global optimization problem is a multimodal minimization problem defined as follows: .. math:: f_{\text{Bukin06}}(x) = 100 \sqrt{ \lvert{x_2 - 0.01 x_1^{2}} \rvert} + 0.01 \lvert{x_1 + 10} \rvert with ...
Bukin06
python
astropy__astropy
astropy/io/fits/fitsrec.py
{ "start": 55215, "end": 56999 }
class ____(UnicodeEncodeError): def __init__(self, encoding, object_, start, end, reason, index): super().__init__(encoding, object_, start, end, reason) self.index = index def _ascii_encode(inarray, out=None): """ Takes a unicode array and fills the output string array with the ASCII ...
_UnicodeArrayEncodeError
python
kamyu104__LeetCode-Solutions
Python/number-of-great-partitions.py
{ "start": 47, "end": 519 }
class ____(object): def countPartitions(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ MOD = 10**9+7 if sum(nums) < 2*k: return 0 dp = [0]*k dp[0] = 1 for x in nums: for i in reversed(xran...
Solution
python
run-llama__llama_index
llama-index-core/llama_index/core/instrumentation/events/query.py
{ "start": 179, "end": 457 }
class ____(BaseEvent): """ QueryStartEvent. Args: query (QueryType): Query as a string or query bundle. """ query: QueryType @classmethod def class_name(cls) -> str: """Class name.""" return "QueryStartEvent"
QueryStartEvent
python
redis__redis-py
redis/commands/search/query.py
{ "start": 11316, "end": 11466 }
class ____: def __init__(self, keyword: str, field: str, *args: Union[str, float]) -> None: self.args = [keyword, field] + list(args)
Filter
python
getsentry__sentry
src/sentry/deletions/defaults/group.py
{ "start": 7141, "end": 7353 }
class ____(EventsBaseDeletionTask): """ This class helps delete Issue Platform events which use the new Clickhouse light deletes. """ dataset = Dataset.IssuePlatform
IssuePlatformEventsDeletionTask
python
PrefectHQ__prefect
src/prefect/server/events/schemas/automations.py
{ "start": 3116, "end": 5300 }
class ____(Trigger, abc.ABC): """ Requires some number of triggers to have fired within the given time period. """ type: Literal["compound", "sequence"] triggers: List["ServerTriggerTypes"] within: Optional[timedelta] def create_automation_state_change_event( self, firing: Firing, ...
CompositeTrigger
python
tornadoweb__tornado
tornado/util.py
{ "start": 1761, "end": 6307 }
class ____: """Streaming gzip decompressor. The interface is like that of `zlib.decompressobj` (without some of the optional arguments, but it understands gzip headers and checksums. """ def __init__(self) -> None: # Magic parameter makes zlib module understand gzip header # http:/...
GzipDecompressor
python
ray-project__ray
rllib/utils/exploration/random_encoder.py
{ "start": 3810, "end": 10695 }
class ____(Exploration): """Random Encoder for Efficient Exploration. Implementation of: [1] State entropy maximization with random encoders for efficient exploration. Seo, Chen, Shin, Lee, Abbeel, & Lee, (2021). arXiv preprint arXiv:2102.09430. Estimates state entropy using a particle-based k...
RE3
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_partition_sets.py
{ "start": 8123, "end": 19611 }
class ____(ExecutingGraphQLContextTestMatrix): def test_get_partition_status(self, graphql_context): repository_selector = infer_repository_selector(graphql_context) result = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PARTITION_BACKFILL_MUTATION, ...
TestPartitionSetRuns
python
numba__numba
numba/tests/test_pycc.py
{ "start": 1846, "end": 2942 }
class ____(TestCase): def setUp(self): unset_macosx_deployment_target() self.tmpdir = temp_directory('test_pycc') # Make sure temporary files and directories created by # distutils don't clutter the top-level /tmp tempfile.tempdir = self.tmpdir def tearDown(self): ...
BasePYCCTest
python
pandas-dev__pandas
asv_bench/benchmarks/groupby.py
{ "start": 28475, "end": 28902 }
class ____: def setup(self): N = 120000 transition_points = np.sort(np.random.choice(np.arange(N), 1400)) transitions = np.zeros(N, dtype=np.bool_) transitions[transition_points] = True self.g = transitions.cumsum() self.df = DataFrame({"signal": np.random.rand(N)}) ...
TransformBools
python
huggingface__transformers
src/transformers/models/informer/modular_informer.py
{ "start": 2137, "end": 2196 }
class ____(TimeSeriesMeanScaler): pass
InformerMeanScaler
python
pytorch__pytorch
test/test_cuda_nvml_based_avail.py
{ "start": 3715, "end": 7258 }
class ____(TestCase): def test_env_var_parsing(self): def _parse_visible_devices(val): from torch.cuda import _parse_visible_devices as _pvd with patch.dict(os.environ, {"CUDA_VISIBLE_DEVICES": val}, clear=True): return _pvd() # rest of the string is ignored...
TestVisibleDeviceParses
python
spyder-ide__spyder
external-deps/qtconsole/qtconsole/jupyter_widget.py
{ "start": 1537, "end": 1639 }
class ____(FrontendWidget): """Dummy class for config inheritance. Destroyed below."""
IPythonWidget
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_type_lookup.py
{ "start": 12189, "end": 12314 }
class ____(AbstractFoo): # Can't resolve this one due to unannotated `x` param def qux(self): pass
ConcreteFoo1
python
walkccc__LeetCode
solutions/3356. Zero Array Transformation II/3356.py
{ "start": 0, "end": 460 }
class ____: def minZeroArray(self, nums: list[int], queries: list[list[int]]) -> int: line = [0] * (len(nums) + 1) decrement = 0 k = 0 for i, num in enumerate(nums): while decrement + line[i] < num: if k == len(queries): return -1 l, r, val = queries[k] k += 1 ...
Solution
python
google__jax
jax/_src/pallas/core.py
{ "start": 20976, "end": 21234 }
class ____(Protocol): """Transforms a memory reference on load or store.""" def undo(self, ref: TransformedRef) -> TransformedRef: raise NotImplementedError("Abstract evaluation not implemented.") @dataclasses.dataclass(frozen=True)
MemoryRefTransform
python
falconry__falcon
tests/test_after_hooks.py
{ "start": 4015, "end": 4178 }
class ____(WrappedClassResource): def on_head(self, req, resp): # Test passing no extra args super().on_head(req, resp)
WrappedClassResourceChild
python
coleifer__peewee
playhouse/psycopg3_ext.py
{ "start": 1623, "end": 1952 }
class ____(_Psycopg3JsonLookupBase): def __sql__(self, ctx): return (ctx .sql(self.node) .literal('#>' if self._as_json else '#>>') .sql(Value('{%s}' % ','.join(map(str, self.parts))))) def cast_jsonb(node): return NodeList((node, SQL('::jsonb')), glue='...
JsonPath
python
huggingface__transformers
src/transformers/models/apertus/modeling_apertus.py
{ "start": 13016, "end": 14794 }
class ____(GradientCheckpointingLayer): def __init__(self, config: ApertusConfig, layer_idx: int): super().__init__() self.hidden_size = config.hidden_size self.self_attn = ApertusAttention(config=config, layer_idx=layer_idx) self.mlp = ApertusMLP(config) self.attention_lay...
ApertusDecoderLayer
python
aimacode__aima-python
logic4e.py
{ "start": 43293, "end": 52096 }
class ____(KB): """A knowledge base consisting of first-order definite clauses. >>> kb0 = FolKB([expr('Farmer(Mac)'), expr('Rabbit(Pete)'), ... expr('(Rabbit(r) & Farmer(f)) ==> Hates(f, r)')]) >>> kb0.tell(expr('Rabbit(Flopsie)')) >>> kb0.retract(expr('Rabbit(Pete)')) >>> kb0.ask(e...
FolKB
python
fluentpython__example-code-2e
08-def-type-hints/birds/protocol/parrot.py
{ "start": 24, "end": 199 }
class ____: def honk(self, times: int) -> None: # <1> print('Honk! ' * times * 2) ze_carioca = Parrot() alert(ze_carioca) # <2>
Parrot
python
falconry__falcon
examples/ws_tutorial/ws_tutorial/app.py
{ "start": 2537, "end": 3665 }
class ____: async def on_websocket(self, req: Request, ws: WebSocket): while True: try: query = await ws.receive_text() report = REPORTS.get(query, None) logger.info('selected report: %s', report) if report is None: ...
ReportsResource
python
FactoryBoy__factory_boy
factory/fuzzy.py
{ "start": 768, "end": 1136 }
class ____(BaseFuzzyAttribute): """Similar to LazyAttribute, but yields random values. Attributes: function (callable): function taking no parameters and returning a random value. """ def __init__(self, fuzzer): super().__init__() self.fuzzer = fuzzer def fuzz(...
FuzzyAttribute
python
scikit-learn__scikit-learn
sklearn/model_selection/tests/test_successive_halving.py
{ "start": 1653, "end": 29010 }
class ____(DummyClassifier): def __init__( self, strategy="stratified", random_state=None, constant=None, n_estimators=10, fail_fit=False, fail_predict=False, a=0, ): self.fail_fit = fail_fit self.fail_predict = fail_predict ...
SometimesFailClassifier
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/dlp.py
{ "start": 76186, "end": 80186 }
class ____(GoogleCloudBaseOperator): """ Lists DlpJobs that match the specified filter in the request. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudDLPListDLPJobsOperator` :param project_id: (Optional) Google Cloud p...
CloudDLPListDLPJobsOperator
python
pyodide__pyodide
src/py/_pyodide/_core_docs.py
{ "start": 31604, "end": 31843 }
class ____(JsProxy, Generic[P, T]): """A JavaScript callable A JavaScript object is treated as a callable if `typeof x` returns `"function"`. """ _js_type_flags = ["IS_CALLABLE"] __call__: Callable[P, T]
JsCallable
python
apache__airflow
dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py
{ "start": 3660, "end": 4333 }
class ____(Enum): DOCUMENTATION = "d" BUGFIX = "b" FEATURE = "f" BREAKING_CHANGE = "x" SKIP = "s" MISC = "m" MIN_AIRFLOW_VERSION_BUMP = "v" # defines the precedence order for provider version bumps # BREAKING_CHANGE > FEATURE > MIN_AIRFLOW_VERSION_BUMP > BUGFIX > MISC > DOCUMENTATION > SKI...
TypeOfChange
python
ray-project__ray
python/ray/train/tests/test_iter_torch_batches_gpu.py
{ "start": 1559, "end": 1997 }
class ____(ArrowBatchCollateFn): """Collate function that returns id and value as a tuple of tensors.""" def __call__(self, batch: pa.Table) -> Tuple[torch.Tensor, torch.Tensor]: """Return id and value as a tuple of tensors.""" assert isinstance(batch, pa.Table) tensor_dict = arrow_batc...
TupleArrowBatchCollateFn
python
crytic__slither
slither/slithir/operations/phi_callback.py
{ "start": 424, "end": 1575 }
class ____(Phi): def __init__( self, left_variable: StateIRVariable, nodes: Set["Node"], call_ir: Union[InternalCall, HighLevelCall], rvalue: StateIRVariable, ) -> None: assert is_valid_lvalue(left_variable) assert isinstance(nodes, set) super().__...
PhiCallback
python
getsentry__sentry
src/sentry/api/endpoints/organization_api_key_details.py
{ "start": 752, "end": 4060 }
class ____(ControlSiloOrganizationEndpoint): owner = ApiOwner.ECOSYSTEM publish_status = { "DELETE": ApiPublishStatus.PRIVATE, "GET": ApiPublishStatus.PRIVATE, "PUT": ApiPublishStatus.PRIVATE, } permission_classes = (OrganizationAdminPermission,) def get(self, request: Reque...
OrganizationApiKeyDetailsEndpoint
python
sqlalchemy__sqlalchemy
test/ext/test_mutable.py
{ "start": 3736, "end": 7691 }
class ____(fixtures.TestBase): @testing.combinations(True, False, argnames="pickleit") def test_pickle_parent_multi_attrs(self, registry, connection, pickleit): """test #8133""" local_foo = Table( "lf", registry.metadata, Column("id", Integer, primary_key=Tru...
MiscTest
python
sphinx-doc__sphinx
sphinx/builders/epub3.py
{ "start": 698, "end": 1711 }
class ____(NamedTuple): text: str refuri: str children: list[NavPoint] # writing modes PAGE_PROGRESSION_DIRECTIONS = { 'horizontal': 'ltr', 'vertical': 'rtl', } IBOOK_SCROLL_AXIS = { 'horizontal': 'vertical', 'vertical': 'horizontal', } THEME_WRITING_MODES = { 'vertical': 'vertical-rl'...
NavPoint
python
django__django
tests/indexes/tests.py
{ "start": 5350, "end": 12691 }
class ____(TransactionTestCase): available_apps = ["indexes"] get_opclass_query = """ SELECT opcname, c.relname FROM pg_opclass AS oc JOIN pg_index as i on oc.oid = ANY(i.indclass) JOIN pg_class as c on c.oid = i.indexrelid WHERE c.relname = '%s' """ def test_text_indexe...
SchemaIndexesPostgreSQLTests
python
mlflow__mlflow
tests/telemetry/test_track.py
{ "start": 595, "end": 6805 }
class ____(Event): name = "test_event" def test_record_usage_event(mock_requests, mock_telemetry_client: TelemetryClient): @record_usage_event(TestEvent) def succeed_func(): # sleep to make sure duration_ms > 0 time.sleep(0.01) return True @record_usage_event(TestEvent) de...
TestEvent
python
HypothesisWorks__hypothesis
hypothesis-python/tests/nocover/test_build_signature.py
{ "start": 2787, "end": 3203 }
class ____: __annotations__ = get_type_hints(use_annotations) __signature__ = signature(use_bad_signature) def __init__(self, **kwargs): assert set(kwargs) == {"testX"} assert isinstance(kwargs["testX"], float) @given(st.builds(ModelWithBadAliasSignature)) def test_build_with_non_types_in...
ModelWithBadAliasSignature
python
ray-project__ray
python/ray/llm/_internal/serve/core/ingress/builder.py
{ "start": 777, "end": 1751 }
class ____(BaseModelExtended): ingress_cls: Union[str, Type[OpenAiIngress]] = Field( default=OpenAiIngress, description="The class name of the ingress to use. It can be in form of `module_name.class_name` or `module_name:class_name` or the class itself. The class constructor should take the followin...
IngressClsConfig
python
sqlalchemy__sqlalchemy
test/orm/test_cycles.py
{ "start": 43900, "end": 46472 }
class ____(fixtures.MappedTest): @classmethod def define_tables(cls, metadata): Table( "parent", metadata, Column( "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("name", String(50), nullable=False), ...
SelfReferentialPostUpdateTest3
python
HypothesisWorks__hypothesis
hypothesis-python/src/hypothesis/internal/conjecture/engine.py
{ "start": 7553, "end": 8569 }
class ____(TypedDict): status: str runtime: float drawtime: float gctime: float events: list[str] PhaseStatistics = TypedDict( "PhaseStatistics", { "duration-seconds": float, "test-cases": list[CallStats], "distinct-failures": int, "shrinks-successful": int,...
CallStats
python
django__django
tests/admin_views/admin.py
{ "start": 13470, "end": 13590 }
class ____(admin.ModelAdmin): list_display = ("id", "collector", "order") list_editable = ("order",)
CategoryAdmin
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 364687, "end": 365357 }
class ____(sgqlc.types.Input): """Autogenerated input type of UpdatePullRequestBranch""" __schema__ = github_schema __field_names__ = ("pull_request_id", "expected_head_oid", "client_mutation_id") pull_request_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="pullRequestId") """The Nod...
UpdatePullRequestBranchInput
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/operators/test_ecs.py
{ "start": 3735, "end": 4046 }
class ____: @pytest.fixture(autouse=True) def _setup_test_cases(self, monkeypatch): self.client = boto3.client("ecs", region_name="eu-west-3") monkeypatch.setattr(EcsHook, "conn", self.client) monkeypatch.setenv("AIRFLOW_CONN_AWS_TEST_CONN", '{"conn_type": "aws"}')
EcsBaseTestCase
python
numpy__numpy
numpy/ma/extras.py
{ "start": 54231, "end": 55119 }
class ____(AxisConcatenator): """ Translate slice objects to concatenation along an axis. For documentation on usage, see `mr_class`. See Also -------- mr_class """ __slots__ = () concatenate = staticmethod(concatenate) @classmethod def makemat(cls, arr): # There...
MAxisConcatenator
python
mlflow__mlflow
mlflow/utils/time.py
{ "start": 538, "end": 1260 }
class ____: """ Measures elapsed time. .. code-block:: python from mlflow.utils.time import Timer with Timer() as t: ... print(f"Elapsed time: {t:.2f} seconds") """ def __init__(self): self.elapsed = 0.0 def __enter__(self): self.elapsed ...
Timer
python
pytorch__pytorch
torch/_dynamo/variables/iter.py
{ "start": 13914, "end": 18109 }
class ____(IteratorVariable): """ Represents zip(*iterables) """ _nonvar_fields = { "index", "strict", *IteratorVariable._nonvar_fields, } def __init__( self, iterables: list[VariableTracker], strict: bool = False, **kwargs: Any, ) ->...
ZipVariable
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py
{ "start": 1817, "end": 4169 }
class ____(GoogleCloudBaseOperator): """The base class for operators that launch AutoML jobs on VertexAI.""" def __init__( self, *, project_id: str, region: str, display_name: str, labels: dict[str, str] | None = None, parent_model: str | None = None, ...
AutoMLTrainingJobBaseOperator
python
Textualize__textual
tests/css/test_screen_css.py
{ "start": 1108, "end": 8637 }
class ____(BaseApp): """Base app for testing screen CSS when switching a screen.""" def on_mount(self): self.push_screen(BaseScreen()) def check_colors_before_screen_css(app: BaseApp): assert app.screen.query_one("#app-css").styles.background == GREEN assert app.screen.query_one("#screen-css-...
SwitchBaseApp
python
getsentry__sentry
tests/sentry/grouping/test_enhancer.py
{ "start": 29073, "end": 33442 }
class ____(TestCase): @dataclass class DummyRustFrame: contributes: bool | None hint: str | None @dataclass class DummyRustStacktraceResult: contributes: bool | None hint: str | None DummyRustExceptionData = dict[str, bytes | None] DummyMatchFrame = dict[str, A...
AssembleStacktraceComponentTest
python
Unity-Technologies__ml-agents
ml-agents/mlagents/trainers/torch_entities/action_log_probs.py
{ "start": 952, "end": 4703 }
class ____(NamedTuple): """ A NamedTuple containing the tensor for continuous log probs and list of tensors for discrete log probs of individual actions as well as all the log probs for an entire branch. Utility functions provide numpy <=> tensor conversions to be used by the optimizers. :param cont...
ActionLogProbs
python
openai__openai-python
src/openai/resources/beta/realtime/realtime.py
{ "start": 33914, "end": 35836 }
class ____(BaseAsyncRealtimeConnectionResource): async def create( self, *, event_id: str | NotGiven = NOT_GIVEN, response: response_create_event_param.Response | NotGiven = NOT_GIVEN, ) -> None: """ This event instructs the server to create a Response, which mean...
AsyncRealtimeResponseResource
python
run-llama__llama_index
llama-index-integrations/postprocessor/llama-index-postprocessor-aimon-rerank/llama_index/postprocessor/aimon_rerank/base.py
{ "start": 535, "end": 4669 }
class ____(BaseNodePostprocessor): model: str = Field(description="AIMon's reranking model name.") top_n: int = Field(description="Top N nodes to return.") task_definition: str = Field( default="Determine the relevance of context documents with respect to the user query.", description="The t...
AIMonRerank
python
numpy__numpy
numpy/ma/core.py
{ "start": 28106, "end": 30544 }
class ____(_MaskedUFunc): """ Defines masked version of unary operations, where invalid values are pre-masked. Parameters ---------- mufunc : callable The function for which to define a masked version. Made available as ``_MaskedUnaryOperation.f``. fill : scalar, optional ...
_MaskedUnaryOperation
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/vertex_ai/dataset.py
{ "start": 18827, "end": 22385 }
class ____(GoogleCloudBaseOperator): """ Lists Datasets in a Location. :param project_id: Required. The ID of the Google Cloud project that the service belongs to. :param region: Required. The ID of the Google Cloud region that the service belongs to. :param filter: The standard list filter. :p...
ListDatasetsOperator
python
pytorch__pytorch
torch/_dynamo/replay_record.py
{ "start": 1086, "end": 1267 }
class ____: name: str is_torch: bool = False value: object = None @property def __name__(self) -> str: return self.name @dataclasses.dataclass
DummyModule
python
huggingface__transformers
src/transformers/models/olmoe/modular_olmoe.py
{ "start": 7105, "end": 10069 }
class ____(MixtralModel): def __init__(self, config: OlmoeConfig): super().__init__(config) self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx) self.layers = nn.ModuleList( [OlmoeDecoderLayer(config, layer_idx) for layer_idx in range(config.n...
OlmoeModel
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 958485, "end": 958869 }
class ____(sgqlc.types.Type): """An edge in a connection.""" __schema__ = github_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") """A cursor for use in pagination.""" node = sgqlc.types.Field("SavedReply", graphql_name...
SavedReplyEdge
python
pallets__werkzeug
tests/test_wrappers.py
{ "start": 43916, "end": 45795 }
class ____: def test_request(self): value = {"ä": "b"} request = wrappers.Request.from_values(json=value) assert request.json == value assert request.get_data() def test_response(self): value = {"ä": "b"} response = wrappers.Response( response=json.du...
TestJSON
python
Pylons__pyramid
tests/test_integration.py
{ "start": 15767, "end": 16520 }
class ____(IntegrationBase, unittest.TestCase): # test that forbidden exception has ACLDenied result attached package = 'tests.pkgs.forbiddenapp' def test_it(self): res = self.testapp.get('/x', status=403) message, result = (x.strip() for x in res.body.split(b'\n')) self.assertTrue(...
TestForbiddenAppHasResult
python
sqlalchemy__sqlalchemy
test/orm/declarative/test_clsregistry.py
{ "start": 625, "end": 902 }
class ____: def __init__(self, base, name): self._sa_class_manager = mock.Mock(registry=base) tokens = name.split(".") self.__module__ = ".".join(tokens[0:-1]) self.name = self.__name__ = tokens[-1] self.metadata = MetaData()
MockClass
python
openai__openai-python
src/openai/types/realtime/realtime_conversation_item_user_message_param.py
{ "start": 279, "end": 1291 }
class ____(TypedDict, total=False): audio: str """ Base64-encoded audio bytes (for `input_audio`), these will be parsed as the format specified in the session input audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified. """ detail: Literal["auto", "low", "high"] ...
Content
python
Textualize__textual
examples/merlin.py
{ "start": 1505, "end": 2283 }
class ____(Digits): """Displays a timer that stops when you win.""" DEFAULT_CSS = """ Timer { text-align: center; width: auto; margin: 2 8; color: $warning; &:light { color: $secondary; } } """ start_time = var(0.0) running = var(T...
Timer
python
GoogleCloudPlatform__python-docs-samples
appengine/standard/modules/main.py
{ "start": 869, "end": 1136 }
class ____(webapp2.RequestHandler): def get(self): module = modules.get_current_module_name() instance_id = modules.get_current_instance_id() self.response.write("module_id={}&instance_id={}".format(module, instance_id))
GetModuleInfoHandler
python
kamyu104__LeetCode-Solutions
Python/maximum-frequency-stack.py
{ "start": 50, "end": 823 }
class ____(object): def __init__(self): self.__freq = collections.Counter() self.__group = collections.defaultdict(list) self.__maxfreq = 0 def push(self, x): """ :type x: int :rtype: void """ self.__freq[x] += 1 if self.__freq[x] > self....
FreqStack
python
boto__boto3
tests/functional/test_s3.py
{ "start": 1904, "end": 4546 }
class ____(unittest.TestCase): def setUp(self): self.session = boto3.session.Session( aws_access_key_id='foo', aws_secret_access_key='bar', region_name='us-west-2', ) self.s3 = self.session.resource('s3') self.stubber = Stubber(self.s3.meta.client)...
BaseTransferTest
python
kamyu104__LeetCode-Solutions
Python/count-covered-buildings.py
{ "start": 37, "end": 624 }
class ____(object): def countCoveredBuildings(self, n, buildings): """ :type n: int :type buildings: List[List[int]] :rtype: int """ left = [n]*n right = [-1]*n up = [-1]*n down = [n]*n for x, y in buildings: x -= 1 ...
Solution
python
sympy__sympy
sympy/matrices/expressions/special.py
{ "start": 4128, "end": 5175 }
class ____(Identity): """ An identity matrix without a specified shape This exists primarily so MatMul() with no arguments can return something meaningful. """ def __new__(cls): # super(Identity, cls) instead of super(GenericIdentity, cls) because # Identity.__new__ doesn't have...
GenericIdentity
python
huggingface__transformers
src/transformers/models/tapas/modeling_tapas.py
{ "start": 22656, "end": 29590 }
class ____(TapasPreTrainedModel): """ This class is a small change compared to [`BertModel`], taking into account the additional token type ids. The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of cross-attention is added between the self-attenti...
TapasModel
python
pytorch__pytorch
test/inductor/test_inductor_freezing.py
{ "start": 2106, "end": 2470 }
class ____(torch.nn.Module): def __init__(self, in_channels, out_channels, bias=False, **kwargs): super().__init__() self.conv = torch.nn.Conv2d(in_channels, out_channels, bias=bias, **kwargs) self.bn = torch.nn.BatchNorm2d(out_channels, eps=0.001, dtype=torch.float) def forward(self, x...
ConvBN
python
ray-project__ray
python/ray/_private/thirdparty/pynvml/pynvml.py
{ "start": 92620, "end": 92835 }
class ____(_PrintableStructure): _fields_ = [ ('version', c_uint), ('vgpuCount', c_uint), ('vgpuTypeIds', POINTER(c_uint)), ] nvmlVgpuTypeIdInfo_v1 = 0x1000010
c_nvmlVgpuTypeIdInfo_v1_t
python
doocs__leetcode
lcci/16.04.Tic-Tac-Toe/Solution.py
{ "start": 0, "end": 859 }
class ____: def tictactoe(self, board: List[str]) -> str: n = len(board) rows = [0] * n cols = [0] * n dg = udg = 0 has_empty_grid = False for i, row in enumerate(board): for j, c in enumerate(row): v = 1 if c == 'X' else -1 ...
Solution
python
tartley__colorama
colorama/ansi.py
{ "start": 2321, "end": 2506 }
class ____(AnsiCodes): BRIGHT = 1 DIM = 2 NORMAL = 22 RESET_ALL = 0 Fore = AnsiFore() Back = AnsiBack() Style = AnsiStyle() Cursor = AnsiCursor()
AnsiStyle
python
getsentry__sentry
src/sentry/identity/providers/dummy.py
{ "start": 759, "end": 1232 }
class ____(Provider): name = "Dummy" key = "dummy" TEMPLATE = '<form method="POST"><input type="email" name="email" /></form>' def get_pipeline_views(self) -> list[PipelineView[IdentityPipeline]]: return [AskEmail()] def build_identity(self, state): return {"id": state["email"], "...
DummyProvider
python
tornadoweb__tornado
maint/test/cython/cythonapp_test.py
{ "start": 450, "end": 1196 }
class ____(unittest.TestCase): def test_arg_replacer_function(self): replacer = ArgReplacer(cythonapp.function_with_args, 'two') args = (1, 'old', 3) kwargs = {} self.assertEqual(replacer.get_old_value(args, kwargs), 'old') self.assertEqual(replacer.replace('new', args, kwarg...
CythonArgReplacerTest
python
pytorch__pytorch
functorch/examples/maml_regression/evjang_transforms_module.py
{ "start": 391, "end": 3411 }
class ____(nn.Module): def __init__(self) -> None: super().__init__() self.fc1 = nn.Linear(1, 40) self.relu1 = nn.ReLU() self.fc2 = nn.Linear(40, 40) self.relu2 = nn.ReLU() self.fc3 = nn.Linear(40, 1) def forward(self, x): x = self.fc1(x) x = self...
ThreeLayerNet
python
sqlalchemy__sqlalchemy
test/orm/test_core_compilation.py
{ "start": 112192, "end": 112854 }
class ____(test_compiler.CrudParamOverlapTest): @testing.fixture( params=Variation.generate_cases("type_", ["orm"]), ids=["orm"], ) def crud_table_fixture(self, request): type_ = request.param if type_.orm: from sqlalchemy.orm import declarative_base ...
CrudParamOverlapTest
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_D.py
{ "start": 14162, "end": 15583 }
class ____(Benchmark): r""" Dixon and Price objective function. This class defines the Dixon and Price global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\text{DixonPrice}}(x) = (x_i - 1)^2 + \sum_{i=2}^n i(2x_i^2 - x_{i-1})^2 ...
DixonPrice
python
urllib3__urllib3
src/urllib3/contrib/emscripten/fetch.py
{ "start": 10527, "end": 23520 }
class ____(io.RawIOBase): """ A read stream that uses pyodide.ffi.run_sync to read from a JavaScript fetch response. This requires support for WebAssembly JavaScript Promise Integration in the containing browser, and for pyodide to be launched via runPythonAsync. :param js_read_stream: The ...
_JSPIReadStream
python
pandas-dev__pandas
pandas/io/stata.py
{ "start": 33684, "end": 85536 }
class ____(StataParser, abc.Iterator): __doc__ = _stata_reader_doc _path_or_buf: IO[bytes] # Will be assigned by `_open_file`. def __init__( self, path_or_buf: FilePath | ReadBuffer[bytes], convert_dates: bool = True, convert_categoricals: bool = True, index_col: s...
StataReader
python
apache__airflow
providers/qdrant/tests/unit/qdrant/hooks/test_qdrant.py
{ "start": 992, "end": 5346 }
class ____: def setup_method(self): """Set up the test connection for the QdrantHook.""" with patch("airflow.models.Connection.get_connection_from_secrets") as mock_get_connection: mock_conn = Mock() mock_conn.host = "localhost" mock_conn.port = 6333 m...
TestQdrantHook
python
lepture__authlib
authlib/integrations/starlette_client/apps.py
{ "start": 1628, "end": 2380 }
class ____(StarletteAppMixin, AsyncOAuth1Mixin, BaseApp): client_cls = AsyncOAuth1Client async def authorize_access_token(self, request, **kwargs): params = dict(request.query_params) state = params.get("oauth_token") if not state: raise OAuthError(description='Missing "oaut...
StarletteOAuth1App
python
apache__airflow
providers/yandex/src/airflow/providers/yandex/operators/dataproc.py
{ "start": 15463, "end": 17421 }
class ____(DataprocBaseOperator): """ Runs Hive job in Data Proc cluster. :param query: Hive query. :param query_file_uri: URI of the script that contains Hive queries. Can be placed in HDFS or S3. :param properties: A mapping of property names to values, used to configure Hive. :param script_v...
DataprocCreateHiveJobOperator
python
fastapi__sqlmodel
docs_src/advanced/uuid/tutorial002.py
{ "start": 101, "end": 1592 }
class ____(SQLModel, table=True): id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True) name: str = Field(index=True) secret_name: str age: Union[int, None] = Field(default=None, index=True) sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" engine = create_en...
Hero
python
getsentry__sentry
tests/sentry/workflow_engine/processors/test_data_condition_group.py
{ "start": 597, "end": 1071 }
class ____(TestCase): def test_get_data_conditions_for_group(self) -> None: assert get_data_conditions_for_group(0) == [] def test_get_data_conditions_for_group__exists(self) -> None: data_condition_group = self.create_data_condition_group() data_condition = self.create_data_condition(c...
TestGetDataConditionsForGroup
python
keras-team__keras
keras/src/utils/file_utils_test.py
{ "start": 26783, "end": 28691 }
class ____(test_case.TestCase): def test_gcs_remote_path(self): self.assertTrue(file_utils.is_remote_path("/gcs/some/path/to/file.txt")) self.assertTrue(file_utils.is_remote_path("/gcs/another/directory/")) self.assertTrue(file_utils.is_remote_path("gcs://bucket/some/file.txt")) def tes...
IsRemotePathTest