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
django__django
tests/prefetch_related/tests.py
{ "start": 62341, "end": 68031 }
class ____(TestCase): databases = {"default", "other"} def test_using_is_honored_m2m(self): B = Book.objects.using("other") A = Author.objects.using("other") book1 = B.create(title="Poems") book2 = B.create(title="Jane Eyre") book3 = B.create(title="Wuthering Heights") ...
MultiDbTests
python
allegroai__clearml
clearml/automation/optuna/optuna.py
{ "start": 4760, "end": 12261 }
class ____(SearchStrategy): def __init__( self, base_task_id: str, hyper_parameters: Sequence[Parameter], objective_metric: Objective, execution_queue: str, num_concurrent_workers: int, max_iteration_per_job: Optional[int], total_max_jobs: Optional[int...
OptimizerOptuna
python
allegroai__clearml
clearml/backend_api/services/v2_13/models.py
{ "start": 110344, "end": 113198 }
class ____(Request): """ Set the model ready flag to True. If the model is an output model of a task then try to publish the task. :param model: Model id :type model: str :param force_publish_task: Publish the associated task (if exists) even if it is not in the 'stopped' state. Optional, t...
SetReadyRequest
python
PyCQA__pylint
tests/functional/g/generic_class_syntax.py
{ "start": 127, "end": 262 }
class ____(Generic[_T]): last_update: Optional[int] = None def __init__(self, data: _T) -> None: self.data = data
Entity
python
astropy__astropy
astropy/cosmology/_src/core.py
{ "start": 2944, "end": 3550 }
class ____: """Descriptor for the `Cosmology.name` field.""" default: str | None = None def __get__( self, instance: Union["Cosmology", None], owner: type["Cosmology"] | None ) -> str: # Called from the class. `dataclass` uses this to create ``__init__``. if instance is None: ...
_NameField
python
readthedocs__readthedocs.org
readthedocs/projects/tests/mockers.py
{ "start": 327, "end": 9868 }
class ____: def __init__(self, project, version, build, requestsmock): self.project = project self.version = version self.build = build self.requestsmock = requestsmock self.patches = {} self.mocks = {} def start(self): self._mock_api() self._moc...
BuildEnvironmentMocker
python
wandb__wandb
wandb/vendor/pygments/lexers/textfmts.py
{ "start": 7000, "end": 10852 }
class ____(RegexLexer): """ Lexer for `Todo.txt <http://todotxt.com/>`_ todo list format. .. versionadded:: 2.0 """ name = 'Todotxt' aliases = ['todotxt'] # *.todotxt is not a standard extension for Todo.txt files; including it # makes testing easier, and also makes autodetecting file ...
TodotxtLexer
python
ray-project__ray
rllib/env/tests/test_multi_agent_env.py
{ "start": 16615, "end": 30362 }
class ____(unittest.TestCase): @classmethod def setUpClass(cls) -> None: ray.init() @classmethod def tearDownClass(cls) -> None: ray.shutdown() def test_basic_mock(self): env = BasicMultiAgent(4) obs, info = env.reset() check(obs, {0: 0, 1: 0, 2: 0, 3: 0}) ...
TestMultiAgentEnv
python
walkccc__LeetCode
solutions/3141. Maximum Hamming Distances/3141.py
{ "start": 0, "end": 464 }
class ____: def maxHammingDistances(self, nums: list[int], m: int) -> list[int]: MAX_MASK = 1 << m # dp[i] := the maximum hamming distance from i to any number in `nums` dp = [-math.inf] * MAX_MASK for num in nums: dp[num] = 0 for bit in range(m): newDp = [0] * MAX_MASK for mas...
Solution
python
getsentry__sentry
tests/snuba/rules/conditions/test_event_frequency.py
{ "start": 51849, "end": 52095 }
class ____( ErrorEventMixin, EventUniqueUserFrequencyConditionTestCase, ): pass @freeze_time( (timezone.now() - timedelta(days=2)).replace(hour=12, minute=40, second=0, microsecond=0) )
ErrorIssueUniqueUserFrequencyConditionTestCase
python
apache__airflow
airflow-core/src/airflow/api_fastapi/core_api/datamodels/log.py
{ "start": 942, "end": 1321 }
class ____(BaseModel): """An individual log message.""" # Not every message has a timestamp. timestamp: Annotated[ datetime | None, # Schema level, say this is always a datetime if it exists WithJsonSchema({"type": "string", "format": "date-time"}), ] = None event: str ...
StructuredLogMessage
python
tensorflow__tensorflow
tensorflow/python/keras/metrics.py
{ "start": 64085, "end": 66912 }
class ____(SensitivitySpecificityBase): """Computes best precision where recall is >= specified value. This metric creates four local variables, `true_positives`, `true_negatives`, `false_positives` and `false_negatives` that are used to compute the precision at the given recall. The threshold for the given re...
PrecisionAtRecall
python
scipy__scipy
scipy/signal/_filter_design.py
{ "start": 1339, "end": 204382 }
class ____(UserWarning): """Warning about badly conditioned filter coefficients""" pass abs = np.absolute def _is_int_type(x): """ Check if input is of a scalar integer type (so ``5`` and ``array(5)`` will pass, while ``5.0`` and ``array([5])`` will fail. """ if np.ndim(x) != 0: ...
BadCoefficients
python
spyder-ide__spyder
spyder/utils/external/dafsa/dafsa.py
{ "start": 10128, "end": 13227 }
class ____(dict): """ Class representing edge objects in a DAFSA. This class overloads a normal Python dictionary, and in simpler implementations could potentially be replaced with a pure dictionary. It was implemented as its own object for homogeneity and for planned future expansions, particu...
DAFSAEdge
python
Lightning-AI__lightning
tests/tests_pytorch/models/test_hparams.py
{ "start": 17760, "end": 18140 }
class ____(BoringModel): """This model has the super().__init__() call at the end.""" def __init__(self, arg1, arg2, *args, **kwargs): self.argument1 = arg1 # arg2 intentionally not set arg1 = "overwritten" local_var = 1234 # noqa: F841 super().__init__(*args, **kwargs) # thi...
LocalVariableModelSuperLast
python
numba__numba
numba/tests/test_tracing.py
{ "start": 246, "end": 1013 }
class ____: """Capture the trace temporarily for validation.""" def __init__(self): self.buffer = StringIO() self.handler = logging.StreamHandler(self.buffer) def __enter__(self): self._handlers = logger.handlers self.buffer = StringIO() logger.handlers = [logging.St...
CapturedTrace
python
pydata__xarray
xarray/tests/test_dataset.py
{ "start": 8728, "end": 299797 }
class ____: def test_repr(self) -> None: data = create_test_data(seed=123, use_extension_array=True) data.attrs["foo"] = "bar" # need to insert str dtype at runtime to handle different endianness var5 = ( "\n var5 (dim1) int64[pyarrow] 64B 5 9 7 2 6 2 8...
TestDataset
python
langchain-ai__langchain
libs/core/tests/unit_tests/indexing/test_indexing.py
{ "start": 770, "end": 80987 }
class ____(BaseLoader): """Toy loader that always returns the same documents.""" def __init__(self, documents: Sequence[Document]) -> None: """Initialize with the documents to return.""" self.documents = documents def lazy_load( self, ) -> Iterator[Document]: yield from...
ToyLoader
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/linalg/sparse/conjugate_gradient_test.py
{ "start": 1075, "end": 4106 }
class ____(test.TestCase, parameterized.TestCase): @parameterized.parameters( itertools.product([np.float32, np.float64], [1, 4, 10], [True, False]) ) def test_conjugate_gradient(self, dtype, size, use_static_shape): shape = [size, size] np.random.seed(1) a_np = ( np.random.uniform(low=...
ConjugateGradientTest
python
dagster-io__dagster
.buildkite/buildkite-shared/buildkite_shared/step_builders/command_step_builder.py
{ "start": 550, "end": 928 }
class ____: def __init__(self, cpu, memory, docker_cpu: str = "500m"): self._cpu = cpu self._memory = memory self._docker_cpu = docker_cpu @property def cpu(self): return self._cpu @property def memory(self): return self._memory @property def docker...
ResourceRequests
python
ansible__ansible
test/units/module_utils/facts/test_collector.py
{ "start": 14132, "end": 14789 }
class ____(unittest.TestCase): def test(self): names = ['network', 'virtual', 'env'] all_fact_subsets = {'env': [default_collectors.EnvFactCollector], 'network': [default_collectors.LinuxNetworkCollector], 'virtual': [default_collectors.LinuxVi...
TestBuildDepData
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/executors/aws_lambda/utils.py
{ "start": 1596, "end": 1789 }
class ____(BaseConfigKeys): """Config keys loaded which are valid lambda invoke args.""" FUNCTION_NAME = "function_name" QUALIFIER = "function_qualifier"
InvokeLambdaKwargsConfigKeys
python
ray-project__ray
rllib/connectors/agent/synced_filter.py
{ "start": 198, "end": 1938 }
class ____(AgentConnector): """An agent connector that filters with synchronized parameters.""" def __init__(self, ctx: ConnectorContext, *args, **kwargs): super().__init__(ctx) if args or kwargs: raise ValueError( "SyncedFilterAgentConnector does not take any additi...
SyncedFilterAgentConnector
python
fastapi__sqlmodel
docs_src/tutorial/fastapi/update/tutorial002.py
{ "start": 519, "end": 2863 }
class ____(SQLModel): name: Optional[str] = None secret_name: Optional[str] = None age: Optional[int] = None password: Optional[str] = None sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" connect_args = {"check_same_thread": False} engine = create_engine(sqlite_url, echo...
HeroUpdate
python
oauthlib__oauthlib
oauthlib/openid/connect/core/grant_types/hybrid.py
{ "start": 419, "end": 2714 }
class ____(GrantTypeBase): def __init__(self, request_validator=None, **kwargs): self.request_validator = request_validator or RequestValidator() self.proxy_target = OAuth2AuthorizationCodeGrant( request_validator=request_validator, **kwargs) # All hybrid response types should ...
HybridGrant
python
huggingface__transformers
src/transformers/models/omdet_turbo/configuration_omdet_turbo.py
{ "start": 903, "end": 14568 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`OmDetTurboForObjectDetection`]. It is used to instantiate a OmDet-Turbo model according to the specified arguments, defining the model architecture Instantiating a configuration with the defaults will yi...
OmDetTurboConfig
python
getsentry__sentry-python
sentry_sdk/scope.py
{ "start": 3304, "end": 5076 }
class ____: def __init__(self, hub=None): # type: (Optional[Any]) -> None self._old_scopes = [] # type: List[Scope] def __enter__(self): # type: () -> Scope isolation_scope = Scope.get_isolation_scope() self._old_scopes.append(isolation_scope) forked_scope = i...
_ScopeManager
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/random/random_gamma_test.py
{ "start": 1385, "end": 9052 }
class ____(test.TestCase): """This is a medium test due to the moments computation taking some time.""" def setUp(self): np.random.seed(137) random_seed.set_random_seed(137) def _Sampler(self, num, alpha, beta, dtype, use_gpu=True, seed=None): def func(): with self.session(use_gpu=use_gpu, gr...
RandomGammaTest
python
bokeh__bokeh
tests/unit/bokeh/test_client_server.py
{ "start": 2326, "end": 2456 }
class ____(Model): distance = DistanceSpec(42) angle = AngleSpec(0) logging.basicConfig(level=logging.DEBUG)
UnitsSpecModel
python
getsentry__sentry
tests/sentry/api/serializers/test_commit_filechange.py
{ "start": 411, "end": 2968 }
class ____(TestCase): def test_simple(self) -> None: user = self.create_user() project = self.create_project() release = Release.objects.create( organization_id=project.organization_id, version=uuid4().hex ) release.add_project(project) repository = Reposi...
CommitFileChangeSerializerTest
python
matplotlib__matplotlib
lib/matplotlib/transforms.py
{ "start": 63528, "end": 65820 }
class ____(AffineBase): """ The base class of all 2D affine transformations. 2D affine transformations are performed using a 3x3 numpy array:: a c e b d f 0 0 1 This class provides the read-only interface. For a mutable 2D affine transformation, use `Affine2D`. Subcl...
Affine2DBase
python
sympy__sympy
sympy/combinatorics/fp_groups.py
{ "start": 1706, "end": 18578 }
class ____(DefaultPrinting): """ The FpGroup would take a FreeGroup and a list/tuple of relators, the relators would be specified in such a way that each of them be equal to the identity of the provided free group. """ is_group = True is_FpGroup = True is_PermutationGroup = False d...
FpGroup
python
scipy__scipy
scipy/stats/_multivariate.py
{ "start": 49867, "end": 53946 }
class ____(multi_rv_frozen): """ Create a frozen matrix normal distribution. Parameters ---------- %(_matnorm_doc_default_callparams)s seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, optional If `seed` is `None` the `~np.random.RandomState` singleton is used. ...
matrix_normal_frozen
python
streamlit__streamlit
lib/streamlit/web/server/routes.py
{ "start": 1872, "end": 4182 }
class ____(tornado.web.StaticFileHandler): def initialize( self, path: str, default_filename: str | None = None, reserved_paths: Sequence[str] = (), ) -> None: self._reserved_paths = reserved_paths super().initialize(path, default_filename) def set_extra_hea...
StaticFileHandler
python
huggingface__transformers
src/transformers/models/bert_japanese/tokenization_bert_japanese.py
{ "start": 20675, "end": 22920 }
class ____: """Runs basic tokenization with jumanpp morphological parser.""" def __init__( self, do_lower_case=False, never_split=None, normalize_text=True, trim_whitespace=False, ): """ Constructs a JumanppTokenizer. Args: **do_l...
JumanppTokenizer
python
kubernetes-client__python
kubernetes/client/models/v1_non_resource_attributes.py
{ "start": 383, "end": 4199 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1NonResourceAttributes
python
google__jax
tests/pallas/tpu_sparsecore_pallas_debug_check_test.py
{ "start": 1419, "end": 5140 }
class ____(jtu.JaxTestCase): @classmethod def setUpClass(cls): super().setUpClass() total_shards = int(os.environ.get("TEST_TOTAL_SHARDS", -1)) if total_shards == -1: raise unittest.SkipTest("Tests can only be run with Bazel.") loader = unittest.TestLoader() test_cases = loader.loadTests...
DebugCheckTest
python
huggingface__transformers
src/transformers/models/owlv2/modeling_owlv2.py
{ "start": 16683, "end": 17982 }
class ____(nn.Module): def __init__(self, config: Owlv2TextConfig): super().__init__() self.token_embedding = nn.Embedding(config.vocab_size, config.hidden_size) self.position_embedding = nn.Embedding(config.max_position_embeddings, config.hidden_size) # position_ids (1, len positio...
Owlv2TextEmbeddings
python
kubernetes-client__python
kubernetes/base/dynamic/exceptions.py
{ "start": 3353, "end": 3415 }
class ____(DynamicApiError): """ 410: StatusGone """
GoneError
python
skorch-dev__skorch
skorch/tests/callbacks/test_training.py
{ "start": 463, "end": 18033 }
class ____: @pytest.fixture def checkpoint_cls(self): from skorch.callbacks import Checkpoint return Checkpoint @pytest.fixture def save_params_mock(self): with patch('skorch.NeuralNet.save_params') as mock: yield mock @pytest.fixture(params=['torch', 'safetenso...
TestCheckpoint
python
getsentry__sentry
src/sentry/integrations/slack/webhooks/command.py
{ "start": 2662, "end": 6986 }
class ____(SlackDMEndpoint): owner = ApiOwner.ECOSYSTEM publish_status = { "POST": ApiPublishStatus.PRIVATE, } authentication_classes = () permission_classes = () slack_request_class = SlackCommandRequest def reply(self, slack_request: SlackDMRequest, message: str) -> Response: ...
SlackCommandsEndpoint
python
readthedocs__readthedocs.org
readthedocs/organizations/tests/test_forms.py
{ "start": 479, "end": 1126 }
class ____(TestCase): def setUp(self): self.owner = fixture.get(User) self.user = fixture.get(User) self.project = fixture.get(Project) self.organization = fixture.get( Organization, name="Mozilla", slug="mozilla", owners=[self.owner],...
OrganizationTestCase
python
getsentry__sentry
tests/sentry/issues/endpoints/test_group.py
{ "start": 455, "end": 3015 }
class ____(TestCase): def setUp(self) -> None: super().setUp() self.permission = GroupAiPermission() self.project = self.create_project() self.group = self.create_group(project=self.project) self.demo_user = self.create_user() def _demo_mode_enabled(self) -> ContextManag...
GroupAiPermissionTest
python
dateutil__dateutil
src/dateutil/parser/_parser.py
{ "start": 58000, "end": 58616 }
class ____(ValueError): """Exception subclass used for any failure to parse a datetime string. This is a subclass of :py:exc:`ValueError`, and should be raised any time earlier versions of ``dateutil`` would have raised ``ValueError``. .. versionadded:: 2.8.1 """ def __str__(self): try...
ParserError
python
getsentry__sentry
tests/sentry/incidents/test_logic.py
{ "start": 135496, "end": 136086 }
class ____(BaseAlertRuleTriggerActionTest): @cached_property def action(self): return create_alert_rule_trigger_action( self.trigger, AlertRuleTriggerAction.Type.EMAIL, AlertRuleTriggerAction.TargetType.USER, target_identifier=str(self.user.id), ) ...
DeleteAlertRuleTriggerAction
python
rq__rq
tests/test_registry.py
{ "start": 810, "end": 9772 }
class ____(RQTestCase): """Test all the BaseRegistry functionality""" def setUp(self): super().setUp() self.registry = BaseRegistry(connection=self.connection) def test_init(self): """Registry can be instantiated with queue or name/Redis connection""" queue = Queue('foo', c...
TestRegistry
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 231984, "end": 232579 }
class ____(sgqlc.types.relay.Connection): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of(CommitEdge), graphql_name="edges") nodes = sgqlc.types.Field(sgqlc.type...
CommitHistoryConnection
python
ray-project__ray
python/ray/_private/thirdparty/pynvml/pynvml.py
{ "start": 68769, "end": 69063 }
class ____(_PrintableStructure): _fields_ = [ ('year', c_uint32), ('month', c_uint16), ('day', c_uint16), ('hour', c_uint16), ('min', c_uint16), ('sec', c_uint16), ('status', c_uint8), ]
c_nvmlGridLicenseExpiry_t
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1536328, "end": 1537139 }
class ____(sgqlc.types.Type, Node): """Represents an 'unlabeled' event on a given issue or pull request.""" __schema__ = github_schema __field_names__ = ("actor", "created_at", "label", "labelable") actor = sgqlc.types.Field(Actor, graphql_name="actor") """Identifies the actor who performed the eve...
UnlabeledEvent
python
python-attrs__attrs
tests/test_functional.py
{ "start": 1380, "end": 1486 }
class ____(metaclass=Meta): pass FromMakeClass = attr.make_class("FromMakeClass", ["x"])
WithMetaSlots
python
openai__openai-python
src/openai/types/responses/input_item_list_params.py
{ "start": 286, "end": 964 }
class ____(TypedDict, total=False): after: str """An item ID to list items after, used in pagination.""" include: List[ResponseIncludable] """Additional fields to include in the response. See the `include` parameter for Response creation above for more information. """ limit: int """A...
InputItemListParams
python
apache__airflow
airflow-core/src/airflow/exceptions.py
{ "start": 7446, "end": 7568 }
class ____(AirflowException): """Raise when multiple values are found for the same connection ID."""
ConnectionNotUnique
python
streamlit__streamlit
lib/tests/streamlit/elements/vega_charts_test.py
{ "start": 104266, "end": 117808 }
class ____(unittest.TestCase): """Test vega chart utility methods.""" @parameterized.expand( [ ( "param_", '{"config": {"settings": ["param_1", "param_2"], "ignore": ["param_3"]}}', '{"config": {"settings": ["param_1", "param_2"], "ignore": ["...
VegaUtilitiesTest
python
jackfrued__Python-100-Days
Day31-35/code/test_example02.py
{ "start": 74, "end": 652 }
class ____(TestCase): """测试排序函数的测试用例""" def setUp(self): self.data1 = [35, 97, 12, 68, 55, 73, 81, 40] self.items1 = [12, 35, 68, 97] self.items2 = [40, 55, 73, 81] def test_merge(self): items = merge(self.items1, self.items2) for i in range(len(items) - 1): ...
TestExample02
python
sympy__sympy
sympy/physics/mechanics/tests/test_wrapping_geometry.py
{ "start": 15151, "end": 19285 }
class ____: """ A test class to verify the Lagrangian mechanics model of a particle tethered by an elastic cable that is constrained to move on the surface of a fixed cone. The physical system consists of a particle of mass `m` which can slide freely on a cone with a half-angle `alpha`. This pa...
TestElasticConeModel
python
google__pytype
pytype/tests/test_test_code.py
{ "start": 79, "end": 3349 }
class ____(test_base.BaseTest): """Tests for test assertions.""" def test_assert_not_none(self): self.Check(""" import unittest from typing import Optional def foo(): return '10' if __random__ else None class FooTest(unittest.TestCase): def test_foo(self): x = ...
AssertionTest
python
cython__cython
docs/examples/userguide/early_binding_for_speed/rectangle_cdef.py
{ "start": 15, "end": 622 }
class ____: x0: cython.int y0: cython.int x1: cython.int y1: cython.int def __init__(self, x0: cython.int, y0: cython.int, x1: cython.int, y1: cython.int): self.x0 = x0 self.y0 = y0 self.x1 = x1 self.y1 = y1 @cython.cfunc def _area(self) -> cython.int: ...
Rectangle
python
dask__distributed
distributed/dashboard/components/scheduler.py
{ "start": 78749, "end": 94042 }
class ____(DashboardComponent): """ Task Group Graph Creates a graph layout for TaskGroups on the scheduler. It assigns (x, y) locations to all the TaskGroups and lays them out by according to their dependencies. The layout gets updated every time that new TaskGroups are added. Each task ...
TaskGroupGraph
python
django-crispy-forms__django-crispy-forms
crispy_forms/exceptions.py
{ "start": 288, "end": 330 }
class ____(CrispyError): pass
DynamicError
python
jackfrued__Python-100-Days
Day31-35/code/example14.py
{ "start": 124, "end": 275 }
class ____(Enum): """花色(枚举)""" SPADE, HEART, CLUB, DIAMOND = range(4) def __lt__(self, other): return self.value < other.value
Suite
python
google__jax
tests/hijax_test.py
{ "start": 4951, "end": 5397 }
class ____(HiPrimitive): def abstract_eval(_, hi_aval): return ShapedArray(hi_aval.shape, jnp.dtype('float32')), set() def to_lojax(_, hi_val): return hi_val.arr.astype('float32') * hi_val.scale[:, None] def jvp(_, primals, tangents): (x,), (xdot,) = primals, tangents return from_qarray(x), from...
FromQ
python
pytorch__pytorch
torch/export/unflatten.py
{ "start": 1236, "end": 1383 }
class ____(Enum): PARAMETER = "parameter" BUFFER = "buffer" CONSTANT = "constant" MODULE = "module" @dataclass(frozen=True)
_AttrKind
python
aimacode__aima-python
deep_learning4e.py
{ "start": 403, "end": 703 }
class ____: """ A single unit of a layer in a neural network :param weights: weights between parent nodes and current node :param value: value of current node """ def __init__(self, weights=None, value=None): self.value = value self.weights = weights or []
Node
python
walkccc__LeetCode
solutions/11. Container With Most Water/11.py
{ "start": 0, "end": 303 }
class ____: def maxArea(self, height: list[int]) -> int: ans = 0 l = 0 r = len(height) - 1 while l < r: minHeight = min(height[l], height[r]) ans = max(ans, minHeight * (r - l)) if height[l] < height[r]: l += 1 else: r -= 1 return ans
Solution
python
jina-ai__jina
jina/excepts.py
{ "start": 2004, "end": 2130 }
class ____(Exception, BaseJinaException): """Exception when user accidentally using a retired argument."""
NotSupportedError
python
huggingface__transformers
src/transformers/models/mobilebert/modeling_mobilebert.py
{ "start": 38079, "end": 41495 }
class ____(MobileBertPreTrainedModel): def __init__(self, config): super().__init__(config) self.num_labels = config.num_labels self.config = config self.mobilebert = MobileBertModel(config) classifier_dropout = ( config.classifier_dropout if config.classifier_dr...
MobileBertForSequenceClassification
python
ray-project__ray
ci/ray_ci/test_linux_tester_container.py
{ "start": 442, "end": 10187 }
class ____: """ Mock subprocess.Popen. This process returns 1 if test targets is empty or contains bad_test; otherwise return 0. """ def __init__(self, test_targets: List[str]): self.test_targets = test_targets def wait(self) -> int: return 1 if "bad_test" in self.test_targets ...
MockPopen
python
crytic__slither
slither/slithir/operations/binary.py
{ "start": 538, "end": 3141 }
class ____(Enum): POWER = "**" MULTIPLICATION = "*" DIVISION = "/" MODULO = "%" ADDITION = "+" SUBTRACTION = "-" LEFT_SHIFT = "<<" RIGHT_SHIFT = ">>" AND = "&" CARET = "^" OR = "|" LESS = "<" GREATER = ">" LESS_EQUAL = "<=" GREATER_EQUAL = ">=" EQUAL = "==...
BinaryType
python
allegroai__clearml
clearml/binding/import_bind.py
{ "start": 213, "end": 3086 }
class ____(object): _patched = False _post_import_hooks = defaultdict(list) @staticmethod def _init_hook() -> None: if PostImportHookPatching._patched: return PostImportHookPatching._patched = True if six.PY2: # python2.x builtins.__org_impor...
PostImportHookPatching
python
pypa__pipenv
pipenv/vendor/tomlkit/toml_char.py
{ "start": 16, "end": 1291 }
class ____(str): def __init__(self, c): super().__init__() if len(self) > 1: raise ValueError("A TOML character must be of length 1") BARE = string.ascii_letters + string.digits + "-_" KV = "= \t" NUMBER = string.digits + "+-_.e" SPACES = " \t" NL = "\n\r" WS = ...
TOMLChar
python
qdrant__qdrant-client
qdrant_client/embed/embedder.py
{ "start": 652, "end": 16412 }
class ____: def __init__(self, threads: Optional[int] = None, **kwargs: Any) -> None: self.embedding_models: dict[str, list[ModelInstance[TextEmbedding]]] = defaultdict(list) self.sparse_embedding_models: dict[str, list[ModelInstance[SparseTextEmbedding]]] = ( defaultdict(list) )...
Embedder
python
pytorch__pytorch
torch/distributed/flight_recorder/components/types.py
{ "start": 3147, "end": 3218 }
class ____(NamedTuple): group_id: str global_rank: int
Membership
python
python-openxml__python-docx
tests/oxml/test_xmlchemy.py
{ "start": 7734, "end": 11056 }
class ____: def it_adds_a_getter_property_for_the_choice_element(self, getter_fixture): parent, expected_choice = getter_fixture assert parent.choice is expected_choice def it_adds_a_creator_method_for_the_child_element(self, new_fixture): parent, expected_xml = new_fixture choi...
DescribeChoice
python
huggingface__transformers
src/transformers/models/metaclip_2/configuration_metaclip_2.py
{ "start": 664, "end": 5784 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`MetaClip2TextModel`]. It is used to instantiate a MetaClip2 text encoder according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield ...
MetaClip2TextConfig
python
ansible__ansible
lib/ansible/cli/__init__.py
{ "start": 4703, "end": 27716 }
class ____(ABC): """ code behind bin/ansible* programs """ PAGER = C.config.get_config_value('PAGER') # -F (quit-if-one-screen) -R (allow raw ansi control chars) # -S (chop long lines) -X (disable termcap init and de-init) LESS_OPTS = 'FRSX' SKIP_INVENTORY_DEFAULTS = False USES_CONNECTION ...
CLI
python
sqlalchemy__sqlalchemy
test/orm/inheritance/test_poly_loading.py
{ "start": 44525, "end": 49815 }
class ____(fixtures.DeclarativeMappedTest): """test #7304 and related cases in this case we trigger the subclass attribute load, while at the same time there will be a deferred loader option present in the state's options that was established by the previous loader. test both that the option takes...
IgnoreOptionsOnSubclassAttrLoad
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/widgets/base.py
{ "start": 15812, "end": 19153 }
class ____: """ Draw a border around any container, optionally with a title text. Changing the title and body of the frame is possible at runtime by assigning to the `body` and `title` attributes of this class. :param body: Another container object. :param title: Text to be displayed in the to...
Frame
python
tox-dev__tox
src/tox/journal/env.py
{ "start": 181, "end": 2152 }
class ____: """Report the status of a tox environment.""" def __init__(self, enabled: bool, name: str) -> None: # noqa: FBT001 self._enabled = enabled self.name = name self._content: dict[str, Any] = {} self._executes: list[tuple[str, Outcome]] = [] def __setitem__(self, k...
EnvJournal
python
realpython__materials
python-enum/inheritance.py
{ "start": 201, "end": 347 }
class ____(BaseTextEnum): LOWERCASE = string.ascii_lowercase UPPERCASE = string.ascii_uppercase print(Alphabet.LOWERCASE.as_list())
Alphabet
python
kubernetes-client__python
kubernetes/client/models/v1_deployment_spec.py
{ "start": 383, "end": 11289 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1DeploymentSpec
python
keras-team__keras
keras/src/layers/convolutional/base_separable_conv.py
{ "start": 573, "end": 12634 }
class ____(Layer): """Abstract base layer for separable convolution. This layer performs a depthwise convolution that acts separately on channels, followed by a pointwise convolution that mixes channels. If `use_bias` is True and a bias initializer is provided, it adds a bias vector to the output. ...
BaseSeparableConv
python
pallets__flask
src/flask/debughelpers.py
{ "start": 330, "end": 509 }
class ____(AssertionError, UnicodeError): """Raised in places where we want some better error reporting for unexpected unicode or binary data. """
UnexpectedUnicodeError
python
sympy__sympy
sympy/stats/crv_types.py
{ "start": 96337, "end": 98567 }
class ____(SingleContinuousDistribution): _argnames = ('mu', 's') @property def set(self): return Interval(self.mu - self.s, self.mu + self.s) @staticmethod def check(mu, s): _value_check(s > 0, "s must be positive") def pdf(self, x): mu, s = self.mu, self.s re...
RaisedCosineDistribution
python
airbytehq__airbyte
airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_base_streams.py
{ "start": 1008, "end": 1140 }
class ____(FBMarketingStream): def list_objects(self, params: Mapping[str, Any]) -> Iterable: yield from []
SomeTestStream
python
PyCQA__pylint
tests/functional/i/invalid/invalid_metaclass.py
{ "start": 890, "end": 1099 }
class ____(metaclass=InvalidAsMetaclass()): # [invalid-metaclass] pass def invalid_metaclass_1(name, bases, attrs): return int def invalid_metaclass_2(name, bases, attrs): return 1
FourthInvalid
python
google__jax
tests/custom_partitioning_sharding_rule_test.py
{ "start": 3794, "end": 10603 }
class ____(jtu.JaxTestCase): def test_rule_is_not_a_str(self): with self.assertRaisesRegex(TypeError, "rule must be a str"): str_to_sdy_sharding_rule(1) def test_factor_sizes_is_not_a_proper_dict(self): with self.assertRaisesRegex( TypeError, "factor_sizes must be a dict of str to int"): ...
StrToSdyShardingRuleTest
python
getsentry__sentry
tests/sentry/core/endpoints/test_project_team_details.py
{ "start": 440, "end": 2769 }
class ____(ProjectTeamDetailsTest): method = "post" def test_add_team(self) -> None: project = self.create_project() team = self.create_team() self.get_success_response( project.organization.slug, project.slug, team.slug, status_code=stat...
ProjectTeamDetailsPostTest
python
PrefectHQ__prefect
scripts/generate_cli_docs.py
{ "start": 496, "end": 614 }
class ____(TypedDict): """A dictionary representing a command argument.""" name: str help: str
ArgumentDict
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 690878, "end": 691608 }
class ____(sgqlc.types.relay.Connection): """The connection type for Mannequin.""" __schema__ = github_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of("MannequinEdge"), graphql_name="edges") """A list of edges.""" nodes = sg...
MannequinConnection
python
wandb__wandb
wandb/sdk/internal/sender.py
{ "start": 4697, "end": 5586 }
class ____: _stopped: threading.Event _queue: queue.Queue _emulator: redirect.TerminalEmulator _writer_thr: threading.Thread _reader_thr: threading.Thread def __init__(self, stream: str, sm: "SendManager"): self._stopped = threading.Event() self._queue = queue.Queue() se...
_OutputRawStream
python
chroma-core__chroma
chromadb/types.py
{ "start": 6520, "end": 6592 }
class ____(TypedDict): id: UUID name: str tenant: str
Database
python
django-haystack__django-haystack
haystack/fields.py
{ "start": 8995, "end": 9415 }
class ____(SearchField): field_type = "integer" def __init__(self, **kwargs): if kwargs.get("facet_class") is None: kwargs["facet_class"] = FacetIntegerField super().__init__(**kwargs) def prepare(self, obj): return self.convert(super().prepare(obj)) def convert(s...
IntegerField
python
keras-team__keras
keras/src/metrics/hinge_metrics_test.py
{ "start": 2760, "end": 4801 }
class ____(testing.TestCase): def test_config(self): cat_hinge_obj = hinge_metrics.CategoricalHinge( name="cat_hinge", dtype="int32" ) self.assertEqual(cat_hinge_obj.name, "cat_hinge") self.assertEqual(cat_hinge_obj._dtype, "int32") # Check save and restore confi...
CategoricalHingeTest
python
apache__airflow
airflow-ctl/src/airflowctl/api/datamodels/generated.py
{ "start": 14699, "end": 14841 }
class ____(str, Enum): NAV = "nav" DAG = "dag" DAG_RUN = "dag_run" TASK = "task" TASK_INSTANCE = "task_instance"
Destination
python
huggingface__transformers
benchmark_v2/framework/hardware_metrics.py
{ "start": 4550, "end": 6806 }
class ____: """Monitor GPU utilization during benchmark execution.""" def __init__(self, sample_interval_sec: float = 0.1, logger: Logger | None = None): self.sample_interval_sec = sample_interval_sec self.logger = logger if logger is not None else logging.getLogger(__name__) self.num_...
GPUMonitor
python
docker__docker-py
docker/errors.py
{ "start": 2956, "end": 3334 }
class ____(DockerException): def __init__(self, msg): self.msg = msg def __str__(self): return self.msg + (". TLS configurations should map the Docker CLI " "client configurations. See " "https://docs.docker.com/engine/articles/https/ " ...
TLSParameterError
python
tensorflow__tensorflow
tensorflow/python/framework/device_spec.py
{ "start": 1723, "end": 13870 }
class ____(object): """Represents a (possibly partial) specification for a TensorFlow device. `DeviceSpec`s are used throughout TensorFlow to describe where state is stored and computations occur. Using `DeviceSpec` allows you to parse device spec strings to verify their validity, merge them or compose them pr...
DeviceSpecV2
python
Unity-Technologies__ml-agents
ml-agents/mlagents/trainers/torch_entities/networks.py
{ "start": 27653, "end": 28725 }
class ____(SimpleActor, Critic): def __init__( self, observation_specs: List[ObservationSpec], network_settings: NetworkSettings, action_spec: ActionSpec, stream_names: List[str], conditional_sigma: bool = False, tanh_squash: bool = False, ): self....
SharedActorCritic
python
pytorch__pytorch
torch/_dynamo/types.py
{ "start": 3663, "end": 3782 }
class ____(Protocol): def __call__( self, cache_hit: bool, ) -> bool: ...
DynamoGuardCompleteHook
python
pytorch__pytorch
scripts/release_notes/commitlist.py
{ "start": 1269, "end": 22125 }
class ____: # NB: Private ctor. Use `from_existing` or `create_new`. def __init__(self, path: str, commits: List[Commit]): self.path = path self.commits = commits @staticmethod def from_existing(path): commits = CommitList.read_from_disk(path) return CommitList(path, com...
CommitList