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
airbytehq__airbyte
airbyte-ci/connectors/connectors_qa/src/connectors_qa/checks/metadata.py
{ "start": 4237, "end": 6859 }
class ____(MetadataCheck): name = "Python connectors must have a CDK tag in metadata" description = f"Python connectors must have a CDK tag in their metadata. It must be set in the `tags` field in {consts.METADATA_FILE_NAME}. The values can be `cdk:low-code`, `cdk:python`, or `cdk:file`." applies_to_connect...
CheckConnectorCDKTag
python
huggingface__transformers
src/transformers/models/rt_detr_v2/modular_rt_detr_v2.py
{ "start": 28019, "end": 29237 }
class ____(RTDetrForObjectDetection, RTDetrV2PreTrainedModel): _tied_weights_keys = { r"bbox_embed.(?![0])\d+": r"bbox_embed.0", r"class_embed.(?![0])\d+": r"^class_embed.0", "model.decoder.class_embed": "class_embed", "model.decoder.bbox_embed": "bbox_embed", } def __init__...
RTDetrV2ForObjectDetection
python
walkccc__LeetCode
solutions/3259. Maximum Energy Boost From Two Drinks/3259.py
{ "start": 0, "end": 379 }
class ____: def maxEnergyBoost( self, energyDrinkA: list[int], energyDrinkB: list[int] ) -> int: dpA = 0 # the maximum energy boost if the last drink is A dpB = 0 # the maximum energy boost if the last drink is B for a, b in zip(energyDrinkA, energyDrinkB): dpA, dpB = max(dpB,...
Solution
python
getsentry__sentry
src/sentry/core/endpoints/project_keys.py
{ "start": 1312, "end": 5615 }
class ____(ProjectEndpoint): publish_status = { "GET": ApiPublishStatus.PUBLIC, "POST": ApiPublishStatus.PUBLIC, } rate_limits = RateLimitConfig( limit_overrides={ "GET": { RateLimitCategory.IP: RateLimit(limit=40, window=1), RateLimitCate...
ProjectKeysEndpoint
python
dagster-io__dagster
helm/dagster/schema/schema/charts/dagster/subschema/run_launcher.py
{ "start": 707, "end": 1770 }
class ____(BaseModel): image: kubernetes.Image imagePullPolicy: Optional[kubernetes.PullPolicy] = None nameOverride: str configSource: dict workerQueues: list[CeleryWorkerQueue] = Field(min_items=1) env: dict[str, str] envConfigMaps: list[kubernetes.ConfigMapEnvSource] envSecrets: list[k...
CeleryK8sRunLauncherConfig
python
numba__numba
numba/tests/test_comprehension.py
{ "start": 603, "end": 7500 }
class ____(TestCase): def test_comp_list(self): pyfunc = comp_list cfunc = njit((types.intp,))(pyfunc) self.assertEqual(cfunc(5), pyfunc(5)) self.assertEqual(cfunc(0), pyfunc(0)) self.assertEqual(cfunc(-1), pyfunc(-1)) def test_bulk_use_cases(self): """ Tests th...
TestListComprehension
python
getlogbook__logbook
src/logbook/compat.py
{ "start": 5066, "end": 7739 }
class ____(logbook.Handler): """Does the opposite of the :class:`RedirectLoggingHandler`, it sends messages from logbook to logging. Because of that, it's a very bad idea to configure both. This handler is for logbook and will pass stuff over to a logger from the standard library. Example usa...
LoggingHandler
python
scrapy__scrapy
tests/test_http_response.py
{ "start": 31642, "end": 33403 }
class ____(TestTextResponse): response_class = HtmlResponse def test_html_encoding(self): body = b"""<html><head><title>Some page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head><body>Price: \xa3100</body></html>' """ r1 = self.res...
TestHtmlResponse
python
mlflow__mlflow
mlflow/projects/backend/abstract_backend.py
{ "start": 115, "end": 2113 }
class ____: """ Abstract plugin class defining the interface needed to execute MLflow projects. You can define subclasses of ``AbstractBackend`` and expose them as third-party plugins to enable running MLflow projects against custom execution backends (e.g. to run projects against your team's in-hou...
AbstractBackend
python
pandas-dev__pandas
pandas/tests/io/test_clipboard.py
{ "start": 4986, "end": 12560 }
class ____: # Test that default arguments copy as tab delimited # Test that explicit delimiters are respected @pytest.mark.parametrize("sep", [None, "\t", ",", "|"]) @pytest.mark.parametrize("encoding", [None, "UTF-8", "utf-8", "utf8"]) def test_round_trip_frame_sep(self, df, sep, encoding): ...
TestClipboard
python
mlflow__mlflow
mlflow/genai/evaluation/entities.py
{ "start": 660, "end": 5048 }
class ____: """Represents a row in the evaluation dataset.""" """Unique identifier for the eval item.""" request_id: str """Raw input to the model/application when `evaluate` is called.""" inputs: dict[str, Any] """Raw output from the model/application.""" outputs: Any """Expectation...
EvalItem
python
numba__numba
numba/tests/test_annotations.py
{ "start": 4735, "end": 7540 }
class ____(unittest.TestCase): def findpatloc(self, lines, pat): for i, ln in enumerate(lines): if pat in ln: return i raise ValueError("can't find {!r}".format(pat)) def getlines(self, func): strbuf = StringIO() func.inspect_types(strbuf) re...
TestTypeAnnotation
python
sphinx-doc__sphinx
sphinx/search/zh.py
{ "start": 847, "end": 2292 }
class ____(SearchLanguage): """Chinese search implementation""" lang = 'zh' language_name = 'Chinese' js_stemmer_rawcode = 'english-stemmer.js' stopwords = ENGLISH_STOPWORDS latin1_letters = re.compile(r'[a-zA-Z0-9_]+') def __init__(self, options: dict[str, str]) -> None: super()._...
SearchChinese
python
numba__llvmlite
llvmlite/tests/test_binding.py
{ "start": 43643, "end": 50935 }
class ____(BaseTest): def jit(self, asm=asm_sum, func_name="sum", target_machine=None, add_process=False, func_type=CFUNCTYPE(c_int, c_int, c_int), suppress_errors=False): lljit = llvm.create_lljit_compiler(target_machine, use_jit_link=Fals...
TestOrcLLJIT
python
walkccc__LeetCode
solutions/335. Self Crossing/335.py
{ "start": 0, "end": 476 }
class ____: def isSelfCrossing(self, x: list[int]) -> bool: if len(x) <= 3: return False for i in range(3, len(x)): if x[i - 2] <= x[i] and x[i - 1] <= x[i - 3]: return True if i >= 4 and x[i - 1] == x[i - 3] and x[i - 2] <= x[i] + x[i - 4]: return True if i >= 5 and x...
Solution
python
getsentry__sentry
src/sentry/api/analytics.py
{ "start": 263, "end": 440 }
class ____(analytics.Event): org_id: int search_type: str query: str @analytics.eventclass("group_similar_issues_embeddings.count")
OrganizationSavedSearchDeletedEvent
python
sqlalchemy__sqlalchemy
test/orm/test_unitofwork.py
{ "start": 37921, "end": 43278 }
class ____(fixtures.MappedTest): @classmethod def define_tables(cls, metadata): Table( "data", metadata, Column( "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("a", String(50)), Column("b", ...
ColumnPropertyTest
python
pydantic__pydantic
pydantic/v1/config.py
{ "start": 2479, "end": 6532 }
class ____: title: Optional[str] = None anystr_lower: bool = False anystr_upper: bool = False anystr_strip_whitespace: bool = False min_anystr_length: int = 0 max_anystr_length: Optional[int] = None validate_all: bool = False extra: Extra = Extra.ignore allow_mutation: bool = True ...
BaseConfig
python
sympy__sympy
sympy/matrices/expressions/factorizations.py
{ "start": 87, "end": 233 }
class ____(MatrixExpr): arg = property(lambda self: self.args[0]) shape = property(lambda self: self.arg.shape) # type: ignore
Factorization
python
getsentry__sentry
src/sentry/api/endpoints/rule_snooze.py
{ "start": 8998, "end": 10357 }
class ____(BaseRuleSnoozeEndpoint[Rule]): owner = ApiOwner.ISSUES publish_status = { "DELETE": ApiPublishStatus.PRIVATE, "POST": ApiPublishStatus.PRIVATE, } rule_field = "rule" def fetch_rule_list(self, project: Project) -> BaseQuerySet[Rule]: queryset = Rule.objects.filter(...
RuleSnoozeEndpoint
python
Textualize__textual
src/textual/widgets/_selection_list.py
{ "start": 2501, "end": 25078 }
class ____(Generic[SelectionType], OptionList): """A vertical selection list that allows making multiple selections.""" BINDINGS = [Binding("space", "select", "Toggle option", show=False)] """ | Key(s) | Description | | :- | :- | | space | Toggle the state of the highlighted selection. | ""...
SelectionList
python
opencv__opencv-python
tests/test.py
{ "start": 29, "end": 370 }
class ____(unittest.TestCase): """ Simple functionality tests. """ def test_import(self): """ Test that the cv2 module can be imported. """ import cv2 def test_video_capture(self): import cv2 cap = cv2.VideoCapture("SampleVideo_1280x720_1mb.mp4") self.assertTrue(c...
OpenCVTest
python
astropy__astropy
astropy/modeling/projections.py
{ "start": 25845, "end": 26194 }
class ____(Pix2SkyProjection, PseudoCylindrical): r""" Hammer-Aitoff projection - pixel to sky. Corresponds to the ``AIT`` projection in FITS WCS. .. math:: \phi &= 2 \arg \left(2Z^2 - 1, \frac{\pi}{180^\circ} \frac{Z}{2}x\right) \\ \theta &= \sin^{-1}\left(\frac{\pi}{180^\circ}yZ\righ...
Pix2Sky_HammerAitoff
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/dataplex.py
{ "start": 3808, "end": 4075 }
class ____(BaseGoogleLink): """Helper class for constructing Dataplex Catalog AspectType link.""" name = "Dataplex Catalog AspectType" key = "dataplex_catalog_aspect_type_key" format_str = DATAPLEX_CATALOG_ASPECT_TYPE_LINK
DataplexCatalogAspectTypeLink
python
encode__django-rest-framework
tests/test_viewsets.py
{ "start": 3521, "end": 6301 }
class ____(TestCase): def test_initialize_view_set_with_actions(self): request = factory.get('/', '', content_type='application/json') my_view = BasicViewSet.as_view(actions={ 'get': 'list', }) response = my_view(request) assert response.status_code == status.HTT...
InitializeViewSetsTestCase
python
euske__pdfminer
pdfminer/layout.py
{ "start": 12214, "end": 12617 }
class ____(LTTextGroup): def analyze(self, laparams): LTTextGroup.analyze(self, laparams) # reorder the objects from top-right to bottom-left. self._objs = csort(self._objs, key=lambda obj: -(1+laparams.boxes_flow)*(obj.x0+obj.x1) - (1-l...
LTTextGroupTBRL
python
facebook__pyre-check
client/tests/coverage_data_tests.py
{ "start": 24033, "end": 28241 }
class ____(testslide.TestCase): ANNOTATION = cst.Annotation(cst.Name("Foo")) def _parameter(self, name: str, annotated: bool) -> cst.Param: return cst.Param( name=cst.Name(name), annotation=self.ANNOTATION if annotated else None, ) def test_from_function_data(self) ...
FunctionAnnotationStatusTest
python
fastai__fastai
fastai/tabular/core.py
{ "start": 7077, "end": 10134 }
class ____(CollBase, GetAttr, FilteredBase): "A `DataFrame` wrapper that knows which cols are cont/cat/y, and returns rows in `__getitem__`" _default,with_cont='procs',True def __init__(self, df, procs=None, cat_names=None, cont_names=None, y_names=None, y_block=None, splits=None, do_setup=...
Tabular
python
marshmallow-code__marshmallow
tests/test_options.py
{ "start": 2756, "end": 4356 }
class ____: class AddFieldsSchema(Schema): name = fields.Str() class Meta: include = {"from": fields.Str()} def test_fields_are_added(self): s = self.AddFieldsSchema() in_data = {"name": "Steve", "from": "Oskosh"} result = s.load({"name": "Steve", "from": "O...
TestIncludeOption
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/path_registry.py
{ "start": 12502, "end": 13137 }
class ____(orm_base.InspectionAttr, HasCacheKey, str): """cacheable string token""" _intern: Dict[str, PathToken] = {} def _gen_cache_key( self, anon_map: anon_map, bindparams: List[BindParameter[Any]] ) -> Tuple[Any, ...]: return (str(self),) @property def _path_for_compare(s...
PathToken
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeVarDefaultClass2.py
{ "start": 2150, "end": 2380 }
class ____(ClassNChild): ... n1 = ClassN() reveal_type(n1.a, expected_text="str") P1 = ParamSpec("P1", default=...) P2 = ParamSpec("P2", default=P1) P3 = ParamSpec("P3", default=P2) P4 = ParamSpec("P4", default=[int, T1])
ClassN
python
spack__spack
lib/spack/spack/solver/asp.py
{ "start": 169624, "end": 169730 }
class ____(spack.error.SpackError): """Raised when there is no possible compiler"""
NoCompilerFoundError
python
apache__airflow
providers/google/tests/unit/google/cloud/hooks/test_os_login.py
{ "start": 1725, "end": 2979 }
class ____: def setup_method(self): with mock.patch( "airflow.providers.google.cloud.hooks.os_login.OSLoginHook.__init__", new=mock_base_gcp_hook_default_project_id, ): self.hook = OSLoginHook(gcp_conn_id="test") @mock.patch( "airflow.providers.google...
TestOSLoginHook
python
more-itertools__more-itertools
tests/test_more.py
{ "start": 14952, "end": 17040 }
class ____(TestCase): def test_basic(self): iterable = ['z', 'a', 'a', 'q', 'q', 'q', 'y'] actual = list(mi.distinct_permutations(iterable)) expected = set(permutations(iterable)) self.assertCountEqual(actual, expected) def test_r(self): for iterable, r in ( ...
DistinctPermutationsTests
python
mwaskom__seaborn
tests/test_axisgrid.py
{ "start": 24063, "end": 49574 }
class ____: rs = np.random.RandomState(sum(map(ord, "PairGrid"))) df = pd.DataFrame(dict(x=rs.normal(size=60), y=rs.randint(0, 4, size=(60)), z=rs.gamma(3, size=60), a=np.repeat(list("abc"), 20), b=np.re...
TestPairGrid
python
pypa__pip
src/pip/_vendor/urllib3/exceptions.py
{ "start": 3633, "end": 3765 }
class ____(ValueError, HTTPError): """Raised when there is something wrong with a given URL input.""" pass
LocationValueError
python
donnemartin__interactive-coding-challenges
sorting_searching/anagrams/test_anagrams.py
{ "start": 18, "end": 531 }
class ____(unittest.TestCase): def test_group_anagrams(self): anagram = Anagram() self.assertRaises(TypeError, anagram.group_anagrams, None) data = ['ram', 'act', 'arm', 'bat', 'cat', 'tab'] expected = ['ram', 'arm', 'act', 'cat', 'bat', 'tab'] self.assertEqual(anagram.group...
TestAnagrams
python
ray-project__ray
python/ray/util/metrics.py
{ "start": 10869, "end": 12497 }
class ____(Metric): """Gauges keep the last recorded value and drop everything before. Unlike counters, gauges can go up or down over time. This corresponds to Prometheus' gauge metric: https://prometheus.io/docs/concepts/metric_types/#gauge Args: name: Name of the metric. descrip...
Gauge
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-markitdown/llama_index/readers/markitdown/base.py
{ "start": 464, "end": 3110 }
class ____(BaseModel): file_path: Union[str, Path, List[str], List[Path]] @model_validator(mode="after") def validate_file_path(self) -> Self: if isinstance(self.file_path, str): if not Path(self.file_path).is_dir(): if not Path(self.file_path).is_file(): ...
ValidFilePath
python
google__jax
tests/ffi_test.py
{ "start": 13990, "end": 16782 }
class ____(jtu.JaxTestCase): def setUp(self): super().setUp() # Register callbacks before checking the number of devices to make sure # that we're testing the registration path, even if we can't run the tests. for target_name in ["lapack_sgeqrf_ffi", "cusolver_geqrf_ffi", "hips...
BatchPartitioningTest
python
getsentry__sentry
tests/sentry/notifications/test_notificationcontroller.py
{ "start": 1610, "end": 31571 }
class ____(TestCase): def setUp(self) -> None: super().setUp() setting_option_1 = add_notification_setting_option( scope_type=NotificationScopeEnum.USER, scope_identifier=self.user.id, type=NotificationSettingEnum.DEPLOY, value=NotificationSettingsOpti...
NotificationControllerTest
python
huggingface__transformers
src/transformers/models/deformable_detr/modeling_deformable_detr.py
{ "start": 19311, "end": 21156 }
class ____(nn.Module): """ This is a more standard version of the position embedding, very similar to the one used by the Attention is all you need paper, generalized to work on images. """ def __init__(self, embedding_dim=64, temperature=10000, normalize=False, scale=None): super().__init_...
DeformableDetrSinePositionEmbedding
python
getsentry__sentry
tests/sentry/conduit/test_tasks.py
{ "start": 568, "end": 2108 }
class ____(TestCase): @override_settings( CONDUIT_PUBLISH_SECRET="test-secret", CONDUIT_PUBLISH_JWT_ISSUER="test-issuer", CONDUIT_PUBLISH_JWT_AUDIENCE="test-audience", ) def test_generate_jwt_uses_settings(self): """Test that generate_jwt uses settings when parameters are not...
GenerateJWTTest
python
google__jax
tests/ann_test.py
{ "start": 1929, "end": 7305 }
class ____(jtu.JaxTestCase): # TODO(b/258315194) Investigate probability property when input is around # few thousands. @jtu.sample_product( qy_shape=[(200, 128), (128, 128)], db_shape=[(128, 500), (128, 3000)], dtype=jtu.dtypes.all_floating, k=[1, 10], recall=[0.95], ) def test_approx_ma...
AnnTest
python
doocs__leetcode
solution/1400-1499/1456.Maximum Number of Vowels in a Substring of Given Length/Solution.py
{ "start": 0, "end": 297 }
class ____: def maxVowels(self, s: str, k: int) -> int: vowels = set("aeiou") ans = cnt = sum(c in vowels for c in s[:k]) for i in range(k, len(s)): cnt += int(s[i] in vowels) - int(s[i - k] in vowels) ans = max(ans, cnt) return ans
Solution
python
huggingface__transformers
src/transformers/generation/continuous_batching/scheduler.py
{ "start": 9090, "end": 13179 }
class ____(Scheduler): """This scheduler processes requests in the order they arrive, meaning decoding requests has priority over prefilling requests. Additionally, it includes a safety margin mechanism to prevent cache exhaustion. By default, when 80% of the cache is full, new requests will not be schedule...
FIFOScheduler
python
pallets__click
src/click/exceptions.py
{ "start": 8480, "end": 8740 }
class ____(UsageError): """Raised if an argument is generally supplied but the use of the argument was incorrect. This is for instance raised if the number of values for an argument is not correct. .. versionadded:: 6.0 """
BadArgumentUsage
python
google__pytype
pytype/tests/test_functions1.py
{ "start": 3297, "end": 29437 }
class ____(test_base.BaseTest): """Tests for functions.""" def test_functions(self): self.Check(""" def fn(a, b=17, c="Hello", d=[]): d.append(99) print(a, b, c, d) fn(1) fn(2, 3) fn(3, c="Bye") fn(4, d=["What?"]) fn(5, "b", "c") """) def test_functi...
TestFunctions
python
scipy__scipy
scipy/stats/_hypotests.py
{ "start": 49510, "end": 70626 }
class ____: statistic: float pvalue: float @xp_capabilities(np_only=True) def boschloo_exact(table, alternative="two-sided", n=32): r"""Perform Boschloo's exact test on a 2x2 contingency table. Parameters ---------- table : array_like of ints A 2x2 contingency table. Elements should ...
BoschlooExactResult
python
celery__celery
celery/app/base.py
{ "start": 8380, "end": 56699 }
class ____: """Celery application. Arguments: main (str): Name of the main module if running as `__main__`. This is used as the prefix for auto-generated task names. Keyword Arguments: broker (str): URL of the default broker used. backend (Union[str, Type[celery.backend...
Celery
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1463661, "end": 1464056 }
class ____(sgqlc.types.Type, Node): """A repository rule.""" __schema__ = github_schema __field_names__ = ("parameters", "type") parameters = sgqlc.types.Field("RuleParameters", graphql_name="parameters") """The parameters for this rule.""" type = sgqlc.types.Field(sgqlc.types.non_null(Reposit...
RepositoryRule
python
apache__thrift
test/py/TestClient.py
{ "start": 13888, "end": 14405 }
class ____(MultiplexedOptionalTest): def get_protocol(self, transport): wrapped_proto = make_pedantic(TBinaryProtocol.TBinaryProtocolFactory().getProtocol(transport)) return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "ThriftTest") def get_protocol2(self, transport): wrappe...
MultiplexedBinaryTest
python
google__pytype
pytype/rewrite/abstract/internal.py
{ "start": 184, "end": 745 }
class ____(base.BaseValue): """Representation of a function arg tuple.""" def __init__( self, ctx: base.ContextType, constant: tuple[_Var, ...] = (), indefinite: bool = False, ): super().__init__(ctx) assert isinstance(constant, tuple), constant self.constant = constant se...
FunctionArgTuple
python
walkccc__LeetCode
solutions/1171. Remove Zero Sum Consecutive Nodes from Linked List/1171.py
{ "start": 0, "end": 418 }
class ____: def removeZeroSumSublists(self, head: ListNode) -> ListNode: dummy = ListNode(0, head) prefix = 0 prefixToNode = {0: dummy} while head: prefix += head.val prefixToNode[prefix] = head head = head.next prefix = 0 head = dummy while head: prefix += head....
Solution
python
allegroai__clearml
clearml/backend_api/services/v2_20/auth.py
{ "start": 22451, "end": 23965 }
class ____(Response): """ Response of auth.revoke_credentials endpoint. :param revoked: Number of credentials revoked :type revoked: int """ _service = "auth" _action = "revoke_credentials" _version = "2.20" _schema = { "definitions": {}, "properties": { ...
RevokeCredentialsResponse
python
pytest-dev__pytest
src/_pytest/capture.py
{ "start": 5810, "end": 6323 }
class ____(io.TextIOWrapper): __slots__ = () @property def name(self) -> str: # Ensure that file.name is a string. Workaround for a Python bug # fixed in >=3.7.4: https://bugs.python.org/issue36015 return repr(self.buffer) @property def mode(self) -> str: # TextIOWr...
EncodedFile
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/inputs.py
{ "start": 1188, "end": 3127 }
class ____(graphene.InputObjectType): runIds = graphene.List(graphene.String) pipelineName = graphene.InputField(graphene.String) tags = graphene.List(graphene.NonNull(GrapheneExecutionTag)) statuses = graphene.List(graphene.NonNull(GrapheneRunStatus)) snapshotId = graphene.InputField(graphene.Strin...
GrapheneRunsFilter
python
jschneier__django-storages
storages/backends/s3.py
{ "start": 3218, "end": 10881 }
class ____(CompressedFileMixin, File): """ The default file object used by the S3Storage backend. This file implements file streaming using boto's multipart uploading functionality. The file can be opened in read or write mode. This class extends Django's File class. However, the contained ...
S3File
python
django__django
tests/auth_tests/test_models.py
{ "start": 13844, "end": 19751 }
class ____(TestCase): @classmethod def setUpTestData(cls): content_type = ContentType.objects.get_for_model(Group) cls.permission = Permission.objects.create( name="test", content_type=content_type, codename="test", ) # User with permission. ...
UserWithPermTestCase
python
dateutil__dateutil
tests/_common.py
{ "start": 6004, "end": 6589 }
class ____(object): """ A class that is always equal to whatever you compare it to. """ def __eq__(self, other): return True def __ne__(self, other): return False def __le__(self, other): return True def __ge__(self, other): return True def __lt__(sel...
ComparesEqualClass
python
apache__airflow
providers/microsoft/azure/tests/unit/microsoft/azure/hooks/test_base_azure.py
{ "start": 1318, "end": 8173 }
class ____: @pytest.mark.parametrize( "mocked_connection", [Connection(conn_id="azure_default", extra={"key_path": "key_file.json"})], indirect=True, ) @patch(f"{MODULE}.get_client_from_auth_file") def test_get_conn_with_key_path(self, mock_get_client_from_auth_file, mocked_conne...
TestBaseAzureHook
python
sqlalchemy__sqlalchemy
test/orm/test_defaults.py
{ "start": 6706, "end": 7437 }
class ____(fixtures.MappedTest): @classmethod def define_tables(cls, metadata): Table( "dt", metadata, Column( "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("col1", String(20), default="hello"), ...
ExcludedDefaultsTest
python
huggingface__transformers
src/transformers/models/lightglue/modeling_lightglue.py
{ "start": 8464, "end": 11619 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config: LightGlueConfig, layer_idx: int): super().__init__() self.config = config self.layer_idx = layer_idx self.head_dim = getattr(config, "head_dim", config.hidden_si...
LightGlueAttention
python
joke2k__faker
faker/providers/bank/__init__.py
{ "start": 190, "end": 6547 }
class ____(BaseProvider): """Implement default bank provider for Faker. .. important:: Bank codes, account numbers, and other ID's generated by this provider are only valid in form, i.e. they conform to some standard/format, are of the expected lengths, and have valid checksums (where appl...
Provider
python
dask__dask
dask/dataframe/dask_expr/_expr.py
{ "start": 30946, "end": 37191 }
class ____(Expr): _parameters = ["frame", "before", "after"] @functools.cached_property def _meta(self): return self.frame._meta def _divisions(self): # Keep divisions alive, MapPartitions will handle the actual division logic return self.frame.divisions def _layer(self) -...
CreateOverlappingPartitions
python
huggingface__transformers
src/transformers/models/videomae/modeling_videomae.py
{ "start": 4523, "end": 7947 }
class ____(nn.Module): """ Video to Patch Embedding. This module turns a batch of videos of shape (batch_size, num_frames, num_channels, height, width) into a tensor of shape (batch_size, seq_len, hidden_size) to be consumed by a Transformer encoder. The seq_len (the number of patches) equals (number o...
VideoMAEPatchEmbeddings
python
pydata__xarray
xarray/coding/variables.py
{ "start": 17907, "end": 20948 }
class ____(VariableCoder): """Scale and offset variables according to CF conventions. Follows the formula: decode_values = encoded_values * scale_factor + add_offset """ def __init__( self, decode_times: bool | CFDatetimeCoder = False, decode_timedelta: bool | CFTimedel...
CFScaleOffsetCoder
python
django__django
django/contrib/postgres/fields/array.py
{ "start": 10233, "end": 10330 }
class ____(ArrayRHSMixin, lookups.DataContains): pass @ArrayField.register_lookup
ArrayContains
python
celery__celery
t/unit/backends/test_base.py
{ "start": 52073, "end": 53012 }
class ____: def test_get(self): with pytest.raises(NotImplementedError): KeyValueStoreBackend(self.app).get('a') def test_set(self): with pytest.raises(NotImplementedError): KeyValueStoreBackend(self.app)._set_with_state('a', 1, states.SUCCESS) def test_incr(self):...
test_KeyValueStoreBackend_interface
python
ray-project__ray
release/ray_release/log_aggregator.py
{ "start": 93, "end": 3883 }
class ____: def __init__(self, log: str): self.log = log def compute_crash_pattern(self) -> str: stack_trace = LogAggregator._compute_stack_trace(self.log.splitlines()) # truncate short enough to store in databases, but long enough to keep the # pattern unique return Log...
LogAggregator
python
getsentry__sentry
tests/sentry/search/test_utils.py
{ "start": 28947, "end": 34577 }
class ____(TestCase): def test(self) -> None: with pytest.raises(Release.DoesNotExist): # no releases exist period environment = None get_latest_release([self.project], environment) old = self.create_release(version="old") new_date = old.date_added + time...
GetLatestReleaseTest
python
gevent__gevent
src/greentest/3.13/test_socket.py
{ "start": 228912, "end": 229797 }
class ____(unittest.TestCase): def testExceptionTree(self): self.assertTrue(issubclass(OSError, Exception)) self.assertTrue(issubclass(socket.herror, OSError)) self.assertTrue(issubclass(socket.gaierror, OSError)) self.assertTrue(issubclass(socket.timeout, OSError)) self.ass...
TestExceptions
python
davidhalter__jedi
jedi/plugins/django.py
{ "start": 10656, "end": 10895 }
class ____(ValueWrapper): def __init__(self, method, model_cls): super().__init__(method) self._model_cls = model_cls def get_signatures(self): return _get_signatures(self._model_cls)
QuerySetBoundMethodWrapper
python
scipy__scipy
scipy/stats/tests/test_distributions.py
{ "start": 225121, "end": 258356 }
class ____: def setup_method(self): self.rng = np.random.default_rng(7195199371) @pytest.fixture(autouse=True) def reset_levy_stable_params(self): """Setup default parameters for levy_stable generator""" stats.levy_stable.parameterization = "S1" stats.levy_stable.cdf_default...
TestLevyStable
python
mwaskom__seaborn
doc/tools/nb_to_doc.py
{ "start": 1518, "end": 5919 }
class ____(Exception): pass def pop_recursive(d, key, default=None): """dict.pop(key) where `key` is a `.`-delimited list of nested keys. >>> d = {'a': {'b': 1, 'c': 2}} >>> pop_recursive(d, 'a.c') 2 >>> d {'a': {'b': 1}} """ nested = key.split('.') current = d for k in nes...
MetadataError
python
ray-project__ray
python/ray/tests/kuberay/test_autoscaling_e2e.py
{ "start": 1850, "end": 14886 }
class ____(unittest.TestCase): """e2e verification of autoscaling following the steps in the Ray documentation. kubectl is used throughout, as that reflects the instructions in the docs. """ def _get_ray_cr_config( self, min_replicas=0, cpu_replicas=0, gpu_replicas=0 ) -> Dict[str, Any]: ...
KubeRayAutoscalingTest
python
encode__httpx
httpx/_exceptions.py
{ "start": 4264, "end": 4448 }
class ____(TransportError): """ Attempted to make a request to an unsupported protocol. For example issuing a request to `ftp://www.example.com`. """
UnsupportedProtocol
python
apache__thrift
test/py/TestClient.py
{ "start": 12232, "end": 13603 }
class ____(TProtocolDecorator.TProtocolDecorator): """ Wraps any protocol with sequence ID checking: looks for outbound uniqueness as well as request/response alignment. """ def __init__(self, protocol): # TProtocolDecorator.__new__ does all the heavy lifting pass def writeMessa...
TPedanticSequenceIdProtocolWrapper
python
bokeh__bokeh
src/bokeh/core/property/data_frame.py
{ "start": 2223, "end": 2851 }
class ____(Property["IntoSeries"]): """ Accept eager series supported by Narwhals. This property only exists to support type validation, e.g. for "accepts" clauses. It is not serializable itself, and is not useful to add to Bokeh models directly. """ def validate(self, value: Any, detail: bool...
EagerSeries
python
python-openxml__python-docx
src/docx/oxml/simpletypes.py
{ "start": 5887, "end": 6064 }
class ____(XsdLong): @classmethod def validate(cls, value: Any) -> None: cls.validate_int_in_range(value, -27273042329600, 27273042316900)
ST_CoordinateUnqualified
python
walkccc__LeetCode
solutions/1169. Invalid Transactions/1169.py
{ "start": 0, "end": 704 }
class ____: def invalidTransactions(self, transactions: list[str]) -> list[str]: ans = [] nameToTrans = collections.defaultdict(list) for t in transactions: name, time, amount, city = t.split(',') time, amount = int(time), int(amount) nameToTrans[name].append({'time': time, 'city': city...
Solution
python
gevent__gevent
src/greentest/3.12/test_subprocess.py
{ "start": 2752, "end": 70872 }
class ____(BaseTestCase): def test_io_buffered_by_default(self): p = subprocess.Popen(ZERO_RETURN_CMD, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) try: self.assertIsInstance(p.stdin, io.BufferedIOBase) ...
ProcessTestCase
python
walkccc__LeetCode
solutions/2576. Find the Maximum Number of Marked Indices/2576.py
{ "start": 0, "end": 377 }
class ____: def maxNumOfMarkedIndices(self, nums: list[int]) -> int: nums.sort() def isPossible(m: int) -> bool: for i in range(m): if 2 * nums[i] > nums[-m + i]: return False return True l = bisect.bisect_left(range(len(nums) // 2 + 1), True, key...
Solution
python
cython__cython
Cython/Build/Tests/TestCyCache.py
{ "start": 216, "end": 6554 }
class ____(CythonTest): def setUp(self): CythonTest.setUp(self) self.temp_dir = tempfile.mkdtemp( prefix='cycache-test', dir='TEST_TMP' if os.path.isdir('TEST_TMP') else None) self.src_dir = tempfile.mkdtemp(prefix='src', dir=self.temp_dir) self.cache_dir = t...
TestCyCache
python
ray-project__ray
rllib/utils/replay_buffers/replay_buffer.py
{ "start": 2068, "end": 14390 }
class ____(ReplayBufferInterface, FaultAwareApply): """The lowest-level replay buffer interface used by RLlib. This class implements a basic ring-type of buffer with random sampling. ReplayBuffer is the base class for advanced types that add functionality while retaining compatibility through inheritan...
ReplayBuffer
python
pypa__warehouse
warehouse/manage/forms.py
{ "start": 21802, "end": 23649 }
class ____(OrganizationNameMixin, SaveOrganizationForm): __params__ = ["name"] + SaveOrganizationForm.__params__ _max_apps = wtforms.IntegerField() membership_size = wtforms.SelectField( choices=[(size.value, size.value) for size in OrganizationMembershipSize], default=None, coerce...
CreateOrganizationApplicationForm
python
encode__django-rest-framework
tests/test_fields.py
{ "start": 67782, "end": 68302 }
class ____(FieldValues): """ Valid and invalid values for a `Choice` field that uses a flat list for the choices, rather than a list of pairs of (`value`, `description`). """ valid_inputs = { 'poor': 'poor', 'medium': 'medium', 'good': 'good', } invalid_inputs = { ...
TestChoiceFieldWithListChoices
python
huggingface__transformers
src/transformers/models/tapas/modeling_tapas.py
{ "start": 6424, "end": 11426 }
class ____(nn.Module): def __init__(self, config, layer_idx=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0 and not hasattr(config, "embedding_size"): raise ValueError( f"The hidden size {config.hidden_size} is not a multiple of the numbe...
TapasSelfAttention
python
streamlit__streamlit
lib/streamlit/elements/widgets/slider.py
{ "start": 7477, "end": 38248 }
class ____: # If min/max/value/step are not provided, then we return an int. # if ONLY step is provided, then it must be an int and we return an int. @overload def slider( self, label: str, min_value: None = None, max_value: None = None, value: None = None, ...
SliderMixin
python
great-expectations__great_expectations
great_expectations/datasource/fluent/spark_azure_blob_storage_datasource.py
{ "start": 1227, "end": 8405 }
class ____(_SparkFilePathDatasource): """ SparkAzureBlobStorageDatasource is a subclass of SparkDatasource which connects to Azure Blob Storage. """ # class attributes data_connector_type: ClassVar[Type[AzureBlobStorageDataConnector]] = ( AzureBlobStorageDataConnector ) # insta...
SparkAzureBlobStorageDatasource
python
xlwings__xlwings
xlwings/constants.py
{ "start": 125410, "end": 125765 }
class ____: xlUnderlineStyleDouble = -4119 # from enum XlUnderlineStyle xlUnderlineStyleDoubleAccounting = 5 # from enum XlUnderlineStyle xlUnderlineStyleNone = -4142 # from enum XlUnderlineStyle xlUnderlineStyleSingle = 2 # from enum XlUnderlineStyle xlUnderlineStyleSingleAccounting = 4 # from...
UnderlineStyle
python
jazzband__django-polymorphic
src/polymorphic/tests/models.py
{ "start": 11145, "end": 11273 }
class ____(PolymorphicModel): topic = models.CharField(max_length=30) class Meta: abstract = True
AbstractProject
python
allegroai__clearml
examples/services/monitoring/slack_alerts.py
{ "start": 1423, "end": 2807 }
class ____: def __init__(self, include=None, exclude=None): # type: (Optional[Union[str, List[str]]], Optional[Union[str, List[str]]]) -> () # Either `include` or `exclude` should be specified, but not both if include is not None and exclude is not None: raise ValueError("Specify...
UserFilter
python
django-import-export__django-import-export
import_export/formats/base_formats.py
{ "start": 4109, "end": 4209 }
class ____(TextFormat): TABLIB_MODULE = "tablib.formats._html" CONTENT_TYPE = "text/html"
HTML
python
openai__openai-python
src/openai/types/realtime/realtime_truncation_retention_ratio.py
{ "start": 691, "end": 1380 }
class ____(BaseModel): retention_ratio: float """ Fraction of post-instruction conversation tokens to retain (`0.0` - `1.0`) when the conversation exceeds the input token limit. Setting this to `0.8` means that messages will be dropped until 80% of the maximum allowed tokens are used. This helps...
RealtimeTruncationRetentionRatio
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1052739, "end": 1053135 }
class ____(sgqlc.types.Type): """An edge in a connection.""" __schema__ = github_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") """A cursor for use in pagination.""" node = sgqlc.types.Field("VerifiableDomain", graphq...
VerifiableDomainEdge
python
astropy__astropy
astropy/coordinates/sky_coordinate.py
{ "start": 1372, "end": 78914 }
class ____(MaskableShapedLikeNDArray): """High-level object providing a flexible interface for celestial coordinate representation, manipulation, and transformation between systems. The |SkyCoord| class accepts a wide variety of inputs for initialization. At a minimum these must provide one or more cel...
SkyCoord
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/roots/mutation.py
{ "start": 19782, "end": 20555 }
class ____(graphene.Mutation): """Terminates a run.""" Output = graphene.NonNull(GrapheneTerminateRunResult) class Arguments: runId = graphene.NonNull(graphene.String) terminatePolicy = graphene.Argument(GrapheneTerminateRunPolicy) class Meta: name = "TerminateRunMutation" ...
GrapheneTerminateRunMutation
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/unpack1.py
{ "start": 131, "end": 942 }
class ____: ... a = [1, "hello", 3.4, Class1()] b = [*a] def int_only(a: int): ... for c in b: if not isinstance(c, (float, str)): # This should generate an error because c can # be an int or foo. int_only(c) if not isinstance(c, Class1): # This should not generat...
Class2
python
pyparsing__pyparsing
examples/simpleBool.py
{ "start": 1225, "end": 1617 }
class ____: repr_symbol: str = "" eval_fn: Callable[ [Iterable[bool]], bool ] = lambda _: False def __init__(self, t): self.args = t[0][0::2] def __str__(self) -> str: sep = f" {self.repr_symbol} " return f"({sep.join(map(str, self.args))})" def __bool__(self) ...
BoolBinOp