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
pytorch__pytorch
torch/compiler/_cache.py
{ "start": 1768, "end": 3419 }
class ____: """ Factory for creating CacheArtifact objects based on their type """ _artifact_types: dict[str, type[CacheArtifact]] = {} @classmethod def register(cls, artifact_cls: type[CacheArtifact]) -> type[CacheArtifact]: artifact_type_key = artifact_cls.type() assert artif...
CacheArtifactFactory
python
huggingface__transformers
src/transformers/models/codegen/modeling_codegen.py
{ "start": 9216, "end": 10037 }
class ____(nn.Module): def __init__(self, intermediate_size, config): # in MLP: intermediate_size= 4 * embed_dim super().__init__() embed_dim = config.n_embd self.fc_in = nn.Linear(embed_dim, intermediate_size) self.fc_out = nn.Linear(intermediate_size, embed_dim) self.act...
CodeGenMLP
python
huggingface__transformers
src/transformers/models/siglip2/modular_siglip2.py
{ "start": 4866, "end": 4912 }
class ____(SiglipConfig): pass
Siglip2Config
python
wandb__wandb
wandb/sdk/artifacts/_generated/add_artifact_collection_tags.py
{ "start": 222, "end": 322 }
class ____(GQLResult): result: Optional[AddArtifactCollectionTagsResult]
AddArtifactCollectionTags
python
numba__numba
numba/tests/test_nrt_refct.py
{ "start": 240, "end": 2911 }
class ____(EnableNRTStatsMixin, TestCase): def setUp(self): # Clean up any NRT-backed objects hanging in a dead reference cycle gc.collect() super(TestNrtRefCt, self).setUp() def test_no_return(self): """ Test issue #1291 """ @njit def foo(n): ...
TestNrtRefCt
python
huggingface__transformers
src/transformers/models/trocr/processing_trocr.py
{ "start": 989, "end": 3565 }
class ____(ProcessorMixin): r""" Constructs a TrOCR processor which wraps a vision image processor and a TrOCR tokenizer into a single processor. [`TrOCRProcessor`] offers all the functionalities of [`ViTImageProcessor`/`DeiTImageProcessor`] and [`RobertaTokenizer`/`XLMRobertaTokenizer`]. See the [`~Tr...
TrOCRProcessor
python
huggingface__transformers
src/transformers/models/git/modeling_git.py
{ "start": 36236, "end": 46673 }
class ____(GitPreTrainedModel): def __init__(self, config): super().__init__(config) self.config = config self.embeddings = GitEmbeddings(config) self.image_encoder = GitVisionModel(config.vision_config) self.encoder = GitEncoder(config) self.visual_projection = Git...
GitModel
python
allegroai__clearml
clearml/backend_api/services/v2_9/workers.py
{ "start": 56579, "end": 58040 }
class ____(Request): """ Returns worker statistics metric keys grouped by categories. :param worker_ids: List of worker ids to collect metrics for. If not provided or empty then all the company workers metrics are analyzed. :type worker_ids: Sequence[str] """ _service = "workers" _...
GetMetricKeysRequest
python
django__django
tests/app_loading/tests.py
{ "start": 127, "end": 2607 }
class ____(SimpleTestCase): def setUp(self): self.egg_dir = "%s/eggs" % os.path.dirname(__file__) self.addCleanup(apps.clear_cache) def test_egg1(self): """Models module can be loaded from an app in an egg""" egg_name = "%s/modelapp.egg" % self.egg_dir with extend_sys_pa...
EggLoadingTest
python
getsentry__sentry
tests/sentry/workflow_engine/processors/test_data_condition_group.py
{ "start": 4122, "end": 5051 }
class ____(TestCase): def setUp(self) -> None: self.data_condition_group = self.create_data_condition_group( logic_type=DataConditionGroup.Type.ANY ) self.data_condition = self.create_data_condition( type=Condition.GREATER, comparison=5, condi...
TestEvaluationConditionCase
python
joke2k__faker
faker/providers/address/es_CL/__init__.py
{ "start": 144, "end": 19785 }
class ____(AddressProvider): # Source for regions, provinces and communes # https://www.subdere.gov.cl/documentacion/c%C3%B3digos-%C3%BAnicos- # territoriales-actualizados-al-06-de-septiembre-2018 regions: Dict[str, str] = { "TA": "Región de Tarapacá", "AN": "Región de Antofagasta", ...
Provider
python
airbytehq__airbyte
airbyte-integrations/connectors/source-braintree/source_braintree/schemas/cards.py
{ "start": 1722, "end": 2085 }
class ____(CreditCard): """ https://developer.paypal.com/braintree/docs/reference/response/android-pay-card """ google_transaction_id: str source_card_type: str source_description: str is_network_tokenized: bool source_card_last_4: str source_card_type: str virtual_card_last_4: ...
AndroidPayCard
python
allegroai__clearml
clearml/utilities/requests_toolbelt/multipart/decoder.py
{ "start": 850, "end": 1990 }
class ____(object): """ The ``BodyPart`` object is a ``Response``-like interface to an individual subpart of a multipart response. It is expected that these will generally be created by objects of the ``MultipartDecoder`` class. Like ``Response``, there is a ``CaseInsensitiveDict`` object named he...
BodyPart
python
getsentry__sentry
src/sentry/analytics/events/api_token_created.py
{ "start": 74, "end": 183 }
class ____(analytics.Event): user_id: int | None = None analytics.register(ApiTokenCreated)
ApiTokenCreated
python
joblib__joblib
joblib/numpy_pickle_compat.py
{ "start": 4163, "end": 5505 }
class ____(NDArrayWrapper): """An object to be persisted instead of numpy arrays. This object store the Zfile filename in which the data array has been persisted, and the meta information to retrieve it. The reason that we store the raw buffer data of the array and the meta information, rather ...
ZNDArrayWrapper
python
spack__spack
lib/spack/spack/vendor/markupsafe/__init__.py
{ "start": 7825, "end": 8934 }
class ____: """Helper for :meth:`Markup.__mod__`.""" __slots__ = ("obj", "escape") def __init__(self, obj: t.Any, escape: t.Callable[[t.Any], Markup]) -> None: self.obj = obj self.escape = escape def __getitem__(self, item: t.Any) -> "_MarkupEscapeHelper": return _MarkupEscape...
_MarkupEscapeHelper
python
readthedocs__readthedocs.org
readthedocs/api/v3/serializers.py
{ "start": 30425, "end": 30808 }
class ____(ProjectSerializer): """ Serializer to render a Project when listed under ProjectRelationship. It's exactly the same as ``ProjectSerializer`` but without some fields. """ class Meta(ProjectSerializer.Meta): fields = [ field for field in ProjectSerializer.Meta.fields i...
ChildProjectSerializer
python
qdrant__qdrant-client
qdrant_client/local/sparse_distances.py
{ "start": 2449, "end": 10351 }
class ____: def __init__(self, context_pairs: list[SparseContextPair]): self.context_pairs = context_pairs def transform_sparse( self, foo: Callable[["SparseVector"], "SparseVector"] ) -> "SparseContextQuery": return SparseContextQuery( context_pairs=[ Sp...
SparseContextQuery
python
dagster-io__dagster
python_modules/dagster/dagster/_core/snap/dep_snapshot.py
{ "start": 6651, "end": 7744 }
class ____( NamedTuple( "_InputDependencySnap", [ ("input_name", str), ("upstream_output_snaps", Sequence[OutputHandleSnap]), ("is_dynamic_collect", bool), ], ) ): def __new__( cls, input_name: str, upstream_output_snaps: Se...
InputDependencySnap
python
tensorflow__tensorflow
tensorflow/python/util/deprecation_test.py
{ "start": 40271, "end": 40975 }
class ____(test.TestCase): def testSingleDeprecatedEndpoint(self): @deprecation.deprecated_endpoints("foo1") def foo(): pass self.assertEqual(("foo1",), foo._tf_deprecated_api_names) def testMultipleDeprecatedEndpoint(self): @deprecation.deprecated_endpoints("foo1", "foo2") def foo(): ...
DeprecatedEndpointsTest
python
astropy__astropy
astropy/units/tests/test_logarithmic.py
{ "start": 7638, "end": 11708 }
class ____: @pytest.mark.parametrize("physical_unit", pu_sample) @pytest.mark.parametrize("lu_unit", lu_units) def test_physical_unit_conversion(self, lu_unit, physical_unit): """Check various LogUnit subclasses are equivalent and convertible to their non-log counterparts.""" lu1 = l...
TestLogUnitConversion
python
python__mypy
mypyc/ir/ops.py
{ "start": 45649, "end": 46782 }
class ____(RegisterOp): """Binary float arithmetic op (e.g., r1 = r2 + r3). These ops are low-level and are similar to the corresponding C operations (and somewhat different from Python operations). The left and right values must be floats. """ error_kind = ERR_NEVER ADD: Final = 0 S...
FloatOp
python
jazzband__django-polymorphic
src/polymorphic/tests/models.py
{ "start": 11861, "end": 12048 }
class ____(SubclassSelectorAbstractBaseModel): abstract_field = models.CharField(max_length=30, default="test_af") class Meta: abstract = True
SubclassSelectorAbstractModel
python
geekcomputers__Python
venv/Lib/site-packages/pip/_vendor/idna/codec.py
{ "start": 1805, "end": 2885 }
class ____(codecs.BufferedIncrementalDecoder): def _buffer_decode(self, data: Any, errors: str, final: bool) -> Tuple[str, int]: if errors != 'strict': raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) if not data: return ('', 0) if not isinstance(...
IncrementalDecoder
python
walkccc__LeetCode
solutions/149. Max Points on a Line/149.py
{ "start": 0, "end": 899 }
class ____: def maxPoints(self, points: list[list[int]]) -> int: ans = 0 def gcd(a: int, b: int) -> int: return a if b == 0 else gcd(b, a % b) def getSlope(p: list[int], q: list[int]) -> tuple[int, int]: dx = p[0] - q[0] dy = p[1] - q[1] if dx == 0: return (0, p[0]) ...
Solution
python
skorch-dev__skorch
skorch/_version.py
{ "start": 7833, "end": 14342 }
class ____(_BaseVersion): _regex = re.compile( r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE, ) def __init__(self, version): # Validate the version and parse it into pieces match = self._regex.search(version) if not match: raise Invalid...
Version
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 58418, "end": 59535 }
class ____(Operation): def __init__(self, shape, *, name=None): super().__init__(name=name) self.shape = shape def call(self, x): return backend.numpy.broadcast_to(x, self.shape) def compute_output_spec(self, x): # Catch broadcasting errors for clear error messages. ...
BroadcastTo
python
sqlalchemy__sqlalchemy
test/sql/test_compiler.py
{ "start": 223003, "end": 224317 }
class ____(fixtures.TestBase): @classmethod def setup_test_class(cls): class CatchCol(ColumnClause): pass class CatchTable(TableClause): pass cls.column = CatchCol("x") cls.table = CatchTable("y") cls.criterion = cls.column == CatchCol("y") ...
KwargPropagationTest
python
getsentry__sentry
src/sentry/api/endpoints/rule_snooze.py
{ "start": 2838, "end": 3050 }
class ____(CamelSnakeSerializer): target = serializers.CharField(required=True, allow_null=False) until = serializers.DateTimeField(required=False, allow_null=True) @register(RuleSnooze)
RuleSnoozeValidator
python
oauthlib__oauthlib
tests/oauth2/rfc6749/clients/test_service_application.py
{ "start": 229, "end": 7569 }
class ____(TestCase): gt = ServiceApplicationClient.grant_type private_key = """ -----BEGIN RSA PRIVATE KEY----- MIICXgIBAAKBgQDk1/bxyS8Q8jiheHeYYp/4rEKJopeQRRKKpZI4s5i+UPwVpupG AlwXWfzXwSMaKPAoKJNdu7tqKRniqst5uoHXw98gj0x7zamu0Ck1LtQ4c7pFMVah 5IYGhBi2E9ycNS329W27nJPWNCbESTu7snVlG8V8mfvGGg3xNjTMO7IdrwIDAQAB Ao...
ServiceApplicationClientTest
python
apache__airflow
devel-common/src/tests_common/_internals/capture_warnings.py
{ "start": 4809, "end": 10462 }
class ____: """Internal plugin for capture warnings during the tests run.""" node_key: str = "capture_warnings_node" def __init__(self, config: pytest.Config, output_path: str | None = None): output_path = output_path or os.environ.get("CAPTURE_WARNINGS_OUTPUT") or "warnings.txt" warning_o...
CaptureWarningsPlugin
python
pypa__pip
src/pip/_internal/network/session.py
{ "start": 10698, "end": 19188 }
class ____(requests.Session): timeout: int | None = None def __init__( self, *args: Any, retries: int = 0, cache: str | None = None, trusted_hosts: Sequence[str] = (), index_urls: list[str] | None = None, ssl_context: SSLContext | None = None, **k...
PipSession
python
PyCQA__pylint
tests/functional/i/invalid/invalid_metaclass.py
{ "start": 1179, "end": 1265 }
class ____(metaclass=invalid_metaclass_2): # [invalid-metaclass] pass
InvalidSecond
python
tensorflow__tensorflow
tensorflow/python/data/kernel_tests/unbatch_test.py
{ "start": 1632, "end": 9969 }
class ____(test_base.DatasetTestBase, parameterized.TestCase): @combinations.generate(test_base.default_test_combinations()) def testUnbatchWithUnknownRankInput(self): dataset = dataset_ops.Dataset.from_tensors([0, 1, 2, 3]).unbatch() self.assertDatasetProduces(dataset, range(4)) @combinations.generate(...
UnbatchTest
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_rich_string07.py
{ "start": 315, "end": 1361 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("rich_string07.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got...
TestCompareXLSXFiles
python
pallets__werkzeug
examples/couchy/utils.py
{ "start": 1516, "end": 2718 }
class ____: def __init__(self, results, per_page, page, endpoint): self.results = results self.per_page = per_page self.page = page self.endpoint = endpoint @cached_property def count(self): return len(self.results) @cached_property def entries(self): ...
Pagination
python
openai__openai-python
tests/api_resources/fine_tuning/test_jobs.py
{ "start": 13404, "end": 27279 }
class ____: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @parametrize async def test_method_create(self, async_client: AsyncOpenAI) -> None: job = await async_client.fine_tuning.jobs...
TestAsyncJobs
python
huggingface__transformers
src/transformers/models/phi/modeling_phi.py
{ "start": 1473, "end": 7958 }
class ____(nn.Module): inv_freq: torch.Tensor # fix linting for `register_buffer` def __init__(self, config: PhiConfig, device=None): super().__init__() self.max_seq_len_cached = config.max_position_embeddings self.original_max_seq_len = config.max_position_embeddings self.con...
PhiRotaryEmbedding
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 339022, "end": 339871 }
class ____(sgqlc.types.Input): """Autogenerated input type of UpdateEnterpriseMembersCanDeleteIssuesSetting """ __schema__ = github_schema __field_names__ = ("enterprise_id", "setting_value", "client_mutation_id") enterprise_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="enterpr...
UpdateEnterpriseMembersCanDeleteIssuesSettingInput
python
jina-ai__jina
tests/integration/streaming/test_streaming.py
{ "start": 223, "end": 1520 }
class ____(Executor): @requests(on='/hello') async def task(self, doc: Document, **kwargs): for i in range(100): yield Document(text=f'{doc.text} {i}') @requests(on='/world') async def non_gen_task(self, docs: DocumentArray, **kwargs): return docs @pytest.mark.asyncio @pyt...
MyExecutor
python
django__django
tests/utils_tests/test_inspect.py
{ "start": 260, "end": 652 }
class ____: def no_arguments(self): return None def one_argument(self, something): return something def just_args(self, *args): return args def all_kinds(self, name, address="home", age=25, *args, **kwargs): return kwargs @classmethod def cls_all_kinds(cls, na...
Person
python
numba__numba
numba/tests/test_dyn_array.py
{ "start": 22541, "end": 22800 }
class ____(TestNdZeros): def setUp(self): super(TestNdOnes, self).setUp() self.pyfunc = np.ones @unittest.expectedFailure def test_1d_dtype_str_structured_dtype(self): super().test_1d_dtype_str_structured_dtype()
TestNdOnes
python
pytorch__pytorch
torch/_dynamo/output_graph.py
{ "start": 9608, "end": 12254 }
class ____: """ A base class containing fields that are considered "persistent" when we want to save all the important state for reconstrucing guards in a different process. Normally we don't need to add states here, but we may have to when the information is needed to serialize the guards, so the f...
OutputGraphGuardsState
python
arrow-py__arrow
tests/test_locales.py
{ "start": 97220, "end": 98692 }
class ____: def test_format_timeframe(self): assert self.locale._format_timeframe("now", 0) == "dabar" assert self.locale._format_timeframe("second", 1) == "sekundės" assert self.locale._format_timeframe("seconds", 3) == "3 sekundžių" assert self.locale._format_timeframe("seconds", 3...
TestLithuanianLocale
python
gevent__gevent
src/gevent/resolver/dnspython.py
{ "start": 7592, "end": 8137 }
class ____(dns.resolver.Answer): # Answer class for HostsResolver object def __init__(self, qname, rdtype, rdclass, rrset, raise_on_no_answer=True): self.response = None self.qname = qname self.rdtype = rdtype self.rdclass = rdclass self.canonical_name = qname if...
_HostsAnswer
python
astropy__astropy
astropy/utils/data.py
{ "start": 70403, "end": 84778 }
class ____(ValueError): """Record the URL or file that was a problem. Using clear_download_cache on the .bad_file or .bad_url attribute, whichever is not None, should resolve this particular problem. """ def __init__(self, *args, bad_urls=None, bad_files=None, **kwargs): super().__init__(*a...
CacheDamaged
python
coleifer__peewee
tests/regressions.py
{ "start": 27301, "end": 28399 }
class ____(ModelTestCase): @requires_models(RS, RD) def test_regression_count_distinct(self): rs = RS.create(name='rs') nums = [0, 1, 2, 3, 2, 1, 0] RD.insert_many([('k%s' % i, i, rs) for i in nums]).execute() query = RD.select(RD.key).distinct() self.assertEqual(query....
TestRegressionCountDistinct
python
run-llama__llama_index
llama-index-integrations/postprocessor/llama-index-postprocessor-bedrock-rerank/llama_index/postprocessor/bedrock_rerank/base.py
{ "start": 626, "end": 8949 }
class ____(BaseNodePostprocessor): top_n: int = Field(default=2, description="Top N nodes to return.") rerank_model_name: str = Field( default=Models.COHERE_RERANK_V3_5.value, description="The modelId of the Bedrock model to use.", ) rerank_model_arn: Optional[str] = Field( defau...
BedrockRerank
python
automl__auto-sklearn
autosklearn/pipeline/components/classification/bernoulli_nb.py
{ "start": 492, "end": 2942 }
class ____(AutoSklearnClassificationAlgorithm): def __init__(self, alpha, fit_prior, random_state=None, verbose=0): self.alpha = alpha self.fit_prior = fit_prior self.random_state = random_state self.verbose = int(verbose) self.estimator = None def fit(self, X, y): ...
BernoulliNB
python
pytorch__pytorch
test/fx/test_partitioner_order.py
{ "start": 787, "end": 922 }
class ____(torch.nn.Module): def forward(self, x): y = torch.add(x, x) z = torch.add(y, x) return z
AddModule
python
airbytehq__airbyte
airbyte-integrations/connectors/source-google-ads/source_google_ads/config_migrations.py
{ "start": 710, "end": 4405 }
class ____: """ This class stands for migrating the config at runtime. This migration is backwards compatible with the previous version, as new property will be created. When falling back to the previous source version connector will use old property `custom_queries`. Add `segments.date` for all qu...
MigrateCustomQuery
python
pytest-dev__pytest-xdist
src/xdist/remote.py
{ "start": 860, "end": 1812 }
class ____: """ Simplified implementation of the same interface as py.log, for backward compatibility since we dropped the dependency on pylib. Note: this is defined here because this module can't depend on xdist, so we need to have the other way around. """ def __init__(self, name: str, *,...
Producer
python
great-expectations__great_expectations
great_expectations/exceptions/exceptions.py
{ "start": 6126, "end": 6738 }
class ____(GreatExpectationsError): def __init__(self, result_dict) -> None: template = """\ Invalid result values were found when trying to instantiate an ExpectationValidationResult. - Invalid result values are likely caused by inconsistent cache values. - Great Expectations enables caching by default. - ...
InvalidCacheValueError
python
airbytehq__airbyte
airbyte-integrations/connectors/source-mixpanel/source_mixpanel/streams.py
{ "start": 9727, "end": 12934 }
class ____(HttpStatusErrorHandler): """ Custom error handler for handling export errors specific to Mixpanel streams. This handler addresses: - 400 status code with "to_date cannot be later than today" message, indicating a potential timezone mismatch. - ConnectionResetError during response parsing...
ExportErrorHandler
python
pallets__quart
src/quart/ctx.py
{ "start": 5936, "end": 7657 }
class ____(_BaseRequestWebsocketContext): """The context relating to the specific websocket, bound to the current task. Do not use directly, prefer the :func:`~quart.Quart.websocket_context` or :func:`~quart.Quart.test_websocket_context` instead. Attributes: _after_websocket_functions: Lis...
WebsocketContext
python
Textualize__textual
docs/examples/styles/scrollbar_corner_color.py
{ "start": 385, "end": 633 }
class ____(App): CSS_PATH = "scrollbar_corner_color.tcss" def compose(self): yield Label(TEXT.replace("\n", " ") + "\n" + TEXT * 10) if __name__ == "__main__": app = ScrollbarCornerColorApp() app.run()
ScrollbarCornerColorApp
python
pytorch__pytorch
torch/fx/experimental/symbolic_shapes.py
{ "start": 83000, "end": 83621 }
class ____(StatefulSymbolicContext): """ The correct symbolic context for a given inner tensor of a traceable tensor subclass may differ from that of the outer symbolic context. This structure allows for this flexibility, with inner symbolic contexts mapped via attr -> symbolic context. """ inn...
SubclassSymbolicContext
python
sqlalchemy__sqlalchemy
test/orm/test_manytomany.py
{ "start": 542, "end": 12072 }
class ____(fixtures.MappedTest): @classmethod def define_tables(cls, metadata): Table( "place", metadata, Column( "place_id", Integer, test_needs_autoincrement=True, primary_key=True, ), ...
M2MTest
python
facebookresearch__faiss
tests/test_fast_scan.py
{ "start": 2374, "end": 4130 }
class ____(unittest.TestCase): def do_test_rounding(self, implem=4, metric=faiss.METRIC_L2): ds = datasets.SyntheticDataset(32, 2000, 5000, 200) index = faiss.index_factory(32, 'PQ16x4', metric) index.train(ds.get_train()) index.add(ds.get_database()) Dref, Iref = index.sea...
TestRounding
python
getsentry__sentry
fixtures/integrations/jira/stub_client.py
{ "start": 144, "end": 2122 }
class ____(StubService): service_name = "jira" def get_create_meta_for_project(self, project): response = self._get_stub_data("createmeta_response.json") if project == "10001": response["projects"][0]["id"] = "10001" return response["projects"][0] def get_issue_fields(s...
StubJiraApiClient
python
apache__airflow
airflow-core/tests/unit/serialization/test_serde.py
{ "start": 5535, "end": 5638 }
class ____(BaseModel): __version__: ClassVar[int] = 1 x: int v: V u: tuple @attr.define
U
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pylint/eq_without_hash.py
{ "start": 957, "end": 1063 }
class ____: try: ... except Exception: def __eq__(self, other): ...
MaybeEqTryExcept
python
getsentry__sentry
src/sentry/workflow_engine/handlers/condition/event_frequency_handlers.py
{ "start": 1994, "end": 3326 }
class ____(DataConditionHandler[list[int]]): group = DataConditionHandler.Group.ACTION_FILTER subgroup = DataConditionHandler.Subgroup.FREQUENCY comparison_json_schema = { "type": "object", "properties": { "interval": {"type": "string", "enum": list(STANDARD_INTERVALS.keys())}, ...
EventFrequencyPercentHandler
python
kamyu104__LeetCode-Solutions
Python/lexicographically-smallest-string-after-reverse.py
{ "start": 2714, "end": 2927 }
class ____(object): def lexSmallest(self, s): """ :type s: str :rtype: str """ return min(min(s[:k][::-1]+s[k:], s[:-k]+s[-k:][::-1]) for k in xrange(1, len(s)+1))
Solution3
python
tensorflow__tensorflow
tensorflow/examples/speech_commands/accuracy_utils.py
{ "start": 779, "end": 6049 }
class ____(object): """Get streaming accuracy statistics every time a new command is founded. Attributes: _how_many_gt: How many ground truths. _how_many_gt_matched: How many ground truths have been matched. _how_many_fp: How many commands have been fired as false positive. _how_many_c: H...
StreamingAccuracyStats
python
eventlet__eventlet
eventlet/green/thread.py
{ "start": 1313, "end": 4964 }
class ____: def __init__(self, greenthread=None): self._greenthread = greenthread self._done = False def _set_done(self): self._done = True def is_done(self): if self._greenthread is not None: return self._greenthread.dead return self._done @propert...
_ThreadHandle
python
google__jax
docs/autodidax.py
{ "start": 87104, "end": 106360 }
class ____(NamedTuple): aval: ShapedArray register_pytree_node(UndefPrimal, lambda u: (u.aval, ()), lambda aval, _: UndefPrimal(aval)) # - # We use `UndefPrimal` instances to indicate which arguments with respect to # which we want to transpose. These arise because in gen...
UndefPrimal
python
joke2k__faker
faker/providers/person/ro_RO/__init__.py
{ "start": 44, "end": 14167 }
class ____(PersonProvider): formats_female = ( "{{first_name_female}} {{last_name}}", "{{first_name_female}} {{last_name}}", "{{first_name_female}} {{last_name}}", "{{first_name_female}} {{first_name_female}} {{last_name}}", ) formats_male = ( "{{first_name_male}} {{l...
Provider
python
pytorch__pytorch
torch/nn/modules/pooling.py
{ "start": 26516, "end": 30710 }
class ____(_AvgPoolNd): r"""Applies a 2D average pooling over an input signal composed of several input planes. In the simplest case, the output value of the layer with input size :math:`(N, C, H, W)`, output :math:`(N, C, H_{out}, W_{out})` and :attr:`kernel_size` :math:`(kH, kW)` can be precisely des...
AvgPool2d
python
airbytehq__airbyte
airbyte-integrations/connectors/source-s3/source_s3/v4/legacy_config_transformer.py
{ "start": 588, "end": 7840 }
class ____: """ Class that takes in S3 source configs in the legacy format and transforms them into configs that can be used by the new S3 source built with the file-based CDK. """ @classmethod def convert(cls, legacy_config: SourceS3Spec) -> Mapping[str, Any]: transformed_config = { ...
LegacyConfigTransformer
python
sphinx-doc__sphinx
sphinx/domains/cpp/_ast.py
{ "start": 55349, "end": 56816 }
class ____(ASTOperator): def __init__(self, op: str) -> None: self.op = op def __eq__(self, other: object) -> bool: if not isinstance(other, ASTOperatorBuildIn): return NotImplemented return self.op == other.op def __hash__(self) -> int: return hash(self.op) ...
ASTOperatorBuildIn
python
coleifer__peewee
peewee.py
{ "start": 78269, "end": 80145 }
class ____(Query): def __init__(self, table, returning=None, **kwargs): self.table = table self._returning = returning self._return_cursor = True if returning else False super(_WriteQuery, self).__init__(**kwargs) def cte(self, name, recursive=False, columns=None, materialized=N...
_WriteQuery
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-azure-inference/llama_index/embeddings/azure_inference/base.py
{ "start": 782, "end": 7211 }
class ____(BaseEmbedding): """ Azure AI model inference for embeddings. Examples: ```python from llama_index.core import Settings from llama_index.embeddings.azure_inference import AzureAIEmbeddingsModel llm = AzureAIEmbeddingsModel( endpoint="https://[your-endp...
AzureAIEmbeddingsModel
python
huggingface__transformers
src/transformers/models/d_fine/modeling_d_fine.py
{ "start": 69893, "end": 75642 }
class ____(ModelOutput): r""" loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)): Total loss as a linear combination of a negative log-likehood (cross-entropy) for class prediction and a bounding box loss. The latter is defined as a linear combination of...
DFineObjectDetectionOutput
python
ray-project__ray
python/ray/tune/experimental/output.py
{ "start": 6518, "end": 6615 }
class ____: trial_infos: List[List[str]] more_info: str @dataclass
_PerStatusTrialTableData
python
PrefectHQ__prefect
src/prefect/client/schemas/objects.py
{ "start": 41514, "end": 42251 }
class ____(ObjectBaseModel): """An ORM representation of a block schema reference.""" parent_block_schema_id: UUID = Field( default=..., description="ID of block schema the reference is nested within" ) parent_block_schema: Optional[BlockSchema] = Field( default=None, description="The b...
BlockSchemaReference
python
airbytehq__airbyte
airbyte-integrations/connectors/source-recharge/unit_tests/integration/pagination.py
{ "start": 271, "end": 562 }
class ____(PaginationStrategy): def __init__(self, request: HttpRequest, next_page_token: str) -> None: self._next_page_token = next_page_token def update(self, response: Dict[str, Any]) -> None: response["next_cursor"] = self._next_page_token
RechargePaginationStrategy
python
python-poetry__poetry
src/poetry/console/commands/install.py
{ "start": 372, "end": 8429 }
class ____(InstallerCommand): name = "install" description = "Installs the project dependencies." options: ClassVar[list[Option]] = [ *InstallerCommand._group_dependency_options(), option( "sync", None, "Synchronize the environment with the locked package...
InstallCommand
python
huggingface__transformers
src/transformers/models/camembert/modeling_camembert.py
{ "start": 38687, "end": 43396 }
class ____(CamembertPreTrainedModel): def __init__(self, config): super().__init__(config) self.dropout = nn.Dropout(config.hidden_dropout_prob) self.classifier = nn.Linear(config.hidden_size, 1) self.roberta = CamembertModel(config, add_pooling_layer=False) # Initialize we...
CamembertForMultipleChoice
python
pandas-dev__pandas
pandas/io/formats/format.py
{ "start": 49890, "end": 50294 }
class ____(_GenericArrayFormatter): def _format_strings(self) -> list[str]: if self.leading_space is False: formatter_str = lambda x: f"{x:d}".format(x=x) else: formatter_str = lambda x: f"{x: d}".format(x=x) formatter = self.formatter or formatter_str fmt_val...
_IntArrayFormatter
python
eriklindernoren__ML-From-Scratch
mlfromscratch/supervised_learning/linear_discriminant_analysis.py
{ "start": 152, "end": 1395 }
class ____(): """The Linear Discriminant Analysis classifier, also known as Fisher's linear discriminant. Can besides from classification also be used to reduce the dimensionaly of the dataset. """ def __init__(self): self.w = None def transform(self, X, y): self.fit(X, y) #...
LDA
python
getsentry__sentry
tests/symbolicator/test_payload_full.py
{ "start": 2744, "end": 14819 }
class ____(RelayStoreHelper, TransactionTestCase): @pytest.fixture(autouse=True) def initialize(self, live_server): self.project.update_option("sentry:builtin_symbol_sources", []) self.min_ago = before_now(minutes=1).isoformat() with ( patch("sentry.auth.system.is_internal_i...
SymbolicatorResolvingIntegrationTest
python
google__jax
tests/tree_util_test.py
{ "start": 39124, "end": 41007 }
class ____(parameterized.TestCase): @parameterized.parameters( (StaticInt(2),), (StaticTuple((2, None)),), (StaticDict(foo=2),), ) def test_trace_just_once_with_same_static(self, y): num_called = 0 @jax.jit def fn(x: int, static_y: StaticInt): nonlocal num_called num_ca...
StaticTest
python
huggingface__transformers
src/transformers/models/vits/modeling_vits.py
{ "start": 30473, "end": 31272 }
class ____(nn.Module): def __init__(self, config: VitsConfig): super().__init__() self.channels = config.depth_separable_channels self.translate = nn.Parameter(torch.zeros(self.channels, 1)) self.log_scale = nn.Parameter(torch.zeros(self.channels, 1)) def forward(self, inputs, p...
VitsElementwiseAffine
python
coleifer__peewee
tests/libs/mock.py
{ "start": 60130, "end": 60628 }
class ____(MagicMixin, NonCallableMock): """A version of `MagicMock` that isn't callable.""" def mock_add_spec(self, spec, spec_set=False): """Add a spec to a mock. `spec` can either be an object or a list of strings. Only attributes on the `spec` can be fetched as attributes from the mo...
NonCallableMagicMock
python
pallets__jinja
tests/test_imports.py
{ "start": 629, "end": 4523 }
class ____: def test_context_imports(self, test_env): t = test_env.from_string('{% import "module" as m %}{{ m.test() }}') assert t.render(foo=42) == "[|23]" t = test_env.from_string( '{% import "module" as m without context %}{{ m.test() }}' ) assert t.render(foo...
TestImports
python
getsentry__sentry
src/sentry/notifications/platform/templates/sample.py
{ "start": 9408, "end": 9682 }
class ____(NotificationData): source = "performance-monitoring" metric_name: str threshold: str current_value: str project_name: str chart_url: str investigation_url: str @template_registry.register(PerformanceAlertData.source)
PerformanceAlertData
python
django__django
tests/apps/query_performing_app/apps.py
{ "start": 728, "end": 818 }
class ____(ModelQueryAppConfig): database = "default"
QueryDefaultDatabaseModelAppConfig
python
spack__spack
lib/spack/spack/vendor/ruamel/yaml/tokens.py
{ "start": 9389, "end": 9452 }
class ____(Token): __slots__ = () id = ','
FlowEntryToken
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/methodOverride4.py
{ "start": 1044, "end": 1107 }
class ____: def method1[T: BaseC](self, x: T) -> T: ...
BaseC
python
getsentry__sentry
src/sentry/apidocs/examples/issue_examples.py
{ "start": 4088, "end": 4598 }
class ____: ORGANIZATION_GROUP_INDEX_GET = [ OpenApiExample( "Return a list of issues for an organization", value=[SIMPLE_ISSUE], response_only=True, status_codes=["200"], ) ] ORGANIZATION_GROUP_INDEX_PUT = [ OpenApiExample( ...
IssueExamples
python
google__jax
tests/mosaic/gpu_test.py
{ "start": 26893, "end": 27248 }
class ____: """A type that represents a 8-bit signed integer. This is a workaround to bypass the fact that we don't have a proper 8-bit integer type class available in MLIR, and can't instantiate types without a MLIR context. """ @staticmethod def get(): # pylint: disable=no-method-argument return ...
I8Type
python
sqlalchemy__sqlalchemy
test/engine/test_execute.py
{ "start": 107330, "end": 118565 }
class ____(fixtures.TestBase): __requires__ = ("sqlite",) def setup_test(self): e = create_engine("sqlite://") connection = Mock(get_server_version_info=Mock(return_value="5.0")) def connect(*args, **kwargs): return connection dbapi = Mock( sqlite_vers...
OnConnectTest
python
apache__airflow
dev/breeze/src/airflow_breeze/utils/provider_dependencies.py
{ "start": 7533, "end": 7605 }
class ____(NamedTuple): package_name: str version: str
PackageInfo
python
google__jax
tests/batching_test.py
{ "start": 49338, "end": 51241 }
class ____: name: str | None axis: int | None def __init__(self, name: str, axis: int | None): assert (name is None) == (axis is None) self.name = name self.axis = axis def named_mul(x: NamedArray, y: NamedArray) -> NamedArray: if x.names != y.names: raise Exception return NamedArray(x.names, la...
NamedMapSpec
python
django__django
tests/admin_inlines/models.py
{ "start": 2681, "end": 3042 }
class ____(models.Model): dummy = models.IntegerField(help_text="Awesome stacked help text is awesome.") holder = models.ForeignKey(Holder4, models.CASCADE) class Meta: constraints = [ models.UniqueConstraint( fields=["dummy", "holder"], name="unique_stacked_dummy_per_ho...
Inner4Stacked
python
pypa__pipenv
pipenv/vendor/click/types.py
{ "start": 17978, "end": 19490 }
class ____(_NumberRangeBase, FloatParamType): """Restrict a :data:`click.FLOAT` value to a range of accepted values. See :ref:`ranges`. If ``min`` or ``max`` are not passed, any value is accepted in that direction. If ``min_open`` or ``max_open`` are enabled, the corresponding boundary is not inclu...
FloatRange
python
pydantic__pydantic
tests/test_forward_ref.py
{ "start": 30762, "end": 31400 }
class ____(BaseModel): bar: Bar """ ) extras_schema = module_2.Foo.__pydantic_core_schema__['schema']['fields']['bar']['schema']['schema'][ 'extras_schema' ] assert extras_schema == {'type': 'int'} def test_pydantic_extra_forward_ref_separate_module_subclass(create_module: Any) -...
Foo
python
sympy__sympy
sympy/plotting/pygletplot/plot_axes.py
{ "start": 5859, "end": 8417 }
class ____(PlotAxesBase): def __init__(self, parent_axes): super().__init__(parent_axes) def draw_axis(self, axis, color): ticks = self._p._axis_ticks[axis] radius = self._p._tick_length / 2.0 if len(ticks) < 2: return # calculate the vector for this axis ...
PlotAxesOrdinate
python
getsentry__sentry
tests/sentry/middleware/test_access_log_middleware.py
{ "start": 7846, "end": 8509 }
class ____(LogCaptureAPITestCase): endpoint = "ratelimit-endpoint" def test_access_log_rate_limited(self) -> None: self._caplog.set_level(logging.INFO, logger="sentry") self.get_error_response(status_code=429) self.assert_access_log_recorded() # no token because the endpoint was...
TestAccessLogRateLimited