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
gevent__gevent
src/greentest/3.14/test_threading_local.py
{ "start": 334, "end": 474 }
class ____(object): pass def target(local, weaklist): weak = Weak() local.weak = weak weaklist.append(weakref.ref(weak))
Weak
python
getsentry__sentry
src/sentry/preprod/utils.py
{ "start": 78, "end": 1018 }
class ____(NamedTuple): """Parsed components of a release version string.""" app_id: str build_version: str def parse_release_version(release_version: str) -> ParsedReleaseVersion | None: """ Parse release version string into app_id and build_version components. Expected formats: 1. "app...
ParsedReleaseVersion
python
ansible__ansible
test/lib/ansible_test/_internal/completion.py
{ "start": 730, "end": 978 }
class ____(enum.Enum): """The audit requirements of a container.""" NONE = 'none' REQUIRED = 'required' def __repr__(self) -> str: return f'{self.__class__.__name__}.{self.name}' @dataclasses.dataclass(frozen=True)
AuditMode
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/constructor14.py
{ "start": 442, "end": 537 }
class ____(Protocol[T_contra]): def __call__(self, message: T_contra, /) -> Any: ...
Callback
python
wandb__wandb
wandb/vendor/pygments/filters/__init__.py
{ "start": 1827, "end": 2893 }
class ____(Filter): """Highlight special code tags in comments and docstrings. Options accepted: `codetags` : list of strings A list of strings that are flagged as code tags. The default is to highlight ``XXX``, ``TODO``, ``BUG`` and ``NOTE``. """ def __init__(self, **options): ...
CodeTagFilter
python
django__django
django/db/models/lookups.py
{ "start": 26654, "end": 26767 }
class ____(YearLookup, GreaterThan): def get_bound_params(self, start, finish): return (finish,)
YearGt
python
google__pytype
pytype/rewrite/abstract/base_test.py
{ "start": 369, "end": 527 }
class ____(test_utils.ContextfulTestBase): def _const(self, const): return base.PythonConstant(self.ctx, const, allow_direct_instantiation=True)
TestBase
python
walkccc__LeetCode
solutions/75. Sort Colors/75-2.py
{ "start": 0, "end": 556 }
class ____: def sortColors(self, nums: list[int]) -> None: l = 0 # The next 0 should be placed in l. r = len(nums) - 1 # THe next 2 should be placed in r. i = 0 while i <= r: if nums[i] == 0: nums[i], nums[l] = nums[l], nums[i] i += 1 l += 1 elif nums[i] == 1: ...
Solution
python
tensorflow__tensorflow
tensorflow/python/autograph/core/converter.py
{ "start": 8192, "end": 8517 }
class ____(object): """ProgramContext keeps track of converting function hierarchies. Attributes: options: ConversionOptions autograph_module: Deprecated. Do not use. """ def __init__(self, options, autograph_module=None): self.options = options self.autograph_module = autograph_module
ProgramContext
python
pandas-dev__pandas
pandas/core/col.py
{ "start": 6101, "end": 9072 }
class ____: def __init__(self, func: Expression, namespace: str) -> None: self._func = func self._namespace = namespace def __call__(self, df: DataFrame) -> Any: return self._func(df) def __getattr__(self, attr: str) -> Any: if isinstance(getattr(getattr(Series, self._names...
NamespaceExpression
python
allegroai__clearml
clearml/backend_api/services/v2_20/tasks.py
{ "start": 243377, "end": 246027 }
class ____(Response): """ Response of tasks.enqueue endpoint. :param updated: Number of tasks updated (0 or 1) :type updated: int :param fields: Updated fields names and values :type fields: dict :param queued: Number of tasks queued (0 or 1) :type queued: int """ _service = "t...
EnqueueResponse
python
readthedocs__readthedocs.org
readthedocs/api/v3/renderers.py
{ "start": 295, "end": 1951 }
class ____(JSONRenderer): """ Renderer that sort they keys from the JSON alphabetically. See https://github.com/encode/django-rest-framework/pull/4202 """ def render(self, data, accepted_media_type=None, renderer_context=None): """ Copied from ``rest_framework.renders.JSONRenderer`...
AlphabeticalSortedJSONRenderer
python
kamyu104__LeetCode-Solutions
Python/single-element-in-a-sorted-array.py
{ "start": 32, "end": 557 }
class ____(object): def singleNonDuplicate(self, nums): """ :type nums: List[int] :rtype: int """ left, right = 0, len(nums)-1 while left <= right: mid = left + (right - left) / 2 if not (mid%2 == 0 and mid+1 < len(nums) and \ ...
Solution
python
getsentry__sentry
src/sentry/shared_integrations/exceptions/__init__.py
{ "start": 5057, "end": 5187 }
class ____(IntegrationError): """ Error when an external API resource is not found. """
IntegrationResourceNotFoundError
python
falconry__falcon
tests/test_httpstatus.py
{ "start": 3717, "end": 6397 }
class ____: def test_raise_status_in_process_request(self, hook_test_client): """Make sure we can raise status from middleware process request""" client = hook_test_client class TestMiddleware: def process_request(self, req, resp): raise HTTPStatus( ...
TestHTTPStatusWithMiddleware
python
ray-project__ray
release/llm_tests/benchmark/load_test.py
{ "start": 4635, "end": 7000 }
class ____: lock = threading.Lock() users = None first_request_done = 0 logging_params = None environment = None tokenizer = None @classmethod def notify_init(cls, environment, logging_params): with cls.lock: if cls.environment is None: cls.environmen...
InitTracker
python
run-llama__llama_index
llama-index-integrations/memory/llama-index-memory-bedrock-agentcore/llama_index/memory/bedrock_agentcore/base.py
{ "start": 4578, "end": 4893 }
class ____(BaseModel): actor_id: str memory_id: str session_id: str namespace: str = "/" memory_strategy_id: Optional[str] = None def get_context(self) -> Dict[str, Optional[str]]: return {key: value for key, value in self.__dict__.items() if value is not None}
AgentCoreMemoryContext
python
fastai__fastai
fastai/vision/augment.py
{ "start": 46805, "end": 47868 }
class ____(): def __init__(self, max_lighting=0.2, p=0.75, draw=None, batch=False): store_attr() def _def_draw(self, x): if not self.batch: res = x.new_empty(x.size(0)).uniform_(math.log(1-self.max_lighting), -math.log(1-self.max_lighting)) else: res = x.new_zeros(x.size(0)) + random.uniform(ma...
_SaturationLogit
python
apache__airflow
providers/openlineage/src/airflow/providers/openlineage/plugins/facets.py
{ "start": 3601, "end": 3722 }
class ____(RunFacet): """Composite Airflow DAG run facet.""" dag: dict dagRun: dict @define
AirflowDagRunFacet
python
apache__airflow
providers/exasol/src/airflow/providers/exasol/operators/exasol.py
{ "start": 1045, "end": 2500 }
class ____(SQLExecuteQueryOperator): """ Executes sql code in a specific Exasol database. :param sql: the SQL code to be executed as a single string, or a list of str (sql statements), or a reference to a template file. template references are recognized by str ending in '.sql' :param e...
ExasolOperator
python
pypa__hatch
tests/backend/builders/test_config.py
{ "start": 6211, "end": 8493 }
class ____: def test_default(self, isolation): builder = MockBuilder(str(isolation)) assert builder.config.require_runtime_dependencies is builder.config.require_runtime_dependencies is False def test_target(self, isolation): config = {"tool": {"hatch": {"build": {"targets": {"foo": {"...
TestRequireRuntimeDependencies
python
numpy__numpy
numpy/_core/tests/test_unicode.py
{ "start": 12521, "end": 12671 }
class ____(ByteorderValues): """Check the byteorder in unicode (size 2, UCS4 values)""" ulen = 2 ucs_value = ucs4_value
TestByteorder_2_UCS4
python
ansible__ansible
lib/ansible/module_utils/facts/system/date_time.py
{ "start": 862, "end": 3086 }
class ____(BaseFactCollector): name = 'date_time' _fact_ids = set() # type: t.Set[str] def collect(self, module=None, collected_facts=None): facts_dict = {} date_time_facts = {} # Store the timestamp once, then get local and UTC versions from that epoch_ts = time.time() ...
DateTimeFactCollector
python
huggingface__transformers
src/transformers/models/instructblipvideo/modular_instructblipvideo.py
{ "start": 6655, "end": 6749 }
class ____(InstructBlipVisionModel): input_modalities = "video"
InstructBlipVideoVisionModel
python
astropy__astropy
astropy/cosmology/_src/tests/io/test_latex.py
{ "start": 321, "end": 2788 }
class ____(ReadWriteTestMixinBase): """ Tests for a Cosmology[Write] with ``format="latex"``. This class will not be directly called by :mod:`pytest` since its name does not begin with ``Test``. To activate the contained tests this class must be inherited in a subclass. Subclasses must define a :fun...
WriteLATEXTestMixin
python
django__django
tests/gis_tests/test_geoforms.py
{ "start": 16720, "end": 18299 }
class ____(SimpleTestCase): def setUp(self): self.geometries = { "point": GEOSGeometry("SRID=4326;POINT(9.052734375 42.451171875)"), } def test_osm_widget(self): class PointForm(forms.Form): p = forms.PointField(widget=forms.OSMWidget) geom = self.geomet...
OSMWidgetTest
python
apache__airflow
airflow-core/src/airflow/api_fastapi/auth/managers/models/resource_details.py
{ "start": 929, "end": 1055 }
class ____: """Represents the details of a configuration.""" section: str | None = None @dataclass
ConfigurationDetails
python
redis__redis-py
redis/asyncio/client.py
{ "start": 50002, "end": 50330 }
class ____(Protocol): async def __call__(self, e: BaseException, pubsub: PubSub): ... PSWorkerThreadExcHandlerT = Union[ PubsubWorkerExceptionHandler, AsyncPubsubWorkerExceptionHandler ] CommandT = Tuple[Tuple[Union[str, bytes], ...], Mapping[str, Any]] CommandStackT = List[CommandT]
AsyncPubsubWorkerExceptionHandler
python
numba__numba
numba/core/cgutils.py
{ "start": 2210, "end": 7039 }
class ____(object): """ Creates a `Structure` like interface that is constructed with information from DataModel instance. FE type must have a data model that is a subclass of StructModel. """ # The following class members must be overridden by subclass _fe_type = None def __init__(sel...
_StructProxy
python
ray-project__ray
doc/source/serve/doc_code/monitoring/logging_config.py
{ "start": 805, "end": 1171 }
class ____: def __call__(self) -> int: logger = logging.getLogger("ray.serve") logger.debug("This debug message is from the router.") return "hello world" # __level_end__ serve.run(Model.bind()) resp = requests.get("http://localhost:8000/") # __logs_dir_start__ @serve.deployment(loggin...
Model
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-dashscope/llama_index/embeddings/dashscope/base.py
{ "start": 1078, "end": 4843 }
class ____(str, Enum): """DashScope MultiModalEmbedding models.""" MULTIMODAL_EMBEDDING_ONE_PEACE_V1 = "multimodal-embedding-one-peace-v1" def get_text_embedding( model: str, text: Union[str, List[str]], api_key: Optional[str] = None, **kwargs: Any, ) -> List[List[float]]: """ Call Da...
DashScopeMultiModalEmbeddingModels
python
networkx__networkx
networkx/algorithms/tests/test_link_prediction.py
{ "start": 1883, "end": 3219 }
class ____: @classmethod def setup_class(cls): cls.func = staticmethod(nx.jaccard_coefficient) cls.test = staticmethod(partial(_test_func, predict_func=cls.func)) def test_K5(self): G = nx.complete_graph(5) self.test(G, [(0, 1)], [(0, 1, 0.6)]) def test_P4(self): ...
TestJaccardCoefficient
python
getsentry__sentry
src/sentry/lang/native/symbolicator.py
{ "start": 1586, "end": 1966 }
class ____: """Bundles information about a symbolication task: the platform and whether it's an existing event being reprocessed. """ platform: SymbolicatorPlatform is_reprocessing: bool = False def with_platform(self, platform: SymbolicatorPlatform) -> SymbolicatorTaskKind: return dat...
SymbolicatorTaskKind
python
celery__celery
t/unit/security/test_certificate.py
{ "start": 2267, "end": 3377 }
class ____(SecurityCase): @patch('os.path.isdir') @patch('glob.glob') @patch('celery.security.certificate.Certificate') def test_init(self, Certificate, glob, isdir): cert = Certificate.return_value = Mock() cert.has_expired.return_value = False isdir.return_value = True ...
test_FSCertStore
python
mlflow__mlflow
mlflow/server/graphql/autogenerated_graphql_schema.py
{ "start": 1101, "end": 1429 }
class ____(graphene.ObjectType): job_id = graphene.String() run_id = graphene.String() job_state = graphene.Field(MlflowDeploymentJobConnectionState) run_state = graphene.Field(MlflowModelVersionDeploymentJobStateDeploymentJobRunState) current_task_name = graphene.String()
MlflowModelVersionDeploymentJobState
python
scipy__scipy
scipy/stats/_sampling.py
{ "start": 12267, "end": 38729 }
class ____: """ Fast sampling by numerical inversion of the CDF for a large class of continuous distributions in `scipy.stats`. Parameters ---------- dist : rv_frozen object Frozen distribution object from `scipy.stats`. The list of supported distributions can be found in the No...
FastGeneratorInversion
python
sqlalchemy__sqlalchemy
test/sql/test_utils.py
{ "start": 890, "end": 5724 }
class ____(fixtures.TestBase): def test_column_element_no_visit(self): class MyElement(ColumnElement): _traverse_internals = [] eq_(sql_util.find_tables(MyElement(), check_columns=True), []) def test_find_tables_selectable(self): metadata = MetaData() common = Table...
MiscTest
python
getsentry__sentry
tests/snuba/api/endpoints/test_organization_trace_item_stats.py
{ "start": 179, "end": 2744 }
class ____( APITransactionTestCase, SnubaTestCase, SpanTestCase, ): view = "sentry-api-0-organization-trace-item-stats" def setUp(self) -> None: super().setUp() self.login_as(user=self.user) self.ten_mins_ago = before_now(minutes=10) self.ten_mins_ago_iso = self.ten_...
OrganizationTraceItemsStatsEndpointTest
python
sphinx-doc__sphinx
sphinx/domains/cpp/_ast.py
{ "start": 122968, "end": 124330 }
class ____(ASTBase): def __init__(self, nestedName: ASTNestedName, initializer: ASTInitializer) -> None: self.nestedName = nestedName self.initializer = initializer def __eq__(self, other: object) -> bool: if not isinstance(other, ASTConcept): return NotImplemented r...
ASTConcept
python
huggingface__transformers
src/transformers/models/qwen3/modeling_qwen3.py
{ "start": 2297, "end": 3067 }
class ____(nn.Module): def __init__(self, hidden_size, eps: float = 1e-6) -> None: """ Qwen3RMSNorm is equivalent to T5LayerNorm """ super().__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.variance_epsilon = eps def forward(self, hidden_states...
Qwen3RMSNorm
python
openai__openai-python
src/openai/resources/fine_tuning/fine_tuning.py
{ "start": 3640, "end": 4216 }
class ____: def __init__(self, fine_tuning: AsyncFineTuning) -> None: self._fine_tuning = fine_tuning @cached_property def jobs(self) -> AsyncJobsWithRawResponse: return AsyncJobsWithRawResponse(self._fine_tuning.jobs) @cached_property def checkpoints(self) -> AsyncCheckpointsWithR...
AsyncFineTuningWithRawResponse
python
huggingface__transformers
src/transformers/utils/quantization_config.py
{ "start": 93552, "end": 94871 }
class ____(QuantizationConfigMixin): """ This is a wrapper class about all possible attributes and features that you can play with a model that has been loaded using mxfp4 quantization. Args: modules_to_not_convert (`list`, *optional*, default to `None`): The list of modules to not ...
Mxfp4Config
python
django__django
django/db/models/fields/tuple_lookups.py
{ "start": 491, "end": 1193 }
class ____(Func): allows_composite_expressions = True function = "" output_field = models.Field() def __len__(self): return len(self.source_expressions) def __iter__(self): return iter(self.source_expressions) def as_sqlite(self, compiler, connection): if connection.ge...
Tuple
python
numpy__numpy
numpy/polynomial/tests/test_laguerre.py
{ "start": 9699, "end": 11012 }
class ____: def test_lagder(self): # check exceptions assert_raises(TypeError, lag.lagder, [0], .5) assert_raises(ValueError, lag.lagder, [0], -1) # check that zeroth derivative does nothing for i in range(5): tgt = [0] * i + [1] res = lag.lagder(tgt...
TestDerivative
python
bokeh__bokeh
src/bokeh/models/widgets/tables.py
{ "start": 16118, "end": 17556 }
class ____(CellFormatter): ''' HTML formatter using a template. This uses Underscore's `template` method and syntax. http://underscorejs.org/#template The formatter has access other items in the row via the `dataContext` object passed to the formatter. So, for example, if another column in the datasourc...
HTMLTemplateFormatter
python
getsentry__sentry
src/sentry/tsdb/redissnuba.py
{ "start": 3263, "end": 3483 }
class ____(type): def __new__(cls, name, bases, attrs): for key in method_specifications.keys(): attrs[key] = make_method(key) return type.__new__(cls, name, bases, attrs)
RedisSnubaTSDBMeta
python
PyCQA__pylint
pylint/config/argument.py
{ "start": 6990, "end": 8307 }
class ____(_BaseStoreArgument): """Class representing a store argument to be parsed by an argparse.ArgumentsParser. This is based on the parameters passed to argparse.ArgumentsParser.add_message. See: https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.add_argument """ # py...
_StoreArgument
python
scipy__scipy
scipy/ndimage/tests/test_interpolation.py
{ "start": 3737, "end": 5330 }
class ____: def test_spline01(self, dtype, order, xp): dtype = getattr(xp, dtype) data = xp.ones([], dtype=dtype) out = ndimage.spline_filter(data, order=order) assert out == xp.asarray(1, dtype=out.dtype) def test_spline02(self, dtype, order, xp): dtype = getattr(xp, d...
TestSpline
python
realpython__materials
python-double-underscore/shapes.py
{ "start": 13, "end": 178 }
class ____: def __init__(self, radius): self.radius = _validate(radius) def calculate_area(self): return round(_PI * self.radius**2, 2)
Circle
python
cython__cython
Cython/Compiler/ExprNodes.py
{ "start": 513879, "end": 515101 }
class ____(IntBinopNode): # '|' operator. def analyse_pytyping_modifiers(self, env): if self.operand1.is_none or self.operand2.is_none: return ['typing.Optional'] def _analyse_bitwise_or_none(self, env, operand_node): """Analyse annotations in form `[...] | None` and `None | [...
BitwiseOrNode
python
Delgan__loguru
loguru/_recattrs.py
{ "start": 2481, "end": 3542 }
class ____: """A class representing a thread record with ID and name. Attributes ---------- id : int The thread ID name : str The thread name """ __slots__ = ("id", "name") def __init__(self, id_, name): """Initialize a RecordThread instance. Parameter...
RecordThread
python
xlwings__xlwings
xlwings/constants.py
{ "start": 79075, "end": 79452 }
class ____: xlBlanks = 4 # from enum XlPTSelectionMode xlButton = 15 # from enum XlPTSelectionMode xlDataAndLabel = 0 # from enum XlPTSelectionMode xlDataOnly = 2 # from enum XlPTSelectionMode xlFirstRow = 256 # from enum XlPTSelectionMode xlLabelOnly = 1 # from enum XlPTSelectionMode ...
PTSelectionMode
python
scikit-learn__scikit-learn
sklearn/calibration.py
{ "start": 39182, "end": 48230 }
class ____(RegressorMixin, BaseEstimator): """Temperature scaling model. Attributes ---------- beta_ : float The optimized inverse temperature. """ def fit(self, X, y, sample_weight=None): """Fit the model using X, y as training data. Parameters ---------- ...
_TemperatureScaling
python
apache__airflow
dev/breeze/src/airflow_breeze/utils/packages.py
{ "start": 2154, "end": 2304 }
class ____(Enum): Operators = "Operators" Transfers = "Transfers" Sensors = "Sensors" Hooks = "Hooks" Secrets = "Secrets"
EntityType
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0119_alter_addonsconfig_flyout_sorting_custom_pattern_and_more.py
{ "start": 150, "end": 1229 }
class ____(migrations.Migration): safe = Safe.before_deploy() dependencies = [ ("projects", "0118_addons_flyout_sorting"), ] operations = [ migrations.AlterField( model_name="addonsconfig", name="flyout_sorting_custom_pattern", field=models.CharField...
Migration
python
PrefectHQ__prefect
src/integrations/prefect-sqlalchemy/tests/test_database.py
{ "start": 1360, "end": 1569 }
class ____: def dispose(self): return True @contextmanager def connect(self): try: yield SQLAlchemyConnectionMock() finally: pass
SQLAlchemyEngineMock
python
numba__numba
numba/core/types/functions.py
{ "start": 26002, "end": 27068 }
class ____(Opaque): """ Recursive call to a Dispatcher. """ _overloads = None def __init__(self, dispatcher_type): assert isinstance(dispatcher_type, Dispatcher) self.dispatcher_type = dispatcher_type name = "recursive(%s)" % (dispatcher_type,) super(RecursiveCall, s...
RecursiveCall
python
cookiecutter__cookiecutter
cookiecutter/environment.py
{ "start": 2003, "end": 2474 }
class ____(ExtensionLoaderMixin, Environment): """Create strict Jinja2 environment. Jinja2 environment will raise error on undefined variable in template- rendering context. """ def __init__(self, **kwargs: Any) -> None: """Set the standard Cookiecutter StrictEnvironment. Also loa...
StrictEnvironment
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 471963, "end": 472478 }
class ____(sgqlc.types.Type): """Autogenerated return type of ApproveDeployments""" __schema__ = github_schema __field_names__ = ("client_mutation_id", "deployments") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the client performing the...
ApproveDeploymentsPayload
python
fabric__fabric
fabric/tasks.py
{ "start": 52, "end": 2876 }
class ____(invoke.Task): """ Extends `invoke.tasks.Task` with knowledge of target hosts and similar. As `invoke.tasks.Task` relegates documentation responsibility to its `@task <invoke.tasks.task>` expression, so we relegate most details to our version of `@task <fabric.tasks.task>` - please see it...
Task
python
ray-project__ray
python/ray/data/tests/test_map.py
{ "start": 33840, "end": 44535 }
class ____: @pytest.fixture def mock_actor_async_ctx(self): _map_actor_ctx = _MapActorContext(Mock(), Mock(), is_async=True) loop: AbstractEventLoop = _map_actor_ctx.udf_map_asyncio_loop assert loop is not None with patch("ray.data._map_actor_context", _map_actor_ctx): ...
TestGenerateTransformFnForAsyncMap
python
allegroai__clearml
clearml/backend_api/services/v2_20/workers.py
{ "start": 75896, "end": 76135 }
class ____(Response): """ Response of workers.register endpoint. """ _service = "workers" _action = "register" _version = "2.20" _schema = {"definitions": {}, "properties": {}, "type": "object"}
RegisterResponse
python
Textualize__textual
src/textual/color.py
{ "start": 20771, "end": 27370 }
class ____: """Defines a color gradient.""" def __init__(self, *stops: tuple[float, Color | str], quality: int = 50) -> None: """Create a color gradient that blends colors to form a spectrum. A gradient is defined by a sequence of "stops" consisting of a tuple containing a float and a color. ...
Gradient
python
getsentry__sentry
src/sentry/integrations/aws_lambda/integration.py
{ "start": 10748, "end": 13483 }
class ____: def dispatch(self, request: HttpRequest, pipeline: IntegrationPipeline) -> HttpResponseBase: curr_step = 0 if pipeline.fetch_state("skipped_project_select") else 1 def render_response(error=None): assert pipeline.organization is not None serialized_organization =...
AwsLambdaCloudFormationPipelineView
python
encode__django-rest-framework
tests/test_validators.py
{ "start": 32232, "end": 32372 }
class ____(serializers.ModelSerializer): class Meta: model = UniqueForDateModel fields = '__all__'
UniqueForDateSerializer
python
scrapy__scrapy
tests/test_dupefilters.py
{ "start": 954, "end": 999 }
class ____: method = "n/a"
DirectDupeFilter
python
django__django
tests/fixtures_regress/models.py
{ "start": 75, "end": 402 }
class ____(models.Model): name = models.CharField(max_length=150) latin_name = models.CharField(max_length=150) count = models.IntegerField() weight = models.FloatField() # use a non-default name for the default manager specimens = models.Manager() def __str__(self): return self.na...
Animal
python
pypa__pipenv
pipenv/patched/pip/_internal/exceptions.py
{ "start": 16146, "end": 17774 }
class ____(HashError): """A hash was needed for a requirement but is absent.""" order = 2 head = ( "Hashes are required in --require-hashes mode, but they are " "missing from some requirements. Here is a list of those " "requirements along with the hashes their downloaded archives "...
HashMissing
python
apache__airflow
airflow-core/src/airflow/utils/file.py
{ "start": 1771, "end": 2843 }
class ____(NamedTuple): """Typed namedtuple with utility functions for regexp ignore rules.""" pattern: Pattern base_dir: Path @staticmethod def compile(pattern: str, base_dir: Path, definition_file: Path) -> _IgnoreRule | None: """Build an ignore rule from the supplied regexp pattern and ...
_RegexpIgnoreRule
python
pytorch__pytorch
test/test_spectral_ops.py
{ "start": 66459, "end": 67144 }
class ____(TestCase): pass def generate_doc_test(doc_test): def test(self, device): self.assertEqual(device, 'cpu') runner = doctest.DocTestRunner() runner.run(doc_test) if runner.failures != 0: runner.summarize() self.fail('Doctest failed') setattr...
TestFFTDocExamples
python
tensorflow__tensorflow
tensorflow/python/distribute/combinations.py
{ "start": 10884, "end": 16212 }
class ____(object): """Wraps a `tf.distribute.Strategy` and adds a name for test titles.""" def __init__(self, name, distribution_fn, required_gpus=None, required_physical_gpus=0, required_tpu=False, use_cloud_tpu=False, ...
NamedDistribution
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/generic1.py
{ "start": 327, "end": 399 }
class ____(Generic[int]): ... # This should generate two errors.
Class3
python
getsentry__sentry
src/sentry/replays/usecases/query/conditions/aggregate.py
{ "start": 2487, "end": 3807 }
class ____(GenericBase): @staticmethod def visit_eq(expression: Expression, value: str | None) -> Condition: if value is None: return does_not_contain(_nonnull_ipv4(expression)) return contains(IPv4Scalar.visit_eq(expression, value)) @staticmethod def visit_neq(expression: E...
SumOfIPv4Scalar
python
huggingface__transformers
src/transformers/models/seamless_m4t/feature_extraction_seamless_m4t.py
{ "start": 1095, "end": 13561 }
class ____(SequenceFeatureExtractor): r""" Constructs a SeamlessM4T feature extractor. This feature extractor inherits from [`SequenceFeatureExtractor`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. This class extracts ...
SeamlessM4TFeatureExtractor
python
google__flatbuffers
tests/monster_test_generated.py
{ "start": 3170, "end": 4116 }
class ____(object): # InParentNamespaceT def __init__( self, ): pass @classmethod def InitFromBuf(cls, buf, pos): inParentNamespace = InParentNamespace() inParentNamespace.Init(buf, pos) return cls.InitFromObj(inParentNamespace) @classmethod def Ini...
InParentNamespaceT
python
scikit-learn__scikit-learn
sklearn/neural_network/_multilayer_perceptron.py
{ "start": 31498, "end": 50619 }
class ____(ClassifierMixin, BaseMultilayerPerceptron): """Multi-layer Perceptron classifier. This model optimizes the log-loss function using LBFGS or stochastic gradient descent. .. versionadded:: 0.18 Parameters ---------- hidden_layer_sizes : array-like of shape(n_layers - 2,), default...
MLPClassifier
python
Textualize__textual
docs/examples/guide/widgets/fizzbuzz01.py
{ "start": 479, "end": 669 }
class ____(App): CSS_PATH = "fizzbuzz01.tcss" def compose(self) -> ComposeResult: yield FizzBuzz() if __name__ == "__main__": app = FizzBuzzApp() app.run()
FizzBuzzApp
python
scipy__scipy
scipy/fft/tests/test_helper.py
{ "start": 18682, "end": 19522 }
class ____: def test_definition(self, xp): x = xp.asarray([0, 1, 2, 3, 4], dtype=xp.float64) x2 = xp.asarray([0, 1, 2, 3, 4, 5], dtype=xp.float64) # default dtype varies across backends y = 9 * fft.rfftfreq(9, xp=xp) xp_assert_close(y, x, check_dtype=False, check_namespace...
TestRFFTFreq
python
Lightning-AI__lightning
src/lightning/pytorch/demos/transformer.py
{ "start": 4175, "end": 5517 }
class ____(Dataset): """Mini version of WikiText2.""" def __init__(self, data_dir: Path = Path("./data"), block_size: int = 35, download: bool = True) -> None: super().__init__() self.path = data_dir / "wikitext-2.txt" if download: self.download(self.path) self.data,...
WikiText2
python
FactoryBoy__factory_boy
tests/djapp/models.py
{ "start": 2083, "end": 2417 }
class ____(models.Model): foo = models.CharField(max_length=20) def __init__(self, post_save_signal_receiver=None): super().__init__() if post_save_signal_receiver: signals.post_save.connect( post_save_signal_receiver, sender=self.__class__, ...
WithSignals
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI020.py
{ "start": 636, "end": 1265 }
class ____(list["int"]): # Y020 Quoted annotations should never be used in stubs """Documented and guaranteed useful.""" # Y021 Docstrings should not be included in stubs if sys.platform == "linux": f: "int" # Y020 Quoted annotations should never be used in stubs elif sys.platform == "win32": f: "str" ...
Child
python
kamyu104__LeetCode-Solutions
Python/find-the-longest-semi-repetitive-substring.py
{ "start": 44, "end": 418 }
class ____(object): def longestSemiRepetitiveSubstring(self, s): """ :type s: str :rtype: int """ result = left = prev = 0 for right in xrange(len(s)): if right-1 >= 0 and s[right-1] == s[right]: left, prev = prev, right result ...
Solution
python
pydantic__pydantic
pydantic/type_adapter.py
{ "start": 1900, "end": 35653 }
class ____(Generic[T]): """!!! abstract "Usage Documentation" [`TypeAdapter`](../concepts/type_adapter.md) Type adapters provide a flexible way to perform validation and serialization based on a Python type. A `TypeAdapter` instance exposes some of the functionality from `BaseModel` instance metho...
TypeAdapter
python
google__jax
tests/pmap_test.py
{ "start": 127610, "end": 128202 }
class ____: def setUp(self): super().setUp() if config.pmap_shmap_merge.value: # NOTE(dsuo): Most test do pass `pmap_shmap_merge=True` and # `disable_jit=True` but are they still meaningful? They can also be much # slower. raise SkipTest('Not testing disable_jit when `pmap_shmap_merge...
EagerPmapMixin
python
astropy__astropy
astropy/table/pprint.py
{ "start": 6106, "end": 30878 }
class ____: @staticmethod def _get_pprint_size(max_lines=None, max_width=None): """Get the output size (number of lines and character width) for Column and Table pformat/pprint methods. If no value of ``max_lines`` is supplied then the height of the screen terminal is used to se...
TableFormatter
python
pytorch__pytorch
torch/distributed/pipelining/stage.py
{ "start": 3807, "end": 41057 }
class ____(ABC): """ Base class for pipeline stages. Defines or implements common methods used by the `_PipelineStage` used by the tracing frontend and `PipelineStage` used by manual frontend. """ def __init__( self, submodule: torch.nn.Module, stage_index: int, ...
_PipelineStageBase
python
dagster-io__dagster
python_modules/dagster/dagster/components/resolved/scopes.py
{ "start": 3462, "end": 4222 }
class ____(WrappedObjectScope): """Provides access to component loading utilities within templates. Available via `{{ context.* }}` in component YAML files. Examples: {{ context.project_root }}/data/input.csv {{ context.load_component("other_component") }} {{ context.build_defs("su...
LoadContextScope
python
psf__black
scripts/release_tests.py
{ "start": 600, "end": 2333 }
class ____(unittest.TestCase): def setUp(self) -> None: # We only test on >= 3.12 self.tempdir = TemporaryDirectory(delete=False) # type: ignore self.tempdir_path = Path(self.tempdir.name) self.sf = SourceFiles(self.tempdir_path) def tearDown(self) -> None: rmtree(self....
TestRelease
python
getsentry__sentry
tests/sentry/preprod/api/endpoints/test_preprod_artifact_rerun_analysis.py
{ "start": 250, "end": 3478 }
class ____(APITestCase): """Base class with shared test logic for rerun analysis endpoints""" def setUp(self): super().setUp() self.organization = self.create_organization(owner=self.user) self.project = self.create_project(organization=self.organization) self.login_as(user=self...
BaseRerunAnalysisTest
python
dagster-io__dagster
python_modules/libraries/dagster-dg-cli/dagster_dg_cli/cli/scaffold/branch/ai.py
{ "start": 2869, "end": 3244 }
class ____(InputType): """Passes along user input as-is.""" @classmethod def matches(cls, user_input: str) -> bool: return True @classmethod def get_context(cls, user_input: str) -> str: return f"The user's stated goal is: {user_input}." @classmethod def additional_allowed...
TextInputType
python
gevent__gevent
src/greentest/3.10/test_smtpd.py
{ "start": 995, "end": 1100 }
class ____(DummyServer): def listen(self, num): raise DummyDispatcherBroken()
BrokenDummyServer
python
django__django
tests/custom_lookups/tests.py
{ "start": 7210, "end": 7271 }
class ____(StartsWith): lookup_name = "sw"
CustomStartsWith
python
oauthlib__oauthlib
oauthlib/oauth2/rfc6749/errors.py
{ "start": 7761, "end": 8013 }
class ____(OAuth2Error): """ The requested scope is invalid, unknown, or malformed, or exceeds the scope granted by the resource owner. https://tools.ietf.org/html/rfc6749#section-5.2 """ error = 'invalid_scope'
InvalidScopeError
python
huggingface__transformers
src/transformers/models/metaclip_2/modular_metaclip_2.py
{ "start": 18030, "end": 20619 }
class ____(CLIPTextModelWithProjection): """ MetaClip2 text model with a projection layer on top (a linear layer on top of the pooled output). This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downl...
MetaClip2TextModelWithProjection
python
pytorch__pytorch
test/functorch/test_control_flow.py
{ "start": 269712, "end": 271874 }
class ____(torch.nn.Module): def forward(self, primals_1: "f32[3, 4]", primals_2: "f32[3, 4]", gt: "b8[]", tangents_1: "f32[3, 4]"): true_graph_1 = self.true_graph_1 false_graph_1 = self.false_graph_1 cond_1 = torch.ops.higher_order.cond(gt, true_graph_1, false_graph_1, (primals_1, primals_2...
GraphModule
python
protocolbuffers__protobuf
python/google/protobuf/internal/message_test.py
{ "start": 2065, "end": 65592 }
class ____(unittest.TestCase): def testBadUtf8String(self, message_module): if api_implementation.Type() != 'python': self.skipTest('Skipping testBadUtf8String, currently only the python ' 'api implementation raises UnicodeDecodeError when a ' 'string field contains ...
MessageTest
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/newType2.py
{ "start": 206, "end": 749 }
class ____(X2, A): ... # This should generate two errors (one for `__new__` and one for `__init__`) # because the first arg is not a string. X3 = type(34, (object,)) # This should generate two errors (one for `__new__` and one for `__init__`) # because the second arg is not a tuple of class types. X4 = type("X4", 34...
B
python
pytorch__pytorch
torch/testing/_internal/common_pruning.py
{ "start": 7112, "end": 8389 }
class ____(nn.Module): r"""Model with only Conv2d layers, all with bias and some with padding > 0, some in a Sequential and some following. Activation function modules in between each layer. Used to test that bias is propagated correctly in the special case of pruned Conv2d-Bias-(Activation)Conv2d fusio...
Conv2dPadBias
python
tiangolo__fastapi
docs_src/cookie_param_models/tutorial002_py310.py
{ "start": 86, "end": 343 }
class ____(BaseModel): model_config = {"extra": "forbid"} session_id: str fatebook_tracker: str | None = None googall_tracker: str | None = None @app.get("/items/") async def read_items(cookies: Cookies = Cookie()): return cookies
Cookies
python
bottlepy__bottle
test/test_securecookies.py
{ "start": 1304, "end": 1745 }
class ____(TestSignedCookies): def setUp(self): super(TestSignedCookiesWithPickle, self).setUp() self.data = dict(a=5, b=touni('υηι¢σ∂є'), c=[1,2,3,4,tob('bytestring')]) @api("0.9", "0.13") def testValid(self): super(TestSignedCookiesWithPickle, self).testValid() @api("0.9", "0...
TestSignedCookiesWithPickle