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
huggingface__transformers
src/transformers/models/ovis2/modular_ovis2.py
{ "start": 4861, "end": 5345 }
class ____(PreTrainedModel): config: Ovis2Config base_model_prefix = "model" input_modalities = ("image", "text") supports_gradient_checkpointing = True _no_split_modules = ["Ovis2VisionAttention"] _skip_keys_device_placement = "past_key_values" _supports_cache_class = True _supports_fla...
Ovis2PreTrainedModel
python
dask__distributed
distributed/spans.py
{ "start": 22426, "end": 23767 }
class ____: """Worker extension for spans support""" worker: Worker digests_total_since_heartbeat: dict[tuple[Hashable, ...], float] def __init__(self, worker: Worker): self.worker = worker self.digests_total_since_heartbeat = {} def collect_digests( self, digests_total_si...
SpansWorkerExtension
python
wandb__wandb
wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/scalar_leafs.py
{ "start": 129, "end": 1115 }
class ____(ValidationRule): def enter_Field(self, node, key, parent, path, ancestors): type = self.context.get_type() if not type: return if is_leaf_type(get_named_type(type)): if node.selection_set: self.context.report_error(GraphQLError( ...
ScalarLeafs
python
scipy__scipy
scipy/stats/tests/test_stats.py
{ "start": 364451, "end": 370577 }
class ____: r""" Test the non-parametric quantile test, including the computation of confidence intervals """ def test_quantile_test_iv(self): x = [1, 2, 3] message = "`x` must be a one-dimensional array of numbers." with pytest.raises(ValueError, match=message): st...
TestQuantileTest
python
numpy__numpy
numpy/_core/records.py
{ "start": 1356, "end": 6284 }
class ____: """ Class to convert formats, names, titles description to a dtype. After constructing the format_parser object, the dtype attribute is the converted data-type: ``dtype = format_parser(formats, names, titles).dtype`` Attributes ---------- dtype : dtype The converted...
format_parser
python
kamyu104__LeetCode-Solutions
Python/parsing-a-boolean-expression.py
{ "start": 29, "end": 834 }
class ____(object): def parseBoolExpr(self, expression): """ :type expression: str :rtype: bool """ def parse(expression, i): if expression[i[0]] not in "&|!": result = expression[i[0]] == 't' i[0] += 1 return result...
Solution
python
readthedocs__readthedocs.org
readthedocs/integrations/migrations/0008_add_new_jsonfields.py
{ "start": 149, "end": 956 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("integrations", "0007_update-provider-data"), ] operations = [ migrations.AddField( model_name="httpexchange", name="request_headers_json", field=models.JSONField(null=True...
Migration
python
keon__algorithms
tests/test_graph.py
{ "start": 8587, "end": 9176 }
class ____(unittest.TestCase): def test_prim_spanning(self): graph1 = { 1: [[3, 2], [8, 3]], 2: [[3, 1], [5, 4]], 3: [[8, 1], [2, 4], [4, 5]], 4: [[5, 2], [2, 3], [6, 5]], 5: [[4, 3], [6, 4]] } self.assertEqual(14, prims_minimum_spa...
PrimsMinimumSpanning
python
huggingface__transformers
src/transformers/models/conditional_detr/modeling_conditional_detr.py
{ "start": 27304, "end": 32780 }
class ____(nn.Module): """ Cross-Attention used in Conditional DETR 'Conditional DETR for Fast Training Convergence' paper. The key q_proj, k_proj, v_proj are defined outside the attention. This attention allows the dim of q, k to be different to v. """ def __init__( self, embe...
ConditionalDetrAttention
python
spyder-ide__spyder
external-deps/qtconsole/qtconsole/kernel_mixins.py
{ "start": 315, "end": 430 }
class ____(MetaQObjectHasTraits('NewBase', (HasTraits, SuperQObject), {})): _timer = None
QtKernelRestarterMixin
python
google__pytype
pytype/tools/annotate_ast/annotate_ast.py
{ "start": 2299, "end": 2454 }
class ____(Exception): """Wrap exceptions raised by Pytype.""" def _annotation_str_from_type_def(type_def): return pytd_utils.Print(type_def)
PytypeError
python
run-llama__llama_index
llama-index-core/tests/agent/workflow/test_single_agent_workflow.py
{ "start": 534, "end": 7220 }
class ____(MockLLM): def __init__(self, responses: List[ChatMessage]): super().__init__() self._responses = responses self._response_index = 0 @property def metadata(self) -> LLMMetadata: return LLMMetadata(is_function_calling_model=True) async def astream_chat( ...
MockLLM
python
encode__django-rest-framework
rest_framework/relations.py
{ "start": 9356, "end": 15146 }
class ____(RelatedField): lookup_field = 'pk' view_name = None default_error_messages = { 'required': _('This field is required.'), 'no_match': _('Invalid hyperlink - No URL match.'), 'incorrect_match': _('Invalid hyperlink - Incorrect URL match.'), 'does_not_exist': _('Inva...
HyperlinkedRelatedField
python
aimacode__aima-python
agents.py
{ "start": 24465, "end": 24755 }
class ____(Obstacle): def __init__(self, coordinates): """Coordinates is a list of tuples.""" super().__init__() self.coordinates = coordinates # ______________________________________________________________________________ # Vacuum environment
PolygonObstacle
python
allegroai__clearml
clearml/backend_api/services/v2_23/dataviews.py
{ "start": 79093, "end": 82210 }
class ____(Response): """ Response of dataviews.delete_many endpoint. :param succeeded: :type succeeded: Sequence[dict] :param failed: :type failed: Sequence[dict] """ _service = "dataviews" _action = "delete_many" _version = "2.23" _schema = { "definitions": {}, ...
DeleteManyResponse
python
huggingface__transformers
src/transformers/models/splinter/modeling_splinter.py
{ "start": 11300, "end": 12919 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.config = config self.layer = nn.ModuleList([SplinterLayer(config) for i in range(config.num_hidden_layers)]) self.gradient_checkpointing = False @can_return_tuple def forward( self, hi...
SplinterEncoder
python
mahmoud__boltons
boltons/iterutils.py
{ "start": 51608, "end": 57558 }
class ____(GUIDerator): """Much like the standard GUIDerator, the SequentialGUIDerator is an iterator that yields a globally-unique identifier (GUID) on every iteration. The GUIDs produced are hexadecimal strings. The SequentialGUIDerator differs in that it picks a starting GUID value and increment...
SequentialGUIDerator
python
django__django
tests/db_functions/models.py
{ "start": 345, "end": 796 }
class ____(models.Model): authors = models.ManyToManyField(Author, related_name="articles") title = models.CharField(max_length=50) summary = models.CharField(max_length=200, null=True, blank=True) text = models.TextField() written = models.DateTimeField() published = models.DateTimeField(null=T...
Article
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/triggers/mwaa.py
{ "start": 4753, "end": 9407 }
class ____(AwsBaseWaiterTrigger): """ Trigger when an MWAA Task is complete. :param external_env_name: The external MWAA environment name that contains the Task Instance you want to wait for (templated) :param external_dag_id: The DAG ID in the external MWAA environment that contains the Task I...
MwaaTaskCompletedTrigger
python
readthedocs__readthedocs.org
readthedocs/notifications/migrations/0004_remove_unused_notification.py
{ "start": 337, "end": 575 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("notifications", "0003_notification_indexes"), ] operations = [ migrations.RunPython(remove_unused_notification), ]
Migration
python
davidhalter__jedi
jedi/plugins/stdlib.py
{ "start": 8694, "end": 11768 }
class ____(AttributeOverwrite): def __init__(self, reversed_obj, iter_list): super().__init__(reversed_obj) self._iter_list = iter_list def py__iter__(self, contextualized_node=None): return self._iter_list @publish_method('__next__') def _next(self, arguments): return ...
ReversedObject
python
pandas-dev__pandas
pandas/tests/indexes/categorical/test_indexing.py
{ "start": 12585, "end": 14948 }
class ____: def test_contains(self): ci = CategoricalIndex(list("aabbca"), categories=list("cabdef"), ordered=False) assert "a" in ci assert "z" not in ci assert "e" not in ci assert np.nan not in ci # assert codes NOT in index assert 0 not in ci ass...
TestContains
python
getsentry__sentry
tests/sentry/db/models/fields/test_jsonfield.py
{ "start": 556, "end": 782 }
class ____(models.Model): null_json = JSONField(null=True) blank_json = JSONField(blank=True) class Meta: app_label = "fixtures" def default() -> dict[str, int]: return {"x": 2}
BlankJSONFieldTestModel
python
davidhalter__jedi
test/completion/stdlib.py
{ "start": 3869, "end": 4757 }
class ____(): def __init__(self): self.my_variable = 3 @staticmethod def my_func(param): #? [] param.my_ #? ['upper'] param.uppe #? str() return param @staticmethod def my_func_without_call(param): #? [] param.my_ #? [...
F
python
getsentry__sentry
tests/sentry/db/test_transactions.py
{ "start": 4927, "end": 5011 }
class ____(CaseMixin, TestCase): pass @no_silo_test
TestDjangoTestCaseTransactions
python
urllib3__urllib3
test/test_exceptions.py
{ "start": 2649, "end": 3210 }
class ____: def test_pool_property_deprecation_warning(self) -> None: err = NewConnectionError(HTTPConnection("localhost"), "test") with pytest.warns(DeprecationWarning) as records: err_pool = err.pool assert err_pool is err.conn msg = ( "The 'pool' property ...
TestNewConnectionError
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1131866, "end": 1133541 }
class ____(sgqlc.types.Type, Node): """A deployment review.""" __schema__ = github_schema __field_names__ = ("comment", "database_id", "environments", "state", "user") comment = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="comment") """The comment the user left.""" database_id...
DeploymentReview
python
tiangolo__fastapi
fastapi/params.py
{ "start": 406, "end": 514 }
class ____(Enum): query = "query" header = "header" path = "path" cookie = "cookie"
ParamTypes
python
ray-project__ray
python/ray/_private/resource_and_label_spec.py
{ "start": 418, "end": 19661 }
class ____: """Represents the resource and label configuration passed to a raylet. All fields can be None. Before starting services, resolve() should be called to return a ResourceAndLabelSpec with unknown values filled in with merged values based on the local machine and user specifications. """ ...
ResourceAndLabelSpec
python
PrefectHQ__prefect
scripts/generate_example_pages.py
{ "start": 656, "end": 797 }
class ____: path: anyio.Path title: str description: str icon: str keywords: list[str] order: int | None = None
Example
python
huggingface__transformers
src/transformers/models/bert_generation/modeling_bert_generation.py
{ "start": 3497, "end": 6729 }
class ____(nn.Module): def __init__(self, config, is_causal=False, layer_idx=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0 and not hasattr(config, "embedding_size"): raise ValueError( f"The hidden size ({config.hidden_size}) is not a mu...
BertGenerationSelfAttention
python
Textualize__textual
docs/examples/widgets/data_table_cursors.py
{ "start": 634, "end": 1108 }
class ____(App): def compose(self) -> ComposeResult: yield DataTable() def on_mount(self) -> None: table = self.query_one(DataTable) table.cursor_type = next(cursors) table.zebra_stripes = True table.add_columns(*ROWS[0]) table.add_rows(ROWS[1:]) def key_c(s...
TableApp
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 262695, "end": 263050 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") node = sgqlc.types.Field("CreatedPullRequestContribution", graphql_name="node...
CreatedPullRequestContributionEdge
python
pytorch__pytorch
torch/distributed/fsdp/_optim_utils.py
{ "start": 1882, "end": 3027 }
class ____: """ This holds the consolidated optimizer state on the target rank. Positive- dimension tensor state is communicated across ranks, while zero-dimension tensor state and non-tensor state is taken directly from the target rank. PyTorch version 1.12 moved to using zero-dimension tensors fo...
_ConsolidatedOptimState
python
dagster-io__dagster
python_modules/libraries/dagster-dg-cli/dagster_dg_cli/api_layer/schemas/deployment.py
{ "start": 501, "end": 619 }
class ____(BaseModel): """GET /api/deployments response.""" items: list[Deployment] total: int
DeploymentList
python
docker__docker-py
docker/api/build.py
{ "start": 135, "end": 16063 }
class ____: def build(self, path=None, tag=None, quiet=False, fileobj=None, nocache=False, rm=False, timeout=None, custom_context=False, encoding=None, pull=False, forcerm=False, dockerfile=None, container_limits=None, decode=False, buildargs=None, gzip=False,...
BuildApiMixin
python
pytorch__pytorch
torch/_inductor/runtime/caching/exceptions.py
{ "start": 1581, "end": 2263 }
class ____(SystemError): """Error raised when a file lock operation times out. This exception is raised when a file lock operation exceeds the specified timeout limit, indicating that the lock could not be acquired within the allotted time. """ def __init__(self, flock: FileLock, timeout: float) -...
FileLockTimeoutError
python
run-llama__llama_index
llama-index-core/llama_index/core/vector_stores/types.py
{ "start": 2481, "end": 3718 }
class ____(BaseModel): r""" Comprehensive metadata filter for vector stores to support more operators. Value uses Strict types, as int, float and str are compatible types and were all converted to string before. See: https://docs.pydantic.dev/latest/usage/types/#strict-types """ key: str ...
MetadataFilter
python
sqlalchemy__sqlalchemy
test/sql/test_operators.py
{ "start": 152997, "end": 155494 }
class ____( testing.AssertsCompiledSQL, fixtures.TestBase ): """test new custom op dispatch feature added as part of #12948""" @testing.fixture def dialect_fixture(self): class MyCompiler(compiler.SQLCompiler): def visit_myop_op_binary(self, binary, operator, **kw): ...
CustomOpDialectCompileTest
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pylint/bad_staticmethod_argument.py
{ "start": 460, "end": 690 }
class ____: @staticmethod def eat(x, self, z): pass @staticmethod def sleep(x, cls, z): pass def grow(self, x, y, z): pass @classmethod def graze(cls, x, y, z): pass
Foo
python
scipy__scipy
scipy/optimize/_shgo_lib/_vertex.py
{ "start": 7009, "end": 13079 }
class ____(VertexCacheBase): def __init__(self, field=None, field_args=(), g_cons=None, g_cons_args=(), workers=1): """ Class for a vertex cache for a simplicial complex with an associated field. Parameters ---------- field : callable Sca...
VertexCacheField
python
Lightning-AI__lightning
tests/tests_pytorch/callbacks/progress/test_tqdm_progress_bar.py
{ "start": 1416, "end": 17086 }
class ____(Tqdm): def __init__(self, *args, **kwargs): self.n_values = [] self.total_values = [] self.descriptions = [] super().__init__(*args, **kwargs) self.__n = 0 self.__total = 0 # again to reset additions from `super().__init__` self.n_values = [...
MockTqdm
python
modin-project__modin
modin/polars/groupby.py
{ "start": 928, "end": 8170 }
class ____: def __init__( self, df: "DataFrame", *by, maintain_order: bool = False, **named_by, ) -> None: self.df = df if len(by) == 1: self.by = by[0] else: if all(isinstance(b, str) and b in self.df.columns for b in by):...
GroupBy
python
google__pytype
pytype/tools/xref/indexer.py
{ "start": 8291, "end": 9092 }
class ____: """A symbol holding a reference to a definition. Attributes: name: The symbol name typ: The symbol type (e.g. Attribute) data: The pytype data attached to the symbol scope: The namespace id (e.g. module.A.f) ref_scope: The namespace id of the referred symbol (if we can determine it)...
Reference
python
cython__cython
Cython/Compiler/ExprNodes.py
{ "start": 558254, "end": 573943 }
class ____: # Mixin class containing code common to PrimaryCmpNodes # and CascadedCmpNodes. special_bool_cmp_function = None special_bool_cmp_utility_code = None special_bool_extra_args = [] def infer_type(self, env): # TODO: Actually implement this (after merging with -unstable). ...
CmpNode
python
wandb__wandb
wandb/vendor/watchdog_0_9_0/wandb_watchdog/events.py
{ "start": 8552, "end": 10575 }
class ____(object): """ Base file system event handler that you can override methods from. """ def dispatch(self, event): """Dispatches events to the appropriate methods. :param event: The event object representing the file system event. :type event: :cl...
FileSystemEventHandler
python
tensorflow__tensorflow
tensorflow/python/distribute/mirrored_values_test.py
{ "start": 2874, "end": 3945 }
class ____(test.TestCase, parameterized.TestCase): config = config_pb2.ConfigProto() config.allow_soft_placement = True def tearDown(self): super().tearDown() context._reset_context() @test_util.run_in_graph_and_eager_modes(config=config) def testProperties(self): if context.num_gpus() < 1 and ...
MirroredVariableTest
python
scipy__scipy
benchmarks/benchmarks/stats.py
{ "start": 17027, "end": 18055 }
class ____(Benchmark): param_names = ['size'] params = [[10, 100, 1000, 10000]] def setup(self, size): num_rows = 4 num_cols = 3 self.df = 5 self.M = np.full((num_rows,num_cols), 0.3) self.U = 0.5 * np.identity(num_rows) + np.full( (num_rows, num_rows), 0...
MatrixSampling
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-confluence/llama_index/readers/confluence/event.py
{ "start": 420, "end": 660 }
class ____(BaseEvent): """Event emitted when the total number of pages to process is determined.""" total_pages: int @classmethod def class_name(cls) -> str: return "TotalPagesToProcessEvent"
TotalPagesToProcessEvent
python
zostera__django-bootstrap4
example/app/forms.py
{ "start": 3146, "end": 3450 }
class ____(forms.Form): text1 = forms.CharField() file1 = forms.FileField() file2 = forms.FileField(required=False) file3 = forms.FileField(widget=forms.ClearableFileInput) file5 = forms.ImageField() file4 = forms.FileField(required=False, widget=forms.ClearableFileInput)
FilesForm
python
pypa__warehouse
tests/functional/manage/test_account_publishing.py
{ "start": 388, "end": 6401 }
class ____: @responses.activate def test_add_pending_github_publisher_succeeds(self, webtest): """ An authenticated user add a new pending GitHub publisher via the form on their account publishing page. """ # Arrange: Create a user with verified email user = UserF...
TestManageAccountPublishing
python
getsentry__sentry
src/sentry/utils/circuit_breaker.py
{ "start": 499, "end": 588 }
class ____(TypedDict, total=True): limit: int window: int
CircuitBreakerPassthrough
python
django-guardian__django-guardian
guardian/testapp/migrations/0005_uuidpkmodel.py
{ "start": 105, "end": 486 }
class ____(migrations.Migration): dependencies = [ ("testapp", "0004_childtestmodel_parenttestmodel"), ] operations = [ migrations.CreateModel( name="UUIDPKModel", fields=[ ("uuid_pk", models.UUIDField(default=uuid.uuid4, editable=False, primary_key=T...
Migration
python
pytorch__pytorch
torch/fx/experimental/partitioner_utils.py
{ "start": 2830, "end": 12295 }
class ____(NamedTuple): devices: list[Device] mode: PartitionMode = PartitionMode.size_based transfer_rate_bytes_per_sec: float = 0.0 node_to_latency_mapping: dict[Node, NodeLatency] = {} node_to_partition_mapping: dict[Node, int] = {} partition_to_logical_device_mapping: dict[int, list[int]] = ...
PartitionerConfig
python
pytorch__pytorch
torch/ao/nn/quantized/modules/normalization.py
{ "start": 2339, "end": 4123 }
class ____(torch.nn.GroupNorm): r"""This is the quantized version of :class:`~torch.nn.GroupNorm`. Additional args: * **scale** - quantization scale of the output, type: double. * **zero_point** - quantization zero point of the output, type: long. """ __constants__ = ["num_groups", "n...
GroupNorm
python
coleifer__peewee
tests/fields.py
{ "start": 3086, "end": 3181 }
class ____(TestModel): value = FloatField() value_null = FloatField(null=True)
FloatModel
python
wandb__wandb
wandb/vendor/pygments/lexers/matlab.py
{ "start": 26640, "end": 29146 }
class ____(RegexLexer): """ For Scilab source code. .. versionadded:: 1.5 """ name = 'Scilab' aliases = ['scilab'] filenames = ['*.sci', '*.sce', '*.tst'] mimetypes = ['text/scilab'] tokens = { 'root': [ (r'//.*?$', Comment.Single), (r'^\s*function',...
ScilabLexer
python
jd__tenacity
tenacity/__init__.py
{ "start": 3613, "end": 4104 }
class ____: actions: t.List[t.Callable[["RetryCallState"], t.Any]] = dataclasses.field( default_factory=list ) retry_run_result: bool = False delay_since_first_attempt: int = 0 stop_run_result: bool = False is_explicit_retry: bool = False def reset(self) -> None: self.action...
IterState
python
plotly__plotly.py
plotly/graph_objs/sankey/node/_hoverlabel.py
{ "start": 233, "end": 11269 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "sankey.node" _path_str = "sankey.node.hoverlabel" _valid_props = { "align", "alignsrc", "bgcolor", "bgcolorsrc", "bordercolor", "bordercolorsrc", "font", "namelength", "namelength...
Hoverlabel
python
PyCQA__pylint
tests/functional/n/no/no_member_if_statements.py
{ "start": 523, "end": 1832 }
class ____: _attr_state: Union[str, datetime] = "Unknown" @property def state(self) -> Union[str, datetime]: return self._attr_state def some_function(self) -> str: state = self.state if isinstance(state, datetime): return state.isoformat() return str(state)...
Base
python
Pylons__pyramid
tests/test_httpexceptions.py
{ "start": 16848, "end": 17268 }
class ____(unittest.TestCase): def _makeOne(self, *arg, **kw): from pyramid.httpexceptions import HTTPForbidden return HTTPForbidden(*arg, **kw) def test_it_result_not_passed(self): exc = self._makeOne() self.assertEqual(exc.result, None) def test_it_result_passed(self): ...
TestHTTPForbidden
python
pytorch__pytorch
tools/testing/target_determination/heuristics/llm.py
{ "start": 520, "end": 1840 }
class ____(HeuristicInterface): def __init__(self, **kwargs: dict[str, Any]) -> None: super().__init__(**kwargs) def get_prediction_confidence(self, tests: list[str]) -> TestPrioritizations: critical_tests = self.get_mappings() filter_valid_tests = { TestRun(test): score ...
LLM
python
getsentry__sentry
src/sentry/replays/endpoints/organization_replay_selector_index.py
{ "start": 2134, "end": 2322 }
class ____(TypedDict, total=False): count_dead_clicks: int count_rage_clicks: int dom_element: str element: ElementResponseType project_id: str
ReplaySelectorResponseData
python
huggingface__transformers
src/transformers/models/modernbert/modeling_modernbert.py
{ "start": 24600, "end": 32527 }
class ____(PreTrainedModel): config: ModernBertConfig base_model_prefix = "model" supports_gradient_checkpointing = True _no_split_modules = ["ModernBertEmbeddings", "ModernBertEncoderLayer"] _supports_flash_attn = True _supports_sdpa = True _supports_flex_attn = False @torch.no_grad() ...
ModernBertPreTrainedModel
python
great-expectations__great_expectations
contrib/experimental/great_expectations_experimental/expectations/expect_column_kolmogoro_smirnov_test_p_value_to_be_greater_than.py
{ "start": 622, "end": 2143 }
class ____(TableMetricProvider): # This is the id string that will be used to reference your Metric. metric_name = "column.p_value_greater_than_threshold" value_keys = ( "column_a", "column_b", ) # This method implements the core logic for the PandasExecutionEngine @metric_value...
ColumnKolmogorovSmirnovTestPValueGreaterThan
python
viewflow__viewflow
viewflow/workflow/flow/views/filters.py
{ "start": 1274, "end": 1867 }
class ____(FilterSet): process = ModelChoiceFilter(queryset=this.queue_processes_query) flow_task = ChoiceFilter() created = DateRangeFilter() def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.filters["flow_task"].field.choices = get_queryset_flow_task_choices(...
FlowUserTaskListFilter
python
pytorch__pytorch
test/distributed/fsdp/test_fsdp_hybrid_shard.py
{ "start": 2489, "end": 2592 }
class ____(Enum): ALL_HYBRID_SHARD = auto() MIXED_HYBRID_FULL_SHARD = auto()
ShardingStrategyMode
python
PrefectHQ__prefect
src/prefect/_internal/concurrency/primitives.py
{ "start": 264, "end": 2672 }
class ____: """ A thread-safe async event. Unlike `asyncio.Event` this implementation does not bind to a loop on creation. This matches the behavior of `asyncio.Event` in Python 3.10+, but differs from earlier versions. This event also does not support a `clear()` operation. This matches the b...
Event
python
wandb__wandb
wandb/vendor/pygments/lexers/objective.py
{ "start": 8244, "end": 8561 }
class ____(objective(CLexer)): """ For Objective-C source code with preprocessor directives. """ name = 'Objective-C' aliases = ['objective-c', 'objectivec', 'obj-c', 'objc'] filenames = ['*.m', '*.h'] mimetypes = ['text/x-objective-c'] priority = 0.05 # Lower than C
ObjectiveCLexer
python
doocs__leetcode
solution/2900-2999/2918.Minimum Equal Sum of Two Arrays After Replacing Zeros/Solution.py
{ "start": 0, "end": 320 }
class ____: def minSum(self, nums1: List[int], nums2: List[int]) -> int: s1 = sum(nums1) + nums1.count(0) s2 = sum(nums2) + nums2.count(0) if s1 > s2: return self.minSum(nums2, nums1) if s1 == s2: return s1 return -1 if nums1.count(0) == 0 else s2
Solution
python
pytorch__pytorch
torch/testing/_internal/distributed/nn/api/remote_module_test.py
{ "start": 2675, "end": 2996 }
class ____: def __init__(self, first_arg, first_kwarg=-1): pass def create_scripted_module(first_arg, first_kwarg=-1): module = MyModule(first_arg, first_kwarg=first_kwarg) scripted_module = torch.jit.script(module) return scripted_module # Common utils for both CPU and CUDA test suites
BadModule
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 352916, "end": 353515 }
class ____(sgqlc.types.Input): """Autogenerated input type of UpdateIssueComment""" __schema__ = github_schema __field_names__ = ("id", "body", "client_mutation_id") id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="id") """The ID of the IssueComment to modify.""" body = sgqlc.typ...
UpdateIssueCommentInput
python
dagster-io__dagster
python_modules/dagster-pipes/dagster_pipes/__init__.py
{ "start": 16273, "end": 16342 }
class ____(TypedDict): extras: PipesExtras
PipesLogWriterOpenedData
python
numpy__numpy
numpy/lib/tests/test_arraypad.py
{ "start": 51062, "end": 56616 }
class ____: @pytest.mark.parametrize("pad_width", [ (4, 5, 6, 7), ((1,), (2,), (3,)), ((1, 2), (3, 4), (5, 6)), ((3, 4, 5), (0, 1, 2)), ]) @pytest.mark.parametrize("mode", _all_modes.keys()) def test_misshaped_pad_width(self, pad_width, mode): arr = np.arange(30)....
TestPadWidth
python
bokeh__bokeh
src/bokeh/document/locking.py
{ "start": 3453, "end": 4965 }
class ____: # TODO(mypy): this needs to implement Document interface ''' Wrap a Document object so that only methods that can safely be used from unlocked callbacks or threads are exposed. Attempts to otherwise access or change the Document results in an exception. ''' def __init__(self, doc: Docu...
UnlockedDocumentProxy
python
scipy__scipy
scipy/special/tests/test_kolmogorov.py
{ "start": 11413, "end": 15773 }
class ____: def test_nan(self): assert_(np.isnan(kolmogorov(np.nan))) def test_basic(self): dataset = [(0, 1.0), (0.5, 0.96394524366487511), (0.8275735551899077, 0.5000000000000000), (1, 0.26999967167735456), (2, 0.0006...
TestKolmogorov
python
networkx__networkx
networkx/algorithms/tests/test_dominance.py
{ "start": 39, "end": 3442 }
class ____: @pytest.mark.parametrize("G", [nx.Graph(), nx.MultiGraph()]) def test_raises_undirected(self, G): """Check that `immediate_dominators` raises for undirected graphs.""" with pytest.raises( nx.NetworkXNotImplemented, match=r"not implemented for undirected" ): ...
TestImmediateDominators
python
getsentry__sentry
tests/sentry/sentry_apps/api/endpoints/test_sentry_apps.py
{ "start": 6500, "end": 9993 }
class ____(SentryAppsTest): def setUp(self) -> None: super().setUp() self.setup_apps() self.superuser = self.create_user(is_superuser=True) self.login_as(self.superuser, superuser=True) def test_staff_sees_all_apps(self) -> None: staff_user = self.create_user(is_staff=T...
SuperuserStaffGetSentryAppsTest
python
kamyu104__LeetCode-Solutions
Python/peak-index-in-a-mountain-array.py
{ "start": 32, "end": 416 }
class ____(object): def peakIndexInMountainArray(self, arr): """ :type arr: List[int] :rtype: int """ left, right = 0, len(arr)-1 while left <= right: mid = left + (right-left)//2 if arr[mid] > arr[mid+1]: right = mid-1 ...
Solution
python
pytorch__pytorch
torch/_lazy/closure.py
{ "start": 160, "end": 475 }
class ____: def __init__(self) -> None: pass def run(self, closure): """Run closure function Args: closure: callable function to run """ closure() def __call__(self, closures): for closure in closures: self.run(closure)
ClosureHandler
python
huggingface__transformers
src/transformers/models/codegen/modeling_codegen.py
{ "start": 11570, "end": 11869 }
class ____(PreTrainedModel): config: CodeGenConfig base_model_prefix = "transformer" supports_gradient_checkpointing = True _no_split_modules = ["CodeGenBlock"] _skip_keys_device_placement = "past_key_values" _can_compile_fullgraph = True @auto_docstring
CodeGenPreTrainedModel
python
PrefectHQ__prefect
src/prefect/task_runners.py
{ "start": 7861, "end": 17233 }
class ____(TaskRunner[PrefectConcurrentFuture[R]]): """ A task runner that executes tasks in a separate thread pool. Attributes: max_workers: The maximum number of threads to use for executing tasks. Defaults to `PREFECT_TASK_RUNNER_THREAD_POOL_MAX_WORKERS` or `sys.maxsize`. Note: ...
ThreadPoolTaskRunner
python
walkccc__LeetCode
solutions/1881. Maximum Value after Insertion/1881.py
{ "start": 0, "end": 251 }
class ____: def maxValue(self, n: str, x: int) -> str: isNegative = n[0] == '-' for i, c in enumerate(n): if not isNegative and int(c) < x or isNegative and int(c) > x: return n[:i] + str(x) + n[i:] return n + str(x)
Solution
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/direct_dep_foo_bar/package.py
{ "start": 217, "end": 689 }
class ____(Package): """This package has a variant "bar", which is False by default, and variant "foo" which is True by default. """ homepage = "http://www.example.com" url = "http://www.example.com/direct-dep-foo-bar-1.0.tar.gz" version("1.0", md5="567890abcdefg12345678900987654321") var...
DirectDepFooBar
python
ansible__ansible
hacking/create-bulk-issues.py
{ "start": 577, "end": 1614 }
class ____: title: str summary: str body: str project: str labels: list[str] | None = None assignee: str | None = None def create(self) -> str: cmd = ['gh', 'issue', 'create', '--title', self.title, '--body', self.body, '--project', self.project] if self.labels: ...
Issue
python
openai__openai-python
examples/responses/structured_outputs.py
{ "start": 159, "end": 1050 }
class ____(BaseModel): steps: List[Step] final_answer: str client = OpenAI() rsp = client.responses.parse( input="solve 8x + 31 = 2", model="gpt-4o-2024-08-06", text_format=MathResponse, ) for output in rsp.output: if output.type != "message": raise Exception("Unexpected non message"...
MathResponse
python
huggingface__transformers
src/transformers/integrations/fbgemm_fp8.py
{ "start": 3157, "end": 12441 }
class ____(nn.Module): def __init__(self, config, dtype=torch.float32): super().__init__() self.num_experts = config.num_local_experts self.intermediate_size = config.intermediate_size self.hidden_size = config.hidden_size self.expert_dim = self.intermediate_size self...
FbgemmFp8Llama4TextExperts
python
pytorch__pytorch
torch/fx/experimental/normalize.py
{ "start": 3614, "end": 5491 }
class ____(AnnotateTypesWithSchema): """ Normalize callsites that are different ways of "spelling" the same invocation into a single, canonical call. Currently supports: 1. Normalize operators (e.g. operator.add) to the `torch` ops they ultimately invoke (e.g. torch.add) when it is possible to s...
NormalizeOperators
python
ray-project__ray
python/ray/dag/dag_node_operation.py
{ "start": 1057, "end": 2689 }
class ____: def __init__( self, exec_task_idx: int, operation_type: _DAGNodeOperationType, method_name: Optional[str] = None, ): """ Args: exec_task_idx: The index of the task that this operation belongs to in the actor's ExecutableTask...
_DAGNodeOperation
python
huggingface__transformers
src/transformers/models/flex_olmo/modeling_flex_olmo.py
{ "start": 17071, "end": 18804 }
class ____(GradientCheckpointingLayer): def __init__(self, config: FlexOlmoConfig, layer_idx: int): super().__init__() self.hidden_size = config.hidden_size self.self_attn = FlexOlmoAttention(config=config, layer_idx=layer_idx) self.mlp = FlexOlmoSparseMoeBlock(config) self.p...
FlexOlmoDecoderLayer
python
google__jax
tests/dynamic_api_test.py
{ "start": 48836, "end": 62038 }
class ____(jtu.JaxTestCase): def setUp(self): super().setUp() if jax.config.x64_enabled: raise unittest.SkipTest() @parameterized.parameters((True,), (False,)) def test_internal_jumble(self, disable_jit): with jax.disable_jit(disable_jit): ins = lax.convert_element_type(jnp.array([3, 1, 4]), c...
JumbleTest
python
getsentry__sentry
tests/sentry/issues/test_occurrence_consumer.py
{ "start": 13222, "end": 14787 }
class ____(IssueOccurrenceTestBase): def test_lookup_event_doesnt_exist(self) -> None: message = get_test_message(self.project.id, include_event=False) with pytest.raises(EventLookupError): with self.feature("organizations:profile-file-io-main-thread-ingest"): _process_me...
IssueOccurrenceLookupEventIdTest
python
marshmallow-code__marshmallow
tests/base.py
{ "start": 3625, "end": 4035 }
class ____: def __init__(self, title, user, collaborators=None, categories=None, id_=None): self.title = title self.user = user self.collaborators = collaborators or [] # List/tuple of users self.categories = categories self.id = id_ def __contains__(self, item): ...
Blog
python
Pylons__pyramid
src/pyramid/interfaces.py
{ "start": 37302, "end": 37440 }
class ____(Interface): """A list object representing all known translation directories for an application"""
ITranslationDirectories
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/ext.py
{ "start": 14436, "end": 15280 }
class ____(_regconfig_fn): """The PostgreSQL ``websearch_to_tsquery`` SQL function. This function applies automatic casting of the REGCONFIG argument to use the :class:`_postgresql.REGCONFIG` datatype automatically, and applies a return type of :class:`_postgresql.TSQUERY`. Assuming the PostgreSQL...
websearch_to_tsquery
python
django__django
tests/generic_inline_admin/admin.py
{ "start": 287, "end": 370 }
class ____(admin.ModelAdmin): inlines = [ MediaInline, ]
EpisodeAdmin
python
huggingface__transformers
src/transformers/models/idefics2/modeling_idefics2.py
{ "start": 17869, "end": 21526 }
class ____(Idefics2PreTrainedModel): config: Idefics2VisionConfig input_modalities = ("image",) _supports_sdpa = True _supports_flash_attn = True _supports_flex_attn = True _can_record_outputs = { "hidden_states": Idefics2EncoderLayer, "attentions": Idefics2VisionAttention, }...
Idefics2VisionTransformer
python
encode__starlette
starlette/testclient.py
{ "start": 2043, "end": 2166 }
class ____(Exception): def __init__(self, session: WebSocketTestSession) -> None: self.session = session
_Upgrade
python
keras-team__keras
keras/src/ops/core.py
{ "start": 37268, "end": 42779 }
class ____(Operation): def __init__(self, function, *, name=None): super().__init__(name=name) self.function = function def call(self, elements): return backend.core.vectorized_map(self.function, elements) def compute_output_spec(self, elements): x = tree.map_structure(lamb...
VectorizedMap
python
eventlet__eventlet
tests/event_test.py
{ "start": 73, "end": 3063 }
class ____(LimitedTestCase): def test_waiting_for_event(self): evt = eventlet.Event() value = 'some stuff' def send_to_event(): evt.send(value) eventlet.spawn_n(send_to_event) self.assertEqual(evt.wait(), value) def test_multiple_waiters(self): self....
TestEvent