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
agronholm__apscheduler
src/apscheduler/_retry.py
{ "start": 864, "end": 1991 }
class ____: """ Mixin that provides support for retrying operations. :param retry_settings: Tenacity settings for retrying operations in case of a database connecitivty problem """ retry_settings: RetrySettings = attrs.field(default=RetrySettings()) _logger: Logger = attrs.field(init=F...
RetryMixin
python
ray-project__ray
python/ray/util/queue.py
{ "start": 326, "end": 8650 }
class ____: """A first-in, first-out queue implementation on Ray. The behavior and use cases are similar to those of the asyncio.Queue class. Features both sync and async put and get methods. Provides the option to block until space is available when calling put on a full queue, or to block until...
Queue
python
allegroai__clearml
clearml/backend_api/services/v2_9/events.py
{ "start": 68512, "end": 69432 }
class ____(Request): """ Get the tasks's latest scalar values :param task: Task ID :type task: str """ _service = "events" _action = "get_task_latest_scalar_values" _version = "2.9" _schema = { "definitions": {}, "properties": {"task": {"description": "Task ID", "ty...
GetTaskLatestScalarValuesRequest
python
pytorch__pytorch
benchmarks/tensorexpr/pooling.py
{ "start": 1306, "end": 1478 }
class ____(PoolingBench): def __init__(self, *args): super().__init__("maxpool", *args) @staticmethod def module(): return "maxpool"
MaxPoolBench
python
pennersr__django-allauth
allauth/socialaccount/views.py
{ "start": 2652, "end": 2894 }
class ____(TemplateView): template_name = ( "socialaccount/authentication_error." + account_settings.TEMPLATE_EXTENSION ) login_error = LoginErrorView.as_view() @method_decorator(login_required, name="dispatch")
LoginErrorView
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/deprecated2.py
{ "start": 1598, "end": 3075 }
class ____: @overload def __new__(cls, x: int) -> Self: ... @overload @deprecated("str no longer supported") def __new__(cls, x: str) -> Self: ... def __new__(cls, x: int | str) -> Self: ... ClassE(3) # This should generate an error if reportDeprecated is enabled. ClassE("") @deprecated("...
ClassE
python
milvus-io__pymilvus
pymilvus/orm/schema.py
{ "start": 36522, "end": 44488 }
class ____: def __init__( self, functions: Union[Function, List[Function]], params: Optional[Dict] = None, ): if isinstance(functions, Function): self._functions = [functions] else: self._functions = functions self._params = params @p...
FunctionScore
python
rapidsai__cudf
python/cudf_polars/cudf_polars/experimental/base.py
{ "start": 2751, "end": 4186 }
class ____: """ Table data source information. Notes ----- This class should be sub-classed for specific data source types (e.g. Parquet, DataFrame, etc.). The required properties/methods enable lazy sampling of the underlying datasource. """ _unique_stats_columns: set[str] ...
DataSourceInfo
python
davidhalter__jedi
jedi/inference/signature.py
{ "start": 1101, "end": 1947 }
class ____(_SignatureMixin): def __init__(self, value, is_bound=False): self.value = value self.is_bound = is_bound @property def name(self): return self.value.name @property def annotation_string(self): return '' def get_param_names(self, resolve_stars=False):...
AbstractSignature
python
getsentry__sentry
src/sentry_plugins/splunk/plugin.py
{ "start": 874, "end": 9022 }
class ____(CorePluginMixin, DataForwardingPlugin): """ - Turn on HTTP Event Collector by enabling its endpoint. HEC is not enabled by default. - http://dev.splunk.com/view/event-collector/SP-CAAAE7F - Settings > Data Inputs > HTTP Event Collector > Add new - Name: Sentry - You'll be gi...
SplunkPlugin
python
pyqtgraph__pyqtgraph
pyqtgraph/widgets/RemoteGraphicsView.py
{ "start": 717, "end": 2123 }
class ____(QtGui.QMouseEvent): @staticmethod def get_state(obj, picklable=False): typ = obj.type() if isinstance(typ, int): # PyQt6 returns an int here instead of QEvent.Type, # but its QtGui.QMouseEvent constructor takes only QEvent.Type. # Note however that ...
MouseEvent
python
optuna__optuna
optuna/storages/_rdb/models.py
{ "start": 4239, "end": 5310 }
class ____(BaseModel): __tablename__ = "study_system_attributes" __table_args__: Any = (UniqueConstraint("study_id", "key"),) study_system_attribute_id = _Column(Integer, primary_key=True) study_id = _Column(Integer, ForeignKey("studies.study_id")) key = _Column(String(MAX_INDEXED_STRING_LENGTH)) ...
StudySystemAttributeModel
python
pytorch__pytorch
test/distributed/tensor/test_dtensor_ops.py
{ "start": 27449, "end": 29062 }
class ____(TestDTensorOps): _op_db = repurpose_ops(op_db, "TestDTensorOps", "TestLocalDTensorOps") def setUp(self) -> None: super().setUp() torch.distributed.init_process_group("fake", rank=0, world_size=self.world_size) self.fake_pg = torch.distributed.distributed_c10d._get_default_gro...
TestLocalDTensorOps
python
Lightning-AI__lightning
src/lightning/pytorch/loops/training_epoch_loop.py
{ "start": 2272, "end": 28249 }
class ____(loops._Loop): """Iterates over all batches in the dataloader (one epoch) that the user returns in their :meth:`~lightning.pytorch.core.LightningModule.train_dataloader` method. Its main responsibilities are calling the ``*_epoch_{start,end}`` hooks, accumulating outputs if the user request t...
_TrainingEpochLoop
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/utils/eks_test_constants.py
{ "start": 5925, "end": 6299 }
class ____: """Page lengths to use when testing pagination.""" SMALL: int = 3 LARGE: int = 10 FARGATE_PROFILE_UUID_PATTERN: str = ( r"(?P<fargate_uuid>[-0-9a-z]{8}-[-0-9a-z]{4}-[-0-9a-z]{4}-[-0-9a-z]{4}-[-0-9a-z]{12})" ) NODEGROUP_UUID_PATTERN: str = ( r"(?P<nodegroup_uuid>[-0-9a-z]{8}-[-0-9a-z]{...
PageCount
python
pytorch__pytorch
test/test_ops_fwd_gradients.py
{ "start": 964, "end": 4074 }
class ____(TestGradients): # Test that forward-over-reverse gradgrad is computed correctly @_gradcheck_ops(op_db) def test_fn_fwgrad_bwgrad(self, device, dtype, op): self._skip_helper(op, device, dtype) if op.supports_fwgrad_bwgrad: self._check_helper(device, dtype, op, op.get_o...
TestFwdGradients
python
django__django
tests/m2m_signals/models.py
{ "start": 393, "end": 451 }
class ____(Car): price = models.IntegerField()
SportsCar
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/linalg/linear_operator_low_rank_update_test.py
{ "start": 9100, "end": 9917 }
class ____( BaseLinearOperatorLowRankUpdatetest, linear_operator_test_util.SquareLinearOperatorDerivedClassTest): """A = L + UU^H, L > 0 ==> A > 0 and we can use a Cholesky.""" _use_diag_update = False _is_diag_update_positive = None _use_v = False def tearDown(self): config.enable_tensor_float_...
LinearOperatorLowRankUpdatetestNoDiagUseCholesky
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/run_config_schema.py
{ "start": 285, "end": 1521 }
class ____(NamedTuple): run_config_schema_type: ConfigType config_type_dict_by_name: Mapping[str, ConfigType] config_type_dict_by_key: Mapping[str, ConfigType] config_mapping: Optional[ConfigMapping] def has_config_type(self, name: str) -> bool: check.str_param(name, "name") return ...
RunConfigSchema
python
huggingface__transformers
src/transformers/models/evolla/modular_evolla.py
{ "start": 5924, "end": 5970 }
class ____(EsmLayer): pass
EvollaSaProtLayer
python
PyCQA__pydocstyle
src/pydocstyle/parser.py
{ "start": 8905, "end": 9306 }
class ____(str): """Represent a docstring. This is a string, but has additional start/end attributes representing the start and end of the token. """ def __new__(cls, v, start, end): return str.__new__(cls, v) def __init__(self, v, start, end): self.start = start self...
Docstring
python
numba__numba
numba/tests/doc_examples/test_interval_example.py
{ "start": 186, "end": 8867 }
class ____(unittest.TestCase): def test_interval_class_usage(self): # magictoken.interval_py_class.begin class Interval(object): """ A half-open interval on the real number line. """ def __init__(self, lo, hi): self.lo = lo ...
IntervalExampleTest
python
kamyu104__LeetCode-Solutions
Python/count-numbers-with-unique-digits-ii.py
{ "start": 1216, "end": 2184 }
class ____(object): def numberCount(self, a, b): """ :type a: int :type b: int :rtype: int """ fact = [1]*2 def nPr(n, k): while len(fact) <= n: # lazy initialization fact.append(fact[-1]*len(fact)) return fact[n]//fact...
Solution2
python
allegroai__clearml
clearml/binding/frameworks/pytorch_bind.py
{ "start": 431, "end": 13200 }
class ____(PatchBaseModelIO): _current_task = None _checkpoint_filename = {} __patched = None __patched_lightning = None __patched_pytorch_lightning = None __patched_mmcv = None @staticmethod def update_current_task(task: Any, **_: Any) -> None: PatchPyTorchModelIO._current_task...
PatchPyTorchModelIO
python
justquick__django-activity-stream
actstream/feeds.py
{ "start": 11370, "end": 11572 }
class ____(ModelActivityMixin, JSONActivityFeed): """ JSON feed of Activity for a given model (where actions involve the given model as any of the entities). """ pass
ModelJSONActivityFeed
python
rq__rq
tests/test_retry.py
{ "start": 384, "end": 6168 }
class ____(RQTestCase): """Tests from test_retry.py""" def test_persistence_of_retry_data(self): """Retry related data is stored and restored properly""" job = Job.create(func=say_hello, connection=self.connection) job.retries_left = 3 job.retry_intervals = [1, 2, 3] job...
TestRetry
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/metaclass3.py
{ "start": 554, "end": 592 }
class ____(metaclass=Meta10): ...
Base10
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_set.py
{ "start": 37517, "end": 38048 }
class ____(_TestBasicOps, __TestCase): def setUp(self): self.case = "unit set (tuple)" self.values = [(0, "zero")] self.set = set(self.values) self.dup = set(self.values) self.length = 1 self.repr = "{(0, 'zero')}" super().setUp() def test_in(se...
TestBasicOpsTuple
python
falconry__falcon
tests/test_httperror.py
{ "start": 4855, "end": 5065 }
class ____: def on_get(self, req, resp): raise falcon.HTTPMethodNotAllowed( ['PUT'], headers={'x-ping': 'pong', 'accept': 'GET,PUT'} )
MethodNotAllowedResourceWithHeadersWithAccept
python
dask__dask
dask/layers.py
{ "start": 2621, "end": 3262 }
class ____(ArrayBlockwiseDep): def __init__(self, chunks: tuple[tuple[int, ...], ...], values: np.ndarray | dict): super().__init__(chunks) self.values = values def __getitem__(self, idx: tuple): return self.values[idx] @normalize_token.register(ArraySliceDep) def normalize_array_slic...
ArrayValuesDep
python
allegroai__clearml
clearml/backend_api/session/jsonmodels/fields.py
{ "start": 13674, "end": 14601 }
class ____(StringField): """Datetime field.""" types = (datetime.datetime,) def __init__(self, str_format: str = None, *args: Any, **kwargs: Any) -> None: """Init. :param str str_format: Format to cast datetime to (if `None` - casting to ISO 8601 format). """ ...
DateTimeField
python
plotly__plotly.py
plotly/graph_objs/contourcarpet/_colorbar.py
{ "start": 233, "end": 61611 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "contourcarpet" _path_str = "contourcarpet.colorbar" _valid_props = { "bgcolor", "bordercolor", "borderwidth", "dtick", "exponentformat", "labelalias", "len", "lenmode", "minexpone...
ColorBar
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pylint/too_many_arguments.py
{ "start": 714, "end": 1260 }
class ____: def f(self, y, z, a, b, c, *, u, v, w): # Too many arguments (8/5) pass def f(self, y, z, a, b, c): # OK pass @classmethod def f(cls, y, z, a, b, c, *, u, v, w): # Too many arguments (8/5) pass @classmethod def f(cls, y, z, a, b, c): # OK pass ...
C
python
pytorch__pytorch
test/fx/test_partitioner_order.py
{ "start": 272, "end": 461 }
class ____(OperatorSupport): def is_node_supported( self, submodules: Mapping[str, torch.nn.Module], node: torch.fx.Node ) -> bool: return True
DummyDevOperatorSupport
python
PrefectHQ__prefect
src/prefect/server/utilities/database.py
{ "start": 6658, "end": 8440 }
class ____(TypeDecorator[Any]): """ JSON type that returns SQLAlchemy's dialect-specific JSON types, where possible. Uses generic JSON otherwise. The "base" type is postgresql.JSONB to expose useful methods prior to SQL compilation """ impl: type[postgresql.JSONB] | type[TypeEngine[Any]] |...
JSON
python
huggingface__transformers
tests/models/vitdet/test_modeling_vitdet.py
{ "start": 5784, "end": 11708 }
class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): """ Here we also overwrite some of the tests of test_modeling_common.py, as VitDet does not use input_ids, inputs_embeds, attention_mask and seq_length. """ all_model_classes = (VitDetModel, VitDetBackbone) if is_torch_available(...
VitDetModelTest
python
great-expectations__great_expectations
contrib/experimental/great_expectations_experimental/expectations/expect_column_to_have_no_days_missing.py
{ "start": 1806, "end": 5169 }
class ____(ColumnAggregateExpectation): """Expect No missing days in date column.""" from datetime import datetime, timedelta today = datetime.now() yesterday = today - timedelta(days=1) two_days_ago = today - timedelta(days=2) thirty_days_ago = today - timedelta(days=30) sixty_days_ago = ...
ExpectColumnToHaveNoDaysMissing
python
huggingface__transformers
tests/models/glm4v_moe/test_modeling_glm4v_moe.py
{ "start": 1264, "end": 6582 }
class ____: def __init__( self, parent, batch_size=3, seq_length=7, num_channels=3, ignore_index=-100, image_size=112, video_start_token_id=3, video_end_token_id=4, image_start_token_id=5, image_end_token_id=6, image_tok...
Glm4vMoeVisionText2TextModelTester
python
huggingface__transformers
src/transformers/models/detr/modeling_detr.py
{ "start": 1858, "end": 3200 }
class ____(BaseModelOutputWithCrossAttentions): r""" cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` and `config.add_cross_attention=True` is passed or when `config.output_attentions=True`): Tuple of `torch.FloatTensor` (one for each layer) of shape `(bat...
DetrDecoderOutput
python
ray-project__ray
python/ray/tests/test_runtime_env_packaging.py
{ "start": 5100, "end": 8296 }
class ____: def test_invalid_directory(self): with pytest.raises(ValueError): get_uri_for_directory("/does/not/exist", include_gitignore=True) with pytest.raises(ValueError): get_uri_for_directory("does/not/exist", include_gitignore=True) def test_determinism(self, rand...
TestGetURIForDirectory
python
pennersr__django-allauth
allauth/socialaccount/providers/facebook/forms.py
{ "start": 27, "end": 116 }
class ____(forms.Form): access_token = forms.CharField(required=True)
FacebookConnectForm
python
lazyprogrammer__machine_learning_examples
tf2.0/mlp_trader.py
{ "start": 6364, "end": 10959 }
class ____(object): def __init__(self, state_size, action_size): self.state_size = state_size self.action_size = action_size self.memory = ReplayBuffer(state_size, action_size, size=500) self.gamma = 0.95 # discount rate self.epsilon = 1.0 # exploration rate self.epsilon_min = 0.01 self....
DQNAgent
python
ionelmc__pytest-benchmark
tests/test_sample.py
{ "start": 65, "end": 266 }
class ____: def __init__(self, func): self.func = func def __get__(self, obj, cls): value = obj.__dict__[self.func.__name__] = self.func(obj) return value
cached_property
python
getsentry__sentry
fixtures/page_objects/base.py
{ "start": 843, "end": 1020 }
class ____(ButtonElement): @property def icon_href(self): return self.element.find_element(by=By.TAG_NAME, value="use").get_attribute("href")
ButtonWithIconElement
python
redis__redis-py
redis/backoff.py
{ "start": 190, "end": 589 }
class ____(ABC): """Backoff interface""" def reset(self): """ Reset internal state before an operation. `reset` is called once at the beginning of every call to `Retry.call_with_retry` """ pass @abstractmethod def compute(self, failures: int) -> float: ...
AbstractBackoff
python
getsentry__sentry
src/sentry/flags/providers.py
{ "start": 18471, "end": 19943 }
class ____: """Abstract payload validator. Uses HMAC-SHA256 by default. Allows us to inject dependencies for differing use cases. Specifically the test suite. """ def __init__( self, organization_id: int, provider: str, message: bytes, signature: str | None,...
PayloadSignatureValidator
python
xlwings__xlwings
xlwings/constants.py
{ "start": 121089, "end": 121301 }
class ____: xlTextQualifierDoubleQuote = 1 # from enum XlTextQualifier xlTextQualifierNone = -4142 # from enum XlTextQualifier xlTextQualifierSingleQuote = 2 # from enum XlTextQualifier
TextQualifier
python
pandas-dev__pandas
pandas/io/excel/_xlsxwriter.py
{ "start": 393, "end": 6035 }
class ____: # Map from openpyxl-oriented styles to flatter xlsxwriter representation # Ordering necessary for both determinism and because some are keyed by # prefixes of others. STYLE_MAPPING: dict[str, list[tuple[tuple[str, ...], str]]] = { "font": [ (("name",), "font_name"), ...
_XlsxStyler
python
lepture__authlib
authlib/integrations/flask_oauth2/requests.py
{ "start": 1093, "end": 1281 }
class ____(JsonPayload): def __init__(self, request: Request): self._request = request @property def data(self): return self._request.get_json()
FlaskJsonPayload
python
doocs__leetcode
lcof2/剑指 Offer II 067. 最大的异或/Solution2.py
{ "start": 649, "end": 840 }
class ____: def findMaximumXOR(self, nums: List[int]) -> int: trie = Trie() for v in nums: trie.insert(v) return max(trie.search(v) for v in nums)
Solution
python
scrapy__scrapy
scrapy/utils/log.py
{ "start": 6975, "end": 8059 }
class ____(logging.Handler): """Record log levels count into a crawler stats""" def __init__(self, crawler: Crawler, *args: Any, **kwargs: Any): super().__init__(*args, **kwargs) self.crawler: Crawler = crawler def emit(self, record: logging.LogRecord) -> None: sname = f"log_count/...
LogCounterHandler
python
PyCQA__pylint
tests/functional/s/singledispatch/singledispatch_functions.py
{ "start": 337, "end": 1396 }
class ____: @staticmethod def register(function): return function def __call__(self, function): return function fake_singledispatch_decorator = FakeSingleDispatch() @singledispatch def func(arg): return arg @func.register(str) def _(arg): return 42 @func.register(float) @func...
FakeSingleDispatch
python
pennersr__django-allauth
tests/apps/socialaccount/providers/feishu/tests.py
{ "start": 211, "end": 1721 }
class ____(OAuth2TestsMixin, TestCase): provider_id = FeishuProvider.id def get_mocked_response(self): return [ MockedResponse( 0, """ {"data": {"access_token": "testac"}} """, ), MockedResponse( ...
FeishuTests
python
django__django
django/core/validators.py
{ "start": 16551, "end": 19915 }
class ____: """ Validate that the input does not exceed the maximum number of digits expected, otherwise raise ValidationError. """ messages = { "invalid": _("Enter a number."), "max_digits": ngettext_lazy( "Ensure that there are no more than %(max)s digit in total.", ...
DecimalValidator
python
tensorflow__tensorflow
tensorflow/python/training/proximal_adagrad_test.py
{ "start": 1304, "end": 10020 }
class ____(test.TestCase): def doTestProximalAdagradwithoutRegularization(self, use_resource=False): # ProximalAdagradOptimizer is supported only in V1. with ops.Graph().as_default(), self.cached_session(): var0 = variables.Variable([0.0, 0.0]) var1 = variables.Variable([0.0, 0.0]) grads0 =...
ProximalAdagradOptimizerTest
python
miyuchina__mistletoe
test/test_block_token.py
{ "start": 25322, "end": 25637 }
class ____(unittest.TestCase): def test_contains(self): lines = ['# heading\n', '\n', 'paragraph\n', 'with\n', '`code`\n'] token = block_token.Document(lines) self.assertTrue('heading' in token) self.assertTrue('code' in token) self.assertFalse('foo' in token)
TestContains
python
aimacode__aima-python
search.py
{ "start": 48799, "end": 50191 }
class ____: """This class holds a list of words. You can use (word in wordlist) to check if a word is in the list, or wordlist.lookup(prefix) to see if prefix starts any of the words in the list.""" def __init__(self, file, min_len=3): lines = file.read().upper().split() self.words = [w...
Wordlist
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_compute.py
{ "start": 38747, "end": 43399 }
class ____: @mock.patch(COMPUTE_ENGINE_HOOK_PATH) def test_delete_template_should_execute_successfully(self, mock_hook): op = ComputeEngineDeleteInstanceTemplateOperator( resource_id=GCE_RESOURCE_ID, project_id=GCP_PROJECT_ID, task_id=TASK_ID, retry=RETRY,...
TestGceTemplateDelete
python
pytorch__pytorch
torch/profiler/_memory_profiler.py
{ "start": 25057, "end": 40400 }
class ____: def __init__(self, result: _ProfilerResult) -> None: self._op_tree = OpTree(result) self._data_flow_graph = DataFlowGraph(self._op_tree) self._size_map = SizeMap(self._op_tree) self._categories = CategoryDict() self._set_gradients_and_temporaries() self._...
MemoryProfile
python
MorvanZhou__Reinforcement-learning-with-tensorflow
experiments/Robot_arm/DDPG.py
{ "start": 4403, "end": 7453 }
class ____(object): def __init__(self, sess, state_dim, action_dim, learning_rate, gamma, t_replace_iter, a, a_): self.sess = sess self.s_dim = state_dim self.a_dim = action_dim self.lr = learning_rate self.gamma = gamma self.t_replace_iter = t_replace_iter se...
Critic
python
Pylons__pyramid
src/pyramid/response.py
{ "start": 269, "end": 307 }
class ____(_Response): pass
Response
python
huggingface__transformers
src/transformers/models/qwen3_omni_moe/modular_qwen3_omni_moe.py
{ "start": 3750, "end": 5266 }
class ____(Qwen2_5OmniAudioEncoderConfig): def __init__( self, num_mel_bins: Optional[int] = 128, encoder_layers: Optional[int] = 32, encoder_attention_heads: Optional[int] = 20, encoder_ffn_dim: Optional[int] = 5120, d_model: Optional[int] = 1280, dropout: Op...
Qwen3OmniMoeAudioEncoderConfig
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 200, "end": 1606 }
class ____(GeneratedAirbyteSource): @public def __init__( self, name: str, client_id: str, client_secret: str, refresh_token: str, athlete_id: int, start_date: str, auth_type: Optional[str] = None, ): """Airbyte Source for Strava. ...
StravaSource
python
jina-ai__jina
tests/unit/orchestrate/flow/flow-orchestrate/test_flow_routing.py
{ "start": 2512, "end": 4273 }
class ____(Executor): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @requests(on='/index') def index(self, docs: DocumentArray, **kwargs): docs.append(Document(text='added')) return docs @requests(on='/search') def search(self, docs: DocumentArray, ...
DynamicPollingExecutorDefaultNames
python
huggingface__transformers
src/transformers/models/vitmatte/modeling_vitmatte.py
{ "start": 3388, "end": 4605 }
class ____(nn.Module): """ Simple ConvStream containing a series of basic conv3x3 layers to extract detail features. """ def __init__(self, config): super().__init__() # We use a default in-case there isn't a backbone config set. This is for backwards compatibility and # to ena...
VitMatteConvStream
python
ansible__ansible
lib/ansible/modules/apt_repository.py
{ "start": 7573, "end": 15900 }
class ____(object): def __init__(self, module): self.module = module self.files = {} # group sources by file self.files_mapping = {} # internal DS for tracking symlinks # Repositories that we're adding -- used to implement mode param self.new_repos = set() self.defa...
SourcesList
python
spack__spack
lib/spack/spack/vendor/macholib/mach_o.py
{ "start": 25869, "end": 26096 }
class ____(Structure): _fields_ = (("flavor", p_uint32), ("count", p_uint32)) def describe(self): s = {} s["flavor"] = int(self.flavor) s["count"] = int(self.count) return s
thread_command
python
pytorch__pytorch
torch/testing/_internal/autocast_test_lists.py
{ "start": 180, "end": 14863 }
class ____: def _rnn_cell_args(self, n, num_chunks, is_lstm, dev, dtype): input = (torch.randn((n, n), device=dev, dtype=torch.float32),) hx = ((torch.randn((n, n), device=dev, dtype=torch.float32), torch.randn((n, n), device=dev, dtype=torch.float32)) if is_lstm else t...
AutocastTestLists
python
dagster-io__dagster
python_modules/dagster/dagster/_core/storage/dagster_run.py
{ "start": 25926, "end": 26539 }
class ____: run_id: str partition: str status: DagsterRunStatus start_time: Optional[float] end_time: Optional[float] ################################################################################################### # GRAVEYARD # # -|- # | # _-'~~~~~`-_ # .' ...
RunPartitionData
python
django__django
tests/model_forms/models.py
{ "start": 6534, "end": 6655 }
class ____(models.Model): slug = models.SlugField(unique=True) def __str__(self): return self.slug
Product
python
sphinx-doc__sphinx
sphinx/domains/cpp/_ast.py
{ "start": 83312, "end": 86386 }
class ____(ASTBase): def __init__( self, outer: str, leftSpecs: ASTDeclSpecsSimple, rightSpecs: ASTDeclSpecsSimple, trailing: ASTTrailingTypeSpec, ) -> None: # leftSpecs and rightSpecs are used for output # allSpecs are used for id generation self....
ASTDeclSpecs
python
django__django
tests/template_tests/filter_tests/test_make_list.py
{ "start": 167, "end": 1365 }
class ____(SimpleTestCase): """ The make_list filter can destroy existing escaping, so the results are escaped. """ @setup({"make_list01": "{% autoescape off %}{{ a|make_list }}{% endautoescape %}"}) def test_make_list01(self): output = self.engine.render_to_string("make_list01", {"a": ...
MakeListTests
python
qdrant__qdrant-client
qdrant_client/connection.py
{ "start": 4979, "end": 13282 }
class ____( collections.namedtuple("_ClientCallDetails", ("method", "timeout", "metadata", "credentials")), grpc.aio.ClientCallDetails, ): pass def header_adder_interceptor( new_metadata: list[tuple[str, str]], auth_token_provider: Optional[Callable[[], str]] = None, ) -> _GenericClientInterceptor...
_ClientAsyncCallDetails
python
pypa__pip
src/pip/_internal/utils/logging.py
{ "start": 7173, "end": 7377 }
class ____(Filter): def __init__(self, level: int) -> None: self.level = level def filter(self, record: logging.LogRecord) -> bool: return record.levelno < self.level
MaxLevelFilter
python
wandb__wandb
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_c.py
{ "start": 4702, "end": 5542 }
class ____(ctypes.Structure): """ Structure representation of the inotify_event structure (used in buffer size calculations):: struct inotify_event { __s32 wd; /* watch descriptor */ __u32 mask; /* watch mask */ __u32 cookie; /* cookie ...
inotify_event_struct
python
tiangolo__fastapi
tests/test_response_model_default_factory.py
{ "start": 127, "end": 1264 }
class ____(BaseModel): code: int = 200 message: str = Field(default_factory=lambda: "Successful operation.") @app.get( "/response_model_has_default_factory_return_dict", response_model=ResponseModel, ) async def response_model_has_default_factory_return_dict(): return {"code": 200} @app.get( ...
ResponseModel
python
airbytehq__airbyte
airbyte-integrations/connectors/source-zendesk-support/unit_tests/integrations/zs_responses/error_response_builder.py
{ "start": 195, "end": 580 }
class ____: def __init__(self, status_code: int): self._status_code: int = status_code @classmethod def response_with_status(cls, status_code) -> "ErrorResponseBuilder": return cls(status_code) def build(self) -> HttpResponse: return HttpResponse(json.dumps(find_template(str(se...
ErrorResponseBuilder
python
scrapy__scrapy
scrapy/commands/check.py
{ "start": 352, "end": 1163 }
class ____(_TextTestResult): def printSummary(self, start: float, stop: float) -> None: write = self.stream.write writeln = self.stream.writeln run = self.testsRun plural = "s" if run != 1 else "" writeln(self.separator2) writeln(f"Ran {run} contract{plural} in {sto...
TextTestResult
python
run-llama__llama_index
llama-index-core/llama_index/core/download/module.py
{ "start": 684, "end": 9564 }
class ____(str, Enum): LOADER = "loader" TOOL = "tool" LLAMAPACK = "llamapack" DATASETS = "datasets" def get_module_info( local_dir_path: PATH_TYPE, remote_dir_path: PATH_TYPE, module_class: str, refresh_cache: bool = False, library_path: str = "library.json", disable_library_c...
MODULE_TYPE
python
openai__openai-python
src/openai/lib/streaming/chat/_events.py
{ "start": 1935, "end": 2120 }
class ____(BaseModel): type: Literal["logprobs.refusal.delta"] refusal: List[ChatCompletionTokenLogprob] snapshot: List[ChatCompletionTokenLogprob]
LogprobsRefusalDeltaEvent
python
ansible__ansible
lib/ansible/modules/hostname.py
{ "start": 6964, "end": 8463 }
class ____(BaseStrategy): """ This is a Redhat Hostname strategy class - it edits the /etc/sysconfig/network file. """ NETWORK_FILE = '/etc/sysconfig/network' def get_permanent_hostname(self): try: for line in get_file_lines(self.NETWORK_FILE): line = to_nati...
RedHatStrategy
python
viewflow__viewflow
viewflow/urls/model.py
{ "start": 6644, "end": 7074 }
class ____( ListBulkActionsMixin, CreateViewMixin, UpdateViewMixin, AppMenuMixin, BaseModelViewset, ): """List/Create/Update/Delete for a model.""" def get_object_url(self, request, obj): if self.has_change_permission(request.user, obj): return self.reverse("change", arg...
ModelViewset
python
prakhar1989__Algorithms
tests/modular_exponentiation_test.py
{ "start": 137, "end": 661 }
class ____(unittest.TestCase): def test_modular_exponentiation(self): self.assertEqual(me.modular_exponentiation(2, 10, 100), 24) self.assertEqual(me.modular_exponentiation(2, 200, 10), 6) self.assertEqual(me.modular_exponentiation(5, 20, 1), 0) #self.assertEqual(me.modular_exponentiation(8, 1, ...
TestLCS
python
gevent__gevent
src/greentest/3.10/test_socket.py
{ "start": 222846, "end": 225247 }
class ____(unittest.TestCase): @unittest.skipUnless(hasattr(socket, "SOCK_CLOEXEC"), "SOCK_CLOEXEC not defined") @support.requires_linux_version(2, 6, 28) def test_SOCK_CLOEXEC(self): with socket.socket(socket.AF_INET, socket.SOCK_STREAM | socket.S...
InheritanceTest
python
Pylons__pyramid
tests/test_integration.py
{ "start": 2098, "end": 6699 }
class ____(IntegrationBase): def test_basic(self): res = self.testapp.get('/minimal.txt', status=200) _assertBody(res.body, os.path.join(here, 'fixtures/minimal.txt')) def test_hidden(self): res = self.testapp.get('/static/.hiddenfile', status=200) _assertBody( res.b...
StaticAppBase
python
ray-project__ray
doc/source/train/doc_code/checkpoints.py
{ "start": 10286, "end": 16967 }
class ____(TrainerCallback): def __init__(self): super().__init__() self.metrics = {} def on_log(self, args, state, control, model=None, logs=None, **kwargs): """Log is called on evaluation step and logging step.""" self.metrics.update(logs) def on_save(self, args, state, c...
MyTrainReportCallback
python
celery__celery
celery/backends/database/models.py
{ "start": 1611, "end": 2432 }
class ____(Task): """For the extend result.""" __tablename__ = 'celery_taskmeta' __table_args__ = {'sqlite_autoincrement': True, 'extend_existing': True} name = sa.Column(sa.String(155), nullable=True) args = sa.Column(sa.LargeBinary, nullable=True) kwargs = sa.Column(sa.LargeBinary, nullable=...
TaskExtended
python
joke2k__faker
faker/providers/phone_number/hr_HR/__init__.py
{ "start": 49, "end": 803 }
class ____(PhoneNumberProvider): formats = ( "01 #### ###", "020 ### ###", "021 ### ###", "022 ### ###", "023 ### ###", "031 ### ###", "032 ### ###", "033 ### ###", "034 ### ###", "035 ### ###", "040 ### ###", "042 ### #...
Provider
python
sympy__sympy
sympy/polys/compatibility.py
{ "start": 12557, "end": 71705 }
class ____(Generic[Er]): gens: tuple[PolyElement[Er], ...] symbols: tuple[Expr, ...] ngens: int domain: Domain[Er] order: MonomialOrder @abstractmethod def drop(self, *gens: PolyElement[Er] | int | str) -> PolyRing[Er] | Domain[Er]: ... @overload def clone( self, sy...
IPolys
python
getsentry__sentry
src/sentry/testutils/factories.py
{ "start": 14689, "end": 91378 }
class ____: @staticmethod @assume_test_silo_mode(SiloMode.REGION) def create_organization(name=None, owner=None, region: Region | str | None = None, **kwargs): if not name: name = petname.generate(2, " ", letters=10).title() with contextlib.ExitStack() as ctx: if reg...
Factories
python
facelessuser__pymdown-extensions
pymdownx/caret.py
{ "start": 5746, "end": 7425 }
class ____(Extension): """Add insert and/or superscript extension to Markdown class.""" def __init__(self, *args, **kwargs): """Initialize.""" self.config = { 'smart_insert': [True, "Treat ^^connected^^words^^ intelligently - Default: True"], 'insert': [True, "Enable in...
InsertSupExtension
python
dagster-io__dagster
examples/docs_projects/project_ml/src/project_ml/defs/assets/model_assets.py
{ "start": 2198, "end": 13810 }
class ____(nn.Module): """Improved CNN for MNIST digit classification based on research.""" def __init__(self, config: ModelConfig = None): super().__init__() if config is None: config = ModelConfig() self.config = config # First convolutional block self.co...
DigitCNN
python
huggingface__transformers
src/transformers/models/siglip2/modular_siglip2.py
{ "start": 12697, "end": 14554 }
class ____(SiglipVisionModel): # Update: add `spatial_shapes` and `pixel_attention_mask` @check_model_inputs(tie_last_hidden_states=False) @auto_docstring def forward( self, pixel_values: torch.FloatTensor, pixel_attention_mask: torch.Tensor, spatial_shapes: torch.LongTen...
Siglip2VisionModel
python
pypa__warehouse
warehouse/subscriptions/models.py
{ "start": 601, "end": 1114 }
class ____(StrLabelEnum): # Name = "value", _("Label") Active = "active", _("Active") PastDue = "past_due", _("Past Due") Unpaid = "unpaid", _("Unpaid") Canceled = "canceled", _("Canceled") Incomplete = "incomplete", _("Incomplete") IncompleteExpired = "incomplete_expired", _("Incomplete Exp...
StripeSubscriptionStatus
python
mitmproxy__pdoc
pdoc/web.py
{ "start": 3765, "end": 4791 }
class ____(http.server.HTTPServer): """pdoc's live-reloading web server""" all_modules: AllModules def __init__(self, addr: tuple[str, int], specs: list[str], **kwargs): super().__init__(addr, DocHandler, **kwargs) # type: ignore module_names = extract.walk_specs(specs) self.all_m...
DocServer
python
sqlalchemy__sqlalchemy
test/ext/test_mutable.py
{ "start": 32556, "end": 33164 }
class ____(_MutableSetTestBase, fixtures.MappedTest): @classmethod def define_tables(cls, metadata): MutableSet = cls._type_fixture() mutable_pickle = MutableSet.as_mutable(PickleType) Table( "foo", metadata, Column( "id", Integer, pri...
MutableSetWithScalarPickleTest
python
huggingface__transformers
src/transformers/models/dinov3_convnext/configuration_dinov3_convnext.py
{ "start": 939, "end": 5695 }
class ____(BackboneConfigMixin, PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`DINOv3ConvNextModel`]. It is used to instantiate an DINOv3ConvNext model according to the specified arguments, defining the model architecture. Instantiating a configuration with the...
DINOv3ConvNextConfig
python
PyCQA__pylint
tests/functional/i/inconsistent/inconsistent_mro.py
{ "start": 121, "end": 181 }
class ____(str, Str): # [inconsistent-mro] pass
Inconsistent
python
huggingface__transformers
src/transformers/processing_utils.py
{ "start": 24790, "end": 25711 }
class ____: """ Dataclass that holds extra useful data for processing multimodal data. Processors currently cannot return keys, unless it is used in model's forward. Thus we have helper methods that calculate and return useful data from processing input multimodals (images/videos). Note that...
MultiModalData
python
pytorch__pytorch
torch/ao/pruning/_experimental/activation_sparsifier/activation_sparsifier.py
{ "start": 263, "end": 19309 }
class ____: r""" The Activation sparsifier class aims to sparsify/prune activations in a neural network. The idea is to attach the sparsifier to a layer (or layers) and it zeroes out the activations based on the mask_fn (or sparsification function) input by the user. The mask_fn is applied once ...
ActivationSparsifier