language
stringclasses
1 value
repo
stringclasses
346 values
path
stringlengths
6
201
class_span
dict
source
stringlengths
21
2.38M
target
stringlengths
1
96
python
huggingface__transformers
src/transformers/models/chameleon/modeling_chameleon.py
{ "start": 32206, "end": 33776 }
class ____: """ A class for mapping discrete image tokens from VQGAN to BPE tokens. """ def __init__(self, vocab_map): self.vocab_map = vocab_map self.image_token_id = vocab_map.get("<image>") @cached_property def val2name(self): return {v: k for k, v in self.vocab_map....
ChameleonImageVocabularyMapping
python
pandas-dev__pandas
pandas/tests/indexes/period/test_tools.py
{ "start": 1060, "end": 1361 }
class ____: def test_tolist(self): index = period_range(freq="Y", start="1/1/2001", end="12/1/2009") rs = index.tolist() for x in rs: assert isinstance(x, Period) recon = PeriodIndex(rs) tm.assert_index_equal(index, recon)
TestPeriodIndexConversion
python
PrefectHQ__prefect
src/prefect/server/schemas/sorting.py
{ "start": 6803, "end": 7504 }
class ____(AutoEnum): """Defines variables sorting options.""" CREATED_DESC = "CREATED_DESC" UPDATED_DESC = "UPDATED_DESC" NAME_DESC = "NAME_DESC" NAME_ASC = "NAME_ASC" @db_injector def as_sql_sort(self, db: "PrefectDBInterface") -> Iterable[sa.ColumnElement[Any]]: """Return an exp...
VariableSort
python
getsentry__sentry
src/sentry/api/endpoints/organization_unsubscribe.py
{ "start": 1013, "end": 2864 }
class ____(Endpoint, Generic[T]): publish_status = { "GET": ApiPublishStatus.PRIVATE, "POST": ApiPublishStatus.PRIVATE, } owner = ApiOwner.HYBRID_CLOUD authentication_classes = (SignedRequestAuthentication,) permission_classes = () object_type = "unknown" def fetch_instance...
OrganizationUnsubscribeBase
python
zostera__django-bootstrap4
tests/forms.py
{ "start": 556, "end": 2903 }
class ____(forms.Form): """Form with a variety of widgets to test bootstrap4 rendering.""" date = forms.DateField(required=False) datetime = forms.SplitDateTimeField(widget=AdminSplitDateTime(), required=False) subject = forms.CharField( max_length=100, help_text="my_help_text", ...
TestForm
python
pandas-dev__pandas
pandas/io/formats/csvs.py
{ "start": 991, "end": 10809 }
class ____: cols: npt.NDArray[np.object_] def __init__( self, formatter: DataFrameFormatter, path_or_buf: FilePath | WriteBuffer[str] | WriteBuffer[bytes] = "", sep: str = ",", cols: Sequence[Hashable] | None = None, index_label: IndexLabel | None = None, ...
CSVFormatter
python
openai__openai-python
src/openai/types/beta/threads/message.py
{ "start": 764, "end": 975 }
class ____(BaseModel): file_id: Optional[str] = None """The ID of the file to attach to the message.""" tools: Optional[List[AttachmentTool]] = None """The tools to add this file to."""
Attachment
python
plotly__plotly.py
plotly/graph_objs/splom/_selected.py
{ "start": 233, "end": 2396 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "splom" _path_str = "splom.selected" _valid_props = {"marker"} @property def marker(self): """ The 'marker' property is an instance of Marker that may be specified as: - An instance of :class:`plotly.graph_obj...
Selected
python
HypothesisWorks__hypothesis
hypothesis-python/tests/conjecture/test_test_data.py
{ "start": 2557, "end": 10637 }
class ____(SearchStrategy): def do_draw(self, data): data.draw_bytes(10**6, 10**6) def test_does_not_double_freeze_in_interval_close(): d = ConjectureData.for_choices((b"hi",)) with pytest.raises(StopTest): d.draw(BigStrategy()) assert d.frozen assert not any(eg.end is None for eg ...
BigStrategy
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/vertex_ai/test_experiment_service.py
{ "start": 2730, "end": 3726 }
class ____: @mock.patch(VERTEX_AI_PATH.format("ExperimentHook")) def test_execute(self, mock_hook): op = DeleteExperimentOperator( task_id=TASK_ID, project_id=GCP_PROJECT, location=GCP_LOCATION, experiment_name=TEST_EXPERIMENT_NAME, gcp_conn_id...
TestVertexAIDeleteExperimentOperator
python
PrefectHQ__prefect
src/integrations/prefect-databricks/prefect_databricks/models/jobs.py
{ "start": 96493, "end": 97082 }
class ____(BaseModel): """ See source code for the fields' description. """ model_config = ConfigDict(extra="allow", frozen=True) content: Optional[str] = Field(None, description="Content of the view.") name: Optional[str] = Field( None, description=( "Name of the v...
ViewItem
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_dash_address.py
{ "start": 1896, "end": 4640 }
class ____(ColumnMapExpectation): """Expect column values to be valid Dashcoin addresses.""" # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. examples = [ { "data": { "all_valid": [ ...
ExpectColumnValuesToBeValidDashAddress
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/override1.py
{ "start": 1859, "end": 1941 }
class ____(F): @override @evil_wrapper def method1(self): pass
G
python
kubernetes-client__python
kubernetes/base/dynamic/resource.py
{ "start": 3841, "end": 8538 }
class ____(Resource): """ Represents a list of API objects """ def __init__(self, client, group='', api_version='v1', base_kind='', kind=None, base_resource_lookup=None): self.client = client self.group = group self.api_version = api_version self.kind = kind or '{}List'.format(b...
ResourceList
python
has2k1__plotnine
plotnine/iapi.py
{ "start": 866, "end": 1308 }
class ____: """ Scale information after it has been trained """ scale: scale aesthetics: Sequence[ScaledAestheticsName] name: Optional[str] # Trained limits of the scale limits: tuple[float, float] | Sequence[str] # Physical size of scale, including expansions range: CoordRange ...
scale_view
python
django__django
tests/staticfiles_tests/cases.py
{ "start": 265, "end": 1578 }
class ____: """ Test case with a couple utility assertions. """ def assertFileContains(self, filepath, text): self.assertIn( text, self._get_file(filepath), "'%s' not in '%s'" % (text, filepath), ) def assertFileNotFound(self, filepath): ...
BaseStaticFilesMixin
python
django__django
django/db/models/functions/text.py
{ "start": 7192, "end": 7898 }
class ____(Func): function = "REPEAT" output_field = CharField() def __init__(self, expression, number, **extra): if ( not hasattr(number, "resolve_expression") and number is not None and number < 0 ): raise ValueError("'number' must be greate...
Repeat
python
cherrypy__cherrypy
cherrypy/test/modwsgi.py
{ "start": 3105, "end": 5124 }
class ____(helper.Supervisor): """Server Controller for ModWSGI and CherryPy.""" using_apache = True using_wsgi = True template = conf_modwsgi def __str__(self): """Render a :class:`ModWSGISupervisor` instance as a string.""" return 'ModWSGI Server on %s:%s' % (self.host, self.port...
ModWSGISupervisor
python
django__django
tests/generic_views/views.py
{ "start": 7427, "end": 7514 }
class ____(BookSigningConfig, generic.MonthArchiveView): pass
BookSigningMonthArchive
python
pennersr__django-allauth
allauth/socialaccount/providers/yahoo/provider.py
{ "start": 319, "end": 1199 }
class ____(OAuth2Provider): id = "yahoo" name = "Yahoo" account_class = YahooAccount oauth2_adapter_class = YahooOAuth2Adapter def get_default_scope(self): """ Doc on scopes available at https://developer.yahoo.com/oauth2/guide/yahoo_scopes/ """ return ["prof...
YahooProvider
python
tensorflow__tensorflow
tensorflow/python/util/module_wrapper_test.py
{ "start": 1080, "end": 1125 }
class ____(types.ModuleType): pass
MockModule
python
django__django
tests/validation/models.py
{ "start": 2052, "end": 2377 }
class ____(models.Model): start_date = models.DateField() end_date = models.DateTimeField() count = models.IntegerField( unique_for_date="start_date", unique_for_year="end_date" ) order = models.IntegerField(unique_for_month="end_date") name = models.CharField(max_length=100)
UniqueForDateModel
python
ray-project__ray
python/ray/data/datasource/datasource.py
{ "start": 15168, "end": 17842 }
class ____(Datasource): """An example datasource that generates rows with random int64 columns. Examples: >>> import ray >>> from ray.data.datasource import RandomIntRowDatasource >>> source = RandomIntRowDatasource() # doctest: +SKIP >>> ray.data.read_datasource( # doctest: +SK...
RandomIntRowDatasource
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/collective_ops_test.py
{ "start": 20718, "end": 22959 }
class ____(test.TestCase, parameterized.TestCase): def testReduce(self): device0 = '/device:GPU:0' device1 = '/device:GPU:1' group_size = 2 group_key = 100 instance_key = 100 results = [] def all_reduce(device): with ops.device(device): token = create_ordering_token() ...
XlaTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-tplcentral/source_tplcentral/streams.py
{ "start": 5653, "end": 6735 }
class ____(IncrementalTplcentralStream): # https://api.3plcentral.com/rels/inventory/stockdetails upstream_primary_key = "ReceiveItemId" upstream_cursor_field = "ReceivedDate" collection_field = "ResourceList" page_size = 500 def path(self, **kwargs) -> str: return "inventory/stockdetai...
StockDetails
python
PrefectHQ__prefect
src/prefect/events/actions.py
{ "start": 2964, "end": 3109 }
class ____(DeploymentAction): """Resumes the given Deployment""" type: Literal["resume-deployment"] = "resume-deployment"
ResumeDeployment
python
airbytehq__airbyte
airbyte-ci/connectors/connectors_qa/src/connectors_qa/checks/metadata.py
{ "start": 504, "end": 1572 }
class ____(MetadataCheck): name = f"Connectors must have valid {consts.METADATA_FILE_NAME} file" description = f"Connectors must have a `{consts.METADATA_FILE_NAME}` file at the root of their directory. This file is used to build our connector registry. Its structure must follow our metadata schema. Field value...
ValidateMetadata
python
donnemartin__interactive-coding-challenges
graphs_trees/invert_tree/test_invert_tree.py
{ "start": 18, "end": 848 }
class ____(unittest.TestCase): def test_invert_tree(self): root = Node(5) bst = InverseBst(root) node2 = bst.insert(2) node3 = bst.insert(3) node1 = bst.insert(1) node7 = bst.insert(7) node6 = bst.insert(6) node9 = bst.insert(9) result = bst.i...
TestInvertTree
python
PyCQA__pylint
tests/functional/s/slots_checks.py
{ "start": 1899, "end": 1946 }
class ____: __slots__ = func()
PotentiallyGood
python
nedbat__coveragepy
tests/mixins.py
{ "start": 4051, "end": 5056 }
class ____: """ Adapter from the pytest capsys fixture to more convenient methods. This doesn't also output to the real stdout, so we probably want to move to "real" capsys when we can use fixtures in test methods. Once you've used one of these methods, the capturing is reset, so another invoc...
StdStreamCapturingMixin
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_bugbear/class_as_data_structure.py
{ "start": 1257, "end": 1430 }
class ____: def __init__(self, foo:int, bar:list): self.foo = foo self.bar = bar self.spam = " - ".join([foo, bar])
NoWarningsComplicatedAssignment
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/input/vt100.py
{ "start": 463, "end": 6586 }
class ____(Input): """ Vt100 input for Posix systems. (This uses a posix file descriptor that can be registered in the event loop.) """ # For the error messages. Only display "Input is not a terminal" once per # file descriptor. _fds_not_a_terminal: set[int] = set() def __init__(self, ...
Vt100Input
python
tornadoweb__tornado
demos/websocket/chatdemo.py
{ "start": 909, "end": 1400 }
class ____(tornado.web.Application): def __init__(self): handlers = [(r"/", MainHandler), (r"/chatsocket", ChatSocketHandler)] settings = dict( cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__", template_path=os.path.join(os.path.dirname(__file__), "templates"), ...
Application
python
huggingface__transformers
src/transformers/feature_extraction_sequence_utils.py
{ "start": 996, "end": 18982 }
class ____(FeatureExtractionMixin): """ This is a general feature extraction class for speech recognition. Args: feature_size (`int`): The feature dimension of the extracted features. sampling_rate (`int`): The sampling rate at which the audio files should be digital...
SequenceFeatureExtractor
python
dask__distributed
distributed/tests/test_utils_test.py
{ "start": 9023, "end": 33708 }
class ____(Server): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.handlers["ping"] = self.pong self.counter = 0 def pong(self, comm): self.counter += 1 return "pong" @gen_test() async def test_locked_comm_drop_in_replacement(loop): asy...
MyServer
python
django__django
tests/admin_changelist/models.py
{ "start": 2944, "end": 3263 }
class ____(models.Model): """ Model with Manager that defines a default order. Refs #17198. """ name = models.CharField(max_length=255) bool = models.BooleanField(default=True) number = models.IntegerField(default=0, db_column="number_val") objects = OrderedObjectManager()
OrderedObject
python
getsentry__sentry
tests/sentry/core/endpoints/test_team_stats.py
{ "start": 285, "end": 1351 }
class ____(APITestCase): def test_simple(self) -> None: self.login_as(user=self.user) team = self.create_team(members=[self.user]) project_1 = self.create_project(teams=[team], name="a") project_2 = self.create_project(teams=[team], name="b") team_2 = self.create_team(member...
TeamStatsTest
python
pytorch__pytorch
torch/nn/modules/activation.py
{ "start": 60400, "end": 61781 }
class ____(Module): r"""Applies the :math:`\log(\text{Softmax}(x))` function to an n-dimensional input Tensor. The LogSoftmax formulation can be simplified as: .. math:: \text{LogSoftmax}(x_{i}) = \log\left(\frac{\exp(x_i) }{ \sum_j \exp(x_j)} \right) Shape: - Input: :math:`(*)` where...
LogSoftmax
python
pypa__pipenv
pipenv/exceptions.py
{ "start": 5683, "end": 6106 }
class ____(PipenvFileError): def __init__(self, filename="Pipfile", extra=None, **kwargs): extra = kwargs.pop("extra", []) message = "{} {}".format( "[bold red]Aborting![/bold red]", "[bold]Please ensure that the file exists and is located in your project root directory.[/bol...
PipfileNotFound
python
kennethreitz__tablib
src/tablib/formats/_jira.py
{ "start": 90, "end": 1087 }
class ____: title = 'jira' @classmethod def export_set(cls, dataset): """Formats the dataset according to the Jira table syntax: ||heading 1||heading 2||heading 3|| |col A1|col A2|col A3| |col B1|col B2|col B3| :param dataset: dataset to serialize :type dat...
JIRAFormat
python
kamyu104__LeetCode-Solutions
Python/maximum-number-of-occurrences-of-a-substring.py
{ "start": 1085, "end": 1633 }
class ____(object): def maxFreq(self, s, maxLetters, minSize, maxSize): """ :type s: str :type maxLetters: int :type minSize: int :type maxSize: int :rtype: int """ lookup = {} for right in xrange(minSize-1, len(s)): word = s[right-...
Solution2
python
apache__airflow
airflow-core/src/airflow/models/asset.py
{ "start": 4639, "end": 6116 }
class ____(Base): """A table to store asset watchers.""" name: Mapped[str] = mapped_column( String(length=1500).with_variant( String( length=1500, # latin1 allows for more indexed length in mysql # and this field should only be ascii chars ...
AssetWatcherModel
python
walkccc__LeetCode
solutions/966. Vowel Spellchecker/966.py
{ "start": 0, "end": 771 }
class ____: def spellchecker(self, wordlist: list[str], queries: list[str]) -> list[str]: def lowerKey(word: str) -> str: return '$' + ''.join([c.lower() for c in word]) def vowelKey(word: str) -> str: return ''.join(['*' if c.lower() in 'aeiou' else c.lower() for c in word]) ans = [] di...
Solution
python
weaviate__weaviate-python-client
weaviate/collections/classes/config.py
{ "start": 64491, "end": 64872 }
class ____(_ConfigBase): vectorizer: Union[Vectorizers, str] model: Dict[str, Any] source_properties: Optional[List[str]] def to_dict(self) -> Dict[str, Any]: ret_dict = super().to_dict() if "sourceProperties" in ret_dict: ret_dict["properties"] = ret_dict.pop("sourcePropert...
_NamedVectorizerConfig
python
google__pytype
pytype_extensions/instrumentation_for_testing_test.py
{ "start": 2334, "end": 4238 }
class ____(unittest.TestCase): def testFakeNoCtor(self): orig_fake_obj = FakeNoCtor(3) obj = orig_fake_obj.Seal() assert_type(obj, NoCtor) for expected_call_count in (1, 2): self.assertEqual(ProductionCodePassNoCtor(obj), 600) fake_obj = i4t.Unseal(obj, FakeNoCtor) assert fake_obj i...
InstrumentationForTestingTest
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_set.py
{ "start": 71132, "end": 71274 }
class ____(_TestMethodsMutating, __TestCase): constructor1 = SetSubclass constructor2 = SetSubclass
TestMethodsMutating_Subclass_Subclass
python
pyca__cryptography
tests/x509/test_x509_ext.py
{ "start": 49064, "end": 51505 }
class ____: def test_not_all_oids(self): with pytest.raises(TypeError): x509.ExtendedKeyUsage(["notoid"]) # type:ignore[list-item] def test_iter_len(self): eku = x509.ExtendedKeyUsage( [ x509.ObjectIdentifier("1.3.6.1.5.5.7.3.1"), x509.Ob...
TestExtendedKeyUsage
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 175573, "end": 176117 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("owner_id", "setting_value", "client_mutation_id") owner_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="ownerId") setting_value = sgqlc.types.Field( s...
UpdateNotificationRestrictionSettingInput
python
doocs__leetcode
solution/2200-2299/2241.Design an ATM Machine/Solution.py
{ "start": 0, "end": 761 }
class ____: def __init__(self): self.d = [20, 50, 100, 200, 500] self.m = len(self.d) self.cnt = [0] * self.m def deposit(self, banknotesCount: List[int]) -> None: for i, x in enumerate(banknotesCount): self.cnt[i] += x def withdraw(self, amount: int) -> List[in...
ATM
python
pytorch__pytorch
test/fx/test_shape_inference.py
{ "start": 419, "end": 4171 }
class ____(unittest.TestCase): def test_infer_symbol_values(self): def mksym(shape_env, value, source, dynamic_dim) -> None: return shape_env.create_symintnode( shape_env.create_symbol( value, source=source, dynamic_dim=...
TestShapeInference
python
ray-project__ray
python/ray/exceptions.py
{ "start": 28469, "end": 28702 }
class ____(RayError): """Raised when the corresponding placement group was removed.""" def __str__(self): return "The placement group corresponding to this Actor has been removed." @PublicAPI
ActorPlacementGroupRemoved
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/dataclass8.py
{ "start": 374, "end": 516 }
class ____: name: str = "sample" dir_a: Path = Path.home().joinpath(f"source/{name}") dir_b: Path = dir_a.joinpath("path/to/b")
ClassC
python
numpy__numpy
numpy/_core/tests/test_defchararray.py
{ "start": 6412, "end": 6632 }
class ____(TestComparisons): """Ticket #1276""" def A(self): return np.array( [['abc', 'abcc', '123'], ['789', 'abc', 'xyz']], np.str_).view(np.char.chararray)
TestComparisonsMixed2
python
wandb__wandb
wandb/vendor/pygments/lexers/console.py
{ "start": 1105, "end": 4120 }
class ____(RegexLexer): """ Lexer for PyPy log files. .. versionadded:: 1.5 """ name = "PyPy Log" aliases = ["pypylog", "pypy"] filenames = ["*.pypylog"] mimetypes = ['application/x-pypylog'] tokens = { "root": [ (r"\[\w+\] \{jit-log-.*?$", Keyword, "jit-log"), ...
PyPyLogLexer
python
pytorch__pytorch
torch/_dynamo/variables/tensor.py
{ "start": 66623, "end": 68906 }
class ____(UserDefinedClassVariable): def call_function( self, tx: "InstructionTranslator", args: list[VariableTracker], kwargs: dict[str, VariableTracker], ) -> VariableTracker: # Handle `Subclass(existing_tensor, ...)` calls. from .torch_function import TensorWi...
TensorSubclassVariable
python
apache__airflow
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py
{ "start": 1941, "end": 15991 }
class ____(KubernetesPodOperator): """ Creates sparkApplication object in kubernetes cluster. .. seealso:: For more detail about Spark Application Object have a look at the reference: https://github.com/GoogleCloudPlatform/spark-on-k8s-operator/blob/v1beta2-1.3.3-3.1.1/docs/api-docs.md#spar...
SparkKubernetesOperator
python
sphinx-doc__sphinx
tests/roots/test-ext-autodoc/target/slots.py
{ "start": 0, "end": 59 }
class ____: """docstring""" __slots__ = ['attr']
Foo
python
dask__distributed
distributed/worker_state_machine.py
{ "start": 13633, "end": 14054 }
class ____(SendMessageToScheduler): op = "task-finished" key: Key run_id: int nbytes: int | None type: bytes # serialized class typename: str metadata: dict thread: int | None startstops: list[StartStop] __slots__ = tuple(__annotations__) def to_dict(self) -> dict[str, Any...
TaskFinishedMsg
python
facebookresearch__faiss
tests/torch_test_neural_net.py
{ "start": 7278, "end": 8931 }
class ____(unittest.TestCase): @torch.no_grad() def test_decode(self): torch.manual_seed(123) step = QINCoStep(d=16, K=20, L=2, h=8) codes = torch.randint(0, 20, (10, )) xhat = torch.randn(10, 16) ref_decode = step.decode(xhat, codes) # step2 = copy_QINCoStep(st...
TestQINCoStep
python
bokeh__bokeh
src/bokeh/models/labeling.py
{ "start": 2336, "end": 4141 }
class ____(LabelingPolicy): ''' Select labels based on a user-defined policy function. .. warning:: The explicit purpose of this Bokeh Model is to embed *raw JavaScript code* for a browser to execute. If any part of the code is derived from untrusted user inputs, then you must take appr...
CustomLabelingPolicy
python
walkccc__LeetCode
solutions/3096. Minimum Levels to Gain More Points/3096.py
{ "start": 0, "end": 310 }
class ____: def minimumLevels(self, possible: list[int]) -> int: n = len(possible) nums = [num if num == 1 else -1 for num in possible] prefix = list(itertools.accumulate(nums, initial=0)) for i in range(1, n): if prefix[i] > prefix[n] - prefix[i]: return i return -1
Solution
python
pypa__pipenv
pipenv/patched/pip/_vendor/rich/markup.py
{ "start": 453, "end": 8481 }
class ____(NamedTuple): """A tag in console markup.""" name: str """The tag name. e.g. 'bold'.""" parameters: Optional[str] """Any additional parameters after the name.""" def __str__(self) -> str: return ( self.name if self.parameters is None else f"{self.name} {self.param...
Tag
python
pypa__warehouse
warehouse/accounts/models.py
{ "start": 1854, "end": 10180 }
class ____(SitemapMixin, HasObservers, HasObservations, HasEvents, db.Model): __tablename__ = "users" __table_args__ = ( CheckConstraint("length(username) <= 50", name="users_valid_username_length"), CheckConstraint( "username ~* '^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$'", ...
User
python
getsentry__sentry
src/sentry/grouping/variants.py
{ "start": 693, "end": 2063 }
class ____(ABC): variant_name: str | None = None @property def contributes(self) -> bool: return True @property @abstractmethod def type(self) -> str: ... def get_hash(self) -> str | None: return None @property def key(self) -> str: return self.type @...
BaseVariant
python
scipy__scipy
scipy/stats/tests/test_distributions.py
{ "start": 258356, "end": 258694 }
class ____: # test for ticket:992 def setup_method(self): self.rng = np.random.default_rng(7556981556) def test_noexception(self): rvs = stats.norm.rvs(loc=(np.arange(5)), scale=np.ones(5), size=(10, 5), random_state=self.rng) assert_equal(rvs.shape, (10, 5...
TestArrayArgument
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 220808, "end": 221061 }
class ____(VegaLiteSchema): """ConditionalAxisNumberArray schema wrapper.""" _schema = {"$ref": "#/definitions/ConditionalAxisNumberArray"} def __init__(self, *args, **kwds): super().__init__(*args, **kwds)
ConditionalAxisNumberArray
python
apache__airflow
providers/openlineage/src/airflow/providers/openlineage/extractors/manager.py
{ "start": 2050, "end": 12873 }
class ____(LoggingMixin): """Class abstracting management of custom extractors.""" def __init__(self): super().__init__() self.extractors: dict[str, type[BaseExtractor]] = {} self.default_extractor = DefaultExtractor # Built-in Extractors like Bash and Python for extrac...
ExtractorManager
python
getsentry__sentry
src/sentry/search/events/datasets/spans_metrics.py
{ "start": 898, "end": 59350 }
class ____(DatasetConfig): missing_function_error = IncompatibleMetricsQuery nullable_metrics = { constants.SPAN_MESSAGING_LATENCY, constants.SPAN_METRICS_MAP["cache.item_size"], constants.SPAN_METRICS_MAP["ai.total_cost"], constants.SPAN_METRICS_MAP["ai.total_tokens.used"], ...
SpansMetricsDatasetConfig
python
pydata__xarray
xarray/tests/test_duck_array_ops.py
{ "start": 7852, "end": 9738 }
class ____(TestOps): @pytest.fixture(autouse=True) def setUp(self): import dask.array self.x = dask.array.from_array( [ [ [nan, nan, 2.0, nan], [nan, 5.0, 6.0, nan], [8.0, 9.0, 10.0, nan], ],...
TestDaskOps
python
PrefectHQ__prefect
src/prefect/workers/base.py
{ "start": 12774, "end": 14701 }
class ____(BaseModel): name: Optional[str] = Field( default=None, description="Name given to infrastructure created by a worker.", ) env: dict[str, Optional[str]] = Field( default_factory=dict, title="Environment Variables", description="Environment variables to set w...
BaseVariables
python
apache__airflow
providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_adls_list.py
{ "start": 1134, "end": 1602 }
class ____: @mock.patch("airflow.providers.microsoft.azure.operators.adls.AzureDataLakeHook") def test_execute(self, mock_hook): mock_hook.return_value.list.return_value = MOCK_FILES operator = ADLSListOperator(task_id=TASK_ID, path=TEST_PATH) files = operator.execute(None) moc...
TestAzureDataLakeStorageListOperator
python
ansible__ansible
test/units/module_utils/facts/test_facts.py
{ "start": 6770, "end": 6953 }
class ____(BaseTestFactsPlatform): platform_id = 'NetBSD' fact_class = virtual.netbsd.NetBSDVirtual collector_class = virtual.netbsd.NetBSDVirtualCollector
TestNetBSDVirtual
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/roles.py
{ "start": 3407, "end": 3459 }
class ____(SQLRole): __slots__ = ()
StructuralRole
python
python__mypy
mypy/semanal_namedtuple.py
{ "start": 2006, "end": 31406 }
class ____: def __init__( self, options: Options, api: SemanticAnalyzerInterface, msg: MessageBuilder ) -> None: self.options = options self.api = api self.msg = msg def analyze_namedtuple_classdef( self, defn: ClassDef, is_stub_file: bool, is_func_scope: bool ) ...
NamedTupleAnalyzer
python
doocs__leetcode
solution/2400-2499/2444.Count Subarrays With Fixed Bounds/Solution.py
{ "start": 0, "end": 389 }
class ____: def countSubarrays(self, nums: List[int], minK: int, maxK: int) -> int: j1 = j2 = k = -1 ans = 0 for i, v in enumerate(nums): if v < minK or v > maxK: k = i if v == minK: j1 = i if v == maxK: j2 =...
Solution
python
tensorflow__tensorflow
tensorflow/python/compiler/tensorrt/model_tests/model_handler.py
{ "start": 25284, "end": 25507 }
class ____(_ModelHandlerManagerBase): """Manages a series of ModelHandlers for aggregated testing/benchmarking in TF2.""" model_handler_cls = ModelHandlerV2 trt_model_handler_cls = TrtModelHandlerV2
ModelHandlerManagerV2
python
streamlit__streamlit
e2e_playwright/conftest.py
{ "start": 1683, "end": 2798 }
class ____(Page): pass def pytest_configure(config: pytest.Config) -> None: """Register custom markers.""" config.addinivalue_line( "markers", "no_perf: mark test to not use performance profiling" ) config.addinivalue_line( "markers", "app_hash(hash): mark test to open the app with...
StaticPage
python
altair-viz__altair
altair/vegalite/v6/schema/channels.py
{ "start": 554800, "end": 584092 }
class ____(FieldChannelMixin, core.FieldOrDatumDefWithConditionMarkPropFieldDefnumber): r""" Size schema wrapper. Parameters ---------- shorthand : str, dict, Sequence[str], :class:`RepeatRef` shorthand for field, aggregate, and type aggregate : dict, :class:`Aggregate`, :class:`ArgmaxD...
Size
python
scipy__scipy
scipy/sparse/linalg/tests/test_onenormest.py
{ "start": 8636, "end": 9300 }
class ____: @pytest.mark.thread_unsafe(reason="Fails in parallel for unknown reasons") def test_randn_inv(self): rng = np.random.RandomState(1234) n = 20 nsamples = 100 for i in range(nsamples): # Choose integer t uniformly between 1 and 3 inclusive. t =...
TestAlgorithm_2_2
python
mahmoud__boltons
boltons/typeutils.py
{ "start": 5514, "end": 5814 }
class ____: """Much like a :class:`property`, but the wrapped get function is a class method. For simplicity, only read-only properties are implemented. """ def __init__(self, fn): self.fn = fn def __get__(self, instance, cls): return self.fn(cls)
classproperty
python
scipy__scipy
scipy/optimize/tests/test__remove_redundancy.py
{ "start": 6446, "end": 6563 }
class ____(RRCommonTests): def rr(self, A, b): return _remove_redundancy_pivot_dense(A, b)
TestRRPivotDense
python
doocs__leetcode
solution/2700-2799/2731.Movement of Robots/Solution.py
{ "start": 0, "end": 336 }
class ____: def sumDistance(self, nums: List[int], s: str, d: int) -> int: mod = 10**9 + 7 for i, c in enumerate(s): nums[i] += d if c == "R" else -d nums.sort() ans = s = 0 for i, x in enumerate(nums): ans += i * x - s s += x retur...
Solution
python
plotly__plotly.py
plotly/graph_objs/layout/scene/annotation/_font.py
{ "start": 235, "end": 9918 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.scene.annotation" _path_str = "layout.scene.annotation.font" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "variant", "weight"...
Font
python
tensorflow__tensorflow
tensorflow/python/ops/data_flow_ops.py
{ "start": 31702, "end": 35045 }
class ____(QueueBase): """A queue implementation that dequeues elements in first-in first-out order. GPUCompatibleFIFOQueue is like FIFOQueue, but the queue resource may be placed either on a CPU or on a GPU. It is not cross-device: enqueues and dequeues will be colocated with the queue resource. GPUCompatible...
GPUCompatibleFIFOQueue
python
celery__celery
t/unit/worker/test_bootsteps.py
{ "start": 1329, "end": 2713 }
class ____: class Def(bootsteps.StartStopStep): name = 'test_Step.Def' def setup_method(self): self.steps = [] def test_blueprint_name(self, bp='test_blueprint_name'): class X(bootsteps.Step): blueprint = bp name = 'X' assert X.name == 'X' ...
test_Step
python
great-expectations__great_expectations
great_expectations/expectations/core/expect_table_columns_to_match_set.py
{ "start": 2907, "end": 23963 }
class ____(BatchExpectation): __doc__ = f"""{EXPECTATION_SHORT_DESCRIPTION} ExpectTableColumnsToMatchSet is a \ Batch Expectation. BatchExpectations are one of the most common types of Expectation. They are evaluated for an entire Batch, and answer a semantic question about the Batch itself. ...
ExpectTableColumnsToMatchSet
python
matplotlib__matplotlib
lib/matplotlib/_mathtext.py
{ "start": 2881, "end": 5669 }
class ____: r""" Result of `ship`\ping a box: lists of positioned glyphs and rectangles. This class is not exposed to end users, but converted to a `VectorParse` or a `RasterParse` by `.MathTextParser.parse`. """ def __init__(self, box: Box): self.box = box self.glyphs: list[tu...
Output
python
spack__spack
lib/spack/spack/solver/asp.py
{ "start": 9585, "end": 20672 }
class ____: """Result of an ASP solve.""" def __init__(self, specs, asp=None): self.asp = asp self.satisfiable = None self.optimal = None self.warnings = None self.nmodels = 0 # Saved control object for reruns when necessary self.control = None ...
Result
python
RaRe-Technologies__gensim
gensim/test/test_phrases.py
{ "start": 18820, "end": 19344 }
class ____(PhrasesCommon, unittest.TestCase): """Test FrozenPhrases models.""" def setUp(self): """Set up FrozenPhrases models for the tests.""" bigram_phrases = Phrases( self.sentences, min_count=1, threshold=1, connector_words=self.connector_words) self.bigram = FrozenPhra...
TestFrozenPhrasesModel
python
getsentry__sentry
tests/sentry/issues/test_issue_search.py
{ "start": 17228, "end": 17853 }
class ____(TestCase): def test_me(self) -> None: result = convert_user_value(["me"], [self.project], self.user, None) assert result[0].id == self.user.id assert result[0].username == self.user.username def test_specified_user(self) -> None: user = self.create_user() resu...
ConvertUserValueTest
python
kamyu104__LeetCode-Solutions
Python/minimum-time-for-k-virus-variants-to-spread.py
{ "start": 4248, "end": 5970 }
class ____(object): def minDayskVariants(self, points, k): """ :type points: List[List[int]] :type k: int :rtype: int """ def add_rec(rec, intervals): x0, y0, x1, y1 = rec # add [y0, y1+1) by 1 in [x0, x1+1) intervals[x0][y0] += 1 ...
Solution2
python
getsentry__sentry
tests/sentry/incidents/models/test_alert_rule.py
{ "start": 9591, "end": 11082 }
class ____: method: str def setUp(self) -> None: self.suspended_registry = TemporaryAlertRuleTriggerActionRegistry.suspend() def tearDown(self) -> None: self.suspended_registry.restore() def test_no_handler(self) -> None: trigger = AlertRuleTriggerAction(type=AlertRuleTriggerA...
AlertRuleTriggerActionActivateBaseTest
python
mlflow__mlflow
tests/sklearn/test_sklearn_model_export.py
{ "start": 2145, "end": 34669 }
class ____(NamedTuple): model: Any inference_data: Any @pytest.fixture(scope="module") def iris_df(): iris = datasets.load_iris() X = iris.data y = iris.target X_df = pd.DataFrame(X, columns=iris.feature_names) X_df = X_df.iloc[:, :2] # we only take the first two features. y_series = ...
ModelWithData
python
matplotlib__matplotlib
lib/mpl_toolkits/axisartist/axislines.py
{ "start": 2005, "end": 3762 }
class ____: """ Base class for axis helper. Subclasses should define the methods listed below. The *axes* argument will be the ``.axes`` attribute of the caller artist. :: # Construct the spine. def get_line_transform(self, axes): return transform def get_line(se...
_AxisArtistHelperBase
python
scipy__scipy
scipy/optimize/tests/test__shgo.py
{ "start": 39217, "end": 42350 }
class ____: def test_1_nfev_simplicial(self): bounds = [(0, 2), (0, 2), (0, 2), (0, 2), (0, 2)] def fun(x): fun.nfev += 1 return rosen(x) fun.nfev = 0 result = shgo(fun, bounds) np.testing.assert_equal(fun.nfev, result.nfev) def test_1_nfev_sob...
TestShgoReturns
python
huggingface__transformers
src/transformers/models/qwen2/configuration_qwen2.py
{ "start": 917, "end": 8633 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`Qwen2Model`]. It is used to instantiate a Qwen2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configura...
Qwen2Config
python
kamyu104__LeetCode-Solutions
Python/maximize-the-number-of-target-nodes-after-connecting-trees-i.py
{ "start": 3588, "end": 5429 }
class ____(object): def maxTargetNodes(self, edges1, edges2, k): """ :type edges1: List[List[int]] :type edges2: List[List[int]] :type k: int :rtype: List[int] """ def tree_dp(adj, k): def dfs1(u, p): for v in adj[u]: ...
Solution2
python
tensorflow__tensorflow
tensorflow/python/ops/ragged/ragged_eager_test.py
{ "start": 1006, "end": 2223 }
class ____(test_util.TensorFlowTestCase, parameterized.TestCase): @parameterized.parameters([ dict(pylist=[[b'a', b'b'], [b'c']]), dict(pylist=[[[1, 2], [3]], [[4, 5, 6], [], [7]]]), dict(pylist=[[[1, 2], [3, 4]], [[5, 6], [], [7, 8]]], ragged_rank=1), ]) def testRaggedTe...
RaggedTensorTest
python
getsentry__sentry
tests/sentry/rules/history/endpoints/test_project_rule_stats.py
{ "start": 1048, "end": 2669 }
class ____(APITestCase): endpoint = "sentry-api-0-project-rule-stats-index" def test(self) -> None: rule = Rule.objects.create(project=self.event.project) rule_2 = Rule.objects.create(project=self.event.project) history = [] for i in range(3): for _ in range(i + 1):...
ProjectRuleStatsIndexEndpointTest
python
scipy__scipy
scipy/ndimage/tests/test_interpolation.py
{ "start": 17819, "end": 22702 }
class ____: @pytest.mark.parametrize('order', range(0, 6)) @pytest.mark.parametrize('dtype', [np.float64, np.complex128]) def test_map_coordinates01(self, order, dtype, xp): if is_jax(xp) and order > 1: pytest.xfail("jax map_coordinates requires order <= 1") data = xp.asarray([...
TestMapCoordinates